Path: utzoo!attcan!uunet!mcvax!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.lang.c Subject: Re: iAPX86 code for ABS (using Microsof Message-ID: <8208@boring.cwi.nl> Date: 19 Jun 89 23:52:47 GMT References: <1202@draken.nada.kth.se> <225800188@uxe.cso.uiuc.edu> Organization: CWI, Amsterdam Lines: 23 In article <225800188@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: > ; b = abs(a) ... > cwd > xor ax,dx > sub ax,dx ... > So your review was correct! I assume that they do this odd thing in > order to not empty instruction prefetch queues???????????????? > No, it is faster; just count clock cycles and compare to: jns lab neg ax lab: On many machines jumps are not cheap, so it may be better to avoid them. (There are machines where if(a >= 0 && b >= 0) is cheaper if && is not short-circuited.) -- dik t. winter, cwi, amsterdam, nederland INTERNET : dik@cwi.nl BITNET/EARN: dik@mcvax