bryanpkc created this revision. bryanpkc added reviewers: sdesmalen, rsandifo-arm, david-arm. Herald added a subscriber: kristof.beyls. Herald added a project: All. bryanpkc requested review of this revision. Herald added subscribers: cfe-commits, MaskRay. Herald added a project: clang.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D142702 Files: clang/lib/Driver/ToolChains/Arch/AArch64.cpp clang/test/Driver/aarch64-implied-sme-features.c
Index: clang/test/Driver/aarch64-implied-sme-features.c =================================================================== --- /dev/null +++ clang/test/Driver/aarch64-implied-sme-features.c @@ -0,0 +1,55 @@ +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme %s -### 2>&1 | FileCheck %s --check-prefix=SME-IMPLY +// SME-IMPLY: "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+nosme %s -### 2>&1 | FileCheck %s --check-prefix=NOSME +// NOSME: "-target-feature" "-sme" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme+nosme %s -### 2>&1 | FileCheck %s --check-prefix=SME-REVERT +// SME-REVERT-NOT: "-target-feature" "+sme" +// SME-REVERT: "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "-sme" "-target-feature" "-sme-f64f64" "-target-feature" "-sme-i16i64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme+nosve %s -### 2>&1 | FileCheck %s --check-prefix=SME-CONFLICT +// SME-CONFLICT: "-target-feature" "-sve" "-target-feature" "-sve2" "-target-feature" "-sve2-bitperm" "-target-feature" "-sve2-sha3" "-target-feature" "-sve2-aes" "-target-feature" "-sve2-sm4" "-target-feature" "-sme" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme+sve %s -### 2>&1 | FileCheck %s --check-prefix=SME-SVE +// SME-SVE: "-target-feature" "+sme" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "+sve" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-i16i64 %s -### 2>&1 | FileCheck %s --check-prefix=SME-I16I64 +// SME-I16I64: "-target-feature" "+sme-i16i64" "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+nosme-i16i64 %s -### 2>&1 | FileCheck %s --check-prefix=NOSME-I16I64 +// NOSME-I16I64-NOT: "-target-feature" "+sme-i16i64" +// NOSME-I16I64-NOT: "-target-feature" "+sme" +// NOSME-I16I64-NOT: "-target-feature" "+sve" +// NOSME-I16I64-NOT: "-target-feature" "+sve2" +// NOSME-I16I64-NOT: "-target-feature" "+bf16" +// NOSME-I16I64: "-target-feature" "-sme-i16i64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-i16i64+nosme-i16i64 %s -### 2>&1 | FileCheck %s --check-prefix=SME-I16I64-REVERT +// SME-I16I64-REVERT: "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "-sme-i16i64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+nosme-f64f64 %s -### 2>&1 | FileCheck %s --check-prefix=NOSME-F64F64 +// NOSME-F64F64-NOT: "-target-feature" "+sme-f64f64" +// NOSME-F64F64-NOT: "-target-feature" "+sme" +// NOSME-F64F64-NOT: "-target-feature" "+sve" +// NOSME-F64F64-NOT: "-target-feature" "+sve2" +// NOSME-F64F64-NOT: "-target-feature" "+bf16" +// NOSME-F64F64: "-target-feature" "-sme-f64f64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-f64f64+nosme-f64f64 %s -### 2>&1 | FileCheck %s --check-prefix=SME-F64F64-REVERT +// SME-F64F64-REVERT: "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "-sme-f64f64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-f64f64+nosme-i16i64 %s -### 2>&1 | FileCheck %s --check-prefix=SME-SUBFEATURE-MIX +// SME-SUBFEATURE-MIX: "-target-feature" "+sme-f64f64" "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "-sme-i16i64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-i16i64+nosme %s -### 2>&1 | FileCheck %s --check-prefix=SME-SUBFEATURE-CONFLICT +// SME-SUBFEATURE-CONFLICT: "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" "-target-feature" "-sme" "-target-feature" "-sme-f64f64" "-target-feature" "-sme-i16i64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+sme-f64f64+nosve %s -### 2>&1 | FileCheck %s --check-prefix=SVE-SUBFEATURE-CONFLICT +// SVE-SUBFEATURE-CONFLICT-NOT: "-target-feature" "+sve2" +// SVE-SUBFEATURE-CONFLICT-NOT: "-target-feature" "+sve" +// SVE-SUBFEATURE-CONFLICT-NOT: "-target-feature" "+sme" +// SVE-SUBFEATURE-CONFLICT-NOT: "-target-feature" "+sme-f64f64" + +// RUN: %clang -target aarch64-linux-gnu -march=armv8-a+nosme+sme-i16i64 %s -### 2>&1 | FileCheck %s --check-prefix=SME-SUBFEATURE-CONFLICT-REV +// SME-SUBFEATURE-CONFLICT-REV: "-target-feature" "-sme-f64f64" "-target-feature" "+sme-i16i64" "-target-feature" "+sme" "-target-feature" "+sve" "-target-feature" "+sve2" "-target-feature" "+bf16" Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp =================================================================== --- clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -83,6 +83,27 @@ else return false; + // +sme implies +sve, +sve2 and +bf16. + // +sme-f64f64 and +sme-i16i64 both imply +sme. + if (Feature == "sme") { + Features.push_back("+sve"); + Features.push_back("+sve2"); + Features.push_back("+bf16"); + } else if (Feature == "nosme") { + Features.push_back("-sme-f64f64"); + Features.push_back("-sme-i16i64"); + } else if (Feature == "sme-f64f64") { + Features.push_back("+sme"); + Features.push_back("+sve"); + Features.push_back("+sve2"); + Features.push_back("+bf16"); + } else if (Feature == "sme-i16i64") { + Features.push_back("+sme"); + Features.push_back("+sve"); + Features.push_back("+sve2"); + Features.push_back("+bf16"); + } + if (Feature == "sve2") Features.push_back("+sve"); else if (Feature == "sve2-bitperm" || Feature == "sve2-sha3" || @@ -95,11 +116,17 @@ Features.push_back("-sve2-sha3"); Features.push_back("-sve2-aes"); Features.push_back("-sve2-sm4"); + Features.push_back("-sme"); + Features.push_back("-sme-f64f64"); + Features.push_back("-sme-i16i64"); } else if (Feature == "nosve2") { Features.push_back("-sve2-bitperm"); Features.push_back("-sve2-sha3"); Features.push_back("-sve2-aes"); Features.push_back("-sve2-sm4"); + Features.push_back("-sme"); + Features.push_back("-sme-f64f64"); + Features.push_back("-sme-i16i64"); } // +sve implies +f32mm if the base architecture is >= v8.6A (except v9A)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits