-
Notifications
You must be signed in to change notification settings - Fork 17.7k
[AArch64][compiler-rt] Add a function returning the current vector length #92921
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
Changes from 2 commits
1038d54
2baec75
75c2ae9
455bb3a
5edc405
6a0a1fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,8 @@ | |
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
|
||
| #include "../cpu_model/aarch64.c" | ||
|
|
||
| __attribute__((visibility("hidden"), nocommon)) | ||
| _Bool __aarch64_has_sme_and_tpidr2_el0; | ||
|
|
||
|
|
@@ -50,3 +52,24 @@ __attribute__((constructor(90))) | |
| static void init_aarch64_has_sme(void) { | ||
| __aarch64_has_sme_and_tpidr2_el0 = has_sme(); | ||
| } | ||
|
|
||
| #if __GNUC__ >= 9 | ||
| #pragma GCC diagnostic ignored "-Wprio-ctor-dtor" | ||
| #endif | ||
| __attribute__((constructor(90))) void get_aarch64_cpu_features(void) { | ||
| if (!__aarch64_cpu_features.features) | ||
| __init_cpu_features(); | ||
| } | ||
|
|
||
| __attribute__((target("sve"))) long emit_cntd(void) { | ||
|
Contributor
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.
|
||
| long vl; | ||
| __asm__ __volatile__("cntd %0" : "=r"(vl)); | ||
| return vl; | ||
| } | ||
|
|
||
| long get_runtime_vl(void) { | ||
|
Contributor
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. This probably should be prefixed with
Contributor
Author
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. Hi @efriedma-quic, I've added this routine to the ABI document in ARM-software/abi-aa#263 and renamed it to |
||
| if (__aarch64_cpu_features.features & (1ULL << FEAT_SVE)) | ||
| return emit_cntd(); | ||
| else | ||
| return 0; | ||
| } | ||
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.
cpu_model/aarch64.cisn't a header; including it seem wrong.