blob: 4cf4596d0ef1bcdf66e3bcc6838e9e75086288d2 [file] [log] [blame]
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -07001#ifndef TEST_ARITH_DEF
2#define TEST_ARITH_DEF
3
4#define XSTR(s) STR(s)
5#define STR(s) #s
6
7#define UINTOP_TABLE \
8 /* inst, operator, div */ \
9 X(Add, +, 0 ) \
10 X(Sub, -, 0 ) \
11 X(Mul, *, 0 ) \
12 X(Udiv, /, 1 ) \
13 X(Urem, %, 1 ) \
14 X(Shl, <<, 0) \
15 X(Lshr, >>, 0) \
16 X(And, &, 0 ) \
17 X(Or, |, 0 ) \
18 X(Xor, ^, 0 ) \
19//#define X(inst, op, isdiv)
20
21#define SINTOP_TABLE \
22 /* inst, operator, div */ \
23 X(Sdiv, /, 1) \
24 X(Srem, %, 1) \
25 X(Ashr, >>, 0) \
26//#define X(inst, op, isdiv)
27
28#define COMMA ,
29#define FPOP_TABLE \
30 /* inst, infix_op, func */ \
31 X(Fadd, +, ) \
32 X(Fsub, -, ) \
33 X(Fmul, *, ) \
34 X(Fdiv, /, ) \
35 X(Frem, COMMA, myFrem) \
36//#define X(inst, op, func)
37
38// Note: The above definition of COMMA, plus the "func" argument to
39// the X macro, are because C++ does not allow the % operator on
40// floating-point primitive types. To work around this, the expansion
41// is "func(a infix_op b)", which becomes "myFrem(a , b)" for the Frem
42// instruction and "(a + b)" for the Fadd instruction. The two
43// versions of myFrem() are defined in a separate bitcode file.
44
45#endif // TEST_ARITH_DEF