aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorFarzon Lotfi <1802579+farzonl@users.noreply.github.com>2024-03-19 12:03:43 -0400
committerGitHub <noreply@github.com>2024-03-19 12:03:43 -0400
commit081a66ffacfe85a37ff775addafcf3371e967328 (patch)
treecbfb6f1b91de75bfdc9461e08fc132c1e5bf546d /clang/lib/Sema/SemaChecking.cpp
parent0081ec11d86f34982ac5b1df4f53943a92d5223f (diff)
downloadllvm-081a66ffacfe85a37ff775addafcf3371e967328.zip
llvm-081a66ffacfe85a37ff775addafcf3371e967328.tar.gz
llvm-081a66ffacfe85a37ff775addafcf3371e967328.tar.bz2
[DXIL] implement dot intrinsic lowering for integers (#85662)
this implements part 1 of 2 for #83626 - `CGBuiltin.cpp` - modified to have seperate cases for signed and unsigned integers. - `SemaChecking.cpp` - modified to prevent the generation of a double dot product intrinsic if the builtin were to be called directly. - `IntrinsicsDirectX.td` creation of the signed and unsigned dot intrinsics needed for instruction expansion. - `DXILIntrinsicExpansion.cpp` - handle instruction expansion cases for integer dot product.
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index a0b256a..f9112a2 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5484,6 +5484,18 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {
checkFloatorHalf);
}
+bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
+ auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
+ if (const auto *VecTy = dyn_cast<VectorType>(PassedType)) {
+ clang::QualType BaseType = VecTy->getElementType();
+ return !BaseType->isHalfType() && !BaseType->isFloat32Type();
+ }
+ return false;
+ };
+ return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy,
+ checkDoubleVector);
+}
+
void SetElementTypeAsReturnType(Sema *S, CallExpr *TheCall,
QualType ReturnType) {
auto *VecTyA = TheCall->getArg(0)->getType()->getAs<VectorType>();
@@ -5520,6 +5532,8 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
return true;
if (SemaBuiltinVectorToScalarMath(TheCall))
return true;
+ if (CheckNoDoubleVectors(this, TheCall))
+ return true;
break;
}
case Builtin::BI__builtin_hlsl_elementwise_rcp: {