Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: src/compiler/arm64/instruction-selector-arm64.cc

Issue 2318043002: [arm64] Use CMN for cmp(a,sub(0,b)) only when checking equality/inequality. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-compare-negate.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/arm64/instruction-selector-arm64.cc
diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc
index 4d48cb93c5f165f8b4ef4a8f5d2f86fac1de3b34..8af97b598ee4e079a1dfd045000b80379d563e1d 100644
--- a/src/compiler/arm64/instruction-selector-arm64.cc
+++ b/src/compiler/arm64/instruction-selector-arm64.cc
@@ -2138,8 +2138,11 @@ void VisitWord32Compare(InstructionSelector* selector, Node* node,
MaybeReplaceCmpZeroWithFlagSettingBinop(selector, &node, binop, &opcode,
cond, cont, &immediate_mode);
}
- } else if (m.right().IsInt32Sub()) {
+ } else if (m.right().IsInt32Sub() && (cond == kEqual || cond == kNotEqual)) {
// Select negated compare for comparisons with negated right input.
+ // Only do this for kEqual and kNotEqual, which do not depend on the
+ // C and V flags, as those flags will be different with CMN when the
+ // right-hand side of the original subtraction is INT_MIN.
Node* sub = m.right().node();
Int32BinopMatcher msub(sub);
if (msub.left().Is(0)) {
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-compare-negate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698