diff options
author | Gert Wollny <[email protected]> | 2019-02-02 18:38:17 +0100 |
---|---|---|
committer | Gert Wollny <[email protected]> | 2019-02-27 11:04:06 +0000 |
commit | b7201a468d0c1d25161f48986e26930e8909bfa8 (patch) | |
tree | a08547f52a816aa4cd2d7ac74176773ac82f2db9 /src | |
parent | ce112fcc873ca4d787b81fd1891597c242692632 (diff) |
nir: Add posibility to not lower to source mod 'abs' for ops with three sources
This is useful for r600 since there the abs source modifier is not supported
for ops with three sources
v2: Use correct logic to enable lowering to abs source mod (Eric Anhold)
Signed-off-by: Gert Wollny <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/nir/nir.h | 3 | ||||
-rw-r--r-- | src/compiler/nir/nir_lower_to_source_mods.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 3403f841939..ac574f903f0 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3205,7 +3205,8 @@ bool nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset); typedef enum { nir_lower_int_source_mods = 1 << 0, nir_lower_float_source_mods = 1 << 1, - nir_lower_all_source_mods = (1 << 2) - 1 + nir_lower_triop_abs = 1 << 2, + nir_lower_all_source_mods = (1 << 3) - 1 } nir_lower_to_source_mods_flags; diff --git a/src/compiler/nir/nir_lower_to_source_mods.c b/src/compiler/nir/nir_lower_to_source_mods.c index 657bf8a3d71..3ca53c34afc 100644 --- a/src/compiler/nir/nir_lower_to_source_mods.c +++ b/src/compiler/nir/nir_lower_to_source_mods.c @@ -45,6 +45,9 @@ nir_lower_to_source_mods_block(nir_block *block, nir_alu_instr *alu = nir_instr_as_alu(instr); + bool lower_abs = (nir_op_infos[alu->op].num_inputs < 3) || + (options & nir_lower_triop_abs); + for (unsigned i = 0; i < nir_op_infos[alu->op].num_inputs; i++) { if (!alu->src[i].src.is_ssa) continue; @@ -81,6 +84,9 @@ nir_lower_to_source_mods_block(nir_block *block, if (!parent->src[0].src.is_ssa) continue; + if (!lower_abs && parent->src[0].abs) + continue; + nir_instr_rewrite_src(instr, &alu->src[i].src, parent->src[0].src); if (alu->src[i].abs) { /* abs trumps both neg and abs, do nothing */ |