Browse Source

nir: Add a flag for lowering fsqrt(x) to frcp(frsqrt(x)).

vc4 cse/algebraic-disabled stats:
total uniforms in shared programs: 13972 -> 13966 (-0.04%)
uniforms in affected programs:     408 -> 402 (-1.47%)
total instructions in shared programs: 44973 -> 44911 (-0.14%)
instructions in affected programs:     1551 -> 1489 (-4.00%)

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
tags/10.6-branchpoint
Eric Anholt 10 years ago
parent
commit
cb95a228e8
2 changed files with 3 additions and 1 deletions
  1. 1
    0
      src/glsl/nir/nir.h
  2. 2
    1
      src/glsl/nir/nir_opt_algebraic.py

+ 1
- 0
src/glsl/nir/nir.h View File

@@ -1328,6 +1328,7 @@ typedef struct nir_function {

typedef struct nir_shader_compiler_options {
bool lower_fpow;
bool lower_fsqrt;
} nir_shader_compiler_options;

typedef struct nir_shader {

+ 2
- 1
src/glsl/nir/nir_opt_algebraic.py View File

@@ -128,7 +128,8 @@ optimizations = [
(('fdiv', 1.0, a), ('frcp', a)),
(('frcp', ('frcp', a)), a),
(('frcp', ('fsqrt', a)), ('frsq', a)),
(('frcp', ('frsq', a)), ('fsqrt', a)),
(('fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'),
(('frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),
# Boolean simplifications
(('ine', 'a@bool', 0), 'a'),
(('ieq', 'a@bool', 0), ('inot', 'a')),

Loading…
Cancel
Save