================
@@ -11935,16 +11967,16 @@ OpenMPIRBuilder::InsertPointTy 
OpenMPIRBuilder::createAtomicCompare(
         Builder.SetInsertPoint(&*ExitBB->getFirstNonPHIIt());
       }
 
-      OldValue = Builder.CreateBitCast(OldIntPHI, X.ElemTy,
-                                       X.Var->getName() + ".atomic.old.fp");
+      OldValue = castAtomicIntToFP(Builder, DL, OldIntPHI, X.ElemTy,
+                                   X.Var->getName() + ".atomic.old.fp");
       SuccessOrFail = SuccessPHI;
     } else {
       AtomicCmpXchgInst *Result = nullptr;
+      const DataLayout &DL = M.getDataLayout();
       if (!IsInteger) {
-        IntegerType *IntCastTy =
-            IntegerType::get(M.getContext(), X.ElemTy->getScalarSizeInBits());
-        Value *EBCast = Builder.CreateBitCast(E, IntCastTy);
-        Value *DBCast = Builder.CreateBitCast(D, IntCastTy);
+        IntegerType *IntCastTy = getAtomicIntTypeForFP(X.ElemTy, DL);
+        Value *EBCast = castFPToAtomicInt(Builder, DL, E, IntCastTy);
+        Value *DBCast = castFPToAtomicInt(Builder, DL, D, IntCastTy);
         Result = Builder.CreateAtomicCmpXchg(X.Var, EBCast, DBCast,
                                              MaybeAlign(), AO, Failure);
----------------
akash-manna-sky wrote:

Done. `AtomicOpValue` now carries the alignment of x, v and r, filled by Clang 
and used on the load, `cmpxchgs`, `atomicrmw` and captured stores. The packed 
member gets align 1, which `AtomicExpand` lowers to the 
`__atomic_compare_exchange libcall`. Added the packed long double `codegen` 
test and the `HandleFPNegZero` unit test with an `x86_fp80` aligned to 1. The 
other `create*` entry points don't use the alignment yet; Clang doesn't call 
them, so that's a follow-up.


https://github.com/llvm/llvm-project/pull/226567
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to