RISC-V: Force scalable vector on all vsetvl tests
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / vsetvl / vlmax_bb_prop-9.c
blob7ea12185966f4541b6a811d60d46cfd93642cf10
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 (int8_t * restrict in, int8_t * restrict out, int n)
8 switch (n)
10 case 0:{
11 vint8mf8_t v = *(vint8mf8_t*)(in + 500);
12 *(vint8mf8_t*)(out + 500) = v;
13 break;
15 case 1:{
16 vint8mf8_t v = *(vint8mf8_t*)(in + 500);
17 *(vint8mf8_t*)(out + 500) = v;
18 break;
20 default:{
21 vint8mf8_t v = *(vint8mf8_t*)(in + 700);
22 *(vint8mf8_t*)(out + 700) = v;
23 break;
27 for (int i = 0 ; i < n * n; i++)
28 out[i] = out[i] + out[i];
30 for (int i = 0 ; i < n * n * n; i++)
31 out[i] = out[i] * out[i];
33 for (int i = 0 ; i < n * n * n * n; i++)
34 out[i] = out[i] * out[i];
36 for (int i = 0 ; i < n * n * n * n; i++) {
37 vint8mf8_t v = *(vint8mf8_t*)(in + 900 + i);
38 *(vint8mf8_t*)(out + 900 + i) = v;
42 void f2 (int8_t * restrict in, int8_t * restrict out, int n)
44 switch (n)
46 case 0:{
47 vint8mf4_t v = *(vint8mf4_t*)(in + 500);
48 *(vint8mf4_t*)(out + 500) = v;
49 break;
51 case 1:{
52 vint8mf4_t v = *(vint8mf4_t*)(in + 500);
53 *(vint8mf4_t*)(out + 500) = v;
54 break;
56 default:{
57 vint8mf4_t v = *(vint8mf4_t*)(in + 700);
58 *(vint8mf4_t*)(out + 700) = v;
59 break;
63 for (int i = 0 ; i < n * n; i++)
64 out[i] = out[i] + out[i];
66 for (int i = 0 ; i < n * n * n; i++)
67 out[i] = out[i] * out[i];
69 for (int i = 0 ; i < n * n * n * n; i++)
70 out[i] = out[i] * out[i];
72 for (int i = 0 ; i < n * n * n * n; i++) {
73 vint8mf4_t v = *(vint8mf4_t*)(in + 900 + i);
74 *(vint8mf4_t*)(out + 900 + i) = v;
78 void f3 (int8_t * restrict in, int8_t * restrict out, int n)
80 switch (n)
82 case 0:{
83 vint8mf2_t v = *(vint8mf2_t*)(in + 500);
84 *(vint8mf2_t*)(out + 500) = v;
85 break;
87 case 1:{
88 vint8mf2_t v = *(vint8mf2_t*)(in + 500);
89 *(vint8mf2_t*)(out + 500) = v;
90 break;
92 default:{
93 vint8mf2_t v = *(vint8mf2_t*)(in + 700);
94 *(vint8mf2_t*)(out + 700) = v;
95 break;
99 for (int i = 0 ; i < n * n; i++)
100 out[i] = out[i] + out[i];
102 for (int i = 0 ; i < n * n * n; i++)
103 out[i] = out[i] * out[i];
105 for (int i = 0 ; i < n * n * n * n; i++)
106 out[i] = out[i] * out[i];
108 for (int i = 0 ; i < n * n * n * n; i++) {
109 vint8mf2_t v = *(vint8mf2_t*)(in + 900 + i);
110 *(vint8mf2_t*)(out + 900 + i) = v;
114 void f4 (int8_t * restrict in, int8_t * restrict out, int n)
116 switch (n)
118 case 0:{
119 vint16mf4_t v = *(vint16mf4_t*)(in + 500);
120 *(vint16mf4_t*)(out + 500) = v;
121 break;
123 case 1:{
124 vint16mf4_t v = *(vint16mf4_t*)(in + 500);
125 *(vint16mf4_t*)(out + 500) = v;
126 break;
128 default:{
129 vint16mf4_t v = *(vint16mf4_t*)(in + 700);
130 *(vint16mf4_t*)(out + 700) = v;
131 break;
135 for (int i = 0 ; i < n * n; i++)
136 out[i] = out[i] + out[i];
138 for (int i = 0 ; i < n * n * n; i++)
139 out[i] = out[i] * out[i];
141 for (int i = 0 ; i < n * n * n * n; i++)
142 out[i] = out[i] * out[i];
144 for (int i = 0 ; i < n * n * n * n; i++) {
145 vint16mf4_t v = *(vint16mf4_t*)(in + 900 + i);
146 *(vint16mf4_t*)(out + 900 + i) = v;
150 void f5 (int8_t * restrict in, int8_t * restrict out, int n)
152 switch (n)
154 case 0:{
155 vint16mf2_t v = *(vint16mf2_t*)(in + 500);
156 *(vint16mf2_t*)(out + 500) = v;
157 break;
159 case 1:{
160 vint16mf2_t v = *(vint16mf2_t*)(in + 500);
161 *(vint16mf2_t*)(out + 500) = v;
162 break;
164 default:{
165 vint16mf2_t v = *(vint16mf2_t*)(in + 700);
166 *(vint16mf2_t*)(out + 700) = v;
167 break;
171 for (int i = 0 ; i < n * n; i++)
172 out[i] = out[i] + out[i];
174 for (int i = 0 ; i < n * n * n; i++)
175 out[i] = out[i] * out[i];
177 for (int i = 0 ; i < n * n * n * n; i++)
178 out[i] = out[i] * out[i];
180 for (int i = 0 ; i < n * n * n * n; i++) {
181 vint16mf2_t v = *(vint16mf2_t*)(in + 900 + i);
182 *(vint16mf2_t*)(out + 900 + i) = v;
186 void f6 (int8_t * restrict in, int8_t * restrict out, int n)
188 switch (n)
190 case 0:{
191 vint32mf2_t v = *(vint32mf2_t*)(in + 500);
192 *(vint32mf2_t*)(out + 500) = v;
193 break;
195 case 1:{
196 vint32mf2_t v = *(vint32mf2_t*)(in + 500);
197 *(vint32mf2_t*)(out + 500) = v;
198 break;
200 default:{
201 vint32mf2_t v = *(vint32mf2_t*)(in + 700);
202 *(vint32mf2_t*)(out + 700) = v;
203 break;
207 for (int i = 0 ; i < n * n; i++)
208 out[i] = out[i] + out[i];
210 for (int i = 0 ; i < n * n * n; i++)
211 out[i] = out[i] * out[i];
213 for (int i = 0 ; i < n * n * n * n; i++)
214 out[i] = out[i] * out[i];
216 for (int i = 0 ; i < n * n * n * n; i++) {
217 vint32mf2_t v = *(vint32mf2_t*)(in + 900 + i);
218 *(vint32mf2_t*)(out + 900 + i) = v;
222 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf8,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */
223 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */
224 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e8,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */
225 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf4,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */
226 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e16,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */
227 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*zero,\s*e32,\s*mf2,\s*t[au],\s*m[au]} 3 { target { no-opts "-O0" no-opts "-Os" no-opts "-Oz" no-opts "-funroll-loops" no-opts "-g" no-opts "-O1" } } } } */