| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target s390_vxe2 } */ |
| 3 |
/* { dg-options "-O3 -mzarch -march=arch13 -mzvector --save-temps" } */ |
| 4 |
|
| 5 |
#include <vecintrin.h> |
| 6 |
|
| 7 |
void __attribute__((noinline,noclone)) |
| 8 |
vstrs1 () |
| 9 |
{ |
| 10 |
int cc; |
| 11 |
vector signed char haystack = { 'h', 'o', 'l', 'a', 'h', 'i', 'h', 'o', |
| 12 |
'h', 'i', 'h', 'o' }; |
| 13 |
vector signed char needle = { 'h', 'i', 'h', 'o', 0 }; |
| 14 |
vector unsigned char length = { 0 }; |
| 15 |
length[7] = 16; |
| 16 |
|
| 17 |
vector unsigned char result |
| 18 |
= vec_search_string_until_zero_cc (haystack, needle, |
| 19 |
length, &cc); |
| 20 |
|
| 21 |
if (result[7] != 4) |
| 22 |
__builtin_abort (); |
| 23 |
|
| 24 |
/* CC2 indicates a full match. */ |
| 25 |
if (cc != 2) |
| 26 |
__builtin_abort (); |
| 27 |
} |
| 28 |
|
| 29 |
int |
| 30 |
main () |
| 31 |
{ |
| 32 |
vstrs1 (); |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |
| 36 |
|
| 37 |
/* { dg-final { scan-assembler-times "vstrszb\t" 1 } } */ |