aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Triple.cpp
diff options
context:
space:
mode:
authorSimon Tatham <simon.tatham@arm.com>2021-04-21 11:19:37 +0100
committerSimon Tatham <simon.tatham@arm.com>2021-04-21 11:20:05 +0100
commit77e170db8678e582af986ffe27e12df196e4357b (patch)
tree63744257135feb4ee21573dcbb2066e0bb3c1e27 /llvm/lib/Support/Triple.cpp
parent08ce2ba518031425643ce3a4a0476f770c9b8dcd (diff)
downloadllvm-77e170db8678e582af986ffe27e12df196e4357b.zip
llvm-77e170db8678e582af986ffe27e12df196e4357b.tar.gz
llvm-77e170db8678e582af986ffe27e12df196e4357b.tar.bz2
[ARM][Driver][Windows] Allow command-line upgrade to Armv8.
If you gave clang the options `--target=arm-pc-windows-msvc` and `-march=armv8-a+crypto` together, the crypto extension would not be enabled in the compilation, and you'd see the following warning message suggesting that the 'armv8-a' had been ignored: clang: warning: ignoring extension 'crypto' because the 'armv7-a' architecture does not support it [-Winvalid-command-line-argument] This happens because Triple::getARMCPUForArch(), for the Win32 OS, unconditionally returns "cortex-a9" (an Armv7 CPU) regardless of MArch, which overrides the architecture setting on the command line. I don't think that the combination of Windows and AArch32 _should_ unconditionally outlaw the use of the crypto extension. MSVC itself doesn't think so: you can perfectly well compile Thumb crypto code using its AArch32-targeted compiler. All the other default CPUs in the same switch statement are conditional on a particular MArch setting; this is the only one that returns a particular CPU _regardless_ of MArch. So I've fixed this one by adding a condition, so that if you ask for an architecture *above* v7, the default of Cortex-A9 no longer overrides it. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D100937
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r--llvm/lib/Support/Triple.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 3c2182e..8831154 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -1716,7 +1716,9 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const {
break;
case llvm::Triple::Win32:
// FIXME: this is invalid for WindowsCE
- return "cortex-a9";
+ if (ARM::parseArchVersion(MArch) <= 7)
+ return "cortex-a9";
+ break;
case llvm::Triple::IOS:
case llvm::Triple::MacOSX:
case llvm::Triple::TvOS: