match.pd: Fold vec_perm with view_convert
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / builtins-3-p9.c
blobb54bda99eacd0fdd1c6481f5d5721e50da836296
1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power9 -mvsx -O1" } */
3 /* { dg-require-effective-target powerpc_vsx } */
5 #include <altivec.h>
7 vector bool char
8 test_ne_char (vector bool char x, vector bool char y)
10 return vec_cmpne (x, y);
13 vector bool short
14 test_ne_short (vector bool short x, vector bool short y)
16 return vec_cmpne (x, y);
19 vector bool int
20 test_ne_int (vector bool int x, vector bool int y)
22 return vec_cmpne (x, y);
25 vector bool long long
26 test_ne_long (vector bool long long x, vector bool long long y)
28 return vec_cmpne (x, y);
31 vector long long
32 test_nabs_long_long (vector long long x)
34 return vec_nabs (x);
37 vector long long
38 test_neg_long_long (vector long long x)
40 return vec_neg (x);
43 vector unsigned long long
44 test_vull_bperm_vull_vuc (vector unsigned long long x,
45 vector unsigned char y)
47 return vec_bperm (x, y);
50 vector signed char
51 test_nabs_char (vector signed char x)
53 return vec_nabs (x);
56 vector short
57 test_nabs_short (vector short x)
59 return vec_nabs (x);
62 vector int
63 test_nabs_int (vector int x)
65 return vec_nabs (x);
69 vector signed char
70 test_neg_char (vector signed char x)
72 return vec_neg (x);
75 vector short
76 test_neg_short (vector short x)
78 return vec_neg (x);
81 vector int
82 test_neg_int (vector int x)
84 return vec_neg (x);
87 /* Expected test results:
89 test_ne_char 1 vcmpneb
90 test_ne_short 1 vcmpneh
91 test_ne_int 1 vcmpnew
92 test_ne_long 1 vcmpequd, 1 xxlnor inst
93 test_neg_long_long 1 vnegd
94 test_vull_bperm_vull_vuc 1 vbpermd
95 test_nabs_long_long (-O0) 1 xxspltib, 1 vsubudm, 1 vminsd
96 test_nabs_long_long (-O1) 1 vnegd, vminsd
97 test_nabs_char (P9) 1 xxspltib, 1 vsububm, 1 vminsb
98 test_nabs_short (P9) 1 xxspltib, 1 vsubuhm, 1 vminsh
99 test_nabs_int (P9) 1 vnegw, 1 vminsw
100 test_neg_char (P9) 1 xxspltib, 1 vsububm
101 test_neg_short (P9) 1 xxspltib, 1 vsubuhm
102 test_neg_int (P9) 1 vnegw
105 /* { dg-final { scan-assembler-times "vcmpneb" 1 } } */
106 /* { dg-final { scan-assembler-times "vcmpneh" 1 } } */
107 /* { dg-final { scan-assembler-times "vcmpnew" 1 } } */
108 /* { dg-final { scan-assembler-times "vcmpequd" 1 } } */
109 /* { dg-final { scan-assembler-times "xxlnor" 1 } } */
110 /* { dg-final { scan-assembler-times "xxspltib" 4 } } */
111 /* { dg-final { scan-assembler-times "vsubudm" 0 } } */
112 /* { dg-final { scan-assembler-times "vsububm" 2 } } */
113 /* { dg-final { scan-assembler-times "vsubuhm" 2 } } */
114 /* { dg-final { scan-assembler-times "vsubuwm" 0 } } */
115 /* { dg-final { scan-assembler-times "vminsb" 1 } } */
116 /* { dg-final { scan-assembler-times "vminsh" 1 } } */
117 /* { dg-final { scan-assembler-times "vminsw" 1 } } */
118 /* { dg-final { scan-assembler-times "vminsd" 1 } } */
119 /* { dg-final { scan-assembler-times "vnegd" 2 } } */
120 /* { dg-final { scan-assembler-times "vnegw" 2 } } */
121 /* { dg-final { scan-assembler-times "vbpermd" 1 } } */