aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Smigiel <trevor_smigiel@playstation.sony.com>2008-08-26 19:43:09 +0000
committerTrevor Smigiel <trevor_smigiel@playstation.sony.com>2008-08-26 19:43:09 +0000
commit419bc121d38fe30277c3d65f145b6c93fddd33a0 (patch)
treefe7e4f6384412e13f02227ca4f6ff0c24f2d301a
parent50b4af3efe865f99c1bbb1912fc819e7ec90fb97 (diff)
Fix hbrp issues.
* haifa-sched.c (sched_emit_insn) : Define. * sched-int.h (sched_emit_insn) : Add prototype. * config/spu/spu.c (spu_sched_reorder) : Use sched_emit_insn. (insert_hbrp_for_ilb_runout) : Put nops between hbr and hbrp insns. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/cell-4_3-branch@139606 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog.cell35
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/config/spu/spu.c44
-rw-r--r--gcc/haifa-sched.c9
-rw-r--r--gcc/sched-int.h1
5 files changed, 87 insertions, 28 deletions
diff --git a/ChangeLog.cell b/ChangeLog.cell
index ee830d04bb6..2bc05b34fc9 100644
--- a/ChangeLog.cell
+++ b/ChangeLog.cell
@@ -1,3 +1,38 @@
+2008-08-26 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+
+ Fix hbrp issues.
+
+ * haifa-sched.c (sched_emit_insn) : Define.
+ * sched-int.h (sched_emit_insn) : Add prototype.
+ * config/spu/spu.c (spu_sched_reorder) : Use sched_emit_insn.
+ (insert_hbrp_for_ilb_runout) : Put nops between hbr and hbrp insns.
+
+2008-08-19 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+
+ Improved branch hints, safe hints, and scheduling.
+
+ * doc/invoke.texi (-mdual-nops, -mhint-max-nops,
+ -mhint-max-distance -msafe-hints) : Document.
+ * config/spu/spu.c (spu_flag_var_tracking): New.
+ (TARGET_SCHED_INIT_GLOBAL, TARGET_SCHED_INIT,
+ TARGET_SCHED_REORDER, TARGET_SCHED_REORDER2,
+ TARGET_ASM_FILE_START): Define.
+ (TARGET_SCHED_ADJUST_PRIORITY): Remove.
+ (STOP_HINT_P, HINTED_P, SCHED_ON_EVEN_P): Define.
+ (spu_emit_branch_hint) Add blocks argument.
+ (insert_branch_hints, insert_nops) Remove.
+ (pad_bb, insert_hbrp_for_ilb_runout, insert_hbrp, in_spu_reorg,
+ uses_ls_unit, spu_sched_init_global, spu_sched_init,
+ spu_sched_reorder, asm_file_start) New functions.
+ (clock_var, spu_sched_length, pipe0_clock,
+ pipe1_clock, prev_clock_var, prev_priority,
+ spu_ls_first, prev_ls_clock) New static variables.
+ * config/spu/spu.h (TARGET_DEFAULT): Add MASK_SAFE_HINTS
+ * config/spu.md (iprefetch): Add operand, make it clobber MEM.
+ (nopn_nv): Add a non-volatile version of nop.
+ * config/spu/spu.opt (-mdual-nops, -mhint-max-nops,
+ -mhint-max-distance, -msafe-hints): New options.
+
2008-08-27 Ben Elliston <bje@au.ibm.com>
* gcc/tree.h (check_qualified_type): Use CONST_CAST_TREE as
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 76c8c500454..38d36190577 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,29 +1,3 @@
-2008-08-19 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
-
- Improved branch hints, safe hints, and scheduling.
-
- * doc/invoke.texi (-mdual-nops, -mhint-max-nops,
- -mhint-max-distance -msafe-hints) : Document.
- * config/spu/spu.c (spu_flag_var_tracking): New.
- (TARGET_SCHED_INIT_GLOBAL, TARGET_SCHED_INIT,
- TARGET_SCHED_REORDER, TARGET_SCHED_REORDER2,
- TARGET_ASM_FILE_START): Define.
- (TARGET_SCHED_ADJUST_PRIORITY): Remove.
- (STOP_HINT_P, HINTED_P, SCHED_ON_EVEN_P): Define.
- (spu_emit_branch_hint) Add blocks argument.
- (insert_branch_hints, insert_nops) Remove.
- (pad_bb, insert_hbrp_for_ilb_runout, insert_hbrp, in_spu_reorg,
- uses_ls_unit, spu_sched_init_global, spu_sched_init,
- spu_sched_reorder, asm_file_start) New functions.
- (clock_var, spu_sched_length, pipe0_clock,
- pipe1_clock, prev_clock_var, prev_priority,
- spu_ls_first, prev_ls_clock) New static variables.
- * config/spu/spu.h (TARGET_DEFAULT): Add MASK_SAFE_HINTS
- * config/spu.md (iprefetch): Add operand, make it clobber MEM.
- (nopn_nv): Add a non-volatile version of nop.
- * config/spu/spu.opt (-mdual-nops, -mhint-max-nops,
- -mhint-max-distance, -msafe-hints): New options.
-
2008-07-24 Ben Elliston <bje@au.ibm.com>
* config/spu/spu-c.c: Move GTY markers to match the precedent.
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index a3987dd8bde..f9207a4a9b5 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2368,6 +2368,7 @@ insert_hbrp_for_ilb_runout (rtx first)
rtx insn, before_4 = 0, before_16 = 0;
int addr = 0, length, first_addr = -1;
int hbrp_addr0 = 128 * 4, hbrp_addr1 = 128 * 4;
+ int insert_lnop_after = 0;
for (insn = first; insn; insn = NEXT_INSN (insn))
if (INSN_P (insn))
{
@@ -2378,9 +2379,31 @@ insert_hbrp_for_ilb_runout (rtx first)
if (before_4 == 0 && addr + length >= 4 * 4)
before_4 = insn;
- if (before_16 == 0 && addr + length >= 16 * 4)
+ /* We test for 14 instructions because the first hbrp will add
+ up to 2 instructions. */
+ if (before_16 == 0 && addr + length >= 14 * 4)
before_16 = insn;
+ if (INSN_CODE (insn) == CODE_FOR_hbr)
+ {
+ /* Make sure an hbrp is at least 2 cycles away from a hint.
+ Insert an lnop after the hbrp when necessary. */
+ if (before_4 == 0 && addr > 0)
+ {
+ before_4 = insn;
+ insert_lnop_after |= 1;
+ }
+ else if (before_4 && addr <= 4 * 4)
+ insert_lnop_after |= 1;
+ if (before_16 == 0 && addr > 10 * 4)
+ {
+ before_16 = insn;
+ insert_lnop_after |= 2;
+ }
+ else if (before_16 && addr <= 14 * 4)
+ insert_lnop_after |= 2;
+ }
+
if (INSN_CODE (insn) == CODE_FOR_iprefetch)
{
if (addr < hbrp_addr0)
@@ -2418,6 +2441,14 @@ insert_hbrp_for_ilb_runout (rtx first)
INSN_ADDRESSES (INSN_UID (before_4)));
PUT_MODE (insn, GET_MODE (before_4));
PUT_MODE (before_4, TImode);
+ if (insert_lnop_after & 1)
+ {
+ insn = emit_insn_before (gen_lnop (), before_4);
+ recog_memoized (insn);
+ INSN_ADDRESSES_NEW (insn,
+ INSN_ADDRESSES (INSN_UID (before_4)));
+ PUT_MODE (insn, TImode);
+ }
}
if ((hbrp_addr0 <= 4 * 4 || hbrp_addr0 > 16 * 4)
&& hbrp_addr1 > 16 * 4)
@@ -2429,6 +2460,15 @@ insert_hbrp_for_ilb_runout (rtx first)
INSN_ADDRESSES (INSN_UID (before_16)));
PUT_MODE (insn, GET_MODE (before_16));
PUT_MODE (before_16, TImode);
+ if (insert_lnop_after & 2)
+ {
+ insn = emit_insn_before (gen_lnop (), before_16);
+ recog_memoized (insn);
+ INSN_ADDRESSES_NEW (insn,
+ INSN_ADDRESSES (INSN_UID
+ (before_16)));
+ PUT_MODE (insn, TImode);
+ }
}
return;
}
@@ -2943,7 +2983,7 @@ spu_sched_reorder (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
&& spu_sched_length - spu_ls_first >= 4 * 15
&& !(pipe0_clock < clock && pipe_0 >= 0) && pipe_1 == pipe_ls)
{
- insn = emit_insn (gen_iprefetch (GEN_INT (3)));
+ insn = sched_emit_insn (gen_iprefetch (GEN_INT (3)));
recog_memoized (insn);
if (pipe0_clock < clock)
PUT_MODE (insn, TImode);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 6a53543f5e3..ffe74ec8a28 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -4395,6 +4395,15 @@ bb_note (basic_block bb)
return note;
}
+rtx
+sched_emit_insn (rtx pat)
+{
+ rtx insn = emit_insn_after (pat, last_scheduled_insn);
+ last_scheduled_insn = insn;
+ extend_global (insn);
+ return insn;
+}
+
#ifdef ENABLE_CHECKING
/* Helper function for check_cfg.
Return nonzero, if edge vector pointed to by EL has edge with TYPE in
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index 60919f09c41..d1b86905b10 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -848,6 +848,7 @@ extern bool sched_insn_is_legitimate_for_speculation_p (const_rtx, ds_t);
extern void unlink_bb_notes (basic_block, basic_block);
extern void add_block (basic_block, basic_block);
extern rtx bb_note (basic_block);
+extern rtx sched_emit_insn (rtx);
/* Functions in sched-rgn.c. */