From: Timothy Arceri Date: Tue, 27 Feb 2018 08:19:21 +0000 (+1100) Subject: nir: add lower_ldexp to nir compiler options X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a050ea60eef9c457a3d5185aa551631df0c35bec;p=mesa.git nir: add lower_ldexp to nir compiler options Reviewed-by: Marek Olšák --- diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 6bb27741437..595689d2441 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -1893,6 +1893,7 @@ const nir_shader_compiler_options v3d_nir_options = { .lower_fpow = true, .lower_fsat = true, .lower_fsqrt = true, + .lower_ldexp = true, .native_integers = true, }; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 2acd9511f57..c676331000f 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1859,6 +1859,8 @@ typedef struct nir_shader_compiler_options { /** lowers ffract to fsub+ffloor: */ bool lower_ffract; + bool lower_ldexp; + bool lower_pack_half_2x16; bool lower_pack_unorm_2x16; bool lower_pack_snorm_2x16; diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index d40d59b5cdb..296f0671386 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -560,8 +560,8 @@ def ldexp(f, exp, bits): return ('fmul', ('fmul', f, pow2_1), pow2_2) optimizations += [ - (('ldexp@32', 'x', 'exp'), ldexp('x', 'exp', 32)), - (('ldexp@64', 'x', 'exp'), ldexp('x', 'exp', 64)), + (('ldexp@32', 'x', 'exp'), ldexp('x', 'exp', 32), 'options->lower_ldexp'), + (('ldexp@64', 'x', 'exp'), ldexp('x', 'exp', 64), 'options->lower_ldexp'), ] # Unreal Engine 4 demo applications open-codes bitfieldReverse() diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_nir.c index 6edb0e45749..0b637bb99bd 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c @@ -44,6 +44,7 @@ static const nir_shader_compiler_options options = { .lower_fmod32 = true, .lower_fmod64 = true, .lower_fdiv = true, + .lower_ldexp = true, .fuse_ffma = true, .native_integers = true, .vertex_id_zero_based = true, diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 706982c4a1c..be80a851d2a 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -2188,6 +2188,7 @@ static const nir_shader_compiler_options nir_options = { .lower_fpow = true, .lower_fsat = true, .lower_fsqrt = true, + .lower_ldexp = true, .lower_negate = true, .native_integers = true, .max_unroll_iterations = 32, diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index e515559acb6..bb9df5e7013 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -41,6 +41,7 @@ .lower_usub_borrow = true, \ .lower_fdiv = true, \ .lower_flrp64 = true, \ + .lower_ldexp = true, \ .native_integers = true, \ .use_interpolated_input_intrinsics = true, \ .vertex_id_zero_based = true