llvm.org GIT mirror llvm / f3c3828
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 Hal Finkel 7 years ago
4 changed file(s) with 21 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
295295
296296 let PPC970_Unit = 1 in { // FXU Operations.
297297
298 let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
298299 def LI8 : DForm_2_r0<14, (outs G8RC:$rD), (ins symbolLo64:$imm),
299300 "li $rD, $imm", IntSimple,
300301 [(set G8RC:$rD, immSExt16:$imm)]>;
301302 def LIS8 : DForm_2_r0<15, (outs G8RC:$rD), (ins symbolHi64:$imm),
302303 "lis $rD, $imm", IntSimple,
303304 [(set G8RC:$rD, imm16ShiftedSExt:$imm)]>;
305 }
304306
305307 // Logical ops.
306308 def NAND8: XForm_6<31, 476, (outs G8RC:$rA), (ins G8RC:$rS, G8RC:$rB),
971971 [(set GPRC:$rD, (subc immSExt16:$imm, GPRC:$rA))]>;
972972 }
973973
974 let isReMaterializable = 1 in {
974 let isReMaterializable = 1, isAsCheapAsAMove = 1, isMoveImm = 1 in {
975975 def LI : DForm_2_r0<14, (outs GPRC:$rD), (ins symbolLo:$imm),
976976 "li $rD, $imm", IntSimple,
977977 [(set GPRC:$rD, immSExt16:$imm)]>;
11
22 declare void @bar(i64 %x, i64 %y)
33
4 ; CHECK: li {{[53]}}, 0
4 ; CHECK: li 3, 0
55 ; CHECK: li 4, 2
6 ; CHECK: li 5, 0
67 ; CHECK: li 6, 3
7 ; CHECK: mr {{[53]}}, {{[53]}}
88
99 define void @foo() {
1010 call void @bar(i64 2, i64 3)
0 ; RUN: llc < %s | FileCheck %s
1 ; ModuleID = 'test.c'
2 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"
3 target triple = "powerpc-unknown-linux"
4
5 @.str = private unnamed_addr constant [6 x i8] c"%d,%d\00", align 1
6
7 define i32 @main() nounwind {
8 entry:
9 ; CHECK: li 4, 128
10 ; CHECK-NOT: mr 4, {{.*}}
11 %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i32 128, i32 128) nounwind
12 ret i32 0
13 }
14
15 declare i32 @printf(i8* nocapture, ...) nounwind