[turbofan] enable constant folding for 64bit comparisons
Change-Id: Id545ca00106fb54ee08078177ad7f24842752afe Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2332799 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#69196}
This commit is contained in:
parent
a731b86ec9
commit
efa3793290
@ -847,11 +847,34 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
|
||||
case IrOpcode::kTrapIf:
|
||||
case IrOpcode::kTrapUnless:
|
||||
return ReduceConditional(node);
|
||||
case IrOpcode::kInt64LessThan:
|
||||
case IrOpcode::kInt64LessThanOrEqual:
|
||||
case IrOpcode::kUint64LessThan:
|
||||
case IrOpcode::kUint64LessThanOrEqual:
|
||||
case IrOpcode::kInt64LessThan: {
|
||||
Int64BinopMatcher m(node);
|
||||
if (m.IsFoldable()) { // K < K => K
|
||||
return ReplaceBool(m.left().Value() < m.right().Value());
|
||||
}
|
||||
return ReduceWord64Comparisons(node);
|
||||
}
|
||||
case IrOpcode::kInt64LessThanOrEqual: {
|
||||
Int64BinopMatcher m(node);
|
||||
if (m.IsFoldable()) { // K <= K => K
|
||||
return ReplaceBool(m.left().Value() <= m.right().Value());
|
||||
}
|
||||
return ReduceWord64Comparisons(node);
|
||||
}
|
||||
case IrOpcode::kUint64LessThan: {
|
||||
Uint64BinopMatcher m(node);
|
||||
if (m.IsFoldable()) { // K < K => K
|
||||
return ReplaceBool(m.left().Value() < m.right().Value());
|
||||
}
|
||||
return ReduceWord64Comparisons(node);
|
||||
}
|
||||
case IrOpcode::kUint64LessThanOrEqual: {
|
||||
Uint64BinopMatcher m(node);
|
||||
if (m.IsFoldable()) { // K <= K => K
|
||||
return ReplaceBool(m.left().Value() <= m.right().Value());
|
||||
}
|
||||
return ReduceWord64Comparisons(node);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -909,6 +909,20 @@ macro TestSliceEnumeration(implicit context: Context)(): Undefined {
|
||||
@export
|
||||
macro TestStaticAssert() {
|
||||
static_assert(1 + 2 == 3);
|
||||
|
||||
static_assert(Convert<uintptr>(5) < Convert<uintptr>(6));
|
||||
static_assert(!(Convert<uintptr>(5) < Convert<uintptr>(5)));
|
||||
static_assert(!(Convert<uintptr>(6) < Convert<uintptr>(5)));
|
||||
static_assert(Convert<uintptr>(5) <= Convert<uintptr>(5));
|
||||
static_assert(Convert<uintptr>(5) <= Convert<uintptr>(6));
|
||||
static_assert(!(Convert<uintptr>(6) <= Convert<uintptr>(5)));
|
||||
|
||||
static_assert(Convert<intptr>(-6) < Convert<intptr>(-5));
|
||||
static_assert(!(Convert<intptr>(-5) < Convert<intptr>(-5)));
|
||||
static_assert(!(Convert<intptr>(-5) < Convert<intptr>(-6)));
|
||||
static_assert(Convert<intptr>(-5) <= Convert<intptr>(-5));
|
||||
static_assert(Convert<intptr>(-6) <= Convert<intptr>(-5));
|
||||
static_assert(!(Convert<intptr>(-5) <= Convert<intptr>(-6)));
|
||||
}
|
||||
|
||||
class SmiBox extends HeapObject {
|
||||
|
Loading…
Reference in New Issue
Block a user