[PATCH] D64415: Consistent types and naming for AArch64 target features (NFC)

2019-07-17 Thread Momchil Velikov via Phabricator via cfe-commits
chill updated this revision to Diff 210286.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64415/new/

https://reviews.llvm.org/D64415

Files:
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/AArch64.h

Index: clang/lib/Basic/Targets/AArch64.h
===
--- clang/lib/Basic/Targets/AArch64.h
+++ clang/lib/Basic/Targets/AArch64.h
@@ -28,13 +28,14 @@
   enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
 
   unsigned FPU;
-  unsigned CRC;
-  unsigned Crypto;
-  unsigned Unaligned;
-  unsigned HasFullFP16;
-  unsigned HasDotProd;
-  unsigned HasFP16FML;
-  unsigned HasMTE;
+  bool HasCRC;
+  bool HasCrypto;
+  bool HasUnaligned;
+  bool HasFullFP16;
+  bool HasDotProd;
+  bool HasFP16FML;
+  bool HasMTE;
+
   llvm::AArch64::ArchKind ArchKind;
 
   static const Builtin::Info BuiltinInfo[];
Index: clang/lib/Basic/Targets/AArch64.cpp
===
--- clang/lib/Basic/Targets/AArch64.cpp
+++ clang/lib/Basic/Targets/AArch64.cpp
@@ -199,13 +199,13 @@
   if (FPU & SveMode)
 Builder.defineMacro("__ARM_FEATURE_SVE", "1");
 
-  if (CRC)
+  if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
-  if (Crypto)
+  if (HasCrypto)
 Builder.defineMacro("__ARM_FEATURE_CRYPTO", "1");
 
-  if (Unaligned)
+  if (HasUnaligned)
 Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
 
   if ((FPU & NeonMode) && HasFullFP16)
@@ -263,13 +263,13 @@
 bool AArch64TargetInfo::handleTargetFeatures(std::vector ,
  DiagnosticsEngine ) {
   FPU = FPUMode;
-  CRC = 0;
-  Crypto = 0;
-  Unaligned = 1;
-  HasFullFP16 = 0;
-  HasDotProd = 0;
-  HasFP16FML = 0;
-  HasMTE = 0;
+  HasCRC = false;
+  HasCrypto = false;
+  HasUnaligned = true;
+  HasFullFP16 = false;
+  HasDotProd = false;
+  HasFP16FML = false;
+  HasMTE = false;
   ArchKind = llvm::AArch64::ArchKind::ARMV8A;
 
   for (const auto  : Features) {
@@ -278,11 +278,11 @@
 if (Feature == "+sve")
   FPU |= SveMode;
 if (Feature == "+crc")
-  CRC = 1;
+  HasCRC = true;
 if (Feature == "+crypto")
-  Crypto = 1;
+  HasCrypto = true;
 if (Feature == "+strict-align")
-  Unaligned = 0;
+  HasUnaligned = false;
 if (Feature == "+v8.1a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
 if (Feature == "+v8.2a")
@@ -294,13 +294,13 @@
 if (Feature == "+v8.5a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
 if (Feature == "+fullfp16")
-  HasFullFP16 = 1;
+  HasFullFP16 = true;
 if (Feature == "+dotprod")
-  HasDotProd = 1;
+  HasDotProd = true;
 if (Feature == "+fp16fml")
-  HasFP16FML = 1;
+  HasFP16FML = true;
 if (Feature == "+mte")
-  HasMTE = 1;
+  HasMTE = true;
   }
 
   setDataLayout();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64415: Consistent types and naming for AArch64 target features (NFC)

2019-07-17 Thread Momchil Velikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366315: [AArch64] Consistent types and naming for AArch64 
target features (NFC) (authored by chill, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64415?vs=210286=210290#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64415/new/

https://reviews.llvm.org/D64415

Files:
  cfe/trunk/lib/Basic/Targets/AArch64.cpp
  cfe/trunk/lib/Basic/Targets/AArch64.h

Index: cfe/trunk/lib/Basic/Targets/AArch64.cpp
===
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp
@@ -199,13 +199,13 @@
   if (FPU & SveMode)
 Builder.defineMacro("__ARM_FEATURE_SVE", "1");
 
-  if (CRC)
+  if (HasCRC)
 Builder.defineMacro("__ARM_FEATURE_CRC32", "1");
 
-  if (Crypto)
+  if (HasCrypto)
 Builder.defineMacro("__ARM_FEATURE_CRYPTO", "1");
 
-  if (Unaligned)
+  if (HasUnaligned)
 Builder.defineMacro("__ARM_FEATURE_UNALIGNED", "1");
 
   if ((FPU & NeonMode) && HasFullFP16)
@@ -263,13 +263,13 @@
 bool AArch64TargetInfo::handleTargetFeatures(std::vector ,
  DiagnosticsEngine ) {
   FPU = FPUMode;
-  CRC = 0;
-  Crypto = 0;
-  Unaligned = 1;
-  HasFullFP16 = 0;
-  HasDotProd = 0;
-  HasFP16FML = 0;
-  HasMTE = 0;
+  HasCRC = false;
+  HasCrypto = false;
+  HasUnaligned = true;
+  HasFullFP16 = false;
+  HasDotProd = false;
+  HasFP16FML = false;
+  HasMTE = false;
   ArchKind = llvm::AArch64::ArchKind::ARMV8A;
 
   for (const auto  : Features) {
@@ -278,11 +278,11 @@
 if (Feature == "+sve")
   FPU |= SveMode;
 if (Feature == "+crc")
-  CRC = 1;
+  HasCRC = true;
 if (Feature == "+crypto")
-  Crypto = 1;
+  HasCrypto = true;
 if (Feature == "+strict-align")
-  Unaligned = 0;
+  HasUnaligned = false;
 if (Feature == "+v8.1a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_1A;
 if (Feature == "+v8.2a")
@@ -294,13 +294,13 @@
 if (Feature == "+v8.5a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
 if (Feature == "+fullfp16")
-  HasFullFP16 = 1;
+  HasFullFP16 = true;
 if (Feature == "+dotprod")
-  HasDotProd = 1;
+  HasDotProd = true;
 if (Feature == "+fp16fml")
-  HasFP16FML = 1;
+  HasFP16FML = true;
 if (Feature == "+mte")
-  HasMTE = 1;
+  HasMTE = true;
   }
 
   setDataLayout();
Index: cfe/trunk/lib/Basic/Targets/AArch64.h
===
--- cfe/trunk/lib/Basic/Targets/AArch64.h
+++ cfe/trunk/lib/Basic/Targets/AArch64.h
@@ -28,13 +28,14 @@
   enum FPUModeEnum { FPUMode, NeonMode = (1 << 0), SveMode = (1 << 1) };
 
   unsigned FPU;
-  unsigned CRC;
-  unsigned Crypto;
-  unsigned Unaligned;
-  unsigned HasFullFP16;
-  unsigned HasDotProd;
-  unsigned HasFP16FML;
-  unsigned HasMTE;
+  bool HasCRC;
+  bool HasCrypto;
+  bool HasUnaligned;
+  bool HasFullFP16;
+  bool HasDotProd;
+  bool HasFP16FML;
+  bool HasMTE;
+
   llvm::AArch64::ArchKind ArchKind;
 
   static const Builtin::Info BuiltinInfo[];
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64415: Consistent types and naming for AArch64 target features (NFC)

2019-07-16 Thread Momchil Velikov via Phabricator via cfe-commits
chill accepted this revision.
chill added a comment.
This revision is now accepted and ready to land.

Going to commit as obvious.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64415/new/

https://reviews.llvm.org/D64415



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D64415: Consistent types and naming for AArch64 target features (NFC)

2019-07-15 Thread Peter Smith via Phabricator via cfe-commits
peter.smith added a comment.

FWIW I think this looks reasonable. The ARM equivalent uses bitfields such as

  unsigned CRC : 1;
  unsigned Crypto : 1;
  unsigned DSP : 1;
  unsigned Unaligned : 1;
  unsigned DotProd : 1;

Which would make more sense than using unsigned for each individual field. 
Several other targets that I looked at used bool and the Has 
convention so I think this brings AArch64 more in line with non ARM Targets at 
the cost of losing a little coherence with ARM where the name Crypto remains. I 
don't think that this is particularly important as the two have already started 
to diverge with HasDotProd.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64415/new/

https://reviews.llvm.org/D64415



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits