Mesa (main): nir: Use nir_test_mask instead of i2b(iand)
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 30 18:29:38 UTC 2022
Module: Mesa
Branch: main
Commit: 4676b3d3dd913ec48e7eb7d2dbe91774f6de55fb
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4676b3d3dd913ec48e7eb7d2dbe91774f6de55fb
Author: Konstantin Seurer <konstantin.seurer at gmail.com>
Date: Fri Jun 24 21:31:51 2022 +0200
nir: Use nir_test_mask instead of i2b(iand)
Signed-off-by: Konstantin Seurer <konstantin.seurer at gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17242>
---
src/compiler/nir/nir_lower_subgroups.c | 2 +-
src/compiler/nir/nir_lower_texcoord_replace.c | 3 +--
src/compiler/nir/nir_lower_ubo_vec4.c | 7 +++----
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/compiler/nir/nir_lower_subgroups.c b/src/compiler/nir/nir_lower_subgroups.c
index a83a1710704..f29545ae4d8 100644
--- a/src/compiler/nir/nir_lower_subgroups.c
+++ b/src/compiler/nir/nir_lower_subgroups.c
@@ -742,7 +742,7 @@ lower_subgroups_instr(nir_builder *b, nir_instr *instr, void *_options)
nir_udiv_imm(b, idx, int_val->bit_size));
}
- return nir_i2b(b, nir_iand_imm(b, nir_ushr(b, int_val, idx), 1));
+ return nir_test_mask(b, nir_ushr(b, int_val, idx), 1);
}
case nir_intrinsic_ballot_bit_count_reduce:
return vec_bit_count(b, int_val);
diff --git a/src/compiler/nir/nir_lower_texcoord_replace.c b/src/compiler/nir/nir_lower_texcoord_replace.c
index fd3a0859a46..f9de2c890a3 100644
--- a/src/compiler/nir/nir_lower_texcoord_replace.c
+++ b/src/compiler/nir/nir_lower_texcoord_replace.c
@@ -123,8 +123,7 @@ nir_lower_texcoord_replace_impl(nir_function_impl *impl,
nir_ishl(&b, nir_imm_int(&b, 1),
nir_iadd_imm(&b, index, base));
- nir_ssa_def *cond =
- nir_i2b(&b, nir_iand_imm(&b, mask, coord_replace));
+ nir_ssa_def *cond = nir_test_mask(&b, mask, coord_replace);
nir_ssa_def *result = nir_bcsel(&b, cond, new_coord,
&intrin->dest.ssa);
diff --git a/src/compiler/nir/nir_lower_ubo_vec4.c b/src/compiler/nir/nir_lower_ubo_vec4.c
index 90885b133b4..17937ace895 100644
--- a/src/compiler/nir/nir_lower_ubo_vec4.c
+++ b/src/compiler/nir/nir_lower_ubo_vec4.c
@@ -142,10 +142,9 @@ nir_lower_ubo_vec4_lower(nir_builder *b, nir_instr *instr, void *data)
BITSET_MASK(intr->num_components) << (align_chan_offset);
nir_component_mask_t high_channels =
low_channels << (8 / chan_size_bytes);
- result = nir_bcsel(b,
- nir_i2b(b, nir_iand_imm(b, byte_offset, 8)),
- nir_channels(b, result, high_channels),
- nir_channels(b, result, low_channels));
+ result = nir_bcsel(b, nir_test_mask(b, byte_offset, 8),
+ nir_channels(b, result, high_channels),
+ nir_channels(b, result, low_channels));
} else {
/* General fallback case: Per-result-channel bcsel-based extraction
* from two separate vec4 loads.
More information about the mesa-commit
mailing list