From owner-freebsd-hackers Mon Jan 7 13:15: 9 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mail12.speakeasy.net (mail12.speakeasy.net [216.254.0.212]) by hub.freebsd.org (Postfix) with ESMTP id 3ADD737B404 for ; Mon, 7 Jan 2002 13:14:35 -0800 (PST) Received: (qmail 19379 invoked from network); 7 Jan 2002 21:14:33 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail12.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 7 Jan 2002 21:14:33 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <3C3A0674.5BD4A62C@math.missouri.edu> Date: Mon, 07 Jan 2002 13:14:02 -0800 (PST) From: John Baldwin To: Stephen Montgomery-Smith Subject: Re: Tell gcc I have a i686 Cc: freebsd-hackers@FreeBSD.org, "Matthew D. Fuller" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 07-Jan-02 Stephen Montgomery-Smith wrote: > John Baldwin wrote: >> >> On 07-Jan-02 Stephen Montgomery-Smith wrote: >> > John Baldwin wrote: >> >> >> >> > You know, I have no idea. It is someone elses code. These are the >> >> > instructions. Can anyone tell me? >> >> > >> >> > "movl 32(%0),%1\n" >> >> > "adcl %1,32(%0)\n" >> >> > >> >> > Also, from this discussion, what I have decided to do is provide it as >> >> > an option for the user to add by editing the Makefile - not to do it >> >> > automatically. >> >> >> >> These instructions are 386 instructions. What we need to see are the >> >> contraints (the stuff after the actual instructions with colons in them) >> >> to >> >> see >> >> if it is somehow using Pentium Pro+ specific registers. And actually, >> >> just >> >> for >> >> the record, a PPro is a 686. :) >> >> >> > >> > OK, this is it in context: >> > >> > register Word32 *_x = x; >> > register int _a = 0; >> > >> > asm("xorl %1,%1\n" /* clear C */ >> > "movl 124(%0),%1\n" >> > "adcl %1,124(%0)\n" >> > : : "r" (_x), "r" (_a) >> > ); >> >> Looks like rather silly code to double the value at x + 124. I say silly >> casue >> it clears carry and then does a addcl. However, since CF is zero, this is >> the >> same as doing an addl. Since it is just doubling the value, a shl would >> make >> more sense (and only be 1 instruction.) >> > > More likely I am butchering the code by trying to only give you part of > it. The whole code is designed to take N 32 bit words and do a left > shift on it: Ok. This isn't 686 specific at all. However, one optimization might be to get rid of the xorl, and use 'addl' for the first instruction instead of adcl. Anyways, If I were you, I would do it via a series of rcl (rotate through carry left, it shits in the carry flag instead of 0), thus I would do: "shl (%0),1\n" #if (N >= 2) "rcl 4(%0),1\n" #endif etc. using a single rcl for the rest of the shifts. Using multiple instructions might be useful if you did multiple loads to different destination registers by interleaving movl's and adcl's, and alternating temporary registers to try and use the multiple pipelines on Pentiums and better. Then again, these instructions might not work well for that. *shrug* Or perhaps if it uses suitable temporary registers, this might be doing all the loads in one pipeline and the adcl's in the others to get a jumpstart on each mov. I dunno. :-P -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message