nir: Add a lower_fdiv option and use it in i965

This commit is contained in:
Jason Ekstrand 2015-09-04 18:47:42 -07:00
parent f32d16a9f0
commit 7174d155e9
3 changed files with 3 additions and 0 deletions

View file

@ -1433,6 +1433,7 @@ typedef struct nir_function {
typedef struct nir_shader_compiler_options {
bool lower_ffma;
bool lower_fdiv;
bool lower_flrp;
bool lower_fpow;
bool lower_fsat;

View file

@ -66,6 +66,7 @@ optimizations = [
(('imul', a, 1), a),
(('fmul', a, -1.0), ('fneg', a)),
(('imul', a, -1), ('ineg', a)),
(('fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),
(('ffma', 0.0, a, b), b),
(('ffma', a, 0.0, b), b),
(('ffma', a, b, 0.0), ('fmul', a, b)),

View file

@ -96,6 +96,7 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo)
*/
nir_options->lower_ffma = true;
nir_options->lower_sub = true;
nir_options->lower_fdiv = true;
/* We want the GLSL compiler to emit code that uses condition codes */
for (int i = 0; i < MESA_SHADER_STAGES; i++) {