]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/fixsfsivfp_test.c
New upstream version 1.25.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / builtins / Unit / fixsfsivfp_test.c
CommitLineData
2c00a5a8
XL
1// RUN: %clang_builtins %s %librt -o %t && %run %t
2
1a4d82fc
JJ
3//===-- fixsfsivfp_test.c - Test __fixsfsivfp -----------------------------===//
4//
5// The LLVM Compiler Infrastructure
6//
7// This file is dual licensed under the MIT and the University of Illinois Open
8// Source Licenses. See LICENSE.TXT for details.
9//
10//===----------------------------------------------------------------------===//
11//
12// This file tests __fixsfsivfp for the compiler_rt library.
13//
14//===----------------------------------------------------------------------===//
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <math.h>
19
20
21extern int __fixsfsivfp(float a);
22
2c00a5a8 23#if __arm__ && __VFP_FP__
1a4d82fc
JJ
24int test__fixsfsivfp(float a)
25{
26 int actual = __fixsfsivfp(a);
27 int expected = a;
28 if (actual != expected)
29 printf("error in test__fixsfsivfp(%f) = %u, expected %u\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__fixsfsivfp(0.0))
39 return 1;
40 if (test__fixsfsivfp(1.0))
41 return 1;
42 if (test__fixsfsivfp(-1.0))
43 return 1;
44 if (test__fixsfsivfp(2147483647.0))
45 return 1;
46 if (test__fixsfsivfp(-2147483648.0))
47 return 1;
48 if (test__fixsfsivfp(65536.0))
49 return 1;
50#else
51 printf("skipped\n");
52#endif
53 return 0;
54}