Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::SimdLowering Class Reference
Inheritance diagram for dart::SimdLowering:
dart::ValueObject

Public Member Functions

 SimdLowering (FlowGraph *flow_graph, Instruction *call, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
bool TryInline (MethodRecognizer::Kind kind)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 2342 of file call_specializer.cc.

Constructor & Destructor Documentation

◆ SimdLowering()

dart::SimdLowering::SimdLowering ( FlowGraph flow_graph,
Instruction call,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
inline

Definition at line 2344 of file call_specializer.cc.

2350 : flow_graph_(flow_graph),
2351 call_(call),
2352 graph_entry_(graph_entry),
2353 entry_(entry),
2354 last_(last),
2355 result_(result) {
2356 *entry_ = new (zone())
2357 FunctionEntryInstr(graph_entry_, flow_graph_->allocate_block_id(),
2358 call_->GetBlock()->try_index(), call_->deopt_id());
2359 *last = *entry_;
2360 }
intptr_t try_index() const
Definition il.h:1724
intptr_t allocate_block_id()
Definition flow_graph.h:266
virtual BlockEntryInstr * GetBlock()
Definition il.cc:1350
intptr_t deopt_id() const
Definition il.h:987
GAsyncResult * result

Member Function Documentation

◆ TryInline()

bool dart::SimdLowering::TryInline ( MethodRecognizer::Kind  kind)
inline

Definition at line 2362 of file call_specializer.cc.

2362 {
2363 switch (kind) {
2364 // ==== Int32x4 ====
2365 case MethodRecognizer::kInt32x4FromInts:
2366 UnboxScalar(0, kUnboxedInt32, 4);
2367 UnboxScalar(1, kUnboxedInt32, 4);
2368 UnboxScalar(2, kUnboxedInt32, 4);
2369 UnboxScalar(3, kUnboxedInt32, 4);
2370 Gather(4);
2371 BoxVector(kUnboxedInt32, 4);
2372 return true;
2373 case MethodRecognizer::kInt32x4FromBools:
2374 UnboxBool(0, 4);
2375 UnboxBool(1, 4);
2376 UnboxBool(2, 4);
2377 UnboxBool(3, 4);
2378 Gather(4);
2379 BoxVector(kUnboxedInt32, 4);
2380 return true;
2381 case MethodRecognizer::kInt32x4GetFlagX:
2382 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2383 IntToBool();
2384 Return(0);
2385 return true;
2386 case MethodRecognizer::kInt32x4GetFlagY:
2387 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2388 IntToBool();
2389 Return(1);
2390 return true;
2391 case MethodRecognizer::kInt32x4GetFlagZ:
2392 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2393 IntToBool();
2394 Return(2);
2395 return true;
2396 case MethodRecognizer::kInt32x4GetFlagW:
2397 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2398 IntToBool();
2399 Return(3);
2400 return true;
2401 case MethodRecognizer::kInt32x4WithFlagX:
2402 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2403 UnboxBool(1, 4);
2404 With(0);
2405 BoxVector(kUnboxedInt32, 4);
2406 return true;
2407 case MethodRecognizer::kInt32x4WithFlagY:
2408 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2409 UnboxBool(1, 4);
2410 With(1);
2411 BoxVector(kUnboxedInt32, 4);
2412 return true;
2413 case MethodRecognizer::kInt32x4WithFlagZ:
2414 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2415 UnboxBool(1, 4);
2416 With(2);
2417 BoxVector(kUnboxedInt32, 4);
2418 return true;
2419 case MethodRecognizer::kInt32x4WithFlagW:
2420 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2421 UnboxBool(1, 4);
2422 With(3);
2423 BoxVector(kUnboxedInt32, 4);
2424 return true;
2425 case MethodRecognizer::kInt32x4Shuffle: {
2426 Definition* mask_definition =
2427 call_->ArgumentAt(call_->ArgumentCount() - 1);
2428 intptr_t mask = 0;
2429 if (!CheckMask(mask_definition, &mask)) {
2430 return false;
2431 }
2432 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2433 Shuffle(mask);
2434 BoxVector(kUnboxedInt32, 4);
2435 return true;
2436 }
2437 case MethodRecognizer::kInt32x4ShuffleMix: {
2438 Definition* mask_definition =
2439 call_->ArgumentAt(call_->ArgumentCount() - 1);
2440 intptr_t mask = 0;
2441 if (!CheckMask(mask_definition, &mask)) {
2442 return false;
2443 }
2444 UnboxVector(0, kUnboxedInt32, kMintCid, 4);
2445 UnboxVector(1, kUnboxedInt32, kMintCid, 4);
2446 ShuffleMix(mask);
2447 BoxVector(kUnboxedInt32, 4);
2448 return true;
2449 }
2450 case MethodRecognizer::kInt32x4GetSignMask:
2451 case MethodRecognizer::kInt32x4Select:
2452 // TODO(riscv)
2453 return false;
2454
2455 // ==== Float32x4 ====
2456 case MethodRecognizer::kFloat32x4Abs:
2457 Float32x4Unary(Token::kABS);
2458 return true;
2459 case MethodRecognizer::kFloat32x4Negate:
2460 Float32x4Unary(Token::kNEGATE);
2461 return true;
2462 case MethodRecognizer::kFloat32x4Sqrt:
2463 Float32x4Unary(Token::kSQRT);
2464 return true;
2465 case MethodRecognizer::kFloat32x4Reciprocal:
2466 Float32x4Unary(Token::kRECIPROCAL);
2467 return true;
2468 case MethodRecognizer::kFloat32x4ReciprocalSqrt:
2469 Float32x4Unary(Token::kRECIPROCAL_SQRT);
2470 return true;
2471 case MethodRecognizer::kFloat32x4GetSignMask:
2472 // TODO(riscv)
2473 return false;
2474 case MethodRecognizer::kFloat32x4Equal:
2475 Float32x4Compare(Token::kEQ);
2476 return true;
2477 case MethodRecognizer::kFloat32x4GreaterThan:
2478 Float32x4Compare(Token::kGT);
2479 return true;
2480 case MethodRecognizer::kFloat32x4GreaterThanOrEqual:
2481 Float32x4Compare(Token::kGTE);
2482 return true;
2483 case MethodRecognizer::kFloat32x4LessThan:
2484 Float32x4Compare(Token::kLT);
2485 return true;
2486 case MethodRecognizer::kFloat32x4LessThanOrEqual:
2487 Float32x4Compare(Token::kLTE);
2488 return true;
2489 case MethodRecognizer::kFloat32x4Add:
2490 Float32x4Binary(Token::kADD);
2491 return true;
2492 case MethodRecognizer::kFloat32x4Sub:
2493 Float32x4Binary(Token::kSUB);
2494 return true;
2495 case MethodRecognizer::kFloat32x4Mul:
2496 Float32x4Binary(Token::kMUL);
2497 return true;
2498 case MethodRecognizer::kFloat32x4Div:
2499 Float32x4Binary(Token::kDIV);
2500 return true;
2501 case MethodRecognizer::kFloat32x4Min:
2502 Float32x4Binary(Token::kMIN);
2503 return true;
2504 case MethodRecognizer::kFloat32x4Max:
2505 Float32x4Binary(Token::kMAX);
2506 return true;
2507 case MethodRecognizer::kFloat32x4Scale:
2508 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2509 UnboxScalar(1, kUnboxedFloat, 4);
2510 BinaryDoubleOp(Token::kMUL, kUnboxedFloat, 4);
2511 BoxVector(kUnboxedFloat, 4);
2512 return true;
2513 case MethodRecognizer::kFloat32x4Splat:
2514 UnboxScalar(0, kUnboxedFloat, 4);
2515 Splat(4);
2516 BoxVector(kUnboxedFloat, 4);
2517 return true;
2518 case MethodRecognizer::kFloat32x4WithX:
2519 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2520 UnboxScalar(1, kUnboxedFloat, 4);
2521 With(0);
2522 BoxVector(kUnboxedFloat, 4);
2523 return true;
2524 case MethodRecognizer::kFloat32x4WithY:
2525 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2526 UnboxScalar(1, kUnboxedFloat, 4);
2527 With(1);
2528 BoxVector(kUnboxedFloat, 4);
2529 return true;
2530 case MethodRecognizer::kFloat32x4WithZ:
2531 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2532 UnboxScalar(1, kUnboxedFloat, 4);
2533 With(2);
2534 BoxVector(kUnboxedFloat, 4);
2535 return true;
2536 case MethodRecognizer::kFloat32x4WithW:
2537 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2538 UnboxScalar(1, kUnboxedFloat, 4);
2539 With(3);
2540 BoxVector(kUnboxedFloat, 4);
2541 return true;
2542 case MethodRecognizer::kFloat32x4Zero:
2543 UnboxDoubleZero(kUnboxedFloat, 4);
2544 BoxVector(kUnboxedFloat, 4);
2545 return true;
2546 case MethodRecognizer::kFloat32x4FromDoubles:
2547 UnboxScalar(0, kUnboxedFloat, 4);
2548 UnboxScalar(1, kUnboxedFloat, 4);
2549 UnboxScalar(2, kUnboxedFloat, 4);
2550 UnboxScalar(3, kUnboxedFloat, 4);
2551 Gather(4);
2552 BoxVector(kUnboxedFloat, 4);
2553 return true;
2554 case MethodRecognizer::kFloat32x4GetX:
2555 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2556 BoxScalar(0, kUnboxedFloat);
2557 return true;
2558 case MethodRecognizer::kFloat32x4GetY:
2559 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2560 BoxScalar(1, kUnboxedFloat);
2561 return true;
2562 case MethodRecognizer::kFloat32x4GetZ:
2563 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2564 BoxScalar(2, kUnboxedFloat);
2565 return true;
2566 case MethodRecognizer::kFloat32x4GetW:
2567 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2568 BoxScalar(3, kUnboxedFloat);
2569 return true;
2570 case MethodRecognizer::kFloat32x4Shuffle: {
2571 Definition* mask_definition =
2572 call_->ArgumentAt(call_->ArgumentCount() - 1);
2573 intptr_t mask = 0;
2574 if (!CheckMask(mask_definition, &mask)) {
2575 return false;
2576 }
2577 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2578 Shuffle(mask);
2579 BoxVector(kUnboxedFloat, 4);
2580 return true;
2581 }
2582 case MethodRecognizer::kFloat32x4ShuffleMix: {
2583 Definition* mask_definition =
2584 call_->ArgumentAt(call_->ArgumentCount() - 1);
2585 intptr_t mask = 0;
2586 if (!CheckMask(mask_definition, &mask)) {
2587 return false;
2588 }
2589 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4);
2590 UnboxVector(1, kUnboxedFloat, kDoubleCid, 4);
2591 ShuffleMix(mask);
2592 BoxVector(kUnboxedFloat, 4);
2593 return true;
2594 }
2595
2596 // ==== Float64x2 ====
2597 case MethodRecognizer::kFloat64x2Abs:
2598 Float64x2Unary(Token::kABS);
2599 return true;
2600 case MethodRecognizer::kFloat64x2Negate:
2601 Float64x2Unary(Token::kNEGATE);
2602 return true;
2603 case MethodRecognizer::kFloat64x2Sqrt:
2604 Float64x2Unary(Token::kSQRT);
2605 return true;
2606 case MethodRecognizer::kFloat64x2Add:
2607 Float64x2Binary(Token::kADD);
2608 return true;
2609 case MethodRecognizer::kFloat64x2Sub:
2610 Float64x2Binary(Token::kSUB);
2611 return true;
2612 case MethodRecognizer::kFloat64x2Mul:
2613 Float64x2Binary(Token::kMUL);
2614 return true;
2615 case MethodRecognizer::kFloat64x2Div:
2616 Float64x2Binary(Token::kDIV);
2617 return true;
2618 case MethodRecognizer::kFloat64x2Min:
2619 Float64x2Binary(Token::kMIN);
2620 return true;
2621 case MethodRecognizer::kFloat64x2Max:
2622 Float64x2Binary(Token::kMAX);
2623 return true;
2624 case MethodRecognizer::kFloat64x2Scale:
2625 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2);
2626 UnboxScalar(1, kUnboxedDouble, 2);
2627 BinaryDoubleOp(Token::kMUL, kUnboxedDouble, 2);
2628 BoxVector(kUnboxedDouble, 2);
2629 return true;
2630 case MethodRecognizer::kFloat64x2Splat:
2631 UnboxScalar(0, kUnboxedDouble, 2);
2632 Splat(2);
2633 BoxVector(kUnboxedDouble, 2);
2634 return true;
2635 case MethodRecognizer::kFloat64x2WithX:
2636 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2);
2637 UnboxScalar(1, kUnboxedDouble, 2);
2638 With(0);
2639 BoxVector(kUnboxedDouble, 2);
2640 return true;
2641 case MethodRecognizer::kFloat64x2WithY:
2642 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2);
2643 UnboxScalar(1, kUnboxedDouble, 2);
2644 With(1);
2645 BoxVector(kUnboxedDouble, 2);
2646 return true;
2647 case MethodRecognizer::kFloat64x2Zero:
2648 UnboxDoubleZero(kUnboxedDouble, 2);
2649 BoxVector(kUnboxedDouble, 2);
2650 return true;
2651 case MethodRecognizer::kFloat64x2FromDoubles:
2652 UnboxScalar(0, kUnboxedDouble, 2);
2653 UnboxScalar(1, kUnboxedDouble, 2);
2654 Gather(2);
2655 BoxVector(kUnboxedDouble, 2);
2656 return true;
2657 case MethodRecognizer::kFloat64x2GetX:
2658 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2);
2659 BoxScalar(0, kUnboxedDouble);
2660 return true;
2661 case MethodRecognizer::kFloat64x2GetY:
2662 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2);
2663 BoxScalar(1, kUnboxedDouble);
2664 return true;
2665
2666 // Mixed
2667 case MethodRecognizer::kFloat32x4ToFloat64x2: {
2668 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4, 1);
2669 Float32x4ToFloat64x2();
2670 BoxVector(kUnboxedDouble, 2);
2671 return true;
2672 }
2673 case MethodRecognizer::kFloat64x2ToFloat32x4: {
2674 UnboxVector(0, kUnboxedDouble, kDoubleCid, 2, 1);
2675 Float64x2ToFloat32x4();
2676 BoxVector(kUnboxedFloat, 4);
2677 return true;
2678 }
2679 case MethodRecognizer::kInt32x4ToFloat32x4:
2680 UnboxVector(0, kUnboxedInt32, kMintCid, 4, 1);
2681 Int32x4ToFloat32x4();
2682 BoxVector(kUnboxedFloat, 4);
2683 return true;
2684 case MethodRecognizer::kFloat32x4ToInt32x4:
2685 UnboxVector(0, kUnboxedFloat, kDoubleCid, 4, 1);
2686 Float32x4ToInt32x4();
2687 BoxVector(kUnboxedInt32, 4);
2688 return true;
2689 default:
2690 return false;
2691 }
2692 }
virtual intptr_t ArgumentCount() const
Definition il.h:1035
Definition * ArgumentAt(intptr_t index) const
Definition il.h:3423
static bool CheckMask(Definition *definition, intptr_t *mask_ptr)

The documentation for this class was generated from the following file: