From: Robert Harley <Robert.Harley@inria.fr>
To: axp-list@redhat.com
Subject: Re: patch_v2: (on Alpha) emulating missing instructions
Date: Mon, 18 Oct 1999 16:46:59 +0200 (MET DST) [thread overview]
Message-ID: <199910181446.QAA18379@pauillac.inria.fr> (raw)
BTW, here is a fast and short way of doing minuw():
------------------------------------------------------------------------------
#define CMPBGE(a, b, c) \
asm("cmpbge %1, %2, %0" : "=r" (c) : "r" (a), "r" (b))
#define ZAP(a, b, c) \
asm("zap %1, %2, %0" : "=r" (c) : "r" (a), "r" (b))
#define ZAPNOT(a, b, c) \
asm("zapnot %1, %2, %0" : "=r" (c) : "r" (a), "r" (b))
static u64 minuw(u64 x, u64 y) {
u64 eq, ge1, ge2;
CMPBGE(x, y, ge1);
CMPBGE(0, x ^ y, eq);
ge2 = (ge1 & ~eq | eq & ge1<<1) & 0xAA;
ge2 |= ge2>>1;
ZAP(x, ge2, x);
ZAPNOT(y, ge2, y);
return x | y;
} /* end function minuw */
------------------------------------------------------------------------------
The output from gcc 2.95 looks like:
------------------------------------------------------------------------------
minuw:
cmpbge $16, $17, $1
xor $16,$17,$3
mov $31,$2
cmpbge $2, $3, $2
addq $1,$1,$4
bic $1,$2,$1
and $2,$4,$2
bis $1,$2,$1
and $1,170,$1
srl $1,1,$2
bis $1,$2,$1
zapnot $17, $1, $17
zap $16, $1, $16
bis $16,$17,$0
ret $31,($26),1
.end minuw
------------------------------------------------------------------------------
This bit:
mov $31,$2
cmpbge $2, $3, $2
would be better as:
cmpbge $31, $3, $2
Bye,
Rob.
next reply other threads:[~1999-10-18 14:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-18 14:46 Robert Harley [this message]
1999-10-18 15:31 ` patch_v2: (on Alpha) emulating missing instructions Phil Carmody
1999-10-23 20:39 ` Richard Henderson
1999-10-21 16:23 ` patch_v3: emulating missing instructions on Alpha Luke Deller
1999-10-23 20:55 ` Richard Henderson
1999-10-24 0:28 ` Daniel Potts
1999-10-25 1:22 ` Luke Deller
1999-10-28 23:34 ` Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1999-10-18 13:05 patch_v2: (on Alpha) emulating missing instructions Robert Harley
1999-10-15 9:30 PATCH: " Luke Deller
1999-10-16 9:13 ` patch_v2: " Luke Deller
1999-01-13 14:10 Alpha 21264 Andy Almond
1999-01-13 16:36 ` Jeff Sturm
1999-01-14 6:50 ` Richard Henderson
1999-01-12 3:55 rpcc Christoph Dworzak
1999-01-12 3:20 ` rpcc Peter Petrakis
1999-01-12 4:59 ` rpcc Richard Henderson
[not found] ` <rth@twiddle.net>
1999-01-12 16:59 ` rpcc Christoph Dworzak
1999-01-12 19:27 ` rpcc Richard Henderson
1999-01-12 21:06 ` rpcc Wes Bauske
1999-01-13 2:16 ` rpcc Richard Henderson
1999-01-14 16:17 ` Alpha 21264 Christoph Dworzak
1999-01-14 15:46 ` Greg Lindahl
1999-01-14 17:27 ` Richard Henderson
1999-10-24 15:04 ` patch_v2: (on Alpha) emulating missing instructions Christoph Dworzak
1999-10-25 9:47 ` Phil Carmody
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