Commit 15957c70 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[wasm-simd][arm64] Prototype sign select

Bug: v8:10983
Change-Id: Id4b3a5909305c34cda0732b63716a2bf0324eac1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2576219Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71651}
parent 5188caf0
......@@ -1300,6 +1300,10 @@ class V8_EXPORT_PRIVATE TurboAssembler : public TurboAssemblerBase {
DCHECK(allow_macro_instructions());
cmeq(vd, vn, imm);
}
void Cmlt(const VRegister& vd, const VRegister& vn, int imm) {
DCHECK(allow_macro_instructions());
cmlt(vd, vn, imm);
}
inline void Neg(const Register& rd, const Operand& operand);
inline void Negs(const Register& rd, const Operand& operand);
......@@ -1548,10 +1552,6 @@ class V8_EXPORT_PRIVATE MacroAssembler : public TurboAssembler {
DCHECK(allow_macro_instructions());
cmle(vd, vn, imm);
}
void Cmlt(const VRegister& vd, const VRegister& vn, int imm) {
DCHECK(allow_macro_instructions());
cmlt(vd, vn, imm);
}
void Ld1(const VRegister& vt, const MemOperand& src) {
DCHECK(allow_macro_instructions());
......
......@@ -2534,6 +2534,14 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
__ Mov(dst.W(), tmp.V8H(), 0);
break;
}
case kArm64SignSelect: {
VectorFormat f = VectorFormatFillQ(MiscField::decode(opcode));
__ Cmlt(i.OutputSimd128Register().Format(f),
i.InputSimd128Register(2).Format(f), 0);
__ Bsl(i.OutputSimd128Register().V16B(), i.InputSimd128Register(0).V16B(),
i.InputSimd128Register(1).V16B());
break;
}
case kArm64S128Const: {
uint64_t imm1 = make_uint64(i.InputUint32(1), i.InputUint32(0));
uint64_t imm2 = make_uint64(i.InputUint32(3), i.InputUint32(2));
......
......@@ -329,6 +329,7 @@ namespace compiler {
V(Arm64I8x16RoundingAverageU) \
V(Arm64I8x16Abs) \
V(Arm64I8x16BitMask) \
V(Arm64SignSelect) \
V(Arm64S128Const) \
V(Arm64S128Zero) \
V(Arm64S128Dup) \
......
......@@ -298,6 +298,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kArm64I8x16RoundingAverageU:
case kArm64I8x16Abs:
case kArm64I8x16BitMask:
case kArm64SignSelect:
case kArm64S128Const:
case kArm64S128Zero:
case kArm64S128Dup:
......
......@@ -7,6 +7,7 @@
#include "src/codegen/assembler-inl.h"
#include "src/codegen/machine-type.h"
#include "src/common/globals.h"
#include "src/compiler/backend/instruction-codes.h"
#include "src/compiler/backend/instruction-selector-impl.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node-matchers.h"
......@@ -211,6 +212,14 @@ void VisitRRIR(InstructionSelector* selector, ArchOpcode opcode, Node* node) {
g.UseUniqueRegister(node->InputAt(1)));
}
void VisitRRRR(InstructionSelector* selector, InstructionCode opcode,
Node* node) {
Arm64OperandGenerator g(selector);
selector->Emit(
opcode, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)),
g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(2)));
}
struct ExtendingLoadMatcher {
ExtendingLoadMatcher(Node* node, InstructionSelector* selector)
: matches_(false), selector_(selector), base_(nullptr), immediate_(0) {
......@@ -3591,6 +3600,18 @@ SIMD_BINOP_LIST(SIMD_VISIT_BINOP)
#undef SIMD_VISIT_BINOP
#undef SIMD_BINOP_LIST
#define VISIT_SIGN_SELECT(NAME, SIZE) \
void InstructionSelector::Visit##NAME(Node* node) { \
InstructionCode opcode = kArm64SignSelect; \
opcode |= MiscField::encode(SIZE); \
VisitRRRR(this, opcode, node); \
}
VISIT_SIGN_SELECT(I8x16SignSelect, 8)
VISIT_SIGN_SELECT(I16x8SignSelect, 16)
VISIT_SIGN_SELECT(I32x4SignSelect, 32)
VISIT_SIGN_SELECT(I64x2SignSelect, 64)
void InstructionSelector::VisitI64x2Mul(Node* node) {
Arm64OperandGenerator g(this);
InstructionOperand temps[] = {g.TempSimd128Register()};
......
......@@ -2830,13 +2830,13 @@ void InstructionSelector::VisitStoreLane(Node* node) { UNIMPLEMENTED(); }
#endif // !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM64
// && !V8_TARGET_ARCH_ARM
#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32
#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM64
// TODO(v8:10983) Prototyping sign select.
void InstructionSelector::VisitI8x16SignSelect(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI16x8SignSelect(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI32x4SignSelect(Node* node) { UNIMPLEMENTED(); }
void InstructionSelector::VisitI64x2SignSelect(Node* node) { UNIMPLEMENTED(); }
#endif // !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32
#endif // !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_ARM64
#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_ARM && \
!V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_MIPS64 && !V8_TARGET_ARCH_MIPS
......
......@@ -765,7 +765,7 @@ WASM_SIMD_TEST(F32x4Le) {
RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Le, LessEqual);
}
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64
// TODO(v8:10983) Prototyping sign select.
template <typename T>
void RunSignSelect(TestExecutionTier execution_tier, LowerSimd lower_simd,
......@@ -822,7 +822,7 @@ WASM_SIMD_TEST_NO_LOWERING(I64x2SignSelect) {
RunSignSelect<int64_t>(execution_tier, lower_simd, kExprI64x2SignSelect,
kExprI64x2Splat, mask);
}
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM64
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_S390X
WASM_SIMD_TEST_NO_LOWERING(F32x4Qfma) {
......
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