[ia32] Move SSE unops into macro list

This is similar to x64, these SSE operations take 2 operands, and their
AVX version also takes 2 operands.

Bug: v8:11879
Change-Id: I98885a7b69f3b61ee89e713b5d7cf2f4fd2406db
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3169315
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: Deepti Gandluri <gdeepti@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76943}
This commit is contained in:
Ng Zhi An 2021-09-20 10:16:41 -07:00 committed by V8 LUCI CQ
parent de1de7c3b8
commit 32253e897c
3 changed files with 34 additions and 69 deletions

View File

@ -2188,13 +2188,6 @@ void Assembler::cvtss2sd(XMMRegister dst, Operand src) {
emit_sse_operand(dst, src);
}
void Assembler::cvtdq2ps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x5B);
emit_sse_operand(dst, src);
}
void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0xF3);
@ -2203,13 +2196,6 @@ void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
emit_sse_operand(dst, src);
}
void Assembler::cvtps2pd(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x5A);
emit_sse_operand(dst, src);
}
void Assembler::cvtpd2ps(XMMRegister dst, XMMRegister src) {
EnsureSpace ensure_space(this);
EMIT(0x66);
@ -2234,27 +2220,6 @@ void Assembler::cvttpd2dq(XMMRegister dst, XMMRegister src) {
emit_sse_operand(dst, src);
}
void Assembler::rcpps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x53);
emit_sse_operand(dst, src);
}
void Assembler::sqrtps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x51);
emit_sse_operand(dst, src);
}
void Assembler::rsqrtps(XMMRegister dst, Operand src) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
EMIT(0x52);
emit_sse_operand(dst, src);
}
void Assembler::cmpps(XMMRegister dst, Operand src, uint8_t cmp) {
EnsureSpace ensure_space(this);
EMIT(0x0F);
@ -3206,6 +3171,14 @@ void Assembler::rorx(Register dst, Operand src, byte imm8) {
EMIT(imm8);
}
void Assembler::sse_instr(XMMRegister dst, Operand src, byte escape,
byte opcode) {
EnsureSpace ensure_space(this);
EMIT(escape);
EMIT(opcode);
emit_sse_operand(dst, src);
}
void Assembler::sse2_instr(XMMRegister dst, Operand src, byte prefix,
byte escape, byte opcode) {
EnsureSpace ensure_space(this);

View File

@ -899,12 +899,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void minss(XMMRegister dst, XMMRegister src) { minss(dst, Operand(src)); }
void minss(XMMRegister dst, Operand src);
void rcpps(XMMRegister dst, Operand src);
void rcpps(XMMRegister dst, XMMRegister src) { rcpps(dst, Operand(src)); }
void sqrtps(XMMRegister dst, Operand src);
void sqrtps(XMMRegister dst, XMMRegister src) { sqrtps(dst, Operand(src)); }
void rsqrtps(XMMRegister dst, Operand src);
void rsqrtps(XMMRegister dst, XMMRegister src) { rsqrtps(dst, Operand(src)); }
void haddps(XMMRegister dst, Operand src);
void haddps(XMMRegister dst, XMMRegister src) { haddps(dst, Operand(src)); }
void sqrtpd(XMMRegister dst, Operand src) {
@ -961,12 +955,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void cvtss2sd(XMMRegister dst, XMMRegister src) {
cvtss2sd(dst, Operand(src));
}
void cvtdq2ps(XMMRegister dst, XMMRegister src) {
cvtdq2ps(dst, Operand(src));
}
void cvtdq2ps(XMMRegister dst, Operand src);
void cvtdq2pd(XMMRegister dst, XMMRegister src);
void cvtps2pd(XMMRegister dst, XMMRegister src);
void cvtpd2ps(XMMRegister dst, XMMRegister src);
void cvttps2dq(XMMRegister dst, XMMRegister src) {
cvttps2dq(dst, Operand(src));
@ -1290,20 +1279,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
}
void vss(byte op, XMMRegister dst, XMMRegister src1, Operand src2);
void vrcpps(XMMRegister dst, XMMRegister src) { vrcpps(dst, Operand(src)); }
void vrcpps(XMMRegister dst, Operand src) {
vinstr(0x53, dst, xmm0, src, kNone, k0F, kWIG);
}
void vsqrtps(XMMRegister dst, XMMRegister src) { vsqrtps(dst, Operand(src)); }
void vsqrtps(XMMRegister dst, Operand src) {
vinstr(0x51, dst, xmm0, src, kNone, k0F, kWIG);
}
void vrsqrtps(XMMRegister dst, XMMRegister src) {
vrsqrtps(dst, Operand(src));
}
void vrsqrtps(XMMRegister dst, Operand src) {
vinstr(0x52, dst, xmm0, src, kNone, k0F, kWIG);
}
void vhaddps(XMMRegister dst, XMMRegister src1, XMMRegister src2) {
vhaddps(dst, src1, Operand(src2));
}
@ -1444,18 +1419,9 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void vroundps(XMMRegister dst, XMMRegister src, RoundingMode mode);
void vroundpd(XMMRegister dst, XMMRegister src, RoundingMode mode);
void vcvtdq2ps(XMMRegister dst, XMMRegister src) {
vcvtdq2ps(dst, Operand(src));
}
void vcvtdq2ps(XMMRegister dst, Operand src) {
vinstr(0x5B, dst, xmm0, src, kNone, k0F, kWIG);
}
void vcvtdq2pd(XMMRegister dst, XMMRegister src) {
vinstr(0xE6, dst, xmm0, src, kF3, k0F, kWIG);
}
void vcvtps2pd(XMMRegister dst, XMMRegister src) {
vinstr(0x5A, dst, xmm0, src, kNone, k0F, kWIG);
}
void vcvtpd2ps(XMMRegister dst, XMMRegister src) {
vinstr(0x5A, dst, xmm0, src, k66, k0F, kWIG);
}
@ -1696,6 +1662,23 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
#undef PACKED_CMP_LIST
// Other SSE and AVX instructions
#define DECLARE_SSE_UNOP_AND_AVX(instruction, escape, opcode) \
void instruction(XMMRegister dst, XMMRegister src) { \
instruction(dst, Operand(src)); \
} \
void instruction(XMMRegister dst, Operand src) { \
sse_instr(dst, src, 0x##escape, 0x##opcode); \
} \
void v##instruction(XMMRegister dst, XMMRegister src) { \
v##instruction(dst, Operand(src)); \
} \
void v##instruction(XMMRegister dst, Operand src) { \
vinstr(0x##opcode, dst, xmm0, src, kNone, k##escape, kWIG); \
}
SSE_UNOP_INSTRUCTION_LIST(DECLARE_SSE_UNOP_AND_AVX)
#undef DECLARE_SSE_UNOP_AND_AVX
#define DECLARE_SSE2_INSTRUCTION(instruction, prefix, escape, opcode) \
void instruction(XMMRegister dst, XMMRegister src) { \
instruction(dst, Operand(src)); \
@ -1905,6 +1888,7 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
inline void emit_disp(Label* L, Displacement::Type type);
inline void emit_near_disp(Label* L);
void sse_instr(XMMRegister dst, Operand src, byte prefix, byte opcode);
void sse2_instr(XMMRegister dst, Operand src, byte prefix, byte escape,
byte opcode);
void ssse3_instr(XMMRegister dst, Operand src, byte prefix, byte escape1,

View File

@ -5,6 +5,14 @@
#ifndef V8_CODEGEN_IA32_SSE_INSTR_H_
#define V8_CODEGEN_IA32_SSE_INSTR_H_
// SSE/SSE2 instructions whose AVX version has two operands.
#define SSE_UNOP_INSTRUCTION_LIST(V) \
V(sqrtps, 0F, 51) \
V(rsqrtps, 0F, 52) \
V(rcpps, 0F, 53) \
V(cvtps2pd, 0F, 5A) \
V(cvtdq2ps, 0F, 5B)
#define SSE2_INSTRUCTION_LIST(V) \
V(packsswb, 66, 0F, 63) \
V(packssdw, 66, 0F, 6B) \