Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* MVI with gcc
@ 1999-03-03 17:05 Robert Harley
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Harley @ 1999-03-03 17:05 UTC (permalink / raw)
  To: axp-list

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.


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

* Re: MVI with gcc
@ 1999-03-03 20:25 Robert Harley
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Harley @ 1999-03-03 20:25 UTC (permalink / raw)
  To: axp-list

I wrote:
>asm ("umulh %1,%2,%0" : "=r" (tmp) : "%rJ" (v1), "rI" (v2)); \

Uh...  ^^^^^ that should be perr, obviously.  I think I'm losing it.

I'm assuming that perr(v1, v2) is the same as perr(v2, v1).  If not,
please nuke the % in %rJ.

Rob.


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

end of thread, other threads:[~1999-03-03 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-03-03 20:25 MVI with gcc Robert Harley
  -- strict thread matches above, loose matches on Subject: below --
1999-03-03 17:05 Robert Harley

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