[clang] [llvm] [HLSL] Implementation of dot intrinsic (PR #81190)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 13:58:50 PST 2024


================
@@ -19594,23 +19750,45 @@ bool Sema::PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall) {
   TheCall->setArg(0, A.get());
   QualType TyA = A.get()->getType();
 
-  if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA))
+  if (checkMathBuiltinElementType(*this, A.get()->getBeginLoc(), TyA, 1))
     return true;
 
   TheCall->setType(TyA);
   return false;
 }
 
 bool Sema::SemaBuiltinElementwiseMath(CallExpr *TheCall) {
+  QualType Res;
+  bool result = SemaBuiltinVectorMath(TheCall, Res);
+  if (result)
+    return true;
+  TheCall->setType(Res);
+  return false;
+}
+
+bool Sema::SemaBuiltinVectorToScalarMath(CallExpr *TheCall) {
+  QualType Res;
+  bool result = SemaBuiltinVectorMath(TheCall, Res);
+  if (result)
+    return true;
+
+  if (auto *VecTy0 = Res->getAs<VectorType>()) {
+    TheCall->setType(VecTy0->getElementType());
+  } else {
+    TheCall->setType(Res);
+  }
----------------
llvm-beanz wrote:

Unnecessary braces.

See: https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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


More information about the cfe-commits mailing list