------- Comment #22 from rguenth at gcc dot gnu dot org  2010-06-19 12:58 
-------
(In reply to comment #21)
> This is the inline (after preprocessor) 
> 
> I guess the many asm meta commands confuse the heuristic. Maybe it could
> be fixed to ignore such commands.
> 
> static inline void rdtsc_barrier(void)
> {
>  asm volatile ("661:\n\t"
 ".byte 0x66,0x66,0x90\n"
 "\n
662:\n"
 ".section .altinstructions,\"a\"\n"
 " " ".balign 8" " " "\n"
" " ".quad" " " "661b\n"
 " " ".quad" " " "663f\n"
 "   .byte " "(3*32+17)" "\n"
 "      .byte 662b-661b\n"
 "    .byte 664f-663f\n"
 "    .byte 0xff + (664f-663f) - (662b-661b)\n"
> ".previous\n"
 ".section .altinstr_replacement, \"ax\"\n"
 "663:\n
\t" "mfence" "\n664:\n"
 ".previous" : : : "memory");

that's 16 lines alone and the call stmt removal doens't result in so
much code-saving that the code size would not increase (which is what
-Os is about - do _not_ increase code-size, not do increase it only
a little).  If I read the above asm correctly it will result in a
single instruction?  We could add support for annotating asm()s
with a size, though that's probably just another source of possible
errors.

The size estimation used is final.c:asm_str_count(), it is currently
not architecture specific.

It could be improved to disregard vertical space and label-only
lines (though even that is tricky to do with respect to the various
assemblers we try to support).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44129

Reply via email to