Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/sve2/whilerw_1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-vectorize -fno-vect-cost-model" } */
3 /* { dg-require-effective-target lp64 } */
4
5 #include <stdint.h>
6
7 #define TEST_LOOP(TYPE) \
8 TYPE \
9 test_##TYPE (TYPE *dst, TYPE *src, int n) \
10 { \
11 TYPE res = 0; \
12 for (int i = 0; i < n; ++i) \
13 { \
14 dst[i] += 1; \
15 res += src[i]; \
16 } \
17 return res; \
18 }
19
20 TEST_LOOP (int8_t);
21 TEST_LOOP (int16_t);
22 TEST_LOOP (int32_t);
23 TEST_LOOP (int64_t);
24
25 /* { dg-final { scan-assembler-times {\twhilerw\t} 4 } } */
26 /* { dg-final { scan-assembler-times {\twhilerw\tp[0-9]+\.b, x0, x1\n} 1 } } */
27 /* { dg-final { scan-assembler-times {\twhilerw\tp[0-9]+\.h, x0, x1\n} 1 } } */
28 /* { dg-final { scan-assembler-times {\twhilerw\tp[0-9]+\.s, x0, x1\n} 1 } } */
29 /* { dg-final { scan-assembler-times {\twhilerw\tp[0-9]+\.d, x0, x1\n} 1 } } */
30 /* { dg-final { scan-assembler-not {\twhilewr\t} } } */