[ARM,AArch64][testsuite] AdvSIMD intrinsics tests cleanup: remove useless expected...
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vqneg.c
blob21a0926813a396c51986304e80e21cce89dd6095
1 #define INSN_NAME vqneg
2 #define TEST_MSG "VQNEG/VQNEGQ"
4 /* Extra tests for functions requiring corner cases tests */
5 void vqneg_extra(void);
6 #define EXTRA_TESTS vqneg_extra
8 #include "unary_sat_op.inc"
10 /* Expected results. */
11 VECT_VAR_DECL(expected,int,8,8) [] = { 0x10, 0xf, 0xe, 0xd, 0xc, 0xb, 0xa, 0x9 };
12 VECT_VAR_DECL(expected,int,16,4) [] = { 0x10, 0xf, 0xe, 0xd };
13 VECT_VAR_DECL(expected,int,32,2) [] = { 0x10, 0xf };
14 VECT_VAR_DECL(expected,int,8,16) [] = { 0x10, 0xf, 0xe, 0xd,
15 0xc, 0xb, 0xa, 0x9,
16 0x8, 0x7, 0x6, 0x5,
17 0x4, 0x3, 0x2, 0x1 };
18 VECT_VAR_DECL(expected,int,16,8) [] = { 0x10, 0xf, 0xe, 0xd,
19 0xc, 0xb, 0xa, 0x9 };
20 VECT_VAR_DECL(expected,int,32,4) [] = { 0x10, 0xf, 0xe, 0xd };
22 /* Expected values of cumulative_saturation flag. */
23 int VECT_VAR(expected_cumulative_sat,int,8,8) = 0;
24 int VECT_VAR(expected_cumulative_sat,int,16,4) = 0;
25 int VECT_VAR(expected_cumulative_sat,int,32,2) = 0;
26 int VECT_VAR(expected_cumulative_sat,int,8,16) = 0;
27 int VECT_VAR(expected_cumulative_sat,int,16,8) = 0;
28 int VECT_VAR(expected_cumulative_sat,int,32,4) = 0;
30 /* Expected results when input is the min negative value of the type. */
31 VECT_VAR_DECL(expected_min_neg,int,8,8) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
32 0x7f, 0x7f, 0x7f, 0x7f };
33 VECT_VAR_DECL(expected_min_neg,int,16,4) [] = { 0x7fff, 0x7fff,
34 0x7fff, 0x7fff };
35 VECT_VAR_DECL(expected_min_neg,int,32,2) [] = { 0x7fffffff, 0x7fffffff };
36 VECT_VAR_DECL(expected_min_neg,int,8,16) [] = { 0x7f, 0x7f, 0x7f, 0x7f,
37 0x7f, 0x7f, 0x7f, 0x7f,
38 0x7f, 0x7f, 0x7f, 0x7f,
39 0x7f, 0x7f, 0x7f, 0x7f };
40 VECT_VAR_DECL(expected_min_neg,int,16,8) [] = { 0x7fff, 0x7fff,
41 0x7fff, 0x7fff,
42 0x7fff, 0x7fff,
43 0x7fff, 0x7fff };
44 VECT_VAR_DECL(expected_min_neg,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
45 0x7fffffff, 0x7fffffff };
47 /* Expected values of cumulative_saturation flag when input is the min
48 negative value of the type. */
49 int VECT_VAR(expected_cumulative_sat_min_neg,int,8,8) = 1;
50 int VECT_VAR(expected_cumulative_sat_min_neg,int,16,4) = 1;
51 int VECT_VAR(expected_cumulative_sat_min_neg,int,32,2) = 1;
52 int VECT_VAR(expected_cumulative_sat_min_neg,int,8,16) = 1;
53 int VECT_VAR(expected_cumulative_sat_min_neg,int,16,8) = 1;
54 int VECT_VAR(expected_cumulative_sat_min_neg,int,32,4) = 1;
56 void vqneg_extra()
58 /* No need for 64 bits variants. */
59 DECL_VARIABLE(vector, int, 8, 8);
60 DECL_VARIABLE(vector, int, 16, 4);
61 DECL_VARIABLE(vector, int, 32, 2);
62 DECL_VARIABLE(vector, int, 8, 16);
63 DECL_VARIABLE(vector, int, 16, 8);
64 DECL_VARIABLE(vector, int, 32, 4);
66 DECL_VARIABLE(vector_res, int, 8, 8);
67 DECL_VARIABLE(vector_res, int, 16, 4);
68 DECL_VARIABLE(vector_res, int, 32, 2);
69 DECL_VARIABLE(vector_res, int, 8, 16);
70 DECL_VARIABLE(vector_res, int, 16, 8);
71 DECL_VARIABLE(vector_res, int, 32, 4);
73 clean_results ();
75 /* Initialize input "vector" with min negative values to check
76 saturation. */
77 VDUP(vector, , int, s, 8, 8, 0x80);
78 VDUP(vector, , int, s, 16, 4, 0x8000);
79 VDUP(vector, , int, s, 32, 2, 0x80000000);
80 VDUP(vector, q, int, s, 8, 16, 0x80);
81 VDUP(vector, q, int, s, 16, 8, 0x8000);
82 VDUP(vector, q, int, s, 32, 4, 0x80000000);
84 #define MSG "min negative input"
85 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8, expected_cumulative_sat_min_neg, MSG);
86 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4, expected_cumulative_sat_min_neg, MSG);
87 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2, expected_cumulative_sat_min_neg, MSG);
88 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16, expected_cumulative_sat_min_neg, MSG);
89 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8, expected_cumulative_sat_min_neg, MSG);
90 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4, expected_cumulative_sat_min_neg, MSG);
92 CHECK(TEST_MSG, int, 8, 8, PRIx8, expected_min_neg, MSG);
93 CHECK(TEST_MSG, int, 16, 4, PRIx8, expected_min_neg, MSG);
94 CHECK(TEST_MSG, int, 32, 2, PRIx8, expected_min_neg, MSG);
95 CHECK(TEST_MSG, int, 8, 16, PRIx8, expected_min_neg, MSG);
96 CHECK(TEST_MSG, int, 16, 8, PRIx8, expected_min_neg, MSG);
97 CHECK(TEST_MSG, int, 32, 4, PRIx8, expected_min_neg, MSG);