lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check results on PowerPC


From: Paulo César Pereira de Andrade
Subject: Re: Check results on PowerPC
Date: Mon, 22 Aug 2022 13:03:06 -0300

Em sáb., 20 de ago. de 2022 às 12:58, Paul Cercueil
<paul@crapouillou.net> escreveu:
>
> Hi Paulo,
>
> Le ven., août 19 2022 at 09:44:50 -0300, Paulo César Pereira de
> Andrade <paulo.cesar.pereira.de.andrade@gmail.com> a écrit :
> > Em sex., 19 de ago. de 2022 às 04:47, Paul Cercueil
> > <paul@crapouillou.net> escreveu:
> >
> >   Hi Paul,
> >
> >>  >>  I don't know if that's a known thing, but there are several
> >>  >> breakages
> >>  >>  on PowerPC (PPC32BE):
> >>  >
> >>  >   What operating system?
> >>
> >>  Linux, under qemu-user.
> >>
> >>  >>  FAIL: 3to2
> > ...
> >
> >   Please confirm running:
> >
> > $ cpp -dM /dev/null | grep _CALL
> >
> > prints a definition for _CALL_SYSV
>
> I do get _CALL_SYSV set to 1, yes.
>
> >
> >   Maybe it is some different processor that lacks some feature,
> > or uses a different abi.
> >
> >   It might also be a problem with glibc, as it might be an issue
> > only with variadic functions, in this case, printf, that might be
> > expecting float values in float registers for variadic arguments.
> >
> >   If yes, please test this reduced test:
> >
> > """
> > .data    32
> > dfmt:
> > .c    "%1.0f\n"
> >
> > .code
> >     jmpi main
> >
> > #define def_test_double(a, b, c)        \
> >     name test_double_##a##_##b##_##c    \
> > test_double_##a##_##b##_##c:            \
> >     prolog                    \
> >     arg_d $d0                \
> >     arg_d $d1                \
> >     getarg_d %b $d0                \
> >     getarg_d %c $d1                \
> >     subr_d %a %b %c                \
> >     retr_d %a                \
> >     epilog
> > #define test_double(a, b, c, x, y)        \
> >     prepare                    \
> >         pushargi_d x            \
> >         pushargi_d y            \
> >     finishi test_double_##a##_##b##_##c    \
> >     retval_d %f0                \
> >     prepare                    \
> >         pushargi dfmt            \
> >         ellipsis            \
> >         pushargr_d %f0            \
> >     finishi @printf
> >
> > def_test_double(f0, f0, f0)
> >
> >     name main
> > main:
> >     prolog
> >     test_double(f0, f0, f0, 3.0, 2.0)
> >     ret
> >     epilog
> > """
> >
> > and run it as:
> >
> > $ cd check
> > $ make debug
> > ...
> > (gdb) break _jit_emit
> > (gdb) run test.tst  # << assuming you called the sample file test.tst
> > ...
> > (gdb) finish
> > (gdb) x/48i _jit.code.ptr
> >
> >   Please copy&paste the output.
>
> So I could not test it with the 'make debug' GDB instance because I'm
> running things in qemu-user, so my host's GDB is for x86_64 while my
> check/lightning binary is ppc.
>
> When I run the test program like this: 'check/lightning check/test.tst'
> It just prints '0'.
>
> I believe I'll need to cross-compile GDB to ppc and run it with
> qemu-user.

Please check if you get this output:
$ check/lightning check/3to2.tst
0
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
1
1

  If you have it built with --enable-disassembler you can just run:

$ check/lightning -v check/3to2.tst

or add:

.disasm

to check/3to2.tst (or test.tst) so that with the ".disasm" directive, it only
disassembles and does not execute.

> Cheers,
> -Paul
>
> >   You might truncate it as it should be less than 48 instructions.
> >
> >>  Actually I tested at the lightning-2.1.3 tag now, and these tests
> >> fail
> >>  as well.
> >>
> >>  >   Apparently it is an issue with floating point registers.

  I did double check, and for calls to variadic functions, it should be
doing both, set the fpr register and set the stack to match the variadic
argument.
  The only thing it is not doing, for _CALL_SYSV is to also set the
integer register. But doing that would completely mess the call.

  Se page 37 of refspecs.linux-foundation.org/elf/elfspec_ppc.pdf

  About:
"""
A caller of a function that takes a variable argument list shall set
condition register bit 6 to 1 if it
passes one or more arguments in the floating-point registers. It is
strongly recommended that the
caller set the bit to 0 otherwise, using the creqv 6, 6, 6 (set to 1)
or crxor 6, 6, 6 (set to 0)
instruction.
"""

  What lightning does it to set the fpr registers and also set the stack
offset to match a variadic call. Could add extra code for creqv or crxor,
and still set the stack. But it already does both conventions to be certain...

  What is the glibc version?

> >>  I think so too.
> >>
> >>  Cheers,
> >>  -Paul
> >>
> >>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]