Commit 71958d2a authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

Create a macro list for X-ss instructions

These are SSE instructions that deal with scalar single precision
values, and look like the packed single precision variant of the
instructions, but with a prefix.

E.g. sqrtps is NP 0F 51, sqrtss is F3 0F 51.

Bug: v8:9810
Change-Id: I417ea6d4d85d8618ad6602a1b32d4428db0d66d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1874509Reviewed-by: 's avatarDeepti Gandluri <gdeepti@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64658}
parent 18afb44f
...@@ -3117,132 +3117,6 @@ void Assembler::movupd(Operand dst, XMMRegister src) { ...@@ -3117,132 +3117,6 @@ void Assembler::movupd(Operand dst, XMMRegister src) {
emit_sse_operand(src, dst); emit_sse_operand(src, dst);
} }
void Assembler::addss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x58);
emit_sse_operand(dst, src);
}
void Assembler::addss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x58);
emit_sse_operand(dst, src);
}
void Assembler::subss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5C);
emit_sse_operand(dst, src);
}
void Assembler::subss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5C);
emit_sse_operand(dst, src);
}
void Assembler::mulss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x59);
emit_sse_operand(dst, src);
}
void Assembler::mulss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x59);
emit_sse_operand(dst, src);
}
void Assembler::divss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5E);
emit_sse_operand(dst, src);
}
void Assembler::divss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5E);
emit_sse_operand(dst, src);
}
void Assembler::maxss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5F);
emit_sse_operand(dst, src);
}
void Assembler::maxss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5F);
emit_sse_operand(dst, src);
}
void Assembler::minss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5D);
emit_sse_operand(dst, src);
}
void Assembler::minss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x5D);
emit_sse_operand(dst, src);
}
void Assembler::sqrtss(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x51);
emit_sse_operand(dst, src);
}
void Assembler::sqrtss(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
emit(0xF3);
emit_optional_rex_32(dst, src);
emit(0x0F);
emit(0x51);
emit_sse_operand(dst, src);
}
void Assembler::ucomiss(XMMRegister dst, XMMRegister src) { void Assembler::ucomiss(XMMRegister dst, XMMRegister src) {
DCHECK(!IsEnabled(AVX)); DCHECK(!IsEnabled(AVX));
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
......
...@@ -832,24 +832,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -832,24 +832,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void sahf(); void sahf();
// SSE instructions
void addss(XMMRegister dst, XMMRegister src);
void addss(XMMRegister dst, Operand src);
void subss(XMMRegister dst, XMMRegister src);
void subss(XMMRegister dst, Operand src);
void mulss(XMMRegister dst, XMMRegister src);
void mulss(XMMRegister dst, Operand src);
void divss(XMMRegister dst, XMMRegister src);
void divss(XMMRegister dst, Operand src);
void maxss(XMMRegister dst, XMMRegister src);
void maxss(XMMRegister dst, Operand src);
void minss(XMMRegister dst, XMMRegister src);
void minss(XMMRegister dst, Operand src);
void sqrtss(XMMRegister dst, XMMRegister src);
void sqrtss(XMMRegister dst, Operand src);
void ucomiss(XMMRegister dst, XMMRegister src); void ucomiss(XMMRegister dst, XMMRegister src);
void ucomiss(XMMRegister dst, Operand src); void ucomiss(XMMRegister dst, Operand src);
void movaps(XMMRegister dst, XMMRegister src); void movaps(XMMRegister dst, XMMRegister src);
...@@ -890,7 +872,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -890,7 +872,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
SSE_INSTRUCTION_LIST(DECLARE_SSE_INSTRUCTION) SSE_INSTRUCTION_LIST(DECLARE_SSE_INSTRUCTION)
#undef DECLARE_SSE_INSTRUCTION #undef DECLARE_SSE_INSTRUCTION
// SSE2 instructions // SSE instructions with prefix and SSE2 instructions
void sse2_instr(XMMRegister dst, XMMRegister src, byte prefix, byte escape, void sse2_instr(XMMRegister dst, XMMRegister src, byte prefix, byte escape,
byte opcode); byte opcode);
void sse2_instr(XMMRegister dst, Operand src, byte prefix, byte escape, void sse2_instr(XMMRegister dst, Operand src, byte prefix, byte escape,
...@@ -903,6 +885,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { ...@@ -903,6 +885,8 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
sse2_instr(dst, src, 0x##prefix, 0x##escape, 0x##opcode); \ sse2_instr(dst, src, 0x##prefix, 0x##escape, 0x##opcode); \
} }
// These SSE instructions have the same encoding as the SSE2 instructions.
SSE_INSTRUCTION_LIST_SS(DECLARE_SSE2_INSTRUCTION)
SSE2_INSTRUCTION_LIST(DECLARE_SSE2_INSTRUCTION) SSE2_INSTRUCTION_LIST(DECLARE_SSE2_INSTRUCTION)
#undef DECLARE_SSE2_INSTRUCTION #undef DECLARE_SSE2_INSTRUCTION
......
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
V(divps, 0F, 5E) \ V(divps, 0F, 5E) \
V(maxps, 0F, 5F) V(maxps, 0F, 5F)
// Instructions dealing with scalar single-precision values.
#define SSE_INSTRUCTION_LIST_SS(V) \
V(sqrtss, F3, 0F, 51) \
V(addss, F3, 0F, 58) \
V(mulss, F3, 0F, 59) \
V(subss, F3, 0F, 5C) \
V(minss, F3, 0F, 5D) \
V(divss, F3, 0F, 5E) \
V(maxss, F3, 0F, 5F)
#define SSE2_INSTRUCTION_LIST(V) \ #define SSE2_INSTRUCTION_LIST(V) \
V(sqrtpd, 66, 0F, 51) \ V(sqrtpd, 66, 0F, 51) \
V(andnpd, 66, 0F, 55) \ V(andnpd, 66, 0F, 55) \
......
...@@ -393,22 +393,6 @@ TEST(DisasmX64) { ...@@ -393,22 +393,6 @@ TEST(DisasmX64) {
__ movdqu(Operand(rsp, 12), xmm0); __ movdqu(Operand(rsp, 12), xmm0);
__ shufps(xmm0, xmm9, 0x0); __ shufps(xmm0, xmm9, 0x0);
// Arithmetic operation
__ addss(xmm1, xmm0);
__ addss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ mulss(xmm1, xmm0);
__ mulss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ subss(xmm1, xmm0);
__ subss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ divss(xmm1, xmm0);
__ divss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ maxss(xmm1, xmm0);
__ maxss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ minss(xmm1, xmm0);
__ minss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ sqrtss(xmm1, xmm0);
__ sqrtss(xmm1, Operand(rbx, rcx, times_4, 10000));
__ ucomiss(xmm0, xmm1); __ ucomiss(xmm0, xmm1);
__ ucomiss(xmm0, Operand(rbx, rcx, times_4, 10000)); __ ucomiss(xmm0, Operand(rbx, rcx, times_4, 10000));
...@@ -417,6 +401,12 @@ TEST(DisasmX64) { ...@@ -417,6 +401,12 @@ TEST(DisasmX64) {
__ instruction(xmm1, Operand(rbx, rcx, times_4, 10000)); __ instruction(xmm1, Operand(rbx, rcx, times_4, 10000));
SSE_INSTRUCTION_LIST(EMIT_SSE_INSTR) SSE_INSTRUCTION_LIST(EMIT_SSE_INSTR)
#undef EMIT_SSE_INSTR #undef EMIT_SSE_INSTR
#define EMIT_SSE_INSTR(instruction, notUsed1, notUsed2, notUse3) \
__ instruction(xmm1, xmm0); \
__ instruction(xmm1, Operand(rbx, rcx, times_4, 10000));
SSE_INSTRUCTION_LIST_SS(EMIT_SSE_INSTR)
#undef EMIT_SSE_INSTR
} }
// SSE2 instructions // SSE2 instructions
......
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