Commit 966f97ac by Jakub Jelinek Committed by Andreas Krebbel

re PR target/58574 (Wrong code due to s390x machine reorg pass)

2013-10-01  Jakub Jelinek  <jakub@redhat.com>
            Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>

	PR target/58574
	* config/s390/s390.c (s390_split_branches): Modify check for table
	jump insns.
	(s390_chunkify_start): Rearrange table jump insn check in order to
	deal with compare and branch insns correctly.

2013-10-01  Jakub Jelinek  <jakub@redhat.com>

	PR target/58574
	* gcc.c-torture/execute/pr58574.c: New testcase.



Co-Authored-By: Andreas Krebbel <Andreas.Krebbel@de.ibm.com>

From-SVN: r203060
parent 3a323a38
2013-10-01 Jakub Jelinek <jakub@redhat.com>
Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR target/58574
* config/s390/s390.c (s390_split_branches): Modify check for table
jump insns.
(s390_chunkify_start): Rearrange table jump insn check in order to
deal with compare and branch insns correctly.
2013-10-01 Kugan Vivekanandarajah <kuganv@linaro.org> 2013-10-01 Kugan Vivekanandarajah <kuganv@linaro.org>
PR target/58578 PR target/58578
......
...@@ -6025,11 +6025,11 @@ s390_split_branches (void) ...@@ -6025,11 +6025,11 @@ s390_split_branches (void)
for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{ {
if (! JUMP_P (insn)) if (! JUMP_P (insn) || tablejump_p (insn, NULL, NULL))
continue; continue;
pat = PATTERN (insn); pat = PATTERN (insn);
if (GET_CODE (pat) == PARALLEL && XVECLEN (pat, 0) > 2) if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0); pat = XVECEXP (pat, 0, 0);
if (GET_CODE (pat) != SET || SET_DEST (pat) != pc_rtx) if (GET_CODE (pat) != SET || SET_DEST (pat) != pc_rtx)
continue; continue;
...@@ -7049,6 +7049,8 @@ s390_chunkify_start (void) ...@@ -7049,6 +7049,8 @@ s390_chunkify_start (void)
for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{ {
rtx table;
/* Labels marked with LABEL_PRESERVE_P can be target /* Labels marked with LABEL_PRESERVE_P can be target
of non-local jumps, so we have to mark them. of non-local jumps, so we have to mark them.
The same holds for named labels. The same holds for named labels.
...@@ -7063,42 +7065,41 @@ s390_chunkify_start (void) ...@@ -7063,42 +7065,41 @@ s390_chunkify_start (void)
if (! vec_insn || ! JUMP_TABLE_DATA_P (vec_insn)) if (! vec_insn || ! JUMP_TABLE_DATA_P (vec_insn))
bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (insn)); bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (insn));
} }
/* Check potential targets in a table jump (casesi_jump). */
else if (tablejump_p (insn, NULL, &table))
{
rtx vec_pat = PATTERN (table);
int i, diff_p = GET_CODE (vec_pat) == ADDR_DIFF_VEC;
for (i = 0; i < XVECLEN (vec_pat, diff_p); i++)
{
rtx label = XEXP (XVECEXP (vec_pat, diff_p, i), 0);
/* If we have a direct jump (conditional or unconditional) if (s390_find_pool (pool_list, label)
or a casesi jump, check all potential targets. */ != s390_find_pool (pool_list, insn))
bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label));
}
}
/* If we have a direct jump (conditional or unconditional),
check all potential targets. */
else if (JUMP_P (insn)) else if (JUMP_P (insn))
{ {
rtx pat = PATTERN (insn); rtx pat = PATTERN (insn);
rtx table;
if (GET_CODE (pat) == PARALLEL && XVECLEN (pat, 0) > 2) if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0); pat = XVECEXP (pat, 0, 0);
if (GET_CODE (pat) == SET) if (GET_CODE (pat) == SET)
{ {
rtx label = JUMP_LABEL (insn); rtx label = JUMP_LABEL (insn);
if (label) if (label)
{ {
if (s390_find_pool (pool_list, label) if (s390_find_pool (pool_list, label)
!= s390_find_pool (pool_list, insn)) != s390_find_pool (pool_list, insn))
bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label)); bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label));
} }
}
else if (tablejump_p (insn, NULL, &table))
{
rtx vec_pat = PATTERN (table);
int i, diff_p = GET_CODE (vec_pat) == ADDR_DIFF_VEC;
for (i = 0; i < XVECLEN (vec_pat, diff_p); i++)
{
rtx label = XEXP (XVECEXP (vec_pat, diff_p, i), 0);
if (s390_find_pool (pool_list, label)
!= s390_find_pool (pool_list, insn))
bitmap_set_bit (far_labels, CODE_LABEL_NUMBER (label));
}
} }
} }
} }
/* Insert base register reload insns before every pool. */ /* Insert base register reload insns before every pool. */
......
2013-10-01 Jakub Jelinek <jakub@redhat.com>
PR target/58574
* gcc.c-torture/execute/pr58574.c: New testcase.
2013-10-01 Kugan Vivekanandarajah <kuganv@linaro.org> 2013-10-01 Kugan Vivekanandarajah <kuganv@linaro.org>
PR Target/58578 PR Target/58578
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment