[x64] Recognize MOVSXBL.

TEST=mjsunit/asm
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/728103007

Cr-Commit-Position: refs/heads/master@{#25386}
This commit is contained in:
Benedikt Meurer 2014-11-18 10:11:29 +01:00
parent 3c79e2e920
commit 72a2ec9eb4
4 changed files with 25 additions and 1 deletions

View File

@ -483,7 +483,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
__ cvtqsi2sd(i.OutputDoubleRegister(), kScratchRegister);
break;
case kX64Movsxbl:
__ movsxbl(i.OutputRegister(), i.MemoryOperand());
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));
}
__ AssertZeroExtended(i.OutputRegister());
break;
case kX64Movzxbl:

View File

@ -353,6 +353,9 @@ void InstructionSelector::VisitWord32Sar(Node* node) {
if (mleft.right().Is(16) && m.right().Is(16)) {
Emit(kX64Movsxwl, g.DefineAsRegister(node), g.Use(mleft.left().node()));
return;
} else if (mleft.right().Is(24) && m.right().Is(24)) {
Emit(kX64Movsxbl, g.DefineAsRegister(node), g.Use(mleft.left().node()));
return;
}
}
VisitWord32Shift(this, node, kX64Sar32);

View File

@ -1383,6 +1383,20 @@ void Assembler::movl(const Operand& dst, Label* src) {
}
void Assembler::movsxbl(Register dst, Register src) {
EnsureSpace ensure_space(this);
if (!src.is_byte_register()) {
// Register is not one of al, bl, cl, dl. Its encoding needs REX.
emit_rex_32(dst, src);
} else {
emit_optional_rex_32(dst, src);
}
emit(0x0F);
emit(0xBE);
emit_modrm(dst, src);
}
void Assembler::movsxbl(Register dst, const Operand& src) {
EnsureSpace ensure_space(this);
emit_optional_rex_32(dst, src);

View File

@ -731,6 +731,7 @@ class Assembler : public AssemblerBase {
void movq(Register dst, int64_t value);
void movq(Register dst, uint64_t value);
void movsxbl(Register dst, Register src);
void movsxbl(Register dst, const Operand& src);
void movsxbq(Register dst, const Operand& src);
void movsxwl(Register dst, Register src);