Commit f2c0264a authored by bmeurer's avatar bmeurer Committed by Commit bot

[x64] Fix invalid REX prefix for pslld, psrld and friends.

R=epertoso@chromium.org

Review-Url: https://codereview.chromium.org/2026633004
Cr-Commit-Position: refs/heads/master@{#36631}
parent a6f6d8ad
......@@ -179,9 +179,8 @@ void Assembler::emit_optional_rex_32(Register rm_reg) {
if (rm_reg.high_bit()) emit(0x41);
}
void Assembler::emit_optional_rex_32(XMMRegister reg) {
byte rex_bits = (reg.code() & 0x8) >> 1;
if (rex_bits != 0) emit(0x40 | rex_bits);
void Assembler::emit_optional_rex_32(XMMRegister rm_reg) {
if (rm_reg.high_bit()) emit(0x41);
}
void Assembler::emit_optional_rex_32(const Operand& op) {
......
......@@ -2296,4 +2296,24 @@ TEST(AssemblerX64JumpTables2) {
}
}
TEST(AssemblerX64PslldWithXmm15) {
CcTest::InitializeVM();
// Allocate an executable page of memory.
size_t actual_size;
byte* buffer = static_cast<byte*>(v8::base::OS::Allocate(
Assembler::kMinimalBufferSize, &actual_size, true));
CHECK(buffer);
Assembler assm(CcTest::i_isolate(), buffer, static_cast<int>(actual_size));
__ movq(xmm15, arg1);
__ pslld(xmm15, 1);
__ movq(rax, xmm15);
__ ret(0);
CodeDesc desc;
assm.GetCode(&desc);
uint64_t result = FUNCTION_CAST<F5>(buffer)(V8_UINT64_C(0x1122334455667788));
CHECK_EQ(V8_UINT64_C(0x22446688aaccef10), result);
}
#undef __
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