[clang] [llvm] [HLSL][DXIL] Implement `asdouble` intrinsic (PR #114847)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 09:12:38 PST 2024
================
@@ -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
More information about the cfe-commits
mailing list