[flang-commits] [flang] [llvm] [mlir] [OpenMPIRBuilder] Emit __atomic_load and __atomic_compare_exchange libcalls for complex types in atomic update (PR #92364)

via flang-commits flang-commits at lists.llvm.org
Fri Sep 27 01:08:35 PDT 2024


================
@@ -7943,6 +7943,83 @@ Value *OpenMPIRBuilder::emitRMWOpAsInstruction(Value *Src1, Value *Src2,
   llvm_unreachable("Unsupported atomic update operation");
 }
 
+std::pair<llvm::LoadInst *, llvm::AllocaInst *>
+OpenMPIRBuilder::EmitAtomicLoadLibcall(Value *X, Type *XElemTy,
+                                       llvm::AtomicOrdering AO,
+                                       uint64_t AtomicSizeInBits) {
+  LLVMContext &Ctx = Builder.getContext();
+  Type *SizedIntTy = Type::getIntNTy(Ctx, AtomicSizeInBits * 8);
----------------
NimishMishra wrote:

Thanks for your review @tblah. 

@Meinersbur also suggested to let the atomic libcall codegen reside in the Frontend, since that is much cleaner. I have addressed your comments, but the code has shifted. I am detailing where the modified code changes in response to your review reside.

`Type *SizedIntTy = Type::getIntNTy(Ctx, getAtomicSizeInBits());` will indeed take the size in bits. This now resides in `EmitAtomicLoadLibcall` in `Atomic.h`

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


More information about the flang-commits mailing list