Skip to content

[FMV][AArch64] Add feature CSSC and detect on linux platform. #132727

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 5 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/test/CodeGen/AArch64/fmv-dependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ __attribute__((target_version("sve2-sm4"))) int fmv(void) { return 0; }
// CHECK: define dso_local i32 @fmv._Mwfxt() #[[wfxt:[0-9]+]] {
__attribute__((target_version("wfxt"))) int fmv(void) { return 0; }

// CHECK: define dso_local i32 @fmv._Mcssc() #[[cssc:[0-9]+]] {
__attribute__((target_version("cssc"))) int fmv(void) { return 0; }

// CHECK-NOT: define dso_local i32 @fmv._M{{.*}}
__attribute__((target_version("non_existent_extension"))) int fmv(void);

Expand Down Expand Up @@ -188,3 +191,4 @@ int caller() {
// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sha2,+sha3,+sve,+sve2,+sve2-sha3,+v8a"
// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sm4,+sve,+sve2,+sve2-sm4,+v8a"
// CHECK: attributes #[[wfxt]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a,+wfxt"
// CHECK: attributes #[[cssc]] = { {{.*}} "target-features"="+cssc,+fp-armv8,+neon,+outline-atomics,+v8a"
375 changes: 195 additions & 180 deletions clang/test/CodeGen/AArch64/fmv-detection.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion compiler-rt/lib/builtins/cpu_model/AArch64CPUFeatures.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum CPUFeatures {
FEAT_FP,
FEAT_SIMD,
FEAT_CRC,
RESERVED_FEAT_SHA1, // previously used and now ABI legacy
FEAT_CSSC,
FEAT_SHA2,
FEAT_SHA3,
RESERVED_FEAT_AES, // previously used and now ABI legacy
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/builtins/cpu_model/aarch64/fmv/mrs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ static void __init_cpu_features_constructor(unsigned long hwcap,
setCPUFeature(FEAT_SME_F64);
if (hwcap2 & HWCAP2_MOPS)
setCPUFeature(FEAT_MOPS);
if (hwcap2 & HWCAP2_CSSC)
setCPUFeature(FEAT_CSSC);
if (hwcap & HWCAP_FP) {
setCPUFeature(FEAT_FP);
// FP and AdvSIMD fields have the same value
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/builtins/cpu_model/aarch64/hwcap.inc
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,6 @@
#ifndef HWCAP2_LRCPC3
#define HWCAP2_LRCPC3 (1UL << 46)
#endif
#ifndef HWCAP2_CSSC
#define HWCAP2_CSSC (1UL << 34)
#endif
2 changes: 1 addition & 1 deletion llvm/include/llvm/TargetParser/AArch64CPUFeatures.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum CPUFeatures {
FEAT_FP,
FEAT_SIMD,
FEAT_CRC,
RESERVED_FEAT_SHA1, // previously used and now ABI legacy
FEAT_CSSC,
FEAT_SHA2,
FEAT_SHA3,
RESERVED_FEAT_AES, // previously used and now ABI legacy
Expand Down
5 changes: 2 additions & 3 deletions llvm/include/llvm/TargetParser/AArch64FeatPriorities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ enum FeatPriorities {
PRIOR_SME,
PRIOR_MEMTAG2,
PRIOR_SB,
PRIOR_PREDRES,
PRIOR_SSBS2,
PRIOR_BTI,
PRIOR_LS64_ACCDATA,
PRIOR_WFXT,
PRIOR_SME_F64,
PRIOR_SME_I64,
PRIOR_SME2,
PRIOR_MOPS
PRIOR_MOPS,
PRIOR_CSSC
};

#endif
1 change: 1 addition & 0 deletions llvm/lib/Target/AArch64/AArch64FMV.td
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ def : FMVExtension<"sve2-bitperm", "SVE_BITPERM">;
def : FMVExtension<"sve2-sha3", "SVE_SHA3">;
def : FMVExtension<"sve2-sm4", "SVE_SM4">;
def : FMVExtension<"wfxt", "WFXT">;
def : FMVExtension<"cssc", "CSSC">;