| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=zvl -ffast-math -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
|
| 6 |
void __attribute__((noipa)) |
| 7 |
add_loop (unsigned int *x, unsigned int *res) |
| 8 |
{ |
| 9 |
unsigned int res0 = res[0]; |
| 10 |
unsigned int res1 = res[1]; |
| 11 |
for (int i = 0; i < 0x7ff; ++i) |
| 12 |
{ |
| 13 |
res0 += x[i * 2]; |
| 14 |
res1 += x[i * 2 + 1]; |
| 15 |
} |
| 16 |
res[0] = res0; |
| 17 |
res[1] = res1; |
| 18 |
} |
| 19 |
|
| 20 |
void __attribute__((noipa)) |
| 21 |
min_loop (unsigned int *x, unsigned int *res) |
| 22 |
{ |
| 23 |
unsigned int res0 = res[0]; |
| 24 |
unsigned int res1 = res[1]; |
| 25 |
for (int i = 0; i < 0x7ff; ++i) |
| 26 |
{ |
| 27 |
res0 = res0 < x[i * 2] ? res0 : x[i * 2]; |
| 28 |
res1 = res1 < x[i * 2 + 1] ? res1 : x[i * 2 + 1]; |
| 29 |
} |
| 30 |
res[0] = res0; |
| 31 |
res[1] = res1; |
| 32 |
} |
| 33 |
|
| 34 |
void __attribute__((noipa)) |
| 35 |
max_loop (unsigned int *x, unsigned int *res) |
| 36 |
{ |
| 37 |
unsigned int res0 = res[0]; |
| 38 |
unsigned int res1 = res[1]; |
| 39 |
for (int i = 0; i < 0x7ff; ++i) |
| 40 |
{ |
| 41 |
res0 = res0 > x[i * 2] ? res0 : x[i * 2]; |
| 42 |
res1 = res1 > x[i * 2 + 1] ? res1 : x[i * 2 + 1]; |
| 43 |
} |
| 44 |
res[0] = res0; |
| 45 |
res[1] = res1; |
| 46 |
} |
| 47 |
|
| 48 |
void __attribute__((noipa)) |
| 49 |
and_loop (unsigned int *x, unsigned int *res) |
| 50 |
{ |
| 51 |
unsigned int res0 = res[0]; |
| 52 |
unsigned int res1 = res[1]; |
| 53 |
for (int i = 0; i < 0x7ff; ++i) |
| 54 |
{ |
| 55 |
res0 &= x[i * 2]; |
| 56 |
res1 &= x[i * 2 + 1]; |
| 57 |
} |
| 58 |
res[0] = res0; |
| 59 |
res[1] = res1; |
| 60 |
} |
| 61 |
|
| 62 |
void __attribute__((noipa)) |
| 63 |
or_loop (unsigned int *x, unsigned int *res) |
| 64 |
{ |
| 65 |
unsigned int res0 = res[0]; |
| 66 |
unsigned int res1 = res[1]; |
| 67 |
for (int i = 0; i < 0x7ff; ++i) |
| 68 |
{ |
| 69 |
res0 |= x[i * 2]; |
| 70 |
res1 |= x[i * 2 + 1]; |
| 71 |
} |
| 72 |
res[0] = res0; |
| 73 |
res[1] = res1; |
| 74 |
} |
| 75 |
|
| 76 |
void __attribute__((noipa)) |
| 77 |
eor_loop (unsigned int *x, unsigned int *res) |
| 78 |
{ |
| 79 |
unsigned int res0 = res[0]; |
| 80 |
unsigned int res1 = res[1]; |
| 81 |
for (int i = 0; i < 0x7ff; ++i) |
| 82 |
{ |
| 83 |
res0 ^= x[i * 2]; |
| 84 |
res1 ^= x[i * 2 + 1]; |
| 85 |
} |
| 86 |
res[0] = res0; |
| 87 |
res[1] = res1; |
| 88 |
} |