Commit 2298b35f authored by Hao Xu's avatar Hao Xu Committed by V8 LUCI CQ

[x64][codegen] Reduce kX64Shr to kX64Shr32

This allows x64 to select shrl instead of shrq instruction for the
below pattern:

  2: ChangeUint32ToUint64(1)
  3: Int64Constant[2]
  4: Word64Shr(2, 3)

Change-Id: I3278b9ab52dd7212d1a616291d114a6bff0d13d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3857740Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Hao A Xu <hao.a.xu@intel.com>
Cr-Commit-Position: refs/heads/main@{#82739}
parent ae44450b
......@@ -997,6 +997,11 @@ void VisitWord64Shift(InstructionSelector* selector, Node* node,
Node* right = m.right().node();
if (g.CanBeImmediate(right)) {
if (opcode == kX64Shr && m.left().IsChangeUint32ToUint64() &&
m.right().HasResolvedValue() && m.right().ResolvedValue() < 32) {
opcode = kX64Shr32;
left = left->InputAt(0);
}
selector->Emit(opcode, g.DefineSameAsFirst(node), g.UseRegister(left),
g.UseImmediate(right));
} else {
......
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