[Mesa-dev] [PATCH 2/2] nir: add lower_ldexp to nir compiler options

Marek Olšák maraeo at gmail.com
Tue Feb 27 19:26:35 UTC 2018


For the series:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Tue, Feb 27, 2018 at 9:40 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
> ---
>  src/broadcom/compiler/nir_to_vir.c          | 1 +
>  src/compiler/nir/nir.h                      | 2 ++
>  src/compiler/nir/nir_opt_algebraic.py       | 4 ++--
>  src/gallium/drivers/freedreno/ir3/ir3_nir.c | 1 +
>  src/gallium/drivers/vc4/vc4_program.c       | 1 +
>  src/intel/compiler/brw_compiler.c           | 1 +
>  6 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
> index 6bb2774143..595689d244 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 c6541f0a6f..239c0bd34f 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1865,6 +1865,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 d40d59b5cd..296f067138 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 at 32', 'x', 'exp'), ldexp('x', 'exp', 32)),
> -   (('ldexp at 64', 'x', 'exp'), ldexp('x', 'exp', 64)),
> +   (('ldexp at 32', 'x', 'exp'), ldexp('x', 'exp', 32), 'options->lower_ldexp'),
> +   (('ldexp at 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 6edb0e4574..0b637bb99b 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 706982c4a1..be80a851d2 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 e515559acb..bb9df5e701 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
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list