From 45417a665fe1c7645a4c433aea832013e8fdd335 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Mon, 10 Nov 2014 21:17:23 +0000 Subject: [PATCH] AArch64: set all processor features from -arch if nothing else present Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural and tuning purposes. So if neither of the explicit options have been given, forward that on to the proper invocation. rdar://problem/18906227 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221631 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Tools.cpp | 6 ++++++ test/Preprocessor/aarch64-target-features.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index ca705c1433..042d7b1a0a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1794,6 +1794,9 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Features); else if ((A = Args.getLastArg(options::OPT_mcpu_EQ))) success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Features); + else if (Args.hasArg(options::OPT_arch)) + success = getAArch64ArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args), Args, + Features); if (success && (A = Args.getLastArg(options::OPT_mtune_EQ))) success = @@ -1801,6 +1804,9 @@ static void getAArch64TargetFeatures(const Driver &D, const ArgList &Args, else if (success && (A = Args.getLastArg(options::OPT_mcpu_EQ))) success = getAArch64MicroArchFeaturesFromMcpu(D, A->getValue(), Args, Features); + else if (Args.hasArg(options::OPT_arch)) + success = getAArch64MicroArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args), + Args, Features); if (!success) D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); diff --git a/test/Preprocessor/aarch64-target-features.c b/test/Preprocessor/aarch64-target-features.c index 74764c2693..4e9e6c7fde 100644 --- a/test/Preprocessor/aarch64-target-features.c +++ b/test/Preprocessor/aarch64-target-features.c @@ -73,6 +73,9 @@ // CHECK-MCPU-A53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" // CHECK-MCPU-A57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" +// RUN: %clang -target x86_64-apple-macosx -arch arm64 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-ARCH-ARM64 %s +// CHECK-ARCH-ARM64: "-target-cpu" "cyclone" "-target-feature" "+neon" "-target-feature" "+crc" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" + // RUN: %clang -target aarch64 -march=armv8-a+fp+simd+crc+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-1 %s // RUN: %clang -target aarch64 -march=armv8-a+nofp+nosimd+nocrc+nocrypto+fp+simd+crc+crypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-1 %s // RUN: %clang -target aarch64 -march=armv8-a+nofp+nosimd+nocrc+nocrypto -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-MARCH-2 %s -- 2.40.0