blob: 488079d75133f8afa58cf1da6ac68d936e279341 [file] [log] [blame]
Jim Stichnoth7da431b2014-08-05 11:22:37 -07001//===- subzero/crosstest/test_arith.def - macros for tests ----*- C++ -*---===//
2//
3// The Subzero Code Generator
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines macros for crosstesting arithmetic operations.
11//
12//===----------------------------------------------------------------------===//
13
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070014#ifndef TEST_ARITH_DEF
15#define TEST_ARITH_DEF
16
17#define XSTR(s) STR(s)
18#define STR(s) #s
19
Matt Walaafeaee42014-08-07 13:47:30 -070020#define UINTOP_TABLE \
21 /* inst, operator, div, shift */ \
22 X(Add, +, 0, 0) \
23 X(Sub, -, 0, 0) \
24 X(Mul, *, 0, 0) \
25 X(Udiv, /, 1, 0) \
26 X(Urem, %, 1, 0) \
27 X(Shl, <<, 0, 1) \
28 X(Lshr, >>, 0, 1) \
29 X(And, &, 0, 0) \
30 X(Or, |, 0, 0) \
31 X(Xor, ^, 0, 0) \
32//#define X(inst, op, isdiv, isshift)
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070033
Matt Walaafeaee42014-08-07 13:47:30 -070034#define SINTOP_TABLE \
35 /* inst, operator, div, shift */ \
36 X(Sdiv, /, 1, 0) \
37 X(Srem, %, 1, 0) \
38 X(Ashr, >>, 0, 1) \
39//#define X(inst, op, isdiv, isshift)
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070040
41#define COMMA ,
Matt Walaafeaee42014-08-07 13:47:30 -070042#define FPOP_TABLE \
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070043 /* inst, infix_op, func */ \
44 X(Fadd, +, ) \
45 X(Fsub, -, ) \
46 X(Fmul, *, ) \
47 X(Fdiv, /, ) \
48 X(Frem, COMMA, myFrem) \
49//#define X(inst, op, func)
50
51// Note: The above definition of COMMA, plus the "func" argument to
52// the X macro, are because C++ does not allow the % operator on
53// floating-point primitive types. To work around this, the expansion
54// is "func(a infix_op b)", which becomes "myFrem(a , b)" for the Frem
55// instruction and "(a + b)" for the Fadd instruction. The two
56// versions of myFrem() are defined in a separate bitcode file.
57
Matt Wala7fa22d82014-07-17 12:41:31 -070058#define INT_VALUE_ARRAY \
59{ 0x0, 0x1, 0x7ffffffe, 0x7fffffff, \
60 0x80000000, 0x80000001, 0xfffffffe, 0xffffffff, \
61 0x7e, 0x7f, 0x80, 0x81, \
62 0xfe, 0xff, 0x100, 0x101, \
63 0x7ffe, 0x7fff, 0x8000, 0x8001, \
64 0xfffe, 0xffff, 0x10000, 0x10001 }
65
66#define FP_VALUE_ARRAY(NegInf, PosInf, NegNan, NaN) \
Jan Voung109fa152014-10-07 17:22:51 -070067{ 0, 1, 1.4, \
68 1.5, 1.6, -1.4, \
69 -1.5, -1.6, 0x7e, \
Matt Wala7fa22d82014-07-17 12:41:31 -070070 0x7f, 0x80, 0x81, \
71 0xfe, 0xff, 0x7ffe, \
72 0x7fff, 0x8000, 0x8001, \
73 0xfffe, 0xffff, 0x7ffffffe, \
74 0x7fffffff, 0x80000000, 0x80000001, \
75 0xfffffffe, 0xffffffff, 0x100000000ll, \
76 0x100000001ll, 0x7ffffffffffffffell, 0x7fffffffffffffffll, \
77 0x8000000000000000ll, 0x8000000000000001ll, 0xfffffffffffffffell, \
78 0xffffffffffffffffll, NegInf, PosInf, \
79 Nan, NegNan, -0.0, \
Jan Voung109fa152014-10-07 17:22:51 -070080 10.0, FLT_MIN, FLT_MAX, \
81 DBL_MIN, DBL_MAX }
Matt Wala7fa22d82014-07-17 12:41:31 -070082
Jim Stichnoth5bc2b1d2014-05-22 13:38:48 -070083#endif // TEST_ARITH_DEF