https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108357

--- Comment #20 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 14 Apr 2023, xry111 at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108357
> 
> --- Comment #18 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #17)
> > Isn't this the same issue as seen in another bug, most targets defining
> > TARGET_PROMOTE_PROTOTYPES to hook_bool_const_tree_true but loongarch not?
> > That will cause those conversions to be missed.
> 
> Looks like we should define it, as our psABI says:
> 
> In most cases, the unsigned integer data types are zero-extended when stored 
> in
> general-purpose register, and the signed integer data types are sign-extended.
> However, in the LP64D ABI, unsigned 32-bit types, such as unsigned int, are
> stored in general-purpose registers as proper sign extensions of their 32-bit
> values.
> 
> IIUC it matches the semantics of TARGET_PROMOTE_PROTOTYPES.

TARGET_PROMOTE_PROTOTYPES is about foo (signed char) or foo (unsigned 
short), thus argument types less than int.  With 
TARGET_PROMOTE_PROTOTYPES defined to true they will get promoted to
integer so you'll see foo ((int)x) when 'x' is of type signed char
or unsigned short for the above cases.

Reply via email to