================
@@ -5153,6 +5158,23 @@ static Value *upgradeAMDGCNIntrinsicCall(StringRef Name,
CallBase *CI,
}
}
+ if (Name.starts_with("fcmp.") || Name.starts_with("icmp.")) {
+ Value *LHS = CI->getArgOperand(0);
+ Value *RHS = CI->getArgOperand(1);
+ CmpInst::Predicate Pred = static_cast<CmpInst::Predicate>(
+ cast<ConstantInt>(CI->getArgOperand(2))->getZExtValue());
+ Value *Cmp = Builder.CreateCmp(Pred, LHS, RHS);
+ CallInst *NewCall = Builder.CreateIntrinsicWithoutFolding(
+ CI->getType(), Intrinsic::amdgcn_ballot, Cmp);
+ NewCall->setTailCallKind(cast<CallInst>(CI)->getTailCallKind());
+ NewCall->setCallingConv(CI->getCallingConv());
+ NewCall->setDebugLoc(CI->getDebugLoc());
+ NewCall->copyMetadata(*CI);
+ NewCall->takeName(CI);
+ // TODO: Copy per-argument attributes over to Cmp or NewCall as
appropriate.
----------------
arsenm wrote:
I'd drop the TODO, it will be done now or never and it's probably not worth the
trouble.
https://github.com/llvm/llvm-project/pull/208183
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits