Debian Codegraph @

gcc/testsuite/g++.target/riscv/rvv/base/pr122448.C

raw
1 /* { dg-do run } */
2 /* { dg-require-effective-target riscv_v_ok } */
3 /* { dg-additional-options "-O3 -march=rv64gcv -mabi=lp64d -fdump-rtl-vsetvl-details" } */
4
5 #include <riscv_vector.h>
6 int a;
7 long b = -2260814313524985651LL;
8 short c; char d;
9 short e[576];
10 unsigned long long f;
11 void g(unsigned long long *i, unsigned long long ad) { *i = ad; }
12 int8_t j[4];
13 int16_t k[4], l[4];
14 void m() {
15 for (short n = 1; n < 023; n += 4)
16 for (short o = 0; o < static_cast<short>(1033314678U); o += 4)
17 for (int p = (int)((long long)(b - 859406540) & 0xFFFFFFFF); p < 9; p += 3) {
18 c ^= static_cast<short>(1033314678 % 0x10000);
19 d &= static_cast<char>(a ? 0 : e[p * 24]);
20 }
21 for (bool q = 0; q < (bool)8; q = 1) {
22 size_t r = 4;
23 for (size_t v; r; r -= v) {
24 v = __riscv_vsetvl_e16m1(r);
25 vint8mf2_t w = __riscv_vle8_v_i8mf2(&j[0], v);
26 vbool16_t ac = __riscv_vmseq_vx_i8mf2_b16(w, 1, v);
27 vint16m1_t x = __riscv_vmv_v_x_i16m1(0, __riscv_vsetvlmax_e16m1());
28 vuint16m1_t y = __riscv_vsll_vx_u16m1(__riscv_vid_v_u16m1(v), 1, v);
29 vint16m1_t z = __riscv_vluxei16_v_i16m1_tu(x, &k[0], y, v);
30 vint16m1_t aa = __riscv_vmax_vv_i16m1(z, z, v);
31 vuint8mf2_t ab = __riscv_vsll_vx_u8mf2(__riscv_vid_v_u8mf2(v), 1, v);
32 __riscv_vsoxei8_v_i16m1_m(ac, &l[0], ab, aa, v);
33 }
34 }
35 }
36
37 int main() {
38 m();
39 g(&f, d);
40 if (f != 0)
41 __builtin_abort ();
42 }
43
44 /* { dg-final { scan-rtl-dump-not "Hoisting vsetvl" "vsetvl" } } */