mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 15:20:17 +01:00
brw/copy: Refactor source modifier type checking
This simplifies the next commit. Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33931>
This commit is contained in:
parent
dee49f4206
commit
e82464e6e0
1 changed files with 36 additions and 24 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue