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

Unified Diff: src/mips/constants-mips.h

Issue 1317253004: MIPS32: Simplify set of condition codes. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/constants-mips.h
diff --git a/src/mips/constants-mips.h b/src/mips/constants-mips.h
index 37ac2336bfd184542e5ad5712bdaa5541878921e..5c006f5093afbf781e19e8231d061a374df1c03b 100644
--- a/src/mips/constants-mips.h
+++ b/src/mips/constants-mips.h
@@ -608,61 +608,79 @@ enum SecondaryField {
// ----- Emulated conditions.
// On MIPS we use this enum to abstract from conditional branch instructions.
-// The 'U' prefix is used to specify unsigned comparisons.
// Opposite conditions must be paired as odd/even numbers
// because 'NegateCondition' function flips LSB to negate condition.
+// CC values for any comparison involving equality has LS bit set.
+// TODO(plind): remove unused conditions, and renumber.
enum Condition {
// Any value < 0 is considered no_condition.
kNoCondition = -1,
- overflow = 0,
- no_overflow = 1,
- Uless = 2,
- Ugreater_equal = 3,
- Uless_equal = 4,
- Ugreater = 5,
- equal = 6,
- not_equal = 7, // Unordered or Not Equal.
- negative = 8,
- positive = 9,
- parity_even = 10,
- parity_odd = 11,
- less = 12,
- greater_equal = 13,
- less_equal = 14,
- greater = 15,
+ // overflow = 0,
+ // no_overflow = 1,
+
+ lo = 2, // Unsigned less than (lower)
+ hs = 3, // Unsigned greater than or equal (higher or same).
+ hi = 4, // Unsigned greater than (higher).
+ ls = 5, // Unsigned less than or equal (lower or same).
+ ne = 6, // Unordered or Not Equal.
+ eq = 7, // Equal.
+ // mi = 8,
+ // pl = 9,
+ // parity_even = 10,
+ // parity_odd = 11,
+ lt = 12, // Less than.
+ ge = 13, // Great than or equal.
+ gt = 14, // Greater than.
+ le = 15, // Less than or equal.
ueq = 16, // Unordered or Equal.
ogl = 17, // Ordered and Not Equal.
cc_always = 18,
// Aliases.
- carry = Uless,
- not_carry = Ugreater_equal,
- zero = equal,
- eq = equal,
- not_zero = not_equal,
- ne = not_equal,
- nz = not_equal,
- sign = negative,
- not_sign = positive,
- mi = negative,
- pl = positive,
- hi = Ugreater,
- ls = Uless_equal,
- ge = greater_equal,
- lt = less,
- gt = greater,
- le = less_equal,
- hs = Ugreater_equal,
- lo = Uless,
al = cc_always,
- ult = Uless,
- uge = Ugreater_equal,
- ule = Uless_equal,
- ugt = Ugreater,
+ nz = ne, // TODO(plind): consider deleting nz
+
+ // // TODO(plind): Currently unused aliases - delete.
+ // carry = Uless,
+ // not_carry = Ugreater_equal,
+ // equal = eq,
+ // zero = equal,
+ // not_equal = ne,
+ // not_zero = not_equal,
+
+ // negative = mi,
+ // positive = pl,
+ // sign = negative,
+ // not_sign = positive,
+
+ // // TODO(plind): These aliases ARE used, and should likey be factored out.
+ Ugreater = hi,
+ Uless_equal = ls,
+ greater_equal = ge,
+ less = lt,
+ greater = gt,
+ less_equal = le,
+ Ugreater_equal = hs,
+ Uless = lo,
+
+ // TODO(plind): understand these aliases for FP, do we need them?
+ ult = lo,
+ uge = hs,
+ ule = ls,
+ ugt = hi,
+
cc_default = kNoCondition
};
+// Conditions are assigned so LSB is set for condition including equality.
+inline bool ConditionIncludesEquality(Condition cc) {
+ DCHECK(cc != cc_always);
+ // TODO(plind): consider DCHECK to validate LSB set properly.
+ return (cc & 1);
+}
+
paul.l... 2015/09/04 03:45:24 This function is no longer needed. I had thought t
balazs.kilvady 2015/09/04 09:27:45 I think the unsused function should be removed but
+
// Returns the equivalent of !cc.
// Negation of the default kNoCondition (-1) results in a non-default
// no_condition value (-2). As long as tests for no_condition check
@@ -709,22 +727,22 @@ inline Condition NegateFpuCondition(Condition cc) {
// Commute a condition such that {a cond b == b cond' a}.
inline Condition CommuteCondition(Condition cc) {
switch (cc) {
- case Uless:
- return Ugreater;
- case Ugreater:
- return Uless;
- case Ugreater_equal:
- return Uless_equal;
- case Uless_equal:
- return Ugreater_equal;
- case less:
- return greater;
- case greater:
- return less;
- case greater_equal:
- return less_equal;
- case less_equal:
- return greater_equal;
+ case lo:
+ return hi;
+ case hi:
+ return lo;
+ case hs:
+ return ls;
+ case ls:
+ return hs;
+ case lt:
+ return gt;
+ case gt:
+ return lt;
+ case ge:
+ return le;
+ case le:
+ return ge;
default:
return cc;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698