http://qs321.pair.com?node_id=887108


in reply to Re^6: Module for 128-bit integer math?
in thread Module for 128-bit integer math?

One thing that might be useful to me if you have the time, is an assembler dump of the sources. Can gcc do that?

gcc -S a.c

And if it can, would it show the actual operations involved, or just calls to system library routines?

It provides the assembler code for the code you are compiling, which would include inlined functions, but I don't see why it would disassemble existing objects.

$ cat a.c #include <stdio.h> int main() { printf("Hello, World!\n"); return 0; }
$ cat a.s .file "a.c" .section .rodata .LC0: .string "Hello, World!" .text .globl main .type main, @function main: leal 4(%esp), %ecx andl $-16, %esp pushl -4(%ecx) pushl %ebp movl %esp, %ebp pushl %ecx subl $4, %esp movl $.LC0, (%esp) call puts movl $0, %eax addl $4, %esp popl %ecx popl %ebp leal -4(%ecx), %esp ret .size main, .-main .ident "GCC: (Debian 4.3.2-1.1) 4.3.2" .section .note.GNU-stack,"",@progbits

Are they inlined?

I can't try to install the dev gcc needed for Math::Int128 at this moment.

Replies are listed 'Best First'.
Re^8: Module for 128-bit integer math?
by salva (Canon) on Feb 09, 2011 at 09:55 UTC
    C code: Assembler generated by gcc -O3 -march=core2: So, it uses inlined 64bits arithmetic, except for division and modulo operations that are library calls.

      Cool! Many thanks for that. I may just translate those sequences to MASM and use them directly until I work if using SSE* will improve performance.

      Shame about the div/mod cos those are the ones I've had trouble getting right. But I should be able to look them up in the gcc library sources?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re^8: Module for 128-bit integer math?
by BrowserUk (Patriarch) on Feb 09, 2011 at 04:04 UTC
    but I don't see why it would disassemble existing objects.

    It obviously wouldn't disassemble anything.

    But if the 128-bit math functions were marked inline, their implementation would show up.

    If not inlined, then the names of the routines called to perform it should be visible, and that would aid tracking down their implementation in the library sources.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It obviously wouldn't disassemble anything.

      Then it will obviously just show the calls to system library routines.

      then the names of the routines called to perform it should be visible

      Confirmed by the demonstration I posted.

        Then it will obviously just show the calls to system library routines.

        Unless they are inlined. Full circle.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.