radeon/llvm: Remove AMDIL VCREATE* instructions
authorTom Stellard <thomas.stellard@amd.com>
Sat, 2 Jun 2012 11:09:16 +0000 (07:09 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 6 Jun 2012 17:46:03 +0000 (13:46 -0400)
This obsoletes the AMDGPULowerInstruction pass.

src/gallium/drivers/radeon/AMDGPU.h
src/gallium/drivers/radeon/AMDGPUInstructions.td
src/gallium/drivers/radeon/AMDGPULowerInstructions.cpp [deleted file]
src/gallium/drivers/radeon/AMDGPUTargetMachine.cpp
src/gallium/drivers/radeon/AMDILInstructions.td
src/gallium/drivers/radeon/Makefile.sources
src/gallium/drivers/radeon/R600Instructions.td
src/gallium/drivers/radeon/SIInstructions.td

index 9d81bc22336f272986731a62152253887a452b33..191f495eaa43e25982e852884d0d55d6e88e41fe 100644 (file)
@@ -28,7 +28,6 @@ FunctionPass *createSIAssignInterpRegsPass(TargetMachine &tm);
 FunctionPass *createSICodeEmitterPass(formatted_raw_ostream &OS);
 
 // Passes common to R600 and SI
-FunctionPass *createAMDGPULowerInstructionsPass(TargetMachine &tm);
 FunctionPass *createAMDGPUConvertToISAPass(TargetMachine &tm);
 
 } // End namespace llvm
index 28ea93d06ede1c4777910f1052696dd27c93c861..9ec9c4d0356ec0108d9455892d26b26fbbe1e9e0 100644 (file)
@@ -104,6 +104,12 @@ class Insert_Element <ValueType elem_type, ValueType vec_type,
   (INSERT_SUBREG vec_class:$vec, elem_class:$elem, sub_reg)
 >;
 
+// Vector Build pattern
+class Vector_Build <ValueType vecType, RegisterClass elemClass> : Pat <
+  (IL_vbuild elemClass:$src),
+  (INSERT_SUBREG (vecType (IMPLICIT_DEF)), elemClass:$src, sel_x)
+>;
+
 // bitconvert pattern
 class BitConvert <ValueType dt, ValueType st, RegisterClass rc> : Pat <
   (dt (bitconvert (st rc:$src0))),
diff --git a/src/gallium/drivers/radeon/AMDGPULowerInstructions.cpp b/src/gallium/drivers/radeon/AMDGPULowerInstructions.cpp
deleted file mode 100644 (file)
index d129a3b..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//===-- AMDGPULowerInstructions.cpp - AMDGPU lowering pass ----------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This pass lowers unsupported AMDIL MachineInstrs to LLVM pseudo 
-// MachineInstrs for hw codegen targets.
-//
-//===----------------------------------------------------------------------===//
-
-
-#include "AMDGPU.h"
-#include "AMDGPURegisterInfo.h"
-#include "AMDIL.h"
-#include "llvm/CodeGen/MachineFunctionPass.h"
-#include "llvm/CodeGen/MachineInstrBuilder.h"
-#include "llvm/CodeGen/MachineRegisterInfo.h"
-
-using namespace llvm;
-
-namespace {
-
-class AMDGPULowerInstructionsPass : public MachineFunctionPass {
-
-private:
-  static char ID;
-  TargetMachine &TM;
-  void lowerVCREATE_v4(MachineInstr &MI, MachineBasicBlock::iterator I,
-                            MachineBasicBlock &MBB, MachineFunction &MF);
-
-public:
-  AMDGPULowerInstructionsPass(TargetMachine &tm) :
-    MachineFunctionPass(ID), TM(tm) { }
-
-  virtual bool runOnMachineFunction(MachineFunction &MF);
-
-  virtual const char *getPassName() const {return "AMDGPU Lower Instructions";}
-
-};
-
-} // End anonymous namespace
-
-char AMDGPULowerInstructionsPass::ID = 0;
-
-FunctionPass *llvm::createAMDGPULowerInstructionsPass(TargetMachine &tm) {
-  return new AMDGPULowerInstructionsPass(tm);
-}
-
-bool AMDGPULowerInstructionsPass::runOnMachineFunction(MachineFunction &MF)
-{
-  for (MachineFunction::iterator BB = MF.begin(), BB_E = MF.end();
-                                                  BB != BB_E; ++BB) {
-    MachineBasicBlock &MBB = *BB;
-    for (MachineBasicBlock::iterator I = MBB.begin(), Next = llvm::next(I);
-         I != MBB.end(); I = Next, Next = llvm::next(I) ) {
-      MachineInstr &MI = *I;
-
-      switch (MI.getOpcode()) {
-      default: continue;
-      case AMDIL::VCREATE_v4f32:
-      case AMDIL::VCREATE_v4i32:
-        lowerVCREATE_v4(MI, I, MBB, MF); break;
-      }
-      MI.eraseFromParent();
-    }
-  }
-  return false;
-}
-
-void AMDGPULowerInstructionsPass::lowerVCREATE_v4(MachineInstr &MI,
-    MachineBasicBlock::iterator I, MachineBasicBlock &MBB, MachineFunction &MF)
-{
-  MachineRegisterInfo & MRI = MF.getRegInfo();
-  unsigned tmp = MRI.createVirtualRegister(
-                  MRI.getRegClass(MI.getOperand(0).getReg()));
-
-  BuildMI(MBB, I, DebugLoc(), TM.getInstrInfo()->get(AMDIL::IMPLICIT_DEF), tmp);
-
-  BuildMI(MBB, I, DebugLoc(), TM.getInstrInfo()->get(AMDIL::INSERT_SUBREG))
-          .addOperand(MI.getOperand(0))
-          .addReg(tmp)
-          .addOperand(MI.getOperand(1))
-          .addImm(AMDIL::sel_x);
-}
index b4d2a2f5ea12a632d7276f3b69075925f29fe89d..c6a2412f970c665142c389a9cdc4aa83896d81bb 100644 (file)
@@ -138,7 +138,6 @@ bool AMDGPUPassConfig::addPreRegAlloc() {
   if (ST.device()->getGeneration() > AMDILDeviceInfo::HD6XXX) {
     PM->add(createSIAssignInterpRegsPass(*TM));
   }
-  PM->add(createAMDGPULowerInstructionsPass(*TM));
   PM->add(createAMDGPUConvertToISAPass(*TM));
   return false;
 }
index 586d18d010597d2adc49442273c8ff8c67ef1ce2..afddefebce6bdc81ce3e3326fa37fa0a8b6dc34f 100644 (file)
@@ -731,12 +731,6 @@ def LCREATE_v2i64     : TwoInOneOut<IL_OP_I_ADD, (outs GPRV2I64:$dst),
                 !strconcat(IL_OP_I_ADD.Text, " $dst, $src0, $src1"),
                 [(set GPRV2I64:$dst, 
                     (IL_lcreate2 GPRV2I32:$src0, GPRV2I32:$src1))]>;
-//===---------------------------------------------------------------------===//
-// Scalar ==> Vector conversion functions
-//===---------------------------------------------------------------------===//
-// This opcode has custom swizzle pattern encoded in Swizzle Encoder
-defm VCREATE          : UnaryOpMCVec<IL_OP_MOV, IL_vbuild>;
-
 //===---------------------------------------------------------------------===//
 // Vector ==> Scalar conversion functions
 //===---------------------------------------------------------------------===//
index 9742e6b7790e756253c5963ea3a5b9e0f567d39d..b5665ce95f34cccd62deeed92731e9b0db531270 100644 (file)
@@ -33,7 +33,6 @@ CPP_SOURCES := \
        AMDGPUTargetMachine.cpp         \
        AMDGPUISelLowering.cpp          \
        AMDGPUConvertToISA.cpp          \
-       AMDGPULowerInstructions.cpp             \
        AMDGPUInstrInfo.cpp             \
        AMDGPURegisterInfo.cpp          \
        AMDGPUUtil.cpp                  \
index 27744d1ab6615c982e4adf6ce9ae55b4a35692da..9caaf1c86a02d916cc4e733777724fae56440dfe 100644 (file)
@@ -1122,6 +1122,9 @@ def : Insert_Element <i32, v4i32, R600_Reg32, R600_Reg128, 5, sel_y>;
 def : Insert_Element <i32, v4i32, R600_Reg32, R600_Reg128, 6, sel_z>;
 def : Insert_Element <i32, v4i32, R600_Reg32, R600_Reg128, 7, sel_w>;
 
+def : Vector_Build <v4f32, R600_Reg32>;
+def : Vector_Build <v4i32, R600_Reg32>;
+
 // bitconvert patterns
 
 def : BitConvert <i32, f32, R600_Reg32>;
index 4408777a5f1a874287f9c53ffa33c7f5aaed155b..8fd0c4933fdddd7d43a3fc7ea785325e4909235a 100644 (file)
@@ -905,6 +905,9 @@ def : Insert_Element <f32, v4f32, VReg_32, VReg_128, 5, sel_y>;
 def : Insert_Element <f32, v4f32, VReg_32, VReg_128, 6, sel_z>;
 def : Insert_Element <f32, v4f32, VReg_32, VReg_128, 7, sel_w>;
 
+def : Vector_Build <v4f32, VReg_32>;
+def : Vector_Build <v4i32, SReg_32>;
+
 /*
 def : Pat<
   (int_SI_vs_load_buffer_index),