[PATCH] Pass -mtune and -march options to assembler.

Mark Mitchell mark@codesourcery.com
Fri May 29 22:07:00 GMT 2009


Valdimir Volynsky wrote:

> IMHO, especialy for hand-written assembly code all optimizations by
> assembler must be excluded. Because program's optimization can destroy
> human's optimizations

This isn't an absolute thing.  In some cases it's bad to second-guess
the user; in other cases, it's desirable.  I suspect that a command-line
option, which defaults to no optimization, is the best choice.

>> Certainly, everything that can be done in the compiler with reasonable
>> effort should be done there.
> 
> I agree. But what to do whis opcode/address-dependable optimizations?
> What to do whis Intel's recomentdation: "Ensure instructions using 0xF7
> opcode byte does not start at offset 14 of a fetch line..."

However you are solving this in the assembler, you can also solve it in
the compiler.  After all, the assembler has no information which the
compiler does not provide to it!  There are two parts to that
recommendation: knowing what opcodes start with 0xf7, and knowing the
alignment of instructions.  Both of those things are just as knowable in
the compiler as they are in the assembler.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list