nir: Fix wrong sign in lower_rcp
authorRuslan Kabatsayev <b7.10110111@gmail.com>
Sat, 11 May 2019 11:04:36 +0000 (14:04 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 11 May 2019 16:25:22 +0000 (09:25 -0700)
commit974c4d679c23373dbed386c696e3e3bc1bfa23ae
tree68800ef78808565fb78106e8ffbe21a5e663e1a5
parent7b2468bf6e58b0b178f8f498fca92c9cc0a71edb
nir: Fix wrong sign in lower_rcp

The nested fma calls were supposed to implement

x_new = x + x * (1 - x*src),

but instead current code is equivalent to

x_new = x - x * (1 - x*src).

The result is that Newton-Raphson steps don't improve precision at all.
This patch fixes this problem.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110435
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/nir/nir_lower_double_ops.c