2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 #if defined(__aarch64__) && defined(__ARM_FEATURE_FMA)
6 /* Expected results. */
7 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0x4438ca3d, 0x44390a3d };
8 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0x44869eb8, 0x4486beb8, 0x4486deb8, 0x4486feb8 };
9 VECT_VAR_DECL(expected
,hfloat
,64,2) [] = { 0x408906e1532b8520, 0x40890ee1532b8520 };
11 #define VECT_VAR_ASSIGN(S,Q,T1,W) S##Q##_##T1##W
12 #define ASSIGN(S, Q, T, W, V) T##W##_t S##Q##_##T##W = V
13 #define TEST_MSG "VFMA_N/VFMAQ_N"
15 void exec_vfma_n (void)
17 /* Basic test: v4=vfma_n(v1,v2), then store the result. */
18 #define TEST_VFMA_N(Q, T1, T2, W, N) \
19 VECT_VAR(vector_res, T1, W, N) = \
20 vfma##Q##_n_##T2##W(VECT_VAR(vector1, T1, W, N), \
21 VECT_VAR(vector2, T1, W, N), \
22 VECT_VAR_ASSIGN(scalar, Q, T1, W)); \
23 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
25 #define CHECK_VFMA_N_RESULTS(test_name,comment) \
27 CHECK_FP(test_name, float, 32, 2, PRIx32, expected, comment); \
28 CHECK_FP(test_name, float, 32, 4, PRIx32, expected, comment); \
29 CHECK_FP(test_name, float, 64, 2, PRIx64, expected, comment); \
32 #define DECL_VFMA_N_VAR(VAR) \
33 DECL_VARIABLE(VAR, float, 32, 2); \
34 DECL_VARIABLE(VAR, float, 32, 4); \
35 DECL_VARIABLE(VAR, float, 64, 2);
37 DECL_VFMA_N_VAR(vector1
);
38 DECL_VFMA_N_VAR(vector2
);
39 DECL_VFMA_N_VAR(vector3
);
40 DECL_VFMA_N_VAR(vector_res
);
44 /* Initialize input "vector1" from "buffer". */
45 VLOAD(vector1
, buffer
, , float, f
, 32, 2);
46 VLOAD(vector1
, buffer
, q
, float, f
, 32, 4);
47 VLOAD(vector1
, buffer
, q
, float, f
, 64, 2);
49 /* Choose init value arbitrarily. */
50 VDUP(vector2
, , float, f
, 32, 2, 9.3f
);
51 VDUP(vector2
, q
, float, f
, 32, 4, 29.7f
);
52 VDUP(vector2
, q
, float, f
, 64, 2, 15.8f
);
54 /* Choose init value arbitrarily. */
55 ASSIGN(scalar
, , float, 32, 81.2f
);
56 ASSIGN(scalar
, q
, float, 32, 36.8f
);
57 ASSIGN(scalar
, q
, float, 64, 51.7f
);
59 /* Execute the tests. */
60 TEST_VFMA_N(, float, f
, 32, 2);
61 TEST_VFMA_N(q
, float, f
, 32, 4);
62 TEST_VFMA_N(q
, float, f
, 64, 2);
64 CHECK_VFMA_N_RESULTS (TEST_MSG
, "");
70 #if defined(__aarch64__) && defined(__ARM_FEATURE_FMA)