| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-march=rv32gcv -mabi=ilp32 -mpreferred-stack-boundary=3 -fno-schedule-insns -fno-schedule-insns2 -O3" } */ |
| 3 |
/* { dg-final { check-function-bodies "**" "" } } */ |
| 4 |
|
| 5 |
#include "riscv_vector.h" |
| 6 |
|
| 7 |
void f (char*); |
| 8 |
|
| 9 |
/* |
| 10 |
** stach_check_alloca_1: |
| 11 |
** addi\tsp,sp,-32 |
| 12 |
** sw\tra,4\(sp\) |
| 13 |
** sw\ts0,0\(sp\) |
| 14 |
** addi\ts0,sp,8 |
| 15 |
** csrr\tt0,vlenb |
| 16 |
** sub\tsp,sp,t0 |
| 17 |
** vs1r.v\tv1,0\(sp\) |
| 18 |
** sub\tsp,sp,t0 |
| 19 |
** vs1r.v\tv2,0\(sp\) |
| 20 |
** ... |
| 21 |
** addi\ta1,a1,15 |
| 22 |
** andi\ta1,a1,-8 |
| 23 |
** sub\tsp,sp,a1 |
| 24 |
** ... |
| 25 |
** lw\tra,4\(sp\) |
| 26 |
** lw\ts0,0\(sp\) |
| 27 |
** addi\tsp,sp,32 |
| 28 |
** jr\tra |
| 29 |
*/ |
| 30 |
void stach_check_alloca_1 (vuint8m1_t data, uint8_t *base, int y, ...) |
| 31 |
{ |
| 32 |
vuint8m8_t v0, v8, v16, v24; |
| 33 |
asm volatile ("nop" |
| 34 |
: "=vr" (v0), "=vr" (v8), "=vr" (v16), "=vr" (v24) |
| 35 |
: |
| 36 |
:); |
| 37 |
asm volatile ("nop" |
| 38 |
: |
| 39 |
: "vr" (v0), "vr" (v8), "vr" (v16), "vr" (v24) |
| 40 |
:); |
| 41 |
*(vuint8m1_t *)base = data; |
| 42 |
char* pStr = (char*)__builtin_alloca(y); |
| 43 |
f(pStr); |
| 44 |
} |