r300/compiler: Rewrite source swizzles when using OMOD
authorTom Stellard <tstellar@gmail.com>
Sat, 1 Oct 2011 22:21:05 +0000 (15:21 -0700)
committerTom Stellard <tstellar@gmail.com>
Sun, 2 Oct 2011 22:21:15 +0000 (15:21 -0700)
src/gallium/drivers/r300/compiler/radeon_optimize.c

index 7df9681bee7eab5dd076985aa3fb69ef146a1a86..b7a0e20797c03ddb63fe98ac6282ca9690c2609e 100644 (file)
@@ -801,8 +801,13 @@ static int peephole_mul_omod(
        /* Rewrite the instructions */
        for (var = writer_list->Item; var; var = var->Friend) {
                struct rc_variable * writer = writer_list->Item;
+               unsigned conversion_swizzle = rc_make_conversion_swizzle(
+                                       writer->Inst->U.I.DstReg.WriteMask,
+                                       inst_mul->U.I.DstReg.WriteMask);
                writer->Inst->U.I.Omod = omod_op;
-               writer->Inst->U.I.DstReg = inst_mul->U.I.DstReg;
+               writer->Inst->U.I.DstReg.File = inst_mul->U.I.DstReg.File;
+               writer->Inst->U.I.DstReg.Index = inst_mul->U.I.DstReg.Index;
+               rc_normal_rewrite_writemask(writer->Inst, conversion_swizzle);
                writer->Inst->U.I.SaturateMode = inst_mul->U.I.SaturateMode;
        }