cranelift: simplify fneg(fneg(x)) to x (#6034)

This commit is contained in:
Karl Meakin
2023-03-16 22:14:12 +00:00
committed by GitHub
parent dccc2d6269
commit d479951469
2 changed files with 12 additions and 0 deletions

View File

@@ -527,6 +527,9 @@
;; with the `bitselect` instruction, but the pattern is a bit more complicated
;; due to most bitselects-over-floats having bitcasts.
;; fneg(fneg(x)) == x.
(rule (simplify (fneg ty (fneg ty x))) (subsume x))
;; If both of the multiplied arguments to an `fma` are negated then remove
;; both of them since they cancel out.
(rule (simplify (fma ty (fneg ty x) (fneg ty y) z))