1 //===------------ unordtf2_test.c - Test __unordtf2------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file tests __unordtf2 for the compiler_rt library.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include <stdio.h>
15 
16 #if __LP64__ && __LDBL_MANT_DIG__ == 113
17 
18 #include "fp_test.h"
19 
20 int __unordtf2(long double a, long double b);
21 
test__unordtf2(long double a,long double b,enum EXPECTED_RESULT expected)22 int test__unordtf2(long double a, long double b, enum EXPECTED_RESULT expected)
23 {
24     int x = __unordtf2(a, b);
25     int ret = compareResultCMP(x, expected);
26 
27     if (ret){
28         printf("error in test__unordtf2(%.20Lf, %.20Lf) = %d, "
29                "expected %s\n", a, b, x, expectedStr(expected));
30     }
31     return ret;
32 }
33 
34 char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};
35 
36 #endif
37 
main()38 int main()
39 {
40 #if __LP64__ && __LDBL_MANT_DIG__ == 113
41     // NaN
42     if (test__unordtf2(makeQNaN128(),
43                        0x1.234567890abcdef1234567890abcp+3L,
44                        NEQUAL_0))
45         return 1;
46     // other
47     if (test__unordtf2(0x1.234567890abcdef1234567890abcp+3L,
48                        0x1.334567890abcdef1234567890abcp+3L,
49                        EQUAL_0))
50         return 1;
51     if (test__unordtf2(0x1.234567890abcdef1234567890abcp+3L,
52                        0x1.234567890abcdef1234567890abcp+3L,
53                        EQUAL_0))
54         return 1;
55     if (test__unordtf2(0x1.234567890abcdef1234567890abcp+3L,
56                        0x1.234567890abcdef1234567890abcp-3L,
57                        EQUAL_0))
58         return 1;
59 
60 #else
61     printf("skipped\n");
62 
63 #endif
64     return 0;
65 }
66