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 exec_opl(s2, s0, s1, 0);
113 exec_opw(s2, s0, s1, 0);
115 exec_opw(s2, s0, s1, 0);
121 exec_opl(s2, s0, s1, CC_C);
122 exec_opw(s2, s0, s1, CC_C);
123 exec_opb(s0, s1, CC_C);
127 void glue(test_, OP)(void)
130 for(i = 0; i < 32; i++)
131 exec_op(0x21ad3d34, 0x12345678, i);
132 for(i = 0; i < 32; i++)
133 exec_op(0x813f3421, 0x82345678, i);
136 void *glue(_test_, OP) __init_call = glue(test_, OP);