This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-4.3.0/ppc32 inline assembly produces bad code


On Wed, Mar 26, 2008 at 09:25:05AM -0700, Till Straumann wrote:
> Is my inline assembly wrong or is this a gcc bug ?

Your inline assembly seems wrong.

> /* Powerpc I/O barrier instruction */
> #define EIEIO(pmem) do { asm volatile("eieio":"=m"(*pmem):"m"(*pmem)); }  
> while (0)

An output memory doesn't mean what you think.  I suspect GCC gave you
an input memory operand as "%r0(%r9)" and an output memory operand as
"%r9", and expected the asm to do what it said it would do with its
operands.

Which doesn't make much sense... but there you go.

Try clobbering it instead, but you don't even need to since the
pointer is already volatile.  asm volatile ("eieio") should work fine.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]