[llvm-branch-commits] [llvm] [AtomicExpand] Add bitcasts when expanding load atomic vector (PR #120716)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jan 22 00:53:15 PST 2025
================
@@ -2060,9 +2060,28 @@ bool AtomicExpandImpl::expandAtomicOpToLibcall(
I->replaceAllUsesWith(V);
} else if (HasResult) {
Value *V;
- if (UseSizedLibcall)
- V = Builder.CreateBitOrPointerCast(Result, I->getType());
- else {
+ if (UseSizedLibcall) {
+ // Add bitcasts from Result's T scalar type to I's <2 x T/2> vector type
+ if (I->getType()->getScalarType()->isIntOrPtrTy() &&
+ I->getType()->isVectorTy() && !Result->getType()->isVectorTy()) {
+ TypeSize Size = Result->getType()->getPrimitiveSizeInBits();
+ assert((unsigned)Size % 2 == 0);
+ unsigned HalfSize = (unsigned)Size / 2;
----------------
arsenm wrote:
bitcast i128 to <2 x ptr> and then inttoptr <2 x i64> to <2 x ptr>?
https://github.com/llvm/llvm-project/pull/120716
More information about the llvm-branch-commits
mailing list