Debian Codegraph @

gcc/testsuite/gcc.target/powerpc/builtins-3-p9.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-mdejagnu-cpu=power9 -mvsx -O1" } */
3 /* { dg-require-effective-target powerpc_vsx } */
4
5 #include <altivec.h>
6
7 vector bool char
8 test_ne_char (vector bool char x, vector bool char y)
9 {
10 return vec_cmpne (x, y);
11 }
12
13 vector bool short
14 test_ne_short (vector bool short x, vector bool short y)
15 {
16 return vec_cmpne (x, y);
17 }
18
19 vector bool int
20 test_ne_int (vector bool int x, vector bool int y)
21 {
22 return vec_cmpne (x, y);
23 }
24
25 vector bool long long
26 test_ne_long (vector bool long long x, vector bool long long y)
27 {
28 return vec_cmpne (x, y);
29 }
30
31 vector long long
32 test_nabs_long_long (vector long long x)
33 {
34 return vec_nabs (x);
35 }
36
37 vector long long
38 test_neg_long_long (vector long long x)
39 {
40 return vec_neg (x);
41 }
42
43 vector unsigned long long
44 test_vull_bperm_vull_vuc (vector unsigned long long x,
45 vector unsigned char y)
46 {
47 return vec_bperm (x, y);
48 }
49
50 vector signed char
51 test_nabs_char (vector signed char x)
52 {
53 return vec_nabs (x);
54 }
55
56 vector short
57 test_nabs_short (vector short x)
58 {
59 return vec_nabs (x);
60 }
61
62 vector int
63 test_nabs_int (vector int x)
64 {
65 return vec_nabs (x);
66 }
67
68
69 vector signed char
70 test_neg_char (vector signed char x)
71 {
72 return vec_neg (x);
73 }
74
75 vector short
76 test_neg_short (vector short x)
77 {
78 return vec_neg (x);
79 }
80
81 vector int
82 test_neg_int (vector int x)
83 {
84 return vec_neg (x);
85 }
86
87 /* Expected test results:
88
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
103 */
104
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 } } */
122