[clang] [llvm] [HLSL] Implement the `smoothstep` intrinsic (PR #132288)
Kaitlin Peng via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 25 16:48:46 PDT 2025
================
@@ -101,6 +101,52 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned BuiltinID,
TheCall->setType(RetTy);
break;
}
+ case SPIRV::BI__builtin_spirv_smoothstep: {
+ if (SemaRef.checkArgCount(TheCall, 3))
+ return true;
+
+ // check if the all arguments have floating representation
+ ExprResult A = TheCall->getArg(0);
+ QualType ArgTyA = A.get()->getType();
+ if (!ArgTyA->hasFloatingRepresentation()) {
+ SemaRef.Diag(A.get()->getBeginLoc(),
+ diag::err_typecheck_convert_incompatible)
----------------
kmpeng wrote:
Don't we also want to say the [api supports matrices](https://github.com/llvm/llvm-project/pull/132288#discussion_r2008116154) though? I don't think I can do that with `err_builtin_invalid_arg_type` unless I edit `DiagnosticSemaKinds.td`—the closest I can get is this message:
```
1st argument must be a scalar or vector of floating-point types (was 'int')
```
https://github.com/llvm/llvm-project/pull/132288
More information about the llvm-commits
mailing list