Commit efa37932 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[turbofan] enable constant folding for 64bit comparisons

Change-Id: Id545ca00106fb54ee08078177ad7f24842752afe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2332799Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69196}
parent a731b86e
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment