| 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-options "-mvsx -O1" } */ |
| 6 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 7 |
|
| 8 |
#include <altivec.h> |
| 9 |
|
| 10 |
vector signed int |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 |
| 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 } } */ |