summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-02-27 19:19:21 +1100
committerTimothy Arceri <[email protected]>2018-02-28 09:23:49 +1100
commita050ea60eef9c457a3d5185aa551631df0c35bec (patch)
treed9be44885ef144928971cb52e7643d5987777e62
parent08fa84bb9adf81aa13422501fef8f077b51ef682 (diff)
nir: add lower_ldexp to nir compiler options
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/broadcom/compiler/nir_to_vir.c1
-rw-r--r--src/compiler/nir/nir.h2
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py4
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir.c1
-rw-r--r--src/gallium/drivers/vc4/vc4_program.c1
-rw-r--r--src/intel/compiler/brw_compiler.c1
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 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