[clang] [llvm] [SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (PR #116642)
Ulrich Weigand via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 28 04:58:32 PST 2024
================
@@ -0,0 +1,34 @@
+;Test -mbackchain longjmp load from jmp_buf.
+; Frame pointer from Slot 1.
+; Jump address from Slot 2.
+; Backchain Value from Slot 3.
+; Stack Pointer from Slot 4.
+; Literal Pool Pointer from Slot 5.
+
+; RUN: llc < %s -mtriple=s390x-linux-gnu -O2 | FileCheck %s
+
+ at buf = dso_local global [20 x ptr] zeroinitializer, align 8
+
+; Function Attrs: noreturn nounwind
+define dso_local void @foo() local_unnamed_addr #0 {
+entry:
+; CHECK: stmg %r11, %r15, 88(%r15)
+; CHECK: larl %r1, buf
+; CHECK: lg %r2, 8(%r1)
+; CHECK: lg %r11, 0(%r1)
+; CHECK: lg %r13, 32(%r1)
+; CHECK: lg %r3, 16(%r1)
+; CHECK: lg %r15, 24(%r1)
+; CHECK: stg %r3, 0(%r15)
+; CHECK: br %r2
+
+ tail call void @llvm.eh.sjlj.longjmp(ptr nonnull @buf)
+ unreachable
+}
+
+; Function Attrs: noreturn nounwind
+declare void @llvm.eh.sjlj.longjmp(ptr) #1
+
+attributes #0 = { noreturn nounwind "backchain" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="z10" }
+attributes #1 = { noreturn nounwind }
+
----------------
uweigand wrote:
Also, it might be simpler to have both backchain and no-backchain test in a single test file: you can have one function with the "backchain" attribute and one without it in the same file.
https://github.com/llvm/llvm-project/pull/116642
More information about the cfe-commits
mailing list