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

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 14:32:49 PST 2025


farzonl 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?

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


More information about the cfe-commits mailing list