summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets.cpp
diff options
context:
space:
mode:
authorKevin Qin <Kevin.Qin@arm.com>2014-06-11 01:42:16 +0000
committerKevin Qin <Kevin.Qin@arm.com>2014-06-11 01:42:16 +0000
commitafd884718962dc65ce0237d33af3073c9a16104f (patch)
tree88c697d4e6036e5a5f43e1766ddc4883fb9a4a3d /clang/lib/Basic/Targets.cpp
parent936d5205bbc4b11ff32cd4e43e3306ad6720c621 (diff)
downloadbcm5719-llvm-afd884718962dc65ce0237d33af3073c9a16104f.tar.gz
bcm5719-llvm-afd884718962dc65ce0237d33af3073c9a16104f.zip
[AArch64] Add default features for CPUs on AArch64 target.
For ARM target, we can use CRYPTO and CRC features if we select cortex-a57 by '-mcpu', but for AArch64 target, it doesn't work unless adding with '-mfpu=crypto-neon-fp-armv8'. To keep consistency between front-end and back-end and get end-users more easier to use, we'd better add default feature for CPUs on AArch64 target as well. llvm-svn: 210625
Diffstat (limited to 'clang/lib/Basic/Targets.cpp')
-rw-r--r--clang/lib/Basic/Targets.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index e88cb9e7280..e13d7a0a4fa 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -4243,6 +4243,7 @@ class AArch64TargetInfo : public TargetInfo {
NeonMode
};
+ std::string CPU;
unsigned FPU;
unsigned CRC;
unsigned Crypto;
@@ -4302,6 +4303,8 @@ public:
.Cases("cortex-a53", "cortex-a57", true)
.Case("cyclone", true)
.Default(false);
+ if (CPUKnown)
+ CPU = Name;
return CPUKnown;
}
@@ -4373,6 +4376,23 @@ public:
(Feature == "neon" && FPU == NeonMode);
}
+ void getDefaultFeatures(llvm::StringMap<bool> &Features) const override {
+
+ if (CPU == "cyclone") {
+ Features["fp-armv8"] = true;
+ Features["neon"] = true;
+ Features["crypto"] = true;
+ Features["crc"] = true;
+ Features["zcm"] = true;
+ Features["zcz"] = true;
+ } else if (CPU == "cortex-a53" || CPU == "cortex-a57") {
+ Features["fp-armv8"] = true;
+ Features["neon"] = true;
+ Features["crypto"] = true;
+ Features["crc"] = true;
+ }
+}
+
bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) override {
FPU = FPUMode;
OpenPOWER on IntegriCloud