On Sat, Jun 21, 2025 at 3:54 PM H.J. Lu <hjl.to...@gmail.com> wrote:
> On Sun, Jun 22, 2025 at 6:35 AM Max Filippov <jcmvb...@gmail.com> wrote:
> > On Sat, Jun 21, 2025 at 2:41 PM Max Filippov <jcmvb...@gmail.com> 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(-)
> >
> > Also with this change function calls that pass 8- and 16-bit signed values
> > don't sign-extend them, which violates the xtensa ABI.
> >
>
> There are no overages in GCC testsuites for these?

There's no xtensa-specific test for the function parameters sign extension
behavior, but the difference is still noticeable as the amount of failing tests
in gcc testsuite went from 215 to 367 around the change

a670ebde3995 ("Drop targetm.promote_prototypes from C, C++ and Ada frontends")

-- 
Thanks.
-- Max

Reply via email to