OLD | NEW |
1 //===- subzero/crosstest/test_arith.cpp - Arithmetic operator tests -------===// | 1 //===- subzero/crosstest/test_arith.cpp - Arithmetic operator tests -------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // Implementation for crosstesting arithmetic operations. | 10 // Implementation for crosstesting arithmetic operations. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 v16si8 test##inst(v16si8 a, v16si8 b) { return a op b; } | 42 v16si8 test##inst(v16si8 a, v16si8 b) { return a op b; } |
43 SINTOP_TABLE | 43 SINTOP_TABLE |
44 #undef X | 44 #undef X |
45 | 45 |
46 #define X(inst, op, func) \ | 46 #define X(inst, op, func) \ |
47 float test##inst(float a, float b) { return func(a op b); } \ | 47 float test##inst(float a, float b) { return func(a op b); } \ |
48 double test##inst(double a, double b) { return func(a op b); } \ | 48 double test##inst(double a, double b) { return func(a op b); } \ |
49 v4f32 test##inst(v4f32 a, v4f32 b) { return func(a op b); } | 49 v4f32 test##inst(v4f32 a, v4f32 b) { return func(a op b); } |
50 FPOP_TABLE | 50 FPOP_TABLE |
51 #undef X | 51 #undef X |
| 52 |
| 53 #define X(mult_by) \ |
| 54 bool testMultiplyBy##mult_by(bool a, bool /*unused*/) { \ |
| 55 return a * (mult_by); \ |
| 56 } \ |
| 57 bool testMultiplyByNeg##mult_by(bool a, bool /*unused*/) { \ |
| 58 return a * (-(mult_by)); \ |
| 59 } \ |
| 60 uint8_t testMultiplyBy##mult_by(uint8_t a, uint8_t /*unused*/) { \ |
| 61 return a * (mult_by); \ |
| 62 } \ |
| 63 uint8_t testMultiplyByNeg##mult_by(uint8_t a, uint8_t /*unused*/) { \ |
| 64 return a * (-(mult_by)); \ |
| 65 } \ |
| 66 uint16_t testMultiplyBy##mult_by(uint16_t a, uint16_t /*unused*/) { \ |
| 67 return a * (mult_by); \ |
| 68 } \ |
| 69 uint16_t testMultiplyByNeg##mult_by(uint16_t a, uint16_t /*unused*/) { \ |
| 70 return a * (-(mult_by)); \ |
| 71 } \ |
| 72 uint32_t testMultiplyBy##mult_by(uint32_t a, uint32_t /*unused*/) { \ |
| 73 return a * (mult_by); \ |
| 74 } \ |
| 75 uint32_t testMultiplyByNeg##mult_by(uint32_t a, uint32_t /*unused*/) { \ |
| 76 return a * (-(mult_by)); \ |
| 77 } \ |
| 78 uint64_t testMultiplyBy##mult_by(uint64_t a, uint64_t /*unused*/) { \ |
| 79 return a * (mult_by); \ |
| 80 } \ |
| 81 uint64_t testMultiplyByNeg##mult_by(uint64_t a, uint64_t /*unused*/) { \ |
| 82 return a * (-(mult_by)); \ |
| 83 } |
| 84 MULIMM_TABLE |
| 85 #undef X |
OLD | NEW |