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