[clang] [clang] Improve diagnostics for vector builtins (PR #125673)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 5 04:13:06 PST 2025


frasercrmck wrote:

> This PR has me thinking about a related problem.
> 
> In HLSL we have elementwise builtins like `__builtin_hlsl_elementwise_frac`. We do not add the `CustomTypeChecking` attribute to these builtins. This puts us down the variadic type check rules for scalar inputs to these builtins. Which mean for floating point cases the type defaults to double. in `-O0` our builtin is wrapped in `%8 = fpext float %7 to double` `%9 = <call to builitn>(%8) ` `fptrunc double %9 to float`
> 
> Does it make more sense to switch all these to CustomTypeChecking Or should we consider type constaining like what you did here?

I wouldn't say I'm knowledgeable enough in this area or in HLSL to answer this question, sorry.

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


More information about the cfe-commits mailing list