root / tests / test-i386-muldiv.h @ a69d83b6
History | View | Annotate | Download (1.5 kB)
1 | d57c4e01 | bellard | |
---|---|---|---|
2 | d57c4e01 | bellard | void glue(glue(test_, OP), b)(int op0, int op1) |
3 | d57c4e01 | bellard | { |
4 | d57c4e01 | bellard | int res, s1, s0, flags;
|
5 | d57c4e01 | bellard | s0 = op0; |
6 | d57c4e01 | bellard | s1 = op1; |
7 | d57c4e01 | bellard | res = s0; |
8 | d57c4e01 | bellard | flags = 0;
|
9 | d57c4e01 | bellard | asm ("push %4\n\t" |
10 | d57c4e01 | bellard | "popf\n\t"
|
11 | d57c4e01 | bellard | stringify(OP)"b %b2\n\t"
|
12 | d57c4e01 | bellard | "pushf\n\t"
|
13 | d57c4e01 | bellard | "popl %1\n\t"
|
14 | d57c4e01 | bellard | : "=a" (res), "=g" (flags) |
15 | d57c4e01 | bellard | : "q" (s1), "0" (res), "1" (flags)); |
16 | d57c4e01 | bellard | printf("%-10s A=%08x B=%08x R=%08x CC=%04x\n",
|
17 | d57c4e01 | bellard | stringify(OP) "b", s0, s1, res, flags & CC_MASK);
|
18 | d57c4e01 | bellard | } |
19 | d57c4e01 | bellard | |
20 | d57c4e01 | bellard | void glue(glue(test_, OP), w)(int op0h, int op0, int op1) |
21 | d57c4e01 | bellard | { |
22 | d57c4e01 | bellard | int res, s1, flags, resh;
|
23 | d57c4e01 | bellard | s1 = op1; |
24 | d57c4e01 | bellard | resh = op0h; |
25 | d57c4e01 | bellard | res = op0; |
26 | d57c4e01 | bellard | flags = 0;
|
27 | d57c4e01 | bellard | asm ("push %5\n\t" |
28 | d57c4e01 | bellard | "popf\n\t"
|
29 | d57c4e01 | bellard | stringify(OP) "w %w3\n\t"
|
30 | d57c4e01 | bellard | "pushf\n\t"
|
31 | d57c4e01 | bellard | "popl %1\n\t"
|
32 | d57c4e01 | bellard | : "=a" (res), "=g" (flags), "=d" (resh) |
33 | d57c4e01 | bellard | : "q" (s1), "0" (res), "1" (flags), "2" (resh)); |
34 | d57c4e01 | bellard | printf("%-10s AH=%08x AL=%08x B=%08x RH=%08x RL=%08x CC=%04x\n",
|
35 | d57c4e01 | bellard | stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK);
|
36 | d57c4e01 | bellard | } |
37 | d57c4e01 | bellard | |
38 | d57c4e01 | bellard | void glue(glue(test_, OP), l)(int op0h, int op0, int op1) |
39 | d57c4e01 | bellard | { |
40 | d57c4e01 | bellard | int res, s1, flags, resh;
|
41 | d57c4e01 | bellard | s1 = op1; |
42 | d57c4e01 | bellard | resh = op0h; |
43 | d57c4e01 | bellard | res = op0; |
44 | d57c4e01 | bellard | flags = 0;
|
45 | d57c4e01 | bellard | asm ("push %5\n\t" |
46 | d57c4e01 | bellard | "popf\n\t"
|
47 | d57c4e01 | bellard | stringify(OP) "l %3\n\t"
|
48 | d57c4e01 | bellard | "pushf\n\t"
|
49 | d57c4e01 | bellard | "popl %1\n\t"
|
50 | d57c4e01 | bellard | : "=a" (res), "=g" (flags), "=d" (resh) |
51 | d57c4e01 | bellard | : "q" (s1), "0" (res), "1" (flags), "2" (resh)); |
52 | d57c4e01 | bellard | printf("%-10s AH=%08x AL=%08x B=%08x RH=%08x RL=%08x CC=%04x\n",
|
53 | d57c4e01 | bellard | stringify(OP) "l", op0h, op0, s1, resh, res, flags & CC_MASK);
|
54 | d57c4e01 | bellard | } |
55 | d57c4e01 | bellard | |
56 | d57c4e01 | bellard | #undef OP |