[clang] [clang][sema] consolidate diags for incompatible_vector_* (PR #83609)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 1 12:55:28 PST 2024
================
@@ -5218,15 +5218,15 @@ bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
// Note: type promotion is intended to be handeled via the intrinsics
// and not the builtin itself.
S->Diag(TheCall->getBeginLoc(),
- diag::err_vec_builtin_incompatible_vector_all)
- << TheCall->getDirectCallee()
+ diag::err_vec_builtin_incompatible_vector)
+ << TheCall->getDirectCallee() << /*all args*/ true
<< SourceRange(A.get()->getBeginLoc(), B.get()->getEndLoc());
retValue = true;
}
if (VecTyA->getNumElements() != VecTyB->getNumElements()) {
// if we get here a HLSLVectorTruncation is needed.
----------------
farzonl wrote:
This case is when one vector is of a different size than another vector. There should have been a type promotion of the larger vector to truncate to the size of the smaller vector. The type promotion however only happens if you call `lerp(...)`, or `dot(...)` ie the api interface for hlsl intrinsics. Type promotions doesn't happen if you call the builtin directly. So this case is to make it clear that if you should not have gotten here through normal means because an `HLSLVectorTruncation` should have happened.
https://github.com/llvm/llvm-project/pull/83609
More information about the cfe-commits
mailing list