[llvm] [SPIRV] Addition of @llvm.lround.* and @llvm.llround.* intrinsic (PR #129240)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 10:33:07 PDT 2025


================
@@ -678,7 +684,26 @@ bool SPIRVInstructionSelector::spvSelect(Register ResVReg,
     return selectSUCmp(ResVReg, ResType, I, true);
   case TargetOpcode::G_UCMP:
     return selectSUCmp(ResVReg, ResType, I, false);
-
+  case TargetOpcode::G_LROUND:
+  case TargetOpcode::G_LLROUND: {
+    Register regForLround =
+        MRI->createVirtualRegister(MRI->getRegClass(ResVReg), "lround");
+    MRI->setRegClass(regForLround, &SPIRV::iIDRegClass);
+    GR.assignSPIRVTypeToVReg(GR.getSPIRVTypeForVReg(I.getOperand(1).getReg()),
+                             regForLround, *(I.getParent()->getParent()));
+    bool isRounded = selectExtInstForLRound(
----------------
MrSidims wrote:

Can it ever be false? if yes, we should prevent fallthrough 

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


More information about the llvm-commits mailing list