Revision 776f2227 tests/test-i386-muldiv.h
b/tests/test-i386-muldiv.h | ||
---|---|---|
1 | 1 |
|
2 |
void glue(glue(test_, OP), b)(int op0, int op1)
|
|
2 |
void glue(glue(test_, OP), b)(long op0, long op1)
|
|
3 | 3 |
{ |
4 |
int res, s1, s0, flags;
|
|
4 |
long res, s1, s0, flags;
|
|
5 | 5 |
s0 = op0; |
6 | 6 |
s1 = op1; |
7 | 7 |
res = s0; |
... | ... | |
10 | 10 |
"popf\n\t" |
11 | 11 |
stringify(OP)"b %b2\n\t" |
12 | 12 |
"pushf\n\t" |
13 |
"popl %1\n\t"
|
|
13 |
"pop %1\n\t" |
|
14 | 14 |
: "=a" (res), "=g" (flags) |
15 | 15 |
: "q" (s1), "0" (res), "1" (flags)); |
16 |
printf("%-10s A=%08x B=%08x R=%08x CC=%04x\n",
|
|
16 |
printf("%-10s A=" FMTLX " B=" FMTLX " R=" FMTLX " CC=%04lx\n",
|
|
17 | 17 |
stringify(OP) "b", s0, s1, res, flags & CC_MASK); |
18 | 18 |
} |
19 | 19 |
|
20 |
void glue(glue(test_, OP), w)(int op0h, int op0, int op1)
|
|
20 |
void glue(glue(test_, OP), w)(long op0h, long op0, long op1)
|
|
21 | 21 |
{ |
22 |
int res, s1, flags, resh;
|
|
22 |
long res, s1, flags, resh;
|
|
23 | 23 |
s1 = op1; |
24 | 24 |
resh = op0h; |
25 | 25 |
res = op0; |
... | ... | |
28 | 28 |
"popf\n\t" |
29 | 29 |
stringify(OP) "w %w3\n\t" |
30 | 30 |
"pushf\n\t" |
31 |
"popl %1\n\t"
|
|
31 |
"pop %1\n\t" |
|
32 | 32 |
: "=a" (res), "=g" (flags), "=d" (resh) |
33 | 33 |
: "q" (s1), "0" (res), "1" (flags), "2" (resh)); |
34 |
printf("%-10s AH=%08x AL=%08x B=%08x RH=%08x RL=%08x CC=%04x\n",
|
|
34 |
printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n",
|
|
35 | 35 |
stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK); |
36 | 36 |
} |
37 | 37 |
|
38 |
void glue(glue(test_, OP), l)(int op0h, int op0, int op1)
|
|
38 |
void glue(glue(test_, OP), l)(long op0h, long op0, long op1)
|
|
39 | 39 |
{ |
40 |
int res, s1, flags, resh;
|
|
40 |
long res, s1, flags, resh;
|
|
41 | 41 |
s1 = op1; |
42 | 42 |
resh = op0h; |
43 | 43 |
res = op0; |
44 | 44 |
flags = 0; |
45 | 45 |
asm ("push %5\n\t" |
46 | 46 |
"popf\n\t" |
47 |
stringify(OP) "l %3\n\t" |
|
47 |
stringify(OP) "l %k3\n\t"
|
|
48 | 48 |
"pushf\n\t" |
49 |
"popl %1\n\t"
|
|
49 |
"pop %1\n\t" |
|
50 | 50 |
: "=a" (res), "=g" (flags), "=d" (resh) |
51 | 51 |
: "q" (s1), "0" (res), "1" (flags), "2" (resh)); |
52 |
printf("%-10s AH=%08x AL=%08x B=%08x RH=%08x RL=%08x CC=%04x\n",
|
|
52 |
printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n",
|
|
53 | 53 |
stringify(OP) "l", op0h, op0, s1, resh, res, flags & CC_MASK); |
54 | 54 |
} |
55 | 55 |
|
56 |
#if defined(__x86_64__) |
|
57 |
void glue(glue(test_, OP), q)(long op0h, long op0, long op1) |
|
58 |
{ |
|
59 |
long res, s1, flags, resh; |
|
60 |
s1 = op1; |
|
61 |
resh = op0h; |
|
62 |
res = op0; |
|
63 |
flags = 0; |
|
64 |
asm ("push %5\n\t" |
|
65 |
"popf\n\t" |
|
66 |
stringify(OP) "q %3\n\t" |
|
67 |
"pushf\n\t" |
|
68 |
"pop %1\n\t" |
|
69 |
: "=a" (res), "=g" (flags), "=d" (resh) |
|
70 |
: "q" (s1), "0" (res), "1" (flags), "2" (resh)); |
|
71 |
printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n", |
|
72 |
stringify(OP) "q", op0h, op0, s1, resh, res, flags & CC_MASK); |
|
73 |
} |
|
74 |
#endif |
|
75 |
|
|
56 | 76 |
#undef OP |
Also available in: Unified diff