mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Allow remat of LI on PPC.
Allow load-immediates to be rematerialised in the register coalescer for PPC. This makes test/CodeGen/PowerPC/big-endian-formal-args.ll fail, because it relies on a register move getting emitted. The immediate load is equivalent, so change this test case. Patch by Tobias von Koch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d939cd68f4
commit
f3c3828e57
@ -296,12 +296,14 @@ def MFLR8 : XFXForm_1_ext<31, 339, 8, (outs G8RC:$rT), (ins),
|
||||
|
||||
let PPC970_Unit = 1 in { // FXU Operations.
|
||||
|
||||
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
|
||||
def LI8 : DForm_2_r0<14, (outs G8RC:$rD), (ins symbolLo64:$imm),
|
||||
"li $rD, $imm", IntSimple,
|
||||
[(set G8RC:$rD, immSExt16:$imm)]>;
|
||||
def LIS8 : DForm_2_r0<15, (outs G8RC:$rD), (ins symbolHi64:$imm),
|
||||
"lis $rD, $imm", IntSimple,
|
||||
[(set G8RC:$rD, imm16ShiftedSExt:$imm)]>;
|
||||
}
|
||||
|
||||
// Logical ops.
|
||||
def NAND8: XForm_6<31, 476, (outs G8RC:$rA), (ins G8RC:$rS, G8RC:$rB),
|
||||
|
@ -972,7 +972,7 @@ def SUBFIC : DForm_2< 8, (outs GPRC:$rD), (ins GPRC:$rA, s16imm:$imm),
|
||||
[(set GPRC:$rD, (subc immSExt16:$imm, GPRC:$rA))]>;
|
||||
}
|
||||
|
||||
let isReMaterializable = 1 in {
|
||||
let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
|
||||
def LI : DForm_2_r0<14, (outs GPRC:$rD), (ins symbolLo:$imm),
|
||||
"li $rD, $imm", IntSimple,
|
||||
[(set GPRC:$rD, immSExt16:$imm)]>;
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
declare void @bar(i64 %x, i64 %y)
|
||||
|
||||
; CHECK: li {{[53]}}, 0
|
||||
; CHECK: li 3, 0
|
||||
; CHECK: li 4, 2
|
||||
; CHECK: li 5, 0
|
||||
; CHECK: li 6, 3
|
||||
; CHECK: mr {{[53]}}, {{[53]}}
|
||||
|
||||
define void @foo() {
|
||||
call void @bar(i64 2, i64 3)
|
||||
|
16
test/CodeGen/PowerPC/remat-imm.ll
Normal file
16
test/CodeGen/PowerPC/remat-imm.ll
Normal file
@ -0,0 +1,16 @@
|
||||
; RUN: llc < %s | FileCheck %s
|
||||
; ModuleID = 'test.c'
|
||||
target datalayout = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32"
|
||||
target triple = "powerpc-unknown-linux"
|
||||
|
||||
@.str = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
|
||||
|
||||
define i32 @main() nounwind {
|
||||
entry:
|
||||
; CHECK: li 4, 128
|
||||
; CHECK-NOT: mr 4, {{.*}}
|
||||
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i32 128, i32 128) nounwind
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
declare i32 @printf(i8* nocapture, ...) nounwind
|
Loading…
x
Reference in New Issue
Block a user