Commit 11069a4e authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/S390: Fix builds without webassembly support

This CL assures builds with "v8_enable_webassembly = false"
compile successfully.

It is an addition on top of this original port:
e73c7b21

Change-Id: Ic27b3006087e4d4de6fe599a9f469d1f80cf8a8f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2918136Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#74769}
parent a4ae746a
......@@ -166,10 +166,13 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
scratch0_(scratch0),
scratch1_(scratch1),
mode_(mode),
#if V8_ENABLE_WEBASSEMBLY
stub_mode_(stub_mode),
#endif // V8_ENABLE_WEBASSEMBLY
must_save_lr_(!gen->frame_access_state()->has_frame()),
unwinding_info_writer_(unwinding_info_writer),
zone_(gen->zone()) {}
zone_(gen->zone()) {
}
void Generate() final {
ConstantPoolUnavailableScope constant_pool_unavailable(tasm());
......@@ -1019,9 +1022,6 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
int misc_field = MiscField::decode(instr->opcode());
int num_parameters = misc_field;
bool has_function_descriptor = false;
Label start_call;
bool isWasmCapiFunction =
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction();
int offset = 20 * kInstrSize;
if (instr->InputAt(0)->IsImmediate() &&
......@@ -1052,6 +1052,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
#endif
#if V8_ENABLE_WEBASSEMBLY
Label start_call;
bool isWasmCapiFunction =
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction();
if (isWasmCapiFunction) {
__ mflr(r0);
__ bind(&start_call);
......
......@@ -2492,6 +2492,18 @@ void InstructionSelector::VisitS128Select(Node* node) {
g.UseRegister(node->InputAt(2)));
}
// This is a replica of SimdShuffle::Pack4Lanes. However, above function will
// not be available on builds with webassembly disabled, hence we need to have
// it declared locally as it is used on other visitors such as S128Const.
static int32_t Pack4Lanes(const uint8_t* shuffle) {
int32_t result = 0;
for (int i = 3; i >= 0; --i) {
result <<= 8;
result |= shuffle[i];
}
return result;
}
void InstructionSelector::VisitS128Const(Node* node) {
PPCOperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
......@@ -2509,14 +2521,10 @@ void InstructionSelector::VisitS128Const(Node* node) {
// We have to use Pack4Lanes to reverse the bytes (lanes) on BE,
// Which in this case is ineffective on LE.
Emit(kPPC_S128Const, g.DefineAsRegister(node),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]))),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 4)),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 8)),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 12)));
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]))),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 4)),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 8)),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 12)));
}
}
......
......@@ -202,10 +202,13 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
scratch0_(scratch0),
scratch1_(scratch1),
mode_(mode),
#if V8_ENABLE_WEBASSEMBLY
stub_mode_(stub_mode),
#endif // V8_ENABLE_WEBASSEMBLY
must_save_lr_(!gen->frame_access_state()->has_frame()),
unwinding_info_writer_(unwinding_info_writer),
zone_(gen->zone()) {}
zone_(gen->zone()) {
}
void Generate() final {
if (COMPRESS_POINTERS_BOOL) {
......
......@@ -2748,6 +2748,18 @@ void InstructionSelector::VisitI8x16Swizzle(Node* node) {
g.UseUniqueRegister(node->InputAt(1)), arraysize(temps), temps);
}
// This is a replica of SimdShuffle::Pack4Lanes. However, above function will
// not be available on builds with webassembly disabled, hence we need to have
// it declared locally as it is used on other visitors such as S128Const.
static int32_t Pack4Lanes(const uint8_t* shuffle) {
int32_t result = 0;
for (int i = 3; i >= 0; --i) {
result <<= 8;
result |= shuffle[i];
}
return result;
}
void InstructionSelector::VisitS128Const(Node* node) {
S390OperandGenerator g(this);
uint32_t val[kSimd128Size / sizeof(uint32_t)];
......@@ -2765,14 +2777,10 @@ void InstructionSelector::VisitS128Const(Node* node) {
// We have to use Pack4Lanes to reverse the bytes (lanes) on BE,
// Which in this case is ineffective on LE.
Emit(kS390_S128Const, g.DefineAsRegister(node),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]))),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 4)),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 8)),
g.UseImmediate(
wasm::SimdShuffle::Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 12)));
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]))),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 4)),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 8)),
g.UseImmediate(Pack4Lanes(bit_cast<uint8_t*>(&val[0]) + 12)));
}
}
......
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