This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/7] always define HAVE_lo_sum


From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>

gcc/ChangeLog:

2015-05-23  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* combine.c (find_split_point): Check the value of HAVE_lo_sum
	instead of if it is defined.
	(combine_simplify_rtx): Likewise.
	* lra-constraints.c (process_address_1): Likewise.
	* config/darwin.c: Adjust.
	* genconfig.c (main): Always define HAVE_lo_sum.
---
 gcc/ChangeLog         |  9 +++++++
 gcc/combine.c         | 10 +++----
 gcc/config/darwin.c   |  3 +--
 gcc/genconfig.c       |  2 ++
 gcc/lra-constraints.c | 72 +++++++++++++++++++++++++--------------------------
 5 files changed, 51 insertions(+), 45 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3ce1628..360f013 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2015-05-23  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
+
+	* combine.c (find_split_point): Check the value of HAVE_lo_sum
+	instead of if it is defined.
+	(combine_simplify_rtx): Likewise.
+	* lra-constraints.c (process_address_1): Likewise.
+	* config/darwin.c: Adjust.
+	* genconfig.c (main): Always define HAVE_lo_sum.
+
 2015-05-23  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
 	* genmatch.c (parser::parse_operation): Reject expanding operator-list inside 'for'.
diff --git a/gcc/combine.c b/gcc/combine.c
index 0817af2..73d141e 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -4785,11 +4785,10 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
       return find_split_point (&SUBREG_REG (x), insn, false);
 
     case MEM:
-#ifdef HAVE_lo_sum
       /* If we have (mem (const ..)) or (mem (symbol_ref ...)), split it
 	 using LO_SUM and HIGH.  */
-      if (GET_CODE (XEXP (x, 0)) == CONST
-	  || GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+      if (HAVE_lo_sum && (GET_CODE (XEXP (x, 0)) == CONST
+			  || GET_CODE (XEXP (x, 0)) == SYMBOL_REF))
 	{
 	  machine_mode address_mode = get_address_mode (x);
 
@@ -4799,7 +4798,6 @@ find_split_point (rtx *loc, rtx_insn *insn, bool set_src)
 				 XEXP (x, 0)));
 	  return &XEXP (XEXP (x, 0), 0);
 	}
-#endif
 
       /* If we have a PLUS whose second operand is a constant and the
 	 address is not valid, perhaps will can split it up using
@@ -5857,16 +5855,14 @@ combine_simplify_rtx (rtx x, machine_mode op0_mode, int in_dest,
 	SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
       break;
 
-#ifdef HAVE_lo_sum
     case LO_SUM:
       /* Convert (lo_sum (high FOO) FOO) to FOO.  This is necessary so we
 	 can add in an offset.  find_split_point will split this address up
 	 again if it doesn't match.  */
-      if (GET_CODE (XEXP (x, 0)) == HIGH
+      if (HAVE_lo_sum && GET_CODE (XEXP (x, 0)) == HIGH
 	  && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
 	return XEXP (x, 1);
       break;
-#endif
 
     case PLUS:
       /* (plus (xor (and <foo> (const_int pow2 - 1)) <c>) <-c>)
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 5ea7088..ea7eec1 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -149,8 +149,7 @@ int generating_for_darwin_version ;
 section * darwin_sections[NUM_DARWIN_SECTIONS];
 
 /* While we transition to using in-tests instead of ifdef'd code.  */
-#ifndef HAVE_lo_sum
-#define HAVE_lo_sum 0
+#if !HAVE_lo_sum
 #define gen_macho_high(a,b) (a)
 #define gen_macho_low(a,b,c) (a)
 #endif
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 7237dede..a0a834a 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -360,6 +360,8 @@ main (int argc, char **argv)
 
   if (have_lo_sum_flag)
     printf ("#define HAVE_lo_sum 1\n");
+  else
+    printf ("#define HAVE_lo_sum 0\n");
 
   if (have_rotate_flag)
     printf ("#define HAVE_rotate 1\n");
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index c0f2995..a8d0820 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2962,42 +2962,42 @@ process_address_1 (int nop, bool check_only_p,
 	  rtx addr = *ad.inner;
 
 	  new_reg = lra_create_new_reg (Pmode, NULL_RTX, cl, "addr");
-#ifdef HAVE_lo_sum
-	  {
-	    rtx_insn *insn;
-	    rtx_insn *last = get_last_insn ();
-
-	    /* addr => lo_sum (new_base, addr), case (2) above.  */
-	    insn = emit_insn (gen_rtx_SET
-			      (new_reg,
-			       gen_rtx_HIGH (Pmode, copy_rtx (addr))));
-	    code = recog_memoized (insn);
-	    if (code >= 0)
-	      {
-		*ad.inner = gen_rtx_LO_SUM (Pmode, new_reg, addr);
-		if (! valid_address_p (ad.mode, *ad.outer, ad.as))
-		  {
-		    /* Try to put lo_sum into register.  */
-		    insn = emit_insn (gen_rtx_SET
-				      (new_reg,
-				       gen_rtx_LO_SUM (Pmode, new_reg, addr)));
-		    code = recog_memoized (insn);
-		    if (code >= 0)
-		      {
-			*ad.inner = new_reg;
-			if (! valid_address_p (ad.mode, *ad.outer, ad.as))
-			  {
-			    *ad.inner = addr;
-			    code = -1;
-			  }
-		      }
-		    
-		  }
-	      }
-	    if (code < 0)
-	      delete_insns_since (last);
-	  }
-#endif
+	  if (HAVE_lo_sum)
+	    {
+	      rtx_insn *insn;
+	      rtx_insn *last = get_last_insn ();
+
+	      /* addr => lo_sum (new_base, addr), case (2) above.  */
+	      insn = emit_insn (gen_rtx_SET
+				(new_reg,
+				 gen_rtx_HIGH (Pmode, copy_rtx (addr))));
+	      code = recog_memoized (insn);
+	      if (code >= 0)
+		{
+		  *ad.inner = gen_rtx_LO_SUM (Pmode, new_reg, addr);
+		  if (! valid_address_p (ad.mode, *ad.outer, ad.as))
+		    {
+		      /* Try to put lo_sum into register.  */
+		      insn = emit_insn (gen_rtx_SET
+					(new_reg,
+					 gen_rtx_LO_SUM (Pmode, new_reg, addr)));
+		      code = recog_memoized (insn);
+		      if (code >= 0)
+			{
+			  *ad.inner = new_reg;
+			  if (! valid_address_p (ad.mode, *ad.outer, ad.as))
+			    {
+			      *ad.inner = addr;
+			      code = -1;
+			    }
+			}
+
+		    }
+		}
+	      if (code < 0)
+		delete_insns_since (last);
+	    }
+
 	  if (code < 0)
 	    {
 	      /* addr => new_base, case (2) above.  */
-- 
2.4.0.78.g7c6ecbf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]