[clang] [clang] Fix sub-integer __builtin_elementwise_(add|sub)_sat (PR #119423)
Fraser Cormack via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 12 03:27:57 PST 2024
frasercrmck wrote:
> Even with this fix, the behavior with mixed types still seems really confusing, especially if you mix signed/unsigned inputs. Can we address that somehow?
I totally agree.
The (elementwise) builtins won't let you mix `ext_vector_type`s of different signs or element sizes, so maybe we should extend logic that to all scalars too? Ban mixed signs? Ban mixed sizes entirely? This would be a larger change that would probably need documenting - an RFC? Worth noting perhaps that maybe the current vector behaviour depends on the type of vectors you use (OpenCL, AltiVec, GCC, NEON, SVE) - I haven't checked that.
I note also that the documentation says that `For scalar types, consider the operation applied to a vector with a single element.`. This is misleading, as the usual implicit conversions don't behave the same way for scalars as they do for vectors.
CC @arsenm - might be of interest to you.
https://github.com/llvm/llvm-project/pull/119423
More information about the cfe-commits
mailing list