linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: David Edelsohn <dje@watson.ibm.com>
Cc: linuxppc-dev@lists.linuxppc.org
Subject: Re: Changes to PPC Linux required for GCC 3.1
Date: Tue, 04 Dec 2001 10:39:24 -0600	[thread overview]
Message-ID: <3C0CFC3C.6060906@acm.org> (raw)
In-Reply-To: 200112041616.LAA25074@makai.watson.ibm.com

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

David Edelsohn wrote:

>	What GCC patches do you need to build PowerPC Linux?
>
>David
>
I believe the following patch is all that is left, I've gotten
everything else into the 3.1 stream.  I'm working with the GCC
maintainers to get this one in.

-Corey


[-- Attachment #2: gcc-ppc-3.1.diff --]
[-- Type: text/plain, Size: 3416 bytes --]

Index: recog.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/recog.c,v
retrieving revision 1.133
diff -u -r1.133 recog.c
--- recog.c	2001/11/02 10:52:08	1.133
+++ recog.c	2001/12/04 16:33:26
@@ -512,7 +512,8 @@
          separated from this function.  */
       if (GET_CODE (XEXP (x, 1)) == CONST_INT)
 	validate_change (object, loc,
-			 plus_constant (XEXP (x, 0), INTVAL (XEXP (x, 1))), 1);
+			 simplify_gen_binary
+			 (PLUS, GET_MODE (x), XEXP (x, 0), XEXP (x, 1)), 1);
       break;
     case MINUS:
       if (GET_CODE (XEXP (x, 1)) == CONST_INT
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.86
diff -u -r1.86 simplify-rtx.c
--- simplify-rtx.c	2001/11/14 13:51:10	1.86
+++ simplify-rtx.c	2001/12/04 16:33:27
@@ -95,6 +95,7 @@
 #define HWI_SIGN_EXTEND(low) \
  ((((HOST_WIDE_INT) low) < 0) ? ((HOST_WIDE_INT) -1) : ((HOST_WIDE_INT) 0))

+rtx neg_const_int PARAMS ((enum machine_mode, rtx));
 static int simplify_plus_minus_op_data_cmp PARAMS ((const void *,
 						    const void *));
 static rtx simplify_plus_minus		PARAMS ((enum rtx_code,
@@ -107,6 +108,17 @@
 static void simplify_binary_is2orm1	PARAMS ((PTR));

 \f
+/* Negate a CONST_INT rtx, truncating (because a conversion from a
+   maximally negative number can overflow). */
+rtx
+neg_const_int (mode, i)
+     enum machine_mode mode;
+     rtx i;
+{
+  return GEN_INT (trunc_int_for_mode (- INTVAL (i), mode));
+}
+
+\f
 /* Make a binary operation by properly ordering the operands and
    seeing if the expression folds.  */

@@ -136,10 +148,9 @@
       && GET_MODE (op0) != VOIDmode
       && (code == PLUS || code == MINUS))
     {
-      HOST_WIDE_INT value = INTVAL (op1);
       if (code == MINUS)
-	value = -value;
-      return plus_constant (op0, value);
+	op1 = neg_const_int (mode, op1);
+      return plus_constant (op0, INTVAL (op1));
     }
   else
     return gen_rtx_fmt_ee (code, mode, op0, op1);
@@ -1276,7 +1287,9 @@

 	  /* Don't let a relocatable value get a negative coeff.  */
 	  if (GET_CODE (op1) == CONST_INT && GET_MODE (op0) != VOIDmode)
-	    return plus_constant (op0, - INTVAL (op1));
+	    return simplify_gen_binary (PLUS, mode,
+					op0,
+					neg_const_int (mode, op1));

 	  /* (x - (x & y)) -> (x & ~y) */
 	  if (GET_CODE (op1) == AND)
@@ -1787,7 +1800,7 @@
 	    case CONST_INT:
 	      if (this_neg)
 		{
-		  ops[i].op = GEN_INT (- INTVAL (this_op));
+		  ops[i].op = neg_const_int (mode, this_op);
 		  ops[i].neg = 0;
 		  changed = 1;
 		}
@@ -1848,7 +1861,7 @@
 		    if (GET_CODE (tem) == NEG)
 		      tem = XEXP (tem, 0), lneg = !lneg;
 		    if (GET_CODE (tem) == CONST_INT && lneg)
-		      tem = GEN_INT (- INTVAL (tem)), lneg = 0;
+		      tem = neg_const_int (mode, tem), lneg = 0;

 		    ops[i].op = tem;
 		    ops[i].neg = lneg;
@@ -1881,10 +1894,10 @@
       && GET_CODE (ops[n_ops - 1].op) == CONST_INT
       && CONSTANT_P (ops[n_ops - 2].op))
     {
-      HOST_WIDE_INT value = INTVAL (ops[n_ops - 1].op);
+      rtx value = ops[n_ops - 1].op;
       if (ops[n_ops - 1].neg ^ ops[n_ops - 2].neg)
-	value = -value;
-      ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, value);
+	value = neg_const_int (mode, value);
+      ops[n_ops - 2].op = plus_constant (ops[n_ops - 2].op, INTVAL (value));
       n_ops--;
     }


  reply	other threads:[~2001-12-04 16:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-04 16:13 Changes to PPC Linux required for GCC 3.1 Corey Minyard
2001-12-04 16:16 ` David Edelsohn
2001-12-04 16:39   ` Corey Minyard [this message]
2001-12-05 12:55 ` Franz Sirl
2001-12-05 16:18   ` Corey Minyard
2001-12-05 17:37     ` Tom Rini
2001-12-05 17:50       ` Benjamin Herrenschmidt
2001-12-05 19:45         ` Tom Rini
2001-12-05 20:30           ` Franz Sirl
2001-12-07 13:01             ` Gabriel Paubert
2001-12-07 20:57               ` AltiVec register ptrace support Kumar Gala
2001-12-07 22:23                 ` Kevin Buettner
2001-12-07 22:34                   ` Daniel Jacobowitz
2001-12-14 18:52                     ` Kumar Gala
2001-12-14 19:16                       ` Jason R Thorpe
2001-12-15  2:08                       ` Andrew Cagney
2001-12-15 17:44                         ` Kumar Gala
2001-12-16 21:11                         ` Paul Mackerras
2002-01-10 18:58                           ` Kumar Gala
2001-12-05 21:59         ` Changes to PPC Linux required for GCC 3.1 Paul Mackerras
2001-12-05 20:17       ` Daniel Jacobowitz
2001-12-05 20:20         ` David Edelsohn
2001-12-05 20:30         ` Franz Sirl
2001-12-06  0:59       ` Corey Minyard
2001-12-06  3:38         ` Tom Rini
2001-12-07  5:22           ` Corey Minyard
2001-12-05 20:51     ` Franz Sirl
2001-12-06  1:41       ` Corey Minyard
  -- strict thread matches above, loose matches on Subject: below --
2001-03-06 16:03 who loads argc in elf binary??????? Alexandre Nikolaev
2001-03-07 19:10 ` Daniel Jacobowitz
2001-03-07 19:15   ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C0CFC3C.6060906@acm.org \
    --to=minyard@acm.org \
    --cc=dje@watson.ibm.com \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).