On Tue, 23 Jan 2007, Kevin Ryde wrote:
> Hugh Sasse <[EMAIL PROTECTED]> writes:
> >
> > mov 0, %o1
> > call printf, 0
>
> Ah dear, thanks, gcc has optimized it out. I'll change the test
> program to something like
>
> #include <math.h>
> volatile double x = 0.0;
> int main () { return (isinf(x) != 0); }
>
> probably adding a check for "volatile" as well though.
>
bash-2.05$ cat isinf.c
#include <stdio.h>
#include <math.h>
int main(void);
int main (void) {
volatile double x = 0.0;
printf ("isinf(0.0) gives %d\n",isinf(x));
printf ("(isinf(0.0) != 0) gives %d\n",(isinf(x) != 0));
return (0);
}
bash-2.05$ gcc -S -o isinf isinf.c
bash-2.05$ cat isinf
.file "isinf.c"
.section ".rodata"
.align 8
.LLC1:
.asciz "isinf(0.0) gives %d\n"
.align 8
.LLC2:
.asciz "(isinf(0.0) != 0) gives %d\n"
.align 8
.LLC0:
.long 0
.long 0
.section ".text"
.align 4
.global main
.type main, #function
.proc 04
main:
save %sp, -120, %sp
sethi %hi(.LLC0), %g1
or %g1, %lo(.LLC0), %g1
ldd [%g1], %f8
std %f8, [%fp-24]
ldd [%fp-24], %f8
std %f8, [%fp-16]
ldd [%fp-16], %o0
call isinf, 0
nop
mov %o0, %g2
sethi %hi(.LLC1), %g1
or %g1, %lo(.LLC1), %o0
mov %g2, %o1
call printf, 0
nop
ldd [%fp-24], %f8
std %f8, [%fp-16]
ldd [%fp-16], %o0
call isinf, 0
nop
mov %o0, %g1
xor %g1, 0, %g1
subcc %g0, %g1, %g0
addx %g0, 0, %g2
sethi %hi(.LLC2), %g1
or %g1, %lo(.LLC2), %o0
mov %g2, %o1
call printf, 0
nop
mov 0, %g1
mov %g1, %i0
restore
jmp %o7+8
nop
.size main, .-main
.ident "GCC: (GNU) 4.1.1"
bash-2.05$
Hugh
_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user