[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:29 PST 2024


================
@@ -0,0 +1,47 @@
+; Test setjmp  store jmp_buf
+; Return address in slot 2.
+; Stack Pointer in slot 4. 
+; Clobber %r6-%r15, %f8-%f15.
+
+; RUN: llc < %s -mtriple=s390x-linux-gnu -O3 | FileCheck %s
+
+ at buf = dso_local global [20 x ptr] zeroinitializer, align 8
+
+; Function Attrs: nounwind
+define dso_local signext range(i32 0, 2) i32 @main(i32 noundef signext %argc, ptr nocapture noundef readnone %argv) local_unnamed_addr #0 {
+entry:
+; CHECK:        stmg    %r6, %r15, 48(%r15)
+; CHECK:        aghi    %r15, -224
+; CHECK:        std     %f8, 216(%r15)
+; CHECK:        std     %f9, 208(%r15)
+; CHECK:        std     %f10, 200(%r15)
+; CHECK:        std     %f11, 192(%r15)
+; CHECK:        std     %f12, 184(%r15)
+; CHECK:        std     %f13, 176(%r15)
+; CHECK:        std     %f14, 168(%r15)
+; CHECK:        std     %f15, 160(%r15)
+; CHECK:        larl    %r1, buf
+; CHECK:        larl    %r0, .LBB0_2
+; CHECK:        stg     %r0, 8(%r1)
+; CHECK:        stg     %r15, 24(%r1)
+  %0 = tail call i32 @llvm.eh.sjlj.setjmp(ptr nonnull @buf)
+  %tobool.not = icmp eq i32 %0, 0
+  br i1 %tobool.not, label %if.end, label %return
----------------
uweigand wrote:

Is this control flow essential to what we're attempting to verify in this test?   The test code should ideally be a simple as possible while still exposing the specific characteristics we want to test.

https://github.com/llvm/llvm-project/pull/116642


More information about the cfe-commits mailing list