]> git.ipfire.org Git - thirdparty/gcc.git/commit
[ARC] Reimplement return padding operation for ARC700.
authorclaziss <claziss@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 08:43:56 +0000 (08:43 +0000)
committerclaziss <claziss@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 13 Jun 2018 08:43:56 +0000 (08:43 +0000)
commit5afc07eeb18fb7dd351ac981367bce721ca22af3
treee980080e39e343317abe7dc492173a7cc68e3e56
parent3df4cca470b3aa12643ed68c08d9fecd8d1c10bf
[ARC] Reimplement return padding operation for ARC700.

For ARC700, adding padding if necessary to avoid a mispredict.  A
return could happen immediately after the function start.  A
call/return and return/return must be 6 bytes apart to avoid
mispredict.

The old implementation was doing this operation very late in the
compilation process, and the additional nop instructions and/or
forcing some other instruction to take their long form was not taken
into account when generating brcc instructions. Thus, wrong code could
be generated.

gcc/
2017-03-24  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc-protos.h (arc_pad_return): Remove.
* config/arc/arc.c (machine_function): Remove force_short_suffix
and size_reason.
(arc_print_operand): Adjust printing of '&'.
(arc_verify_short): Remove conditional printing of short suffix.
(arc_final_prescan_insn): Remove reference to size_reason.
(pad_return): New function.
(arc_reorg): Call pad_return.
(arc_pad_return): Remove.
(arc_init_machine_status): Remove reference to force_short_suffix.
* config/arc/arc.md (vunspec): Add VUNSPEC_ARC_BLOCKAGE.
(attr length): When attribute iscompact is true force to 2
regardless; in the case of maybe check if we want to force the
instruction to have 4 bytes length.
(nopv): Change it to generate 4 byte long nop as well.
(blockage): New pattern.
(simple_return): Remove call to arc_pad_return.
(p_return_i): Likewise.

gcc/testsuite/
2017-03-24  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/pr9001107555.c: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261542 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arc/arc-protos.h
gcc/config/arc/arc.c
gcc/config/arc/arc.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arc/pr9001107555.c [new file with mode: 0644]