[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / vsx-vector-6-func-cmp-run.c
blobf751ef64c563dfac0b5b4794c08cb48ba4324bd2
1 /* { dg-do run { target lp64 } } */
2 /* { dg-require-effective-target vsx_hw } */
3 /* { dg-options "-O2 -mvsx" } */
5 #define DEBUG 0
7 /* This file just generates calls to the various builtins and verifies the
8 expected number of instructions for each builtin were generated. */
10 #include "vsx-vector-6-func-cmp.h"
12 /* Macros to check the results of the builtin tests. */
13 #define FLOAT_CHECK(NAME) \
14 f_result = vec_##NAME (f_src_a, f_src_b); \
16 if ((f_result[0] != f_##NAME##_expected[0]) \
17 || (f_result[1] != f_##NAME##_expected[1]) \
18 || (f_result[2] != f_##NAME##_expected[2]) \
19 || (f_result[3] != f_##NAME##_expected[3])) \
20 { \
21 if (DEBUG) \
22 { \
23 printf("ERROR: vec_%s (float) expected value does not match\n", \
24 #NAME); \
25 printf(" expected[0] = 0x%x; result[0] =0x%x\n", \
26 f_##NAME##_expected[0], f_result[0]); \
27 printf(" expected[1] = 0x%x; result[1] = 0x%x\n", \
28 f_##NAME##_expected[1], f_result[1]); \
29 printf(" expected[2] = 0x%x; result[2] = 0x%x\n", \
30 f_##NAME##_expected[2], f_result[2]); \
31 printf(" expected[3] = 0x%x; result[3] = 0x%x\n", \
32 f_##NAME##_expected[3], f_result[3]); \
33 } \
34 else \
35 abort(); \
38 #define DOUBLE_CHECK(NAME) \
39 d_result = vec_##NAME (d_src_a, d_src_b); \
41 if ((d_result[0] != d_##NAME##_expected[0]) \
42 || (d_result[1] != d_##NAME##_expected[1])) \
43 { \
44 if (DEBUG) \
45 { \
46 printf("ERROR: vec_%s (double) expected value does not match\n", \
47 #NAME); \
48 printf(" expected[0] = 0x%lx; result[0] = 0x%lx\n", \
49 d_##NAME##_expected[0], d_result[0]); \
50 printf(" expected[1] = 0x%lx; result[1] = 0x%lx\n", \
51 d_##NAME##_expected[1], d_result[1]); \
52 } \
53 else \
54 abort(); \
57 int
58 main () {
59 int i;
60 vector float f_src_a = { 126.0, 23.0, -338.0, 17.0};
61 vector float f_src_b = { 2.00, 23.0, 1.0, 4.0};
62 vector bool f_result;
63 vector bool int f_cmpeq_expected = {0x0, 0xFFFFFFFF, 0x0, 0x0};
64 vector bool int f_cmpgt_expected = {0xFFFFFFFF, 0x0, 0x0, 0xFFFFFFFF};
65 vector bool int f_cmpge_expected = {0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0xFFFFFFFF};
66 vector bool int f_cmplt_expected = {0x0, 0x0, 0xFFFFFFFF, 0x0};
67 vector bool int f_cmple_expected = {0x0, 0xFFFFFFFF, 0xFFFFFFFF, 0x0};
69 vector double d_src_a = { 125.44, -338.56};
70 vector double d_src_b = { 4.0, -338.56};
71 vector bool long long d_result;
72 vector bool long long d_cmpeq_expected = {0x0, 0xFFFFFFFFFFFFFFFF};
73 vector bool long long d_cmpgt_expected = {0xFFFFFFFFFFFFFFFF, 0x0};
74 vector bool long long d_cmpge_expected = {0xFFFFFFFFFFFFFFFF,
75 0xFFFFFFFFFFFFFFFF};
76 vector bool long long d_cmplt_expected = {0x0, 0x0};
77 vector bool long long d_cmple_expected = {0x0, 0xFFFFFFFFFFFFFFFF};
79 FLOAT_CHECK (cmpeq)
80 FLOAT_CHECK (cmpgt)
81 FLOAT_CHECK (cmpge)
82 FLOAT_CHECK (cmplt)
83 FLOAT_CHECK (cmple)
85 DOUBLE_CHECK (cmpeq)
86 DOUBLE_CHECK (cmpgt)
87 DOUBLE_CHECK (cmpge)
88 DOUBLE_CHECK (cmplt)
89 DOUBLE_CHECK (cmple)
91 return 0;