3 static const char *const cmp_result_str
[] = {
7 #define TEST_CxB(insn, fmt, mode, v1, v2) \
11 __asm__ volatile(insn " %[r1],%[r2]\n\t" \
15 : [r1]"f"(v1), [r2]mode(v2) \
17 printf("%-6s" fmt " %s " fmt "\n", \
18 insn ":", v1, cmp_result_str[cc], v2); \
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
)
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
);
90 float neg_inf
= -1.f
/ 0.;
92 do_compare(3.14f
, 3.14f
);
93 do_compare(-2.78f
, 2.78f
);
95 do_compare(inf
, neg_inf
);
96 do_compare(neg_inf
, neg_inf
);
98 do_compare(neg_inf
, -1.f
);
99 do_compare(1.f
/ inf
, -1.f
/ inf
);