Re: [patch] Clean up WORD_REGISTER_OPERATIONS & LOAD_EXTEND_OP tests

2016-11-04 Thread Richard Biener
On Thu, Nov 3, 2016 at 9:56 PM, Eric Botcazou  wrote:
> Hi,
>
> WORD_REGISTER_OPERATIONS and LOAD_EXTEND_OP are partially used directly as
> preprocessor macros and partially tested in the code.  This patch brings a bit
> of consistency into this by converting the remaining macro cases.
>
> Tested on SPARC/Solaris and x86-64/Linux, OK for the mainline?

Ok.

Richard.

>
> 2016-11-03  Eric Botcazou  
>
> * defaults.h (LOAD_EXTEND_OP): Define if not already defined.
> * combine.c (LOAD_EXTEND_OP): Delete.
> (simplify_comparison): Fix comment on LOAD_EXTEND_OP.
> * cse.c (LOAD_EXTEND_OP): Delete.
> * fold-const.c (LOAD_EXTEND_OP): Likewise.
> * fwprop.c (free_load_extend): Remove #ifdef LOAD_EXTEND_OP/#endif.
> * postreload.c (LOAD_EXTEND_OP): Delete.
> * reload.c (push_reload): Remove #ifdef LOAD_EXTEND_OP/#endif.
> Convert conditional compilation based on WORD_REGISTER_OPERATIONS.
> (find_reloads): Likewise.
> * reload1.c (eliminate_regs_1): Likewise.
> * rtlanal.c (nonzero_bits1): Remove #ifdef LOAD_EXTEND_OP/#endif.
> (num_sign_bit_copies1): Likewise.
>
> --
> Eric Botcazou


[patch] Clean up WORD_REGISTER_OPERATIONS & LOAD_EXTEND_OP tests

2016-11-03 Thread Eric Botcazou
Hi,

WORD_REGISTER_OPERATIONS and LOAD_EXTEND_OP are partially used directly as 
preprocessor macros and partially tested in the code.  This patch brings a bit 
of consistency into this by converting the remaining macro cases.

Tested on SPARC/Solaris and x86-64/Linux, OK for the mainline?


2016-11-03  Eric Botcazou  

* defaults.h (LOAD_EXTEND_OP): Define if not already defined.
* combine.c (LOAD_EXTEND_OP): Delete.
(simplify_comparison): Fix comment on LOAD_EXTEND_OP.
* cse.c (LOAD_EXTEND_OP): Delete.
* fold-const.c (LOAD_EXTEND_OP): Likewise.
* fwprop.c (free_load_extend): Remove #ifdef LOAD_EXTEND_OP/#endif.
* postreload.c (LOAD_EXTEND_OP): Delete.
* reload.c (push_reload): Remove #ifdef LOAD_EXTEND_OP/#endif.
Convert conditional compilation based on WORD_REGISTER_OPERATIONS.
(find_reloads): Likewise.
* reload1.c (eliminate_regs_1): Likewise.
* rtlanal.c (nonzero_bits1): Remove #ifdef LOAD_EXTEND_OP/#endif.
(num_sign_bit_copies1): Likewise.

-- 
Eric BotcazouIndex: combine.c
===
--- combine.c	(revision 241808)
+++ combine.c	(working copy)
@@ -104,10 +104,6 @@ along with GCC; see the file COPYING3.
 #include "rtl-iter.h"
 #include "print-rtl.h"
 
-#ifndef LOAD_EXTEND_OP
-#define LOAD_EXTEND_OP(M) UNKNOWN
-#endif
-
 /* Number of attempts to combine instructions in this function.  */
 
 static int combine_attempts;
@@ -12462,14 +12458,14 @@ simplify_comparison (enum rtx_code code,
  care bits and we can assume they have any convenient value.  So
  making the transformation is safe.
 
- 2. SUBREG_REG (op0) is a memory and LOAD_EXTEND_OP is not defined.
+ 2. SUBREG_REG (op0) is a memory and LOAD_EXTEND_OP is UNKNOWN.
  In this case the upper bits of op0 are undefined.  We should not make
  the simplification in that case as we do not know the contents of
  those bits.
 
- 3. SUBREG_REG (op0) is a memory and LOAD_EXTEND_OP is defined and not
- UNKNOWN.  In that case we know those bits are zeros or ones.  We must
- also be sure that they are the same as the upper bits of op1.
+ 3. SUBREG_REG (op0) is a memory and LOAD_EXTEND_OP is not UNKNOWN.
+ In that case we know those bits are zeros or ones.  We must also be
+ sure that they are the same as the upper bits of op1.
 
  We can never remove a SUBREG for a non-equality comparison because
  the sign bit is in a different place in the underlying object.  */
Index: cse.c
===
--- cse.c	(revision 241808)
+++ cse.c	(working copy)
@@ -43,10 +43,6 @@ along with GCC; see the file COPYING3.
 #include "dbgcnt.h"
 #include "rtl-iter.h"
 
-#ifndef LOAD_EXTEND_OP
-#define LOAD_EXTEND_OP(M) UNKNOWN
-#endif
-
 /* The basic idea of common subexpression elimination is to go
through the code, keeping a record of expressions that would
have the same value at the current scan point, and replacing
Index: defaults.h
===
--- defaults.h	(revision 241808)
+++ defaults.h	(working copy)
@@ -1259,6 +1259,10 @@ see the files COPYING3 and COPYING.RUNTI
 #define WORD_REGISTER_OPERATIONS 0
 #endif
 
+#ifndef LOAD_EXTEND_OP
+#define LOAD_EXTEND_OP(M) UNKNOWN
+#endif
+
 #ifndef CONSTANT_ALIGNMENT
 #define CONSTANT_ALIGNMENT(EXP, ALIGN) ALIGN
 #endif
Index: fold-const.c
===
--- fold-const.c	(revision 241808)
+++ fold-const.c	(working copy)
@@ -80,10 +80,6 @@ along with GCC; see the file COPYING3.
 #include "tree-ssanames.h"
 #include "selftest.h"
 
-#ifndef LOAD_EXTEND_OP
-#define LOAD_EXTEND_OP(M) UNKNOWN
-#endif
-
 /* Nonzero if we are folding constants inside an initializer; zero
otherwise.  */
 int folding_initializer = 0;
Index: fwprop.c
===
--- fwprop.c	(revision 241808)
+++ fwprop.c	(working copy)
@@ -1051,9 +1051,7 @@ free_load_extend (rtx src, rtx_insn *ins
   df_ref def, use;
 
   reg = XEXP (src, 0);
-#ifdef LOAD_EXTEND_OP
   if (LOAD_EXTEND_OP (GET_MODE (reg)) != GET_CODE (src))
-#endif
 return false;
 
   FOR_EACH_INSN_USE (use, insn)
Index: postreload.c
===
--- postreload.c	(revision 241808)
+++ postreload.c	(working copy)
@@ -41,10 +41,6 @@ along with GCC; see the file COPYING3.
 #include "tree-pass.h"
 #include "dbgcnt.h"
 
-#ifndef LOAD_EXTEND_OP
-#define LOAD_EXTEND_OP(M) UNKNOWN
-#endif
-
 static int reload_cse_noop_set_p (rtx);
 static bool reload_cse_simplify (rtx_insn *, rtx);
 static void reload_cse_regs_1 (void);
Index: reload.c
===
--- reload.c	(revision 241808)
+++ reload.c	(working copy)
@@ -1064,7 +1064,6 @@ push_reload