summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2015-02-03 22:48:27 +0200
committerFrancisco Jerez <currojerez@riseup.net>2015-02-19 14:06:42 +0200
commitbda7698fce21daa1b94bc79c0a0ed3da8d385997 (patch)
tree34a02cf0f2f2f5b8e7d37b7e9f77c29f518052a8
parent187ace73a93d87122a977e4afade237be159ab04 (diff)
i965/vec4: Fix constant propagation across different types.
If the source type differs from the original type of the constant we need to bit-cast it before propagating, otherwise the original type information will be lost. If the constant was a vector float there isn't much we can do, because the result of bit-casting the component values of a vector float cannot itself be represented as an immediate. Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
index 674be512f8d..679867c3551 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp
@@ -122,6 +122,16 @@ try_constant_propagate(struct brw_context *brw, vec4_instruction *inst,
if (value.file != IMM)
return false;
+ if (value.type == BRW_REGISTER_TYPE_VF) {
+ /* The result of bit-casting the component values of a vector float
+ * cannot in general be represented as an immediate.
+ */
+ if (inst->src[arg].type != BRW_REGISTER_TYPE_F)
+ return false;
+ } else {
+ value.type = inst->src[arg].type;
+ }
+
if (inst->src[arg].abs) {
if ((brw->gen >= 8 && is_logic_op(inst->opcode)) ||
!brw_abs_immediate(value.type, &value.fixed_hw_reg)) {