[clang] [Clang][AArch64] Fixed incorrect _BitInt alignment (PR #90602)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 09:14:03 PDT 2024


================
@@ -518,6 +518,16 @@ class TargetInfo : public TransferrableTargetInfo,
   /// getInt128Align() - Returns the alignment of Int128.
   unsigned getInt128Align() const { return Int128Align; }
 
+  /// getBitIntAlign/Width - Return aligned size of '_BitInt' and
+  /// 'unsigned _BitInt' for this target, in bits.
+  unsigned getBitIntWidth(unsigned NumBits) const {
+    return llvm::alignTo(NumBits, getBitIntAlign(NumBits));
+  }
+  virtual unsigned getBitIntAlign(unsigned NumBits) const {
----------------
efriedma-quic wrote:

```
unsigned getBitIntMaxAlign() {
  return BitIntMaxAlign.or(LongLongAlign);
}
unsigned getBitIntAlign(unsigned NumBits) const {
    return std::clamp<unsigned>(llvm::PowerOf2Ceil(NumBits), getCharWidth(),
                                getBitIntMaxAlign());
}
```

https://github.com/llvm/llvm-project/pull/90602


More information about the cfe-commits mailing list