i386.md (and promoting splitters): Disable QI to SImode promoting when doing so chang...
authorJan Hubicka <jh@suse.cz>
Thu, 6 Jun 2002 21:20:43 +0000 (23:20 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 6 Jun 2002 21:20:43 +0000 (21:20 +0000)
* 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.

From-SVN: r54327

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/emit-rtl.c
gcc/ifcvt.c
gcc/recog.c
gcc/rtl.h

index dcc6990425fdeae851d52200136e852e0e049004..d42f67447fc19cdd28278700a438d3284eb4aa19 100644 (file)
@@ -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.
index f2203c40571bed33fb20c6e015b86006ed0b2aea..10c31295fd39039ddf812349da9d891b89a82dca 100644 (file)
    && 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))
    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)))]
index 9d15fdf6ae48ce6855a5a5c62b27525153a8d57a..724244baae459763ec8c7016e2bcd68d6ec2e6b3 100644 (file)
@@ -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;
 }
 \f
+/* 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;
+}
+\f
 /* 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
index 4ed1494416e3208107ce2a0d895e4be3325e518b..842eb547383f27ecda912db2e4a8e05fad4eae8e 100644 (file)
@@ -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);
index 6ad82eeae1dfc6cdc652748a8845c6934c77b72f..cbc691d99686cc1537b9f433f20d445cd13b1ec4 100644 (file)
@@ -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);
 
index d4b6063944d5053cb4ceb786b504f7642f7a4623..314adf1567e95d3b6aec37b70df49d2c2b21e855 100644 (file)
--- 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));