nir/lower_int64: add bitfield_reverse lowering
now that we can represent 64-bit bitfield_reverse in NIR, we need a lowering for it as well. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35198>
This commit is contained in:
committed by
Marge Bot
parent
c3fb0645d8
commit
d696b19dd0
@@ -866,6 +866,16 @@ lower_bit_count64(nir_builder *b, nir_def *x)
|
||||
return nir_iadd(b, lo_count, hi_count);
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
lower_bitfield_reverse64(nir_builder *b, nir_def *x)
|
||||
{
|
||||
nir_def *x_lo = nir_unpack_64_2x32_split_x(b, x);
|
||||
nir_def *x_hi = nir_unpack_64_2x32_split_y(b, x);
|
||||
nir_def *lo_rev = nir_bitfield_reverse(b, x_lo);
|
||||
nir_def *hi_rev = nir_bitfield_reverse(b, x_hi);
|
||||
return nir_pack_64_2x32_split(b, hi_rev, lo_rev);
|
||||
}
|
||||
|
||||
nir_lower_int64_options
|
||||
nir_lower_int64_op_to_options_mask(nir_op opcode)
|
||||
{
|
||||
@@ -946,6 +956,8 @@ nir_lower_int64_op_to_options_mask(nir_op opcode)
|
||||
return nir_lower_find_lsb64;
|
||||
case nir_op_bit_count:
|
||||
return nir_lower_bit_count64;
|
||||
case nir_op_bitfield_reverse:
|
||||
return nir_lower_bitfield_reverse64;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -1050,6 +1062,8 @@ lower_int64_alu_instr(nir_builder *b, nir_alu_instr *alu)
|
||||
return lower_find_lsb64(b, src[0]);
|
||||
case nir_op_bit_count:
|
||||
return lower_bit_count64(b, src[0]);
|
||||
case nir_op_bitfield_reverse:
|
||||
return lower_bitfield_reverse64(b, src[0]);
|
||||
case nir_op_i2f64:
|
||||
case nir_op_i2f32:
|
||||
case nir_op_i2f16:
|
||||
|
||||
@@ -44,6 +44,7 @@ typedef enum {
|
||||
nir_lower_conv64 = (1 << 23),
|
||||
nir_lower_uadd_sat64 = (1 << 24),
|
||||
nir_lower_iadd3_64 = (1 << 25),
|
||||
nir_lower_bitfield_reverse64 = (1 << 26),
|
||||
} nir_lower_int64_options;
|
||||
|
||||
typedef enum {
|
||||
|
||||
Reference in New Issue
Block a user