diff options
author | Christoph Müllner <christoph.muellner@vrull.eu> | 2024-07-06 17:03:18 +0200 |
---|---|---|
committer | Christoph Müllner <christoph.muellner@vrull.eu> | 2024-07-15 19:06:41 +0200 |
commit | 61c21a719e205f70bd046c6a0275d1a3fd6341a4 (patch) | |
tree | 834d490f4d4012f225c1c388ecd5054e83d83982 /libcpp | |
parent | aa8e2de78cae4dca7f9b0efe0685f3382f9ecb9a (diff) | |
download | gcc-61c21a719e205f70bd046c6a0275d1a3fd6341a4.zip gcc-61c21a719e205f70bd046c6a0275d1a3fd6341a4.tar.gz gcc-61c21a719e205f70bd046c6a0275d1a3fd6341a4.tar.bz2 |
RISC-V: Allow adding enabled extension via target arch attributes
The set of enabled extensions can be extended via target arch function
attributes by listing each extension with a '+' prefix and a comma as
list separator. E.g.:
__attribute__((target("arch=+zba,+zbb"))) void foo();
The programmer intends to ensure that one or more extensions
are enabled when building the code. This is independent of the arch
string that is passed at build time via the -march= option.
Therefore, it is reasonable to allow enabling extensions via target arch
attributes, which have already been enabled via the -march= string.
The subset list code already supports such duplication for implied
extensions. This patch adds an interface so the subset list
parser can be switched into a mode where duplication is allowed.
This commit fixes the following regressed test cases:
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-39.c
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-42.c
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-43.c
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-44.c
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-45.c
* gcc.target/riscv/rvv/base/target_attribute_v_with_intrinsic-46.c
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc (riscv_subset_list::add):
Allow adding enabled extension if m_allow_adding_dup is set.
* config/riscv/riscv-subset.h: Add m_allow_adding_dup and setter.
* config/riscv/riscv-target-attr.cc (riscv_target_attr_parser::parse_arch):
Allow adding enabled extensions.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/pr115554.c: Change expected fail to expected pass.
* gcc.target/riscv/target-attr-16.c: New test.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Diffstat (limited to 'libcpp')
0 files changed, 0 insertions, 0 deletions