================ @@ -1870,6 +1870,23 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return true; break; } + case Builtin::BI__builtin_hlsl_asdouble: { + if (SemaRef.checkArgCount(TheCall, 2)) + return true; + if (CheckUnsignedIntRepresentation(&SemaRef, TheCall)) + return true; + + // Set the return type to be a scalar or vector of same length of double + ASTContext &Ctx = SemaRef.getASTContext(); + auto *VTy = TheCall->getArg(0)->getType()->getAs<VectorType>(); + + QualType ResultType = + VTy ? Ctx.getVectorType(Ctx.DoubleTy, VTy->getNumElements(), + VTy->getVectorKind()) + : Ctx.DoubleTy; + TheCall->setType(ResultType); ---------------- joaosaffran wrote:
Can we use `SetElementTypeAsReturnType` here ? https://github.com/llvm/llvm-project/pull/114847 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits