Commit 9c120b75 authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][x64] Fix encoding of vcvtdq2pd

vcvtdq2pd was incorrectly declared to take 3 operands, the use of the
macro Cvtdq2pd meant that the call was vcvtdq2pd(dst, dst, src). This
is an incorrect encoding. Our tests happen to pass because dst was xmm0,
which made it accidentally correct.

This fixes it by moving cvtdq2pd out of the macro list.

Bug: v8:11265
Change-Id: I8b1baf4dd2c670021eafa76dc1a10b442f812805
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2654003Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72382}
parent 5b17a28f
......@@ -3107,6 +3107,10 @@ void Assembler::cmppd(XMMRegister dst, Operand src, int8_t cmp) {
emit(cmp);
}
void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
sse2_instr(dst, src, 0xF3, 0x0F, 0xE6);
}
void Assembler::cvttss2si(Register dst, Operand src) {
DCHECK(!IsEnabled(AVX));
EnsureSpace ensure_space(this);
......
......@@ -1207,6 +1207,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void movupd(XMMRegister dst, Operand src);
void movupd(Operand dst, XMMRegister src);
void cvtdq2pd(XMMRegister dst, XMMRegister src);
void cvttsd2si(Register dst, Operand src);
void cvttsd2si(Register dst, XMMRegister src);
void cvttss2siq(Register dst, XMMRegister src);
......@@ -1402,6 +1404,9 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void vmovhlps(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
vinstr(0x12, dst, src1, src2, kNone, k0F, kWIG);
}
void vcvtdq2pd(XMMRegister dst, XMMRegister src) {
vinstr(0xe6, dst, xmm0, src, kF3, k0F, kWIG);
}
void vcvtss2sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
vinstr(0x5a, dst, src1, src2, kF3, k0F, kWIG);
}
......
......@@ -135,8 +135,7 @@
V(subsd, F2, 0F, 5C) \
V(minsd, F2, 0F, 5D) \
V(divsd, F2, 0F, 5E) \
V(maxsd, F2, 0F, 5F) \
V(cvtdq2pd, F3, 0F, E6)
V(maxsd, F2, 0F, 5F)
#define SSSE3_INSTRUCTION_LIST(V) \
V(pshufb, 66, 0F, 38, 00) \
......
......@@ -431,6 +431,7 @@ TEST(DisasmX64) {
// SSE2 instructions
{
__ cvtdq2pd(xmm3, xmm4);
__ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000));
__ cvttsd2si(rdx, xmm1);
__ cvttsd2siq(rdx, xmm1);
......@@ -681,6 +682,7 @@ TEST(DisasmX64) {
__ vucomisd(xmm9, xmm1);
__ vucomisd(xmm8, Operand(rbx, rdx, times_2, 10981));
__ vcvtdq2pd(xmm9, xmm11);
__ vcvtss2sd(xmm4, xmm9, xmm11);
__ vcvtss2sd(xmm4, xmm9, Operand(rbx, rcx, times_1, 10000));
__ vcvttps2dq(xmm4, xmm11);
......
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