[Mesa-dev] [PATCH 3/3] radeon/llvm: fix crashes when using MULLO_INT

Vincent Lejeune vljn at ovi.com
Thu Oct 18 12:12:50 PDT 2012


---
 lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp b/lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp
index d5ae33d..f499c78 100644
--- a/lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp
+++ b/lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp
@@ -276,11 +276,20 @@ bool R600ExpandSpecialInstrsPass::runOnMachineFunction(MachineFunction &MF) {
         } else {
           Opcode = MI.getOpcode();
         }
-        MachineInstr *NewMI =
-          BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(Opcode), DstReg)
-                  .addReg(Src0)
-                  .addReg(Src1)
-                  .addImm(0); // Flag
+
+        MachineInstr *NewMI;
+        if (MI.getNumExplicitOperands() == 5) {
+          NewMI = BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(Opcode), DstReg)
+              .addReg(Src0)
+              .addReg(Src1)
+              .addReg(0) // Pred
+              .addImm(0); // Flag
+        } else {
+          NewMI = BuildMI(MBB, I, MBB.findDebugLoc(I), TII->get(Opcode), DstReg)
+              .addReg(Src0)
+              .addReg(Src1)
+              .addImm(0); // Flag
+        }
 
         NewMI->setIsInsideBundle(Chan != 0);
         TII->addFlag(NewMI, 0, Flags);
-- 
1.7.11.7



More information about the mesa-dev mailing list