[llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8InstrFormats.td SparcV8InstrInfo.td

Chris Lattner lattner at cs.uiuc.edu
Sat Dec 17 11:37:12 PST 2005



Changes in directory llvm/lib/Target/SparcV8:

SparcV8InstrFormats.td updated: 1.11 -> 1.12
SparcV8InstrInfo.td updated: 1.53 -> 1.54
---
Log message:

Use sethi to build large immediates with zeros at the bottom



---
Diffs of the changes:  (+14 -3)

 SparcV8InstrFormats.td |    3 ++-
 SparcV8InstrInfo.td    |   14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/SparcV8/SparcV8InstrFormats.td
diff -u llvm/lib/Target/SparcV8/SparcV8InstrFormats.td:1.11 llvm/lib/Target/SparcV8/SparcV8InstrFormats.td:1.12
--- llvm/lib/Target/SparcV8/SparcV8InstrFormats.td:1.11	Sat Dec 17 12:49:14 2005
+++ llvm/lib/Target/SparcV8/SparcV8InstrFormats.td	Sat Dec 17 13:37:00 2005
@@ -21,11 +21,12 @@
 
 // Specific F2 classes: SparcV8 manual, page 44
 //
-class F2_1<bits<3> op2Val, dag ops, string asmstr> : F2 {
+class F2_1<bits<3> op2Val, dag ops, string asmstr, list<dag> pattern> : F2 {
   bits<5>  rd;
 
   dag OperandList = ops;
   let AsmString   = asmstr;
+  let Pattern = pattern;
 
   let op2         = op2Val;
 


Index: llvm/lib/Target/SparcV8/SparcV8InstrInfo.td
diff -u llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.53 llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.54
--- llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.53	Sat Dec 17 13:07:57 2005
+++ llvm/lib/Target/SparcV8/SparcV8InstrInfo.td	Sat Dec 17 13:37:00 2005
@@ -39,6 +39,15 @@
   return (((int)N->getValue() << (32-13)) >> (32-13)) == (int)N->getValue();
 }]>;
 
+def HI22 : SDNodeXForm<imm, [{
+  // Transformation function: shift the immediate value down into the low bits.
+  return CurDAG->getTargetConstant((unsigned)N->getValue() >> 10, MVT::i32);
+}]>;
+
+def SETHIimm : PatLeaf<(imm), [{
+  return (((unsigned)N->getValue() >> 10) << 10) == (unsigned)N->getValue();
+}], HI22>;
+
 //===----------------------------------------------------------------------===//
 // Instructions
 //===----------------------------------------------------------------------===//
@@ -160,12 +169,13 @@
 // Section B.9 - SETHI Instruction, p. 104
 def SETHIi: F2_1<0b100,
                  (ops IntRegs:$dst, i32imm:$src),
-                 "sethi $src, $dst">;
+                 "sethi $src, $dst",
+                 [(set IntRegs:$dst, SETHIimm:$src)]>;
 
 // Section B.10 - NOP Instruction, p. 105
 // (It's a special case of SETHI)
 let rd = 0, imm22 = 0 in
-  def NOP : F2_1<0b100, (ops), "nop">;
+  def NOP : F2_1<0b100, (ops), "nop", []>;
 
 // Section B.11 - Logical Instructions, p. 106
 def ANDrr   : F3_1<2, 0b000001,






More information about the llvm-commits mailing list