Skip to content

Commit ac507be

Browse files
committed
AArch64: add architecture version feature to Clang invocation.
Otherwise we don't get the correct predefines and so on in the front-end (or the right features in the backend). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289692 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 16aa35a commit ac507be

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lib/Driver/Tools.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2527,9 +2527,11 @@ static bool DecodeAArch64Mcpu(const Driver &D, StringRef Mcpu, StringRef &CPU,
25272527
Features.push_back("+neon");
25282528
} else {
25292529
unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU);
2530-
unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU, ArchKind);
2530+
if (!llvm::AArch64::getArchFeatures(ArchKind, Features))
2531+
return false;
25312532

2532-
if (!llvm::AArch64::getExtensionFeatures(Extersion, Features))
2533+
unsigned Extension = llvm::AArch64::getDefaultExtensions(CPU, ArchKind);
2534+
if (!llvm::AArch64::getExtensionFeatures(Extension, Features))
25332535
return false;
25342536
}
25352537

test/Driver/aarch64-cpus.c

+11-7
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,20 @@
157157
// RUN: %clang -target aarch64 -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
158158
// RUN: %clang -target aarch64 -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
159159
// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
160-
// RUN: %clang -target aarch64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
161-
// RUN: %clang -target aarch64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
162-
// RUN: %clang -target aarch64_be -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s
163-
// VULCAN: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "vulcan"
160+
// RUN: %clang -target aarch64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s
161+
// RUN: %clang -target aarch64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s
162+
// RUN: %clang -target aarch64_be -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s
163+
// VULCAN: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "vulcan" "-target-feature" "+v8.1a"
164+
// VULCAN-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "vulcan"
165+
// VULCAN-TUNE-NOT: +v8.1a
164166

165167
// RUN: %clang -target arm64 -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s
166168
// RUN: %clang -target arm64 -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s
167-
// RUN: %clang -target arm64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s
168-
// RUN: %clang -target arm64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s
169-
// ARM64-VULCAN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "vulcan"
169+
// RUN: %clang -target arm64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN-TUNE %s
170+
// RUN: %clang -target arm64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN-TUNE %s
171+
// ARM64-VULCAN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "vulcan" "-target-feature" "+v8.1a"
172+
// ARM64-VULCAN-TUNE: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "vulcan"
173+
// ARM64-VULCAN-TUNE-NOT: +v8.1a
170174

171175
// RUN: %clang -target aarch64_be -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s
172176
// RUN: %clang -target aarch64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s

0 commit comments

Comments
 (0)