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]

fix for powerpc64 TImode ICE


powerpc64-linux gcc-3.3 and mainline ICE on the following

cat > ti.c <<EOF
typedef int TItype __attribute__ ((mode (TI)));

TItype foo (void)
{
  return (TItype) 5 << 63;
}
EOF
powerpc64-linux-gcc -c ti.c
ti.c: In function `foo':
ti.c:6: internal compiler error: in output_toc, at config/rs6000/rs6000.c:11864

Fixed by this patch:

	* config/rs6000/rs6000.md: Add TI constant splitter.

Regression tested powerpc64-linux on 3.3 branch.  OK mainline and 3.3?

diff -urpN -xCVS -x'*~' gcc33.orig/gcc/config/rs6000/rs6000.md gcc33/gcc/config/rs6000/rs6000.md
--- gcc33.orig/gcc/config/rs6000/rs6000.md	2003-02-05 09:16:21.000000000 +1030
+++ gcc33/gcc/config/rs6000/rs6000.md	2003-02-24 20:02:25.000000000 +1030
@@ -9133,6 +9133,32 @@
   operands[5] = GEN_INT (CONST_DOUBLE_LOW  (operands[1]));
 }")
 
+(define_split
+  [(set (match_operand:TI 0 "gpc_reg_operand" "")
+	(match_operand:TI 1 "const_double_operand" ""))]
+  "TARGET_POWERPC64"
+  [(set (match_dup 2) (match_dup 4))
+   (set (match_dup 3) (match_dup 5))]
+  "
+{
+  operands[2] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN == 0,
+				       TImode);
+  operands[3] = operand_subword_force (operands[0], WORDS_BIG_ENDIAN != 0,
+				       TImode);
+  if (GET_CODE (operands[1]) == CONST_DOUBLE)
+    {
+      operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
+      operands[5] = GEN_INT (CONST_DOUBLE_LOW (operands[1]));
+    }
+  else if (GET_CODE (operands[1]) == CONST_INT)
+    {
+      operands[4] = GEN_INT (- (INTVAL (operands[1]) < 0));
+      operands[5] = operands[1];
+    }
+  else
+    FAIL;
+}")
+
 (define_insn "*movdi_internal64"
   [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,?f,f,m,r,*h,*h")
 	(match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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