-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AArch64] Use dupq (SVE2.1) for segmented lane splats #144482
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
huntergr-arm
merged 9 commits into
llvm:main
from
huntergr-arm:segmented-lane-splat-codegen
Jun 18, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e848506
[AArch64] Use dupq for segmented lane splats (SVE 2.1)
huntergr-arm 5dd61ba
Add dupq sdnodes and patterns to match
huntergr-arm 5ffdce6
Lower to new sdnodes
huntergr-arm 1f05588
*Use optional result instead of reference argument
huntergr-arm 1fc5190
use end lane index in 8b test
huntergr-arm 31ee725
Formatting
huntergr-arm 6b380b0
Single loop
huntergr-arm ddcf5d5
Drop extra VT
huntergr-arm c512f9b
* Add assert to guard against 64b vectortypes
huntergr-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=aarch64-linux-gnu < %s | FileCheck %s | ||
|
||
define void @dupq_i8_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_i8_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: dupq z0.b, z0.b[15] | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <32 x i8>, ptr %addr | ||
%splat.lanes = shufflevector <32 x i8> %load, <32 x i8> poison, <32 x i32> <i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, i32 15, | ||
i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31, i32 31> | ||
store <32 x i8> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_i16_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_i16_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: dupq z0.h, z0.h[2] | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <16 x i16>, ptr %addr | ||
%splat.lanes = shufflevector <16 x i16> %load, <16 x i16> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, | ||
i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10> | ||
store <16 x i16> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_i32_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_i32_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: dupq z0.s, z0.s[3] | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <8 x i32>, ptr %addr | ||
%splat.lanes = shufflevector <8 x i32> %load, <8 x i32> poison, <8 x i32> <i32 3, i32 3, i32 3, i32 3, | ||
i32 7, i32 7, i32 7, i32 7> | ||
store <8 x i32> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_i64_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_i64_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: trn1 z0.d, z0.d, z0.d | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <4 x i64>, ptr %addr | ||
%splat.lanes = shufflevector <4 x i64> %load, <4 x i64> poison, <4 x i32> <i32 0, i32 0, i32 2, i32 2> | ||
store <4 x i64> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_f16_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_f16_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: dupq z0.h, z0.h[2] | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <16 x half>, ptr %addr | ||
%splat.lanes = shufflevector <16 x half> %load, <16 x half> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, | ||
i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10> | ||
store <16 x half> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_bf16_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_bf16_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldp q0, q1, [x0] | ||
; CHECK-NEXT: dup v0.8h, v0.h[2] | ||
; CHECK-NEXT: dup v1.8h, v1.h[2] | ||
paulwalker-arm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
; CHECK-NEXT: stp q0, q1, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <16 x bfloat>, ptr %addr | ||
%splat.lanes = shufflevector <16 x bfloat> %load, <16 x bfloat> poison, <16 x i32> <i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, i32 2, | ||
i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10, i32 10> | ||
store <16 x bfloat> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_f32_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_f32_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: dupq z0.s, z0.s[3] | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <8 x float>, ptr %addr | ||
%splat.lanes = shufflevector <8 x float> %load, <8 x float> poison, <8 x i32> <i32 3, i32 3, i32 3, i32 3, | ||
i32 7, i32 7, i32 7, i32 7> | ||
store <8 x float> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
define void @dupq_f64_256b(ptr %addr) #0 { | ||
; CHECK-LABEL: dupq_f64_256b: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr z0, [x0] | ||
; CHECK-NEXT: trn1 z0.d, z0.d, z0.d | ||
; CHECK-NEXT: str z0, [x0] | ||
; CHECK-NEXT: ret | ||
%load = load <4 x double>, ptr %addr | ||
%splat.lanes = shufflevector <4 x double> %load, <4 x double> poison, <4 x i32> <i32 0, i32 0, i32 2, i32 2> | ||
store <4 x double> %splat.lanes, ptr %addr | ||
ret void | ||
} | ||
|
||
attributes #0 = { noinline vscale_range(2,2) "target-features"="+sve2p1,+bf16" } |
Oops, something went wrong.
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.