]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_switch_vtype-3.c
RISC-V: Add testcases for VSETVL PASS 2
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / vsetvl / vlmax_switch_vtype-3.c
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv -mabi=ilp32" } */
3
4 #include "riscv_vector.h"
5
6 void f (void * restrict in, void * restrict out, int n)
7 {
8 vint8mf8_t v1 = *(vint8mf8_t*)(in + 1);
9 vint16mf4_t v2 = *(vint16mf4_t*)(in + 2);
10 vint32mf2_t v3 = *(vint32mf2_t*)(in + 3);
11 vfloat32mf2_t v4 = *(vfloat32mf2_t*)(in + 4);
12
13 *(vint8mf8_t*)(out + 1) = v1;
14 *(vint16mf4_t*)(out + 2) = v2;
15 *(vint32mf2_t*)(out + 3) = v3;
16 *(vfloat32mf2_t*)(out + 4) = v4;
17
18 for (int i = 0; i < n; i++)
19 {
20 vint16mf2_t v = *(vint16mf2_t*)(in + i + 5);
21 *(vint16mf2_t*)(out + i + 5) = v;
22 }
23 }
24
25 /* { dg-final { scan-assembler-times {vsetvli} 2 { target { no-opts "-O0" no-opts "-Os" no-opts "-flto" no-opts "-g" no-opts "-funroll-loops" } } } } */