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)
8 #define EXECOP2(size, rsize, res, s1, flags) \
11 stringify(OP) size " %" rsize "2, %" rsize "0\n\t" \
14 : "=q" (res), "=g" (flags)\
15 : "q" (s1), "0" (res), "1" (flags)); \
16 printf("%-10s A=" FMTLX " B=" FMTLX " R=" FMTLX " CCIN=%04lx CC=%04lx\n", \
17 stringify(OP) size, s0, s1, res, iflags, flags & CC_MASK);
19 #define EXECOP1(size, rsize, res, flags) \
22 stringify(OP) size " %" rsize "0\n\t" \
25 : "=q" (res), "=g" (flags)\
26 : "0" (res), "1" (flags)); \
27 printf("%-10s A=" FMTLX " R=" FMTLX " CCIN=%04lx CC=%04lx\n", \
28 stringify(OP) size, s0, res, iflags, flags & CC_MASK);
31 #if defined(__x86_64__)
32 void exec_opq(long s0
, long s1
, long iflags
)
37 EXECOP1("q", "", res
, flags
);
41 void exec_opl(long s0
, long s1
, long iflags
)
46 EXECOP1("l", "k", res
, flags
);
49 void exec_opw(long s0
, long s1
, long iflags
)
54 EXECOP1("w", "w", res
, flags
);
57 void exec_opb(long s0
, long s1
, long iflags
)
62 EXECOP1("b", "b", res
, flags
);
65 #if defined(__x86_64__)
66 void exec_opq(long s0
, long s1
, long iflags
)
71 EXECOP2("q", "", res
, s1
, flags
);
75 void exec_opl(long s0
, long s1
, long iflags
)
80 EXECOP2("l", "k", res
, s1
, flags
);
83 void exec_opw(long s0
, long s1
, long iflags
)
88 EXECOP2("w", "w", res
, s1
, flags
);
91 void exec_opb(long s0
, long s1
, long iflags
)
96 EXECOP2("b", "b", res
, s1
, flags
);
100 void exec_op(long s0
, long s1
)
104 #if defined(__x86_64__)
111 #if defined(__x86_64__)
112 exec_opq(s0
, s1
, CC_C
);
114 exec_opl(s0
, s1
, CC_C
);
115 exec_opw(s0
, s1
, CC_C
);
116 exec_opb(s0
, s1
, CC_C
);
120 void glue(test_
, OP
)(void)
122 exec_op(0x12345678, 0x812FADA);
123 exec_op(0x12341, 0x12341);
124 exec_op(0x12341, -0x12341);
125 exec_op(0xffffffff, 0);
126 exec_op(0xffffffff, -1);
127 exec_op(0xffffffff, 1);
128 exec_op(0xffffffff, 2);
129 exec_op(0x7fffffff, 0);
130 exec_op(0x7fffffff, 1);
131 exec_op(0x7fffffff, -1);
132 exec_op(0x80000000, -1);
133 exec_op(0x80000000, 1);
134 exec_op(0x80000000, -2);
135 exec_op(0x12347fff, 0);
136 exec_op(0x12347fff, 1);
137 exec_op(0x12347fff, -1);
138 exec_op(0x12348000, -1);
139 exec_op(0x12348000, 1);
140 exec_op(0x12348000, -2);
141 exec_op(0x12347f7f, 0);
142 exec_op(0x12347f7f, 1);
143 exec_op(0x12347f7f, -1);
144 exec_op(0x12348080, -1);
145 exec_op(0x12348080, 1);
146 exec_op(0x12348080, -2);
149 void *glue(_test_
, OP
) __init_call
= glue(test_
, OP
);