| 1 |
#define FNNAME1(NAME) exec_ ## NAME |
| 2 |
#define FNNAME(NAME) FNNAME1 (NAME) |
| 3 |
|
| 4 |
void FNNAME (INSN) (void) |
| 5 |
{ |
| 6 |
/* vector_res = vqrdmlah (vector, vector2, vector3, vector4), |
| 7 |
then store the result. */ |
| 8 |
#define TEST_VQRDMLAH2(INSN, Q, T1, T2, W, N, CMT) \ |
| 9 |
Set_Neon_Cumulative_Sat (0, VECT_VAR (vector_res, T1, W, N)); \ |
| 10 |
VECT_VAR (vector_res, T1, W, N) = \ |
| 11 |
INSN##Q##_##T2##W (VECT_VAR (vector, T1, W, N), \ |
| 12 |
VECT_VAR (vector2, T1, W, N), \ |
| 13 |
VECT_VAR (vector3, T1, W, N)); \ |
| 14 |
vst1##Q##_##T2##W (VECT_VAR (result, T1, W, N), \ |
| 15 |
VECT_VAR (vector_res, T1, W, N)) |
| 16 |
|
| 17 |
/* Two auxliary macros are necessary to expand INSN. */ |
| 18 |
#define TEST_VQRDMLAH1(INSN, Q, T1, T2, W, N, CMT) \ |
| 19 |
TEST_VQRDMLAH2 (INSN, Q, T1, T2, W, N, CMT) |
| 20 |
|
| 21 |
#define TEST_VQRDMLAH(Q, T1, T2, W, N, CMT) \ |
| 22 |
TEST_VQRDMLAH1 (INSN, Q, T1, T2, W, N, CMT) |
| 23 |
|
| 24 |
DECL_VARIABLE (vector, int, 16, 4); |
| 25 |
DECL_VARIABLE (vector, int, 32, 2); |
| 26 |
DECL_VARIABLE (vector, int, 16, 8); |
| 27 |
DECL_VARIABLE (vector, int, 32, 4); |
| 28 |
|
| 29 |
DECL_VARIABLE (vector_res, int, 16, 4); |
| 30 |
DECL_VARIABLE (vector_res, int, 32, 2); |
| 31 |
DECL_VARIABLE (vector_res, int, 16, 8); |
| 32 |
DECL_VARIABLE (vector_res, int, 32, 4); |
| 33 |
|
| 34 |
DECL_VARIABLE (vector2, int, 16, 4); |
| 35 |
DECL_VARIABLE (vector2, int, 32, 2); |
| 36 |
DECL_VARIABLE (vector2, int, 16, 8); |
| 37 |
DECL_VARIABLE (vector2, int, 32, 4); |
| 38 |
|
| 39 |
DECL_VARIABLE (vector3, int, 16, 4); |
| 40 |
DECL_VARIABLE (vector3, int, 32, 2); |
| 41 |
DECL_VARIABLE (vector3, int, 16, 8); |
| 42 |
DECL_VARIABLE (vector3, int, 32, 4); |
| 43 |
|
| 44 |
clean_results (); |
| 45 |
|
| 46 |
VLOAD (vector, buffer, , int, s, 16, 4); |
| 47 |
VLOAD (vector, buffer, , int, s, 32, 2); |
| 48 |
VLOAD (vector, buffer, q, int, s, 16, 8); |
| 49 |
VLOAD (vector, buffer, q, int, s, 32, 4); |
| 50 |
|
| 51 |
/* Initialize vector2. */ |
| 52 |
VDUP (vector2, , int, s, 16, 4, 0x5555); |
| 53 |
VDUP (vector2, , int, s, 32, 2, 0xBB); |
| 54 |
VDUP (vector2, q, int, s, 16, 8, 0xBB); |
| 55 |
VDUP (vector2, q, int, s, 32, 4, 0x22); |
| 56 |
|
| 57 |
/* Initialize vector3. */ |
| 58 |
VDUP (vector3, , int, s, 16, 4, 0x5555); |
| 59 |
VDUP (vector3, , int, s, 32, 2, 0xBB); |
| 60 |
VDUP (vector3, q, int, s, 16, 8, 0x33); |
| 61 |
VDUP (vector3, q, int, s, 32, 4, 0x22); |
| 62 |
|
| 63 |
#define CMT "" |
| 64 |
TEST_VQRDMLAH ( , int, s, 16, 4, CMT); |
| 65 |
TEST_VQRDMLAH ( , int, s, 32, 2, CMT); |
| 66 |
TEST_VQRDMLAH (q, int, s, 16, 8, CMT); |
| 67 |
TEST_VQRDMLAH (q, int, s, 32, 4, CMT); |
| 68 |
|
| 69 |
CHECK (TEST_MSG, int, 16, 4, PRIx16, expected, CMT); |
| 70 |
CHECK (TEST_MSG, int, 32, 2, PRIx32, expected, CMT); |
| 71 |
CHECK (TEST_MSG, int, 16, 8, PRIx16, expected, CMT); |
| 72 |
CHECK (TEST_MSG, int, 32, 4, PRIx32, expected, CMT); |
| 73 |
|
| 74 |
/* Now use input values such that the multiplication causes |
| 75 |
saturation. */ |
| 76 |
#define TEST_MSG_MUL " (check mul cumulative saturation)" |
| 77 |
VDUP (vector, , int, s, 16, 4, 0x8000); |
| 78 |
VDUP (vector, , int, s, 32, 2, 0x80000000); |
| 79 |
VDUP (vector, q, int, s, 16, 8, 0x8000); |
| 80 |
VDUP (vector, q, int, s, 32, 4, 0x80000000); |
| 81 |
VDUP (vector2, , int, s, 16, 4, 0x8000); |
| 82 |
VDUP (vector2, , int, s, 32, 2, 0x80000000); |
| 83 |
VDUP (vector2, q, int, s, 16, 8, 0x8000); |
| 84 |
VDUP (vector2, q, int, s, 32, 4, 0x80000000); |
| 85 |
VDUP (vector3, , int, s, 16, 4, 0x8000); |
| 86 |
VDUP (vector3, , int, s, 32, 2, 0x80000000); |
| 87 |
VDUP (vector3, q, int, s, 16, 8, 0x8000); |
| 88 |
VDUP (vector3, q, int, s, 32, 4, 0x80000000); |
| 89 |
|
| 90 |
TEST_VQRDMLAH ( , int, s, 16, 4, TEST_MSG_MUL); |
| 91 |
TEST_VQRDMLAH ( , int, s, 32, 2, TEST_MSG_MUL); |
| 92 |
TEST_VQRDMLAH (q, int, s, 16, 8, TEST_MSG_MUL); |
| 93 |
TEST_VQRDMLAH (q, int, s, 32, 4, TEST_MSG_MUL); |
| 94 |
|
| 95 |
CHECK (TEST_MSG, int, 16, 4, PRIx16, expected_mul, TEST_MSG_MUL); |
| 96 |
CHECK (TEST_MSG, int, 32, 2, PRIx32, expected_mul, TEST_MSG_MUL); |
| 97 |
CHECK (TEST_MSG, int, 16, 8, PRIx16, expected_mul, TEST_MSG_MUL); |
| 98 |
CHECK (TEST_MSG, int, 32, 4, PRIx32, expected_mul, TEST_MSG_MUL); |
| 99 |
|
| 100 |
/* Use input values where rounding produces a result equal to the |
| 101 |
saturation value, but does not set the saturation flag. */ |
| 102 |
#define TEST_MSG_ROUND " (check rounding)" |
| 103 |
VDUP (vector, , int, s, 16, 4, 0x8000); |
| 104 |
VDUP (vector, , int, s, 32, 2, 0x80000000); |
| 105 |
VDUP (vector, q, int, s, 16, 8, 0x8000); |
| 106 |
VDUP (vector, q, int, s, 32, 4, 0x80000000); |
| 107 |
VDUP (vector2, , int, s, 16, 4, 0x8001); |
| 108 |
VDUP (vector2, , int, s, 32, 2, 0x80000001); |
| 109 |
VDUP (vector2, q, int, s, 16, 8, 0x8001); |
| 110 |
VDUP (vector2, q, int, s, 32, 4, 0x80000001); |
| 111 |
VDUP (vector3, , int, s, 16, 4, 0x8001); |
| 112 |
VDUP (vector3, , int, s, 32, 2, 0x80000001); |
| 113 |
VDUP (vector3, q, int, s, 16, 8, 0x8001); |
| 114 |
VDUP (vector3, q, int, s, 32, 4, 0x80000001); |
| 115 |
|
| 116 |
TEST_VQRDMLAH ( , int, s, 16, 4, TEST_MSG_ROUND); |
| 117 |
TEST_VQRDMLAH ( , int, s, 32, 2, TEST_MSG_ROUND); |
| 118 |
TEST_VQRDMLAH (q, int, s, 16, 8, TEST_MSG_ROUND); |
| 119 |
TEST_VQRDMLAH (q, int, s, 32, 4, TEST_MSG_ROUND); |
| 120 |
|
| 121 |
CHECK (TEST_MSG, int, 16, 4, PRIx16, expected_round, TEST_MSG_ROUND); |
| 122 |
CHECK (TEST_MSG, int, 32, 2, PRIx32, expected_round, TEST_MSG_ROUND); |
| 123 |
CHECK (TEST_MSG, int, 16, 8, PRIx16, expected_round, TEST_MSG_ROUND); |
| 124 |
CHECK (TEST_MSG, int, 32, 4, PRIx32, expected_round, TEST_MSG_ROUND); |
| 125 |
} |
| 126 |
|
| 127 |
int |
| 128 |
main (void) |
| 129 |
{ |
| 130 |
FNNAME (INSN) (); |
| 131 |
return 0; |
| 132 |
} |