mirrored from git://gcc.gnu.org/git/gcc.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
claziss
committed
Jun 13, 2018
1 parent
3df4cca
commit 5afc07e
Showing
6 changed files
with
166 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* { dg-do assemble } * | ||
/* { dg-skip-if "" { ! { clmcpu } } } */ | ||
/* { dg-options "-O3 -funroll-loops -mno-sdata -mcpu=arc700" } */ | ||
|
||
typedef long long a __attribute__((__mode__(__DI__))); | ||
typedef struct c c; | ||
|
||
struct b | ||
{ | ||
int d; | ||
c *e; | ||
}; | ||
|
||
enum { f }; | ||
|
||
typedef struct | ||
{ | ||
a g; | ||
a h; | ||
int i; | ||
} j; | ||
|
||
struct c | ||
{ | ||
int count; | ||
int current; | ||
}; | ||
|
||
int k; | ||
|
||
extern void bar (int, long long); | ||
int foo (struct b *demux, __builtin_va_list args) | ||
{ | ||
c m = *demux->e; | ||
j *n; | ||
switch (k) | ||
case f: | ||
{ | ||
a o = __builtin_va_arg(args, a); | ||
m.current = 0; | ||
while (m.current < m.count) | ||
{ | ||
if (n[m.current].h > o) { | ||
bar (demux->d, 4 + 128LL * n[m.current].i); | ||
break; | ||
} | ||
m.current++; | ||
} | ||
return 0; | ||
} | ||
} |