radeon/llvm: Add support for fneg on SI
authorTom Stellard <thomas.stellard@amd.com>
Thu, 2 Aug 2012 18:05:20 +0000 (14:05 -0400)
committerTom Stellard <thomas.stellard@amd.com>
Thu, 2 Aug 2012 20:12:10 +0000 (20:12 +0000)
src/gallium/drivers/radeon/SIISelLowering.cpp
src/gallium/drivers/radeon/SIInstructions.td

index a14cb6f4106539f7f72ff30b9d621655777a9803..3e08e885129404d40606d6918b6ba78590e95294 100644 (file)
@@ -99,6 +99,21 @@ MachineBasicBlock * SITargetLowering::EmitInstrWithCustomInserter(
     MI->eraseFromParent();
     break;
 
+  case AMDGPU::FNEG_SI:
+    BuildMI(*BB, I, BB->findDebugLoc(I), TII->get(AMDGPU::V_MOV_B32_e64))
+                 .addOperand(MI->getOperand(0))
+                 .addOperand(MI->getOperand(1))
+                 // VSRC1-2 are unused, but we still need to fill all the
+                 // operand slots, so we just reuse the VSRC0 operand
+                 .addOperand(MI->getOperand(1))
+                 .addOperand(MI->getOperand(1))
+                 .addImm(0) // ABS
+                 .addImm(0) // CLAMP
+                 .addImm(0) // OMOD
+                 .addImm(1); // NEG
+    MI->eraseFromParent();
+    break;
+
   case AMDGPU::SI_INTERP:
     LowerSI_INTERP(MI, *BB, I, MRI);
     break;
index 1f03ea57278e2541244a098143f3a6e3c9ce81c8..c753943eabf6d4c90e877f1cde4f428e28170264 100644 (file)
@@ -1017,6 +1017,7 @@ def : Pat <
 
 def CLAMP_SI : CLAMP<VReg_32>;
 def FABS_SI : FABS<VReg_32>;
+def FNEG_SI : FNEG<VReg_32>;
 
 def : Extract_Element <f32, v4f32, VReg_128, 0, sel_x>;
 def : Extract_Element <f32, v4f32, VReg_128, 1, sel_y>;