-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][AArch64] Add --print-supported-extensions support (#65466)
This follows the RISC-V work done in 4b40ced. This uses AArch64's target parser instead. We just list the names, without the "+" on them, which matches RISC-V's format. ``` $ ./bin/clang -target aarch64-linux-gnu --print-supported-extensions clang version 18.0.0 (https://github.com/llvm/llvm-project.git 154da8aec20719c82235a6957aa6e461f5a5e030) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: <...> All available -march extensions for AArch64 aes b16b16 bf16 brbe crc crypto cssc <...> ``` Since our extensions don't have versions in the same way there's just one column with the name in. Any extension without a feature name (including the special "none") is not listed as those cannot be passed to -march, they're just for the backend. For example the MTE extension can be added with "+memtag" but MTE2 and MTE3 do not have feature names so they cannot be added to -march. This does not attempt to tackle the fact that clang allows invalid combinations of AArch64 extensions, it simply lists the possible options. It's still up to the user to ask for something sensible. Equally, this has no context of what CPU is being selected. Neither does the RISC-V option, the user has to be aware of that. I've added a target parser test, and a high level clang test that checks RISC-V and AArch64 work and that Intel, that doesn't support this, shows the correct error.
- Loading branch information
1 parent
00add6e
commit 90db419
Showing
7 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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,14 @@ | ||
// Test that --print-supported-extensions lists supported -march extensions | ||
// on supported architectures, and errors on unsupported architectures. | ||
|
||
// RUN: %if aarch64-registered-target %{ %clang --target=aarch64-linux-gnu \ | ||
// RUN: --print-supported-extensions 2>&1 | FileCheck %s --check-prefix AARCH64 %} | ||
// AARCH64: All available -march extensions for AArch64 | ||
|
||
// RUN: %if aarch64-registered-target %{ %clang --target=riscv64-linux-gnu \ | ||
// RUN: --print-supported-extensions 2>&1 | FileCheck %s --check-prefix RISCV %} | ||
// RISCV: All available -march extensions for RISC-V | ||
|
||
// RUN: %if x86-registered-target %{ not %clang --target=x86_64-linux-gnu \ | ||
// RUN: --print-supported-extensions 2>&1 | FileCheck %s --check-prefix X86 %} | ||
// X86: error: option '--print-supported-extensions' cannot be specified on this target |
This file contains 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 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 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 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