From: Jonathan Marek Date: Sun, 15 Dec 2019 18:43:07 +0000 (-0500) Subject: nir: add option to lower half packing opcodes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=004797002fb87db0c2323955eed2f8f6871c3bfb;p=mesa.git nir: add option to lower half packing opcodes Signed-off-by: Jonathan Marek Reviewed-by: Alyssa Rosenzweig Reviewed-by: Eric Anholt Part-of: --- diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index fc46a3e6604..fbef503f0fa 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -2761,11 +2761,13 @@ typedef struct nir_shader_compiler_options { bool lower_ldexp; bool lower_pack_half_2x16; + bool lower_pack_half_2x16_split; bool lower_pack_unorm_2x16; bool lower_pack_snorm_2x16; bool lower_pack_unorm_4x8; bool lower_pack_snorm_4x8; bool lower_unpack_half_2x16; + bool lower_unpack_half_2x16_split; bool lower_unpack_unorm_2x16; bool lower_unpack_snorm_2x16; bool lower_unpack_unorm_4x8; diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index f101ad04567..633ee8792d9 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -1117,6 +1117,18 @@ optimizations.extend([ 127.0))), 'options->lower_unpack_snorm_4x8'), + (('pack_half_2x16_split', 'a@32', 'b@32'), + ('ior', ('ishl', ('u2u32', ('f2f16', b)), 16), ('u2u32', ('f2f16', a))), + 'options->lower_pack_half_2x16_split'), + + (('unpack_half_2x16_split_x', 'a@32'), + ('f2f32', ('u2u16', a)), + 'options->lower_unpack_half_2x16_split'), + + (('unpack_half_2x16_split_y', 'a@32'), + ('f2f32', ('u2u16', ('ushr', a, 16))), + 'options->lower_unpack_half_2x16_split'), + (('isign', a), ('imin', ('imax', a, -1), 1), 'options->lower_isign'), (('fsign', a), ('fsub', ('b2f', ('flt', 0.0, a)), ('b2f', ('flt', a, 0.0))), 'options->lower_fsign'),