2 #define exec_op glue(exec_, OP)
3 #define exec_opq glue(glue(exec_, OP), q)
4 #define exec_opl glue(glue(exec_, OP), l)
5 #define exec_opw glue(glue(exec_, OP), w)
6 #define exec_opb glue(glue(exec_, OP), b)
11 #define EXECSHIFT(size, res, s1, s2, flags) \
14 stringify(OP) size " %" size "2, %" size "0\n\t" \
17 : "=g" (res), "=g" (flags)\
18 : "r" (s1), "0" (res), "1" (flags));
20 #define EXECSHIFT(size, res, s1, s2, flags) \
23 stringify(OP) size " %%cl, %" size "0\n\t" \
26 : "=q" (res), "=g" (flags)\
27 : "c" (s1), "0" (res), "1" (flags));
30 void exec_opq(int64 s2
, int64 s0
, int64 s1
, int64 iflags
)
35 EXECSHIFT("q", res
, s1
, s2
, flags
);
36 /* overflow is undefined if count != 1 */
39 printf("%-10s A=%016llx B=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
40 stringify(OP
) "q", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
43 void exec_opl(int64 s2
, int64 s0
, int64 s1
, int64 iflags
)
48 EXECSHIFT("", res
, s1
, s2
, flags
);
49 /* overflow is undefined if count != 1 */
52 printf("%-10s A=%016llx B=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
53 stringify(OP
) "l", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
56 void exec_opw(int64 s2
, int64 s0
, int64 s1
, int64 iflags
)
61 EXECSHIFT("w", res
, s1
, s2
, flags
);
62 /* overflow is undefined if count != 1 */
65 printf("%-10s A=%016llx B=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
66 stringify(OP
) "w", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
70 #define EXECSHIFT(size, res, s1, s2, flags) \
73 stringify(OP) size " %%cl, %" size "5, %" size "0\n\t" \
76 : "=g" (res), "=g" (flags)\
77 : "c" (s1), "0" (res), "1" (flags), "r" (s2));
79 void exec_opl(int64 s2
, int64 s0
, int64 s1
, int64 iflags
)
84 EXECSHIFT("", res
, s1
, s2
, flags
);
85 /* overflow is undefined if count != 1 */
88 printf("%-10s A=%016llx B=%016llx C=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
89 stringify(OP
) "l", s0
, s2
, s1
, res
, iflags
, flags
& CC_MASK
);
92 void exec_opw(int64 s2
, int64 s0
, int64 s1
, int64 iflags
)
97 EXECSHIFT("w", res
, s1
, s2
, flags
);
98 /* overflow is undefined if count != 1 */
101 printf("%-10s A=%016llx B=%016llx C=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
102 stringify(OP
) "w", s0
, s2
, s1
, res
, iflags
, flags
& CC_MASK
);
108 void exec_opb(int64 s0
, int64 s1
, int64 iflags
)
113 EXECSHIFT("b", res
, s1
, 0, flags
);
114 /* overflow is undefined if count != 1 */
117 printf("%-10s A=%016llx B=%016llx R=%016llx CCIN=%04llx CC=%04llx\n",
118 stringify(OP
) "b", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
122 void exec_op(int64 s2
, int64 s0
, int64 s1
)
124 int64 o
,s
,z
,a
,c
,p
,flags_in
;
125 for (o
= 0; o
< 2; o
++) {
126 for (s
= 0; s
< 2; s
++) {
127 for (z
= 0; z
< 2; z
++) {
128 for (a
= 0; a
< 2; a
++) {
129 for (c
= 0; c
< 2; c
++) {
130 for (p
= 0; p
< 2; p
++) {
132 flags_in
= (o
? CC_O
: 0)
139 exec_opq(s2
, s0
, s1
, flags_in
);
141 exec_opl(s2
, s0
, s1
, flags_in
);
144 exec_opw(s2
, s0
, s1
, flags_in
);
146 exec_opw(s2
, s0
, s1
, flags_in
);
149 exec_opb(s0
, s1
, flags_in
);
152 exec_opq(s2
, s0
, s1
, flags_in
);
153 exec_opl(s2
, s0
, s1
, flags_in
);
154 exec_opw(s2
, s0
, s1
, flags_in
);
155 exec_opb(s0
, s1
, flags_in
);
162 void glue(test_
, OP
)(void)
165 for(i
= 0; i
< 64; i
++)
166 exec_op(0x3141592721ad3d34, 0x2718284612345678, i
);
167 for(i
= 0; i
< 64; i
++)
168 exec_op(0x31415927813f3421, 0x2718284682345678, i
);
171 void *glue(_test_
, OP
) __init_call
= glue(test_
, OP
);