11 # define ix7fe 0x7ffffffe
12 # define ix7f 0x7fffffff
13 # define ix80 0x80000000
14 # define iff 0xffffffff
15 # define ife 0xfffffffe
16 # define ifd 0xfffffffd
17 # define ifc 0xfffffffc
19 # define ix7fe 0x7ffffffffffffffe
20 # define ix7f 0x7fffffffffffffff
21 # define ix80 0x8000000000000000
22 # define iff 0xffffffffffffffff
23 # define ife 0xfffffffffffffffe
24 # define ifd 0xfffffffffffffffd
25 # define ifc 0xfffffffffffffffc
28 /* check jumps are taken and result value is correct */
29 #define bopr_t(l, u, op, r0, r1, il, ir, iv) \
32 b##op##r##u op##u##r##l##r0##r1 %r0 %r1 \
33 /* validate did jump */ \
35 op##u##r##l##r0##r1: \
36 beqi op##u##r##l##ok##r0##r1 %r0 iv \
38 op##u##r##l##ok##r0##r1:
39 #define bopi_t(l, u, op, r0, il, ir, iv) \
41 b##op##i##u op##u##i##l##r0##r1 %r0 ir \
42 /* validate did jump */ \
44 op##u##i##l##r0##r1: \
45 beqi op##u##i##l##ok##r0##r1 %r0 iv \
47 op##u##i##l##ok##r0##r1:
48 #define bopr_f(l, u, op, r0, r1, il, ir, iv) \
51 b##op##r##u op##u##r##l##r0##r1 %r0 %r1 \
52 beqi op##u##r##l##ok##r0##r1 %r0 iv \
53 op##u##r##l##r0##r1: \
55 op##u##r##l##ok##r0##r1:
56 #define bopi_f(l, u, op, r0, il, ir, iv) \
58 b##op##i##u op##u##i##l##r0##r1 %r0 ir \
59 beqi op##u##i##l##ok##r0##r1 %r0 iv \
60 op##u##i##l##r0##r1: \
62 op##u##i##l##ok##r0##r1:
63 #define ccop(cc, l, u, op, r0, r1, il, ir, iv) \
64 bopr##cc(l, u, op, r0, r1, i##il, i##ir, i##iv) \
65 bopi##cc(l, u, op, r0, i##il, i##ir, i##iv)
66 #define tadd(l, u, r0, r1, il, ir, iv) \
67 ccop(_t, l, u, oadd, r0, r1, il, ir, iv) \
68 ccop(_f, l, u, xadd, r0, r1, il, ir, iv)
69 #define fadd(l, u, r0, r1, il, ir, iv) \
70 ccop(_f, l, u, oadd, r0, r1, il, ir, iv) \
71 ccop(_t, l, u, xadd, r0, r1, il, ir, iv)
72 #define tsub(l, u, r0, r1, il, ir, iv) \
73 ccop(_t, l, u, osub, r0, r1, il, ir, iv) \
74 ccop(_f, l, u, xsub, r0, r1, il, ir, iv)
75 #define fsub(l, u, r0, r1, il, ir, iv) \
76 ccop(_f, l, u, osub, r0, r1, il, ir, iv) \
77 ccop(_t, l, u, xsub, r0, r1, il, ir, iv)
79 #define xopr6(l,op,r0,r1,r2,r3,r4,r5,llo,lhi,rlo,rhi,vlo,vhi) \
86 beqi op##l##L##r0##r1##r2##r3##r4##r5 %r0 vlo \
88 op##l##L##r0##r1##r2##r3##r4##r5: \
89 beqi op##l##H##r0##r1##r2##r3##r4##r5 %r3 vhi \
91 op##l##H##r0##r1##r2##r3##r4##r5:
92 #define xopr4_(l,op,r0,r1,r2,r3,llo,lhi,rlo,rhi,vlo,vhi) \
99 beqi op##l##L_##r0##r1##r2##r3 %r0 vlo \
101 op##l##L_##r0##r1##r2##r3: \
102 beqi op##l##H_##r0##r1##r2##r3 %r1 vhi \
104 op##l##H_##r0##r1##r2##r3:
105 #define xopr_4(l,op,r0,r1,r2,r3,llo,lhi,rlo,rhi,vlo,vhi) \
112 beqi op##l##_L##r0##r1##r2##r3 %r0 vlo \
114 op##l##_L##r0##r1##r2##r3: \
115 beqi op##l##_H##r0##r1##r2##r3 %r1 vhi \
117 op##l##_H##r0##r1##r2##r3:
119 #define xaddr(l,llo,lhi,rlo,rhi,vlo,vhi) \
120 xopr6(l,add,r0,r1,r2,v0,v1,v2,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi) \
121 xopr4_(l,add,r0,r1,r2,v0,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi) \
122 xopr_4(l,add,r0,r1,r2,v0,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi)
123 #define xsubr(l,llo,lhi,rlo,rhi,vlo,vhi) \
124 xopr6(l,sub,r0,r1,r2,v0,v1,v2,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi) \
125 xopr4_(l,sub,r0,r1,r2,v0,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi) \
126 xopr_4(l,sub,r0,r1,r2,v0,i##llo,i##lhi,i##rlo,i##rhi,i##vlo,i##vhi)
135 tadd(__LINE__, , r0, r1, x7f, x1, x80)
136 fadd(__LINE__, , r0, r1, x7fe, x1, x7f)
137 tsub(__LINE__, , r0, r1, x80, x1, x7f)
138 fsub(__LINE__, , r0, r1, x7f, x1, x7fe)
139 tadd(__LINE__, _u, r0, r1, ff, x1, x0)
140 fadd(__LINE__, _u, r0, r1, x7f, x1, x80)
141 tsub(__LINE__, _u, r0, r1, x0, x1, ff)
142 fsub(__LINE__, _u, r0, r1, x80, x1, x7f)
144 /* 0xffffffffffffffff + 1 = 0x10000000000000000 */
145 xaddr(__LINE__, ff, ff, x1, x0, x0, x0)
147 /* 1 + 0xffffffffffffffff = 0x10000000000000000 */
148 xaddr(__LINE__, x1, x0, ff, ff, x0, x0)
150 /* 0xfffffffeffffffff + 1 = 0xffffffff00000000 */
151 xaddr(__LINE__, ff, fe, x1, x0, x0, ff)
153 /* 1 + 0xfffffffeffffffff = 0xffffffff00000000 */
154 xaddr(__LINE__, x1, x0, ff, fe, x0, ff)
156 /* 0xfffffffefffffffe + 2 = 0xffffffff00000000 */
157 xaddr(__LINE__, fe, fe, x2, x0, x0, ff)
159 /* 2 + 0xfffffffefffffffe = 0xffffffff00000000 */
160 xaddr(__LINE__, x2, x0, fe, fe, x0, ff)
162 /* 0xffffffffffffffff - 1 = 0xfffffffffffffffe */
163 xsubr(__LINE__, ff, ff, x1, x0, fe, ff)
165 /* 1 - 0xffffffffffffffff = -0xfffffffffffffffe */
166 xsubr(__LINE__, x1, x0, ff, ff, x2, x0)
168 /* 0xfffffffeffffffff - 1 = 0xfffffffefffffffe */
169 xsubr(__LINE__, ff, fe, x1, x0, fe, fe)
171 /* 1 - 0xfffffffeffffffff = -0xfffffffefffffffe */
172 xsubr(__LINE__, x1, x0, ff, fe, x2, x1)
174 /* 0xfffffffefffffffe - 2 = 0xfffffffefffffffc */
175 xsubr(__LINE__, fe, fe, x2, x0, fc, fe)
177 /* 2 + 0xfffffffefffffffe = -0xfffffffefffffffc */
178 xsubr(__LINE__, x2, x0, fe, fe, x4, x1)