Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/vsetvl/avl_single-104.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-mrvv-vector-bits=scalable -march=rv32gcv -mabi=ilp32 -fno-schedule-insns -fno-schedule-insns2 -fno-tree-vectorize" } */
3
4 #include "riscv_vector.h"
5
6 void
7 foo (int cond, int vl, int *in, int *out, int n)
8 {
9 if (cond > 30)
10 {
11 vint32m1_t v = __riscv_vle32_v_i32m1 ((int32_t *) in, vl);
12 __riscv_vse32_v_i32m1 ((int32_t *) out, v, vl);
13 }
14 else if (cond < 10)
15 {
16 vint8mf4_t v = __riscv_vle8_v_i8mf4 ((int8_t *) in, vl);
17 v = __riscv_vle8_v_i8mf4_tu (v, (int8_t *) in + 10, vl);
18 __riscv_vse8_v_i8mf4 ((int8_t *) out, v, vl);
19 }
20 else
21 {
22 vl = vl * 2;
23 }
24
25 for (int i = 0; i < n; i += 1)
26 {
27 vint16mf2_t v = __riscv_vle16_v_i16mf2 ((int16_t *) in + i, vl);
28 v = __riscv_vle16_v_i16mf2_tu (v, (int16_t *) in + i + 10, vl);
29 v = __riscv_vadd_vv_i16mf2 (v, v, vl);
30 __riscv_vse16_v_i16mf2 ((int16_t *) out + i, v, vl);
31 }
32 }
33
34 /* { dg-final { scan-assembler-not {vsetvli\s+zero,zero,e16,mf2,t[au],m[au]} { target { no-opts "-O0" no-opts "-Os" no-opts "-O1" no-opts "-g" no-opts "-funroll-loops" } } } } */
35 /* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-g" no-opts "-funroll-loops" } } } } */