RISC-V: Force scalable vector on all vsetvl tests
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / vsetvl / vlmax_back_prop-13.c
blob44a07008617386dcd33474907e1c4d7341c93d3a
1 /* { dg-do compile } */
2 /* { dg-options "--param=riscv-autovec-preference=scalable -march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */
4 #include "riscv_vector.h"
6 void f (int32_t * restrict in, int32_t * restrict out, int n, int cond, int cond2, int cond3)
8 for (int i = 0; i < n; i++) {
9 vint8mf8_t v = *(vint8mf8_t*)(in + i);
10 *(vint8mf8_t*)(out + i + 200) = v;
12 for (int i = 0; i < n; i++) {
13 vint32mf2_t v = *(vint32mf2_t*)(in + 200 + i);
14 *(vint32mf2_t*)(out + i + 400) = v;
16 for (int i = 0; i < n; i++) {
17 vint64m1_t v = *(vint64m1_t*)(in + 300 + i);
18 *(vint64m1_t*)(out + i + 400) = v;
20 for (int i = 0; i < n; i++) {
21 vfloat32mf2_t v = *(vfloat32mf2_t*)(in + 400 + i);
22 *(vfloat32mf2_t*)(out + i + 500) = v;
24 for (int i = 0; i < n; i++) {
25 vuint32mf2_t v = *(vuint32mf2_t*)(in + 500 + i);
26 *(vuint32mf2_t*)(out + i + 600) = v;
29 if (cond == 0)
31 if (cond2 == 11)
33 for (int i = 0; i < n; i++)
35 out[i] = out[i] + 2;
38 else if (cond2 == 111)
40 if (cond3 == 300)
42 for (int i = 0; i < n; i++)
44 out[i] = out[i] + out[i];
46 } else {
47 for (int i = 0; i < n; i++) {
48 vint8mf2_t v = *(vint8mf2_t*)(in + 2000 + i);
49 *(vint8mf2_t*)(out + i + 4000) = v;
55 for (int i = 0; i < n; i++) {
56 vint16m1_t v;
57 *(vint16m1_t*)(out + i + 700) = v;
61 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */
62 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*m1,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */
63 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */
64 /* { dg-final { scan-assembler-times {vsetvli} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-flto" } } } } */