Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/pr113420-1.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
3
4 #include "riscv_vector.h"
5
6 void
7 matrix_transpose_intrinsics (float *dst, float *src, size_t n)
8 {
9 for (size_t row_id = 0; row_id < n; ++row_id)
10 { // input row-index
11 size_t avl = n;
12 // source pointer to row_id-th row
13 float *row_src = src + row_id * n;
14 // destination pointer to row_id-th column
15 float *row_dst = dst + row_id;
16 while (avl > 0)
17 {
18 size_t vl = __riscv_vsetvl_e32m1 (avl);
19 vfloat32m1_t row = __riscv_vle32_v_f32m1 (row_src, vl);
20 __riscv_vsse32 (row_dst, sizeof (float) * n, row, vl);
21 // updating application vector length
22 avl -= vl;
23 // updating source and destination pointers
24 row_src += vl;
25 row_dst += vl * n;
26 }
27 }
28 }
29
30 /* { dg-final { scan-assembler-times {vsse32\.v} 1 } } */