1 #include <stdio.h>
2 #include "macro_fpu.h"
3 
main()4 int main()
5 {
6 #if defined(__mips_hard_float)
7    int i = 0;
8 
9    printf("--- BC1F ---  if fs == ft then " \
10           "out = ft else out = fs + ft\n");
11    for (i = 0; i < MAX_ARR; i++) {
12       TESTINST1s("bc1f", i);
13       TESTINST1d("bc1f", i);
14    }
15 
16    printf("--- BC1T ---  if fs != ft then " \
17           "out = fs + ft else out = ft\n");
18    for (i = 0; i < MAX_ARR; i++) {
19       TESTINST1s("bc1t", i);
20       TESTINST1d("bc1t", i);
21    }
22 
23    printf("--- BC1FL ---  if fs == ft then " \
24           "out = ft else out = fs + ft\n");
25    for (i = 0; i < MAX_ARR; i++) {
26       TESTINST2s("bc1fl", i);
27       TESTINST2d("bc1fl", i);
28    }
29 
30    printf("--- BC1TL ---  if fs != ft then " \
31           "out = ft else out = fs + ft\n");
32    for (i = 0; i < MAX_ARR; i++) {
33       TESTINST2s("bc1tl", i);
34       TESTINST2d("bc1tl", i);
35    }
36 
37    printf("--- C.F.S/D ---  if false then " \
38           "out = fs + ft else out = fs\n");
39    for (i = 0; i < MAX_ARR; i++) {
40       TESTINST_CONDs("c.f.s", i);
41       TESTINST_CONDd("c.f.d", i);
42    }
43 
44    printf("--- C.UN.S/D ---  if unordered(fs, ft) then " \
45           "out = fs + ft else out = fs\n");
46    for (i = 0; i < MAX_ARR; i++) {
47       TESTINST_CONDs("c.un.s", i);
48       TESTINST_CONDd("c.un.d", i);
49    }
50 
51    printf("--- C.EQ.S/D ---  if fs == ft then " \
52           "out = fs + ft else out = fs\n");
53    for (i = 0; i < MAX_ARR; i++) {
54       TESTINST_CONDs("c.eq.s", i);
55       TESTINST_CONDd("c.eq.d", i);
56    }
57 
58    printf("--- C.UEQ.S/D ---  if (unordered(fs, ft) or (fs == ft)) then " \
59           "out = fs + ft else out = fs\n");
60    for (i = 0; i < MAX_ARR; i++) {
61       TESTINST_CONDs("c.ueq.s", i);
62       TESTINST_CONDd("c.ueq.d", i);
63    }
64 
65    printf("--- C.OLT.S/D ---  if (ordered(fs, ft) or (fs < ft)) then " \
66           "out = fs + ft else out = fs\n");
67    for (i = 0; i < MAX_ARR; i++) {
68       TESTINST_CONDs("c.olt.s", i);
69       TESTINST_CONDd("c.olt.d", i);
70    }
71 
72    printf("--- C.ULT.S/D ---  if (unordered(fs, ft) or (fs < ft)) then " \
73           "out = fs + ft else out = fs\n");
74    for (i = 0; i < MAX_ARR; i++) {
75       TESTINST_CONDs("c.ult.s", i);
76       TESTINST_CONDd("c.ult.d", i);
77    }
78 
79    printf("--- C.OLE.S/D ---  if (ordered(fs, ft) or (fs <= ft)) then " \
80           "out = fs + ft else out = fs\n");
81    for (i = 0; i < MAX_ARR; i++) {
82       TESTINST_CONDs("c.ole.s", i);
83       TESTINST_CONDd("c.ole.d", i);
84    }
85 
86    printf("--- C.ULE.S/D ---  if (unordered(fs, ft) or (fs <= ft)) then " \
87           "out = fs + ft else out = fs\n");
88    for (i = 0; i < MAX_ARR; i++) {
89       TESTINST_CONDs("c.ule.s", i);
90       TESTINST_CONDd("c.ule.d", i);
91    }
92 
93    printf("--- C.SF.S/D ---  if signaling false then " \
94           "out = fs + ft else out = fs\n");
95    for (i = 0; i < MAX_ARR; i++) {
96       TESTINST_CONDs("c.sf.s", i);
97       TESTINST_CONDd("c.sf.d", i);
98    }
99 
100    printf("--- C.NGLE.S/D --- if not ((fs > ft) or (fs <= ft)) then " \
101           "out = fs + ft else out = fs\n");
102    for (i = 0; i < MAX_ARR; i++) {
103       TESTINST_CONDs("c.ngle.s", i);
104       TESTINST_CONDd("c.ngle.d", i);
105    }
106 
107    printf("--- C.SEQ.S/D ---  if signaling equal then " \
108           "out = fs + ft else out = fs\n");
109    for (i = 0; i < MAX_ARR; i++) {
110       TESTINST_CONDs("c.seq.s", i);
111       TESTINST_CONDd("c.seq.d", i);
112    }
113 
114    printf("--- C.NGL.S/D ---  if not ((fs > ft) or (fs < ft)) then " \
115           "out = fs + ft else out = fs\n");
116    for (i = 0; i < MAX_ARR; i++) {
117       TESTINST_CONDs("c.ngl.s", i);
118       TESTINST_CONDd("c.ngl.d", i);
119    }
120 
121    printf("--- C.LT.S/D ---  if fs < ft then " \
122           "out = fs + ft else out = fs\n");
123    for (i = 0; i < MAX_ARR; i++) {
124       TESTINST_CONDs("c.lt.s", i);
125       TESTINST_CONDd("c.lt.d", i);
126    }
127 
128    printf("--- C.NGE.S/D ---  if not (fs >= ft) then " \
129           "out = fs + ft else out = fs\n");
130    for (i = 0; i < MAX_ARR; i++) {
131       TESTINST_CONDs("c.nge.s", i);
132       TESTINST_CONDd("c.nge.d", i);
133    }
134 
135    printf("--- C.LE.S/D ---  if fs <= ft then " \
136           "out = fs + ft else out = fs\n");
137    for (i = 0; i < MAX_ARR; i++) {
138       TESTINST_CONDs("c.le.s", i);
139       TESTINST_CONDd("c.le.d", i);
140    }
141 
142    printf("--- C.NGT.S/D ---  if not (fs > ft) then " \
143           "out = fs + ft else out = fs\n");
144    for (i = 0; i < MAX_ARR; i++) {
145       TESTINST_CONDs("c.ngt.s", i);
146       TESTINST_CONDd("c.ngt.d", i);
147    }
148 #endif
149    return 0;
150 }
151 
152