[llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td

Chris Lattner lattner at cs.uiuc.edu
Wed Sep 28 16:07:24 PDT 2005



Changes in directory llvm/lib/Target/PowerPC:

PowerPCInstrInfo.td updated: 1.110 -> 1.111
---
Log message:

Codegen ADD X, IMM -> addis/addi if needed.
This implements PowerPC/fold-li.ll



---
Diffs of the changes:  (+12 -2)

 PowerPCInstrInfo.td |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/PowerPC/PowerPCInstrInfo.td
diff -u llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.110 llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.111
--- llvm/lib/Target/PowerPC/PowerPCInstrInfo.td:1.110	Wed Sep 28 17:47:06 2005
+++ llvm/lib/Target/PowerPC/PowerPCInstrInfo.td	Wed Sep 28 18:07:13 2005
@@ -218,6 +218,13 @@
   return getI32Imm((unsigned)N->getValue() >> 16);
 }]>;
 
+def HA16 : SDNodeXForm<imm, [{
+  // Transformation function: shift the immediate value down into the low bits.
+  signed int Val = N->getValue();
+  return getI32Imm((Val - (signed short)Val) >> 16);
+}]>;
+
+
 def immSExt16  : PatLeaf<(imm), [{
   // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended
   // field.  Used by instructions like 'addi'.
@@ -801,10 +808,13 @@
 def EQV2 : Pat<(xor GPRC:$in1, (not GPRC:$in2)),
                (EQV GPRC:$in1, GPRC:$in2)>;
 
-// or by an arbitrary immediate.
+// ADD an arbitrary immediate.
+def : Pat<(add GPRC:$in, imm:$imm),
+          (ADDIS (ADDI GPRC:$in, (LO16 imm:$imm)), (HA16 imm:$imm))>;
+// OR an arbitrary immediate.
 def : Pat<(or GPRC:$in, imm:$imm),
           (ORIS (ORI GPRC:$in, (LO16 imm:$imm)), (HI16 imm:$imm))>;
-// xor by an arbitrary immediate.
+// XOR an arbitrary immediate.
 def : Pat<(xor GPRC:$in, imm:$imm),
           (XORIS (XORI GPRC:$in, (LO16 imm:$imm)), (HI16 imm:$imm))>;
 






More information about the llvm-commits mailing list