[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr78604.c
blobf6ac7f15985ba43c17d9d9d5b9fd62246d4ef693
1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -O2 -ftree-vectorize -fdump-tree-vect-details -fno-unroll-loops" } */
6 #ifndef SIZE
7 #define SIZE 1024
8 #endif
10 #ifndef ALIGN
11 #define ALIGN 32
12 #endif
14 #ifndef TYPE
15 #define TYPE long long
16 #endif
18 #ifndef SIGN_TYPE
19 #define SIGN_TYPE signed TYPE
20 #endif
22 #ifndef UNS_TYPE
23 #define UNS_TYPE unsigned TYPE
24 #endif
26 #define ALIGN_ATTR __attribute__((__aligned__(ALIGN)))
28 SIGN_TYPE sa[SIZE] ALIGN_ATTR;
29 SIGN_TYPE sb[SIZE] ALIGN_ATTR;
30 SIGN_TYPE sc[SIZE] ALIGN_ATTR;
32 UNS_TYPE ua[SIZE] ALIGN_ATTR;
33 UNS_TYPE ub[SIZE] ALIGN_ATTR;
34 UNS_TYPE uc[SIZE] ALIGN_ATTR;
36 void
37 sign_lt (SIGN_TYPE val1, SIGN_TYPE val2)
39 unsigned long i;
41 for (i = 0; i < SIZE; i++)
42 sa[i] = (sb[i] < sc[i]) ? val1 : val2;
45 void
46 sign_lte (SIGN_TYPE val1, SIGN_TYPE val2)
48 unsigned long i;
50 for (i = 0; i < SIZE; i++)
51 sa[i] = (sb[i] <= sc[i]) ? val1 : val2;
54 void
55 sign_gt (SIGN_TYPE val1, SIGN_TYPE val2)
57 unsigned long i;
59 for (i = 0; i < SIZE; i++)
60 sa[i] = (sb[i] > sc[i]) ? val1 : val2;
63 void
64 sign_gte (SIGN_TYPE val1, SIGN_TYPE val2)
66 unsigned long i;
68 for (i = 0; i < SIZE; i++)
69 sa[i] = (sb[i] >= sc[i]) ? val1 : val2;
73 void
74 uns_lt (UNS_TYPE val1, UNS_TYPE val2)
76 unsigned long i;
78 for (i = 0; i < SIZE; i++)
79 ua[i] = (ub[i] < uc[i]) ? val1 : val2;
82 void
83 uns_lte (UNS_TYPE val1, UNS_TYPE val2)
85 unsigned long i;
87 for (i = 0; i < SIZE; i++)
88 ua[i] = (ub[i] <= uc[i]) ? val1 : val2;
91 void
92 uns_gt (UNS_TYPE val1, UNS_TYPE val2)
94 unsigned long i;
96 for (i = 0; i < SIZE; i++)
97 ua[i] = (ub[i] > uc[i]) ? val1 : val2;
100 void
101 uns_gte (UNS_TYPE val1, UNS_TYPE val2)
103 unsigned long i;
105 for (i = 0; i < SIZE; i++)
106 ua[i] = (ub[i] >= uc[i]) ? val1 : val2;
109 /* { dg-final { scan-assembler-times {\mvcmpgtsd\M} 4 } } */
110 /* { dg-final { scan-assembler-times {\mvcmpgtud\M} 4 } } */
111 /* { dg-final { scan-assembler-not {\mvcmpequd\M} } } */
112 /* For each function, one is for the comparison statement and the other
113 is for the condition statement which consumes the compared result. */
114 /* { dg-final { scan-tree-dump-times "vect_model_simple_cost" 16 "vect" } } */