On Mon, Sep 21, 2026 at 05:46:56PM -0400, Matt Turner wrote:
> +/* Fail to compile unless the asm output operand X has the same size as
> + TYPE. This stands in for casting the output to TYPE, which clang
> + rejects. */
> +#define __ll_check_output(type, x) \
> + ((void) sizeof (char [sizeof (x) == sizeof (type) ? 1 : -1]))
Note, casts for output operands don't check just size, they check whether
the mode is the same, which is something different. There can be different
modes with the same size. E.g. DFmode or DImode or CSImode or V1DImode or
V2SImode or V4HImode or V8QImode all have the same size.
So just checking size is weaker than what it previously checked.
I'd say if we are willing to change anything, there should be a macro
that can be used directly in the output operand and for non-clang it will
expand to the cast and for clang whatever else one wants (no checking at
all, checking the same, checking the mode).
So, have __asm ("..." : "=r" __ll_check_output (USItype, count) : ...);
where #define __ll_check_output(type, out) would expand to
((type) out) for gcc and say (out) for clang.
Jakub