[PATCH] D83079: [clang][aarch64] Generate preprocessor macros for -march=armv8.6a+sve.

Francesco Petrogalli via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 7 09:42:58 PDT 2020


fpetrogalli updated this revision to Diff 276106.
fpetrogalli added a comment.

Removed the unrelated change of the empty line.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83079/new/

https://reviews.llvm.org/D83079

Files:
  clang/lib/Driver/ToolChains/Arch/AArch64.cpp
  clang/test/Preprocessor/aarch64-target-features.c


Index: clang/test/Preprocessor/aarch64-target-features.c
===================================================================
--- clang/test/Preprocessor/aarch64-target-features.c
+++ clang/test/Preprocessor/aarch64-target-features.c
@@ -112,6 +112,12 @@
 // CHECK-SVE-F64MM: __ARM_FEATURE_SVE 1
 // CHECK-SVE-F64MM: __ARM_FEATURE_SVE_MATMUL_FP64 1
 
+// RUN: %clang -target aarch64-none-linux-gnu -march=armv8.6-a+sve -x c -E -dM %s -o - | FileCheck --check-prefix=CHECK-SVE-8_6 %s
+// CHECK-SVE-8_6: __ARM_FEATURE_SVE 1
+// CHECK-SVE-8_6: __ARM_FEATURE_SVE_BF16 1
+// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_FP32 1
+// CHECK-SVE-8_6: __ARM_FEATURE_SVE_MATMUL_INT8 1
+
 // The following tests may need to be revised in the future since
 // SVE2 is currently still part of Future Architecture Technologies
 // (https://developer.arm.com/docs/ddi0602/latest)
Index: clang/lib/Driver/ToolChains/Arch/AArch64.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -114,10 +114,16 @@
   std::pair<StringRef, StringRef> Split = StringRef(MarchLowerCase).split("+");
 
   llvm::AArch64::ArchKind ArchKind = llvm::AArch64::parseArch(Split.first);
-  if (ArchKind == llvm::AArch64::ArchKind::INVALID ||
-      !llvm::AArch64::getArchFeatures(ArchKind, Features) ||
-      (Split.second.size() &&
-       !DecodeAArch64Features(D, Split.second, Features, ArchKind)))
+
+  if (!llvm::AArch64::getArchFeatures(ArchKind, Features))
+    return false;
+
+  if (ArchKind == llvm::AArch64::ArchKind::ARMV8_6A) {
+    Features.push_back("+i8mm");
+    Features.push_back("+bf16");
+  }
+
+  if (!DecodeAArch64Features(D, Split.second, Features, ArchKind))
     return false;
 
   return true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83079.276106.patch
Type: text/x-patch
Size: 1794 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200707/f9447fac/attachment.bin>


More information about the cfe-commits mailing list