xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/ve/grow_stack.S (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2// See https://llvm.org/LICENSE.txt for license information.
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#include "../assembly.h"
6
7// grow_stack routine
8// This routine is VE specific
9// https://www.nec.com/en/global/prod/hpc/aurora/document/VE-ABI_v1.1.pdf
10
11// destroy %s62 and %s63 only
12
13#ifdef __ve__
14
15.text
16.p2align        4
17DEFINE_COMPILERRT_FUNCTION(__ve_grow_stack)
18        subu.l          %sp, %sp, %s0           # sp -= alloca size
19        and             %sp, -16, %sp           # align sp
20        brge.l.t        %sp, %sl, 1f
21        ld              %s63, 0x18(,%tp)        # load param area
22        lea             %s62, 0x13b             # syscall # of grow
23        shm.l           %s62, 0x0(%s63)         # stored at addr:0
24        shm.l           %sl, 0x8(%s63)          # old limit at addr:8
25        shm.l           %sp, 0x10(%s63)         # new limit at addr:16
26        monc
271:
28        b.l             (,%lr)
29END_COMPILERRT_FUNCTION(__ve_grow_stack)
30
31#endif // __ve__
32