FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / bfp-4.c
blob02315b6f9ddbbe5ad572b011763a44093202a19e
1 #include <stdio.h>
3 static const char *const cmp_result_str[] = {
4 "==", "<", ">", "??"
5 };
7 #define TEST_CxB(insn, fmt, mode, v1, v2) \
8 do { \
9 int cc; \
11 __asm__ volatile(insn " %[r1],%[r2]\n\t" \
12 "ipm %[psw]\n\t" \
13 "srl %[psw],28\n\t" \
14 : [psw]"=d"(cc) \
15 : [r1]"f"(v1), [r2]mode(v2) \
16 : "cc"); \
17 printf("%-6s" fmt " %s " fmt "\n", \
18 insn ":", v1, cmp_result_str[cc], v2); \
19 } while (0)
21 /* Test BFP comparison for 32/64/128-bit. */
23 static void cebr(float a, float b)
25 TEST_CxB("cebr", "%g", "f", a, b);
28 static void ceb(float a, float b)
30 TEST_CxB("ceb", "%g", "R", a, b);
33 static void cdbr(double a, double b)
35 TEST_CxB("cdbr", "%g", "f", a, b);
38 static void cdb(double a, double b)
40 TEST_CxB("cdb", "%g", "R", a, b);
43 static void cxbr(long double a, long double b)
45 TEST_CxB("cxbr", "%Lg", "f", a, b);
48 static void kebr(float a, float b)
50 TEST_CxB("kebr", "%g", "f", a, b);
53 static void keb(float a, float b)
55 TEST_CxB("keb", "%g", "R", a, b);
58 static void kdbr(double a, double b)
60 TEST_CxB("kdbr", "%g", "f", a, b);
63 static void kdb(double a, double b)
65 TEST_CxB("kdb", "%g", "R", a, b);
68 static void kxbr(long double a, long double b)
70 TEST_CxB("kxbr", "%Lg", "f", a, b);
73 static void do_compare(float a, float b)
75 cebr(a, b);
76 ceb(a, b);
77 kebr(a, b);
78 keb(a, b);
79 cdbr((double) a, (double) b);
80 cdb((double) a, (double) b);
81 kdbr((double) a, (double) b);
82 kdb((double) a, (double) b);
83 cxbr((long double) a, (long double) b);
84 kxbr((long double) a, (long double) b);
87 int main(void)
89 float inf = 1.f / 0.;
90 float neg_inf = -1.f / 0.;
92 do_compare(3.14f, 3.14f);
93 do_compare(-2.78f, 2.78f);
94 do_compare(inf, inf);
95 do_compare(inf, neg_inf);
96 do_compare(neg_inf, neg_inf);
97 do_compare(inf, 1.f);
98 do_compare(neg_inf, -1.f);
99 do_compare(1.f / inf, -1.f / inf);
100 return 0;