1 /* { dg-do run { target { powerpc64*-*-* && { p8vector_hw } } } } */
2 /* { dg-require-effective-target powerpc_vsx_ok } */
3 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O3" } */
5 /* Test that the vec_cmpne builtin works as expected for long long
14 #define define_test_functions(VBTYPE, RTYPE, STYPE, NAME) \
16 RTYPE result_ne_##NAME[N] __attribute__((aligned(16))); \
17 RTYPE result_eq_##NAME[N] __attribute__((aligned(16))); \
18 STYPE operand1_##NAME[N] __attribute__((aligned(16))); \
19 STYPE operand2_##NAME[N] __attribute__((aligned(16))); \
20 RTYPE expected_##NAME[N] __attribute__((aligned(16))); \
22 __attribute__((noinline)) void vector_tests_##NAME () \
24 vector STYPE v1_##NAME, v2_##NAME; \
25 vector bool VBTYPE tmp_##NAME; \
27 for (i = 0; i < N; i+=16/sizeof (STYPE)) \
29 /* result_ne = operand1!=operand2. */ \
30 v1_##NAME = (vector STYPE) { operand1_##NAME[i], \
31 operand1_##NAME[i+1] }; \
32 v2_##NAME = (vector STYPE) { operand2_##NAME[i], \
33 operand2_##NAME[i+1] }; \
35 tmp_##NAME = vec_cmpeq (v1_##NAME, v2_##NAME); \
36 result_eq_##NAME[i] = tmp_##NAME[0]; \
37 result_eq_##NAME[i+1] = tmp_##NAME[1]; \
39 tmp_##NAME = vec_cmpne (v1_##NAME, v2_##NAME); \
40 result_ne_##NAME[i] = tmp_##NAME[0]; \
41 result_ne_##NAME[i+1] = tmp_##NAME[1]; \
45 __attribute__((noinline)) void init_##NAME () \
48 for (i = 0; i < N; ++i) \
50 result_ne_##NAME[i] = 7; \
51 result_eq_##NAME[i] = 15; \
55 operand1_##NAME[i] = 1; \
56 operand2_##NAME[i] = 2; \
61 operand1_##NAME[i] = 2; \
62 operand2_##NAME[i] = 1; \
67 operand1_##NAME[i] = 3; \
68 operand2_##NAME[i] = 3; \
70 /* For vector comparisons: "For each element of the result_ne, the \
71 value of each bit is 1 if the corresponding elements of ARG1 and \
72 ARG2 are equal." {or whatever the comparison is} "Otherwise, the \
73 value of each bit is 0." */ \
74 expected_##NAME[i] = -1 * (RTYPE)(operand1_##NAME[i] != operand2_##NAME[i]); \
78 __attribute__((noinline)) void verify_results_##NAME () \
81 for (i = 0; i < N; ++i) \
83 if ( ((result_ne_##NAME[i] != expected_##NAME[i]) || \
84 (result_ne_##NAME[i] == result_eq_##NAME[i]))) \
90 #define execute_test_functions(VBTYPE, RTYPE, STYPE, NAME) \
93 vector_tests_##NAME (); \
94 verify_results_##NAME (); \
98 define_test_functions (long long, signed long long, signed long long, si
);
99 define_test_functions (long long, signed long long, double, dd
);
103 execute_test_functions (long long, signed long long, signed long long, si
);
104 execute_test_functions (long long, signed long long, double, dd
);