]> git.proxmox.com Git - rustc.git/blob - 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
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
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
15 #include "int_lib.h"
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <math.h>
19
20
21 extern COMPILER_RT_ABI double __floatsidfvfp(int a);
22
23 #if __arm__ && __VFP_FP__
24 int 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
35 int main()
36 {
37 #if __arm__ && __VFP_FP__
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 }