https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119979
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #4)
> Created attachment 61231 [details]
> A patch
>
> Please try this. I suspect that all targets using
> default_promote_function_mode_always_promote are broken.
I'll note that there are quite few targets claiming their hook is
basically default_promote_function_mode_always_promote. Like RISC-V:
/* This function is equivalent to default_promote_function_mode_always_promote
except that it returns a promoted mode even if type is NULL_TREE. This is
needed by libcalls which have no type (only a mode) such as fixed conversion
routines that take a signed or unsigned char/short/int argument and convert
it to a fixed type. */
static machine_mode
riscv_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
machine_mode mode,
int *punsignedp ATTRIBUTE_UNUSED,
const_tree fntype ATTRIBUTE_UNUSED,
int for_return ATTRIBUTE_UNUSED)
{
int unsignedp;
if (type != NULL_TREE)
return promote_mode (type, mode, punsignedp);
same for mips. So HJs suspicion might either be not spot-on or imprecise?
If there's only iq2000, mcore ahd sh4eb affected this bug will eventually
be demoted to P4. SH is the only somewhat maintained port in that list.