[PATCH] D34686: [AArch64] Add hasFP16VectorArithmetic helper function. NFCI
Sjoerd Meijer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 27 07:20:45 PDT 2017
SjoerdMeijer created this revision.
Herald added subscribers: kristof.beyls, aemerson.
This is a clean-up for different ARMV8-A architecture kinds. Helper function hasFP16VectorArithmetic makes things a bit more “scalable” if we want to add ARMv8.3 at some point.
https://reviews.llvm.org/D34686
Files:
lib/Basic/Targets.cpp
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6186,9 +6186,8 @@
unsigned CRC;
unsigned Crypto;
unsigned Unaligned;
- unsigned V8_1A;
- unsigned V8_2A;
unsigned HasFullFP16;
+ unsigned ArchKind;
static const Builtin::Info BuiltinInfo[];
@@ -6254,6 +6253,18 @@
static_cast<unsigned>(llvm::AArch64::ArchKind::AK_INVALID);
}
+ bool hasFP16VectorArithmetic() const {
+ if (FPU != NeonMode || !HasFullFP16)
+ return false;
+
+ switch(ArchKind) {
+ default:
+ return false;
+ case llvm::ARM::AK_ARMV8_2A:
+ return true;
+ }
+ }
+
void getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const override {
// Target identification.
@@ -6318,9 +6329,10 @@
if (Unaligned)
Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
- if (V8_1A)
+ if (ArchKind == llvm::ARM::AK_ARMV8_1A)
Builder.defineMacro("__ARM_FEATURE_QRDMX", "1");
- if (V8_2A && FPU == NeonMode && HasFullFP16)
+
+ if (hasFP16VectorArithmetic())
Builder.defineMacro("__ARM_FEATURE_FP16_VECTOR_ARITHMETIC", "1");
// All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work.
@@ -6348,9 +6360,8 @@
CRC = 0;
Crypto = 0;
Unaligned = 1;
- V8_1A = 0;
- V8_2A = 0;
HasFullFP16 = 0;
+ ArchKind = llvm::ARM::AK_INVALID;
for (const auto &Feature : Features) {
if (Feature == "+neon")
@@ -6362,9 +6373,9 @@
if (Feature == "+strict-align")
Unaligned = 0;
if (Feature == "+v8.1a")
- V8_1A = 1;
+ ArchKind = llvm::ARM::AK_ARMV8_1A;
if (Feature == "+v8.2a")
- V8_2A = 1;
+ ArchKind = llvm::ARM::AK_ARMV8_2A;
if (Feature == "+fullfp16")
HasFullFP16 = 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34686.104159.patch
Type: text/x-patch
Size: 1899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170627/ab1e7922/attachment.bin>
More information about the cfe-commits
mailing list