[clang] [llvm] [AArch64] Add ability to list extensions enabled for a target (PR #95805)

David Green via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 18 10:20:52 PDT 2024


================
@@ -19,3 +19,19 @@
 // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s
 // RUN: %clang --target=arm64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s
 // ARM64-GENERICV81A: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic"{{.*}} "-target-feature" "+v8.1a"{{.*}} "-target-feature" "+neon"
+
+// ===== Architecture extensions =====
+
+// RUN: %clang -target aarch64 -march=armv8.1-a --print-enabled-extensions 2>&1 | FileCheck -check-prefix=ARCH-EXTENSION --implicit-check-not FEAT_ %s
+// ARCH-EXTENSION: FEAT_ETE
+// ARCH-EXTENSION: FEAT_LOR
+// ARCH-EXTENSION: FEAT_TRBE
+// ARCH-EXTENSION: FEAT_VHE
+// ARCH-EXTENSION: FEAT_PAN
+// ARCH-EXTENSION: FEAT_CRC32
+// FIXME: FEAT_FP is optional from v8.0a
+// ARCH-EXTENSION: FEAT_FP
+// ARCH-EXTENSION: FEAT_LSE
+// ARCH-EXTENSION: FEAT_RDM
+// FIXME: FEAT_AdvSIMD is optional from v8.0a
----------------
davemgreen wrote:

There is a difference between what the Arm architecture technically describes as optional and what the platform enables by default (i.e. what we enable by default for the compiler in Armv8-a). We don't want everyone in the world to lose out on Neon vectorization and require soft-fp just because it is technically optional in the architecture. The same idea has been applied to SVE2 in Armv9 (although that one has become more debatable). Some of the other optional extensions seem like they might be system-register extensions, I imagine that might be why they are enabled. There might be a better way to handle that.

So I'm not sure if there is anything that needs to be "fixed" here, and think I would recommend removing them (especially from fp/asimd, the others are more debatable and could stay if you think they are useful).

https://github.com/llvm/llvm-project/pull/95805


More information about the cfe-commits mailing list