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

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
Index: src/compiler/wasm-linkage.cc
diff --git a/src/compiler/wasm-linkage.cc b/src/compiler/wasm-linkage.cc
index 8be1cbf4e97ea7aeadee56ba87e1d4efc458bd2b..fa6e41f79c2252cf4fc3287bbc4e0eec54a2bf90 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* GetI32WasmCallDescriptorWithReplacement(
titzer 2016/10/12 19:06:55 The name is a bit weird now, since it is no longer
aseemgarg 2016/10/17 19:01:44 Done.
+ Zone* zone, CallDescriptor* descriptor, size_t num_replacements,
+ MachineType 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) == 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) == 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) == type) {
+ for (size_t j = 0; j < num_replacements; j++) {
+ locations.AddReturn(rets.Next(MachineRepresentation::kWord32));
+ }
} 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) == type) {
+ for (size_t j = 0; j < num_replacements; j++) {
+ locations.AddParam(params.Next(MachineRepresentation::kWord32));
titzer 2016/10/12 19:06:55 kWord32 should be a parameter to this method now.
aseemgarg 2016/10/17 19:01:44 Done.
+ }
} else {
locations.AddParam(
params.Next(descriptor->GetParameterType(i).representation()));
@@ -369,8 +366,18 @@ 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 GetI32WasmCallDescriptorWithReplacement(zone, descriptor, 2,
+ MachineType::Int64());
+}
+
+CallDescriptor* ModuleEnv::GetI32WasmCallDescriptorForSimd(
+ Zone* zone, CallDescriptor* descriptor) {
+ return GetI32WasmCallDescriptorWithReplacement(zone, descriptor, 4,
+ MachineType::Simd128());
}
} // namespace wasm

Powered by Google App Engine
This is Rietveld 408576698