diff options
author | Jason Ekstrand <[email protected]> | 2016-01-06 15:30:38 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-01-07 16:14:38 -0800 |
commit | d00abcc28376116554799d403211367470dff200 (patch) | |
tree | a52ab151bcb382ec46e81f9639bfba9e75a50289 /src | |
parent | b0d4ee520e20444172d088d11260e656fc1cf12d (diff) |
nir/algebraic: Add more lowering
This commit adds lowering options for the following opcodes:
- nir_op_fmod
- nir_op_bitfield_insert
- nir_op_uadd_carry
- nir_op_usub_borrow
Reviewed-by: Iago Toral Quiroga <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/nir.h | 4 | ||||
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/glsl/nir/nir.h b/src/glsl/nir/nir.h index fed8a973416..23aec694d95 100644 --- a/src/glsl/nir/nir.h +++ b/src/glsl/nir/nir.h @@ -1446,6 +1446,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 c553de577ee..1eb044a5a20 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), ('b2i', ('ult', ('iadd', a, b), a)), 'options->lower_uadd_carry'), + (('usub_borrow', a, b), ('b2i', ('ult', a, b)), 'options->lower_usub_borrow'), ] # Add optimizations to handle the case where the result of a ternary is |