summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-11-06 11:59:16 -0600
committerMarge Bot <eric+marge@anholt.net>2020-11-09 18:58:51 +0000
commit15c6e05a7257a85c4763d28743414011ad59bac4 (patch)
treeff338a131d1d02759de18c702e5daf3cced5e7a6
parent86ef139bf46aa9d3a2e8bec927cdca126bd0fcfd (diff)
nir/lower_bit_size: Don't cast comparison results
Some ALU ops (comparisons being the primary example) have a fixed bit-size destination and, in that case, we don't want to insert a conversion on the destination. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7482>
-rw-r--r--src/compiler/nir/nir_lower_bit_size.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_lower_bit_size.c b/src/compiler/nir/nir_lower_bit_size.c
index 34bfa3a1d8f..0508bdd3d87 100644
--- a/src/compiler/nir/nir_lower_bit_size.c
+++ b/src/compiler/nir/nir_lower_bit_size.c
@@ -85,7 +85,8 @@ lower_instr(nir_builder *bld, nir_alu_instr *alu, unsigned bit_size)
/* Convert result back to the original bit-size */
- if (dst_bit_size != bit_size) {
+ if (nir_alu_type_get_type_size(nir_op_infos[op].output_type) == 0 &&
+ dst_bit_size != bit_size) {
nir_alu_type type = nir_op_infos[op].output_type;
nir_ssa_def *dst = nir_convert_to_bit_size(bld, lowered_dst, type, dst_bit_size);
nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa, nir_src_for_ssa(dst));