Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/widen/widen-complicate-1.c

raw
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(TYPE1, TYPE2) \
7 __attribute__ ((noipa)) void vwadd_##TYPE1_##TYPE2 ( \
8 TYPE1 *__restrict dst, TYPE1 *__restrict dst2, TYPE1 *__restrict dst3, \
9 TYPE2 *__restrict a, TYPE2 *__restrict b, TYPE2 *__restrict a2, \
10 TYPE2 *__restrict b2, int n) \
11 { \
12 for (int i = 0; i < n; i++) \
13 { \
14 dst[i] = (TYPE1) a[i] + (TYPE1) b[i]; \
15 dst2[i] = (TYPE1) a2[i] + (TYPE1) b[i]; \
16 dst3[i] = (TYPE1) a2[i] + (TYPE1) a[i]; \
17 } \
18 }
19
20 #define TEST_ALL() \
21 TEST_TYPE (int16_t, int8_t) \
22 TEST_TYPE (uint16_t, uint8_t) \
23 TEST_TYPE (int32_t, int16_t) \
24 TEST_TYPE (uint32_t, uint16_t) \
25 TEST_TYPE (int64_t, int32_t) \
26 TEST_TYPE (uint64_t, uint32_t) \
27 TEST_TYPE (float, _Float16) \
28 TEST_TYPE (double, float)
29
30 TEST_ALL ()
31
32 /* { dg-final { scan-assembler-times {\tvwadd\.vv} 9 } } */
33 /* { dg-final { scan-assembler-times {\tvwaddu\.vv} 9 } } */
34 /* { dg-final { scan-assembler-times {\tvfwadd\.vv} 6 } } */