Statistics
| Branch: | Revision:

root / tests / test-i386-muldiv.h @ 076d2471

History | View | Annotate | Download (2.1 kB)

1 d57c4e01 bellard
2 5fafdf24 ths
void glue(glue(test_, OP), b)(long op0, long op1)
3 d57c4e01 bellard
{
4 776f2227 bellard
    long 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 5fafdf24 ths
         stringify(OP)"b %b2\n\t"
12 d57c4e01 bellard
         "pushf\n\t"
13 776f2227 bellard
         "pop %1\n\t"
14 d57c4e01 bellard
         : "=a" (res), "=g" (flags)
15 d57c4e01 bellard
         : "q" (s1), "0" (res), "1" (flags));
16 776f2227 bellard
    printf("%-10s A=" FMTLX " B=" FMTLX " R=" FMTLX " CC=%04lx\n",
17 d57c4e01 bellard
           stringify(OP) "b", s0, s1, res, flags & CC_MASK);
18 d57c4e01 bellard
}
19 d57c4e01 bellard
20 5fafdf24 ths
void glue(glue(test_, OP), w)(long op0h, long op0, long op1)
21 d57c4e01 bellard
{
22 776f2227 bellard
    long 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 5fafdf24 ths
         stringify(OP) "w %w3\n\t"
30 d57c4e01 bellard
         "pushf\n\t"
31 776f2227 bellard
         "pop %1\n\t"
32 d57c4e01 bellard
         : "=a" (res), "=g" (flags), "=d" (resh)
33 d57c4e01 bellard
         : "q" (s1), "0" (res), "1" (flags), "2" (resh));
34 776f2227 bellard
    printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n",
35 d57c4e01 bellard
           stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK);
36 d57c4e01 bellard
}
37 d57c4e01 bellard
38 5fafdf24 ths
void glue(glue(test_, OP), l)(long op0h, long op0, long op1)
39 d57c4e01 bellard
{
40 776f2227 bellard
    long 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 5fafdf24 ths
         stringify(OP) "l %k3\n\t"
48 d57c4e01 bellard
         "pushf\n\t"
49 776f2227 bellard
         "pop %1\n\t"
50 d57c4e01 bellard
         : "=a" (res), "=g" (flags), "=d" (resh)
51 d57c4e01 bellard
         : "q" (s1), "0" (res), "1" (flags), "2" (resh));
52 776f2227 bellard
    printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n",
53 d57c4e01 bellard
           stringify(OP) "l", op0h, op0, s1, resh, res, flags & CC_MASK);
54 d57c4e01 bellard
}
55 d57c4e01 bellard
56 776f2227 bellard
#if defined(__x86_64__)
57 5fafdf24 ths
void glue(glue(test_, OP), q)(long op0h, long op0, long op1)
58 776f2227 bellard
{
59 776f2227 bellard
    long res, s1, flags, resh;
60 776f2227 bellard
    s1 = op1;
61 776f2227 bellard
    resh = op0h;
62 776f2227 bellard
    res = op0;
63 776f2227 bellard
    flags = 0;
64 776f2227 bellard
    asm ("push %5\n\t"
65 776f2227 bellard
         "popf\n\t"
66 5fafdf24 ths
         stringify(OP) "q %3\n\t"
67 776f2227 bellard
         "pushf\n\t"
68 776f2227 bellard
         "pop %1\n\t"
69 776f2227 bellard
         : "=a" (res), "=g" (flags), "=d" (resh)
70 776f2227 bellard
         : "q" (s1), "0" (res), "1" (flags), "2" (resh));
71 776f2227 bellard
    printf("%-10s AH=" FMTLX " AL=" FMTLX " B=" FMTLX " RH=" FMTLX " RL=" FMTLX " CC=%04lx\n",
72 776f2227 bellard
           stringify(OP) "q", op0h, op0, s1, resh, res, flags & CC_MASK);
73 776f2227 bellard
}
74 776f2227 bellard
#endif
75 776f2227 bellard
76 d57c4e01 bellard
#undef OP