[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)
Momchil Velikov via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 08:34:39 PDT 2024
================
@@ -1774,6 +1774,18 @@ llvm::Constant *ConstantEmitter::emitForMemory(CodeGenModule &CGM,
return Res;
}
+ if (const auto *BIT = destType->getAs<BitIntType>()) {
+ if (BIT->getNumBits() > 128) {
+ // Long _BitInt has array of bytes as in-memory type.
+ ConstantAggregateBuilder Builder(CGM);
+ llvm::Type *DesiredTy = CGM.getTypes().ConvertTypeForMem(destType);
+ auto *CI = cast<llvm::ConstantInt>(C);
----------------
momchil-velikov wrote:
How about a "small" `_BitInt` ? The comment starts
> // LLVM type doesn't match AST type only for big enough _BitInts,
and for AArch32 and AArch64 we are going to have a non-matching LLVM types even for "small" `_BitInt`s - for AArch32 because the ABI wants the padding bing in-memory representation to contain zero or the sign-bit, and for both we'd like to emit loads/stores in bigger chunks, e.g. `i17` is a single `i32` load store, as opposed to two separate accesses to `i16` and `i8`.
https://github.com/llvm/llvm-project/pull/91364
More information about the cfe-commits
mailing list