mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 12:43:36 +01:00
178bc607c9
This patch handles cases where we have to save/restore the link register into the stack and and load/store instruction which use the stack are part of the outlined region. It checks that there will be no overflow introduced by the new offset and fixup these instructions accordingly. Differential Revision: https://reviews.llvm.org/D92934
187 lines
7.2 KiB
YAML
187 lines
7.2 KiB
YAML
# RUN: llc -mtriple=armv7-- -run-pass=prologepilog -run-pass=machine-outliner \
|
|
# RUN: -verify-machineinstrs %s -o - | FileCheck %s
|
|
|
|
--- |
|
|
define void @CheckAddrMode_i12() { ret void }
|
|
define void @CheckAddrMode3() { ret void }
|
|
define void @CheckAddrMode5() { ret void }
|
|
define void @CheckAddrMode5FP16() { ret void }
|
|
define void @foo() { ret void }
|
|
|
|
...
|
|
---
|
|
|
|
name: CheckAddrMode_i12
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $r0
|
|
; CHECK-LABEL: name: CheckAddrMode_i12
|
|
; CHECK: $r1 = MOVr killed $r0, 14 /* CC::al */, $noreg, $noreg
|
|
; CHECK-NEXT: BL @OUTLINED_FUNCTION_[[I12:[0-9]+]]
|
|
; CHECK-NEXT: $r6 = LDRi12 $sp, 4088, 14 /* CC::al */, $noreg
|
|
$r1 = MOVr killed $r0, 14, $noreg, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRi12 $sp, 0, 14, $noreg
|
|
$r2 = LDRi12 $sp, 8, 14, $noreg
|
|
$r5 = LDRi12 $sp, 4086, 14, $noreg
|
|
$r6 = LDRi12 $sp, 4088, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRi12 $sp, 0, 14, $noreg
|
|
$r2 = LDRi12 $sp, 8, 14, $noreg
|
|
$r5 = LDRi12 $sp, 4086, 14, $noreg
|
|
$r6 = LDRi12 $sp, 4088, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRi12 $sp, 0, 14, $noreg
|
|
$r2 = LDRi12 $sp, 8, 14, $noreg
|
|
$r5 = LDRi12 $sp, 4086, 14, $noreg
|
|
$r6 = LDRi12 $sp, 4088, 14, $noreg
|
|
BX_RET 14, $noreg
|
|
...
|
|
---
|
|
|
|
name: CheckAddrMode3
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $r1
|
|
; CHECK-LABEL: name: CheckAddrMode3
|
|
; CHECK: $r0 = MOVr killed $r1, 14 /* CC::al */, $noreg, $noreg
|
|
; CHECK-NEXT: BL @OUTLINED_FUNCTION_[[I3:[0-9]+]]
|
|
; CHECK-NEXT: $r6 = LDRSH $sp, $noreg, 248, 14 /* CC::al */, $noreg
|
|
$r0 = MOVr killed $r1, 14, $noreg, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRSH $sp, $noreg, 0, 14, $noreg
|
|
$r2 = LDRSH $sp, $noreg, 8, 14, $noreg
|
|
$r5 = LDRSH $sp, $noreg, 247, 14, $noreg
|
|
$r6 = LDRSH $sp, $noreg, 248, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRSH $sp, $noreg, 0, 14, $noreg
|
|
$r2 = LDRSH $sp, $noreg, 8, 14, $noreg
|
|
$r5 = LDRSH $sp, $noreg, 247, 14, $noreg
|
|
$r6 = LDRSH $sp, $noreg, 248, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$r1 = LDRSH $sp, $noreg, 0, 14, $noreg
|
|
$r2 = LDRSH $sp, $noreg, 8, 14, $noreg
|
|
$r5 = LDRSH $sp, $noreg, 247, 14, $noreg
|
|
$r6 = LDRSH $sp, $noreg, 248, 14, $noreg
|
|
BX_RET 14, $noreg
|
|
...
|
|
---
|
|
|
|
name: CheckAddrMode5
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $r2
|
|
; CHECK-LABEL: name: CheckAddrMode5
|
|
; CHECK: $r0 = MOVr killed $r2, 14 /* CC::al */, $noreg, $noreg
|
|
; CHECK-NEXT: BL @OUTLINED_FUNCTION_[[I5:[0-9]+]]
|
|
; CHECK-NEXT: $d5 = VLDRD $sp, 254, 14 /* CC::al */, $noreg
|
|
$r0 = MOVr killed $r2, 14, $noreg, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$d0 = VLDRD $sp, 0, 14, $noreg
|
|
$d1 = VLDRD $sp, 8, 14, $noreg
|
|
$d4 = VLDRD $sp, 253, 14, $noreg
|
|
$d5 = VLDRD $sp, 254, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$d0 = VLDRD $sp, 0, 14, $noreg
|
|
$d1 = VLDRD $sp, 8, 14, $noreg
|
|
$d4 = VLDRD $sp, 253, 14, $noreg
|
|
$d5 = VLDRD $sp, 254, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$d0 = VLDRD $sp, 0, 14, $noreg
|
|
$d1 = VLDRD $sp, 8, 14, $noreg
|
|
$d4 = VLDRD $sp, 253, 14, $noreg
|
|
$d5 = VLDRD $sp, 254, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$d0 = VLDRD $sp, 0, 14, $noreg
|
|
$d1 = VLDRD $sp, 8, 14, $noreg
|
|
$d4 = VLDRD $sp, 253, 14, $noreg
|
|
$d5 = VLDRD $sp, 254, 14, $noreg
|
|
BX_RET 14, $noreg
|
|
...
|
|
---
|
|
|
|
name: CheckAddrMode5FP16
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $r3
|
|
; CHECK-LABEL: name: CheckAddrMode5FP16
|
|
; CHECK: $r0 = MOVr killed $r3, 14 /* CC::al */, $noreg, $noreg
|
|
; CHECK-NEXT: BL @OUTLINED_FUNCTION_[[I5FP16:[0-9]+]]
|
|
; CHECK-NEXT: $s6 = VLDRH $sp, 252, 14, $noreg
|
|
$r0 = MOVr killed $r3, 14, $noreg, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$s1 = VLDRH $sp, 0, 14, $noreg
|
|
$s2 = VLDRH $sp, 8, 14, $noreg
|
|
$s5 = VLDRH $sp, 240, 14, $noreg
|
|
$s6 = VLDRH $sp, 252, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$s1 = VLDRH $sp, 0, 14, $noreg
|
|
$s2 = VLDRH $sp, 8, 14, $noreg
|
|
$s5 = VLDRH $sp, 240, 14, $noreg
|
|
$s6 = VLDRH $sp, 252, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$s1 = VLDRH $sp, 0, 14, $noreg
|
|
$s2 = VLDRH $sp, 8, 14, $noreg
|
|
$s5 = VLDRH $sp, 240, 14, $noreg
|
|
$s6 = VLDRH $sp, 252, 14, $noreg
|
|
BL @foo, implicit-def dead $lr, implicit $sp
|
|
$s1 = VLDRH $sp, 0, 14, $noreg
|
|
$s2 = VLDRH $sp, 8, 14, $noreg
|
|
$s5 = VLDRH $sp, 240, 14, $noreg
|
|
$s6 = VLDRH $sp, 252, 14, $noreg
|
|
BX_RET 14, $noreg
|
|
...
|
|
---
|
|
|
|
name: foo
|
|
tracksRegLiveness: true
|
|
body: |
|
|
bb.0:
|
|
liveins: $lr
|
|
|
|
BX_RET 14, $noreg
|
|
|
|
;CHECK: name: OUTLINED_FUNCTION_[[I5]]
|
|
;CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -8
|
|
;CHECK-NEXT: BL @foo, implicit-def dead $lr, implicit $sp
|
|
;CHECK-NEXT: $d0 = VLDRD $sp, 2, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $d1 = VLDRD $sp, 10, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $d4 = VLDRD $sp, 255, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
|
|
|
|
;CHECK: name: OUTLINED_FUNCTION_[[I5FP16]]
|
|
;CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -8
|
|
;CHECK-NEXT: BL @foo, implicit-def dead $lr, implicit $sp
|
|
;CHECK-NEXT: $s1 = VLDRH $sp, 4, 14, $noreg
|
|
;CHECK-NEXT: $s2 = VLDRH $sp, 12, 14, $noreg
|
|
;CHECK-NEXT: $s5 = VLDRH $sp, 244, 14, $noreg
|
|
;CHECK-NEXT: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
|
|
|
|
;CHECK: name: OUTLINED_FUNCTION_[[I12]]
|
|
;CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -8
|
|
;CHECK-NEXT: BL @foo, implicit-def dead $lr, implicit $sp
|
|
;CHECK-NEXT: $r1 = LDRi12 $sp, 8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $r2 = LDRi12 $sp, 16, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $r5 = LDRi12 $sp, 4094, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
|
|
|
|
;CHECK: name: OUTLINED_FUNCTION_[[I3]]
|
|
;CHECK: early-clobber $sp = STR_PRE_IMM killed $lr, $sp, -8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
|
|
;CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -8
|
|
;CHECK-NEXT: BL @foo, implicit-def dead $lr, implicit $sp
|
|
;CHECK-NEXT: $r1 = LDRSH $sp, $noreg, 8, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $r2 = LDRSH $sp, $noreg, 16, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $r5 = LDRSH $sp, $noreg, 255, 14 /* CC::al */, $noreg
|
|
;CHECK-NEXT: $lr, $sp = LDR_POST_IMM $sp, $noreg, 8, 14 /* CC::al */, $noreg
|