[llvm] [SPIRV] Lower load/store atomic to OpAtomicLoad/OpAtomicStore (PR #185696)

Viktoria Maximova via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 10:12:22 PDT 2026


================
@@ -32,4 +34,20 @@ bool SPIRVTypeInst::isTypeIntN(unsigned N) const {
     return MI->getOperand(1).getImm() == N;
   return true;
 }
+
+bool SPIRVTypeInst::isTypeFloat(unsigned Width,
+                                std::optional<unsigned> Encoding) const {
+  if (MI->getOpcode() != SPIRV::OpTypeFloat)
+    return false;
+  if (Width)
+    return MI->getOperand(1).getImm() == Width;
+  if (Encoding) {
+    if (MI->getNumOperands() < 3)
+      return false;
+    const MachineOperand &EO = MI->getOperand(2);
+    assert(EO.isImm() && "Encoding operand must be an immediate");
+    return EO.getImm() == *Encoding;
+  }
----------------
vmaksimo wrote:

Is checking by width/encoding planned for future use, or are these parameters unneeded? I see `isTypeFloat()` is only being called with default values.

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


More information about the llvm-commits mailing list