1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[NFC][Codegen] Autogenerate Thumb2/setjmp_longjmp.ll test

This commit is contained in:
Roman Lebedev 2021-06-24 21:33:43 +03:00
parent d4359ff02a
commit 22ff0f5fb2

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc %s -o - | FileCheck %s
target triple = "thumbv7-apple-ios"
@ -7,40 +8,77 @@ declare i8* @llvm.frameaddress(i32)
declare i8* @llvm.stacksave()
@g = external global i32
; CHECK-LABEL: double_foobar
;
; setjmp sequence:
; CHECK: mov [[PCREG:r[0-9]+]], pc
; CHECK-NEXT: adds [[PCREG]], [[PCREG]], #7
; CHECK-NEXT: str [[PCREG]], {{\[}}[[BUFREG:r[0-9]+]], #4]
; CHECK-NEXT: movs r0, #0
; CHECK-NEXT: b [[LABEL:L[a-zA-Z0-9]+]]
; CHECK-NEXT: movs r0, #1
; CHECK-NEXT: [[LABEL]]:
;
; setjmp sequence 2:
; CHECK: mov [[PCREG:r[0-9]+]], pc
; CHECK-NEXT: adds [[PCREG]], [[PCREG]], #7
; CHECK-NEXT: str [[PCREG]], {{\[}}[[BUFREG:r[0-9]+]], #4]
; CHECK-NEXT: movs r0, #0
; CHECK-NEXT: b [[LABEL:L[a-zA-Z0-9]+]]
; CHECK-NEXT: movs r0, #1
; CHECK-NEXT: [[LABEL]]:
; longjmp sequence:
; CHECK: ldr [[TEMPREG:r[0-9]+]], [{{\s*}}[[BUFREG:r[0-9]+]], #8]
; CHECK-NEXT: mov sp, [[TEMPREG]]
; CHECK-NEXT: ldr [[DESTREG:r[0-9]+]], {{\[}}[[BUFREG]], #4]
; CHECK-NEXT: ldr r7, {{\[}}[[BUFREG]]{{\]}}
; CHECK-NEXT: bx [[DESTREG]]
;
; longjmp sequence2:
; CHECK: ldr [[TEMPREG:r[0-9]+]], [{{\s*}}[[BUFREG:r[0-9]+]], #8]
; CHECK-NEXT: mov sp, [[TEMPREG]]
; CHECK-NEXT: ldr [[DESTREG:r[0-9]+]], {{\[}}[[BUFREG]], #4]
; CHECK-NEXT: ldr r7, {{\[}}[[BUFREG]]{{\]}}
; CHECK-NEXT: bx [[DESTREG]]
define void @double_foobar() {
; CHECK-LABEL: double_foobar:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r10, r11, lr}
; CHECK-NEXT: add r7, sp, #24
; CHECK-NEXT: sub sp, #24
; CHECK-NEXT: movs r1, #0
; CHECK-NEXT: add r0, sp, #4
; CHECK-NEXT: str r7, [sp, #4]
; CHECK-NEXT: str.w sp, [sp, #12]
; CHECK-NEXT: mov r1, pc @ eh_setjmp begin
; CHECK-NEXT: adds r1, r1, #7
; CHECK-NEXT: str r1, [r0, #4]
; CHECK-NEXT: movs r0, #0
; CHECK-NEXT: b LSJLJEH0
; CHECK-NEXT: movs r0, #1 @ eh_setjmp end
; CHECK-NEXT: LSJLJEH0:
; CHECK-NEXT: cbz r0, LBB0_3
; CHECK-NEXT: @ %bb.1: @ %if.then
; CHECK-NEXT: movw r0, :lower16:(L_g$non_lazy_ptr-(LPC0_0+4))
; CHECK-NEXT: movt r0, :upper16:(L_g$non_lazy_ptr-(LPC0_0+4))
; CHECK-NEXT: LPC0_0:
; CHECK-NEXT: add r0, pc
; CHECK-NEXT: ldr r1, [r0]
; CHECK-NEXT: movs r0, #1
; CHECK-NEXT: str r1, [sp] @ 4-byte Spill
; CHECK-NEXT: str r0, [r1]
; CHECK-NEXT: add r0, sp, #4
; CHECK-NEXT: movs r1, #0
; CHECK-NEXT: str r7, [sp, #4]
; CHECK-NEXT: str.w sp, [sp, #12]
; CHECK-NEXT: mov r1, pc @ eh_setjmp begin
; CHECK-NEXT: adds r1, r1, #7
; CHECK-NEXT: str r1, [r0, #4]
; CHECK-NEXT: movs r0, #0
; CHECK-NEXT: b LSJLJEH1
; CHECK-NEXT: movs r0, #1 @ eh_setjmp end
; CHECK-NEXT: LSJLJEH1:
; CHECK-NEXT: cmp r0, #0
; CHECK-NEXT: itttt ne
; CHECK-NEXT: movne r0, #3
; CHECK-NEXT: ldrne r1, [sp] @ 4-byte Reload
; CHECK-NEXT: strne r0, [r1]
; CHECK-NEXT: addne sp, #24
; CHECK-NEXT: it ne
; CHECK-NEXT: popne.w {r4, r5, r6, r7, r8, r10, r11, pc}
; CHECK-NEXT: LBB0_2: @ %if2.else
; CHECK-NEXT: ldr r1, [sp] @ 4-byte Reload
; CHECK-NEXT: movs r0, #2
; CHECK-NEXT: str r0, [r1]
; CHECK-NEXT: add r1, sp, #4
; CHECK-NEXT: movs r0, #0
; CHECK-NEXT: ldr r0, [r1, #8]
; CHECK-NEXT: mov sp, r0
; CHECK-NEXT: ldr r0, [r1, #4]
; CHECK-NEXT: ldr r7, [r1]
; CHECK-NEXT: bx r0
; CHECK-NEXT: LBB0_3: @ %if.else
; CHECK-NEXT: movw r0, :lower16:(L_g$non_lazy_ptr-(LPC0_1+4))
; CHECK-NEXT: movs r1, #0
; CHECK-NEXT: movt r0, :upper16:(L_g$non_lazy_ptr-(LPC0_1+4))
; CHECK-NEXT: LPC0_1:
; CHECK-NEXT: add r0, pc
; CHECK-NEXT: ldr r0, [r0]
; CHECK-NEXT: str r1, [r0]
; CHECK-NEXT: add r0, sp, #4
; CHECK-NEXT: ldr r1, [r0, #8]
; CHECK-NEXT: mov sp, r1
; CHECK-NEXT: ldr r1, [r0, #4]
; CHECK-NEXT: ldr r7, [r0]
; CHECK-NEXT: bx r1
entry:
%buf = alloca [5 x i8*], align 4
%bufptr = bitcast [5 x i8*]* %buf to i8*