[llvm] [NVPTX] extend type support for nvvm.{min, max, mulhi, sad} (PR #78385)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 10:57:11 PST 2024


================
@@ -4132,19 +4133,21 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
       Value *Val = CI->getArgOperand(1);
       Rep = Builder.CreateAtomicRMW(AtomicRMWInst::FAdd, Ptr, Val, MaybeAlign(),
                                     AtomicOrdering::SequentiallyConsistent);
-    } else if (IsNVVM && (Name == "max.i" || Name == "max.ll" ||
-                          Name == "max.ui" || Name == "max.ull")) {
+    } else if (IsNVVM &&
+               (Name == "max.s" || Name == "max.i" || Name == "max.ll" ||
+                Name == "max.us" || Name == "max.ui" || Name == "max.ull")) {
       Value *Arg0 = CI->getArgOperand(0);
       Value *Arg1 = CI->getArgOperand(1);
-      Value *Cmp = Name.ends_with(".ui") || Name.ends_with(".ull")
+      Value *Cmp = Name.starts_with("max.u")
                        ? Builder.CreateICmpUGE(Arg0, Arg1, "max.cond")
                        : Builder.CreateICmpSGE(Arg0, Arg1, "max.cond");
       Rep = Builder.CreateSelect(Cmp, Arg0, Arg1, "max");
-    } else if (IsNVVM && (Name == "min.i" || Name == "min.ll" ||
-                          Name == "min.ui" || Name == "min.ull")) {
+    } else if (IsNVVM &&
+               (Name == "min.s" || Name == "min.i" || Name == "min.ll" ||
+                Name == "min.us" || Name == "min.ui" || Name == "min.ull")) {
----------------
Artem-B wrote:

Ditto.

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


More information about the llvm-commits mailing list