Bug 40359 - [4.5 Regression] Revision 148211 caused a lot of failures in the vect test suite.
Summary: [4.5 Regression] Revision 148211 caused a lot of failures in the vect test su...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-06 09:15 UTC by Dominique d'Humieres
Modified: 2009-07-06 09:03 UTC (History)
3 users (show)

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


Attachments
A patch to fix the fails (744 bytes, patch)
2009-06-06 16:43 UTC, revital eres
Details | Diff
patch to fix syntax errors in tests (491 bytes, patch)
2009-06-07 07:12 UTC, revital eres
Details | Diff
dump file with -fdump-tree-vect-details (9.67 KB, text/plain)
2009-06-12 12:00 UTC, Dominique d'Humieres
Details
Patch to fix error in vect-42.c (484 bytes, patch)
2009-06-15 10:41 UTC, revital eres
Details | Diff
dump file with -fdump-tree-vect-details default (-m32) for revision 148502. (9.67 KB, text/plain)
2009-06-17 11:58 UTC, Dominique d'Humieres
Details
dump file with -fdump-tree-vect-details -m64 for revision 148502. (8.29 KB, text/plain)
2009-06-17 12:03 UTC, Dominique d'Humieres
Details
patch to fix vect-42.c (827 bytes, patch)
2009-06-18 08:03 UTC, Ira Rosen
Details | Diff
fix vect-42.c (357 bytes, patch)
2009-06-18 09:14 UTC, Ira Rosen
Details | Diff
Final version of the patch (506 bytes, patch)
2009-06-18 14:06 UTC, revital eres
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2009-06-06 09:15:31 UTC
On i686-apple-darwin9, revision 148211 caused a lot of failures in the vect test suite with both -m32 and -m64:

< FAIL: gcc.dg/vect/costmodel/i386/costmodel-vect-31.c scan-tree-dump-times vect "vectorization not profitable" 1
< FAIL: gcc.dg/vect/costmodel/i386/costmodel-vect-31.c scan-tree-dump-times vect "vectorized 3 loops" 1
< FAIL: gcc.dg/vect/costmodel/i386/costmodel-vect-33.c scan-tree-dump-times vect "vectorization not profitable" 1
< FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "vectorized 1 loops" 0
< FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "vector alignment may not be reachable" 1
< FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "not vectorized: unsupported unaligned store" 1
< FAIL: gcc.dg/vect/vect-109.c scan-tree-dump-times vect "not vectorized: unsupported unaligned store" 2
< XPASS: gcc.dg/vect/vect-26.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gcc.dg/vect/vect-26.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< XPASS: gcc.dg/vect/vect-28.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gcc.dg/vect/vect-28.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< XPASS: gcc.dg/vect/vect-33.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gcc.dg/vect/vect-33.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Vectorizing an unaligned access" 4
< FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< XPASS: gcc.dg/vect/vect-44.c scan-tree-dump-times vect "Vectorizing an unaligned access" 3
< FAIL: gcc.dg/vect/vect-44.c scan-tree-dump-times vect "Vectorizing an unaligned access" 2
< FAIL: gcc.dg/vect/vect-44.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-50.c scan-tree-dump-times vect "Vectorizing an unaligned access" 2
< FAIL: gcc.dg/vect/vect-50.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-54.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-54.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-58.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-58.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-70.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-70.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-87.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-87.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-88.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-88.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-89.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-89.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-91.c scan-tree-dump-times vect "Alignment of access forced using peeling" 3
< FAIL: gcc.dg/vect/vect-92.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/vect-92.c scan-tree-dump-times vect "Alignment of access forced using peeling" 3
< FAIL: gcc.dg/vect/vect-93.c scan-tree-dump-times vect "Alignment of access forced using peeling" 3
< FAIL: gcc.dg/vect/vect-93.c scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gcc.dg/vect/vect-95.c scan-tree-dump-times vect "Vectorizing an unaligned access" 2
< FAIL: gcc.dg/vect/vect-95.c scan-tree-dump-times vect "Alignment of access forced using versioning" 2
< FAIL: gcc.dg/vect/vect-96.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/vect-align-1.c scan-tree-dump-times vect "Alignment of access forced using versioning" 1
< FAIL: gcc.dg/vect/vect-align-2.c scan-tree-dump-times vect "Alignment of access forced using versioning" 1
< XPASS: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "vectorized 1 loops" 2
< FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "vectorized 1 loops" 1
< FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< XPASS: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "Vectorizing an unaligned access" 4
< FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect "Vectorizing an unaligned access" 2
< XPASS: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect "vectorized 1 loops" 2
< FAIL: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect "vectorized 1 loops" 1
< FAIL: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/slp-25.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/slp-25.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
< FAIL: gcc.dg/vect/no-section-anchors-vect-31.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/no-section-anchors-vect-31.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
< FAIL: gcc.dg/vect/no-section-anchors-vect-64.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/no-section-anchors-vect-64.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
< FAIL: gcc.dg/vect/no-section-anchors-vect-66.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/no-section-anchors-vect-66.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gcc.dg/vect/no-section-anchors-vect-68.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/no-section-anchors-vect-68.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
< FAIL: gcc.dg/vect/no-section-anchors-vect-69.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
< FAIL: gcc.dg/vect/no-section-anchors-vect-69.c scan-tree-dump-times vect "Alignment of access forced using peeling" 2
< XPASS: gcc.dg/vect/no-scevccp-outer-8.c scan-tree-dump-times vect "OUTER LOOP VECTORIZED." 1

< FAIL: gfortran.dg/vect/vect-2.f90  -O  scan-tree-dump-times vect "Alignment of access forced using peeling" 3
< FAIL: gfortran.dg/vect/vect-2.f90  -O  scan-tree-dump-times vect "Vectorizing an unaligned access" 2
< FAIL: gfortran.dg/vect/vect-3.f90  -O  scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gfortran.dg/vect/vect-3.f90  -O  scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gfortran.dg/vect/vect-4.f90  -O  scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gfortran.dg/vect/vect-4.f90  -O  scan-tree-dump-times vect "Vectorizing an unaligned access" 1
< FAIL: gfortran.dg/vect/vect-5.f90  -O  scan-tree-dump-times vect "Alignment of access forced using peeling" 1
< FAIL: gfortran.dg/vect/vect-5.f90  -O  scan-tree-dump-times vect "Vectorizing an unaligned access" 1

See also:

http://gcc.gnu.org/ml/gcc-regression/2009-06/msg00044.html
http://gcc.gnu.org/ml/gcc-regression/2009-06/msg00043.html
Comment 1 revital eres 2009-06-06 11:00:11 UTC
It might be that i686 should be added to check_effective_target_vect_hw_misalign.

Please try the following patch:

Index: testsuite/lib/target-supports.exp
===================================================================
--- testsuite/lib/target-supports.exp   (revision 148211)
+++ testsuite/lib/target-supports.exp   (working copy)
@@ -2231,7 +2231,8 @@ proc check_effective_target_vect_hw_misa
         verbose "check_effective_target_vect_hw_misalign: using cached result" 2
     } else {
         set et_vect_hw_misalign_saved 0
-       if { [istarget x86_64-*-*] } {
+       if { ([istarget x86_64-*-*]
+            || [istarget i?86-*-*]) } {
           set et_vect_hw_misalign_saved 1
        }
     }
Comment 2 Dominique d'Humieres 2009-06-06 15:49:11 UTC
Subject: Re:  [4.5 Regression] Revision 148211 caused a
 lot of failures in the vect test suite.

> It might be that i686 should be added to check_effective_target_vect_hw_misalign.

It does, but I still have 9 extra failures:

FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "vectorized 1 loops" 0
FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "vector alignment may not be reachable" 1
FAIL: gcc.dg/vect/pr25413.c scan-tree-dump-times vect "not vectorized: unsupported unaligned store" 1
FAIL: gcc.dg/vect/vect-58.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/vect-58.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/vect/vect-88.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/vect-88.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1
FAIL: gcc.dg/vect/no-section-anchors-vect-66.c scan-tree-dump-times vect "Vectorizing an unaligned access" 0
FAIL: gcc.dg/vect/no-section-anchors-vect-66.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1

Thanks for the patch.

Dominique
Comment 3 revital eres 2009-06-06 16:43:59 UTC
Created attachment 17957 [details]
A patch to fix the fails
Comment 4 revital eres 2009-06-06 16:46:12 UTC
(In reply to comment #3)
> Created an attachment (id=17957) [edit]
> A patch to fix the fails

I appreciate it if you could test whether the attached patch fixes the failures.
If so, I'll submit it.

Thanks.
Comment 5 Dominique d'Humieres 2009-06-06 17:24:00 UTC
With the patch in comment #3 the failures are gone:

make -k check-gcc RUNTESTFLAGS="vect.exp=*.c --target_board=unix'{,-m64}'"

...
		=== gcc Summary ===

# of expected passes		2829
# of expected failures		216
# of unsupported tests		18

tested on i686-apple-darwin9.
Comment 6 revital eres 2009-06-06 17:32:23 UTC
(In reply to comment #5)
> With the patch in comment #3 the failures are gone:
> make -k check-gcc RUNTESTFLAGS="vect.exp=*.c --target_board=unix'{,-m64}'"

Thanks for checking, I'll submit the patch then.
Comment 7 Dominique d'Humieres 2009-06-07 06:37:49 UTC
On powerpc-apple-darwin9 with -m64, but not with default -m32, I also see the following new failures:

ERROR: gcc.dg/vect/vect-42.c: error executing dg-final: syntax error in target selector "target !vect_hw_misalign"
UNRESOLVED: gcc.dg/vect/vect-42.c: error executing dg-final: syntax error in target selector "target !vect_hw_misalign"
ERROR: gcc.dg/vect/vect-50.c: error executing dg-final: syntax error in target selector "target !vect_no_align"
UNRESOLVED: gcc.dg/vect/vect-50.c: error executing dg-final: syntax error in target selector "target !vect_no_align"
ERROR: gcc.dg/vect/vect-96.c: error executing dg-final: syntax error in target selector "target !vect_hw_misalign"
UNRESOLVED: gcc.dg/vect/vect-96.c: error executing dg-final: syntax error in target selector "target !vect_hw_misalign"
Comment 8 revital eres 2009-06-07 07:12:10 UTC
Created attachment 17959 [details]
patch to fix syntax errors in tests

This patch should fix the syntax errors.  
I'll sumbit it also if the problem is solved.

Thanks again,
Revital
Comment 9 Dominique d'Humieres 2009-06-07 07:48:20 UTC
The patch in comment #8 fixes the failures reported in comment #7. I now see (powerpc-apple-darwin9 with -m64):

FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Alignment of access forced using versioning" 3

Comment 10 revital eres 2009-06-07 10:51:08 UTC
(In reply to comment #9)
> The patch in comment #8 fixes the failures reported in comment #7. I now see
> (powerpc-apple-darwin9 with -m64):
> FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Alignment of access
> forced using versioning" 3

I can not reproduce this failure; I appreciate it if you could post the vectorizer dump file (produced with -fdump-tree-vect-details flag) thanks.
Comment 11 Dominique d'Humieres 2009-06-12 12:00:19 UTC
Created attachment 17988 [details]
dump file with -fdump-tree-vect-details

(In reply to comment #10)
[karma] f90/bug% grep "Alignment of access" vect-42.c.104t.vect
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: Alignment of access forced using peeling.
Comment 12 Ira Rosen 2009-06-15 09:58:28 UTC
(In reply to comment #9)
> The patch in comment #8 fixes the failures reported in comment #7. I now see
> (powerpc-apple-darwin9 with -m64):
> FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Alignment of access
> forced using versioning" 3

Is this target ([istarget *-*-darwin*] && [is-effective-target lp64]) (meaning vector_alignment_reachable is false for it)?

If so, why do we do peeling? And also why in that case it doesn't XPASS "Alignment of access forced using peeling" 1 "vect"?

Otherwise, vector_alignment_reachable is true, and it is not supposed to look for the versioning string at all (since the target is not vect_no_align, right?).

It doesn't make sense to me either way...
Revital, maybe you can try to add brackets: { ! { vector_alignment_reachable } } instead of { ! vector_alignment_reachable} ?

Ira
Comment 13 revital eres 2009-06-15 10:41:23 UTC
Created attachment 18003 [details]
Patch to fix error in vect-42.c

Ira, thanks for the suggestion!
I deleted an extra space, so now the syntax is {! vector_alignment_reachable}.
Dominique  -- if that still does not fix the problem I will try to add more braces...
Thanks!
Comment 14 Dominique d'Humieres 2009-06-15 12:36:59 UTC
(In reply to comment #13)
> if that still does not fix the problem I will try to add more braces...

I tried several variants that were not working. The following patch works, though I have no idea if it is right:

[karma] darwin_buildw/gcc% diff -up /opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c
--- /opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c	2009-06-05 18:02:02.000000000 +0200
+++ /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c	2009-06-15 14:17:38.000000000 +0200
@@ -63,7 +63,7 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align || { { ! vector_alignment_reachable} && {!vect_hw_misalign} } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align || { { ! vector_alignment_reachable } && vect_hw_misalign } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */


[karma] darwin_buildw/gcc% make -k check-gcc RUNTESTFLAGS="vect.exp=vect-42.c --target_board=unix'{,-m64}'"
...
WARNING: Couldn't find the global config file.
Test Run By dominiq on Mon Jun 15 14:17:58 2009
Native configuration is powerpc-apple-darwin9

		=== gcc tests ===

Schedule of variations:
    unix
    unix/-m64

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix ===

# of expected passes		5
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of expected failures		2

		=== gcc Summary ===

# of expected passes		8
# of expected failures		2
/opt/gcc/darwin_buildw/gcc/xgcc  version 4.5.0 20090614 (experimental) [trunk revision 148466] (GCC) 

Comment 15 Dominique d'Humieres 2009-06-15 12:46:28 UTC
With the patch in comment #14, on i686-apple-darwin9 I get:

		=== gcc tests ===

Schedule of variations:
    unix
    unix/-m64

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix ===

# of expected passes		3
# of expected failures		2
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of expected failures		2

		=== gcc Summary ===

# of expected passes		6
# of expected failures		4
/Volumes/MacBook/opt/gcc/i686-darwin/gcc/xgcc  version 4.5.0 20090614 (experimental) [trunk revision 148472] (GCC) 

Comment 16 revital eres 2009-06-15 13:32:18 UTC
> -/* { dg-final { scan-tree-dump-times "Alignment of access forced using
> versioning" 3 "vect" { target { vect_no_align || { { !
> vector_alignment_reachable} && {!vect_hw_misalign} } } } } } */
> +/* { dg-final { scan-tree-dump-times "Alignment of access forced using
> versioning" 3 "vect" { target { vect_no_align || { { !
> vector_alignment_reachable } && vect_hw_misalign } } } } } */

hmmm... versioning should not be done for targets that support vect_hw_misalign... 
Although this change fixes the failures it does not seem to be right...

Thanks again.
Comment 17 Ira Rosen 2009-06-16 07:36:40 UTC
Dominique, 

Could you please try this patch (I changed (!a && !b) to !(a || b)).

Thanks,
Ira



Index: vect-42.c
===================================================================
--- vect-42.c   (revision 148487)
+++ vect-42.c   (working copy)
@@ -63,7 +63,7 @@
 }

 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align || { { ! vector_alignment_reachable} && {!vect_hw_misalign} } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align || { !  { vector_alignment_reachable || vect_hw_misalign } } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */

Comment 18 Dominique d'Humieres 2009-06-16 10:10:32 UTC
> Could you please try this patch (I changed (!a && !b) to !(a || b)).

I am currently regtesting on my ppc and it takes a long time. Meanwhile I am not sure to understand what you expect with this change: if I am not mistaken !(a || b) == (!a && !b) .
Comment 19 Ira Rosen 2009-06-16 10:18:08 UTC
(In reply to comment #18)
> > Could you please try this patch (I changed (!a && !b) to !(a || b)).
> I am currently regtesting on my ppc and it takes a long time. Meanwhile I am
> not sure to understand what you expect with this change: if I am not mistaken
> !(a || b) == (!a && !b) .

Yes, the problem is that we think that the test is correct and it doesn't work because of some syntax/brackets/space problems.
Comment 20 Dominique d'Humieres 2009-06-16 10:26:32 UTC
> Yes, the problem is that we think that the test is correct and it doesn't work
> because of some syntax/brackets/space problems.

I certainly don't understand the "space" mess. Before reaching the patch in comment #14 I have tried several variations. All of them, but the one in comment #14, either did not fix the failure with -m64 or did fail the test with -m32. In particular replacing 'target' with 'xfail' fixed the -m64 failure but the test failed with -m32. What are the expected patterns for the 3 variables with -m32 and -m64?
Comment 21 Ira Rosen 2009-06-16 11:08:32 UTC
(In reply to comment #20)
> What are the expected patterns for the 3 variables
> with -m32 and -m64?

I am not sure, this is why I asked you if the target is 
([istarget *-*-darwin*] && [is-effective-target lp64]).

vect_no_align and vect_hw_misalign have to be false, so, I guess, vector_alignment_reachable is different for -m32 and -m64, since the behaviour is different. 

"Alignment of access forced using versioning" means the vectorizer uses loop versioning to force alignment. It happens when there is no misalignment support at all (vect_no_align) or when other methods fail: loop peeling doesn't help (!vector_alignment_reachable) and also there is no hardware misalignment support (!vect_hw_misalign).

From the dump you attached, I see that loop peeling was done, therefore, vector_alignment_reachable is true, and it must not look for "Alignment of access forced using versioning". But it does. This what makes me think that it is just a syntax problem.

On the other hand, I don't understand the difference with -m32 and -m64. It seems to me, that ([istarget *-*-darwin*] && [is-effective-target lp64]) is false for -m32 and, possibly, true for -m64. But that contradicts the dump.

Comment 22 Dominique d'Humieres 2009-06-16 13:13:42 UTC
> On the other hand, I don't understand the difference with -m32 and -m64. It
> seems to me, that ([istarget *-*-darwin*] && [is-effective-target lp64]) is
> false for -m32 and, possibly, true for -m64. But that contradicts the dump.

My understanding is that ([istarget *-*-darwin*] && [is-effective-target lp64]) should return false for -m32 and true for -m64. At least it is how it works on other tests I have looked at. Is there anyway to check it?
Comment 23 Ira Rosen 2009-06-17 08:22:45 UTC
(In reply to comment #22)
> My understanding is that ([istarget *-*-darwin*] && [is-effective-target lp64])
> should return false for -m32 and true for -m64. At least it is how it works on
> other tests I have looked at. Is there anyway to check it?

You can add 
/* { dg-final { scan-tree-dump-times "bla bla bla" 1 "vect" { target vector_alignment_reachable } } } */
to some test. It should fail for -m32 and pass for -m64 (since we think that vector_alignment_reachable is true for -m32 and false for -m64).



Comment 24 Dominique d'Humieres 2009-06-17 10:17:10 UTC
(In reply to comment #23)
If I add to vect-42.c (with my patch) the line

/* { dg-final { scan-tree-dump-times "bla bla bla" 1 "vect" { target vector_alignment_reachable } } } */

I get:

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "bla bla bla" 1

		=== gcc Summary for unix ===

# of expected passes		5
# of unexpected failures	1
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of expected failures		2

i.e., the test is done for -m32 (and fail) but not for -m64.

If I add the line

* { dg-final { scan-tree-dump-times "bla bla bla" 1 "vect" { target { ! vect_hw_misalign } } } } *//

I get

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "bla bla bla" 1

		=== gcc Summary for unix ===

# of expected passes		5
# of unexpected failures	1
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "bla bla bla" 1

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of unexpected failures	1
# of expected failures		2

i.e., vect_hw_misalign is false for both -m32 and -m64.

So it looks that vect_hw_misalign has the opposite meaning of that assumed in comment #16:

> hmmm... versioning should not be done for targets that support
> vect_hw_misalign... 

Final note, the change in comment #17 does not help.
Comment 25 Ira Rosen 2009-06-17 11:06:02 UTC
(In reply to comment #24)
> If I add to vect-42.c (with my patch) the line
>
> /* { dg-final { scan-tree-dump-times "bla bla bla" 1 "vect" { target
vector_alignment_reachable } } } */
...
> i.e., the test is done for -m32 (and fail) but not for -m64.

So, vector_alignment_reachable is true for -m32 and false for -m64.

...
> i.e., vect_hw_misalign is false for both -m32 and -m64.
> So it looks that vect_hw_misalign has the opposite meaning of that assumed in
> comment #16:
> > hmmm... versioning should not be done for targets that support
> > vect_hw_misalign... 

Why? vect_hw_misalign means that misaligned data acceses are supported by hardware, therefore, we don't need to do versioning. And we expect versioning here with -m64 since both vect_hw_misalign and vector_alignment_reachable are false.

> Final note, the change in comment #17 does not help.

Thanks for checking.


I still don't understand why this test works on -m64
/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
vector_alignment_reachable is false, so there should be no peeling according to the test. But it is there, and the test doesn't XPASS...

And, of course, I don't understand why we do peeling, i.e., builtin vector_alignment_reachable returns true.

Comment 26 Dominique d'Humieres 2009-06-17 11:58:53 UTC
Created attachment 18012 [details]
dump file with -fdump-tree-vect-details default (-m32) for revision 148502.

Summary:

[karma] f90/bug% grep peeling vect-42_32.c.105t.vect 
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: Alignment of access forced using peeling.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: === vect_do_peeling_for_alignment ===
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: === vect_do_peeling_for_loop_bound ===(get_loop_exit_condition 
[karma] f90/bug% grep versioning vect-42_32.c.105t.vect 
[karma] f90/bug% grep unaligned vect-42_32.c.105t.vect 
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: vect_model_load_cost: unaligned software pipelined.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: vect_model_load_cost: unaligned software pipelined.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: vect_model_load_cost: unaligned software pipelined.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: vect_model_load_cost: unaligned software pipelined.
Comment 27 Dominique d'Humieres 2009-06-17 12:03:25 UTC
Created attachment 18013 [details]
dump file with -fdump-tree-vect-details -m64 for revision 148502.

Summary:

[karma] f90/bug% grep peeling vect-42_64.c.105t.vect
[karma] f90/bug% grep versioning vect-42_64.c.105t.vect
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:43: note: Alignment of access forced using versioning.
[karma] f90/bug% grep unaligned vect-42_64.c.105t.vect
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: Vectorizing an unaligned access.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: vect_model_load_cost: unaligned software pipelined.
/opt/gcc/_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: vect_model_load_cost: unaligned software pipelined.
Comment 28 Dominique d'Humieres 2009-06-17 12:12:02 UTC
Does the following patch makes more sense for you:

--- ../_gcc_clean/gcc/testsuite/gcc.dg/vect/vect-42.c	2009-06-05 18:02:02.000000000 +0200
+++ gcc/testsuite/gcc.dg/vect/vect-42.c	2009-06-17 14:08:50.000000000 +0200
@@ -63,7 +63,8 @@ int main (void)
 }
 
 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target { vect_no_align || { { ! vector_alignment_reachable} && {!vect_hw_misalign} } } } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { vect_no_align || { { ! vector_alignment_reachable } && { ! vect_hw_misalign } } } } } } */
 /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { { vect_no_align || vect_hw_misalign } || vector_alignment_reachable } } } } */
 /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align || vect_hw_misalign } || { ! vector_alignment_reachable } } } } } */
 /* { dg-final { cleanup-tree-dump "vect" } } */

which yields:

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix ===

# of expected passes		5
# of expected failures		1
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		5
# of expected failures		2
Comment 29 Ira Rosen 2009-06-17 12:40:09 UTC
Oh, so the first dump you attached (in comment #11) was for -m32. Now it makes sense.

I think, we have to distinguish between vect_no_align and the other cases. I will prepare a patch tomorrow.

Thanks,
Ira

Comment 30 Dominique d'Humieres 2009-06-17 12:48:09 UTC
> Oh, so the first dump you attached (in comment #11) was for -m32. Now it makes sense.

Since I started to have some doubts about it, I redid it for both cases to be sure.
Comment 31 Ira Rosen 2009-06-18 08:03:23 UTC
Created attachment 18019 [details]
patch to fix vect-42.c

I think the easiest way to fix it is to change the test to have one vetorizable loop again as before http://gcc.gnu.org/viewcvs?view=rev&revision=147851.
Comment 32 Dominique d'Humieres 2009-06-18 08:46:10 UTC
With the patch in comment #31 I get:

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Vectorizing an unaligned access" 2
FAIL: gcc.dg/vect/vect-42.c scan-tree-dump-times vect "Alignment of access forced using peeling" 1

		=== gcc Summary for unix ===

# of expected passes		3
# of unexpected failures	2
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...
ERROR: gcc.dg/vect/vect-42.c: error executing dg-final: syntax error in target selector "target !vect_hw_misalign"

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of unresolved testcases	1

The syntax error is fixed by replacing {!vect_hw_misalign} with { ! vect_hw_misalign }. For the 32 bit mode, the failures are consistent with:

[karma] f90/bug% gfc -O3 -fdump-tree-vect-details /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c
[karma] f90/bug% grep unaligned vect-42.c.105t.vect
[karma] f90/bug% grep peeling vect-42.c.105t.vect
[karma] f90/bug% grep versioning vect-42.c.105t.vect
/opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: versioning for alias required: can't determine dependence between b[i_17] and *D.2095_6
/opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: versioning for alias required: can't determine dependence between c[i_17] and *D.2095_6
/opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: Alignment of access forced using versioning.
/opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect-42.c:37: note: created 2 versioning for alias checks.

i.e., no "unaligned" nor "peeling" found.
Comment 33 Ira Rosen 2009-06-18 09:14:46 UTC
Created attachment 18020 [details]
fix vect-42.c

OK, now I understand why we need two loops here (we need to pass the arrays as parameters to avoid versioning for alias).
So, I split the checks for vect_no_align and the others. Hope, this time it works.
Thanks.
Comment 34 Dominique d'Humieres 2009-06-18 12:59:39 UTC
With the patch in comment #33, I get on powerpc-apple-darwin9:

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix ===

# of expected passes		5
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		4
# of expected failures		2

and on i686-apple-darwin9:

Schedule of variations:
    unix
    unix/-m64

Running target unix
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix ===

# of expected passes		3
# of expected failures		2
Running target unix/-m64
Using /sw/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /sw/share/dejagnu/config/unix.exp as generic interface file for target.
Using /opt/gcc/gcc-4.5-work/gcc/testsuite/config/default.exp as tool-and-target-specific interface file.
Running /opt/gcc/gcc-4.5-work/gcc/testsuite/gcc.dg/vect/vect.exp ...

		=== gcc Summary for unix/-m64 ===

# of expected passes		3
# of expected failures		2

So the patch fixes the last problem (at least for these platforms). Thanks for your patience!
Comment 35 revital eres 2009-06-18 14:06:53 UTC
Created attachment 18021 [details]
Final version of the patch

I'll submit the following patch -- it contains Ira's latest fix and two syntax errors fixes.

Thanks again for helping!
Comment 36 Dominique d'Humieres 2009-07-06 09:03:43 UTC
Closing as fixed.