From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 7868 invoked from network); 18 Oct 1999 14:47:06 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 18 Oct 1999 14:47:06 -0000 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id KAA31318 for ; Mon, 18 Oct 1999 10:47:04 -0400 Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id QAA05093 for ; Mon, 18 Oct 1999 16:47:00 +0200 (MET DST) Received: (from harley@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA18379 for axp-list@redhat.com; Mon, 18 Oct 1999 16:46:59 +0200 (MET DST) Date: Mon, 18 Oct 1999 16:46:59 +0200 (MET DST) From: Robert Harley Message-Id: <199910181446.QAA18379@pauillac.inria.fr> To: axp-list@redhat.com Subject: Re: patch_v2: (on Alpha) emulating missing instructions 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.