diff options
Diffstat (limited to 'gcc/testsuite')
189 files changed, 3946 insertions, 146 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3095cffa11d..e35854179d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,519 @@ +2013-12-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59355 + * g++.dg/ipa/pr59355.C: New test. + +2013-12-04 Yufeng Zhang <yufeng.zhang@arm.com> + + * gcc.dg/tree-ssa/slsr-39.c: Update. + * gcc.dg/tree-ssa/slsr-41.c: New test. + +2013-12-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com> + + * gcc.target/powerpc/pr57363.c: New test. + +2013-12-03 Wei Mi <wmi@google.com> + + PR rtl-optimization/59020 + * testsuite/gcc.dg/pr59020.c: New. + * testsuite/gcc.dg/macro-fusion-1.c: New. + * testsuite/gcc.dg/macro-fusion-2.c: New. + +2013-12-03 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/59063 + * lib/asan-dg.exp: Don't add anything to flags if libsanitizer + has not been found. + * lib/ubsan-dg.exp: Likewise. Append to flags also + -B${gccpath}/libsanitizer/. + +2013-12-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: Skip for little + endian. + +2013-12-03 H.J. Lu <hongjiu.lu@intel.com> + + PR target/59363 + * gcc.target/i386/pr59363.c: New file. + +2013-12-03 Marek Polacek <polacek@redhat.com> + + PR c/59351 + * gcc.dg/pr59351.c: New test. + +2013-12-03 Chung-Ju Wu <jasonwucj@gmail.com> + + * gcc.dg/20020312-2.c: Add __nds32__ case. + * gcc.dg/builtin-apply2.c: Skip for nds32*-*-*. + * gcc.dg/sibcall-3.c: Expected fail for nds32*-*-*. + * gcc.dg/sibcall-4.c: Expected fail for nds32*-*-*. + * gcc.dg/stack-usage-1.c (SIZE): Define case for __nds32__. + * gcc.dg/torture/pr37868.c: Skip for nds32*-*-*. + * gcc.dg/torture/stackalign/builtin-apply-2.c: Skip for nds32*-*-*. + * gcc.dg/tree-ssa/20040204-1.c: Expected fail for nds32*-*-*. + * gcc.dg/tree-ssa/pr42585.c: Skip for nds32*-*-*. + * gcc.dg/tree-ssa/sra-12.c: Skip for nds32*-*-*. + * gcc.target/nds32: New nds32 specific directory and testcases. + * lib/target-supports.exp (check_profiling_available): Check for + nds32*-*-elf. + +2013-12-03 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59362 + * gcc.c-torture/compile/pr59362.c: New test. + + PR middle-end/59011 + * gcc.dg/pr59011.c: New test. + + PR target/58864 + * g++.dg/opt/pr58864.C: New test. + +2013-12-02 Jeff Law <law@redhat.com> + + PR tree-optimization/59322 + * gcc.c-torture/compile/pr59322.c: New test. + +2013-12-02 Sriraman Tallam <tmsriram@google.com> + + PR target/58944 + * testsuite/gcc.target/i386/pr58944.c: New test. + +2013-12-02 Joseph Myers <joseph@codesourcery.com> + + PR c/58235 + * gcc.dg/c90-array-lval-8.c: New test. + +2013-12-02 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59358 + * gcc.c-torture/execute/pr59358.c: New test. + + PR lto/59326 + * gcc.target/i386/i386.exp (check_effective_target_avx2): Move to... + * lib/target-supports.exp (check_effective_target_avx2): ... here. + (check_effective_target_vect_simd_clones): New. + * gcc.dg/vect/vect-simd-clone-1.c: Add dg-require-effective-target + vect_simd_clones. + * gcc.dg/vect/vect-simd-clone-2.c: Likewise. + * gcc.dg/vect/vect-simd-clone-3.c: Likewise. + * gcc.dg/vect/vect-simd-clone-4.c: Likewise. + * gcc.dg/vect/vect-simd-clone-5.c: Likewise. + * gcc.dg/vect/vect-simd-clone-6.c: Likewise. + * gcc.dg/vect/vect-simd-clone-7.c: Likewise. + * gcc.dg/vect/vect-simd-clone-8.c: Likewise. + * gcc.dg/vect/vect-simd-clone-9.c: Likewise. + * gcc.dg/vect/vect-simd-clone-10.c: Likewise. + * gcc.dg/vect/vect-simd-clone-11.c: Likewise. + * gcc.dg/vect/vect-simd-clone-12.c: Likewise. + +2013-12-02 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * gcc.dg/pr56997-4.c: New testcase. + +2013-12-02 Marek Polacek <polacek@redhat.com> + + * c-c++-common/ubsan/vla-1.c: Split the tests into individual + functions. + +2013-12-02 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59139 + * gcc.dg/torture/pr59139.c: New testcase. + +2013-12-02 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt30.adb: New test. + +2013-12-01 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/57354 + * gfortran.dg/realloc_on_assign_23.f90 : New test + +2013-12-01 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/34547 + * gfortran.dg/null_5.f90 : Include new error. + * gfortran.dg/null_6.f90 : Include new error. + +2013-11-29 Marek Polacek <polacek@redhat.com> + + PR sanitizer/59331 + * g++.dg/ubsan/pr59331.C: New test. + * g++.dg/ubsan/cxx1y-vla.C: Enable -Wall -Wno-unused-variable. + Disable the -w option. + * c-c++-common/ubsan/vla-1.c: Likewise. + * c-c++-common/ubsan/vla-2.c: Likewise. + * c-c++-common/ubsan/vla-3.c: Don't use the -w option. + +2013-11-29 Joseph Myers <joseph@codesourcery.com> + + PR c/42262 + * gcc.dg/c99-init-5.c, gcc.dg/c99-init-6.c: New tests. + +2013-11-29 H.J. Lu <hongjiu.lu@intel.com> + + * lib/asan-dg.exp (asan_link_flags): Properly add path to + libsanitizer.spec to cflags. + +2013-11-29 Richard Biener <rguenther@suse.de> + + PR middle-end/59208 + * g++.dg/torture/pr59208.C: New testcase. + +2013-11-29 Jakub Jelinek <jakub@redhat.com> + Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/59063 + * c-c++-common/asan/pr59063-1.c: New test. + * c-c++-common/asan/pr59063-2.c: Likewise. + * lib/asan-dg.exp: Add path to libsanitizer.spec to cflags. + * lib/ubsan-dg.exp: Likewise. + +2013-11-29 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt29.ad[sb]: New test. + +2013-11-29 Richard Biener <rguenther@suse.de> + + PR middle-end/59338 + * gcc.dg/torture/pr59338.c: New testcase. + +2013-11-29 Jakub Jelinek <jakub@redhat.com> + + PR lto/59326 + * gcc.dg/vect/vect-simd-clone-12.c: New test. + * gcc.dg/vect/vect-simd-clone-12a.c: New test. + * gcc.dg/vect/vect-simd-clone-10a.c: Remove extern keywords. + + PR c/59280 + * c-c++-common/pr59280.c: New test. + +2013-11-29 Zhenqiang Chen <zhenqiang.chen@linaro.org> + + * gcc.target/arm/lp1243022.c: Skip target arm-neon. + +2013-11-29 Joseph Myers <joseph@codesourcery.com> + + PR c/57574 + * gcc.dg/inline-35.c: New test. + +2013-11-28 Jakub Jelinek <jakub@redhat.com> + + PR c++/59297 + * g++.dg/gomp/pr59297.C: New test. + +2013-11-28 Vladimir Makarov <vmakarov@redhat.com> + + PR target/57293 + * gcc.target/i386/pr57293.c: New. + +2013-11-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/arm/vrinta-ce.c: New testcase. + +2013-11-28 Richard Biener <rguenther@suse.de> + + PR lto/59323 + * gcc.dg/lto/pr59323-2_0.c: New testcase. + +2013-11-28 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59330 + * gcc.dg/torture/pr59330.c: New testcase. + +2013-11-28 Richard Biener <rguenther@suse.de> + + PR lto/59323 + * gcc.dg/lto/pr59323_0.c: New testcase. + +2013-11-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/57393 + PR tree-optimization/58018 + PR tree-optimization/58131 + * gcc.dg/torture/pr57393-1.c: New test. + * gcc.dg/torture/pr57393-2.c: New test. + * gcc.dg/torture/pr57393-3.c: New test. + * gcc.dg/torture/pr58018.c: New test. + * gcc.dg/torture/pr58131.c: New test. + * gfortran.dg/pr57393-1.f90: New test. + * gfortran.dg/pr57393-2.f90: New test. + +2013-11-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gfortran.dg/nan_7.f90: Disable for little endian PowerPC. + +2013-11-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/guality/param-3.c: New test. + +2013-11-27 Uros Bizjak <ubizjak@gmail.com> + Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> + + PR target/56788 + * gcc.target/i386/xop-frczX.c: New test. + +2013-11-27 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59014 + * gcc.c-torture/execute/pr59014-2.c: New test. + +2013-11-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58647 + * g++.dg/parse/crash66.C: New. + +2013-11-27 Kenneth Zadeck <zadeck@naturalbridge.com> + + * gcc.dg/c90-const-expr-8.c: Look for overflow on INT_MIN % -1. + * gcc.dg/c99-const-expr-8.c: Look for overflow on INT_MIN % -1. + +2013-11-27 Marek Polacek <polacek@redhat.com> + + PR sanitizer/59306 + * g++.dg/ubsan/pr59306.C: New test. + +2013-11-27 Aldy Hernandez <aldyh@redhat.com> + Jakub Jelinek <jakub@redhat.com> + + * g++.dg/gomp/declare-simd-1.C (f38): Make sure + simdlen is a power of two. + * gcc.dg/gomp/simd-clones-2.c: Compile on all targets. + Remove -msse2. Adjust regexps for name mangling changes. + * gcc.dg/gomp/simd-clones-3.c: Likewise. + * gcc.dg/vect/vect-simd-clone-1.c: New test. + * gcc.dg/vect/vect-simd-clone-2.c: New test. + * gcc.dg/vect/vect-simd-clone-3.c: New test. + * gcc.dg/vect/vect-simd-clone-4.c: New test. + * gcc.dg/vect/vect-simd-clone-5.c: New test. + * gcc.dg/vect/vect-simd-clone-6.c: New test. + * gcc.dg/vect/vect-simd-clone-7.c: New test. + * gcc.dg/vect/vect-simd-clone-8.c: New test. + * gcc.dg/vect/vect-simd-clone-9.c: New test. + * gcc.dg/vect/vect-simd-clone-10.c: New test. + * gcc.dg/vect/vect-simd-clone-10.h: New file. + * gcc.dg/vect/vect-simd-clone-10a.c: New file. + * gcc.dg/vect/vect-simd-clone-11.c: New test. + +2013-11-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.dg/cilk-plus/cilk-plus.exp: Append to ld_library_path. + Call set_ld_library_path_env_vars. + * g++.dg/cilk-plus/cilk-plus.exp: Likewise. + +2013-11-27 Tom de Vries <tom@codesourcery.com> + Marc Glisse <marc.glisse@inria.fr> + + PR c++/59032 + * c-c++-common/pr59032.c: New testcase. + +2013-11-27 Tom de Vries <tom@codesourcery.com> + Marc Glisse <marc.glisse@inria.fr> + + PR middle-end/59037 + * c-c++-common/pr59037.c: New testcase. + +2013-11-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20131127-1.c: New test. + +2013-11-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59288 + * gcc.dg/torture/pr59288.c: New testcase. + +2013-11-27 Marek Polacek <polacek@redhat.com> + + * c-c++-common/ubsan/undefined-1.c: New test. + +2013-11-26 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59014 + * gcc.c-torture/execute/pr59014.c: New test. + + PR target/59229 + * gcc.c-torture/execute/pr59229.c: New test. + + PR rtl-optimization/59166 + * gcc.dg/torture/pr59166.c: New test. + + PR c++/58874 + * g++.dg/gomp/pr58874.C: New test. + + PR middle-end/59150 + * g++.dg/gomp/pr59150.C: New test. + + PR middle-end/59152 + * c-c++-common/gomp/pr59152.c: New test. + +2013-11-26 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/gomp/openmp-simd-1.c: Cleanup original tree dump. + * gcc.dg/gomp/openmp-simd-2.c: Ditto. + * g++.dg/gomp/openmp-simd-1.C: Ditto. + * g++.dg/gomp/openmp-simd-2.C: Ditto. + * gfortran.dg/c_loc_test_22.f90: Ditto. + * gcc.dg/tree-ssa/attr-alias-2.c: Cleanup optimized tree dump. + * gcc.dg/tree-ssa/isolate-5.c: Ditto. + * gcc.dg/tree-ssa/pr57361.c: Cleanup dse1 tree dump. + * gcc.dg/vect/vect-124.c: Cleanup vect tree dump. + * gcc.dg/pr57518.c: Cleanup ira rtl dump. + * gcc.dg/tree-prof/cold_partition_label.c: Cleanup saved temps. + +2013-11-26 Yufeng Zhang <yufeng.zhang@arm.com> + + * gcc.target/arm/20131120.c: New test. + +2013-11-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59245 + * gcc.dg/torture/pr59245.c: New testcase. + +2013-11-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/59290 + * gcc.target/arm/negdi-2.c: Scan more general register names. + +2013-11-26 Terry Guo <terry.guo@arm.com> + + * gcc.target/arm/thumb1-pic-high-reg.c: New case. + * gcc.target/arm/thumb1-pic-single-base.c: New case. + +2013-11-26 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58700 + * g++.dg/parse/bitfield4.C: New. + +2013-11-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59287 + * gcc.dg/tree-ssa/alias-29.c: New testcase. + +2013-11-25 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/54485 + * g++.dg/other/default8.C: New. + * g++.dg/tc1/dr217.C: Remove xfail. + * g++.dg/other/default5.C: Adjust. + * g++.old-deja/g++.mike/p1989.C: Likewise. + +2013-11-25 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58607 + * g++.dg/cpp0x/constexpr-ice9.C: New. + +2013-11-25 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/58810 + * g++.dg/other/cv_func3.C: New. + * g++.dg/other/cv_func.C: Adjust. + * g++.dg/parse/fn-typedef2.C: Likewise. + +2013-11-25 Marek Polacek <polacek@redhat.com> + + PR sanitizer/59250 + * g++.dg/ubsan/pr59250.C: New test. + +2013-11-25 Janus Weil <janus@gcc.gnu.org> + + PR fortran/59143 + * gfortran.dg/typebound_proc_30.f90: New. + +2013-11-25 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/59080 + * g++.dg/cpp0x/initlist75.C: New. + + PR c++/59096 + * g++.dg/cpp0x/gen-attrs-57.C: New. + +2013-11-25 Adam Butcher <adam@jessamine.co.uk> + + PR c++/59112 + PR c++/59113 + * g++.dg/cpp1y/pr58533.C: Updated testcase. + * g++.dg/cpp1y/pr59112.C: New testcase. + * g++.dg/cpp1y/pr59113.C: New testcase. + +2013-11-25 Terry Guo <terry.guo@arm.com> + + * gcc.target/arm/thumb2-slow-flash-data.c: New. + +2013-11-23 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/float-exact-1.c: Use dg-add-options ieee. + [LDBL_MANT_DIG == 113]: Fix wrong variable name. + +2013-11-23 Janus Weil <janus@gcc.gnu.org> + + PR fortran/59228 + * gfortran.dg/asynchronous_4.f90: New. + +2013-11-22 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/asan/no-redundant-instrumentation-7.c: Fix + cleanup-tree-dump directive. + +2013-11-22 Jan Hubicka <jh@suse.cz> + + * gcc.dg/20081223-1.c: Add -ffat-lto-objects. + * gcc.dg/vect/vect.exp: Add -ffat-lto-objects. + +2013-11-22 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/ubsan/return-1.C: New test. + * g++.dg/ubsan/return-2.C: New test. + + * c-c++-common/asan/no-redundant-instrumentation-1.c: Tweak to avoid + optimizing away some __asan_report* calls. + +2013-11-22 Martin Jambor <mjambor@suse.cz> + + * gcc.dg/pr10474.c: Also test ppc64. + * gcc.dg/ira-shrinkwrap-prep-1.c: Also test ppc64, change all ints + to longs. + * gcc.dg/ira-shrinkwrap-prep-2.c: Likewise. + +2013-11-22 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/59054 + * gcc.target/powerpc/direct-move.h (VSX_REG_ATTR): Allow test to + specify an appropriate register class for VSX operations. + (load_vsx): Use it. + (load_gpr_to_vsx): Likewise. + (load_vsx_to_gpr): Likewise. + * gcc.target/powerpc/direct-move-vint1.c: Use an appropriate + register class for VSX registers that the type can handle. Remove + checks for explicit number of instructions generated, just check + if the instruction is generated. + * gcc.target/powerpc/direct-move-vint2.c: Likewise. + * gcc.target/powerpc/direct-move-float1.c: Likewise. + * gcc.target/powerpc/direct-move-float2.c: Likewise. + * gcc.target/powerpc/direct-move-double1.c: Likewise. + * gcc.target/powerpc/direct-move-double2.c: Likewise. + * gcc.target/powerpc/direct-move-long1.c: Likewise. + * gcc.target/powerpc/direct-move-long2.c: Likewise. + + * gcc.target/powerpc/pr59054.c: Remove duplicate code. + + * gcc.target/powerpc/bool3-av.c: Limit to 64-bit mode for now. + * gcc.target/powerpc/bool3-p7.c: Likewise. + * gcc.target/powerpc/bool3-p8.c: Likewise. + + * gcc.target/powerpc/p8vector-ldst.c: Just check that the + appropriate instructions are generated, don't check the count. + +2013-11-22 Richard Earnshaw <rearnsha@arm.com> + + PR target/59216 + * gcc.target/arm/negdi-4.c: Delete invalid test. + * gcc.dg/torture/pr59216.c: New test. + +2013-11-22 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/aarch64/vmov_n_1.c: New testcase. + 2013-11-22 Richard Biener <rguenther@suse.de> * gcc.dg/torture/20131122-0.c: New testcase. diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c index 6cf644195d6..fa52e0ca85d 100644 --- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c +++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c @@ -6,7 +6,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ -static char tab[4] = {0}; +extern char tab[4]; static int test0 () @@ -27,12 +27,14 @@ test0 () return t0 + t1; } -static int -test1 () +__attribute__((noinline, noclone)) static int +test1 (int i) { + char foo[4] = {}; + /*__builtin___asan_report_store1 called 1 time here to instrument the initialization. */ - char foo[4] = {1}; + foo[i] = 1; /*__builtin___asan_report_store1 called 2 times here to instrument the store to the memory region of tab. */ @@ -45,7 +47,7 @@ test1 () /* There are 2 calls to __builtin___asan_report_store1 and 2 calls to __builtin___asan_report_load1 to instrument the store to (subset of) the memory region of tab. */ - __builtin_memcpy (&tab[1], foo, 3); + __builtin_memcpy (&tab[1], foo + i, 3); /* This should not generate a __builtin___asan_report_load1 because the reference to tab[1] has been already instrumented above. */ @@ -58,7 +60,7 @@ test1 () int main () { - return test0 () && test1 (); + return test0 () && test1 (0); } /* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 7 "asan0" } } */ diff --git a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c index 075e9cfb868..bf40a037679 100644 --- a/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c +++ b/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c @@ -20,4 +20,4 @@ foo (int *a, char *b, char *c) /* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 6 "asan0" } } */ /* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan" } } */ +/* { dg-final { cleanup-tree-dump "asan0" } } */ diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-1.c b/gcc/testsuite/c-c++-common/asan/pr59063-1.c new file mode 100644 index 00000000000..a4e01f76f3a --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pr59063-1.c @@ -0,0 +1,11 @@ +/* { dg-do run } */ + +#include <time.h> +static int weak_gettime (clockid_t clk_id, struct timespec *tp) + __attribute__((__weakref__("clock_gettime"))); +int main() { + if (!clock_gettime) + return 0; + struct timespec ts; + return weak_gettime(CLOCK_MONOTONIC, &ts); +} diff --git a/gcc/testsuite/c-c++-common/asan/pr59063-2.c b/gcc/testsuite/c-c++-common/asan/pr59063-2.c new file mode 100644 index 00000000000..64354ea7831 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/pr59063-2.c @@ -0,0 +1,12 @@ +/* { dg-do run } */ +/* { dg-options "-static-libasan" } */ + +#include <time.h> +static int weak_gettime (clockid_t clk_id, struct timespec *tp) + __attribute__((__weakref__("clock_gettime"))); +int main() { + if (!clock_gettime) + return 0; + struct timespec ts; + return weak_gettime(CLOCK_MONOTONIC, &ts); +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr59152.c b/gcc/testsuite/c-c++-common/gomp/pr59152.c new file mode 100644 index 00000000000..bcccb1be349 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr59152.c @@ -0,0 +1,40 @@ +/* PR middle-end/59152 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fipa-pure-const" } */ + +extern int b[]; +void +foo (void) +{ + unsigned long v1, v2, v3; + #pragma omp parallel for schedule(static, 32) collapse(3) + for (v1 = 0; v1 < 20; v1 += 2) + for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3) + for (v3 = 10; v3 > 0; v3--) + #pragma omp atomic + b[v3]++; +} + +void +bar (void) +{ + unsigned long v1, v2, v3; + #pragma omp parallel for schedule(static) collapse(3) + for (v1 = 0; v1 < 20; v1 += 2) + for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3) + for (v3 = 10; v3 > 0; v3--) + #pragma omp atomic + b[v3]++; +} + +void +baz (void) +{ + unsigned long v1, v2, v3; + #pragma omp parallel for schedule(runtime) collapse(3) + for (v1 = 0; v1 < 20; v1 += 2) + for (v2 = __LONG_MAX__; v2 > __LONG_MAX__ - 30; v2 -= 3) + for (v3 = 10; v3 > 0; v3--) + #pragma omp atomic + b[v3]++; +} diff --git a/gcc/testsuite/c-c++-common/pr59032.c b/gcc/testsuite/c-c++-common/pr59032.c new file mode 100644 index 00000000000..327f5aeb6bc --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr59032.c @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo() +{ + float v __attribute__((vector_size(8))); + v++; +} + +void +foo2 () +{ + float v __attribute__((vector_size(8))); + ++v; +} + +void +foo3 () +{ + float v __attribute__((vector_size(8))); + v--; +} + +void +foo4 () +{ + float v __attribute__((vector_size(8))); + --v; +} diff --git a/gcc/testsuite/c-c++-common/pr59037.c b/gcc/testsuite/c-c++-common/pr59037.c new file mode 100644 index 00000000000..fae13c2fa94 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr59037.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef int v4si __attribute__ ((vector_size (16))); + +int +main (int argc, char** argv) +{ + v4si x = {0,1,2,3}; + x = (v4si) {(x)[3], (x)[2], (x)[1], (x)[0]}; + return x[4]; +} diff --git a/gcc/testsuite/c-c++-common/pr59280.c b/gcc/testsuite/c-c++-common/pr59280.c new file mode 100644 index 00000000000..779f0fb858f --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr59280.c @@ -0,0 +1,4 @@ +/* PR c/59280 */ +/* { dg-do compile } */ + +void bar (char *) __attribute__((constructor(foo))); /* { dg-error "constructor priorities must be integers|was not declared|constructor priorities are not supported" } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/undefined-1.c b/gcc/testsuite/c-c++-common/ubsan/undefined-1.c new file mode 100644 index 00000000000..1229b711fe9 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/undefined-1.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined" } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ + +int +foo (int x, int y) +{ + const int z = 2; + if (z & 1) + return x << y; + return 0; +} + +int +bar (int x, int y) +{ + return x + y; +} + +int +main (void) +{ + foo (3, 2); + bar (12, 42); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-1.c b/gcc/testsuite/c-c++-common/ubsan/vla-1.c index 6c1d81e9d22..ca538ed8693 100644 --- a/gcc/testsuite/c-c++-common/ubsan/vla-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/vla-1.c @@ -1,33 +1,104 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -w" } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */ -static int +typedef long int V; +int x = -1; +double di = -3.2; +V v = -6; + +static int __attribute__ ((noinline, noclone)) bar (void) { - return -42; + return -4; } -typedef long int V; -int -main (void) +static void __attribute__ ((noinline, noclone)) +fn1 (void) { - int x = -1; - double di = -3.2; - V v = -666; - int a[x]; - int aa[x][x]; - int aaa[x][x][x]; +} + +static void __attribute__ ((noinline, noclone)) +fn2 (void) +{ + int a[x][x]; +} + +static void __attribute__ ((noinline, noclone)) +fn3 (void) +{ + int a[x][x][x]; +} + +static void __attribute__ ((noinline, noclone)) +fn4 (void) +{ int b[x - 4]; +} + +static void __attribute__ ((noinline, noclone)) +fn5 (void) +{ int c[(int) di]; +} + +static void __attribute__ ((noinline, noclone)) +fn6 (void) +{ int d[1 + x]; +} + +static void __attribute__ ((noinline, noclone)) +fn7 (void) +{ int e[1 ? x : -1]; +} + +static void __attribute__ ((noinline, noclone)) +fn8 (void) +{ int f[++x]; +} + +static void __attribute__ ((noinline, noclone)) +fn9 (void) +{ int g[(signed char) --x]; +} + +static void __attribute__ ((noinline, noclone)) +fn10 (void) +{ int h[(++x, --x, x)]; +} + +static void __attribute__ ((noinline, noclone)) +fn11 (void) +{ int i[v]; +} + +static void __attribute__ ((noinline, noclone)) +fn12 (void) +{ int j[bar ()]; +} +int +main (void) +{ + fn1 (); + fn2 (); + fn3 (); + fn4 (); + fn5 (); + fn6 (); + fn7 (); + fn8 (); + fn9 (); + fn10 (); + fn11 (); + fn12 (); return 0; } @@ -44,5 +115,5 @@ main (void) /* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value 0(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */ /* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -1(\n|\r\n|\r)" } */ -/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -666(\n|\r\n|\r)" } */ -/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -42(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -6(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*variable length array bound evaluates to non-positive value -4(\n|\r\n|\r)" } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-2.c b/gcc/testsuite/c-c++-common/ubsan/vla-2.c index 2fbeb7113b8..c62ced91348 100644 --- a/gcc/testsuite/c-c++-common/ubsan/vla-2.c +++ b/gcc/testsuite/c-c++-common/ubsan/vla-2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -w" } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */ int main (void) diff --git a/gcc/testsuite/c-c++-common/ubsan/vla-3.c b/gcc/testsuite/c-c++-common/ubsan/vla-3.c index 20dd38b79a7..5e10af0b593 100644 --- a/gcc/testsuite/c-c++-common/ubsan/vla-3.c +++ b/gcc/testsuite/c-c++-common/ubsan/vla-3.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -w" } */ +/* { dg-options "-fsanitize=vla-bound" } */ /* Don't instrument the arrays here. */ int diff --git a/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp b/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp index a66ec44f297..707d17ec5e4 100644 --- a/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp +++ b/gcc/testsuite/g++.dg/cilk-plus/cilk-plus.exp @@ -31,7 +31,8 @@ dg-finish set library_var [get_multilibs] # Pointing the ld_library_path to the Cilk Runtime library binaries. -set ld_library_path "${library_var}/libcilkrts/.libs" +append ld_library_path ":${library_var}/libcilkrts/.libs" +set_ld_library_path_env_vars global TEST_EXTRA_LIBS set TEST_EXTRA_LIBS "-L${library_var}/libcilkrts/.libs" diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C new file mode 100644 index 00000000000..50de3720b26 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ice9.C @@ -0,0 +1,7 @@ +// PR c++/58607 +// { dg-do compile { target c++11 } } + +struct A +{ + constexpr A() { i; } // { dg-error "declared|empty body" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C new file mode 100644 index 00000000000..12b4f4c84e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-57.C @@ -0,0 +1,9 @@ +// PR c++/59096 +// { dg-do compile { target c++11 } } + +template<typename T> struct A +{ + typedef T B [[mode]]; // { dg-warning "ignored" } +}; + +A<int>::B b; diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist75.C b/gcc/testsuite/g++.dg/cpp0x/initlist75.C new file mode 100644 index 00000000000..f185401c20a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist75.C @@ -0,0 +1,6 @@ +// PR c++/59080 +// { dg-require-effective-target c++11 } + +#include <initializer_list> + +auto foo[] = {}; // { dg-error "auto|unable to deduce" } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr58533.C b/gcc/testsuite/g++.dg/cpp1y/pr58533.C index e1855d78e08..9bcd7716697 100644 --- a/gcc/testsuite/g++.dg/cpp1y/pr58533.C +++ b/gcc/testsuite/g++.dg/cpp1y/pr58533.C @@ -3,5 +3,5 @@ void foo() { - void (*fp)(auto); // { dg-error "template" } + void (*fp)(auto); // { dg-error "auto|not permitted" } } diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59112.C b/gcc/testsuite/g++.dg/cpp1y/pr59112.C new file mode 100644 index 00000000000..e7326ac3113 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr59112.C @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-std=gnu++1y" } + +// PR c++/59112 + +void foo() +{ + struct A + { + A(auto) {} // { dg-error "auto|not permitted" } + }; +} diff --git a/gcc/testsuite/g++.dg/cpp1y/pr59113.C b/gcc/testsuite/g++.dg/cpp1y/pr59113.C new file mode 100644 index 00000000000..f909a76bd35 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr59113.C @@ -0,0 +1,11 @@ +// { dg-do compile } +// { dg-options "-std=gnu++1y" } + +// PR c++/59113 + +void foo() +{ + void bar(auto) {} // { dg-error "function-definition|auto|not permitted" } +} + +auto i = 0; diff --git a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C index e9be161948e..4b2812fb6e6 100644 --- a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C +++ b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C @@ -239,5 +239,5 @@ struct D void f38 (D &d) { - d.f37 <12> (6); + d.f37 <16> (6); } diff --git a/gcc/testsuite/g++.dg/gomp/openmp-simd-1.C b/gcc/testsuite/g++.dg/gomp/openmp-simd-1.C index fedb186fedf..e8e057a6166 100644 --- a/gcc/testsuite/g++.dg/gomp/openmp-simd-1.C +++ b/gcc/testsuite/g++.dg/gomp/openmp-simd-1.C @@ -44,3 +44,4 @@ void foo(int n, float *a, float *b) /* { dg-final { scan-tree-dump-not "omp teams" "original" } } */ /* { dg-final { scan-tree-dump-not "omp target" "original" } } */ /* { dg-final { scan-tree-dump-not "omp parallel" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/g++.dg/gomp/openmp-simd-2.C b/gcc/testsuite/g++.dg/gomp/openmp-simd-2.C index e31c1ebecf9..ad9b441f21d 100644 --- a/gcc/testsuite/g++.dg/gomp/openmp-simd-2.C +++ b/gcc/testsuite/g++.dg/gomp/openmp-simd-2.C @@ -42,3 +42,4 @@ void bar(int n, float *a, float *b) /* { dg-final { scan-tree-dump-times "pragma omp simd safelen\\(64\\)" 1 "original" } } */ /* { dg-final { scan-tree-dump-not "omp parallel" "original" } } */ /* { dg-final { scan-tree-dump-not "omp for" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/g++.dg/gomp/pr58874.C b/gcc/testsuite/g++.dg/gomp/pr58874.C new file mode 100644 index 00000000000..be3f53e4467 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr58874.C @@ -0,0 +1,14 @@ +// PR c++/58874 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct A +{ + template<int> struct B + { + #pragma omp declare reduction (x : int : omp_out |= omp_in) + }; +}; + +#pragma omp declare reduction (y : long : omp_out |= omp_in) \ + initializer (omp_priv = 0) diff --git a/gcc/testsuite/g++.dg/gomp/pr59150.C b/gcc/testsuite/g++.dg/gomp/pr59150.C new file mode 100644 index 00000000000..103edb64918 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr59150.C @@ -0,0 +1,25 @@ +// PR middle-end/59150 +// { dg-do compile } +// { dg-options "-O -fopenmp-simd -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" } + +#pragma omp declare reduction (foo: int: omp_out += omp_in) initializer (omp_priv = 0) + +int +foo () +{ + int i, v, &u = v; + #pragma omp simd reduction (foo:u) + for (i = 0; i < 1024; i++) + u = i; + return u; +} + +int +bar () +{ + int i, v, &u = v; + #pragma omp simd reduction (foo:u) safelen(1) + for (i = 0; i < 1024; i++) + u = i; + return u; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr59297.C b/gcc/testsuite/g++.dg/gomp/pr59297.C new file mode 100644 index 00000000000..330ed2e00b1 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr59297.C @@ -0,0 +1,25 @@ +// PR c++/59297 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template <typename T> +struct A +{ + ~A (); + const T &operator[] (int) const; +}; + +struct B +{ + int &operator () (A <int>); +}; + +void +foo (B &x, int &z) +{ + A<A<int> > y; + #pragma omp atomic + x (y[0]) += 1; + #pragma omp atomic + z += x(y[1]); +} diff --git a/gcc/testsuite/g++.dg/inherit/virtual11.C b/gcc/testsuite/g++.dg/inherit/virtual11.C new file mode 100644 index 00000000000..04c24129343 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/virtual11.C @@ -0,0 +1,17 @@ +// PR c++/59031 +// { dg-do compile } +// { dg-options "-fdump-tree-gimple " } +class B { + public: + virtual int add (int a, int b) {return a+ b;} +}; + +class D : public B { +}; + +int foo (int a, int b) { + D d; + return d.add(a, b); +} +// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "gimple" } } +// { dg-final { cleanup-tree-dump "gimple" } } diff --git a/gcc/testsuite/g++.dg/ipa/pr59355.C b/gcc/testsuite/g++.dg/ipa/pr59355.C new file mode 100644 index 00000000000..907c6d74501 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr59355.C @@ -0,0 +1,14 @@ +// PR tree-optimization/59355 +// { dg-do compile } +// { dg-options "-O2 -fno-devirtualize" } + +struct S +{ + virtual void bar (); +}; + +void +foo (S *s) +{ + s->bar (); +} diff --git a/gcc/testsuite/g++.dg/opt/pr58864.C b/gcc/testsuite/g++.dg/opt/pr58864.C new file mode 100644 index 00000000000..b8587f298a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr58864.C @@ -0,0 +1,21 @@ +// PR target/58864 +// { dg-do compile } +// { dg-options "-Os" } +// { dg-additional-options "-march=i686" { target { { i?86-*-* x86_64-*-* } && ia32 } } } + +struct A { A (); ~A (); }; +struct B { B (); }; + +float d, e; + +void +foo () +{ + A a; + float c = d; + while (1) + { + B b; + e = c ? -c : 0; + } +} diff --git a/gcc/testsuite/g++.dg/other/cv_func.C b/gcc/testsuite/g++.dg/other/cv_func.C index 941cb8d53d8..2eb9f039a5a 100644 --- a/gcc/testsuite/g++.dg/other/cv_func.C +++ b/gcc/testsuite/g++.dg/other/cv_func.C @@ -3,7 +3,7 @@ typedef int FIC(int) const; typedef int FI(int); -FIC f; // { dg-error "qualified" } +FIC f; // { dg-error "cv-qualifier" } struct S { FIC f; // OK diff --git a/gcc/testsuite/g++.dg/other/cv_func3.C b/gcc/testsuite/g++.dg/other/cv_func3.C new file mode 100644 index 00000000000..0fd47882f2a --- /dev/null +++ b/gcc/testsuite/g++.dg/other/cv_func3.C @@ -0,0 +1,10 @@ +// PR c++/58810 + +typedef int F() const; + +F f; // { dg-error "cv-qualifier" } + +struct A +{ + friend F f; // { dg-error "cv-qualifier" } +}; diff --git a/gcc/testsuite/g++.dg/other/default5.C b/gcc/testsuite/g++.dg/other/default5.C index d5bae344c44..87acb765e6d 100644 --- a/gcc/testsuite/g++.dg/other/default5.C +++ b/gcc/testsuite/g++.dg/other/default5.C @@ -43,5 +43,5 @@ template<int> struct B void F2(int, int, int = 0); }; -template<int N> void B<N>::F1(int, int = 0, int) {} -template<int N> void B<N>::F2(int = 0, int, int) {} // { dg-error "default" } +template<int N> void B<N>::F1(int, int = 0, int) {} // { dg-error "default arguments" } +template<int N> void B<N>::F2(int = 0, int, int) {} // { dg-error "default arguments|parameter 2" } diff --git a/gcc/testsuite/g++.dg/other/default8.C b/gcc/testsuite/g++.dg/other/default8.C new file mode 100644 index 00000000000..255a661356c --- /dev/null +++ b/gcc/testsuite/g++.dg/other/default8.C @@ -0,0 +1,43 @@ +// PR c++54485 + +template<typename T> +class K1 +{ + int fn(int, int); + int gn(int, int); +}; + +template<typename T> +int K1<T>::fn (int a, int b = 3) // { dg-error "default arguments" } +{ + return a - b; +} + +template<typename T> +int K1<T>::gn (int a = 1, int b = 3) // { dg-error "default arguments" } +{ + return a - b; +} + +template<typename T> +class K2 +{ + template<typename U> + int fn(int, int); + template<typename U> + int gn(int, int); +}; + +template<typename T> +template<typename U> +int K2<T>::fn (int a, int b = 3) // { dg-error "default arguments" } +{ + return a - b; +} + +template<typename T> +template<typename U> +int K2<T>::gn (int a = 1, int b = 3) // { dg-error "default arguments" } +{ + return a - b; +} diff --git a/gcc/testsuite/g++.dg/parse/bitfield4.C b/gcc/testsuite/g++.dg/parse/bitfield4.C new file mode 100644 index 00000000000..e10fa5f3342 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/bitfield4.C @@ -0,0 +1,6 @@ +// PR c++/58700 + +struct A +{ + static int : 4; // { dg-error "bit-field" } +}; diff --git a/gcc/testsuite/g++.dg/parse/crash66.C b/gcc/testsuite/g++.dg/parse/crash66.C new file mode 100644 index 00000000000..ceedd2be243 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash66.C @@ -0,0 +1,11 @@ +// PR c++/58647 + +struct A +{ + static void foo(); +}; + +template<typename> void bar() +{ + A().foo; +} diff --git a/gcc/testsuite/g++.dg/parse/fn-typedef2.C b/gcc/testsuite/g++.dg/parse/fn-typedef2.C index c9c7f060d01..6bb83024b9f 100644 --- a/gcc/testsuite/g++.dg/parse/fn-typedef2.C +++ b/gcc/testsuite/g++.dg/parse/fn-typedef2.C @@ -4,4 +4,4 @@ typedef void ft() const; typedef void V; typedef V ft() const; -ft f; // { dg-error "qualified" } +ft f; // { dg-error "cv-qualifier" } diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c index cdab74a19ae..be5a204c901 100644 --- a/gcc/testsuite/g++.dg/plugin/selfassign.c +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c @@ -11,6 +11,17 @@ #include "stringpool.h" #include "toplev.h" #include "basic-block.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "gimple-iterator.h" #include "tree.h" diff --git a/gcc/testsuite/g++.dg/tc1/dr217.C b/gcc/testsuite/g++.dg/tc1/dr217.C index cfa2803974d..099359b216a 100644 --- a/gcc/testsuite/g++.dg/tc1/dr217.C +++ b/gcc/testsuite/g++.dg/tc1/dr217.C @@ -10,5 +10,5 @@ struct S }; template <class T> -void S<T>::foo (int = 0) // { dg-error "" "default arguments for parameters of member functions of class templates can be specified in the initial declaration only" { xfail *-*-* } } +void S<T>::foo (int = 0) // { dg-error "" "default arguments for parameters of member functions of class templates can be specified in the initial declaration only" } { } diff --git a/gcc/testsuite/g++.dg/torture/pr59208.C b/gcc/testsuite/g++.dg/torture/pr59208.C new file mode 100644 index 00000000000..3dc110c55e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr59208.C @@ -0,0 +1,25 @@ +// { dg-do compile } +class A { +public: + A(); + A(int *); +}; +class B {}; +class C : B { +public: + virtual void m_fn1(); + void operator+=(int) { m_fn1(); } +}; +enum DebuggerType {}; +C a; +DebuggerType b; +void operator==(A &, const A &); +static A get_dbx_doc(A &p1) { p1 == 0; } + +void add_button() { + A c; + switch (b) + case 0: + get_dbx_doc(c); + a += 0; +} diff --git a/gcc/testsuite/g++.dg/ubsan/cxx1y-vla.C b/gcc/testsuite/g++.dg/ubsan/cxx1y-vla.C index 350db3f3473..7023c70cea0 100644 --- a/gcc/testsuite/g++.dg/ubsan/cxx1y-vla.C +++ b/gcc/testsuite/g++.dg/ubsan/cxx1y-vla.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-fsanitize=vla-bound -w -std=c++1y" } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable -std=c++1y" } */ /* { dg-shouldfail "ubsan" } */ int diff --git a/gcc/testsuite/g++.dg/ubsan/pr59250.C b/gcc/testsuite/g++.dg/ubsan/pr59250.C new file mode 100644 index 00000000000..48513068826 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr59250.C @@ -0,0 +1,19 @@ +// PR sanitizer/59250 +// { dg-do compile } +// { dg-options "-fsanitize=undefined" } +// { dg-skip-if "" { *-*-* } { "-flto" } { "" } } + +struct E { + int i; +}; + +struct S { + const char *s; + S (const char *); + static E *e; +}; + +S::S (const char *) : s (0) +{ + e = new E (); +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr59306.C b/gcc/testsuite/g++.dg/ubsan/pr59306.C new file mode 100644 index 00000000000..426e6a5bd5f --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr59306.C @@ -0,0 +1,14 @@ +// { dg-do compile } +// { dg-options "-fsanitize=undefined" } +// { dg-skip-if "" { *-*-* } { "-flto" } { "" } } + +class A { + void bar (void (A::*) (int)); + void foo (int); + void B (); +}; + +void A::B() +{ + bar (&A::foo); +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr59331.C b/gcc/testsuite/g++.dg/ubsan/pr59331.C new file mode 100644 index 00000000000..1bb3666efbf --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr59331.C @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=vla-bound -Wall -Wno-unused-variable" } */ + +void foo(int i) +{ + /* Don't warn here with "value computed is not used". */ + char a[i]; +} diff --git a/gcc/testsuite/g++.dg/ubsan/return-1.C b/gcc/testsuite/g++.dg/ubsan/return-1.C new file mode 100644 index 00000000000..43791b9e33f --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/return-1.C @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-options "-fsanitize=return" } +// { dg-shouldfail "ubsan" } + +struct S { S (); ~S (); }; + +S::S () {} +S::~S () {} + +int +foo (int x) +{ + S a; + { + S b; + if (x) + return 1; + } +} + +int +main () +{ + foo (0); +} + +// { dg-output "execution reached the end of a value-returning function without returning a value" } diff --git a/gcc/testsuite/g++.dg/ubsan/return-2.C b/gcc/testsuite/g++.dg/ubsan/return-2.C new file mode 100644 index 00000000000..c7380f03ed6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/return-2.C @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-fsanitize=return" } + +struct S { S (); ~S (); }; + +S::S () {} +S::~S () {} + +int +foo (int x) +{ + S a; + { + S b; + if (x) + return 1; + } +} + +int +main () +{ + foo (1); + foo (14); +} diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p1989.C b/gcc/testsuite/g++.old-deja/g++.mike/p1989.C index 487f609a145..fdede63e406 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p1989.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p1989.C @@ -108,7 +108,7 @@ List_DL<T>::prepend(const T& item) template<class T> void -List_DL<T>::insert(const T& item, Pix x, bool before = TRUE) +List_DL<T>::insert(const T& item, Pix x, bool before = TRUE) // { dg-error "default arguments" } { link<T> *l = (link<T> *) x; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59322.c b/gcc/testsuite/gcc.c-torture/compile/pr59322.c new file mode 100644 index 00000000000..918d6bdb18e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59322.c @@ -0,0 +1,16 @@ + +int a, b, d; +short c; + +int +foo () +{ + for (b = 0; b; b = a) + for (c = 18; c < 10; c++) + { + d = c; + if (d) + return 0; + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr59362.c b/gcc/testsuite/gcc.c-torture/compile/pr59362.c new file mode 100644 index 00000000000..3e78f76bc5f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr59362.c @@ -0,0 +1,21 @@ +/* PR tree-optimization/59362 */ + +char * +foo (char *r, int s) +{ + r = __builtin___stpcpy_chk (r, "abc", __builtin_object_size (r, 1)); + if (s) + r = __builtin___stpcpy_chk (r, "d", __builtin_object_size (r, 1)); + return r; +} + +char *a; +long int b; + +void +bar (void) +{ + b = __builtin_object_size (0, 0); + a = __builtin___stpcpy_chk (0, "", b); + b = __builtin_object_size (a, 0); +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20131127-1.c b/gcc/testsuite/gcc.c-torture/execute/20131127-1.c new file mode 100644 index 00000000000..8ec49657741 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20131127-1.c @@ -0,0 +1,34 @@ +/* PR middle-end/59138 */ +/* Testcase by John Regehr <regehr@cs.utah.edu> */ + +extern void abort (void); + +#pragma pack(1) + +struct S0 { + int f0; + int f1; + int f2; + short f3; +}; + +short a = 1; + +struct S0 b = { 1 }, c, d, e; + +struct S0 fn1() { return c; } + +void fn2 (void) +{ + b = fn1 (); + a = 0; + d = e; +} + +int main (void) +{ + fn2 (); + if (a != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59014-2.c b/gcc/testsuite/gcc.c-torture/execute/pr59014-2.c new file mode 100644 index 00000000000..18da0059eab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr59014-2.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/59014 */ + +__attribute__((noinline, noclone)) long long int +foo (long long int x, long long int y) +{ + if (((int) x | (int) y) != 0) + return 6; + return x + y; +} + +int +main () +{ + if (sizeof (long long) == sizeof (int)) + return 0; + int shift_half = sizeof (int) * __CHAR_BIT__ / 2; + long long int x = (3LL << shift_half) << shift_half; + long long int y = (5LL << shift_half) << shift_half; + long long int z = foo (x, y); + if (z != ((8LL << shift_half) << shift_half)) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59014.c b/gcc/testsuite/gcc.c-torture/execute/pr59014.c new file mode 100644 index 00000000000..10bf81a462f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr59014.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/59014 */ + +int a = 2, b, c, d; + +int +foo () +{ + for (;; c++) + if ((b > 0) | (a & 1)) + ; + else + { + d = a; + return 0; + } +} + +int +main () +{ + foo (); + if (d != 2) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59229.c b/gcc/testsuite/gcc.c-torture/execute/pr59229.c new file mode 100644 index 00000000000..d2a776778de --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr59229.c @@ -0,0 +1,29 @@ +int i; + +__attribute__((noinline, noclone)) void +bar (char *p) +{ + if (i < 1 || i > 6) + __builtin_abort (); + if (__builtin_memcmp (p, "abcdefg", i + 1) != 0) + __builtin_abort (); + __builtin_memset (p, ' ', 7); +} + +__attribute__((noinline, noclone)) void +foo (char *p, unsigned long l) +{ + if (l < 1 || l > 6) + return; + char buf[7]; + __builtin_memcpy (buf, p, l + 1); + bar (buf); +} + +int +main () +{ + for (i = 0; i < 16; i++) + foo ("abcdefghijklmnop", i); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr59358.c b/gcc/testsuite/gcc.c-torture/execute/pr59358.c new file mode 100644 index 00000000000..674026d6258 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr59358.c @@ -0,0 +1,44 @@ +/* PR tree-optimization/59358 */ + +__attribute__((noinline, noclone)) int +foo (int *x, int y) +{ + int z = *x; + if (y > z && y <= 16) + while (y > z) + z *= 2; + return z; +} + +int +main () +{ + int i; + for (i = 1; i < 17; i++) + { + int j = foo (&i, 16); + int k; + if (i >= 8 && i <= 15) + k = 16 + (i - 8) * 2; + else if (i >= 4 && i <= 7) + k = 16 + (i - 4) * 4; + else if (i == 3) + k = 24; + else + k = 16; + if (j != k) + __builtin_abort (); + j = foo (&i, 7); + if (i >= 7) + k = i; + else if (i >= 4) + k = 8 + (i - 4) * 2; + else if (i == 3) + k = 12; + else + k = 8; + if (j != k) + __builtin_abort (); + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/20020312-2.c b/gcc/testsuite/gcc.dg/20020312-2.c index 299910047f5..7562a8d65f6 100644 --- a/gcc/testsuite/gcc.dg/20020312-2.c +++ b/gcc/testsuite/gcc.dg/20020312-2.c @@ -52,6 +52,8 @@ extern void abort (void); /* No pic register. */ #elif defined(__moxie__) /* No pic register. */ +#elif defined(__nds32__) +/* No pic register. */ #elif defined(__hppa__) /* PIC register is %r27 or %r19, but is used even without -fpic. */ #elif defined(__pdp11__) diff --git a/gcc/testsuite/gcc.dg/20081223-1.c b/gcc/testsuite/gcc.dg/20081223-1.c index 6bfbd17556f..e5184e044e7 100644 --- a/gcc/testsuite/gcc.dg/20081223-1.c +++ b/gcc/testsuite/gcc.dg/20081223-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-flto" { target lto } } */ +/* { dg-options "-flto -ffat-lto-objects" { target lto } } */ typedef struct foo_ foo_t; foo_t bar; /* { dg-error "storage size of 'bar' isn't known" } */ diff --git a/gcc/testsuite/gcc.dg/builtin-apply2.c b/gcc/testsuite/gcc.dg/builtin-apply2.c index 869f337a9a5..3ae2adc6e07 100644 --- a/gcc/testsuite/gcc.dg/builtin-apply2.c +++ b/gcc/testsuite/gcc.dg/builtin-apply2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "aarch64*-*-* avr-*-* " } { "*" } { "" } } */ +/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { "aarch64*-*-* avr-*-* nds32*-*-*" } { "*" } { "" } } */ /* { dg-skip-if "Variadic funcs use Base AAPCS. Normal funcs use VFP variant." { arm*-*-* && arm_hf_eabi } { "*" } { "" } } */ /* PR target/12503 */ diff --git a/gcc/testsuite/gcc.dg/c90-array-lval-8.c b/gcc/testsuite/gcc.dg/c90-array-lval-8.c new file mode 100644 index 00000000000..bc5b7b21b8a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c90-array-lval-8.c @@ -0,0 +1,20 @@ +/* Test for non-lvalue arrays: test that they cannot be assigned to + array variables. PR 58235. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */ + +struct s { char c[1]; } x; +struct s f (void) { return x; } + +void +g (void) +{ + char c[1]; + c = f ().c; /* { dg-error "array" } */ +} + +void +h (void) +{ + char c[1] = f ().c; /* { dg-error "array" } */ +} diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-8.c b/gcc/testsuite/gcc.dg/c90-const-expr-8.c index 4923bc68046..b6aba7b1d87 100644 --- a/gcc/testsuite/gcc.dg/c90-const-expr-8.c +++ b/gcc/testsuite/gcc.dg/c90-const-expr-8.c @@ -23,5 +23,6 @@ enum e { /* { dg-error "3:overflow in constant expression" "constant" { target *-*-* } 22 } */ E6 = 0 * !-INT_MIN, /* { dg-warning "13:integer overflow in expression" } */ /* { dg-error "8:not an integer constant" "constant" { target *-*-* } 24 } */ - E7 = INT_MIN % -1 /* Not an overflow. */ + E7 = INT_MIN % -1 /* { dg-warning "16:integer overflow in expression" } */ + /* { dg-error "1:overflow in constant expression" "constant" { target *-*-* } 28 } */ }; diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-8.c b/gcc/testsuite/gcc.dg/c99-const-expr-8.c index e84fa7b4db0..1ddd9ed91ce 100644 --- a/gcc/testsuite/gcc.dg/c99-const-expr-8.c +++ b/gcc/testsuite/gcc.dg/c99-const-expr-8.c @@ -23,5 +23,6 @@ enum e { /* { dg-error "overflow in constant expression" "constant" { target *-*-* } 22 } */ E6 = 0 * !-INT_MIN, /* { dg-warning "integer overflow in expression" } */ /* { dg-error "not an integer constant" "constant" { target *-*-* } 24 } */ - E7 = INT_MIN % -1 /* Not an overflow. */ + E7 = INT_MIN % -1 /* { dg-warning "16:integer overflow in expression" } */ + /* { dg-error "1:overflow in constant expression" "constant" { target *-*-* } 28 } */ }; diff --git a/gcc/testsuite/gcc.dg/c99-init-5.c b/gcc/testsuite/gcc.dg/c99-init-5.c new file mode 100644 index 00000000000..17bacd90c6a --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-init-5.c @@ -0,0 +1,9 @@ +/* Test for designated initializers: string constants used with + designator in character array should not initialize the array as a + whole. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +char g[] = { [7] = "abcd" }; /* { dg-error "initial" } */ +char h[10][10] = { [1][1] = "abcd" }; /* { dg-error "initial" } */ +char i[10][10] = { [1] = "abcd" }; diff --git a/gcc/testsuite/gcc.dg/c99-init-6.c b/gcc/testsuite/gcc.dg/c99-init-6.c new file mode 100644 index 00000000000..6328f82676f --- /dev/null +++ b/gcc/testsuite/gcc.dg/c99-init-6.c @@ -0,0 +1,6 @@ +/* Test for designated initializers: invalid uses of string constants + should not ICE. PR 42262. */ +/* { dg-do compile } */ +/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */ + +int a[] = { [0 ... 1] = "", [0] = "" }; /* { dg-error "initial" } */ diff --git a/gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp b/gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp index dc66fcb4c0c..39abbba3fbc 100644 --- a/gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp +++ b/gcc/testsuite/gcc.dg/cilk-plus/cilk-plus.exp @@ -26,7 +26,8 @@ if { ![check_effective_target_cilkplus] } { set library_var [get_multilibs] # Pointing the ld_library_path to the Cilk Runtime library binaries. -set ld_library_path "${library_var}/libcilkrts/.libs" +append ld_library_path ":${library_var}/libcilkrts/.libs" +set_ld_library_path_env_vars global TEST_EXTRA_LIBS set TEST_EXTRA_LIBS "-L${library_var}/libcilkrts/.libs" diff --git a/gcc/testsuite/gcc.dg/float-exact-1.c b/gcc/testsuite/gcc.dg/float-exact-1.c index 7e8f3f153ae..d22e70b354b 100644 --- a/gcc/testsuite/gcc.dg/float-exact-1.c +++ b/gcc/testsuite/gcc.dg/float-exact-1.c @@ -2,6 +2,7 @@ floating-point contents expressed in decimal. PR 21718. */ /* { dg-do run } */ /* { dg-options "-w" } */ +/* { dg-add-options ieee } */ /* For float (if IEEE binary32), double (if IEEE binary64) and long double (if IEEE binary64, x86 extended or IEEE binary128) we test @@ -2292,7 +2293,7 @@ static const long double ld1c = 182358152808745703724362178773168996492870519432472065091133\ 11767578125001e-4966L; /* 0x1.8p-16494 */ -static const long double ld2ae = 0x1p-16494L, ld2be = 0x2p-16494L, ld1ce = 0x2p-16494L; +static const long double ld2ae = 0x1p-16494L, ld2be = 0x2p-16494L, ld2ce = 0x2p-16494L; static const long double ld2a = 9.7127626791570376663866584373414698287493540070520215145348\ 265837955593101861790565265072369149749103838172122152721795\ diff --git a/gcc/testsuite/gcc.dg/gomp/openmp-simd-1.c b/gcc/testsuite/gcc.dg/gomp/openmp-simd-1.c index fedb186fedf..e8e057a6166 100644 --- a/gcc/testsuite/gcc.dg/gomp/openmp-simd-1.c +++ b/gcc/testsuite/gcc.dg/gomp/openmp-simd-1.c @@ -44,3 +44,4 @@ void foo(int n, float *a, float *b) /* { dg-final { scan-tree-dump-not "omp teams" "original" } } */ /* { dg-final { scan-tree-dump-not "omp target" "original" } } */ /* { dg-final { scan-tree-dump-not "omp parallel" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/openmp-simd-2.c b/gcc/testsuite/gcc.dg/gomp/openmp-simd-2.c index e66806845b7..94afced248f 100644 --- a/gcc/testsuite/gcc.dg/gomp/openmp-simd-2.c +++ b/gcc/testsuite/gcc.dg/gomp/openmp-simd-2.c @@ -40,3 +40,4 @@ void bar(int n, float *a, float *b) /* { dg-final { scan-tree-dump-times "pragma omp simd safelen\\(64\\)" 1 "original" } } */ /* { dg-final { scan-tree-dump-not "omp parallel" "original" } } */ /* { dg-final { scan-tree-dump-not "omp for" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-1.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-1.c new file mode 100644 index 00000000000..486b67a637a --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-1.c @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -fdump-tree-optimized -O3" } */ + +/* Test that functions that have SIMD clone counterparts are not + cloned by IPA-cp. For example, special_add() below has SIMD clones + created for it. However, if IPA-cp later decides to clone a + specialization of special_add(x, 666) when analyzing fillit(), we + will forever keep the vectorizer from using the SIMD versions of + special_add in a loop. + + If IPA-CP gets taught how to adjust the SIMD clones as well, this + test could be removed. */ + +#pragma omp declare simd simdlen(4) +static int __attribute__ ((noinline)) +special_add (int x, int y) +{ + if (y == 666) + return x + y + 123; + else + return x + y; +} + +void fillit(int *tot) +{ + int i; + + for (i=0; i < 10000; ++i) + tot[i] = special_add (i, 666); +} + +/* { dg-final { scan-tree-dump-not "special_add.constprop" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c new file mode 100644 index 00000000000..030ae6cb19b --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-2.c @@ -0,0 +1,26 @@ +/* { dg-options "-fopenmp -fdump-tree-optimized -O" } */ + +#pragma omp declare simd inbranch uniform(c) linear(b:66) +#pragma omp declare simd notinbranch aligned(c:32) +int addit(int a, int b, int *c) +{ + return a + b; +} + +#pragma omp declare simd uniform(a) aligned(a:32) linear(k:1) notinbranch +float setArray(float *a, float x, int k) +{ + a[k] = a[k] + x; + return a[k]; +} + +/* { dg-final { scan-tree-dump "_ZGVbN4ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVbN4vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVbM4vl66u_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVcN8ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVcN4vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVcM4vl66u_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVdN8ua32vl_setArray" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVdN8vvva32_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVdM8vl66u_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-3.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-3.c new file mode 100644 index 00000000000..98e767c3ae3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-3.c @@ -0,0 +1,18 @@ +/* { dg-options "-fopenmp -fdump-tree-optimized -O2" } */ + +/* Test that if there is no *inbranch clauses, that both the masked and + the unmasked version are created. */ + +#pragma omp declare simd +int addit(int a, int b, int c) +{ + return a + b; +} + +/* { dg-final { scan-tree-dump "_ZGVbN4vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVbM4vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVcN4vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVcM4vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVdN8vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { scan-tree-dump "_ZGVdM8vvv_addit" "optimized" { target i?86-*-* x86_64-*-* } } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-4.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-4.c new file mode 100644 index 00000000000..893f44e690f --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-fopenmp" } */ + +#pragma omp declare simd simdlen(4) notinbranch +int f2 (int a, int b) +{ + if (a > 5) + return a + b; + else + return a - b; +} diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-5.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-5.c new file mode 100644 index 00000000000..801c24f34af --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-5.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-fopenmp -w" } */ + +/* ?? The -w above is to inhibit the following warning for now: + a.c:2:6: warning: AVX vector argument without AVX enabled changes + the ABI [enabled by default]. */ + +#pragma omp declare simd notinbranch simdlen(4) +void foo (int *a) +{ + *a = 555; +} diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-6.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-6.c new file mode 100644 index 00000000000..8818594bfac --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-6.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-fopenmp" } */ + +/* Test that array subscripts are properly adjusted. */ + +int array[1000]; +#pragma omp declare simd notinbranch simdlen(4) +void foo (int i) +{ + array[i] = 555; +} diff --git a/gcc/testsuite/gcc.dg/gomp/simd-clones-7.c b/gcc/testsuite/gcc.dg/gomp/simd-clones-7.c new file mode 100644 index 00000000000..ef6fa113c1a --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/simd-clones-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-fopenmp -w" } */ + +int array[1000]; + +#pragma omp declare simd notinbranch simdlen(4) +void foo (int *a, int b) +{ + a[b] = 555; +} + +#pragma omp declare simd notinbranch simdlen(4) +void bar (int *a) +{ + *a = 555; +} diff --git a/gcc/testsuite/gcc.dg/guality/param-3.c b/gcc/testsuite/gcc.dg/guality/param-3.c new file mode 100644 index 00000000000..a3b5adb5a0b --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/param-3.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" "-O1" } } */ + +typedef __UINTPTR_TYPE__ uintptr_t; + +__attribute__((noinline, noclone)) int +sub (int a, int b) +{ + return a - b; +} + +typedef struct { uintptr_t pa; uintptr_t pb; } fatp_t + __attribute__ ((aligned (2 * __alignof__ (uintptr_t)))); + +__attribute__((noinline, noclone)) void +foo (fatp_t str, int a, int b) +{ + int i = sub (a, b); + if (i == 0) /* BREAK */ + foo (str, a - 1, b); +} + +int +main (void) +{ + fatp_t ptr = { 31415927, 27182818 }; + foo (ptr, 1, 2); + return 0; +} + +/* { dg-final { gdb-test 20 "str.pa" "31415927" } } */ +/* { dg-final { gdb-test 20 "str.pb" "27182818" } } */ diff --git a/gcc/testsuite/gcc.dg/inline-35.c b/gcc/testsuite/gcc.dg/inline-35.c new file mode 100644 index 00000000000..ebbb8df2fe1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/inline-35.c @@ -0,0 +1,19 @@ +/* A function definition of an inline function following a static + declaration does not make an inline definition in C99/C11 terms. + PR 57574. */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -pedantic-errors" } */ + +static int n; + +static inline int f1 (void); +inline int f1 (void) { return n; } + +static int f2 (void); +inline int f2 (void) { return n; } + +static inline int f3 (void); +int f3 (void) { return n; } + +static int f4 (void); +int f4 (void) { return n; } diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c index 4fc00b292dc..54d3e761573 100644 --- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c +++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-1.c @@ -1,18 +1,18 @@ -/* { dg-do compile { target { x86_64-*-* && lp64 } } } */ +/* { dg-do compile { target { { x86_64-*-* && lp64 } || { powerpc*-*-* && lp64 } } } } */ /* { dg-options "-O3 -fdump-rtl-ira -fdump-rtl-pro_and_epilogue" } */ -int __attribute__((noinline, noclone)) -foo (int a) +long __attribute__((noinline, noclone)) +foo (long a) { return a + 5; } -static int g; +static long g; -int __attribute__((noinline, noclone)) -bar (int a) +long __attribute__((noinline, noclone)) +bar (long a) { - int r; + long r; if (a) { diff --git a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c index bb725e1651c..ed08494cfa0 100644 --- a/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c +++ b/gcc/testsuite/gcc.dg/ira-shrinkwrap-prep-2.c @@ -1,18 +1,18 @@ -/* { dg-do compile { target { x86_64-*-* && lp64 } } } */ +/* { dg-do compile { target { { x86_64-*-* && lp64 } || { powerpc*-*-* && lp64 } } } } */ /* { dg-options "-O3 -fdump-rtl-ira -fdump-rtl-pro_and_epilogue" } */ -int __attribute__((noinline, noclone)) -foo (int a) +long __attribute__((noinline, noclone)) +foo (long a) { return a + 5; } -static int g; +static long g; -int __attribute__((noinline, noclone)) -bar (int a) +long __attribute__((noinline, noclone)) +bar (long a) { - int r; + long r; if (a) { diff --git a/gcc/testsuite/gcc.dg/lto/pr59323-2_0.c b/gcc/testsuite/gcc.dg/lto/pr59323-2_0.c new file mode 100644 index 00000000000..938a89d6a28 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr59323-2_0.c @@ -0,0 +1,37 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -g -flto } } } */ +/* { dg-extra-ld-options { -r -nostdlib } } */ + +extern void bar(void); + +int main(int argc, char **argv) +{ + int i; + + if (argc == 1) { + extern void bar (); + + bar(); + + { + extern void bar (); + + asm goto ("" : : : : lab); +lab: + ; + } + } + + { + extern void bar (); + + int foo(void) + { + return argv[0][0]; + } + + i = foo(); + } + + return i; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr59323_0.c b/gcc/testsuite/gcc.dg/lto/pr59323_0.c new file mode 100644 index 00000000000..b5910589158 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr59323_0.c @@ -0,0 +1,37 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -g -flto } } } */ +/* { dg-extra-ld-options { -r -nostdlib } } */ + +extern void bar(void); + +int main(int argc, char **argv) +{ + int i; + + if (argc == 1) { + enum { X }; + + bar(); + + { + enum { X }; + + asm goto ("" : : : : lab); +lab: + ; + } + } + + { + enum { X }; + + int foo(void) + { + return argv[0][0]; + } + + i = foo(); + } + + return i; +} diff --git a/gcc/testsuite/gcc.dg/macro-fusion-1.c b/gcc/testsuite/gcc.dg/macro-fusion-1.c new file mode 100644 index 00000000000..4ac98668bdc --- /dev/null +++ b/gcc/testsuite/gcc.dg/macro-fusion-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -mtune=corei7 -fdump-rtl-sched2" } */ +/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ + +int a[100]; + +double bar (double sum) +{ + int i; + for (i = 0; i < 1000000; i++) + sum += (0.5 + (a[i%100] - 128)); + return sum; +} diff --git a/gcc/testsuite/gcc.dg/macro-fusion-2.c b/gcc/testsuite/gcc.dg/macro-fusion-2.c new file mode 100644 index 00000000000..638350d9926 --- /dev/null +++ b/gcc/testsuite/gcc.dg/macro-fusion-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -mtune=corei7-avx -fdump-rtl-sched2" } */ +/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ + +int a[100]; + +double bar (double sum) +{ + int i = 100000; + while (i != 0) + { + sum += (0.5 + (a[i%100] - 128)); + i--; + } + return sum; +} diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c index 72d724063e4..c04d96d8232 100644 --- a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c @@ -9,6 +9,17 @@ #include "tree.h" #include "toplev.h" #include "basic-block.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "tree.h" #include "tree-pass.h" diff --git a/gcc/testsuite/gcc.dg/plugin/ggcplug.c b/gcc/testsuite/gcc.dg/plugin/ggcplug.c index eb61ece4522..d441528e9de 100644 --- a/gcc/testsuite/gcc.dg/plugin/ggcplug.c +++ b/gcc/testsuite/gcc.dg/plugin/ggcplug.c @@ -8,6 +8,17 @@ #include "tree.h" #include "toplev.h" #include "basic-block.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "tree.h" #include "tree-pass.h" diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c index 1e601a63c90..f80719a4ff0 100644 --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c @@ -6,6 +6,17 @@ #include "tree.h" #include "tm.h" #include "toplev.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "tree-pass.h" #include "intl.h" diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index cdab74a19ae..be5a204c901 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -11,6 +11,17 @@ #include "stringpool.h" #include "toplev.h" #include "basic-block.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "gimple-iterator.h" #include "tree.h" diff --git a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c index 39f44626a55..e83476b63fd 100644 --- a/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/start_unit_plugin.c @@ -14,6 +14,17 @@ #include "stringpool.h" #include "toplev.h" #include "basic-block.h" +#include "pointer-set.h" +#include "hash-table.h" +#include "vec.h" +#include "ggc.h" +#include "basic-block.h" +#include "tree-ssa-alias.h" +#include "internal-fn.h" +#include "gimple-fold.h" +#include "tree-eh.h" +#include "gimple-expr.h" +#include "is-a.h" #include "gimple.h" #include "tree.h" #include "tree-pass.h" diff --git a/gcc/testsuite/gcc.dg/pr10474.c b/gcc/testsuite/gcc.dg/pr10474.c index 08324d83a1d..77ccc4606ed 100644 --- a/gcc/testsuite/gcc.dg/pr10474.c +++ b/gcc/testsuite/gcc.dg/pr10474.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { x86_64-*-* && lp64 } } } */ +/* { dg-do compile { target { { x86_64-*-* && lp64 } || { powerpc*-*-* && lp64 } } } } */ /* { dg-options "-O3 -fdump-rtl-pro_and_epilogue" } */ void f(int *i) diff --git a/gcc/testsuite/gcc.dg/pr56997-4.c b/gcc/testsuite/gcc.dg/pr56997-4.c new file mode 100644 index 00000000000..38f6248d2ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56997-4.c @@ -0,0 +1,23 @@ +/* Test volatile access to unaligned field. */ +/* { dg-do compile } */ +/* { dg-options "-fno-strict-volatile-bitfields -fdump-rtl-final" } */ + +#define test_type unsigned short + +typedef struct s{ + unsigned char Prefix[1]; + volatile test_type Type; +}__attribute((__packed__,__aligned__(4))) ss; + +extern volatile ss v; + +void +foo (test_type u) +{ + v.Type = u; +} + +/* The C++ memory model forbids data store race conditions outside the + unaligned data member, therefore only QI or HI access is allowed, no SI. */ +/* { dg-final { scan-rtl-dump-not "mem/v(/.)*:SI" "final" } } */ +/* { dg-final { cleanup-rtl-dump "final" } } */ diff --git a/gcc/testsuite/gcc.dg/pr57518.c b/gcc/testsuite/gcc.dg/pr57518.c index 8eb714d8c55..94ef82db8e3 100644 --- a/gcc/testsuite/gcc.dg/pr57518.c +++ b/gcc/testsuite/gcc.dg/pr57518.c @@ -2,7 +2,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-rtl-ira" } */ -/* { dg-final { scan-rtl-dump-not "REG_EQUIV\[^\n\]*mem\[^\n\]*\"ip\".*subreg" "ira" } } */ char ip[10]; int total; @@ -13,3 +12,6 @@ void foo() { t = ip[2]; total = t & 0x3; } + +/* { dg-final { scan-rtl-dump-not "REG_EQUIV\[^\n\]*mem\[^\n\]*\"ip\".*subreg" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ diff --git a/gcc/testsuite/gcc.dg/pr59011.c b/gcc/testsuite/gcc.dg/pr59011.c new file mode 100644 index 00000000000..2fb8187ad55 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr59011.c @@ -0,0 +1,22 @@ +/* PR middle-end/59011 */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99" } */ + +void +foo (int m) +{ + int a[m]; + void + bar (void) + { + { + int + baz (void) + { + return a[0]; + } + } + a[0] = 42; + } + bar (); +} diff --git a/gcc/testsuite/gcc.dg/pr59020.c b/gcc/testsuite/gcc.dg/pr59020.c new file mode 100644 index 00000000000..696c9df9ac1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr59020.c @@ -0,0 +1,15 @@ +/* PR rtl-optimization/59020 */ + +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fmodulo-sched -fno-inline -march=corei7" } */ + +int a, b, d; +unsigned c; + +void f() +{ + unsigned q; + for(; a; a++) + if(((c %= d && 1) ? : 1) & 1) + for(; b; q++); +} diff --git a/gcc/testsuite/gcc.dg/pr59351.c b/gcc/testsuite/gcc.dg/pr59351.c new file mode 100644 index 00000000000..384058f4041 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr59351.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -Wpedantic" } */ + +unsigned int +foo (void) +{ + return sizeof ((int[]) {}); /* { dg-warning "ISO C forbids empty initializer braces" } */ +} diff --git a/gcc/testsuite/gcc.dg/sibcall-3.c b/gcc/testsuite/gcc.dg/sibcall-3.c index c4460e2e522..e02a410e6d9 100644 --- a/gcc/testsuite/gcc.dg/sibcall-3.c +++ b/gcc/testsuite/gcc.dg/sibcall-3.c @@ -5,7 +5,7 @@ Copyright (C) 2002 Free Software Foundation Inc. Contributed by Hans-Peter Nilsson <hp@bitrange.com> */ -/* { dg-do run { xfail { { cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */ +/* { dg-do run { xfail { { cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* mcore-*-* mn10300-*-* nds32*-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */ /* -mlongcall disables sibcall patterns. */ /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */ /* { dg-options "-O2 -foptimize-sibling-calls" } */ diff --git a/gcc/testsuite/gcc.dg/sibcall-4.c b/gcc/testsuite/gcc.dg/sibcall-4.c index 4f468f6595e..a66ed079862 100644 --- a/gcc/testsuite/gcc.dg/sibcall-4.c +++ b/gcc/testsuite/gcc.dg/sibcall-4.c @@ -5,7 +5,7 @@ Copyright (C) 2002 Free Software Foundation Inc. Contributed by Hans-Peter Nilsson <hp@bitrange.com> */ -/* { dg-do run { xfail { { cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */ +/* { dg-do run { xfail { { cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* mcore-*-* mn10300-*-* nds32*-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */ /* -mlongcall disables sibcall patterns. */ /* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */ /* { dg-options "-O2 -foptimize-sibling-calls" } */ diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 78807bacd30..7956efc4089 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -38,6 +38,9 @@ # else # define SIZE 248 # endif +#elif defined (__nds32__) +# define SIZE 248 /* 256 - 8 bytes, only $fp and padding bytes are saved in + the register save area under O0 optimization level. */ #elif defined (__powerpc64__) || defined (__ppc64__) || defined (__POWERPC64__) \ || defined (__PPC64__) # if _CALL_ELF == 2 diff --git a/gcc/testsuite/gcc.dg/torture/pr37868.c b/gcc/testsuite/gcc.dg/torture/pr37868.c index cc9c24f49bb..5204c5a5941 100644 --- a/gcc/testsuite/gcc.dg/torture/pr37868.c +++ b/gcc/testsuite/gcc.dg/torture/pr37868.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-options "-fno-strict-aliasing" } */ -/* { dg-skip-if "unaligned access" { arc*-*-* epiphany-*-* sparc*-*-* sh*-*-* tic6x-*-* } "*" "" } */ +/* { dg-skip-if "unaligned access" { arc*-*-* epiphany-*-* nds32*-*-* sparc*-*-* sh*-*-* tic6x-*-* } "*" "" } */ extern void abort (void); #if (__SIZEOF_INT__ <= 2) diff --git a/gcc/testsuite/gcc.dg/torture/pr57393-1.c b/gcc/testsuite/gcc.dg/torture/pr57393-1.c new file mode 100644 index 00000000000..e62d44df484 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57393-1.c @@ -0,0 +1,15 @@ +/* PR middle-end/57393 */ +/* { dg-do compile } */ +/* { dg-additional-options "-g -ffast-math" } */ + +extern void bar (double); + +struct S { int n; }; + +void +foo (struct S s, double a, int i, int j, int k) +{ + struct S t; + bar (s.n * a * i * j); + t.n = s.n * a * i * k; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr57393-2.c b/gcc/testsuite/gcc.dg/torture/pr57393-2.c new file mode 100644 index 00000000000..b9b12ffa557 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57393-2.c @@ -0,0 +1,16 @@ +/* PR middle-end/57393 */ +/* { dg-do compile } */ + +char a; + +foo (int **p) +{ + int b; + for (;;) + { + int c[1] = { 0 }; + unsigned *d = &c[0]; + for (b = 7; b; b--) + **p &= --*d >= a; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr57393-3.c b/gcc/testsuite/gcc.dg/torture/pr57393-3.c new file mode 100644 index 00000000000..34cece06cbd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr57393-3.c @@ -0,0 +1,20 @@ +/* PR middle-end/57393 */ +/* { dg-do compile } */ + +int a, b, c; +void foo (void); + +int +bar (void) +{ + for (;;) + { + foo (); + int d = a = 0; + for (; a < 7; ++a) + { + d--; + b &= c <= d; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr58018.c b/gcc/testsuite/gcc.dg/torture/pr58018.c new file mode 100644 index 00000000000..52c8e83fa0d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58018.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/58018 */ +/* { dg-do compile } */ + +int a, b, c, d, e; + +void +bar (int p) +{ + int f = b; + e &= p <= (f ^= 0); +} + +void +foo () +{ + for (; d; d++) + { + bar (a && c); + bar (0); + bar (1); + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr58131.c b/gcc/testsuite/gcc.dg/torture/pr58131.c new file mode 100644 index 00000000000..3f68d4c5286 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr58131.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/58131 */ +/* { dg-do compile } */ + +short a; +int b, c, d[1][4][2]; + +void +foo (void) +{ + int *e; + for (b = 1; ; b--) + { + if (*e) + break; + for (c = 2; c >= 0; c--) + { + *e |= d[0][3][b] != a; + int *f = &d[0][3][b]; + *f = 0; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59139.c b/gcc/testsuite/gcc.dg/torture/pr59139.c new file mode 100644 index 00000000000..4ec9177ffe7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59139.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int a, b, c, d, e; +int fn1(p1, p2) { return p2 == 0 ? p1 : 1 % p2; } + +void fn2() +{ + c = 0; + for (;; c = (unsigned short)c) + { + b = 2; + for (; b; b = a) + { + e = fn1(2, c && 1); + d = c == 0 ? e : c; + if (d) + return; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59166.c b/gcc/testsuite/gcc.dg/torture/pr59166.c new file mode 100644 index 00000000000..d29ec33e0f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59166.c @@ -0,0 +1,37 @@ +/* PR rtl-optimization/59166 */ +/* { dg-additional-options "-fcompare-debug" } */ + +int a, b, c, f, g; + +void +foo () +{ + for (; b; b++) + for (; f; f = g) + for (; a;) + ; +} + +static int +bar (int p) +{ + short d; + if (c) + { + for (; f; f = g); + foo (); + d = p; + char e = d; + if (p) + return 1; + } + return p; +} + +int +main () +{ + bar (0); + bar (g); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59216.c b/gcc/testsuite/gcc.dg/torture/pr59216.c new file mode 100644 index 00000000000..0de51bac95b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59216.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ + +#include <limits.h> + +extern void abort (void); +extern void exit (int); + +long long __attribute__((noinline)) f(int a) +{ + return -(long long) a; +} + +int +main() +{ + if (f(0) != 0) + abort (); + + if (f(1) != -(long long)1) + abort (); + + if (f(-1) != -(long long)-1) + abort (); + + if (f(INT_MIN) != -(long long)INT_MIN) + abort (); + + if (f(INT_MAX) != -(long long)INT_MAX) + abort (); + + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59245.c b/gcc/testsuite/gcc.dg/torture/pr59245.c new file mode 100644 index 00000000000..e5b9a0fb487 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59245.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ + +int a, b, c, e, g; +char d[5], f; + +int +fn1 () +{ + if (b) + { + g = 0; + return 0; + } + for (f = 0; f != 1; f--) + ; + return 0; +} + +void +fn2 () +{ + d[4] = -1; + for (a = 4; a; a--) + { + fn1 (); + e = c < -2147483647 - 1 - d[a] ? c : 0; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59288.c b/gcc/testsuite/gcc.dg/torture/pr59288.c new file mode 100644 index 00000000000..8331e73289c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59288.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ + +void +baz (int *d) +{ + long int i, j, k; + for (i = 0, j = 0, k = 0; i < 512; i = (int) i + 1, j = (int) j + 1, k = (int) k + 3) + d[i] = j ^ (i * 3) ^ (2 * k + 2); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59330.c b/gcc/testsuite/gcc.dg/torture/pr59330.c new file mode 100644 index 00000000000..74b832ea314 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59330.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ + +void free(void *ptr) +{ +} + +void *foo(void) +{ + return 0; +} + +int main(void) +{ + void *p = foo(); + free(p); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59338.c b/gcc/testsuite/gcc.dg/torture/pr59338.c new file mode 100644 index 00000000000..481c84d4ee7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59338.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +typedef enum +{ + XYZZY, +} enumType; + +typedef struct +{ + unsigned char More : 1; +} tResp; + +typedef struct +{ + enumType QueryType; + union + { + tResp l[0]; + } u; +} tQResp; + +void test(void) +{ + tQResp *qResp = (0); + if (qResp->u.l[0].More == 0) + return; +} diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c index ed81e808309..8eba13aed67 100644 --- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c +++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-apply-2.c @@ -10,6 +10,7 @@ avr: Variadic funcs don't pass arguments in registers, while normal funcs do. */ /* { dg-skip-if "Variadic funcs use different argument passing from normal funcs" { arm_hf_eabi || { avr-*-* } } "*" "" } */ +/* { dg-skip-if "Variadic funcs have all args on stack. Normal funcs have args in registers." { nds32*-*-* } "*" "" } */ #define INTEGER_ARG 5 diff --git a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c index 9dc75668e8d..a03aad7f6d8 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c +++ b/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c @@ -1,7 +1,7 @@ /* Test case to check if function foo gets split and the cold function gets a label. */ /* { dg-require-effective-target freorder } */ -/* { dg-options "-O2 -freorder-blocks-and-partition --save-temps" } */ +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps" } */ #define SIZE 10000 @@ -34,3 +34,5 @@ main (int argc, char *argv[]) foo (argc); return 0; } + +/* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c index 470b585fd53..8518dfb1a8b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040204-1.c @@ -33,5 +33,5 @@ void test55 (int x, int y) that the && should be emitted (based on BRANCH_COST). Fix this by teaching dom to look through && and register all components as true. */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* powerpc*-*-* cris-*-* crisv32-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* sparc*-*-* spu-*-* x86_64-*-*" } } } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized" { xfail { ! "alpha*-*-* arm*-*-* powerpc*-*-* cris-*-* crisv32-*-* hppa*-*-* i?86-*-* mmix-*-* mips*-*-* m68k*-*-* moxie-*-* nds32*-*-* sparc*-*-* spu-*-* x86_64-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c new file mode 100644 index 00000000000..4d57ca8f8f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-29.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized" } */ + +union X { + int i; + void *p; +}; +void bar (int); + +int * __attribute__((noinline,noclone)) +baz (int *p) { return p; } + +void foo (union X *x) +{ + struct Y { int i; } ystruct = {}; + ystruct.i = * baz (&ystruct.i); + bar (x->i); +} + +/* DSE and then DCE should be able to remove all uses of ystruct. + Formerly the union access for the parameter to bar let 'anything' + escape which made the call to bar possibly use ystruct and thus + prevent the store to ystruct.i from being eliminated. The call to + baz makes sure that ystruct has its address taken. */ + +/* { dg-final { scan-tree-dump-not "ystruct" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/attr-alias-2.c b/gcc/testsuite/gcc.dg/tree-ssa/attr-alias-2.c index 6d95a1582e2..89477d92f23 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/attr-alias-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/attr-alias-2.c @@ -8,3 +8,4 @@ main() return b+a; } /* { dg-final { scan-tree-dump "return 8" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c index ee587d2320d..4d01d5c6399 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c @@ -1,8 +1,6 @@ - /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-optimized" } */ - struct demangle_component { @@ -11,7 +9,6 @@ struct demangle_component }; - struct d_info { struct demangle_component *comps; @@ -19,7 +16,6 @@ struct d_info int num_comps; }; - static struct demangle_component * d_make_empty (struct d_info *di) { @@ -31,8 +27,6 @@ d_make_empty (struct d_info *di) return p; } - - struct demangle_component * d_type (struct d_info *di) { @@ -55,8 +49,4 @@ d_type (struct d_info *di) /* { dg-final { scan-tree-dump-times "\\.type" 1 "optimized"} } */ /* { dg-final { scan-tree-dump-times "->zzz" 1 "isolate-paths"} } */ /* { dg-final { cleanup-tree-dump "isolate-paths" } } */ -/* { dg-final { cleanup-tree-dump "optimized-paths" } } */ - - - - +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c b/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c index bea55496aeb..a970c855b88 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr42585.c @@ -35,6 +35,6 @@ Cyc_string_ungetc (int ignore, struct _fat_ptr *sptr) /* Whether the structs are totally scalarized or not depends on the MOVE_RATIO macro definition in the back end. The scalarization will not take place when using small values for MOVE_RATIO. */ -/* { dg-final { scan-tree-dump-times "struct _fat_ptr _ans" 0 "optimized" { target { ! "arm*-*-* avr-*-* powerpc*-*-* s390*-*-* sh*-*-*" } } } } */ -/* { dg-final { scan-tree-dump-times "struct _fat_ptr _T2" 0 "optimized" { target { ! "arm*-*-* avr-*-* powerpc*-*-* s390*-*-* sh*-*-*" } } } } */ +/* { dg-final { scan-tree-dump-times "struct _fat_ptr _ans" 0 "optimized" { target { ! "arm*-*-* avr-*-* nds32*-*-* powerpc*-*-* s390*-*-* sh*-*-*" } } } } */ +/* { dg-final { scan-tree-dump-times "struct _fat_ptr _T2" 0 "optimized" { target { ! "arm*-*-* avr-*-* nds32*-*-* powerpc*-*-* s390*-*-* sh*-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c index 81f27b3cd1f..bc265db6ff4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr57361.c @@ -7,3 +7,4 @@ void f (struct A *a) { } /* { dg-final { scan-tree-dump "Deleted dead store" "dse1"} } */ +/* { dg-final { cleanup-tree-dump "dse1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c index 8cc279857c2..c1462195c9d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-39.c @@ -6,7 +6,7 @@ *PINDEX: C1 + (C2 * C3) + C4 */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-slsr" } */ +/* { dg-options "-O2 -fdump-tree-slsr-details" } */ typedef int arr_2[50][50]; @@ -22,5 +22,5 @@ void foo (arr_2 a2, int v1) return; } -/* { dg-final { scan-tree-dump-times "MEM" 4 "slsr" } } */ +/* { dg-final { scan-tree-dump-times "Replacing reference: " 4 "slsr" } } */ /* { dg-final { cleanup-tree-dump "slsr" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-41.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-41.c new file mode 100644 index 00000000000..2c9d90880b8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-41.c @@ -0,0 +1,24 @@ +/* Verify straight-line strength reduction in using + alternative base expr to record and look for the + potential candidate. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-slsr-details" } */ + +typedef int arr_2[50][50]; + +void foo (arr_2 a2, int v1) +{ + int i, j; + + i = v1 + 5; + j = i; + a2 [i-10] [j] = 2; + a2 [i] [j++] = i; + a2 [i+20] [j++] = i; + a2 [i-3] [i-1] += 1; + return; +} + +/* { dg-final { scan-tree-dump-times "Replacing reference: " 5 "slsr" } } */ +/* { dg-final { cleanup-tree-dump "slsr" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/sra-12.c b/gcc/testsuite/gcc.dg/tree-ssa/sra-12.c index 1ad3f492422..59e5e6af6d9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/sra-12.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/sra-12.c @@ -21,5 +21,5 @@ int foo (struct S *p) *p = l; } -/* { dg-final { scan-tree-dump-times "l;" 0 "release_ssa" { target { ! "avr*-*-*" } } } } */ +/* { dg-final { scan-tree-dump-times "l;" 0 "release_ssa" { target { ! "avr*-*-* nds32*-*-*" } } } } */ /* { dg-final { cleanup-tree-dump "release_ssa" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c index 376c7e4ee07..f3d169b0324 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-skip-if "cost too high" { powerpc*le-*-* } { "*" } { "" } } */ #include <stdarg.h> #include "../../tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-124.c b/gcc/testsuite/gcc.dg/vect/vect-124.c index dc81c3169c7..f659b94baba 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-124.c +++ b/gcc/testsuite/gcc.dg/vect/vect-124.c @@ -26,3 +26,5 @@ main () abort (); return 0; } + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c new file mode 100644 index 00000000000..9fdd0563889 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-1.c @@ -0,0 +1,59 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int array[N]; + +#pragma omp declare simd simdlen(4) notinbranch +#pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3) +#pragma omp declare simd simdlen(8) notinbranch +#pragma omp declare simd simdlen(8) notinbranch uniform(b) linear(c:3) +__attribute__((noinline)) int +foo (int a, int b, int c) +{ + if (a < 30) + return 5; + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + array[i] = foo (i, 123, i * 3); +} + +__attribute__((noinline, noclone)) void +baz () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + array[i] = foo (i, array[i], i * 3); +} + +int +main () +{ + int i; + check_vect (); + bar (); + for (i = 0; i < N; i++) + if (array[i] != (i < 30 ? 5 : i * 4 + 123)) + abort (); + baz (); + for (i = 0; i < N; i++) + if (array[i] != (i < 30 ? 5 : i * 8 + 123)) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c new file mode 100644 index 00000000000..923a9453c25 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.c @@ -0,0 +1,84 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-sources vect-simd-clone-10a.c } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N], b[N]; +long int c[N]; +unsigned char d[N]; + +#include "vect-simd-clone-10.h" + +__attribute__((noinline)) void +fn1 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + a[i] = foo (c[i], a[i], b[i]) + 6; + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = bar (a[i], b[i], c[i]) * 2; +} + +__attribute__((noinline)) void +fn2 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + { + a[i] = foo (c[i], a[i], b[i]) + 6; + d[i]++; + } + #pragma omp simd + for (i = 0; i < N; i++) + { + c[i] = bar (a[i], b[i], c[i]) * 2; + d[i] /= 2; + } +} + +__attribute__((noinline)) void +fn3 (void) +{ + int i; + for (i = 0; i < N; i++) + { + a[i] = i * 2; + b[i] = 17 + (i % 37); + c[i] = (i & 63); + d[i] = 16 + i; + } +} + +int +main () +{ + int i; + check_vect (); + fn3 (); + fn1 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63)) + abort (); + fn3 (); + fn2 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63) + || d[i] != ((unsigned char) (17 + i)) / 2) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.h b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.h new file mode 100644 index 00000000000..ac3b81f8616 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10.h @@ -0,0 +1,4 @@ +#pragma omp declare simd notinbranch +extern int foo (long int a, int b, int c); +#pragma omp declare simd notinbranch +extern long int bar (int a, int b, long int c); diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c new file mode 100644 index 00000000000..1314039643f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +#include "vect-simd-clone-10.h" + +#pragma omp declare simd notinbranch +int +foo (long int a, int b, int c) +{ + return a + b + c; +} + +#pragma omp declare simd notinbranch +long int +bar (int a, int b, long int c) +{ + return a + b + c; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-11.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-11.c new file mode 100644 index 00000000000..a04530e251e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-11.c @@ -0,0 +1,67 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N] __attribute__((aligned (32))); + +#pragma omp declare simd linear(a) linear(b:3) linear(c:6) notinbranch +__attribute__((noinline)) int +foo (int a, int b, int c) +{ + return a ^ (b * 512) ^ (c * 512 * 512); +} + +__attribute__((noinline, noclone)) void +bar (int *d) +{ + int i, j, k; + for (i = 0, j = 0, k = 0; i < N / 2; i++, j++, k += 3) + d[i] = foo (j, i * 3, 2 * k + 2); +} + +#if 0 +__attribute__((noinline, noclone)) void +baz (int *d) +{ + long int i, j, k; + for (i = 0, j = 0, k = 0; i < N / 2; + i = (int) i + 1, j = (int) j + 1, k = (int) k + 3) + d[i] = foo (j, i * 3, 2 * k + 2); +} +#endif + +int +main () +{ + int i; + check_vect (); + if (sizeof (int) * __CHAR_BIT__ < 32) + return 0; + bar (a + 7); + for (i = 0; i < N / 2; i++) + if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512))) + abort (); + bar (a); + for (i = 0; i < N / 2; i++) + if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512))) + abort (); +#if 0 + baz (a + 7); + for (i = 0; i < N / 2; i++) + if (a[i + 7] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512))) + abort (); + baz (a); + for (i = 0; i < N / 2; i++) + if (a[i] != (i ^ (i * 3 * 512) ^ (((i * 6) + 2) * 512 * 512))) + abort (); +#endif + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c new file mode 100644 index 00000000000..279abd7c682 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c @@ -0,0 +1,8 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-sources vect-simd-clone-12a.c } */ + +#include "vect-simd-clone-10.c" + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c new file mode 100644 index 00000000000..fcd04614e97 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +#include "vect-simd-clone-10.h" + +#pragma omp declare simd notinbranch +__attribute__((noinline)) int +foo (long int a, int b, int c) +{ + return a + b + c; +} + +#pragma omp declare simd notinbranch +__attribute__((noinline)) long int +bar (int a, int b, long int c) +{ + return a + b + c; +} diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c new file mode 100644 index 00000000000..0eae49db97a --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-2.c @@ -0,0 +1,53 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int array[N] __attribute__((aligned (32))); + +#pragma omp declare simd simdlen(4) notinbranch aligned(a:16) uniform(a) linear(b) +#pragma omp declare simd simdlen(4) notinbranch aligned(a:32) uniform(a) linear(b) +#pragma omp declare simd simdlen(8) notinbranch aligned(a:16) uniform(a) linear(b) +#pragma omp declare simd simdlen(8) notinbranch aligned(a:32) uniform(a) linear(b) +__attribute__((noinline)) void +foo (int *a, int b, int c) +{ + a[b] = c; +} + +__attribute__((noinline, noclone)) void +bar () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + foo (array, i, i * array[i]); +} + +__attribute__((noinline, noclone)) void +baz () +{ + int i; + for (i = 0; i < N; i++) + array[i] = 5 * (i & 7); +} + +int +main () +{ + int i; + check_vect (); + baz (); + bar (); + for (i = 0; i < N; i++) + if (array[i] != 5 * (i & 7) * i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c new file mode 100644 index 00000000000..857c6f783e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-3.c @@ -0,0 +1,46 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int d[N], e[N]; + +#pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3) +__attribute__((noinline)) int +foo (int a, int b, int c) +{ + if (a < 30) + return 5; + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + { + d[i] = foo (i, 123, i * 3); + e[i] = e[i] + i; + } +} + +int +main () +{ + int i; + check_vect (); + bar (); + for (i = 0; i < N; i++) + if (d[i] != (i < 30 ? 5 : i * 4 + 123) || e[i] != i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c new file mode 100644 index 00000000000..c64f1b0bfe5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-4.c @@ -0,0 +1,49 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +float d[N]; +int e[N]; +unsigned short f[N]; + +#pragma omp declare simd simdlen(8) notinbranch uniform(b) +__attribute__((noinline)) float +foo (float a, float b, float c) +{ + if (a < 30) + return 5.0f; + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + { + d[i] = foo (i, 123, i * 3); + e[i] = e[i] * 3; + f[i] = f[i] + 1; + } +} + +int +main () +{ + int i; + check_vect (); + bar (); + for (i = 0; i < N; i++) + if (d[i] != (i < 30 ? 5.0f : i * 4 + 123.0f) || e[i] || f[i] != 1) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c new file mode 100644 index 00000000000..1d2b067a7d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-5.c @@ -0,0 +1,44 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int d[N], e[N]; + +#pragma omp declare simd simdlen(4) notinbranch uniform(b) linear(c:3) +__attribute__((noinline)) long long int +foo (int a, int b, int c) +{ + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar () +{ + int i; +#pragma omp simd + for (i = 0; i < N; ++i) + { + d[i] = foo (i, 123, i * 3); + e[i] = e[i] + i; + } +} + +int +main () +{ + int i; + check_vect (); + bar (); + for (i = 0; i < N; i++) + if (d[i] != i * 4 + 123 || e[i] != i) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-6.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-6.c new file mode 100644 index 00000000000..26995da86e3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-6.c @@ -0,0 +1,75 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N]; +long long int b[N]; +short c[N]; + +#pragma omp declare simd +#pragma omp declare simd uniform(b) linear(c:3) +__attribute__((noinline)) short +foo (int a, long long int b, short c) +{ + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar (int x) +{ + int i; + if (x == 0) + { + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = foo (a[i], b[i], c[i]); + } + else + { + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = foo (a[i], x, i * 3); + } +} + +__attribute__((noinline, noclone)) void +baz (void) +{ + int i; + for (i = 0; i < N; i++) + { + a[i] = 2 * i; + b[i] = -7 * i + 6; + c[i] = (i & 31) << 4; + } +} + +int +main () +{ + int i; + check_vect (); + baz (); + bar (0); + for (i = 0; i < N; i++) + if (a[i] != 2 * i || b[i] != 6 - 7 * i + || c[i] != 6 - 5 * i + ((i & 31) << 4)) + abort (); + else + a[i] = c[i]; + bar (17); + for (i = 0; i < N; i++) + if (a[i] != 6 - 5 * i + ((i & 31) << 4) + || b[i] != 6 - 7 * i + || c[i] != 23 - 2 * i + ((i & 31) << 4)) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-7.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-7.c new file mode 100644 index 00000000000..2745c5e41d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-7.c @@ -0,0 +1,75 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N]; +long long int b[N]; +short c[N]; + +#pragma omp declare simd +#pragma omp declare simd uniform(b) linear(c:3) +__attribute__((noinline)) short +foo (int a, long long int b, int c) +{ + return a + b + c; +} + +__attribute__((noinline, noclone)) void +bar (int x) +{ + int i; + if (x == 0) + { + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = foo (a[i], b[i], c[i]); + } + else + { + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = foo (a[i], x, i * 3); + } +} + +__attribute__((noinline, noclone)) void +baz (void) +{ + int i; + for (i = 0; i < N; i++) + { + a[i] = 2 * i; + b[i] = -7 * i + 6; + c[i] = (i & 31) << 4; + } +} + +int +main () +{ + int i; + check_vect (); + baz (); + bar (0); + for (i = 0; i < N; i++) + if (a[i] != 2 * i || b[i] != 6 - 7 * i + || c[i] != 6 - 5 * i + ((i & 31) << 4)) + abort (); + else + a[i] = c[i]; + bar (17); + for (i = 0; i < N; i++) + if (a[i] != 6 - 5 * i + ((i & 31) << 4) + || b[i] != 6 - 7 * i + || c[i] != 23 - 2 * i + ((i & 31) << 4)) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c new file mode 100644 index 00000000000..e0b09b645d4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-8.c @@ -0,0 +1,95 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N], b[N]; +long int c[N]; +unsigned char d[N]; + +#pragma omp declare simd simdlen(8) notinbranch +__attribute__((noinline)) int +foo (long int a, int b, int c) +{ + return a + b + c; +} + +#pragma omp declare simd simdlen(8) notinbranch +__attribute__((noinline)) long int +bar (int a, int b, long int c) +{ + return a + b + c; +} + +__attribute__((noinline)) void +fn1 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + a[i] = foo (c[i], a[i], b[i]) + 6; + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = bar (a[i], b[i], c[i]) * 2; +} + +__attribute__((noinline)) void +fn2 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + { + a[i] = foo (c[i], a[i], b[i]) + 6; + d[i]++; + } + #pragma omp simd + for (i = 0; i < N; i++) + { + c[i] = bar (a[i], b[i], c[i]) * 2; + d[i] /= 2; + } +} + +__attribute__((noinline)) void +fn3 (void) +{ + int i; + for (i = 0; i < N; i++) + { + a[i] = i * 2; + b[i] = 17 + (i % 37); + c[i] = (i & 63); + d[i] = 16 + i; + } +} + +int +main () +{ + int i; + check_vect (); + fn3 (); + fn1 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63)) + abort (); + fn3 (); + fn2 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63) + || d[i] != ((unsigned char) (17 + i)) / 2) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-9.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-9.c new file mode 100644 index 00000000000..0c5ff4fa438 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-9.c @@ -0,0 +1,95 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#include "tree-vect.h" + +#ifndef N +#define N 1024 +#endif + +int a[N], b[N]; +long int c[N]; +unsigned char d[N]; + +#pragma omp declare simd notinbranch +__attribute__((noinline)) static int +foo (long int a, int b, int c) +{ + return a + b + c; +} + +#pragma omp declare simd notinbranch +__attribute__((noinline)) static long int +bar (int a, int b, long int c) +{ + return a + b + c; +} + +__attribute__((noinline)) void +fn1 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + a[i] = foo (c[i], a[i], b[i]) + 6; + #pragma omp simd + for (i = 0; i < N; i++) + c[i] = bar (a[i], b[i], c[i]) * 2; +} + +__attribute__((noinline)) void +fn2 (void) +{ + int i; + #pragma omp simd + for (i = 0; i < N; i++) + { + a[i] = foo (c[i], a[i], b[i]) + 6; + d[i]++; + } + #pragma omp simd + for (i = 0; i < N; i++) + { + c[i] = bar (a[i], b[i], c[i]) * 2; + d[i] /= 2; + } +} + +__attribute__((noinline)) void +fn3 (void) +{ + int i; + for (i = 0; i < N; i++) + { + a[i] = i * 2; + b[i] = 17 + (i % 37); + c[i] = (i & 63); + d[i] = 16 + i; + } +} + +int +main () +{ + int i; + check_vect (); + fn3 (); + fn1 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63)) + abort (); + fn3 (); + fn2 (); + for (i = 0; i < N; i++) + if (a[i] != i * 2 + 23 + (i % 37) + (i & 63) + || b[i] != 17 + (i % 37) + || c[i] != i * 4 + 80 + 4 * (i % 37) + 4 * (i & 63) + || d[i] != ((unsigned char) (17 + i)) / 2) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index bea7ee0064b..796f83ea4e0 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -76,7 +76,7 @@ lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" # Main loop. set VECT_ADDITIONAL_FLAGS [list ""] if { [check_effective_target_lto] } { - lappend VECT_ADDITIONAL_FLAGS "-flto" + lappend VECT_ADDITIONAL_FLAGS "-flto -ffat-lto-objects" } foreach flags $VECT_ADDITIONAL_FLAGS { dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \ diff --git a/gcc/testsuite/gcc.target/aarch64/vmov_n_1.c b/gcc/testsuite/gcc.target/aarch64/vmov_n_1.c new file mode 100644 index 00000000000..b9d094a044a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vmov_n_1.c @@ -0,0 +1,349 @@ +/* Test vmov_n works correctly. */ +/* { dg-do run } */ +/* { dg-options "-O3 --save-temps" } */ + +#include <arm_neon.h> + +extern void abort (void); + +#define INHIB_OPTIMIZATION asm volatile ("" : : : "memory") + +#define CONCAT(a, b) a##b +#define CONCAT1(a, b) CONCAT (a, b) +#define REG_INFEX64 _ +#define REG_INFEX128 q_ +#define REG_INFEX(reg_len) REG_INFEX##reg_len +#define POSTFIX_N(reg_len, data_len, data_type) \ + CONCAT1 (REG_INFEX (reg_len), n_##data_type##data_len) +#define LANE_POSTFIX(reg_len, data_len, data_type) \ + CONCAT1 (REG_INFEX (reg_len),lane_##data_type##data_len) + +/* Test values consist of bytes with following hex values. + For example: + TEST1 for int16_t will be 0xaaaa + TEST1 for int32_t will be 0xaaaaaaaa + etc. */ + +#define TEST1h aa +#define TEST2h 55 +#define TEST3h ff +#define TEST4h 00 +#define TEST5h cc +#define TEST6h 33 + +#define TESTh_8(x) TEST##x##h +#define TESTh_16(x) CONCAT1 (TESTh_8 (x), TESTh_8 (x)) +#define TESTh_32(x) CONCAT1 (TESTh_16 (x), TESTh_16 (x)) +#define TESTh_64(x) CONCAT1 (TESTh_32 (x), TESTh_32 (x)) + +#define TEST_8(x) CONCAT1 (0x, TESTh_8 (x)) +#define TEST_16(x) CONCAT1 (0x, TESTh_16 (x)) +#define TEST_32(x) CONCAT1 (0x, TESTh_32 (x)) +#define TEST_64(x) CONCAT1 (0x, TESTh_64 (x)) + +#define TEST(test, data_len) \ + CONCAT1 (TEST, _##data_len) (test) + +#define GET_ELEMENT(reg_len, data_len, data_type) \ + CONCAT1 (vget, LANE_POSTFIX (reg_len, data_len, data_type)) + +#define VMOV_INST(reg_len, data_len, data_type) \ + CONCAT1 (vmov, POSTFIX_N (reg_len, data_len, data_type)) + +#define VMOV_OBSCURE_INST(reg_len, data_len, data_type) \ + CONCAT1 (VMOV_INST (reg_len, data_len, data_type), _obscure) + +#define RUN_TEST(reg_len, data_len, data_type, \ + test, n, a, b, c) \ +{ \ + int i; \ + INHIB_OPTIMIZATION; \ + (a) = TEST (test, data_len); \ + INHIB_OPTIMIZATION; \ + (b) = VMOV_OBSCURE_INST (reg_len, data_len, data_type) (&(a)); \ + (c) = TEST (test, data_len); \ + for (i = 0; i < n; i++) \ + { \ + INHIB_OPTIMIZATION; \ + a = GET_ELEMENT (reg_len, data_len, data_type) (b, i); \ + if ((a) != (c)) \ + return 1; \ + } \ +} + +#define TYPE_f32 float32_t +#define TYPE_64_f32 float32x2_t +#define TYPE_128_f32 float32x4_t + +#define TYPE_f64 float64_t +#define TYPE_64_f64 float64x1_t +#define TYPE_128_f64 float64x2_t + +#define TYPE_s8 int8_t +#define TYPE_64_s8 int8x8_t +#define TYPE_128_s8 int8x16_t + +#define TYPE_s16 int16_t +#define TYPE_64_s16 int16x4_t +#define TYPE_128_s16 int16x8_t + +#define TYPE_s32 int32_t +#define TYPE_64_s32 int32x2_t +#define TYPE_128_s32 int32x4_t + +#define TYPE_s64 int64_t +#define TYPE_64_s64 int64x1_t +#define TYPE_128_s64 int64x2_t + +#define TYPE_u8 uint8_t +#define TYPE_64_u8 uint8x8_t +#define TYPE_128_u8 uint8x16_t + +#define TYPE_u16 uint16_t +#define TYPE_64_u16 uint16x4_t +#define TYPE_128_u16 uint16x8_t + +#define TYPE_u32 uint32_t +#define TYPE_64_u32 uint32x2_t +#define TYPE_128_u32 uint32x4_t + +#define TYPE_u64 uint64_t +#define TYPE_64_u64 uint64x1_t +#define TYPE_128_u64 uint64x2_t + +#define TYPE_p8 poly8_t +#define TYPE_64_p8 poly8x8_t +#define TYPE_128_p8 poly8x16_t + +#define TYPE_p16 poly16_t +#define TYPE_64_p16 poly16x4_t +#define TYPE_128_p16 poly16x8_t + +#define DIV64_8 8 +#define DIV64_16 4 +#define DIV64_32 2 +#define DIV64_64 1 + +#define DIV128_8 16 +#define DIV128_16 8 +#define DIV128_32 4 +#define DIV128_64 2 + +#define DIV(reg_len, data_len) \ +CONCAT1 (CONCAT1 (DIV, reg_len), \ + CONCAT1 (_, data_len)) + +#define VECTOR_TYPE(reg_len, data_len, data_type) \ +CONCAT1 (CONCAT1 (CONCAT1 (TYPE_,reg_len), \ + CONCAT1 (_,data_type)), \ + data_len) + +#define SIMPLE_TYPE(data_len, data_type) \ +CONCAT1 (TYPE_, \ + CONCAT1 (data_type, \ + data_len)) + +#define OBSCURE_FUNC_NAME(reg_len, data_type, data_len) \ +CONCAT1 (CONCAT1 (vmov, \ + POSTFIX_N (reg_len, data_len, data_type)), \ + _obscure) + +#define OBSCURE_FUNC(reg_len, data_len, data_type) \ +VECTOR_TYPE (reg_len, data_len, data_type) \ +__attribute__ ((noinline)) \ +OBSCURE_FUNC_NAME (reg_len, data_type, data_len) \ + (SIMPLE_TYPE (data_len, data_type) *ap) \ +{ \ + SIMPLE_TYPE (data_len, data_type) register a; \ + INHIB_OPTIMIZATION; \ + a = *ap; \ + INHIB_OPTIMIZATION; \ + return VMOV_INST (reg_len, data_len, data_type) (a); \ +} + +#define TESTFUNC_NAME(reg_len, data_type, data_len) \ +CONCAT1 (test_vmov, \ + POSTFIX_N (reg_len, data_len, data_type)) + +#define TESTFUNC(reg_len, data_len, data_type) \ +int \ +TESTFUNC_NAME (reg_len, data_type, data_len) () \ +{ \ + SIMPLE_TYPE (data_len, data_type) a; \ + VECTOR_TYPE (reg_len, data_len, data_type) b; \ + SIMPLE_TYPE (data_len, data_type) c; \ + \ + RUN_TEST (reg_len, data_len, data_type, 1, \ + DIV (reg_len, data_len), a, b, c); \ + RUN_TEST (reg_len, data_len, data_type, 2, \ + DIV (reg_len, data_len), a, b, c); \ + RUN_TEST (reg_len, data_len, data_type, 3, \ + DIV (reg_len, data_len), a, b, c); \ + RUN_TEST (reg_len, data_len, data_type, 4, \ + DIV (reg_len, data_len), a, b, c); \ + RUN_TEST (reg_len, data_len, data_type, 5, \ + DIV (reg_len, data_len), a, b, c); \ + RUN_TEST (reg_len, data_len, data_type, 6, \ + DIV (reg_len, data_len), a, b, c); \ + return 0; \ +} + +OBSCURE_FUNC (64, 32, f) +TESTFUNC (64, 32, f) +/* "dup Vd.2s, Rn" is less preferable then "dup Vd.2s, Vn.s[lane]". */ +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, v\[0-9\]+\.s\\\[\[0-9\]+\\\]" 1 } } */ + +OBSCURE_FUNC (64, 64, f) +TESTFUNC (64, 64, f) +/* "fmov Dd, Rn" is generated instead of "dup Dd, Rn". + No assembley scan included. */ + +OBSCURE_FUNC (64, 8, p) +TESTFUNC (64, 8, p) +/* Generates "dup Vd.8b, Rn". Scan found near s8 version. */ + +OBSCURE_FUNC (64, 16, p) +TESTFUNC (64, 16, p) +/* Generates "dup Vd.4h, Rn". Scan found near s16 version. */ + +OBSCURE_FUNC (64, 8, s) +TESTFUNC (64, 8, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8b, w\[0-9\]+" 3 } } */ + +OBSCURE_FUNC (64, 16, s) +TESTFUNC (64, 16, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4h, w\[0-9\]+" 3 } } */ + +OBSCURE_FUNC (64, 32, s) +TESTFUNC (64, 32, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2s, w\[0-9\]+" 2 } } */ + +OBSCURE_FUNC (64, 64, s) +TESTFUNC (64, 64, s) +/* "fmov Dd, Rn" is generated instead of "dup Dd, Rn". + No assembley scan included. */ + +OBSCURE_FUNC (64, 8, u) +TESTFUNC (64, 8, u) +/* Generates "dup Vd.8b, Rn". Scan found near s8 version. */ + +OBSCURE_FUNC (64, 16, u) +TESTFUNC (64, 16, u) +/* Generates "dup Vd.4h, Rn". Scan found near s16 version. */ + +OBSCURE_FUNC (64, 32, u) +TESTFUNC (64, 32, u) +/* Generates "dup Vd.2s, Rn". Scan found near s32 version. */ + +OBSCURE_FUNC (64, 64, u) +TESTFUNC (64, 64, u) +/* "fmov Dd, Rn" is generated instead of "dup Dd, Rn". + No assembley scan included. */ + +OBSCURE_FUNC (128, 32, f) +TESTFUNC (128, 32, f) +/* "dup Vd.4s, Rn" is less preferable then "dup Vd.4s, Vn.s[lane]". */ +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, v\[0-9\]+\.s\\\[\[0-9\]+\\\]" 1 } } */ + +OBSCURE_FUNC (128, 64, f) +TESTFUNC (128, 64, f) +/* "dup Vd.2d, Rn" is less preferable then "dup Vd.2d, Vn.d[lane]". */ +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2d, v\[0-9\]+\.d\\\[\[0-9\]+\\\]" 1 } } */ + +OBSCURE_FUNC (128, 8, p) +TESTFUNC (128, 8, p) +/* Generates "dup Vd.16b, Rn". Scan found near s8 version. */ + +OBSCURE_FUNC (128, 16, p) +TESTFUNC (128, 16, p) +/* Generates "dup Vd.8h, Rn". Scan found near s16 version. */ + +OBSCURE_FUNC (128, 8, s) +TESTFUNC (128, 8, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.16b, w\[0-9\]+" 3 } } */ + +OBSCURE_FUNC (128, 16, s) +TESTFUNC (128, 16, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.8h, w\[0-9\]+" 3 } } */ + +OBSCURE_FUNC (128, 32, s) +TESTFUNC (128, 32, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.4s, w\[0-9\]+" 2 } } */ + +OBSCURE_FUNC (128, 64, s) +TESTFUNC (128, 64, s) +/* { dg-final { scan-assembler-times "dup\\tv\[0-9\]+\.2d, x\[0-9\]+" 2 } } */ + +OBSCURE_FUNC (128, 8, u) +TESTFUNC (128, 8, u) +/* Generates "dup Vd.16b, Rn". Scan found near s8 version. */ + +OBSCURE_FUNC (128, 16, u) +TESTFUNC (128, 16, u) +/* Generates "dup Vd.8h, Rn". Scan found near s16 version. */ + +OBSCURE_FUNC (128, 32, u) +TESTFUNC (128, 32, u) +/* Generates "dup Vd.4s, Rn". Scan found near s32 version. */ + +OBSCURE_FUNC (128, 64, u) +TESTFUNC (128, 64, u) +/* Generates "dup Vd.2d, Rn". Scan found near s64 version. */ + +int +main (int argc, char **argv) +{ + if (test_vmov_n_f32 ()) + abort (); + if (test_vmov_n_f64 ()) + abort (); + if (test_vmov_n_p8 ()) + abort (); + if (test_vmov_n_p16 ()) + abort (); + if (test_vmov_n_s8 ()) + abort (); + if (test_vmov_n_s16 ()) + abort (); + if (test_vmov_n_s32 ()) + abort (); + if (test_vmov_n_s64 ()) + abort (); + if (test_vmov_n_u8 ()) + abort (); + if (test_vmov_n_u16 ()) + abort (); + if (test_vmov_n_u32 ()) + abort (); + if (test_vmov_n_u64 ()) + abort (); + + if (test_vmovq_n_f32 ()) + abort (); + if (test_vmovq_n_f64 ()) + abort (); + if (test_vmovq_n_p8 ()) + abort (); + if (test_vmovq_n_p16 ()) + abort (); + if (test_vmovq_n_s8 ()) + abort (); + if (test_vmovq_n_s16 ()) + abort (); + if (test_vmovq_n_s32 ()) + abort (); + if (test_vmovq_n_s64 ()) + abort (); + if (test_vmovq_n_u8 ()) + abort (); + if (test_vmovq_n_u16 ()) + abort (); + if (test_vmovq_n_u32 ()) + abort (); + if (test_vmovq_n_u64 ()) + abort (); + + return 0; +} + +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/arm/20131120.c b/gcc/testsuite/gcc.target/arm/20131120.c new file mode 100644 index 00000000000..c370ae60cd8 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/20131120.c @@ -0,0 +1,14 @@ +/* Check that CONST_INT is not forced into REG before PLUS. */ +/* { dg-do compile { target { arm_arm_ok || arm_thumb2_ok} } } */ +/* { dg-options "-O2 -fdump-rtl-expand" } */ + +typedef int Arr2[50][50]; + +void +foo (Arr2 a2, int i) +{ + a2[i+20][i] = 1; +} + +/* { dg-final { scan-rtl-dump-not "\\\(set \\\(reg:SI \[0-9\]*\\\)\[\n\r\]+\[ \t]*\\\(const_int 4000" "expand" } } */ +/* { dg-final { cleanup-rtl-dump "expand" } } */ diff --git a/gcc/testsuite/gcc.target/arm/lp1243022.c b/gcc/testsuite/gcc.target/arm/lp1243022.c index 91a544d1b7d..cb405908e05 100644 --- a/gcc/testsuite/gcc.target/arm/lp1243022.c +++ b/gcc/testsuite/gcc.target/arm/lp1243022.c @@ -1,7 +1,7 @@ /* { dg-do compile { target arm_thumb2 } } */ /* { dg-options "-O2 -fdump-rtl-subreg2" } */ -/* { dg-final { scan-rtl-dump "REG_INC" "subreg2" } } */ +/* { dg-final { scan-rtl-dump "REG_INC" "subreg2" { target { ! arm_neon } } } } */ /* { dg-final { cleanup-rtl-dump "subreg2" } } */ struct device; typedef unsigned int __u32; diff --git a/gcc/testsuite/gcc.target/arm/negdi-2.c b/gcc/testsuite/gcc.target/arm/negdi-2.c index 96bbcab337e..4444c20ea9c 100644 --- a/gcc/testsuite/gcc.target/arm/negdi-2.c +++ b/gcc/testsuite/gcc.target/arm/negdi-2.c @@ -11,6 +11,6 @@ Expected output: rsb r0, r0, #0 mov r1, #0 */ -/* { dg-final { scan-assembler-times "rsb\\tr0, r0, #0" 1 { target { arm_nothumb } } } } */ -/* { dg-final { scan-assembler-times "negs\\tr0, r0" 1 { target { ! arm_nothumb } } } } */ +/* { dg-final { scan-assembler-times "rsb\\t...?, ...?, #0" 1 { target { arm_nothumb } } } } */ +/* { dg-final { scan-assembler-times "negs\\t...?, ...?" 1 { target { ! arm_nothumb } } } } */ /* { dg-final { scan-assembler-times "mov" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/negdi-4.c b/gcc/testsuite/gcc.target/arm/negdi-4.c deleted file mode 100644 index dc3deaad5ad..00000000000 --- a/gcc/testsuite/gcc.target/arm/negdi-4.c +++ /dev/null @@ -1,16 +0,0 @@ -/* { dg-do compile } */ -/* { dg-require-effective-target arm32 } */ -/* { dg-options "-O2" } */ - -signed long long negdi_extendsidi (signed int x) -{ - return -((signed long long) x); -} -/* -Expected output: - rsbs r0, r0, #0 - mov r1, r0, asr #31 -*/ -/* { dg-final { scan-assembler-times "rsb" 1 } } */ -/* { dg-final { scan-assembler-times "asr" 1 } } */ -/* { dg-final { scan-assembler-times "rsc" 0 } } */ diff --git a/gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c b/gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c new file mode 100644 index 00000000000..df269fc8476 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-pic-high-reg.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-options "-mthumb -fpic -mpic-register=9" } */ + +int g_test; + +int +foo (int par) +{ + g_test = par; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c b/gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c new file mode 100644 index 00000000000..6e9b2570a4a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb1-pic-single-base.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-options "-mthumb -fpic -msingle-pic-base" } */ + +int g_test; + +int +foo (int par) +{ + g_test = par; +} diff --git a/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data.c b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data.c new file mode 100644 index 00000000000..9852ea5d0bd --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/thumb2-slow-flash-data.c @@ -0,0 +1,74 @@ +/* The option -mslow-flash-data is just for performance tuning, it + doesn't totally disable the use of literal pools. But for below + simple cases, the use of literal pool should be replaced by + movw/movt or read-only constant pool. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target arm_cortex_m } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options "-O2 -mthumb -mslow-flash-data" } */ + +float sf; +double df; +long long l; +static char *p = "Hello World"; + +float +testsf (float *p) +{ + if (*p > 1.1234f) + return 2.1234f; + else + return 3.1234f; +} + +double +testdf (double *p) +{ + if (*p > 4.1234) + return 2.1234; + else + return 3.1234; +} + +long long +testll (long long *p) +{ + if (*p > 0x123456789ABCDEFll) + return 0x111111111ll; + else + return 0x222222222ll; +} + +char * +testchar () +{ + return p + 4; +} + +int +foo (int a, int b) +{ + int i; + volatile *labelref = &&label1; + + if (a > b) + { + while (i < b) + { + a += *labelref; + i += 1; + } + goto *labelref; + } + else + b = b + 3; + + a = a * b; + +label1: + return a + b; +} + +/* { dg-final { scan-assembler-times "movt" 13 } } */ +/* { dg-final { scan-assembler-times "movt.*LC0\\+4" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/vrinta-ce.c b/gcc/testsuite/gcc.target/arm/vrinta-ce.c new file mode 100644 index 00000000000..71c5b3b0e37 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/vrinta-ce.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_v8_vfp_ok } */ +/* { dg-options "-O2 -marm -march=armv8-a" } */ +/* { dg-add-options arm_v8_vfp } */ + +double foo (double a) +{ + if (a > 3.0) + return __builtin_round (a); + + return 0.0; +} + +/* { dg-final { scan-assembler-times "vrinta.f64\td\[0-9\]+" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/i386/i386.exp b/gcc/testsuite/gcc.target/i386/i386.exp index 15f744cf2de..c7c26766bc2 100644 --- a/gcc/testsuite/gcc.target/i386/i386.exp +++ b/gcc/testsuite/gcc.target/i386/i386.exp @@ -209,18 +209,6 @@ proc check_effective_target_lzcnt { } { } "-mlzcnt" ] } -# Return 1 if avx2 instructions can be compiled. -proc check_effective_target_avx2 { } { - return [check_no_compiler_messages avx2 object { - typedef long long __v4di __attribute__ ((__vector_size__ (32))); - __v4di - mm256_is32_andnotsi256 (__v4di __X, __v4di __Y) - { - return __builtin_ia32_andnotsi256 (__X, __Y); - } - } "-O0 -mavx2" ] -} - # Return 1 if bmi instructions can be compiled. proc check_effective_target_bmi { } { return [check_no_compiler_messages bmi object { diff --git a/gcc/testsuite/gcc.target/i386/pr57293.c b/gcc/testsuite/gcc.target/i386/pr57293.c new file mode 100644 index 00000000000..fa016d55f25 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr57293.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-O2 -fomit-frame-pointer" } */ +/* { dg-final { scan-assembler-not "%ebp" } } */ + +__attribute__((__noinline__, __noclone__, __stdcall__)) void g(int a) +{ + __builtin_printf("in g(): %d\n", a); +} + +__attribute__((__noinline__, __noclone__, __thiscall__)) void h(int a, int b) +{ + __builtin_printf("in h(): %d %d\n", a, b); +} + +void f() +{ + g(0); + h(0, 1); + __builtin_puts("in f()"); +} diff --git a/gcc/testsuite/gcc.target/i386/pr57410.c b/gcc/testsuite/gcc.target/i386/pr57410.c new file mode 100644 index 00000000000..6ca65d00030 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr57410.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fpeel-loops" } */ + +extern char outbuffer[]; +extern char buffer[]; + +void foo(int j) +{ + unsigned i, fp = fp; + for (i = 0; i < 6; i++) + buffer[j++] = outbuffer[fp - i]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr58944.c b/gcc/testsuite/gcc.target/i386/pr58944.c new file mode 100644 index 00000000000..8164cf99508 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr58944.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Wunused-macros -march=native" } */ + +#pragma GCC push_options +#pragma GCC target("xsaveopt") +void fn1(void) {} +#pragma GCC pop_options + +/* { dg-prune-output "macro \"__code_model_" } */ +/* { dg-prune-output "macro \"__XSAVE__\" is not used" } */ +/* { dg-prune-output "macro \"__XSAVEOPT__\" is not used" } */ diff --git a/gcc/testsuite/gcc.target/i386/pr59363.c b/gcc/testsuite/gcc.target/i386/pr59363.c new file mode 100644 index 00000000000..a4e12403543 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr59363.c @@ -0,0 +1,24 @@ +/* PR target/59363 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mtune=amdfam10" } */ + +typedef struct { + int ctxlen; + long interhunkctxlen; + int flags; + long find_func; + void *find_func_priv; + int hunk_func; +} xdemitconf_t; + +__attribute__((noinline)) +int xdi_diff(xdemitconf_t *xecfg) { + if (xecfg->hunk_func == 0) + __builtin_abort(); + return 0; +} +int main() { + xdemitconf_t xecfg = {0}; + xecfg.hunk_func = 1; + return xdi_diff(&xecfg); +} diff --git a/gcc/testsuite/gcc.target/i386/xop-frczX.c b/gcc/testsuite/gcc.target/i386/xop-frczX.c new file mode 100644 index 00000000000..931b5ce397b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/xop-frczX.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-require-effective-target xop } */ +/* { dg-options "-O2 -mxop" } */ + +#include "xop-check.h" + +#include <x86intrin.h> + +void +check_mm_vmfrcz_sd (__m128d __A, __m128d __B) +{ + union128d a, b, c; + double d[2]; + + a.x = __A; + b.x = __B; + c.x = _mm_frcz_sd (__A, __B); + d[0] = b.a[0] - (int)b.a[0] ; + d[1] = a.a[1]; + if (check_union128d (c, d)) + abort (); +} + +void +check_mm_vmfrcz_ss (__m128 __A, __m128 __B) +{ + union128 a, b, c; + float f[4]; + + a.x = __A; + b.x = __B; + c.x = _mm_frcz_ss (__A, __B); + f[0] = b.a[0] - (int)b.a[0] ; + f[1] = a.a[1]; + f[2] = a.a[2]; + f[3] = a.a[3]; + if (check_union128 (c, f)) + abort (); +} + +static void +xop_test (void) +{ + union128 a, b; + union128d c,d; + int i; + + for (i = 0; i < 4; i++) + { + a.a[i] = i + 3.5; + b.a[i] = i + 7.9; + } + for (i = 0; i < 2; i++) + { + c.a[i] = i + 3.5; + d.a[i] = i + 7.987654321; + } + check_mm_vmfrcz_ss (a.x, b.x); + check_mm_vmfrcz_sd (c.x, d.x); +} diff --git a/gcc/testsuite/gcc.target/nds32/basic-main.c b/gcc/testsuite/gcc.target/nds32/basic-main.c new file mode 100644 index 00000000000..6fdbc357fbd --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/basic-main.c @@ -0,0 +1,9 @@ +/* This is a basic main function test program. */ + +/* { dg-do run } */ +/* { dg-options "-O0" } */ + +int main(void) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-isb.c b/gcc/testsuite/gcc.target/nds32/builtin-isb.c new file mode 100644 index 00000000000..e65061bae0d --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-isb.c @@ -0,0 +1,11 @@ +/* Verify that we generate isb instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tisb" } } */ + +void +test (void) +{ + __builtin_nds32_isb (); +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-isync.c b/gcc/testsuite/gcc.target/nds32/builtin-isync.c new file mode 100644 index 00000000000..3160e4ad385 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-isync.c @@ -0,0 +1,12 @@ +/* Verify that we generate isync instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tisync" } } */ + +void +test (void) +{ + int *addr = (int *) 0x53000000; + __builtin_nds32_isync (addr); +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-mfsr-mtsr.c b/gcc/testsuite/gcc.target/nds32/builtin-mfsr-mtsr.c new file mode 100644 index 00000000000..db4c55845c0 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-mfsr-mtsr.c @@ -0,0 +1,17 @@ +/* Verify that we generate mfsr/mtsr instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tmfsr" } } */ +/* { dg-final { scan-assembler "\\tmtsr" } } */ + +#include <nds32_intrinsic.h> + +void +test (void) +{ + int ipsw_value; + + ipsw_value = __builtin_nds32_mfsr (__NDS32_REG_IPSW__); + __builtin_nds32_mtsr (ipsw_value, __NDS32_REG_IPSW__); +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-mfusr-mtusr.c b/gcc/testsuite/gcc.target/nds32/builtin-mfusr-mtusr.c new file mode 100644 index 00000000000..3cfaab95114 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-mfusr-mtusr.c @@ -0,0 +1,17 @@ +/* Verify that we generate mfusr/mtusr instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tmfusr" } } */ +/* { dg-final { scan-assembler "\\tmtusr" } } */ + +#include <nds32_intrinsic.h> + +void +test (void) +{ + int itype_value; + + itype_value = __builtin_nds32_mfusr (__NDS32_REG_ITYPE__); + __builtin_nds32_mtusr (itype_value, __NDS32_REG_ITYPE__); +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-setgie-dis.c b/gcc/testsuite/gcc.target/nds32/builtin-setgie-dis.c new file mode 100644 index 00000000000..2dceed98ac8 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-setgie-dis.c @@ -0,0 +1,11 @@ +/* Verify that we generate setgie.d instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tsetgie.d" } } */ + +void +test (void) +{ + __builtin_nds32_setgie_dis (); +} diff --git a/gcc/testsuite/gcc.target/nds32/builtin-setgie-en.c b/gcc/testsuite/gcc.target/nds32/builtin-setgie-en.c new file mode 100644 index 00000000000..892887019c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/builtin-setgie-en.c @@ -0,0 +1,11 @@ +/* Verify that we generate setgie.e instruction with builtin function. */ + +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* { dg-final { scan-assembler "\\tsetgie.e" } } */ + +void +test (void) +{ + __builtin_nds32_setgie_en (); +} diff --git a/gcc/testsuite/gcc.target/nds32/nds32.exp b/gcc/testsuite/gcc.target/nds32/nds32.exp new file mode 100644 index 00000000000..e88d0222729 --- /dev/null +++ b/gcc/testsuite/gcc.target/nds32/nds32.exp @@ -0,0 +1,45 @@ +# Target test cases of Andes NDS32 cpu for GNU compiler +# Copyright (C) 2012-2013 Free Software Foundation, Inc. +# Contributed by Andes Technology Corporation. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3, or (at your +# option) any later version. +# +# GCC is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't a nds32 target. +if ![istarget nds32*-*-*] then { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# If a testcase doesn't have special options, use these. +global DEFAULT_CFLAGS +if ![info exists DEFAULT_CFLAGS] then { + set DEFAULT_CFLAGS " -ansi -pedantic-errors" +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ + "" $DEFAULT_CFLAGS + +# All done. +dg-finish diff --git a/gcc/testsuite/gcc.target/powerpc/bool3-av.c b/gcc/testsuite/gcc.target/powerpc/bool3-av.c index 4ef82c8cd97..d4aac786b2c 100644 --- a/gcc/testsuite/gcc.target/powerpc/bool3-av.c +++ b/gcc/testsuite/gcc.target/powerpc/bool3-av.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ /* { dg-options "-O2 -mcpu=power6 -mabi=altivec -maltivec -mno-vsx" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bool3-p7.c b/gcc/testsuite/gcc.target/powerpc/bool3-p7.c index a077ba5aea7..34e3c9e79dd 100644 --- a/gcc/testsuite/gcc.target/powerpc/bool3-p7.c +++ b/gcc/testsuite/gcc.target/powerpc/bool3-p7.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-options "-O2 -mcpu=power7" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bool3-p8.c b/gcc/testsuite/gcc.target/powerpc/bool3-p8.c index 361a0452d7d..e1b2dfa7ee2 100644 --- a/gcc/testsuite/gcc.target/powerpc/bool3-p8.c +++ b/gcc/testsuite/gcc.target/powerpc/bool3-p8.c @@ -1,4 +1,4 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-O2 -mcpu=power8" } */ diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c b/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c index 534a04a937b..2569ac84369 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-double1.c @@ -3,13 +3,14 @@ /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-mcpu=power8 -O2" } */ -/* { dg-final { scan-assembler-times "mtvsrd" 1 } } */ -/* { dg-final { scan-assembler-times "mfvsrd" 1 } } */ +/* { dg-final { scan-assembler "mtvsrd" } } */ +/* { dg-final { scan-assembler "mfvsrd" } } */ -/* Check code generation for direct move for long types. */ +/* Check code generation for direct move for double types. */ #define TYPE double #define IS_FLOAT 1 #define NO_ALTIVEC 1 +#define VSX_REG_ATTR "ws" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c b/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c index 750debfc0df..c8702204b70 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-double2.c @@ -10,5 +10,6 @@ #define IS_FLOAT 1 #define NO_ALTIVEC 1 #define DO_MAIN +#define VSX_REG_ATTR "ws" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c b/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c index ff1e97c0d43..524c0eead43 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-float1.c @@ -3,15 +3,16 @@ /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-mcpu=power8 -O2" } */ -/* { dg-final { scan-assembler-times "mtvsrd" 2 } } */ -/* { dg-final { scan-assembler-times "mfvsrd" 2 } } */ -/* { dg-final { scan-assembler-times "xscvdpspn" 2 } } */ -/* { dg-final { scan-assembler-times "xscvspdpn" 2 } } */ +/* { dg-final { scan-assembler "mtvsrd" } } */ +/* { dg-final { scan-assembler "mfvsrd" } } */ +/* { dg-final { scan-assembler "xscvdpspn" } } */ +/* { dg-final { scan-assembler "xscvspdpn" } } */ -/* Check code generation for direct move for long types. */ +/* Check code generation for direct move for float types. */ #define TYPE float #define IS_FLOAT 1 #define NO_ALTIVEC 1 +#define VSX_REG_ATTR "ww" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c b/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c index ace728ff6d4..352e76166d0 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-float2.c @@ -10,5 +10,6 @@ #define IS_FLOAT 1 #define NO_ALTIVEC 1 #define DO_MAIN +#define VSX_REG_ATTR "ww" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c b/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c index 907e802c72b..0a78f9cb258 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-long1.c @@ -3,13 +3,14 @@ /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-mcpu=power8 -O2" } */ -/* { dg-final { scan-assembler-times "mtvsrd" 1 } } */ -/* { dg-final { scan-assembler-times "mfvsrd" 2 } } */ +/* { dg-final { scan-assembler "mtvsrd" } } */ +/* { dg-final { scan-assembler "mfvsrd" } } */ /* Check code generation for direct move for long types. */ #define TYPE long #define IS_INT 1 #define NO_ALTIVEC 1 +#define VSX_REG_ATTR "d" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c b/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c index fba613e4548..cee9e0e0f1d 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-long2.c @@ -10,5 +10,6 @@ #define IS_INT 1 #define NO_ALTIVEC 1 #define DO_MAIN +#define VSX_REG_ATTR "d" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c b/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c index cdfa18857f1..3067b9a8e62 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-vint1.c @@ -3,11 +3,12 @@ /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-options "-mcpu=power8 -O2" } */ -/* { dg-final { scan-assembler-times "mtvsrd" 4 } } */ -/* { dg-final { scan-assembler-times "mfvsrd" 4 } } */ +/* { dg-final { scan-assembler "mtvsrd" } } */ +/* { dg-final { scan-assembler "mfvsrd" } } */ -/* Check code generation for direct move for long types. */ +/* Check code generation for direct move for vector types. */ #define TYPE vector int +#define VSX_REG_ATTR "wa" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c b/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c index 5c0c9abdac5..0d8264faf71 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c +++ b/gcc/testsuite/gcc.target/powerpc/direct-move-vint2.c @@ -8,5 +8,6 @@ #define TYPE vector int #define DO_MAIN +#define VSX_REG_ATTR "wa" #include "direct-move.h" diff --git a/gcc/testsuite/gcc.target/powerpc/direct-move.h b/gcc/testsuite/gcc.target/powerpc/direct-move.h index c1709e6c7ef..6a5b7ba1806 100644 --- a/gcc/testsuite/gcc.target/powerpc/direct-move.h +++ b/gcc/testsuite/gcc.target/powerpc/direct-move.h @@ -3,6 +3,10 @@ #include <math.h> extern void abort (void); +#ifndef VSX_REG_ATTR +#define VSX_REG_ATTR "wa" +#endif + void __attribute__((__noinline__)) copy (TYPE *a, TYPE *b) { @@ -44,7 +48,7 @@ void __attribute__((__noinline__)) load_vsx (TYPE *a, TYPE *b) { TYPE c = *a; - __asm__ ("# vsx, reg = %x0" : "+wa" (c)); + __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c)); *b = c; } #endif @@ -57,7 +61,7 @@ load_gpr_to_vsx (TYPE *a, TYPE *b) TYPE d; __asm__ ("# gpr, reg = %0" : "+b" (c)); d = c; - __asm__ ("# vsx, reg = %x0" : "+wa" (d)); + __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (d)); *b = d; } #endif @@ -68,7 +72,7 @@ load_vsx_to_gpr (TYPE *a, TYPE *b) { TYPE c = *a; TYPE d; - __asm__ ("# vsx, reg = %x0" : "+wa" (c)); + __asm__ ("# vsx, reg = %x0" : "+" VSX_REG_ATTR (c)); d = c; __asm__ ("# gpr, reg = %0" : "+b" (d)); *b = d; diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c index d0b3eb09ef7..33f19991f76 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c @@ -36,7 +36,7 @@ void store_df (double *p, double d) *p = d; } -/* { dg-final { scan-assembler-times "lxsspx" 2 } } */ -/* { dg-final { scan-assembler-times "lxsdx" 1 } } */ -/* { dg-final { scan-assembler-times "stxsspx" 1 } } */ -/* { dg-final { scan-assembler-times "stxsdx" 1 } } */ +/* { dg-final { scan-assembler "lxsspx" } } */ +/* { dg-final { scan-assembler "lxsdx" } } */ +/* { dg-final { scan-assembler "stxsspx" } } */ +/* { dg-final { scan-assembler "stxsdx" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr57363.c b/gcc/testsuite/gcc.target/powerpc/pr57363.c new file mode 100644 index 00000000000..45ea3f3fe61 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr57363.c @@ -0,0 +1,19 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-options "-mlong-double-128" } */ + +/* Check if adding a qNAN and a normal long double does not generate a + inexact exception. */ + +#define _GNU_SOURCE +#include <fenv.h> + +int main(void) +{ + double x = __builtin_nan (""); + long double y = 1.1L; + + feenableexcept (FE_INEXACT); + feclearexcept (FE_ALL_EXCEPT); + x = x + y; + return fetestexcept(FE_INEXACT); +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr59054.c b/gcc/testsuite/gcc.target/powerpc/pr59054.c index 0379aeee635..052f238ba0e 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr59054.c +++ b/gcc/testsuite/gcc.target/powerpc/pr59054.c @@ -4,15 +4,3 @@ /* { dg-options "-mcpu=power7 -O0 -m64" } */ long foo (void) { return 0; } - -/* { dg-final { scan-assembler-not "xxlor" } } */ -/* { dg-final { scan-assembler-not "stfd" } } */ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ -/* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-options "-mcpu=power7 -O0 -m64" } */ - -long foo (void) { return 0; } - -/* { dg-final { scan-assembler-not "xxlor" } } */ -/* { dg-final { scan-assembler-not "stfd" } } */ diff --git a/gcc/testsuite/gfortran.dg/asynchronous_4.f90 b/gcc/testsuite/gfortran.dg/asynchronous_4.f90 new file mode 100644 index 00000000000..ca6cd6c0265 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/asynchronous_4.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! +! PR 59228: ICE with assumed type and ASYNCHRONOUS +! +! Contributed by Valery Weber <valeryweber@hotmail.com> + + IMPLICIT NONE + + interface + subroutine test(base) + TYPE(*), ASYNCHRONOUS :: base + end subroutine + end interface + +CONTAINS + + SUBROUTINE foo ( data ) + REAL, DIMENSION( : ), ASYNCHRONOUS :: data + CALL test ( data ) ! { dg-error "Rank mismatch in argument" } + END SUBROUTINE + +END diff --git a/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 index 5263060be75..2eea2a52777 100644 --- a/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 +++ b/gcc/testsuite/gfortran.dg/c_loc_test_22.f90 @@ -21,4 +21,4 @@ end ! { dg-final { scan-tree-dump-times "parm.\[0-9\]+.data = \\(void .\\) &\\(.yyy.\[0-9\]+\\)\\\[D.\[0-9\]+ \\* 4\\\];" 1 "original" } } ! { dg-final { scan-tree-dump-times "D.\[0-9\]+ = parm.\[0-9\]+.data;\[^;]+ptr\[1-4\] = D.\[0-9\]+;" 4 "original" } } -! { dg-final { cleanup-tree-dump "optimized" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/nan_7.f90 b/gcc/testsuite/gfortran.dg/nan_7.f90 index 12c7b3ce40f..4c2f62eeaed 100644 --- a/gcc/testsuite/gfortran.dg/nan_7.f90 +++ b/gcc/testsuite/gfortran.dg/nan_7.f90 @@ -2,6 +2,7 @@ ! { dg-options "-fno-range-check" } ! { dg-require-effective-target fortran_real_16 } ! { dg-require-effective-target fortran_integer_16 } +! { dg-skip-if "" { "powerpc*le-*-*" } { "*" } { "" } } ! PR47293 NAN not correctly read character(len=200) :: str real(16) :: r diff --git a/gcc/testsuite/gfortran.dg/null_5.f90 b/gcc/testsuite/gfortran.dg/null_5.f90 index 886a6a1ff8b..50b41c3e8bf 100644 --- a/gcc/testsuite/gfortran.dg/null_5.f90 +++ b/gcc/testsuite/gfortran.dg/null_5.f90 @@ -34,7 +34,7 @@ subroutine test_PR34547_1 () end subroutine test_PR34547_1 subroutine test_PR34547_2 () - print *, null () ! { dg-error "in data transfer statement requires MOLD" } + print *, null () ! { dg-error "Invalid context" } end subroutine test_PR34547_2 subroutine test_PR34547_3 () diff --git a/gcc/testsuite/gfortran.dg/null_6.f90 b/gcc/testsuite/gfortran.dg/null_6.f90 index dd517cfa3e2..6b8f21e63bc 100644 --- a/gcc/testsuite/gfortran.dg/null_6.f90 +++ b/gcc/testsuite/gfortran.dg/null_6.f90 @@ -30,5 +30,5 @@ end subroutine test_PR50375_2 subroutine test_PR34547_3 () integer, allocatable :: i(:) - print *, NULL(i) + print *, NULL(i) ! { dg-error "Invalid context for NULL" } end subroutine test_PR34547_3 diff --git a/gcc/testsuite/gfortran.dg/pr57393-1.f90 b/gcc/testsuite/gfortran.dg/pr57393-1.f90 new file mode 100644 index 00000000000..6b2cb1b3fe6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr57393-1.f90 @@ -0,0 +1,38 @@ +! PR middle-end/57393 +! { dg-do compile } +! { dg-options "-g -O2 -ffast-math" } + +SUBROUTINE pr57393(nn,e,g,t0,t1,t2,t3,t4,t5,t6,t7,& + t8,t9,t10,t11,t12,t13,t14,t15,& + t16,t17,t18,t19,t20,t21,t22,t23,& + t24,t25,t26,t27,t28,t29,t30,& + t31,t32,t33,t34,t35,t36,t37,t38,& + t39,t40,t41,t42,t43,t44,t45,t46,t47) + IMPLICIT REAL*8 (t) + INTEGER, PARAMETER :: dp=8 + REAL(kind=dp) :: e(nn) + DO ii=1,nn + t48 = 0.1955555555e2_dp * t1 * t2 + & + 0.6000000000e1_dp * t3 * t4 * t5 + t49 = 0.1620000000e3_dp * t6 * t7 * t8 + & + 0.1080000000e3_dp * t6 * t9 * t5 - & + 0.6000000000e1_dp * t10 * t20 * t21 * t55 - & + 0.2400000000e2_dp * t10 * t11 * t12 - & + 0.1200000000e2_dp * t13 * t14 * t15 + t50 = t49 + t16 + t51 = (3 * t17 * t18 * t19) + & + (t22 * t23 * t19) + (t50 * t19) - & + 0.3333333336e0_dp * t24 * t25 + t52 = 0.1555555556e1_dp * t26 * t27 * t12 + & + (t51 + t28 + t29 + t30) * & + 0.3125000000e0_dp * t31 * t32 * t33 * t34 + t53 = -0.1000000001e1_dp * t35 * t36 * t5 - & + (t37 + t38 + t39 + t52) - & + 0.8333333340e-1_dp * t40 * t41 * t42 + t54 = -0.1000000001e1_dp * t43 * t44 * t45 - & + t47 * (t46 + t53) + IF (g >= 3 .OR. g == -3) THEN + e(ii) = e(ii) + t54 * t0 + END IF + END DO +END SUBROUTINE pr57393 diff --git a/gcc/testsuite/gfortran.dg/pr57393-2.f90 b/gcc/testsuite/gfortran.dg/pr57393-2.f90 new file mode 100644 index 00000000000..fafa8f900f1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr57393-2.f90 @@ -0,0 +1,10 @@ +! PR middle-end/57393 +! { dg-do compile } +! { dg-options "-g -O2" } + +SUBROUTINE pr57393 ( a1, a2, a3, a4, a5, a6, a7 ) + COMPLEX(kind=8), DIMENSION(:), INTENT(IN) :: a1 + INTEGER, DIMENSION(:), INTENT(IN) :: a2, a3, a5, a6 + COMPLEX(kind=8), DIMENSION(:), INTENT(INOUT) :: a4 + a4(a6(1)+1:a6(1)+a5(1))=a1(a3(1)+1:a3(1)+a2(1)) +END SUBROUTINE pr57393 diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_23.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_23.f90 new file mode 100644 index 00000000000..f9897f17401 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_23.f90 @@ -0,0 +1,30 @@ +! { dg-do run } +! +! PR fortran/57354 +! +! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com> +! + type t + integer,allocatable :: i + end type + + type(t) :: e + type(t), allocatable :: a(:) + integer :: chksum = 0 + + do i=1,3 ! Was 100 in original + e%i = i + chksum = chksum + i + if (.not.allocated(a)) then + a = [e] + else + call foo + end if + end do + + if (sum ([(a(i)%i, i=1,size(a))]) .ne. chksum) call abort +contains + subroutine foo + a = [a, e] + end subroutine +end diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 b/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 new file mode 100644 index 00000000000..09b07261089 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_proc_30.f90 @@ -0,0 +1,38 @@ +! { dg-do compile } +! +! PR 59143: [OOP] Bogus warning with array-valued type-bound procedure +! +! Contributed by Jürgen Reuter <juergen.reuter@desy.de> + +module phs_single + + type :: phs_single_t + contains + procedure, nopass :: d1, d2 + end type + +contains + + subroutine evaluate (phs) + class(phs_single_t) :: phs + call func1 (phs%d1 ()) + call func1 (phs%d2 (2)) + end subroutine + + subroutine func1 (p) + real :: p(2) + end subroutine + + function d1 () + real :: d1(2) + d1 = 1. + end function + + function d2 (n) + real :: d2(n) + d2 = 1. + end function + +end module + +! { dg-final { cleanup-modules "phs_single" } } diff --git a/gcc/testsuite/gnat.dg/opt29.adb b/gcc/testsuite/gnat.dg/opt29.adb new file mode 100644 index 00000000000..64f2baef3d0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt29.adb @@ -0,0 +1,13 @@ +-- { dg-do compile }
+-- { dg-options "-O" }
+
+package body Opt29 is
+
+ procedure Proc (T : Rec) is
+ begin
+ if Derived2 (T.F2.all).Id = T.F1.Id then
+ raise Program_Error;
+ end if;
+ end;
+
+end Opt29;
diff --git a/gcc/testsuite/gnat.dg/opt29.ads b/gcc/testsuite/gnat.dg/opt29.ads new file mode 100644 index 00000000000..c809b1c4193 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt29.ads @@ -0,0 +1,28 @@ +package Opt29 is
+
+ type Word is mod 2**16;
+
+ type PID is record
+ W1, W2: Word;
+ end record;
+
+ type Root1 is tagged record
+ Id: PID;
+ end record;
+ type Root1_Ptr is access all Root1'Class;
+
+ type Root2 is tagged null record;
+ type Root2_Ptr is access all Root2'class;
+
+ type Derived2 is new Root2 with record
+ Id: PID;
+ end record;
+
+ type Rec is record
+ F1: Root1_Ptr;
+ F2: Root2_Ptr;
+ end record;
+
+ procedure Proc (T : Rec);
+
+end Opt29;
diff --git a/gcc/testsuite/gnat.dg/opt30.adb b/gcc/testsuite/gnat.dg/opt30.adb new file mode 100644 index 00000000000..12139c555c4 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt30.adb @@ -0,0 +1,20 @@ +-- { dg-do run } +-- { dg-options "-O" } + +procedure Opt30 is + + function Id_I (I : Integer) return Integer is + begin + return I; + end; + + A : array (Integer range -4..4) of Integer; + +begin + A := (-ID_I(4), -ID_I(3), -ID_I(2), -ID_I(1), ID_I(100), + ID_I(1), ID_I(2), ID_I(3), ID_I(4)); + A(-4..0) := A(0..4); + if A /= (100, 1, 2, 3, 4, 1, 2, 3, 4) then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/lib/asan-dg.exp b/gcc/testsuite/lib/asan-dg.exp index e0bf2da2e78..8990677d51e 100644 --- a/gcc/testsuite/lib/asan-dg.exp +++ b/gcc/testsuite/lib/asan-dg.exp @@ -41,6 +41,7 @@ proc asan_link_flags { paths } { if { $gccpath != "" } { if { [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.a"] || [file exists "${gccpath}/libsanitizer/asan/.libs/libasan.${shlib_ext}"] } { + append flags " -B${gccpath}/libsanitizer/ " append flags " -B${gccpath}/libsanitizer/asan/ " append flags " -L${gccpath}/libsanitizer/asan/.libs " append ld_library_path ":${gccpath}/libsanitizer/asan/.libs" diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 104818d327e..642c3448bda 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -530,6 +530,7 @@ proc check_profiling_available { test_what } { || [istarget mn10300-*-elf*] || [istarget moxie-*-elf*] || [istarget msp430-*-*] + || [istarget nds32*-*-elf] || [istarget picochip-*-*] || [istarget powerpc-*-eabi*] || [istarget powerpc-*-elf] @@ -2146,6 +2147,32 @@ proc check_effective_target_vect_floatuint_cvt { } { return $et_vect_floatuint_cvt_saved } +# Return 1 if the target supports #pragma omp declare simd, 0 otherwise. +# +# This won't change for different subtargets so cache the result. + +proc check_effective_target_vect_simd_clones { } { + global et_vect_simd_clones_saved + + if [info exists et_vect_simd_clones_saved] { + verbose "check_effective_target_vect_simd_clones: using cached result" 2 + } else { + set et_vect_simd_clones_saved 0 + if { [istarget i?86-*-*] || [istarget x86_64-*-*] } { + # On i?86/x86_64 #pragma omp declare simd builds a sse2, avx and + # avx2 clone. Only the right clone for the specified arch will be + # chosen, but still we need to at least be able to assemble + # avx2. + if { [check_effective_target_avx2] } { + set et_vect_simd_clones_saved 1 + } + } + } + + verbose "check_effective_target_vect_simd_clones: returning $et_vect_simd_clones_saved" 2 + return $et_vect_simd_clones_saved +} + # Return 1 if this is a AArch64 target supporting big endian proc check_effective_target_aarch64_big_endian { } { return [check_no_compiler_messages aarch64_big_endian assembly { @@ -5106,6 +5133,18 @@ proc check_effective_target_avx { } { } "-O2 -mavx" ] } +# Return 1 if avx2 instructions can be compiled. +proc check_effective_target_avx2 { } { + return [check_no_compiler_messages avx2 object { + typedef long long __v4di __attribute__ ((__vector_size__ (32))); + __v4di + mm256_is32_andnotsi256 (__v4di __X, __v4di __Y) + { + return __builtin_ia32_andnotsi256 (__X, __Y); + } + } "-O0 -mavx2" ] +} + # Return 1 if sse instructions can be compiled. proc check_effective_target_sse { } { return [check_no_compiler_messages sse object { diff --git a/gcc/testsuite/lib/ubsan-dg.exp b/gcc/testsuite/lib/ubsan-dg.exp index 4ec5fdfad67..aa01988f976 100644 --- a/gcc/testsuite/lib/ubsan-dg.exp +++ b/gcc/testsuite/lib/ubsan-dg.exp @@ -32,6 +32,7 @@ proc ubsan_link_flags { paths } { if { $gccpath != "" } { if { [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.a"] || [file exists "${gccpath}/libsanitizer/ubsan/.libs/libubsan.${shlib_ext}"] } { + append flags " -B${gccpath}/libsanitizer/ " append flags " -B${gccpath}/libsanitizer/ubsan/ " append flags " -L${gccpath}/libsanitizer/ubsan/.libs" append ld_library_path ":${gccpath}/libsanitizer/ubsan/.libs" |