RISC-V: Force scalable vector on all vsetvl tests
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / vsetvl / vlmax_single_block-4.c
blobbac607bf8d6646249697b8c41963f328893086c8
1 /* { dg-do compile } */
2 /* { dg-options "--param=riscv-autovec-preference=scalable -march=rv32gcv -mabi=ilp32" } */
4 /* Test insert-vsetvl PASS whether it's able to eliminate vsetvl for same vtype in VLMAX. */
6 #include "riscv_vector.h"
8 void foo2 (void * restrict in, void * restrict out)
10 vint16mf4_t v1 = *(vint16mf4_t*)(in + 1);
11 vint16mf4_t v2 = *(vint16mf4_t*)(in + 2);
12 vint16mf4_t v3 = *(vint16mf4_t*)(in + 3);
13 vint16mf4_t v4 = *(vint16mf4_t*)(in + 4);
14 vint16mf4_t v5 = *(vint16mf4_t*)(in + 5);
15 vint16mf4_t v6 = *(vint16mf4_t*)(in + 6);
16 vint16mf4_t v7 = *(vint16mf4_t*)(in + 7);
17 vint16mf4_t v8 = *(vint16mf4_t*)(in + 8);
18 *(vint16mf4_t*)(out + 1) = v1;
19 *(vint16mf4_t*)(out + 2) = v2;
20 *(vint16mf4_t*)(out + 3) = v3;
21 *(vint16mf4_t*)(out + 4) = v4;
22 *(vint16mf4_t*)(out + 5) = v5;
23 *(vint16mf4_t*)(out + 6) = v6;
24 *(vint16mf4_t*)(out + 7) = v7;
25 *(vint16mf4_t*)(out + 8) = v8;
28 void foo3 (void * restrict in, void * restrict out)
30 vint16mf2_t v1 = *(vint16mf2_t*)(in + 1);
31 vint16mf2_t v2 = *(vint16mf2_t*)(in + 2);
32 vint16mf2_t v3 = *(vint16mf2_t*)(in + 3);
33 vint16mf2_t v4 = *(vint16mf2_t*)(in + 4);
34 vint16mf2_t v5 = *(vint16mf2_t*)(in + 5);
35 vint16mf2_t v6 = *(vint16mf2_t*)(in + 6);
36 vint16mf2_t v7 = *(vint16mf2_t*)(in + 7);
37 vint16mf2_t v8 = *(vint16mf2_t*)(in + 8);
38 *(vint16mf2_t*)(out + 1) = v1;
39 *(vint16mf2_t*)(out + 2) = v2;
40 *(vint16mf2_t*)(out + 3) = v3;
41 *(vint16mf2_t*)(out + 4) = v4;
42 *(vint16mf2_t*)(out + 5) = v5;
43 *(vint16mf2_t*)(out + 6) = v6;
44 *(vint16mf2_t*)(out + 7) = v7;
45 *(vint16mf2_t*)(out + 8) = v8;
48 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" } } } } */
49 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" } } } } */