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]

Re: [patch] Fix PR40021: miscompile of BLAS (hence tonto and gamess)


On Wed, May 6, 2009 at 9:52 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Wed, 6 May 2009, Richard Guenther wrote:
>
>> On Wed, May 6, 2009 at 6:00 PM, Michael Matz <matz@suse.de> wrote:
>> > Hi,
>> >
>> > as detailed in the bugreport we can end up in a situation where a basic
>> > block with just one successor edge ends with multiple jump instructions to
>> > the same target (only during expansion itself). ?We are confused if we
>> > want to insert instructions on such edge and insert them before the last
>> > jump, but after the others, which later leads to miscompilations as the
>> > inserted instruction isn't ru then.
>> >
>> > This fixes the miscompile (with test input and of the testcase).
>> > Regstrapped on x86_64-linux. ?Okay?
>>
>> The patch is ok if you add a testcase.
>
> r147186. ?The testcase is target dependend (insofar as it needs sse math
> on -m32 to trigger), so I've put it in gfortran.dg/pr40021.f as there was
> precedent already for such tests. ?I've also done the two minor changes
> H.J. suggested, in the testcase and the new function.
>

That testcase isn't x86 specific. gfortran.fortran-torture/execute already
adds -msse2 to -ftree-vectorize for x86. I am checking in this patch
to move it to gfortran.fortran-torture/execute/pr40021.f.  I have verified
that we will get

FAIL: gfortran.fortran-torture/execute/pr40021.f execution, -O2
-ftree-vectorize -msse2

on ia32 before the fix.

Thanks.


-- 
H.J.
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 147190)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2009-05-06  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* gfortran.dg/pr40021.f: Moved to ...
+	* gfortran.fortran-torture/execute/pr40021.f: Here.
+
 2009-05-06  Janis Johnson  <janis187@us.ibm.com>

 	PR middle-end/39986
Index: gfortran.fortran-torture/execute/pr40021.f
===================================================================
--- gfortran.fortran-torture/execute/pr40021.f	(revision 147190)
+++ gfortran.fortran-torture/execute/pr40021.f	(working copy)
@@ -1,6 +1,4 @@
-! { dg-do run { target i?86-*-* x86_64-*-* } }
-! { dg-require-effective-target ilp32 }
-! { dg-options "-O2 -ftree-vectorize -msse2 -mfpmath=sse -ffast-math" }
+C Derived from lapack
         PROGRAM test
         DOUBLE PRECISION DA
         INTEGER I, N
Index: gfortran.dg/pr40021.f
===================================================================
--- gfortran.dg/pr40021.f	(revision 147190)
+++ gfortran.dg/pr40021.f	(working copy)
@@ -1,42 +0,0 @@
-! { dg-do run { target i?86-*-* x86_64-*-* } }
-! { dg-require-effective-target ilp32 }
-! { dg-options "-O2 -ftree-vectorize -msse2 -mfpmath=sse -ffast-math" }
-        PROGRAM test
-        DOUBLE PRECISION DA
-        INTEGER I, N
-        DOUBLE PRECISION DX(9),DY(9)
-
-        EXTERNAL DAXPY
-        N=5
-        DA=1.0
-        DATA DX/-2, -1, -3, -4, 1, 2, 10, 15, 14/
-        DATA DY/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/
-        CALL DAXPY (N,DA,DX,DY)
-        DO 10 I = 1, N
-          if (DX(I).ne.DY(I)) call abort
-10      CONTINUE
-        STOP
-        END
-
-      SUBROUTINE DAXPY(N,DA,DX,DY)
-      DOUBLE PRECISION DA
-      INTEGER N
-      DOUBLE PRECISION DX(*),DY(*)
-      INTEGER I,IX,IY,M,MP1
-      INTRINSIC MOD
-      IF (N.LE.0) RETURN
-   20 M = MOD(N,4)
-      IF (M.EQ.0) GO TO 40
-      DO 30 I = 1,M
-          DY(I) = DY(I) + DA*DX(I)
-   30 CONTINUE
-      IF (N.LT.4) RETURN
-   40 MP1 = M + 1
-      DO 50 I = MP1,N,4
-          DY(I) = DY(I) + DA*DX(I)
-          DY(I+1) = DY(I+1) + DA*DX(I+1)
-          DY(I+2) = DY(I+2) + DA*DX(I+2)
-          DY(I+3) = DY(I+3) + DA*DX(I+3)
-   50 CONTINUE
-      RETURN
-      END


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