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

Side by Side Diff: src/compiler/arm64/instruction-selector-arm64.cc

Issue 2687373002: Revert of [arm64] A shift of 0 is not allowed in ubfx. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/instruction-selector-impl.h" 5 #include "src/compiler/instruction-selector-impl.h"
6 #include "src/compiler/node-matchers.h" 6 #include "src/compiler/node-matchers.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 // The mask must be contiguous, and occupy the least-significant bits. 950 // The mask must be contiguous, and occupy the least-significant bits.
951 DCHECK_EQ(0u, base::bits::CountTrailingZeros64(mask)); 951 DCHECK_EQ(0u, base::bits::CountTrailingZeros64(mask));
952 952
953 // Select Ubfx for And(Shr(x, imm), mask) where the mask is in the least 953 // Select Ubfx for And(Shr(x, imm), mask) where the mask is in the least
954 // significant bits. 954 // significant bits.
955 Int64BinopMatcher mleft(m.left().node()); 955 Int64BinopMatcher mleft(m.left().node());
956 if (mleft.right().HasValue()) { 956 if (mleft.right().HasValue()) {
957 // Any shift value can match; int64 shifts use `value % 64`. 957 // Any shift value can match; int64 shifts use `value % 64`.
958 uint32_t lsb = static_cast<uint32_t>(mleft.right().Value() & 0x3f); 958 uint32_t lsb = static_cast<uint32_t>(mleft.right().Value() & 0x3f);
959 959
960 if (lsb != 0) { 960 // Ubfx cannot extract bits past the register size, however since
961 // Ubfx cannot extract bits past the register size, however since 961 // shifting the original value would have introduced some zeros we can
962 // shifting the original value would have introduced some zeros we can 962 // still use ubfx with a smaller mask and the remaining bits will be
963 // still use ubfx with a smaller mask and the remaining bits will be 963 // zeros.
964 // zeros. 964 if (lsb + mask_width > 64) mask_width = 64 - lsb;
965 if (lsb + mask_width > 64) mask_width = 64 - lsb;
966 965
967 Emit(kArm64Ubfx, g.DefineAsRegister(node), 966 Emit(kArm64Ubfx, g.DefineAsRegister(node),
968 g.UseRegister(mleft.left().node()), 967 g.UseRegister(mleft.left().node()),
969 g.UseImmediateOrTemp(mleft.right().node(), lsb), 968 g.UseImmediateOrTemp(mleft.right().node(), lsb),
970 g.TempImmediate(static_cast<int32_t>(mask_width))); 969 g.TempImmediate(static_cast<int32_t>(mask_width)));
971 return; 970 return;
972 }
973 } 971 }
974 // Other cases fall through to the normal And operation. 972 // Other cases fall through to the normal And operation.
975 } 973 }
976 } 974 }
977 VisitLogical<Int64BinopMatcher>( 975 VisitLogical<Int64BinopMatcher>(
978 this, node, &m, kArm64And, CanCover(node, m.left().node()), 976 this, node, &m, kArm64And, CanCover(node, m.left().node()),
979 CanCover(node, m.right().node()), kLogical64Imm); 977 CanCover(node, m.right().node()), kLogical64Imm);
980 } 978 }
981 979
982 980
(...skipping 1729 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 // static 2710 // static
2713 MachineOperatorBuilder::AlignmentRequirements 2711 MachineOperatorBuilder::AlignmentRequirements
2714 InstructionSelector::AlignmentRequirements() { 2712 InstructionSelector::AlignmentRequirements() {
2715 return MachineOperatorBuilder::AlignmentRequirements:: 2713 return MachineOperatorBuilder::AlignmentRequirements::
2716 FullUnalignedAccessSupport(); 2714 FullUnalignedAccessSupport();
2717 } 2715 }
2718 2716
2719 } // namespace compiler 2717 } // namespace compiler
2720 } // namespace internal 2718 } // namespace internal
2721 } // namespace v8 2719 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698