New Advanced SIMD intrinsics tests.
[platform/upstream/gcc49.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vsub.c
1 #define INSN_NAME vsub
2 #define TEST_MSG "VSUB/VSUBQ"
3
4 /* Extra tests for functions requiring floating-point types */
5 void exec_vsub_f32(void);
6 #define EXTRA_TESTS exec_vsub_f32
7
8 #include "binary_op.inc"
9
10 /* Expected results.  */
11 VECT_VAR_DECL(expected,int,8,8) [] = { 0xee, 0xef, 0xf0, 0xf1,
12                                        0xf2, 0xf3, 0xf4, 0xf5 };
13 VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 };
14 VECT_VAR_DECL(expected,int,32,2) [] = { 0xffffffed, 0xffffffee };
15 VECT_VAR_DECL(expected,int,64,1) [] = { 0xffffffffffffff8c };
16 VECT_VAR_DECL(expected,uint,8,8) [] = { 0xdc, 0xdd, 0xde, 0xdf,
17                                         0xe0, 0xe1, 0xe2, 0xe3 };
18 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xffd2, 0xffd3, 0xffd4, 0xffd5 };
19 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xffffffc8, 0xffffffc9 };
20 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xffffffffffffffee };
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) [] = { 0xfa, 0xfb, 0xfc, 0xfd,
26                                         0xfe, 0xff, 0x0, 0x1,
27                                         0x2, 0x3, 0x4, 0x5,
28                                         0x6, 0x7, 0x8, 0x9 };
29 VECT_VAR_DECL(expected,int,16,8) [] = { 0x4, 0x5, 0x6, 0x7,
30                                         0x8, 0x9, 0xa, 0xb };
31 VECT_VAR_DECL(expected,int,32,4) [] = { 0xe, 0xf, 0x10, 0x11 };
32 VECT_VAR_DECL(expected,int,64,2) [] = { 0xffffffffffffffd8,
33                                         0xffffffffffffffd9 };
34 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xe4, 0xe5, 0xe6, 0xe7,
35                                          0xe8, 0xe9, 0xea, 0xeb,
36                                          0xec, 0xed, 0xee, 0xef,
37                                          0xf0, 0xf1, 0xf2, 0xf3};
38 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xffed, 0xffee, 0xffef, 0xfff0,
39                                          0xfff1, 0xfff2, 0xfff3, 0xfff4 };
40 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xffffffb9, 0xffffffba,
41                                          0xffffffbb, 0xffffffbc };
42 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xffffffffffffffed,
43                                          0xffffffffffffffee };
44 VECT_VAR_DECL(expected,poly,8,16) [] = { 0x33, 0x33, 0x33, 0x33,
45                                          0x33, 0x33, 0x33, 0x33,
46                                          0x33, 0x33, 0x33, 0x33,
47                                          0x33, 0x33, 0x33, 0x33 };
48 VECT_VAR_DECL(expected,poly,16,8) [] = { 0x3333, 0x3333, 0x3333, 0x3333,
49                                          0x3333, 0x3333, 0x3333, 0x3333 };
50 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0x33333333, 0x33333333,
51                                           0x33333333, 0x33333333 };
52
53 /* Expected results for float32 variants. Needs to be separated since
54    the generic test function does not test floating-point
55    versions.  */
56 VECT_VAR_DECL(expected_float32,hfloat,32,2) [] = { 0xc00ccccd, 0xc00ccccd };
57 VECT_VAR_DECL(expected_float32,hfloat,32,4) [] = { 0xc00ccccc, 0xc00ccccc,
58                                                    0xc00ccccc, 0xc00ccccc };
59
60 void exec_vsub_f32(void)
61 {
62   DECL_VARIABLE(vector, float, 32, 2);
63   DECL_VARIABLE(vector, float, 32, 4);
64
65   DECL_VARIABLE(vector2, float, 32, 2);
66   DECL_VARIABLE(vector2, float, 32, 4);
67
68   DECL_VARIABLE(vector_res, float, 32, 2);
69   DECL_VARIABLE(vector_res, float, 32, 4);
70
71   VDUP(vector, , float, f, 32, 2, 2.3f);
72   VDUP(vector, q, float, f, 32, 4, 3.4f);
73
74   VDUP(vector2, , float, f, 32, 2, 4.5f);
75   VDUP(vector2, q, float, f, 32, 4, 5.6f);
76
77   TEST_BINARY_OP(INSN_NAME, , float, f, 32, 2);
78   TEST_BINARY_OP(INSN_NAME, q, float, f, 32, 4);
79
80   CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected_float32, "");
81   CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected_float32, "");
82 }