Reviewers: Benedikt Meurer,
Message:
PTAL
Description:
[turbofan] Avoid useless zero-extension on arm64.
[email protected]
Please review this at https://codereview.chromium.org/737733002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+10, -4 lines):
M src/compiler/arm64/instruction-selector-arm64.cc
M test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
Index: src/compiler/arm64/instruction-selector-arm64.cc
diff --git a/src/compiler/arm64/instruction-selector-arm64.cc
b/src/compiler/arm64/instruction-selector-arm64.cc
index
aba7eb0189e1bb960624f8f7a4e2ba47a505b222..298e49ed0f6c069a963dc0c37965628049cd1d96
100644
--- a/src/compiler/arm64/instruction-selector-arm64.cc
+++ b/src/compiler/arm64/instruction-selector-arm64.cc
@@ -882,7 +882,16 @@ void
InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
void InstructionSelector::VisitChangeUint32ToUint64(Node* node) {
Arm64OperandGenerator g(this);
- Emit(kArm64Mov32, g.DefineAsRegister(node),
g.UseRegister(node->InputAt(0)));
+ Node* value = node->InputAt(0);
+ MachineType type = GetMachineType(value);
+ if ((type == kMachInt32) || (type == kMachUint32)) {
+ // 32-bit operations will write their result in a W register
(implicitly
+ // clearing the top 32-bit of the corresponding X register) so the
+ // zero-extension is a no-op.
+ Emit(kArchNop, g.DefineSameAsFirst(node), g.Use(value));
+ } else {
+ Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(value));
+ }
}
Index: test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
diff --git
a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
index
2d127c448fbf223ce6eca98f3ee8be25e31d2438..79daa34457c64b0add2b11f34225bd4e8bc559bb
100644
--- a/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
+++ b/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
@@ -264,9 +264,6 @@ static const Conversion kConversionInstructions[] = {
{{&RawMachineAssembler::ChangeInt32ToInt64, "ChangeInt32ToInt64",
kArm64Sxtw, kMachInt64},
kMachInt32},
- {{&RawMachineAssembler::ChangeUint32ToUint64, "ChangeUint32ToUint64",
- kArm64Mov32, kMachUint64},
- kMachUint32},
{{&RawMachineAssembler::TruncateInt64ToInt32, "TruncateInt64ToInt32",
kArm64Mov32, kMachInt32},
kMachInt64},
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.