1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/test/CodeGen/Mips/largeimm1.ll
Simon Dardis 1f6e565a78 [mips] Optimize stack pointer adjustments.
Instead of always using addu to adjust the stack pointer when the
size out is of the range of an addiu instruction, use subu so that
a smaller constant can be generated.

This can give savings of ~3 instructions whenever a function has a
a stack frame whose size is out of range of an addiu instruction.

This change may break some naive stack unwinders.

Partially resolves PR/26291.

Thanks to David Chisnall for reporting the issue.

Reviewers: dsanders, vkalintiris

Differential Review: http://reviews.llvm.org/D21321

llvm-svn: 272666
2016-06-14 13:39:43 +00:00

20 lines
545 B
LLVM

; RUN: llc -march=mipsel -relocation-model=pic < %s | FileCheck %s
define void @f() nounwind {
entry:
%a1 = alloca [1073741824 x i8], align 1
%arrayidx = getelementptr inbounds [1073741824 x i8], [1073741824 x i8]* %a1, i32 0, i32 1048676
call void @f2(i8* %arrayidx) nounwind
ret void
; CHECK-LABEL: f:
; CHECK: lui $[[R0:[a-z0-9]+]], 16384
; CHECK: addiu $[[R1:[a-z0-9]+]], $[[R0]], 24
; CHECK: subu $sp, $sp, $[[R1]]
; CHECK: lui $[[R2:[a-z0-9]+]], 16384
; CHECK: addu ${{[0-9]+}}, $sp, $[[R2]]
}
declare void @f2(i8*)