lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] sparc port of lightning-2.0


From: Philip Herron
Subject: Re: [Lightning] sparc port of lightning-2.0
Date: Sun, 17 Feb 2013 14:04:26 +0000

Where abouts can i peruse the sparc code, because i have access to
solaris sparc machines in work as well as the gnu build farm would
love to take a look into this.

--Phil

On 17 February 2013 13:53, Paulo César Pereira de Andrade
<address@hidden> wrote:
>   Just to let you know development is still active :-)
>
>   I got an account in the gcc build farm, so I am making a sparc port there.
> After a few days reading assembly manuals and coding the port, it is
> now executing some code. One example from the test cases:
>
> ---%<---
> $ cat add.tst
> .data   32
> fmt:
> .c      "%d + %d = %d\n"
>
> .code
>         jmpi main
>
>         name test
> test:
>         prolog
>         arg $i0
>         arg $i1
>         getarg %r0 $i0
>         getarg %r1 $i1
>         addr %r0 %r0 %r1
>         retr %r0
>         epilog
>
>         name main
> main:
>         prolog
>         prepare
>                 pushargi 5
>                 pushargi 4
>         finishi test
>         retval %r0
>         prepare
>                 pushargi fmt
>                 ellipsis
>                 pushargi 5
>                 pushargi 4
>                 pushargr %r0
>         finishi @printf
>         ret
>         epilog
> ---%<---
>
> and what I see in my ssh to the sparc computer:
>
> ---%<---
> (gdb) r -v2 add.tst
> Starting program: /home/pcpa/lightning-2.0/check/.libs/lt-lightning -v2 
> add.tst
>
>     jmpi L3
>         #name test
> L0:
>         #note add.tst:9
> L1: %i0 %i1 /* prolog */
>         arg 0x0
>         arg 0x1
>         movr %g2 %i0
>         movr %g3 %i1
>         addr %g2 %g2 %g3
>         movr %i0 %g2
> L2: /* epilog */
>         #name main
> L3:
>         #note add.tst:20
> L4: %g2 /* prolog */
>         movi %o0 0x5
>         movi %o1 0x4
>     calli L0
>         movr %g2 %o0
>         movi %o0 0x3dfe8
>         movi %o1 0x5
>         movi %o2 0x4
>         movr %o3 %g2
>     calli 0x70301900
> L5: /* epilog */
>   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>         0x7041a000      sethi  %hi(0x7041a000), %g2
>         0x7041a004      or  %g2, 0x30, %g2      ! 0x7041a030 main:add.tst:20
>         0x7041a008      jmp  %g2
>         0x7041a00c      nop
> # test:add.tst:9
>         0x7041a010      save  %sp, -112, %sp
>         0x7041a014      mov  %i0, %g2
>         0x7041a018      mov  %i1, %g3
>         0x7041a01c      add  %g2, %g3, %g2
>         0x7041a020      mov  %g2, %i0
>         0x7041a024      restore
>         0x7041a028      retl
>         0x7041a02c      nop
> # main:add.tst:20
>         0x7041a030      save  %sp, -112, %sp
>         0x7041a034      mov  5, %o0
>         0x7041a038      mov  4, %o1
>         0x7041a03c      sethi  %hi(0x7041a000), %g3
>         0x7041a040      or  %g3, 0x10, %g3      ! 0x7041a010 test:add.tst:9
>         0x7041a044      call  %g3
>         0x7041a048      nop
>         0x7041a04c      mov  %o0, %g2
>         0x7041a050      sethi  %hi(0x3dc00), %o0
>         0x7041a054      or  %o0, 0x3e8, %o0     ! 0x3dfe8
>         0x7041a058      mov  5, %o1
>         0x7041a05c      mov  4, %o2
>         0x7041a060      mov  %g2, %o3
>         0x7041a064      call  0x70301900
>         0x7041a068      nop
>         0x7041a06c      restore
>         0x7041a070      retl
>         0x7041a074      nop
>   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 5 + 4 = 9
>
> Program exited normally.
> ---%<---
>
> There is still plently to be done to pass all test cases, and several
> backend specific optimizations could be done. Particularly, sparc
> benefits from knowing if the current function is a leaf function, and
> this is information is easy to gather. Not so easy is to use annulled
> delay slots or do optimal delay slot usage, but at least some of
> it should be used (at first only when it can be readily done, that
> is, not have an optimization pass reordering the assembly output).
>
> Thanks,
> Paulo
>
> _______________________________________________
> Lightning mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lightning



reply via email to

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