| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */ |
| 3 |
|
| 4 |
#define N 16 |
| 5 |
|
| 6 |
int foo1 () |
| 7 |
{ |
| 8 |
int i; |
| 9 |
char ia[N]; |
| 10 |
char ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 11 |
char ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 12 |
|
| 13 |
/* Not vectorizable, multiplication */ |
| 14 |
for (i = 0; i < N; i++) |
| 15 |
{ |
| 16 |
ia[i] = ib[i] * ic[i]; |
| 17 |
} |
| 18 |
|
| 19 |
/* check results: */ |
| 20 |
for (i = 0; i < N; i++) |
| 21 |
{ |
| 22 |
if (ia[i] != (char) (ib[i] * ic[i])) |
| 23 |
__builtin_abort (); |
| 24 |
} |
| 25 |
|
| 26 |
return 0; |
| 27 |
} |
| 28 |
|
| 29 |
typedef int half_word; |
| 30 |
|
| 31 |
int foo2 () |
| 32 |
{ |
| 33 |
int i; |
| 34 |
half_word ia[N]; |
| 35 |
half_word ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 36 |
half_word ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; |
| 37 |
|
| 38 |
/* Not worthwhile, only 2 parts per int */ |
| 39 |
for (i = 0; i < N; i++) |
| 40 |
{ |
| 41 |
ia[i] = ib[i] + ic[i]; |
| 42 |
} |
| 43 |
|
| 44 |
/* check results: */ |
| 45 |
for (i = 0; i < N; i++) |
| 46 |
{ |
| 47 |
if (ia[i] != ib[i] + ic[i]) |
| 48 |
__builtin_abort (); |
| 49 |
} |
| 50 |
|
| 51 |
return 0; |
| 52 |
} |
| 53 |
|
| 54 |
/* { dg-final { scan-assembler-times {li\s+[a-x0-9]+,0\s+ret} 2 } } */ |
| 55 |
/* { dg-final { scan-assembler-not {vset} } } */ |