From: Tom Stellard Date: Fri, 25 May 2012 14:59:52 +0000 (-0400) Subject: radeon/llvm: Use a custom inserter to lower FNEG X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=667cdba2118cf82e0027bf44314c9d1334d00840;p=mesa.git radeon/llvm: Use a custom inserter to lower FNEG --- diff --git a/src/gallium/drivers/radeon/AMDGPUInstructions.td b/src/gallium/drivers/radeon/AMDGPUInstructions.td index 1f0d582d82b..a004b9c5aba 100644 --- a/src/gallium/drivers/radeon/AMDGPUInstructions.td +++ b/src/gallium/drivers/radeon/AMDGPUInstructions.td @@ -74,6 +74,13 @@ class FABS : AMDGPUShaderInst < [(set rc:$dst, (fabs rc:$src0))] >; +class FNEG : AMDGPUShaderInst < + (outs rc:$dst), + (ins rc:$src0), + "FNEG $dst, $src0", + [(set rc:$dst, (fneg rc:$src0))] +>; + } // End isPseudo = 1, hasCustomInserter = 1 } // End isCodeGenOnly = 1 diff --git a/src/gallium/drivers/radeon/AMDILInstructions.td b/src/gallium/drivers/radeon/AMDILInstructions.td index 869c2bb6af2..0197e9418f3 100644 --- a/src/gallium/drivers/radeon/AMDILInstructions.td +++ b/src/gallium/drivers/radeon/AMDILInstructions.td @@ -50,7 +50,6 @@ def INTTOANY_i16: OneInOneOut; // get rid of the addri via the tablegen instead of custom lowered instruction defm EADD : BinaryOpMCi32; def INTTOANY_i32: OneInOneOut; defm RND_Z : UnaryOpMCf32; // This opcode has custom swizzle pattern encoded in Swizzle Encoder -def NEG_f32 : OneInOneOut; def INTTOANY_f32 : OneInOneOutgetOperand(1)); break; + case AMDIL::FNEG_R600: + MI->getOperand(1).addTargetFlag(MO_FLAG_NEG); + BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDIL::MOV)) + .addOperand(MI->getOperand(0)) + .addOperand(MI->getOperand(1)); + break; + case AMDIL::R600_LOAD_CONST: { int64_t RegIndex = MI->getOperand(1).getImm(); diff --git a/src/gallium/drivers/radeon/R600Instructions.td b/src/gallium/drivers/radeon/R600Instructions.td index 22f3fc1b780..a2a509ea8ba 100644 --- a/src/gallium/drivers/radeon/R600Instructions.td +++ b/src/gallium/drivers/radeon/R600Instructions.td @@ -1070,6 +1070,7 @@ def TXD_SHADOW: AMDGPUShaderInst < def CLAMP_R600 : CLAMP ; def FABS_R600 : FABS; +def FNEG_R600 : FNEG; let isPseudo = 1 in { diff --git a/src/gallium/drivers/radeon/R600LowerInstructions.cpp b/src/gallium/drivers/radeon/R600LowerInstructions.cpp index 1795b38dfb6..3b96b195fe6 100644 --- a/src/gallium/drivers/radeon/R600LowerInstructions.cpp +++ b/src/gallium/drivers/radeon/R600LowerInstructions.cpp @@ -224,23 +224,6 @@ bool R600LowerInstructionsPass::runOnMachineFunction(MachineFunction &MF) continue; } - case AMDIL::NEGATE_i32: - BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::SUB_INT)) - .addOperand(MI.getOperand(0)) - .addReg(AMDIL::ZERO) - .addOperand(MI.getOperand(1)); - break; - - case AMDIL::NEG_f32: - { - MI.getOperand(1).addTargetFlag(MO_FLAG_NEG); - BuildMI(MBB, I, MBB.findDebugLoc(I), - TII->get(TII->getISAOpcode(AMDIL::MOV))) - .addOperand(MI.getOperand(0)) - .addOperand(MI.getOperand(1)); - break; - } - case AMDIL::ULT: BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(AMDIL::SETGT_UINT)) .addOperand(MI.getOperand(0))