xref: /openbmc/qemu/tests/tcg/xtensa/test_fp1.S (revision 0a553c58)
1#include "macros.inc"
2
3test_suite fp1
4
5#if XCHAL_HAVE_FP
6
7.macro movfp fr, v
8    movi    a2, \v
9    wfr     \fr, a2
10.endm
11
12.macro test_ord_ex op, br, fr0, fr1, v0, v1, r
13    movi    a2, 0
14    wur     a2, fsr
15    movfp   \fr0, \v0
16    movfp   \fr1, \v1
17    \op     \br, \fr0, \fr1
18    movi    a2, 0
19    movi    a3, 1
20    movt    a2, a3, \br
21    assert  eqi, a2, \r
22    rur     a2, fsr
23    assert  eqi, a2, 0
24.endm
25
26.macro test_ord op, br, fr0, fr1, v0, v1, r
27    movi    a2, 0
28    wur     a2, fcr
29    test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r
30    movi    a2, 0x7c
31    wur     a2, fcr
32    test_ord_ex \op, \br, \fr0, \fr1, \v0, \v1, \r
33.endm
34
35.macro test_ord_all op, aa, ab, ba, aPI, PIa, aN, Na, II, IN, NI
36    test_ord \op  b0,  f0,  f1, 0x3f800000, 0x3f800000, \aa
37    test_ord \op  b1,  f2,  f3, 0x3f800000, 0x3fc00000, \ab
38    test_ord \op  b2,  f4,  f5, 0x3fc00000, 0x3f800000, \ba
39    test_ord \op  b3,  f6,  f7, 0x3f800000, 0x7f800000, \aPI
40    test_ord \op  b4,  f8,  f9, 0x7f800000, 0x3f800000, \PIa
41    test_ord \op  b5, f10, f11, 0x3f800000, 0xffc00001, \aN
42    test_ord \op  b6, f12, f13, 0x3f800000, 0xff800001, \aN
43    test_ord \op  b7, f14, f15, 0x3f800000, 0x7f800001, \aN
44    test_ord \op  b8,  f0,  f1, 0x3f800000, 0x7fc00000, \aN
45    test_ord \op  b9,  f2,  f3, 0xffc00001, 0x3f800000, \Na
46    test_ord \op b10,  f4,  f5, 0xff800001, 0x3f800000, \Na
47    test_ord \op b11,  f6,  f7, 0x7f800001, 0x3f800000, \Na
48    test_ord \op b12,  f8,  f9, 0x7fc00000, 0x3f800000, \Na
49    test_ord \op b13, f10, f11, 0x7f800000, 0x7f800000, \II
50    test_ord \op b14, f12, f13, 0x7f800000, 0x7fc00000, \IN
51    test_ord \op b15, f14, f15, 0x7fc00000, 0x7f800000, \NI
52.endm
53
54test un_s
55    movi    a2, 1
56    wsr     a2, cpenable
57    test_ord_all un.s, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1
58test_end
59
60test oeq_s
61    test_ord_all oeq.s, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0
62test_end
63
64test ueq_s
65    test_ord_all ueq.s, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1
66test_end
67
68test olt_s
69    test_ord_all olt.s, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0
70test_end
71
72test ult_s
73    test_ord_all ult.s, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1
74test_end
75
76test ole_s
77    test_ord_all ole.s, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0
78test_end
79
80test ule_s
81    test_ord_all ule.s, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1
82test_end
83
84.macro test_cond op, fr0, fr1, cr, v0, v1, r
85    movfp   \fr0, \v0
86    movfp   \fr1, \v1
87    \op     \fr0, \fr1, \cr
88    rfr     a2, \fr0
89    movi    a3, \r
90    assert  eq, a2, a3
91.endm
92
93test moveqz_s
94    movi    a3, 0
95    test_cond moveqz.s, f0, f1, a3, 0, 0x3f800000, 0x3f800000
96    movi    a3, 1
97    test_cond moveqz.s, f0, f1, a3, 0, 0x3f800000, 0
98test_end
99
100test movnez_s
101    movi    a3, 0
102    test_cond movnez.s, f0, f1, a3, 0, 0x3f800000, 0
103    movi    a3, 1
104    test_cond movnez.s, f0, f1, a3, 0, 0x3f800000, 0x3f800000
105test_end
106
107test movltz_s
108    movi    a3, -1
109    test_cond movltz.s, f0, f1, a3, 0, 0x3f800000, 0x3f800000
110    movi    a3, 0
111    test_cond movltz.s, f0, f1, a3, 0, 0x3f800000, 0
112    movi    a3, 1
113    test_cond movltz.s, f0, f1, a3, 0, 0x3f800000, 0
114test_end
115
116test movgez_s
117    movi    a3, -1
118    test_cond movgez.s, f0, f1, a3, 0, 0x3f800000, 0
119    movi    a3, 0
120    test_cond movgez.s, f0, f1, a3, 0, 0x3f800000, 0x3f800000
121    movi    a3, 1
122    test_cond movgez.s, f0, f1, a3, 0, 0x3f800000, 0x3f800000
123test_end
124
125test movf_s
126    olt.s   b0, f0, f0
127    test_cond movf.s, f0, f1, b0, 0, 0x3f800000, 0x3f800000
128    ueq.s   b0, f0, f0
129    test_cond movf.s, f0, f1, b0, 0, 0x3f800000, 0
130test_end
131
132test movt_s
133    ueq.s   b0, f0, f0
134    test_cond movt.s, f0, f1, b0, 0, 0x3f800000, 0x3f800000
135    olt.s   b0, f0, f0
136    test_cond movt.s, f0, f1, b0, 0, 0x3f800000, 0
137test_end
138
139#endif
140
141test_suite_end
142