Ilya Zakharevich on Mon, 8 Apr 2002 19:30:15 -0400 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: GP/PARI 2.1.3: ix86 assembler for divll |
On Mon, Apr 01, 2002 at 04:54:45PM -0500, Ilya Zakharevich wrote: > Try compiling this (e.g., append it to src/gp/gp.c) > > void > ddummyy(ulong a) > { > (void)divll(a, 1000000000); > } > > On ix86, this produces the following assembler: > > .align 2 > .globl _ddummyy > _ddummyy: > movl 4(%esp),%eax > movl _hiremainder,%edx > /APP > divl $1000000000 > /NO_APP > movl %edx,_hiremainder > ret > > which results in the following message from gas: > > {stdin}: Assembler messages: > {stdin}:9343: Error: operands given don't match any known 386 instruction Per 386book, IDIV takes memory or register operand. Per http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_16.html#SEC175 this should be denoted "mr", not "g" ("g" includes immediate-integer operands). --- ./src/kernel/ix86/level0.h-pre Fri Nov 3 13:00:24 2000 +++ ./src/kernel/ix86/level0.h Mon Apr 8 15:41:16 2002 @@ -173,7 +173,7 @@ extern ulong hiremainder; ({ ulong __value, __arg1 = (a), __arg2 = (b); \ __asm__ ("divl %4" \ : "=a" /* %eax */ (__value), "=d" /* %edx */ (hiremainder) \ - : "0" /* %eax */ (__arg1), "1" /* %edx */ (hiremainder), "g" (__arg2)); \ + : "0" /* %eax */ (__arg1), "1" /* %edx */ (hiremainder), "mr" /* memory or general register */ (__arg2)); \ __value; \ }) Enjoy, Ilya