-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NFC][AArch64] Tests for guarding unrolling with scalable vec ins/ext #81132
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 4 commits into
main
from
users/huntergr-arm/spr/scalable-subvec-ins-ext-cost-tests
Feb 19, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d25b58f
[NFC][AArch64] Precommit tests for guarding unrolling with scalable s…
huntergr-arm 4047162
Add direct cost model tests, remove negative case from unroll test
huntergr-arm c734bdc
Add tests with predicate types, change vector params to undef
huntergr-arm e939d4b
Add a test to extract a fixed width predicate from a scalable predicate
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
63 changes: 63 additions & 0 deletions
63
llvm/test/Transforms/LoopUnroll/AArch64/scalable-vec-ins-ext.ll
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,63 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3 | ||
; RUN: opt -passes=loop-unroll,simplifycfg -S -mtriple aarch64 %s | FileCheck %s | ||
|
||
;; This test contains IR similar to what would be generated when SVE ACLE | ||
;; routines are used with fixed-width vector types -- lots of subvector inserts | ||
;; and extracts that are effectively just bitcasts since the types are the | ||
;; same at a given SVE bit size. We want to make sure that they are not a | ||
;; barrier to unrolling simple loops with a fixed trip count which could be | ||
;; further optimized. | ||
|
||
define void @test_ins_ext_cost(ptr readonly %a, ptr readonly %b, ptr readonly %c, ptr noalias %d) #0 { | ||
; CHECK-LABEL: define void @test_ins_ext_cost( | ||
; CHECK-SAME: ptr readonly [[A:%.*]], ptr readonly [[B:%.*]], ptr readonly [[C:%.*]], ptr noalias [[D:%.*]]) #[[ATTR0:[0-9]+]] { | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: br label [[FOR_BODY:%.*]] | ||
; CHECK: for.body: | ||
; CHECK-NEXT: [[EXIT_COND:%.*]] = phi i1 [ true, [[ENTRY:%.*]] ], [ false, [[FOR_BODY]] ] | ||
; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, [[ENTRY]] ], [ 1, [[FOR_BODY]] ] | ||
; CHECK-NEXT: [[GEP_A:%.*]] = getelementptr inbounds <8 x float>, ptr [[A]], i64 [[IV]] | ||
; CHECK-NEXT: [[LOAD_A:%.*]] = load <8 x float>, ptr [[GEP_A]], align 16 | ||
; CHECK-NEXT: [[GEP_B:%.*]] = getelementptr inbounds <8 x float>, ptr [[B]], i64 [[IV]] | ||
; CHECK-NEXT: [[LOAD_B:%.*]] = load <8 x float>, ptr [[GEP_B]], align 16 | ||
; CHECK-NEXT: [[GEP_C:%.*]] = getelementptr inbounds <8 x float>, ptr [[C]], i64 [[IV]] | ||
; CHECK-NEXT: [[LOAD_C:%.*]] = load <8 x float>, ptr [[GEP_C]], align 16 | ||
; CHECK-NEXT: [[CAST_SCALABLE_B:%.*]] = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> [[LOAD_B]], i64 0) | ||
; CHECK-NEXT: [[CAST_SCALABLE_C:%.*]] = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> [[LOAD_C]], i64 0) | ||
; CHECK-NEXT: [[ADD:%.*]] = fadd <vscale x 4 x float> [[CAST_SCALABLE_B]], [[CAST_SCALABLE_C]] | ||
; CHECK-NEXT: [[CAST_SCALABLE_A:%.*]] = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> [[LOAD_A]], i64 0) | ||
; CHECK-NEXT: [[MUL:%.*]] = fmul <vscale x 4 x float> [[CAST_SCALABLE_A]], [[ADD]] | ||
; CHECK-NEXT: [[CAST_FIXED_D:%.*]] = tail call <8 x float> @llvm.vector.extract.v8f32.nxv4f32(<vscale x 4 x float> [[MUL]], i64 0) | ||
; CHECK-NEXT: [[GEP_D:%.*]] = getelementptr inbounds <8 x float>, ptr [[D]], i64 0, i64 [[IV]] | ||
; CHECK-NEXT: store <8 x float> [[CAST_FIXED_D]], ptr [[GEP_D]], align 16 | ||
; CHECK-NEXT: br i1 [[EXIT_COND]], label [[FOR_BODY]], label [[EXIT:%.*]] | ||
; CHECK: exit: | ||
; CHECK-NEXT: ret void | ||
; | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%exit.cond = phi i1 [ true, %entry ], [ false, %for.body ] | ||
%iv = phi i64 [ 0, %entry ], [ 1, %for.body ] | ||
%gep.a = getelementptr inbounds <8 x float>, ptr %a, i64 %iv | ||
%load.a = load <8 x float>, ptr %gep.a, align 16 | ||
%gep.b = getelementptr inbounds <8 x float>, ptr %b, i64 %iv | ||
%load.b = load <8 x float>, ptr %gep.b, align 16 | ||
%gep.c = getelementptr inbounds <8 x float>, ptr %c, i64 %iv | ||
%load.c = load <8 x float>, ptr %gep.c, align 16 | ||
%cast.scalable.b = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> %load.b, i64 0) | ||
%cast.scalable.c = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> %load.c, i64 0) | ||
%add = fadd <vscale x 4 x float> %cast.scalable.b, %cast.scalable.c | ||
%cast.scalable.a = tail call <vscale x 4 x float> @llvm.vector.insert.nxv4f32.v8f32(<vscale x 4 x float> undef, <8 x float> %load.a, i64 0) | ||
%mul = fmul <vscale x 4 x float> %cast.scalable.a, %add | ||
%cast.fixed.d = tail call <8 x float> @llvm.vector.extract.v8f32.nxv4f32(<vscale x 4 x float> %mul, i64 0) | ||
%gep.d = getelementptr inbounds <8 x float>, ptr %d, i64 0, i64 %iv | ||
store <8 x float> %cast.fixed.d, ptr %gep.d, align 16 | ||
br i1 %exit.cond, label %for.body, label %exit | ||
|
||
exit: | ||
ret void | ||
} | ||
|
||
attributes #0 = { "target-features"="+sve" vscale_range(2, 16) } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could you also add a test-case of extracting a fixed-length predicate from a scalable predicate, e.g.
<8 x i1>
from a<vscale x 8 x i1>
?