From 2ab2d2e5881d289a8239467a97516e4e410cebfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Samuel=20Iglesias=20Gons=C3=A1lvez?= Date: Thu, 28 Apr 2016 12:19:13 +0200 Subject: [PATCH] nir: Separate 32 and 64-bit fmod lowering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Split 32-bit and 64-bit fmod lowering as the drivers might need to lower them separately inside NIR depending on the HW support. Signed-off-by: Samuel Iglesias Gonsálvez Reviewed-by: Jordan Justen --- src/compiler/nir/nir.h | 3 ++- src/compiler/nir/nir_opt_algebraic.py | 5 +++-- src/mesa/drivers/dri/i965/brw_compiler.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index de573b45c08..98451c6dbb9 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1630,7 +1630,8 @@ typedef struct nir_shader_compiler_options { bool lower_fpow; bool lower_fsat; bool lower_fsqrt; - bool lower_fmod; + bool lower_fmod32; + bool lower_fmod64; bool lower_bitfield_extract; bool lower_bitfield_insert; bool lower_uadd_carry; diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index f181044faf2..0a95725f962 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -296,8 +296,9 @@ optimizations = [ (('iadd', '#a', ('iadd', b, '#c')), ('iadd', ('iadd', a, c), b)), # Misc. lowering - (('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod'), - (('frem', a, b), ('fsub', a, ('fmul', b, ('ftrunc', ('fdiv', a, b)))), 'options->lower_fmod'), + (('fmod@32', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod32'), + (('fmod@64', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod64'), + (('frem', a, b), ('fsub', a, ('fmul', b, ('ftrunc', ('fdiv', a, b)))), 'options->lower_fmod32'), (('uadd_carry@32', a, b), ('b2i', ('ult', ('iadd', a, b), a)), 'options->lower_uadd_carry'), (('usub_borrow@32', a, b), ('b2i', ('ult', a, b)), 'options->lower_usub_borrow'), diff --git a/src/mesa/drivers/dri/i965/brw_compiler.c b/src/mesa/drivers/dri/i965/brw_compiler.c index 61bb5ade282..9977d792679 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.c +++ b/src/mesa/drivers/dri/i965/brw_compiler.c @@ -76,7 +76,7 @@ shader_perf_log_mesa(void *data, const char *fmt, ...) .lower_sub = true, \ .lower_fdiv = true, \ .lower_scmp = true, \ - .lower_fmod = true, \ + .lower_fmod32 = true, \ .lower_bitfield_extract = true, \ .lower_bitfield_insert = true, \ .lower_uadd_carry = true, \ -- 2.30.2