[clang] [CIR] Add support for storing into _Atomic variables (PR #165872)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 4 11:14:41 PST 2025
================
@@ -215,6 +229,34 @@ bool AtomicInfo::emitMemSetZeroIfNecessary() const {
return false;
}
+/// Return true if \param valueTy is a type that should be casted to integer
+/// around the atomic memory operation. If \param cmpxchg is true, then the
+/// cast of a floating point type is made as that instruction can not have
+/// floating point operands. TODO: Allow compare-and-exchange and FP - see
+/// comment in CIRGenAtomicExpandPass.cpp.
+static bool shouldCastToInt(mlir::Type valueTy, bool cmpxchg) {
+ if (cir::isAnyFloatingPointType(valueTy))
+ return isa<cir::FP80Type>(valueTy) || cmpxchg;
----------------
bcardosolopes wrote:
that sounds fair, thanks!
https://github.com/llvm/llvm-project/pull/165872
More information about the cfe-commits
mailing list