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