summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-06 21:20:43 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2002-06-06 21:20:43 +0000
commitd321a68b6399071a75ef335336068e3a8b789666 (patch)
treefaa2390f8f70ae3e60f4e184669ef5304b7cb309
parent8000c5ebe796b473d677d54fabf5c4c7994afb9b (diff)
downloadgcc-d321a68b6399071a75ef335336068e3a8b789666.tar.gz
* i386.md (and promoting splitters): Disable QI to SImode promoting
when doing so changes immediate to be 32bit. * rtl.h (emit_*_scope): Declare. * emit-rtl.c (emit_*_scope): New global functions. (try_split): Copy scope. * ifcvt.c (noce_try_store_flag, noce_try_store_flag_constants, noce_try_flag_inc, noce_try_store_flag_mask, noce_try_cmove, noce_try_cmove_arith, noce_try_minmax, noce_try_abs, noce_process_if_block, find_cond_trap): Copy scopes. * recog.c (peephole2_optimize): likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54327 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/i386/i386.md13
-rw-r--r--gcc/emit-rtl.c78
-rw-r--r--gcc/ifcvt.c23
-rw-r--r--gcc/recog.c3
-rw-r--r--gcc/rtl.h8
6 files changed, 122 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dcc6990425f..d42f67447fc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+Thu Jun 6 23:14:46 CEST 2002 Jan Hubicka <jh@suse.cz>
+
+ * i386.md (and promoting splitters): Disable QI to SImode promoting
+ when doing so changes immediate to be 32bit.
+
+ * rtl.h (emit_*_scope): Declare.
+ * emit-rtl.c (emit_*_scope): New global functions.
+ (try_split): Copy scope.
+ * ifcvt.c (noce_try_store_flag, noce_try_store_flag_constants,
+ noce_try_flag_inc, noce_try_store_flag_mask, noce_try_cmove,
+ noce_try_cmove_arith, noce_try_minmax, noce_try_abs,
+ noce_process_if_block, find_cond_trap): Copy scopes.
+ * recog.c (peephole2_optimize): likewise.
+
2002-06-06 Jeffrey Law <law@redhat.com>
* h8300.h (OK_FOR_U): Fix thinko exposed by flag checking.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index f2203c40571..10c31295fd3 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -16358,6 +16358,8 @@
&& ix86_match_ccmode (insn, CCNOmode)
&& (GET_MODE (operands[0]) == HImode
|| (GET_MODE (operands[0]) == QImode
+ /* Ensure that the operand will remain sign extended immedaite. */
+ && INTVAL (operands[2]) >= 0
&& (TARGET_PROMOTE_QImode || optimize_size)))"
[(parallel [(set (reg:CCNO 17)
(compare:CCNO (and:SI (match_dup 1) (match_dup 2))
@@ -16371,16 +16373,17 @@
operands[0] = gen_lowpart (SImode, operands[0]);
operands[1] = gen_lowpart (SImode, operands[1]);")
+; Don't promote the QImode tests, as i386 don't have encoding of
+; the test instruction with 32bit sign extended immediate and thus
+; the code grows.
(define_split
[(set (reg 17)
- (compare (and (match_operand 0 "aligned_operand" "")
- (match_operand 1 "const_int_operand" ""))
+ (compare (and (match_operand:HI 0 "aligned_operand" "")
+ (match_operand:HI 1 "const_int_operand" ""))
(const_int 0)))]
"! TARGET_PARTIAL_REG_STALL && reload_completed
&& ix86_match_ccmode (insn, CCNOmode)
- && (GET_MODE (operands[0]) == HImode
- || (GET_MODE (operands[0]) == QImode
- && (TARGET_PROMOTE_QImode || optimize_size)))"
+ && GET_MODE (operands[0]) == HImode"
[(set (reg:CCNO 17)
(compare:CCNO (and:SI (match_dup 0) (match_dup 1))
(const_int 0)))]
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 9d15fdf6ae4..724244baae4 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3205,7 +3205,7 @@ try_split (pat, trial, last)
if (GET_CODE (XVECEXP (seq, 0, i)) == INSN)
mark_label_nuses (PATTERN (XVECEXP (seq, 0, i)));
- tem = emit_insn_after (seq, trial);
+ tem = emit_insn_after_scope (seq, trial, INSN_SCOPE (trial));
delete_insn (trial);
if (has_barrier)
@@ -4069,6 +4069,82 @@ emit_line_note_after (file, line, after)
return note;
}
+/* Like emit_insn_after, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_insn_after_scope (pattern, after, scope)
+ rtx pattern, after;
+ tree scope;
+{
+ rtx last = emit_insn_after (pattern, after);
+ for (after = NEXT_INSN (after); after != last; after = NEXT_INSN (after))
+ INSN_SCOPE (after) = scope;
+ return last;
+}
+
+/* Like emit_insns_after, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_insns_after_scope (pattern, after, scope)
+ rtx pattern, after;
+ tree scope;
+{
+ rtx last = emit_insns_after (pattern, after);
+ for (after = NEXT_INSN (after); after != last; after = NEXT_INSN (after))
+ INSN_SCOPE (after) = scope;
+ return last;
+}
+
+/* Like emit_jump_insn_after, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_jump_insn_after_scope (pattern, after, scope)
+ rtx pattern, after;
+ tree scope;
+{
+ rtx last = emit_jump_insn_after (pattern, after);
+ for (after = NEXT_INSN (after); after != last; after = NEXT_INSN (after))
+ INSN_SCOPE (after) = scope;
+ return last;
+}
+
+/* Like emit_call_insn_after, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_call_insn_after_scope (pattern, after, scope)
+ rtx pattern, after;
+ tree scope;
+{
+ rtx last = emit_call_insn_after (pattern, after);
+ for (after = NEXT_INSN (after); after != last; after = NEXT_INSN (after))
+ INSN_SCOPE (after) = scope;
+ return last;
+}
+
+/* Like emit_insn_before, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_insn_before_scope (pattern, before, scope)
+ rtx pattern, before;
+ tree scope;
+{
+ rtx first = PREV_INSN (before);
+ rtx last = emit_insn_before (pattern, before);
+
+ for (first = NEXT_INSN (first); first != last; first = NEXT_INSN (first))
+ INSN_SCOPE (first) = scope;
+ return last;
+}
+
+/* Like emit_insns_before, but set INSN_SCOPE according to SCOPE. */
+rtx
+emit_insns_before_scope (pattern, before, scope)
+ rtx pattern, before;
+ tree scope;
+{
+ rtx first = PREV_INSN (before);
+ rtx last = emit_insns_before (pattern, before);
+
+ for (first = NEXT_INSN (first); first != last; first = NEXT_INSN (first))
+ INSN_SCOPE (first) = scope;
+ return last;
+}
+
/* Make an insn of code INSN with pattern PATTERN
and add it to the end of the doubly-linked list.
If PATTERN is a SEQUENCE, take the elements of it
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 4ed1494416e..842eb547383 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -612,7 +612,7 @@ noce_try_store_flag (if_info)
seq = get_insns ();
end_sequence ();
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump, INSN_SCOPE (if_info->insn_a));
return TRUE;
}
@@ -747,7 +747,7 @@ noce_try_store_flag_constants (if_info)
if (seq_contains_jump (seq))
return FALSE;
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump, INSN_SCOPE (if_info->insn_a));
return TRUE;
}
@@ -807,7 +807,8 @@ noce_try_store_flag_inc (if_info)
if (seq_contains_jump (seq))
return FALSE;
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump,
+ INSN_SCOPE (if_info->insn_a));
return TRUE;
}
@@ -859,7 +860,8 @@ noce_try_store_flag_mask (if_info)
if (seq_contains_jump (seq))
return FALSE;
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump,
+ INSN_SCOPE (if_info->insn_a));
return TRUE;
}
@@ -954,7 +956,8 @@ noce_try_cmove (if_info)
seq = get_insns ();
end_sequence ();
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump,
+ INSN_SCOPE (if_info->insn_a));
return TRUE;
}
else
@@ -1116,7 +1119,7 @@ noce_try_cmove_arith (if_info)
tmp = get_insns ();
end_sequence ();
- emit_insns_before (tmp, if_info->jump);
+ emit_insns_before_scope (tmp, if_info->jump, INSN_SCOPE (if_info->insn_a));
return TRUE;
end_seq_and_fail:
@@ -1368,7 +1371,7 @@ noce_try_minmax (if_info)
if (seq_contains_jump (seq))
return FALSE;
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump, INSN_SCOPE (if_info->insn_a));
if_info->cond = cond;
if_info->cond_earliest = earliest;
@@ -1486,7 +1489,7 @@ noce_try_abs (if_info)
if (seq_contains_jump (seq))
return FALSE;
- emit_insns_before (seq, if_info->jump);
+ emit_insns_before_scope (seq, if_info->jump, INSN_SCOPE (if_info->insn_a));
if_info->cond = cond;
if_info->cond_earliest = earliest;
@@ -1758,7 +1761,7 @@ noce_process_if_block (test_bb, then_bb, else_bb, join_bb)
insn_b = gen_sequence ();
end_sequence ();
- emit_insn_after (insn_b, test_bb->end);
+ emit_insn_after_scope (insn_b, test_bb->end, INSN_SCOPE (insn_a));
}
/* Merge the blocks! */
@@ -2126,7 +2129,7 @@ find_cond_trap (test_bb, then_edge, else_edge)
return FALSE;
/* Emit the new insns before cond_earliest. */
- emit_insn_before (seq, cond_earliest);
+ emit_insn_before_scope (seq, cond_earliest, INSN_SCOPE (trap));
/* Delete the trap block if possible. */
remove_edge (trap_bb == then_bb ? then_edge : else_edge);
diff --git a/gcc/recog.c b/gcc/recog.c
index 6ad82eeae1d..cbc691d9968 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3133,7 +3133,8 @@ peephole2_optimize (dump_file)
REG_EH_REGION, NULL_RTX);
/* Replace the old sequence with the new. */
- try = emit_insn_after (try, peep2_insn_data[i].insn);
+ try = emit_insn_after_scope (try, peep2_insn_data[i].insn,
+ INSN_SCOPE (peep2_insn_data[i].insn));
before_try = PREV_INSN (insn);
delete_insn_chain (insn, peep2_insn_data[i].insn);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index d4b6063944d..314adf1567e 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1375,14 +1375,20 @@ extern rtx assign_stack_temp_for_type PARAMS ((enum machine_mode,
extern rtx assign_temp PARAMS ((tree, int, int, int));
/* In emit-rtl.c */
extern rtx emit_insn_before PARAMS ((rtx, rtx));
+extern rtx emit_insn_before_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_jump_insn_before PARAMS ((rtx, rtx));
+extern rtx emit_jump_insn_before_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_call_insn_before PARAMS ((rtx, rtx));
+extern rtx emit_call_insn_before_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_barrier_before PARAMS ((rtx));
extern rtx emit_label_before PARAMS ((rtx, rtx));
extern rtx emit_note_before PARAMS ((int, rtx));
extern rtx emit_insn_after PARAMS ((rtx, rtx));
+extern rtx emit_insn_after_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_jump_insn_after PARAMS ((rtx, rtx));
+extern rtx emit_jump_insn_after_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_call_insn_after PARAMS ((rtx, rtx));
+extern rtx emit_call_insn_after_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_barrier_after PARAMS ((rtx));
extern rtx emit_label_after PARAMS ((rtx, rtx));
extern rtx emit_note_after PARAMS ((int, rtx));
@@ -1390,7 +1396,9 @@ extern rtx emit_line_note_after PARAMS ((const char *, int, rtx));
extern rtx emit_insn PARAMS ((rtx));
extern rtx emit_insns PARAMS ((rtx));
extern rtx emit_insns_before PARAMS ((rtx, rtx));
+extern rtx emit_insns_before_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_insns_after PARAMS ((rtx, rtx));
+extern rtx emit_insns_after_scope PARAMS ((rtx, rtx, tree));
extern rtx emit_jump_insn PARAMS ((rtx));
extern rtx emit_call_insn PARAMS ((rtx));
extern rtx emit_label PARAMS ((rtx));