ntt: Evaluate write_mask check
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 2 Aug 2023 14:24:59 +0000 (10:24 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Aug 2023 22:40:30 +0000 (22:40 +0000)
In light of the input necessarily being SSA.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>

src/gallium/auxiliary/nir/nir_to_tgsi.c

index 00d7191..b2a9303 100644 (file)
@@ -1269,16 +1269,13 @@ ntt_get_alu_src(struct ntt_compile *c, nir_alu_instr *instr, int i)
     */
    if (nir_src_bit_size(instr->src[i].src) == 64 &&
       !(src.src.is_ssa && src.src.ssa->parent_instr->type == nir_instr_type_ssa_undef)) {
-      int chan0 = 0, chan1 = 1;
+      int chan1 = 1;
       if (nir_op_infos[instr->op].input_sizes[i] == 0) {
-         chan0 = ffs(instr->dest.write_mask) - 1;
-         chan1 = ffs(instr->dest.write_mask & ~(1 << chan0)) - 1;
-         if (chan1 == -1)
-            chan1 = chan0;
+         chan1 = nir_dest_num_components(instr->dest.dest) > 1 ? 1 : 0;
       }
       usrc = ureg_swizzle(usrc,
-                          src.swizzle[chan0] * 2,
-                          src.swizzle[chan0] * 2 + 1,
+                          src.swizzle[0] * 2,
+                          src.swizzle[0] * 2 + 1,
                           src.swizzle[chan1] * 2,
                           src.swizzle[chan1] * 2 + 1);
    } else {