]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/riscv/rvv/vsetvl/vlmax_back_prop-26.c
RISC-V: Add testcases for VSETVL PASS 5
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / vsetvl / vlmax_back_prop-26.c
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gcv -mabi=ilp32 -fno-tree-vectorize" } */
3
4 #include "riscv_vector.h"
5
6 void f (void * restrict in, void * restrict out, int n, int cond)
7 {
8 if (cond == 0) {
9 vint8mf8_t v = *(vint8mf8_t*)(in + 100);
10 *(vint8mf8_t*)(out + 100) = v;
11 for (int i = 0; i < n; i++)
12 {
13 vint16mf4_t v2;
14 *(vint16mf4_t*)(out + i + 100) = v2;
15 }
16 } else if (cond == 1) {
17 vint8mf8_t v = *(vint8mf8_t*)(in + 200);
18 *(vint8mf8_t*)(out + 200) = v;
19 for (int i = 0; i < n; i++)
20 {
21 vint32mf2_t v2;
22 *(vint32mf2_t*)(out + i + 200) = v2;
23 }
24 } else if (cond == 2) {
25 vint8mf8_t v = *(vint8mf8_t*)(in + 300);
26 *(vint8mf8_t*)(out + 300) = v;
27 for (int i = 0; i < n; i++)
28 {
29 vint8mf8_t v2;
30 *(vint8mf8_t*)(out + i + 300) = v2;
31 }
32 } else if (cond == 3) {
33 vint8mf8_t v = *(vint8mf8_t*)(in + 400);
34 *(vint8mf8_t*)(out + 400) = v;
35 for (int i = 0; i < n; i++)
36 {
37 vint64m1_t v2;
38 *(vint64m1_t*)(out + i + 400) = v2;
39 }
40 } else if (cond == 4) {
41 vint8mf8_t v = *(vint8mf8_t*)(in + 500);
42 *(vint8mf8_t*)(out + 500) = v;
43 for (int i = 0; i < n; i++)
44 {
45 vfloat32mf2_t v2;
46 *(vfloat32mf2_t*)(out + i + 500) = v2;
47 }
48 } else if (cond == 5) {
49 vuint8mf8_t v = *(vuint8mf8_t*)(in + 600);
50 *(vuint8mf8_t*)(out + 600) = v;
51 for (int i = 0; i < n; i++)
52 {
53 vuint16mf4_t v2;
54 *(vuint16mf4_t*)(out + i + 600) = v2;
55 }
56 } else if (cond == 6) {
57 vuint8mf8_t v = *(vuint8mf8_t*)(in + 700);
58 *(vuint8mf8_t*)(out + 700) = v;
59 for (int i = 0; i < n; i++)
60 {
61 vuint32mf2_t v2;
62 *(vuint32mf2_t*)(out + i + 700) = v2;
63 }
64 } else if (cond == 7) {
65 vuint8mf8_t v = *(vuint8mf8_t*)(in + 800);
66 *(vuint8mf8_t*)(out + 800) = v;
67 for (int i = 0; i < n; i++)
68 {
69 vuint8mf8_t v2;
70 *(vuint8mf8_t*)(out + i + 800) = v2;
71 }
72 } else if (cond == 8) {
73 vuint8mf8_t v = *(vuint8mf8_t*)(in + 900);
74 *(vuint8mf8_t*)(out + 900) = v;
75 for (int i = 0; i < n; i++)
76 {
77 vuint64m1_t v2;
78 *(vuint64m1_t*)(out + i + 900) = v2;
79 }
80 }
81 }
82
83 /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
84 /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 1 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
85 /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e64,\s*m1,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
86 /* { dg-final { scan-assembler-times {vsetvli\s+zero,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 2 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
87 /* { 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" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
88 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 8 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */
89 /* { dg-final { scan-assembler-times {vsetvli} 17 { target { no-opts "-O0" no-opts "-O1" no-opts "-Os" no-opts "-funroll-loops" no-opts "-g" } } } } */