]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/floatsidfvfp_test.c
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / builtins / Unit / floatsidfvfp_test.c
CommitLineData
2c00a5a8 1// RUN: %clang_builtins %s %librt -o %t && %run %t
1a4d82fc
JJ
2//===-- floatsidfvfp_test.c - Test __floatsidfvfp -------------------------===//
3//
4// The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10//
11// This file tests __floatsidfvfp for the compiler_rt library.
12//
13//===----------------------------------------------------------------------===//
14
92a42be0 15#include "int_lib.h"
1a4d82fc
JJ
16#include <stdio.h>
17#include <stdlib.h>
18#include <math.h>
19
20
92a42be0 21extern COMPILER_RT_ABI double __floatsidfvfp(int a);
1a4d82fc 22
2c00a5a8 23#if __arm__ && __VFP_FP__
1a4d82fc
JJ
24int test__floatsidfvfp(int a)
25{
26 double actual = __floatsidfvfp(a);
27 double expected = a;
28 if (actual != expected)
29 printf("error in test__ floatsidfvfp(%d) = %f, expected %f\n",
30 a, actual, expected);
31 return actual != expected;
32}
33#endif
34
35int main()
36{
2c00a5a8 37#if __arm__ && __VFP_FP__
1a4d82fc
JJ
38 if (test__floatsidfvfp(0))
39 return 1;
40 if (test__floatsidfvfp(1))
41 return 1;
42 if (test__floatsidfvfp(-1))
43 return 1;
44 if (test__floatsidfvfp(0x7FFFFFFF))
45 return 1;
46 if (test__floatsidfvfp(0x80000000))
47 return 1;
48#else
49 printf("skipped\n");
50#endif
51 return 0;
52}