1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

implement large (>16 bit) constant loading.

llvm-svn: 166749
This commit is contained in:
Reed Kotler 2012-10-26 03:09:34 +00:00
parent 32ebb868a5
commit fd22c8bfc1
2 changed files with 21 additions and 0 deletions

View File

@ -971,6 +971,10 @@ class SetCC_I16<PatFrag cond_op, PatLeaf imm_type, Instruction I>:
Mips16Pat<(cond_op CPU16Regs:$rx, imm_type:$imm16), Mips16Pat<(cond_op CPU16Regs:$rx, imm_type:$imm16),
(I CPU16Regs:$rx, imm_type:$imm16)>; (I CPU16Regs:$rx, imm_type:$imm16)>;
// Large (>16 bit) immediate loads
def : Mips16Pat<(i32 imm:$imm),
(OrRxRxRy16 (SllX16 (LiRxImmX16 (HI16 imm:$imm)), 16),
(LiRxImmX16 (LO16 imm:$imm)))>;
// //
// Some branch conditional patterns are not generated by llvm at this time. // Some branch conditional patterns are not generated by llvm at this time.

17
test/CodeGen/Mips/i32k.ll Normal file
View File

@ -0,0 +1,17 @@
; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16a
; RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16b
@.str = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
define i32 @main() nounwind {
entry:
%call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 1075344593) nounwind
; 16a: li ${{[0-9]+}}, 29905
; 16b: li ${{[0-9]+}}, 16408
%call1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str, i32 0, i32 0), i32 -1075344593) nounwind
; 16a: li ${{[0-9]+}}, 49127
; 16b: li ${{[0-9]+}}, 35631
ret i32 0
}
declare i32 @printf(i8* nocapture, ...) nounwind