| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -ffast-math -fno-vect-cost-model" } */ |
| 3 |
|
| 4 |
#include <stdint-gcc.h> |
| 5 |
|
| 6 |
#define TEST_TYPE(TYPE) \ |
| 7 |
__attribute__ ((noipa)) void ternop_##TYPE (TYPE *__restrict dest1, \ |
| 8 |
TYPE *__restrict dest2, \ |
| 9 |
TYPE *__restrict dest3, \ |
| 10 |
TYPE *__restrict src1, \ |
| 11 |
TYPE *__restrict src2, int n) \ |
| 12 |
{ \ |
| 13 |
for (int i = 0; i < n; ++i) \ |
| 14 |
{ \ |
| 15 |
dest1[i] = -(src1[i] * src2[i]) + dest2[i]; \ |
| 16 |
dest2[i] += src1[i] * dest1[i]; \ |
| 17 |
dest3[i] += src2[i] * dest2[i]; \ |
| 18 |
} \ |
| 19 |
} |
| 20 |
|
| 21 |
#define TEST_ALL() \ |
| 22 |
TEST_TYPE (int8_t) \ |
| 23 |
TEST_TYPE (uint8_t) \ |
| 24 |
TEST_TYPE (int16_t) \ |
| 25 |
TEST_TYPE (uint16_t) \ |
| 26 |
TEST_TYPE (int32_t) \ |
| 27 |
TEST_TYPE (uint32_t) \ |
| 28 |
TEST_TYPE (int64_t) \ |
| 29 |
TEST_TYPE (uint64_t) \ |
| 30 |
TEST_TYPE (_Float16) \ |
| 31 |
TEST_TYPE (float) \ |
| 32 |
TEST_TYPE (double) |
| 33 |
|
| 34 |
TEST_ALL () |
| 35 |
|
| 36 |
/* { dg-final { scan-assembler-times {\tvmv} 11 } } */ |