summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-12 09:48:08 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2011-12-12 09:48:08 +0000
commita08c9086662af01e9b45c14a9254a9f8c8ed2c57 (patch)
treee100d0deea8e73f61b639ceca819feeedad88a45 /gcc/testsuite
parent30be4b5bc2781a437162c35b2d95672ce77cc6c5 (diff)
downloadgcc-a08c9086662af01e9b45c14a9254a9f8c8ed2c57.tar.gz
2011-12-12 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 182221 using svnmerge git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@182223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog379
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-17.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto29.C25
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto7.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template4.C42
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr51420.C8
-rw-r--r--gcc/testsuite/g++.dg/ext/desig3.C9
-rw-r--r--gcc/testsuite/g++.dg/gcov/gcov-14.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/pr48042_0.C14
-rw-r--r--gcc/testsuite/g++.dg/opt/pr50747-1_0.C18
-rw-r--r--gcc/testsuite/g++.dg/opt/pr50747-2_0.C112
-rw-r--r--gcc/testsuite/g++.dg/opt/pr51262.C21
-rw-r--r--gcc/testsuite/g++.dg/parse/error45.C9
-rw-r--r--gcc/testsuite/g++.dg/template/cond8.C10
-rw-r--r--gcc/testsuite/g++.dg/tm/cgraph_edge.C33
-rw-r--r--gcc/testsuite/g++.dg/torture/pr51482.C30
-rw-r--r--gcc/testsuite/g++.dg/vect/pr51485.cc14
-rw-r--r--gcc/testsuite/g++.dg/warn/Woverflow-4.C13
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20111209-1.c13
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20111208-1.c94
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr51466.c43
-rw-r--r--gcc/testsuite/gcc.dg/guality/pr48437.c17
-rw-r--r--gcc/testsuite/gcc.dg/lto/20111207-1_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20111207-1_1.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20111207-1_2.c1
-rw-r--r--gcc/testsuite/gcc.dg/lto/20111207-1_3.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20111207-2_0.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr45416.c14
-rw-r--r--gcc/testsuite/gcc.dg/sms-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/sms-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/sms-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/sms-5.c4
-rw-r--r--gcc/testsuite/gcc.dg/sms-6.c7
-rw-r--r--gcc/testsuite/gcc.dg/sms-7.c5
-rw-r--r--gcc/testsuite/gcc.dg/sms-8.c5
-rw-r--r--gcc/testsuite/gcc.dg/sms-9.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-13-big-array.c141
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-13.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-24-big-array.c99
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-24.c29
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-3-big-array.c155
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-3.c16
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-34-big-array.c69
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-34.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-4-big-array.c135
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-4.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c127
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-cond-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c62
-rw-r--r--gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-1-big-array.c90
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-10-big-array.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-10.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-105-big-array.c106
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-105.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-112-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-112.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-15-big-array.c48
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-15.c13
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-2-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-2.c14
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-31-big-array.c90
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-31.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-32-big-array.c40
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-32.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-33-big-array.c44
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-33.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-34-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-34.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-35-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-35.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-36-big-array.c47
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-36.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-6-big-array.c79
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-6.c31
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-73-big-array.c51
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-73.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-74-big-array.c68
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-74.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-75-big-array.c57
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-75.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76-big-array.c83
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76.c15
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-80-big-array.c71
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-80.c21
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-85-big-array.c49
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-85.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-89-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-89.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-97-big-array.c73
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-97.c12
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-98-big-array.c57
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-98.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-all-big-array.c254
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-all.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c65
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c28
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-iv-8-big-array.c43
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-iv-8.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-iv-8a-big-array.c43
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-iv-8a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1-big-array.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1a-big-array.c25
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1b-big-array.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-1b.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2-big-array.c41
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2a-big-array.c42
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2c-big-array.c42
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-2c.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3-big-array.c52
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c54
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-3a.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4a-big-array.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4a.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4b-big-array.c26
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4b.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4c-big-array.c27
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4c.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4d-big-array.c51
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4d.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4m-big-array.c58
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-4m.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-fir-big-array.c74
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb-big-array.c78
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-outer-fir.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-1-big-array.c64
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-2-big-array.c65
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c64
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-4-big-array.c68
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c71
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c36
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c69
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c35
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c49
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c49
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c17
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c50
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c20
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-shift-2-big-array.c190
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-shift-2.c18
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c92
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c43
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c101
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c33
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c94
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c53
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c116
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c63
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c105
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c35
-rw-r--r--gcc/testsuite/gcc.dg/volatile3.c13
-rw-r--r--gcc/testsuite/gcc.target/epiphany/interrupt.c6
-rw-r--r--gcc/testsuite/gcc.target/i386/movdi-rex64.c12
-rw-r--r--gcc/testsuite/gcc.target/mips/branch-1.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/dmult-1.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/extend-1.c2
-rw-r--r--gcc/testsuite/gcc.target/mips/mult-1.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c76
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-perm-2.c19
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-perm-4.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/ppc-target-4.c84
-rw-r--r--gcc/testsuite/gcc.target/powerpc/recip-5.c3
-rw-r--r--gcc/testsuite/gfortran.dg/auto_dealloc_2.f902
-rw-r--r--gcc/testsuite/gfortran.dg/bounds_check_16.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/class_19.f032
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_1.f0376
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_2.f0378
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_3.f03143
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_4.f0326
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_5.f0325
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_6.f0333
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_7.f0359
-rw-r--r--gcc/testsuite/gfortran.dg/class_array_8.f0318
-rw-r--r--gcc/testsuite/gfortran.dg/class_to_type_1.f0397
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/poly_run_1.f9043
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/poly_run_2.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_poly_1.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_poly_2.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/workshare2.f9053
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/workshare3.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/io_real_boz_3.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/io_real_boz_4.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/io_real_boz_5.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/private_type_14.f9043
-rw-r--r--gcc/testsuite/gfortran.dg/realloc_on_assign_8.f9017
-rw-r--r--gcc/testsuite/gfortran.dg/trans-mem-skel.f905
-rw-r--r--gcc/testsuite/gfortran.dg/type_to_class_1.f0365
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_assignment_3.f032
-rw-r--r--gcc/testsuite/gfortran.dg/warn_function_without_result_2.f9019
-rw-r--r--gcc/testsuite/gnat.dg/specs/elab3.ads16
-rw-r--r--gcc/testsuite/go.test/test/assign.go22
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug226.dir/x.go9
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug226.dir/y.go31
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug226.go7
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug310.go20
-rw-r--r--gcc/testsuite/go.test/test/fixedbugs/bug359.go26
209 files changed, 6919 insertions, 799 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1763ada432c..1d78adfdb8c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,377 @@
+2011-12-12 Richard Guenther <rguenther@suse.de>
+
+ PR lto/51262
+ * g++.dg/opt/pr51262.C: New testcase.
+
+2011-12-12 Revital Eres <revital.eres@linaro.org>
+
+ PR rtl-optimization/47013
+ * gcc.dg/sms-2.c: Change scan-tree-dump-times and the code itself
+ to preserve the function.
+ * gcc.dg/sms-6.c: Add --param sms-min-sc=1. Add dg-options for
+ powerpc*-*-*. Avoid superfluous spaces in dg-final.
+ * gcc.dg/sms-3.c: Add --param sms-min-sc=1 and
+ -fmodulo-sched-allow-regmoves flags.
+ * gcc.dg/sms-7.c: Likewise. Remove dg-final for powerpc*-*-*
+ and avoid superfluous spaces in dg-final for spu-*-*.
+ * gcc.dg/sms-4.c: Add dg-options for powerpc*-*-*.
+ * gcc.dg/sms-8.c: Add --param sms-min-sc=1. Add dg-options and
+ change scan-rtl-dump-times for powerpc*-*-*.
+ * gcc.dg/sms-5.c: Add --param sms-min-sc=1 flag, remove
+ powerpc*-*-* from dg-final and avoid superfluous spaces in
+ dg-final.
+ * gcc.dg/sms-9.c: Remove -fno-auto-inc-dec.
+
+2011-12-11 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51485
+ * g++.dg/vect/pr51485.cc: New test.
+
+2011-12-11 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50923
+ * gfortran.dg/warn_function_without_result_2.f90: New.
+
+2011-12-11 Paul Thomas <pault@gcc.gnu.org>
+ Tobias Burnus <burnus@gcc.gnu.org>
+
+ PR fortran/41539
+ PR fortran/43214
+ PR fortran/43969
+ PR fortran/44568
+ PR fortran/46356
+ PR fortran/46990
+ PR fortran/49074
+ * gfortran.dg/class_array_1.f03: New.
+ * gfortran.dg/class_array_2.f03: New.
+ * gfortran.dg/class_array_3.f03: New.
+ * gfortran.dg/class_array_4.f03: New.
+ * gfortran.dg/class_array_5.f03: New.
+ * gfortran.dg/class_array_6.f03: New.
+ * gfortran.dg/class_array_7.f03: New.
+ * gfortran.dg/class_array_8.f03: New.
+ * gfortran.dg/coarray_poly_1.f90: New.
+ * gfortran.dg/coarray_poly_2.f90: New.
+ * gfortran.dg/coarray/poly_run_1.f90: New.
+ * gfortran.dg/coarray/poly_run_2.f90: New.
+ * gfortran.dg/class_to_type_1.f03: New.
+ * gfortran.dg/type_to_class_1.f03: New.
+ * gfortran.dg/typebound_assignment_3.f03: Remove the error.
+ * gfortran.dg/auto_dealloc_2.f90: Occurences of __builtin_free
+ now 2.
+ * gfortran.dg/class_19.f03: Occurences of __builtin_free now 8.
+
+2011-12-11 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/50690
+ * gfortran.dg/gomp/workshare2.f90: New test.
+ * gfortran.dg/gomp/workshare3.f90: New test.
+
+2011-12-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/elab3.ads: New test.
+
+2011-12-10 Richard Henderson <rth@redhat.com>
+
+ * gcc.target/powerpc/altivec-perm-1.c: New.
+ * gcc.target/powerpc/altivec-perm-2.c: New.
+ * gcc.target/powerpc/altivec-perm-4.c: New.
+
+2011-12-10 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ * gcc.target/epiphany/interrupt.c: Add dg-options "-g".
+ Add a scan-assembler-time clause to test for the interupt vector jump.
+ (f): Rename to ...
+ (dma0_handler): ... this.
+
+2011-12-10 Nathan Sidwell <nathan@acm.org>
+
+ PR gcov-profile/51449
+ * g++.dg/gcov/gcov-14.C: New.
+
+2011-12-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/compile/20111209-1.c: New test.
+
+2011-12-09 Jason Merrill <jason@redhat.com>
+
+ PR c++/51151
+ * g++.dg/warn/Woverflow-4.C: New.
+
+2011-12-09 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/51289
+ * g++.dg/cpp0x/alias-decl-17.C: New test.
+
+2011-12-09 Michael Meissner <meissner@the-meissners.org>
+
+ * gcc.target/powerpc/recip-5.c: Disable running on any system that
+ does not support VSX.
+
+ * gcc.target/powerpc/ppc-target-4.c: New file to test target
+ specific functions enabling target specific builtins.
+
+2011-12-09 Michael Zolotukhin <michael.v.zolotukhin@intel.com>
+
+ * gcc.dg/vect/slp-13.c: Array size increase reverted.
+ * gcc.dg/vect/slp-24.c: Ditto.
+ * gcc.dg/vect/slp-3.c: Ditto.
+ * gcc.dg/vect/slp-34.c: Ditto.
+ * gcc.dg/vect/slp-4.c: Ditto.
+ * gcc.dg/vect/slp-cond-2.c: Ditto.
+ * gcc.dg/vect/slp-multitypes-11.c: Ditto.
+ * gcc.dg/vect/vect-1.c: Ditto.
+ * gcc.dg/vect/vect-10.c: Ditto.
+ * gcc.dg/vect/vect-105.c: Ditto.
+ * gcc.dg/vect/vect-112.c: Ditto.
+ * gcc.dg/vect/vect-15.c: Ditto.
+ * gcc.dg/vect/vect-2.c: Ditto.
+ * gcc.dg/vect/vect-31.c: Ditto.
+ * gcc.dg/vect/vect-32.c: Ditto.
+ * gcc.dg/vect/vect-33.c: Ditto.
+ * gcc.dg/vect/vect-34.c: Ditto.
+ * gcc.dg/vect/vect-35.c: Ditto.
+ * gcc.dg/vect/vect-36.c: Ditto.
+ * gcc.dg/vect/vect-6.c: Ditto.
+ * gcc.dg/vect/vect-73.c: Ditto.
+ * gcc.dg/vect/vect-74.c: Ditto.
+ * gcc.dg/vect/vect-75.c: Ditto.
+ * gcc.dg/vect/vect-76.c: Ditto.
+ * gcc.dg/vect/vect-80.c: Ditto.
+ * gcc.dg/vect/vect-85.c: Ditto.
+ * gcc.dg/vect/vect-89.c: Ditto.
+ * gcc.dg/vect/vect-97.c: Ditto.
+ * gcc.dg/vect/vect-98.c: Ditto.
+ * gcc.dg/vect/vect-all.c: Ditto.
+ * gcc.dg/vect/vect-double-reduc-6.c: Ditto.
+ * gcc.dg/vect/vect-iv-8.c: Ditto.
+ * gcc.dg/vect/vect-iv-8a.c: Ditto.
+ * gcc.dg/vect/vect-outer-1.c: Ditto.
+ * gcc.dg/vect/vect-outer-1a.c: Ditto.
+ * gcc.dg/vect/vect-outer-1b.c: Ditto.
+ * gcc.dg/vect/vect-outer-2.c: Ditto.
+ * gcc.dg/vect/vect-outer-2a.c: Ditto.
+ * gcc.dg/vect/vect-outer-2c.c: Ditto.
+ * gcc.dg/vect/vect-outer-3.c: Ditto.
+ * gcc.dg/vect/vect-outer-3a.c: Ditto.
+ * gcc.dg/vect/vect-outer-4a.c: Ditto.
+ * gcc.dg/vect/vect-outer-4b.c: Ditto.
+ * gcc.dg/vect/vect-outer-4c.c: Ditto.
+ * gcc.dg/vect/vect-outer-4d.c: Ditto.
+ * gcc.dg/vect/vect-outer-4m.c: Ditto.
+ * gcc.dg/vect/vect-outer-fir-lb.c: Ditto.
+ * gcc.dg/vect/vect-outer-fir.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-1.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-2.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-3.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-4.c: Ditto.
+ * gcc.dg/vect/vect-reduc-1char.c: Ditto.
+ * gcc.dg/vect/vect-reduc-2char.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-1b.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-1c.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-2b.c: Ditto.
+ * gcc.dg/vect/vect-shift-2.c: Ditto.
+ * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Ditto.
+ * gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap4.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap7.c: Ditto.
+ * gcc.dg/vect/slp-13-big-array.c: New test.
+ * gcc.dg/vect/slp-24-big-array.c: Ditto.
+ * gcc.dg/vect/slp-3-big-array.c: Ditto.
+ * gcc.dg/vect/slp-34-big-array.c: Ditto.
+ * gcc.dg/vect/slp-4-big-array.c: Ditto.
+ * gcc.dg/vect/slp-cond-2-big-array.c: Ditto.
+ * gcc.dg/vect/slp-multitypes-11-big-array.c: Ditto.
+ * gcc.dg/vect/vect-1-big-array.c: Ditto.
+ * gcc.dg/vect/vect-10-big-array.c: Ditto.
+ * gcc.dg/vect/vect-105-big-array.c: Ditto.
+ * gcc.dg/vect/vect-112-big-array.c: Ditto.
+ * gcc.dg/vect/vect-15-big-array.c: Ditto.
+ * gcc.dg/vect/vect-2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-31-big-array.c: Ditto.
+ * gcc.dg/vect/vect-32-big-array.c: Ditto.
+ * gcc.dg/vect/vect-33-big-array.c: Ditto.
+ * gcc.dg/vect/vect-34-big-array.c: Ditto.
+ * gcc.dg/vect/vect-35-big-array.c: Ditto.
+ * gcc.dg/vect/vect-36-big-array.c: Ditto.
+ * gcc.dg/vect/vect-6-big-array.c: Ditto.
+ * gcc.dg/vect/vect-73-big-array.c: Ditto.
+ * gcc.dg/vect/vect-74-big-array.c: Ditto.
+ * gcc.dg/vect/vect-75-big-array.c: Ditto.
+ * gcc.dg/vect/vect-76-big-array.c: Ditto.
+ * gcc.dg/vect/vect-80-big-array.c: Ditto.
+ * gcc.dg/vect/vect-85-big-array.c: Ditto.
+ * gcc.dg/vect/vect-89-big-array.c: Ditto.
+ * gcc.dg/vect/vect-97-big-array.c: Ditto.
+ * gcc.dg/vect/vect-98-big-array.c: Ditto.
+ * gcc.dg/vect/vect-all-big-array.c: Ditto.
+ * gcc.dg/vect/vect-double-reduc-6-big-array.c: Ditto.
+ * gcc.dg/vect/vect-iv-8-big-array.c: Ditto.
+ * gcc.dg/vect/vect-iv-8a-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-1-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-1a-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-1b-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-2a-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-2c-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-3-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-3a-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-4a-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-4b-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-4c-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-4d-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-4m-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-fir-lb-big-array.c: Ditto.
+ * gcc.dg/vect/vect-outer-fir-big-array.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-1-big-array.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-3-big-array.c: Ditto.
+ * gcc.dg/vect/vect-over-widen-4-big-array.c: Ditto.
+ * gcc.dg/vect/vect-reduc-1char-big-array.c: Ditto.
+ * gcc.dg/vect/vect-reduc-2char-big-array.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-1b-big-array.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-1c-big-array.c: Ditto.
+ * gcc.dg/vect/vect-reduc-pattern-2b-big-array.c: Ditto.
+ * gcc.dg/vect/vect-shift-2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Ditto.
+ * gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Ditto.
+
+2011-12-09 Richard Guenther <rguenther@suse.de>
+
+ PR lto/48042
+ * g++.dg/lto/pr48042_0.C: New testcase.
+
+2011-12-09 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/51482
+ * g++.dg/torture/pr51482.C: New testcase.
+
+2011-12-08 Andrew Pinski <apinski@cavium.com>
+
+ * gcc.target/mips/mult-1.c: Forbid all Octeon processors.
+ * gcc.target/mips/dmult-1.c: Likewise.
+ * gcc.target/mips/branch-1.c: Likewise.
+ * gcc.target/mips/extend-1.c: Likewise.
+
+2011-12-08 Jason Merrill <jason@redhat.com>
+
+ PR c++/51318
+ * g++.dg/template/cond8.C: New.
+
+ PR c++/51459
+ * g++.dg/cpp0x/lambda/lambda-template4.C: New.
+
+2011-12-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/51466
+ * gcc.c-torture/execute/pr51466.c: New test.
+
+2011-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/50815
+ * gfortran.dg/bounds_check_16.f90: New.
+
+2011-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51378
+ * gfortran.dg/private_type_14.f90: New.
+
+2011-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51407
+ * gfortran.dg/io_real_boz_3.f90: New.
+ * gfortran.dg/io_real_boz_4.f90: New.
+ * gfortran.dg/io_real_boz_5.f90: New.
+
+2011-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/51448
+ * gfortran.dg/realloc_on_assign_8.f90: New.
+
+2011-12-08 Teresa Johnson <tejohnson@google.com>
+
+ * gcc.target/i386/movdi-rex64.c: Remove unnecessary
+ unused label.
+
+2011-12-08 Teresa Johnson <tejohnson@google.com>
+
+ * gcc.target/i386/movdi-rex64.c: Remove unnecessary
+ -Wwrite-strings option.
+
+2011-12-08 Teresa Johnson <tejohnson@google.com>
+
+ * gcc.target/i386/movdi-rex64.c: New.
+
+2011-12-08 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/volatile3.c: New testcase.
+
+2011-12-08 Georg-Johann Lay <avr@gjlay.de>
+
+ PR tree-optimization/51315
+ * gcc.c-torture/execute/20111208-1.c (int16_t): Use __INT16_TYPE__
+ for typedef.
+ (int32_t): Use __INT32_TYPE__ for typedef.
+
+2011-12-08 Georg-Johann Lay <avr@gjlay.de>
+
+ PR tree-optimization/51315
+ * gcc.c-torture/execute/20111208-1.c: Fix wrong assumption
+ sizeof(int)==4.
+
+2011-12-08 Richard Guenther <rguenther@suse.de>
+
+ PR lto/50747
+ * g++.dg/opt/pr50747-1_0.C: New testcase.
+ * g++.dg/opt/pr50747-2_0.C: Likewise.
+
+2011-12-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20111208-1.c: New test.
+
+2011-12-08 Richard Guenther <rguenther@suse.de>
+
+ PR lto/48437
+ * gcc.dg/lto/20111207-2_0.c: New testcase.
+ * gcc.dg/guality/pr48437.c: Likewise.
+
+2011-12-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/51401
+ * g++.dg/cpp0x/auto7.C: Adjust expected error message.
+ * g++.dg/cpp0x/auto29.C: New test.
+
+ PR c++/51429
+ * g++.dg/parse/error45.C: New test.
+
+ PR c++/51229
+ * g++.dg/ext/desig3.C: New test.
+
+ PR c++/51369
+ * g++.dg/cpp0x/constexpr-51369.C: New test.
+
+2011-12-07 Andrew Pinski <apinski@cavium.com>
+
+ PR middle-end/45416
+ * gcc.dg/pr45416.c: New testcase.
+
+2011-12-07 Ed Smith-Rowland <3dw4rd@verizon.net>
+
+ PR c++/51420
+ * g++.dg/cpp0x/pr51420.C: New.
+
+2011-12-07 Richard Guenther <rguenther@suse.de>
+
+ PR lto/48100
+ * gcc.dg/lto/20111207-1_0.c: New testcase.
+ * gcc.dg/lto/20111207-1_1.c: Likewise.
+ * gcc.dg/lto/20111207-1_2.c: Likewise.
+ * gcc.dg/lto/20111207-1_3.c: Likewise.
+
2011-12-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50823
@@ -374,11 +748,6 @@
PR target/50123
* gcc.dg/atomic-op-optimize.c: New. Test for optimizations.
-2011-11-29 Michael Meissner <meissner@linux.vnet.ibm.com>
-
- * gcc.target/powerpc/ppc-target-4.c: New file to test target
- specific functions enabling target specific builtins.
-
2011-11-29 Yufeng Zhang <yufeng.zhang@arm.com>
Use complex floating-point constant in CDBL.
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-17.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-17.C
new file mode 100644
index 00000000000..41b1c950fcd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-17.C
@@ -0,0 +1,21 @@
+// Origin PR c++/51289
+// { dg-options "-std=c++11" }
+
+template<typename a, template <typename, typename> class b>
+struct foo {
+ template <typename t>
+ using type = b<a, t>;
+ template <typename t>
+ b<a, t> funca() {}
+
+ template <typename t>
+ type<t> funcb() {}
+};
+
+// This is an additional test, to emit an error message when using
+// unexpanded parameter packs in an alias declaration.
+template <class ... T>
+struct S {};
+
+template<class ... T>
+using A = S<T>; // { dg-error "parameter packs not expanded" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto29.C b/gcc/testsuite/g++.dg/cpp0x/auto29.C
new file mode 100644
index 00000000000..818745751a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/auto29.C
@@ -0,0 +1,25 @@
+// PR c++/51401
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+template <int>
+struct A
+{
+ auto i; // { dg-error "non-static data member declared" }
+};
+
+template <int>
+struct B
+{
+ auto i = 0; // { dg-error "non-static data member declared" }
+};
+
+struct C
+{
+ auto i; // { dg-error "non-static data member declared" }
+};
+
+struct D
+{
+ auto i = 0; // { dg-error "non-static data member declared" }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto7.C b/gcc/testsuite/g++.dg/cpp0x/auto7.C
index e7ab7236d05..3b3b8290168 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto7.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto7.C
@@ -9,5 +9,5 @@ template<int> struct A
{
static auto k = 7; // { dg-error "non-const" }
static auto l; // { dg-error "has no initializer" }
- auto m; // { dg-error "has no initializer" }
+ auto m; // { dg-error "non-static data member declared" }
};
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C
new file mode 100644
index 00000000000..6606be8b6f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-51369.C
@@ -0,0 +1,12 @@
+// PR c++/51369
+// { dg-do compile }
+// { dg-options "-std=c++11" }
+
+constexpr int x[2][2] = {};
+
+template<int>
+void
+foo ()
+{
+ x[0][0];
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template4.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template4.C
new file mode 100644
index 00000000000..a65727a1d43
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template4.C
@@ -0,0 +1,42 @@
+// PR c++/51459
+// { dg-do run { target c++11 } }
+
+struct func {
+ virtual ~func() { }
+ virtual void operator()() const = 0;
+ virtual func* clone() const = 0;
+};
+
+template<typename T>
+struct funcimpl : func {
+ explicit funcimpl(T t) : t(t) { }
+ void operator()() const { t(); }
+ func* clone() const { return new funcimpl(*this); }
+ T t;
+};
+
+struct function
+{
+ func* p;
+
+ template<typename T>
+ function(T t) : p(new funcimpl<T>(t)) { }
+
+ ~function() { delete p; }
+
+ function(const function& f) : p(f.p->clone()) { }
+
+ function& operator=(const function& ) = delete;
+
+ void operator()() const { (*p)(); }
+};
+
+template <typename F>
+function animate(F f) { return [=]{ f(); }; }
+
+int main()
+{
+ function linear1 = []{};
+ function av(animate(linear1));
+ av();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51420.C b/gcc/testsuite/g++.dg/cpp0x/pr51420.C
new file mode 100644
index 00000000000..aec8cb1fcbc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr51420.C
@@ -0,0 +1,8 @@
+// { dg-options "-std=c++11" }
+
+void
+foo()
+{
+ float x = operator"" _F(); // { dg-error "was not declared in this scope" }
+ float y = 0_F; // { dg-error "unable to find numeric literal operator" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/desig3.C b/gcc/testsuite/g++.dg/ext/desig3.C
new file mode 100644
index 00000000000..d1ff5e53ef5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/desig3.C
@@ -0,0 +1,9 @@
+// PR c++/51229
+// { dg-do compile }
+// { dg-options "" }
+
+struct A { int i; };
+
+int a[5] = { .foo = 7 };// { dg-error "used in a GNU-style designated initializer for an array" }
+int b[] = { .foo = 8 }; // { dg-error "used in a GNU-style designated initializer for an array" }
+A c = { [0] = {} }; // { dg-error "used in a GNU-style designated initializer for class" }
diff --git a/gcc/testsuite/g++.dg/gcov/gcov-14.C b/gcc/testsuite/g++.dg/gcov/gcov-14.C
new file mode 100644
index 00000000000..8f8e3882d82
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gcov/gcov-14.C
@@ -0,0 +1,16 @@
+/* { dg-options "-fprofile-arcs -ftest-coverage -Ofast" } */
+/* { dg-do run { target native } } */
+
+#include <iostream>
+
+void __attribute__ ((noinline))
+ Out (std::ostream &out, double x)
+{ out << x << std::endl; } /* count(1) */
+
+int main ()
+{
+ Out (std::cout, 1.5); /* count(1) */
+ return 0;
+}
+
+/* { dg-final { run-gcov gcov-14.C } } */
diff --git a/gcc/testsuite/g++.dg/lto/pr48042_0.C b/gcc/testsuite/g++.dg/lto/pr48042_0.C
new file mode 100644
index 00000000000..00b3428e9f1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr48042_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do link }
+// { dg-extra-ld-options "-r -nostdlib -g" }
+
+class A {
+ virtual int x() = 0;
+};
+
+class B:public A {
+ int x();
+};
+
+int B::x() {
+}
+
diff --git a/gcc/testsuite/g++.dg/opt/pr50747-1_0.C b/gcc/testsuite/g++.dg/opt/pr50747-1_0.C
new file mode 100644
index 00000000000..4a5546c638e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr50747-1_0.C
@@ -0,0 +1,18 @@
+// { dg-do compile }
+// { dg-require-effective-target lto }
+// { dg-options "-flto" }
+
+void foo();
+
+static void bar() __attribute__((weakref("foo")));
+
+struct A
+{
+ A();
+};
+
+int i;
+
+template <typename T, int&> struct B : T {};
+
+B<A, i> b;
diff --git a/gcc/testsuite/g++.dg/opt/pr50747-2_0.C b/gcc/testsuite/g++.dg/opt/pr50747-2_0.C
new file mode 100644
index 00000000000..26f423af631
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr50747-2_0.C
@@ -0,0 +1,112 @@
+// { dg-do compile }
+// { dg-require-effective-target lto }
+// { dg-options "-w -fpermissive -fno-implicit-templates -flto" }
+
+namespace std {
+ typedef long unsigned int size_t;
+ template<typename _Alloc> class allocator;
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_ostream;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_ostringstream;
+}
+extern "C++" {
+ namespace std {
+ class exception {
+ };
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class new_allocator {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> {
+ public: typedef size_t size_type;
+ template<typename _Tp1> struct rebind {
+ typedef allocator<_Tp1> other;
+ };
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc> class basic_string {
+ typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ private: struct _Rep_base {
+ };
+ struct _Rep : _Rep_base {
+ _CharT* _M_refdata() throw() {
+ }
+ };
+ struct _Alloc_hider : _Alloc {
+ _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) {
+ }
+ _CharT* _M_p;
+ };
+ private: mutable _Alloc_hider _M_dataplus;
+ static _Rep& _S_empty_rep() {
+ }
+ public: basic_string() : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) {
+ }
+ template<class _InputIterator> basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a = _Alloc());
+ static _CharT* _S_construct(size_type __req, _CharT __c, const _Alloc& __a);
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc> inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const basic_string<_CharT, _Traits, _Alloc>& __str) {
+ }
+ template<typename _CharT, typename _Traits, typename _Alloc> template<typename _InputIterator> basic_string<_CharT, _Traits, _Alloc>:: basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a) : _M_dataplus(_S_construct(__beg, __end, __a), __a) {
+ };
+ enum _Ios_Openmode {
+ _S_app = 1L << 0, _S_ate = 1L << 1, _S_bin = 1L << 2, _S_in = 1L << 3, _S_out = 1L << 4, _S_trunc = 1L << 5, _S_ios_openmode_end = 1L << 16 };
+ class ios_base {
+ public: class failure : public exception {
+ };
+ typedef _Ios_Openmode openmode;
+ static const openmode in = _S_in;
+ static const openmode out = _S_out;
+ };
+ template<typename _CharT, typename _Traits> class basic_streambuf {
+ public: typedef _CharT char_type;
+ char_type* egptr() const {
+ }
+ char_type* pbase() const {
+ }
+ char_type* pptr() const {
+ }
+ };
+ template<typename _CharT, typename _Traits> class basic_ios : public ios_base {
+ };
+ template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc> class basic_stringbuf : public basic_streambuf<_CharT, _Traits> {
+ public: typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_streambuf<char_type, traits_type> __streambuf_type;
+ typedef basic_string<char_type, _Traits, _Alloc> __string_type;
+ protected: ios_base::openmode _M_mode;
+ __string_type _M_string;
+ public: explicit basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out) : __streambuf_type(), _M_mode(__mode), _M_string() {
+ }
+ __string_type str() const {
+ __string_type __ret;
+ if (this->pptr()) {
+ if (this->pptr() > this->egptr()) __ret = __string_type(this->pbase(), this->pptr());
+ }
+ }
+ };
+ template <typename _CharT, typename _Traits, typename _Alloc> class basic_ostringstream : public basic_ostream<_CharT, _Traits> {
+ public: typedef _CharT char_type;
+ typedef _Traits traits_type;
+ typedef basic_string<_CharT, _Traits, _Alloc> __string_type;
+ typedef basic_stringbuf<_CharT, _Traits, _Alloc> __stringbuf_type;
+ typedef basic_ostream<char_type, traits_type> __ostream_type;
+ private: __stringbuf_type _M_stringbuf;
+ public: explicit basic_ostringstream(ios_base::openmode __mode = ios_base::out) : __ostream_type(), _M_stringbuf(__mode | ios_base::out) {
+ }
+ __string_type str() const {
+ return _M_stringbuf.str();
+ }
+ };
+ template<typename _Tp> class complex;
+ template<typename _Tp, typename _CharT, class _Traits> basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x) {
+ basic_ostringstream<_CharT, _Traits> __s;
+ return __os << __s.str();
+ };
+ template basic_ostream<wchar_t, char_traits<wchar_t> >& operator<<(basic_ostream<wchar_t, char_traits<wchar_t> >&, const complex<long double>&);
+}
diff --git a/gcc/testsuite/g++.dg/opt/pr51262.C b/gcc/testsuite/g++.dg/opt/pr51262.C
new file mode 100644
index 00000000000..d0e8d781262
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/pr51262.C
@@ -0,0 +1,21 @@
+// { dg-do compile }
+// { dg-require-effective-target lto }
+// { dg-options "-flto -g" }
+
+template < typename > void *
+bar (int *p)
+{
+ union
+ {
+ int *p;
+ }
+ u;
+ u.p = p;
+ return u.p;
+}
+
+void
+foo (int *p)
+{
+ bar < void >(p);
+}
diff --git a/gcc/testsuite/g++.dg/parse/error45.C b/gcc/testsuite/g++.dg/parse/error45.C
new file mode 100644
index 00000000000..7df8b13f469
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/error45.C
@@ -0,0 +1,9 @@
+// PR c++/51429
+// { dg-do compile }
+
+struct A
+{
+ void foo (double);
+ void foo (int);
+ A () { foo = 0; } // { dg-error "invalid use of member function" }
+};
diff --git a/gcc/testsuite/g++.dg/template/cond8.C b/gcc/testsuite/g++.dg/template/cond8.C
new file mode 100644
index 00000000000..a3bad7e7bed
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/cond8.C
@@ -0,0 +1,10 @@
+// PR c++/51318
+
+enum { e0, e1 };
+
+template<bool B, int = B ? e0 : e1> struct A {};
+
+template<typename T> struct B
+{
+ A<T::X> a;
+};
diff --git a/gcc/testsuite/g++.dg/tm/cgraph_edge.C b/gcc/testsuite/g++.dg/tm/cgraph_edge.C
new file mode 100644
index 00000000000..d4c8f77fe89
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tm/cgraph_edge.C
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-fgnu-tm -O3" }
+
+template<typename _InputIterator, typename _Distance> inline void advance(_InputIterator& __i, _Distance __n)
+ {
+ if (__n > 0)
+ while (__n--)
+ --__i;
+ else
+ --__i;
+ }
+
+void _Rb_tree_increment ();
+
+template<typename _Tp> struct _Rb_tree_iterator
+ {
+ typedef _Rb_tree_iterator<_Tp> iterator;
+
+ iterator& operator--()
+ {
+ _Rb_tree_increment();
+ }
+ };
+
+void update ()
+ {
+ _Rb_tree_iterator<int>::iterator it;
+ __transaction_relaxed
+ {
+ advance (it, 0);
+ }
+ }
+
diff --git a/gcc/testsuite/g++.dg/torture/pr51482.C b/gcc/testsuite/g++.dg/torture/pr51482.C
new file mode 100644
index 00000000000..28435919f46
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr51482.C
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+typedef enum { CLASS_IN = 1, CLASS_OUT = -1 } FERGUSON_KEY_CLASS, BEZIER_KEY_CLASS;
+typedef class flag_interface { } VECT3DF_SIMPLE;
+typedef struct vect3df {
+ float x,y,z;
+} VECT3DF, VECT;
+typedef struct vect4df : public vect3df {
+ float w;
+} VECT4DF, WVECT;
+typedef class llist_item { } ANIM_KEY;
+typedef class anim_track : public flag_interface, public llist_item { } ANIM_KEY_BEZ;
+typedef class anim_track_bezier : public anim_track { } ANIM_KEY_BEZ_WVECT;
+typedef class anim_track_bez_wvect : public anim_track_bezier {
+ WVECT * tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn);
+} ANIM_TRACK_BEZ_WVECT;
+WVECT * anim_track_bez_wvect::tangent(int kn, BEZIER_KEY_CLASS key_class, WVECT *p_tn)
+{
+ float bias,continuity,tension,tn1,bp1;
+ WVECT *p_p0,*p_p1,*p_p2, t1, g1,g2,g3;
+ g1.x = (p_p1->x - p_p0->x)*bp1;
+ g1.y = (p_p1->y - p_p0->y)*bp1;
+ g1.z = (p_p1->z - p_p0->z)*bp1;
+ g1.w = (p_p1->w - p_p0->w)*bp1;
+ bp1 = (0.5f + key_class*0.5f*continuity);
+ p_tn->x = (g1.x + g3.x*bp1)*tn1;
+ p_tn->y = (g1.y + g3.y*bp1)*tn1;
+ p_tn->z = (g1.z + g3.z*bp1)*tn1;
+ p_tn->w = (g1.w + g3.w*bp1)*tn1;
+}
diff --git a/gcc/testsuite/g++.dg/vect/pr51485.cc b/gcc/testsuite/g++.dg/vect/pr51485.cc
new file mode 100644
index 00000000000..d57d7596d0e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr51485.cc
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+
+struct A { A (); unsigned int a; };
+double bar (A a) throw () __attribute__((pure));
+
+void
+foo (unsigned int x, double *y, A *z)
+{
+ unsigned int i;
+ for (i = 0; i < x; i++)
+ y[i] = bar (z[i]);
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/g++.dg/warn/Woverflow-4.C b/gcc/testsuite/g++.dg/warn/Woverflow-4.C
new file mode 100644
index 00000000000..1595bcada3e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Woverflow-4.C
@@ -0,0 +1,13 @@
+// PR c++/51151
+// { dg-options "-Wshadow" }
+
+template<typename T> class C {
+public:
+ void f() {
+ m = c2 + 1;
+ }
+ static const long unsigned int c1 = 7;
+ static const int c2 = c1 - 1;
+ int m;
+};
+template class C<int>;
diff --git a/gcc/testsuite/gcc.c-torture/compile/20111209-1.c b/gcc/testsuite/gcc.c-torture/compile/20111209-1.c
new file mode 100644
index 00000000000..c7f832a9e37
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20111209-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target s390x-*-* *-*-*vms* } } */
+
+typedef char* char_ptr32 __attribute__ ((mode(SI)));
+
+char_ptr32 getenv (const char *name);
+unsigned long strlen (const char *str);
+
+void
+__gnat_getenv (char *name, int *len, char **value)
+{
+ *value = getenv (name);
+ *len = strlen (*value);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20111208-1.c b/gcc/testsuite/gcc.c-torture/execute/20111208-1.c
new file mode 100644
index 00000000000..dc2b9ca8c86
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20111208-1.c
@@ -0,0 +1,94 @@
+/* PR tree-optimization/51315 */
+/* Reported by Jurij Smakov <jurij@wooyd.org> */
+
+typedef unsigned int size_t;
+
+extern void *memcpy (void *__restrict __dest,
+ __const void *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
+
+extern size_t strlen (__const char *__s)
+ __attribute__ ((__nothrow__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+
+typedef __INT16_TYPE__ int16_t;
+typedef __INT32_TYPE__ int32_t;
+
+extern void abort (void);
+
+int a;
+
+static void __attribute__ ((noinline,noclone))
+do_something (int item)
+{
+ a = item;
+}
+
+int
+pack_unpack (char *s, char *p)
+{
+ char *send, *pend;
+ char type;
+ int integer_size;
+
+ send = s + strlen (s);
+ pend = p + strlen (p);
+
+ while (p < pend)
+ {
+ type = *p++;
+
+ switch (type)
+ {
+ case 's':
+ integer_size = 2;
+ goto unpack_integer;
+
+ case 'l':
+ integer_size = 4;
+ goto unpack_integer;
+
+ unpack_integer:
+ switch (integer_size)
+ {
+ case 2:
+ {
+ union
+ {
+ int16_t i;
+ char a[sizeof (int16_t)];
+ }
+ v;
+ memcpy (v.a, s, sizeof (int16_t));
+ s += sizeof (int16_t);
+ do_something (v.i);
+ }
+ break;
+
+ case 4:
+ {
+ union
+ {
+ int32_t i;
+ char a[sizeof (int32_t)];
+ }
+ v;
+ memcpy (v.a, s, sizeof (int32_t));
+ s += sizeof (int32_t);
+ do_something (v.i);
+ }
+ break;
+ }
+ break;
+ }
+ }
+ return (int) *s;
+}
+
+int
+main (void)
+{
+ int n = pack_unpack ("\200\001\377\376\035\300", "sl");
+ if (n != 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr51466.c b/gcc/testsuite/gcc.c-torture/execute/pr51466.c
new file mode 100644
index 00000000000..aa0b7fd4fb9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr51466.c
@@ -0,0 +1,43 @@
+/* PR tree-optimization/51466 */
+
+extern void abort (void);
+
+__attribute__((noinline, noclone)) int
+foo (int i)
+{
+ volatile int v[4];
+ int *p;
+ v[i] = 6;
+ p = (int *) &v[i];
+ return *p;
+}
+
+__attribute__((noinline, noclone)) int
+bar (int i)
+{
+ volatile int v[4];
+ int *p;
+ v[i] = 6;
+ p = (int *) &v[i];
+ *p = 8;
+ return v[i];
+}
+
+__attribute__((noinline, noclone)) int
+baz (int i)
+{
+ volatile int v[4];
+ int *p;
+ v[i] = 6;
+ p = (int *) &v[0];
+ *p = 8;
+ return v[i];
+}
+
+int
+main ()
+{
+ if (foo (3) != 6 || bar (2) != 8 || baz (0) != 8 || baz (1) != 6)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/guality/pr48437.c b/gcc/testsuite/gcc.dg/guality/pr48437.c
new file mode 100644
index 00000000000..5346baa0bd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/guality/pr48437.c
@@ -0,0 +1,17 @@
+/* PR lto/48437 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+#include "../nop.h"
+
+int i __attribute__((used));
+int main()
+{
+ volatile int i;
+ for (i = 3; i < 7; ++i)
+ {
+ extern int i;
+ asm volatile (NOP : : : "memory"); /* { dg-final { gdb-test 14 "i" "0" } } */
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-1_0.c b/gcc/testsuite/gcc.dg/lto/20111207-1_0.c
new file mode 100644
index 00000000000..486264066f6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20111207-1_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options { { -flto } } } */
+/* { dg-require-linker-plugin "" } */
+/* { dg-extra-ld-options "-fuse-linker-plugin" } */
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-1_1.c b/gcc/testsuite/gcc.dg/lto/20111207-1_1.c
new file mode 100644
index 00000000000..a616c194fca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20111207-1_1.c
@@ -0,0 +1,3 @@
+/* { dg-options "-fno-lto" } */
+
+int i;
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-1_2.c b/gcc/testsuite/gcc.dg/lto/20111207-1_2.c
new file mode 100644
index 00000000000..048f715b465
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20111207-1_2.c
@@ -0,0 +1 @@
+int i;
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-1_3.c b/gcc/testsuite/gcc.dg/lto/20111207-1_3.c
new file mode 100644
index 00000000000..9beed59509a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20111207-1_3.c
@@ -0,0 +1,6 @@
+extern int i;
+
+int main()
+{
+ return i;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20111207-2_0.c b/gcc/testsuite/gcc.dg/lto/20111207-2_0.c
new file mode 100644
index 00000000000..672db535a08
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20111207-2_0.c
@@ -0,0 +1,17 @@
+/* { dg-lto-do run } */
+
+int
+test (void)
+{
+ int f (void);
+ return 0;
+}
+
+int
+main (void)
+{
+ int f (void);
+ int test (void);
+
+ return test ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr45416.c b/gcc/testsuite/gcc.dg/pr45416.c
new file mode 100644
index 00000000000..1e57185b1c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr45416.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo(long long a)
+{
+ if (a & (long long) 0x400)
+ return 1;
+ return 0;
+}
+
+/* { dg-final { scan-assembler "andl" { target i?86-*-linux* x86_64-*-linux* } } } " */
+/* { dg-final { scan-assembler-not "setne" { target i?86-*-linux* x86_64-*-linux* } } }" */
+/* { dg-final { scan-assembler "and" { target arm*-*-* } } }" */
+/* { dg-final { scan-assembler-not "moveq" { target arm*-*-* } } }" */
diff --git a/gcc/testsuite/gcc.dg/sms-2.c b/gcc/testsuite/gcc.dg/sms-2.c
index 9ea63bd0f41..897e5d4b173 100644
--- a/gcc/testsuite/gcc.dg/sms-2.c
+++ b/gcc/testsuite/gcc.dg/sms-2.c
@@ -4,12 +4,11 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms" } */
-
+int th, h, em, nlwm, nlwS, nlw, sy;
void
fun (nb)
int nb;
{
- int th, h, em, nlwm, nlwS, nlw, sy;
while (nb--)
while (h--)
@@ -33,5 +32,5 @@ fun (nb)
}
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS loop many exits" 1 "sms" { target spu-*-* powerpc*-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-3.c b/gcc/testsuite/gcc.dg/sms-3.c
index b78c2b27ee5..d1d3b508f67 100644
--- a/gcc/testsuite/gcc.dg/sms-3.c
+++ b/gcc/testsuite/gcc.dg/sms-3.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves" } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/sms-4.c b/gcc/testsuite/gcc.dg/sms-4.c
index eafb395627d..83b32d05a4b 100644
--- a/gcc/testsuite/gcc.dg/sms-4.c
+++ b/gcc/testsuite/gcc.dg/sms-4.c
@@ -1,6 +1,7 @@
/* Inspired from sbitmap_a_or_b_and_c_cg function in sbitmap.c. */
/* { dg-do run } */
/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms --param sms-min-sc=1" { target powerpc*-*-* } } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/sms-5.c b/gcc/testsuite/gcc.dg/sms-5.c
index 6fbb612e385..7bc4c33a3cd 100644
--- a/gcc/testsuite/gcc.dg/sms-5.c
+++ b/gcc/testsuite/gcc.dg/sms-5.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -funroll-loops -fdump-rtl-sms --param sms-min-sc=1" } */
/* This is the same test as loop-2e.c test. It is related to a fix in
the generation of the prolog and epilog. */
@@ -46,7 +46,7 @@ int main ()
return 0;
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* spu-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-6.c b/gcc/testsuite/gcc.dg/sms-6.c
index 34e9cf82da4..3da708dadac 100644
--- a/gcc/testsuite/gcc.dg/sms-6.c
+++ b/gcc/testsuite/gcc.dg/sms-6.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms" } */
+/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1" } */
+/* { dg-options "-O2 -fmodulo-sched -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves" { target powerpc*-*-* } } */
extern void abort (void);
@@ -43,7 +44,7 @@ int main()
return 0;
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-7.c b/gcc/testsuite/gcc.dg/sms-7.c
index 29791ff2a4f..f96530a2697 100644
--- a/gcc/testsuite/gcc.dg/sms-7.c
+++ b/gcc/testsuite/gcc.dg/sms-7.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms" } */
+/* { dg-options "-O3 -fmodulo-sched -fstrict-aliasing -fdump-rtl-sms -fmodulo-sched-allow-regmoves --param sms-min-sc=1" } */
extern void abort (void);
@@ -44,7 +44,6 @@ int main()
return 0;
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 3 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target spu-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-8.c b/gcc/testsuite/gcc.dg/sms-8.c
index afac55dadd1..1cb6280aab2 100644
--- a/gcc/testsuite/gcc.dg/sms-8.c
+++ b/gcc/testsuite/gcc.dg/sms-8.c
@@ -3,7 +3,8 @@
that was not fixed by reg-moves. */
/* { dg-do run } */
- /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms --param sms-min-sc=1" } */
+ /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" { target powerpc*-*-* } } */
extern void abort (void);
@@ -35,7 +36,7 @@ main ()
return 0;
}
-/* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */
+/* { dg-final { scan-rtl-dump-times "SMS succeeded" 0 "sms" { target powerpc*-*-* } } } */
/* { dg-final { cleanup-rtl-dump "sms" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-9.c b/gcc/testsuite/gcc.dg/sms-9.c
index 9d1f8814257..c8dc28104aa 100644
--- a/gcc/testsuite/gcc.dg/sms-9.c
+++ b/gcc/testsuite/gcc.dg/sms-9.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-options "-O2 -fmodulo-sched -fno-auto-inc-dec -O2 -fmodulo-sched-allow-regmoves" } */
+/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves" } */
#include <stdlib.h>
#include <stdarg.h>
diff --git a/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c
new file mode 100644
index 00000000000..c40822b62a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-13-big-array.c
@@ -0,0 +1,141 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+volatile int y = 0;
+
+int
+main1 ()
+{
+ int i;
+ unsigned short out[N*8];
+ unsigned short in[N*8];
+ unsigned int in2[N*8];
+ unsigned int out2[N*8];
+
+ for (i = 0; i < N*8; i++)
+ {
+ in[i] = in2[i] = i;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ /* Induction is not SLPable yet. */
+ for (i = 0; i < N; i++)
+ {
+ out[i*8] = in[i*8] + i;
+ out[i*8 + 1] = in[i*8 + 1] + i;
+ out[i*8 + 2] = in[i*8 + 2] + i;
+ out[i*8 + 3] = in[i*8 + 3] + i;
+ out[i*8 + 4] = in[i*8 + 4] + i;
+ out[i*8 + 5] = in[i*8 + 5] + i;
+ out[i*8 + 6] = in[i*8 + 6] + i;
+ out[i*8 + 7] = in[i*8 + 7] + i;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (out[i*8] != in[i*8] + i
+ || out[i*8 + 1] != in[i*8 + 1] + i
+ || out[i*8 + 2] != in[i*8 + 2] + i
+ || out[i*8 + 3] != in[i*8 + 3] + i
+ || out[i*8 + 4] != in[i*8 + 4] + i
+ || out[i*8 + 5] != in[i*8 + 5] + i
+ || out[i*8 + 6] != in[i*8 + 6] + i
+ || out[i*8 + 7] != in[i*8 + 7] + i)
+ abort ();
+ }
+
+ /* Induction is not SLPable yet and strided group size must be a power of 2
+ to get vectorized. */
+ for (i = 0; i < N/2; i++)
+ {
+ out2[i*12] = in2[i*12] + i;
+ out2[i*12 + 1] = in2[i*12 + 1] + i;
+ out2[i*12 + 2] = in2[i*12 + 2] + i;
+ out2[i*12 + 3] = in2[i*12 + 3] + i;
+ out2[i*12 + 4] = in2[i*12 + 4] + i;
+ out2[i*12 + 5] = in2[i*12 + 5] + i;
+ out2[i*12 + 6] = in2[i*12 + 6] + i;
+ out2[i*12 + 7] = in2[i*12 + 7] + i;
+ out2[i*12 + 8] = in2[i*12 + 8] + i;
+ out2[i*12 + 9] = in2[i*12 + 9] + i;
+ out2[i*12 + 10] = in2[i*12 + 10] + i;
+ out2[i*12 + 11] = in2[i*12 + 11] + i;
+ }
+
+ /* check results: */
+ for (i = 0; i < N/2; i++)
+ {
+ if (out2[i*12] != in2[i*12] + i
+ || out2[i*12 + 1] != in2[i*12 + 1] + i
+ || out2[i*12 + 2] != in2[i*12 + 2] + i
+ || out2[i*12 + 3] != in2[i*12 + 3] + i
+ || out2[i*12 + 4] != in2[i*12 + 4] + i
+ || out2[i*12 + 5] != in2[i*12 + 5] + i
+ || out2[i*12 + 6] != in2[i*12 + 6] + i
+ || out2[i*12 + 7] != in2[i*12 + 7] + i
+ || out2[i*12 + 8] != in2[i*12 + 8] + i
+ || out2[i*12 + 9] != in2[i*12 + 9] + i
+ || out2[i*12 + 10] != in2[i*12 + 10] + i
+ || out2[i*12 + 11] != in2[i*12 + 11] + i)
+ abort ();
+ }
+
+ /* Not power of 2 but SLPable. */
+ for (i = 0; i < N/2; i++)
+ {
+ out2[i*12] = in2[i*12] + 1;
+ out2[i*12 + 1] = in2[i*12 + 1] + 2;
+ out2[i*12 + 2] = in2[i*12 + 2] + 3;
+ out2[i*12 + 3] = in2[i*12 + 3] + 4;
+ out2[i*12 + 4] = in2[i*12 + 4] + 5;
+ out2[i*12 + 5] = in2[i*12 + 5] + 6;
+ out2[i*12 + 6] = in2[i*12 + 6] + 7;
+ out2[i*12 + 7] = in2[i*12 + 7] + 8;
+ out2[i*12 + 8] = in2[i*12 + 8] + 9;
+ out2[i*12 + 9] = in2[i*12 + 9] + 10;
+ out2[i*12 + 10] = in2[i*12 + 10] + 11;
+ out2[i*12 + 11] = in2[i*12 + 11] + 12;
+ }
+
+ /* check results: */
+ for (i = 0; i < N/2; i++)
+ {
+ if (out2[i*12] != in2[i*12] + 1
+ || out2[i*12 + 1] != in2[i*12 + 1] + 2
+ || out2[i*12 + 2] != in2[i*12 + 2] + 3
+ || out2[i*12 + 3] != in2[i*12 + 3] + 4
+ || out2[i*12 + 4] != in2[i*12 + 4] + 5
+ || out2[i*12 + 5] != in2[i*12 + 5] + 6
+ || out2[i*12 + 6] != in2[i*12 + 6] + 7
+ || out2[i*12 + 7] != in2[i*12 + 7] + 8
+ || out2[i*12 + 8] != in2[i*12 + 8] + 9
+ || out2[i*12 + 9] != in2[i*12 + 9] + 10
+ || out2[i*12 + 10] != in2[i*12 + 10] + 11
+ || out2[i*12 + 11] != in2[i*12 + 11] + 12)
+ abort ();
+ }
+
+
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-13.c b/gcc/testsuite/gcc.dg/vect/slp-13.c
index e1c4e415f67..655e6ade1d0 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-13.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-13.c
@@ -3,25 +3,17 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 64
-volatile int y = 0;
+#define N 8
int
main1 ()
{
int i;
unsigned short out[N*8];
- unsigned short in[N*8];
- unsigned int in2[N*8];
+ unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
+ unsigned int in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int out2[N*8];
- for (i = 0; i < N*8; i++)
- {
- in[i] = in2[i] = i;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
/* Induction is not SLPable yet. */
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c
new file mode 100644
index 00000000000..6c8f01c9749
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-24-big-array.c
@@ -0,0 +1,99 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+} s;
+
+unsigned char ub[N*2];
+unsigned char uc[N];
+
+volatile int y = 0;
+unsigned char check_diff = 2;
+
+void
+main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
+{
+ int i;
+ unsigned char udiff = 2;
+ unsigned char umax = x;
+ unsigned char umin = x;
+ unsigned char ua1[N*2];
+ s *pIn = arr;
+ s out[N];
+
+ for (i = 0; i < N; i++) {
+ udiff += (unsigned char) (ub[i] - uc[i]);
+
+ ua1[2*i+1] = ub[2*i+1];
+ ua1[2*i] = ub[2*i];
+
+ out[i].d = pIn->d - 1;
+ out[i].b = pIn->b - 4;
+ out[i].c = pIn->c - 8;
+ out[i].a = pIn->a - 3;
+
+ pIn++;
+ }
+
+ for (i = 0; i < N; i++) {
+ if (ua1[2*i] != ub[2*i]
+ || ua1[2*i+1] != ub[2*i+1]
+ || out[i].a != arr[i].a - 3
+ || out[i].b != arr[i].b - 4
+ || out[i].c != arr[i].c - 8
+ || out[i].d != arr[i].d - 1)
+ abort ();
+ }
+
+ /* check results: */
+ if (udiff != check_diff)
+ abort ();
+}
+
+int main (void)
+{
+ int i;
+ s arr[N];
+
+ check_diff = 2;
+ ub[0] = uc[0] = 1;
+ for (i = 1; i < N; i++) {
+ ub[i] = (i%5 == 0)?i*3:i;
+ uc[i] = i;
+ check_diff += (unsigned char) (ub[i] - uc[i]);
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+ for (; i < 2*N; i++) {
+ ub[i] = 0;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i + 9;
+ arr[i].b = i * 2 + 10;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ if (arr[i].a == 178)
+ abort ();
+ }
+ check_vect ();
+
+ main1 (100, 100, 1, arr);
+ main1 (0, 15, 0, arr);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { vect_no_align && ilp32 } } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { xfail { vect_no_align && ilp32 } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-24.c b/gcc/testsuite/gcc.dg/vect/slp-24.c
index 690422231bd..61c53f08fa6 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-24.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-24.c
@@ -3,7 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 64
+#define N 16
+#define DIFF 242
typedef struct {
unsigned char a;
@@ -12,11 +13,8 @@ typedef struct {
unsigned char d;
} s;
-unsigned char ub[N*2];
-unsigned char uc[N];
-
-volatile int y = 0;
-unsigned char check_diff = 2;
+unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
@@ -30,7 +28,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *a
s out[N];
for (i = 0; i < N; i++) {
- udiff += (unsigned char) (ub[i] - uc[i]);
+ udiff += (unsigned char)(ub[i] - uc[i]);
ua1[2*i+1] = ub[2*i+1];
ua1[2*i] = ub[2*i];
@@ -54,7 +52,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *a
}
/* check results: */
- if (udiff != check_diff)
+ if (udiff != DIFF)
abort ();
}
@@ -63,21 +61,6 @@ int main (void)
int i;
s arr[N];
- check_diff = 2;
- ub[0] = uc[0] = 1;
- for (i = 1; i < N; i++) {
- ub[i] = (i%5 == 0)?i*3:i;
- uc[i] = i;
- check_diff += (unsigned char) (ub[i] - uc[i]);
- if (y) /* Avoid vectorization. */
- abort ();
- }
- for (; i < 2*N; i++) {
- ub[i] = 0;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
for (i = 0; i < N; i++)
{
arr[i].a = i + 9;
diff --git a/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c
new file mode 100644
index 00000000000..4f50f1f90fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-3-big-array.c
@@ -0,0 +1,155 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 96
+
+unsigned short in[N*8];
+volatile int y = 0;
+
+int
+main1 ()
+{
+ int i;
+ unsigned short out[N*8];
+
+ for (i = 0; i < N*8; i++)
+ {
+ in[i] = i&63;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ out[i*8] = in[i*8];
+ out[i*8 + 1] = in[i*8 + 1];
+ out[i*8 + 2] = in[i*8 + 2];
+ out[i*8 + 3] = in[i*8 + 3];
+ out[i*8 + 4] = in[i*8 + 4];
+ out[i*8 + 5] = in[i*8 + 5];
+ out[i*8 + 6] = in[i*8 + 6];
+ out[i*8 + 7] = in[i*8 + 7];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (out[i*8] != in[i*8]
+ || out[i*8 + 1] != in[i*8 + 1]
+ || out[i*8 + 2] != in[i*8 + 2]
+ || out[i*8 + 3] != in[i*8 + 3]
+ || out[i*8 + 4] != in[i*8 + 4]
+ || out[i*8 + 5] != in[i*8 + 5]
+ || out[i*8 + 6] != in[i*8 + 6]
+ || out[i*8 + 7] != in[i*8 + 7])
+ abort ();
+ }
+
+ for (i = 0; i < N*2; i++)
+ {
+ out[i*4] = in[i*4];
+ out[i*4 + 1] = in[i*4 + 1];
+ out[i*4 + 2] = in[i*4 + 2];
+ out[i*4 + 3] = in[i*4 + 3];
+ }
+
+ /* check results: */
+ for (i = 0; i < N*2; i++)
+ {
+ if (out[i*4] != in[i*4]
+ || out[i*4 + 1] != in[i*4 + 1]
+ || out[i*4 + 2] != in[i*4 + 2]
+ || out[i*4 + 3] != in[i*4 + 3])
+ abort ();
+ }
+
+ for (i = 0; i < N/2; i++)
+ {
+ out[i*16] = in[i*16];
+ out[i*16 + 1] = in[i*16 + 1];
+ out[i*16 + 2] = in[i*16 + 2];
+ out[i*16 + 3] = in[i*16 + 3];
+ out[i*16 + 4] = in[i*16 + 4];
+ out[i*16 + 5] = in[i*16 + 5];
+ out[i*16 + 6] = in[i*16 + 6];
+ out[i*16 + 7] = in[i*16 + 7];
+ out[i*16 + 8] = in[i*16 + 8];
+ out[i*16 + 9] = in[i*16 + 9];
+ out[i*16 + 10] = in[i*16 + 10];
+ out[i*16 + 11] = in[i*16 + 11];
+ out[i*16 + 12] = in[i*16 + 12];
+ out[i*16 + 13] = in[i*16 + 13];
+ out[i*16 + 14] = in[i*16 + 14];
+ out[i*16 + 15] = in[i*16 + 15];
+ }
+
+ /* check results: */
+ for (i = 0; i < N/2; i++)
+ {
+ if (out[i*16] != in[i*16]
+ || out[i*16 + 1] != in[i*16 + 1]
+ || out[i*16 + 2] != in[i*16 + 2]
+ || out[i*16 + 3] != in[i*16 + 3]
+ || out[i*16 + 4] != in[i*16 + 4]
+ || out[i*16 + 5] != in[i*16 + 5]
+ || out[i*16 + 6] != in[i*16 + 6]
+ || out[i*16 + 7] != in[i*16 + 7]
+ || out[i*16 + 8] != in[i*16 + 8]
+ || out[i*16 + 9] != in[i*16 + 9]
+ || out[i*16 + 10] != in[i*16 + 10]
+ || out[i*16 + 11] != in[i*16 + 11]
+ || out[i*16 + 12] != in[i*16 + 12]
+ || out[i*16 + 13] != in[i*16 + 13]
+ || out[i*16 + 14] != in[i*16 + 14]
+ || out[i*16 + 15] != in[i*16 + 15])
+ abort ();
+ }
+
+ /* SLP with unrolling by 8. */
+ for (i = 0; i < N/4; i++)
+ {
+ out[i*9] = in[i*9];
+ out[i*9 + 1] = in[i*9 + 1];
+ out[i*9 + 2] = in[i*9 + 2];
+ out[i*9 + 3] = in[i*9 + 3];
+ out[i*9 + 4] = in[i*9 + 4];
+ out[i*9 + 5] = in[i*9 + 5];
+ out[i*9 + 6] = in[i*9 + 6];
+ out[i*9 + 7] = in[i*9 + 7];
+ out[i*9 + 8] = in[i*9 + 8];
+ }
+
+ /* check results: */
+ for (i = 0; i < N/4; i++)
+ {
+ if (out[i*9] != in[i*9]
+ || out[i*9 + 1] != in[i*9 + 1]
+ || out[i*9 + 2] != in[i*9 + 2]
+ || out[i*9 + 3] != in[i*9 + 3]
+ || out[i*9 + 4] != in[i*9 + 4]
+ || out[i*9 + 5] != in[i*9 + 5]
+ || out[i*9 + 6] != in[i*9 + 6]
+ || out[i*9 + 7] != in[i*9 + 7]
+ || out[i*9 + 8] != in[i*9 + 8])
+ abort ();
+ }
+
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-3.c b/gcc/testsuite/gcc.dg/vect/slp-3.c
index 6c6a655b16f..7d9bd563739 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-3.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-3.c
@@ -3,10 +3,9 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 96
+#define N 12
-unsigned short in[N*8];
-volatile int y = 0;
+unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};
int
main1 ()
@@ -14,13 +13,6 @@ main1 ()
int i;
unsigned short out[N*8];
- for (i = 0; i < N*8; i++)
- {
- in[i] = i&63;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
for (i = 0; i < N; i++)
{
out[i*8] = in[i*8];
@@ -149,7 +141,7 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c
new file mode 100644
index 00000000000..53da79ee77f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-34-big-array.c
@@ -0,0 +1,69 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 64
+
+unsigned short in[N*8];
+unsigned short in2[N*8];
+volatile int y = 0;
+
+int
+main1 ()
+{
+ int i;
+ unsigned short out[N*8];
+ unsigned short out2[N*8];
+
+ for (i = 0; i < N*8; i++)
+ {
+ in[i] = in2[i] = i;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ /* SLP with unrolling by 8. */
+ for (i = 0; i < N; i++)
+ {
+ out[i*3] = in[i*3] + 5;
+ out[i*3 + 1] = in[i*3 + 1] + 6;
+ out[i*3 + 2] = in[i*3 + 2] + 16;
+
+ out2[i*5] = in2[i*5] + 2;
+ out2[i*5 + 1] = in2[i*5 + 1] + 2;
+ out2[i*5 + 2] = in2[i*5 + 2] + 1;
+ out2[i*5 + 3] = in2[i*5 + 3] + 3;
+ out2[i*5 + 4] = in2[i*5 + 4] + 13;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (out[i*3] != in[i*3] + 5
+ || out[i*3 + 1] != in[i*3 + 1] + 6
+ || out[i*3 + 2] != in[i*3 + 2] + 16
+ || out2[i*5] != in2[i*5] + 2
+ || out2[i*5 + 1] != in2[i*5 + 1] + 2
+ || out2[i*5 + 2] != in2[i*5 + 2] + 1
+ || out2[i*5 + 3] != in2[i*5 + 3] + 3
+ || out2[i*5 + 4] != in2[i*5 + 4] + 13)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-34.c b/gcc/testsuite/gcc.dg/vect/slp-34.c
index 39b28e5464d..63dbab05152 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-34.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-34.c
@@ -3,11 +3,10 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 64
+#define N 8
-unsigned short in[N*8];
-unsigned short in2[N*8];
-volatile int y = 0;
+unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
+unsigned short in2[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
int
main1 ()
@@ -16,13 +15,6 @@ main1 ()
unsigned short out[N*8];
unsigned short out2[N*8];
- for (i = 0; i < N*8; i++)
- {
- in[i] = in2[i] = i;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
/* SLP with unrolling by 8. */
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c
new file mode 100644
index 00000000000..55607dd2d94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-4-big-array.c
@@ -0,0 +1,135 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+volatile int y = 0;
+
+int
+main1 ()
+{
+ int i;
+ unsigned short out[N*8];
+ unsigned short in[N*8];
+ unsigned int ia[N*2];
+
+ for (i = 0; i < N*8; i++)
+ {
+ in[i] = i;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ out[i*8] = in[i*8];
+ out[i*8 + 1] = in[i*8 + 1];
+ out[i*8 + 2] = in[i*8 + 2];
+ out[i*8 + 3] = in[i*8 + 3];
+ out[i*8 + 4] = in[i*8 + 4];
+ out[i*8 + 5] = in[i*8 + 5];
+ out[i*8 + 6] = in[i*8 + 6];
+ out[i*8 + 7] = in[i*8 + 7];
+
+ ia[i] = 7;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (out[i*8] != in[i*8]
+ || out[i*8 + 1] != in[i*8 + 1]
+ || out[i*8 + 2] != in[i*8 + 2]
+ || out[i*8 + 3] != in[i*8 + 3]
+ || out[i*8 + 4] != in[i*8 + 4]
+ || out[i*8 + 5] != in[i*8 + 5]
+ || out[i*8 + 6] != in[i*8 + 6]
+ || out[i*8 + 7] != in[i*8 + 7]
+ || ia[i] != 7)
+ abort ();
+ }
+
+ for (i = 0; i < N*2; i++)
+ {
+ out[i*4] = in[i*4];
+ out[i*4 + 1] = in[i*4 + 1];
+ out[i*4 + 2] = in[i*4 + 2];
+ out[i*4 + 3] = in[i*4 + 3];
+
+ ia[i] = 12;
+ }
+
+ /* check results: */
+ for (i = 0; i < N*2; i++)
+ {
+ if (out[i*4] != in[i*4]
+ || out[i*4 + 1] != in[i*4 + 1]
+ || out[i*4 + 2] != in[i*4 + 2]
+ || out[i*4 + 3] != in[i*4 + 3]
+ || ia[i] != 12)
+ abort ();
+ }
+
+ for (i = 0; i < N/2; i++)
+ {
+ out[i*16] = in[i*16];
+ out[i*16 + 1] = in[i*16 + 1];
+ out[i*16 + 2] = in[i*16 + 2];
+ out[i*16 + 3] = in[i*16 + 3];
+ out[i*16 + 4] = in[i*16 + 4];
+ out[i*16 + 5] = in[i*16 + 5];
+ out[i*16 + 6] = in[i*16 + 6];
+ out[i*16 + 7] = in[i*16 + 7];
+ out[i*16 + 8] = in[i*16 + 8];
+ out[i*16 + 9] = in[i*16 + 9];
+ out[i*16 + 10] = in[i*16 + 10];
+ out[i*16 + 11] = in[i*16 + 11];
+ out[i*16 + 12] = in[i*16 + 12];
+ out[i*16 + 13] = in[i*16 + 13];
+ out[i*16 + 14] = in[i*16 + 14];
+ out[i*16 + 15] = in[i*16 + 15];
+
+ ia[i] = 21;
+ }
+
+ /* check results: */
+ for (i = 0; i < N/2; i++)
+ {
+ if (out[i*16] != in[i*16]
+ || out[i*16 + 1] != in[i*16 + 1]
+ || out[i*16 + 2] != in[i*16 + 2]
+ || out[i*16 + 3] != in[i*16 + 3]
+ || out[i*16 + 4] != in[i*16 + 4]
+ || out[i*16 + 5] != in[i*16 + 5]
+ || out[i*16 + 6] != in[i*16 + 6]
+ || out[i*16 + 7] != in[i*16 + 7]
+ || out[i*16 + 8] != in[i*16 + 8]
+ || out[i*16 + 9] != in[i*16 + 9]
+ || out[i*16 + 10] != in[i*16 + 10]
+ || out[i*16 + 11] != in[i*16 + 11]
+ || out[i*16 + 12] != in[i*16 + 12]
+ || out[i*16 + 13] != in[i*16 + 13]
+ || out[i*16 + 14] != in[i*16 + 14]
+ || out[i*16 + 15] != in[i*16 + 15]
+ || ia[i] != 21)
+ abort ();
+ }
+
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-4.c b/gcc/testsuite/gcc.dg/vect/slp-4.c
index 3622f9d249a..50ad2bd53a4 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-4.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-4.c
@@ -3,24 +3,16 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
-volatile int y = 0;
+#define N 16
int
main1 ()
{
int i;
unsigned short out[N*8];
- unsigned short in[N*8];
+ unsigned short in[N*8] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63};
unsigned int ia[N*2];
- for (i = 0; i < N*8; i++)
- {
- in[i] = i;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
for (i = 0; i < N; i++)
{
out[i*8] = in[i*8];
diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c
new file mode 100644
index 00000000000..8217b764af0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-cond-2-big-array.c
@@ -0,0 +1,127 @@
+/* { dg-require-effective-target vect_cond_mixed } */
+#include "tree-vect.h"
+
+#define N 128
+int d[N], e[N], f[N];
+unsigned char k[N];
+float a[N], b[N];
+
+__attribute__((noinline, noclone)) void
+f1 (void)
+{
+ int i;
+ for (i = 0; i < N/4; i++)
+ {
+ k[4*i] = a[4*i] < b[4*i] ? 17 : 0;
+ k[4*i+1] = a[4*i+1] < b[4*i+1] ? 17 : 0;
+ k[4*i+2] = a[4*i+2] < b[4*i+2] ? 17 : 0;
+ k[4*i+3] = a[4*i+3] < b[4*i+3] ? 17 : 0;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f2 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 0 : 24;
+ k[2*i+1] = a[2*i+1] < b[2*i+1] ? 7 : 4;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f3 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ k[2*i] = a[2*i] < b[2*i] ? 51 : 12;
+ k[2*i+1] = a[2*i+1] > b[2*i+1] ? 51 : 12;
+ }
+}
+
+__attribute__((noinline, noclone)) void
+f4 (void)
+{
+ int i;
+ for (i = 0; i < N/2; ++i)
+ {
+ int d0 = d[2*i], e0 = e[2*i];
+ int d1 = d[2*i+1], e1 = e[2*i+1];
+ f[2*i] = a[2*i] >= b[2*i] ? d0 : e0;
+ f[2*i+1] = a[2*i+1] >= b[2*i+1] ? d1 : e1;
+ }
+}
+
+int
+main ()
+{
+ int i;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break;
+ case 1: a[i] = 0; b[i] = 0; break;
+ case 2: a[i] = i + 1; b[i] = - i - 1; break;
+ case 3: a[i] = i; b[i] = i + 7; break;
+ case 4: a[i] = i; b[i] = i; break;
+ case 5: a[i] = i + 16; b[i] = i + 3; break;
+ case 6: a[i] = - i - 5; b[i] = - i; break;
+ case 7: a[i] = - i; b[i] = - i; break;
+ case 8: a[i] = - i; b[i] = - i - 7; break;
+ }
+ d[i] = i;
+ e[i] = 2 * i;
+ }
+
+ f1 ();
+ for (i = 0; i < N; i++)
+ if (k[i] != ((i % 3) == 0 ? 17 : 0))
+ abort ();
+
+ f2 ();
+ for (i = 0; i < N; i++)
+ {
+ switch (i % 9)
+ {
+ case 0:
+ case 6:
+ if (k[i] != ((i/9 % 2) == 0 ? 0 : 7))
+ abort ();
+ break;
+ case 1:
+ case 5:
+ case 7:
+ if (k[i] != ((i/9 % 2) == 0 ? 4 : 24))
+ abort ();
+ break;
+ case 2:
+ case 4:
+ case 8:
+ if (k[i] != ((i/9 % 2) == 0 ? 24 : 4))
+ abort ();
+ break;
+ case 3:
+ if (k[i] != ((i/9 % 2) == 0 ? 7 : 0))
+ abort ();
+ break;
+ }
+ }
+
+ f3 ();
+
+ f4 ();
+ for (i = 0; i < N; i++)
+ if (f[i] != ((i % 3) == 0 ? e[i] : d[i]))
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 3 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/slp-cond-2.c b/gcc/testsuite/gcc.dg/vect/slp-cond-2.c
index 8217b764af0..c73933fce0f 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-cond-2.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-cond-2.c
@@ -1,7 +1,7 @@
/* { dg-require-effective-target vect_cond_mixed } */
#include "tree-vect.h"
-#define N 128
+#define N 32
int d[N], e[N], f[N];
unsigned char k[N];
float a[N], b[N];
diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c
new file mode 100644
index 00000000000..b7a7a0be11b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11-big-array.c
@@ -0,0 +1,62 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 144
+
+struct s
+{
+ int a;
+ int b;
+ int c;
+};
+
+char in[N*3];
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
+ struct s out[N];
+
+ for (i = 0; i < N; i++)
+ {
+ in[i] = i&127;
+ if (y) /* Avoid vectorization. */
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ out[i].a = (int) in[i*3] + 1;
+ out[i].b = (int) in[i*3 + 1] + 2;
+ out[i].c = (int) in[i*3 + 2] + 3;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (out[i].a != (int) in[i*3] + 1
+ || out[i].b != (int) in[i*3 + 1] + 2
+ || out[i].c != (int) in[i*3 + 2] + 3)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target vect_unpack } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c
index 8ead45ee194..602517bfcd1 100644
--- a/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c
+++ b/gcc/testsuite/gcc.dg/vect/slp-multitypes-11.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 144
+#define N 18
struct s
{
@@ -12,8 +12,7 @@ struct s
int c;
};
-char in[N*3];
-volatile int y = 0;
+char in[N*3] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53};
__attribute__ ((noinline)) int
main1 ()
@@ -23,13 +22,6 @@ main1 ()
for (i = 0; i < N; i++)
{
- in[i] = i&127;
- if (y) /* Avoid vectorization. */
- abort ();
- }
-
- for (i = 0; i < N; i++)
- {
out[i].a = (int) in[i*3] + 1;
out[i].b = (int) in[i*3 + 1] + 2;
out[i].c = (int) in[i*3 + 2] + 3;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-1-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-1-big-array.c
new file mode 100644
index 00000000000..4c0f532b468
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-1-big-array.c
@@ -0,0 +1,90 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_float } */
+
+#define N 128
+
+void fbar (float *);
+void ibar (int *);
+void sbar (short *);
+
+/* multiple loops */
+
+foo (int n)
+{
+ float a[N+1];
+ float b[N];
+ float c[N];
+ float d[N];
+ int ia[N];
+ int ib[N];
+ int ic[N];
+ int i,j;
+ int diff = 0;
+ char cb[N];
+ char cc[N];
+ char image[N][N];
+ char block[N][N];
+
+ /* Vectorizable. */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ diff += (cb[i] - cc[i]);
+ }
+ ibar (&diff);
+
+
+ /* Vectorizable. */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ }
+ ibar (&diff);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i];
+ }
+ fbar (a);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i] + d[i];
+ }
+ fbar (a);
+
+
+ /* Strided access. Vectorizable on platforms that support load of strided
+ accesses (extract of even/odd vector elements). */
+ for (i = 0; i < N/2; i++){
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+ fbar (a);
+
+
+ /* Vectorizable. */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ d[i] = b[i] + c[i];
+ ia[i] = ib[i] + ic[i];
+ }
+ ibar (ia);
+ fbar (a);
+ fbar (d);
+
+ /* Not vetorizable yet (too conservative dependence test). */
+ for (i = 0; i < N; i++){
+ a[i] = b[i] + c[i];
+ a[i+1] = b[i] + c[i];
+ }
+ fbar (a);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 6 loops" 1 "vect" { target vect_strided2 } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 5 loops" 1 "vect" { xfail vect_strided2 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-1.c b/gcc/testsuite/gcc.dg/vect/vect-1.c
index 3fe51228531..04392ea78da 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-1.c
@@ -2,7 +2,7 @@
/* { dg-require-effective-target vect_int } */
/* { dg-require-effective-target vect_float } */
-#define N 128
+#define N 16
void fbar (float *);
void ibar (int *);
diff --git a/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c
new file mode 100644
index 00000000000..ce6161977ac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-10-big-array.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+#include <stdlib.h>
+
+#define N 128
+
+short a[N];
+short d[N];
+
+volatile int y = 0;
+
+int foo ()
+{
+ int i;
+ short b[N];
+ short c[N];
+ for (i = 0; i < N/2; i++)
+ {
+ b[i] = i*3;
+ c[i] = i;
+
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ /* Strided access pattern. */
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[2*i+1] * c[2*i+1] - b[2*i] * c[2*i];
+ d[i] = b[2*i] * c[2*i+1] + b[2*i+1] * c[2*i];
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { ! vect_strided2 } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-10.c b/gcc/testsuite/gcc.dg/vect/vect-10.c
index 393416eb38a..faa500d2a18 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-10.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-10.c
@@ -1,28 +1,16 @@
/* { dg-do compile } */
/* { dg-require-effective-target vect_int } */
-#include <stdlib.h>
-#define N 128
+#define N 16
short a[N];
short d[N];
-volatile int y = 0;
-
int foo ()
{
int i;
- short b[N];
- short c[N];
- for (i = 0; i < N/2; i++)
- {
- b[i] = i*3;
- c[i] = i;
-
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
+ short b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+ short c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
/* Strided access pattern. */
for (i = 0; i < N/2; i++)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c
new file mode 100644
index 00000000000..f99a2afd728
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-105-big-array.c
@@ -0,0 +1,106 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+
+struct extraction
+{
+ int a[N][N];
+ int b[N][N];
+};
+
+static int a[N][N];
+static int b[N][N];
+static int c[N][N];
+
+volatile int y;
+
+__attribute__ ((noinline))
+int main1 (int x) {
+ int i,j, off;
+ struct extraction *p;
+ p = (struct extraction *) malloc (sizeof (struct extraction));
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ a[i][j] = (i*7 + j*17)%53;
+ b[i][j] = (i*11+ j*13)%41;
+ if (y)
+ abort (); /* to avoid vectorization. */
+ }
+ }
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ c[i][j] = a[i][j];
+ if (y)
+ abort (); /* to avoid vectorization. */
+ }
+ }
+ for (i = 1; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ off = x + i + j + N+1;
+ if (x + i + j > N*N-1)
+ break;
+ if (off > N*N-1)
+ *(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
+ else
+ *(&c[0][0]+x+i+j) = *(&a[0][0] + off);
+ if (y)
+ abort (); /* to avoid vectorization. */
+ }
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ p->a[i][j] = a[i][j];
+ p->b[i][j] = b[i][j];
+ /* Because Y is volatile, the compiler cannot move this check out
+ of the loop. */
+ if (y)
+ abort (); /* to avoid vectorization. */
+ }
+ }
+
+ /* Vectorizable: distance > number of iterations. */
+ for (i = 1; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ *((int *)p + x + i + j) = *((int *)p + x + i + j + N+1);
+ }
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ if (p->a[i][j] != c[i][j])
+ abort ();
+ }
+ }
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (N);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-105.c b/gcc/testsuite/gcc.dg/vect/vect-105.c
index f2e68aeac41..bbf42af897f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-105.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-105.c
@@ -4,7 +4,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 16
+#define N 4
struct extraction
{
@@ -12,51 +12,17 @@ struct extraction
int b[N][N];
};
-static int a[N][N];
-static int b[N][N];
-static int c[N][N];
+static int a[N][N] = {{1,2,3,11},{4,5,6,12},{7,8,9,13},{34,45,67,83}};
+static int b[N][N] = {{17,28,15,23},{0,2,3,24},{4,31,82,25},{29,31,432,256}};
+static int c[N][N] = {{1,2,3,11},{4,9,13,34},{45,67,83,13},{34,45,67,83}};
volatile int y;
__attribute__ ((noinline))
int main1 (int x) {
- int i,j, off;
+ int i,j;
struct extraction *p;
p = (struct extraction *) malloc (sizeof (struct extraction));
- for (i = 0; i < N; i++)
- {
- for (j = 0; j < N; j++)
- {
- a[i][j] = (i*7 + j*17)%53;
- b[i][j] = (i*11+ j*13)%41;
- if (y)
- abort (); /* to avoid vectorization. */
- }
- }
- for (i = 0; i < N; i++)
- {
- for (j = 0; j < N; j++)
- {
- c[i][j] = a[i][j];
- if (y)
- abort (); /* to avoid vectorization. */
- }
- }
- for (i = 1; i < N; i++)
- {
- for (j = 0; j < N; j++)
- {
- off = x + i + j + N+1;
- if (x + i + j > N*N-1)
- break;
- if (off > N*N-1)
- *(&c[0][0]+x+i+j) = *(&b[0][0] + off - N*N);
- else
- *(&c[0][0]+x+i+j) = *(&a[0][0] + off);
- if (y)
- abort (); /* to avoid vectorization. */
- }
- }
for (i = 0; i < N; i++)
{
@@ -67,7 +33,7 @@ int main1 (int x) {
/* Because Y is volatile, the compiler cannot move this check out
of the loop. */
if (y)
- abort (); /* to avoid vectorization. */
+ abort (); /* to avoid vectorization */
}
}
@@ -76,7 +42,7 @@ int main1 (int x) {
{
for (j = 0; j < N; j++)
{
- *((int *)p + x + i + j) = *((int *)p + x + i + j + N+1);
+ *((int *)p + x + i + j) = *((int *)p + x + i + j + 5);
}
}
@@ -86,7 +52,7 @@ int main1 (int x) {
for (j = 0; j < N; j++)
{
if (p->a[i][j] != c[i][j])
- abort ();
+ abort();
}
}
return 0;
@@ -100,7 +66,7 @@ int main (void)
}
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
-/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { target vect_no_align } } } */
/* { dg-final { scan-tree-dump-times "possible dependence between data-refs" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c
new file mode 100644
index 00000000000..a1302c1e936
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-112-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+char cb[N];
+char cc[N];
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+main1 (void)
+{
+ int i;
+ int diff = 0;
+ int check_diff = 0;
+ for (i = 0; i < N; i++) {
+ cb[i] = i + 2;
+ cc[i] = i + 1;
+ check_diff += (cb[i] - cc[i]);
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ /* Cross-iteration cycle. */
+ diff = 0;
+ for (i = 0; i < N; i++) {
+ diff += (cb[i] - cc[i]);
+ }
+
+ /* Check results. */
+ if (diff != check_diff)
+ abort ();
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_unpack } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-112.c b/gcc/testsuite/gcc.dg/vect/vect-112.c
index a1302c1e936..4d954d10829 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-112.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-112.c
@@ -3,27 +3,16 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
-char cb[N];
-char cc[N];
-
-volatile int y = 0;
+char cb[N] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17};
+char cc[N] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
__attribute__ ((noinline)) int
main1 (void)
{
int i;
int diff = 0;
- int check_diff = 0;
- for (i = 0; i < N; i++) {
- cb[i] = i + 2;
- cc[i] = i + 1;
- check_diff += (cb[i] - cc[i]);
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
/* Cross-iteration cycle. */
diff = 0;
@@ -32,8 +21,8 @@ main1 (void)
}
/* Check results. */
- if (diff != check_diff)
- abort ();
+ if (diff != 16)
+ abort();
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c
new file mode 100644
index 00000000000..912907d8c82
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-15-big-array.c
@@ -0,0 +1,48 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+ int a[N];
+ int b[N];
+
+ for (i = 0; i <N; i++)
+ {
+ b[i] = i*3;
+ if (y)
+ abort ();
+ }
+
+ /* Not vectorizable yet (reverse access and forward access). */
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = b[i-1];
+ }
+
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != b[N-1-i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_perm && vect_hw_misalign } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-15.c b/gcc/testsuite/gcc.dg/vect/vect-15.c
index cbc11c20745..ba7599162db 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-15.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-15.c
@@ -3,23 +3,14 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
-
-volatile int y = 0;
+#define N 16
__attribute__ ((noinline))
int main1 ()
{
int i;
int a[N];
- int b[N];
-
- for (i = 0; i <N; i++)
- {
- b[i] = i*3;
- if (y)
- abort ();
- }
+ int b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
/* Not vectorizable yet (reverse access and forward access). */
for (i = N; i > 0; i--)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-2-big-array.c
new file mode 100644
index 00000000000..25502700452
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-2-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+char cb[N];
+char ca[N];
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ cb[i] = i*3;
+ /* To avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ca[i] != cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-2.c b/gcc/testsuite/gcc.dg/vect/vect-2.c
index e6399ff212f..5d4fc914a97 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-2.c
@@ -3,13 +3,11 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
-char cb[N];
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
-volatile int y = 0;
-
__attribute__ ((noinline))
int main1 ()
{
@@ -17,14 +15,6 @@ int main1 ()
for (i = 0; i < N; i++)
{
- cb[i] = i*3;
- /* To avoid vectorization. */
- if (y)
- abort ();
- }
-
- for (i = 0; i < N; i++)
- {
ca[i] = cb[i];
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-31-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-31-big-array.c
new file mode 100644
index 00000000000..25d7fdf2b7b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-31-big-array.c
@@ -0,0 +1,90 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 256
+
+struct t{
+ int k[N];
+ int l;
+};
+
+struct s{
+ char a; /* aligned */
+ char b[N-1]; /* unaligned (offset 1B) */
+ char c[N]; /* aligned (offset NB) */
+ struct t d; /* aligned (offset 2NB) */
+ struct t e; /* unaligned (offset 2N+4N+4 B) */
+};
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+ struct s tmp;
+
+ /* unaligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.b[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.b[i] != 5)
+ abort ();
+ }
+
+ /* aligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.c[i] = 6;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.c[i] != 6)
+ abort ();
+ }
+
+ /* aligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.d.k[i] = 7;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.d.k[i] != 7)
+ abort ();
+ }
+
+ /* unaligned */
+ for (i = 0; i < N/2; i++)
+ {
+ tmp.e.k[i] = 8;
+ }
+
+ /* check results: */
+ for (i = 0; i <N/2; i++)
+ {
+ if (tmp.e.k[i] != 8)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-31.c b/gcc/testsuite/gcc.dg/vect/vect-31.c
index c6861fab78b..8719fc9d27e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-31.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-31.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 256
+#define N 32
struct t{
int k[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-32-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-32-big-array.c
new file mode 100644
index 00000000000..774a0b05577
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-32-big-array.c
@@ -0,0 +1,40 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ struct {
+ char ca[N];
+ } s;
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-32.c b/gcc/testsuite/gcc.dg/vect/vect-32.c
index 143ebf52247..c869f5ec989 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-32.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-32.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
__attribute__ ((noinline))
int main1 ()
diff --git a/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c
new file mode 100644
index 00000000000..2fc7106b888
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-33-big-array.c
@@ -0,0 +1,44 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+struct test {
+ char ca[N];
+};
+
+extern struct test s;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vector_alignment_reachable } } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-33.c b/gcc/testsuite/gcc.dg/vect/vect-33.c
index 261d89af4f2..d35bce4d6f6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-33.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-33.c
@@ -4,7 +4,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
struct test {
char ca[N];
};
diff --git a/gcc/testsuite/gcc.dg/vect/vect-34-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-34-big-array.c
new file mode 100644
index 00000000000..9041bd6e194
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-34-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+struct {
+ char ca[N];
+} s;
+char cb[N];
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i = 0; i < N; i++)
+ {
+ cb[i] = i*3;
+ /* To avoid vectorization. */
+ if (y)
+ abort ();
+ }
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-34.c b/gcc/testsuite/gcc.dg/vect/vect-34.c
index 3f059c6b9d0..df18f774e5d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-34.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-34.c
@@ -3,15 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
struct {
char ca[N];
} s;
-char cb[N];
-
-volatile int y = 0;
-
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+
__attribute__ ((noinline))
int main1 ()
{
@@ -19,13 +17,6 @@ int main1 ()
for (i = 0; i < N; i++)
{
- cb[i] = i*3;
- /* To avoid vectorization. */
- if (y)
- abort ();
- }
- for (i = 0; i < N; i++)
- {
s.ca[i] = cb[i];
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-35-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-35-big-array.c
new file mode 100644
index 00000000000..73b18cf62d8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-35-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ union {
+ unsigned char a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ unsigned char b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+ } s;
+ int i;
+
+ /* Initialization. */
+ for (i = 0; i < N; i++)
+ {
+ s.b[i] = i;
+ }
+
+ /* Dependence analysis fails cause s.a and s.b may overlap.
+ Use runtime aliasing test with versioning. */
+ for (i = 0; i < N; i++)
+ {
+ s.a[i] = s.b[i] + 1;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.a[i] != i + 1)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail { ia64-*-* sparc*-*-* } } } } */
+/* { dg-final { scan-tree-dump-times "can't determine dependence between" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-35.c b/gcc/testsuite/gcc.dg/vect/vect-35.c
index 130e37647bf..0f4284a6257 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-35.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-35.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
__attribute__ ((noinline))
int main1 ()
diff --git a/gcc/testsuite/gcc.dg/vect/vect-36-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-36-big-array.c
new file mode 100644
index 00000000000..8f2514db234
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-36-big-array.c
@@ -0,0 +1,47 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+ struct {
+ char ca[N];
+ char cb[N];
+ } s;
+
+
+ for (i = 0; i < N; i++)
+ {
+ s.cb[i] = 3*i;
+ __asm__ volatile ("");
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ s.ca[i] = s.cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.ca[i] != s.cb[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-36.c b/gcc/testsuite/gcc.dg/vect/vect-36.c
index 34f0d5ab8ea..20df3940a48 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-36.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-36.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
__attribute__ ((noinline))
int main1 ()
diff --git a/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c
new file mode 100644
index 00000000000..14d3faa0a12
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c
@@ -0,0 +1,79 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+float results1[N];
+float results2[N];
+float a[N] = {0};
+float e[N] = {0};
+float b[N];
+float c[N];
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i;
+
+ for (i=0; i<N; i++)
+ {
+ b[i] = i*3;
+ c[i] = i;
+ results1[i] = 0;
+ results2[i] = 0;
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+ for (i=0; i<N/2; i++)
+ {
+ results1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ results2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+
+ /* check results: */
+ for (i=0; i<N; i++)
+ {
+ if (a[i] != results1[i] || e[i] != results2[i])
+ abort ();
+ }
+
+
+ for (i = 1; i <=N-4; i++)
+ {
+ a[i+3] = b[i-1];
+ }
+
+ /* check results: */
+ for (i = 1; i <=N-4; i++)
+ {
+ if (a[i+3] != b[i-1])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-6.c b/gcc/testsuite/gcc.dg/vect/vect-6.c
index 4dcb1bea0f1..5f2e0ea5936 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-6.c
@@ -3,41 +3,20 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
-float results1[N];
-float results2[N];
+float results1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,0.00};
+float results2[N] = {0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
float a[N] = {0};
float e[N] = {0};
-float b[N];
-float c[N];
-
-volatile int y = 0;
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline))
int main1 ()
{
int i;
- for (i=0; i<N; i++)
- {
- b[i] = i*3;
- c[i] = i;
- results1[i] = 0;
- results2[i] = 0;
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
- for (i=0; i<N/2; i++)
- {
- results1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
- results2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
-
for (i = 0; i < N/2; i++)
{
a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-73-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-73-big-array.c
new file mode 100644
index 00000000000..5f40055e2c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-73-big-array.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+int ic[N*2];
+int ib[N];
+
+#define ia (ic+N)
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i, j;
+
+ for (i = 0; i < N; i++)
+ {
+ ib[i] = i*3;
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-73.c b/gcc/testsuite/gcc.dg/vect/vect-73.c
index 19d8d24e0ac..ee3c6e60e15 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-73.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-73.c
@@ -3,15 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
int ic[N*2];
-int ib[N];
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
#define ia (ic+N)
-volatile int y = 0;
-
__attribute__ ((noinline))
int main1 ()
{
@@ -19,13 +17,6 @@ int main1 ()
for (i = 0; i < N; i++)
{
- ib[i] = i*3;
- if (y)
- abort ();
- }
-
- for (i = 0; i < N; i++)
- {
ia[i] = ib[i];
}
@@ -33,7 +24,7 @@ int main1 ()
for (i = 0; i < N; i++)
{
if (ia[i] != ib[i])
- abort ();
+ abort();
}
return 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-74-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-74-big-array.c
new file mode 100644
index 00000000000..5cd926fe0ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-74-big-array.c
@@ -0,0 +1,68 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
+float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
+{
+ int i;
+ float *q = pb + 4;
+
+ for (i = 0; i < N; i++)
+ {
+ b[i] = i;
+ c[i] = 0.5 + i;
+ if (y)
+ abort ();
+ }
+ for (; i < N+4; i++)
+ {
+ b[i] = i;
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ pa[i] = q[i] * pc[i];
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ if (pa[i] != q[i] * pc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (a, b, c);
+
+ return 0;
+}
+
+/* Xfail until handling restrict is refined. See pr29145. */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* Uncomment when this testcase gets vectorized again:
+ dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } }
+ dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
+*/
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-74.c b/gcc/testsuite/gcc.dg/vect/vect-74.c
index f8e973ef358..a680b9fb01b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-74.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-74.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
@@ -13,8 +13,6 @@ float a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float b[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
float c[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
-volatile int y = 0;
-
__attribute__ ((noinline)) int
main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc)
{
@@ -23,27 +21,13 @@ main1 (float *__restrict__ pa, float * __restrict__ pb, float * __restrict__ pc
for (i = 0; i < N; i++)
{
- b[i] = i;
- c[i] = 0.5 + i;
- if (y)
- abort ();
- }
- for (; i < N+4; i++)
- {
- b[i] = i;
- if (y)
- abort ();
- }
-
- for (i = 0; i < N; i++)
- {
pa[i] = q[i] * pc[i];
}
for (i = 0; i < N; i++)
{
if (pa[i] != q[i] * pc[i])
- abort ();
+ abort();
}
return 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-75-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
new file mode 100644
index 00000000000..1c70cc2c518
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-75-big-array.c
@@ -0,0 +1,57 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 120
+#define OFF 8
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 (int *ib)
+{
+ int i;
+ int ia[N];
+
+ for (i = OFF; i < N+OFF; i++)
+ {
+ ib[i] = ib[i%OFF]*(i/OFF);
+ if (y)
+ abort ();
+ }
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i+OFF];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i+OFF])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (ib);
+ return 0;
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail vect_no_align } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-75.c b/gcc/testsuite/gcc.dg/vect/vect-75.c
index 1c70cc2c518..092a3013e07 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-75.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-75.c
@@ -3,16 +3,14 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 120
+#define N 8
#define OFF 8
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
-
-volatile int y = 0;
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10, 14, 22, 26, 34};
__attribute__ ((noinline))
int main1 (int *ib)
@@ -20,12 +18,6 @@ int main1 (int *ib)
int i;
int ia[N];
- for (i = OFF; i < N+OFF; i++)
- {
- ib[i] = ib[i%OFF]*(i/OFF);
- if (y)
- abort ();
- }
for (i = 0; i < N; i++)
{
ia[i] = ib[i+OFF];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-76-big-array.c
new file mode 100644
index 00000000000..915f10edbf4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-76-big-array.c
@@ -0,0 +1,83 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 124
+#define OFF 4
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
+int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17};
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 (int *pib)
+{
+ int i;
+ int ia[N+OFF];
+ for (i = OFF; i < N+OFF; i++)
+ {
+ ib[i] = ib[i%8]*(i/8);
+ ic[i] = ic[i%8]*(i/8);
+ if (y)
+ abort ();
+ }
+
+ for (i = OFF; i < N; i++)
+ {
+ ia[i] = pib[i - OFF];
+ }
+
+
+ /* check results: */
+ for (i = OFF; i < N; i++)
+ {
+ if (ia[i] != pib[i - OFF])
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = pib[i - OFF];
+ }
+
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != pib[i - OFF])
+ abort ();
+ }
+
+ for (i = OFF; i < N; i++)
+ {
+ ia[i] = ic[i - OFF];
+ }
+
+
+ /* check results: */
+ for (i = OFF; i < N; i++)
+ {
+ if (ia[i] != ic[i - OFF])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (&ib[OFF]);
+ return 0;
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c
index edb0790e5a4..d7713024224 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-76.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-76.c
@@ -3,30 +3,21 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 124
+#define N 24
#define OFF 4
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17};
-int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17};
-
-volatile int y = 0;
+int ib[N+OFF] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
+int ic[N+OFF] = {0, 1, 3, 5, 7, 11, 13, 17, 0, 2, 6, 10};
__attribute__ ((noinline))
int main1 (int *pib)
{
int i;
int ia[N+OFF];
- for (i = OFF; i < N+OFF; i++)
- {
- ib[i] = ib[i%8]*(i/8);
- ic[i] = ic[i%8]*(i/8);
- if (y)
- abort ();
- }
for (i = OFF; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-80-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-80-big-array.c
new file mode 100644
index 00000000000..611d8260d4d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-80-big-array.c
@@ -0,0 +1,71 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+/* Check handling of accesses for which the "initial condition" -
+ the expression that represents the first location accessed - is
+ more involved than just an ssa_name. */
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+main1 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc)
+{
+ int i;
+ float *q = pb + 4;
+ for (i = 0; i < N; i++)
+ {
+ fb[i] = i;
+ fc[i] = 0.5+i;
+ if (y)
+ abort ();
+ }
+ for (; i < N+4; i++)
+ {
+ fb[i] = i;
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ pa[i] = q[i] * pc[i];
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ if (pa[i] != q[i] * pc[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (fa, fb, fc);
+
+ return 0;
+}
+
+/* For targets that don't support misaligned loads we version for the
+ all three accesses (peeling to align the store will not force the
+ two loads to be aligned). */
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* Uncomment when this testcase gets vectorized again:
+ dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } }
+ dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" { target vect_no_align } }
+*/
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-80.c b/gcc/testsuite/gcc.dg/vect/vect-80.c
index f5cdbb2fd30..fc0ed1b3938 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-80.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-80.c
@@ -3,36 +3,21 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
float fa[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
-float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
-float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float fb[N+4] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 7.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0};
+float fc[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 7.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5};
/* Check handling of accesses for which the "initial condition" -
the expression that represents the first location accessed - is
more involved than just an ssa_name. */
-volatile int y = 0;
-
__attribute__ ((noinline)) int
main1 (float * __restrict__ pa, float * __restrict__ pb, float *__restrict__ pc)
{
int i;
float *q = pb + 4;
- for (i = 0; i < N; i++)
- {
- fb[i] = i;
- fc[i] = 0.5+i;
- if (y)
- abort ();
- }
- for (; i < N+4; i++)
- {
- fb[i] = i;
- if (y)
- abort ();
- }
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-85-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-85-big-array.c
new file mode 100644
index 00000000000..004114fbb66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-85-big-array.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline))
+int main1 (int *a)
+{
+ int i, j, k;
+ int b[N];
+
+ for (i = 0; i < N; i++)
+ {
+ for (j = 0; j < N; j++)
+ {
+ k = i + N;
+ a[j] = k;
+ }
+ b[i] = k;
+ }
+
+
+ for (j = 0; j < N; j++)
+ if (a[j] != i + N - 1)
+ abort ();
+
+ for (j = 0; j < N; j++)
+ if (b[j] != j + N)
+ abort ();
+
+ return 0;
+}
+
+int main (void)
+{
+ int a[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+ check_vect ();
+
+ main1 (a);
+
+ return 0;
+}
+
+/* Fails for targets that don't vectorize PLUS (e.g alpha). */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-85.c b/gcc/testsuite/gcc.dg/vect/vect-85.c
index 136ff4a800a..a5bf5db078a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-85.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-85.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
__attribute__ ((noinline))
int main1 (int *a)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
new file mode 100644
index 00000000000..89286635cee
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-89-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+struct tmp_struct
+{
+ int x;
+ int y[N];
+};
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ int i, *q;
+ struct tmp_struct tmp, *p;
+
+ p = &tmp;
+ q = p->y;
+
+ for (i = 0; i < N; i++)
+ {
+ *q++ = 5;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (p->y[i] != 5)
+ {
+ abort ();
+ }
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-89.c b/gcc/testsuite/gcc.dg/vect/vect-89.c
index d621785e38a..131efeab53a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-89.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-89.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
struct tmp_struct
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-97-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-97-big-array.c
new file mode 100644
index 00000000000..87bacbf726b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-97-big-array.c
@@ -0,0 +1,73 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 ()
+{
+ struct {
+ char *p;
+ char *q;
+ } s;
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ cb[i] = i*3;
+ if (y)
+ abort ();
+ }
+
+ /* Check that datarefs analysis can determine that the access via pointer
+ s.p is based off array x, which enables us to antialias this access from
+ the access to array cb. */
+ s.p = x;
+ for (i = 0; i < N; i++)
+ {
+ s.p[i] = cb[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.p[i] != cb[i])
+ abort ();
+ }
+
+ /* Check that datarefs analysis can determine that the access via pointer
+ s.p is based off array x, and that the access via pointer s.q is based off
+ array cb, which enables us to antialias these two accesses. */
+ s.q = cb;
+ for (i = 0; i < N; i++)
+ {
+ s.p[i] = s.q[i];
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (s.p[i] != s.q[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+
+/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-97.c b/gcc/testsuite/gcc.dg/vect/vect-97.c
index f8bf4c32142..6ea26149095 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-97.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-97.c
@@ -3,12 +3,10 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
char x[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
-char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
-
-volatile int y = 0;
+char cb[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
__attribute__ ((noinline))
int main1 ()
@@ -18,12 +16,6 @@ int main1 ()
char *q;
} s;
int i;
- for (i = 0; i < N; i++)
- {
- cb[i] = i*3;
- if (y)
- abort ();
- }
/* Check that datarefs analysis can determine that the access via pointer
s.p is based off array x, which enables us to antialias this access from
diff --git a/gcc/testsuite/gcc.dg/vect/vect-98-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-98-big-array.c
new file mode 100644
index 00000000000..0528d43b807
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-98-big-array.c
@@ -0,0 +1,57 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 16
+#define DOT16( a, b) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + \
+ a[4]*b[4] + a[5]*b[5] + a[6]*b[6] + a[7]*b[7] + \
+ a[8]*b[8] + a[9]*b[9] + a[10]*b[10] + a[11]*b[11] + \
+ a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15])
+
+volatile int y = 0;
+
+__attribute__ ((noinline))
+int main1 (int ia[][N])
+{
+ int i, j;
+ int ib[N] = {0,3,6,9};
+ int ic[N][N];
+
+ for (i = 0; i < N; i++)
+ {
+ ic[0][i] = DOT16 (ia[i], ib);
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ic[0][i] != DOT16 (ia[i], ib))
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ int ia[N][N];
+ int i,j;
+ for (i = 0; i < N; i++)
+ for (j = 0; j < N; j++)
+ {
+ ia[i][j] = i + j + 1;
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ check_vect ();
+
+ return main1 (ia);
+}
+
+/* Needs interleaving support. */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided4 } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { xfail vect_strided4 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-98.c b/gcc/testsuite/gcc.dg/vect/vect-98.c
index 987c93bf178..01c9153878f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-98.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-98.c
@@ -3,13 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 16
-#define DOT16( a, b) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + \
- a[4]*b[4] + a[5]*b[5] + a[6]*b[6] + a[7]*b[7] + \
- a[8]*b[8] + a[9]*b[9] + a[10]*b[10] + a[11]*b[11] + \
- a[12]*b[12] + a[13]*b[13] + a[14]*b[14] + a[15]*b[15])
-
-volatile int y = 0;
+#define N 4
+#define DOT4( a, b ) ( a[0]*b[0] + a[1]*b[1] + a[2]*b[2] + a[3]*b[3] )
__attribute__ ((noinline))
int main1 (int ia[][N])
@@ -20,14 +15,14 @@ int main1 (int ia[][N])
for (i = 0; i < N; i++)
{
- ic[0][i] = DOT16 (ia[i], ib);
+ ic[0][i] = DOT4 (ia[i], ib);
}
/* check results: */
for (i = 0; i < N; i++)
{
- if (ic[0][i] != DOT16 (ia[i], ib))
- abort ();
+ if (ic[0][i] != DOT4 (ia[i], ib))
+ abort();
}
return 0;
@@ -35,16 +30,7 @@ int main1 (int ia[][N])
int main (void)
{
- int ia[N][N];
- int i,j;
- for (i = 0; i < N; i++)
- for (j = 0; j < N; j++)
- {
- ia[i][j] = i + j + 1;
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
+ int ia[N][N] = {{1,2,3,4},{2,3,5,7},{2,4,6,8},{22,43,55,77}};
check_vect ();
diff --git a/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c
new file mode 100644
index 00000000000..ef5213a3685
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c
@@ -0,0 +1,254 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+int iadd_results[N];
+float fadd_results[N];
+float fmul_results[N];
+float fresults1[N];
+float fresults2[N];
+
+/****************************************************/
+__attribute__ ((noinline))
+void icheck_results (int *a, int *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+__attribute__ ((noinline))
+void fcheck_results (float *a, float *results)
+{
+ int i;
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != results[i])
+ abort ();
+ }
+}
+
+__attribute__ ((noinline)) void
+fbar_mul (float *a)
+{
+ fcheck_results (a, fmul_results);
+}
+
+__attribute__ ((noinline)) void
+fbar_add (float *a)
+{
+ fcheck_results (a, fadd_results);
+}
+
+__attribute__ ((noinline)) void
+ibar_add (int *a)
+{
+ icheck_results (a, iadd_results);
+}
+
+__attribute__ ((noinline)) void
+fbar1 (float *a)
+{
+ fcheck_results (a, fresults1);
+}
+
+__attribute__ ((noinline)) void
+fbar2 (float *a)
+{
+ fcheck_results (a, fresults2);
+}
+
+float a[N];
+float e[N];
+float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+float c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+float d[N] = {0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30};
+int ic[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+int ia[N];
+char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+char ca[N];
+short sa[N];
+
+volatile int y = 0;
+
+/* All of the loops below are currently vectorizable, except
+ initialization ones. */
+
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i,j;
+ /* Initialization. */
+ for (i = 0; i < N; i++)
+ {
+ b[i] = i*3;
+ c[i] = i;
+ d[i] = i*2;
+ ic[i] = i*3;
+ ib[i] = i*3;
+ cb[i] = i*3;
+ fadd_results[i] = b[i] + c[i] + d[i];
+ iadd_results[i] = ib[i] + ic[i];
+ fmul_results[i] = b[i] * c[i];
+ fresults1[i] = 0;
+ fresults2[i] = 0;
+ if (y)
+ abort ();
+ }
+
+ /* Test 1: copy chars. */
+ for (i = 0; i < N; i++)
+ {
+ ca[i] = cb[i];
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ca[i] != cb[i])
+ abort ();
+ }
+
+
+ /* Test 2: fp mult. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] * c[i];
+ }
+ fbar_mul (a);
+
+
+ /* Test 3: mixed types (int, fp), same nunits in vector. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = b[i] + c[i] + d[i];
+ e[i] = b[i] + c[i] + d[i];
+ ia[i] = ib[i] + ic[i];
+ }
+ ibar_add (ia);
+ fbar_add (a);
+ fbar_add (e);
+
+ /* Initialization. */
+ for (i = 0; i < N; i++)
+ {
+ fresults1[i] = a[i];
+ fresults2[i] = e[i];
+ if (y)
+ abort ();
+ }
+ for (i = 0; i < N/2; i++)
+ {
+ fresults1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ fresults2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ if (y)
+ abort ();
+ }
+ /* Test 4: access with offset. */
+ for (i = 0; i < N/2; i++)
+ {
+ a[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
+ e[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
+ }
+ fbar1 (a);
+ fbar2 (e);
+
+
+ /* Test 5: access with offset. */
+ for (i = 1; i <=N-4; i++)
+ {
+ a[i+3] = b[i-1];
+ }
+ /* check results: */
+ for (i = 1; i <=N-4; i++)
+ {
+ if (a[i+3] != b[i-1])
+ abort ();
+ }
+
+
+ /* Test 6 - loop induction with stride != 1. */
+ i = 0;
+ j = 0;
+ while (i < 5*N)
+ {
+ a[j] = c[j];
+ i += 5;
+ j++;
+ }
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != c[i])
+ abort ();
+ }
+
+
+ /* Test 7 - reverse access. */
+ for (i = N; i > 0; i--)
+ {
+ a[N-i] = d[N-i];
+ }
+ /* check results: */
+ for (i = 0; i <N; i++)
+ {
+ if (a[i] != d[i])
+ abort ();
+ }
+
+
+ /* Tests 8,9,10 - constants. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = 5.0;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != 5.0)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ sa[i] = 5;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (sa[i] != 5)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ ia[i] = ib[i] + 5;
+ }
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (ia[i] != ib[i] + 5)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 ();
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-all.c b/gcc/testsuite/gcc.dg/vect/vect-all.c
index 79ad5997b19..6adb7bf88bd 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-all.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-all.c
@@ -4,13 +4,13 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
-int iadd_results[N];
-float fadd_results[N];
-float fmul_results[N];
-float fresults1[N];
-float fresults2[N];
+int iadd_results[N] = {0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90};
+float fadd_results[N] = {0.0,6.0,12.0,18.0,24.0,30.0,36.0,42.0,48.0,54.0,60.0,66.0,72.0,78.0,84.0,90.0};
+float fmul_results[N] = {0.0,3.0,12.0,27.0,48.0,75.0,108.0,147.0,192.0,243.0,300.0,363.0,432.0,507.0,588.0,675.0};
+float fresults1[N] = {192.00,240.00,288.00,336.00,384.00,432.00,480.00,528.00,48.00,54.00,60.00,66.00,72.00,78.00,84.00,90.00};
+float fresults2[N] = {0.00,6.00,12.00,18.00,24.00,30.00,36.00,42.00,0.00,54.00,120.00,198.00,288.00,390.00,504.00,630.00};
/****************************************************/
__attribute__ ((noinline))
@@ -77,32 +77,12 @@ char cb[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
char ca[N];
short sa[N];
-volatile int y = 0;
-
-/* All of the loops below are currently vectorizable, except
- initialization ones. */
+/* All of the loops below are currently vectorizable. */
__attribute__ ((noinline)) int
main1 ()
{
int i,j;
- /* Initialization. */
- for (i = 0; i < N; i++)
- {
- b[i] = i*3;
- c[i] = i;
- d[i] = i*2;
- ic[i] = i*3;
- ib[i] = i*3;
- cb[i] = i*3;
- fadd_results[i] = b[i] + c[i] + d[i];
- iadd_results[i] = ib[i] + ic[i];
- fmul_results[i] = b[i] * c[i];
- fresults1[i] = 0;
- fresults2[i] = 0;
- if (y)
- abort ();
- }
/* Test 1: copy chars. */
for (i = 0; i < N; i++)
@@ -136,21 +116,7 @@ main1 ()
fbar_add (a);
fbar_add (e);
- /* Initialization. */
- for (i = 0; i < N; i++)
- {
- fresults1[i] = a[i];
- fresults2[i] = e[i];
- if (y)
- abort ();
- }
- for (i = 0; i < N/2; i++)
- {
- fresults1[i] = b[i+N/2] * c[i+N/2] - b[i] * c[i];
- fresults2[i+N/2] = b[i] * c[i+N/2] + b[i+N/2] * c[i];
- if (y)
- abort ();
- }
+
/* Test 4: access with offset. */
for (i = 0; i < N/2; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c
new file mode 100644
index 00000000000..abf3f7db6d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6-big-array.c
@@ -0,0 +1,65 @@
+/* { dg-require-effective-target vect_int_mult } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define K 16
+
+int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+int out[K];
+int check_result[K];
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) void
+foo ()
+{
+ int sum;
+ int i, j, k;
+
+ for (k = 0; k < K; k++)
+ {
+ sum = 1;
+ for (j = 0; j < K; j++)
+ for (i = 0; i < K; i++)
+ {
+ sum *= in[i+k][j];
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+ check_result[k] = sum;
+ }
+
+ for (k = 0; k < K; k++)
+ {
+ sum = 1;
+ for (j = 0; j < K; j++)
+ for (i = 0; i < K; i++)
+ sum *= in[i+k][j];
+ out[k] = sum;
+ }
+}
+
+int main ()
+{
+ int i, j, k;
+
+ check_vect ();
+
+ for (i = 0; i < 2*K; i++)
+ for (j = 0; j < K; j++)
+ in[i][j] = (i+2)/3;
+
+ foo ();
+
+ for (k = 0; k < K; k++)
+ if (out[k] != check_result[k])
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c b/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c
index 0b49ab77298..6b14e3bf590 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-double-reduc-6.c
@@ -3,15 +3,13 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define K 16
+#define K 4
int in[2*K][K] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
int out[K];
-int check_result[K];
+int check_result[K] = {0,16,256,4096};
-volatile int y = 0;
-
-__attribute__ ((noinline)) void
+__attribute__ ((noinline)) void
foo ()
{
int sum;
@@ -20,21 +18,7 @@ foo ()
for (k = 0; k < K; k++)
{
sum = 1;
- for (j = 0; j < K; j++)
- for (i = 0; i < K; i++)
- {
- sum *= in[i+k][j];
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
- check_result[k] = sum;
- }
-
- for (k = 0; k < K; k++)
- {
- sum = 1;
- for (j = 0; j < K; j++)
+ for (j = 0; j < K; j++)
for (i = 0; i < K; i++)
sum *= in[i+k][j];
out[k] = sum;
@@ -59,7 +43,7 @@ int main ()
return 0;
}
-
+
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
-
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-iv-8-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-iv-8-big-array.c
new file mode 100644
index 00000000000..677b7a3534b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-iv-8-big-array.c
@@ -0,0 +1,43 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline)) int main1 (short X)
+{
+ unsigned char a[N];
+ unsigned short b[N];
+ unsigned int c[N];
+ short myX = X;
+ int i;
+
+ /* vectorization of induction with type conversions. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = (unsigned char)X;
+ b[i] = X;
+ c[i] = (unsigned int)X;
+ X++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != (unsigned char)myX || b[i] != myX || c[i] != (unsigned int)myX++)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (3);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_pack_trunc && vect_unpack } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-iv-8.c b/gcc/testsuite/gcc.dg/vect/vect-iv-8.c
index 4150ee28216..6544988b247 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-iv-8.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-iv-8.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 26
__attribute__ ((noinline)) int main1 (short X)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-iv-8a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-iv-8a-big-array.c
new file mode 100644
index 00000000000..100c7513c40
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-iv-8a-big-array.c
@@ -0,0 +1,43 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+__attribute__ ((noinline)) int main1 (short X)
+{
+ signed char a[N];
+ short b[N];
+ int c[N];
+ short myX = X;
+ int i;
+
+ /* vectorization of induction with type conversions. */
+ for (i = 0; i < N; i++)
+ {
+ a[i] = (signed char)X;
+ b[i] = X;
+ c[i] = (int)X;
+ X++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (a[i] != (signed char)myX || b[i] != myX || c[i] != (int)myX++)
+ abort ();
+ }
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ return main1 (3);
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_pack_trunc && vect_unpack } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-iv-8a.c b/gcc/testsuite/gcc.dg/vect/vect-iv-8a.c
index 3492030d227..dc742eb84fb 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-iv-8a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-iv-8a.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 26
__attribute__ ((noinline)) int main1 (short X)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1-big-array.c
new file mode 100644
index 00000000000..804c3867bd0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1-big-array.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+#define N 256
+signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short out[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+/* Can't do outer-loop vectorization because of non-consecutive access. */
+
+void
+foo (){
+ int i,j;
+ int diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j+=8) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ out[i]=diff;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 1 "vect" { xfail vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
index e8094db4112..2ce8f8ebac8 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-#define N 256
+#define N 64
signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short out[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1a-big-array.c
new file mode 100644
index 00000000000..9b418fabaa9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1a-big-array.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+#define N 256
+signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+/* Can't do outer-loop vectorization because of non-consecutive access. */
+
+int
+foo (){
+ int i,j;
+ int diff = 0;
+
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j+=8) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ }
+ return diff;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 1 "vect" { xfail vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
index 9b418fabaa9..a9b786e235c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1a.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-#define N 256
+#define N 64
signed short image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
signed short block[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1b-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1b-big-array.c
new file mode 100644
index 00000000000..48b7180784e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1b-big-array.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+#define N 160
+signed short image[N][N];
+signed short block[N][N];
+signed short out[N];
+
+/* Outer-loop cannot get vectorized because of non-consecutive access. */
+
+void
+foo (){
+ int i,j;
+ int diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j+=4) {
+ diff += (image[i][j] - block[i][j]);
+ }
+ out[i]=diff;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 1 "vect" { xfail vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "strided access in outer loop" 2 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-1b.c b/gcc/testsuite/gcc.dg/vect/vect-outer-1b.c
index 48b7180784e..815758c766f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-1b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-1b.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
-#define N 160
+#define N 40
signed short image[N][N];
signed short block[N][N];
signed short out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2-big-array.c
new file mode 100644
index 00000000000..ba3fa87b151
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2-big-array.c
@@ -0,0 +1,41 @@
+/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_intfloat_cvt } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 160
+float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float out[N];
+
+/* Outer-loop vectorization. */
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j;
+
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ image[j][i] = j+i;
+ }
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+
+ foo ();
+
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ if (image[j][i] != j+i)
+ abort ();
+ }
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
index ba3fa87b151..38701977bc6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 160
+#define N 40
float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2a-big-array.c
new file mode 100644
index 00000000000..062e1fdd451
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2a-big-array.c
@@ -0,0 +1,42 @@
+/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_intfloat_cvt } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 160
+float image[N][N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j,k;
+
+ for (k=0; k<N; k++) {
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ image[k][j][i] = j+i+k;
+ }
+ }
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j, k;
+
+ foo ();
+
+ for (k=0; k<N; k++) {
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ if (image[k][j][i] != j+i+k)
+ abort ();
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
index 062e1fdd451..b8d0e51fee5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2a.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 160
+#define N 40
float image[N][N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2c-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2c-big-array.c
new file mode 100644
index 00000000000..cdea72aabe2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2c-big-array.c
@@ -0,0 +1,42 @@
+/* { dg-require-effective-target vect_float } */
+/* { dg-require-effective-target vect_intfloat_cvt } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 160
+float image[2*N][2*N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j,k;
+
+ for (k=0; k<N; k++) {
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j+=2) {
+ image[k][j][i] = j+i+k;
+ }
+ }
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j, k;
+
+ foo ();
+
+ for (k=0; k<N; k++) {
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j+=2) {
+ if (image[k][j][i] != j+i+k)
+ abort ();
+ }
+ }
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c b/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
index cdea72aabe2..0ca868637ad 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-2c.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 160
+#define N 40
float image[2*N][2*N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
__attribute__ ((noinline)) void
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3-big-array.c
new file mode 100644
index 00000000000..83b6f994cd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3-big-array.c
@@ -0,0 +1,52 @@
+/* { dg-require-effective-target vect_float } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 320
+float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float out[N];
+
+/* Outer-loop vectoriation. */
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j++) {
+ diff += image[j][i];
+ }
+ out[i]=diff;
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ image[i][j]=i+j;
+ }
+ }
+
+ foo ();
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j++) {
+ diff += image[j][i];
+ }
+ if (out[i] != diff)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
index 83b6f994cd7..924700c5840 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 320
+#define N 40
float image[N][N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
new file mode 100644
index 00000000000..9768a1ed577
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c
@@ -0,0 +1,54 @@
+/* { dg-require-effective-target vect_float } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 320
+float image[N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
+float out[N];
+
+/* Outer-loop vectorization with misaliged accesses in the inner-loop. */
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j++) {
+ diff += image[j][i];
+ }
+ out[i]=diff;
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ for (j = 0; j < N; j++) {
+ image[i][j]=i+j;
+ }
+ }
+
+ foo ();
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < N; j++) {
+ diff += image[j][i];
+ }
+ if (out[i] != diff)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 2 "vect" { xfail vect_multiple_sizes } } } */
+/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 3 "vect" { target vect_multiple_sizes } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
index 9768a1ed577..1759ee38db7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-3a.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 320
+#define N 40
float image[N][N+1] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4a-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4a-big-array.c
new file mode 100644
index 00000000000..af9d2a88b29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4a-big-array.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+#define N 512
+#define M 1024
+signed short in[N+M];
+signed short coeff[M];
+signed short out[N];
+
+/* Outer-loop vectorization. */
+
+void
+foo (){
+ int i,j;
+ int diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i]*coeff[j];
+ }
+ out[i]=diff;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_widen_mult_hi_to_si && vect_pack_trunc } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
index 3981b94e656..d7bcc9a2e8c 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4a.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
-#define N 512
-#define M 1024
+#define N 40
+#define M 128
signed short in[N+M];
signed short coeff[M];
signed short out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4b-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4b-big-array.c
new file mode 100644
index 00000000000..703ac94835a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4b-big-array.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+#define N 320
+#define M 1024
+signed short in[N+M];
+signed short coeff[M];
+int out[N];
+
+/* Outer-loop vectorization. */
+
+void
+foo (){
+ int i,j;
+ int diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i]*coeff[j];
+ }
+ out[i]=diff;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target vect_widen_mult_hi_to_si } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
index a9035454729..407315a8dc3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4b.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
-#define N 320
-#define M 1024
+#define N 40
+#define M 128
signed short in[N+M];
signed short coeff[M];
int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4c-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4c-big-array.c
new file mode 100644
index 00000000000..2ce242cb96b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4c-big-array.c
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+#define N 320
+#define M 1024
+unsigned short in[N+M];
+unsigned short coeff[M];
+unsigned int out[N];
+
+/* Outer-loop vectorization. */
+
+void
+foo (){
+ int i,j;
+ unsigned short diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i]*coeff[j];
+ }
+ out[i]=diff;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_short_mult && { ! vect_no_align } } } } } */
+/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c
index 4b6ffbf10ec..3342b79b215 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c
@@ -1,7 +1,7 @@
/* { dg-do compile } */
-#define N 320
-#define M 1024
+#define N 40
+#define M 128
unsigned short in[N+M];
unsigned short coeff[M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4d-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4d-big-array.c
new file mode 100644
index 00000000000..0d85bed6059
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4d-big-array.c
@@ -0,0 +1,51 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 320
+#define M 1024
+float in[N+M];
+float out[N];
+
+/* Outer-loop vectorization. */
+
+__attribute__ ((noinline)) void
+foo (){
+ int i,j;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=4) {
+ diff += in[j+i];
+ }
+ out[i]=diff;
+ }
+}
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+ float diff;
+
+ for (i = 0; i < N; i++)
+ in[i] = i;
+
+ foo ();
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=4) {
+ diff += in[j+i];
+ }
+ if (out[i] != diff)
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4d.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4d.c
index e70be3248c0..c344fb1d67b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4d.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4d.c
@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 320
-#define M 1024
+#define N 40
+#define M 128
float in[N+M];
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4m-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4m-big-array.c
new file mode 100644
index 00000000000..9a1e02e0356
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4m-big-array.c
@@ -0,0 +1,58 @@
+/* { dg-require-effective-target vect_int } */
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 320
+#define M 1024
+unsigned short in[N+M];
+unsigned int out[N];
+
+/* Outer-loop vectorization. */
+/* Not vectorized due to multiple-types in the inner-loop. */
+
+__attribute__ ((noinline)) unsigned int
+foo (){
+ int i,j;
+ unsigned int diff;
+ unsigned int s=0;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i];
+ }
+ s+=((unsigned short)diff>>3);
+ }
+ return s;
+}
+
+int main (void)
+{
+ int i, j;
+ unsigned int diff;
+ unsigned int s=0,sum=0;
+
+ check_vect ();
+
+ for (i = 0; i < N+M; i++) {
+ in[i] = i;
+ }
+
+ sum=foo ();
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j+=8) {
+ diff += in[j+i];
+ }
+ s += ((unsigned short)diff>>3);
+ }
+
+ if (s != sum)
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4m.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4m.c
index 1087df0d4cf..6e032f13c4f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-4m.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4m.c
@@ -2,8 +2,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 320
-#define M 1024
+#define N 40
+#define M 128
unsigned short in[N+M];
unsigned int out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-fir-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-big-array.c
new file mode 100644
index 00000000000..c69b7d74950
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-big-array.c
@@ -0,0 +1,74 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 80
+#define M 256
+float in[N+M];
+float coeff[M];
+float out[N];
+float fir_out[N];
+
+/* Should be vectorized. Fixed misaligment in the inner-loop. */
+__attribute__ ((noinline))
+void foo (){
+ int i,j,k;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ out[i] = 0;
+ }
+
+ for (k = 0; k < 4; k++) {
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = k; j < M; j+=4) {
+ diff += in[j+i]*coeff[j];
+ }
+ out[i] += diff;
+ }
+ }
+
+}
+
+/* Vectorized. Changing misalignment in the inner-loop. */
+__attribute__ ((noinline))
+void fir (){
+ int i,j,k;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j++) {
+ diff += in[j+i]*coeff[j];
+ }
+ fir_out[i] = diff;
+ }
+}
+
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+ float diff;
+
+ for (i = 0; i < M; i++)
+ coeff[i] = i;
+ for (i = 0; i < N+M; i++)
+ in[i] = i;
+
+ foo ();
+ fir ();
+
+ for (i = 0; i < N; i++) {
+ if (out[i] != fir_out[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail vect_no_align } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb-big-array.c
new file mode 100644
index 00000000000..5ac62ac3a2f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb-big-array.c
@@ -0,0 +1,78 @@
+/* { dg-require-effective-target vect_float } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 80
+#define M 128
+float in[N+M];
+float coeff[M];
+float out[N];
+float fir_out[N];
+
+/* Vectorized. Fixed misaligment in the inner-loop. */
+__attribute__ ((noinline))
+void foo (){
+ int i,j,k;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ out[i] = 0;
+ }
+
+ for (k = 0; k < 4; k++) {
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ j = k;
+
+ do {
+ diff += in[j+i]*coeff[j];
+ j+=4;
+ } while (j < M);
+
+ out[i] += diff;
+ }
+ }
+
+}
+
+/* Vectorized. Changing misalignment in the inner-loop. */
+__attribute__ ((noinline))
+void fir (){
+ int i,j,k;
+ float diff;
+
+ for (i = 0; i < N; i++) {
+ diff = 0;
+ for (j = 0; j < M; j++) {
+ diff += in[j+i]*coeff[j];
+ }
+ fir_out[i] = diff;
+ }
+}
+
+
+int main (void)
+{
+ check_vect ();
+ int i, j;
+ float diff;
+
+ for (i = 0; i < M; i++)
+ coeff[i] = i;
+ for (i = 0; i < N+M; i++)
+ in[i] = i;
+
+ foo ();
+ fir ();
+
+ for (i = 0; i < N; i++) {
+ if (out[i] != fir_out[i])
+ abort ();
+ }
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 2 "vect" { xfail vect_no_align } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb.c b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb.c
index 5ac62ac3a2f..3c1a362c003 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-fir-lb.c
@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 80
-#define M 128
+#define N 40
+#define M 64
float in[N+M];
float coeff[M];
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-fir.c b/gcc/testsuite/gcc.dg/vect/vect-outer-fir.c
index c81180c8313..af787b96a33 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-outer-fir.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-outer-fir.c
@@ -3,8 +3,8 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 80
-#define M 256
+#define N 40
+#define M 128
float in[N+M];
float coeff[M];
float out[N];
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-1-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1-big-array.c
new file mode 100644
index 00000000000..2061594acc0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1-big-array.c
@@ -0,0 +1,64 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 512
+
+/* Modified rgb to rgb conversion from FFmpeg. */
+__attribute__ ((noinline)) void
+foo (unsigned char *src, unsigned char *dst)
+{
+ unsigned char *s = src;
+ unsigned short *d = (unsigned short *)dst;
+ int i;
+
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ *d = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
+ d++;
+ }
+
+ s = src;
+ d = (unsigned short *)dst;
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
+ abort ();
+ d++;
+ }
+}
+
+int main (void)
+{
+ int i;
+ unsigned char in[N], out[N];
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ in[i] = i;
+ out[i] = 255;
+ __asm__ volatile ("");
+ }
+
+ foo (in, out);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c
index 2061594acc0..36f4684ad58 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c
@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 512
+#define N 64
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-2-big-array.c
new file mode 100644
index 00000000000..bc738cef26c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-2-big-array.c
@@ -0,0 +1,65 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 512
+
+/* Modified rgb to rgb conversion from FFmpeg. */
+__attribute__ ((noinline)) void
+foo (unsigned char *src, unsigned char *dst)
+{
+ unsigned char *s = src;
+ int *d = (int *)dst;
+ int i;
+
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ *d = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
+ d++;
+ }
+
+ s = src;
+ d = (int *)dst;
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
+ abort ();
+ d++;
+ }
+}
+
+int main (void)
+{
+ int i;
+ unsigned char in[N], out[N];
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ in[i] = i;
+ out[i] = 255;
+ __asm__ volatile ("");
+ }
+
+ foo (in, out);
+
+ return 0;
+}
+
+/* Final value stays in int, so no over-widening is detected at the moment. */
+/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 0 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-2.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-2.c
index bc738cef26c..fecc5ef3038 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-2.c
@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 512
+#define N 64
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c
new file mode 100644
index 00000000000..d828c833f55
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3-big-array.c
@@ -0,0 +1,64 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+/* Modified rgb to rgb conversion from FFmpeg. */
+__attribute__ ((noinline)) void
+foo (unsigned char *src, unsigned char *dst)
+{
+ unsigned char *s = src;
+ unsigned short *d = (unsigned short *)dst;
+ int i;
+
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ *d = ((b>>3) | ((g&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9));
+ d++;
+ }
+
+ s = src;
+ d = (unsigned short *)dst;
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ if (*d != ((b>>3) | ((g&0xFFC)<<3) | ((r+0xF8)>>8) | (a<<9)))
+ abort ();
+ d++;
+ }
+}
+
+int main (void)
+{
+ int i;
+ unsigned char in[N], out[N];
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ in[i] = i;
+ out[i] = 255;
+ __asm__ volatile ("");
+ }
+
+ foo (in, out);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c
index d828c833f55..ed36688f6c6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c
@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 64
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) void
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-4-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4-big-array.c
new file mode 100644
index 00000000000..d296dc94486
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4-big-array.c
@@ -0,0 +1,68 @@
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_shift } */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 512
+
+/* Modified rgb to rgb conversion from FFmpeg. */
+__attribute__ ((noinline)) int
+foo (unsigned char *src, unsigned char *dst)
+{
+ unsigned char *s = src;
+ unsigned short *d = (unsigned short *)dst, res;
+ int i, result = 0;
+
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ res = ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5));
+ *d = res;
+ result += res;
+ d++;
+ }
+
+ s = src;
+ d = (unsigned short *)dst;
+ for (i = 0; i < N/4; i++)
+ {
+ const int b = *s++;
+ const int g = *s++;
+ const int r = *s++;
+ const int a = *s++;
+ if (*d != ((b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8) | (a>>5)))
+ abort ();
+ d++;
+ }
+
+ return result;
+}
+
+int main (void)
+{
+ int i;
+ unsigned char in[N], out[N];
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ in[i] = i;
+ out[i] = 255;
+ __asm__ volatile ("");
+ }
+
+ foo (in, out);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c
index d296dc94486..c1291e38f6d 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c
@@ -5,7 +5,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 512
+#define N 64
/* Modified rgb to rgb conversion from FFmpeg. */
__attribute__ ((noinline)) int
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
new file mode 100644
index 00000000000..7462cb34cc5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char-big-array.c
@@ -0,0 +1,71 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 256
+
+unsigned char ub[N];
+unsigned char uc[N];
+unsigned char diff;
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) void
+main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
+{
+ int i;
+ unsigned char udiff = 2;
+ unsigned char umax = x;
+ unsigned char umin = x;
+
+ diff = 2;
+ for (i = 0; i < N; i++) {
+ ub[i] = i;
+ uc[i] = i;
+ if (i%16 == 0)
+ {
+ ub[i] = i+2;
+ diff += 2;
+ }
+ if (uc[i] > max_result)
+ max_result = uc[i];
+ if (uc[i] < min_result)
+ min_result = uc[i];
+
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+ for (i = 0; i < N; i++) {
+ udiff += (unsigned char) (ub[i] - uc[i]);
+ }
+
+ for (i = 0; i < N; i++) {
+ umax = umax < uc[i] ? uc[i] : umax;
+ }
+
+ for (i = 0; i < N; i++) {
+ umin = umin > uc[i] ? uc[i] : umin;
+ }
+
+ /* check results: */
+ if (udiff != diff)
+ abort ();
+ if (umax != max_result)
+ abort ();
+ if (umin != min_result)
+ abort ();
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (100, 100, 1);
+ main1 (0, 15, 0);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
index 7462cb34cc5..5a1c03d113f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
@@ -3,13 +3,11 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 256
+#define N 16
+#define DIFF 242
-unsigned char ub[N];
-unsigned char uc[N];
-unsigned char diff;
-
-volatile int y = 0;
+unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
__attribute__ ((noinline)) void
main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
@@ -19,26 +17,8 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
unsigned char umax = x;
unsigned char umin = x;
- diff = 2;
- for (i = 0; i < N; i++) {
- ub[i] = i;
- uc[i] = i;
- if (i%16 == 0)
- {
- ub[i] = i+2;
- diff += 2;
- }
- if (uc[i] > max_result)
- max_result = uc[i];
- if (uc[i] < min_result)
- min_result = uc[i];
-
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
for (i = 0; i < N; i++) {
- udiff += (unsigned char) (ub[i] - uc[i]);
+ udiff += (unsigned char)(ub[i] - uc[i]);
}
for (i = 0; i < N; i++) {
@@ -50,7 +30,7 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
}
/* check results: */
- if (udiff != diff)
+ if (udiff != DIFF)
abort ();
if (umax != max_result)
abort ();
@@ -59,9 +39,9 @@ main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
}
int main (void)
-{
+{
check_vect ();
-
+
main1 (100, 100, 1);
main1 (0, 15, 0);
return 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
new file mode 100644
index 00000000000..7004e9e4e44
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char-big-array.c
@@ -0,0 +1,69 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 256
+volatile int y = 0;
+
+__attribute__ ((noinline))
+void main1 (signed char x, signed char max_result, signed char min_result)
+{
+ int i;
+ signed char b[N];
+ signed char c[N];
+ signed char check_diff = 2;
+ signed char diff = 2;
+ signed char max = x;
+ signed char min = x;
+
+ check_diff = 2;
+ for (i = 0; i < N; i++) {
+ b[i] = i;
+ c[i] = i;
+ if (i%16 == 0)
+ {
+ c[i] = i + 1;
+ check_diff += 1;
+ }
+ if (c[i] > max_result)
+ max_result = c[i];
+ if (c[i] < min_result)
+ min_result = c[i];
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++) {
+ diff += (signed char) (c[i] - b[i]);
+ }
+
+ for (i = 0; i < N; i++) {
+ max = max < c[i] ? c[i] : max;
+ }
+
+ for (i = 0; i < N; i++) {
+ min = min > c[i] ? c[i] : min;
+ }
+
+ /* check results: */
+ if (diff != check_diff)
+ abort ();
+ if (max != max_result)
+ abort ();
+ if (min != min_result)
+ abort ();
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (100, 100, 1);
+ main1 (0, 15, 0);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
index 7004e9e4e44..6d01f03174a 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
@@ -3,40 +3,21 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 256
-volatile int y = 0;
+#define N 16
+#define DIFF 121
__attribute__ ((noinline))
void main1 (signed char x, signed char max_result, signed char min_result)
{
int i;
- signed char b[N];
- signed char c[N];
- signed char check_diff = 2;
+ signed char b[N] = {1,2,3,6,8,10,12,14,16,18,20,22,24,26,28,30};
+ signed char c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
signed char diff = 2;
signed char max = x;
signed char min = x;
- check_diff = 2;
for (i = 0; i < N; i++) {
- b[i] = i;
- c[i] = i;
- if (i%16 == 0)
- {
- c[i] = i + 1;
- check_diff += 1;
- }
- if (c[i] > max_result)
- max_result = c[i];
- if (c[i] < min_result)
- min_result = c[i];
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
-
- for (i = 0; i < N; i++) {
- diff += (signed char) (c[i] - b[i]);
+ diff += (signed char)(b[i] - c[i]);
}
for (i = 0; i < N; i++) {
@@ -48,7 +29,7 @@ void main1 (signed char x, signed char max_result, signed char min_result)
}
/* check results: */
- if (diff != check_diff)
+ if (diff != DIFF)
abort ();
if (max != max_result)
abort ();
@@ -57,9 +38,9 @@ void main1 (signed char x, signed char max_result, signed char min_result)
}
int main (void)
-{
+{
check_vect ();
-
+
main1 (100, 100, 1);
main1 (0, 15, 0);
return 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c
new file mode 100644
index 00000000000..1967e3da6b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b-big-array.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+unsigned char udata_ch[N];
+#define SUM N*(N-1)
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+foo ()
+{
+ int i;
+ unsigned int intsum = 0;
+
+ for (i = 0; i < N; i++)
+ {
+ udata_ch[i] = i*2;
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ /* widenning sum: sum chars into int. */
+ for (i = 0; i < N; i++)
+ {
+ intsum += udata_ch[i];
+ }
+
+ /* check results: */
+ if (intsum != SUM)
+ abort ();
+
+ return 0;
+}
+
+int
+main (void)
+{
+ check_vect ();
+ return foo ();
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si || vect_unpack } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
index 1967e3da6b2..6effa87ebb5 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c
@@ -3,11 +3,10 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
-unsigned char udata_ch[N];
-#define SUM N*(N-1)
-
-volatile int y = 0;
+#define N 16
+unsigned char udata_ch[N] =
+ { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
+#define SUM 210
__attribute__ ((noinline)) int
foo ()
@@ -15,14 +14,6 @@ foo ()
int i;
unsigned int intsum = 0;
- for (i = 0; i < N; i++)
- {
- udata_ch[i] = i*2;
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
-
/* widenning sum: sum chars into int. */
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c
new file mode 100644
index 00000000000..5394adee00e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c-big-array.c
@@ -0,0 +1,49 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+unsigned char udata_ch[N];
+#define SUM N*(N-1)
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+foo ()
+{
+ int i;
+ unsigned short shortsum = 0;
+
+ for (i = 0; i < N; i++)
+ {
+ udata_ch[i] = i*2;
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ /* widenning sum: sum chars into short. */
+ for (i = 0; i < N; i++)
+ {
+ shortsum += udata_ch[i];
+ }
+
+ /* check results: */
+ if (shortsum != SUM)
+ abort ();
+
+ return 0;
+}
+
+int
+main (void)
+{
+ check_vect ();
+ return foo ();
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_hi } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c
index 5394adee00e..872e6e82e5b 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c
@@ -3,11 +3,10 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
-unsigned char udata_ch[N];
-#define SUM N*(N-1)
-
-volatile int y = 0;
+#define N 16
+unsigned char udata_ch[N] =
+ { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
+#define SUM 210
__attribute__ ((noinline)) int
foo ()
@@ -15,14 +14,6 @@ foo ()
int i;
unsigned short shortsum = 0;
- for (i = 0; i < N; i++)
- {
- udata_ch[i] = i*2;
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
-
/* widenning sum: sum chars into short. */
for (i = 0; i < N; i++)
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c
new file mode 100644
index 00000000000..fa0100b9a9d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b-big-array.c
@@ -0,0 +1,50 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+signed char data_ch[N];
+
+volatile int y = 0;
+
+__attribute__ ((noinline)) int
+foo ()
+{
+ int i;
+ signed int intsum = 0;
+ signed int check_intsum = 0;
+
+ for (i = 0; i < N; i++)
+ {
+ data_ch[i] = i*2;
+ check_intsum += data_ch[i];
+ /* Avoid vectorization. */
+ if (y)
+ abort ();
+ }
+
+ /* widenning sum: sum chars into int. */
+ for (i = 0; i < N; i++)
+ {
+ intsum += data_ch[i];
+ }
+
+ /* check results: */
+ if (intsum != check_intsum)
+ abort ();
+
+ return 0;
+}
+
+int
+main (void)
+{
+ check_vect ();
+ return foo ();
+}
+
+/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si && vect_unpack } } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
index fa0100b9a9d..53d5f0d5cce 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c
@@ -3,26 +3,16 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
-signed char data_ch[N];
-
-volatile int y = 0;
+#define N 16
+signed char data_ch[N] =
+ { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 };
+#define SUM 210
__attribute__ ((noinline)) int
foo ()
{
int i;
signed int intsum = 0;
- signed int check_intsum = 0;
-
- for (i = 0; i < N; i++)
- {
- data_ch[i] = i*2;
- check_intsum += data_ch[i];
- /* Avoid vectorization. */
- if (y)
- abort ();
- }
/* widenning sum: sum chars into int. */
for (i = 0; i < N; i++)
@@ -31,7 +21,7 @@ foo ()
}
/* check results: */
- if (intsum != check_intsum)
+ if (intsum != SUM)
abort ();
return 0;
diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-shift-2-big-array.c
new file mode 100644
index 00000000000..0e1acfb7beb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-shift-2-big-array.c
@@ -0,0 +1,190 @@
+/* { dg-require-effective-target vect_shift } */
+/* { dg-require-effective-target vect_int } */
+/* Check the standard integer types for left and right shifts to see if the
+ compiler replaced a scalar instruction with a vector instruction whether the
+ correct value is generated. */
+
+#ifdef TRACE
+#endif
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#ifndef ALIGN
+#define ALIGN __attribute__((__aligned__(__BIGGEST_ALIGNMENT__)))
+#endif
+
+#ifndef NOINLINE
+#define NOINLINE __attribute__((__noinline__))
+#endif
+
+#ifdef TRACE
+#define TRACE_FUNC(PREFIX, NAME) printf (#PREFIX #NAME "\n")
+#define TRACE_DONE() printf ("done!\n")
+#define TRACE_ABORT(I,E,G) \
+do { \
+ printf ("Element %d, expected 0x%lx, got 0x%lx\n", \
+ I, (long)(E), (long)(G)); \
+ abort (); \
+} while (0)
+
+#else
+#define TRACE_FUNC(PREFIX, A)
+#define TRACE_DONE()
+#define TRACE_ABORT(I,E,G) abort ()
+#endif
+
+#define NAME(A,B) A ## B
+
+#define VECT_TESTS(PREFIX, TYPE, N) \
+ /* Restrict the optimizer from optimizing the setup loops. */ \
+volatile TYPE NAME (PREFIX, zero) = 0; \
+ \
+TYPE NAME (PREFIX, a)[N] ALIGN; \
+TYPE NAME (PREFIX, b)[N] ALIGN; \
+TYPE NAME (PREFIX, c)[N] ALIGN; \
+TYPE NAME (PREFIX, d)[N] ALIGN; \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_2) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_2); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << 2; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_var) (int shift) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_var); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << shift; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, lshift_vect) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, lshift_vect); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] << NAME (PREFIX, c)[i]; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_2) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_2); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> 2; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_var) (int shift) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_var); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> shift; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, rshift_vect) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, rshift_vect); \
+ for (i = 0; i < N; i++) \
+ NAME (PREFIX, a)[i] = NAME (PREFIX, b)[i] >> NAME (PREFIX, c)[i]; \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, check) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, check); \
+ for (i = 0; i < N; i++) \
+ if (NAME (PREFIX, a)[i] != NAME (PREFIX, d)[i]) \
+ TRACE_ABORT (i, NAME (PREFIX, d)[i], NAME (PREFIX, a)[i]); \
+} \
+ \
+static void NOINLINE \
+NAME (PREFIX, tests) (void) \
+{ \
+ int i; \
+ \
+ TRACE_FUNC (PREFIX, tests); \
+ for (i = 0; i < N; i++) \
+ { \
+ NAME (PREFIX, b)[i] = (i + NAME (PREFIX, zero)); \
+ NAME (PREFIX, c)[i] = 2; \
+ NAME (PREFIX, d)[i] = (i + NAME (PREFIX, zero)) << 2; \
+ } \
+ \
+ NAME (PREFIX, lshift_2) (); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, lshift_var) (2); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, lshift_vect) (); \
+ NAME (PREFIX, check) (); \
+ \
+ for (i = 0; i < N; i++) \
+ { \
+ NAME (PREFIX, b)[i] = ((i + NAME (PREFIX, zero)) << 4) \
+ | (((TYPE)0x80) << ((sizeof (TYPE) * 8) - 8)); \
+ NAME (PREFIX, c)[i] = 2; \
+ NAME (PREFIX, d)[i] = (TYPE)((NAME (PREFIX, b)[i] \
+ + NAME (PREFIX, zero)) >> 2); \
+ } \
+ \
+ NAME (PREFIX, rshift_2) (); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, rshift_var) (2); \
+ NAME (PREFIX, check) (); \
+ \
+ NAME (PREFIX, rshift_vect) (); \
+ NAME (PREFIX, check) (); \
+}
+
+VECT_TESTS (uc_, unsigned char, 128)
+VECT_TESTS (us_, unsigned short, 256)
+VECT_TESTS (ui_, unsigned int, 256)
+VECT_TESTS (ul_, unsigned long, 256)
+
+VECT_TESTS (sc_, signed char, 128)
+VECT_TESTS (ss_, short, 256)
+VECT_TESTS (si_, int, 256)
+VECT_TESTS (sl_, long, 256)
+
+int main ()
+{
+ int i;
+
+ check_vect ();
+
+ uc_tests ();
+ us_tests ();
+ ui_tests ();
+ ul_tests ();
+
+ sc_tests ();
+ ss_tests ();
+ si_tests ();
+ sl_tests ();
+
+ TRACE_DONE ();
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-shift-2.c b/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
index 0e1acfb7beb..83211eba49f 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-shift-2.c
@@ -157,15 +157,15 @@ NAME (PREFIX, tests) (void) \
NAME (PREFIX, check) (); \
}
-VECT_TESTS (uc_, unsigned char, 128)
-VECT_TESTS (us_, unsigned short, 256)
-VECT_TESTS (ui_, unsigned int, 256)
-VECT_TESTS (ul_, unsigned long, 256)
-
-VECT_TESTS (sc_, signed char, 128)
-VECT_TESTS (ss_, short, 256)
-VECT_TESTS (si_, int, 256)
-VECT_TESTS (sl_, long, 256)
+VECT_TESTS(uc_, unsigned char, 16)
+VECT_TESTS(us_, unsigned short, 32)
+VECT_TESTS(ui_, unsigned int, 32)
+VECT_TESTS(ul_, unsigned long, 32)
+
+VECT_TESTS(sc_, signed char, 16)
+VECT_TESTS(ss_, short, 32)
+VECT_TESTS(si_, int, 32)
+VECT_TESTS(sl_, long, 32)
int main ()
{
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c
new file mode 100644
index 00000000000..6e3c9f1b9ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c
@@ -0,0 +1,92 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+ unsigned char g;
+ unsigned char h;
+} s;
+
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
+ s arr[N];
+ s *ptr = arr;
+ s check_res[N];
+ s res[N];
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i;
+ arr[i].b = i * 2;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ arr[i].e = i + 5;
+ arr[i].f = i * 2 + 2;
+ arr[i].g = i - 3;
+ arr[i].h = 56;
+
+ check_res[i].c = arr[i].a;
+ check_res[i].a = arr[i].f + arr[i].a;
+ check_res[i].d = arr[i].f - arr[i].a;
+ check_res[i].b = arr[i].f;
+ check_res[i].f = arr[i].a;
+ check_res[i].e = arr[i].f - arr[i].a;
+ check_res[i].h = arr[i].f;
+ check_res[i].g = arr[i].f - arr[i].a;
+
+ if (arr[i].a == 178)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ res[i].c = ptr->a;
+ res[i].a = ptr->f + ptr->a;
+ res[i].d = ptr->f - ptr->a;
+ res[i].b = ptr->f;
+ res[i].f = ptr->a;
+ res[i].e = ptr->f - ptr->a;
+ res[i].h = ptr->f;
+ res[i].g = ptr->f - ptr->a;
+ ptr++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != check_res[i].a
+ || res[i].b != check_res[i].b
+ || res[i].c != check_res[i].c
+ || res[i].d != check_res[i].d
+ || res[i].e != check_res[i].e
+ || res[i].f != check_res[i].f
+ || res[i].g != check_res[i].g
+ || res[i].h != check_res[i].h)
+ abort ();
+ }
+}
+
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c
index f20d158db70..4fb5494a4d3 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
typedef struct {
unsigned char a;
@@ -22,7 +22,6 @@ main1 ()
int i;
s arr[N];
s *ptr = arr;
- s check_res[N];
s res[N];
for (i = 0; i < N; i++)
@@ -35,16 +34,6 @@ main1 ()
arr[i].f = i * 2 + 2;
arr[i].g = i - 3;
arr[i].h = 56;
-
- check_res[i].c = arr[i].a;
- check_res[i].a = arr[i].f + arr[i].a;
- check_res[i].d = arr[i].f - arr[i].a;
- check_res[i].b = arr[i].f;
- check_res[i].f = arr[i].a;
- check_res[i].e = arr[i].f - arr[i].a;
- check_res[i].h = arr[i].f;
- check_res[i].g = arr[i].f - arr[i].a;
-
if (arr[i].a == 178)
abort();
}
@@ -56,23 +45,23 @@ main1 ()
res[i].d = ptr->f - ptr->a;
res[i].b = ptr->f;
res[i].f = ptr->a;
- res[i].e = ptr->f - ptr->a;
- res[i].h = ptr->f;
+ res[i].e = ptr->f - ptr->a;
+ res[i].h = ptr->f;
res[i].g = ptr->f - ptr->a;
- ptr++;
- }
-
+ ptr++;
+ }
+
/* check results: */
for (i = 0; i < N; i++)
- {
- if (res[i].a != check_res[i].a
- || res[i].b != check_res[i].b
- || res[i].c != check_res[i].c
- || res[i].d != check_res[i].d
- || res[i].e != check_res[i].e
- || res[i].f != check_res[i].f
- || res[i].g != check_res[i].g
- || res[i].h != check_res[i].h)
+ {
+ if (res[i].c != arr[i].a
+ || res[i].a != arr[i].f + arr[i].a
+ || res[i].d != arr[i].f - arr[i].a
+ || res[i].b != arr[i].f
+ || res[i].f != arr[i].a
+ || res[i].e != arr[i].f - arr[i].a
+ || res[i].h != arr[i].f
+ || res[i].g != arr[i].f - arr[i].a)
abort();
}
}
@@ -89,4 +78,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
-
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c
new file mode 100644
index 00000000000..5a446317ca3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c
@@ -0,0 +1,101 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+ unsigned char g;
+ unsigned char h;
+} s;
+
+__attribute__ ((noinline)) int
+main1 ()
+{
+ int i;
+ s arr[N];
+ s *ptr = arr;
+ s check_res[N];
+ s res[N];
+ unsigned char u, t, s, x, y, z, w;
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i;
+ arr[i].b = i * 2;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ arr[i].e = i * 3 + 5;
+ arr[i].f = i * 5;
+ arr[i].g = i - 3;
+ arr[i].h = 67;
+
+ u = arr[i].b - arr[i].a;
+ t = arr[i].d - arr[i].c;
+ check_res[i].c = u + t;
+ x = arr[i].b + arr[i].d;
+ check_res[i].a = arr[i].a + x;
+ check_res[i].d = u + t;
+ s = arr[i].h - arr[i].a;
+ check_res[i].b = s + t;
+ check_res[i].f = arr[i].f + arr[i].h;
+ check_res[i].e = arr[i].b + arr[i].e;
+ check_res[i].h = arr[i].d;
+ check_res[i].g = u + t;
+
+ if (arr[i].a == 178)
+ abort ();
+ }
+
+ for (i = 0; i < N; i++)
+ {
+ u = ptr->b - ptr->a;
+ t = ptr->d - ptr->c;
+ res[i].c = u + t;
+ x = ptr->b + ptr->d;
+ res[i].a = ptr->a + x;
+ res[i].d = u + t;
+ s = ptr->h - ptr->a;
+ res[i].b = s + t;
+ res[i].f = ptr->f + ptr->h;
+ res[i].e = ptr->b + ptr->e;
+ res[i].h = ptr->d;
+ res[i].g = u + t;
+ ptr++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != check_res[i].a
+ || res[i].b != check_res[i].b
+ || res[i].c != check_res[i].c
+ || res[i].d != check_res[i].d
+ || res[i].e != check_res[i].e
+ || res[i].f != check_res[i].f
+ || res[i].g != check_res[i].g
+ || res[i].h != check_res[i].h)
+ abort ();
+ }
+}
+
+
+int main (void)
+{
+ check_vect ();
+
+ main1 ();
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c
index 28a9c58cd65..cc09fa608dc 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
typedef struct {
unsigned char a;
@@ -22,7 +22,6 @@ main1 ()
int i;
s arr[N];
s *ptr = arr;
- s check_res[N];
s res[N];
unsigned char u, t, s, x, y, z, w;
@@ -36,20 +35,6 @@ main1 ()
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 67;
-
- u = arr[i].b - arr[i].a;
- t = arr[i].d - arr[i].c;
- check_res[i].c = u + t;
- x = arr[i].b + arr[i].d;
- check_res[i].a = arr[i].a + x;
- check_res[i].d = u + t;
- s = arr[i].h - arr[i].a;
- check_res[i].b = s + t;
- check_res[i].f = arr[i].f + arr[i].h;
- check_res[i].e = arr[i].b + arr[i].e;
- check_res[i].h = arr[i].d;
- check_res[i].g = u + t;
-
if (arr[i].a == 178)
abort();
}
@@ -74,14 +59,14 @@ main1 ()
/* check results: */
for (i = 0; i < N; i++)
{
- if (res[i].a != check_res[i].a
- || res[i].b != check_res[i].b
- || res[i].c != check_res[i].c
- || res[i].d != check_res[i].d
- || res[i].e != check_res[i].e
- || res[i].f != check_res[i].f
- || res[i].g != check_res[i].g
- || res[i].h != check_res[i].h)
+ if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
+ || res[i].a != arr[i].a + arr[i].b + arr[i].d
+ || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
+ || res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
+ || res[i].f != arr[i].f + arr[i].h
+ || res[i].e != arr[i].b + arr[i].e
+ || res[i].h != arr[i].d
+ || res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
abort();
}
}
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c
new file mode 100644
index 00000000000..cc1b9498914
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c
@@ -0,0 +1,94 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+ unsigned char g;
+ unsigned char h;
+} s;
+
+s check_res[N];
+
+__attribute__ ((noinline)) int
+main1 (s *arr)
+{
+ int i;
+ s *ptr = arr;
+ s res[N];
+
+ for (i = 0; i < N; i++)
+ {
+ res[i].c = ptr->b;
+ res[i].a = ptr->f + ptr->b;
+ res[i].d = ptr->f - ptr->b;
+ res[i].b = ptr->f;
+ res[i].f = ptr->b;
+ res[i].e = ptr->f - ptr->b;
+ res[i].h = ptr->f;
+ res[i].g = ptr->f - ptr->b;
+ ptr++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != check_res[i].a
+ || res[i].b != check_res[i].b
+ || res[i].c != check_res[i].c
+ || res[i].d != check_res[i].d
+ || res[i].e != check_res[i].e
+ || res[i].f != check_res[i].f
+ || res[i].g != check_res[i].g
+ || res[i].h != check_res[i].h)
+ abort ();
+ }
+}
+
+
+int main (void)
+{
+ int i;
+ s arr[N];
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i;
+ arr[i].b = i * 2;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ arr[i].e = i + 5;
+ arr[i].f = i * 2 + 2;
+ arr[i].g = i - 3;
+ arr[i].h = 56;
+
+ check_res[i].c = arr[i].b;
+ check_res[i].a = arr[i].f + arr[i].b;
+ check_res[i].d = arr[i].f - arr[i].b;
+ check_res[i].b = arr[i].f;
+ check_res[i].f = arr[i].b;
+ check_res[i].e = arr[i].f - arr[i].b;
+ check_res[i].h = arr[i].f;
+ check_res[i].g = arr[i].f - arr[i].b;
+ if (arr[i].a == 178)
+ abort ();
+ }
+
+ main1 (arr);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
index cc1b9498914..349e8693926 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
typedef struct {
unsigned char a;
@@ -16,8 +16,6 @@ typedef struct {
unsigned char h;
} s;
-s check_res[N];
-
__attribute__ ((noinline)) int
main1 (s *arr)
{
@@ -32,24 +30,24 @@ main1 (s *arr)
res[i].d = ptr->f - ptr->b;
res[i].b = ptr->f;
res[i].f = ptr->b;
- res[i].e = ptr->f - ptr->b;
- res[i].h = ptr->f;
+ res[i].e = ptr->f - ptr->b;
+ res[i].h = ptr->f;
res[i].g = ptr->f - ptr->b;
- ptr++;
- }
-
+ ptr++;
+ }
+
/* check results: */
for (i = 0; i < N; i++)
- {
- if (res[i].a != check_res[i].a
- || res[i].b != check_res[i].b
- || res[i].c != check_res[i].c
- || res[i].d != check_res[i].d
- || res[i].e != check_res[i].e
- || res[i].f != check_res[i].f
- || res[i].g != check_res[i].g
- || res[i].h != check_res[i].h)
- abort ();
+ {
+ if (res[i].c != arr[i].b
+ || res[i].a != arr[i].f + arr[i].b
+ || res[i].d != arr[i].f - arr[i].b
+ || res[i].b != arr[i].f
+ || res[i].f != arr[i].b
+ || res[i].e != arr[i].f - arr[i].b
+ || res[i].h != arr[i].f
+ || res[i].g != arr[i].f - arr[i].b)
+ abort();
}
}
@@ -58,11 +56,11 @@ int main (void)
{
int i;
s arr[N];
-
+
check_vect ();
for (i = 0; i < N; i++)
- {
+ {
arr[i].a = i;
arr[i].b = i * 2;
arr[i].c = 17;
@@ -71,18 +69,9 @@ int main (void)
arr[i].f = i * 2 + 2;
arr[i].g = i - 3;
arr[i].h = 56;
-
- check_res[i].c = arr[i].b;
- check_res[i].a = arr[i].f + arr[i].b;
- check_res[i].d = arr[i].f - arr[i].b;
- check_res[i].b = arr[i].f;
- check_res[i].f = arr[i].b;
- check_res[i].e = arr[i].f - arr[i].b;
- check_res[i].h = arr[i].f;
- check_res[i].g = arr[i].f - arr[i].b;
if (arr[i].a == 178)
- abort ();
- }
+ abort();
+ }
main1 (arr);
@@ -91,4 +80,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
-
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c
new file mode 100644
index 00000000000..916fdf4d4fa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c
@@ -0,0 +1,116 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+ unsigned char g;
+ unsigned char h;
+} s;
+
+s check_res[N];
+
+__attribute__ ((noinline)) int
+main1 (s *arr)
+{
+ int i;
+ s *ptr = arr;
+ s res[N];
+ unsigned char x;
+
+ for (i = 0; i < N; i++)
+ {
+ res[i].c = ptr->b + ptr->c;
+ x = ptr->c + ptr->f;
+ res[i].a = x + ptr->b;
+ res[i].d = ptr->b + ptr->c;
+ res[i].b = ptr->c;
+ res[i].f = ptr->f + ptr->e;
+ res[i].e = ptr->b + ptr->e;
+ res[i].h = ptr->c;
+ res[i].g = ptr->b + ptr->c;
+ ptr++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != check_res[i].a
+ || res[i].b != check_res[i].b
+ || res[i].c != check_res[i].c
+ || res[i].d != check_res[i].d
+ || res[i].e != check_res[i].e
+ || res[i].f != check_res[i].f
+ || res[i].g != check_res[i].g
+ || res[i].h != check_res[i].h)
+ abort ();
+ }
+
+ ptr = arr;
+ /* Not vectorizable: gap in store. */
+ for (i = 0; i < N; i++)
+ {
+ res[i].a = ptr->b;
+ res[i].b = ptr->c;
+ ptr++;
+ }
+
+ /* Check results. */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != arr[i].b
+ || res[i].b != arr[i].c)
+ abort ();
+ }
+
+}
+
+
+int main (void)
+{
+ int i;
+ s arr[N];
+ unsigned char x;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i;
+ arr[i].b = i * 2;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ arr[i].e = i * 3 + 5;
+ arr[i].f = i * 5;
+ arr[i].g = i - 3;
+ arr[i].h = 56;
+
+ check_res[i].c = arr[i].b + arr[i].c;
+ x = arr[i].c + arr[i].f;
+ check_res[i].a = x + arr[i].b;
+ check_res[i].d = arr[i].b + arr[i].c;
+ check_res[i].b = arr[i].c;
+ check_res[i].f = arr[i].f + arr[i].e;
+ check_res[i].e = arr[i].b + arr[i].e;
+ check_res[i].h = arr[i].c;
+ check_res[i].g = arr[i].b + arr[i].c;
+
+ if (arr[i].a == 178)
+ abort ();
+ }
+ main1 (arr);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
index 92255d42707..537bcc87dfb 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
typedef struct {
unsigned char a;
@@ -16,8 +16,6 @@ typedef struct {
unsigned char h;
} s;
-s check_res[N];
-
__attribute__ ((noinline)) int
main1 (s *arr)
{
@@ -34,39 +32,39 @@ main1 (s *arr)
res[i].d = ptr->b + ptr->c;
res[i].b = ptr->c;
res[i].f = ptr->f + ptr->e;
- res[i].e = ptr->b + ptr->e;
- res[i].h = ptr->c;
+ res[i].e = ptr->b + ptr->e;
+ res[i].h = ptr->c;
res[i].g = ptr->b + ptr->c;
- ptr++;
- }
-
+ ptr++;
+ }
+
/* check results: */
for (i = 0; i < N; i++)
- {
- if (res[i].a != check_res[i].a
- || res[i].b != check_res[i].b
- || res[i].c != check_res[i].c
- || res[i].d != check_res[i].d
- || res[i].e != check_res[i].e
- || res[i].f != check_res[i].f
- || res[i].g != check_res[i].g
- || res[i].h != check_res[i].h)
+ {
+ if (res[i].c != arr[i].b + arr[i].c
+ || res[i].a != arr[i].c + arr[i].f + arr[i].b
+ || res[i].d != arr[i].b + arr[i].c
+ || res[i].b != arr[i].c
+ || res[i].f != arr[i].f + arr[i].e
+ || res[i].e != arr[i].b + arr[i].e
+ || res[i].h != arr[i].c
+ || res[i].g != arr[i].b + arr[i].c)
abort ();
}
ptr = arr;
/* Not vectorizable: gap in store. */
for (i = 0; i < N; i++)
- {
+ {
res[i].a = ptr->b;
res[i].b = ptr->c;
- ptr++;
+ ptr++;
}
-
+
/* Check results. */
for (i = 0; i < N; i++)
{
- if (res[i].a != arr[i].b
+ if (res[i].a != arr[i].b
|| res[i].b != arr[i].c)
abort ();
}
@@ -78,12 +76,11 @@ int main (void)
{
int i;
s arr[N];
- unsigned char x;
-
+
check_vect ();
for (i = 0; i < N; i++)
- {
+ {
arr[i].a = i;
arr[i].b = i * 2;
arr[i].c = 17;
@@ -92,20 +89,10 @@ int main (void)
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 56;
-
- check_res[i].c = arr[i].b + arr[i].c;
- x = arr[i].c + arr[i].f;
- check_res[i].a = x + arr[i].b;
- check_res[i].d = arr[i].b + arr[i].c;
- check_res[i].b = arr[i].c;
- check_res[i].f = arr[i].f + arr[i].e;
- check_res[i].e = arr[i].b + arr[i].e;
- check_res[i].h = arr[i].c;
- check_res[i].g = arr[i].b + arr[i].c;
-
if (arr[i].a == 178)
- abort ();
- }
+ abort();
+ }
+
main1 (arr);
return 0;
@@ -113,4 +100,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
-
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c
new file mode 100644
index 00000000000..ecacefab9a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c
@@ -0,0 +1,105 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 128
+
+typedef struct {
+ unsigned char a;
+ unsigned char b;
+ unsigned char c;
+ unsigned char d;
+ unsigned char e;
+ unsigned char f;
+ unsigned char g;
+ unsigned char h;
+} s;
+
+s check_res[N];
+
+__attribute__ ((noinline)) int
+main1 (s *arr)
+{
+ int i;
+ s *ptr = arr;
+ s res[N];
+ unsigned char u, t, s, x, y, z, w;
+
+ for (i = 0; i < N; i++)
+ {
+ u = ptr->b - ptr->a;
+ t = ptr->d - ptr->c;
+ res[i].c = u + t;
+ x = ptr->b + ptr->d;
+ res[i].a = ptr->a + x;
+ res[i].d = u + t;
+ s = ptr->h - ptr->a;
+ res[i].b = s + t;
+ res[i].f = ptr->f + ptr->h;
+ res[i].e = ptr->b + ptr->e;
+ res[i].h = ptr->d;
+ res[i].g = u + t;
+ ptr++;
+ }
+
+ /* check results: */
+ for (i = 0; i < N; i++)
+ {
+ if (res[i].a != check_res[i].a
+ || res[i].b != check_res[i].b
+ || res[i].c != check_res[i].c
+ || res[i].d != check_res[i].d
+ || res[i].e != check_res[i].e
+ || res[i].f != check_res[i].f
+ || res[i].g != check_res[i].g
+ || res[i].h != check_res[i].h)
+ abort ();
+ }
+}
+
+
+int main (void)
+{
+ int i;
+ s arr[N];
+ unsigned char u, t, s, x, y, z, w;
+
+ check_vect ();
+
+ for (i = 0; i < N; i++)
+ {
+ arr[i].a = i;
+ arr[i].b = i * 2;
+ arr[i].c = 17;
+ arr[i].d = i+34;
+ arr[i].e = i * 3 + 5;
+ arr[i].f = i * 5;
+ arr[i].g = i - 3;
+ arr[i].h = 67;
+
+ u = arr[i].b - arr[i].a;
+ t = arr[i].d - arr[i].c;
+ check_res[i].c = u + t;
+ x = arr[i].b + arr[i].d;
+ check_res[i].a = arr[i].a + x;
+ check_res[i].d = u + t;
+ s = arr[i].h - arr[i].a;
+ check_res[i].b = s + t;
+ check_res[i].f = arr[i].f + arr[i].h;
+ check_res[i].e = arr[i].b + arr[i].e;
+ check_res[i].h = arr[i].d;
+ check_res[i].g = u + t;
+
+ if (arr[i].a == 178)
+ abort ();
+ }
+
+ main1 (arr);
+
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
diff --git a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
index 0e3c0528dc9..76cb66d0861 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
@@ -3,7 +3,7 @@
#include <stdarg.h>
#include "tree-vect.h"
-#define N 128
+#define N 16
typedef struct {
unsigned char a;
@@ -16,8 +16,6 @@ typedef struct {
unsigned char h;
} s;
-s check_res[N];
-
__attribute__ ((noinline)) int
main1 (s *arr)
{
@@ -46,14 +44,14 @@ main1 (s *arr)
/* check results: */
for (i = 0; i < N; i++)
{
- if (res[i].a != check_res[i].a
- || res[i].b != check_res[i].b
- || res[i].c != check_res[i].c
- || res[i].d != check_res[i].d
- || res[i].e != check_res[i].e
- || res[i].f != check_res[i].f
- || res[i].g != check_res[i].g
- || res[i].h != check_res[i].h)
+ if (res[i].c != arr[i].b - arr[i].a + arr[i].d - arr[i].c
+ || res[i].a != arr[i].a + arr[i].b + arr[i].d
+ || res[i].d != arr[i].b - arr[i].a + arr[i].d - arr[i].c
+ || res[i].b != arr[i].h - arr[i].a + arr[i].d - arr[i].c
+ || res[i].f != arr[i].f + arr[i].h
+ || res[i].e != arr[i].b + arr[i].e
+ || res[i].h != arr[i].d
+ || res[i].g != arr[i].b - arr[i].a + arr[i].d - arr[i].c)
abort();
}
}
@@ -63,7 +61,6 @@ int main (void)
{
int i;
s arr[N];
- unsigned char u, t, s, x, y, z, w;
check_vect ();
@@ -77,20 +74,6 @@ int main (void)
arr[i].f = i * 5;
arr[i].g = i - 3;
arr[i].h = 67;
-
- u = arr[i].b - arr[i].a;
- t = arr[i].d - arr[i].c;
- check_res[i].c = u + t;
- x = arr[i].b + arr[i].d;
- check_res[i].a = arr[i].a + x;
- check_res[i].d = u + t;
- s = arr[i].h - arr[i].a;
- check_res[i].b = s + t;
- check_res[i].f = arr[i].f + arr[i].h;
- check_res[i].e = arr[i].b + arr[i].e;
- check_res[i].h = arr[i].d;
- check_res[i].g = u + t;
-
if (arr[i].a == 178)
abort();
}
diff --git a/gcc/testsuite/gcc.dg/volatile3.c b/gcc/testsuite/gcc.dg/volatile3.c
new file mode 100644
index 00000000000..4a5893d97cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/volatile3.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-ssa" } */
+
+volatile int *q;
+void foo(int i)
+{
+ volatile int a[2];
+ volatile int *p = &a[i];
+ q = p;
+}
+
+/* { dg-final { scan-tree-dump-not "{v}" "ssa" } } */
+/* { dg-final { cleanup-tree-dump "ssa" } } */
diff --git a/gcc/testsuite/gcc.target/epiphany/interrupt.c b/gcc/testsuite/gcc.target/epiphany/interrupt.c
index a44c79e432e..86fb255613b 100644
--- a/gcc/testsuite/gcc.target/epiphany/interrupt.c
+++ b/gcc/testsuite/gcc.target/epiphany/interrupt.c
@@ -1,5 +1,7 @@
+/* { dg-options "-g" } */
+
void __attribute__((interrupt("dma0")))
-f (void)
+dma0_handler (void)
{
}
@@ -12,3 +14,5 @@ void __attribute__((interrupt(42)))
h (void)
{ /* { dg-warning "is not a string constant" } */
}
+
+/* { dg-final { scan-assembler-times "b\[ \t\]*_dma0_handler" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/movdi-rex64.c b/gcc/testsuite/gcc.target/i386/movdi-rex64.c
new file mode 100644
index 00000000000..f8b8388106d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/movdi-rex64.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-fPIE" } */
+/* { dg-require-effective-target pie } */
+
+char *strcpy (char *dest, const char *src);
+
+static __thread char buffer[25];
+const char * error_message (void)
+{
+ strcpy (buffer, "Unknown code ");
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/mips/branch-1.c b/gcc/testsuite/gcc.target/mips/branch-1.c
index 62d6bbb619a..2f4510f8dd6 100644
--- a/gcc/testsuite/gcc.target/mips/branch-1.c
+++ b/gcc/testsuite/gcc.target/mips/branch-1.c
@@ -2,7 +2,7 @@
but we test for "bbit" elsewhere. On other targets, we should implement
the "if" statements using an "andi" instruction followed by a branch
on zero. */
-/* { dg-options "-O2 forbid_cpu=octeon" } */
+/* { dg-options "-O2 forbid_cpu=octeon.*" } */
void bar (void);
NOMIPS16 void f1 (int x) { if (x & 4) bar (); }
diff --git a/gcc/testsuite/gcc.target/mips/dmult-1.c b/gcc/testsuite/gcc.target/mips/dmult-1.c
index 517e43ed54b..f8c0b8b44f1 100644
--- a/gcc/testsuite/gcc.target/mips/dmult-1.c
+++ b/gcc/testsuite/gcc.target/mips/dmult-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "forbid_cpu=octeon -mgp64" } */
+/* { dg-options "forbid_cpu=octeon.* -mgp64" } */
/* { dg-final { scan-assembler "\tdmult\t" } } */
/* { dg-final { scan-assembler "\tmflo\t" } } */
/* { dg-final { scan-assembler-not "\tdmul\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/extend-1.c b/gcc/testsuite/gcc.target/mips/extend-1.c
index 4295106866b..5e9389060c8 100644
--- a/gcc/testsuite/gcc.target/mips/extend-1.c
+++ b/gcc/testsuite/gcc.target/mips/extend-1.c
@@ -1,4 +1,4 @@
-/* { dg-options "-O -mgp64 forbid_cpu=octeon" } */
+/* { dg-options "-O -mgp64 forbid_cpu=octeon.*" } */
/* { dg-final { scan-assembler-times "\tdsll\t" 5 } } */
/* { dg-final { scan-assembler-times "\tdsra\t" 5 } } */
/* { dg-final { scan-assembler-not "\tsll\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/mult-1.c b/gcc/testsuite/gcc.target/mips/mult-1.c
index 43dd08c0b52..96961b0d85c 100644
--- a/gcc/testsuite/gcc.target/mips/mult-1.c
+++ b/gcc/testsuite/gcc.target/mips/mult-1.c
@@ -1,6 +1,6 @@
/* For SI->DI widening multiplication we should use DINS to combine the two
halves. For Octeon use DMUL with explicit widening. */
-/* { dg-options "-O -mgp64 isa_rev>=2 forbid_cpu=octeon" } */
+/* { dg-options "-O -mgp64 isa_rev>=2 forbid_cpu=octeon.*" } */
/* { dg-final { scan-assembler "\tdins\t" } } */
/* { dg-final { scan-assembler-not "\tdsll\t" } } */
/* { dg-final { scan-assembler-not "\tdsrl\t" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c b/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
new file mode 100644
index 00000000000..ee5c5eee900
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-perm-1.c
@@ -0,0 +1,76 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O -maltivec -mno-vsx" } */
+
+typedef unsigned char V __attribute__((vector_size(16)));
+
+V b1(V x)
+{
+ return __builtin_shuffle(x, (V){ 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, });
+}
+
+V b2(V x)
+{
+ return __builtin_shuffle(x, (V){ 2,3,2,3, 2,3,2,3, 2,3,2,3, 2,3,2,3, });
+}
+
+V b4(V x)
+{
+ return __builtin_shuffle(x, (V){ 4,5,6,7, 4,5,6,7, 4,5,6,7, 4,5,6,7, });
+}
+
+V p2(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 });
+
+}
+
+V p4(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31 });
+}
+
+V h1(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 0, 16, 1, 17, 2, 18, 3, 19, 4, 20, 5, 21, 6, 22, 7, 23 });
+}
+
+V h2(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 0, 1, 16, 17, 2, 3, 18, 19, 4, 5, 20, 21, 6, 7, 22, 23 });
+}
+
+V h4(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 });
+}
+
+V l1(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 8, 24, 9, 25, 10, 26, 11, 27, 12, 28, 13, 29, 14, 30, 15, 31 });
+}
+
+V l2(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 8, 9, 24, 25, 10, 11, 26, 27, 12, 13, 28, 29, 14, 15, 30, 31 });
+}
+
+V l4(V x, V y)
+{
+ return __builtin_shuffle(x, y,
+ (V){ 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 });
+}
+
+/* { dg-final { scan-assembler-not "vperm" } } */
+/* { dg-final { scan-assembler "vspltb" } } */
+/* { dg-final { scan-assembler "vsplth" } } */
+/* { dg-final { scan-assembler "vspltw" } } */
+/* { dg-final { scan-assembler "vpkuhum" } } */
+/* { dg-final { scan-assembler "vpkuwum" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-perm-2.c b/gcc/testsuite/gcc.target/powerpc/altivec-perm-2.c
new file mode 100644
index 00000000000..1b90bb9567c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-perm-2.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O -maltivec -mno-vsx" } */
+
+typedef unsigned short V __attribute__((vector_size(16)));
+
+V f2(V x)
+{
+ return __builtin_shuffle(x, (V){ 1,1,1,1, 1,1,1,1, });
+}
+
+V f4(V x)
+{
+ return __builtin_shuffle(x, (V){ 2,3,2,3, 2,3,2,3, });
+}
+
+/* { dg-final { scan-assembler-not "vperm" } } */
+/* { dg-final { scan-assembler "vsplth" } } */
+/* { dg-final { scan-assembler "vspltw" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-perm-4.c b/gcc/testsuite/gcc.target/powerpc/altivec-perm-4.c
new file mode 100644
index 00000000000..9598edfb010
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-perm-4.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O -maltivec -mno-vsx" } */
+
+typedef unsigned int V __attribute__((vector_size(16)));
+
+V f4(V x)
+{
+ return __builtin_shuffle(x, (V){ 1,1,1,1, });
+}
+
+/* { dg-final { scan-assembler-not "vperm" } } */
+/* { dg-final { scan-assembler "vspltw" } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c b/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c
new file mode 100644
index 00000000000..ac728334cd5
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c
@@ -0,0 +1,84 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-options "-O2 -ffast-math -mcpu=power5 -mno-altivec -mabi=altivec -fno-unroll-loops" } */
+/* { dg-final { scan-assembler-times "vaddfp" 1 } } */
+/* { dg-final { scan-assembler-times "xvaddsp" 1 } } */
+/* { dg-final { scan-assembler-times "fadds" 1 } } */
+
+#ifndef SIZE
+#define SIZE 1024
+#endif
+
+#ifdef __ALTIVEC__
+#error "__ALTIVEC__ should not be defined."
+#endif
+
+#ifdef __VSX__
+#error "__VSX__ should not be defined."
+#endif
+
+#pragma GCC target("vsx")
+#include <altivec.h>
+#pragma GCC reset_options
+
+#pragma GCC push_options
+#pragma GCC target("altivec,no-vsx")
+
+#ifndef __ALTIVEC__
+#error "__ALTIVEC__ should be defined."
+#endif
+
+#ifdef __VSX__
+#error "__VSX__ should not be defined."
+#endif
+
+void
+av_add (vector float *a, vector float *b, vector float *c)
+{
+ unsigned long i;
+ unsigned long n = SIZE / 4;
+
+ for (i = 0; i < n; i++)
+ a[i] = vec_add (b[i], c[i]);
+}
+
+#pragma GCC target("vsx")
+
+#ifndef __ALTIVEC__
+#error "__ALTIVEC__ should be defined."
+#endif
+
+#ifndef __VSX__
+#error "__VSX__ should be defined."
+#endif
+
+void
+vsx_add (vector float *a, vector float *b, vector float *c)
+{
+ unsigned long i;
+ unsigned long n = SIZE / 4;
+
+ for (i = 0; i < n; i++)
+ a[i] = vec_add (b[i], c[i]);
+}
+
+#pragma GCC pop_options
+#pragma GCC target("no-vsx,no-altivec")
+
+#ifdef __ALTIVEC__
+#error "__ALTIVEC__ should not be defined."
+#endif
+
+#ifdef __VSX__
+#error "__VSX__ should not be defined."
+#endif
+
+void
+norm_add (float *a, float *b, float *c)
+{
+ unsigned long i;
+
+ for (i = 0; i < SIZE; i++)
+ a[i] = b[i] + c[i];
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/recip-5.c b/gcc/testsuite/gcc.target/powerpc/recip-5.c
index 0b3823cfa51..3d7d691d5ac 100644
--- a/gcc/testsuite/gcc.target/powerpc/recip-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/recip-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile { target { powerpc*-*-* } } } */
-/* { dg-require-effective-target powerpc_fprs } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_vsx_ok } */
/* { dg-options "-O3 -ftree-vectorize -mrecip=all -ffast-math -mcpu=power7 -fno-unroll-loops" } */
/* { dg-final { scan-assembler-times "xvredp" 4 } } */
/* { dg-final { scan-assembler-times "xvresp" 5 } } */
diff --git a/gcc/testsuite/gfortran.dg/auto_dealloc_2.f90 b/gcc/testsuite/gfortran.dg/auto_dealloc_2.f90
index 4cbda828895..e607b6ad91d 100644
--- a/gcc/testsuite/gfortran.dg/auto_dealloc_2.f90
+++ b/gcc/testsuite/gfortran.dg/auto_dealloc_2.f90
@@ -25,5 +25,5 @@ contains
end program
-! { dg-final { scan-tree-dump-times "__builtin_free" 2 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_free" 3 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/bounds_check_16.f90 b/gcc/testsuite/gfortran.dg/bounds_check_16.f90
new file mode 100644
index 00000000000..38a86306e93
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bounds_check_16.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-options "-fcheck=bounds" }
+!
+! PR fortran/50815
+!
+! Don't check the bounds of deferred-length strings.
+! gfortran had an ICE before because it did.
+!
+SUBROUTINE TEST(VALUE)
+ IMPLICIT NONE
+ CHARACTER(LEN=:), ALLOCATABLE :: VALUE
+ CHARACTER(LEN=128) :: VAL
+ VALUE = VAL
+END SUBROUTINE TEST
diff --git a/gcc/testsuite/gfortran.dg/class_19.f03 b/gcc/testsuite/gfortran.dg/class_19.f03
index 78e5652a871..27ee7b4e2cb 100644
--- a/gcc/testsuite/gfortran.dg/class_19.f03
+++ b/gcc/testsuite/gfortran.dg/class_19.f03
@@ -39,7 +39,7 @@ program main
end program main
-! { dg-final { scan-tree-dump-times "__builtin_free" 8 "original" } }
+! { dg-final { scan-tree-dump-times "__builtin_free" 11 "original" } }
! { dg-final { cleanup-tree-dump "original" } }
! { dg-final { cleanup-modules "foo_mod" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_1.f03 b/gcc/testsuite/gfortran.dg/class_array_1.f03
new file mode 100644
index 00000000000..32a0e54bf0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_1.f03
@@ -0,0 +1,76 @@
+! { dg-do run }
+!
+! Test functionality of allocatable class arrays:
+! ALLOCATE with source, ALLOCATED, DEALLOCATE, passing as arguments for
+! ELEMENTAL and non-ELEMENTAL procedures, SELECT TYPE and LOWER/UPPER.
+!
+ type :: type1
+ integer :: i
+ end type
+ type, extends(type1) :: type2
+ real :: r
+ end type
+ class(type1), allocatable, dimension (:) :: x
+
+ allocate(x(2), source = type2(42,42.0))
+ call display(x, [1], [2], t2 = [type2(42,42.0),type2(42,42.0)])
+ call display(x, [1], [2], t2 = [type2(111,99.0),type2(111,99.0)])
+ if (allocated (x)) deallocate (x)
+
+ allocate(x(1:4), source = [(type2(i,42.0 + float (i)), i = 1, 4)])
+ call display(x, [1], [4], t2 = [(type2(i,42.0 + float (i)), i = 1, 4)])
+ call display(x, [1], [4], t2 = [(type2(111,99.0), i = 1, 4)])
+
+ if (any (disp (x) .ne. [99.0,99.0,99.0,99.0])) call abort
+
+ if (allocated (x)) deallocate (x)
+
+ allocate(x(1:4), source = type1(42))
+ call display(x, [1], [4], t1 = [(type1(42), i = 1, 4)])
+ call display(x, [1], [4], t1 = [type1(42),type1(99),type1(42),type1(42)])
+ if (any (disp (x) .ne. [0.0,0.0,0.0,0.0])) call abort
+
+contains
+ subroutine display(x, lower, upper, t1, t2)
+ class(type1), allocatable, dimension (:) :: x
+ integer, dimension (:) :: lower, upper
+ type(type1), optional, dimension(:) :: t1
+ type(type2), optional, dimension(:) :: t2
+ select type (x)
+ type is (type1)
+ if (present (t1)) then
+ if (any (x%i .ne. t1%i)) call abort
+ else
+ call abort
+ end if
+ x(2)%i = 99
+ type is (type2)
+ if (present (t2)) then
+ if (any (x%i .ne. t2%i)) call abort
+ if (any (x%r .ne. t2%r)) call abort
+ else
+ call abort
+ end if
+ x%i = 111
+ x%r = 99.0
+ end select
+ call bounds (x, lower, upper)
+ end subroutine
+ subroutine bounds (x, lower, upper)
+ class(type1), allocatable, dimension (:) :: x
+ integer, dimension (:) :: lower, upper
+ if (any (lower .ne. lbound (x))) call abort
+ if (any (upper .ne. ubound (x))) call abort
+ end subroutine
+ elemental function disp(y) result(ans)
+ class(type1), intent(in) :: y
+ real :: ans
+ select type (y)
+ type is (type1)
+ ans = 0.0
+ type is (type2)
+ ans = y%r
+ end select
+ end function
+end
+
diff --git a/gcc/testsuite/gfortran.dg/class_array_2.f03 b/gcc/testsuite/gfortran.dg/class_array_2.f03
new file mode 100644
index 00000000000..68f1b71e552
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_2.f03
@@ -0,0 +1,78 @@
+! { dg-do run }
+!
+! Test functionality of pointer class arrays:
+! ALLOCATE with source, ASSOCIATED, DEALLOCATE, passing as arguments for
+! ELEMENTAL and non-ELEMENTAL procedures, SELECT TYPE and LOWER/UPPER.
+!
+ type :: type1
+ integer :: i
+ end type
+ type, extends(type1) :: type2
+ real :: r
+ end type
+ class(type1), pointer, dimension (:) :: x
+
+ allocate(x(2), source = type2(42,42.0))
+ call display(x, [1], [2], t2 = [type2(42,42.0),type2(42,42.0)])
+ call display(x, [1], [2], t2 = [type2(111,99.0),type2(111,99.0)])
+ if (associated (x)) deallocate (x)
+
+ allocate(x(1:4), source = [(type2(i,42.0 + float (i)), i = 1, 4)])
+ call display(x, [1], [4], t2 = [(type2(i,42.0 + float (i)), i = 1, 4)])
+ call display(x, [1], [4], t2 = [(type2(111,99.0), i = 1, 4)])
+
+ if (any (disp (x) .ne. [99.0,99.0,99.0,99.0])) call abort
+
+ if (associated (x)) deallocate (x)
+
+ allocate(x(1:4), source = type1(42))
+ call display(x, [1], [4], t1 = [(type1(42), i = 1, 4)])
+ call display(x, [1], [4], t1 = [type1(42),type1(99),type1(42),type1(42)])
+ if (any (disp (x) .ne. [0.0,0.0,0.0,0.0])) call abort
+
+ if (associated (x)) deallocate (x)
+
+contains
+ subroutine display(x, lower, upper, t1, t2)
+ class(type1), pointer, dimension (:) :: x
+ integer, dimension (:) :: lower, upper
+ type(type1), optional, dimension(:) :: t1
+ type(type2), optional, dimension(:) :: t2
+ select type (x)
+ type is (type1)
+ if (present (t1)) then
+ if (any (x%i .ne. t1%i)) call abort
+ else
+ call abort
+ end if
+ x(2)%i = 99
+ type is (type2)
+ if (present (t2)) then
+ if (any (x%i .ne. t2%i)) call abort
+ if (any (x%r .ne. t2%r)) call abort
+ else
+ call abort
+ end if
+ x%i = 111
+ x%r = 99.0
+ end select
+ call bounds (x, lower, upper)
+ end subroutine
+ subroutine bounds (x, lower, upper)
+ class(type1), pointer, dimension (:) :: x
+ integer, dimension (:) :: lower, upper
+ if (any (lower .ne. lbound (x))) call abort
+ if (any (upper .ne. ubound (x))) call abort
+ end subroutine
+ elemental function disp(y) result(ans)
+ class(type1), intent(in) :: y
+ real :: ans
+ select type (y)
+ type is (type1)
+ ans = 0.0
+ type is (type2)
+ ans = y%r
+ end select
+ end function
+end
+
diff --git a/gcc/testsuite/gfortran.dg/class_array_3.f03 b/gcc/testsuite/gfortran.dg/class_array_3.f03
new file mode 100644
index 00000000000..0ca0a006eaf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_3.f03
@@ -0,0 +1,143 @@
+! { dg-do run }
+!
+! class based quick sort program - starting point comment #0 of pr41539
+!
+! Note assignment with vector index reference fails because temporary
+! allocation does not occur - also false dependency detected. Nullification
+! of temp descriptor data causes a segfault.
+!
+module m_qsort
+ implicit none
+ type, abstract :: sort_t
+ contains
+ procedure(disp), deferred :: disp
+ procedure(lt_cmp), deferred :: lt_cmp
+ procedure(assign), deferred :: assign
+ generic :: operator(<) => lt_cmp
+ generic :: assignment(=) => assign
+ end type sort_t
+ interface
+ elemental integer function disp(a)
+ import
+ class(sort_t), intent(in) :: a
+ end function disp
+ end interface
+ interface
+ impure elemental logical function lt_cmp(a,b)
+ import
+ class(sort_t), intent(in) :: a, b
+ end function lt_cmp
+ end interface
+ interface
+ elemental subroutine assign(a,b)
+ import
+ class(sort_t), intent(out) :: a
+ class(sort_t), intent(in) :: b
+ end subroutine assign
+ end interface
+contains
+
+ subroutine qsort(a)
+ class(sort_t), intent(inout),allocatable :: a(:)
+ class(sort_t), allocatable :: tmp (:)
+ integer, allocatable :: index_array (:)
+ integer :: i
+ allocate (tmp(size (a, 1)), source = a)
+ index_array = [(i, i = 1, size (a, 1))]
+ call internal_qsort (tmp, index_array) ! Do not move class elements around until end
+ do i = 1, size (a, 1) ! Since they can be of arbitrary size.
+ a(i) = tmp(index_array(i)) ! Vector index array would be neater
+ end do
+! a = tmp(index_array) ! Like this - TODO: fixme
+ end subroutine qsort
+
+ recursive subroutine internal_qsort (x, iarray)
+ class(sort_t), intent(inout),allocatable :: x(:)
+ class(sort_t), allocatable :: ptr
+ integer, allocatable :: iarray(:), above(:), below(:), itmp(:)
+ integer :: pivot, nelem, i, iptr
+ if (.not.allocated (iarray)) return
+ nelem = size (iarray, 1)
+ if (nelem .le. 1) return
+ pivot = nelem / 2
+ allocate (ptr, source = x(iarray(pivot))) ! Pointer to the pivot element
+ do i = 1, nelem
+ iptr = iarray(i) ! Index for i'th element
+ if (ptr%lt_cmp (x(iptr))) then ! Compare pivot with i'th element
+ itmp = [iptr]
+ above = concat (itmp, above) ! Invert order to prevent infinite loops
+ else
+ itmp = [iptr]
+ below = concat (itmp, below) ! -ditto-
+ end if
+ end do
+ call internal_qsort (x, above) ! Recursive sort of 'above' and 'below'
+ call internal_qsort (x, below)
+ iarray = concat (below, above) ! Concatenate the result
+ end subroutine internal_qsort
+
+ function concat (ia, ib) result (ic)
+ integer, allocatable, dimension(:) :: ia, ib, ic
+ if (allocated (ia) .and. allocated (ib)) then
+ ic = [ia, ib]
+ else if (allocated (ia)) then
+ ic = ia
+ else if (allocated (ib)) then
+ ic = ib
+ end if
+ end function concat
+end module m_qsort
+
+module test
+ use m_qsort
+ implicit none
+ type, extends(sort_t) :: sort_int_t
+ integer :: i
+ contains
+ procedure :: disp => disp_int
+ procedure :: lt_cmp => lt_cmp_int
+ procedure :: assign => assign_int
+ end type
+contains
+ elemental integer function disp_int(a)
+ class(sort_int_t), intent(in) :: a
+ disp_int = a%i
+ end function disp_int
+ elemental subroutine assign_int (a, b)
+ class(sort_int_t), intent(out) :: a
+ class(sort_t), intent(in) :: b ! TODO: gfortran does not throw 'class(sort_int_t)'
+ select type (b)
+ class is (sort_int_t)
+ a%i = b%i
+ class default
+ a%i = -1
+ end select
+ end subroutine assign_int
+ impure elemental logical function lt_cmp_int(a,b) result(cmp)
+ class(sort_int_t), intent(in) :: a
+ class(sort_t), intent(in) :: b
+ select type(b)
+ type is(sort_int_t)
+ if (a%i < b%i) then
+ cmp = .true.
+ else
+ cmp = .false.
+ end if
+ class default
+ ERROR STOP "Don't compare apples with oranges"
+ end select
+ end function lt_cmp_int
+end module test
+
+program main
+ use test
+ class(sort_t), allocatable :: A(:)
+ integer :: i, m(5)= [7 , 4, 5, 2, 3]
+ allocate (A(5), source = [(sort_int_t(m(i)), i=1,5)])
+! print *, "Before qsort: ", (A(i)%disp(), i = 1, size(a,1))
+ call qsort(A)
+! print *, "After qsort: ", (A(i)%disp(), i = 1, size(a,1))
+ if (any ([(A(i)%disp(), i = 1, size(a,1))] .ne. [2,3,4,5,7])) call abort
+end program main
+
+! { dg-final { cleanup-modules "m_qsort test" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_4.f03 b/gcc/testsuite/gfortran.dg/class_array_4.f03
new file mode 100644
index 00000000000..7c748f008d0
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_4.f03
@@ -0,0 +1,26 @@
+! { dg-do run }
+! PR43214 - implementation of class arrays
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+!
+module m
+ type t
+ real :: r = 99
+ contains
+ procedure, pass :: foo => foo
+ end type t
+contains
+ elemental subroutine foo(x, i)
+ class(t),intent(in) :: x
+ integer,intent(inout) :: i
+ i = x%r + i
+ end subroutine foo
+end module m
+
+ use m
+ type(t) :: x(3)
+ integer :: n(3) = [0,100,200]
+ call x(:)%foo(n)
+ if (any(n .ne. [99,199,299])) call abort
+end
+! { dg-final { cleanup-modules "m" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_5.f03 b/gcc/testsuite/gfortran.dg/class_array_5.f03
new file mode 100644
index 00000000000..2a7e2f1bc46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_5.f03
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! PR44568 - class array impelementation.
+!
+! Contributed by Hans-Werner Boschmann
+!
+module ice6
+
+ type::a_type
+ contains
+ procedure::do_something
+ end type a_type
+
+ contains
+
+ subroutine do_something(this)
+ class(a_type),intent(in)::this
+ end subroutine do_something
+
+ subroutine do_something_else()
+ class(a_type),dimension(:),allocatable::values
+ call values(1)%do_something()
+ end subroutine do_something_else
+
+end module ice6
+! { dg-final { cleanup-modules "ice6" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_6.f03 b/gcc/testsuite/gfortran.dg/class_array_6.f03
new file mode 100644
index 00000000000..4f8b803befb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_6.f03
@@ -0,0 +1,33 @@
+! { dg-do compile }
+! PR46356 - class arrays
+!
+! Contributed by Ian Harvey
+!
+MODULE procedure_intent_nonsense
+ IMPLICIT NONE
+ PRIVATE
+ TYPE, PUBLIC :: Parent
+ INTEGER :: comp
+ END TYPE Parent
+
+ TYPE :: ParentVector
+ INTEGER :: a
+ ! CLASS(Parent), ALLOCATABLE :: a
+ END TYPE ParentVector
+CONTAINS
+ SUBROUTINE vector_operation(pvec)
+ CLASS(ParentVector), INTENT(INOUT) :: pvec(:)
+ INTEGER :: i
+ !---
+ DO i = 1, SIZE(pvec)
+ CALL item_operation(pvec(i))
+ END DO
+ ! PRINT *, pvec(1)%a%comp
+ END SUBROUTINE vector_operation
+
+ SUBROUTINE item_operation(pvec)
+ CLASS(ParentVector), INTENT(INOUT) :: pvec
+ !TYPE(ParentVector), INTENT(INOUT) :: pvec
+ END SUBROUTINE item_operation
+END MODULE procedure_intent_nonsense
+! { dg-final { cleanup-modules "procedure_intent_nonsense" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_7.f03 b/gcc/testsuite/gfortran.dg/class_array_7.f03
new file mode 100644
index 00000000000..225cc7e06c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_7.f03
@@ -0,0 +1,59 @@
+! { dg-do run }
+! PR46990 - class array implementation
+!
+! Contributed by Wolfgang Kilian on comp.lang.fortran - see comment #7 of PR
+!
+module realloc
+ implicit none
+
+ type :: base_type
+ integer :: i
+ contains
+ procedure :: assign
+ generic :: assignment(=) => assign ! define generic assignment
+ end type base_type
+
+ type, extends(base_type) :: extended_type
+ integer :: j
+ end type extended_type
+
+contains
+
+ elemental subroutine assign (a, b)
+ class(base_type), intent(out) :: a
+ type(base_type), intent(in) :: b
+ a%i = b%i
+ end subroutine assign
+
+ subroutine reallocate (a)
+ class(base_type), dimension(:), allocatable, intent(inout) :: a
+ class(base_type), dimension(:), allocatable :: tmp
+ allocate (tmp (2 * size (a))) ! how to alloc b with same type as a ?
+ if (trim (print_type ("tmp", tmp)) .ne. "tmp is base_type") call abort
+ tmp(:size(a)) = a ! polymorphic l.h.s.
+ call move_alloc (from=tmp, to=a)
+ end subroutine reallocate
+
+ character(20) function print_type (name, a)
+ character(*), intent(in) :: name
+ class(base_type), dimension(:), intent(in) :: a
+ select type (a)
+ type is (base_type); print_type = NAME // " is base_type"
+ type is (extended_type); print_type = NAME // " is extended_type"
+ end select
+ end function
+
+end module realloc
+
+program main
+ use realloc
+ implicit none
+ class(base_type), dimension(:), allocatable :: a
+
+ allocate (extended_type :: a(10))
+ if (trim (print_type ("a", a)) .ne. "a is extended_type") call abort
+ call reallocate (a)
+ if (trim (print_type ("a", a)) .ne. "a is base_type") call abort
+end program main
+
+! { dg-final { cleanup-modules "realloc" } }
diff --git a/gcc/testsuite/gfortran.dg/class_array_8.f03 b/gcc/testsuite/gfortran.dg/class_array_8.f03
new file mode 100644
index 00000000000..20c57ec03ff
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_array_8.f03
@@ -0,0 +1,18 @@
+! { dg-do run }
+! PR43969 - class array implementation
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+!
+ implicit none
+
+ type indx_map
+ end type
+
+ type desc_type
+ class(indx_map), allocatable :: indxmap(:)
+ end type
+
+ type(desc_type) :: desc
+ if (allocated(desc%indxmap)) call abort()
+
+end
diff --git a/gcc/testsuite/gfortran.dg/class_to_type_1.f03 b/gcc/testsuite/gfortran.dg/class_to_type_1.f03
new file mode 100644
index 00000000000..0243343d637
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_to_type_1.f03
@@ -0,0 +1,97 @@
+! { dg-do run }
+!
+! Passing CLASS to TYPE
+!
+implicit none
+type t
+ integer :: A
+ real, allocatable :: B(:)
+end type t
+
+type, extends(t) :: t2
+ complex :: z = cmplx(3.3, 4.4)
+end type t2
+integer :: i
+class(t), allocatable :: x(:)
+
+allocate(t2 :: x(10))
+select type(x)
+ type is(t2)
+ if (size (x) /= 10) call abort ()
+ x = [(t2(a=-i, B=[1*i,2*i,3*i,4*i]), i = 1, 10)]
+ do i = 1, 10
+ if (x(i)%a /= -i .or. size (x(i)%b) /= 4 &
+ .or. any (x(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ if (x(i)%z /= cmplx(3.3, 4.4)) call abort()
+ end do
+ class default
+ call abort()
+end select
+
+call base(x)
+call baseExplicit(x, size(x))
+call class(x)
+call classExplicit(x, size(x))
+contains
+ subroutine base(y)
+ type(t) :: y(:)
+ if (size (y) /= 10) call abort ()
+ do i = 1, 10
+ if (y(i)%a /= -i .or. size (y(i)%b) /= 4 &
+ .or. any (y(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ end do
+ end subroutine base
+ subroutine baseExplicit(v, n)
+ integer, intent(in) :: n
+ type(t) :: v(n)
+ if (size (v) /= 10) call abort ()
+ do i = 1, 10
+ if (v(i)%a /= -i .or. size (v(i)%b) /= 4 &
+ .or. any (v(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ end do
+ end subroutine baseExplicit
+ subroutine class(z)
+ class(t), intent(in) :: z(:)
+ select type(z)
+ type is(t2)
+ if (size (z) /= 10) call abort ()
+ do i = 1, 10
+ if (z(i)%a /= -i .or. size (z(i)%b) /= 4 &
+ .or. any (z(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ if (z(i)%z /= cmplx(3.3, 4.4)) call abort()
+ end do
+ class default
+ call abort()
+ end select
+ call base(z)
+ call baseExplicit(z, size(z))
+ end subroutine class
+ subroutine classExplicit(u, n)
+ integer, intent(in) :: n
+ class(t), intent(in) :: u(n)
+ select type(u)
+ type is(t2)
+ if (size (u) /= 10) call abort ()
+ do i = 1, 10
+ if (u(i)%a /= -i .or. size (u(i)%b) /= 4 &
+ .or. any (u(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ if (u(i)%z /= cmplx(3.3, 4.4)) call abort()
+ end do
+ class default
+ call abort()
+ end select
+ call base(u)
+ call baseExplicit(u, n)
+ end subroutine classExplicit
+end
+
diff --git a/gcc/testsuite/gfortran.dg/coarray/poly_run_1.f90 b/gcc/testsuite/gfortran.dg/coarray/poly_run_1.f90
new file mode 100644
index 00000000000..a371aef0810
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/poly_run_1.f90
@@ -0,0 +1,43 @@
+! { dg-do run }
+!
+! Test for polymorphic coarrays
+!
+type t
+end type t
+class(t), allocatable :: A(:)[:,:]
+allocate (A(2)[1:4,-5:*])
+if (any (lcobound(A) /= [1, -5])) call abort ()
+if (num_images() == 1) then
+ if (any (ucobound(A) /= [4, -5])) call abort ()
+else
+ if (ucobound(A,dim=1) /= 4) call abort ()
+end if
+if (allocated(A)) i = 5
+call s(A)
+!call t(A) ! FIXME
+
+contains
+
+subroutine s(x)
+ class(t),allocatable :: x(:)[:,:]
+ if (any (lcobound(x) /= [1, -5])) call abort ()
+ if (num_images() == 1) then
+ if (any (ucobound(x) /= [4, -5])) call abort ()
+! FIXME: Tree-walking issue?
+! else
+! if (ucobound(x,dim=1) /= 4) call abort ()
+ end if
+end subroutine s
+
+! FIXME
+!subroutine st(x)
+! class(t),allocatable :: x(:)[:,:]
+! if (any (lcobound(x) /= [1, 2])) call abort ()
+! if (num_images() == 1) then
+! if (any (ucobound(x) /= [4, 2])) call abort ()
+! else
+! if (ucobound(x,dim=1) /= 4) call abort ()
+! end if
+!end subroutine st
+end
+
diff --git a/gcc/testsuite/gfortran.dg/coarray/poly_run_2.f90 b/gcc/testsuite/gfortran.dg/coarray/poly_run_2.f90
new file mode 100644
index 00000000000..fe524a0751a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/poly_run_2.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+!
+! Test for polymorphic coarrays
+!
+type t
+end type t
+class(t), allocatable :: A[:,:]
+allocate (A[1:4,-5:*])
+if (allocated(A)) stop
+if (any (lcobound(A) /= [1, -5])) call abort ()
+if (num_images() == 1) then
+ if (any (ucobound(A) /= [4, -5])) call abort ()
+! FIXME: Tree walk issue
+!else
+! if (ucobound(A,dim=1) /= 4) call abort ()
+end if
+if (allocated(A)) i = 5
+call s(A)
+call st(A)
+contains
+subroutine s(x)
+ class(t) :: x[4,2:*]
+ if (any (lcobound(x) /= [1, 2])) call abort ()
+ if (num_images() == 1) then
+ if (any (ucobound(x) /= [4, 2])) call abort ()
+ else
+ if (ucobound(x,dim=1) /= 4) call abort ()
+ end if
+end subroutine s
+subroutine st(x)
+ class(t) :: x[:,:]
+ if (any (lcobound(x) /= [1, -5])) call abort ()
+ if (num_images() == 1) then
+ if (any (ucobound(x) /= [4, -5])) call abort ()
+ else
+ if (ucobound(x,dim=1) /= 4) call abort ()
+ end if
+end subroutine st
+end
+
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_1.f90 b/gcc/testsuite/gfortran.dg/coarray_poly_1.f90
new file mode 100644
index 00000000000..03dbee79839
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_1.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+! Test for polymorphic coarrays
+!
+subroutine s2()
+ type t
+ end type t
+ class(t) :: A(:)[4,2:*] ! { dg-error "is not ALLOCATABLE, SAVE nor a dummy argument" }
+ print *, ucobound(a)
+ allocate(a) ! { dg-error "must be ALLOCATABLE or a POINTER" }
+end
+
diff --git a/gcc/testsuite/gfortran.dg/coarray_poly_2.f90 b/gcc/testsuite/gfortran.dg/coarray_poly_2.f90
new file mode 100644
index 00000000000..dd5a5537f46
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_poly_2.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=single" }
+!
+ type t
+ end type t
+ type(t) :: a[*]
+ call test(a) ! { dg-error "Rank mismatch in argument 'x' at .1. .rank-1 and scalar." }
+contains
+ subroutine test(x)
+ class(t) :: x(:)[*]
+ print *, ucobound(x)
+ end
+end
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare2.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare2.f90
new file mode 100644
index 00000000000..26023c8da15
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare2.f90
@@ -0,0 +1,53 @@
+! { dg-do compile }
+! { dg-options "-fopenmp -ffrontend-optimize -fdump-tree-original" }
+! PR 50690 - this used to ICE because workshare could not handle
+! BLOCKs.
+! To test for correct execution, run this program (but don't forget
+! to unset the stack limit).
+program foo
+ implicit none
+ integer, parameter :: n = 10000000
+ real, parameter :: eps = 3e-7
+ integer :: i,j
+ real :: A(n), B(5), C(n)
+ real :: tmp
+ B(1) = 3.344
+ tmp = B(1)
+ do i=1,10
+ call random_number(a)
+ c = a
+ !$omp parallel default(shared)
+ !$omp workshare
+ A(:) = A(:)*cos(B(1))+A(:)*cos(B(1))
+ !$omp end workshare nowait
+ !$omp end parallel ! sync is implied here
+ end do
+
+ c = c*tmp + c*tmp
+
+ do j=1,n
+ if (abs(a(j)-c(j)) > eps) then
+ print *,1,j,a(j), c(j)
+ call abort
+ end if
+ end do
+
+ do i=1,10
+ call random_number(a)
+ c = a
+ !$omp parallel workshare default(shared)
+ A(:) = A(:)*cos(B(1))+A(:)*cos(B(1))
+ !$omp end parallel workshare
+ end do
+
+ c = c*tmp + c*tmp
+ do j=1,n
+ if (abs(a(j)-c(j)) > eps) then
+ print *,2,j,a(j), c(j)
+ call abort
+ end if
+ end do
+
+end program foo
+! { dg-final { scan-tree-dump-times "__var" 0 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/gomp/workshare3.f90 b/gcc/testsuite/gfortran.dg/gomp/workshare3.f90
new file mode 100644
index 00000000000..579eb717329
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/workshare3.f90
@@ -0,0 +1,39 @@
+! { dg-do compile }
+! { dg-options "-ffrontend-optimize -fdump-tree-original -fopenmp" }
+! Test that common function elimination is done within the OMP parallel
+! blocks even if there is a workshare around it.
+program foo
+ implicit none
+ integer, parameter :: n = 10000000
+ real, parameter :: eps = 3e-7
+ integer :: i,j
+ real :: A(n), B(5), C(n)
+ real :: tmp
+ B(1) = 3.344
+ tmp = B(1)
+ do i=1,10
+ call random_number(a)
+ c = a
+ !$omp parallel workshare
+ !$omp parallel default(shared)
+ !$omp do
+ do j=1,n
+ A(j) = A(j)*cos(B(1))+A(j)*cos(B(1))
+ end do
+ !$omp end do
+ !$omp end parallel
+ !$omp end parallel workshare
+ end do
+
+ c = c*cos(b(1))+ c*cos(b(1))
+
+ do j=1,n
+ if (abs(a(j)-c(j)) > eps) then
+ print *,1,j,a(j), c(j)
+ call abort
+ end if
+ end do
+
+end program foo
+! { dg-final { scan-tree-dump-times "__builtin_cosf" 2 "original" } }
+! { dg-final { cleanup-tree-dump "original" } }
diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_3.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_3.f90
new file mode 100644
index 00000000000..8a6f0965060
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/io_real_boz_3.f90
@@ -0,0 +1,34 @@
+! { dg-do run }
+! { dg-options "-std=f2008" }
+!
+! PR fortran/51407
+!
+! Fortran 2008 allows BOZ edit descriptors for real/complex.
+!
+ real(kind=4) :: x
+ complex(kind=4) :: z
+ character(len=64) :: str1
+
+ x = 1.0_16 + 2.0_16**(-105)
+ z = cmplx (1.0, 2.0)
+
+ write (str1,'(b32)') x
+ read (str1,'(b32)') x
+ write (str1,'(o32)') x
+ read (str1,'(o32)') x
+ write (str1,'(z32)') x
+ read (str1,'(z32)') x
+ write (str1,'(b0)') x
+ write (str1,'(o0)') x
+ write (str1,'(z0)') x
+
+ write (str1,'(2b32)') z
+ read (str1,'(2b32)') z
+ write (str1,'(2o32)') z
+ read (str1,'(2o32)') z
+ write (str1,'(2z32)') z
+ read (str1,'(2z32)') z
+ write (str1,'(2b0)') z
+ write (str1,'(2o0)') z
+ write (str1,'(2z0)') z
+ end
diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_4.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_4.f90
new file mode 100644
index 00000000000..b70555a4687
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/io_real_boz_4.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-options "-std=f2003" }
+!
+! PR fortran/51407
+!
+! Valid in F2008, but in F95/F2003:
+! { dg-output "Expected INTEGER for item 1 in formatted transfer, got REAL" }
+! { dg-shouldfail "Only F2003: BOZ edit with REAL" }
+!
+ real(kind=16) :: x
+ character(len=32) :: str1
+ x = 1.0_16 + 2.0_16**(-105)
+ write (str1,'(z32)') x
+ write (str1,'(z0)') x
+ end
diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_5.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_5.f90
new file mode 100644
index 00000000000..6a36ee59ccb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/io_real_boz_5.f90
@@ -0,0 +1,13 @@
+! { dg-do run }
+! { dg-options "-std=f2008" }
+!
+! PR fortran/51407
+!
+! Invalid in F2008 (accepted with -std=gnu)
+! { dg-output "Expected numeric type for item 1 in formatted transfer, got CHARACTER" }
+! { dg-shouldfail "Character type in BOZ" }
+!
+ character(len=32) :: str1
+ x = 1.0_16 + 2.0_16**(-105)
+ write (str1,'(z0)') 'X'
+ end
diff --git a/gcc/testsuite/gfortran.dg/private_type_14.f90 b/gcc/testsuite/gfortran.dg/private_type_14.f90
new file mode 100644
index 00000000000..6c90b86411a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/private_type_14.f90
@@ -0,0 +1,43 @@
+! { dg-do compile }
+!
+! PR fortran/51378
+!
+! Allow constructor to nonprivate parent compoents,
+! even if the extension specified PRIVATE for its own components
+!
+! Contributed by Reinhold Bader
+!
+module type_ext
+ type :: vec
+ real, dimension(3) :: comp
+ integer :: len
+ end type vec
+ type, extends(vec) :: l_vec
+ private
+ character(len=20) :: label = '01234567890123456789'
+ end type l_vec
+end module type_ext
+program test_ext
+ use type_ext
+ implicit none
+ type(vec) :: o_vec, oo_vec
+ type(l_vec) :: o_l_vec
+ integer :: i
+!
+ o_vec = vec((/1.0, 2.0, 3.0/),3)
+! write(*,*) o_vec%comp, o_vec%len
+ o_l_vec = l_vec(comp=(/1.0, 2.0, 3.0/),len=3)
+! partial constr. not accepted by ifort 11.1, fixed in 12.0 (issue 562240)
+! write(*,*) o_l_vec%comp, o_l_vec%len
+! write(*,*) o_l_vec%vec
+ oo_vec = o_l_vec%vec
+ do i=1, 3
+ if (abs(oo_vec%comp(i) - o_vec%comp(i)) > 1.0E-5) then
+ write(*, *) 'FAIL'
+ stop
+ end if
+ end do
+ write(*, *) 'OK'
+end program
+
+! { dg-final { cleanup-modules "type_ext" } }
diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90
new file mode 100644
index 00000000000..4f7d28895b5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_8.f90
@@ -0,0 +1,17 @@
+! { dg-do compile }
+!
+! PR fortran/51448
+!
+! Contribued by François Willot
+!
+ PROGRAM MAIN
+ IMPLICIT NONE
+ TYPE mytype
+ REAL b(2)
+ END TYPE mytype
+ TYPE(mytype) a
+ DOUBLE PRECISION, ALLOCATABLE :: x(:)
+ ALLOCATE(x(2))
+ a%b=0.0E0
+ x=a%b
+ END
diff --git a/gcc/testsuite/gfortran.dg/trans-mem-skel.f90 b/gcc/testsuite/gfortran.dg/trans-mem-skel.f90
new file mode 100644
index 00000000000..7e56fadbdbc
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/trans-mem-skel.f90
@@ -0,0 +1,5 @@
+! { dg-do compile }
+! { dg-options "-fgnu-tm" }
+program foo
+ real x
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/type_to_class_1.f03 b/gcc/testsuite/gfortran.dg/type_to_class_1.f03
new file mode 100644
index 00000000000..173ca3635eb
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/type_to_class_1.f03
@@ -0,0 +1,65 @@
+! { dg-do run }
+!
+! Passing TYPE to CLASS
+!
+implicit none
+type t
+ integer :: A
+ real, allocatable :: B(:)
+end type t
+
+type(t), allocatable :: x(:)
+type(t) :: y(10)
+integer :: i
+
+allocate(x(10))
+if (size (x) /= 10) call abort ()
+x = [(t(a=-i, B=[1*i,2*i,3*i,4*i]), i = 1, 10)]
+do i = 1, 10
+ if (x(i)%a /= -i .or. size (x(i)%b) /= 4 &
+ .or. any (x(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+end do
+
+y = x ! TODO: Segfaults in runtime without 'y' being set
+
+call class(x)
+call classExplicit(x, size(x))
+call class(y)
+call classExplicit(y, size(y))
+
+contains
+ subroutine class(z)
+ class(t), intent(in) :: z(:)
+ select type(z)
+ type is(t)
+ if (size (z) /= 10) call abort ()
+ do i = 1, 10
+ if (z(i)%a /= -i .or. size (z(i)%b) /= 4 &
+ .or. any (z(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ end do
+ class default
+ call abort()
+ end select
+ end subroutine class
+ subroutine classExplicit(u, n)
+ integer, intent(in) :: n
+ class(t), intent(in) :: u(n)
+ select type(u)
+ type is(t)
+ if (size (u) /= 10) call abort ()
+ do i = 1, 10
+ if (u(i)%a /= -i .or. size (u(i)%b) /= 4 &
+ .or. any (u(i)%b /= [1*i,2*i,3*i,4*i])) then
+ call abort()
+ end if
+ end do
+ class default
+ call abort()
+ end select
+ end subroutine classExplicit
+end
+
diff --git a/gcc/testsuite/gfortran.dg/typebound_assignment_3.f03 b/gcc/testsuite/gfortran.dg/typebound_assignment_3.f03
index ce84a3957d0..2001589a9ca 100644
--- a/gcc/testsuite/gfortran.dg/typebound_assignment_3.f03
+++ b/gcc/testsuite/gfortran.dg/typebound_assignment_3.f03
@@ -24,7 +24,7 @@ end module
use foo
type (bar) :: foobar(2)
- foobar = bar() ! { dg-error "currently not implemented" }
+ foobar = bar() ! There was a not-implemented error here
end
! { dg-final { cleanup-modules "foo" } }
diff --git a/gcc/testsuite/gfortran.dg/warn_function_without_result_2.f90 b/gcc/testsuite/gfortran.dg/warn_function_without_result_2.f90
new file mode 100644
index 00000000000..25fd0b73a75
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/warn_function_without_result_2.f90
@@ -0,0 +1,19 @@
+! { dg-do compile }
+! { dg-options "-Wall" }
+!
+! PR fortran/50923
+!
+module m
+contains
+ integer pure function f() ! { dg-warning "Return value of function 'f' at .1. not set" }
+ end function f
+ integer pure function g() result(h) ! { dg-warning "Return value 'h' of function 'g' declared at .1. not set" }
+ end function g
+ integer pure function i()
+ i = 7
+ end function i
+ integer pure function j() result(k)
+ k = 8
+ end function j
+end module m
+! { dg-final { cleanup-modules "mod" } }
diff --git a/gcc/testsuite/gnat.dg/specs/elab3.ads b/gcc/testsuite/gnat.dg/specs/elab3.ads
new file mode 100644
index 00000000000..7af6f386d1f
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/elab3.ads
@@ -0,0 +1,16 @@
+-- { dg-do compile }
+
+pragma Restrictions(No_Elaboration_Code);
+
+package Elab3 is
+
+ type T_List is array (Positive range <>) of Integer;
+ type T_List_Access is access constant T_List;
+
+ type R is record
+ A : T_List_Access;
+ end record;
+
+ C : constant R := (A => null);
+
+end Elab3;
diff --git a/gcc/testsuite/go.test/test/assign.go b/gcc/testsuite/go.test/test/assign.go
index 59471388c06..2192f9ede08 100644
--- a/gcc/testsuite/go.test/test/assign.go
+++ b/gcc/testsuite/go.test/test/assign.go
@@ -16,38 +16,38 @@ type T struct {
func main() {
{
var x, y sync.Mutex
- x = y // ERROR "assignment.*Mutex"
+ x = y // ok
_ = x
}
{
var x, y T
- x = y // ERROR "assignment.*Mutex"
+ x = y // ok
_ = x
}
{
var x, y [2]sync.Mutex
- x = y // ERROR "assignment.*Mutex"
+ x = y // ok
_ = x
}
{
var x, y [2]T
- x = y // ERROR "assignment.*Mutex"
+ x = y // ok
_ = x
}
{
- x := sync.Mutex{0, 0} // ERROR "assignment.*Mutex"
+ x := sync.Mutex{0, 0} // ERROR "assignment.*Mutex"
_ = x
}
{
- x := sync.Mutex{key: 0} // ERROR "(unknown|assignment).*Mutex"
+ x := sync.Mutex{key: 0} // ERROR "(unknown|assignment).*Mutex"
_ = x
}
{
- x := &sync.Mutex{} // ok
- var y sync.Mutex // ok
- y = *x // ERROR "assignment.*Mutex"
- *x = y // ERROR "assignment.*Mutex"
+ x := &sync.Mutex{} // ok
+ var y sync.Mutex // ok
+ y = *x // ok
+ *x = y // ok
_ = x
_ = y
- }
+ }
}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/x.go b/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/x.go
deleted file mode 100644
index 64d7a29e7e1..00000000000
--- a/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/x.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package x
-
-type T struct { x, Y int }
-
-func (t T) M()
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/y.go b/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/y.go
deleted file mode 100644
index c66d592b7c0..00000000000
--- a/gcc/testsuite/go.test/test/fixedbugs/bug226.dir/y.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package y
-
-import "./x"
-
-func f() {
- ok := new(x.T);
- var ok1 x.T;
- ok2 := &ok1;
- ok3 := &x.T{};
- ok4 := &x.T{Y:2};
- _ = x.T{};
- _ = x.T{Y:2};
-
- ok1.M();
- bad1 := *ok; // ERROR "assignment.*T"
- bad2 := ok1; // ERROR "assignment.*T"
- *ok4 = ok1; // ERROR "assignment.*T"
- *ok4 = *ok2; // ERROR "assignment.*T"
- ok1 = *ok4; // ERROR "assignment.*T"
- _ = bad1;
- _ = bad2;
- _ = ok4;
- _ = ok3;
- _ = ok2;
- _ = ok1;
- _ = ok;
-}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug226.go b/gcc/testsuite/go.test/test/fixedbugs/bug226.go
deleted file mode 100644
index 5457a64bc11..00000000000
--- a/gcc/testsuite/go.test/test/fixedbugs/bug226.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// $G $D/$F.dir/x.go && errchk $G $D/$F.dir/y.go
-
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-ignored
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug310.go b/gcc/testsuite/go.test/test/fixedbugs/bug310.go
deleted file mode 100644
index 191f3ed2b4e..00000000000
--- a/gcc/testsuite/go.test/test/fixedbugs/bug310.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// errchk $G $D/$F.go
-
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package p
-
-import (
- "bytes"
- "fmt"
-)
-
-type t int
-
-func main() {
- _ = t.bar // ERROR "no method"
- var b bytes.Buffer
- fmt.Print(b) // ERROR "implicit assignment"
-}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug359.go b/gcc/testsuite/go.test/test/fixedbugs/bug359.go
deleted file mode 100644
index 3701499ed20..00000000000
--- a/gcc/testsuite/go.test/test/fixedbugs/bug359.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// errchk $G $D/$F.go
-
-// Copyright 2011 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// issue 1910
-// error on wrong line
-
-package main
-
-import "container/list"
-
-type Painting struct {
- fragments list.List // private
-}
-
-func (p Painting) Foo() {
- for e := p.fragments; e.Front() != nil; { // ERROR "unexported field|hidden field"
- }
-}
-
-// from comment 4 of issue 1910
-type Foo interface {
- Run(a int) (a int) // ERROR "a redeclared|redefinition|previous"
-}