Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* a CVTST/s of +INF doesn't work :-{
       [not found] <199912101725.MAA00952@linux04.mro.dec.com>
@ 1999-12-13  0:58 ` Uncle George
  1999-12-13  2:36   ` Brad Lucier
  0 siblings, 1 reply; 4+ messages in thread
From: Uncle George @ 1999-12-13  0:58 UTC (permalink / raw)
  To: Jay.Estabrook; +Cc: axp-list, Richard Henderson

[-- Attachment #1: Type: text/plain, Size: 676 bytes --]

it seems that the comparison of a (float) 0 with a (float) +INF  does not work
with linux-2.2.13.
the cvtst/s instruction ( which in itself it very strangely assembled - which
appears, when hand disassembled to be a CVTxS form of instruction rather than the
expected CVTxT ) does not convert the (float) +inf to a (double) +inf.
the the (float)inf becomes a (double) 0.
Attached is a simple program that exhibits the problem.
gat

BTW There seems to be some sorta madness with respect to the CVT instructs, that
defies my logic. Do I need to become also cerebrally damaged to understand this
:-/
ie a cvtst/s != the assembler version != whats in memory != what I understand.


[-- Attachment #2: a.c --]
[-- Type: text/plain, Size: 429 bytes --]

int compare ( float, float );

main() {
	union
	{
		float	f;
		int	i;
		double	d;
		long	l;
	} ll, rr, dd;

	float l, r;
	int i;
	double d;
	ll.i = 0;
	rr.i = 0x7f800000;
	d = rr.f;
	dd.d = d;
	

	printf("l = %g, r = %g, d = (%lx, %g)\n", ll.f, rr.f, dd.l, dd.d );
	i = compare( ll.f,rr.f );
	printf("i = %d\n", i);

}

compare( float l, float r )
{
	if ( l < r )
		return 1;
	else
	if ( l > r )
		return -1;
	else
		return 0;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: a CVTST/s of +INF doesn't work :-{
  1999-12-13  0:58 ` a CVTST/s of +INF doesn't work :-{ Uncle George
@ 1999-12-13  2:36   ` Brad Lucier
  1999-12-13 14:41     ` Uncle George
  0 siblings, 1 reply; 4+ messages in thread
From: Brad Lucier @ 1999-12-13  2:36 UTC (permalink / raw)
  To: axp-list; +Cc: Jay.Estabrook, Richard Henderson

It seems to work when you use -mieee:

popov-126% gcc -mieee -o floatcompare floatcompare.c 
popov-127% floatcompare 
l = 0, r = inf, d = (7ff0000000000000, inf)
i = 1
popov-132% gcc -v
Reading specs from /export/u10/gcc-2.95.1/lib/gcc-lib/alphaev6-unknown-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)

and I'm running generic 2.2.13.

Brad Lucier


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: a CVTST/s of +INF doesn't work :-{
  1999-12-13  2:36   ` Brad Lucier
@ 1999-12-13 14:41     ` Uncle George
  0 siblings, 0 replies; 4+ messages in thread
From: Uncle George @ 1999-12-13 14:41 UTC (permalink / raw)
  To: axp-list; +Cc: Brad Lucier

Interesting, ur gcc is from august, mine is from march. So I suppose u upgraded ur gcc. I can
also presume that u also built 2.2.13 with this new gcc ? Since I dont think that my 'c' program
did not get changed with respect to cvtst, it must me the kernel build.
where did u get ur current gcc ?
gat


Brad Lucier wrote:

> It seems to work when you use -mieee:
>
> popov-126% gcc -mieee -o floatcompare floatcompare.c
> popov-127% floatcompare
> l = 0, r = inf, d = (7ff0000000000000, inf)
> i = 1
> popov-132% gcc -v
> Reading specs from /export/u10/gcc-2.95.1/lib/gcc-lib/alphaev6-unknown-linux-gnu/2.95.1/specs
> gcc version 2.95.1 19990816 (release)
>
> and I'm running generic 2.2.13.
>
> Brad Lucier
>
> --
> To unsubscribe: send e-mail to axp-list-request@redhat.com with
> 'unsubscribe' as the subject.  Do not send it to axp-list@redhat.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: a CVTST/s of +INF doesn't work :-{
@ 1999-12-13 17:42 Brad Lucier
  0 siblings, 0 replies; 4+ messages in thread
From: Brad Lucier @ 1999-12-13 17:42 UTC (permalink / raw)
  To: axp-list, gatgul; +Cc: lucier

No, I compiled the 2.2.13 kernel with egcs-1.1.2 (the compiler that came with
RH 6.0, and the one recommended in the 2.2.13 release notes).

See http://gcc.gnu.org to download 2.95.1.

Brad Lucier

Here is the output of gcc:

popov-139% gcc -mieee -S floatcompare.c
popov-140% cat floatcompare.s
        .file   1 "floatcompare.c"
        .set noat
        .set noreorder
        .arch ev6
.section        .rodata
$LC0:
        .ascii "l = %g, r = %g, d = (%lx, %g)\12\0"
$LC1:
        .ascii "i = %d\12\0"
.text
        .align 5
        .globl main
        .ent main
main:
        .eflag 48
        .frame $15,64,$26,0
        .mask 0x4008000,-64
        ldgp $29,0($27)
$main..ng:
        lda $30,-64($30)
        stq $26,0($30)
        stq $15,8($30)
        mov $30,$15
        .prologue 1
        stl $31,16($15)
        ldah $1,32640
        stl $1,24($15)
        lds $f11,24($15)
        cvtsts $f11,$f10
        stt $f10,56($15)
        ldt $f10,56($15)
        stt $f10,32($15)
        lds $f11,16($15)
        cvtsts $f11,$f10
        lds $f12,24($15)
        cvtsts $f12,$f11
        lda $16,$LC0
        fmov $f10,$f17
        fmov $f11,$f18
        ldq $19,32($15)
        ldt $f20,32($15)
        jsr $26,printf
        ldgp $29,0($26)
        lds $f16,16($15)
        lds $f17,24($15)
        jsr $26,compare
        ldgp $29,0($26)
        mov $0,$1
        stl $1,48($15)
        ldl $1,48($15)
        lda $16,$LC1
        mov $1,$17
        jsr $26,printf
        ldgp $29,0($26)
$L2:
        mov $15,$30
        ldq $26,0($30)
        ldq $15,8($30)
        lda $30,64($30)
        ret $31,($26),1
        .end main
        .align 5
        .globl compare
        .ent compare
compare:
        .eflag 48
        .frame $15,32,$26,0
        .mask 0x4008000,-32
$compare..ng:
        lda $30,-32($30)
        stq $26,0($30)
        stq $15,8($30)
        mov $30,$15
        .prologue 0
        sts $f16,16($15)
        sts $f17,20($15)
        lds $f11,16($15)
        cvtsts $f11,$f10
        lds $f12,20($15)
        cvtsts $f12,$f11
        cmptltsu $f10,$f11,$f12
        fmov $f12,$f10
        fbeq $f10,$L4
        lda $0,1
        br $31,$L3
        br $31,$L5
$L4:
        lds $f11,16($15)
        cvtsts $f11,$f10
        lds $f12,20($15)
        cvtsts $f12,$f11
        cmptltsu $f11,$f10,$f12
        fmov $f12,$f10
        fbeq $f10,$L6
        lda $0,-1
        br $31,$L3
        br $31,$L5
$L6:
        mov $31,$0
        br $31,$L3
$L7:
$L5:
$L3:
        mov $15,$30
        ldq $26,0($30)
        ldq $15,8($30)
        lda $30,32($30)
        ret $31,($26),1
        .end compare
        .ident  "GCC: (GNU) 2.95.1 19990816 (release)"


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-13 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <199912101725.MAA00952@linux04.mro.dec.com>
1999-12-13  0:58 ` a CVTST/s of +INF doesn't work :-{ Uncle George
1999-12-13  2:36   ` Brad Lucier
1999-12-13 14:41     ` Uncle George
1999-12-13 17:42 Brad Lucier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox