On Sun, Jun 22, 2025 at 5:49 AM Takayuki 'January June' Suwa <jjsuwa_sys3...@yahoo.co.jp> wrote: > > On 2025/06/22 6:41, Max Filippov wrote: > > On Sat, Jun 21, 2025 at 2:12 PM Takayuki 'January June' Suwa > > <jjsuwa_sys3...@yahoo.co.jp> wrote: > >> > >> That hook has since been deprecated > >> (commit a670ebde3995481225ec62b29686ec07a21e5c10) and has led to incorrect > >> results on Xtensa: > >> > >> /* example */ > >> #define <stdint.h> > >> uint32_t __attribute__((noinline)) test0(uint32_t a, uint16_t b) { > >> return a + b; > >> } > >> uint32_t __attribute__((noinline)) test1(uint32_t a, uint32_t b) { > >> return test0(a, b); > >> } > >> > >> ;; before (-mabi=call0) > >> test0: > >> add.n a2, a3, a2 > >> ret.n > >> test1: > >> sext a3, a3, 15 ;; NG, do not sign-extend > >> j.l test0, a9 > >> > >> ;; after (-mabi=call0) > >> test0: > >> extui a3, a3, 0, 16 ;; OK > >> add.n a2, a3, a2 > >> ret.n > >> test1: > >> j.l test0, a9 > >> > >> With this patch, the result is consistent with other targets such as > >> AArch64. > >> > >> gcc/ChangeLog: > >> > >> * config/xtensa/xtensa.cc > >> (TARGET_PROMOTE_PROTOTYPES, TARGET_PROMOTE_FUNCTION_MODE): > >> Remove. > >> --- > >> gcc/config/xtensa/xtensa.cc | 5 ----- > >> 1 file changed, 5 deletions(-) > > > > This results in a bunch of ICEs with the following backtrace: > > > How about leaving TARGET_PROMOTE_FUNCTION_MODE and just removing > TARGET_PROMOTE_PROTOTYPES?
The sign extension of signed char function arguments is missing with this change, breaking the ABI, e.g void s8(signed char c); void cs8(signed char *c) { s8(*c); } is translated to cs8: entry sp, 32 l8ui a10, a2, 0 call8 s8 retw.n -- Thanks. -- Max