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

Unified Diff: src/compiler/x64/code-generator-x64.cc

Issue 938513003: [x64] Recognize zero extension of 8-bit and 16-bit values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x64/code-generator-x64.cc
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
index adf8966906cdba104476f3a29694f85b570661ee..973bbd1ef06bb794d153701c380eeae63b2c4057 100644
--- a/src/compiler/x64/code-generator-x64.cc
+++ b/src/compiler/x64/code-generator-x64.cc
@@ -248,6 +248,18 @@ class OutOfLineTruncateDoubleToI FINAL : public OutOfLineCode {
} while (0)
+#define ASSEMBLE_MOVX(asm_instr) \
+ do { \
+ if (instr->addressing_mode() != kMode_None) { \
+ __ asm_instr(i.OutputRegister(), i.MemoryOperand()); \
+ } else if (instr->InputAt(0)->IsRegister()) { \
+ __ asm_instr(i.OutputRegister(), i.InputRegister(0)); \
+ } else { \
+ __ asm_instr(i.OutputRegister(), i.InputOperand(0)); \
+ } \
+ } while (0)
+
+
#define ASSEMBLE_DOUBLE_BINOP(asm_instr) \
do { \
if (instr->InputAt(1)->IsDoubleRegister()) { \
@@ -801,17 +813,12 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
ASSEMBLE_AVX_DOUBLE_BINOP(vdivsd);
break;
case kX64Movsxbl:
- if (instr->addressing_mode() != kMode_None) {
- __ movsxbl(i.OutputRegister(), i.MemoryOperand());
- } else if (instr->InputAt(0)->IsRegister()) {
- __ movsxbl(i.OutputRegister(), i.InputRegister(0));
- } else {
- __ movsxbl(i.OutputRegister(), i.InputOperand(0));
- }
+ ASSEMBLE_MOVX(movsxbl);
__ AssertZeroExtended(i.OutputRegister());
break;
case kX64Movzxbl:
- __ movzxbl(i.OutputRegister(), i.MemoryOperand());
+ ASSEMBLE_MOVX(movzxbl);
+ __ AssertZeroExtended(i.OutputRegister());
break;
case kX64Movb: {
int index = 0;
@@ -824,17 +831,11 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break;
}
case kX64Movsxwl:
- if (instr->addressing_mode() != kMode_None) {
- __ movsxwl(i.OutputRegister(), i.MemoryOperand());
- } else if (instr->InputAt(0)->IsRegister()) {
- __ movsxwl(i.OutputRegister(), i.InputRegister(0));
- } else {
- __ movsxwl(i.OutputRegister(), i.InputOperand(0));
- }
+ ASSEMBLE_MOVX(movsxwl);
__ AssertZeroExtended(i.OutputRegister());
break;
case kX64Movzxwl:
- __ movzxwl(i.OutputRegister(), i.MemoryOperand());
+ ASSEMBLE_MOVX(movzxwl);
__ AssertZeroExtended(i.OutputRegister());
break;
case kX64Movw: {
@@ -869,14 +870,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
}
}
break;
- case kX64Movsxlq: {
- if (instr->InputAt(0)->IsRegister()) {
- __ movsxlq(i.OutputRegister(), i.InputRegister(0));
- } else {
- __ movsxlq(i.OutputRegister(), i.InputOperand(0));
- }
+ case kX64Movsxlq:
+ ASSEMBLE_MOVX(movsxlq);
break;
- }
case kX64Movq:
if (instr->HasOutput()) {
__ movq(i.OutputRegister(), i.MemoryOperand());
« no previous file with comments | « no previous file | src/compiler/x64/instruction-selector-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698