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: MS/CW-style inline assembly for GCC


>>>>> "Nathan" == Nathan Sidwell <nathan@codesourcery.com> writes:

 Nathan> Richard Earnshaw wrote:
 >> On Fri, 2004-05-07 at 22:38, Paul Koning wrote:

 >>> I think an asm statement with any semantics OTHER than "make this
 >>> block of instructions appear in the binary exactly as written" is
 >>> badly broken.  (Yes, that's why the MIPS assembler is bogus --
 >>> although there at least you can tell it ".set noreorder".)

 >> I used to think that way myself, but these days I'm not so sure.
 >> Modern processors perform abysmally if code is not correctly
 >> scheduled, and there's no way that a programmer can tune their
 >> code for every variant of a CPU on the market.  Allowing the tools
 >> to reschedule the contents of ASM blocks is potentially a major
 >> win.

 Nathan> yup. My experience of this kind of thing has been 1) use C
 Nathan> for the control structure 2) use single asm inserts 3) allow
 Nathan> the compiler to do register allocation and scheduling

That's just fine.  But that's not what I was objecting to.

My understanding is that the CW style will take a SINGLE asm block and
fiddle with it.  I believe that's broken.

If you write only single-like asm blocks, then this issue by
definition cannot occur (unless you have MIPS style pseudo-assemblers,
of course).  And it is perfectly sane for the compiler to schedule
whole blocks of asm code.  What isn't fine is for it to attempt to
interpret the meaning of the individual lines within an asm block, and
permute them.

	paul


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