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
)
11 vint8mf8_t v
= *(vint8mf8_t
*)(in
+ 500);
12 *(vint8mf8_t
*)(out
+ 500) = v
;
16 vint8mf8_t v
= *(vint8mf8_t
*)(in
+ 500);
17 *(vint8mf8_t
*)(out
+ 500) = v
;
21 vint8mf8_t v
= *(vint8mf8_t
*)(in
+ 700);
22 *(vint8mf8_t
*)(out
+ 700) = v
;
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
)
47 vint8mf4_t v
= *(vint8mf4_t
*)(in
+ 500);
48 *(vint8mf4_t
*)(out
+ 500) = v
;
52 vint8mf4_t v
= *(vint8mf4_t
*)(in
+ 500);
53 *(vint8mf4_t
*)(out
+ 500) = v
;
57 vint8mf4_t v
= *(vint8mf4_t
*)(in
+ 700);
58 *(vint8mf4_t
*)(out
+ 700) = v
;
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
)
83 vint8mf2_t v
= *(vint8mf2_t
*)(in
+ 500);
84 *(vint8mf2_t
*)(out
+ 500) = v
;
88 vint8mf2_t v
= *(vint8mf2_t
*)(in
+ 500);
89 *(vint8mf2_t
*)(out
+ 500) = v
;
93 vint8mf2_t v
= *(vint8mf2_t
*)(in
+ 700);
94 *(vint8mf2_t
*)(out
+ 700) = v
;
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
)
119 vint16mf4_t v
= *(vint16mf4_t
*)(in
+ 500);
120 *(vint16mf4_t
*)(out
+ 500) = v
;
124 vint16mf4_t v
= *(vint16mf4_t
*)(in
+ 500);
125 *(vint16mf4_t
*)(out
+ 500) = v
;
129 vint16mf4_t v
= *(vint16mf4_t
*)(in
+ 700);
130 *(vint16mf4_t
*)(out
+ 700) = v
;
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
)
155 vint16mf2_t v
= *(vint16mf2_t
*)(in
+ 500);
156 *(vint16mf2_t
*)(out
+ 500) = v
;
160 vint16mf2_t v
= *(vint16mf2_t
*)(in
+ 500);
161 *(vint16mf2_t
*)(out
+ 500) = v
;
165 vint16mf2_t v
= *(vint16mf2_t
*)(in
+ 700);
166 *(vint16mf2_t
*)(out
+ 700) = v
;
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
)
191 vint32mf2_t v
= *(vint32mf2_t
*)(in
+ 500);
192 *(vint32mf2_t
*)(out
+ 500) = v
;
196 vint32mf2_t v
= *(vint32mf2_t
*)(in
+ 500);
197 *(vint32mf2_t
*)(out
+ 500) = v
;
201 vint32mf2_t v
= *(vint32mf2_t
*)(in
+ 700);
202 *(vint32mf2_t
*)(out
+ 700) = v
;
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" } } } } */