Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-2.c

raw
1 /* { dg-do compile { target { ! riscv_abi_e } } } */
2 /* { dg-additional-options "-O1 -fno-schedule-insns -fno-schedule-insns2 -mrvv-max-lmul=m8" } */
3 /* { dg-add-options riscv_v } */
4 /* { dg-final { check-function-bodies "**" "" } } */
5
6 typedef struct { char c[16]; } c16;
7 typedef struct { char c[32]; } c32;
8 typedef struct { short s; char c[30]; } s16;
9
10 /* A short struct copy can use vsetivli.
11 ** f1: { target { no-opts "-mrvv-vector-bits=zvl" } }
12 ** vsetivli\s+zero,16,e8,m(1|f8|f2|f4),ta,ma
13 ** vle8.v\s+v1,0\(a1\)
14 ** vse8.v\s+v1,0\(a0\)
15 ** ret
16 */
17
18 /*
19 ** f1: { target { { any-opts "-mrvv-vector-bits=zvl" } && { no-opts "-march=rv64gcv_zvl1024b" "-march=rv64gcv_zvl256b" "-march=rv64gcv_zvl512b -mrvv-max-lmul=dynamic" } } }
20 ** vl1re8.v\s+v1,0\(a1\)
21 ** vs1r.v\s+v1,0\(a0\)
22 ** ret
23 */
24
25 void f1 (c16 *a, c16* b)
26 {
27 *a = *b;
28 }
29
30 /* A longer one needs li.
31 ** f2: { target { no-opts "-mrvv-vector-bits=zvl" } }
32 ** li\s+[ta][0-7],32
33 ** vsetvli\s+zero,[ta][0-7],e8,m(f4|f2|1|2|8),ta,ma
34 ** vle8.v\s+v(1|2|8),0\(a1\)
35 ** vse8.v\s+v(1|2|8),0\(a0\)
36 ** ret
37 */
38
39 /*
40 ** f2: { target { { any-opts "-mrvv-vector-bits=zvl" } && { no-opts "-march=rv64gcv_zvl1024b" "-march=rv64gcv_zvl256b" "-march=rv64gcv_zvl512b -mrvv-max-lmul=dynamic" } } }
41 ** vl2re8.v\s+v2,0\(a1\)
42 ** vs2r.v\s+v2,0\(a0\)
43 ** ret
44 */
45 void f2 (c32 *a, c32* b)
46 {
47 *a = *b;
48 }
49
50 /* A 32 byte struct is still short enough for vsetivli
51 if we can use an element width larger than 8.
52 ** f3: { target { no-opts "-mrvv-vector-bits=zvl" } }
53 ** vsetivli\s+zero,16,e16,m(f2|f4|1|2|8),ta,ma
54 ** vle16.v\s+v(1|2|8),0\(a1\)
55 ** vse16.v\s+v(1|2|8),0\(a0\)
56 ** ret
57 */
58
59 /*
60 ** f3: { target { { any-opts "-mrvv-vector-bits=zvl" } && { no-opts "-march=rv64gcv_zvl1024b" "-march=rv64gcv_zvl256b" "-march=rv64gcv_zvl512b -mrvv-max-lmul=dynamic" } } }
61 ** vl2re16.v\s+v2,0\(a1\)
62 ** vs2r.v\s+v2,0\(a0\)
63 ** ret
64 */
65 void f3 (s16 *a, s16* b)
66 {
67 *a = *b;
68 }