Files
llvm-project/llvm/test/CodeGen/SPARC/stackaddress.ll
moorabbit a5fa246435 [Clang] Add __builtin_stack_address (#148281)
Add support for `__builtin_stack_address` builtin. The semantics match
those of GCC's builtin with the same name.

`__builtin_stack_address` returns the starting address of the stack
region that may be used by called functions. It may or may not include
the space used for on-stack arguments passed to a callee (See [GCC
Bug/121013](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121013)).

Fixes #82632.
2026-01-12 10:01:57 +01:00

17 lines
417 B
LLVM

; RUN: llc < %s -mtriple=sparc | FileCheck --check-prefix=sparc32 %s
; RUN: llc < %s -mtriple=sparcv9 | FileCheck --check-prefix=sparc64 %s
declare ptr @llvm.stackaddress.p0()
define ptr @test() {
; sparc32: save %sp, -96, %sp
; sparc32: ret
; sparc32: restore %sp, 68, %o0
;
; sparc64: save %sp, -128, %sp
; sparc64: ret
; sparc64: restore %sp, 2175, %o0
%sp = call ptr @llvm.stackaddress.p0()
ret ptr %sp
}