On Sat, 22 Jan 2005 18:36:46 +1100
Erik de Castro Lopo <[EMAIL PROTECTED]> wrote:

> On Fri, 21 Jan 2005 23:08:50 +0000
> Neil Klepeis <[EMAIL PROTECTED]> wrote:
> 
> > What exactly am I looking for? 
> 
> I'm not too sure, but I'd know if I saw it :-).
> 
> > After using g++ -S, the allpass.o file, 
> > for example, starts out with:
> 
> Send me the whole allpass.c file by private mail (address below) and
> I'll have a look.

OK, the code of interest is in the process() method of the allpass class.
This method is defined as an inline function in allpass.h. I therefore
wrote a small test file :

    #include "allpass.h"

    static allpass ap ;

    float test (float x)
    {   return ap.process (x) ;
    }

and compiler that with:

    g++ -S -O3 test.cpp -o test.s

In the asembler output file we get this:

    .LFE6:
        .size _Z41__static_initialization_and_  <snip rest of line>
        .section        .rodata.cst4,"aM",@progbits,4
        .align 4
.LC0:
        .long   201326592
        .text
        .align 2
        .p2align 4,,15

The long above (201326592) is the integer representation of the float value.

The asm code for the test function looks like this (comments added):

    .globl _Z4testf
        .type   _Z4testf, @function
    _Z4testf:
    .LFB7:
        pushl   %ebp
    .LCFI2:
        movl    %esp, %ebp
    .LCFI3:
        subl    $4, %esp
    .LCFI4:
        flds    .LC0                  ; load the float value to the fpu stack
        movl    ap+12, %edx
        movl    ap+4, %ecx
        flds    8(%ebp)
        movl    (%ecx,%edx,4), %eax   ; load buffer[bufidx] -> %eax
        movl    %eax, -4(%ebp)        ; move %eax -> bufout
        flds    -4(%ebp)              ; load bufout to the fpu
        fadd    %st(2), %st           ; new top of stack = bufout + the_const
        fstps   -4(%ebp)              ; store top of stack -> bufout
        flds    -4(%ebp)              ; load buf out to top of stack
        fsubp   %st, %st(2)           ; new top of stack <- bufout - the_const
                
and so on. This shows that even with -O3, the denormalisation
code is not being optimised out.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
+-----------------------------------------------------------+
"O'Caml ... a "language designed for smart people" if there ever
was one." -- Mike Vanier

Reply via email to