Bug 26362 - ICE on the autovect-branch (gfortran example)
Summary: ICE on the autovect-branch (gfortran example)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2006-02-19 14:50 UTC by Magnus Johansson
Modified: 2007-07-01 10:05 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Johansson 2006-02-19 14:50:45 UTC
gfortran-autovect -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/autovect --program-suffix=-autovect --enable-threads=posix --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.0-autovect 20060214 (experimental)


gfortran-autovect -O3 -Wunused -fautomatic -mfpmath=sse -msse -mmmx -msse2 -ftree-vectorize -ftree-vectorizer-verbose=2 -c xyz1.for xyz1.for: In function ‘xyz1’:
xyz1.for:1: internal compiler error: in make_ssa_name, at tree-ssanames.c:129
Please submit a full bug report,


      SUBROUTINE XYZ1
C
      IMPLICIT DOUBLE PRECISION ( A - H, O - Z ), INTEGER ( I - N )
C
      COMMON /ABC/ MMSAD( 250 ), MCAI( 500 )
C
      DIMENSION JTMP( 750 ), KTMP( 750 )
      DIMENSION MTMP( 750 ), LTMP(750)
C
      IF ( IJK .LT. KJI )  THEN
         DO 500 JKL = 1, ILS
            IF ( MTMP(JKL) .LT. 0 ) THEN
               IJK = IJK + 1
               MTMP(JKL) = IJK
            END IF
 500     CONTINUE
C
         MMS = 0
         DO 1000 JKL = 1, ILS
            MMS = MMS + 2
            JTMP(JKL) = MMSAD(JKL)
            KTMP(JKL) = MCAI(MMS-1)
            LTMP(JKL) = MCAI( MMS )
 1000    CONTINUE
C
         DO 9000 JKL = 1, ILS
            KF1 = MTMP(JKL)
            MMS = KF1 + KF1
            MMSAD(KF1)  = JTMP(JKL)
            MCAI(MMS-1) = KTMP(JKL)
            MCAI( MMS ) = LTMP(JKL)
 9000    CONTINUE
C
      END IF
C
      RETURN
      END
Comment 1 Dorit Naishlos 2006-02-20 16:45:58 UTC
Looks like the vectorizer detects a strided access in this testcase. Strided accesses are not entirely supported for SSE right now (work in progress...), but it is enabled, so currently all strided testcases brake on SSE.
Comment 2 Dorit Naishlos 2006-02-20 17:09:39 UTC
Actually there's this patch by rth that seems to fix this ICE; it's from a while back, I don't think it was fully tested at the time, and I'm not sure it provides all the missing bits/fixes for SSE support.

=== targhooks.c
==================================================================
--- targhooks.c		 (revision 108004)
+++ targhooks.c		 (local)
@@ -448,7 +448,8 @@
   tree type;
   enum machine_mode mode;
   block_stmt_iterator bsi;
-  tree th, tl, result, x;
+  tree t1, t2, result, x;
+  int i, n;
 
   /* If the first argument is a type, just check if support
      is available. Return a non NULL value if supported, NULL_TREE otherwise.
@@ -472,31 +473,37 @@
     return NULL;
 
   bsi = bsi_for_stmt (stmt);
-  
-  th = make_rename_temp (type, NULL);
-  x = build2 (VEC_INTERLEAVE_HIGH_EXPR, type, vec1, vec2);
-  x = build2 (MODIFY_EXPR, type, th, x);
-  th = make_ssa_name (th, x);
-  TREE_OPERAND (x, 0) = th;
-  bsi_insert_before (&bsi, x, BSI_SAME_STMT);
 
-  tl = make_rename_temp (type, NULL);
-  x = build2 (VEC_INTERLEAVE_LOW_EXPR, type, vec1, vec2);
-  x = build2 (MODIFY_EXPR, type, tl, x);
-  tl = make_ssa_name (tl, x);
-  TREE_OPERAND (x, 0) = tl;
-  bsi_insert_before (&bsi, x, BSI_SAME_STMT);
+  n = exact_log2 (GET_MODE_NUNITS (mode)) - 1;
+  for (i = 0; i < n; ++i)
+    {
+      t1 = create_tmp_var (type, NULL);
+      add_referenced_tmp_var (t1);
+      x = build2 (VEC_INTERLEAVE_HIGH_EXPR, type, vec1, vec2);
+      x = build2 (MODIFY_EXPR, type, t1, x);
+      t1 = make_ssa_name (t1, x);
+      TREE_OPERAND (x, 0) = t1;
+      bsi_insert_before (&bsi, x, BSI_SAME_STMT);
 
-  result = make_rename_temp (type, NULL);
-  /* ??? Endianness issues?  */
+      t2 = create_tmp_var (type, NULL);
+      add_referenced_tmp_var (t2);
+      x = build2 (VEC_INTERLEAVE_LOW_EXPR, type, vec1, vec2);
+      x = build2 (MODIFY_EXPR, type, t2, x);
+      t2 = make_ssa_name (t2, x);
+      TREE_OPERAND (x, 0) = t2;
+      bsi_insert_before (&bsi, x, BSI_SAME_STMT);
+
+      if (BYTES_BIG_ENDIAN)
+		 vec1 = t1, vec2 = t2;
+      else
+		 vec1 = t2, vec2 = t1;
+    }
+  
   x = build2 (odd_p ? VEC_INTERLEAVE_HIGH_EXPR : VEC_INTERLEAVE_LOW_EXPR,
-		       type, th, tl);
-  x = build2 (MODIFY_EXPR, type, result, x);
-  result = make_ssa_name (result, x);
-  TREE_OPERAND (x, 0) = result;
-  bsi_insert_before (&bsi, x, BSI_SAME_STMT);
+		       type, vec1, vec2);
+  x = build2 (MODIFY_EXPR, type, dest, x);
 
-  return result;
+  return x;
 }
 
 tree
 

Comment 3 Ira Rosen 2007-01-28 10:45:26 UTC
The current versions of both mainline and autovect branch do not ICE. Strided loads are not implemented for SSE. I opened a PR 30211 for it. 
I think this PR can be closed.

Ira
Comment 4 dorit 2007-07-01 10:05:15 UTC
Closed based on Ira's comment.