[clang] [libclc] Clang: Deprecate float support from __builtin_elementwise_max (PR #180885)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 26 06:49:33 PST 2026
================
@@ -3558,11 +3558,38 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
TheCall, EltwiseBuiltinArgTyRestriction::IntegerTy))
return ExprError();
break;
- case Builtin::BI__builtin_elementwise_min:
- case Builtin::BI__builtin_elementwise_max:
+ case Builtin::BI__builtin_elementwise_min: {
if (BuiltinElementwiseMath(TheCall))
return ExprError();
+ Expr *Arg0 = TheCall->getArg(0);
+ Expr *Arg1 = TheCall->getArg(1);
+ QualType Ty0 = Arg0->getType();
+ QualType Ty1 = Arg1->getType();
+ const VectorType *VecTy0 = Ty0->getAs<VectorType>();
+ const VectorType *VecTy1 = Ty1->getAs<VectorType>();
+ if (Ty0->isFloatingType() || Ty1->isFloatingType() ||
+ (VecTy0 && VecTy0->getElementType()->isFloatingType()) ||
+ (VecTy1 && VecTy1->getElementType()->isFloatingType()))
+ Diag(TheCall->getBeginLoc(), diag::warn_deprecated_builtin_no_suggestion)
+ << "__builtin_elementwise_min";
----------------
AaronBallman wrote:
Sorry for missing this earlier, but you can use `getASTContext().BuiltinInfo.getQuotedName()` to get the name of the builtin from its ID instead of passing in the string explicitly. If you use that, I think you can combine the checking for min and max again and reduce a lot of duplication.
https://github.com/llvm/llvm-project/pull/180885
More information about the cfe-commits
mailing list