For known positive non-zero value X:
fcmp uge X, -C => true fcmp ugt X, -C => true fcmp une X, -C => true fcmp oeq X, -C => false fcmp ole X, -C => false fcmp olt X, -C => false
Patch by Paul Walker.
Differential D40012
[InstSimplify] More fcmp cases when comparing against negative constants. paulwalker-arm on Nov 14 2017, 2:55 AM. Authored by
Details For known positive non-zero value X: fcmp uge X, -C => true fcmp ugt X, -C => true fcmp une X, -C => true fcmp oeq X, -C => false fcmp ole X, -C => false fcmp olt X, -C => false Patch by Paul Walker.
Diff Detail Event TimelineComment Actions Looks like a straight-forward simplification to me, but it would be good if someone else could have a look too. Comment Actions The tests should go under tests/Transforms/InstSimplify since this is handled outside of InstCombine.
Comment Actions Broke out the isNegative case into its own block so that more conditions can be handled when it's known the constant is non-zero. Removed my original tests and updated the existing ones to reflect the optimised output. Comment Actions LGTM. Please add a 'TODO' comment in the new block of code about extending this. We should have cases for 'UNE' and 'OEQ' predicates too? Comment Actions Extended to cover une and oeq conditions. Added an assert to protect against unintentional refactoring and a TODO for future improvements.
Comment Actions Removed three instcombine tests that are either covered by existing instsimplify tests of have equivalent instsimplify tests provided by this patch. |
We've already handled isNaN above here? Could assert instead of re-checking that condition or just remove it.