1#define FNNAME1(NAME) exec_ ## NAME 2#define FNNAME(NAME) FNNAME1(NAME) 3 4void FNNAME (INSN_NAME) (void) 5{ 6 /* Basic test: y=vaddl(x1,x2), then store the result. */ 7#define TEST_VADDL1(INSN, T1, T2, W, W2, N) \ 8 VECT_VAR(vector_res, T1, W2, N) = \ 9 INSN##_##T2##W(VECT_VAR(vector, T1, W, N), \ 10 VECT_VAR(vector2, T1, W, N)); \ 11 vst1q_##T2##W2(VECT_VAR(result, T1, W2, N), VECT_VAR(vector_res, T1, W2, N)) 12 13#define TEST_VADDL(INSN, T1, T2, W, W2, N) \ 14 TEST_VADDL1(INSN, T1, T2, W, W2, N) 15 16 DECL_VARIABLE(vector, int, 8, 8); 17 DECL_VARIABLE(vector, int, 16, 4); 18 DECL_VARIABLE(vector, int, 32, 2); 19 DECL_VARIABLE(vector, uint, 8, 8); 20 DECL_VARIABLE(vector, uint, 16, 4); 21 DECL_VARIABLE(vector, uint, 32, 2); 22 23 DECL_VARIABLE(vector2, int, 8, 8); 24 DECL_VARIABLE(vector2, int, 16, 4); 25 DECL_VARIABLE(vector2, int, 32, 2); 26 DECL_VARIABLE(vector2, uint, 8, 8); 27 DECL_VARIABLE(vector2, uint, 16, 4); 28 DECL_VARIABLE(vector2, uint, 32, 2); 29 30 DECL_VARIABLE(vector_res, int, 16, 8); 31 DECL_VARIABLE(vector_res, int, 32, 4); 32 DECL_VARIABLE(vector_res, int, 64, 2); 33 DECL_VARIABLE(vector_res, uint, 16, 8); 34 DECL_VARIABLE(vector_res, uint, 32, 4); 35 DECL_VARIABLE(vector_res, uint, 64, 2); 36 37 clean_results (); 38 39 /* Initialize input "vector" from "buffer". */ 40 VLOAD(vector, buffer, , int, s, 8, 8); 41 VLOAD(vector, buffer, , int, s, 16, 4); 42 VLOAD(vector, buffer, , int, s, 32, 2); 43 VLOAD(vector, buffer, , uint, u, 8, 8); 44 VLOAD(vector, buffer, , uint, u, 16, 4); 45 VLOAD(vector, buffer, , uint, u, 32, 2); 46 47 /* Choose init value arbitrarily. */ 48 VDUP(vector2, , int, s, 8, 8, -13); 49 VDUP(vector2, , int, s, 16, 4, -14); 50 VDUP(vector2, , int, s, 32, 2, -16); 51 VDUP(vector2, , uint, u, 8, 8, 0xf3); 52 VDUP(vector2, , uint, u, 16, 4, 0xfff1); 53 VDUP(vector2, , uint, u, 32, 2, 0xfffffff0); 54 55 /* Execute the tests. */ 56 TEST_VADDL(INSN_NAME, int, s, 8, 16, 8); 57 TEST_VADDL(INSN_NAME, int, s, 16, 32, 4); 58 TEST_VADDL(INSN_NAME, int, s, 32, 64, 2); 59 TEST_VADDL(INSN_NAME, uint, u, 8, 16, 8); 60 TEST_VADDL(INSN_NAME, uint, u, 16, 32, 4); 61 TEST_VADDL(INSN_NAME, uint, u, 32, 64, 2); 62 63 CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, ""); 64 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, ""); 65 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected, ""); 66 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, ""); 67 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, ""); 68 CHECK(TEST_MSG, uint, 64, 2, PRIx64, expected, ""); 69} 70 71int main (void) 72{ 73 FNNAME (INSN_NAME) (); 74 return 0; 75} 76