Commit 040fa762 authored by ahaas's avatar ahaas Committed by Commit bot

[arm64][turbofan] Do not use ubfx for shr+and combination for mask=0.

R=titzer@chromium.org, v8-arm-ports@googlegroups.com
BUG=v8:6046

Review-Url: https://codereview.chromium.org/2737493002
Cr-Commit-Position: refs/heads/master@{#43643}
parent f0e7a317
......@@ -1111,7 +1111,7 @@ void InstructionSelector::VisitWord32Shr(Node* node) {
if (m.left().IsWord32And() && m.right().HasValue()) {
uint32_t lsb = m.right().Value() & 0x1f;
Int32BinopMatcher mleft(m.left().node());
if (mleft.right().HasValue()) {
if (mleft.right().HasValue() && mleft.right().Value() != 0) {
// Select Ubfx for Shr(And(x, mask), imm) where the result of the mask is
// shifted into the least-significant bits.
uint32_t mask = (mleft.right().Value() >> lsb) << lsb;
......@@ -1155,7 +1155,7 @@ void InstructionSelector::VisitWord64Shr(Node* node) {
if (m.left().IsWord64And() && m.right().HasValue()) {
uint32_t lsb = m.right().Value() & 0x3f;
Int64BinopMatcher mleft(m.left().node());
if (mleft.right().HasValue()) {
if (mleft.right().HasValue() && mleft.right().Value() != 0) {
// Select Ubfx for Shr(And(x, mask), imm) where the result of the mask is
// shifted into the least-significant bits.
uint64_t mask = (mleft.right().Value() >> lsb) << lsb;
......
......@@ -6739,6 +6739,20 @@ TEST(Regression5951) {
CHECK_EQ(input, m.Call(input));
}
TEST(Regression6046a) {
BufferedRawMachineAssemblerTester<int64_t> m;
m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(0), m.Int64Constant(0)),
m.Int64Constant(64)));
CHECK_EQ(0, m.Call());
}
TEST(Regression6046b) {
BufferedRawMachineAssemblerTester<int32_t> m;
m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(0), m.Int32Constant(0)),
m.Int32Constant(32)));
CHECK_EQ(0, m.Call());
}
#endif // V8_TARGET_ARCH_64_BIT
TEST(Regression6028) {
......
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