[llvm] r185518 - [XCore] Add ISel pattern for LDWCP
Richard Osborne
richard at xmos.com
Wed Jul 3 00:48:50 PDT 2013
Author: friedgold
Date: Wed Jul 3 02:48:50 2013
New Revision: 185518
URL: http://llvm.org/viewvc/llvm-project?rev=185518&view=rev
Log:
[XCore] Add ISel pattern for LDWCP
Patch by Robert Lytton.
Modified:
llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td
llvm/trunk/test/CodeGen/XCore/load.ll
Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td?rev=185518&r1=185517&r2=185518&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td (original)
+++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.td Wed Jul 3 02:48:50 2013
@@ -279,12 +279,6 @@ multiclass FRU6_LRU6_backwards_branch<bi
!strconcat(OpcStr, " $a, $b"), []>;
}
-multiclass FRU6_LRU6_cp<bits<6> opc, string OpcStr> {
- def _ru6: _FRU6<opc, (outs RRegs:$a), (ins i32imm:$b),
- !strconcat(OpcStr, " $a, cp[$b]"), []>;
- def _lru6: _FLRU6<opc, (outs RRegs:$a), (ins i32imm:$b),
- !strconcat(OpcStr, " $a, cp[$b]"), []>;
-}
// U6
multiclass FU6_LU6<bits<10> opc, string OpcStr, SDNode OpNode> {
@@ -539,8 +533,13 @@ def STWDP_lru6 : _FLRU6<0b010100, (outs)
[(store RRegs:$a, (dprelwrapper tglobaladdr:$b))]>;
//let Uses = [CP] in ..
-let mayLoad = 1, isReMaterializable = 1, neverHasSideEffects = 1 in
-defm LDWCP : FRU6_LRU6_cp<0b011011, "ldw">;
+let mayLoad = 1, isReMaterializable = 1, neverHasSideEffects = 1 in {
+def LDWCP_ru6 : _FRU6<0b011011, (outs RRegs:$a), (ins i32imm:$b),
+ "ldw $a, cp[$b]", []>;
+def LDWCP_lru6: _FLRU6<0b011011, (outs RRegs:$a), (ins i32imm:$b),
+ "ldw $a, cp[$b]",
+ [(set RRegs:$a, (load (cprelwrapper tglobaladdr:$b)))]>;
+}
let Uses = [SP] in {
let mayStore=1 in {
Modified: llvm/trunk/test/CodeGen/XCore/load.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/load.ll?rev=185518&r1=185517&r2=185518&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/XCore/load.ll (original)
+++ llvm/trunk/test/CodeGen/XCore/load.ll Wed Jul 3 02:48:50 2013
@@ -39,3 +39,12 @@ entry:
%2 = zext i8 %1 to i32
ret i32 %2
}
+
+ at GConst = external constant i32
+define i32 @load_cp() nounwind {
+entry:
+; CHECK: load_cp:
+; CHECK: ldw r0, cp[GConst]
+ %0 = load i32* @GConst
+ ret i32 %0
+}
More information about the llvm-commits
mailing list