Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/series-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv -mabi=ilp32d -mrvv-vector-bits=zvl -mrvv-max-lmul=m4" } */
3
4 #include <stdint-gcc.h>
5
6 #define NUM_ELEMS(TYPE) (64 / sizeof (TYPE))
7
8 #define DEF_LOOP(TYPE, BASE, STEP, SUFFIX) \
9 void __attribute__ ((noinline, noclone)) \
10 loop_##TYPE##_##SUFFIX (TYPE *restrict a) \
11 { \
12 for (int i = 0; i < NUM_ELEMS (TYPE); ++i) \
13 a[i] = (BASE) + i * (STEP); \
14 }
15
16 #define TEST_SEW32_TYPES(T, BASE, STEP, SUFFIX) \
17 T (uint32_t, BASE, STEP, SUFFIX) \
18 T (int32_t, BASE, STEP, SUFFIX)
19
20 #define TEST_ALL(T) \
21 TEST_SEW32_TYPES (T, 0, 1, b0s1) \
22 TEST_SEW32_TYPES (T, 0, 2, b0s2) \
23 TEST_SEW32_TYPES (T, 0, 3, b0s3) \
24 TEST_SEW32_TYPES (T, 0, 8, b0s8) \
25 TEST_SEW32_TYPES (T, 0, 9, b0s9) \
26 TEST_SEW32_TYPES (T, 0, 16, b0s16) \
27 TEST_SEW32_TYPES (T, 0, 17, b0s17) \
28 TEST_SEW32_TYPES (T, 0, 32, b0s32) \
29 TEST_SEW32_TYPES (T, 0, 33, b0s33) \
30 TEST_SEW32_TYPES (T, -16, 1, bm16s1) \
31 TEST_SEW32_TYPES (T, 15, 1, b15s1) \
32 TEST_SEW32_TYPES (T, -17, 1, bm17s1) \
33 TEST_SEW32_TYPES (T, 16, 1, b16s1) \
34 TEST_SEW32_TYPES (T, -16, 128, bm16s128) \
35 TEST_SEW32_TYPES (T, 15, 128, b15s128) \
36 TEST_SEW32_TYPES (T, -17, 128, bm17s128) \
37 TEST_SEW32_TYPES (T, 16, 128, b16s128) \
38 TEST_SEW32_TYPES (T, -16, 179, bm16s179) \
39 TEST_SEW32_TYPES (T, 15, 179, b15s179) \
40 TEST_SEW32_TYPES (T, -17, 179, bm17s179) \
41 TEST_SEW32_TYPES (T, 16, 179, b16s179) \
42 TEST_SEW32_TYPES (T, -16, 65536, bm16s65536) \
43 TEST_SEW32_TYPES (T, 15, 65536, b15s65536) \
44 TEST_SEW32_TYPES (T, -17, 65536, bm17s65536) \
45 TEST_SEW32_TYPES (T, 16, 65536, b16s65536)
46
47 TEST_ALL (DEF_LOOP)
48
49 /* { dg-final { scan-assembler-times {vid\.v\s+v[0-9]+} 50 } } */
50 /* { dg-final { scan-assembler-times {vsll\.vi\s+v[0-9]+} 24 } } */