1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/Thumb2/thumb2-execute-only-prologue.ll
Keith Walker 894061e4f5 [ARM] unwinding .pad instructions missing in execute-only prologue
If the stack pointer is altered for local variables and we are generating
Thumb2 execute-only code the .pad directive is missing.

Usually the size of the adjustment is stored in a PC-relative location
and loaded into a register which is then added to the stack pointer.
However when we are generating execute-only code code the size of the
adjustment is instead generated using the MOVW/MOVT instruction pair.

As a by product of handling the execute-only case this also fixes an
existing issue that in the none execute-only case the .pad directive was
generated against the load of the constant to a register instruction,
instead of the instruction which adds the register to the stack pointer.

Differential Revision: https://reviews.llvm.org/D76849
2020-04-07 11:51:59 +01:00

39 lines
1.1 KiB
LLVM

; RUN: llc < %s -mtriple=thumbv8m.base-arm-none-eabi | FileCheck %s
define void @fn() {
entry:
; CHECK-LABEL: fn:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .save {r4, r5, r6, lr}
; CHECK-NEXT: push {r4, r5, r6, lr}
; CHECK-NEXT: ldr r6, .LCPI0_0
; CHECK-NEXT: .pad #1600
; CHECK-NEXT: add sp, r6
; CHECK: .LCPI0_0:
; CHECK_NEXT: long 4294963196
%a = alloca [400 x i32], align 4
%arraydecay = getelementptr inbounds [400 x i32], [400 x i32]* %a, i32 0, i32 0
call void @bar(i32* %arraydecay)
ret void
}
define void @execute_only_fn() #0 {
entry:
; CHECK-LABEL: execute_only_fn:
; CHECK: @ %bb.0: @ %entry
; CHECK-NEXT: .save {r4, r5, r6, lr}
; CHECK-NEXT: push {r4, r5, r6, lr}
; CHECK-NEXT: movw r6, #63936
; CHECK-NEXT: movt r6, #65535
; CHECK-NEXT: .pad #1600
; CHECK-NEXT: add sp, r6
%a = alloca [400 x i32], align 4
%arraydecay = getelementptr inbounds [400 x i32], [400 x i32]* %a, i32 0, i32 0
call void @bar(i32* %arraydecay)
ret void
}
declare dso_local void @bar(i32*)
attributes #0 = { noinline optnone "target-features"="+armv8-m.base,+execute-only,+thumb-mode" }