diff --git a/src/intel/compiler/brw_opt_copy_propagation.cpp b/src/intel/compiler/brw_opt_copy_propagation.cpp index f0165e6fc12..8871dc61d1d 100644 --- a/src/intel/compiler/brw_opt_copy_propagation.cpp +++ b/src/intel/compiler/brw_opt_copy_propagation.cpp @@ -852,21 +852,25 @@ try_copy_propagate(brw_shader &s, brw_inst *inst, brw_type_size_bytes(inst->src[arg].type)) % brw_type_size_bytes(entry->src.type) != 0) return false; - /* Since semantics of source modifiers are type-dependent we need to - * ensure that the meaning of the instruction remains the same if we - * change the type. If the sizes of the types are different the new - * instruction will read a different amount of data than the original - * and the semantics will always be different. - */ - if (has_source_modifiers && - entry->dst.type != inst->src[arg].type && - (!inst->can_change_types() || - brw_type_size_bits(entry->dst.type) != brw_type_size_bits(inst->src[arg].type))) - return false; + if (has_source_modifiers) { + /* If the sizes of the types are different the new instruction will read + * a different amount of data than the original and the semantics will + * always be different. + */ + if (brw_type_size_bits(entry->dst.type) != + brw_type_size_bits(inst->src[arg].type)) + return false; - if ((entry->src.negate || entry->src.abs) && - is_logic_op(inst->opcode)) { - return false; + if (is_logic_op(inst->opcode)) { + return false; + } else if (entry->dst.type != inst->src[arg].type && + !inst->can_change_types()) { + /* Since semantics of source modifiers are type-dependent we need to + * ensure that the meaning of the instruction remains the same if we + * change the type. + */ + return false; + } } /* Save the offset of inst->src[arg] relative to entry->dst for it to be @@ -1582,20 +1586,28 @@ try_copy_propagate_def(brw_shader &s, const bool has_source_modifiers = val.abs || val.negate; if (has_source_modifiers) { - if (is_logic_op(inst->opcode) || !inst->can_do_source_mods(devinfo)) + if (!inst->can_do_source_mods(devinfo)) return false; - /* Since semantics of source modifiers are type-dependent we need to - * ensure that the meaning of the instruction remains the same if we - * change the type. If the sizes of the types are different the new - * instruction will read a different amount of data than the original - * and the semantics will always be different. + /* If the sizes of the types are different the new instruction will read + * a different amount of data than the original and the semantics will + * always be different. */ - if (def->dst.type != inst->src[arg].type && - (!inst->can_change_types() || - brw_type_size_bits(def->dst.type) != - brw_type_size_bits(inst->src[arg].type))) + if (brw_type_size_bits(def->dst.type) != + brw_type_size_bits(inst->src[arg].type)) { return false; + } + + if (is_logic_op(inst->opcode)) { + return false; + } else if (def->dst.type != inst->src[arg].type && + !inst->can_change_types()) { + /* Since semantics of source modifiers are type-dependent we need to + * ensure that the meaning of the instruction remains the same if we + * change the type. + */ + return false; + } } /* Send messages with EOT set are restricted to use g112-g127 (and we