[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / compiler-rt / test / builtins / Unit / fixdfsivfp_test.c
blob606875c71a309032ed3af707d592201c56767452
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_fixdfsivfp
4 //===-- fixdfsivfp_test.c - Test __fixdfsivfp -----------------------------===//
5 //
6 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7 // See https://llvm.org/LICENSE.txt for license information.
8 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9 //
10 //===----------------------------------------------------------------------===//
12 // This file tests __fixdfsivfp for the compiler_rt library.
14 //===----------------------------------------------------------------------===//
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <math.h>
21 extern int __fixdfsivfp(double a);
23 #if __arm__ && __VFP_FP__
24 int test__fixdfsivfp(double a)
26 int actual = __fixdfsivfp(a);
27 int expected = a;
28 if (actual != expected)
29 printf("error in test__fixdfsivfp(%f) = %d, expected %d\n",
30 a, actual, expected);
31 return actual != expected;
33 #endif
35 int main()
37 #if __arm__ && __VFP_FP__
38 if (test__fixdfsivfp(0.0))
39 return 1;
40 if (test__fixdfsivfp(1.0))
41 return 1;
42 if (test__fixdfsivfp(-1.0))
43 return 1;
44 if (test__fixdfsivfp(2147483647))
45 return 1;
46 if (test__fixdfsivfp(-2147483648.0))
47 return 1;
48 #else
49 printf("skipped\n");
50 #endif
51 return 0;