[Mesa-dev] [PATCH v2 16/29] nir: fix denorm flush-to-zero in sqrt's lowering at nir_lower_double_ops
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Tue Dec 18 10:34:11 UTC 2018
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
---
src/compiler/nir/nir_lower_double_ops.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_lower_double_ops.c b/src/compiler/nir/nir_lower_double_ops.c
index b3543bc6963..c27e2d384a5 100644
--- a/src/compiler/nir/nir_lower_double_ops.c
+++ b/src/compiler/nir/nir_lower_double_ops.c
@@ -289,9 +289,14 @@ lower_sqrt_rsq(nir_builder *b, nir_ssa_def *src, bool sqrt)
* 0 -> 0 and
* +inf -> +inf
*/
- res = nir_bcsel(b, nir_ior(b, nir_feq(b, src, nir_imm_double(b, 0.0)),
+ nir_ssa_def *src_flushed = nir_bcsel(b,
+ nir_flt(b, nir_fabs(b, src),
+ nir_imm_double(b, 2.22507385850720138309023271733e-308)),
+ nir_imm_double(b, 0.0),
+ src);
+ res = nir_bcsel(b, nir_ior(b, nir_feq(b, src_flushed, nir_imm_double(b, 0.0)),
nir_feq(b, src, nir_imm_double(b, INFINITY))),
- src, res);
+ src_flushed, res);
} else {
res = fix_inv_result(b, res, src, new_exp);
}
--
2.19.1
More information about the mesa-dev
mailing list