-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LV] Teach LoopVectorizationLegality about struct vector calls #119221
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
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
60ce37c
[LV] Teach LoopVectorizationLegality about struct vector calls
MacDue b2aed52
Rename test
MacDue 68574da
Fixups
MacDue e3cf243
Fix typo
MacDue ac07996
Fixups
MacDue b09f359
Fixups
MacDue 06eac2c
Fixups
MacDue 6313237
Fixups
MacDue fe16f8c
Update llvm/lib/IR/VectorTypeUtils.cpp
MacDue 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
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
97 changes: 97 additions & 0 deletions
97
llvm/test/Transforms/LoopVectorize/AArch64/scalable-struct-return.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,97 @@ | ||
; RUN: opt < %s -mattr=+sve -passes=loop-vectorize -force-vector-interleave=1 -prefer-predicate-over-epilogue=predicate-dont-vectorize -S -pass-remarks-analysis=loop-vectorize 2>%t | FileCheck %s | ||
; RUN: cat %t | FileCheck --check-prefix=CHECK-REMARKS %s | ||
|
||
target triple = "aarch64-unknown-linux-gnu" | ||
|
||
; Tests basic vectorization of scalable homogeneous struct literal returns. | ||
|
||
; TODO: Support vectorization in this case. | ||
; CHECK-REMARKS: remark: {{.*}} loop not vectorized: Auto-vectorization of calls that return struct types is not yet supported | ||
define void @struct_return_f32_widen(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) { | ||
; CHECK-LABEL: define void @struct_return_f32_widen | ||
; CHECK-NOT: vector.body: | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] | ||
%arrayidx = getelementptr inbounds float, ptr %in, i64 %iv | ||
%in_val = load float, ptr %arrayidx, align 4 | ||
%call = tail call { float, float } @foo(float %in_val) #0 | ||
%extract_a = extractvalue { float, float } %call, 0 | ||
%extract_b = extractvalue { float, float } %call, 1 | ||
%arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv | ||
store float %extract_a, ptr %arrayidx2, align 4 | ||
%arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv | ||
store float %extract_b, ptr %arrayidx4, align 4 | ||
%iv.next = add nuw nsw i64 %iv, 1 | ||
%exitcond.not = icmp eq i64 %iv.next, 1024 | ||
br i1 %exitcond.not, label %exit, label %for.body | ||
|
||
exit: | ||
ret void | ||
} | ||
|
||
; TODO: Support vectorization in this case. | ||
; CHECK-REMARKS: remark: {{.*}} loop not vectorized: Auto-vectorization of calls that return struct types is not yet supported | ||
define void @struct_return_f64_widen(ptr noalias %in, ptr noalias writeonly %out_a, ptr noalias writeonly %out_b) { | ||
; CHECK-LABEL: define void @struct_return_f64_widen | ||
; CHECK-NOT: vector.body: | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] | ||
%arrayidx = getelementptr inbounds double, ptr %in, i64 %iv | ||
%in_val = load double, ptr %arrayidx, align 8 | ||
%call = tail call { double, double } @bar(double %in_val) #1 | ||
%extract_a = extractvalue { double, double } %call, 0 | ||
%extract_b = extractvalue { double, double } %call, 1 | ||
%arrayidx2 = getelementptr inbounds double, ptr %out_a, i64 %iv | ||
store double %extract_a, ptr %arrayidx2, align 8 | ||
%arrayidx4 = getelementptr inbounds double, ptr %out_b, i64 %iv | ||
store double %extract_b, ptr %arrayidx4, align 8 | ||
%iv.next = add nuw nsw i64 %iv, 1 | ||
%exitcond.not = icmp eq i64 %iv.next, 1024 | ||
br i1 %exitcond.not, label %exit, label %for.body | ||
|
||
exit: | ||
ret void | ||
} | ||
|
||
; TODO: Support vectorization in this case. | ||
; CHECK-REMARKS: remark: {{.*}} loop not vectorized: Auto-vectorization of calls that return struct types is not yet supported | ||
define void @struct_return_f32_widen_rt_checks(ptr %in, ptr writeonly %out_a, ptr writeonly %out_b) { | ||
; CHECK-LABEL: define void @struct_return_f32_widen_rt_checks | ||
; CHECK-NOT: vector.body: | ||
entry: | ||
br label %for.body | ||
|
||
for.body: | ||
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ] | ||
%arrayidx = getelementptr inbounds float, ptr %in, i64 %iv | ||
%in_val = load float, ptr %arrayidx, align 4 | ||
%call = tail call { float, float } @foo(float %in_val) #0 | ||
%extract_a = extractvalue { float, float } %call, 0 | ||
%extract_b = extractvalue { float, float } %call, 1 | ||
%arrayidx2 = getelementptr inbounds float, ptr %out_a, i64 %iv | ||
store float %extract_a, ptr %arrayidx2, align 4 | ||
%arrayidx4 = getelementptr inbounds float, ptr %out_b, i64 %iv | ||
store float %extract_b, ptr %arrayidx4, align 4 | ||
%iv.next = add nuw nsw i64 %iv, 1 | ||
%exitcond.not = icmp eq i64 %iv.next, 1024 | ||
br i1 %exitcond.not, label %exit, label %for.body | ||
|
||
exit: | ||
ret void | ||
} | ||
|
||
declare { float, float } @foo(float) | ||
declare { double, double } @bar(double) | ||
|
||
declare { <vscale x 4 x float>, <vscale x 4 x float> } @scalable_vec_masked_foo(<vscale x 4 x float>, <vscale x 4 x i1>) | ||
declare { <vscale x 2 x double>, <vscale x 2 x double> } @scalable_vec_masked_bar(<vscale x 2 x double>, <vscale x 2 x i1>) | ||
|
||
|
||
attributes #0 = { nounwind "vector-function-abi-variant"="_ZGVsMxv_foo(scalable_vec_masked_foo)" } | ||
attributes #1 = { nounwind "vector-function-abi-variant"="_ZGVsMxv_bar(scalable_vec_masked_bar)" } |
Oops, something went wrong.
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.