radeon/llvm: Move SMRD IMM pattern before SMRD SGPR pattern
authorTom Stellard <thomas.stellard@amd.com>
Tue, 31 Jul 2012 16:42:15 +0000 (16:42 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 31 Jul 2012 20:19:20 +0000 (20:19 +0000)
In tablegen, if two patterns match, the one that comes first in the file
is given preference.  We want the SMRD IMM pattern to be given
preference, because it encodes the pointer offset in its immediate
field, which saves us an add instruction.

src/gallium/drivers/radeon/SIInstrInfo.td

index 78b1a37f08191cc1eec3eb927508c2fc2f52c561..36496f0cc73cca55f5ab2223f5acc8acb2479e0c 100644 (file)
@@ -475,21 +475,20 @@ class MTBUF_Store_Helper <bits<3> op, string asm, RegisterClass regClass> : MTBU
 
 multiclass SMRD_Helper <bits<5> op, string asm, RegisterClass dstClass,
                        ValueType vt> {
-
-  def _SGPR : SMRD <
+  def _IMM : SMRD <
               op,
               (outs dstClass:$dst),
-              (ins SMRDmemrr:$src0),
+              (ins SMRDmemri:$src0),
               asm,
-              [(set (vt dstClass:$dst), (constant_load ADDR_Reg:$src0))]
+              [(set (vt dstClass:$dst), (constant_load ADDR_Offset8:$src0))]
   >;
 
-  def _IMM : SMRD <
+  def _SGPR : SMRD <
               op,
               (outs dstClass:$dst),
-              (ins SMRDmemri:$src0),
+              (ins SMRDmemrr:$src0),
               asm,
-              [(set (vt dstClass:$dst), (constant_load ADDR_Offset8:$src0))]
+              [(set (vt dstClass:$dst), (constant_load ADDR_Reg:$src0))]
   >;
 }