Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1547)

Unified Diff: src/compiler/wasm-linkage.cc

Issue 2294743003: [wasm] simd scalar lowering F32x4Add and I32x4Add (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] simd scalar lowering F32x4Add and I32x4Add Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-linkage.cc
diff --git a/src/compiler/wasm-linkage.cc b/src/compiler/wasm-linkage.cc
index 574db1cfef2f7795e059db80ab15b8a76b699963..5dfcbcc552c5c08844954d84412a380cbafa7a57 100644
--- a/src/compiler/wasm-linkage.cc
+++ b/src/compiler/wasm-linkage.cc
@@ -307,26 +307,23 @@ CallDescriptor* ModuleEnv::GetWasmCallDescriptor(Zone* zone,
"wasm-call");
}
-CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
- Zone* zone, CallDescriptor* descriptor) {
+CallDescriptor* ReplaceTypeInCallDescriptorWith(
+ Zone* zone, CallDescriptor* descriptor, size_t num_replacements,
+ MachineType input_type, MachineRepresentation output_type) {
size_t parameter_count = descriptor->ParameterCount();
size_t return_count = descriptor->ReturnCount();
for (size_t i = 0; i < descriptor->ParameterCount(); i++) {
- if (descriptor->GetParameterType(i) == MachineType::Int64()) {
- // For each int64 input we get two int32 inputs.
- parameter_count++;
+ if (descriptor->GetParameterType(i) == input_type) {
+ parameter_count += num_replacements - 1;
}
}
for (size_t i = 0; i < descriptor->ReturnCount(); i++) {
- if (descriptor->GetReturnType(i) == MachineType::Int64()) {
- // For each int64 return we get two int32 returns.
- return_count++;
+ if (descriptor->GetReturnType(i) == input_type) {
+ return_count += num_replacements - 1;
}
}
if (parameter_count == descriptor->ParameterCount() &&
return_count == descriptor->ReturnCount()) {
- // If there is no int64 parameter or return value, we can just return the
- // original descriptor.
return descriptor;
}
@@ -335,10 +332,10 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
Allocator rets = return_registers.Get();
for (size_t i = 0; i < descriptor->ReturnCount(); i++) {
- if (descriptor->GetReturnType(i) == MachineType::Int64()) {
- // For each int64 return we get two int32 returns.
- locations.AddReturn(rets.Next(MachineRepresentation::kWord32));
- locations.AddReturn(rets.Next(MachineRepresentation::kWord32));
+ if (descriptor->GetReturnType(i) == input_type) {
+ for (size_t j = 0; j < num_replacements; j++) {
+ locations.AddReturn(rets.Next(output_type));
+ }
} else {
locations.AddReturn(
rets.Next(descriptor->GetReturnType(i).representation()));
@@ -348,10 +345,10 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
Allocator params = parameter_registers.Get();
for (size_t i = 0; i < descriptor->ParameterCount(); i++) {
- if (descriptor->GetParameterType(i) == MachineType::Int64()) {
- // For each int64 input we get two int32 inputs.
- locations.AddParam(params.Next(MachineRepresentation::kWord32));
- locations.AddParam(params.Next(MachineRepresentation::kWord32));
+ if (descriptor->GetParameterType(i) == input_type) {
+ for (size_t j = 0; j < num_replacements; j++) {
+ locations.AddParam(params.Next(output_type));
+ }
} else {
locations.AddParam(
params.Next(descriptor->GetParameterType(i).representation()));
@@ -369,8 +366,20 @@ CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
descriptor->CalleeSavedFPRegisters(), // callee-saved fp regs
descriptor->flags(), // flags
descriptor->debug_name());
+}
- return descriptor;
+CallDescriptor* ModuleEnv::GetI32WasmCallDescriptor(
+ Zone* zone, CallDescriptor* descriptor) {
+ return ReplaceTypeInCallDescriptorWith(zone, descriptor, 2,
+ MachineType::Int64(),
+ MachineRepresentation::kWord32);
+}
+
+CallDescriptor* ModuleEnv::GetI32WasmCallDescriptorForSimd(
+ Zone* zone, CallDescriptor* descriptor) {
+ return ReplaceTypeInCallDescriptorWith(zone, descriptor, 4,
+ MachineType::Simd128(),
+ MachineRepresentation::kWord32);
}
} // namespace wasm
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698