aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-04 13:20:52 -0700
committerEmil Velikov <[email protected]>2017-10-17 16:59:02 +0100
commitf9c4f22f5a3290a62314f82feddf62026655db29 (patch)
tree969fe3e21a79611bee9384160469947045c8d11d
parent4ae1a62b26d4a615391fcef25f3e434822523e38 (diff)
intel/compiler: Don't propagate cmod into integer multiplies
No shader-db change on Sky Lake. Reviewed-by: Matt Turner <[email protected]> Cc: [email protected] (cherry picked from commit 7463d5058009d1e9d9d01292f894271a26a062b8)
-rw-r--r--src/intel/compiler/brw_fs_cmod_propagation.cpp17
-rw-r--r--src/intel/compiler/brw_vec4_cmod_propagation.cpp17
2 files changed, 34 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_fs_cmod_propagation.cpp b/src/intel/compiler/brw_fs_cmod_propagation.cpp
index db63e942b75..4625d69f89e 100644
--- a/src/intel/compiler/brw_fs_cmod_propagation.cpp
+++ b/src/intel/compiler/brw_fs_cmod_propagation.cpp
@@ -150,6 +150,23 @@ opt_cmod_propagation_local(const gen_device_info *devinfo, bblock_t *block)
if (scan_inst->saturate)
break;
+ /* From the Sky Lake PRM, Vol 2a, "Multiply":
+ *
+ * "When multiplying integer data types, if one of the sources
+ * is a DW, the resulting full precision data is stored in
+ * the accumulator. However, if the destination data type is
+ * either W or DW, the low bits of the result are written to
+ * the destination register and the remaining high bits are
+ * discarded. This results in undefined Overflow and Sign
+ * flags. Therefore, conditional modifiers and saturation
+ * (.sat) cannot be used in this case."
+ *
+ * We just disallow cmod propagation on all integer multiplies.
+ */
+ if (!brw_reg_type_is_floating_point(scan_inst->dst.type) &&
+ scan_inst->opcode == BRW_OPCODE_MUL)
+ break;
+
/* Otherwise, try propagating the conditional. */
enum brw_conditional_mod cond =
inst->src[0].negate ? brw_swap_cmod(inst->conditional_mod)
diff --git a/src/intel/compiler/brw_vec4_cmod_propagation.cpp b/src/intel/compiler/brw_vec4_cmod_propagation.cpp
index 05e65168193..0d72d82a578 100644
--- a/src/intel/compiler/brw_vec4_cmod_propagation.cpp
+++ b/src/intel/compiler/brw_vec4_cmod_propagation.cpp
@@ -137,6 +137,23 @@ opt_cmod_propagation_local(bblock_t *block)
if (scan_inst->saturate)
break;
+ /* From the Sky Lake PRM, Vol 2a, "Multiply":
+ *
+ * "When multiplying integer data types, if one of the sources
+ * is a DW, the resulting full precision data is stored in
+ * the accumulator. However, if the destination data type is
+ * either W or DW, the low bits of the result are written to
+ * the destination register and the remaining high bits are
+ * discarded. This results in undefined Overflow and Sign
+ * flags. Therefore, conditional modifiers and saturation
+ * (.sat) cannot be used in this case.
+ *
+ * We just disallow cmod propagation on all integer multiplies.
+ */
+ if (!brw_reg_type_is_floating_point(scan_inst->dst.type) &&
+ scan_inst->opcode == BRW_OPCODE_MUL)
+ break;
+
/* Otherwise, try propagating the conditional. */
enum brw_conditional_mod cond =
inst->src[0].negate ? brw_swap_cmod(inst->conditional_mod)