From: Daniel K. <ko...@li...> - 2006-02-27 22:50:51
|
On Mon, Feb 27, 2006 at 09:36:15PM +0000, Erik Walthinsen wrote: > -------- Original Message -------- > Subject: Bug in libdv MMX inline asm > From: Zan Lynx <zl...@ac...> > To: ome...@us... > Date: Mon, 27 Feb 2006 13:58:04 -0700 > > Testing a new GCC 4.1 beta I discovered that it put one of the global > statics into a register. AMD-64 has a lot of them to use. :) > > This caused a build error because the asm code was using memory to > register functions to try to do reg to reg operations. > > To fix this, use the memory constraint in the m2r and r2m macros instead > of the X (anything goes) constraint. Richard Guenther from Suse passed me the following patch, which he needed to build libdv on x86 with gcc 4.1. Most parts are also contained in Zan's larger patch, but apparently the first change in Richard's patch needs to be added on top of that. (Sorry, I had been sitting on this patch for way too long and was only reminded of it by Erik's mail to the list.) Regards, Daniel. --- libdv/mmx.h.orig 2005-10-26 13:20:55.000000000 +0200 +++ libdv/mmx.h 2005-10-26 13:25:21.000000000 +0200 @@ -353,16 +353,16 @@ #define mmx_i2r(op, imm, reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ - : "X" (imm) ) + : "i" (imm) ) #define mmx_m2r(op, mem, reg) \ __asm__ __volatile__ (#op " %0, %%" #reg \ : /* nothing */ \ - : "X" (mem)) + : "m" (mem)) #define mmx_r2m(op, reg, mem) \ __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ + : "=m" (mem) \ : /* nothing */ ) #define mmx_r2r(op, regs, regd) \ @@ -372,8 +372,8 @@ __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ #op " %1, %%mm0\n\t" \ "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) + : "=m" (memd) \ + : "m" (mems)) #endif |