Mesa (master): nir/lower_bit_size: Don't cast comparison results

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 9 19:13:34 UTC 2020


Module: Mesa
Branch: master
Commit: 15c6e05a7257a85c4763d28743414011ad59bac4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=15c6e05a7257a85c4763d28743414011ad59bac4

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Fri Nov  6 11:59:16 2020 -0600

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 at whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7482>

---

 src/compiler/nir/nir_lower_bit_size.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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));



More information about the mesa-commit mailing list