Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-3-p9.c
bloba175890d5a3780e4b0ac51212302c9248b44dce3
1 /* { dg-do compile { target { le } } } */
2 /* { dg-require-effective-target powerpc_p9vector_ok } */
3 /* { dg-options "-mcpu=power9 -O1" } */
4 /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */
6 #include <altivec.h>
8 vector bool char
9 test_ne_char (vector bool char x, vector bool char y)
11 return vec_cmpne (x, y);
14 vector bool short
15 test_ne_short (vector bool short x, vector bool short y)
17 return vec_cmpne (x, y);
20 vector bool int
21 test_ne_int (vector bool int x, vector bool int y)
23 return vec_cmpne (x, y);
26 vector bool long long
27 test_ne_long (vector bool long long x, vector bool long long y)
29 return vec_cmpne (x, y);
32 vector long long
33 test_nabs_long_long (vector long long x)
35 return vec_nabs (x);
38 vector long long
39 test_neg_long_long (vector long long x)
41 return vec_neg (x);
44 vector unsigned long long
45 test_vull_bperm_vull_vuc (vector unsigned long long x,
46 vector unsigned char y)
48 return vec_bperm (x, y);
51 vector signed char
52 test_nabs_char (vector signed char x)
54 return vec_nabs (x);
57 vector short
58 test_nabs_short (vector short x)
60 return vec_nabs (x);
63 vector int
64 test_nabs_int (vector int x)
66 return vec_nabs (x);
70 vector signed char
71 test_neg_char (vector signed char x)
73 return vec_neg (x);
76 vector short
77 test_neg_short (vector short x)
79 return vec_neg (x);
82 vector int
83 test_neg_int (vector int x)
85 return vec_neg (x);
88 /* Expected test results:
90 test_ne_char 1 vcmpneb
91 test_ne_short 1 vcmpneh
92 test_ne_int 1 vcmpnew
93 test_ne_long 1 vcmpequd, 1 xxlnor inst
94 test_neg_long_long 1 vnegd
95 test_vull_bperm_vull_vuc 1 vbpermd
96 test_nabs_long_long (-O0) 1 xxspltib, 1 vsubudm, 1 vminsd
97 test_nabs_long_long (-O1) 1 vnegd, vminsd
98 test_nabs_char (P9) 1 xxspltib, 1 vsububm, 1 vminsb
99 test_nabs_short (P9) 1 xxspltib, 1 vsubuhm, 1 vminsh
100 test_nabs_int (P9) 1 vnegw, 1 vminsw
101 test_neg_char (P9) 1 xxspltib, 1 vsububm
102 test_neg_short (P9) 1 xxspltib, 1 vsubuhm
103 test_neg_int (P9) 1 vnegw
106 /* { dg-final { scan-assembler-times "vcmpneb" 1 } } */
107 /* { dg-final { scan-assembler-times "vcmpneh" 1 } } */
108 /* { dg-final { scan-assembler-times "vcmpnew" 1 } } */
109 /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
110 /* { dg-final { scan-assembler-times "xxlnor" 1 } } */
111 /* { dg-final { scan-assembler-times "xxspltib" 4 } } */
112 /* { dg-final { scan-assembler-times "vsubudm" 0 } } */
113 /* { dg-final { scan-assembler-times "vsububm" 2 } } */
114 /* { dg-final { scan-assembler-times "vsubuhm" 2 } } */
115 /* { dg-final { scan-assembler-times "vsubuwm" 0 } } */
116 /* { dg-final { scan-assembler-times "vminsb" 1 } } */
117 /* { dg-final { scan-assembler-times "vminsh" 1 } } */
118 /* { dg-final { scan-assembler-times "vminsw" 1 } } */
119 /* { dg-final { scan-assembler-times "vminsd" 1 } } */
120 /* { dg-final { scan-assembler-times "vnegd" 2 } } */
121 /* { dg-final { scan-assembler-times "vnegw" 2 } } */
122 /* { dg-final { scan-assembler-times "vbpermd" 1 } } */