sparc v8 .mul &co

Valery Ushakov <[email protected]>
Newsgroups gmane.os.netbsd.ports.sparc
Message-ID <[email protected]>
For v8 we have a stub .mul implementation in /lib/libsparc_v8.so.0
that just calls the v8 smul instruction instead of the lengthy v7
routine in common/lib/libc/arch/sparc/gen/mul.S (from the sparc
manual).

The problem is, the trivial v8 ".mul" routine is not actually
compatabile with the v7 ".mul"

smul leaves its 64-bit output in %y, %o0 (rd), while .mul leaves its
output in %o1, %o0.  It also "indicates that overflow has occurred by
clearing the Z condition code upon return [note that this is different
from condition codes set by the SMULcc and UMULcc instructions]."

I've come across some handwritten sparc asm that fails with our v8
stub b/c of this difference.  I wonder how come we never stubmled over
this before.

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.