summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-02-16 17:33:13 -0800
committerIan Romanick <[email protected]>2018-03-08 15:26:26 -0800
commit1583f49eaae0292eba1a04e67125bb4b92b33b0a (patch)
treee034e9c1d123fdebef8842d918e9a3d5b6fc2ad5 /src/intel/compiler
parent360899d4577a2431dc73b5c702d60ac6bd59ca07 (diff)
i965/vec4: Allow CSE on subset VF constant loads
v2: Rewrite the code that generates the VF mask. Suggested by Ken. No changes on other platforms. Haswell, Ivy Bridge, and Sandy Bridge had similar results. (Haswell shown) total instructions in shared programs: 13059891 -> 13059884 (<.01%) instructions in affected programs: 431 -> 424 (-1.62%) helped: 7 HURT: 0 helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1 helped stats (rel) min: 1.19% max: 5.26% x̄: 2.05% x̃: 1.49% 95% mean confidence interval for instructions value: -1.00 -1.00 95% mean confidence interval for instructions %-change: -3.39% -0.71% Instructions are helped. total cycles in shared programs: 409260032 -> 409260018 (<.01%) cycles in affected programs: 4228 -> 4214 (-0.33%) helped: 7 HURT: 0 helped stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2 helped stats (rel) min: 0.28% max: 2.04% x̄: 0.54% x̃: 0.28% 95% mean confidence interval for cycles value: -2.00 -2.00 95% mean confidence interval for cycles %-change: -1.15% 0.07% Inconclusive result (%-change mean confidence interval includes 0). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/compiler')
-rw-r--r--src/intel/compiler/brw_vec4_cse.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_vec4_cse.cpp b/src/intel/compiler/brw_vec4_cse.cpp
index d9f08c96317..c9cf54c6f75 100644
--- a/src/intel/compiler/brw_vec4_cse.cpp
+++ b/src/intel/compiler/brw_vec4_cse.cpp
@@ -104,6 +104,25 @@ operands_match(const vec4_instruction *a, const vec4_instruction *b)
return xs[0].equals(ys[0]) &&
((xs[1].equals(ys[1]) && xs[2].equals(ys[2])) ||
(xs[2].equals(ys[1]) && xs[1].equals(ys[2])));
+ } else if (a->opcode == BRW_OPCODE_MOV &&
+ xs[0].file == IMM &&
+ xs[0].type == BRW_REGISTER_TYPE_VF) {
+ src_reg tmp_x = xs[0];
+ src_reg tmp_y = ys[0];
+
+ /* Smash out the values that are not part of the writemask. Otherwise
+ * the equals operator will fail due to mismatches in unused components.
+ */
+ const unsigned ab_writemask = a->dst.writemask & b->dst.writemask;
+ const uint32_t mask = ((ab_writemask & WRITEMASK_X) ? 0x000000ff : 0) |
+ ((ab_writemask & WRITEMASK_Y) ? 0x0000ff00 : 0) |
+ ((ab_writemask & WRITEMASK_Z) ? 0x00ff0000 : 0) |
+ ((ab_writemask & WRITEMASK_W) ? 0xff000000 : 0);
+
+ tmp_x.ud &= mask;
+ tmp_y.ud &= mask;
+
+ return tmp_x.equals(tmp_y);
} else if (!a->is_commutative()) {
return xs[0].equals(ys[0]) && xs[1].equals(ys[1]) && xs[2].equals(ys[2]);
} else {