-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AArch64][SelectionDAG] Add support for 8to64 partial reduction cases #138269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
NickGuy-Arm
merged 4 commits into
llvm:main
from
NickGuy-Arm:legal-partial-reduction/8to6
May 6, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3187e07
[AArch64][SelectionDAG] Add support for 8to64 partial reduction cases
NickGuy-Arm 00371df
Switch to using wide adds instead of unpacking
NickGuy-Arm 1d0994b
Address comments and add SVE2/SME guard & fallback
NickGuy-Arm 466eb9f
Update doc-comment and add sme test run line
NickGuy-Arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
| ; RUN: llc -mtriple=aarch64 -mattr=+sve2,+i8mm %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-I8MM | ||
| ; RUN: llc -mtriple=aarch64 -mattr=+sve2 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOI8MM | ||
| ; RUN: llc -mtriple=aarch64 -mattr=+sve2,+i8mm -aarch64-enable-partial-reduce-nodes %s -o - | FileCheck %s --check-prefixes=CHECK-NEWLOWERING | ||
| ; RUN: llc -mtriple=aarch64 -mattr=+sve,+i8mm -aarch64-enable-partial-reduce-nodes %s -o - | FileCheck %s --check-prefixes=CHECK-NEWLOWERING,CHECK-NEWLOWERING-SVE | ||
| ; RUN: llc -mtriple=aarch64 -mattr=+sve2,+i8mm -aarch64-enable-partial-reduce-nodes %s -o - | FileCheck %s --check-prefixes=CHECK-NEWLOWERING,CHECK-NEWLOWERING-SVE2 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also add a run line for |
||
| ; RUN: llc -mtriple=aarch64 -mattr=+sme -force-streaming -aarch64-enable-partial-reduce-nodes %s -o - | FileCheck %s --check-prefixes=CHECK-NEWLOWERING,CHECK-NEWLOWERING-SME | ||
|
|
||
| define <vscale x 4 x i32> @udot(<vscale x 4 x i32> %acc, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) { | ||
| ; CHECK-LABEL: udot: | ||
|
|
@@ -196,46 +198,31 @@ define <vscale x 4 x i64> @udot_8to64(<vscale x 4 x i64> %acc, <vscale x 16 x i8 | |
| ; CHECK-NEXT: add z1.d, z1.d, z3.d | ||
| ; CHECK-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-LABEL: udot_8to64: | ||
| ; CHECK-NEWLOWERING: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z4.h, z2.b | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z2.h, z2.b | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z5.h, z3.b | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z3.h, z3.b | ||
| ; CHECK-NEWLOWERING-NEXT: ptrue p0.d | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z6.s, z4.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z7.s, z2.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z24.s, z5.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z25.s, z3.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z4.s, z4.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z2.s, z2.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z5.s, z5.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z3.s, z3.h | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z26.d, z6.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z27.d, z7.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z28.d, z24.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z29.d, z25.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z6.d, z6.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z7.d, z7.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z24.d, z24.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z25.d, z25.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z26.d, z28.d | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z26.d, z4.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z28.d, z5.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z27.d, z29.d | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z27.d, z2.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpklo z29.d, z3.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z4.d, z4.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z2.d, z2.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z5.d, z5.s | ||
| ; CHECK-NEWLOWERING-NEXT: uunpkhi z3.d, z3.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z6.d, z24.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z7.d, z25.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z26.d, z28.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z27.d, z29.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z4.d, z5.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z2.d, z3.d | ||
| ; CHECK-NEWLOWERING-NEXT: ret | ||
| ; CHECK-NEWLOWERING-SVE-LABEL: udot_8to64: | ||
| ; CHECK-NEWLOWERING-SVE: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: movi v4.2d, #0000000000000000 | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: udot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: uunpkhi z2.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: uunpklo z3.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: add z2.d, z3.d, z2.d | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: add z0.d, z0.d, z2.d | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-SVE2-LABEL: udot_8to64: | ||
| ; CHECK-NEWLOWERING-SVE2: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: movi v4.2d, #0000000000000000 | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: udot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: uaddwb z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: uaddwt z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-SME-LABEL: udot_8to64: | ||
| ; CHECK-NEWLOWERING-SME: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SME-NEXT: mov z4.s, #0 // =0x0 | ||
| ; CHECK-NEWLOWERING-SME-NEXT: udot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SME-NEXT: uaddwb z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SME-NEXT: uaddwt z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SME-NEXT: ret | ||
| entry: | ||
| %a.wide = zext <vscale x 16 x i8> %a to <vscale x 16 x i64> | ||
| %b.wide = zext <vscale x 16 x i8> %b to <vscale x 16 x i64> | ||
|
|
@@ -256,46 +243,31 @@ define <vscale x 4 x i64> @sdot_8to64(<vscale x 4 x i64> %acc, <vscale x 16 x i8 | |
| ; CHECK-NEXT: add z1.d, z1.d, z3.d | ||
| ; CHECK-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-LABEL: sdot_8to64: | ||
| ; CHECK-NEWLOWERING: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z4.h, z2.b | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z2.h, z2.b | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z5.h, z3.b | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z3.h, z3.b | ||
| ; CHECK-NEWLOWERING-NEXT: ptrue p0.d | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z6.s, z4.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z7.s, z2.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z24.s, z5.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z25.s, z3.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z4.s, z4.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z2.s, z2.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z5.s, z5.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z3.s, z3.h | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z26.d, z6.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z27.d, z7.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z28.d, z24.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z29.d, z25.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z6.d, z6.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z7.d, z7.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z24.d, z24.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z25.d, z25.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z26.d, z28.d | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z26.d, z4.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z28.d, z5.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z27.d, z29.d | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z27.d, z2.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpklo z29.d, z3.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z4.d, z4.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z2.d, z2.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z5.d, z5.s | ||
| ; CHECK-NEWLOWERING-NEXT: sunpkhi z3.d, z3.s | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z6.d, z24.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z7.d, z25.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z26.d, z28.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z27.d, z29.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z1.d, p0/m, z4.d, z5.d | ||
| ; CHECK-NEWLOWERING-NEXT: mla z0.d, p0/m, z2.d, z3.d | ||
| ; CHECK-NEWLOWERING-NEXT: ret | ||
| ; CHECK-NEWLOWERING-SVE-LABEL: sdot_8to64: | ||
| ; CHECK-NEWLOWERING-SVE: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: movi v4.2d, #0000000000000000 | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: sdot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: sunpkhi z2.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: sunpklo z3.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: add z2.d, z3.d, z2.d | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: add z0.d, z0.d, z2.d | ||
| ; CHECK-NEWLOWERING-SVE-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-SVE2-LABEL: sdot_8to64: | ||
| ; CHECK-NEWLOWERING-SVE2: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: movi v4.2d, #0000000000000000 | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: sdot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: saddwb z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: saddwt z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SVE2-NEXT: ret | ||
| ; | ||
| ; CHECK-NEWLOWERING-SME-LABEL: sdot_8to64: | ||
| ; CHECK-NEWLOWERING-SME: // %bb.0: // %entry | ||
| ; CHECK-NEWLOWERING-SME-NEXT: mov z4.s, #0 // =0x0 | ||
| ; CHECK-NEWLOWERING-SME-NEXT: sdot z4.s, z2.b, z3.b | ||
| ; CHECK-NEWLOWERING-SME-NEXT: saddwb z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SME-NEXT: saddwt z0.d, z0.d, z4.s | ||
| ; CHECK-NEWLOWERING-SME-NEXT: ret | ||
| entry: | ||
| %a.wide = sext <vscale x 16 x i8> %a to <vscale x 16 x i64> | ||
| %b.wide = sext <vscale x 16 x i8> %b to <vscale x 16 x i64> | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.