i965: Only consider fixed_hw_reg in equals() if file is HW_REG/IMM.
authorMatt Turner <mattst88@gmail.com>
Tue, 18 Aug 2015 21:28:03 +0000 (14:28 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 28 Aug 2015 18:30:47 +0000 (11:30 -0700)
Noticed when debugging things that lead to the next patch.

On G45 (and presumably ILK) this helps register coalescing:

total instructions in shared programs: 4077373 -> 4077340 (-0.00%)
instructions in affected programs:     43751 -> 43718 (-0.08%)
helped:                                52
HURT:                                  2

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_vec4.cpp

index 81009a091284b993a8fcd02b1171ee65cdd9aafc..269914d64a887e346f0d680e869c7e99033960d7 100644 (file)
@@ -427,7 +427,9 @@ fs_reg::equals(const fs_reg &r) const
            negate == r.negate &&
            abs == r.abs &&
            !reladdr && !r.reladdr &&
-           memcmp(&fixed_hw_reg, &r.fixed_hw_reg, sizeof(fixed_hw_reg)) == 0 &&
+           ((file != HW_REG && file != IMM) ||
+            memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
+                   sizeof(fixed_hw_reg)) == 0) &&
            stride == r.stride);
 }
 
index f18915a8e3806a12fcb6138de39ee81e3da823d7..b97b6c13a13d3646504a37cd0cd231ce63086964 100644 (file)
@@ -216,8 +216,9 @@ dst_reg::equals(const dst_reg &r) const
            writemask == r.writemask &&
            (reladdr == r.reladdr ||
             (reladdr && r.reladdr && reladdr->equals(*r.reladdr))) &&
-           memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
-                  sizeof(fixed_hw_reg)) == 0);
+           ((file != HW_REG && file != IMM) ||
+            memcmp(&fixed_hw_reg, &r.fixed_hw_reg,
+                   sizeof(fixed_hw_reg)) == 0));
 }
 
 bool