| 1 |
/* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */ |
| 2 |
|
| 3 |
unsigned short __attribute__((noipa)) |
| 4 |
add_loop (unsigned short *x) |
| 5 |
{ |
| 6 |
unsigned short res = 0; |
| 7 |
for (int i = 0; i < 0xfff; ++i) |
| 8 |
res += x[i]; |
| 9 |
return res; |
| 10 |
} |
| 11 |
|
| 12 |
unsigned short __attribute__((noipa)) |
| 13 |
min_loop (unsigned short *x) |
| 14 |
{ |
| 15 |
unsigned short res = ~0; |
| 16 |
for (int i = 0; i < 0xfff; ++i) |
| 17 |
res = res < x[i] ? res : x[i]; |
| 18 |
return res; |
| 19 |
} |
| 20 |
|
| 21 |
unsigned short __attribute__((noipa)) |
| 22 |
max_loop (unsigned short *x) |
| 23 |
{ |
| 24 |
unsigned short res = 0; |
| 25 |
for (int i = 0; i < 0xfff; ++i) |
| 26 |
res = res > x[i] ? res : x[i]; |
| 27 |
return res; |
| 28 |
} |
| 29 |
|
| 30 |
unsigned short __attribute__((noipa)) |
| 31 |
and_loop (unsigned short *x) |
| 32 |
{ |
| 33 |
unsigned short res = ~0; |
| 34 |
for (int i = 0; i < 0xfff; ++i) |
| 35 |
res &= x[i]; |
| 36 |
return res; |
| 37 |
} |
| 38 |
|
| 39 |
unsigned short __attribute__((noipa)) |
| 40 |
or_loop (unsigned short *x) |
| 41 |
{ |
| 42 |
unsigned short res = 0; |
| 43 |
for (int i = 0; i < 0xfff; ++i) |
| 44 |
res |= x[i]; |
| 45 |
return res; |
| 46 |
} |
| 47 |
|
| 48 |
unsigned short __attribute__((noipa)) |
| 49 |
eor_loop (unsigned short *x) |
| 50 |
{ |
| 51 |
unsigned short res = 0; |
| 52 |
for (int i = 0; i < 0xfff; ++i) |
| 53 |
res ^= x[i]; |
| 54 |
return res; |
| 55 |
} |
| 56 |
|
| 57 |
/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */ |
| 58 |
/* { dg-final { scan-assembler-times {\tadd\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */ |
| 59 |
/* { dg-final { scan-assembler-times {\tuaddv\t} 1 } } */ |
| 60 |
|
| 61 |
/* { dg-final { scan-assembler-times {\tumin\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */ |
| 62 |
/* { dg-final { scan-assembler-times {\tuminv\t} 1 } } */ |
| 63 |
|
| 64 |
/* { dg-final { scan-assembler-times {\tumax\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 2 } } */ |
| 65 |
/* { dg-final { scan-assembler-times {\tumaxv\t} 1 } } */ |
| 66 |
|
| 67 |
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */ |
| 68 |
/* { dg-final { scan-assembler-times {\tand\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */ |
| 69 |
/* { dg-final { scan-assembler-times {\tandv\t} 1 } } */ |
| 70 |
|
| 71 |
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */ |
| 72 |
/* { dg-final { scan-assembler-times {\torr\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */ |
| 73 |
/* { dg-final { scan-assembler-times {\torv\t} 1 } } */ |
| 74 |
|
| 75 |
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.d, z[0-9]+\.d, z[0-9]+\.d\n} 1 } } */ |
| 76 |
/* { dg-final { scan-assembler-times {\teor\tz[0-9]+\.h, p[0-7]/m, z[0-9]+\.h, z[0-9]+\.h\n} 1 } } */ |
| 77 |
/* { dg-final { scan-assembler-times {\teorv\t} 1 } } */ |