2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 #ifdef __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 };
10 VECT_VAR_DECL(expected
,hfloat
,64,2) [] = { 0x408906e1532b8520, 0x40890ee1532b8520 };
13 #define TEST_MSG "VFMA/VFMAQ"
17 /* Basic test: v4=vfma(v1,v2), then store the result. */
18 #define TEST_VFMA(Q, T1, T2, W, N) \
19 VECT_VAR(vector_res, T1, W, N) = \
20 vfma##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \
21 VECT_VAR(vector2, T1, W, N), \
22 VECT_VAR(vector3, T1, W, N)); \
23 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
26 #define CHECK_VFMA_RESULTS(test_name,comment) \
28 CHECK_FP(test_name, float, 32, 2, PRIx32, expected, comment); \
29 CHECK_FP(test_name, float, 32, 4, PRIx32, expected, comment); \
30 CHECK_FP(test_name, float, 64, 2, PRIx64, expected, comment); \
32 #define DECL_VFMA_VAR(VAR) \
33 DECL_VARIABLE(VAR, float, 32, 2); \
34 DECL_VARIABLE(VAR, float, 32, 4); \
35 DECL_VARIABLE(VAR, float, 64, 2);
37 #define CHECK_VFMA_RESULTS(test_name,comment) \
39 CHECK_FP(test_name, float, 32, 2, PRIx32, expected, comment); \
40 CHECK_FP(test_name, float, 32, 4, PRIx32, expected, comment); \
42 #define DECL_VFMA_VAR(VAR) \
43 DECL_VARIABLE(VAR, float, 32, 2); \
44 DECL_VARIABLE(VAR, float, 32, 4);
47 DECL_VFMA_VAR(vector1
);
48 DECL_VFMA_VAR(vector2
);
49 DECL_VFMA_VAR(vector3
);
50 DECL_VFMA_VAR(vector_res
);
54 /* Initialize input "vector1" from "buffer". */
55 VLOAD(vector1
, buffer
, , float, f
, 32, 2);
56 VLOAD(vector1
, buffer
, q
, float, f
, 32, 4);
58 VLOAD(vector1
, buffer
, q
, float, f
, 64, 2);
61 /* Choose init value arbitrarily. */
62 VDUP(vector2
, , float, f
, 32, 2, 9.3f
);
63 VDUP(vector2
, q
, float, f
, 32, 4, 29.7f
);
65 VDUP(vector2
, q
, float, f
, 64, 2, 15.8f
);
68 /* Choose init value arbitrarily. */
69 VDUP(vector3
, , float, f
, 32, 2, 81.2f
);
70 VDUP(vector3
, q
, float, f
, 32, 4, 36.8f
);
72 VDUP(vector3
, q
, float, f
, 64, 2, 51.7f
);
75 /* Execute the tests. */
76 TEST_VFMA(, float, f
, 32, 2);
77 TEST_VFMA(q
, float, f
, 32, 4);
79 TEST_VFMA(q
, float, f
, 64, 2);
82 CHECK_VFMA_RESULTS (TEST_MSG
, "");
88 #ifdef __ARM_FEATURE_FMA