On Fri, Jan 3, 2014 at 9:37 AM, Jakub Jelinek <ja...@redhat.com> wrote:

> Linus complained about padding inserted in between asm goto.  In 4.8
> even -mtune=generic performs ix86_avoid_jump_mispredicts, in 4.9 only e.g.
> -mtune=atom and others, but not generic.
> The issue is that assuming every asm goto must contain a jump is too
> pessimistic, often asm goto (may) transfer control to the label(s) through
> other means (e.g. on the side data structure with labels etc.), plus we
> conservatively assume asm goto is 0 bytes long, so we were adding the
> paddings pretty much always when multiple asm goto stmts appeared
> consecutively.
>
> This patch just ignores asm goto from the optimization.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk and 4.8
> after a while?
>
> 2014-01-03  Jakub Jelinek  <ja...@redhat.com>
>
>         PR target/59625
>         * config/i386/i386.c (ix86_avoid_jump_mispredicts): Don't consider
>         asm goto as jump.
>
>         * gcc.target/i386/pr59625.c: New test.

OK everywhere, but please add a short comment about asm goto handling

> +/* Verify we don't consider asm goto as a jump for four jumps limit
> +   optimization.  asm goto doesn't have to contain a jump at all,
> +   the branching to labels can happen through different means.  */
> +/* { dg-final { scan-assembler-not 
> "p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*p2align\[^\n\r\]*\[\n\r]*\[^\n\r\]*p2align"
>  } } */

This RE can probably use match count, "{n}", as e.g. in g++.dg/abi/mangle33.C

Thanks,
Uros.

Reply via email to