]> git.proxmox.com Git - rustc.git/blame - src/libcompiler_builtins/compiler-rt/test/builtins/Unit/gedf2vfp_test.c
New upstream version 1.28.0+dfsg1
[rustc.git] / src / libcompiler_builtins / compiler-rt / test / builtins / Unit / gedf2vfp_test.c
CommitLineData
2c00a5a8
XL
1// RUN: %clang_builtins %s %librt -o %t && %run %t
2
1a4d82fc
JJ
3//===-- gedf2vfp_test.c - Test __gedf2vfp ---------------------------------===//
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 __gedf2vfp for the compiler_rt library.
13//
14//===----------------------------------------------------------------------===//
15
16#include <stdlib.h>
17#include <stdint.h>
18#include <stdio.h>
19#include <math.h>
20
21
22extern int __gedf2vfp(double a, double b);
23
2c00a5a8 24#if __arm__ && __VFP_FP__
1a4d82fc
JJ
25int test__gedf2vfp(double a, double b)
26{
27 int actual = __gedf2vfp(a, b);
28 int expected = (a >= b) ? 1 : 0;
29 if (actual != expected)
30 printf("error in __gedf2vfp(%f, %f) = %d, expected %d\n",
31 a, b, actual, expected);
32 return actual != expected;
33}
34#endif
35
36int main()
37{
2c00a5a8 38#if __arm__ && __VFP_FP__
1a4d82fc
JJ
39 if (test__gedf2vfp(0.0, 0.0))
40 return 1;
41 if (test__gedf2vfp(1.0, 0.0))
42 return 1;
43 if (test__gedf2vfp(-1.0, -2.0))
44 return 1;
45 if (test__gedf2vfp(-2.0, -1.0))
46 return 1;
47 if (test__gedf2vfp(HUGE_VAL, 1.0))
48 return 1;
49 if (test__gedf2vfp(1.0, HUGE_VAL))
50 return 1;
51#else
52 printf("skipped\n");
53#endif
54 return 0;
55}