[llvm] [WebAssembly,llvm] Add llvm.wasm.ref.test.func intrinsic, option 2 (PR #147486)

Hood Chatham via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 02:49:22 PDT 2025


================
@@ -402,7 +402,12 @@ void InstrEmitter::AddOperand(MachineInstrBuilder &MIB, SDValue Op,
     AddRegisterOperand(MIB, Op, IIOpNum, II, VRBaseMap,
                        IsDebug, IsClone, IsCloned);
   } else if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(Op)) {
-    MIB.addImm(C->getSExtValue());
+    if (C->getOpcode() == ISD::TargetConstantAP) {
+      MIB.addCImm(
+          ConstantInt::get(MF->getFunction().getContext(), C->getAPIntValue()));
+    } else {
+      MIB.addImm(C->getSExtValue());
+    }
----------------
hoodmane wrote:

If I swap it based on the bit width I will have to pad my ints to be always larger than 64 bits. But that does sound like the simplest way to go.

I'm not sure how I would use `EmitSpecialNode`, so if you could explain that further it'd be helpful. Or I can just go ahead with the bit width check.

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


More information about the llvm-commits mailing list