| 1 |
/* Verify that overloaded built-ins for vec_orc and vec_nand with char |
| 2 |
* inputs produce the right results. These intrinsics (vec_orc, |
| 3 |
* vec_nand) were added as part of ISA 2.07 (P8). */ |
| 4 |
|
| 5 |
/* { dg-do compile } */ |
| 6 |
/* { dg-options "-mvsx -O1" } */ |
| 7 |
/* { dg-additional-options "-mdejagnu-cpu=power8" { target { ! has_arch_pwr8 } } } */ |
| 8 |
/* { dg-require-effective-target powerpc_vsx } */ |
| 9 |
|
| 10 |
#include <altivec.h> |
| 11 |
|
| 12 |
vector signed char |
| 13 |
test1_orc (vector bool char x, vector signed char y) |
| 14 |
{ |
| 15 |
vector signed char *foo; |
| 16 |
*foo += vec_orc (x, y); |
| 17 |
return *foo; |
| 18 |
} |
| 19 |
|
| 20 |
vector signed char |
| 21 |
test1_nand (vector bool char x, vector signed char y) |
| 22 |
{ |
| 23 |
vector signed char *foo; |
| 24 |
*foo += vec_nand (x, y); |
| 25 |
return *foo; |
| 26 |
} |
| 27 |
|
| 28 |
vector signed char |
| 29 |
test2_orc (vector signed char x, vector bool char y) |
| 30 |
{ |
| 31 |
vector signed char *foo; |
| 32 |
*foo += vec_orc (x, y); |
| 33 |
return *foo; |
| 34 |
} |
| 35 |
|
| 36 |
vector signed char |
| 37 |
test2_nand (vector signed char x, vector bool char y) |
| 38 |
{ |
| 39 |
vector signed char *foo; |
| 40 |
*foo += vec_nand (x, y); |
| 41 |
return *foo; |
| 42 |
} |
| 43 |
|
| 44 |
vector signed char |
| 45 |
test3_orc (vector signed char x, vector signed char y) |
| 46 |
{ |
| 47 |
vector signed char *foo; |
| 48 |
*foo += vec_orc (x, y); |
| 49 |
return *foo; |
| 50 |
} |
| 51 |
|
| 52 |
vector signed char |
| 53 |
test3_nand (vector signed char x, vector signed char y) |
| 54 |
{ |
| 55 |
vector signed char *foo; |
| 56 |
*foo += vec_nand (x, y); |
| 57 |
return *foo; |
| 58 |
} |
| 59 |
|
| 60 |
vector unsigned char |
| 61 |
test4_orc (vector bool char x, vector unsigned char y) |
| 62 |
{ |
| 63 |
vector unsigned char *foo; |
| 64 |
*foo += vec_orc (x, y); |
| 65 |
return *foo; |
| 66 |
} |
| 67 |
|
| 68 |
vector unsigned char |
| 69 |
test4_nand (vector bool char x, vector unsigned char y) |
| 70 |
{ |
| 71 |
vector unsigned char *foo; |
| 72 |
*foo += vec_nand (x, y); |
| 73 |
return *foo; |
| 74 |
} |
| 75 |
|
| 76 |
vector unsigned char |
| 77 |
test5_orc (vector unsigned char x, vector bool char y) |
| 78 |
{ |
| 79 |
vector unsigned char *foo; |
| 80 |
*foo += vec_orc (x, y); |
| 81 |
return *foo; |
| 82 |
} |
| 83 |
|
| 84 |
vector unsigned char |
| 85 |
test5_nand (vector unsigned char x, vector bool char y) |
| 86 |
{ |
| 87 |
vector unsigned char *foo; |
| 88 |
*foo += vec_nand (x, y); |
| 89 |
return *foo; |
| 90 |
} |
| 91 |
|
| 92 |
vector unsigned char |
| 93 |
test6_orc (vector unsigned char x, vector unsigned char y) |
| 94 |
{ |
| 95 |
vector unsigned char *foo; |
| 96 |
*foo += vec_orc (x, y); |
| 97 |
return *foo; |
| 98 |
} |
| 99 |
|
| 100 |
vector unsigned char |
| 101 |
test6_nand (vector unsigned char x, vector unsigned char y) |
| 102 |
{ |
| 103 |
vector unsigned char *foo; |
| 104 |
*foo += vec_nand (x, y); |
| 105 |
return *foo; |
| 106 |
} |
| 107 |
|
| 108 |
/* { dg-final { scan-assembler-times {\mxxlnand\M} 6 } } */ |
| 109 |
/* { dg-final { scan-assembler-times {\mxxlorc\M} 6 } } */ |