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

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

Issue 2919203002: [WASM] Eliminate SIMD boolean vector types. (Closed)
Patch Set: Restore DCHECKs in AssembleMove/Swap now that we're back to 1 SIMD representation. Created 3 years, 6 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/wasm-compiler.cc ('k') | src/compiler/x87/instruction-selector-x87.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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 break; 226 break;
227 case MachineRepresentation::kTaggedSigned: // Fall through. 227 case MachineRepresentation::kTaggedSigned: // Fall through.
228 case MachineRepresentation::kTaggedPointer: // Fall through. 228 case MachineRepresentation::kTaggedPointer: // Fall through.
229 case MachineRepresentation::kTagged: // Fall through. 229 case MachineRepresentation::kTagged: // Fall through.
230 case MachineRepresentation::kWord64: 230 case MachineRepresentation::kWord64:
231 opcode = kX64Movq; 231 opcode = kX64Movq;
232 break; 232 break;
233 case MachineRepresentation::kSimd128: // Fall through. 233 case MachineRepresentation::kSimd128: // Fall through.
234 opcode = kX64Movdqu; 234 opcode = kX64Movdqu;
235 break; 235 break;
236 case MachineRepresentation::kSimd1x4: // Fall through.
237 case MachineRepresentation::kSimd1x8: // Fall through.
238 case MachineRepresentation::kSimd1x16: // Fall through.
239 case MachineRepresentation::kNone: 236 case MachineRepresentation::kNone:
240 UNREACHABLE(); 237 UNREACHABLE();
241 break; 238 break;
242 } 239 }
243 return opcode; 240 return opcode;
244 } 241 }
245 242
246 ArchOpcode GetStoreOpcode(StoreRepresentation store_rep) { 243 ArchOpcode GetStoreOpcode(StoreRepresentation store_rep) {
247 switch (store_rep.representation()) { 244 switch (store_rep.representation()) {
248 case MachineRepresentation::kFloat32: 245 case MachineRepresentation::kFloat32:
(...skipping 14 matching lines...) Expand all
263 break; 260 break;
264 case MachineRepresentation::kTaggedSigned: // Fall through. 261 case MachineRepresentation::kTaggedSigned: // Fall through.
265 case MachineRepresentation::kTaggedPointer: // Fall through. 262 case MachineRepresentation::kTaggedPointer: // Fall through.
266 case MachineRepresentation::kTagged: // Fall through. 263 case MachineRepresentation::kTagged: // Fall through.
267 case MachineRepresentation::kWord64: 264 case MachineRepresentation::kWord64:
268 return kX64Movq; 265 return kX64Movq;
269 break; 266 break;
270 case MachineRepresentation::kSimd128: // Fall through. 267 case MachineRepresentation::kSimd128: // Fall through.
271 return kX64Movdqu; 268 return kX64Movdqu;
272 break; 269 break;
273 case MachineRepresentation::kSimd1x4: // Fall through.
274 case MachineRepresentation::kSimd1x8: // Fall through.
275 case MachineRepresentation::kSimd1x16: // Fall through.
276 case MachineRepresentation::kNone: 270 case MachineRepresentation::kNone:
277 UNREACHABLE(); 271 UNREACHABLE();
278 } 272 }
279 UNREACHABLE(); 273 UNREACHABLE();
280 } 274 }
281 275
282 } // namespace 276 } // namespace
283 277
284 void InstructionSelector::VisitStackSlot(Node* node) { 278 void InstructionSelector::VisitStackSlot(Node* node) {
285 StackSlotRepresentation rep = StackSlotRepresentationOf(node->op()); 279 StackSlotRepresentation rep = StackSlotRepresentationOf(node->op());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 opcode = kCheckedLoadWord64; 419 opcode = kCheckedLoadWord64;
426 break; 420 break;
427 case MachineRepresentation::kFloat32: 421 case MachineRepresentation::kFloat32:
428 opcode = kCheckedLoadFloat32; 422 opcode = kCheckedLoadFloat32;
429 break; 423 break;
430 case MachineRepresentation::kFloat64: 424 case MachineRepresentation::kFloat64:
431 opcode = kCheckedLoadFloat64; 425 opcode = kCheckedLoadFloat64;
432 break; 426 break;
433 case MachineRepresentation::kBit: // Fall through. 427 case MachineRepresentation::kBit: // Fall through.
434 case MachineRepresentation::kSimd128: // Fall through. 428 case MachineRepresentation::kSimd128: // Fall through.
435 case MachineRepresentation::kSimd1x4: // Fall through.
436 case MachineRepresentation::kSimd1x8: // Fall through.
437 case MachineRepresentation::kSimd1x16: // Fall through.
438 case MachineRepresentation::kTaggedSigned: // Fall through. 429 case MachineRepresentation::kTaggedSigned: // Fall through.
439 case MachineRepresentation::kTaggedPointer: // Fall through. 430 case MachineRepresentation::kTaggedPointer: // Fall through.
440 case MachineRepresentation::kTagged: // Fall through. 431 case MachineRepresentation::kTagged: // Fall through.
441 case MachineRepresentation::kNone: 432 case MachineRepresentation::kNone:
442 UNREACHABLE(); 433 UNREACHABLE();
443 return; 434 return;
444 } 435 }
445 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) { 436 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
446 Int32Matcher mlength(length); 437 Int32Matcher mlength(length);
447 Int32BinopMatcher moffset(offset); 438 Int32BinopMatcher moffset(offset);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 opcode = kCheckedStoreWord64; 474 opcode = kCheckedStoreWord64;
484 break; 475 break;
485 case MachineRepresentation::kFloat32: 476 case MachineRepresentation::kFloat32:
486 opcode = kCheckedStoreFloat32; 477 opcode = kCheckedStoreFloat32;
487 break; 478 break;
488 case MachineRepresentation::kFloat64: 479 case MachineRepresentation::kFloat64:
489 opcode = kCheckedStoreFloat64; 480 opcode = kCheckedStoreFloat64;
490 break; 481 break;
491 case MachineRepresentation::kBit: // Fall through. 482 case MachineRepresentation::kBit: // Fall through.
492 case MachineRepresentation::kSimd128: // Fall through. 483 case MachineRepresentation::kSimd128: // Fall through.
493 case MachineRepresentation::kSimd1x4: // Fall through.
494 case MachineRepresentation::kSimd1x8: // Fall through.
495 case MachineRepresentation::kSimd1x16: // Fall through.
496 case MachineRepresentation::kTaggedSigned: // Fall through. 484 case MachineRepresentation::kTaggedSigned: // Fall through.
497 case MachineRepresentation::kTaggedPointer: // Fall through. 485 case MachineRepresentation::kTaggedPointer: // Fall through.
498 case MachineRepresentation::kTagged: // Fall through. 486 case MachineRepresentation::kTagged: // Fall through.
499 case MachineRepresentation::kNone: 487 case MachineRepresentation::kNone:
500 UNREACHABLE(); 488 UNREACHABLE();
501 return; 489 return;
502 } 490 }
503 InstructionOperand value_operand = 491 InstructionOperand value_operand =
504 g.CanBeImmediate(value) ? g.UseImmediate(value) : g.UseRegister(value); 492 g.CanBeImmediate(value) ? g.UseImmediate(value) : g.UseRegister(value);
505 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) { 493 if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
(...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 #define SIMD_TYPES(V) \ 2441 #define SIMD_TYPES(V) \
2454 V(I32x4) \ 2442 V(I32x4) \
2455 V(I16x8) \ 2443 V(I16x8) \
2456 V(I8x16) 2444 V(I8x16)
2457 2445
2458 #define SIMD_FORMAT_LIST(V) \ 2446 #define SIMD_FORMAT_LIST(V) \
2459 V(32x4) \ 2447 V(32x4) \
2460 V(16x8) \ 2448 V(16x8) \
2461 V(8x16) 2449 V(8x16)
2462 2450
2463 #define SIMD_ZERO_OP_LIST(V) \
2464 V(S128Zero) \
2465 V(S1x4Zero) \
2466 V(S1x8Zero) \
2467 V(S1x16Zero)
2468
2469 #define SIMD_BINOP_LIST(V) \ 2451 #define SIMD_BINOP_LIST(V) \
2470 V(I32x4Add) \ 2452 V(I32x4Add) \
2471 V(I32x4AddHoriz) \ 2453 V(I32x4AddHoriz) \
2472 V(I32x4Sub) \ 2454 V(I32x4Sub) \
2473 V(I32x4Mul) \ 2455 V(I32x4Mul) \
2474 V(I32x4MinS) \ 2456 V(I32x4MinS) \
2475 V(I32x4MaxS) \ 2457 V(I32x4MaxS) \
2476 V(I32x4Eq) \ 2458 V(I32x4Eq) \
2477 V(I32x4Ne) \ 2459 V(I32x4Ne) \
2478 V(I32x4MinU) \ 2460 V(I32x4MinU) \
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 #define SIMD_UNOP_LIST(V) V(S128Not) 2492 #define SIMD_UNOP_LIST(V) V(S128Not)
2511 2493
2512 #define SIMD_SHIFT_OPCODES(V) \ 2494 #define SIMD_SHIFT_OPCODES(V) \
2513 V(I32x4Shl) \ 2495 V(I32x4Shl) \
2514 V(I32x4ShrS) \ 2496 V(I32x4ShrS) \
2515 V(I32x4ShrU) \ 2497 V(I32x4ShrU) \
2516 V(I16x8Shl) \ 2498 V(I16x8Shl) \
2517 V(I16x8ShrS) \ 2499 V(I16x8ShrS) \
2518 V(I16x8ShrU) 2500 V(I16x8ShrU)
2519 2501
2502 void InstructionSelector::VisitS128Zero(Node* node) {
2503 X64OperandGenerator g(this);
2504 Emit(kX64S128Zero, g.DefineAsRegister(node), g.DefineAsRegister(node));
2505 }
2506
2520 #define VISIT_SIMD_SPLAT(Type) \ 2507 #define VISIT_SIMD_SPLAT(Type) \
2521 void InstructionSelector::Visit##Type##Splat(Node* node) { \ 2508 void InstructionSelector::Visit##Type##Splat(Node* node) { \
2522 X64OperandGenerator g(this); \ 2509 X64OperandGenerator g(this); \
2523 Emit(kX64##Type##Splat, g.DefineAsRegister(node), \ 2510 Emit(kX64##Type##Splat, g.DefineAsRegister(node), \
2524 g.Use(node->InputAt(0))); \ 2511 g.Use(node->InputAt(0))); \
2525 } 2512 }
2526 SIMD_TYPES(VISIT_SIMD_SPLAT) 2513 SIMD_TYPES(VISIT_SIMD_SPLAT)
2527 #undef VISIT_SIMD_SPLAT 2514 #undef VISIT_SIMD_SPLAT
2528 2515
2529 #define VISIT_SIMD_EXTRACT_LANE(Type) \ 2516 #define VISIT_SIMD_EXTRACT_LANE(Type) \
(...skipping 10 matching lines...) Expand all
2540 void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \ 2527 void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \
2541 X64OperandGenerator g(this); \ 2528 X64OperandGenerator g(this); \
2542 int32_t lane = OpParameter<int32_t>(node); \ 2529 int32_t lane = OpParameter<int32_t>(node); \
2543 Emit(kX64##Type##ReplaceLane, g.DefineSameAsFirst(node), \ 2530 Emit(kX64##Type##ReplaceLane, g.DefineSameAsFirst(node), \
2544 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane), \ 2531 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane), \
2545 g.Use(node->InputAt(1))); \ 2532 g.Use(node->InputAt(1))); \
2546 } 2533 }
2547 SIMD_TYPES(VISIT_SIMD_REPLACE_LANE) 2534 SIMD_TYPES(VISIT_SIMD_REPLACE_LANE)
2548 #undef VISIT_SIMD_REPLACE_LANE 2535 #undef VISIT_SIMD_REPLACE_LANE
2549 2536
2550 #define SIMD_VISIT_ZERO_OP(Name) \
2551 void InstructionSelector::Visit##Name(Node* node) { \
2552 X64OperandGenerator g(this); \
2553 Emit(kX64S128Zero, g.DefineAsRegister(node), g.DefineAsRegister(node)); \
2554 }
2555 SIMD_ZERO_OP_LIST(SIMD_VISIT_ZERO_OP)
2556 #undef SIMD_VISIT_ZERO_OP
2557
2558 #define VISIT_SIMD_SHIFT(Opcode) \ 2537 #define VISIT_SIMD_SHIFT(Opcode) \
2559 void InstructionSelector::Visit##Opcode(Node* node) { \ 2538 void InstructionSelector::Visit##Opcode(Node* node) { \
2560 X64OperandGenerator g(this); \ 2539 X64OperandGenerator g(this); \
2561 int32_t value = OpParameter<int32_t>(node); \ 2540 int32_t value = OpParameter<int32_t>(node); \
2562 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \ 2541 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \
2563 g.UseRegister(node->InputAt(0)), g.UseImmediate(value)); \ 2542 g.UseRegister(node->InputAt(0)), g.UseImmediate(value)); \
2564 } 2543 }
2565 SIMD_SHIFT_OPCODES(VISIT_SIMD_SHIFT) 2544 SIMD_SHIFT_OPCODES(VISIT_SIMD_SHIFT)
2566 #undef VISIT_SIMD_SHIFT 2545 #undef VISIT_SIMD_SHIFT
2567 2546
2568 #define VISIT_SIMD_UNOP(Opcode) \ 2547 #define VISIT_SIMD_UNOP(Opcode) \
2569 void InstructionSelector::Visit##Opcode(Node* node) { \ 2548 void InstructionSelector::Visit##Opcode(Node* node) { \
2570 X64OperandGenerator g(this); \ 2549 X64OperandGenerator g(this); \
2571 Emit(kX64##Opcode, g.DefineAsRegister(node), \ 2550 Emit(kX64##Opcode, g.DefineAsRegister(node), \
2572 g.UseRegister(node->InputAt(0))); \ 2551 g.UseRegister(node->InputAt(0))); \
2573 } 2552 }
2574 SIMD_UNOP_LIST(VISIT_SIMD_UNOP) 2553 SIMD_UNOP_LIST(VISIT_SIMD_UNOP)
2575 #undef VISIT_SIMD_UNOP 2554 #undef VISIT_SIMD_UNOP
2576 2555
2577 #define VISIT_SIMD_BINOP(Opcode) \ 2556 #define VISIT_SIMD_BINOP(Opcode) \
2578 void InstructionSelector::Visit##Opcode(Node* node) { \ 2557 void InstructionSelector::Visit##Opcode(Node* node) { \
2579 X64OperandGenerator g(this); \ 2558 X64OperandGenerator g(this); \
2580 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \ 2559 Emit(kX64##Opcode, g.DefineSameAsFirst(node), \
2581 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); \ 2560 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); \
2582 } 2561 }
2583 SIMD_BINOP_LIST(VISIT_SIMD_BINOP) 2562 SIMD_BINOP_LIST(VISIT_SIMD_BINOP)
2584 #undef VISIT_SIMD_BINOP 2563 #undef VISIT_SIMD_BINOP
2585 2564
2586 #define SIMD_VISIT_SELECT_OP(format) \ 2565 void InstructionSelector::VisitS128Select(Node* node) {
2587 void InstructionSelector::VisitS##format##Select(Node* node) { \ 2566 X64OperandGenerator g(this);
2588 X64OperandGenerator g(this); \ 2567 Emit(kX64S128Select, g.DefineSameAsFirst(node),
2589 Emit(kX64S128Select, g.DefineSameAsFirst(node), \ 2568 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)),
2590 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)), \ 2569 g.UseRegister(node->InputAt(2)));
2591 g.UseRegister(node->InputAt(2))); \ 2570 }
2592 }
2593 SIMD_FORMAT_LIST(SIMD_VISIT_SELECT_OP)
2594 #undef SIMD_VISIT_SELECT_OP
2595 2571
2596 void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) { 2572 void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) {
2597 UNREACHABLE(); 2573 UNREACHABLE();
2598 } 2574 }
2599 2575
2600 void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) { 2576 void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) {
2601 UNREACHABLE(); 2577 UNREACHABLE();
2602 } 2578 }
2603 2579
2604 // static 2580 // static
(...skipping 22 matching lines...) Expand all
2627 // static 2603 // static
2628 MachineOperatorBuilder::AlignmentRequirements 2604 MachineOperatorBuilder::AlignmentRequirements
2629 InstructionSelector::AlignmentRequirements() { 2605 InstructionSelector::AlignmentRequirements() {
2630 return MachineOperatorBuilder::AlignmentRequirements:: 2606 return MachineOperatorBuilder::AlignmentRequirements::
2631 FullUnalignedAccessSupport(); 2607 FullUnalignedAccessSupport();
2632 } 2608 }
2633 2609
2634 } // namespace compiler 2610 } // namespace compiler
2635 } // namespace internal 2611 } // namespace internal
2636 } // namespace v8 2612 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | src/compiler/x87/instruction-selector-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698