This is the mail archive of the
mailing list for the GCC project.
[PATCH] Consider repz; ret as jump for branch mispredict padding
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Henderson <rth at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jun 2009 22:11:08 +0200
- Subject: [PATCH] Consider repz; ret as jump for branch mispredict padding
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
I've looked today at why test4jmp.sh still shows failures on both x86_64 and
i686 cc1plus binary. The problem is that ix86_pad_returns creates repz; ret
as normal insns instead of jumps ("return" which it replaces is a jump) and
so ix86_avoid_branch_mispredicts considers it as non-jump. Fixed thusly,
fixed all test4jmp.sh reported failures in i686 cc1plus and all but one in
x86_64 cc1plus (the remaining one is in .init section, nothing gcc controls
nor anyone cares, because it is executed just once). .text section in
cc1plus grew by 100-200 bytes.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2009-06-10 Jakub Jelinek <email@example.com>
* config/i386/i386.c (ix86_pad_returns): Use emit_jump_insn_before
instead of emit_insn_before.
--- gcc/config/i386/i386.c.jj 2009-06-08 11:53:54.000000000 +0200
+++ gcc/config/i386/i386.c 2009-06-10 15:57:53.000000000 +0200
@@ -27756,7 +27756,7 @@ ix86_pad_returns (void)
- emit_insn_before (gen_return_internal_long (), ret);
+ emit_jump_insn_before (gen_return_internal_long (), ret);