Patchwork patch for machine dependent rtl section to hide case statements for different types of constants.

login
register
mail settings
Submitter Kenneth Zadeck
Date Aug. 20, 2012, 1:50 p.m.
Message ID <503240A7.6030502@naturalbridge.com>
Download mbox | patch
Permalink /patch/178790/
State New
Headers show

Comments

Kenneth Zadeck - Aug. 20, 2012, 1:50 p.m.
This patch started out to be a purely mechanical change to the switch 
statements so that the ones that are used to take apart constants can be 
logically grouped.    This is important for the next patch that I will 
submit this week that frees the rtl level from only being able to 
represent large integer constants with two HWIs.

I sent the patch to Richard Sandiford and when the comments came back 
from him, this patch turned into something that actually has real 
semantic changes.   (His comments are enclosed below.)   I did almost 
all of Richard's changes because he is generally right about such 
things, but it does mean that the patch has to be more carefully 
reviewed.   Richard does not count his comments as a review.

The patch has, of course, been properly tested on x86-64.

Any comments?  Ok for commit?

Kenny

Richard's comments:
=========================
The omission of CONST_FIXED from the cselib_expand_value_rtx_1,
attr_copy_rtx, clear_struct_flag and combine switches looks
unintentional (though only as a missed compiler-speed optimisation).
Same goes for the omission of CONST_VECTOR from check_maybe_invariant.

The omission of CONST_FIXED from dse.c:const_or_frame_p looks like
a missed target-code optimisation.  The function ought to be using
CONSTANT_P instead.

==== I did not do what is suggested in the last sentence because
==== it changes the behavior of the rtx "HIGH".

I don't see any reason to prefer the hashing of CONST_VECTORs in
hash_invariant_expr_1 and invariant_expr_equal_p over the default
cse implementation, so here too I think we can add CONST_VECTOR
to the switch.

cse.c:exp_equiv_p, rtx_equal_for_memref_p, operands_match_p,
rtx_equal_p_cb and rtx_equal_p  are all testing the property
"is pointer equality sufficient for this kind of constant".
rtx_renumbered_equal_p is too, so I think the omission of
CONST_FIXED there is again unintentional.

That leaves mark_jump_label_1.  This block is really testing
"does this rtx have no operands that might be labels",
which is again true for CONST_FIXED.  TBH, this smacks
of premature optimisation to me.  How do we know that
checking each code here is cheaper than falling through?
I doubt the switch is populated enough to merit a jump table,
and the number of executed branches might well be higher
like this when you take other codes into account.

So in terms of setting the abstraction level, I think there
are two options:

1) Define:

/* Match CONST_*s that can represent compile-time constant integers.  */
#define CASE_CONST_SCALAR_INT \
   case CONST_INT: \
   case CONST_DOUBLE

/* Match CONST_*s for which pointer equality corresponds to value 
equality.  */
#define CASE_CONST_UNIQUE \
   case CONST_INT: \
   case CONST_DOUBLE: \
   case CONST_FIXED

/* Match all CONST_* rtxes.  */
#define CASE_CONST_ANY \
   case CONST_INT: \
   case CONST_DOUBLE: \
   case CONST_FIXED: \
   case CONST_VECTOR

and remove the mark_jump_label_1 cases.

The name "CASE_CONST_SCALAR_INT" matches "SCALAR_INT_MODE_P",
CASE_CONST_UNIQUE is solely for the equality functions above.

2) As for (1), but keep the mark_jump_label_1 cases and
rename CASE_CONST_UNIQUE to CASE_CONST_LEAF so that mark_jump_label_1
can use it.  This implies that all "leaf" CONST_*s (i.e. those without
rtx operands) will always be hashed to give pointer equality.

I don't like that assumption, and CASE_CONST_UNIQUE feels like a better
abstraction, so I prefer (1) over (2).

For avoidance of doubt, this isn't an approval or anything.
It definitely needs to be submitted upstream.  (Yeah, yeah,
sorry for nagging. :-))

Richard
==================
Kenneth Zadeck - Aug. 20, 2012, 1:58 p.m.
I of course meant the machine "independent" not "dependent"
On 08/20/2012 09:50 AM, Kenneth Zadeck wrote:
> This patch started out to be a purely mechanical change to the switch 
> statements so that the ones that are used to take apart constants can 
> be logically grouped.    This is important for the next patch that I 
> will submit this week that frees the rtl level from only being able to 
> represent large integer constants with two HWIs.
>
> I sent the patch to Richard Sandiford and when the comments came back 
> from him, this patch turned into something that actually has real 
> semantic changes.   (His comments are enclosed below.)   I did almost 
> all of Richard's changes because he is generally right about such 
> things, but it does mean that the patch has to be more carefully 
> reviewed.   Richard does not count his comments as a review.
>
> The patch has, of course, been properly tested on x86-64.
>
> Any comments?  Ok for commit?
>
> Kenny
Richard Sandiford - Aug. 20, 2012, 4:20 p.m.
Kenneth Zadeck <zadeck@naturalbridge.com> writes:
> The omission of CONST_FIXED from the cselib_expand_value_rtx_1,
> attr_copy_rtx, clear_struct_flag and combine switches looks
> unintentional (though only as a missed compiler-speed optimisation).
> Same goes for the omission of CONST_VECTOR from check_maybe_invariant.
>
> The omission of CONST_FIXED from dse.c:const_or_frame_p looks like
> a missed target-code optimisation.  The function ought to be using
> CONSTANT_P instead.
>
> ==== I did not do what is suggested in the last sentence because
> ==== it changes the behavior of the rtx "HIGH".

As mentioned privately, that's what we want.

> 1) Define:
>
> /* Match CONST_*s that can represent compile-time constant integers.  */
> #define CASE_CONST_SCALAR_INT \
>    case CONST_INT: \
>    case CONST_DOUBLE
>
> /* Match CONST_*s for which pointer equality corresponds to value 
> equality.  */
> #define CASE_CONST_UNIQUE \
>    case CONST_INT: \
>    case CONST_DOUBLE: \
>    case CONST_FIXED
>
> /* Match all CONST_* rtxes.  */
> #define CASE_CONST_ANY \
>    case CONST_INT: \
>    case CONST_DOUBLE: \
>    case CONST_FIXED: \
>    case CONST_VECTOR
>
> and remove the mark_jump_label_1 cases.

I meant that these three should be the _only_ cases we need.
The reason I listed all those missed cases was that, with the
exception of mark_jump_label_1, the switches really seemed to be
testing one of the three conditions above.

Richard

Patch

diff -uprN '--exclude=.svn' gccBaseline/gcc/alias.c gccWCase/gcc/alias.c
--- gccBaseline/gcc/alias.c	2012-08-17 09:35:24.794195890 -0400
+++ gccWCase/gcc/alias.c	2012-08-19 09:48:33.666509880 -0400
@@ -1486,9 +1486,7 @@  rtx_equal_for_memref_p (const_rtx x, con
       return XSTR (x, 0) == XSTR (y, 0);
 
     case VALUE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_CONST_UNIQUE:
       /* There's no need to compare the contents of CONST_DOUBLEs or
 	 CONST_INTs because pointer equality is a good enough
 	 comparison for these nodes.  */
diff -uprN '--exclude=.svn' gccBaseline/gcc/combine.c gccWCase/gcc/combine.c
--- gccBaseline/gcc/combine.c	2012-08-17 09:35:24.802195795 -0400
+++ gccWCase/gcc/combine.c	2012-08-17 09:36:49.921199621 -0400
@@ -531,12 +531,10 @@  find_single_use_1 (rtx dest, rtx *loc)
 
   switch (code)
     {
-    case CONST_INT:
     case CONST:
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_CONST_INTEGER_OR_FLOAT:
     case CLOBBER:
       return 0;
 
@@ -12788,10 +12786,8 @@  mark_used_regs_combine (rtx x)
     {
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_CONST_INTEGER_OR_FLOAT:
     case PC:
     case ADDR_VEC:
     case ADDR_DIFF_VEC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/cse.c gccWCase/gcc/cse.c
--- gccBaseline/gcc/cse.c	2012-07-27 16:58:24.829691705 -0400
+++ gccWCase/gcc/cse.c	2012-08-19 09:48:52.470284742 -0400
@@ -2623,9 +2623,7 @@  exp_equiv_p (const_rtx x, const_rtx y, i
     {
     case PC:
     case CC0:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_CONST_UNIQUE:
       return x == y;
 
     case LABEL_REF:
@@ -2829,10 +2827,7 @@  canon_reg (rtx x, rtx insn)
     case PC:
     case CC0:
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case ADDR_VEC:
@@ -3133,10 +3128,7 @@  fold_rtx (rtx x, rtx insn)
       return x;
 
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case REG:
@@ -3198,12 +3190,9 @@  fold_rtx (rtx x, rtx insn)
 	    break;
 
 	  case CONST:
-	  case CONST_INT:
+	  CASE_ALL_NUMERIC_CONST:
 	  case SYMBOL_REF:
 	  case LABEL_REF:
-	  case CONST_DOUBLE:
-	  case CONST_FIXED:
-	  case CONST_VECTOR:
 	    const_arg = folded_arg;
 	    break;
 
@@ -6063,13 +6052,10 @@  cse_process_notes_1 (rtx x, rtx object,
 
   switch (code)
     {
-    case CONST_INT:
     case CONST:
     case SYMBOL_REF:
     case LABEL_REF:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case PC:
     case CC0:
     case LO_SUM:
@@ -6671,10 +6657,7 @@  count_reg_usage (rtx x, int *counts, rtx
     case PC:
     case CC0:
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return;
diff -uprN '--exclude=.svn' gccBaseline/gcc/cselib.c gccWCase/gcc/cselib.c
--- gccBaseline/gcc/cselib.c	2012-08-12 18:32:23.788114457 -0400
+++ gccWCase/gcc/cselib.c	2012-08-17 14:43:03.765769479 -0400
@@ -1603,9 +1603,7 @@  cselib_expand_value_rtx_1 (rtx orig, str
 	    }
       }
 
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
@@ -1856,10 +1854,7 @@  cselib_subst_to_values (rtx x, enum mach
 	break;
       return e->val_rtx;
 
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
-    case CONST_INT:
-    case CONST_FIXED:
+    CASE_ALL_NUMERIC_CONST:
       return x;
 
     case PRE_DEC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/df-scan.c gccWCase/gcc/df-scan.c
--- gccBaseline/gcc/df-scan.c	2012-08-17 09:35:24.774196124 -0400
+++ gccWCase/gcc/df-scan.c	2012-08-17 09:36:49.805200966 -0400
@@ -3107,11 +3107,8 @@  df_uses_record (struct df_collection_rec
     {
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case PC:
     case CC0:
     case ADDR_VEC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/dse.c gccWCase/gcc/dse.c
--- gccBaseline/gcc/dse.c	2012-08-19 13:17:02.662197266 -0400
+++ gccWCase/gcc/dse.c	2012-08-19 10:57:25.508896657 -0400
@@ -1112,9 +1112,7 @@  const_or_frame_p (rtx x)
   switch (GET_CODE (x))
     {
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return true;
diff -uprN '--exclude=.svn' gccBaseline/gcc/emit-rtl.c gccWCase/gcc/emit-rtl.c
--- gccBaseline/gcc/emit-rtl.c	2012-08-17 09:35:24.798195842 -0400
+++ gccWCase/gcc/emit-rtl.c	2012-08-17 09:36:49.913199714 -0400
@@ -2504,10 +2504,7 @@  verify_rtx_sharing (rtx orig, rtx insn)
     case REG:
     case DEBUG_EXPR:
     case VALUE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case CODE_LABEL:
@@ -2721,10 +2718,7 @@  repeat:
     case REG:
     case DEBUG_EXPR:
     case VALUE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case CODE_LABEL:
@@ -2843,10 +2837,7 @@  repeat:
     case REG:
     case DEBUG_EXPR:
     case VALUE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
@@ -5236,10 +5227,7 @@  copy_insn_1 (rtx orig)
     {
     case REG:
     case DEBUG_EXPR:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/explow.c gccWCase/gcc/explow.c
--- gccBaseline/gcc/explow.c	2012-08-12 18:32:23.788114457 -0400
+++ gccWCase/gcc/explow.c	2012-08-12 18:33:45.655145336 -0400
@@ -347,8 +347,7 @@  convert_memory_address_addr_space (enum
      to the default case.  */
   switch (GET_CODE (x))
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
+    CASE_SCALAR_CONST_INTEGER:
       if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode))
 	code = TRUNCATE;
       else if (POINTERS_EXTEND_UNSIGNED < 0)
diff -uprN '--exclude=.svn' gccBaseline/gcc/gcse.c gccWCase/gcc/gcse.c
--- gccBaseline/gcc/gcse.c	2012-08-12 18:32:23.784114505 -0400
+++ gccWCase/gcc/gcse.c	2012-08-12 20:38:03.296744164 -0400
@@ -742,10 +742,7 @@  want_to_gcse_p (rtx x, int *max_distance
     case CALL:
       return 0;
 
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
       if (!doing_code_hoisting_p)
 	/* Do not PRE constants.  */
 	return 0;
@@ -887,10 +884,7 @@  oprs_unchanged_p (const_rtx x, const_rtx
     case PC:
     case CC0: /*FIXME*/
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case ADDR_VEC:
@@ -1693,10 +1687,7 @@  compute_transp (const_rtx x, int indx, s
     case PC:
     case CC0: /*FIXME*/
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case ADDR_VEC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/genattrtab.c gccWCase/gcc/genattrtab.c
--- gccBaseline/gcc/genattrtab.c	2012-05-29 13:46:05.453557165 -0400
+++ gccWCase/gcc/genattrtab.c	2012-08-12 20:39:27.995701835 -0400
@@ -674,9 +674,7 @@  attr_copy_rtx (rtx orig)
   switch (code)
     {
     case REG:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_CONST_INTEGER_OR_FLOAT:
     case SYMBOL_REF:
     case MATCH_TEST:
     case CODE_LABEL:
@@ -3090,9 +3088,7 @@  clear_struct_flag (rtx x)
   switch (code)
     {
     case REG:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_VECTOR:
+    CASE_CONST_INTEGER_OR_FLOAT:
     case MATCH_TEST:
     case SYMBOL_REF:
     case CODE_LABEL:
diff -uprN '--exclude=.svn' gccBaseline/gcc/ira.c gccWCase/gcc/ira.c
--- gccBaseline/gcc/ira.c	2012-08-14 15:08:58.432065441 -0400
+++ gccWCase/gcc/ira.c	2012-08-17 09:36:49.921199621 -0400
@@ -2445,10 +2445,7 @@  equiv_init_varies_p (rtx x)
       return !MEM_READONLY_P (x) || equiv_init_varies_p (XEXP (x, 0));
 
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return 0;
@@ -2560,13 +2557,10 @@  contains_replace_regs (rtx x)
 
   switch (code)
     {
-    case CONST_INT:
     case CONST:
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case PC:
     case CC0:
     case HIGH:
@@ -2608,13 +2602,10 @@  memref_referenced_p (rtx memref, rtx x)
 
   switch (code)
     {
-    case CONST_INT:
     case CONST:
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case PC:
     case CC0:
     case HIGH:
@@ -3566,10 +3557,7 @@  rtx_moveable_p (rtx *loc, enum op_type t
   switch (code)
     {
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return true;
diff -uprN '--exclude=.svn' gccBaseline/gcc/jump.c gccWCase/gcc/jump.c
--- gccBaseline/gcc/jump.c	2012-07-22 16:55:01.223983160 -0400
+++ gccWCase/gcc/jump.c	2012-08-19 09:50:02.045452233 -0400
@@ -1078,8 +1078,7 @@  mark_jump_label_1 (rtx x, rtx insn, bool
     case PC:
     case CC0:
     case REG:
-    case CONST_INT:
-    case CONST_DOUBLE:
+    CASE_CONST_LEAF:
     case CLOBBER:
     case CALL:
       return;
@@ -1753,8 +1752,7 @@  rtx_renumbered_equal_p (const_rtx x, con
     case CC0:
     case ADDR_VEC:
     case ADDR_DIFF_VEC:
-    case CONST_INT:
-    case CONST_DOUBLE:
+    CASE_CONST_UNIQUE:
       return 0;
 
     case LABEL_REF:
diff -uprN '--exclude=.svn' gccBaseline/gcc/loop-invariant.c gccWCase/gcc/loop-invariant.c
--- gccBaseline/gcc/loop-invariant.c	2012-07-22 16:55:01.239982968 -0400
+++ gccWCase/gcc/loop-invariant.c	2012-08-17 14:48:03.982236836 -0400
@@ -203,9 +203,7 @@  check_maybe_invariant (rtx x)
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_ALL_SCALAR_NUMERIC_CONST:
     case SYMBOL_REF:
     case CONST:
     case LABEL_REF:
@@ -302,9 +300,7 @@  hash_invariant_expr_1 (rtx insn, rtx x)
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CONST:
     case LABEL_REF:
@@ -363,9 +359,7 @@  invariant_expr_equal_p (rtx insn1, rtx e
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CONST:
     case LABEL_REF:
diff -uprN '--exclude=.svn' gccBaseline/gcc/postreload-gcse.c gccWCase/gcc/postreload-gcse.c
--- gccBaseline/gcc/postreload-gcse.c	2012-07-22 16:55:01.143984121 -0400
+++ gccWCase/gcc/postreload-gcse.c	2012-08-12 20:30:51.397401347 -0400
@@ -519,10 +519,7 @@  oprs_unchanged_p (rtx x, rtx insn, bool
     case PC:
     case CC0: /*FIXME*/
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case ADDR_VEC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/reginfo.c gccWCase/gcc/reginfo.c
--- gccBaseline/gcc/reginfo.c	2012-07-22 16:55:01.247982871 -0400
+++ gccWCase/gcc/reginfo.c	2012-08-12 18:33:45.619145765 -0400
@@ -1022,10 +1022,7 @@  reg_scan_mark_refs (rtx x, rtx insn)
   switch (code)
     {
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CC0:
     case PC:
     case SYMBOL_REF:
diff -uprN '--exclude=.svn' gccBaseline/gcc/regrename.c gccWCase/gcc/regrename.c
--- gccBaseline/gcc/regrename.c	2012-08-17 09:35:24.626197862 -0400
+++ gccWCase/gcc/regrename.c	2012-08-17 09:36:49.741201708 -0400
@@ -1342,10 +1342,7 @@  scan_rtx (rtx insn, rtx *loc, enum reg_c
   switch (code)
     {
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case CC0:
diff -uprN '--exclude=.svn' gccBaseline/gcc/reload1.c gccWCase/gcc/reload1.c
--- gccBaseline/gcc/reload1.c	2012-08-17 09:35:24.878194902 -0400
+++ gccWCase/gcc/reload1.c	2012-08-17 09:36:49.929199528 -0400
@@ -2566,10 +2566,7 @@  eliminate_regs_1 (rtx x, enum machine_mo
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
@@ -2983,10 +2980,7 @@  elimination_effects (rtx x, enum machine
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
@@ -4454,13 +4448,10 @@  scan_paradoxical_subregs (rtx x)
   switch (code)
     {
     case REG:
-    case CONST_INT:
     case CONST:
     case SYMBOL_REF:
     case LABEL_REF:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR: /* shouldn't happen, but just in case.  */
+    CASE_ALL_NUMERIC_CONST:
     case CC0:
     case PC:
     case USE:
diff -uprN '--exclude=.svn' gccBaseline/gcc/reload.c gccWCase/gcc/reload.c
--- gccBaseline/gcc/reload.c	2012-08-12 18:32:23.712115357 -0400
+++ gccWCase/gcc/reload.c	2012-08-19 09:50:42.864963443 -0400
@@ -2318,9 +2318,7 @@  operands_match_p (rtx x, rtx y)
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_CONST_UNIQUE:
       return 0;
 
     case LABEL_REF:
@@ -5341,11 +5339,8 @@  subst_reg_equivs (rtx ad, rtx insn)
   switch (code)
     {
     case HIGH:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case PC:
diff -uprN '--exclude=.svn' gccBaseline/gcc/resource.c gccWCase/gcc/resource.c
--- gccBaseline/gcc/resource.c	2012-06-27 22:29:11.986407159 -0400
+++ gccWCase/gcc/resource.c	2012-08-12 18:33:45.675145099 -0400
@@ -215,10 +215,7 @@  mark_referenced_resources (rtx x, struct
   switch (code)
     {
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case PC:
     case SYMBOL_REF:
     case LABEL_REF:
@@ -632,10 +629,7 @@  mark_set_resources (rtx x, struct resour
     case BARRIER:
     case CODE_LABEL:
     case USE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case LABEL_REF:
     case SYMBOL_REF:
     case CONST:
diff -uprN '--exclude=.svn' gccBaseline/gcc/rtlanal.c gccWCase/gcc/rtlanal.c
--- gccBaseline/gcc/rtlanal.c	2012-08-12 18:32:23.712115357 -0400
+++ gccWCase/gcc/rtlanal.c	2012-08-12 18:33:45.667145194 -0400
@@ -97,10 +97,7 @@  rtx_unstable_p (const_rtx x)
       return !MEM_READONLY_P (x) || rtx_unstable_p (XEXP (x, 0));
 
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return 0;
@@ -170,10 +167,7 @@  rtx_varies_p (const_rtx x, bool for_alia
       return !MEM_READONLY_P (x) || rtx_varies_p (XEXP (x, 0), for_alias);
 
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
       return 0;
@@ -585,10 +579,7 @@  count_occurrences (const_rtx x, const_rt
   switch (code)
     {
     case REG:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
@@ -690,10 +681,7 @@  reg_mentioned_p (const_rtx reg, const_rt
     case PC:
       return 0;
 
-    case CONST_INT:
-    case CONST_VECTOR:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
+    CASE_ALL_NUMERIC_CONST:
       /* These are kept unique for a given value.  */
       return 0;
 
@@ -887,10 +875,7 @@  modified_between_p (const_rtx x, const_r
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CONST:
     case SYMBOL_REF:
     case LABEL_REF:
@@ -946,10 +931,7 @@  modified_in_p (const_rtx x, const_rtx in
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CONST:
     case SYMBOL_REF:
     case LABEL_REF:
@@ -2095,11 +2077,8 @@  volatile_insn_p (const_rtx x)
     {
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CC0:
     case PC:
     case REG:
@@ -2160,11 +2139,8 @@  volatile_refs_p (const_rtx x)
     {
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CC0:
     case PC:
     case REG:
@@ -2223,11 +2199,8 @@  side_effects_p (const_rtx x)
     {
     case LABEL_REF:
     case SYMBOL_REF:
-    case CONST_INT:
     case CONST:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CC0:
     case PC:
     case REG:
@@ -2312,10 +2285,7 @@  may_trap_p_1 (const_rtx x, unsigned flag
   switch (code)
     {
       /* Handle these cases quickly.  */
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case LABEL_REF:
     case CONST:
@@ -2514,10 +2484,7 @@  inequality_comparisons_p (const_rtx x)
     case SCRATCH:
     case PC:
     case CC0:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case CONST:
     case LABEL_REF:
     case SYMBOL_REF:
@@ -2760,10 +2727,7 @@  computed_jump_p_1 (const_rtx x)
       return 0;
 
     case CONST:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case REG:
       return 1;
diff -uprN '--exclude=.svn' gccBaseline/gcc/rtl.c gccWCase/gcc/rtl.c
--- gccBaseline/gcc/rtl.c	2012-07-25 19:35:50.088957883 -0400
+++ gccWCase/gcc/rtl.c	2012-08-19 09:51:59.004052293 -0400
@@ -248,10 +248,7 @@  copy_rtx (rtx orig)
     case REG:
     case DEBUG_EXPR:
     case VALUE:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC:
@@ -400,9 +397,7 @@  rtx_equal_p_cb (const_rtx x, const_rtx y
     case DEBUG_EXPR:
     case VALUE:
     case SCRATCH:
-    case CONST_DOUBLE:
-    case CONST_INT:
-    case CONST_FIXED:
+    CASE_CONST_UNIQUE:
       return 0;
 
     case DEBUG_IMPLICIT_PTR:
@@ -539,9 +534,7 @@  rtx_equal_p (const_rtx x, const_rtx y)
     case DEBUG_EXPR:
     case VALUE:
     case SCRATCH:
-    case CONST_DOUBLE:
-    case CONST_INT:
-    case CONST_FIXED:
+    CASE_CONST_UNIQUE:
       return 0;
 
     case DEBUG_IMPLICIT_PTR:
diff -uprN '--exclude=.svn' gccBaseline/gcc/rtl.h gccWCase/gcc/rtl.h
--- gccBaseline/gcc/rtl.h	2012-08-12 18:32:23.796114363 -0400
+++ gccWCase/gcc/rtl.h	2012-08-19 09:52:56.323366473 -0400
@@ -403,6 +403,59 @@  struct GTY((variable_size)) rtvec_def {
 /* Predicate yielding nonzero iff X is an rtx for a memory location.  */
 #define MEM_P(X) (GET_CODE (X) == MEM)
 
+/* Match CONST_*s that can represent compile-time scalar constant
+   integers.  */ 
+#define CASE_SCALAR_CONST_INTEGER                     \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE
+
+/* Match CONST_*s that can represent compile-time scalar or vector
+   constant integers.  */ 
+#define CASE_CONST_INTEGER                            \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_VECTOR
+
+/* Match CONST_*s that can represent compile-time scalar constant
+   integers or floats.  */ 
+#define CASE_SCALAR_CONST_INTEGER_OR_FLOAT            \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE
+
+/* Match CONST_*s that can represent compile-time constant integers or
+   floats.  */ 
+#define CASE_CONST_INTEGER_OR_FLOAT                   \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_VECTOR
+
+/* Match all CONST_* scalar rtxes.  */ 
+#define CASE_ALL_SCALAR_NUMERIC_CONST                 \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_FIXED
+
+/* Match all CONST_* rtxes.  */ 
+#define CASE_ALL_NUMERIC_CONST                        \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_FIXED:                                   \
+  case CONST_VECTOR
+
+/* Match CONST_*s for which pointer equality corresponds to value
+   equality.  */ 
+#define CASE_CONST_UNIQUE                             \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_FIXED
+
+/* Match CONST_*s that have no internal rtxs so therefore pointer
+   equality corresponds to value equality.  */
+#define CASE_CONST_LEAF                               \
+  case CONST_INT:                                     \
+  case CONST_DOUBLE:                                  \
+  case CONST_FIXED 
+
 /* Predicate yielding nonzero iff X is an rtx for a constant integer.  */
 #define CONST_INT_P(X) (GET_CODE (X) == CONST_INT)
 
diff -uprN '--exclude=.svn' gccBaseline/gcc/sched-deps.c gccWCase/gcc/sched-deps.c
--- gccBaseline/gcc/sched-deps.c	2012-07-09 14:05:35.142032050 -0400
+++ gccWCase/gcc/sched-deps.c	2012-08-12 18:33:45.675145099 -0400
@@ -2547,10 +2547,7 @@  sched_analyze_2 (struct deps_desc *deps,
 
   switch (code)
     {
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CONST:
     case LABEL_REF:
diff -uprN '--exclude=.svn' gccBaseline/gcc/valtrack.c gccWCase/gcc/valtrack.c
--- gccBaseline/gcc/valtrack.c	2012-08-02 07:44:36.439673435 -0400
+++ gccWCase/gcc/valtrack.c	2012-08-12 18:33:45.683145006 -0400
@@ -44,10 +44,7 @@  cleanup_auto_inc_dec (rtx src, enum mach
   switch (code)
     {
     case REG:
-    case CONST_INT:
-    case CONST_DOUBLE:
-    case CONST_FIXED:
-    case CONST_VECTOR:
+    CASE_ALL_NUMERIC_CONST:
     case SYMBOL_REF:
     case CODE_LABEL:
     case PC: