Re: An execution time puzzle

Liste des GroupesRevenir à c arch 
Sujet : Re: An execution time puzzle
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.arch
Date : 10. Mar 2025, 17:55:16
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2025Mar10.175516@mips.complang.tuwien.ac.at>
References : 1 2 3
User-Agent : xrn 10.11
Brett <ggtgp@yahoo.com> writes:
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
I recreated this in assembly language:
 
        .text
        .globl main
main:
        mov $threaded, %rdx
        mov $0, %rbx
        mov $(returnstack+8),%r13
        mov %rdx, %r8
docol:  
        add    $0x8,%rbx
        sub    $0x8,%r13
        mov    %rbx,0x0(%r13)
        mov    %rdx,%rbx
        mov    (%rbx),%rax
        jmp    *%rax
outout:
        mov    %r8,%r15
        add    $0x10,%rbx
        mov    0x0(%r13),%rbx
        mov    -0x10(%r15),%rax
        mov    %r15,%rdx
        add    $0x8,%r13
        sub    $0x8,%rbx
        jmp    *%rax
 
        .data
        .quad docol
        .quad 0
threaded:
        .quad outout
returnstack:
        .zero 16,0
...
How about giving us the original source code function, my x86 is rusty and
it is helpful to plug source into compiler explorer to see what different
compilers do.

The original source code is

: foo dup execute-exit ;
\ invoked with
' foo foo

This is Forth source code for Gforth (and the output is from
gforth-fast).  I expect that most c.a readers will find the assembly
language more approachable:-)

- anton
--
'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'
  Mitch Alsup, <c17fcd89-f024-40e7-a594-88a85ac10d20o@googlegroups.com>

Date Sujet#  Auteur
10 Mar 25 * An execution time puzzle11Anton Ertl
10 Mar 25 +* Re: An execution time puzzle7Anton Ertl
10 Mar 25 i+* Re: An execution time puzzle2Brett
10 Mar 25 ii`- Re: An execution time puzzle1Anton Ertl
10 Mar 25 i`* Re: An execution time puzzle4Anton Ertl
11 Mar 25 i `* Re: An execution time puzzle3Anton Ertl
11 Mar 25 i  `* Re: An execution time puzzle2Michael S
11 Mar 25 i   `- Re: An execution time puzzle1Anton Ertl
10 Mar 25 `* Re: An execution time puzzle3Robert Finch
10 Mar 25  +- Re: An execution time puzzle1Michael S
11 Mar 25  `- Re: An execution time puzzle1Anton Ertl

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal