On Thu, Jan 7, 2016 at 10:21 AM, Iago Toral <ito...@igalia.com> wrote: > On Wed, 2016-01-06 at 15:30 -0800, Jason Ekstrand wrote: >> This commit adds lowering options for the following opcodes: >> >> - nir_op_fmod >> - nir_op_bitfield_insert >> - nir_op_uadd_carry >> - nir_op_usub_borrow >> --- >> src/glsl/nir/nir.h | 4 ++++ >> src/glsl/nir/nir_opt_algebraic.py | 6 ++++++ >> 2 files changed, 10 insertions(+) >> >> diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h >> index 59f6f68..61e51da 100644 >> --- a/src/glsl/nir/nir.h >> +++ b/src/glsl/nir/nir.h >> @@ -1509,6 +1509,10 @@ typedef struct nir_shader_compiler_options { >> bool lower_fpow; >> bool lower_fsat; >> bool lower_fsqrt; >> + bool lower_fmod; >> + bool lower_bitfield_insert; >> + bool lower_uadd_carry; >> + bool lower_usub_borrow; >> /** lowers fneg and ineg to fsub and isub. */ >> bool lower_negate; >> /** lowers fsub and isub to fadd+fneg and iadd+ineg. */ >> diff --git a/src/glsl/nir/nir_opt_algebraic.py >> b/src/glsl/nir/nir_opt_algebraic.py >> index a5a4841..f4a8632 100644 >> --- a/src/glsl/nir/nir_opt_algebraic.py >> +++ b/src/glsl/nir/nir_opt_algebraic.py >> @@ -222,6 +222,12 @@ optimizations = [ >> (('iadd', a, ('isub', 0, b)), ('isub', a, b)), >> (('fabs', ('fsub', 0.0, a)), ('fabs', a)), >> (('iabs', ('isub', 0, a)), ('iabs', a)), >> + >> + # Misc. lowering >> + (('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), >> 'options->lower_fmod'), >> + (('bitfield_insert', a, b, c, d), ('bfi', ('bfm', d, c), b, a), >> 'options->lower_bitfield_insert'), >> + (('uadd_carry', a, b), ('ult', ('iadd', a, b), a), >> 'options->lower_uadd_carry'), >> + (('usub_borrow', a, b), ('ult', a, b), 'options->lower_usub_borrow'), > > Don't we need to use b2i with uadd_carry and usub_borrow? ult seems to > return NIR_TRUE (~0u) instead of 1.
I believe you're right. ARB_gpu_shader5 says those out parameters are of type genUType. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev