RISC-V: Enable basic VLS modes support
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / rvv / autovec / vls / spill-2.c
blobe8fa54c1c127a98390322b38546d81d2e38f7f09
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gcv_zvfh_zvl4096b -mabi=lp64d -O3 -fno-schedule-insns -fno-schedule-insns2" } */
4 #include "def.h"
6 void
7 spill_0 (int16_t *in, int16_t *out)
9 v1hi v1 = *(v1hi*)in;
10 exhaust_vector_regs ();
11 asm volatile ("" ::: "memory");
12 *(v1hi*)out = v1;
15 void
16 spill_1 (int16_t *in, int16_t *out)
18 v2hi v1 = *(v2hi*)in;
19 exhaust_vector_regs ();
20 asm volatile ("" ::: "memory");
21 *(v2hi*)out = v1;
24 void
25 spill_2 (int16_t *in, int16_t *out)
27 v4hi v1 = *(v4hi*)in;
28 exhaust_vector_regs ();
29 asm volatile ("" ::: "memory");
30 *(v4hi*)out = v1;
33 void
34 spill_3 (int16_t *in, int16_t *out)
36 v8hi v1 = *(v8hi*)in;
37 exhaust_vector_regs ();
38 asm volatile ("" ::: "memory");
39 *(v8hi*)out = v1;
42 void
43 spill_4 (int16_t *in, int16_t *out)
45 v16hi v1 = *(v16hi*)in;
46 exhaust_vector_regs ();
47 asm volatile ("" ::: "memory");
48 *(v16hi*)out = v1;
51 void
52 spill_5 (int16_t *in, int16_t *out)
54 v32hi v1 = *(v32hi*)in;
55 exhaust_vector_regs ();
56 asm volatile ("" ::: "memory");
57 *(v32hi*)out = v1;
60 void
61 spill_6 (int16_t *in, int16_t *out)
63 v64hi v1 = *(v64hi*)in;
64 exhaust_vector_regs ();
65 asm volatile ("" ::: "memory");
66 *(v64hi*)out = v1;
69 void
70 spill_7 (int16_t *in, int16_t *out)
72 v128hi v1 = *(v128hi*)in;
73 exhaust_vector_regs ();
74 asm volatile ("" ::: "memory");
75 *(v128hi*)out = v1;
78 void
79 spill_8 (int16_t *in, int16_t *out)
81 v256hi v1 = *(v256hi*)in;
82 exhaust_vector_regs ();
83 asm volatile ("" ::: "memory");
84 *(v256hi*)out = v1;
87 void
88 spill_9 (int16_t *in, int16_t *out)
90 v512hi v1 = *(v512hi*)in;
91 exhaust_vector_regs ();
92 asm volatile ("" ::: "memory");
93 *(v512hi*)out = v1;
96 void
97 spill_10 (int16_t *in, int16_t *out)
99 v1024hi v1 = *(v1024hi*)in;
100 exhaust_vector_regs ();
101 asm volatile ("" ::: "memory");
102 *(v1024hi*)out = v1;
105 void
106 spill_11 (int16_t *in, int16_t *out)
108 v2048hi v1 = *(v2048hi*)in;
109 exhaust_vector_regs ();
110 asm volatile ("" ::: "memory");
111 *(v2048hi*)out = v1;
114 /* { dg-final { scan-assembler-times {vle16\.v\tv[0-9]+,0\s*\([a-x0-9]+\)} 24 } } */
115 /* { dg-final { scan-assembler-times {vse16\.v\tv[0-9]+,0\s*\([a-x0-9]+\)} 24 } } */
116 /* { dg-final { scan-assembler-times {addi\tsp,sp,-16} 4 } } */
117 /* { dg-final { scan-assembler-times {addi\tsp,sp,-32} 1 } } */
118 /* { dg-final { scan-assembler-times {addi\tsp,sp,-64} 1 } } */
119 /* { dg-final { scan-assembler-times {addi\tsp,sp,-128} 1 } } */
120 /* { dg-final { scan-assembler-times {addi\tsp,sp,-256} 1 } } */
121 /* { dg-final { scan-assembler-times {addi\tsp,sp,-512} 1 } } */
122 /* { dg-final { scan-assembler-times {addi\tsp,sp,-1024} 1 } } */
123 /* { dg-final { scan-assembler-times {addi\tsp,sp,-2048} 1 } } */
124 /* { dg-final { scan-assembler-times {li\t[a-x0-9]+,-4096\s+add\tsp,sp,[a-x0-9]+} 1 } } */