2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected
,int,16,4) [] = { 0xfef0, 0xff01, 0xff12, 0xff23 };
7 VECT_VAR_DECL(expected
,int,32,2) [] = { 0xfffffde0, 0xfffffe02 };
8 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0xfcd0, 0xfd03, 0xfd36, 0xfd69 };
9 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0xfffffbc0, 0xfffffc04 };
10 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
11 VECT_VAR_DECL(expected
, hfloat
, 16, 4) [] = { 0xdd93, 0xdd3a, 0xdce1, 0xdc87 };
13 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0xc3b26666, 0xc3a74000 };
14 VECT_VAR_DECL(expected
,int,16,8) [] = { 0xfab0, 0xfb05, 0xfb5a, 0xfbaf,
15 0xfc04, 0xfc59, 0xfcae, 0xfd03 };
16 VECT_VAR_DECL(expected
,int,32,4) [] = { 0xfffff9a0, 0xfffffa06,
17 0xfffffa6c, 0xfffffad2 };
18 VECT_VAR_DECL(expected
,uint
,16,8) [] = { 0xf890, 0xf907, 0xf97e, 0xf9f5,
19 0xfa6c, 0xfae3, 0xfb5a, 0xfbd1 };
20 VECT_VAR_DECL(expected
,uint
,32,4) [] = { 0xfffff780, 0xfffff808,
21 0xfffff890, 0xfffff918 };
22 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
23 VECT_VAR_DECL(expected
, hfloat
, 16, 8) [] = { 0xe58e, 0xe535, 0xe4dc, 0xe483,
24 0xe42a, 0xe3a3, 0xe2f2, 0xe240 };
26 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0xc4b1cccd, 0xc4a6b000,
27 0xc49b9333, 0xc4907667 };
29 #define INSN_NAME vmul_n
30 #define TEST_MSG "VMUL_N"
32 #define FNNAME1(NAME) exec_ ## NAME
33 #define FNNAME(NAME) FNNAME1(NAME)
35 void FNNAME (INSN_NAME
) (void)
37 #define DECL_VMUL(VAR) \
38 DECL_VARIABLE(VAR, int, 16, 4); \
39 DECL_VARIABLE(VAR, int, 32, 2); \
40 DECL_VARIABLE(VAR, uint, 16, 4); \
41 DECL_VARIABLE(VAR, uint, 32, 2); \
42 DECL_VARIABLE(VAR, float, 32, 2); \
43 DECL_VARIABLE(VAR, int, 16, 8); \
44 DECL_VARIABLE(VAR, int, 32, 4); \
45 DECL_VARIABLE(VAR, uint, 16, 8); \
46 DECL_VARIABLE(VAR, uint, 32, 4); \
47 DECL_VARIABLE(VAR, float, 32, 4)
49 /* vector_res = vmul_n(vector,val), then store the result. */
50 #define TEST_VMUL_N(Q, T1, T2, W, N, L) \
51 VECT_VAR(vector_res, T1, W, N) = \
52 vmul##Q##_n_##T2##W(VECT_VAR(vector, T1, W, N), \
54 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \
55 VECT_VAR(vector_res, T1, W, N))
58 DECL_VMUL(vector_res
);
60 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
61 DECL_VARIABLE(vector
, float, 16, 4);
62 DECL_VARIABLE(vector
, float, 16, 8);
63 DECL_VARIABLE(vector_res
, float, 16, 4);
64 DECL_VARIABLE(vector_res
, float, 16, 8);
69 /* Initialize vector from pre-initialized values. */
70 VLOAD(vector
, buffer
, , int, s
, 16, 4);
71 VLOAD(vector
, buffer
, , int, s
, 32, 2);
72 VLOAD(vector
, buffer
, , uint
, u
, 16, 4);
73 VLOAD(vector
, buffer
, , uint
, u
, 32, 2);
74 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
75 VLOAD(vector
, buffer
, , float, f
, 16, 4);
77 VLOAD(vector
, buffer
, , float, f
, 32, 2);
78 VLOAD(vector
, buffer
, q
, int, s
, 16, 8);
79 VLOAD(vector
, buffer
, q
, int, s
, 32, 4);
80 VLOAD(vector
, buffer
, q
, uint
, u
, 16, 8);
81 VLOAD(vector
, buffer
, q
, uint
, u
, 32, 4);
82 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
83 VLOAD(vector
, buffer
, q
, float, f
, 16, 8);
85 VLOAD(vector
, buffer
, q
, float, f
, 32, 4);
87 /* Choose multiplier arbitrarily. */
88 TEST_VMUL_N(, int, s
, 16, 4, 0x11);
89 TEST_VMUL_N(, int, s
, 32, 2, 0x22);
90 TEST_VMUL_N(, uint
, u
, 16, 4, 0x33);
91 TEST_VMUL_N(, uint
, u
, 32, 2, 0x44);
92 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
93 TEST_VMUL_N(, float, f
, 16, 4, 22.3f
);
95 TEST_VMUL_N(, float, f
, 32, 2, 22.3f
);
96 TEST_VMUL_N(q
, int, s
, 16, 8, 0x55);
97 TEST_VMUL_N(q
, int, s
, 32, 4, 0x66);
98 TEST_VMUL_N(q
, uint
, u
, 16, 8, 0x77);
99 TEST_VMUL_N(q
, uint
, u
, 32, 4, 0x88);
100 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
101 TEST_VMUL_N(q
, float, f
, 16, 8, 88.9f
);
103 TEST_VMUL_N(q
, float, f
, 32, 4, 88.9f
);
105 CHECK(TEST_MSG
, int, 16, 4, PRIx16
, expected
, "");
106 CHECK(TEST_MSG
, int, 32, 2, PRIx32
, expected
, "");
107 CHECK(TEST_MSG
, uint
, 16, 4, PRIx16
, expected
, "");
108 CHECK(TEST_MSG
, uint
, 32, 2, PRIx32
, expected
, "");
109 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
110 CHECK_FP(TEST_MSG
, float, 16, 4, PRIx16
, expected
, "");
112 CHECK_FP(TEST_MSG
, float, 32, 2, PRIx32
, expected
, "");
113 CHECK(TEST_MSG
, int, 16, 8, PRIx16
, expected
, "");
114 CHECK(TEST_MSG
, int, 32, 4, PRIx32
, expected
, "");
115 CHECK(TEST_MSG
, uint
, 16, 8, PRIx16
, expected
, "");
116 CHECK(TEST_MSG
, uint
, 32, 4, PRIx32
, expected
, "");
117 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
118 CHECK_FP(TEST_MSG
, float, 16, 8, PRIx16
, expected
, "");
120 CHECK_FP(TEST_MSG
, float, 32, 4, PRIx32
, expected
, "");
125 FNNAME (INSN_NAME
) ();