Date: Mon, 07 Jan 2002 14:35:00 -0600 From: Stephen Montgomery-Smith <stephen@math.missouri.edu> To: John Baldwin <jhb@FreeBSD.org> Cc: "Matthew D. Fuller" <fullermd@over-yonder.net>, freebsd-hackers@FreeBSD.org Subject: Re: Tell gcc I have a i686 Message-ID: <3C3A0674.5BD4A62C@math.missouri.edu> References: <XFMail.020107115534.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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: register Word32 *_x = x; register int _a = 0; asm("xorl %1,%1\n" /* clear C */ "movl (%0),%1\n" "adcl %1,(%0)\n" #if (N >= 2) "movl 4(%0),%1\n" "adcl %1,4(%0)\n" #endif #if (N >= 3) "movl 8(%0),%1\n" "adcl %1,8(%0)\n" #endif #if (N >= 4) "movl 12(%0),%1\n" "adcl %1,12(%0)\n" #endif #if (N >= 5) "movl 16(%0),%1\n" "adcl %1,16(%0)\n" #endif #if (N >= 6) "movl 20(%0),%1\n" "adcl %1,20(%0)\n" #endif #if (N >= 7) "movl 24(%0),%1\n" "adcl %1,24(%0)\n" #endif #if (N >= 8) "movl 28(%0),%1\n" "adcl %1,28(%0)\n" #endif #if (N >= 9) "movl 32(%0),%1\n" "adcl %1,32(%0)\n" #endif #if (N >= 10) "movl 36(%0),%1\n" "adcl %1,36(%0)\n" #endif #if (N >= 11) "movl 40(%0),%1\n" "adcl %1,40(%0)\n" #endif #if (N >= 12) "movl 44(%0),%1\n" "adcl %1,44(%0)\n" #endif #if (N >= 13) "movl 48(%0),%1\n" "adcl %1,48(%0)\n" #endif #if (N >= 14) "movl 52(%0),%1\n" "adcl %1,52(%0)\n" #endif #if (N >= 15) "movl 56(%0),%1\n" "adcl %1,56(%0)\n" #endif #if (N >= 16) "movl 60(%0),%1\n" "adcl %1,60(%0)\n" #endif #if (N >= 17) "movl 64(%0),%1\n" "adcl %1,64(%0)\n" #endif #if (N >= 18) "movl 68(%0),%1\n" "adcl %1,68(%0)\n" #endif #if (N >= 19) "movl 72(%0),%1\n" "adcl %1,72(%0)\n" #endif #if (N >= 20) "movl 76(%0),%1\n" "adcl %1,76(%0)\n" #endif #if (N >= 21) "movl 80(%0),%1\n" "adcl %1,80(%0)\n" #endif #if (N >= 22) "movl 84(%0),%1\n" "adcl %1,84(%0)\n" #endif #if (N >= 23) "movl 88(%0),%1\n" "adcl %1,88(%0)\n" #endif #if (N >= 24) "movl 92(%0),%1\n" "adcl %1,92(%0)\n" #endif #if (N >= 25) "movl 96(%0),%1\n" "adcl %1,96(%0)\n" #endif #if (N >= 26) "movl 100(%0),%1\n" "adcl %1,100(%0)\n" #endif #if (N >= 27) "movl 104(%0),%1\n" "adcl %1,104(%0)\n" #endif #if (N >= 28) "movl 108(%0),%1\n" "adcl %1,108(%0)\n" #endif #if (N >= 29) "movl 112(%0),%1\n" "adcl %1,112(%0)\n" #endif #if (N >= 30) "movl 116(%0),%1\n" "adcl %1,116(%0)\n" #endif #if (N >= 31) "movl 120(%0),%1\n" "adcl %1,120(%0)\n" #endif #if (N >= 32) "movl 124(%0),%1\n" "adcl %1,124(%0)\n" #endif : : "r" (_x), "r" (_a) ); -- Stephen Montgomery-Smith stephen@math.missouri.edu http://www.math.missouri.edu/~stephen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C3A0674.5BD4A62C>