[ARM/AArch64][testsuite] Add vmlal_n and vmlsl_n tests.
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vadd.c
blobf08c620c82c228680d76f58bd6d3c67a4a653bf1
1 #define INSN_NAME vadd
2 #define TEST_MSG "VADD/VADDQ"
4 /* Extra tests for functions requiring floating-point types. */
5 void exec_vadd_f32(void);
6 #define EXTRA_TESTS exec_vadd_f32
8 #include "binary_op.inc"
10 /* Expected results. */
11 VECT_VAR_DECL(expected,int,8,8) [] = { 0xf2, 0xf3, 0xf4, 0xf5,
12 0xf6, 0xf7, 0xf8, 0xf9 };
13 VECT_VAR_DECL(expected,int,16,4) [] = { 0xffec, 0xffed, 0xffee, 0xffef };
14 VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff3, 0xfffffff4 };
15 VECT_VAR_DECL(expected,int,64,1) [] = { 0x54 };
16 VECT_VAR_DECL(expected,uint,8,8) [] = { 0x4, 0x5, 0x6, 0x7,
17 0x8, 0x9, 0xa, 0xb };
18 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xe, 0xf, 0x10, 0x11 };
19 VECT_VAR_DECL(expected,uint,32,2) [] = { 0x18, 0x19 };
20 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff2 };
21 VECT_VAR_DECL(expected,poly,8,8) [] = { 0x33, 0x33, 0x33, 0x33,
22 0x33, 0x33, 0x33, 0x33 };
23 VECT_VAR_DECL(expected,poly,16,4) [] = { 0x3333, 0x3333, 0x3333, 0x3333 };
24 VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x33333333, 0x33333333 };
25 VECT_VAR_DECL(expected,int,8,16) [] = { 0xe6, 0xe7, 0xe8, 0xe9,
26 0xea, 0xeb, 0xec, 0xed,
27 0xee, 0xef, 0xf0, 0xf1,
28 0xf2, 0xf3, 0xf4, 0xf5 };
29 VECT_VAR_DECL(expected,int,16,8) [] = { 0xffdc, 0xffdd, 0xffde, 0xffdf,
30 0xffe0, 0xffe1, 0xffe2, 0xffe3 };
31 VECT_VAR_DECL(expected,int,32,4) [] = { 0xffffffd2, 0xffffffd3,
32 0xffffffd4, 0xffffffd5 };
33 VECT_VAR_DECL(expected,int,64,2) [] = { 0x8, 0x9 };
34 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xfc, 0xfd, 0xfe, 0xff,
35 0x0, 0x1, 0x2, 0x3,
36 0x4, 0x5, 0x6, 0x7,
37 0x8, 0x9, 0xa, 0xb };
38 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff3, 0xfff4, 0xfff5, 0xfff6,
39 0xfff7, 0xfff8, 0xfff9, 0xfffa };
40 VECT_VAR_DECL(expected,uint,32,4) [] = { 0x27, 0x28, 0x29, 0x2a };
41 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffffffffffff3,
42 0xfffffffffffffff4 };
43 VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
44 0x33, 0x33, 0x33, 0x33,
45 0x33, 0x33, 0x33, 0x33,
46 0x33, 0x33, 0x33, 0x33 };
47 VECT_VAR_DECL(expected,poly,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
48 0x3333, 0x3333, 0x3333, 0x3333 };
49 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x33333333, 0x33333333,
50 0x33333333, 0x33333333 };
52 /* Expected results for float32 variants. Needs to be separated since
53 the generic test function does not test floating-point
54 versions. */
55 VECT_VAR_DECL(expected_float32,hfloat,32,2) [] = { 0x40d9999a, 0x40d9999a };
56 VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0x41100000, 0x41100000,
57 0x41100000, 0x41100000 };
59 void exec_vadd_f32(void)
61 DECL_VARIABLE(vector, float, 32, 2);
62 DECL_VARIABLE(vector, float, 32, 4);
64 DECL_VARIABLE(vector2, float, 32, 2);
65 DECL_VARIABLE(vector2, float, 32, 4);
67 DECL_VARIABLE(vector_res, float, 32, 2);
68 DECL_VARIABLE(vector_res, float, 32, 4);
70 VDUP(vector, , float, f, 32, 2, 2.3f);
71 VDUP(vector, q, float, f, 32, 4, 3.4f);
73 VDUP(vector2, , float, f, 32, 2, 4.5f);
74 VDUP(vector2, q, float, f, 32, 4, 5.6f);
76 TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2);
77 TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4);
79 CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_float32, "");
80 CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_float32, "");