struct prog_src_register src0 = inst->SrcReg[0];
struct prog_src_register src1 = inst->SrcReg[1];
struct prog_dst_register dst = inst->DstReg;
-
+ struct prog_dst_register temp = get_temp(c);
+
if (dst.WriteMask & WRITEMASK_Y) {
/* dst.y = mul src0.y, src1.y
*/
emit_op(c,
OPCODE_MUL,
- dst_mask(dst, WRITEMASK_Y),
+ dst_mask(temp, WRITEMASK_Y),
inst->SaturateMode,
src0,
src1,
*/
swz = emit_op(c,
OPCODE_SWZ,
- dst_mask(dst, WRITEMASK_XZ),
+ dst_mask(temp, WRITEMASK_XZ),
inst->SaturateMode,
src_swizzle(src0, SWIZZLE_ONE, z, z, z),
src_undef(),
*/
emit_op(c,
OPCODE_MOV,
- dst_mask(dst, WRITEMASK_W),
+ dst_mask(temp, WRITEMASK_W),
inst->SaturateMode,
src1,
src_undef(),
src_undef());
}
+
+ /* This will get optimized out in general, but it ensures that we
+ * don't overwrite src operands in our channel-wise splitting
+ * above. See piglit fp-dst-aliasing-[12].
+ */
+ emit_op(c,
+ OPCODE_MOV,
+ dst,
+ 0,
+ src_reg_from_dst(temp),
+ src_undef(),
+ src_undef());
+
+ release_temp(c, temp);
}