Subject: Re: gcc 3.3.1 bug + patch
To: Ian Lance Taylor <ian@airs.com>
From: Martin Husemann <martin@duskware.de>
List: tech-toolchain
Date: 08/15/2003 21:23:35
On Fri, Aug 15, 2003 at 10:53:44AM -0700, Ian Lance Taylor wrote:
> As far as I know, that assumption is not correct.
[..]

Thanks for the review. Here is a new try.

Martin

Index: sparc.md
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/config/sparc/sparc.md,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sparc.md
--- sparc.md	2003/07/23 02:41:59	1.1.1.1
+++ sparc.md	2003/08/15 19:15:31
@@ -6881,6 +6881,13 @@
 {
   if (operands[2] == const1_rtx)
     return "add\t%1, %1, %0";
+  if (GET_CODE (operands[2]) == CONST_INT) {
+    if ((unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 32) {
+      if (TARGET_ARCH64)
+        return "sllx\t%1, %2, %0";
+      operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
+    }
+  }
   return "sll\t%1, %2, %0";
 }
   [(set (attr "type")
@@ -6969,7 +6976,16 @@
 	(ashiftrt:SI (match_operand:SI 1 "register_operand" "r")
 		     (match_operand:SI 2 "arith_operand" "rI")))]
   ""
-  "sra\t%1, %2, %0"
+{
+  if (GET_CODE (operands[2]) == CONST_INT) {
+    if ((unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 32) {
+      if (TARGET_ARCH64)
+        return "srax\t%1, %2, %0";
+      operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
+    }
+  }
+  return "sra\t%1, %2, %0";
+}
   [(set_attr "type" "shift")])
 
 (define_insn "*ashrsi3_extend"
@@ -7040,7 +7056,16 @@
 	(lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
 		     (match_operand:SI 2 "arith_operand" "rI")))]
   ""
-  "srl\t%1, %2, %0"
+{
+  if (GET_CODE (operands[2]) == CONST_INT) {
+    if ((unsigned HOST_WIDE_INT) INTVAL (operands[2]) >= 32) {
+      if (TARGET_ARCH64)
+        return "srlx\t%1, %2, %0";
+      operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f);
+    }
+  }
+  return "srl\t%1, %2, %0";
+}
   [(set_attr "type" "shift")])
 
 ;; This handles the case where