nir: add lower_ldexp to nir compiler options
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 27 Feb 2018 08:19:21 +0000 (19:19 +1100)
committerTimothy Arceri <tarceri@itsqueeze.com>
Tue, 27 Feb 2018 22:23:49 +0000 (09:23 +1100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/broadcom/compiler/nir_to_vir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_opt_algebraic.py
src/gallium/drivers/freedreno/ir3/ir3_nir.c
src/gallium/drivers/vc4/vc4_program.c
src/intel/compiler/brw_compiler.c

index 6bb277414379eff12620cb48d010a90b3ce1cb9f..595689d24416a45455fb1ef7d175bf8666732a1e 100644 (file)
@@ -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,
 };
 
index 2acd9511f57db9b69d2ba0651fd877b82bf13c3e..c676331000fc59df953ab2ab323eee41c427bd8a 100644 (file)
@@ -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;
index d40d59b5cdbf82876f52c1f6e04f2a5486aa8129..296f06713862796a9a15101bba121b5c16fed81e 100644 (file)
@@ -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()
index 6edb0e457497b38fa7a6cfabf6a0201923104be6..0b637bb99bd2e01b85bb7e8661461566bb8b7462 100644 (file)
@@ -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,
index 706982c4a1cc08a8f905bac86d7ffcb63e02acfe..be80a851d2a88ba9a40f234d622fa82af54166db 100644 (file)
@@ -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,
index e515559acb6a7b4e613604840be4be73da290610..bb9df5e70136ea5a200f948fed9e20d3fd51c673 100644 (file)
@@ -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