Commit 024353a
committed
[RISCV] Attempt to widen SEW before generic shuffle lowering
This takes inspiration from AArch64 which does the same thing to assist
with zip/trn/etc.. Doing this recursion unconditionally when the mask
allows is slightly questionable, but seems to work out okay in practice.
If reviewers would rather see a more narrow heuristic for widening, let
me know - and please suggest a heuristic which makes sense to you.
My actual motivation for this involves matching the proposed
zip/unzip/zipeven/zipodd instructions being discussed on sig-vector,
but this also applies to other shuffle masks as well.
As a bit of context, it's helpful to realize that we have existing
logic in both DAGCombine and InstCombine which mutates the element
width of in an analogous manner. However, that code has two
restriction which prevent it from handling the motivating cases here.
First, it only triggers if there is a bitcast involving a different
element type. Second, the matcher used considers a partially undef
wide element to be a non-match. I considered trying to relax those
assumptions, but the information loss for undef in mid-level opt
seemed more likely to open a can of worms than I wanted.1 parent cdbba15 commit 024353a
File tree
8 files changed
+390
-476
lines changed- llvm
- include/llvm/Analysis
- lib
- Analysis
- Target
- AArch64
- RISCV
- test/CodeGen/RISCV/rvv
8 files changed
+390
-476
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
238 | 244 | | |
239 | 245 | | |
240 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
482 | 518 | | |
483 | 519 | | |
484 | 520 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13721 | 13721 | | |
13722 | 13722 | | |
13723 | 13723 | | |
13724 | | - | |
13725 | | - | |
13726 | | - | |
13727 | | - | |
13728 | | - | |
13729 | | - | |
13730 | | - | |
13731 | | - | |
13732 | | - | |
13733 | | - | |
13734 | | - | |
13735 | | - | |
13736 | | - | |
13737 | | - | |
13738 | | - | |
13739 | | - | |
13740 | | - | |
13741 | | - | |
13742 | | - | |
13743 | | - | |
13744 | | - | |
13745 | | - | |
13746 | | - | |
13747 | | - | |
13748 | | - | |
13749 | | - | |
13750 | | - | |
13751 | | - | |
13752 | | - | |
13753 | | - | |
13754 | | - | |
13755 | | - | |
13756 | | - | |
13757 | | - | |
13758 | | - | |
13759 | | - | |
13760 | | - | |
13761 | | - | |
13762 | 13724 | | |
13763 | 13725 | | |
13764 | 13726 | | |
| |||
13785 | 13747 | | |
13786 | 13748 | | |
13787 | 13749 | | |
13788 | | - | |
| 13750 | + | |
13789 | 13751 | | |
13790 | 13752 | | |
13791 | 13753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5261 | 5261 | | |
5262 | 5262 | | |
5263 | 5263 | | |
| 5264 | + | |
| 5265 | + | |
| 5266 | + | |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
| 5276 | + | |
| 5277 | + | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
| 5286 | + | |
| 5287 | + | |
| 5288 | + | |
| 5289 | + | |
| 5290 | + | |
| 5291 | + | |
| 5292 | + | |
| 5293 | + | |
| 5294 | + | |
| 5295 | + | |
| 5296 | + | |
| 5297 | + | |
| 5298 | + | |
| 5299 | + | |
5264 | 5300 | | |
5265 | 5301 | | |
5266 | 5302 | | |
| |||
5506 | 5542 | | |
5507 | 5543 | | |
5508 | 5544 | | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
5509 | 5550 | | |
5510 | 5551 | | |
5511 | 5552 | | |
| |||
5615 | 5656 | | |
5616 | 5657 | | |
5617 | 5658 | | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
5618 | 5665 | | |
5619 | 5666 | | |
5620 | 5667 | | |
| |||
Lines changed: 17 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 606 | + | |
| 607 | + | |
610 | 608 | | |
611 | 609 | | |
612 | 610 | | |
| |||
704 | 702 | | |
705 | 703 | | |
706 | 704 | | |
707 | | - | |
708 | | - | |
| 705 | + | |
| 706 | + | |
709 | 707 | | |
710 | 708 | | |
711 | 709 | | |
| |||
756 | 754 | | |
757 | 755 | | |
758 | 756 | | |
759 | | - | |
760 | | - | |
761 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
762 | 760 | | |
763 | 761 | | |
764 | 762 | | |
| |||
832 | 830 | | |
833 | 831 | | |
834 | 832 | | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
855 | 843 | | |
856 | 844 | | |
857 | 845 | | |
| |||
0 commit comments