1 /* Verify that overloaded built-ins for vec_and, vec_andc, vec_or and vec_xor
2  * with int inputs produce the right results.  */
3 
4 /* { dg-do compile } */
5 /* { dg-require-effective-target powerpc_vsx_ok } */
6 /* { dg-options "-mvsx -O1" } */
7 
8 #include <altivec.h>
9 
10 vector signed int
test1_or(vector bool int x,vector signed int y)11 test1_or (vector bool int x, vector signed int y)
12 {
13   vector signed int *foo;
14   *foo += vec_or (x, y);
15   return *foo;
16 }
17 
18 vector signed int
test1_xor(vector bool int x,vector signed int y)19 test1_xor (vector bool int x, vector signed int y)
20 {
21   vector signed int *foo;
22   *foo += vec_xor (x, y);
23   return *foo;
24 }
25 
26 vector signed int
test2_or(vector signed int x,vector bool int y)27 test2_or (vector signed int x, vector bool int y)
28 {
29   vector signed int *foo;
30   *foo += vec_or (x, y);
31   return *foo;
32 }
33 
34 vector signed int
test2_xor(vector signed int x,vector bool int y)35 test2_xor (vector signed int x, vector bool int y)
36 {
37   vector signed int *foo;
38   *foo += vec_xor (x, y);
39   return *foo;
40 }
41 
42 vector signed int
test3_or(vector signed int x,vector signed int y)43 test3_or (vector signed int x, vector signed int y)
44 {
45   vector signed int *foo;
46   *foo += vec_or (x, y);
47   return *foo;
48 }
49 
50 vector signed int
test3_xor(vector signed int x,vector signed int y)51 test3_xor (vector signed int x, vector signed int y)
52 {
53   vector signed int *foo;
54   *foo += vec_xor (x, y);
55   return *foo;
56 }
57 
58 vector signed int
test3_nor(vector signed int x,vector signed int y)59 test3_nor (vector signed int x, vector signed int y)
60 {
61   vector signed int *foo;
62   *foo += vec_nor (x, y);
63   return *foo;
64 }
65 
66 vector unsigned int
test4_or(vector bool int x,vector unsigned int y)67 test4_or (vector bool int x, vector unsigned int y)
68 {
69   vector unsigned int *foo;
70   *foo += vec_or (x, y);
71   return *foo;
72 }
73 
74 vector unsigned int
test4_xor(vector bool int x,vector unsigned int y)75 test4_xor (vector bool int x, vector unsigned int y)
76 {
77   vector unsigned int *foo;
78   *foo += vec_xor (x, y);
79   return *foo;
80 }
81 
82 vector unsigned int
test5_or(vector unsigned int x,vector bool int y)83 test5_or (vector unsigned int x, vector bool int y)
84 {
85   vector unsigned int *foo;
86   *foo += vec_or (x, y);
87   return *foo;
88 }
89 
90 vector unsigned int
test5_xor(vector unsigned int x,vector bool int y)91 test5_xor (vector unsigned int x, vector bool int y)
92 {
93   vector unsigned int *foo;
94   *foo += vec_xor (x, y);
95   return *foo;
96 }
97 
98 vector unsigned int
test6_or(vector unsigned int x,vector unsigned int y)99 test6_or (vector unsigned int x, vector unsigned int y)
100 {
101   vector unsigned int *foo;
102   *foo += vec_or (x, y);
103   return *foo;
104 }
105 
106 vector unsigned int
test6_xor(vector unsigned int x,vector unsigned int y)107 test6_xor (vector unsigned int x, vector unsigned int y)
108 {
109   vector unsigned int *foo;
110   *foo += vec_xor (x, y);
111   return *foo;
112 }
113 
114 vector unsigned int
test6_nor(vector unsigned int x,vector unsigned int y)115 test6_nor (vector unsigned int x, vector unsigned int y)
116 {
117   vector unsigned int *foo;
118   *foo += vec_nor (x, y);
119   return *foo;
120 }
121 
122 /* { dg-final { scan-assembler-times {\mxxlor\M} 6 } } */
123 /* { dg-final { scan-assembler-times {\mxxlxor\M} 6 } } */
124 /* { dg-final { scan-assembler-times {\mxxlnor\M} 2 } } */
125