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

Side by Side Diff: src/compiler/x64/instruction-selector-x64.cc

Issue 2776753004: [wasm] Make Opcode names consistent across architectures, implementations (Closed)
Patch Set: Fix Saturates Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/compiler/x64/instruction-scheduler-x64.cc ('k') | src/wasm/function-body-decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 addressing_mode = kMode_MRI; 2374 addressing_mode = kMode_MRI;
2375 } else { 2375 } else {
2376 inputs[input_count++] = g.UseUniqueRegister(index); 2376 inputs[input_count++] = g.UseUniqueRegister(index);
2377 addressing_mode = kMode_MR1; 2377 addressing_mode = kMode_MR1;
2378 } 2378 }
2379 outputs[0] = g.DefineAsFixed(node, rax); 2379 outputs[0] = g.DefineAsFixed(node, rax);
2380 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); 2380 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
2381 Emit(code, 1, outputs, input_count, inputs); 2381 Emit(code, 1, outputs, input_count, inputs);
2382 } 2382 }
2383 2383
2384 #define SIMD_TYPES(V) V(Int32x4) 2384 #define SIMD_TYPES(V) V(I32x4)
2385 2385
2386 #define SIMD_ZERO_OP_LIST(V) \ 2386 #define SIMD_ZERO_OP_LIST(V) \
2387 V(Simd128Zero) \ 2387 V(S128Zero) \
2388 V(Simd1x4Zero) \ 2388 V(S1x4Zero) \
2389 V(Simd1x8Zero) \ 2389 V(S1x8Zero) \
2390 V(Simd1x16Zero) 2390 V(S1x16Zero)
2391
2392 #define SIMD_SHIFT_OPCODES(V) \
2393 V(I32x4Shl) \
2394 V(I32x4ShrS) \
2395 V(I32x4ShrU)
2391 2396
2392 #define SIMD_BINOP_LIST(V) \ 2397 #define SIMD_BINOP_LIST(V) \
2393 V(Int32x4Add) \ 2398 V(I32x4Add) \
2394 V(Int32x4Sub) \ 2399 V(I32x4Sub) \
2395 V(Int32x4Mul) \ 2400 V(I32x4Mul) \
2396 V(Int32x4Min) \ 2401 V(I32x4MinS) \
2397 V(Int32x4Max) \ 2402 V(I32x4MaxS) \
2398 V(Int32x4Equal) \ 2403 V(I32x4Eq) \
2399 V(Int32x4NotEqual) \ 2404 V(I32x4Ne) \
2400 V(Uint32x4Min) \ 2405 V(I32x4MinU) \
2401 V(Uint32x4Max) 2406 V(I32x4MaxU)
2402
2403 #define SIMD_SHIFT_OPCODES(V) \
2404 V(Int32x4ShiftLeftByScalar) \
2405 V(Int32x4ShiftRightByScalar) \
2406 V(Uint32x4ShiftRightByScalar)
2407 2407
2408 #define VISIT_SIMD_SPLAT(Type) \ 2408 #define VISIT_SIMD_SPLAT(Type) \
2409 void InstructionSelector::Visit##Type##Splat(Node* node) { \ 2409 void InstructionSelector::Visit##Type##Splat(Node* node) { \
2410 X64OperandGenerator g(this); \ 2410 X64OperandGenerator g(this); \
2411 Emit(kX64##Type##Splat, g.DefineAsRegister(node), \ 2411 Emit(kX64##Type##Splat, g.DefineAsRegister(node), \
2412 g.Use(node->InputAt(0))); \ 2412 g.Use(node->InputAt(0))); \
2413 } 2413 }
2414 SIMD_TYPES(VISIT_SIMD_SPLAT) 2414 SIMD_TYPES(VISIT_SIMD_SPLAT)
2415 #undef VISIT_SIMD_SPLAT 2415 #undef VISIT_SIMD_SPLAT
2416 2416
(...skipping 11 matching lines...) Expand all
2428 void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \ 2428 void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \
2429 X64OperandGenerator g(this); \ 2429 X64OperandGenerator g(this); \
2430 int32_t lane = OpParameter<int32_t>(node); \ 2430 int32_t lane = OpParameter<int32_t>(node); \
2431 Emit(kX64##Type##ReplaceLane, g.DefineSameAsFirst(node), \ 2431 Emit(kX64##Type##ReplaceLane, g.DefineSameAsFirst(node), \
2432 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane), \ 2432 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane), \
2433 g.Use(node->InputAt(1))); \ 2433 g.Use(node->InputAt(1))); \
2434 } 2434 }
2435 SIMD_TYPES(VISIT_SIMD_REPLACE_LANE) 2435 SIMD_TYPES(VISIT_SIMD_REPLACE_LANE)
2436 #undef VISIT_SIMD_REPLACE_LANE 2436 #undef VISIT_SIMD_REPLACE_LANE
2437 2437
2438 #define SIMD_VISIT_ZERO_OP(Name) \ 2438 #define SIMD_VISIT_ZERO_OP(Name) \
2439 void InstructionSelector::Visit##Name(Node* node) { \ 2439 void InstructionSelector::Visit##Name(Node* node) { \
2440 X64OperandGenerator g(this); \ 2440 X64OperandGenerator g(this); \
2441 Emit(kX64Simd128Zero, g.DefineAsRegister(node), g.DefineAsRegister(node)); \ 2441 Emit(kX64S128Zero, g.DefineAsRegister(node), g.DefineAsRegister(node)); \
2442 } 2442 }
2443 SIMD_ZERO_OP_LIST(SIMD_VISIT_ZERO_OP) 2443 SIMD_ZERO_OP_LIST(SIMD_VISIT_ZERO_OP)
2444 #undef SIMD_VISIT_ZERO_OP 2444 #undef SIMD_VISIT_ZERO_OP
2445 2445
2446 #define VISIT_SIMD_BINOP(Opcode) \
2447 void InstructionSelector::Visit##Opcode(Node* node) { \
2448 X64OperandGenerator g(this); \
2449 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \
2450 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); \
2451 }
2452 SIMD_BINOP_LIST(VISIT_SIMD_BINOP)
2453 #undef VISIT_SIMD_BINOP
2454
2455 #define VISIT_SIMD_SHIFT(Opcode) \ 2446 #define VISIT_SIMD_SHIFT(Opcode) \
2456 void InstructionSelector::Visit##Opcode(Node* node) { \ 2447 void InstructionSelector::Visit##Opcode(Node* node) { \
2457 X64OperandGenerator g(this); \ 2448 X64OperandGenerator g(this); \
2458 int32_t value = OpParameter<int32_t>(node); \ 2449 int32_t value = OpParameter<int32_t>(node); \
2459 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \ 2450 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \
2460 g.UseRegister(node->InputAt(0)), g.UseImmediate(value)); \ 2451 g.UseRegister(node->InputAt(0)), g.UseImmediate(value)); \
2461 } 2452 }
2462 SIMD_SHIFT_OPCODES(VISIT_SIMD_SHIFT) 2453 SIMD_SHIFT_OPCODES(VISIT_SIMD_SHIFT)
2463 #undef VISIT_SIMD_SHIFT 2454 #undef VISIT_SIMD_SHIFT
2464 2455
2465 void InstructionSelector::VisitSimd32x4Select(Node* node) { 2456 #define VISIT_SIMD_BINOP(Opcode) \
2457 void InstructionSelector::Visit##Opcode(Node* node) { \
2458 X64OperandGenerator g(this); \
2459 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \
2460 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); \
2461 }
2462 SIMD_BINOP_LIST(VISIT_SIMD_BINOP)
2463 #undef VISIT_SIMD_BINOP
2464
2465 void InstructionSelector::VisitS32x4Select(Node* node) {
2466 X64OperandGenerator g(this); 2466 X64OperandGenerator g(this);
2467 Emit(kX64Simd32x4Select, g.DefineSameAsFirst(node), 2467 Emit(kX64S32x4Select, g.DefineSameAsFirst(node),
2468 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)), 2468 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)),
2469 g.UseRegister(node->InputAt(2))); 2469 g.UseRegister(node->InputAt(2)));
2470 } 2470 }
2471 2471
2472 // static 2472 // static
2473 MachineOperatorBuilder::Flags 2473 MachineOperatorBuilder::Flags
2474 InstructionSelector::SupportedMachineOperatorFlags() { 2474 InstructionSelector::SupportedMachineOperatorFlags() {
2475 MachineOperatorBuilder::Flags flags = 2475 MachineOperatorBuilder::Flags flags =
2476 MachineOperatorBuilder::kWord32ShiftIsSafe | 2476 MachineOperatorBuilder::kWord32ShiftIsSafe |
2477 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz; 2477 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz;
(...skipping 17 matching lines...) Expand all
2495 // static 2495 // static
2496 MachineOperatorBuilder::AlignmentRequirements 2496 MachineOperatorBuilder::AlignmentRequirements
2497 InstructionSelector::AlignmentRequirements() { 2497 InstructionSelector::AlignmentRequirements() {
2498 return MachineOperatorBuilder::AlignmentRequirements:: 2498 return MachineOperatorBuilder::AlignmentRequirements::
2499 FullUnalignedAccessSupport(); 2499 FullUnalignedAccessSupport();
2500 } 2500 }
2501 2501
2502 } // namespace compiler 2502 } // namespace compiler
2503 } // namespace internal 2503 } // namespace internal
2504 } // namespace v8 2504 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-scheduler-x64.cc ('k') | src/wasm/function-body-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698