1 #include <assert.h>
2
3 #define TEST_COMP(N) \
4 void test_##N(float fj, float fk) \
5 { \
6 int rd = 0; \
7 \
8 asm volatile("fcmp."#N".s $fcc6,%1,%2\n" \
9 "movcf2gr %0, $fcc6\n" \
10 : "=r"(rd) \
11 : "f"(fj), "f"(fk) \
12 : ); \
13 assert(rd == 1); \
14 }
15
16 TEST_COMP(ceq)
TEST_COMP(clt)17 TEST_COMP(clt)
18 TEST_COMP(cle)
19 TEST_COMP(cne)
20 TEST_COMP(seq)
21 TEST_COMP(slt)
22 TEST_COMP(sle)
23 TEST_COMP(sne)
24
25 int main()
26 {
27 test_ceq(0xff700102, 0xff700102);
28 test_clt(0x00730007, 0xff730007);
29 test_cle(0xff70130a, 0xff70130b);
30 test_cne(0x1238acde, 0xff71111f);
31 test_seq(0xff766618, 0xff766619);
32 test_slt(0xff78881c, 0xff78901d);
33 test_sle(0xff780b22, 0xff790b22);
34 test_sne(0xff7bcd25, 0xff7a26cf);
35
36 return 0;
37 }
38