nir: Simplify feq(fneg(a), a)) -> feq(a, 0.0)
The positive and negative value of a float can only be equal to each other if it is -0.0f and 0.0f. This is safe for Nan and Inf, as -Nan != Nan, and -Inf != Inf This gives no changes in my shader-db Signed-off-by: Thomas Helland <thomashelland90@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
a39167d594
commit
49d0a36bd6
|
@ -114,6 +114,7 @@ optimizations = [
|
||||||
(('seq', a, b), ('b2f', ('feq', a, b)), 'options->lower_scmp'),
|
(('seq', a, b), ('b2f', ('feq', a, b)), 'options->lower_scmp'),
|
||||||
(('sne', a, b), ('b2f', ('fne', a, b)), 'options->lower_scmp'),
|
(('sne', a, b), ('b2f', ('fne', a, b)), 'options->lower_scmp'),
|
||||||
(('fne', ('fneg', a), a), ('fne', a, 0.0)),
|
(('fne', ('fneg', a), a), ('fne', a, 0.0)),
|
||||||
|
(('feq', ('fneg', a), a), ('feq', a, 0.0)),
|
||||||
# Emulating booleans
|
# Emulating booleans
|
||||||
(('imul', ('b2i', a), ('b2i', b)), ('b2i', ('iand', a, b))),
|
(('imul', ('b2i', a), ('b2i', b)), ('b2i', ('iand', a, b))),
|
||||||
(('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),
|
(('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),
|
||||||
|
|
Loading…
Reference in New Issue