Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Robert Harley <Robert.Harley@inria.fr>
To: axp-list@redhat.com
Subject: MVI with gcc
Date: Wed, 3 Mar 1999 18:05:03 +0100 (MET)	[thread overview]
Message-ID: <199903031705.SAA17636@pauillac.inria.fr> (raw)

In thread "Alpha too slow?", Andreas Krebs (krebs@qkal.sap-ag.de) wrote:

>under digital unix you need to following code in me.c:
>
>#include <c_asm.h>
>#define perr(v1, v2) (asm("perr %a0, %a1, %v0", (v1), (v2)))


With gcc and friends you can do something like this:

#if defined(__GNUC__) && defined(__alpha)

#define perr(v1, v2) \
 ({ u64 tmp;                                                            \
    asm ("umulh %1,%2,%0" : "=r" (tmp) : "%rJ" (v1), "rI" (v2));        \
    tmp;                                                                \
 })

#else

#error Bogosity detected.

#endif


At least I think so!  Perhaps someone who knows a bit about asm()'s
can chime in to confirm or deny...

Bye,
  Rob.


             reply	other threads:[~1999-03-03 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-03 17:05 Robert Harley [this message]
  -- strict thread matches above, loose matches on Subject: below --
1999-03-03 20:25 MVI with gcc Robert Harley
read-only archive

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