OSDN Git Service

i965/vec4: Use reads_accumulator_implicitly(), not MACH checks.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 22 Apr 2017 22:02:08 +0000 (15:02 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 24 Apr 2017 17:53:49 +0000 (10:53 -0700)
Curro pointed out that I should not just check for MACH, but use
the reads_accumulator_implicitly() helper, which would also prevent
the same bug with MAC and SADA2 (if we ever decide to use them).

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/intel/compiler/brw_vec4.cpp

index 4bb774b..0909ddb 100644 (file)
@@ -1071,11 +1071,11 @@ vec4_instruction::can_reswizzle(const struct gen_device_info *devinfo,
    if (devinfo->gen == 6 && is_math() && swizzle != BRW_SWIZZLE_XYZW)
       return false;
 
-   /* Don't touch MACH - it uses the accumulator results from an earlier
-    * MUL - so we'd need to reswizzle both.  We don't do that, so just
-    * avoid it entirely.
+   /* We can't swizzle implicit accumulator access.  We'd have to
+    * reswizzle the producer of the accumulator value in addition
+    * to the consumer (i.e. both MUL and MACH).  Just skip this.
     */
-   if (opcode == BRW_OPCODE_MACH)
+   if (reads_accumulator_implicitly())
       return false;
 
    if (!can_do_writemask(devinfo) && dst_writemask != WRITEMASK_XYZW)