FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / mul.h
blob2d54387ed1d62e2fef5a43e19fa179ea17f4b51d
1 #include <stdio.h>
3 union reg_pair {
4 struct { unsigned long a, b; };
5 unsigned __int128 pair;
6 };
8 #define MUL_REG_OP(insn, m1, fmt, m2) \
9 ({ \
10 union reg_pair tmp = { { m1, m1 } }; \
11 unsigned cc; \
12 asm ("xr %[cc],%[cc]\n" \
13 insn("%[pair]", "%[op]") \
14 "ipm %[cc]\n" \
15 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
16 : [op] fmt (m2) \
17 : "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) \
23 ({ \
24 union reg_pair tmp = { { 0, 0 } }; \
25 unsigned cc; \
26 asm ("xr %[cc],%[cc]\n" \
27 insn("%[pair]", "%[a]", "%[b]") \
28 "ipm %[cc]\n" \
29 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
30 : [a] "d" (m1), [b] "d" (m2) \
31 : "cc"); \
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) \
37 ({ \
38 union reg_pair tmp = { { m1, m1 } }; \
39 unsigned cc; \
40 asm ("xr %[cc],%[cc]\n" \
41 insn("%[pair]", "0x" #m2) \
42 "ipm %[cc]\n" \
43 : [pair] "+d" (tmp.pair), [cc] "=&d" (cc) \
44 :: "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) \
50 ({ \
51 f(i, 0ul, x, m2); \
52 f(i, 1ul, 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) \
74 ({ \
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); \