2 #define exec_op glue(exec_, OP)
3 #define exec_opl glue(glue(exec_, OP), l)
4 #define exec_opw glue(glue(exec_, OP), w)
5 #define exec_opb glue(glue(exec_, OP), b)
10 #define EXECSHIFT(size, res, s1, s2, flags) \
13 stringify(OP) size " %" size "2, %" size "0\n\t" \
16 : "=g" (res), "=g" (flags)\
17 : "r" (s1), "0" (res), "1" (flags));
19 #define EXECSHIFT(size, res, s1, s2, flags) \
22 stringify(OP) size " %%cl, %" size "0\n\t" \
25 : "=q" (res), "=g" (flags)\
26 : "c" (s1), "0" (res), "1" (flags));
29 void exec_opl(int s2
, int s0
, int s1
, int iflags
)
34 EXECSHIFT("", res
, s1
, s2
, flags
);
35 /* overflow is undefined if count != 1 */
38 printf("%-10s A=%08x B=%08x R=%08x CCIN=%04x CC=%04x\n",
39 stringify(OP
) "l", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
42 void exec_opw(int s2
, int s0
, int s1
, int iflags
)
47 EXECSHIFT("w", res
, s1
, s2
, flags
);
48 /* overflow is undefined if count != 1 */
51 printf("%-10s A=%08x B=%08x R=%08x CCIN=%04x CC=%04x\n",
52 stringify(OP
) "w", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
56 #define EXECSHIFT(size, res, s1, s2, flags) \
59 stringify(OP) size " %%cl, %" size "5, %" size "0\n\t" \
62 : "=g" (res), "=g" (flags)\
63 : "c" (s1), "0" (res), "1" (flags), "r" (s2));
65 void exec_opl(int s2
, int s0
, int s1
, int iflags
)
70 EXECSHIFT("", res
, s1
, s2
, flags
);
71 /* overflow is undefined if count != 1 */
74 printf("%-10s A=%08x B=%08x C=%08x R=%08x CCIN=%04x CC=%04x\n",
75 stringify(OP
) "l", s0
, s2
, s1
, res
, iflags
, flags
& CC_MASK
);
78 void exec_opw(int s2
, int s0
, int s1
, int iflags
)
83 EXECSHIFT("w", res
, s1
, s2
, flags
);
84 /* overflow is undefined if count != 1 */
87 printf("%-10s A=%08x B=%08x C=%08x R=%08x CCIN=%04x CC=%04x\n",
88 stringify(OP
) "w", s0
, s2
, s1
, res
, iflags
, flags
& CC_MASK
);
94 void exec_opb(int s0
, int s1
, int iflags
)
99 EXECSHIFT("b", res
, s1
, 0, flags
);
100 /* overflow is undefined if count != 1 */
103 printf("%-10s A=%08x B=%08x R=%08x CCIN=%04x CC=%04x\n",
104 stringify(OP
) "b", s0
, s1
, res
, iflags
, flags
& CC_MASK
);
108 void exec_op(int s2
, int s0
, int s1
)
110 int o
,s
,z
,a
,c
,p
,flags_in
;
111 for (o
= 0; o
< 2; o
++) {
112 for (s
= 0; s
< 2; s
++) {
113 for (z
= 0; z
< 2; z
++) {
114 for (a
= 0; a
< 2; a
++) {
115 for (c
= 0; c
< 2; c
++) {
116 for (p
= 0; p
< 2; p
++) {
118 flags_in
= (o
? CC_O
: 0)
125 exec_opl(s2
, s0
, s1
, flags_in
);
128 exec_opw(s2
, s0
, s1
, flags_in
);
130 exec_opw(s2
, s0
, s1
, flags_in
);
133 exec_opb(s0
, s1
, flags_in
);
136 exec_opl(s2
, s0
, s1
, flags_in
);
137 exec_opw(s2
, s0
, s1
, flags_in
);
138 exec_opb(s0
, s1
, flags_in
);
145 void glue(test_
, OP
)(void)
148 for(i
= 0; i
< 32; i
++)
149 exec_op(0x21ad3d34, 0x12345678, i
);
150 for(i
= 0; i
< 32; i
++)
151 exec_op(0x813f3421, 0x82345678, i
);
154 void *glue(_test_
, OP
) __init_call
= glue(test_
, OP
);