4 struct { unsigned long a
, b
; };
5 unsigned __int128 pair
;
8 #define MUL_REG_OP(insn, m1, fmt, m2) \
10 union reg_pair tmp = { { m1, m1 } }; \
12 asm ("xr %[cc],%[cc]\n" \
13 insn("%[pair]", "%[op]") \
15 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
18 printf(#insn " %16.16lX * %16.16lX = %16.16lX%16.16lX (cc=%u)\n", \
19 m1, m2, tmp.a, tmp.b, cc >> 28); \
22 #define MUL_REG_REG_REG(insn, m1, none, m2) \
24 union reg_pair tmp = { { 0, 0 } }; \
26 asm ("xr %[cc],%[cc]\n" \
27 insn("%[pair]", "%[a]", "%[b]") \
29 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
30 : [a] "d" (m1), [b] "d" (m2) \
32 printf(#insn " %16.16lX * %16.16lX = %16.16lX%16.16lX (cc=%d)\n", \
33 m1, m2, tmp.a, tmp.b, cc >> 28); \
36 #define MUL_REG_XIMM(insn, m1, um2, m2) \
38 union reg_pair tmp = { { m1, m1 } }; \
40 asm ("xr %[cc],%[cc]\n" \
41 insn("%[pair]", "0x" #m2) \
43 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
45 printf(#insn " %16.16lX * %16.16lX = %16.16lX%16.16lX (cc=%d)\n", \
46 m1, (unsigned long) 0x##um2##m2, tmp.a, tmp.b, cc >> 28); \
49 #define sweep(f, i, x, m2) \
53 f(i, 0xfffful, x, m2); \
54 f(i, 0x7ffful, x, m2); \
55 f(i, 0x8000ul, x, m2); \
56 f(i, 0xfffffffful, x, m2); \
57 f(i, 0x80000000ul, x, m2); \
58 f(i, 0x7ffffffful, x, m2); \
59 f(i, 0xfffffffffffffffful, x, m2); \
60 f(i, 0x8000000000000000ul, x, m2); \
61 f(i, 0x7ffffffffffffffful, x, m2); \
64 #define singlesweep(i, fmt, m2) sweep(MUL_REG_OP, i, fmt, m2)
65 #define regregsweep(i, m2) sweep(MUL_REG_REG_REG, i, , m2)
66 #define ximmsweep(i, um2, m2) sweep(MUL_REG_XIMM, i, um2, m2)
68 #define regsweep(i, m2) singlesweep(i, "d", m2)
69 #define memsweep(i, m2) singlesweep(i, "T", m2)
70 #define rmemsweep(i, m2) singlesweep(i, "R", m2)
71 #define immsweep(i, m2) singlesweep(i, "n", (unsigned long)m2)
73 #define for_each_m2(do_regmem_insns) \
75 do_regmem_insns(0x0ul); \
76 do_regmem_insns(0x7ffffffffffffffful); \
77 do_regmem_insns(0x8000000000000000ul); \
78 do_regmem_insns(0xfffffffffffffffful); \
79 do_regmem_insns(0x7fffffff00000000ul); \
80 do_regmem_insns(0x8000000000000000ul); \
81 do_regmem_insns(0xffffffff00000000ul); \
82 do_regmem_insns(0x000000007ffffffful); \
83 do_regmem_insns(0x0000000080000000ul); \
84 do_regmem_insns(0x00000000fffffffful); \
85 do_regmem_insns(0x000000000000fffful); \
86 do_regmem_insns(0x0000000000007ffful); \
87 do_regmem_insns(0x0000000000008000ul); \
88 do_regmem_insns(0x000000000000fffful); \