================
@@ -356,6 +356,34 @@ static bool updateFnegToFsub(Instruction &I,
return true;
}
+// DXIL has no floating-point atomic operation. A float exchange only moves the
+// bit pattern, so exchange an integer of the same width instead. Opaque
+// pointers keep the pointer operand type-agnostic, so only the value and the
+// result need a cast. This matches what DXC emits for groupshared memory.
+static bool
+legalizeFloatAtomicExchange(Instruction &I,
+ SmallVectorImpl<Instruction *> &ToRemove,
+ DenseMap<Value *, Value *> &) {
+ auto *AI = dyn_cast<AtomicRMWInst>(&I);
+ if (!AI || AI->getOperation() != AtomicRMWInst::Xchg)
+ return false;
+
+ Type *ValTy = AI->getValOperand()->getType();
+ if (!ValTy->isFloatingPointTy())
----------------
bob80905 wrote:
SemaHLSL should catch non-conformant types. But you're right that we could
catch illegal widths here, so I've added a width check right after this.
https://github.com/llvm/llvm-project/pull/222163
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits