Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/cmp_fp_op.inc

raw
1 /* Template file for the validation of comparison operator with
2 floating-point support.
3
4 This file is meant to be included by the relevant test files, which
5 have to define the intrinsic family to test. If a given intrinsic
6 supports variants which are not supported by all the other
7 operators, these can be tested by providing a definition for
8 EXTRA_TESTS. */
9
10 #include <arm_neon.h>
11 #include "arm-neon-ref.h"
12 #include "compute-ref-data.h"
13
14 /* Additional expected results declaration, they are initialized in
15 each test file. */
16 extern ARRAY(expected2, uint, 32, 2);
17 extern ARRAY(expected2, uint, 32, 4);
18 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
19 extern ARRAY(expected2, uint, 16, 4);
20 extern ARRAY(expected2, uint, 16, 8);
21 #endif
22
23 #define FNNAME1(NAME) exec_ ## NAME
24 #define FNNAME(NAME) FNNAME1(NAME)
25
26 void FNNAME (INSN_NAME) (void)
27 {
28 /* Basic test: y=vcomp(x1,x2), then store the result. */
29 #define TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N) \
30 VECT_VAR(vector_res, T3, W, N) = \
31 INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \
32 VECT_VAR(vector2, T1, W, N)); \
33 vst1##Q##_u##W(VECT_VAR(result, T3, W, N), VECT_VAR(vector_res, T3, W, N))
34
35 #define TEST_VCOMP(INSN, Q, T1, T2, T3, W, N) \
36 TEST_VCOMP1(INSN, Q, T1, T2, T3, W, N)
37
38 DECL_VARIABLE(vector, float, 32, 2);
39 DECL_VARIABLE(vector, float, 32, 4);
40 DECL_VARIABLE(vector2, float, 32, 2);
41 DECL_VARIABLE(vector2, float, 32, 4);
42 DECL_VARIABLE(vector_res, uint, 32, 2);
43 DECL_VARIABLE(vector_res, uint, 32, 4);
44 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
45 DECL_VARIABLE(vector, float, 16, 4);
46 DECL_VARIABLE(vector, float, 16, 8);
47 DECL_VARIABLE(vector2, float, 16, 4);
48 DECL_VARIABLE(vector2, float, 16, 8);
49 DECL_VARIABLE(vector_res, uint, 16, 4);
50 DECL_VARIABLE(vector_res, uint, 16, 8);
51 #endif
52
53 clean_results ();
54
55 /* Initialize input "vector" from "buffer". */
56 VLOAD(vector, buffer, , float, f, 32, 2);
57 VLOAD(vector, buffer, q, float, f, 32, 4);
58 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
59 VLOAD(vector, buffer, , float, f, 16, 4);
60 VLOAD(vector, buffer, q, float, f, 16, 8);
61 #endif
62
63 /* Choose init value arbitrarily, will be used for vector
64 comparison. */
65 VDUP(vector2, , float, f, 32, 2, -16.0f);
66 VDUP(vector2, q, float, f, 32, 4, -14.0f);
67 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
68 VDUP(vector2, , float, f, 16, 4, -16.0f);
69 VDUP(vector2, q, float, f, 16, 8, -14.0f);
70 #endif
71
72 /* Apply operator named INSN_NAME. */
73 TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2);
74 CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, "");
75
76 TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4);
77 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
78
79 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
80 TEST_VCOMP(INSN_NAME, , float, f, uint, 16, 4);
81 CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, "");
82
83 TEST_VCOMP(INSN_NAME, q, float, f, uint, 16, 8);
84 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, "");
85 #endif
86
87 /* Test again, with different input values. */
88 VDUP(vector2, , float, f, 32, 2, -10.0f);
89 VDUP(vector2, q, float, f, 32, 4, 10.0f);
90
91 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
92 VDUP(vector2, , float, f, 16, 4, -10.0f);
93 VDUP(vector2, q, float, f, 16, 8, 10.0f);
94 #endif
95
96 TEST_VCOMP(INSN_NAME, , float, f, uint, 32, 2);
97 CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected2, "");
98
99 TEST_VCOMP(INSN_NAME, q, float, f, uint, 32, 4);
100 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected2,"");
101
102 #if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
103 TEST_VCOMP(INSN_NAME, , float, f, uint, 16, 4);
104 CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected2, "");
105
106 TEST_VCOMP(INSN_NAME, q, float, f, uint, 16, 8);
107 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected2,"");
108 #endif
109 }
110
111 int main (void)
112 {
113 FNNAME (INSN_NAME) ();
114
115 return 0;
116 }