Flutter Engine
The Flutter Engine
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 2327 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 2329 of file call_specializer.cc.

2335 : flow_graph_(flow_graph),
2336 call_(call),
2337 graph_entry_(graph_entry),
2338 entry_(entry),
2339 last_(last),
2340 result_(result) {
2341 *entry_ = new (zone())
2342 FunctionEntryInstr(graph_entry_, flow_graph_->allocate_block_id(),
2343 call_->GetBlock()->try_index(), call_->deopt_id());
2344 *last = *entry_;
2345 }
intptr_t try_index() const
Definition: il.h:1730
intptr_t allocate_block_id()
Definition: flow_graph.h:266
virtual BlockEntryInstr * GetBlock()
Definition: il.cc:1352
intptr_t deopt_id() const
Definition: il.h:993
GAsyncResult * result
def call(args)
Definition: dom.py:159

Member Function Documentation

◆ TryInline()

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

Definition at line 2347 of file call_specializer.cc.

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

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