#
# All expression types can have a bit-size specified. For opcodes, this
# looks like "op@32", for variables it is "a@32" or "a@uint32" to specify a
-# type and size, and for literals, you can write "2.0@32".
+# type and size, and for literals, you can write "2.0@32". In the search half
+# of the expression this indicates that it should only match that particular
+# bit-size. In the replace half of the expression this indicates that the
+# constructed value should have that bit-size.
optimizations = [
(('fneg', ('fneg', a)), a),
for (unsigned i = 0; i < num_components; ++i)
new_swizzle[i] = instr->src[src].swizzle[swizzle[i]];
+ /* If the value has a specific bit size and it doesn't match, bail */
+ if (value->bit_size &&
+ nir_src_bit_size(instr->src[src].src) != value->bit_size)
+ return false;
+
switch (value->type) {
case nir_search_value_expression:
if (!instr->src[src].src.is_ssa)
assert(instr->dest.dest.is_ssa);
+ if (expr->value.bit_size &&
+ instr->dest.dest.ssa.bit_size != expr->value.bit_size)
+ return false;
+
state->inexact_match = expr->inexact || state->inexact_match;
state->has_exact_alu = instr->exact || state->has_exact_alu;
if (state->inexact_match && state->has_exact_alu)
}
}
+ if (value->bit_size) {
+ assert(!tree->is_dest_sized || tree->dest_size == value->bit_size);
+ tree->common_size = value->bit_size;
+ }
+
return tree;
}