• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
glue(glue (test_,OP),b)2 void glue(glue(test_, OP), b)(int64 op0, int64 op1)
3 {
4     int64 res, s1, s0, flags;
5     s0 = op0;
6     s1 = op1;
7     res = s0;
8     flags = 0;
9     asm ("pushq %4\n\t"
10          "popfq\n\t"
11          stringify(OP)"b %b2\n\t"
12          "pushfq\n\t"
13          "popq %1\n\t"
14          : "=a" (res), "=g" (flags)
15          : "q" (s1), "0" (res), "1" (flags));
16     xxprintf("%-10s A=%016llx B=%016llx R=%016llx CC=%04llx\n",
17            stringify(OP) "b", s0, s1, res, flags & CC_MASK);
18 }
19 
glue(glue (test_,OP),w)20 void glue(glue(test_, OP), w)(int64 op0h, int64 op0, int64 op1)
21 {
22     int64 res, s1, flags, resh;
23     s1 = op1;
24     resh = op0h;
25     res = op0;
26     flags = 0;
27     asm ("pushq %5\n\t"
28          "popfq\n\t"
29          stringify(OP) "w %w3\n\t"
30          "pushfq\n\t"
31          "popq %1\n\t"
32          : "=a" (res), "=g" (flags), "=d" (resh)
33          : "q" (s1), "0" (res), "1" (flags), "2" (resh));
34     xxprintf("%-10s AH=%016llx AL=%016llx B=%016llx RH=%016llx RL=%016llx CC=%04llx\n",
35            stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK);
36 }
37 
glue(glue (test_,OP),l)38 void glue(glue(test_, OP), l)(int64 op0h, int64 op0, int64 op1)
39 {
40     int64 res, s1, flags, resh;
41     s1 = op1;
42     resh = op0h;
43     res = op0;
44     flags = 0;
45     asm ("pushq %5\n\t"
46          "popfq\n\t"
47          stringify(OP) "l %3\n\t"
48          "pushfq\n\t"
49          "popq %1\n\t"
50          : "=a" (res), "=g" (flags), "=d" (resh)
51          : "q" ((int)s1), "0" (res), "1" (flags), "2" (resh));
52     xxprintf("%-10s AH=%016llx AL=%016llx B=%016llx RH=%016llx RL=%016llx CC=%04llx\n",
53            stringify(OP) "l", op0h, op0, s1, resh, res, flags & CC_MASK);
54 }
55 
glue(glue (test_,OP),q)56 void glue(glue(test_, OP), q)(int64 op0h, int64 op0, int64 op1)
57 {
58     int64 res, s1, flags, resh;
59     s1 = op1;
60     resh = op0h;
61     res = op0;
62     flags = 0;
63     asm ("pushq %5\n\t"
64          "popfq\n\t"
65          stringify(OP) "q %3\n\t"
66          "pushfq\n\t"
67          "popq %1\n\t"
68          : "=a" (res), "=g" (flags), "=d" (resh)
69          : "q" (s1), "0" (res), "1" (flags), "2" (resh));
70     xxprintf("%-10s AH=%016llx AL=%016llx B=%016llx RH=%016llx RL=%016llx CC=%04llx\n",
71            stringify(OP) "q", op0h, op0, s1, resh, res, flags & CC_MASK);
72 }
73 
74 #undef OP
75