-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[clang][SME] Account for C++ lambdas in SME builtin diagnostics #124750
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
+73
−4
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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,47 @@ | ||
| // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve \ | ||
| // RUN: -target-feature +sme -target-feature +neon -x c++ -std=c++20 -Waarch64-sme-attributes -fsyntax-only -verify %s | ||
|
|
||
| // REQUIRES: aarch64-registered-target | ||
|
|
||
| #include <arm_sme.h> | ||
| #include <arm_neon.h> | ||
|
|
||
| void use_streaming_builtin_in_lambda(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming __arm_out("za") | ||
| { | ||
| [&]{ | ||
| /// The lambda is its own function and does not inherit the SME attributes (so this should error). | ||
| // expected-error@+1 {{builtin can only be called from a streaming function}} | ||
| svld1_hor_za64(0, slice_base, pg, ptr); | ||
| }(); | ||
| } | ||
|
|
||
| void use_streaming_builtin(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming __arm_out("za") | ||
| { | ||
| /// Without the lambda the same builtin is okay (as the SME attributes apply). | ||
| svld1_hor_za64(0, slice_base, pg, ptr); | ||
| } | ||
|
|
||
| int16x8_t use_neon_builtin_sm(int16x8_t splat) __arm_streaming_compatible { | ||
| // expected-error@+1 {{builtin can only be called from a non-streaming function}} | ||
| return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33); | ||
| } | ||
|
|
||
| int16x8_t use_neon_builtin_sm_in_lambda(int16x8_t splat) __arm_streaming_compatible { | ||
| return [&]{ | ||
| /// This should not error (as we switch out of streaming mode to execute the lambda). | ||
| /// Note: The result int16x8_t is spilled and reloaded as a q-register. | ||
| return (int16x8_t)__builtin_neon_vqaddq_v((int8x16_t)splat, (int8x16_t)splat, 33); | ||
| }(); | ||
| } | ||
|
|
||
| float use_incomp_sve_builtin_sm() __arm_streaming { | ||
| // expected-error@+1 {{builtin can only be called from a non-streaming function}} | ||
| return svadda(svptrue_b32(), 0, svdup_f32(1)); | ||
| } | ||
|
|
||
| float incomp_sve_sm_fadda_sm_in_lambda(void) __arm_streaming { | ||
| return [&]{ | ||
| /// This should work like the Neon builtin. | ||
| return svadda(svptrue_b32(), 0, svdup_f32(1)); | ||
| }(); | ||
| } | ||
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.