[APInt] Add an isSplat helper and use it in some places.
[oota-llvm.git] / include / llvm / ADT / APInt.h
index 838c59dd617bf8a5c26f584afcef7fc76c9a67d5..36d8159d21ba08be1219911660033a66634264a6 100644 (file)
@@ -407,6 +407,13 @@ public:
                                                             : getZExtValue();
   }
 
+  /// \brief Check if the APInt consists of a repeated bit pattern.
+  ///
+  /// e.g. 0x01010101 satisfies isSplat(8).
+  /// \param SplatSizeInBits The size of the pattern in bits. Must divide bit
+  /// width without remainder.
+  bool isSplat(unsigned SplatSizeInBits) const;
+
   /// @}
   /// \name Value Generators
   /// @{