2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected
,int,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a,
7 0x78, 0x56, 0x34, 0x12 };
8 VECT_VAR_DECL(expected
,int,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 };
9 VECT_VAR_DECL(expected
,int,32,2) [] = { 0x9abcdef0, 0x12345678 };
10 VECT_VAR_DECL(expected
,int,64,1) [] = { 0x123456789abcdef0 };
11 VECT_VAR_DECL(expected
,uint
,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a,
12 0x78, 0x56, 0x34, 0x12 };
13 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 };
14 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0x9abcdef0, 0x12345678 };
15 VECT_VAR_DECL(expected
,uint
,64,1) [] = { 0x123456789abcdef0 };
16 VECT_VAR_DECL(expected
,poly
,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a,
17 0x78, 0x56, 0x34, 0x12 };
18 VECT_VAR_DECL(expected
,poly
,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 };
19 VECT_VAR_DECL(expected
,hfloat
,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 };
20 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0x9abcdef0, 0x12345678 };
22 #define INSN_NAME vcreate
23 #define TEST_MSG "VCREATE"
25 #define FNNAME1(NAME) void exec_ ## NAME (void)
26 #define FNNAME(NAME) FNNAME1(NAME)
30 /* Basic test: y=vcreate(x), then store the result. */
31 #define TEST_VCREATE(T1, T2, W, N) \
32 VECT_VAR(vector_res, T1, W, N) = vcreate_##T2##W(VECT_VAR(val, T1, W, N)); \
33 vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
35 #define DECL_VAL(VAR, T1, W, N) \
36 uint64_t VECT_VAR(VAR, T1, W, N)
38 DECL_VAL(val
, int, 8, 8);
39 DECL_VAL(val
, int, 16, 4);
40 DECL_VAL(val
, int, 32, 2);
41 DECL_VAL(val
, int, 64, 1);
42 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
43 DECL_VAL(val
, float, 16, 4);
45 DECL_VAL(val
, float, 32, 2);
46 DECL_VAL(val
, uint
, 8, 8);
47 DECL_VAL(val
, uint
, 16, 4);
48 DECL_VAL(val
, uint
, 32, 2);
49 DECL_VAL(val
, uint
, 64, 1);
50 DECL_VAL(val
, poly
, 8, 8);
51 DECL_VAL(val
, poly
, 16, 4);
53 DECL_VARIABLE(vector_res
, int, 8, 8);
54 DECL_VARIABLE(vector_res
, int, 16, 4);
55 DECL_VARIABLE(vector_res
, int, 32, 2);
56 DECL_VARIABLE(vector_res
, int, 64, 1);
57 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
58 DECL_VARIABLE(vector_res
, float, 16, 4);
60 DECL_VARIABLE(vector_res
, float, 32, 2);
61 DECL_VARIABLE(vector_res
, uint
, 8, 8);
62 DECL_VARIABLE(vector_res
, uint
, 16, 4);
63 DECL_VARIABLE(vector_res
, uint
, 32, 2);
64 DECL_VARIABLE(vector_res
, uint
, 64, 1);
65 DECL_VARIABLE(vector_res
, poly
, 8, 8);
66 DECL_VARIABLE(vector_res
, poly
, 16, 4);
70 /* Initialize input values arbitrarily. */
71 VECT_VAR(val
, int, 8, 8) = 0x123456789abcdef0LL
;
72 VECT_VAR(val
, int, 16, 4) = 0x123456789abcdef0LL
;
73 VECT_VAR(val
, int, 32, 2) = 0x123456789abcdef0LL
;
74 VECT_VAR(val
, int, 64, 1) = 0x123456789abcdef0LL
;
75 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
76 VECT_VAR(val
, float, 16, 4) = 0x123456789abcdef0LL
;
78 VECT_VAR(val
, float, 32, 2) = 0x123456789abcdef0LL
;
79 VECT_VAR(val
, uint
, 8, 8) = 0x123456789abcdef0ULL
;
80 VECT_VAR(val
, uint
, 16, 4) = 0x123456789abcdef0ULL
;
81 VECT_VAR(val
, uint
, 32, 2) = 0x123456789abcdef0ULL
;
82 VECT_VAR(val
, uint
, 64, 1) = 0x123456789abcdef0ULL
;
83 VECT_VAR(val
, poly
, 8, 8) = 0x123456789abcdef0ULL
;
84 VECT_VAR(val
, poly
, 16, 4) = 0x123456789abcdef0ULL
;
86 TEST_VCREATE(int, s
, 8, 8);
87 TEST_VCREATE(int, s
, 16, 4);
88 TEST_VCREATE(int, s
, 32, 2);
89 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
90 TEST_VCREATE(float, f
, 16, 4);
92 TEST_VCREATE(float, f
, 32, 2);
93 TEST_VCREATE(int, s
, 64, 1);
94 TEST_VCREATE(uint
, u
, 8, 8);
95 TEST_VCREATE(uint
, u
, 16, 4);
96 TEST_VCREATE(uint
, u
, 32, 2);
97 TEST_VCREATE(uint
, u
, 64, 1);
98 TEST_VCREATE(poly
, p
, 8, 8);
99 TEST_VCREATE(poly
, p
, 16, 4);
101 CHECK(TEST_MSG
, int, 8, 8, PRIx8
, expected
, "");
102 CHECK(TEST_MSG
, int, 16, 4, PRIx16
, expected
, "");
103 CHECK(TEST_MSG
, int, 32, 2, PRIx32
, expected
, "");
104 CHECK(TEST_MSG
, int, 64, 1, PRIx64
, expected
, "");
105 CHECK(TEST_MSG
, uint
, 8, 8, PRIx8
, expected
, "");
106 CHECK(TEST_MSG
, uint
, 16, 4, PRIx16
, expected
, "");
107 CHECK(TEST_MSG
, uint
, 32, 2, PRIx32
, expected
, "");
108 CHECK(TEST_MSG
, uint
, 64, 1, PRIx64
, expected
, "");
109 CHECK_POLY(TEST_MSG
, poly
, 8, 8, PRIx8
, expected
, "");
110 CHECK_POLY(TEST_MSG
, poly
, 16, 4, PRIx16
, expected
, "");
111 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
112 CHECK_FP(TEST_MSG
, float, 16, 4, PRIx16
, expected
, "");
114 CHECK_FP(TEST_MSG
, float, 32, 2, PRIx32
, expected
, "");