diff options
Diffstat (limited to 'gcc/testsuite')
642 files changed, 17135 insertions, 2904 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ad5ccb7dc64..7243fdf3372 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,1616 @@ +2017-07-31 Jan Hubicka <hubicka@ucw.cz> + Martin Liska <mliska@suse.cz> + + * gcc.dg/predict-15.c: New test. + * gcc.dg/tree-ssa/vrp24.c: Update scanned pattern. + +2017-07-31 Uros Bizjak <ubizjak@gmail.com> + + PR target/25967 + * gcc.target/i386/naked-1.c: New test. + * gcc.target/i386/naked-2.c: Ditto. + * gcc.target/i386/naked-3.c: Ditto. + * gcc.target/x86_64/abi/ms-sysv/ms-sysv.c: Remove + do_test_body0 stub function, use attribute "naked" instead. + * gcc.dg/pr44290-1.c: Use naked_functions effective target. + * gcc.dg/pr44290-2.c: Ditto. + +2017-07-31 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/81581 + * gfortran.dg/dim_sum_1.f90: New test case. + * gfortran.dg/dim_sum_2.f90: New test case. + * gfortran.dg/dim_sum_3.f90: New test case. + +2017-07-31 Martin Liska <mliska@suse.cz> + + * gcc.dg/builtin-unreachable-6.c: Update scanned patterns. + * gcc.dg/tree-ssa/attr-hotcold-2.c: Likewise. + +2017-07-31 Martin Liska <mliska@suse.cz> + + PR sanitize/81530 + * g++.dg/ubsan/pr81530.C: New test. + +2017-07-31 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/81604 + * c-c++-common/ubsan/pr81604.c: New test. + +2017-07-30 H.J. Lu <hongjiu.lu@intel.com> + + PR target/79793 + * gcc.dg/guality/pr68037-1.c: Update gdb breakpoints. + * gcc.target/i386/interrupt-5.c (interrupt_frame): New struct. + (foo): Check the builtin return address against the return address + in interrupt frame. + * gcc.target/i386/pr79793-1.c: New test. + * gcc.target/i386/pr79793-2.c: Likewise. + +2017-07-29 Eric Botcazou <ebotcazou@adacore.com> + + * c-c++-common/dump-ada-spec-7.c: New test. + +2017-07-29 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/debug/dwarf2/inline-ns-1.C: New test. + * g++.dg/debug/dwarf2/inline-ns-2.C: New test. + +2017-07-28 Peter Bergner <bergner@vnet.ibm.com> + + * gcc.target/powerpc/cpu-builtin-1.c (darn, scv): Add tests. + +2017-07-28 Tamar Christina <tamar.christina@arm.com> + + * gcc.target/aarch64/int_mov_immediate_1.c: New. + +2017-07-28 Bin Cheng <bin.cheng@arm.com> + + * gcc.dg/vect/pr80815-3.c: Require vect_perm. + +2017-07-28 Tamar Christina <tamar.christina@arm.com> + Bilyan Borisov <bilyan.borisov@arm.com> + + * gcc.target/aarch64/dbl_mov_immediate_1.c: New. + * gcc.target/aarch64/flt_mov_immediate_1.c: New. + * gcc.target/aarch64/f16_mov_immediate_1.c: New. + * gcc.target/aarch64/f16_mov_immediate_2.c: New. + * gcc.target/aarch64/pr63304_1.c: Changed to double. + +2017-07-28 Bin Cheng <bin.cheng@arm.com> + + * gcc.dg/tree-ssa/predcom-dse-1.c: New test. + * gcc.dg/tree-ssa/predcom-dse-2.c: New test. + * gcc.dg/tree-ssa/predcom-dse-3.c: New test. + * gcc.dg/tree-ssa/predcom-dse-4.c: New test. + * gcc.dg/tree-ssa/predcom-dse-5.c: New test. + * gcc.dg/tree-ssa/predcom-dse-6.c: New test. + * gcc.dg/tree-ssa/predcom-dse-7.c: New test. + * gcc.dg/tree-ssa/predcom-dse-8.c: New test. + * gcc.dg/tree-ssa/predcom-dse-9.c: New test. + * gcc.dg/tree-ssa/predcom-dse-10.c: New test. + * gcc.dg/tree-ssa/predcom-dse-11.c: New test. + +2017-07-28 Martin Liska <mliska@suse.cz> + + PR sanitizer/81340 + * g++.dg/asan/pr81340.C: New test. + +2017-07-28 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81502 + * gcc.target/i386/pr81502.c: New testcase. + +2017-07-28 Martin Liska <mliska@suse.cz> + + PR sanitizer/81460 + * gcc.dg/asan/pr81460.c: New test. + +2017-07-28 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/80998 + * c-c++-common/ubsan/ptr-overflow-1.c: New test. + * c-c++-common/ubsan/ptr-overflow-2.c: New test. + + PR tree-optimization/81578 + * gcc.dg/pr81578.c: New test. + +2017-07-28 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81573 + * gcc.dg/torture/pr81573.c: Explicitely use signed char. + +2017-07-27 Peter Bergner <bergner@vnet.ibm.com> + + * g++.dg/pr69667.C: Remove option -mlra. + * gcc.target/powerpc/dform-1.c: Likewise. + * gcc.target/powerpc/dform-2.c: Likewise. + * gcc.target/powerpc/dform-3.c: Likewise. + * gcc.target/powerpc/p8vector-int128-1.c: Likewise. + * gcc.target/powerpc/p9-vparity.c: Likewise. + * gcc.target/powerpc/pr63491.c: Likewise. + * gcc.target/powerpc/pr67808.c: Likewise. + * gcc.target/powerpc/pr68805.c: Likewise. + * gcc.target/powerpc/pr69461.c: Likewise. + * gcc.target/powerpc/pr71680.c: Likewise. + * gcc.target/powerpc/pr77289.c: Likewise. + * gcc.target/powerpc/pr78458.c: Likewise. + * gcc.target/powerpc/pr78543.c: Likewise. + * g++.dg/pr71294.C: Remove option -mno-lra. + * gcc.target/powerpc/pr71656-1.c: Likewise. + * gcc.target/powerpc/pr71656-2.c: Likewise. + * gcc.target/powerpc/pr71698.c: Likewise. + +2017-07-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + Sudakshina Das <sudi.das@arm.com> + + * gcc.target/aarch64/tst_imm_split_1.c: New Test. + +2017-07-27 Marek Polacek <polacek@redhat.com> + + PR c/81417 + * c-c++-common/Wsign-compare-1.c: New test. + * g++.dg/warn/Wsign-compare-2.C: Update dg-warning. + * g++.dg/warn/Wsign-compare-4.C: Likewise. + * g++.dg/warn/Wsign-compare-6.C: Likewise. + * g++.dg/warn/compare1.C: Likewise. + * gcc.dg/compare1.c: Likewise. + * gcc.dg/compare2.c: Likewise. + * gcc.dg/compare4.c: Likewise. + * gcc.dg/compare5.c: Likewise. + * gcc.dg/pr35430.c: Likewise. + * gcc.dg/pr60087.c: Likewise. + +2017-07-27 Peter Bergner <bergner@vnet.ibm.com> + + PR middle-end/81564 + * gcc.dg/pr81564.c: New test. + +2017-07-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81573 + PR tree-optimization/81494 + * gcc.dg/torture/pr81573.c: New testcase. + +2017-07-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81571 + * gcc.dg/torture/pr81571.c: New testcase. + +2017-07-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81502 + * gcc.target/i386/vect-insert-1.c: New testcase. + +2017-07-27 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/81534 + * gcc.target/s390/pr81534.c: New test. + +2017-07-27 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/81555 + PR tree-optimization/81556 + * gcc.c-torture/execute/pr81555.c: New test. + * gcc.c-torture/execute/pr81556.c: New test. + + * gcc.dg/attr-noipa.c: New test. + * gcc.dg/ipa/ipa-pta-18.c: New test. + * gcc.dg/ipa/ipa-sra-11.c: New test. + +2017-07-25 Michael Meissner <meissner@linux.vnet.ibm.com> + + * gcc.target/powerpc/vsx-himode.c: Delete -mvsx-small-integer + option. + * gcc.target/powerpc/vsx-himode2.c: Likewise. + * gcc.target/powerpc/vsx-himode3.c: Likewise. + * gcc.target/powerpc/vsx-qimode.c: Likewise. + * gcc.target/powerpc/vsx-qimode2.c: Likewise. + * gcc.target/powerpc/vsx-qimode3.c: Likewise. + * gcc.target/powerpc/vsx-simode.c: Likewise. + * gcc.target/powerpc/vsx-simode2.c: Likewise. + * gcc.target/powerpc/vsx-simode3.c: Likewise. + +2017-07-26 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/71570 + * g++.dg/cpp0x/lambda/lambda-ice17.C: New. + +2017-07-26 H.J. Lu <hongjiu.lu@intel.com> + + PR target/81563 + * gcc.target/i386/pr81563.c: New test + +2017-07-26 Wilco Dijkstra <wdijkstr@arm.com> + + PR target/79041 + * gcc.target/aarch64/pr79041-2.c: Don't run in ILP32. + +2017-07-26 Marek Polacek <polacek@redhat.com> + + PR middle-end/70992 + * gcc.dg/overflow-warn-1.c: Adjust dg-error. + * gcc.dg/overflow-warn-2.c: Likewise. + * gcc.dg/overflow-warn-3.c: Likewise. + * gcc.dg/overflow-warn-4.c: Likewise. + * gcc.dg/torture/pr70992-2.c: New test. + * gcc.dg/torture/pr70992.c: New test. + +2017-07-26 Richard Biener <rguenther@suse.de> + + * gcc/testsuite/gcc.dg/pr70920-2.c: Adjust for transform already + happening in ccp1. + * gcc/testsuite/gcc.dg/pr70920-4.c: Likewise. + +2017-07-26 Wilco Dijkstra <wdijkstr@arm.com> + + PR middle-end/46932 + * gcc.dg/pr46932.c: New testcase. + +2017-07-26 Martin Liska <mliska@suse.cz> + + PR sanitize/81186 + * gcc.dg/asan/pr81186.c: New test. + +2017-07-25 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-4-p9-runnable.c: Add test file for + vec_cnttz builtins. + +2017-07-25 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt66.adb: New test. + +2017-07-25 Alexander Monakov <amonakov@ispras.ru> + + * gcc.dg/tree-ssa/assoc-2.c: Enhance. + * gcc.dg/tree-ssa/slsr-4.c: Adjust. + +2017-07-25 Alexander Monakov <amonakov@ispras.ru> + + * gcc.dg/tree-ssa/assoc-2.c: New testcase. + +2017-07-25 Torsten Duwe <duwe@suse.de> + + * c-c++-common/patchable_function_entry-default.c: New test. + * c-c++-common/patchable_function_entry-decl.c: Likewise. + * c-c++-common/patchable_function_entry-definition.c: Likewise. + +2017-07-25 Jakub Jelinek <jakub@redhat.com> + + PR target/81532 + * gcc.target/i386/pr80833-3.c: New test. + * gcc.target/i386/avx512dq-pr81532.c: New test. + * gcc.target/i386/avx512bw-pr81532.c: New test. + +2017-07-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81455 + * gcc.dg/pr81455.c: New testcase. + +2017-07-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81529 + * gfortran.dg/pr81529.f90: New testcase. + +2017-07-25 Wilco Dijkstra <wdijkstr@arm.com> + + * gcc.target/aarch64/pr79041-2.c: Improve test. + +2017-07-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81410 + * gcc.dg/vect/pr81410.c: Do not typedef uint64_t. + +2017-07-25 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81510 + * gcc.dg/torture/pr81510.c: New testcase. + * gcc.dg/torture/pr81510-2.c: Likewise. + +2017-07-25 Martin Liska <mliska@suse.cz> + + PR ipa/81520 + * gcc.dg/ipa/pr81520.c: New test. + +2017-07-25 Marek Polacek <polacek@redhat.com> + + PR c/81364 + * Wmultistatement-macros-12.c: New test. + +2017-07-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/81414 + * gcc.target/aarch64/pr81414.C: New. + +2017-07-25 Richard Biener <rguenther@suse.de> + + PR middle-end/81505 + * gcc.dg/ubsan/pr81505.c: New testcase. + +2017-07-24 Daniel Santos <daniel.santos@pobox.com> + + PR testsuite/80759 + * gcc.target/x86_64/abi/ms-sysv/do-test.S + (ELFFN_BEGIN): Rename to FN_TYPE. + (ELFFN_END): Rename to FN_SIZE. + (ASMNAME): New macro. + (FUNC): Rename to FUNC_BEGIN, use ASMNAME and use .globl instead of + .global. + (FUNC_END): Use ASMNAME. + (test_data_save): Remove. + (test_data_input): Likewise. + (test_data_output: Likewise. + (test_data_fn): Likewise. + (test_data_retaddr): Likewise. + (regs_to_mem): Make globals, use r10 instead of rax. + (mem_to_regs): Likewise. + (do_test_unaligned): Remove .cfi directives, remove pushf/popf, move + body to ms-sysv.c. + (do_test_aligned): Likewise. + * gcc.target/x86_64/abi/ms-sysv/ms-sysv.c: + Add dg-* directives. + (PASTE_STR): New macro. + (ASMNAME): Likewise. + (LOAD_TEST_DATA_ADDR): Likewise. + (TEST_DATA_OFFSET): Likewise. + (do_test_body0): New C function. + (do_test_body): New inline assembly routine. + * gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp + (runtest_ms_sysv): Modify. + +2017-07-24 Michael Meissner <meissner@linux.vnet.ibm.com> + + * gcc.target/powerpc/pr65849-1.c: Delete, test no longer valid + since the upper-regs options have been deleted. + * gcc.target/powerpc/pr65849-2.c: Likewise. + * gcc.target/powerpc/pr80099-1.c: Likewise. + * gcc.target/powerpc/pr80099-2.c: Likewise. + * gcc.target/powerpc/pr80099-3.c: Likewise. + * gcc.target/powerpc/pr80099-4.c: Likewise. + * gcc.target/powerpc/pr80099-5.c: Likewise. + * gcc.target/powerpc/builtins-2-p9-runnable.c: Update test to + support removal of the upper-regs options. + * gcc.target/powerpc/p8vector-fp.c: Likewise. + * gcc.target/powerpc/p8vector-ldst.c: Likewise. + * gcc.target/powerpc/p9-dimode1.c: Likewise. + * gcc.target/powerpc/p9-dimode2.c: Likewise. + * gcc.target/powerpc/ppc-fpconv-1.c: Likewise. + * gcc.target/powerpc/ppc-fpconv-10.c: Likewise. + * gcc.target/powerpc/ppc-fpconv-5.c: Likewise. + * gcc.target/powerpc/ppc-fpconv-9.c: Likewise. + * gcc.target/powerpc/ppc-round.c: Likewise. + * gcc.target/powerpc/pr71720.c: Likewise. + * gcc.target/powerpc/pr72853.c: Likewise. + * gcc.target/powerpc/pr79907.c: Likewise. + * gcc.target/powerpc/pr78953.c: Likewise. + * gcc.target/powerpc/upper-regs-df.c: Likewise. + * gcc.target/powerpc/upper-regs-sf.c: Likewise. + * gcc.target/powerpc/vec-extract-1.c: Likewise. + * gcc.target/powerpc/vec-init-3.c: Likewise. + * gcc.target/powerpc/vec-init-6.c: Likewise. + * gcc.target/powerpc/vec-init-7.c: Likewise. + * gcc.target/powerpc/vec-set-char.c: Likewise. + * gcc.target/powerpc/vec-set-int.c: Likewise. + * gcc.target/powerpc/vec-set-short.c: Likewise. + +2017-07-24 Wilco Dijkstra <wdijkstr@arm.com> + + PR target/79041 + * gcc.target/aarch64/pr79041-2.c: New test. + +2017-07-24 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-3-p9-runnable.c: Add new test file for + the new built-ins. + +2017-07-24 Jackson Woodruff <jackson.woodruff@arm.com> + + * gcc.target/aarch64/simd/vmla_elem_1.c: New. + +2017-07-24 Thomas Koenig <tkoenig@gcc.gnu.org> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/66102 + * gfortran.dg/realloc_on_assign_28.f90: New test. + +2017-07-23 David Edelsohn <dje.gcc@gmail.com> + + * gcc.dg/pr56727-2.c: Limit to powerpc-linux. + * gcc.dg/debug/dwarf2/stacked-qualified-types-3.c: Remove AIX XFAIL. + +2017-07-23 Uros Bizjak <ubizjak@gmail.com> + + PR target/80569 + * gcc.target/i386/pr80569.c: New test. + +2017-07-21 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-2.c (vmulosh, vmulouh, vmulesh, + vmuleuh): Fix scan-assembler-times should check for word not half word + instructions. + +2017-07-21 Jim Wilson <jim.wilson@linaro.org> + + * lib/target-supports.exp (add_options_for_arm_v8_1a_neon): Delete + redundant -march option. + (check_effective_target_arm_v8_1a_neon_ok_nocache): Try armv8-a+rdma + in addition to armv8.1-a. + +2017-07-21 Yury Gribov <tetra2005@gmail.com> + + PR middle-end/56727 + * gcc.dg/pr56727-1.c: New test. + * gcc.dg/pr56727-2.c: New test. + +2017-07-21 Steven Munroe <munroesj@gcc.gnu.org> + + * gcc.target/powerpc/mmx-check.h: New file. + * gcc.target/powerpc/mmx-packs.c: New file. + * gcc.target/powerpc/mmx-packssdw-1.c: New file. + * gcc.target/powerpc/mmx-packsswb-1.c: New file. + * gcc.target/powerpc/mmx-packuswb-1.c: New file. + * gcc.target/powerpc/mmx-paddb-1.c: New file. + * gcc.target/powerpc/mmx-paddd-1.c: New file. + * gcc.target/powerpc/mmx-paddsb-1.c: New file. + * gcc.target/powerpc/mmx-paddsw-1.c: New file. + * gcc.target/powerpc/mmx-paddusb-1.c: New file. + * gcc.target/powerpc/mmx-paddusw-1.c: New file. + * gcc.target/powerpc/mmx-paddw-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqb-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqd-1.c: New file. + * gcc.target/powerpc/mmx-pcmpeqw-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtb-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtd-1.c: New file. + * gcc.target/powerpc/mmx-pcmpgtw-1.c: New file. + * gcc.target/powerpc/mmx-pmaddwd-1.c: New file. + * gcc.target/powerpc/mmx-pmulhw-1.c: New file. + * gcc.target/powerpc/mmx-pmullw-1.c: New file. + * gcc.target/powerpc/mmx-pslld-1.c: New file. + * gcc.target/powerpc/mmx-psllw-1.c: New file. + * gcc.target/powerpc/mmx-psrad-1.c: New file. + * gcc.target/powerpc/mmx-psraw-1.c: New file. + * gcc.target/powerpc/mmx-psrld-1.c: New file. + * gcc.target/powerpc/mmx-psrlw-1.c: New file. + * gcc.target/powerpc/mmx-psubb-2.c: New file. + * gcc.target/powerpc/mmx-psubd-2.c: New file. + * gcc.target/powerpc/mmx-psubsb-1.c: New file. + * gcc.target/powerpc/mmx-psubsw-1.c: New file. + * gcc.target/powerpc/mmx-psubusb-1.c: New file. + * gcc.target/powerpc/mmx-psubusw-1.c: New file. + * gcc.target/powerpc/mmx-psubw-2.c: New file. + * gcc.target/powerpc/mmx-punpckhbw-1.c: New file. + * gcc.target/powerpc/mmx-punpckhdq-1.c: New file. + * gcc.target/powerpc/mmx-punpckhwd-1.c: New file. + * gcc.target/powerpc/mmx-punpcklbw-1.c: New file. + * gcc.target/powerpc/mmx-punpckldq-1.c: New file. + * gcc.target/powerpc/mmx-punpcklwd-1.c: New file. + +2017-06-21 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81500 + * gcc.dg/torture/pr81500.c: New testcase. + +2017-07-20 Nathan Sidwell <nathan@acm.org> + + * g++.dg/ext/anon-struct6.C: Adjust diag. + * g++.old-deja/g++.other/anon4.C: Adjust diag. + +2017-07-20 Jakub Jelinek <jakub@redhat.com> + + PR target/80846 + * gcc.target/i386/avx-pr80846.c: New test. + * gcc.target/i386/avx2-pr80846.c: New test. + * gcc.target/i386/avx512f-pr80846.c: New test. + +2017-07-20 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/81388 + * gcc.dg/tree-ssa/pr81388-1.c: New test. + * gcc.dg/tree-ssa/pr81388-2.c: New test. + +2017-07-17 Tom de Vries <tom@codesourcery.com> + + PR middle-end/81030 + * gcc.dg/pr81030.c: New test. + +2017-07-20 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61171 + * g++.dg/vect/pr61171.cc: New testcase. + * gfortran.dg/vect/pr61171.f: Likewise. + * gcc.dg/vect/vect-reduc-11.c: Likewise. + +2017-07-20 Richard Biener <rguenther@suse.de> + + * gcc.dg/vect/slp-43.c: Increase loop count to enable vectorization + with V64QImode. + * gcc.dg/vect/slp-45.c: Likewise. + +2017-07-20 Naveen H.S <Naveen.Hurugalawadi@cavium.com> + + * gcc.dg/tree-ssa/vrp116.c: New Test. + +2017-07-19 Michael Meissner <meissner@linux.vnet.ibm.com> + + * gcc.target/powerpc/cpu-builtin-1.c: Change test to use #ifdef + __BUILTIN_CPU_SUPPORTS to see if the GLIBC is new enough that + __builtin_cpu_is and __builtin_cpu_supports are supported. + +2017-07-19 Steven Munroe <munroesj@gcc.gnu.org> + + * gcc.target/powerpc/bmi-check.h (main): Skip unless + __BUILTIN_CPU_SUPPORTS__ defined. + * gcc.target/powerpc/bmi2-check.h (main): Skip unless + __BUILTIN_CPU_SUPPORTS__ defined. + +2017-07-19 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/81346 + * gcc.dg/tree-ssa/pr81346-5.c: New test. + +2017-07-19 Tom de Vries <tom@codesourcery.com> + + * gcc.target/nvptx/decl-init.c: Update alignment. + * gcc.target/nvptx/slp-2-run.c: New test. + * gcc.target/nvptx/slp-2.c: New test. + * gcc.target/nvptx/v2di.c: New test. + +2017-07-19 Tom de Vries <tom@codesourcery.com> + + * gcc.target/nvptx/slp-run.c: New test. + * gcc.target/nvptx/slp.c: New test. + * gcc.target/nvptx/v2si-cvt.c: New test. + * gcc.target/nvptx/v2si-run.c: New test. + * gcc.target/nvptx/v2si.c: New test. + * gcc.target/nvptx/vec.inc: New test. + +2017-07-19 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/81346 + * gcc.dg/tree-ssa/pr81346-1.c: New test. + * gcc.dg/tree-ssa/pr81346-2.c: New test. + * gcc.dg/tree-ssa/pr81346-3.c: New test. + * gcc.dg/tree-ssa/pr81346-4.c: New test. + * gcc.target/i386/umod-3.c: Hide comparison against 1 from the + compiler to avoid X / C1 op C2 optimization to trigger. + +2017-07-19 Martin Liska <mliska@suse.cz> + + PR sanitizer/63361 + * c-c++-common/ubsan/float-cast-overflow-1.c: Add either + -ffloat-store or -mieee for targets that need it. + +2017-07-18 Tom de Vries <tom@codesourcery.com> + + PR middle-end/81464 + * gfortran.dg/pr81464.f90: New test. + +2017-07-18 Uros Bizjak <ubizjak@gmail.com> + + PR target/81471 + * gcc.target/i386/pr81471.c: New test. + +2017-06-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81410 + * gcc.dg/vect/pr81410.c: New testcase. + +2017-07-18 Jan Hubicka <hubicka@ucw.cz> + + PR middle-end/81462 + * g++.dg/torture/pr81462.C: New testcase. + +2017-07-18 Bin Cheng <bin.cheng@arm.com> + + PR target/81408 + * g++.dg/tree-ssa/pr81408.C: New. + * gcc.dg/tree-ssa/pr19210-1.c: Check dump message rather than warning. + +2017-07-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/80620 + PR tree-optimization/81403 + * gcc.dg/torture/pr80620.c: New testcase. + * gcc.dg/torture/pr81403.c: Likewise. + +2017-07-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81418 + * gcc.dg/torture/pr81418.c: New testcase. + +2017-07-17 Carl Love <cel@us.ibm.com> + + Revert commit r249572 2017-06-22 Carl Love <cel@us.ibm.com> + test case changes for commit 249424 + + * gcc.target/powerpc/builtins-2.c (vmulosh, vmulouh, vmulesh, + vmuleuh): Fix scan-assembler-times should check for word not half word + instructions. + +2017-07-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/81162 + * gcc.dg/pr81162.c: Move this to... + * gcc.dg/ubsan/pr81162.c: ...here. + +2017-07-17 Volker Reichelt <v.reichelt@netcologne.de> + + * g++.dg/diagnostic/friend1.C: New test. + * g++.dg/cpp0x/auto1.C: Add check for fix-it hint. + +2017-07-17 Nathan Sidwell <nathan@acm.org> + + * g++.dg/warn/ctor-dtor-privacy-3.C: New. + +2017-07-17 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * lib/gcc-dg.exp: Increase expect's match buffer size. + +2017-07-17 Bin Cheng <bin.cheng@arm.com> + + PR target/81369 + * gcc.dg/tree-ssa/pr81369.c: New. + +2017-07-17 Claudiu Zissulescu <claziss@synopsys.com> + + * gcc.target/arc/pr9000674901.c: New file. + * gcc.target/arc/pic-1.c: Likewise. + * gcc.target/arc/pr9001191897.c: Likewise. + +2017-07-17 Claudiu Zissulescu <claziss@synopsys.com> + Andrew Burgess <andrew.burgess@embecosm.com> + + * gcc.target/arc/naked-1.c: New file. + * gcc.target/arc/naked-2.c: Likewise. + +2017-07-17 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/81428 + * gcc.dg/fixed-point/pr81428.c: New test. + + PR tree-optimization/81365 + * g++.dg/torture/pr81365.C: New test. + + PR tree-optimization/81396 + * gcc.dg/tree-ssa/pr81396.c: New test. + +2017-07-16 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt65.adb: New test. + +2017-07-16 Jan Hubicka <hubicka@ucw.cz> + + * gcc.dg/predict-8.c: Update. + +2017-07-16 Volker Reichelt <v.reichelt@netcologne.de> + + * g++.dg/cpp1z/direct-enum-init1.C: Revert special enum handling. + * g++.dg/warn/pr12242.C: Likewise. + +2017-07-14 Kelvin Nilsen <kelvin@gcc.gnu.org> + + * gcc.target/powerpc/bfp/scalar-cmp-exp-eq-3.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-eq-4.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-gt-3.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-gt-4.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-lt-3.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-lt-4.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-3.c: New test. + * gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-4.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-exp-3.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-exp-4.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-exp-5.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-exp-6.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-exp-7.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-sig-3.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-sig-4.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-sig-5.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-sig-6.c: New test. + * gcc.target/powerpc/bfp/scalar-extract-sig-7.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-10.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-11.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-12.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-13.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-14.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-15.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-6.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-7.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-8.c: New test. + * gcc.target/powerpc/bfp/scalar-insert-exp-9.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-10.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-11.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-12.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-13.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-14.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-15.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-8.c: New test. + * gcc.target/powerpc/bfp/scalar-test-data-class-9.c: New test. + * gcc.target/powerpc/bfp/scalar-test-neg-4.c: New test. + * gcc.target/powerpc/bfp/scalar-test-neg-5.c: New test. + * gcc.target/powerpc/bfp/scalar-test-neg-6.c: New test. + * gcc.target/powerpc/bfp/scalar-test-neg-7.c: New test. + * gcc.target/powerpc/bfp/scalar-test-neg-8.c: New test. + * gcc.target/powerpc/bfp/vec-extract-exp-4.c: New test. + * gcc.target/powerpc/bfp/vec-extract-exp-5.c: New test. + * gcc.target/powerpc/bfp/vec-extract-sig-4.c: New test. + * gcc.target/powerpc/bfp/vec-extract-sig-5.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-10.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-11.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-8.c: New test. + * gcc.target/powerpc/bfp/vec-insert-exp-9.c: New test. + * gcc.target/powerpc/bfp/vec-test-data-class-8.c: New test. + * gcc.target/powerpc/bfp/vec-test-data-class-9.c: New test. + +2016-07-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR tree-optimization/81162 + * gcc.dg/pr81162.c: New file. + +2017-07-14 Martin Sebor <msebor@redhat.com> + + * gcc.dg/tree-ssa/ssa-dse-30.c: Correct test to look for memmove + that bcopy is expected to be transformed to. + +2017-07-14 David Malcolm <dmalcolm@redhat.com> + + * g++.dg/cpp0x/missing-initializer_list-include.C: New test case. + * g++.dg/lookup/missing-std-include-2.C: New test case. + * g++.dg/lookup/missing-std-include-3.C: New test case. + * g++.dg/rtti/missing-typeinfo-include.C: New test case. + * gcc.dg/missing-header-fixit-1.c: New test case. + * gcc.dg/missing-header-fixit-2.c: New test case. + * gcc.dg/missing-header-fixit-2.h: New header. + +2017-07-13 David Malcolm <dmalcolm@redhat.com> + + PR c/81405 + * gcc.dg/Wmissing-braces-fixits.c: Add coverage for PR c/81405. */ + +2017-07-13 Will Schmidt <will_schmidt@vnet.ibm.com> + + * gcc.target/powerpc/fold-vec-missing-lhs.c: New. + +2017-07-13 Martin Liska <mliska@suse.cz> + + * c-c++-common/ubsan/sanitize-all-1.c: Update scanned pattern. + * c-c++-common/ubsan/sanitize-recover-1.c:Likewise. + * c-c++-common/ubsan/sanitize-recover-2.c:Likewise. + * c-c++-common/ubsan/sanitize-recover-5.c:Likewise. + * c-c++-common/ubsan/sanitize-recover-7.c:Likewise. + * c-c++-common/ubsan/sanitize-recover-8.c:Likewise. + * c-c++-common/ubsan/sanitize-recover-9.c:Likewise. + +2017-07-12 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/81193 + * gcc.target/powerpc/bmi-andn-1.c: Add guard against using + __builtin_cpu_supports with old GLIBC's. + * gcc.target/powerpc/bmi-andn-2.c: Likewise. + * gcc.target/powerpc/bmi-bextr-1.c: Likewise. + * gcc.target/powerpc/bmi-bextr-2.c: Likewise. + * gcc.target/powerpc/bmi-bextr-4.c: Likewise. + * gcc.target/powerpc/bmi-bextr-5.c: Likewise. + * gcc.target/powerpc/bmi-blsi-1.c: Likewise. + * gcc.target/powerpc/bmi-blsi-2.c: Likewise. + * gcc.target/powerpc/bmi-blsmsk-1.c: Likewise. + * gcc.target/powerpc/bmi-blsmsk-2.c: Likewise. + * gcc.target/powerpc/bmi-blsr-1.c: Likewise. + * gcc.target/powerpc/bmi-blsr-2.c: Likewise. + * gcc.target/powerpc/bmi-tzcnt-1.c: Likewise. + * gcc.target/powerpc/bmi-tzcnt-2.c: Likewise. + * gcc.target/powerpc/bmi2-bzhi32-1.c: Likewise. + * gcc.target/powerpc/bmi2-bzhi64-1.c: Likewise. + * gcc.target/powerpc/bmi2-mulx32-1.c: Likewise. + * gcc.target/powerpc/bmi2-mulx32-2.c: Likewise. + * gcc.target/powerpc/bmi2-mulx64-1.c: Likewise. + * gcc.target/powerpc/bmi2-mulx64-2.c: Likewise. + * gcc.target/powerpc/bmi2-pdep32-1.c: Likewise. + * gcc.target/powerpc/bmi2-pdep64-1.c: Likewise. + * gcc.target/powerpc/bmi2-pext32-1.c: Likewise. + * gcc.target/powerpc/bmi2-pext64-1.c: Likewise. + * gcc.target/powerpc/cpu-builtin-1.c: Likewise. + +2017-07-12 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/p9-xxbr-1.c (rev_bool_char, rev_bool_short, + rev_bool_int): Add test cases for builtins. + * gcc.target/powerpc/p9-xxbr-2.c (rev_long_long, rev_ulong_ulong): Add + test cases for builtins. + +2017-07-12 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-1-p9-runnable.c (dg-ddo run): Add + lp64 && p9vector_hw. + +2017-07-12 Christophe Lyon <christophe.lyon@linaro.org> + + * lib/target-supports.exp (check_stack_check_available): Make + testcase name depend on stack_kind. + +2017-07-11 Michael Collison <michael.collison@arm.com> + + * gcc.target/aarch64/cmp-2.c: New testcase. + +2017-07-11 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51270 + * g++.dg/warn/Wreturn-local-addr-3.C: New. + +2017-07-11 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-2-p9-runnable.c: Add new file with + test cases for the builtins. + +2017-07-11 Yury Gribov <tetra2005@gmail.com> + + * lib/profopt.exp: Print relative names in UNSUPPORTED + AutoFDO tests. + +2017-07-10 Michael Collison <michael.collison@arm.com> + + * gcc.target/aarch64/var_shift_mask_1.c: Fix for ILP32 + +2017-07-10 Uros Bizjak <ubizjak@gmail.com> + + PR target/81375 + * gcc.target/i386/pr81375.c: New test. + +2017-07-10 Martin Sebor <msebor@redhat.com> + + PR tree-optimization/80397 + * gcc.dg/tree-ssa/builtin-sprintf-warn-17.c: New test. + +2017-07-10 Martin Sebor <msebor@redhat.com> + + PR other/81345 + * gcc.dg/pr81345.c: New test. + +2017-07-10 Claudiu Zissulescu <claziss@synopsys.com> + + * gcc.target/arc/mulsi3_highpart-1.c: Remove 'X' constraint. + * gcc.target/arc/mulsi3_highpart-2.c: Likewise. + +2017-07-09 Uros Bizjak <ubizjak@gmail.com> + + PR target/81313 + * gcc.dg/stack-layout-dynamic-1.c (bar): Add 4 additional + integer argumets to bypass x86_64 outgoing args optimization. + +2017-07-09 Thomas Koenig <tkoenig@gcc.gnu.org> + + * gfortran.dg/eoshift_4.f90: New test. + * gfortran.dg/eoshift_5.f90: New test. + * gfortran.dg/eoshift_6.f90: New test. + +2017-07-09 H.J. Lu <hongjiu.lu@intel.com> + + PR target/81313 + * gcc.target/i386/pr81313-1.c: New test. + * gcc.target/i386/pr81313-2.c: Likewise. + * gcc.target/i386/pr81313-3.c: Likewise. + * gcc.target/i386/pr81313-4.c: Likewise. + * gcc.target/i386/pr81313-5.c: Likewise. + +2017-07-08 Richard Sandiford <richard.sandiford@linaro.org> + + * gnat.dg/vect15.ads (Sarray): Increase range to 1 .. 5. + * gnat.dg/vect16.ads (Sarray): Likewise. + * gnat.dg/vect17.ads (Sarray): Likewise. + * gnat.dg/vect15.adb (Add): Create a dependence distance of 1. + * gnat.dg/vect16.adb (Add): Likewise. + * gnat.dg/vect17.adb (Add): Likewise. + +2017-07-07 David Malcolm <dmalcolm@redhat.com> + + PR c++/79300 + * g++.dg/diagnostic/pr79300.C: New test case. + +2017-07-07 Michael Meissner <meissner@linux.vnet.ibm.com> + + * gcc.target/powerpc/clone1.c: Add check to make sure the + __builtin_cpu_supports function is fully supported. + * gcc.target/powerpc/clone2.c: New runtime test for + target_clones. + + PR target/81348 + * gcc.target/powerpc/pr81348.c: New test. + +2017-07-07 Szabolcs Nagy <szabolcs.nagy@arm.com> + + * gfortran.dg/vect/pr60510.f: Require vect_double support. + +2017-07-07 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-1-p9-runnable.c: Add new test + file for built-ins. + +2017-07-07 Jose E. Marchesi <jose.marchesi@oracle.com> + + * gcc.target/sparc/dictunpack.c: New file. + * gcc.target/sparc/fpcmpdeshl.c: Likewise. + * gcc.target/sparc/fpcmpshl.c: Likewise. + * gcc.target/sparc/fpcmpurshl.c: Likewise. + * gcc.target/sparc/fpcmpushl.c: Likewise. + +2017-07-06 Harald Anlauf <anlauf@gmx.de> + + PR fortran/70071 + * gfortran.dg/coarray_44.f90: New testcase. + +2017-07-06 Maxim Ostapenko <m.ostapenko@samsung.com> + + * c-c++-common/asan/kasan-alloca-1.c: New test. + * c-c++-common/asan/kasan-alloca-2.c: Likewise. + +2017-07-06 Maxim Ostapenko <m.ostapenko@samsung.com> + + * c-c++-common/asan/alloca_big_alignment.c: New test. + * c-c++-common/asan/alloca_detect_custom_size.c: Likewise. + * c-c++-common/asan/alloca_instruments_all_paddings.c: Likewise. + * c-c++-common/asan/alloca_loop_unpoisoning.c: Likewise. + * c-c++-common/asan/alloca_overflow_partial.c: Likewise. + * c-c++-common/asan/alloca_overflow_right.c: Likewise. + * c-c++-common/asan/alloca_safe_access.c: Likewise. + * c-c++-common/asan/alloca_underflow_left.c: Likewise. + +2017-07-06 Georg-Johann Lay <avr@gjlay.de> + + PR target/81305 + * gcc.target/avr/isr-test.h: Fix warnings. + +2017-07-06 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * lib/target-supports.exp: Generate + check_effective_target_arm_arch_v8r_ok, add_options_for_arm_arch_v8r + and check_effective_target_arm_arch_v8r_multilib. + +2017-07-06 Carl Love <cel@us.ibm.com> + + * ChangeLog: Clean up from mid air collision + +2017-07-06 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/p8vector-builtin-8.c (foo): Add test cases for + the new vec_subc, vec_sube, vec_subec built-ins. Add the missing test + cases for vec_addc, adde and addec builtins. + +2017-07-06 David Malcolm <dmalcolm@redhat.com> + + PR c++/79300 + * c-c++-common/Wmisleading-indentation-3.c (fn_14): Update + expected underlining within macro expansion. + * c-c++-common/pr70264.c: Likewise. + * g++.dg/plugin/diagnostic-test-expressions-1.C + (test_within_macro_1): New test. + (test_within_macro_2): Likewise. + (test_within_macro_3): Likewise. + (test_within_macro_4): Likewise. + * gcc.dg/format/diagnostic-ranges.c (test_macro_3): Update + expected underlining within macro expansion. + (test_macro_4): Likewise. + * gcc.dg/plugin/diagnostic-test-expressions-1.c + (test_within_macro_1): New test. + (test_within_macro_2): Likewise. + (test_within_macro_3): Likewise. + (test_within_macro_4): Likewise. + * gcc.dg/spellcheck-fields-2.c (test_macro): Update expected + underlining within macro expansion. + +2017-07-06 Sebastian Peryt <sebastian.peryt@intel.com> + + * gcc.target/i386/avx512f-vgetexpsd-1.c (_mm_mask_getexp_sd, + _mm_maskz_getexp_sd, _mm_mask_getexp_round_sd, + _mm_maskz_getexp_round_sd): Test new intrinsics. + * gcc.target/i386/avx512f-vgetexpss-1.c (_mm_mask_getexp_ss, + _mm_maskz_getexp_ss, _mm_mask_getexp_round_ss, + _mm_maskz_getexp_round_ss): Ditto. + * gcc.target/i386/avx512f-vgetmantsd-1.c (_mm_mask_getmant_sd, + _mm_maskz_getmant_sd, _mm_mask_getmant_round_sd, + _mm_maskz_getmant_round_sd): Ditto. + * gcc.target/i386/avx512f-vgetmantss-1.c (_mm_mask_getmant_ss, + _mm_maskz_getmant_ss, _mm_mask_getmant_round_ss, + _mm_maskz_getmant_round_ss): Ditto. + * gcc.target/i386/avx512f-vgetexpsd-2.c (_mm_mask_getexp_sd, + _mm_maskz_getexp_sd, _mm_getexp_round_sd, _mm_mask_getexp_round_sd, + _mm_maskz_getexp_round_sd): New runtime tests. + * gcc.target/i386/avx512f-vgetexpss-2.c (_mm_mask_getexp_ss, + _mm_maskz_getexp_ss, _mm_getexp_round_ss, _mm_mask_getexp_round_ss, + _mm_maskz_getexp_round_ss): Ditto. + * gcc.target/i386/avx512f-vgetmantsd-2.c (_mm_mask_getmant_sd, + _mm_maskz_getmant_sd, _mm_getmant_round_sd, _mm_mask_getmant_round_sd, + _mm_maskz_getmant_round_sd): Ditto. + * gcc.target/i386/avx512f-vgetmantss-2.c (_mm_mask_getmant_ss, + _mm_maskz_getmant_ss, _mm_getmant_round_ss, _mm_mask_getmant_round_ss, + _mm_maskz_getmant_round_ss): Ditto. + * gcc.target/i386/avx-1.c (__builtin_ia32_getexpsd_mask_round, + __builtin_ia32_getexpss_mask_round, __builtin_ia32_getmantsd_mask_round, + __builtin_ia32_getmantss_mask_round): Test new builtins. + * gcc.target/i386/sse-13.c : Ditto. + * gcc.target/i386/sse-23.c: Ditto. + * gcc.target/i386/sse-14.c (_mm_maskz_getexp_round_sd, + _mm_maskz_getexp_round_ss, _mm_mask_getmant_round_sd, + _mm_maskz_getmant_round_sd, _mm_mask_getmant_round_ss, + _mm_maskz_getmant_round_ss, _mm_mask_getexp_round_sd, + _mm_mask_getexp_round_ss): Test new intrinsics. + * gcc.target/i386/testround-1.c: Ditto. + * gcc.target/i386/sse-22.c (_mm_maskz_getmant_round_sd, + _mm_maskz_getmant_round_ss, _mm_mask_getmant_round_sd, + _mm_mask_getmant_round_ss): Test new intrinsics + * gcc.target/i386/testimm-10.c (_mm_mask_getmant_sd, + _mm_maskz_getmant_sd, _mm_mask_getmant_ss, + _mm_maskz_getmant_ss): Test new intrinsics. + +2017-07-06 Christophe Lyon <christophe.lyon@linaro.org> + + * lib/target-supports-dg.exp (dg-require-stack-check): New. + * lib/target-supports.exp (check_stack_check_available): New. + * g++.dg/other/i386-9.C: Add dg-require-stack-check. + * gcc.c-torture/compile/stack-check-1.c: Likewise. + * gcc.dg/graphite/run-id-pr47653.c: Likewise. + * gcc.dg/pr47443.c: Likewise. + * gcc.dg/pr48134.c: Likewise. + * gcc.dg/pr70017.c: Likewise. + * gcc.target/aarch64/stack-checking.c: Likewise. + * gcc.target/arm/stack-checking.c: Likewise. + * gcc.target/i386/pr48723.c: Likewise. + * gcc.target/i386/pr55672.c: Likewise. + * gcc.target/i386/pr67265-2.c: Likewise. + * gcc.target/i386/pr67265.c: Likewise. + * gnat.dg/opt49.adb: Likewise. + * gnat.dg/stack_check1.adb: Likewise. + * gnat.dg/stack_check2.adb: Likewise. + * gnat.dg/stack_check3.adb: Likewise. + +2017-07-05 Kelvin Nilsen <kelvin@gcc.gnu.org> + + PR target/80103 + * gcc.target/powerpc/pr80103-1.c (void b): Correct spelling of + __attribute__. + +2017-07-05 Sebastian Peryt <sebastian.peryt@intel.com> + + * gcc.target/i386/avx512f-vaddsd-3.c: New test for mask 0 verification. + * gcc.target/i386/avx512f-vaddss-3.c: Ditto. + * gcc.target/i386/avx512f-vdivsd-3.c: Ditto. + * gcc.target/i386/avx512f-vdivss-3.c: Ditto. + * gcc.target/i386/avx512f-vmaxsd-3.c: Ditto. + * gcc.target/i386/avx512f-vmaxss-3.c: Ditto. + * gcc.target/i386/avx512f-vminsd-3.c: Ditto. + * gcc.target/i386/avx512f-vminss-3.c: Ditto. + * gcc.target/i386/avx512f-vmulsd-3.c: Ditto. + * gcc.target/i386/avx512f-vmulss-3.c: Ditto. + * gcc.target/i386/avx512f-vsubsd-3.c: Ditto. + * gcc.target/i386/avx512f-vsubss-3.c: Ditto. + +2017-07-05 Georg-Johann Lay <avr@gjlay.de> + + PR target/81305 + * gcc.target/avr/isr-test.h: New file. + * gcc.target/avr/torture/isr-01-simple.c: New test. + * gcc.target/avr/torture/isr-02-call.c: New test. + * gcc.target/avr/torture/isr-03-fixed.c: New test. + +2017-07-05 Bin Cheng <bin.cheng@arm.com> + + * gcc.dg/tree-ssa/ldist-4.c: Adjust test string. + * gcc.dg/tree-ssa/ldist-12.c: Ditto. + * gcc.dg/tree-ssa/ldist-13.c: Ditto. + * gcc.dg/tree-ssa/ldist-14.c: Ditto. + +2017-07-05 Bin Cheng <bin.cheng@arm.com> + + * gcc.dg/tree-ssa/ldist-26.c: New test. + +2017-07-05 Bin Cheng <bin.cheng@arm.com> + + * gcc.dg/tree-ssa/ldist-6.c: XFAIL. + +2017-07-04 Uros Bizjak <ubizjak@gmail.com> + + PR target/81300 + * gcc.target/i386/pr81300.c: New test. + +2017-07-04 Uros Bizjak <ubizjak@gmail.com> + + PR target/81294 + * gcc.target/i386/adx-addcarryx32-2.c (adx_test): Swap + x and y arguments in the call to _subborrow_u32. + * gcc.target/i386/adx-addcarryx64-2.c (adx_test): Swap + x and y arguments in the call to _subborrow_u64. + * gcc.target/i386/pr81294-1.c: New test. + * gcc.target/i386/pr81294-2.c: Ditto. + +2017-07-04 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/aarch64/simd/vminmaxnm_1.c: Fix strict aliasing issues. + +2017-07-04 Marek Polacek <polacek@redhat.com> + + PR c/81231 + * gcc.dg/atomic-pr81231.c: New test. + +2017-07-04 Richard Sandiford <richard.sandiford@linaro.org> + + PR tree-optimization/81292 + * gcc.dg/pr81292-1.c: New test. + * gcc.dg/pr81292-2.c: Likewise. + +2017-07-04 Martin Liska <mliska@suse.cz> + + PR sanitizer/81040 + * g++.dg/asan/function-argument-1.C: Run the test-case w/o + use-after-scope sanitization. + +2017-07-04 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/asan/function-argument-3.C: Add -Wno-psabi to additional + options. + + PR target/81175 + * gcc.target/i386/pr69255-2.c (foo): Use the return value of the + gather. + +2017-07-04 Martin Liska <mliska@suse.cz> + + PR ipa/81214 + * g++.dg/ext/mvc2.C: Add dg-require ifunc. + * g++.dg/ext/mvc3.C: Likewise. + * gcc.target/i386/mvc2.c: Likewise. + * gcc.target/i386/mvc3.c: Likewise. + +2017-07-04 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/cpp1z/decomp1.C: Expect structured binding instead of + decomposition declaration in diagnostics. + * g++.dg/cpp1z/decomp2.C: Likewise. + * g++.dg/cpp1z/decomp3.C: Likewise. + * g++.dg/cpp1z/decomp4.C: Likewise. + * g++.dg/cpp1z/decomp5.C: Likewise. + * g++.dg/cpp1z/decomp6.C: Likewise. + * g++.dg/cpp1z/decomp7.C: Likewise. + * g++.dg/cpp1z/decomp8.C: Likewise. + * g++.dg/cpp1z/decomp13.C: Likewise. + * g++.dg/cpp1z/decomp14.C: Likewise. + * g++.dg/cpp1z/decomp18.C: Likewise. + * g++.dg/cpp1z/decomp19.C: Likewise. + * g++.dg/cpp1z/decomp22.C: Likewise. + * g++.dg/cpp1z/decomp23.C: Likewise. + * g++.dg/cpp1z/decomp24.C: Likewise. + * g++.dg/cpp1z/decomp25.C: Likewise. + * g++.dg/cpp1z/decomp26.C: Likewise. + * g++.dg/cpp1z/decomp28.C: Likewise. + + PR c++/81258 + * g++.dg/cpp1z/decomp21.C (foo): Adjust expected diagnostics. + * g++.dg/cpp1z/decomp30.C: New test. + +2017-07-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/65775 + * g++.dg/cpp0x/trailing14.C: New. + +2017-07-03 Dominique d'Humieres <dominiq@lps.ens.fr> + + PR testsuite/79866 + * gfortran.dg/coarray_event_2.f08: New test. + +2017-07-03 Dominique d'Humieres <dominiq@lps.ens.fr> + + PR testsuite/79843 + * gfortran.dg/namelist_3.f90: Adjust the dg-error string. + * gfortran.dg/pointer_intent_2.f90: Likewise. + +2017-07-02 Jan Hubicka <hubicka@ucw.cz> + + PR middle-end/81290 + * gcc.c-torture/compile/pr81290.c: New. + +2017-07-03 Richard Biener <rguenther@suse.de> + + PR tree-optimization/60510 + * gfortran.dg/vect/pr60510.f: New testcase. + +2017-07-03 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.target/i386/mvc6.c: Require ifunc support. + +2017-07-03 Martin Liska <mliska@suse.cz> + + PR sanitize/81040 + * g++.dg/asan/function-argument-1.C: New test. + * g++.dg/asan/function-argument-2.C: New test. + * g++.dg/asan/function-argument-3.C: New test. + +2017-07-03 Richard Sandiford <richard.sandiford@linaro.org> + + * gcc.dg/vect/bb-slp-pr65935.c: Expect SLP to be used in main + as well. + +2017-07-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/69468 + * gcc.dg/pr81192.c: Update. + +2017-07-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/81192 + * gcc.dg/pr81192.c: Update. + +2017-07-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/81192 + * gcc.dg/pr81192.c: New test. + +2017-07-02 Thomas Koenig <tkoenig@gcc.gnu.org> + + * gfortran/eoshift_3.f90: New test. + +2017-07-02 Richard Sandiford <richard.sandiford@linaro.org> + + * gcc.dg/strlenopt-32.c: New testcase. + * gcc.dg/strlenopt-33.c: Likewise. + * gcc.dg/strlenopt-33g.c: Likewise. + * gcc.dg/strlenopt-34.c: Likewise. + * gcc.dg/strlenopt-35.c: Likewise. + +2017-07-02 Richard Sandiford <richard.sandiford@linaro.org> + + PR tree-optimization/80769 + * gcc.dg/strlenopt-31.c: New test. + * gcc.dg/strlenopt-31g.c: Likewise. + +2017-07-02 Richard Sandiford <richard.sandiford@linaro.org> + + PR tree-optimization/81136 + * gcc.dg/vect/pr81136.c: New test. + +2017-07-01 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/81262 + * gcc.c-torture/compile/pr81262.c: New test. + * g++.dg/ubsan/pr81262.C: New test. + +2017-06-29 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/81261 + * g++.dg/ipa/pr81261.C: New testcase. + +2017-06-30 Andrew Pinski <apinski@cavium.com> + + * gcc.dg/torture/pr81245.c: New testcase. + +2017-06-30 Aldy Hernandez <aldyh@redhat.com> + + * gcc.dg/Walloca-14.c: Adapt test to recognize new complaint of + unbounded use. + +2017-06-30 David Malcolm <dmalcolm@redhat.com> + + PR c++/80014 + * g++.dg/plugin/diagnostic-test-expressions-1.C (std::type_info): + Add declaration. + (test_typeid): New test function. + +2017-06-30 Jakub Jelinek <jakub@redhat.com> + + PR target/81225 + * gcc.target/i386/pr81225.c: New test. + +2017-06-30 Nathan Sidwell <nathan@acm.org> + + * g++.dg/concepts/memfun-err.C: Adjust diagnostics. + * g++.dg/cpp0x/decltype9.C: Likewise. + * g++.dg/cpp0x/forw_enum9.C: Likewise. + * g++.dg/lookup/decl1.C: Likewise. + * g++.dg/lookup/extern-c-redecl.C: Likewise. + * g++.dg/other/pr28432.C: Likewise. + * g++.dg/parse/crash12.C: Likewise. + * g++.dg/parse/enum3.C: Likewise. + * g++.dg/parse/operator6.C: Likewise. + * g++.dg/template/crash69.C: Likewise. + * g++.dg/template/error27.C: Likewise. + * g++.dg/template/error28.C: Likewise. + * g++.dg/template/memfriend6.C: Likewise. + * g++.old-deja/g++.mike/err1.C: Likewise. + * g++.old-deja/g++.mike/p811.C: Likewise. + * g++.old-deja/g++.other/crash25.C: Likewise. + * g++.old-deja/g++.other/dtor4.C: Likewise. + * g++.old-deja/g++.pt/t37.C: Likewise. + +2017-06-30 Martin Liska <mliska@suse.cz> + + PR ipa/81214 + * gcc.target/i386/pr81214.c: New test. + +2017-06-30 Nathan Sidwell <nathan@acm.org> + + * g++.dg/plugin/decl-plugin-test.C: Expect special ctor name. + + PR c++/81229 + * g++.dg/lookup/pr81229.C: New. + +2017-06-30 Martin Liska <mliska@suse.cz> + + PR sanitizer/81021 + * g++.dg/asan/pr81021.C: New test. + +2017-06-30 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81249 + * g++.dg/torture/pr81249.C: New testcase. + +2017-06-29 Paolo Carlini <paolo.carlini@oracle.com> + + * g++.dg/cpp0x/inh-ctor3.C: Adjust for dg-message vs dg-error. + * g++.dg/diagnostic/variadic1.C: Likewise. + * g++.dg/gomp/udr-3.C: Likewise. + * g++.dg/overload/error1.C: Likewise. + * g++.dg/overload/error2.C: Likewise. + * g++.dg/template/duplicate1.C: Likewise. + * g++.old-deja/g++.benjamin/warn02.C: Likewise. + * g++.old-deja/g++.brendan/arm2.C: Likewise. + * g++.old-deja/g++.other/redecl2.C: Likewise. + * g++.old-deja/g++.other/redecl4.C: Likewise. + * g++.old-deja/g++.pt/memtemp78.C: Likewise. + +2017-06-29 Cesar Philippidis <cesar@codesourcery.com> + + PR fortran/77765 + * gfortran.dg/goacc/pr77765.f90: New test. + +2017-06-29 Steve Ellcey <sellcey@cavium.com> + + * gcc.target/aarch64/ccmp_2.c: New test. + +2017-06-29 Nathan Sidwell <nathan@acm.org> + + PR c++/81247 + * g++.dg/parse/pr81247-[abc].C: New. + +2017-06-29 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-3-runnable.c (test_int_result, + test_unsigned_int_result, test_ll_int_result, + test_ll_unsigned_int_result): Add result checking functions, add + debug support. + (main): Add builtin function tests. + +2017-06-29 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-3-vec_reve-runnable.c (dg-options, + dg-skip-if): Add -mvsx -mcpu=power7. + +2017-06-29 Richard Biener <rguenther@suse.de> + + * gcc.dg/vect/slp-reduc-8.c: New testcase. + +2017-06-29 Nathan Sidwell <nathan@acm.org> + + * g++.dg/cpp1y/builtin_FUNCTION.C: New. + +2017-06-29 Peter Bergner <bergner@vnet.ibm.com> + + PR middle-end/81194 + * g++.dg/pr81194.C: New test. + +2017-06-29 H.J. Lu <hongjiu.lu@intel.com> + + PR ipa/80565 + * gcc.dg/torture/pr80565.c: New file. + +2017-06-29 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/81196 + * gcc.dg/vect/pr81196.c: New. + +2017-06-29 Michael Collison <michael.collison@arm.com> + + Fix date on previous ChangeLog entry. + +2017-06-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + Michael Collison <michael.collison@arm.com> + + PR target/70119 + * gcc.target/aarch64/var_shift_mask_1.c: New test. + +2017-06-28 Sebastian Peryt <sebastian.peryt@intel.com> + + * gcc.target/i386/avx512vl-vpermd-1.c (_mm256_permutexvar_epi32): + Test new intrinsic. + * gcc.target/i386/avx512vl-vpermq-imm-1.c (_mm256_permutex_epi64): + Ditto. + * gcc.target/i386/avx512vl-vpermq-var-1.c (_mm256_permutexvar_epi64): + Ditto. + * gcc.target/i386/avx512f-vpermd-2.c: Do not check for AVX512F_LEN. + * gcc.target/i386/avx512f-vpermq-imm-2.c: Ditto. + * gcc.target/i386/avx512f-vpermq-var-2.c: Ditto. + +2017-06-28 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * lib/target-supports.exp (check_effective_target_vect_int): Replace + current ARM check by ARM NEON's availability check. + (check_effective_target_vect_intfloat_cvt): Likewise. + (check_effective_target_vect_uintfloat_cvt): Likewise. + (check_effective_target_vect_floatint_cvt): Likewise. + (check_effective_target_vect_floatuint_cvt): Likewise. + (check_effective_target_vect_shift): Likewise. + (check_effective_target_whole_vector_shift): Likewise. + (check_effective_target_vect_bswap): Likewise. + (check_effective_target_vect_shift_char): Likewise. + (check_effective_target_vect_long): Likewise. + (check_effective_target_vect_float): Likewise. + (check_effective_target_vect_perm): Likewise. + (check_effective_target_vect_perm_byte): Likewise. + (check_effective_target_vect_perm_short): Likewise. + (check_effective_target_vect_widen_sum_hi_to_si_pattern): Likewise. + (check_effective_target_vect_widen_sum_qi_to_hi): Likewise. + (check_effective_target_vect_widen_mult_qi_to_hi): Likewise. + (check_effective_target_vect_widen_mult_hi_to_si): Likewise. + (check_effective_target_vect_widen_mult_qi_to_hi_pattern): Likewise. + (check_effective_target_vect_widen_mult_hi_to_si_pattern): Likewise. + (check_effective_target_vect_widen_shift): Likewise. + (check_effective_target_vect_extract_even_odd): Likewise. + (check_effective_target_vect_interleave): Likewise. + (check_effective_target_vect_multiple_sizes): Likewise. + (check_effective_target_vect64): Likewise. + (check_effective_target_vect_max_reduc): Likewise. + +2017-06-28 Richard Biener <rguenther@suse.de> + + PR middle-end/81227 + * gcc.dg/pr81227.c: New testcase. + +2017-06-28 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/81193 + * lib/target-supports.exp + (check_ppc_cpu_supports_hw_available): New test to make sure + __builtin_cpu_supports works on power7 and newer. + +2017-06-28 Martin Liska <mliska@suse.cz> + + PR ipa/81128 + * gcc.target/i386/pr81128.c: New test. + +2017-06-28 Martin Liska <mliska@suse.cz> + + PR driver/79659 + * g++.dg/opt/pr79659.C: New test. + +2017-06-28 Christophe Lyon <christophe.lyon@linaro.org> + + * gcc.dg/tree-ssa/copy-sign-1.c: Add c99_runtime effective target + and options. + * gcc.dg/tree-ssa/mult-abs-2.c: Likewise. + +2017-06-28 Marc Glisse <marc.glisse@inria.fr> + + * gcc.dg/tree-ssa/addadd.c: Remove test duplicated in addadd-2.c. + * gcc.dg/tree-ssa/mulcmp-1.c: New file. + +2017-06-28 Jakub Jelinek <jakub@redhat.com> + + * gcc.target/i386/cmov7.c (sgn): Renamed to ... + (foo): ... this. Change constants such that it isn't matched + as __builtin_copysign, yet tests the combiner the same. + +2017-06-28 Martin Liska <mliska@suse.cz> + + PR sanitizer/81224 + * gcc.dg/asan/pr81224.c: New test. + +2017-06-28 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/tree-prof/val-profiler-threads-1.c (main): Fix 2nd argument + passed to pthread_join. + +2017-06-28 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * gcc.target/s390/nodatarel-1.c: New test. + +2017-06-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/80164 + * gfortran.dg/array_temporaries_4.f90: New test. + +2017-06-27 Andrew Pinski <apinski@cavium.com> + + * gcc.dg/tree-ssa/copy-sign-1.c: New testcase. + * gcc.dg/tree-ssa/copy-sign-2.c: New testcase. + * gcc.dg/tree-ssa/mult-abs-2.c: New testcase. + +2017-06-27 Marek Polacek <polacek@redhat.com> + + PR sanitizer/81223 + * gcc.dg/ubsan/pr81223.c: New test. + +2017-06-27 Marc Glisse <marc.glisse@inria.fr> + + * gcc.dg/tree-ssa/assoc-1.c: New file. + +2017-06-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/62046 + * g++.dg/parse/catch2.C: New. + +2017-06-27 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/81209 + * g++.dg/ubsan/pr81209.C: New test. + + PR middle-end/81207 + * gcc.c-torture/compile/pr81207.c: New test. + +2017-06-27 Marek Polacek <polacek@redhat.com> + + PR bootstrap/81216 + * g++.dg/warn/Wmultistatement-macros-1.C: New test. + +2017-06-26 Martin Sebor <msebor@redhat.com> + + PR c++/81169 + * g++.dg/Wclass-memaccess-2.C: New test. + +2017-06-26 Carl Love <cel@us.ibm.com> + + * gcc.target/powerpc/builtins-3-vec_reve-runnable.c: + Add new runnable test file for the vec_rev built-ins. + +2016-06-26 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR/tree-optimization 71815 + * gcc.dg/tree-ssa/slsr-35.c: Remove -fno-code-hoisting workaround. + * gcc.dg/tree-ssa/slsr-36.c: Likewise. + +2017-06-26 Renlin Li <renlin.li@arm.com> + Szabolcs Nagy <szabolcs.nagy@arm.com> + + * gcc.c-torture/execute/builtins/memops-asm-lib.c (my_memmove): New. + * gcc.c-torture/execute/builtins/memops-asm.c (memmove): Declare + memmove. + +2017-06-26 Richard Biener <rguenther@suse.de> + + PR target/81175 + * gfortran.dg/pr81175.f: New testcase. + +2017-06-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/81203 + * gcc.dg/torture/pr81203.c: New testcase. + +2017-06-26 Marek Polacek <polacek@redhat.com> + + PR c/80116 + * c-c++-common/Wmultistatement-macros-1.c: New test. + * c-c++-common/Wmultistatement-macros-2.c: New test. + * c-c++-common/Wmultistatement-macros-3.c: New test. + * c-c++-common/Wmultistatement-macros-4.c: New test. + * c-c++-common/Wmultistatement-macros-5.c: New test. + * c-c++-common/Wmultistatement-macros-6.c: New test. + * c-c++-common/Wmultistatement-macros-7.c: New test. + * c-c++-common/Wmultistatement-macros-8.c: New test. + * c-c++-common/Wmultistatement-macros-9.c: New test. + * c-c++-common/Wmultistatement-macros-10.c: New test. + * c-c++-common/Wmultistatement-macros-11.c: New test. + +2017-06-26 Eric Botcazou <ebotcazou@adacore.com> + + * c-c++-common/ubsan/sanitize-recover-7.c (dg-options): Add -w. + +2017-06-26 Christophe Lyon <christophe.lyon@linaro.org> + + * lib/target-supports.exp + (check_effective_target_arm_neon_ok_nocache): Add flags with + -mfloat-abi=hard. Include arm_neon.h. + (check_effective_target_arm_neon_ok_no_float_abi_nocache): New. + (check_effective_target_arm_neon_ok_no_float_abi): New. + * gcc.target/arm/lto/pr65837_0.c: Require + arm_neon_ok_no_float_abi. Add -mfpu=neon to dg-lto-options. + * gcc.target/arm/lto/pr65837-attr_0.c: Require + arm_neon_ok_no_float_abi. Remove dg-suppress-ld-options. + 2017-06-24 Paolo Carlini <paolo.carlini@oracle.com> PR c++/62315 @@ -5,7 +1618,7 @@ 2017-06-24 Thomas Koenig <tkoenig@gcc.gnu.org> - PR fortran/52473 + PR fortran/52473 * gfortran.dg/cshift_2.f90: New test. 2017-06-23 Jim Wilson <jim.wilson@linaro.org> @@ -36,8 +1649,7 @@ 2017-06-23 James Cowgill <James.Cowgill@imgtec.com> - * go.test/go-test.exp (go-set-goarch): Update MIPS architecture - names. + * go.test/go-test.exp (go-set-goarch): Update MIPS architecture names. 2017-06-22 Matt Turner <mattst88@gmail.com> @@ -394,7 +2006,7 @@ * gcc.dg/fold-bcopy.c: New test. * gcc.dg/tree-ssa/ssa-dse-30.c: Likewise.. * gcc.dg/tree-ssa/alias-36.c: Likewise. - * gcc/testsuite/gcc.dg/pr79214.c: Adjust. + * gcc.dg/pr79214.c: Adjust. * gcc.dg/tree-prof/val-prof-7.c: Likewise. * gcc.dg/Wsizeof-pointer-memaccess1.c: Likewise. * gcc.dg/builtins-nonnull.c: Likewise. @@ -735,12 +2347,12 @@ 2017-06-08 Will Schmidt <will_schmidt@vnet.ibm.com> - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-char.c: New. - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-float.c: New. - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-floatdouble.c: New. - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-int.c: New. - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-longlong.c: New. - * testsuite/gcc.target/powerpc/fold-vec-logical-eqv-short.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-char.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-float.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-floatdouble.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-int.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-longlong.c: New. + * gcc.target/powerpc/fold-vec-logical-eqv-short.c: New. 2017-06-08 Jakub Jelinek <jakub@redhat.com> @@ -2463,8 +4075,8 @@ 2017-05-08 Wilco Dijkstra <wdijkstr@arm.com> - * testsuite/gcc.dg/vect/vect-44.c: Add -fno-vect-cost-model. - * gcc/testsuite/gcc.dg/vect/vect-50.c: Likewise. + * gcc.dg/vect/vect-44.c: Add -fno-vect-cost-model. + * gcc.dg/vect/vect-50.c: Likewise. 2017-05-07 Jeff Law <law@redhat.com> diff --git a/gcc/testsuite/c-c++-common/Wmisleading-indentation-3.c b/gcc/testsuite/c-c++-common/Wmisleading-indentation-3.c index 6482b006c7f..870ba720c5f 100644 --- a/gcc/testsuite/c-c++-common/Wmisleading-indentation-3.c +++ b/gcc/testsuite/c-c++-common/Wmisleading-indentation-3.c @@ -68,7 +68,7 @@ void fn_14 (void) /* { dg-begin-multiline-output "" } for ((VAR) = (START); (VAR) < (STOP); (VAR++)) - ^ + ^~~ { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } FOR_EACH (i, 0, 10) diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-1.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-1.c new file mode 100644 index 00000000000..cdecbb4aca4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-1.c @@ -0,0 +1,118 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(X, Y) \ + tmp = X; /* { dg-warning "macro expands to multiple statements" } */ \ + X = Y; \ + Y = tmp + +#define STUFF \ + if (0) x = y + +#define STUFF2 \ + if (0) x = y; x++ + +#define STUFF3 \ + if (x) /* { dg-message "not guarded by this 'if' clause" } */ \ + SWAP(x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define SET(X, Y) \ + (X) = (Y) + +#define STUFF4 \ + if (x) \ + SET(x, y); \ + SET(x, y) + +#define STUFF5 \ + { tmp = x; x = y; } + +#define STUFF6 \ + x++;; + +int x, y, tmp; + +void +fn1 (void) +{ + if (x) /* { dg-message "not guarded by this 'if' clause" } */ + SWAP(x, y); /* { dg-message "in expansion of macro .SWAP." } */ +} + +void +fn2 (void) +{ + SWAP(x, y); +} + +void +fn3 (void) +{ + if (x) + { + SWAP(x, y); + } +} + +void +fn4 (void) +{ + if (x) + ({ x = 10; x++; }); +} + +void +fn5 (void) +{ + if (x) /* { dg-message "not guarded by this 'if' clause" } */ +L1: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + goto L1; +} + +void +fn6 (void) +{ + if (x) + SET (x, y); + SET (tmp, x); +} + +void +fn7 (void) +{ + STUFF; +} + +void +fn8 (void) +{ + STUFF2; +} + +void +fn9 (void) +{ + STUFF3; /* { dg-message "in expansion of macro .STUFF3." } */ +} + +void +fn10 (void) +{ + STUFF4; +} + +void +fn11 (void) +{ + if (x) + STUFF5; +} + +void +fn12 (void) +{ + if (x) + STUFF6; +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-10.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-10.c new file mode 100644 index 00000000000..766ed25242a --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-10.c @@ -0,0 +1,82 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(x, y) \ + tmp = x; /* { dg-warning "macro expands to multiple statements" } */ \ + x = y; \ + y = tmp + +#define M1 \ + switch (x) /* { dg-message "not guarded by this 'switch' clause" } */ \ + case 1: \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define M2 \ + switch (x) \ + case 1: \ + x++ + +#define M3 \ + switch (x) \ + case 1: \ + x++;; + +#define M4 \ + switch (x) /* { dg-message "not guarded by this 'switch' clause" } */ \ +L1: \ + case 1: \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define INC \ + x++;; + +int x, y, tmp; + +void +fn0 (void) +{ + switch (x) /* { dg-message "not guarded by this 'switch' clause" } */ + case 1: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + + switch (x) /* { dg-message "not guarded by this 'switch' clause" } */ + case 1: + case 2: + case 3: + case 4: + case 5: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ +} + +void +fn1 (void) +{ + M1; /* { dg-message "in expansion of macro .M1." } */ + M2; + M3; + M4; /* { dg-message "in expansion of macro .M4." } */ + goto L1; +} + +void +fn2 (void) +{ + switch (x) + case 1: + INC + + switch (x) + case 1: + ({ x = 10; x++; }); +} + +void +fn3 (void) +{ + switch (x) + { + case 1: + SWAP (x, y); + } +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-11.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-11.c new file mode 100644 index 00000000000..4f4a123631d --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-11.c @@ -0,0 +1,19 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +enum E { A, B }; + +const char * +foo (enum E e) +{ +#define CASE(X) case X: return #X + switch (e) + { + CASE (A); + CASE (B); + default: + return "<unknown>"; + } +#undef CASE +}; diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-12.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-12.c new file mode 100644 index 00000000000..ac8915c24b0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-12.c @@ -0,0 +1,43 @@ +/* PR c/81364 */ +/* { dg-do compile } */ +/* { dg-options "-Wmultistatement-macros" } */ + +#define FOO0 if (1) { } else +#define TST0 \ +void bar0 (void) \ +{ \ + FOO0 { } /* { dg-bogus "macro expands to multiple statements" } */ \ +} +TST0 + +#define FOO1 for (;;) +#define TST1 \ +void bar1 (void) \ +{ \ + FOO1 { } /* { dg-bogus "macro expands to multiple statements" } */ \ +} +TST1 + +#define FOO2 while (1) +#define TST2 \ +void bar2 (void) \ +{ \ + FOO2 { } /* { dg-bogus "macro expands to multiple statements" } */ \ +} +TST2 + +#define FOO3 switch (1) +#define TST3 \ +void bar3 (void) \ +{ \ + FOO3 { } /* { dg-bogus "macro expands to multiple statements" } */ \ +} +TST3 + +#define FOO4 if (1) +#define TST4 \ +void bar4 (void) \ +{ \ + FOO4 { } /* { dg-bogus "macro expands to multiple statements" } */ \ +} +TST4 diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-2.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-2.c new file mode 100644 index 00000000000..9fef90177eb --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-2.c @@ -0,0 +1,137 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(X, Y) \ + tmp = X; /* { dg-warning "macro expands to multiple statements" } */ \ + X = Y; \ + Y = tmp + +#define STUFF \ + if (0) {} else x = y + +#define STUFF2 \ + if (0) {} else x = y; x++ + +#define STUFF3 \ + if (x) \ + {} \ + else /* { dg-message "not guarded by this 'else' clause" } */ \ + SWAP(x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define SET(X, Y) \ + (X) = (Y) + +#define STUFF4 \ + if (x) \ + {} \ + else \ + SET(x, y); \ + SET(x, y) + +#define STUFF5 \ + { tmp = x; x = y; } + +#define STUFF6 \ + x++;; + +int x, y, tmp; + +void +fn1 (void) +{ + if (x) + { + } + else /* { dg-message "not guarded by this 'else' clause" } */ + SWAP(x, y); /* { dg-message "in expansion of macro .SWAP." } */ +} + +void +fn2 (void) +{ + SWAP(x, y); +} + +void +fn3 (void) +{ + if (x) + { + } + else + { + SWAP(x, y); + } +} + +void +fn4 (void) +{ + if (x) + { + } + else + ({ x = 10; x++; }); +} + +void +fn5 (void) +{ + if (x) + { + } + else /* { dg-message "not guarded by this 'else' clause" } */ +L1: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + goto L1; +} + +void +fn6 (void) +{ + if (x) + { + } + else + SET (x, y); + SET (tmp, x); +} + +void +fn7 (void) +{ + STUFF; +} + +void +fn8 (void) +{ + STUFF2; +} + +void +fn9 (void) +{ + STUFF3; /* { dg-message "in expansion of macro .STUFF3." } */ +} + +void +fn10 (void) +{ + STUFF4; +} + +void +fn11 (void) +{ + if (x) + STUFF5; +} + +void +fn12 (void) +{ + if (x) + STUFF6; +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-3.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-3.c new file mode 100644 index 00000000000..d130a35f8cc --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-3.c @@ -0,0 +1,12 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define CHECK(X) if (!(X)) __builtin_abort () + +void +fn (int i) +{ + CHECK (i == 1); + CHECK (i == 2); +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-4.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-4.c new file mode 100644 index 00000000000..e5cc9c35d5b --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-4.c @@ -0,0 +1,14 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define FN(C) \ + void \ + fn (void) \ + { \ + C; \ + } + +int i; + +FN (if (i) ++i) diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-5.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-5.c new file mode 100644 index 00000000000..0ac84f54480 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-5.c @@ -0,0 +1,18 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define M(N) \ +L ## N: \ + x++; x++ /* { dg-warning "macro expands to multiple statements" } */ + +int x, y, tmp; + +void +fn1 (void) +{ + if (x) /* { dg-message "not guarded by this 'if' clause" } */ + M (0); /* { dg-message "in expansion of macro .M." } */ + if (x) /* { dg-message "not guarded by this 'if' clause" } */ + M (1); /* { dg-message "in expansion of macro .M." } */ +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-6.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-6.c new file mode 100644 index 00000000000..5ec9cd9db26 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-6.c @@ -0,0 +1,22 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define M \ + if (x) x++; x++ + +void +f (int x) +{ + M; + M; + M; + M; + M; + M; + M; + M; + M; + M; + M; +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-7.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-7.c new file mode 100644 index 00000000000..d661f148ddf --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-7.c @@ -0,0 +1,18 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(X, Y) \ + tmp = X; /* { dg-warning "macro expands to multiple statements" } */ \ + X = Y; \ + Y = tmp + +#define BODY_AND_IF(COND, X, Y) \ + if (COND) SWAP (X, Y) /* { dg-message "in expansion of macro .SWAP." } */ + +void +fn (int x, int y) +{ + int tmp; + BODY_AND_IF (1, x, y); /* { dg-message "in expansion of macro .BODY_AND_IF." } */ +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-8.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-8.c new file mode 100644 index 00000000000..06522a7d737 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-8.c @@ -0,0 +1,64 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(x, y) \ + tmp = x; /* { dg-warning "macro expands to multiple statements" } */ \ + x = y; \ + y = tmp + +#define M1 \ + for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define M2 \ + for (i = 0; i < 1; ++i) \ + x++ + +#define M3 \ + for (i = 0; i < 1; ++i) \ + x++;; + +#define M4 \ + for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ \ +L1: \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define INC \ + x++;; + +int x, y, tmp; + +void +fn0 (void) +{ + int i; + for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + + for (i = 0; i < 1; ++i) /* { dg-message "not guarded by this 'for' clause" } */ +L: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + goto L; +} + +void +fn1 (void) +{ + int i; + M1; /* { dg-message "in expansion of macro .M1." } */ + M2; + M3; + M4; /* { dg-message "in expansion of macro .M4." } */ + goto L1; +} + +void +fn2 (void) +{ + for (int i = 0; i < 1; ++i) + INC + + for (int i = 0; i < 1; ++i) + ({ x = 10; x++; }); +} diff --git a/gcc/testsuite/c-c++-common/Wmultistatement-macros-9.c b/gcc/testsuite/c-c++-common/Wmultistatement-macros-9.c new file mode 100644 index 00000000000..350c4f9ffd0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wmultistatement-macros-9.c @@ -0,0 +1,62 @@ +/* PR c/80116 */ +/* { dg-options "-Wmultistatement-macros" } */ +/* { dg-do compile } */ + +#define SWAP(x, y) \ + tmp = x; /* { dg-warning "macro expands to multiple statements" } */ \ + x = y; \ + y = tmp + +#define M1 \ + while (x) /* { dg-message "not guarded by this 'while' claus" } */ \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define M2 \ + while (x) \ + x++ + +#define M3 \ + while (x) \ + x++;; + +#define M4 \ + while (x) /* { dg-message "not guarded by this 'while' claus" } */ \ +L1: \ + SWAP (x, y) /* { dg-message "in expansion of macro .SWAP." } */ + +#define INC \ + x++;; + +int x, y, tmp; + +void +fn0 (void) +{ + while (x) /* { dg-message "not guarded by this 'while' claus" } */ + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + + while (x) /* { dg-message "not guarded by this 'while' claus" } */ +L: + SWAP (x, y); /* { dg-message "in expansion of macro .SWAP." } */ + goto L; +} + +void +fn1 (void) +{ + M1; /* { dg-message "in expansion of macro .M1." } */ + M2; + M3; + M4; /* { dg-message "in expansion of macro .M4." } */ + goto L1; +} + +void +fn2 (void) +{ + while (x) + INC + + while (x) + ({ x = 10; x++; }); +} diff --git a/gcc/testsuite/c-c++-common/Wsign-compare-1.c b/gcc/testsuite/c-c++-common/Wsign-compare-1.c new file mode 100644 index 00000000000..b9b17a99280 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Wsign-compare-1.c @@ -0,0 +1,33 @@ +/* PR c/81417 */ +/* { dg-do compile } */ +/* { dg-options "-Wsign-compare" } */ + +int +fn1 (signed int a, unsigned int b) +{ + return a < b; /* { dg-warning "comparison of integer expressions of different signedness: 'int' and 'unsigned int'" } */ +} + +int +fn2 (signed int a, unsigned int b) +{ + return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'int'" } */ +} + +int +fn3 (signed long int a, unsigned long int b) +{ + return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'long unsigned int' and 'long int'" } */ +} + +int +fn4 (signed short int a, unsigned int b) +{ + return b < a; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'short int'" } */ +} + +int +fn5 (unsigned int a, signed int b) +{ + return a < b; /* { dg-warning "comparison of integer expressions of different signedness: 'unsigned int' and 'int'" } */ +} diff --git a/gcc/testsuite/c-c++-common/asan/alloca_big_alignment.c b/gcc/testsuite/c-c++-common/asan/alloca_big_alignment.c new file mode 100644 index 00000000000..54f03b8e301 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_big_alignment.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <assert.h> + +volatile int ten = 10; + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(128))); + assert(!((long) str & 127L)); + str[index] = '1'; // BOOM +} + +int main() { + foo(ten, ten); + return 0; +} + +/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*alloca_big_alignment.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ +/* { dg-output "\[^\n\r]*in foo.*alloca_big_alignment.c.*(\n|\r\n|\r)" */ diff --git a/gcc/testsuite/c-c++-common/asan/alloca_detect_custom_size.c b/gcc/testsuite/c-c++-common/asan/alloca_detect_custom_size.c new file mode 100644 index 00000000000..609dafe7bd8 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_detect_custom_size.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <assert.h> + +struct A { + char a[3]; + int b[3]; +}; + +volatile int ten = 10; + +__attribute__((noinline)) void foo(int index, int len) { + volatile struct A str[len] __attribute__((aligned(32))); + assert(!((long) str & 31L)); + str[index].a[0] = '1'; // BOOM +} + +int main(int argc, char **argv) { + foo(ten, ten); + return 0; +} + +/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*alloca_detect_custom_size.c:16|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ +/* { dg-output "\[^\n\r]*in foo.*alloca_detect_custom_size.c.*(\n|\r\n|\r)" */ diff --git a/gcc/testsuite/c-c++-common/asan/alloca_instruments_all_paddings.c b/gcc/testsuite/c-c++-common/asan/alloca_instruments_all_paddings.c new file mode 100644 index 00000000000..6b08c0bf614 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_instruments_all_paddings.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ + +#include "sanitizer/asan_interface.h" +#include <assert.h> + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(32))); + assert(!((long) str & 31L)); + char *q = (char *)__asan_region_is_poisoned((char *)str, 64); + assert(q && ((q - str) == index)); +} + +int main(int argc, char **argv) { + for (int i = 1; i < 33; ++i) + foo(i, i); + + for (int i = 1; i < 33; ++i) + foo(i, i); + + return 0; +} diff --git a/gcc/testsuite/c-c++-common/asan/alloca_loop_unpoisoning.c b/gcc/testsuite/c-c++-common/asan/alloca_loop_unpoisoning.c new file mode 100644 index 00000000000..0ddadb9c385 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_loop_unpoisoning.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ + +/* This testcase checks that allocas and VLAs inside loop are correctly unpoisoned. */ + +#include <assert.h> +#include <stdint.h> +#include <stdlib.h> +#include <stdio.h> +#include "sanitizer/asan_interface.h" + +void *top, *bot; +volatile int thirty_two = 32; + +__attribute__((noinline)) void foo(int len) { + char x; + top = &x; + volatile char array[len]; + assert(!((uintptr_t) array & 31L)); + alloca(len); + for (int i = 0; i < thirty_two; ++i) { + char array[i]; + bot = array; + /* Just to prevent optimization. */ + printf("%p\n", bot); + assert(!((uintptr_t) bot & 31L)); + } +} + +int main(int argc, char **argv) { + foo(thirty_two); + void *q = __asan_region_is_poisoned(bot, (char *)top - (char *)bot); + assert(!q); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/asan/alloca_overflow_partial.c b/gcc/testsuite/c-c++-common/asan/alloca_overflow_partial.c new file mode 100644 index 00000000000..9f4d0780bff --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_overflow_partial.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <assert.h> + +volatile const int ten = 10; + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(32))); + assert(!((long) str & 31L)); + str[index] = '1'; // BOOM +} + +int main(int argc, char **argv) { + foo(ten, ten); + return 0; +} + +/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*alloca_overflow_partial.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ +/* { dg-output "\[^\n\r]*in foo.*alloca_overflow_partial.c.*(\n|\r\n|\r)" */ diff --git a/gcc/testsuite/c-c++-common/asan/alloca_overflow_right.c b/gcc/testsuite/c-c++-common/asan/alloca_overflow_right.c new file mode 100644 index 00000000000..085fdae350b --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_overflow_right.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <assert.h> + +volatile const int ten = 10; + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(32))); + assert(!((long) str & 31L)); + str[index] = '1'; // BOOM +} + +int main(int argc, char **argv) { + foo(33, ten); + return 0; +} + +/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*alloca_overflow_right.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ +/* { dg-output "\[^\n\r]*in foo.*alloca_overflow_right.c.*(\n|\r\n|\r)" */ diff --git a/gcc/testsuite/c-c++-common/asan/alloca_safe_access.c b/gcc/testsuite/c-c++-common/asan/alloca_safe_access.c new file mode 100644 index 00000000000..92da1b2ed46 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_safe_access.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +#include <assert.h> + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(32))); + assert(!((long)str & 31L)); + str[index] = '1'; +} + +int main(int argc, char **argv) { + foo(4, 5); + foo(39, 40); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/asan/alloca_underflow_left.c b/gcc/testsuite/c-c++-common/asan/alloca_underflow_left.c new file mode 100644 index 00000000000..fe2abe11461 --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/alloca_underflow_left.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <assert.h> + +volatile const int ten = 10; + +__attribute__((noinline)) void foo(int index, int len) { + volatile char str[len] __attribute__((aligned(32))); + assert(!((long) str & 31L)); + str[index] = '1'; // BOOM +} + +int main(int argc, char **argv) { + foo(-1, ten); + return 0; +} + +/* { dg-output "WRITE of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ +(in _*foo(\[^\n\r]*alloca_underflow_left.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is located in stack of thread T0.*(\n|\r\n|\r)" */ +/* { dg-output "\[^\n\r]*in foo.*alloca_underflow_left.c.*(\n|\r\n|\r)" */ diff --git a/gcc/testsuite/c-c++-common/asan/kasan-alloca-1.c b/gcc/testsuite/c-c++-common/asan/kasan-alloca-1.c new file mode 100644 index 00000000000..518d19050ed --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/kasan-alloca-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address -fdump-tree-sanopt" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +void foo(int index, int len) { + char str[len]; + str[index] = '1'; // BOOM +} + +/* { dg-final { scan-tree-dump-not "__builtin___asan_alloca_poison" "sanopt" } } */ +/* { dg-final { scan-tree-dump-not "__builtin___asan_allocas_unpoison" "sanopt" } } */ diff --git a/gcc/testsuite/c-c++-common/asan/kasan-alloca-2.c b/gcc/testsuite/c-c++-common/asan/kasan-alloca-2.c new file mode 100644 index 00000000000..e3999d93f6f --- /dev/null +++ b/gcc/testsuite/c-c++-common/asan/kasan-alloca-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrument-allocas=1 --param asan-stack=1 -fdump-tree-sanopt" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +void foo(int index, int len) { + char str[len]; + str[index] = '1'; // BOOM +} + +/* { dg-final { scan-tree-dump-times "__builtin___asan_alloca_poison" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_allocas_unpoison" 1 "sanopt" } } */ diff --git a/gcc/testsuite/c-c++-common/dump-ada-spec-7.c b/gcc/testsuite/c-c++-common/dump-ada-spec-7.c new file mode 100644 index 00000000000..515d2597662 --- /dev/null +++ b/gcc/testsuite/c-c++-common/dump-ada-spec-7.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */
+/* { dg-options "-fdump-ada-spec" } */
+
+enum E1 {
+ A1 = -1L,
+ A2 = 0,
+ A3 = 1
+};
+
+static enum {B1 = -1L, B2, B3} Obj1;
+
+static struct { int i; } Obj2;
+
+/* { dg-final { scan-ada-spec-not "unsigned" } } */
+/* { dg-final { cleanup-ada-spec } } */
diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c new file mode 100644 index 00000000000..8514b10e820 --- /dev/null +++ b/gcc/testsuite/c-c++-common/patchable_function_entry-decl.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */ +/* { dg-final { scan-assembler-times "nop" 2 } } */ + +extern int a; + +/* Respect overriding attributes in the declaration. */ +int f3 (void) __attribute__((patchable_function_entry(2))); + +/* F3 should now get 2 NOPs. */ +int +__attribute__((noinline)) +f3 (void) +{ + return 5*a; +} diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-default.c b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c new file mode 100644 index 00000000000..0dcf1181dde --- /dev/null +++ b/gcc/testsuite/c-c++-common/patchable_function_entry-default.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */ +/* { dg-final { scan-assembler-times "nop" 3 } } */ + +extern int a; + +/* Nothing declared must not mean anything. */ +int f3 (void); + +/* F3 should get a default-sized NOP area. */ +int +__attribute__((noinline)) +f3 (void) +{ + return 5*a; +} diff --git a/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c new file mode 100644 index 00000000000..a007867dcb0 --- /dev/null +++ b/gcc/testsuite/c-c++-common/patchable_function_entry-definition.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fpatchable-function-entry=3,1" } */ +/* { dg-final { scan-assembler-times "nop" 1 } } */ + +extern int a; + +int f3 (void); + +/* F3 should now get 1 NOP. */ +int +__attribute__((noinline)) +__attribute__((patchable_function_entry(1))) +f3 (void) +{ + return 5*a; +} diff --git a/gcc/testsuite/c-c++-common/pr70264.c b/gcc/testsuite/c-c++-common/pr70264.c index 815aad175e5..c446942d0b8 100644 --- a/gcc/testsuite/c-c++-common/pr70264.c +++ b/gcc/testsuite/c-c++-common/pr70264.c @@ -5,7 +5,7 @@ X /* { dg-begin-multiline-output "" } #define X __LINE__ - ^ + ^~~~~~~~ { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } X diff --git a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c index cd6941c9d30..aae88aa3180 100644 --- a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-1.c @@ -1,6 +1,7 @@ /* { dg-do run { target { lp64 || ilp32 } } } */ /* { dg-options "-fsanitize=float-cast-overflow" } */ -/* { dg-additional-options "-msse2 -mfpmath=sse" { target { sse2_runtime && ia32 } } } */ +/* { dg-additional-options "-ffloat-store" { target { ia32 } } } */ +/* { dg-additional-options "-mieee" { target { { alpha*-*-* } || { sh*-*-* } } } } */ #include <limits.h> #include "float-cast.h" diff --git a/gcc/testsuite/c-c++-common/ubsan/pr81604.c b/gcc/testsuite/c-c++-common/ubsan/pr81604.c new file mode 100644 index 00000000000..a06de76b023 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/pr81604.c @@ -0,0 +1,31 @@ +/* PR sanitizer/81604 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=bounds,signed-integer-overflow" } */ + +long a[10]; + +__attribute__((noinline, noclone)) long * +foo (int i) +{ + return &a[i]; +} + +__attribute__((noinline, noclone)) long +bar (long x, long y) +{ + return x * y; +} + +int +main () +{ + volatile int i = -1; + volatile long l = __LONG_MAX__; + long *volatile p; + p = foo (i); + l = bar (l, l); + return 0; +} + +/* { dg-output "index -1 out of bounds for type 'long int \\\[10\\\]'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*signed integer overflow: \[0-9]+ \\* \[0-9]+ cannot be represented in type 'long int'" } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c new file mode 100644 index 00000000000..8edfbce0327 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-1.c @@ -0,0 +1,65 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fno-sanitize-recover=pointer-overflow -Wall" } */ + +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) char *f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char *f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char *f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char *f4 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char *f5 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char *f6 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) int *f7 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f8 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f9 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f10 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +struct S *volatile q; +char a[64]; +struct S s; +int *volatile r; + +int +main () +{ + struct S t; + p = &a[32]; + p = f1 (p); + p = f1 (p); + p = f2 (p); + p = f3 (p, 1); + p = f3 (p, -1); + p = f3 (p, 3); + p = f3 (p, -6); + p = f4 (p, 1); + p = f4 (p, -1); + p = f4 (p, 3); + p = f4 (p, -6); + p = f5 (p, 1); + p = f5 (p, 3); + p = f6 (p, 1); + p = f6 (p, 3); + if (sizeof (unsigned long) >= sizeof (char *)) + { + p = f5 (p, -1); + p = f5 (p, -6); + p = f6 (p, -1); + p = f6 (p, -6); + } + q = &s; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + q = &t; + r = f7 (q); + r = f8 (q); + r = f9 (q); + r = f10 (q, 0); + r = f10 (q, 10); + r = f10 (q, 64); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c new file mode 100644 index 00000000000..a1110a2ddbc --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/ptr-overflow-2.c @@ -0,0 +1,113 @@ +/* PR sanitizer/80998 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=pointer-overflow -fsanitize-recover=pointer-overflow -fno-ipa-icf -Wall" } */ + +__attribute__((noinline, noclone)) char * f1 (char *p) { return p + 1; } +__attribute__((noinline, noclone)) char * f2 (char *p) { return p - 1; } +__attribute__((noinline, noclone)) char * f3 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f4 (char *p, int i) { return p + i; } +__attribute__((noinline, noclone)) char * f5 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f6 (char *p, int i) { return p - i; } +__attribute__((noinline, noclone)) char * f7 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f8 (char *p, unsigned long int i) { return p + i; } +__attribute__((noinline, noclone)) char * f9 (char *p, unsigned long int i) { return p - i; } +__attribute__((noinline, noclone)) char * f10 (char *p, unsigned long int i) { return p - i; } +struct S { int a; int b; int c[64]; }; +__attribute__((noinline, noclone)) int *f11 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f12 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f13 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f14 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f15 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f16 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f17 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f18 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f19 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f20 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f21 (struct S *p) { return &p->a; } +__attribute__((noinline, noclone)) int *f22 (struct S *p) { return &p->b; } +__attribute__((noinline, noclone)) int *f23 (struct S *p) { return &p->c[64]; } +__attribute__((noinline, noclone)) int *f24 (struct S *p, int i) { return &p->c[i]; } +__attribute__((noinline, noclone)) int *f25 (struct S *p, int i) { return &p->c[i]; } + +char *volatile p; +__UINTPTR_TYPE__ volatile u; +struct S *volatile q; +int *volatile r; + +int +main () +{ + u = ~(__UINTPTR_TYPE__) 0; + p = (char *) u; + p = f1 (p); + u = 0; + p = (char *) u; + p = f2 (p); + u = -(__UINTPTR_TYPE__) 7; + p = (char *) u; + p = f3 (p, 7); + u = 3; + p = (char *) u; + p = f4 (p, -4); + u = 23; + p = (char *) u; + p = f5 (p, 27); + u = -(__UINTPTR_TYPE__) 15; + p = (char *) u; + p = f6 (p, -15); + u = -(__UINTPTR_TYPE__) 29; + p = (char *) u; + p = f7 (p, 31); + u = 23; + p = (char *) u; + p = f9 (p, 24); + if (sizeof (unsigned long) < sizeof (char *)) + return 0; + u = 7; + p = (char *) u; + p = f8 (p, -8); + u = -(__UINTPTR_TYPE__) 25; + p = (char *) u; + p = f10 (p, -25); + u = ~(__UINTPTR_TYPE__) 0; + q = (struct S *) u; + r = f11 (q); + r = f12 (q); + r = f13 (q); + r = f14 (q, 0); + r = f15 (q, 63); + u = ~(__UINTPTR_TYPE__) 0 - (17 * sizeof (int)); + q = (struct S *) u; + r = f16 (q); + r = f17 (q); + r = f18 (q); + r = f19 (q, 0); + r = f20 (q, 63); + u = 3 * sizeof (int); + q = (struct S *) u; + r = f21 (q); + r = f22 (q); + r = f23 (q); + r = f24 (q, -2); + r = f25 (q, -6); + return 0; +} + +/* { dg-output ":5:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:6:6\[79]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+ overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:7:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+9 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:8:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+3 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:9:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+\[cC](\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:10:7\[46]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+1 overflowed to (0\[xX])?0\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:11:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]3 overflowed to (0\[xX])?0\+2(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:13:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+17 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:12:\[89]\[80]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+7 overflowed to (0\[xX])?\[fF]\+(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:14:\[89]\[91]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[eE]7 overflowed to (0\[xX])?0\+" } */ +/* { dg-output "(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:17:\[67]\[82]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:18:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+107(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:19:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+7(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:20:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+ overflowed to (0\[xX])?0\+103(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:23:\[67]\[86]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[cC]3(\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:25:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?\[fF]\+\[bB]\[bB] overflowed to (0\[xX])?0\+\[bB]\[fF](\n|\r\n|\r)" { target int32 } } */ +/* { dg-output "\[^\n\r]*:30:\[78]\[52]\[^\n\r]*runtime error: pointer index expression with base (0\[xX])?0\+\[cC] overflowed to (0\[xX])?\[fF]\+\[cC]" { target int32 } } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-all-1.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-all-1.c index 9ffba50443a..96a8cc576b6 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-all-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-all-1.c @@ -5,4 +5,4 @@ int i; -/* { dg-error "-fsanitize=all option is not valid" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize=all. option is not valid" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-1.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-1.c index 4d8c27e945a..efa5ad7291f 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-1.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-1.c @@ -3,4 +3,4 @@ int i; -/* { dg-error "-fsanitize-recover=unreachable is not supported" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize-recover=unreachable. is not supported" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-2.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-2.c index e9849bd50ab..2b7cbcb6a7f 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-2.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-2.c @@ -3,4 +3,4 @@ int i; -/* { dg-error "-fsanitize-recover=return is not supported" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize-recover=return. is not supported" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-5.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-5.c index 9c1ed322d5e..3d2e51ebb91 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-5.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-5.c @@ -3,4 +3,4 @@ int i; -/* { dg-error "-fsanitize-recover=unreachable is not supported" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize-recover=unreachable. is not supported" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-7.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-7.c index 2e6599fe312..a571f2bcdc1 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-7.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-7.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-fsanitize=address -fsanitize=thread" } */ +/* { dg-options "-fsanitize=address -fsanitize=thread -w" } */ int i; -/* { dg-error "-fsanitize=address and -fsanitize=kernel-address are incompatible with -fsanitize=thread" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize=address. and .-fsanitize=kernel-address. are incompatible with .-fsanitize=thread." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-8.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-8.c index ecaf0e648af..97f4bf4c465 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-8.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-8.c @@ -3,4 +3,4 @@ int i; -/* { dg-error "-fsanitize=leak is incompatible with -fsanitize=thread" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize=leak. is incompatible with .-fsanitize=thread." "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-9.c b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-9.c index ef80ef1e27d..0800ecbe155 100644 --- a/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-9.c +++ b/gcc/testsuite/c-c++-common/ubsan/sanitize-recover-9.c @@ -3,4 +3,4 @@ int i; -/* { dg-error "-fsanitize-recover=unreachable is not supported" "" { target *-*-* } 0 } */ +/* { dg-error ".-fsanitize-recover=unreachable. is not supported" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/g++.dg/Wclass-memaccess-2.C b/gcc/testsuite/g++.dg/Wclass-memaccess-2.C new file mode 100644 index 00000000000..49581df1204 --- /dev/null +++ b/gcc/testsuite/g++.dg/Wclass-memaccess-2.C @@ -0,0 +1,61 @@ +// PR c++/81169 - -Wclass-memaccess illegitimate warning related to volatile +// { dg-do compile } +// { dg-options "-Wclass-memaccess" } + +struct S { int x; }; + +void cast_const (const S *p) +{ + __builtin_memset (const_cast<S*>(p), 0, sizeof *p); +} + +void cast_volatile (volatile S *p) +{ + __builtin_memset (const_cast<S*>(p), 0, sizeof *p); +} + +void cast_const_volatile (const volatile S *p) +{ + __builtin_memset (const_cast<S*>(p), 0, sizeof *p); +} + +void c_cast_const_volatile (const volatile S *p) +{ + __builtin_memset ((S*)p, 0, sizeof *p); +} + +// A C cast to void* suppresses the warning because it casts away +// the qualifiers from the otherwise trivial pointed-to type.. +void c_void_cast_const_volatile (const volatile S *p) +{ + __builtin_memset ((void*)p, 0, sizeof *p); +} + +// Also verify that casting to char* suppresses the warning for +// non-trivial types. + +struct NonTrivial +{ + NonTrivial (); + NonTrivial (const NonTrivial&); + NonTrivial& operator= (const NonTrivial&); + ~NonTrivial (); +}; + +void cast_void (NonTrivial *p) +{ + __builtin_memset (reinterpret_cast<char*>(p), 0, sizeof *p); +} + +// A C cast to a character (or any trivial) type suppresses the warning. +void c_cast_uchar (NonTrivial *p) +{ + __builtin_memset ((unsigned char*)p, 0, sizeof *p); +} + +// A cast to void* does not suppress the warning. That is (or can be) +// considered a feature. +void c_cast_void (NonTrivial *p) +{ + __builtin_memset ((void*)p, 0, sizeof *p); // { dg-warning "\\\[-Wclass-memaccess]" } +} diff --git a/gcc/testsuite/g++.dg/asan/function-argument-1.C b/gcc/testsuite/g++.dg/asan/function-argument-1.C new file mode 100644 index 00000000000..bdbb37a44a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/function-argument-1.C @@ -0,0 +1,31 @@ +// { dg-do run } +// { dg-shouldfail "asan" } +// { dg-options "-fsanitize=address -fno-sanitize-address-use-after-scope" } + +struct A +{ + int a[5]; +}; + +static __attribute__ ((noinline)) int +goo (A *a) +{ + int *ptr = &a->a[0]; + return *(volatile int *) (ptr - 1); +} + +__attribute__ ((noinline)) int +foo (A arg) +{ + return goo (&arg); +} + +int +main () +{ + return foo (A ()); +} + +// { dg-output "ERROR: AddressSanitizer: stack-buffer-underflow on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size . at.*" } +// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* underflows this variable.*" } diff --git a/gcc/testsuite/g++.dg/asan/function-argument-2.C b/gcc/testsuite/g++.dg/asan/function-argument-2.C new file mode 100644 index 00000000000..3a7c33bdaaa --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/function-argument-2.C @@ -0,0 +1,24 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +static __attribute__ ((noinline)) int +goo (int *a) +{ + return *(volatile int *)a; +} + +__attribute__ ((noinline)) int +foo (char arg) +{ + return goo ((int *)&arg); +} + +int +main () +{ + return foo (12); +} + +// { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size . at.*" } +// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* partially overflows this variable.*" } diff --git a/gcc/testsuite/g++.dg/asan/function-argument-3.C b/gcc/testsuite/g++.dg/asan/function-argument-3.C new file mode 100644 index 00000000000..6994b6df1c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/function-argument-3.C @@ -0,0 +1,28 @@ +// { dg-do run } +// { dg-shouldfail "asan" } +// { dg-additional-options "-Wno-psabi" } + +typedef int v4si __attribute__ ((vector_size (16))); + +static __attribute__ ((noinline)) int +goo (v4si *a) +{ + return (*(volatile v4si *) (a + 1))[2]; +} + +__attribute__ ((noinline)) int +foo (v4si arg) +{ + return goo (&arg); +} + +int +main () +{ + v4si v = {1,2,3,4}; + return foo (v); +} + +// { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size . at.*" } +// { dg-output ".*'arg' <== Memory access at offset \[0-9\]* overflows this variable.*" } diff --git a/gcc/testsuite/g++.dg/asan/pr81021.C b/gcc/testsuite/g++.dg/asan/pr81021.C new file mode 100644 index 00000000000..daa0525c273 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr81021.C @@ -0,0 +1,33 @@ +// { dg-do run } + +#include <string> + +struct ConfigFile { + ConfigFile(std::string filename, std::string delimiter) { throw "error"; } + ConfigFile(std::string filename) {} +}; + +struct Configuration { + ConfigFile _configFile; + + Configuration(const std::string &root, const char *baseName) + : _configFile(root + baseName, "=") { } + Configuration(const std::string &root, const char *a, const char *b) + : _configFile(root + a + b) { } +}; + + +void test() { + std::string root("etc"); + try { + Configuration config(root, "notthere"); + } + catch (...) { + // exception is thrown, caught here and ignored... + } + Configuration config(root, "a", "b"); // ASAN error during constructor here +} + +int main(int argc, const char *argv[]) { + test(); +} diff --git a/gcc/testsuite/g++.dg/asan/pr81340.C b/gcc/testsuite/g++.dg/asan/pr81340.C new file mode 100644 index 00000000000..76ac08a9a56 --- /dev/null +++ b/gcc/testsuite/g++.dg/asan/pr81340.C @@ -0,0 +1,22 @@ +// { dg-options "-fsanitize=address -O2 -g -Wno-write-strings" } + +class a { + struct b { + b(int, int); + } c; + +public: + int d; + a(char *) : c(0, d) {} +}; +class e { + int f(const int &, const int &, const int &, bool, bool, bool, int, bool); +}; +class g { +public: + static g *h(); + void i(a, void *); +}; +int e::f(const int &, const int &, const int &, bool j, bool, bool, int, bool) { + g::h()->i("", &j); +} diff --git a/gcc/testsuite/g++.dg/concepts/memfun-err.C b/gcc/testsuite/g++.dg/concepts/memfun-err.C index e44273ca8c8..f44610a6aa0 100644 --- a/gcc/testsuite/g++.dg/concepts/memfun-err.C +++ b/gcc/testsuite/g++.dg/concepts/memfun-err.C @@ -15,16 +15,16 @@ int called = 0; // Test constrained member definitions template<typename T> - struct S1 { + struct S1 { // { dg-message "defined here" } void f1() requires C<T>() { } void g1() requires C<T>() and true; template<C U> void h1(U u) { called = 1; } - void g2() requires C<T>(); // { dg-error "candidate" } + void g2() requires C<T>(); // { dg-message "candidate" } }; template<typename T> - void S1<T>::g2() requires D<T>() { } // { dg-error "prototype" } + void S1<T>::g2() requires D<T>() { } // { dg-error "no declaration matches" } int main() { S1<X> sx; diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C new file mode 100644 index 00000000000..6bf9b7b1666 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C @@ -0,0 +1,16 @@ +// PR c++/72764 +// { dg-do compile { target c++11 } } + +template < typename > struct A; +template < typename > struct B {}; + +template < typename T > +using C = typename A < T >::template D < T >; + +template < typename T > struct A +{ + // should be: template < typename > struct D : B < C < T > > {}; + struct D : B < C < T > > {}; // { dg-error "not a class template" } +}; + +A < int >::D a; // { dg-message "required" } diff --git a/gcc/testsuite/g++.dg/cpp0x/auto1.C b/gcc/testsuite/g++.dg/cpp0x/auto1.C index b8d39051821..dd8f5fc8cf9 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto1.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto1.C @@ -1,9 +1,14 @@ // { dg-do compile { target c++11 } } -// { dg-options "-std=c++98 -Wc++11-compat" } +// { dg-options "-std=c++98 -Wc++11-compat -fdiagnostics-show-caret" } // Test warning for use of auto in C++98 mode with C++11 // compatibility warnings void f() { - auto int x = 5; // { dg-warning "changes meaning" } + auto int x = 5; /* { dg-warning "changes meaning" } + { dg-begin-multiline-output "" } + auto int x = 5; + ^~~~ + ---- + { dg-end-multiline-output "" } */ } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C new file mode 100644 index 00000000000..d504954bc63 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C @@ -0,0 +1,13 @@ +// PR c++/81188 +// { dg-do compile { target c++11 } } + +template <class F> +struct C { + F fast(long i) const; + auto operator[](long i) const -> decltype(this->fast(i)); +}; + +template <class F> +auto C<F>::operator[](long i) const -> decltype(this->fast(i)) { + return fast(i); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype9.C b/gcc/testsuite/g++.dg/cpp0x/decltype9.C index 9db3db039a2..45cd9ed7da3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/decltype9.C +++ b/gcc/testsuite/g++.dg/cpp0x/decltype9.C @@ -1,9 +1,9 @@ // PR c++/34271 // { dg-do compile { target c++11 } } -template<int> struct A -{ +template<int> struct A { // { dg-message "defined here" } static int i; }; -template<int N> int A<N>::i(decltype (A::i)); // { dg-error "member function|must be an expression" } +template<int N> int A<N>::i(decltype (A::i)); // { dg-error "no declaration" } +// { dg-message "no functions" "note" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C index 4f1475acfde..acf16c6c8bd 100644 --- a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C @@ -4,7 +4,7 @@ template<typename T> struct S1 { enum E1 : int; - enum class E2 : int; + enum class E2 : T; }; template<typename T> enum S1<T>::E1 : int { e1 }; diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C new file mode 100644 index 00000000000..90a06c610f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C @@ -0,0 +1,7 @@ +// PR c++/81164 +// { dg-do compile { target c++11 } } + +struct A {}; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : B,C { using A::A; }; // { dg-error "indirect" } diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C new file mode 100644 index 00000000000..8e31f739d74 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C @@ -0,0 +1,23 @@ +// PR c++/67054 +// { dg-do compile { target c++11 } } + +struct A +{ + A(int) {} +}; + +struct C +{ + C(int) {} +}; + +struct B : A +{ + using A::A; + C c = 42; +}; + +int main() +{ + B b = 24; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C index 8cbeed66047..c5a00750236 100644 --- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C @@ -8,7 +8,7 @@ struct B2 { B2(int); }; struct D1 : B1, B2 { - using B1::B1; // { dg-error "inherited" } + using B1::B1; // { dg-message "declared" } using B2::B2; // { dg-error "inherited" } }; // ill-formed: attempts to declare D1(int) twice struct D2 : B1, B2 { diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C new file mode 100644 index 00000000000..57111fdef6a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C @@ -0,0 +1,12 @@ +// PR c++/71570 +// { dg-do compile { target c++11 } } + +void foo (int); + +void foo (void) +{ + [&foo] // { dg-error "cannot capture" } + { + foo (0); + }; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C new file mode 100644 index 00000000000..8e803c82f24 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C @@ -0,0 +1,28 @@ +/* This is padding (to avoid the generated patch containing DejaGnu + directives). */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +// { dg-do compile { target c++11 } } + +void test (int i) +{ + auto a = { &i }; // { dg-error "deducing from brace-enclosed initializer list requires #include <initializer_list>" } +} + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing this + source filename, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ +/* Use #if 0/#endif rather than comments, to allow the text to contain + a comment. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -1,3 +1,4 @@ ++#include <initializer_list> + /* This is padding (to avoid the generated patch containing DejaGnu + directives). */ +{ dg-end-multiline-output "" } +#endif diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept30.C b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C new file mode 100644 index 00000000000..c51e94e7573 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C @@ -0,0 +1,12 @@ +// PR c++/69300 +// { dg-do compile { target c++11 } } + +template<typename A> +struct F { + template<typename B> + void f() noexcept(&F::template f<B>) {} // { dg-error "exception specification" } +}; + +int main () { + F<void>().f<int>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing14.C b/gcc/testsuite/g++.dg/cpp0x/trailing14.C new file mode 100644 index 00000000000..2544d0bab5e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/trailing14.C @@ -0,0 +1,15 @@ +// PR c++/65775 +// { dg-do compile { target c++11 } } +// { dg-options "-Wignored-qualifiers" } + +using Qi = int const volatile; +Qi q1(); // { dg-warning "1: type qualifiers ignored" } +auto q2() -> Qi; // { dg-warning "1: type qualifiers ignored" } + +using Fi = int(); +Fi f1(); // { dg-error "1: 'f1' declared as function returning a function" } +auto f2() -> Fi; // { dg-error "1: 'f2' declared as function returning a function" } + +using Ai = int[5]; +Ai a1(); // { dg-error "1: 'a1' declared as function returning an array" } +auto a2() -> Ai; // { dg-error "1: 'a2' declared as function returning an array" } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C new file mode 100644 index 00000000000..4a02ab22990 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++11 } } + +template <class A0, class... As> struct tuple +{ + tuple<As...> tail; + template <int Offset, class... More> int apply(const More&... more) { + return tail.apply<1>(more...); // { dg-error "" } needs .template + } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C new file mode 100644 index 00000000000..6f8df3e1aaf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C @@ -0,0 +1,22 @@ +// PR c++/72801 +// { dg-do compile { target c++11 } } + +template < typename, typename > struct A {}; + +template < typename ... T > struct B +{ + template < typename > struct C + { + static const int a = 0; + }; + + template < typename R, typename ... S > + struct C < R (A < T, S > ...) > + { + static const int a = 1; + }; +}; + +#define SA(X) static_assert ((X), #X) +SA(B <>::C<int()>::a == 1); + diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C new file mode 100644 index 00000000000..0dbe904601d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C @@ -0,0 +1,16 @@ +// PR c++/81215 +// { dg-do compile { target c++11 } } + +template<typename U> struct X { }; +template<typename T, typename U = void> struct set { }; + +template <typename V, template <typename...> class C> +void bar (const X<C<V>>&) +{ +} + +void +foo (X<set<int>>& x) +{ + bar (x); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C new file mode 100644 index 00000000000..f3e576ae988 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C @@ -0,0 +1,27 @@ +// PR c++/69111 +// { dg-do compile { target c++11 } } + +template <template <typename> class ...> +struct template_list {}; + +template <typename T> +struct A +{}; + +template <typename> +struct B +{ + template <typename T> + using type = A<T>; +}; + +template <typename ... Types> +struct C +{ + using type = template_list<B<Types>::template type...>; +}; + +int main() +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C b/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C new file mode 100644 index 00000000000..680ba633611 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/builtin_FUNCTION.C @@ -0,0 +1,42 @@ +// { dg-do run } + +#include <string.h> + +const char *ct, *dt, *cv; + +struct KLASS +{ + KLASS () ; + ~KLASS (); + operator int (); +}; + +KLASS::KLASS() +{ + ct = __builtin_FUNCTION (); +} + +KLASS::~KLASS () +{ + dt = __builtin_FUNCTION (); +} + +KLASS::operator int () +{ + cv = __builtin_FUNCTION (); + return 0; +} + +int main () +{ + int q = int (KLASS ()); + + if (strcmp (ct, "KLASS")) + return 1; + if (strcmp (dt, "~KLASS")) + return 2; + if (strcmp (cv, "operator int")) + return 3; + + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C new file mode 100644 index 00000000000..eeffa69adf5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction40.C @@ -0,0 +1,19 @@ +// PR c++/81180 +// { dg-options -std=c++1z } + +template < int I > struct int_{}; + +template < typename T > +struct A{ + template < typename U, int I > + struct B{ + B(U u, int_< I >){} + }; +}; + + +int main(){ + A< int >::B v(0, int_< 0 >()); + (void)v; +} + diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C new file mode 100644 index 00000000000..5e7fa3a2c51 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction41.C @@ -0,0 +1,19 @@ +// { dg-options -std=c++1z } + +#include <initializer_list> + +struct B { }; + +template <class T> +struct A +{ + A(std::initializer_list<T>); + A(T, B); +}; + +A a { 1, B() }; + +template <class,class> struct same; +template <class T> struct same<T,T> { }; + +same<decltype(a), A<int>> s; diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C new file mode 100644 index 00000000000..8217fd4d79a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction42.C @@ -0,0 +1,19 @@ +// { dg-options -std=c++1z } + +#include <initializer_list> + +template <class,class> struct same; +template <class T> struct same<T,T> { }; + +template <class T> +struct A +{ + A(const A&); + A(std::initializer_list<T>); +}; + +A a { 1 }; +A b { a }; + +same<decltype (a), decltype (b)> s; + diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp1.C b/gcc/testsuite/g++.dg/cpp1z/decomp1.C index 98f60905e1a..33068917863 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp1.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp1.C @@ -7,10 +7,10 @@ struct S { int a; signed char b; float c; } s = { 6, 7, 8.0f }; int main () { - auto & [ c, d ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ e, f ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ g, h, i ] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ j, k, l ] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto & [ c, d ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ e, f ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ g, h, i ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ j, k, l ] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } } c++; d++; e += 6; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp13.C b/gcc/testsuite/g++.dg/cpp1z/decomp13.C index 9ebddc6e608..a9bf264a2ca 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp13.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp13.C @@ -11,27 +11,27 @@ namespace std { template<> struct std::tuple_size<B> { static constexpr int value = 2; }; template<int I> struct std::tuple_element<I,B> { typedef int type; }; -auto [ aa, bb, cc, dd ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } +auto [ aa, bb, cc, dd ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZDC2aa2bb2cc2ddE" } } -const auto & [ e, f, g, h ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } +const auto & [ e, f, g, h ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZDC1e1f1g1hE" } } -auto [ ee, ff ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } +auto [ ee, ff ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZDC2ee2ffE" } } -auto & [ gg, hh ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } +auto & [ gg, hh ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZDC2gg2hhE" } } namespace N { namespace M { - auto [ i, j, k, l ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ i, j, k, l ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZN1N1MDC1i1j1k1lEE" } } - auto & [ m, n, o, ppp ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto & [ m, n, o, ppp ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZN1N1MDC1m1n1o3pppEE" } } - auto [ ii, jj ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ ii, jj ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZN1N1MDC2ii2jjEE" } } // { dg-final { scan-assembler "_ZN1N1M2iiE" } } // { dg-final { scan-assembler "_ZN1N1M2jjE" } } - auto & [ mm, nn ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto & [ mm, nn ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZN1N1MDC2mm2nnEE" } } // { dg-final { scan-assembler "_ZN1N1M2mmE" } } // { dg-final { scan-assembler "_ZN1N1M2nnE" } } @@ -39,14 +39,14 @@ namespace N } namespace std { - auto [ i2, j2, k2, l2 ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ i2, j2, k2, l2 ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZStDC2i22j22k22l2E" } } - auto [ vv, ww ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ vv, ww ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } // { dg-final { scan-assembler "_ZStDC2vv2wwE" } } // { dg-final { scan-assembler "_ZSt2vv" } } // { dg-final { scan-assembler "_ZSt2ww" } } } namespace { - auto [ v, w, x, y ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ v, w, x, y ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp14.C b/gcc/testsuite/g++.dg/cpp1z/decomp14.C index 5d6d05fb8a4..d05a8903232 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp14.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp14.C @@ -18,13 +18,13 @@ struct M : virtual J, L {}; void foo (C &c, F &f, G &g, H &h, I &i, K &k, M &m) { - auto [ ci ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [ ci ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } } auto [ fi ] = f; // { dg-error "cannot decompose class type 'F': both it and its base class 'A' have non-static data members" } - // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } auto [ gi ] = g; // { dg-error "cannot decompose class type 'G': its base classes 'A' and 'E' have non-static data members" } - // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } - auto [ hi ] = h; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } + auto [ hi ] = h; // { dg-warning "structured bindings only available with" "" { target c++14_down } } auto [ ki ] = k; // { dg-error "'B' is an ambiguous base of 'K'" } - // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } - auto [ mi ] = m; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } + auto [ mi ] = m; // { dg-warning "structured bindings only available with" "" { target c++14_down } } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp18.C b/gcc/testsuite/g++.dg/cpp1z/decomp18.C index d5c68a26891..7799e462cdd 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp18.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp18.C @@ -7,6 +7,6 @@ void foo () { int z = 0; - for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto & [ b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } z += b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s; } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp19.C b/gcc/testsuite/g++.dg/cpp1z/decomp19.C index e392e658e27..e7d7abfce7c 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp19.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp19.C @@ -8,6 +8,6 @@ main () int x = 99; struct S { int &x; }; S s{x}; - auto [p] = s; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [p] = s; // { dg-warning "structured bindings only available with" "" { target c++14_down } } return p - 99; } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp2.C b/gcc/testsuite/g++.dg/cpp1z/decomp2.C index 5831fc74940..6574028217f 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp2.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp2.C @@ -9,12 +9,12 @@ __complex__ int c = 7 + 8i; int main () { - auto & [ d, e, f, g ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ h, i, j, k ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ l, m ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ n, o ] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ p, q ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ r, s ] = c; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto & [ d, e, f, g ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ h, i, j, k ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ l, m ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ n, o ] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ p, q ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ r, s ] = c; // { dg-warning "structured bindings only available with" "" { target c++14_down } } d += 10; e += 11; f += 12; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp21.C b/gcc/testsuite/g++.dg/cpp1z/decomp21.C index d046ed54a14..7d3a465d3a3 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp21.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp21.C @@ -12,5 +12,6 @@ foo () auto [ n, o, p ] { a }; auto [ q, r, t ] ( s ); auto [ u, v, w ] ( s, ); // { dg-error "expected primary-expression before '.' token" } - auto [ x, y, z ] ( a ); // { dg-error "expression list treated as compound expression in initializer" "" { target *-*-* } .-1 } + // { dg-error "invalid initializer for structured binding declaration" "" { target *-*-* } .-1 } + auto [ x, y, z ] ( a ); } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp22.C b/gcc/testsuite/g++.dg/cpp1z/decomp22.C index 81d40c56931..9e6b8df486a 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp22.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp22.C @@ -16,6 +16,6 @@ int &&get (C<E...> &&); int foo (C<int> t) { - auto[x0] = t; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto[x0] = t; // { dg-warning "structured bindings only available with" "" { target c++14_down } } return x0; } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp23.C b/gcc/testsuite/g++.dg/cpp1z/decomp23.C index c682fa00264..9e9278050c9 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp23.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp23.C @@ -7,6 +7,6 @@ int foo (std::tuple<int> t) { - auto [x0] = t; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [x0] = t; // { dg-warning "structured bindings only available with" "" { target c++14_down } } return x0; } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp24.C b/gcc/testsuite/g++.dg/cpp1z/decomp24.C index 0e874fa6055..4bd519791ff 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp24.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp24.C @@ -7,5 +7,5 @@ foo () { int a {10}; auto [b] { [&a](){} }; // { dg-error "cannot decompose lambda closure type" } - return b - a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } + return b - a; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp25.C b/gcc/testsuite/g++.dg/cpp1z/decomp25.C index c99273613bc..d90e665add0 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp25.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp25.C @@ -7,9 +7,9 @@ struct S { enum E { A }; void f () { auto [x] = 0; x++; } // { dg-error "cannot decompose non-array non-class type" } - // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } void g (T t) { auto [y] = t; y++; } // { dg-error "cannot decompose non-array non-class type" } -}; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .-1 } +}; // { dg-warning "structured bindings only available with" "" { target c++14_down } .-1 } int main () diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp26.C b/gcc/testsuite/g++.dg/cpp1z/decomp26.C index f413920f545..035433385d7 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp26.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp26.C @@ -2,5 +2,5 @@ // { dg-do compile { target c++11 } } // { dg-options "" } -template<typename T> T &make(); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } .+1 } +template<typename T> T &make(); // { dg-warning "structured bindings only available with" "" { target c++14_down } .+1 } auto [d1, d2] = make<int>(); // { dg-error "cannot decompose non-array non-class type" } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp28.C b/gcc/testsuite/g++.dg/cpp1z/decomp28.C index 7561d9dfc02..8b0b5a54999 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp28.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp28.C @@ -15,14 +15,14 @@ template <int N> void foo (std::tuple<int> b) { - auto [c] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [c] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } } template <typename T> void bar (std::tuple<T> b) { - auto [c] = b; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [c] = b; // { dg-warning "structured bindings only available with" "" { target c++14_down } } } void @@ -35,5 +35,5 @@ baz (std::tuple<int> b) int main () { - [](auto) { [](std::tuple<int> b) { auto[c] = b; }; } (0); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + [](auto) { [](std::tuple<int> b) { auto[c] = b; }; } (0); // { dg-warning "structured bindings only available with" "" { target c++14_down } } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp3.C b/gcc/testsuite/g++.dg/cpp1z/decomp3.C index a739d3ace37..58ce71bf6ac 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp3.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp3.C @@ -9,36 +9,36 @@ B baz (); void test (A &b, B c) { - int && [ d ] = c; // { dg-error "decomposition declaration cannot be declared with type 'int'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - char & [ e, f, ff ] { b }; // { dg-error "decomposition declaration cannot be declared with type 'char'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - auto&[g,h,i]=b; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } - decltype (auto) [ j ] = c; // { dg-error "decomposition declaration cannot be declared with type 'decltype.auto.'" "" { target c++14 } } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + int && [ d ] = c; // { dg-error "structured binding declaration cannot have type 'int'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + char & [ e, f, ff ] { b }; // { dg-error "structured binding declaration cannot have type 'char'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + auto&[g,h,i]=b; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } + decltype (auto) [ j ] = c; // { dg-error "structured binding declaration cannot have type 'decltype.auto.'" "" { target c++14 } } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } // { dg-error "expected primary-expression before 'decltype'" "" { target c++11_down } .-2 } auto & & && & [ m, n, o ] = b; // { dg-error "multiple ref-qualifiers" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - constexpr auto [ p ] = c; // { dg-error "decomposition declaration cannot be declared 'constexpr'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + constexpr auto [ p ] = c; // { dg-error "structured binding declaration cannot be 'constexpr'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } friend auto [ q ] = c; // { dg-error "'friend' used outside of class" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - typedef auto [ r ] = c; // { dg-error "decomposition declaration cannot be declared 'typedef'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - inline auto [ s ] = c; // { dg-error "decomposition declaration cannot be declared 'inline'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + typedef auto [ r ] = c; // { dg-error "structured binding declaration cannot be 'typedef'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + inline auto [ s ] = c; // { dg-error "structured binding declaration cannot be 'inline'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } __restrict auto [ t ] = c; // { dg-error "invalid use of 'restrict'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - long long auto [ u ] = c; // { dg-error "'long long' invalid for 'decomposition'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + long long auto [ u ] = c; // { dg-error "'long long' invalid for 'structured binding'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } virtual auto [ v ] = c; // { dg-error "'virtual' outside class declaration" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } explicit auto [ w ] = c; // { dg-error "'explicit' outside class declaration" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - static auto [ x ] = c; // { dg-error "decomposition declaration cannot be declared 'static'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - extern auto [ y ] { c }; // { dg-error "decomposition declaration cannot be declared 'extern'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + static auto [ x ] = c; // { dg-error "structured binding declaration cannot be 'static'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + extern auto [ y ] { c }; // { dg-error "structured binding declaration cannot be 'extern'" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } } void @@ -52,15 +52,15 @@ void test3 (A &b, B c) { auto [ d, e, f ] = arr; // { dg-error "only 3 names provided while 'int .4.' decomposes into 4 elements" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto & [ g, h, i, j, k ] = arr; // { dg-error "5 names provided while 'int .4.' decomposes into 4 elements" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto [ l, m ] = b; // { dg-error "only 2 names provided while 'A' decomposes into 3 elements" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto & [ n, o, p, q ] = b; // { dg-error "4 names provided while 'A' decomposes into 3 elements" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - auto [] { c }; // { dg-error "empty decomposition declaration" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + auto [] { c }; // { dg-error "empty structured binding declaration" } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto [ r, s ] = c; // { dg-error "2 names provided while 'B' decomposes into 1 elements" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp30.C b/gcc/testsuite/g++.dg/cpp1z/decomp30.C new file mode 100644 index 00000000000..23115ad1082 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/decomp30.C @@ -0,0 +1,12 @@ +// PR c++/81258 +// { dg-options -std=c++1z } + +int a[2]; +auto [b, c] (a); +auto [d, e] { a }; +auto [f, g] = a; +auto [h, i] ( a, a ); // { dg-error "invalid initializer for structured binding declaration" } +auto [j, k] { a, a }; // { dg-error "invalid initializer for structured binding declaration" } +auto [l, m] = { a }; // { dg-error "deducing from brace-enclosed initializer list requires" } +auto [n, o] {}; // { dg-error "invalid initializer for structured binding declaration" } +auto [p, q] (); // { dg-error "invalid initializer for structured binding declaration" } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp4.C b/gcc/testsuite/g++.dg/cpp1z/decomp4.C index bc85263e986..55460833bd9 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp4.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp4.C @@ -15,18 +15,18 @@ void test (A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h, I &i) { auto [ j ] = a; // { dg-error "cannot decompose class type 'A' because it has an anonymous struct member" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto [ k ] { b }; // { dg-error "cannot decompose class type 'B' because it has an anonymous union member" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } auto [ l, l2 ] = c; // { dg-error "cannot decompose non-public member 'C::b' of 'C'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - auto [ m ] = d; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + auto [ m ] = d; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } auto [ n ] { e }; // { dg-error "cannot decompose non-public member 'E::a' of 'E'" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - auto [ o ] { f }; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + auto [ o ] { f }; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } auto & [ p ] { g }; // { dg-error "cannot decompose class type 'G': both it and its base class 'F' have non-static data members" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } - auto [ q ] { h }; // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + auto [ q ] { h }; // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } } auto [ r ] { i }; // { dg-error "cannot decompose class type 'I': its base classes 'F' and 'H' have non-static data members" } - // { dg-warning "decomposition declaration only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } + // { dg-warning "structured bindings only available with -std=c..1z or -std=gnu..1z" "" { target c++14_down } .-1 } } diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp5.C b/gcc/testsuite/g++.dg/cpp1z/decomp5.C index 86b2c22f37a..99610d76832 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp5.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp5.C @@ -12,19 +12,19 @@ main () x.i = i; x.j = 2 * i++; } - for (auto & [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto & [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x += 2; y += 3; } i = 0; - for (const auto [ u, v ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (const auto [ u, v ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { if (u != i + 2 || v != 2 * i++ + 3) __builtin_abort (); } i = 0; - for (auto [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x += 4; y += 5; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp6.C b/gcc/testsuite/g++.dg/cpp1z/decomp6.C index 7a8a239d9e1..378a25141f4 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp6.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp6.C @@ -23,7 +23,7 @@ main () if (ccnt != 6 || dcnt || cccnt || tccnt) __builtin_abort (); { - auto [b,c,d,e,f,g] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [b,c,d,e,f,g] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 6 || dcnt || cccnt || tccnt != 6) __builtin_abort (); b.a++; @@ -34,7 +34,7 @@ main () if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5]) __builtin_abort (); { - auto&[ h, i, j, k, l, m ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto&[ h, i, j, k, l, m ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 6 || dcnt || cccnt || tccnt != 6) __builtin_abort (); j.a += 4; @@ -59,7 +59,7 @@ main () if (ccnt != 12 || dcnt != 12 || cccnt || tccnt != 6) __builtin_abort (); { - auto [b,c,d,e,f,g] { a }; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [b,c,d,e,f,g] { a }; // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 12 || dcnt != 12 || cccnt != 6 || tccnt != 6) __builtin_abort (); b.a++; @@ -70,7 +70,7 @@ main () if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5]) __builtin_abort (); { - auto&[ h, i, j, k, l, m ] {a}; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto&[ h, i, j, k, l, m ] {a}; // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 12 || dcnt != 12 || cccnt != 6 || tccnt != 6) __builtin_abort (); j.a += 4; @@ -95,7 +95,7 @@ main () if (ccnt != 18 || dcnt != 24 || cccnt != 6 || tccnt != 6) __builtin_abort (); { - auto [b,c,d,e,f,g] ( a ); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto [b,c,d,e,f,g] ( a ); // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 18 || dcnt != 24 || cccnt != 12 || tccnt != 6) __builtin_abort (); b.a++; @@ -106,7 +106,7 @@ main () if (&b == &a[0] || &c == &a[1] || &d == &a[2] || &e == &a[3] || &f == &a[4] || &g == &a[5]) __builtin_abort (); { - auto&[ h, i, j, k, l, m ] (a); // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto&[ h, i, j, k, l, m ] (a); // { dg-warning "structured bindings only available with" "" { target c++14_down } } if (ccnt != 18 || dcnt != 24 || cccnt != 12 || tccnt != 6) __builtin_abort (); j.a += 4; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp7.C b/gcc/testsuite/g++.dg/cpp1z/decomp7.C index d366adecc4c..545c5cf1060 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp7.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp7.C @@ -10,14 +10,14 @@ template <typename T, typename U> void foo (T &x, U &y) { - auto & [ c, d ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ e, f ] = a; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ g, h, i ] = sa; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ j, k, l ] = sa; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ m, n ] = x; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ o, p ] = x; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto [ q, r, s ] = y; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } - auto & [ t, u, v ] = y; // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + auto & [ c, d ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ e, f ] = a; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ g, h, i ] = sa; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ j, k, l ] = sa; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ m, n ] = x; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ o, p ] = x; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto [ q, r, s ] = y; // { dg-warning "structured bindings only available with" "" { target c++14_down } } + auto & [ t, u, v ] = y; // { dg-warning "structured bindings only available with" "" { target c++14_down } } c += 1; e += 2; g += 3; diff --git a/gcc/testsuite/g++.dg/cpp1z/decomp8.C b/gcc/testsuite/g++.dg/cpp1z/decomp8.C index 9e1ea5d5da1..af3075cce98 100644 --- a/gcc/testsuite/g++.dg/cpp1z/decomp8.C +++ b/gcc/testsuite/g++.dg/cpp1z/decomp8.C @@ -14,19 +14,19 @@ foo (T &b) x.i = i; x.j = 2 * i++; } - for (auto & [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto & [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x += 2; y += 3; } i = 0; - for (const auto [ u, v ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (const auto [ u, v ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { if (u != i + 2 || v != 2 * i++ + 3) __builtin_abort (); } i = 0; - for (auto [ x, y ] : a) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto [ x, y ] : a) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x += 4; y += 5; @@ -45,19 +45,19 @@ foo (T &b) x.i = i; x.j = 2 * i++; } - for (auto & [ x, y ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto & [ x, y ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x -= 2; y -= 3; } i = 0; - for (const auto [ u, v ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (const auto [ u, v ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { if (u != i - 2 || v != 2 * i++ - 3) __builtin_abort (); } i = 0; - for (auto [ x, y ] : b) // { dg-warning "decomposition declaration only available with" "" { target c++14_down } } + for (auto [ x, y ] : b) // { dg-warning "structured bindings only available with" "" { target c++14_down } } { x -= 4; y -= 5; diff --git a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C index 11269ccbe9c..b473ed553c9 100644 --- a/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C +++ b/gcc/testsuite/g++.dg/cpp1z/direct-enum-init1.C @@ -17,121 +17,121 @@ void bar (E); void foo () { - A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" } + B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } C c1 { s }; - D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" } - D d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } } - // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 } - D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } } - D d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } } + D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" } + D d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } } + // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 } + D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } } + D d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } } D d5 { D(l) }; - D d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } } - E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } + D d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } } + E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" } - C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } + B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" } + C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } - D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } } - E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } } + E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" } - bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" } - V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" } + bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" } + V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" } - if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" } + if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } ; - if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } } + if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } } ; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 } - C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } } - B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } } - B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } + B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } + B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 } - C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } } + C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 } - C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } } - C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } + C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } + C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } } struct U { - U () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } - U (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + U () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } + U (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } U (float) : e({ 6 }) {}// { dg-error "list-initializer for non-class type must not be parenthesized" } - // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target *-*-* } .-1 } + // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target *-*-* } .-1 } E e; }; struct W { - A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } - C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } } + A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" } + B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } + C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-1 } - D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" } + D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" } }; template <int N> void foo2 () { - A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + A a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" } + B b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } C c1 { s }; - D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" } - D d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } } - // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 } - D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } } - D d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } } + D d1 { D(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" } + D d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } } + // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 } + D d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } } + D d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } } D d5 { D(l) }; - D d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } } - E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } + D d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } } + E e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + E e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + E e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + E e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" } - C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } - D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } } - E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + B b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" } + C c2 = { C { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } + D *d7 = new D { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } } + E *e5 = new E { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" } - bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" } - V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + bar ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" } + bar (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + V v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" } + V v2 = { E { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + V v3 = { E { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" } - if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + V v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" } + if (B b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } ; - if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } } + if (B b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } } ; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 } - C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } } - B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } } - B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + C c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } + B b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } + B b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 } - C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } } + C c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 } - C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } } - C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } + C c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } + C c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } } template <int N> struct U2 { - U2 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } - U2 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + U2 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } + U2 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } U2 (float) : e({ 6 }) {} E e; @@ -140,11 +140,11 @@ struct U2 template <int N> struct W2 { - A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" "" { target *-*-* } .-2 } - B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-3 } - C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-4 } + A a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" "" { target *-*-* } .-2 } + B b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-3 } + C c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-4 } // { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-5 } - D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-6 } + D d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-6 } }; template <typename H, typename I, typename J, typename K, typename L, typename M> @@ -152,54 +152,54 @@ void foo3 () { void bar3 (L); - H a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - I b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + H a1 { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" } + I b1 { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } J c1 { s }; - K d1 { K(t) }; // { dg-error "invalid cast from type 'T' to type 'D {enum}'" } - K d2 { t }; // { dg-error "cannot convert 'T' to 'D {enum}' in initialization" "" { target c++14_down } } - // { dg-error "invalid cast from type 'T' to type 'D {enum}'" "" { target c++1z } .-1 } - K d3 { 9 }; // { dg-error "cannot convert 'int' to 'D {enum}' in initialization" "" { target c++14_down } } - K d4 { l }; // { dg-error "cannot convert 'long int' to 'D {enum}' in initialization" "" { target c++14_down } } + K d1 { K(t) }; // { dg-error "invalid cast from type 'T' to type 'D'" } + K d2 { t }; // { dg-error "cannot convert 'T' to 'D' in initialization" "" { target c++14_down } } + // { dg-error "invalid cast from type 'T' to type 'D'" "" { target c++1z } .-1 } + K d3 { 9 }; // { dg-error "cannot convert 'int' to 'D' in initialization" "" { target c++14_down } } + K d4 { l }; // { dg-error "cannot convert 'long int' to 'D' in initialization" "" { target c++14_down } } K d5 { K(l) }; - K d6 { G }; // { dg-error "cannot convert 'A {enum}' to 'D {enum}' in initialization" "" { target c++14_down } } - L e1 { 5 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - L e2 { -1 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } + K d6 { G }; // { dg-error "cannot convert 'A' to 'D' in initialization" "" { target c++14_down } } + L e1 { 5 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + L e2 { -1 }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-1' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - L e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + L e3 { 5.0 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - L e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + L e4 { 5.2 }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.\[0-9]*e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - I b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" } - J c2 = { J { 8 } }; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } - K *d7 = new K { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target c++14_down } } - L *e5 = new L { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + I b2 = { 7 }; // { dg-error "invalid conversion from 'int' to 'B'" } + J c2 = { J { 8 } }; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } + K *d7 = new K { 9 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target c++14_down } } + L *e5 = new L { -4 }; // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '-4' from 'int' to 'unsigned char' inside" "" { target c++1z } .-1 } - bar3 ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' for argument" } - bar3 (E { 9 }); // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - M v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E {enum}'" } - M v2 = { L { 12 } }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" "" { target c++14_down } } - M v3 = { L { 5.0 } }; // { dg-error "cannot convert 'double' to 'E {enum}' in initialization" "" { target c++14_down } } + bar3 ({ 10 }); // { dg-error "cannot convert \[^\n\r]* to 'E' for argument" } + bar3 (E { 9 }); // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + M v1 = { { 11 } }; // { dg-error "braces around scalar initializer for type 'E'" } + M v2 = { L { 12 } }; // { dg-error "cannot convert 'int' to 'E' in initialization" "" { target c++14_down } } + M v3 = { L { 5.0 } }; // { dg-error "cannot convert 'double' to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } - M v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E {enum}' in initialization" } - if (I b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + M v4 = { 13 }; // { dg-error "cannot convert 'int' to 'E' in initialization" } + if (I b3 { 5 }) // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } ; - if (I b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B {enum}' in initialization" "" { target c++14_down } } + if (I b4 { 4.0 }) // { dg-error "cannot convert 'double' to 'B' in initialization" "" { target c++14_down } } ; // { dg-error "narrowing conversion of '4.0e.0' from 'double' to 'short int' inside" "" { target c++1z } .-1 } - J c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C {enum}' in initialization" "" { target c++14_down } } - I b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B {enum}'" "" { target c++14_down } } - I b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } } + J c3 { 8L }; // { dg-error "cannot convert 'long int' to 'C' in initialization" "" { target c++14_down } } + I b4 {short (c + 5)}; // { dg-error "invalid conversion from 'short int' to 'B'" "" { target c++14_down } } + I b5 {c + 5}; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } } // { dg-error "narrowing conversion of \[^\n\r]* from 'int' to 'short int' inside" "" { target c++1z } .-1 } - J c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C {enum}' in initialization" "" { target c++14_down } } + J c4 { ll }; // { dg-error "cannot convert 'long long int' to 'C' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of 'll' from 'long long int' to 'int' inside" "" { target c++1z } .-1 } - J c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C {enum}' in initialization" "" { target c++14_down } } - J c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C {enum}' in initialization" "" { target c++14_down } } + J c5 {short (c + 5)}; // { dg-error "cannot convert 'short int' to 'C' in initialization" "" { target c++14_down } } + J c6 {c + 5}; // { dg-error "cannot convert 'int' to 'C' in initialization" "" { target c++14_down } } } template <typename L> struct U3 { - U3 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } - U3 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E {enum}' in initialization" "" { target c++14_down } } + U3 () : e { 5 } {} // { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } + U3 (int) : e { 5.0 } {}// { dg-error "cannot convert \[^\n\r]* to 'E' in initialization" "" { target c++14_down } } // { dg-error "narrowing conversion of '5.0e.0' from 'double' to 'unsigned char' inside" "" { target c++1z } .-1 } U3 (float) : e({ 6 }) {} L e; @@ -208,11 +208,11 @@ struct U3 template <typename H, typename I, typename J, typename K> struct W3 { - H a { 5 }; // { dg-error "invalid conversion from 'int' to 'A {enum}'" "" { target *-*-* } .-2 } - I b { 6 }; // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-3 } - J c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-4 } + H a { 5 }; // { dg-error "invalid conversion from 'int' to 'A'" "" { target *-*-* } .-2 } + I b { 6 }; // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-3 } + J c { 3.0f }; // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-4 } // { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-5 } - K d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-6 } + K d = { 7 }; // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-6 } }; void @@ -221,17 +221,17 @@ test () foo2<0> (); U2<0> u20; U2<1> u21 (5); - W2<0> w2; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-1 } - // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-2 } + W2<0> w2; // { dg-error "invalid conversion from 'int' to 'A'" } + // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-1 } + // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-2 } // { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-3 } - // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-4 } + // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-4 } foo3<A, B, C, D, E, V> (); U3<E> u30; U3<E> u31 (5); - W3<A, B, C, D> w3; // { dg-error "invalid conversion from 'int' to 'A {enum}'" } - // { dg-error "invalid conversion from 'int' to 'B {enum}'" "" { target c++14_down } .-1 } - // { dg-error "cannot convert \[^\n\r]* to 'C {enum}' in initialization" "" { target c++14_down } .-2 } + W3<A, B, C, D> w3; // { dg-error "invalid conversion from 'int' to 'A'" } + // { dg-error "invalid conversion from 'int' to 'B'" "" { target c++14_down } .-1 } + // { dg-error "cannot convert \[^\n\r]* to 'C' in initialization" "" { target c++14_down } .-2 } // { dg-error "narrowing conversion of '3.0e.0f' from 'float' to 'int' inside" "" { target c++1z } .-3 } - // { dg-error "cannot convert \[^\n\r]* to 'D {enum}' in initialization" "" { target *-*-* } .-4 } + // { dg-error "cannot convert \[^\n\r]* to 'D' in initialization" "" { target *-*-* } .-4 } } diff --git a/gcc/testsuite/g++.dg/cpp1z/dr393.C b/gcc/testsuite/g++.dg/cpp1z/dr393.C new file mode 100644 index 00000000000..4a7645a618f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/dr393.C @@ -0,0 +1,4 @@ +// DR 393 +// { dg-options -Wpedantic } + +void f(int (&)[]); // { dg-warning "unknown bound" "" { target c++14_down } } diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C new file mode 100644 index 00000000000..cae380a21eb --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-1.C @@ -0,0 +1,23 @@ +// { dg-options "-O2 -gdwarf-4 -dA -gno-strict-dwarf" } +// { dg-final { scan-assembler-times " DW_AT_export_symbols" 1 } } +// { dg-final { scan-assembler-times "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" 2 } } + +namespace A +{ + int i = 5; + inline namespace B + { + int j = 6; + namespace C + { + int k = 7; + }; + }; +}; +int l = A::i + A::j + A::C::k; +int m = A::i + A::B::j + A::B::C::k; +namespace +{ + int n = 8; +}; +int o = n; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C new file mode 100644 index 00000000000..4d9aed7e219 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/inline-ns-2.C @@ -0,0 +1,23 @@ +// { dg-options "-O2 -gdwarf-5 -dA" } +// { dg-final { scan-assembler-times " DW_AT_export_symbols" 2 } } +// { dg-final { scan-assembler-not "DIE \\(\[^\n\r\]*\\) DW_TAG_imported_module" } } + +namespace A +{ + int i = 5; + inline namespace B + { + int j = 6; + namespace C + { + int k = 7; + }; + }; +}; +int l = A::i + A::j + A::C::k; +int m = A::i + A::B::j + A::B::C::k; +namespace +{ + int n = 8; +}; +int o = n; diff --git a/gcc/testsuite/g++.dg/diagnostic/friend1.C b/gcc/testsuite/g++.dg/diagnostic/friend1.C new file mode 100644 index 00000000000..a35f92ad949 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/friend1.C @@ -0,0 +1,8 @@ +// { dg-options "-fdiagnostics-show-caret" } + +friend void foo(); /* { dg-error "used outside of class" } + { dg-begin-multiline-output "" } + friend void foo(); + ^~~~~~ + ------ + { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/diagnostic/pr79300.C b/gcc/testsuite/g++.dg/diagnostic/pr79300.C new file mode 100644 index 00000000000..6805e85873f --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr79300.C @@ -0,0 +1,44 @@ +// { dg-options "-fdiagnostics-show-caret" } + +#define TEST_1_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_1_DEPTH_0 } + +void test_1 () +{ + TEST_1_DEPTH_0 // { dg-line use_TEST_1_DEPTH_0 } +} + +// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_1_DEPTH_0 } +/* { dg-begin-multiline-output "" } + #define TEST_1_DEPTH_0 throw bad_alloc; + ^~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_1_DEPTH_0'" "" { target *-*-* } use_TEST_1_DEPTH_0 } +/* { dg-begin-multiline-output "" } + TEST_1_DEPTH_0 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ + + +#define TEST_2_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_2_DEPTH_0 } +#define TEST_2_DEPTH_1 TEST_2_DEPTH_0 // { dg-line define_TEST_2_DEPTH_1 } + +void test_2 () +{ + TEST_2_DEPTH_1 // { dg-line use_TEST_2_DEPTH_1 } +} + +// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_2_DEPTH_0 } +/* { dg-begin-multiline-output "" } + #define TEST_2_DEPTH_0 throw bad_alloc; + ^~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_2_DEPTH_0'" "" { target *-*-* } define_TEST_2_DEPTH_1 } +/* { dg-begin-multiline-output "" } + #define TEST_2_DEPTH_1 TEST_2_DEPTH_0 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_2_DEPTH_1'" "" { target *-*-* } use_TEST_2_DEPTH_1 } +/* { dg-begin-multiline-output "" } + TEST_2_DEPTH_1 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/g++.dg/diagnostic/variadic1.C b/gcc/testsuite/g++.dg/diagnostic/variadic1.C index 69f1f988f30..7e3db314328 100644 --- a/gcc/testsuite/g++.dg/diagnostic/variadic1.C +++ b/gcc/testsuite/g++.dg/diagnostic/variadic1.C @@ -4,6 +4,6 @@ template<int N> struct B { }; template<typename... T> struct A { - B<sizeof...(T)> f(); // { dg-error "sizeof\\.\\.\\." } + B<sizeof...(T)> f(); // { dg-message "sizeof\\.\\.\\." } B<42> f(); // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.dg/ext/anon-struct6.C b/gcc/testsuite/g++.dg/ext/anon-struct6.C index 66d4b327196..9b59085f670 100644 --- a/gcc/testsuite/g++.dg/ext/anon-struct6.C +++ b/gcc/testsuite/g++.dg/ext/anon-struct6.C @@ -3,8 +3,8 @@ struct A { struct - { // { dg-error "anonymous struct cannot have function members" } + { struct { static int i; }; // { dg-error "prohibits anonymous structs|non-static data members|unnamed class" } - void foo() { i; } + void foo() { i; } // { dg-error "can only have non-static data" } }; // { dg-error "prohibits anonymous structs" } }; diff --git a/gcc/testsuite/g++.dg/ext/mvc2.C b/gcc/testsuite/g++.dg/ext/mvc2.C index e7abab81d95..1b8c6f4d6e9 100644 --- a/gcc/testsuite/g++.dg/ext/mvc2.C +++ b/gcc/testsuite/g++.dg/ext/mvc2.C @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-ifunc "" } */ __attribute__((target_clones("avx","arch=slm","default"))) __attribute__((target("avx"))) diff --git a/gcc/testsuite/g++.dg/ext/mvc3.C b/gcc/testsuite/g++.dg/ext/mvc3.C index 05bebf7d4fb..d32b2c93aa0 100644 --- a/gcc/testsuite/g++.dg/ext/mvc3.C +++ b/gcc/testsuite/g++.dg/ext/mvc3.C @@ -1,4 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-require-ifunc "" } */ __attribute__((target("avx"))) __attribute__((target_clones("avx","arch=slm","default"))) diff --git a/gcc/testsuite/g++.dg/gomp/udr-3.C b/gcc/testsuite/g++.dg/gomp/udr-3.C index 9fc6f40820a..57531f2042b 100644 --- a/gcc/testsuite/g++.dg/gomp/udr-3.C +++ b/gcc/testsuite/g++.dg/gomp/udr-3.C @@ -77,7 +77,7 @@ namespace N2 { struct U { - #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" } + #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" } #pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" } }; } @@ -109,9 +109,9 @@ namespace N4 struct U { #pragma omp declare reduction (bar: T: omp_out.t += omp_in.t) - #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-error "with" } + #pragma omp declare reduction (bar: S: omp_out.s *= omp_in.s) // { dg-message "previous" } #pragma omp declare reduction (bar: S: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" } - #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" } + #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" } #pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" } #pragma omp declare reduction (bar: short unsigned: omp_out += omp_in) #pragma omp declare reduction (bar: short int: omp_out += omp_in) @@ -132,7 +132,7 @@ namespace N5 template <typename T> struct U { - #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-error "with" } + #pragma omp declare reduction (bar: T: omp_out.s *= omp_in.s) // { dg-message "previous" } #pragma omp declare reduction (bar: T: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" } }; U<S> u; @@ -159,9 +159,9 @@ namespace N6 { typedef V V2; #pragma omp declare reduction (bar: T: omp_out.t += omp_in.t) - #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-error "with" } + #pragma omp declare reduction (bar: V: omp_out.s *= omp_in.s) // { dg-message "previous" } #pragma omp declare reduction (bar: V2: omp_out.s += omp_in.s) // { dg-error "cannot be overloaded" } - #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-error "with" } + #pragma omp declare reduction (bar: long: omp_out += omp_in) // { dg-message "previous" } #pragma omp declare reduction (bar: long int: omp_out += omp_in) // { dg-error "cannot be overloaded" } #pragma omp declare reduction (bar: short unsigned: omp_out += omp_in) #pragma omp declare reduction (bar: short int: omp_out += omp_in) diff --git a/gcc/testsuite/g++.dg/ipa/pr81261.C b/gcc/testsuite/g++.dg/ipa/pr81261.C new file mode 100644 index 00000000000..f182eb152cd --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr81261.C @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fno-guess-branch-probability" } */ + +struct CBase { + virtual void BaseFunc () {} +}; + +struct MMixin { + virtual void * MixinFunc (int, void *) = 0; +}; + +struct CExample: CBase, public MMixin +{ + void *MixinFunc (int arg, void *arg2) + { + if (arg != 1 || arg2) + return 0; + return this; + } +}; + +void *test (MMixin & anExample) +{ + return anExample.MixinFunc (1, 0); +} + +int main () +{ + CExample c; + return (test (c) != &c); +} diff --git a/gcc/testsuite/g++.dg/lookup/decl1.C b/gcc/testsuite/g++.dg/lookup/decl1.C index 42a9978e597..205ffcff1d7 100644 --- a/gcc/testsuite/g++.dg/lookup/decl1.C +++ b/gcc/testsuite/g++.dg/lookup/decl1.C @@ -19,14 +19,13 @@ C2<X>::operator C1<Y>() return C1<Y>(); } -struct A -{ - operator int (); // { dg-error "operator" } - operator float (); // { dg-error "operator" } - operator float () const; // { dg-error "operator" } - template <typename T> operator T * (); // { dg-error "candidates" } +struct A { // { dg-message "defined here" } + operator int (); // { dg-message "operator" } + operator float (); // { dg-message "operator" } + operator float () const; // { dg-message "operator" } + template <typename T> operator T * (); // { dg-message "operator" } }; -A::operator short () { // { dg-error "prototype for" } +A::operator short () { // { dg-error "no declaration matches" } return 0; } diff --git a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C index 31d100a74f9..3e901cc7759 100644 --- a/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C +++ b/gcc/testsuite/g++.dg/lookup/extern-c-redecl.C @@ -8,4 +8,4 @@ namespace A { // next line should trigger an error because // it conflicts with previous declaration of foo_func (), due to // different exception specifications. -extern "C" void foo_func (); // { dg-error "C language|exception specifications" } +extern "C" void foo_func (); // { dg-error "C language linkage|exception specifications" } diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C new file mode 100644 index 00000000000..ae918f869a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-2.C @@ -0,0 +1,55 @@ +/* Example of fix-it hints that add #include directives, + adding them after a pre-existing #include. */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +/* This is padding (to avoid the generated patch containing DejaGnu + directives). */ + +#include <stdio.h> + +void test (void) +{ + std::string s ("hello world"); // { dg-error ".string. is not a member of .std." } + // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + + std::cout << 10; // { dg-error ".cout. is not a member of .std." } + // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } +} + +/* Same again, to test idempotency of the added "#include" fix-it. */ + +void test_2 (void) +{ + std::string s ("hello again"); // { dg-error ".string. is not a member of .std." } + // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } + + std::cout << 10; // { dg-error ".cout. is not a member of .std." } + // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 } +} + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing this + source filename, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ + +/* Verify the hunks within the patch. + Use #if 0/#endif rather than comments, to allow the text to contain + a comment. + We expect a "#include <string>" and "#include <iostream>" to each have been + added once, immediately below the last #include. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -7,6 +7,8 @@ + directives). */ + + #include <stdio.h> ++#include <string> ++#include <iostream> + + void test (void) + { +{ dg-end-multiline-output "" } +#endif diff --git a/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C new file mode 100644 index 00000000000..23f868dff09 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/missing-std-include-3.C @@ -0,0 +1,35 @@ +/* Example of where the error occurs before the first #include, + which in this case happens to be the missing header. + For this case, expect to insert the #include at the top of the file. */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +void test () +{ + std::string test; // { dg-error ".string. is not a member of .std." } + // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 } +} + +#include <string> + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing this + source filename, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ + +/* Verify the hunks within the patch. + Use #if 0/#endif rather than comments, to allow the text to contain + a comment. + We expect a "#include <string>" have been added once, at the top + of the file. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -1,3 +1,4 @@ ++#include <string> + /* Example of where the error occurs before the first #include, + which in this case happens to be the missing header. + For this case, expect to insert the #include at the top of the file. */ +{ dg-end-multiline-output "" } +#endif diff --git a/gcc/testsuite/g++.dg/lookup/pr81229.C b/gcc/testsuite/g++.dg/lookup/pr81229.C new file mode 100644 index 00000000000..c9981c9f60a --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr81229.C @@ -0,0 +1,7 @@ +// PR c++/81229 GC ICE with stale pointed in identifier type. +// { dg-additional-options "--param ggc-min-heapsize=0" } + +typedef unsigned L; +typedef unsigned L; + +L l; diff --git a/gcc/testsuite/g++.dg/opt/pr79659.C b/gcc/testsuite/g++.dg/opt/pr79659.C new file mode 100644 index 00000000000..132d5c1e7f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr79659.C @@ -0,0 +1,5 @@ +// PR target/79659 +// { dg-do compile } +// { dg-options "-flifetime-dse=123456" } + +// { dg-error "is not between 0 and 2" "" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/other/i386-9.C b/gcc/testsuite/g++.dg/other/i386-9.C index 79640579142..782cf875eef 100644 --- a/gcc/testsuite/g++.dg/other/i386-9.C +++ b/gcc/testsuite/g++.dg/other/i386-9.C @@ -2,6 +2,7 @@ // Testcase by Zdenek Sojka <zsojka@seznam.cz> // { dg-do run { target i?86-*-* x86_64-*-* } } +/* { dg-require-stack-check "" } */ // { dg-options "-Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer" } int main() diff --git a/gcc/testsuite/g++.dg/other/pr28432.C b/gcc/testsuite/g++.dg/other/pr28432.C index 2b9c7634367..8e2428594d9 100644 --- a/gcc/testsuite/g++.dg/other/pr28432.C +++ b/gcc/testsuite/g++.dg/other/pr28432.C @@ -3,5 +3,7 @@ // { dg-options "" } -struct A {}; -void A::foo(); // { dg-error "member function declared in class|outside of class is not definition" } +struct A {}; // { dg-message "defined here" } + +void A::foo(); // { dg-error "no declaration matches" } +// { dg-message "no functions named" "note" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/overload/error1.C b/gcc/testsuite/g++.dg/overload/error1.C index 6c5998c720a..a4fd4854eb2 100644 --- a/gcc/testsuite/g++.dg/overload/error1.C +++ b/gcc/testsuite/g++.dg/overload/error1.C @@ -2,6 +2,6 @@ struct S { - void f () {} // { dg-error "with" } + void f () {} // { dg-message "previous" } int f () { return 0; } // { dg-error "overloaded" } }; diff --git a/gcc/testsuite/g++.dg/overload/error2.C b/gcc/testsuite/g++.dg/overload/error2.C index 4a9d35bc49d..23a2ea18d3a 100644 --- a/gcc/testsuite/g++.dg/overload/error2.C +++ b/gcc/testsuite/g++.dg/overload/error2.C @@ -6,6 +6,6 @@ struct A { - void foo(); // { dg-error "with" } + void foo(); // { dg-message "previous" } virtual void foo(); // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.dg/parse/catch2.C b/gcc/testsuite/g++.dg/parse/catch2.C new file mode 100644 index 00000000000..528d6c74125 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/catch2.C @@ -0,0 +1,4 @@ +// PR c++/62046 + +void foo() { } catch (...); // { dg-error "expected" } +class bar { void foo() { } catch (...); }; // { dg-error "expected" } diff --git a/gcc/testsuite/g++.dg/parse/crash12.C b/gcc/testsuite/g++.dg/parse/crash12.C index 769ca2e9343..61921fded8f 100644 --- a/gcc/testsuite/g++.dg/parse/crash12.C +++ b/gcc/testsuite/g++.dg/parse/crash12.C @@ -6,15 +6,16 @@ template <class _Tp> class auto_ptr {}; template <class _Tp> -class counted_ptr -{ +class counted_ptr { // { dg-message "defined here" } public: - counted_ptr(::auto_ptr<_Tp>& __a); // { dg-error "candidate" } + counted_ptr(::auto_ptr<_Tp>& __a); // { dg-message "candidate" } ::auto_ptr<_Tp> auto_ptr(); }; template <class _Tp> -inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) // { dg-error "required|not match|template" } +inline counted_ptr<_Tp>::counted_ptr(class auto_ptr& __a) +// { dg-error "no declaration matches" "" { target *-*-* } .-1 } +// { dg-error "template argument required" "" { target *-*-* } .-2 } { } diff --git a/gcc/testsuite/g++.dg/parse/enum3.C b/gcc/testsuite/g++.dg/parse/enum3.C index dc07193d389..81e69635678 100644 --- a/gcc/testsuite/g++.dg/parse/enum3.C +++ b/gcc/testsuite/g++.dg/parse/enum3.C @@ -1,5 +1,7 @@ // PR c++/28261 -struct A {}; // { dg-error "A::A" } +struct A {}; // { dg-message "A::A" } +// { dg-message "defined here" "" { target *-*-* } .-1 } -A::A (enum { e }) {} // { dg-error "defined|prototype" } +A::A (enum { e }) {} // { dg-error "no declaration matches" } +// { dg-error "in parameter types" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/parse/operator6.C b/gcc/testsuite/g++.dg/parse/operator6.C index e58a3a682c3..c13860efd80 100644 --- a/gcc/testsuite/g++.dg/parse/operator6.C +++ b/gcc/testsuite/g++.dg/parse/operator6.C @@ -1,5 +1,6 @@ // PR c++/25635 -struct A {}; +struct A {}; // { dg-message "defined here" } -A::operator int(); // { dg-error "class" } +A::operator int(); // { dg-error "no declaration matches" } +// { dg-message "no conversion operators" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/parse/pr81247-a.C b/gcc/testsuite/g++.dg/parse/pr81247-a.C new file mode 100644 index 00000000000..c5b22ab479f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr81247-a.C @@ -0,0 +1,13 @@ +// PR c++/81247 ICE + +namespace N // { dg-message "previous declaration" } +// { dg-error "expected" "" { target *-*-* } .+1 } +template < typename T > class A +{ // { dg-error "redeclared as different" } + template < T > friend class N; +}; + +void f () +{ + A < int > a1; // { dg-message "required from here" } +} diff --git a/gcc/testsuite/g++.dg/parse/pr81247-b.C b/gcc/testsuite/g++.dg/parse/pr81247-b.C new file mode 100644 index 00000000000..b2b035b9baf --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr81247-b.C @@ -0,0 +1,14 @@ +// PR c++/81247 confused error + +namespace N { // { dg-message "previous declaration" } +} + +template < typename T > class A +{ // { dg-error "redeclared as different" } + template < T > friend class N; +}; + +void f () +{ + A < int > a1; +} diff --git a/gcc/testsuite/g++.dg/parse/pr81247-c.C b/gcc/testsuite/g++.dg/parse/pr81247-c.C new file mode 100644 index 00000000000..32f41f28f41 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr81247-c.C @@ -0,0 +1,13 @@ +// PR c++/81247 confused error + +namespace N { // { dg-message "previous declaration" } + template < typename T > class A + { // { dg-error "conflicts with a previous" } + template < T > friend class N; + }; +} + +void f () +{ + N::A < int > a1; +} diff --git a/gcc/testsuite/g++.dg/parse/template-keyword1.C b/gcc/testsuite/g++.dg/parse/template-keyword1.C new file mode 100644 index 00000000000..0a1298e75f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template-keyword1.C @@ -0,0 +1,3 @@ +// PR c++/81257 + +template < typename ::template A < int > >; // { dg-error "" } diff --git a/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C b/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C index 08a2ff2aa5d..e6bd746892c 100644 --- a/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C +++ b/gcc/testsuite/g++.dg/plugin/decl-plugin-test.C @@ -17,7 +17,7 @@ class test_class { int class_field1; // { dg-warning "Decl Field class_field1" } int class_field2; // { dg-warning "Decl Field class_field2" } - test_class() // { dg-warning "Decl Function test_class" } + test_class() // { dg-warning "Decl Function __ct" } : class_field1(0), class_field2(0) {} diff --git a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C index 2c004f30620..a145dfea28c 100644 --- a/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C +++ b/gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C @@ -848,3 +848,113 @@ tests::test_method_calls () ~~~~~~~~~~~~~~~~~~^~ { dg-end-multiline-output "" } */ } + +namespace std +{ + class type_info { public: int foo; }; +} + +void test_typeid (int i) +{ + __emit_expression_range (0, &typeid(i)); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, &typeid(i)); + ^~~~~~~~~~ + { dg-end-multiline-output "" } */ + + __emit_expression_range (0, &typeid(int)); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, &typeid(int)); + ^~~~~~~~~~~~ + { dg-end-multiline-output "" } */ + + __emit_expression_range (0, &typeid(i * 2)); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, &typeid(i * 2)); + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ + + __emit_expression_range (0, typeid(int).foo); /* { dg-warning "range" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, typeid(int).foo); + ~~~~~~~~~~~~^~~ + { dg-end-multiline-output "" } */ +} + +/* Various tests of locations involving macros. */ + +void test_within_macro_1 (int lhs, int rhs) +{ +#define MACRO_1(EXPR) EXPR + + __emit_expression_range (0, MACRO_1 (lhs == rhs)); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_1 (lhs == rhs)); + ~~~~^~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_1(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_1 +} + +void test_within_macro_2 (int lhs, int rhs) +{ +#define MACRO_2(EXPR) EXPR + + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + ~~~~^~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + ^~~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_2(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_2 +} + +void test_within_macro_3 (int lhs, int rhs) +{ +#define MACRO_3(EXPR) EXPR + + __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs)); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs)); + ^ + { dg-end-multiline-output "" } */ + +#undef MACRO_3 +} + +void test_within_macro_4 (int lhs, int rhs) +{ +#define MACRO_4(EXPR) EXPR + + __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs))); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs))); + ^ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_4(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_4 +} diff --git a/gcc/testsuite/g++.dg/pr69667.C b/gcc/testsuite/g++.dg/pr69667.C index 2b3e93d2e1e..76f7cb3d40b 100644 --- a/gcc/testsuite/g++.dg/pr69667.C +++ b/gcc/testsuite/g++.dg/pr69667.C @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-mcpu=power8 -w -std=c++14 -mlra" } */ +/* { dg-options "-mcpu=power8 -w -std=c++14" } */ /* target/69667, compiler got internal compiler error: Max. number of generated reload insns per insn is achieved (90) */ diff --git a/gcc/testsuite/g++.dg/pr71294.C b/gcc/testsuite/g++.dg/pr71294.C index 55dd01e5ccf..67675dd7e30 100644 --- a/gcc/testsuite/g++.dg/pr71294.C +++ b/gcc/testsuite/g++.dg/pr71294.C @@ -1,7 +1,7 @@ // { dg-do compile { target { powerpc64*-*-* && lp64 } } } // { dg-require-effective-target powerpc_p8vector_ok } */ // { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } -// { dg-options "-mcpu=power8 -O3 -fstack-protector -mno-lra" } +// { dg-options "-mcpu=power8 -O3 -fstack-protector" } // PAR target/71294 failed because RELOAD could not figure how create a V2DI // vector that auto vectorization created with each element being the same diff --git a/gcc/testsuite/g++.dg/pr81194.C b/gcc/testsuite/g++.dg/pr81194.C new file mode 100644 index 00000000000..249fcf3b7c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr81194.C @@ -0,0 +1,60 @@ +// { dg-do compile } +// { dg-options "-O2 -std=c++17 -fno-exceptions" } + +template <class a> struct b { typedef a *c; }; +class e {}; +template <typename a> class d { +public: + typedef typename b<a>::c c; + c begin(); + c end(); +}; +struct f { + enum { g } h; +}; +struct i { + d<f *> j(); +}; +struct l { + d<i *> k(); +}; +class ac; +class o { +public: + o(int *, int *, int *, ac *); +}; +class ac { +public: + ac(e); + virtual o *ae(int *, int *, int *, int *); +}; +class p { + void af(f *m) { + switch (m->h) + case f::g: + ag(); + } + +public: + void n() { + l ah; + for (i *ai : ah.k()) + for (f *m : ai->j()) + af(m); + } + virtual void ag() { __builtin_unreachable(); } +}; +template <typename = int> class an : o { +public: + an(int *, int *, int *, int *, ac *); +}; +class q : ac { +public: + q() : ac([]() -> e {}()) {} + o *ae(int *ap, int *aq, int *ar, int *as) { an(ap, aq, ar, as, this); } +}; +template <typename at> +an<at>::an(int *, int *aq, int *ar, int *as, ac *au) : o(aq, ar, as, au) { + p().n(); +} +void av() { new q; } diff --git a/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C b/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C new file mode 100644 index 00000000000..937c38f11a2 --- /dev/null +++ b/gcc/testsuite/g++.dg/rtti/missing-typeinfo-include.C @@ -0,0 +1,27 @@ +/* This is padding (to avoid the generated patch containing DejaGnu + directives). */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +void test() +{ + typeid(void); // { dg-error "must '#include <typeinfo>' before using 'typeid'" } +} + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing this + source filename, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ +/* Use #if 0/#endif rather than comments, to allow the text to contain + a comment. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -1,3 +1,4 @@ ++#include <typeinfo> + /* This is padding (to avoid the generated patch containing DejaGnu + directives). */ + +{ dg-end-multiline-output "" } +#endif diff --git a/gcc/testsuite/g++.dg/template/crash69.C b/gcc/testsuite/g++.dg/template/crash69.C index badf70bd0e4..21ed91bb27e 100644 --- a/gcc/testsuite/g++.dg/template/crash69.C +++ b/gcc/testsuite/g++.dg/template/crash69.C @@ -3,10 +3,11 @@ template<typename T> class A { static int i; // { dg-message "private" } - friend int T::foo(); // { dg-error "does not match" } + friend int T::foo(); // { dg-error "no declaration matches" } }; struct B { - void foo() { A<B>::i; } // { dg-error "within|candidate" } + void foo() { A<B>::i; } // { dg-message "candidate" } + // { dg-error "private within" "" { target *-*-* } .-1 } }; diff --git a/gcc/testsuite/g++.dg/template/duplicate1.C b/gcc/testsuite/g++.dg/template/duplicate1.C index c9cdab4b932..39185b350e7 100644 --- a/gcc/testsuite/g++.dg/template/duplicate1.C +++ b/gcc/testsuite/g++.dg/template/duplicate1.C @@ -2,6 +2,6 @@ template<int> struct A { - ~A() {} // { dg-error "with" } + ~A() {} // { dg-message "previous" } ~A() {} // { dg-error "cannot be overloaded" } }; diff --git a/gcc/testsuite/g++.dg/template/error27.C b/gcc/testsuite/g++.dg/template/error27.C index 8d41d0248ef..7f15f8c284d 100644 --- a/gcc/testsuite/g++.dg/template/error27.C +++ b/gcc/testsuite/g++.dg/template/error27.C @@ -1,5 +1,6 @@ // PR c++/27211 -struct A {}; +struct A {}; // { dg-message "defined here" } -template<int> void A::foo() {} // { dg-error "member function" } +template<int> void A::foo() {} // { dg-error "no declaration matches" } +// { dg-message "no functions named" "note" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/template/error28.C b/gcc/testsuite/g++.dg/template/error28.C index e87d542d888..d4cf031210b 100644 --- a/gcc/testsuite/g++.dg/template/error28.C +++ b/gcc/testsuite/g++.dg/template/error28.C @@ -1,5 +1,6 @@ // PR c++/27211 -struct A {}; +struct A {}; // { dg-message "defined here" } -template<int> void A::foo(); // { dg-error "member function" } +template<int> void A::foo(); // { dg-error "no declaration matches" } +// { dg-message "no functions named" "note" { target *-*-* } .-1 } diff --git a/gcc/testsuite/g++.dg/template/lookup10.C b/gcc/testsuite/g++.dg/template/lookup10.C new file mode 100644 index 00000000000..fa90af46c7c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/lookup10.C @@ -0,0 +1,12 @@ +// PR c++/81204 + +namespace std { + template<typename, typename> struct set { }; +} +using namespace std; + +template <int I, typename Result> +inline void set(Result & res) +{ + res.template set<I>(); +} diff --git a/gcc/testsuite/g++.dg/template/lookup11.C b/gcc/testsuite/g++.dg/template/lookup11.C new file mode 100644 index 00000000000..203460eda73 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/lookup11.C @@ -0,0 +1,11 @@ +// PR c++/81026 + +namespace std { + template<class> struct extent; +} +using namespace std; + +template <class T> +struct S { + void f() { T().template extent<42>(); } +}; diff --git a/gcc/testsuite/g++.dg/template/memfriend6.C b/gcc/testsuite/g++.dg/template/memfriend6.C index 5f82339af54..4f126862670 100644 --- a/gcc/testsuite/g++.dg/template/memfriend6.C +++ b/gcc/testsuite/g++.dg/template/memfriend6.C @@ -6,18 +6,21 @@ // Member function of class template as friend // Erroneous case: mismatch during declaration -template <class T> struct A { - template <class U> void f(U); // { dg-error "candidate" } - void g(); // { dg-error "candidate|with" } - void h(); // { dg-error "candidate|with" } - void i(int); // { dg-error "candidate" } +template <class T> struct A { // { dg-message "defined here" } + template <class U> void f(U); // { dg-message "candidate" } + void g(); // { dg-message "candidate" } + void h(); // { dg-message "candidate" } + void i(int); // { dg-message "candidate" } }; class C { int ii; - template <class U> friend void A<U>::f(U); // { dg-error "not match" } + template <class U> + friend void A<U>::f(U); // { dg-error "no declaration matches" } template <class U> template <class V> - friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" } - template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" } - template <class U> friend void A<U>::i(char); // { dg-error "not match" } + friend void A<U>::g(); // { dg-error "no declaration matches" } + template <class U> + friend int A<U>::h(); // { dg-error "no declaration matches" } + template <class U> + friend void A<U>::i(char); // { dg-error "no declaration matches" } }; diff --git a/gcc/testsuite/g++.dg/template/partial-specialization8.C b/gcc/testsuite/g++.dg/template/partial-specialization8.C new file mode 100644 index 00000000000..e3ffe3b58a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial-specialization8.C @@ -0,0 +1,19 @@ +// PR c++/55639 + +template <int number> +struct SomeClass +{ + SomeClass() { } + + template <typename E, int number2> + struct Fun { + static void + fun() { } + }; +}; + +template <int number> +template <typename E> +struct SomeClass<number>::template Fun<E, 0> { // { dg-error "template" } + static void fun() { } +}; diff --git a/gcc/testsuite/g++.dg/template/template-keyword1.C b/gcc/testsuite/g++.dg/template/template-keyword1.C new file mode 100644 index 00000000000..0f928a8523e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/template-keyword1.C @@ -0,0 +1,15 @@ +// PR c++/45976 + +template<int a> +struct A { + static const int value; + + template<int b> + struct B { + static const int value; + }; +}; + +template<int a> +template<int b> +const int A<a>::template B<b>::value = 0; // { dg-error "keyword .template" } diff --git a/gcc/testsuite/g++.dg/torture/pr81249.C b/gcc/testsuite/g++.dg/torture/pr81249.C new file mode 100644 index 00000000000..7bf617b0421 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr81249.C @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-mavx2 -mprefer-avx128" { target x86_64-*-* i?86-*-* } } */ + +typedef struct rtx_def *rtx; +union rtunion { + rtx rt_rtx; +}; +struct rtx_def { + struct { + rtunion fld[0]; + } u; + rtx elem[]; +} a; +int b, c, d; +rtx e; +int main() { + for (;;) { + d = 0; + for (; d < b; d++) + if (a.elem[d]) + e = a.elem[d]->u.fld[1].rt_rtx; + if (e) + c = 0; + } +} diff --git a/gcc/testsuite/g++.dg/torture/pr81365.C b/gcc/testsuite/g++.dg/torture/pr81365.C new file mode 100644 index 00000000000..fde5e503df9 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr81365.C @@ -0,0 +1,39 @@ +// PR tree-optimization/81365 +// { dg-do run } + +struct A { unsigned a; }; + +struct B { + B (const A *x) + { + __builtin_memcpy (b, x, 3 * sizeof (A)); + __builtin_memcpy (c, x + 3, sizeof (A)); + __builtin_memset (c + 1, 0, sizeof (A)); + } + bool + foo (unsigned x) + { + A *it = c; + if (it->a == x || (++it)->a == x) + { + A t(b[0]); + b[0] = *it; + *it = t; + return true; + } + return false; + } + A b[3]; + A c[2]; +}; + +int +main () +{ + A x[] = { 4, 8, 12, 18 }; + B y(x); + if (!y.foo (18)) + __builtin_abort (); + if (!y.foo (4)) + __builtin_abort (); +} diff --git a/gcc/testsuite/g++.dg/torture/pr81462.C b/gcc/testsuite/g++.dg/torture/pr81462.C new file mode 100644 index 00000000000..044c8b78ee5 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr81462.C @@ -0,0 +1,17 @@ +// { dg-do compile } +// { dg-options "-O1 -fno-ipa-pure-const" } +struct B { + B* self; + B() : self( this ) { self->f(); } + virtual void f() = 0; + }; + + struct D : B + { + void f() {} + }; + + int main() + { + D d; + } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr81408.C b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C new file mode 100644 index 00000000000..f94544b9e2d --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr81408.C @@ -0,0 +1,92 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -std=gnu++11 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */ + +namespace a { +void b () __attribute__ ((__noreturn__)); +template <typename> struct d; +template <typename e> struct d<e *> +{ + typedef e f; +}; +struct g +{ + template <typename h> using i = h *; +}; +} +using a::d; +template <typename j, typename> class k +{ + j l; + +public: + typename d<j>::f operator* () {} + void operator++ () { ++l; } + j + aa () + { + return l; + } +}; +template <typename m, typename n, typename ab> +bool +operator!= (k<m, ab> o, k<n, ab> p2) +{ + return o.aa () != p2.aa (); +} +struct p; +namespace a { +struct F +{ + struct q + { + using ai = g::i<p>; + }; + using r = q::ai; +}; +class H +{ +public: + k<F::r, int> begin (); + k<F::r, int> end (); +}; +int s; +class I +{ +public: + void + aq (char) + { + if (s) + b (); + } +}; +class u : public I +{ +public: + void + operator<< (u o (u)) + { + o (*this); + } + u operator<< (void *); +}; +template <typename at, typename au> +at +av (au o) +{ + o.aq ('\n'); +} +u ax; +} +struct p +{ + char *ay; +}; +a::H t; +void +ShowHelpListCommands () +{ + for (auto c : t) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ + a::ax << c.ay << a::av; +} + diff --git a/gcc/testsuite/g++.dg/ubsan/pr81209.C b/gcc/testsuite/g++.dg/ubsan/pr81209.C new file mode 100644 index 00000000000..3f2a5768907 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr81209.C @@ -0,0 +1,21 @@ +// PR sanitizer/81209 +// { dg-do compile } +// { dg-options "-fsanitize=undefined -fno-declone-ctor-dtor" } + +#ifdef __SIZEOF_INT128__ +typedef __int128 T; +#else +typedef long long int T; +#endif + +struct B {}; +struct A : virtual public B +{ + A (long); + T a; +}; + +A::A (long c) +{ + long b = a % c; +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr81262.C b/gcc/testsuite/g++.dg/ubsan/pr81262.C new file mode 100644 index 00000000000..1b360de95ad --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr81262.C @@ -0,0 +1,14 @@ +// PR sanitizer/81262 +// { dg-do compile } +// { dg-options "-O2 -fsanitize=unreachable" } + +int +foo () +{ + asm goto ("" : : : : l1, l2); + __builtin_unreachable (); + l1: + return 1; + l2: + return 0; +} diff --git a/gcc/testsuite/g++.dg/ubsan/pr81530.C b/gcc/testsuite/g++.dg/ubsan/pr81530.C new file mode 100644 index 00000000000..e21724686c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr81530.C @@ -0,0 +1,6 @@ +/* PR sanitizer/81530 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=undefined" } */ + +int a[(long) 4e20]; /* { dg-error "overflow in constant expression" } */ +/* { dg-error "size of array .a. is too large" "" { target *-*-* } .-1 } */ diff --git a/gcc/testsuite/g++.dg/vect/pr61171.cc b/gcc/testsuite/g++.dg/vect/pr61171.cc new file mode 100644 index 00000000000..f3e2e3e4c13 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr61171.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-effective-target vect_float } +// { dg-additional-options "-ffast-math" } + +float px[1024]; +float xx, vv; +unsigned int N=1024; + +void ok() { + for (unsigned j=0U; j<N; ++j) { + float ax = px[j]-xx; + vv-=ax; + } +} + +void noOk() { + for (unsigned j=0U; j<N; ++j) { + float ax = xx-px[j]; + vv+=ax; + } +} + +// { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } diff --git a/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C new file mode 100644 index 00000000000..afaef9ad429 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wmultistatement-macros-1.C @@ -0,0 +1,13 @@ +// PR bootstrap/81216 +// { dg-options "-Wmultistatement-macros" } +// { dg-do compile } + +template <typename A, typename B> +static bool +equal (A a, A b, B c) +{ + for (; a != b; ++a, (void)++c) + if (!(*a == *c)) + return false; + return true; +} diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C new file mode 100644 index 00000000000..52607b62284 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wreturn-local-addr-3.C @@ -0,0 +1,8 @@ +// PR c++/51270 +// { dg-options "-O2" } + +const int& f(long l) +{ + const int& i = l; + return i; // { dg-warning "address of local variable" } +} diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C index 2b8360648fa..b66e8b46565 100644 --- a/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C +++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-2.C @@ -6,5 +6,5 @@ void foo (__complex__ int i) { i == 0u; - i == ~1u; // { dg-warning "comparison between signed and unsigned integer expressions" } + i == ~1u; // { dg-warning "comparison of integer expressions of different signedness" } } diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C index b3eb8e2a7de..e92ab137e3b 100644 --- a/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C +++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-4.C @@ -3,10 +3,10 @@ int foo(unsigned int *a, int b) { - return (*a) <= b; // { dg-warning "comparison between signed and unsigned" } + return (*a) <= b; // { dg-warning "comparison of integer expressions of different signedness" } } int bar(unsigned int *a, int b) { - return *a <= b; // { dg-warning "comparison between signed and unsigned" } + return *a <= b; // { dg-warning "comparison of integer expressions of different signedness" } } diff --git a/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C b/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C index 1f8af664c7b..71b4ebf1613 100644 --- a/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C +++ b/gcc/testsuite/g++.dg/warn/Wsign-compare-6.C @@ -8,7 +8,7 @@ int main() int i = 5; int const ic = 5; - i < 5u; // { dg-warning "5:comparison between signed and unsigned" } + i < 5u; // { dg-warning "5:comparison of integer expressions of different signedness" } ic < 5u; FIVE < 5u; } diff --git a/gcc/testsuite/g++.dg/warn/compare1.C b/gcc/testsuite/g++.dg/warn/compare1.C index e00592262c6..38f4dffd1da 100644 --- a/gcc/testsuite/g++.dg/warn/compare1.C +++ b/gcc/testsuite/g++.dg/warn/compare1.C @@ -6,5 +6,5 @@ int f(unsigned a, int b) { - return a < b; /* { dg-warning "signed and unsigned" } */ + return a < b; /* { dg-warning "comparison of integer expressions of different signedness" } */ } diff --git a/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C new file mode 100644 index 00000000000..93a42eac08d --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/ctor-dtor-privacy-3.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// { dg-additional-options "-Wctor-dtor-privacy" } + +class X // { dg-message "only defines private" } +{ +public: + X (X const &); // { dg-message "requires an existing" } +}; + +class Y // { dg-message "only defines private" } +{ +public: + Y (Y &&); // { dg-message "requires an existing" } +}; + +class Z +{ +public: + Z (int); +}; diff --git a/gcc/testsuite/g++.dg/warn/pr12242.C b/gcc/testsuite/g++.dg/warn/pr12242.C index e1cd780d170..f95bf8b92d9 100644 --- a/gcc/testsuite/g++.dg/warn/pr12242.C +++ b/gcc/testsuite/g++.dg/warn/pr12242.C @@ -10,14 +10,14 @@ void example () X x; Y y; - x = 10; // { dg-warning "invalid conversion from .int. to .X {enum}." "invalid" } + x = 10; // { dg-warning "invalid conversion from .int. to .X." "invalid" } // { dg-warning "unspecified" "unspecified" { target *-*-* } .-1 } - x = 1; // { dg-warning "invalid conversion from .int. to .X {enum}." } - x = C; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" } - x = D; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" } - y = A; // { dg-error "cannot convert .X {enum}. to .Y {enum}. in assignment" } - x = y; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" } - x = i; // { dg-warning "invalid conversion from .int. to .X {enum}." } + x = 1; // { dg-warning "invalid conversion from .int. to .X." } + x = C; // { dg-error "cannot convert .Y. to .X. in assignment" } + x = D; // { dg-error "cannot convert .Y. to .X. in assignment" } + y = A; // { dg-error "cannot convert .X. to .Y. in assignment" } + x = y; // { dg-error "cannot convert .Y. to .X. in assignment" } + x = i; // { dg-warning "invalid conversion from .int. to .X." } } void foo () diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C index a3d23747b48..b3b1387462d 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/warn02.C @@ -31,7 +31,7 @@ class C class D { public: - int foo2() {return b;} // { dg-error "with" } + int foo2() {return b;} // { dg-message "previous" } int foo2() {return b;} // { dg-error "overloaded" } int b; }; @@ -39,7 +39,7 @@ public: class E { public: - int foo2(); // { dg-error "with" } + int foo2(); // { dg-message "previous" } int foo2(); // { dg-error "overloaded" } int b; }; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C b/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C index fb1ee429d37..23d6ae69f79 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/arm2.C @@ -8,12 +8,12 @@ class X { public: - int foo(); // { dg-error "with" } + int foo(); // { dg-message "previous" } static int foo(); // error: redeclaration// { dg-error "overloaded" } .* }; class Y { public: - static int foo(); // { dg-error "with" } + static int foo(); // { dg-message "previous" } int foo(); // error: redeclaration// { dg-error "overloaded" } .* }; diff --git a/gcc/testsuite/g++.old-deja/g++.bugs/900520_03.C b/gcc/testsuite/g++.old-deja/g++.bugs/900520_03.C index 7978e386aba..ebcb45f57a1 100644 --- a/gcc/testsuite/g++.old-deja/g++.bugs/900520_03.C +++ b/gcc/testsuite/g++.old-deja/g++.bugs/900520_03.C @@ -34,7 +34,7 @@ typedef int u_array[]; typedef u_array &u_array_ref; -void take_u_array_ref (u_array_ref arg) { } // { dg-error "" } reference to array of unknown bound in parmtype +void take_u_array_ref (u_array_ref arg) { } // { dg-error "" "" { target c++14_down } } reference to array of unknown bound in parmtype extern u_array u_array_gbl_obj; u_array_ref u_array_ref_gbl_obj0 = u_array_gbl_obj; // OK diff --git a/gcc/testsuite/g++.old-deja/g++.law/array2.C b/gcc/testsuite/g++.old-deja/g++.law/array2.C index 0dcddb03cd5..c51f13de0ac 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/array2.C +++ b/gcc/testsuite/g++.old-deja/g++.law/array2.C @@ -6,5 +6,5 @@ // Subject: prototype bug ? // Date: Thu, 5 Nov 92 15:37:34 PST - extern unsigned char * (*trt_def(int))[][2]; - extern unsigned char * (trt_rplst(unsigned char *(*)[][2])); // { dg-error "" } +extern unsigned char * (*trt_def(int))[][2]; +extern unsigned char * (trt_rplst(unsigned char *(*)[][2])); // { dg-error "" "" { target c++14_down } } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/err1.C b/gcc/testsuite/g++.old-deja/g++.mike/err1.C index 8e15dd27ae4..90f4ce68e55 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/err1.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/err1.C @@ -1,8 +1,8 @@ // { dg-do assemble } -struct gorf { +struct gorf { // { dg-message "defined here" } int stuff; - void snarf(); // { dg-error "" } + void snarf(); // { dg-message "" } }; -template <class T> void gorf::snarf() { return; } // { dg-error "" } +template <class T> void gorf::snarf() { return; } // { dg-error "no declaration" } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p811.C b/gcc/testsuite/g++.old-deja/g++.mike/p811.C index 260c6459cb8..5c8260aa1f8 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p811.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p811.C @@ -515,21 +515,22 @@ public: virtual char *stringify2() const = 0; // { dg-error "overriding" } }; -class X: public Y { +class X: public Y { // { dg-message "defined here" } public: X(): Y() {} - const char *stringify(); // { dg-error "candidate" } - const char *stringify2() const; // { dg-error "candidate|conflicting return type" } + const char *stringify(); // { dg-message "candidate" } + const char *stringify2() const; // { dg-message "candidate" } + // { dg-error "conflicting return type" "" { target *-*-* } .-1 } }; char * -X::stringify() const // { dg-error "does not match" } +X::stringify() const // { dg-error "no declaration matches" } { return "stringify"; } const char * -X::stringify2() // { dg-error "does not match" } +X::stringify2() // { dg-error "no declaration matches" } { return "stringify2"; } diff --git a/gcc/testsuite/g++.old-deja/g++.other/anon4.C b/gcc/testsuite/g++.old-deja/g++.other/anon4.C index 2a01be3d0aa..b6cb3006d71 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/anon4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/anon4.C @@ -10,7 +10,7 @@ struct A { union - { // { dg-error "" } anon union cannot have member fns - void bad(); + { + void bad(); // { dg-error "can only have non-static data" } }; }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash25.C b/gcc/testsuite/g++.old-deja/g++.other/crash25.C index 5b313db1a8d..0611286fdc3 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash25.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash25.C @@ -9,7 +9,8 @@ public: virtual ~X(); } -X::x() // { dg-error "6:no 'X X::x\\(\\)' member function declared in class 'X'" } +X::x() // { dg-error "1:no declaration matches" } +// { dg-message "1:no functions named" "note" { target *-*-* } .-1 } { } diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C index a4db38ba707..b7ae3706864 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/dtor4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/dtor4.C @@ -1,10 +1,10 @@ // { dg-do assemble } -struct S1 { - ~S1(); // { dg-error "" } candidate +struct S1 { // { dg-message "defined here" } + ~S1(); // { dg-message "candidate" } }; -S1::~S1() const // { dg-error "" } prototype does not match +S1::~S1() const // { dg-error "no declaration matches" } { } @@ -15,12 +15,12 @@ struct S2 { template <class T> -struct S3 { - ~S3(); // { dg-error "" } candidate +struct S3 { // { dg-message "defined here" } + ~S3(); // { dg-message "candidate" } }; template <class T> -S3<T>::~S3() volatile // { dg-error "" } prototype does not match +S3<T>::~S3() volatile // { dg-error "no declaration matches" } { } diff --git a/gcc/testsuite/g++.old-deja/g++.other/redecl2.C b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C index 0d6ccf669f0..2da0b4f9978 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/redecl2.C +++ b/gcc/testsuite/g++.old-deja/g++.other/redecl2.C @@ -1,9 +1,9 @@ // { dg-do assemble } struct S { - S(int); // { dg-error "with" } + S(int); // { dg-message "previous" } S(int); // { dg-error "overloaded" } already declared - ~S();// { dg-error "with" } + ~S();// { dg-message "previous" } ~S(); // { dg-error "overloaded" } already declared }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/redecl4.C b/gcc/testsuite/g++.old-deja/g++.other/redecl4.C index e3355dafc41..c2303575dfc 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/redecl4.C +++ b/gcc/testsuite/g++.old-deja/g++.other/redecl4.C @@ -1,7 +1,7 @@ // { dg-do assemble } int main() { struct A { - void f(); // { dg-error "with" } already declared + void f(); // { dg-message "previous" } already declared void f(); // { dg-error "overloaded" } already declared }; } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C index 73348351f0d..a8ba371af7a 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp78.C @@ -23,7 +23,7 @@ template struct B<int>; struct C { template <class U> - void f() {} // { dg-error "with" } redeclaration + void f() {} // { dg-message "previous" } redeclaration template <class U> void f() {} // { dg-error "overloaded" } redeclaration @@ -42,7 +42,7 @@ template struct D<int, double>; template <class T, class U> struct D2 { - void f(T); // { dg-error "with" } redeclaration + void f(T); // { dg-message "previous" } redeclaration void f(U); // { dg-error "overloaded" } redeclaration }; @@ -50,7 +50,7 @@ template struct D2<int, int>; struct E { - void f(); // { dg-error "with" } redeclaration + void f(); // { dg-message "previous" } redeclaration void f(); // { dg-error "overloaded" } redeclaration }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/t37.C b/gcc/testsuite/g++.old-deja/g++.pt/t37.C index 99348c05009..dbf1f4403b3 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/t37.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/t37.C @@ -1,9 +1,10 @@ -// { dg-do assemble } +// { dg-do compile } -class A { // { dg-error "" } synthesized copy ctor +class A { // { dg-message "A::A" } synthesized copy ctor + // { dg-message "defined here" "note" { target *-*-* } .-1 } public: - A(int); // { dg-error "" } referenced below - A(float); // { dg-error "" } referenced below + A(int); // { dg-message "A::A" } + A(float); // { dg-message "A::A" } ~A(); }; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81207.c b/gcc/testsuite/gcc.c-torture/compile/pr81207.c new file mode 100644 index 00000000000..f0faa8c0a22 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr81207.c @@ -0,0 +1,13 @@ +/* PR middle-end/81207 */ + +static const char *b[2] = { "'", "" }; + +int +foo (const char *d) +{ + int e; + for (e = 0; b[e]; e++) + if (__builtin_strstr (d, b[e])) + return 1; + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81262.c b/gcc/testsuite/gcc.c-torture/compile/pr81262.c new file mode 100644 index 00000000000..68fbea2a7ab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr81262.c @@ -0,0 +1,14 @@ +/* PR sanitizer/81262 */ + +void bar (void) __attribute__((cold, noreturn)); + +int +foo (void) +{ + asm goto ("" : : : : l1, l2); + bar (); + l1: + return 1; + l2: + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr81290.c b/gcc/testsuite/gcc.c-torture/compile/pr81290.c new file mode 100644 index 00000000000..1fd8b2055da --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr81290.c @@ -0,0 +1,22 @@ +/* { dg-options "-funroll-loops -w" } */ +int vz; + +void +ms (int sw, int cm) +{ + for (vz = 0; vz < 19; ++vz) + { + fx: + sw *= 2; + } + + for (;;) + { + if (sw != 0) + for (;;) + { + } + if (1 / 0 && cm != 0) + goto fx; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c index 5c99688b35a..2a03f7c29ae 100644 --- a/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/stack-check-1.c @@ -1,3 +1,4 @@ /* { dg-require-effective-target untyped_assembly } */ +/* { dg-require-stack-check "" } */ /* { dg-additional-options "-fstack-check" } */ #include "20031023-1.c" diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c index 00005298d10..25d4a40a67e 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm-lib.c @@ -37,6 +37,24 @@ my_bcopy (const void *s, void *d, size_t n) } } +__attribute__ ((used)) +void +my_memmove (void *d, const void *s, size_t n) +{ + char *dst = (char *) d; + const char *src = (const char *) s; + if (src >= dst) + while (n--) + *dst++ = *src++; + else + { + dst += n; + src += n; + while (n--) + *--dst = *--src; + } +} + /* LTO code is at the present to able to track that asm alias my_bcopy on builtin actually refers to this function. See PR47181. */ __attribute__ ((used)) diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c index ed2b06cf06f..44e336cce7c 100644 --- a/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c +++ b/gcc/testsuite/gcc.c-torture/execute/builtins/memops-asm.c @@ -12,6 +12,8 @@ extern void *memcpy (void *, const void *, size_t) __asm (ASMNAME ("my_memcpy")); extern void bcopy (const void *, void *, size_t) __asm (ASMNAME ("my_bcopy")); +extern void *memmove (void *, const void *, size_t) + __asm (ASMNAME ("my_memmove")); extern void *memset (void *, int, size_t) __asm (ASMNAME ("my_memset")); extern void bzero (void *, size_t) diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81555.c b/gcc/testsuite/gcc.c-torture/execute/pr81555.c new file mode 100644 index 00000000000..d546368a39b --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr81555.c @@ -0,0 +1,24 @@ +/* PR tree-optimization/81555 */ + +unsigned int a = 1, d = 0xfaeU, e = 0xe376U; +_Bool b = 0, f = 1; +unsigned char g = 1; + +void +foo (void) +{ + _Bool c = a != b; + if (c) + f = 0; + if (e & c & (unsigned char)d & c) + g = 0; +} + +int +main () +{ + foo (); + if (f || g != 1) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr81556.c b/gcc/testsuite/gcc.c-torture/execute/pr81556.c new file mode 100644 index 00000000000..cfbc75f861a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr81556.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/81556 */ + +unsigned long long int b = 0xb82ff73c5c020599ULL; +unsigned long long int c = 0xd4e8188733a29d8eULL; +unsigned long long int d = 2, f = 1, g = 0, h = 0; +unsigned long long int e = 0xf27771784749f32bULL; + +__attribute__((noinline, noclone)) void +foo (void) +{ + _Bool a = d > 1; + g = f % ((d > 1) << 9); + h = a & (e & (a & b & c)); +} + +int +main () +{ + foo (); + if (g != 1 || h != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/Walloca-14.c b/gcc/testsuite/gcc.dg/Walloca-14.c index 723dbe5081a..f3e3f579439 100644 --- a/gcc/testsuite/gcc.dg/Walloca-14.c +++ b/gcc/testsuite/gcc.dg/Walloca-14.c @@ -9,5 +9,6 @@ g (int *p) extern void f (void *); void *q = __builtin_alloca (p); /* { dg-warning "passing argument 1" } */ + /* { dg-warning "unbounded use of 'alloca'" "unbounded" { target *-*-* } 11 } */ f (q); } diff --git a/gcc/testsuite/gcc.dg/Wmissing-braces-fixits.c b/gcc/testsuite/gcc.dg/Wmissing-braces-fixits.c index b7d66cd6c3d..2cce217369c 100644 --- a/gcc/testsuite/gcc.dg/Wmissing-braces-fixits.c +++ b/gcc/testsuite/gcc.dg/Wmissing-braces-fixits.c @@ -162,3 +162,28 @@ struct sa3 arr_4_sa3[4] = \ 6, 7, 8, 9, 10, 11}; {{ }}{{ }} { dg-end-multiline-output "" } */ + +/* PR c/81405. */ +int a5[][0][0] = { 1, 2 }; /* { dg-line pr_81405 } */ + + /* { dg-warning "missing braces around initializer" "" { target c } pr_81405 } */ + /* { dg-begin-multiline-output "" } + int a5[][0][0] = { 1, 2 }; + ^ + { ----- + {{1}}}}, {{{2 }} + { dg-end-multiline-output "" } */ + + /* { dg-warning "excess elements" "" { target c } pr_81405 } */ + /* { dg-begin-multiline-output "" } + int a5[][0][0] = { 1, 2 }; + ^ + { dg-end-multiline-output "" } */ + /* { dg-begin-multiline-output "" } + int a5[][0][0] = { 1, 2 }; + ^ + { dg-end-multiline-output "" } */ + /* { dg-begin-multiline-output "" } + int a5[][0][0] = { 1, 2 }; + ^~~ + { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/gcc.dg/asan/pr81186.c b/gcc/testsuite/gcc.dg/asan/pr81186.c new file mode 100644 index 00000000000..7f0f672ca40 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr81186.c @@ -0,0 +1,18 @@ +/* PR sanitizer/81186 */ +/* { dg-do run } */ + +int +main () +{ + __label__ l; + void f () + { + int a[123]; + + goto l; + } + + f (); +l: + return 0; +} diff --git a/gcc/testsuite/gcc.dg/asan/pr81224.c b/gcc/testsuite/gcc.dg/asan/pr81224.c new file mode 100644 index 00000000000..def5cb69aec --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr81224.c @@ -0,0 +1,11 @@ +/* PR sanitizer/80659 */ +/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-additional-options "-msse2" } */ + +int a; +int +b () +{ + register __attribute__ ((__vector_size__ (4 * sizeof (int)))) int c asm("xmm0"); + return c[a]; +} diff --git a/gcc/testsuite/gcc.dg/asan/pr81460.c b/gcc/testsuite/gcc.dg/asan/pr81460.c new file mode 100644 index 00000000000..00c1bb7c9f2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/pr81460.c @@ -0,0 +1,8 @@ +/* PR sanitizer/80460 */ +/* { dg-do compile } */ + +int +f (int a, struct { int b[a]; } c) /* { dg-warning "anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" } */ +{ + return c.b[0]; +} diff --git a/gcc/testsuite/gcc.dg/atomic-pr81231.c b/gcc/testsuite/gcc.dg/atomic-pr81231.c new file mode 100644 index 00000000000..304e4281f7b --- /dev/null +++ b/gcc/testsuite/gcc.dg/atomic-pr81231.c @@ -0,0 +1,12 @@ +/* PR c/81231 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +enum E; + +void +foo (void) +{ + __atomic_load_n ((enum E *) 0, 0); /* { dg-error "incompatible" } */ + __atomic_load_n ((enum X *) 0, 0); /* { dg-error "incompatible" } */ +} diff --git a/gcc/testsuite/gcc.dg/attr-noipa.c b/gcc/testsuite/gcc.dg/attr-noipa.c new file mode 100644 index 00000000000..1d2b86894ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-noipa.c @@ -0,0 +1,188 @@ +/* Test the noipa attribute. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +static inline int __attribute__((noipa)) +fn1 (void) /* { dg-warning "inline function \[^\n\]* given attribute noinline" "" } */ +{ + return 1; +} + +/* Verify the function is not inlined into its caller. */ + +static __attribute__((noipa)) int +fn2 (int x, int y) +{ + return x + y; +} + +int +fn3 (int x) +{ + return fn2 (x, 0); +} + +/* { dg-final { scan-tree-dump "= fn2 \\(" "optimized" } } */ + +void fn4 (char *); + +/* Verify the function is not cloned. */ + +__attribute__((__noipa__)) static int +fn5 (int x, int y) +{ + char *p = __builtin_alloca (x + y); + fn4 (p); + return x + y; +} + +int +fn6 (int x) +{ + return fn5 (x, 2); +} + +/* { dg-final { scan-tree-dump "= fn5 \\(" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "fn5\\.constprop" "optimized" } } */ + +/* Verify we still remove unused function calls, even if they have + noipa attribute. */ + +static void fn7 (void) __attribute__((noipa)); +static void +fn7 (void) +{ +} + +/* { dg-final { scan-tree-dump-not "fn7 \\(" "optimized" } } */ + +/* Verify noipa functions are not ICF optimized. */ + +static __attribute__((noipa)) int +fn8 (int x) +{ + return x + 12; +} + +static __attribute__((noipa)) int +fn9 (int x) +{ + return x + 12; +} + +int +fn10 (int x) +{ + return fn8 (x) + fn9 (x); +} + +/* { dg-final { scan-tree-dump "fn8 \\(int" "optimized" } } */ +/* { dg-final { scan-tree-dump "fn9 \\(int" "optimized" } } */ + +/* Verify IPA-VRP is not performed. */ + +void fn11 (void); + +static int __attribute__((noipa)) +fn12 (int x) +{ + if (x < 6 || x >= 29) + fn11 (); +} + +void +fn13 (int x) +{ + fn12 (6 + (x & 15)); +} + +/* { dg-final { scan-tree-dump "fn11 \\(\\)" "optimized" } } */ + +void fn14 (void); + +__attribute__((noipa)) static int +fn15 (int x) +{ + return x & 7; +} + +int +fn16 (int x) +{ + x = fn15 (x); + if (x < 0 || x >= 7) + fn14 (); +} + +/* { dg-final { scan-tree-dump "fn14 \\(\\)" "optimized" } } */ + +/* Verify IPA BIT CP is not performed. */ + +void fn17 (void); + +__attribute__((noipa)) static int +fn18 (int x) +{ + if (x & 8) + fn17 (); +} + +void +fn19 (void) +{ + fn18 (1); + fn18 (2); + fn18 (4); + fn18 (16); + fn18 (32); + fn18 (64); +} + +/* { dg-final { scan-tree-dump "fn17 \\(\\)" "optimized" } } */ + +/* Ensure pure/const discovery is not performed. */ + +int var1; +void fn20 (void); + +__attribute__((noipa)) static int +fn21 (int x, int y) +{ + return x * y; +} + +int +fn22 (void) +{ + var1 = 7; + asm volatile ("" : "+g" (var1) : : "memory"); + int a = var1; + int b = fn21 (a, a); + if (a != var1) + fn20 (); + return b; +} + +/* { dg-final { scan-tree-dump "fn20 \\(\\)" "optimized" } } */ + +/* Verify IPA alignment propagation is not performed. */ + +static __attribute__ ((aligned(16))) char var2[32]; +void fn23 (void); + +__attribute__((noipa)) static void +fn24 (char *p) +{ + if ((((__UINTPTR_TYPE__) p) & 15) != 0) + fn23 (); + asm (""); +} + +void +fn25 (void) +{ + fn24 (var2); + fn24 (var2 + 16); +} + +/* { dg-final { scan-tree-dump "fn20 \\(\\)" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-6.c b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c index d2596e95c3f..2f8ca369546 100644 --- a/gcc/testsuite/gcc.dg/builtin-unreachable-6.c +++ b/gcc/testsuite/gcc.dg/builtin-unreachable-6.c @@ -16,5 +16,5 @@ lab2: goto *x; } -/* { dg-final { scan-tree-dump-times "lab \\\[\[0-9.\]+%\\\]" 1 "fab1" } } */ +/* { dg-final { scan-tree-dump-times "lab:" 1 "fab1" } } */ /* { dg-final { scan-tree-dump-times "__builtin_unreachable" 1 "fab1" } } */ diff --git a/gcc/testsuite/gcc.dg/compare1.c b/gcc/testsuite/gcc.dg/compare1.c index 17ba3ee2098..7becfbdb17f 100644 --- a/gcc/testsuite/gcc.dg/compare1.c +++ b/gcc/testsuite/gcc.dg/compare1.c @@ -37,5 +37,5 @@ int h(enum mm2 x) int i(enum mm2 x) { - return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */ + return x == (tf?DI2:-1); /* { dg-warning "different signedness" "case 4" } */ } diff --git a/gcc/testsuite/gcc.dg/compare2.c b/gcc/testsuite/gcc.dg/compare2.c index 0625eb9c3f6..c309f1d00eb 100644 --- a/gcc/testsuite/gcc.dg/compare2.c +++ b/gcc/testsuite/gcc.dg/compare2.c @@ -18,11 +18,11 @@ void f(int x, unsigned int y) /* ?: branches are signed constants. */ x > (tf?64:-1); /* { dg-bogus "signed and unsigned" "case 5" } */ - y > (tf?64:-1); /* { dg-warning "signed and unsigned" "case 6" } */ + y > (tf?64:-1); /* { dg-warning "different signedness" "case 6" } */ /* ?: branches are (recursively) signed constants. */ x > (tf?64:(tf?128:-1)); /* { dg-bogus "signed and unsigned" "case 7" } */ - y > (tf?64:(tf?128:-1)); /* { dg-warning "signed and unsigned" "case 8" } */ + y > (tf?64:(tf?128:-1)); /* { dg-warning "different signedness" "case 8" } */ /* Statement expression. */ x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */ @@ -34,11 +34,11 @@ void f(int x, unsigned int y) /* Statement expression with signed ?:. */ x > ({tf; tf?64:-1;}); /* { dg-bogus "signed and unsigned" "case 13" } */ - y > ({tf; tf?64:-1;}); /* { dg-warning "signed and unsigned" "case 14" } */ + y > ({tf; tf?64:-1;}); /* { dg-warning "different signedness" "case 14" } */ /* Statement expression with recursive signed ?:. */ x > ({tf; tf?64:(tf?128:-1);}); /* { dg-bogus "signed and unsigned" "case 15" } */ - y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "signed and unsigned" "case 16" } */ + y > ({tf; tf?64:(tf?128:-1);}); /* { dg-warning "different signedness" "case 16" } */ /* ?: branches are constants. */ tf ? x : (tf?64:32); /* { dg-bogus "conditional expression" "case 17" } */ diff --git a/gcc/testsuite/gcc.dg/compare4.c b/gcc/testsuite/gcc.dg/compare4.c index e5dad4d1e45..299d488edf6 100644 --- a/gcc/testsuite/gcc.dg/compare4.c +++ b/gcc/testsuite/gcc.dg/compare4.c @@ -10,7 +10,7 @@ int foo(int x, int y, unsigned u) { /* A COMPOUND_EXPR is non-negative if the last element is known to be non-negative. */ - if (u < (bar(), -1)) /*{ dg-warning "9:signed and unsigned" "COMPOUND_EXPR" }*/ + if (u < (bar(), -1)) /*{ dg-warning "9:different signedness" "COMPOUND_EXPR" }*/ return x; if (u < (bar(), 10)) return x; @@ -34,7 +34,7 @@ int foo(int x, int y, unsigned u) /* A MODIFY_EXPR is non-negative if the new value is known to be non-negative. */ - if (u < (x = -1)) /* { dg-warning "9:signed and unsigned" "MODIFY_EXPR" } */ + if (u < (x = -1)) /* { dg-warning "9:different signedness" "MODIFY_EXPR" } */ return x; if (u < (x = 10)) return x; diff --git a/gcc/testsuite/gcc.dg/compare5.c b/gcc/testsuite/gcc.dg/compare5.c index f19c575efb7..3a502f12de9 100644 --- a/gcc/testsuite/gcc.dg/compare5.c +++ b/gcc/testsuite/gcc.dg/compare5.c @@ -10,7 +10,7 @@ int foo(int x, int y, unsigned u) { /* A *_DIV_EXPR is non-negative if both operands are. */ - if (u < ((x=-22)/33)) /* { dg-warning "signed and unsigned" "DIV_EXPR" } */ + if (u < ((x=-22)/33)) /* { dg-warning "different signedness" "DIV_EXPR" } */ return x; if (u < ((x=22)/33)) @@ -25,7 +25,7 @@ int foo(int x, int y, unsigned u) /* A *_MOD_EXPR is non-negative if the first operand is. */ - if (u < ((x=-22)%33)) /* { dg-warning "signed and unsigned" "MOD_EXPR" } */ + if (u < ((x=-22)%33)) /* { dg-warning "different signedness" "MOD_EXPR" } */ return x; if (u < ((x=22)%-33)) diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c index dac4405b36c..efa3fa0b1f2 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/stacked-qualified-types-3.c @@ -31,4 +31,4 @@ char * _Atomic restrict h; char * _Atomic i; char * restrict j; -/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_(?:const|volatile|atomic|restrict)_type" 8 { xfail { powerpc-ibm-aix* } } } } */ +/* { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_(?:const|volatile|atomic|restrict)_type" 8 } } */ diff --git a/gcc/testsuite/gcc.dg/fixed-point/pr81428.c b/gcc/testsuite/gcc.dg/fixed-point/pr81428.c new file mode 100644 index 00000000000..98f4b235718 --- /dev/null +++ b/gcc/testsuite/gcc.dg/fixed-point/pr81428.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/81428 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +void +foo (long _Fract *a, long _Fract *b) +{ + *b = *a / *a; +} diff --git a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c index cab30f2d7f6..8cce5b38c9f 100644 --- a/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c +++ b/gcc/testsuite/gcc.dg/format/diagnostic-ranges.c @@ -278,7 +278,7 @@ void test_macro_3 (const char *msg) printf(FMT_STRING, msg); /* { dg-message "10: in expansion of macro 'FMT_STRING" } */ /* { dg-begin-multiline-output "" } #define FMT_STRING "hello %i world" - ^ + ^~~~~~~~~~~~~~~~ { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } printf(FMT_STRING, msg); @@ -293,7 +293,7 @@ void test_macro_4 (const char *msg) printf(FMT_STRING "\n", msg); /* { dg-message "10: in expansion of macro 'FMT_STRING" } */ /* { dg-begin-multiline-output "" } #define FMT_STRING "hello %i world" - ^ + ^~~~~~~~~~~~~~~~ { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } printf(FMT_STRING "\n", msg); diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c b/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c index cd9d8ebcb16..ca91af471ca 100644 --- a/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c +++ b/gcc/testsuite/gcc.dg/graphite/run-id-pr47653.c @@ -1,3 +1,4 @@ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic -ftree-pre -fgraphite-identity" } */ /* nvptx doesn't expose a stack. */ /* { dg-skip-if "" { nvptx-*-* } } */ diff --git a/gcc/testsuite/gcc.dg/guality/pr68037-1.c b/gcc/testsuite/gcc.dg/guality/pr68037-1.c index 74f61ec5f96..44cab58659f 100644 --- a/gcc/testsuite/gcc.dg/guality/pr68037-1.c +++ b/gcc/testsuite/gcc.dg/guality/pr68037-1.c @@ -59,9 +59,9 @@ main () return 0; } -/* { dg-final { gdb-test 31 "error" "0x12345670" } } */ -/* { dg-final { gdb-test 31 "frame->ip" "0x12345671" } } */ -/* { dg-final { gdb-test 31 "frame->cs" "0x12345672" } } */ -/* { dg-final { gdb-test 31 "frame->flags" "0x12345673" } } */ -/* { dg-final { gdb-test 31 "frame->sp" "0x12345674" } } */ -/* { dg-final { gdb-test 31 "frame->ss" "0x12345675" } } */ +/* { dg-final { gdb-test 33 "error" "0x12345670" } } */ +/* { dg-final { gdb-test 33 "frame->ip" "0x12345671" } } */ +/* { dg-final { gdb-test 33 "frame->cs" "0x12345672" } } */ +/* { dg-final { gdb-test 33 "frame->flags" "0x12345673" } } */ +/* { dg-final { gdb-test 33 "frame->sp" "0x12345674" } } */ +/* { dg-final { gdb-test 33 "frame->ss" "0x12345675" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c new file mode 100644 index 00000000000..01b09764097 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-18.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fipa-pta -fdump-ipa-pta2-details -fdump-tree-fre3-details" } */ + +static int __attribute__((noipa)) +foo (int *p, int *q) +{ + *p = 1; + *q = 0; + return *p; +} + +extern void abort (void); + +int main() +{ + int a, b; + if (foo (&a, &b) != 1) + abort (); + return 0; +} + +/* Verify we can disambiguate *p and *q in foo. */ + +/* { dg-final { scan-ipa-dump "foo.arg0 = &a" "pta2" } } */ +/* { dg-final { scan-ipa-dump "foo.arg1 = &b" "pta2" } } */ +/* { dg-final { scan-tree-dump-not "Replaced \\\*p_2\\\(D\\\) with 1" "fre3" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c b/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c new file mode 100644 index 00000000000..e91423a62fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipa-sra-11.c @@ -0,0 +1,39 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fipa-sra -fdump-tree-eipa_sra-details" } */ + +struct bovid +{ + float red; + int green; + void *blue; +}; + +extern int printf (const char *, ...); +extern void abort (void); + +static int +__attribute__((noipa)) +ox (struct bovid cow) +{ + if (cow.green != 6) + abort (); + + printf ("green: %f\nblue: %p\nblue again: %p\n", cow.green, + cow.blue, cow.blue); + return 0; +} + +int +main (int argc, char *argv[]) +{ + struct bovid cow; + + cow.red = 7.4; + cow.green = 6; + cow.blue = &cow; + + ox (cow); + return 0; +} + +/* { dg-final { scan-tree-dump-not "About to replace expr" "eipa_sra" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/pr81520.c b/gcc/testsuite/gcc.dg/ipa/pr81520.c new file mode 100644 index 00000000000..b5d33d2dc96 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr81520.c @@ -0,0 +1,11 @@ +/* PR ipa/81520 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fPIC" } */ +/* { dg-require-effective-target fpic } */ + +char +a (int b) +{ + a (b); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-1.c b/gcc/testsuite/gcc.dg/missing-header-fixit-1.c new file mode 100644 index 00000000000..2b28357e1db --- /dev/null +++ b/gcc/testsuite/gcc.dg/missing-header-fixit-1.c @@ -0,0 +1,36 @@ +/* Example of a fix-it hint that adds a #include directive, + adding them to the top of the file, given that there is no + pre-existing #include. */ + +/* This is padding (to avoid the generated patch containing DejaGnu + directives). */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +void test (int i, int j) +{ + printf ("%i of %i\n", i, j); /* { dg-warning "implicit declaration" } */ + /* { dg-message "include '<stdio.h>' or provide a declaration of 'printf'" "" { target *-*-* } .-1 } */ +} + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing this + source filename, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ +/* Use #if 0/#endif rather than comments, to allow the text to contain + a comment. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -1,3 +1,4 @@ ++#include <stdio.h> + /* Example of a fix-it hint that adds a #include directive, + adding them to the top of the file, given that there is no + pre-existing #include. */ +{ dg-end-multiline-output "" } +#endif + +/* FIXME: should we attempt to skip leading comments when determining the + insertion location? + Similarly, should we attempt to be within single-inclusion guards, etc? */ diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-2.c b/gcc/testsuite/gcc.dg/missing-header-fixit-2.c new file mode 100644 index 00000000000..5d5f87488f5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/missing-header-fixit-2.c @@ -0,0 +1,31 @@ +/* Verify that when we suggest adding #include directives that they + are added to the affected file. */ + +/* The following header file is missing a "#include <stdio.h>". */ + +#include "missing-header-fixit-2.h" + +/* These directives actually apply to the header. */ +/* { dg-warning "implicit declaration of function 'printf'" "" { target *-*-* } 6 } */ +/* { dg-warning "incompatible implicit declaration of built-in function 'printf'" "" { target *-*-* } 6 } */ + +/* { dg-options "-fdiagnostics-generate-patch" } */ + +/* Verify the output from -fdiagnostics-generate-patch. + We expect the patch to begin with a header, containing the + filename of the header, via an absolute path. + Given the path, we can only capture it via regexps. */ +/* { dg-regexp "\\-\\-\\- .*" } */ +/* { dg-regexp "\\+\\+\\+ .*" } */ +/* Use #if 0/#endif rather than comments, to allow the text to contain + a comment. + We expect the *header* to have been patched, adding the missing include. */ +#if 0 +{ dg-begin-multiline-output "" } +@@ -1,3 +1,4 @@ ++#include <stdio.h> + /* This is missing-header-fixit-2.h, for use by + missing-header-fixit-2.c */ + +{ dg-end-multiline-output "" } +#endif diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-2.h b/gcc/testsuite/gcc.dg/missing-header-fixit-2.h new file mode 100644 index 00000000000..c0bf55dcbe6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/missing-header-fixit-2.h @@ -0,0 +1,7 @@ +/* This is missing-header-fixit-2.h, for use by + missing-header-fixit-2.c */ + +void test (int i, int j) +{ + printf ("%i of %i\n", i, j); +} diff --git a/gcc/testsuite/gcc.dg/overflow-warn-1.c b/gcc/testsuite/gcc.dg/overflow-warn-1.c index 8eb322579cf..a5cd5738636 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-1.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-1.c @@ -49,7 +49,7 @@ static int sc = INT_MAX + 1; /* { dg-warning "25:integer overflow in expression" void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */ +/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-2.c b/gcc/testsuite/gcc.dg/overflow-warn-2.c index f048d6dae2a..05ab104fa4a 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-2.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-2.c @@ -49,7 +49,7 @@ static int sc = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-1 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */ +/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-3.c b/gcc/testsuite/gcc.dg/overflow-warn-3.c index 664011e401d..fd4a34f67e2 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-3.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-3.c @@ -55,7 +55,7 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } /* { dg-warning "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */ +/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */ /* { dg-warning "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/overflow-warn-4.c b/gcc/testsuite/gcc.dg/overflow-warn-4.c index 52677ce897a..018e3e1e4cd 100644 --- a/gcc/testsuite/gcc.dg/overflow-warn-4.c +++ b/gcc/testsuite/gcc.dg/overflow-warn-4.c @@ -55,7 +55,7 @@ void *p = 0 * (INT_MAX + 1); /* { dg-warning "integer overflow in expression" } /* { dg-error "overflow in constant expression" "constant" { target *-*-* } .-1 } */ /* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *q = 0 * (1 / 0); /* { dg-warning "division by zero" } */ -/* { dg-error "initializer element is not computable at load time" "constant" { target *-*-* } .-1 } */ +/* { dg-error "initializer element is not constant" "constant" { target *-*-* } .-1 } */ /* { dg-error "initialization makes pointer from integer without a cast" "null" { target *-*-* } .-2 } */ void *r = (1 ? 0 : INT_MAX+1); diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c index b0dbc05bc1d..03b78042107 100644 --- a/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c +++ b/gcc/testsuite/gcc.dg/plugin/diagnostic-test-expressions-1.c @@ -708,3 +708,82 @@ baz"); ~~~~ { dg-end-multiline-output "" } */ } + +/* Various tests of locations involving macros. */ + +void test_within_macro_1 (int lhs, int rhs) +{ +#define MACRO_1(EXPR) EXPR + + __emit_expression_range (0, MACRO_1 (lhs == rhs)); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_1 (lhs == rhs)); + ~~~~^~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_1(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_1 +} + +void test_within_macro_2 (int lhs, int rhs) +{ +#define MACRO_2(EXPR) EXPR + + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + ~~~~^~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_2 (MACRO_2 (lhs == rhs))); + ^~~~~~~ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_2(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_2 +} + +void test_within_macro_3 (int lhs, int rhs) +{ +#define MACRO_3(EXPR) EXPR + + __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs)); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_3 (lhs) == MACRO_3 (rhs)); + ^ + { dg-end-multiline-output "" } */ + +#undef MACRO_3 +} + +void test_within_macro_4 (int lhs, int rhs) +{ +#define MACRO_4(EXPR) EXPR + + __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs))); + +/* { dg-warning "range" "" { target *-*-* } .-2 } */ +/* { dg-begin-multiline-output "" } + __emit_expression_range (0, MACRO_4 (MACRO_4 (lhs) == MACRO_4 (rhs))); + ^ + { dg-end-multiline-output "" } */ +/* { dg-begin-multiline-output "" } + #define MACRO_4(EXPR) EXPR + ^~~~ + { dg-end-multiline-output "" } */ + +#undef MACRO_4 +} + diff --git a/gcc/testsuite/gcc.dg/pr35430.c b/gcc/testsuite/gcc.dg/pr35430.c index ab5e4cac8a5..7365ccfcf94 100644 --- a/gcc/testsuite/gcc.dg/pr35430.c +++ b/gcc/testsuite/gcc.dg/pr35430.c @@ -6,5 +6,5 @@ void foo (__complex__ int i) { i == 0u; - i == ~1u; /* { dg-warning "comparison between signed and unsigned integer expressions" } */ + i == ~1u; /* { dg-warning "comparison of integer expressions of different signedness" } */ } diff --git a/gcc/testsuite/gcc.dg/pr44290-1.c b/gcc/testsuite/gcc.dg/pr44290-1.c index c036db654f3..05d2454fc31 100644 --- a/gcc/testsuite/gcc.dg/pr44290-1.c +++ b/gcc/testsuite/gcc.dg/pr44290-1.c @@ -1,4 +1,5 @@ -/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */ +/* { dg-do compile } */ +/* { dg-require-effective-target naked_functions } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ static void __attribute__((naked)) diff --git a/gcc/testsuite/gcc.dg/pr44290-2.c b/gcc/testsuite/gcc.dg/pr44290-2.c index 17615366267..07335109114 100644 --- a/gcc/testsuite/gcc.dg/pr44290-2.c +++ b/gcc/testsuite/gcc.dg/pr44290-2.c @@ -1,4 +1,5 @@ -/* { dg-do compile { target arm*-*-* avr-*-* mcore-*-* rx-*-* spu-*-* } } */ +/* { dg-do compile } */ +/* { dg-require-effective-target naked_functions } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ static unsigned long __attribute__((naked)) diff --git a/gcc/testsuite/gcc.dg/pr46932.c b/gcc/testsuite/gcc.dg/pr46932.c new file mode 100644 index 00000000000..b96febcc095 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46932.c @@ -0,0 +1,13 @@ +/* { dg-options "-O2 -fdump-rtl-auto_inc_dec" } */ + +/* Check that accesses based on the frame pointer do not + use auto increment. */ + +extern void foo(char*); +void t01(char t) +{ + char c = t; + foo(&c); +} + +/* { dg-final { scan-rtl-dump-not "success" "auto_inc_dec" } } */ diff --git a/gcc/testsuite/gcc.dg/pr47443.c b/gcc/testsuite/gcc.dg/pr47443.c index 47abea27dd7..5a5c43f2537 100644 --- a/gcc/testsuite/gcc.dg/pr47443.c +++ b/gcc/testsuite/gcc.dg/pr47443.c @@ -1,5 +1,6 @@ /* PR tree-optimization/47443 */ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic" } */ static inline int bar (char *c, int i) diff --git a/gcc/testsuite/gcc.dg/pr48134.c b/gcc/testsuite/gcc.dg/pr48134.c index 8dc5a6d0d41..446ad01b452 100644 --- a/gcc/testsuite/gcc.dg/pr48134.c +++ b/gcc/testsuite/gcc.dg/pr48134.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "specific" } */ /* { dg-options "-O2 -fstack-check=specific -fno-tree-dse -fno-tree-fre -fno-tree-loop-optimize -g" } */ struct S diff --git a/gcc/testsuite/gcc.dg/pr56727-1.c b/gcc/testsuite/gcc.dg/pr56727-1.c new file mode 100644 index 00000000000..ffc133545e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56727-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ +/* { dg-final { scan-assembler-not "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-* } } } */ + +#define define_func(type) \ + void f_ ## type (type b) { f_ ## type (0); } \ + void __attribute__((noinline, noclone)) f_noinline_ ## type (type b) \ + { f_noinline_ ## type (0); } + +define_func(char) +define_func(short) +define_func(int) +define_func(long) + +int foo(int n) +{ + return (n == 1 || n == 2) ? 1 : foo(n-1) * foo(n-2); +} + +int __attribute__((noinline, noclone)) foo_noinline(int n) +{ + return (n == 1 || n == 2) ? 1 : foo_noinline(n-1) * foo_noinline(n-2); +} diff --git a/gcc/testsuite/gcc.dg/pr56727-2.c b/gcc/testsuite/gcc.dg/pr56727-2.c new file mode 100644 index 00000000000..e47ee3cd96b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56727-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target fpic } } */ +/* { dg-options "-O2 -fPIC" } */ +/* { dg-final { scan-assembler "@(PLT|plt)" { target i?86-*-* x86_64-*-* powerpc*-*-linux* } } } */ + +__attribute__((noinline, noclone)) +void f (short b) +{ + f (0); +} + +static void g (short) __attribute__ ((alias ("f"))); + +void h () +{ + g (0); +} diff --git a/gcc/testsuite/gcc.dg/pr60087.c b/gcc/testsuite/gcc.dg/pr60087.c index 9cdd5897354..c6cf7aa4607 100644 --- a/gcc/testsuite/gcc.dg/pr60087.c +++ b/gcc/testsuite/gcc.dg/pr60087.c @@ -10,5 +10,5 @@ foo (unsigned int ui, int i) b = 0 != ~uc; /* { dg-warning "9:promoted ~unsigned is always non-zero" } */ b = 2 != ~uc; /* { dg-warning "9:comparison of promoted ~unsigned with constant" } */ b = uc == ~uc; /* { dg-warning "10:comparison of promoted ~unsigned with unsigned" } */ - b = i == ui; /* { dg-warning "9:comparison between signed and unsigned integer expressions" } */ + b = i == ui; /* { dg-warning "9:comparison of integer expressions of different signedness" } */ } diff --git a/gcc/testsuite/gcc.dg/pr70017.c b/gcc/testsuite/gcc.dg/pr70017.c index f544167612b..3489d5baf48 100644 --- a/gcc/testsuite/gcc.dg/pr70017.c +++ b/gcc/testsuite/gcc.dg/pr70017.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-fstack-check=generic" } */ /* Check that the expected warning is issued for large frames. */ diff --git a/gcc/testsuite/gcc.dg/pr70920-2.c b/gcc/testsuite/gcc.dg/pr70920-2.c index 2db9897bad5..98072247e94 100644 --- a/gcc/testsuite/gcc.dg/pr70920-2.c +++ b/gcc/testsuite/gcc.dg/pr70920-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-forwprop-details" } */ +/* { dg-options "-O2 -fdump-tree-ccp1-details" } */ #include <stdint.h> @@ -18,4 +18,4 @@ foo (int *a) } } -/* { dg-final { scan-tree-dump "gimple_simplified to if \\(a_\[0-9\]*\\(D\\) == 0B\\)" "forwprop1" } } */ +/* { dg-final { scan-tree-dump "gimple_simplified to if \\(a_\[0-9\]*\\(D\\) == 0B\\)" "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr70920-4.c b/gcc/testsuite/gcc.dg/pr70920-4.c index e9c2b9587e5..70973cb162a 100644 --- a/gcc/testsuite/gcc.dg/pr70920-4.c +++ b/gcc/testsuite/gcc.dg/pr70920-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target lp64 } */ -/* { dg-options "-O2 -fdump-tree-forwprop-details -Wno-int-to-pointer-cast" } */ +/* { dg-options "-O2 -fdump-tree-ccp1 -Wno-int-to-pointer-cast" } */ #include <stdint.h> @@ -19,4 +19,4 @@ foo (int a) } } -/* { dg-final { scan-tree-dump "if \\(_\[0-9\]* == 0\\)" "forwprop1" } } */ +/* { dg-final { scan-tree-dump "if \\(a_\[0-9\]*\\(D\\) == 0\\)" "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr81030.c b/gcc/testsuite/gcc.dg/pr81030.c new file mode 100644 index 00000000000..23da6e528ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81030.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ + +void __assert_fail (const char *, const char *, unsigned int, const char *); + +int a, b, c, d, e, f, h; +unsigned char g; + +int main () +{ + int i, *j = &b; + if (a) + { + if (h) + { + int **k = &j; + d = 0; + *k = &e; + } + else + for (b = 0; b > -28; b = g) + ; + c || !j ? : __assert_fail ("c || !j", "small.c", 20, "main"); + if (f) + for (i = 0; i < 1; i++) + ; + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr81192.c b/gcc/testsuite/gcc.dg/pr81192.c new file mode 100644 index 00000000000..57eb4781d4d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81192.c @@ -0,0 +1,22 @@ +/* { dg-options "-Os -fdump-tree-pre-details" } */ + +unsigned a; +int b, c; + +static int +fn1 (int p1, int p2) +{ + return p1 > 2147483647 - p2 ? p1 : p1 + p2; +} + +void +fn2 (void) +{ + int j; + a = 30; + for (; a;) + for (; c; b = fn1 (j, 1)) + ; +} + +/* { dg-final { scan-tree-dump-times "(?n)find_duplicates: <bb .*> duplicate of <bb .*>" 1 "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/pr81227.c b/gcc/testsuite/gcc.dg/pr81227.c new file mode 100644 index 00000000000..bdaa8cbab2b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81227.c @@ -0,0 +1,22 @@ +/* Copy of gcc.c-torture/compile/pr80443.c */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fwrapv" } */ + +struct S { int a : 1; } b, c; +signed char d, e, f; + +void +foo () +{ + while (f) + { + signed char g = b.a; + if (g) + b.a = ~(1 + (d || c.a)); + if (b.a < g && b.a) + g = 0; + if (b.a > c.a) + b.a = g; + c.a = e; + } +} diff --git a/gcc/testsuite/gcc.dg/pr81292-1.c b/gcc/testsuite/gcc.dg/pr81292-1.c new file mode 100644 index 00000000000..931e4c37c17 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81292-1.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +char a[10]; + +int __attribute__ ((noinline, noclone)) +f1 (int n) +{ + a[0] = '1'; + a[1] = '2'; + return strlen (a + 1) < n ? strlen (a) : 100; +} + +int __attribute__ ((noinline, noclone)) +f2 (char *a, int n) +{ + a[0] = '1'; + a[1] = '2'; + return strlen (a + 1) < n ? strlen (a) : 100; +} + +int +main (void) +{ + char b[10]; + strcpy (a + 2, "345"); + strcpy (b + 2, "34567"); + if (f1 (100) != 5 || f2 (b, 100) != 7) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/pr81292-2.c b/gcc/testsuite/gcc.dg/pr81292-2.c new file mode 100644 index 00000000000..c1c507f982e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81292-2.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +char a[] = { 0, 'a', 0, 'b', 'c', 0, 'd', 'e', 'f', 0 }; + +int __attribute__ ((noinline, noclone)) +f1 (void) +{ + a[0] = '1'; + a[strlen (a)] = '2'; + a[strlen (a)] = '3'; + return strlen (a); +} + +int __attribute__ ((noinline, noclone)) +f2 (char *a) +{ + a[0] = '1'; + a[strlen (a)] = '2'; + a[strlen (a)] = '3'; + return strlen (a); +} + +int +main (void) +{ + char b[] = { 0, 0, 'a', 'b', 0, 0 }; + if (f1 () != 9 || f2 (b) != 5) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 6 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/pr81345.c b/gcc/testsuite/gcc.dg/pr81345.c new file mode 100644 index 00000000000..c2cbad72967 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81345.c @@ -0,0 +1,17 @@ +/* PR other/81345 - -Wall resets -Wstringop-overflow to 1 from the default 2 + { dg-do compile } + { dg-options "-O2 -Wall" } */ + +char a[3]; + +void f (const char *s) +{ + __builtin_strncpy (a, s, sizeof a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */ +} + +struct S { char a[3]; int i; }; + +void g (struct S *d, const char *s) +{ + __builtin_strncpy (d->a, s, sizeof d->a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr81455.c b/gcc/testsuite/gcc.dg/pr81455.c new file mode 100644 index 00000000000..8ab88639ee8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81455.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -funswitch-loops" } */ + +void +jh (unsigned int aw, int sn) +{ + int xs; + + for (xs = 0; xs < 1; ++xs) + aw &= 1; + + while (aw < 1 || ++sn < 1) + { + } +} diff --git a/gcc/testsuite/gcc.dg/pr81564.c b/gcc/testsuite/gcc.dg/pr81564.c new file mode 100644 index 00000000000..13519991f17 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81564.c @@ -0,0 +1,21 @@ +/* PR middle-end/81564 ICE in group_case_labels_stmt(). */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct a { + int b; + int c; +}; + +void +foo (void) +{ + struct a *e; + switch (e->c) + { + case 7: + case 3: + if (__builtin_expect(!0, 0)) + __builtin_unreachable(); + } +} diff --git a/gcc/testsuite/gcc.dg/pr81578.c b/gcc/testsuite/gcc.dg/pr81578.c new file mode 100644 index 00000000000..a6ef77f20c0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81578.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/81578 */ +/* { dg-do compile { target pthread } } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2" } */ + +int +foo (int *x) +{ + int i, r = 1; + for (i = 0; i != 1024; i++) + r *= x[i] < 0; + return r; +} diff --git a/gcc/testsuite/gcc.dg/predict-15.c b/gcc/testsuite/gcc.dg/predict-15.c new file mode 100644 index 00000000000..2a8c3ea8597 --- /dev/null +++ b/gcc/testsuite/gcc.dg/predict-15.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ + +int main(int argc, char **argv) +{ + if (argc == 123) + goto exit; + else + { + return 0; + } + +exit: + return 1; +} + +/* { dg-final { scan-tree-dump "goto heuristics of edge" "profile_estimate"} } */ diff --git a/gcc/testsuite/gcc.dg/predict-8.c b/gcc/testsuite/gcc.dg/predict-8.c index edead8d90b1..e13cc006f3a 100644 --- a/gcc/testsuite/gcc.dg/predict-8.c +++ b/gcc/testsuite/gcc.dg/predict-8.c @@ -8,4 +8,4 @@ int foo(float a, float b) { return 2; } -/* { dg-final { scan-rtl-dump-times "REG_BR_PROB 100" 1 "expand"} } */ +/* { dg-final { scan-rtl-dump-times "REG_BR_PROB 400 " 1 "expand"} } */ diff --git a/gcc/testsuite/gcc.dg/spellcheck-fields-2.c b/gcc/testsuite/gcc.dg/spellcheck-fields-2.c index 7c542145b07..76684f71c80 100644 --- a/gcc/testsuite/gcc.dg/spellcheck-fields-2.c +++ b/gcc/testsuite/gcc.dg/spellcheck-fields-2.c @@ -28,7 +28,7 @@ int test_macro (union u *ptr) /* { dg-begin-multiline-output "" } #define FIELD colour - ^ + ^~~~~~ { dg-end-multiline-output "" } */ /* { dg-begin-multiline-output "" } diff --git a/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c b/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c index 9f2d37daa8b..7e59f28031a 100644 --- a/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c +++ b/gcc/testsuite/gcc.dg/stack-layout-dynamic-1.c @@ -1,15 +1,15 @@ -/* Verify that run time aligned local variables are aloocated in the prologue +/* Verify that run time aligned local variables are allocated in the prologue in one pass together with normal local variables. */ /* { dg-do compile } */ /* { dg-options "-O0 -fomit-frame-pointer" } */ /* { dg-require-effective-target ptr32plus } */ -extern void bar (void *, void *, void *); +extern void bar (void *, void *, void *, void *, void *, void *, void *); void foo (void) { - int i; + int i, j, k, l, m; __attribute__ ((aligned(65536))) char runtime_aligned_1[512]; __attribute__ ((aligned(32768))) char runtime_aligned_2[1024]; - bar (&i, &runtime_aligned_1, &runtime_aligned_2); + bar (&i, &j, &k, &l, &m, &runtime_aligned_1, &runtime_aligned_2); } /* { dg-final { scan-assembler-not "cfi_def_cfa_register" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-31.c b/gcc/testsuite/gcc.dg/strlenopt-31.c new file mode 100644 index 00000000000..bdd46ba0000 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-31.c @@ -0,0 +1,25 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include "strlenopt.h" + +__attribute__((noinline, noclone)) int +bar (char *p1, const char *q) +{ + strcpy (p1, "abcde"); + char *p2 = strchr (p1, '\0'); + strcpy (p2, q); + char *p3 = strchr (p2, '\0'); + memcpy (p3, "x", 2); + return strlen (p1); +} + +int +main (void) +{ + char buffer[10]; + int res = bar (buffer, "foo"); + if (strcmp (buffer, "abcdefoox") != 0 || res != 9) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/strlenopt-31g.c b/gcc/testsuite/gcc.dg/strlenopt-31g.c new file mode 100644 index 00000000000..45cc29c1024 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-31g.c @@ -0,0 +1,9 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#define USE_GNU +#include "strlenopt-31.c" + +/* { dg-final { scan-tree-dump-times "stpcpy \\(" 1 "strlen" } } */ +/* { dg-final { scan-tree-dump-times "memcpy \\(" 2 "strlen" } } */ +/* { dg-final { scan-tree-dump-not "strlen \\(" "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-32.c b/gcc/testsuite/gcc.dg/strlenopt-32.c new file mode 100644 index 00000000000..08eb6bc2b08 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-32.c @@ -0,0 +1,193 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +char temp[30]; +volatile int v; + +size_t __attribute__ ((noinline, noclone)) +f1 (void) +{ + char a[30]; + v += 1; + memcpy (a, "1234567", 7); + memcpy (a + 7, "89abcdefg", 9); + memcpy (a + 16, "h", 2); + return strlen (a); // This strlen should be optimized into 17. +} + +size_t __attribute__ ((noinline, noclone)) +f2 (char *a) +{ + v += 2; + memcpy (a, "1234567", 7); + memcpy (a + 7, "89abcdefg", 9); + memcpy (a + 16, "h", 2); + return strlen (a); // This strlen should be optimized into 17. +} + +size_t __attribute__ ((noinline, noclone)) +f3 (void) +{ + char a[30]; + v += 3; + a[0] = '1'; + memcpy (a + 1, "2345678", 8); + return strlen (a); // This strlen should be optimized into 8. +} + +size_t __attribute__ ((noinline, noclone)) +f4 (char *a) +{ + v += 4; + a[0] = '1'; + memcpy (a + 1, "2345678", 8); + return strlen (a); // This strlen should be optimized into 8. +} + +size_t __attribute__ ((noinline, noclone)) +f5 (void) +{ + char a[30]; + v += 5; + a[0] = '1'; + a[1] = '2'; + a[2] = '3'; + memcpy (a + 3, "456", 3); + a[6] = '7'; + a[7] = 0; + return strlen (a); // This strlen should be optimized into 7. +} + +size_t __attribute__ ((noinline, noclone)) +f6 (char *a) +{ + v += 6; + a[0] = '1'; + a[1] = '2'; + a[2] = '3'; + memcpy (a + 3, "456", 3); + a[6] = '7'; + a[7] = 0; + return strlen (a); // This strlen should be optimized into 7. +} + +size_t __attribute__ ((noinline, noclone)) +f7 (void) +{ + char a[30]; + v += 7; + strcpy (a, "abcde"); + int len1 = strlen (a); + a[2] = '_'; + int len2 = strlen (a); + return len1 + len2; // This should be optimized into 10. +} + +size_t __attribute__ ((noinline, noclone)) +f8 (char *a) +{ + v += 8; + strcpy (a, "abcde"); + int len1 = strlen (a); + a[2] = '_'; + int len2 = strlen (a); + return len1 + len2; // This should be optimized into 10. +} + +size_t __attribute__ ((noinline, noclone)) +f9 (char b) +{ + char a[30]; + v += 9; + strcpy (a, "foo.bar"); + a[4] = b; + a[3] = 0; + return strlen (a); // This should be optimized into 3. +} + +size_t __attribute__ ((noinline, noclone)) +f10 (char *a, char b) +{ + v += 10; + strcpy (a, "foo.bar"); + a[4] = b; + a[3] = 0; + return strlen (a); // This should be optimized into 3. +} + +size_t __attribute__ ((noinline, noclone)) +f11 (void) +{ + char a[30]; + v += 11; + strcpy (temp, "123456"); + memcpy (a, temp, 7); + return strlen (a); // This should be optimized into 6. +} + +size_t __attribute__ ((noinline, noclone)) +f12 (char *a) +{ + v += 12; + strcpy (temp, "123456"); + memcpy (a, temp, 7); + return strlen (a); // This should be optimized into 6. +} + +size_t __attribute__ ((noinline, noclone)) +f13 (void) +{ + char a[30]; + v += 13; + strcpy (temp, "1234567"); + memcpy (a, temp, 7); + a[7] = 0; + return strlen (a); // This should be optimized into 7. +} + +size_t __attribute__ ((noinline, noclone)) +f14 (char *a) +{ + v += 14; + strcpy (temp, "1234567"); + memcpy (a, temp, 7); + a[7] = 0; + return strlen (a); // This should be optimized into 7. +} + +size_t __attribute__ ((noinline, noclone)) +f15 (void) +{ + char a[30]; + v += 15; + strcpy (temp, "12345679"); + memcpy (a, temp, 7); + a[7] = 0; + return strlen (a); // This should be optimized into 7. +} + +size_t __attribute__ ((noinline, noclone)) +f16 (char *a) +{ + v += 16; + strcpy (temp, "123456789"); + memcpy (a, temp, 7); + a[7] = 0; + return strlen (a); // This should be optimized into 7. +} + +int +main () +{ + char a[30]; + if (f1 () != 17 || f2 (a) != 17 || f3 () != 8 || f4 (a) != 8 + || f5 () != 7 || f6 (a) != 7 || f7 () != 10 || f8 (a) != 10 + || f9 ('_') != 3 || f10 (a, '_') != 3 || f11 () != 6 || f12 (a) != 6 + || f13 () != 7 || f14 (a) != 7 || f15 () != 7 || f16 (a) != 7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-33.c b/gcc/testsuite/gcc.dg/strlenopt-33.c new file mode 100644 index 00000000000..1e1c4dee1f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-33.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +volatile int v; + +size_t __attribute__ ((noinline, noclone)) +f1 (char *b) +{ + char a[30]; + v += 1; + strcpy (a, b); + // This needs to stay. + int len1 = strlen (a); + a[0] = '_'; + a[1] = 0; + return len1 + strlen (a); +} + +size_t __attribute__ ((noinline, noclone)) +f2 (char *a, char *b) +{ + v += 2; + strcpy (a, b); + // This needs to stay. + int len1 = strlen (a); + a[0] = '_'; + a[1] = 0; + return len1 + strlen (a); +} + +int +main () +{ + char a[30]; + if (f1 ("foo") != 4 || f2 (a, "foobar") != 7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-33g.c b/gcc/testsuite/gcc.dg/strlenopt-33g.c new file mode 100644 index 00000000000..0223f82f1d1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-33g.c @@ -0,0 +1,45 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#define USE_GNU +#include "strlenopt.h" + +volatile int v; + +size_t __attribute__ ((noinline, noclone)) +f1 (char *b) +{ + char a[30]; + v += 1; + // Should be converted to stpcpy. + strcpy (a, b); + int len1 = strlen (a); + a[0] = '_'; + a[1] = 0; + return len1 + strlen (a); +} + +size_t __attribute__ ((noinline, noclone)) +f2 (char *a, char *b) +{ + v += 2; + // Should be converted to stpcpy. + strcpy (a, b); + int len1 = strlen (a); + a[0] = '_'; + a[1] = 0; + return len1 + strlen (a); +} + +int +main () +{ + char a[30]; + if (f1 ("foo") != 4 || f2 (a, "foobar") != 7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 0 "strlen" } } */ +/* { dg-final { scan-tree-dump-times "stpcpy \\(" 2 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-34.c b/gcc/testsuite/gcc.dg/strlenopt-34.c new file mode 100644 index 00000000000..c9433c0399e --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-34.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +volatile int v; + +size_t __attribute__ ((noinline, noclone)) +f1 (char b) +{ + char a[30]; + v += 1; + strcpy (a, "foo.bar"); + a[3] = b; + a[4] = 0; + return strlen (a); +} + +size_t __attribute__ ((noinline, noclone)) +f2 (char *a, char b) +{ + v += 2; + strcpy (a, "foo.bar"); + a[3] = b; + a[4] = 0; + return strlen (a); +} + +int +main () +{ + char a[30]; + if (f1 ('_') != 4 || f1 (0) != 3 || f2 (a, '_') != 4 || f2 (a, 0) != 3) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 2 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/strlenopt-35.c b/gcc/testsuite/gcc.dg/strlenopt-35.c new file mode 100644 index 00000000000..03b3e13a8e2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/strlenopt-35.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fdump-tree-strlen" } */ + +#include "strlenopt.h" + +volatile int v; + +size_t +f1 (char *a1) +{ + v += 1; + size_t x = strlen (a1); + char *a2 = a1 + x; + a2[0] = '1'; + a2[1] = '2'; + a2[2] = '3'; + a2[3] = 0; + return strlen (a1); +} + +int +main () +{ + char a[30]; + strcpy (a, "abcd"); + if (f1 (a) != 7) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "strlen \\(" 1 "strlen" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr70992-2.c b/gcc/testsuite/gcc.dg/torture/pr70992-2.c new file mode 100644 index 00000000000..c5d2c5f2683 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70992-2.c @@ -0,0 +1,9 @@ +/* PR middle-end/70992 */ +/* { dg-do compile } */ + +unsigned int *od; +int +fn (void) +{ + return (0 % 0 + 1) * *od * 2; /* { dg-warning "division by zero" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr70992.c b/gcc/testsuite/gcc.dg/torture/pr70992.c new file mode 100644 index 00000000000..56728e09d1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr70992.c @@ -0,0 +1,41 @@ +/* PR middle-end/70992 */ +/* { dg-do compile } */ + +typedef unsigned int uint32_t; +typedef int int32_t; + +uint32_t +fn (uint32_t so) +{ + return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn5 (uint32_t so) +{ + return (0x80000000 / 0 + 1) * (so + so); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn6 (uint32_t so) +{ + return (0x80000000 / 0 - 1) * (so + so); /* { dg-warning "division by zero" } */ +} + +uint32_t +fn2 (uint32_t so) +{ + return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */ +} + +int32_t +fn3 (int32_t so) +{ + return (so + so) * (0x80000000 / 0 + 1); /* { dg-warning "division by zero" } */ +} + +int32_t +fn4 (int32_t so) +{ + return (so + so) * (0x80000000 / 0 - 1); /* { dg-warning "division by zero" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr80565.c b/gcc/testsuite/gcc.dg/torture/pr80565.c new file mode 100644 index 00000000000..66620656e64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr80565.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ + +int a, b, c, e, h, j; +char d; +short f, g; +static short fn2(int p1) { + for (;;) + for (; g; g++) + if (p1) + break; +} + +static short fn3(void); +static char fn4(char p1) { + int i; + for (; d;) + f = 8; + for (; f; f = 0) + for (; i; i++) { + j = 0; + for (; j; j++) + ; + } +} + +static short fn1(short p1) { fn2(b || fn3()); } + +short fn3(void) { + if (c) { + fn4(e); + h = 0; + for (;; h++) + ; + } +} + +int main() { + for (; a;) + fn1(c); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr80620.c b/gcc/testsuite/gcc.dg/torture/pr80620.c new file mode 100644 index 00000000000..ef56eedba5a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr80620.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +long long int a = -465274079317386463LL; +int b = 856872806; +int c = -1940894202; +int d = 1718449211; +int e = -392681565; +unsigned long long int f = 13521452247506316486ULL; +int g = -13194608; + +__attribute__((noinline, noclone)) +void foo () +{ + if (!a - a) + c = b = 0; + else + d = 3UL * a == 0; + if (g / a) + e = 0 < -a + 500849970701012771LL + (unsigned long) -a; + else + f = 4081116982543369LL & a; +} + +int +main () +{ + asm volatile ("" : : : "memory"); + foo (); + if (f != 2818598057803777LL) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81203.c b/gcc/testsuite/gcc.dg/torture/pr81203.c new file mode 100644 index 00000000000..5c9eaf569e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81203.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +int a; +int b() +{ + int c, d; + if (a) + d = b(); + return 1 + c + d; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81245.c b/gcc/testsuite/gcc.dg/torture/pr81245.c new file mode 100644 index 00000000000..b2ee7bb3a9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81245.c @@ -0,0 +1,16 @@ +/* { dg-options "-ffast-math" } */ +/* { dg-do compile } */ +/* This test used to crash the vectorizer as the ifconvert pass + used to convert the if to copysign but called update_stmt on + the old statement after calling fold_stmt. */ +double sg[18]; +void f(void) +{ + for (int i = 0 ;i < 18;i++) + { + if (sg[i] < 0.0) + sg[i] = -1.0; + else + sg[i] = 1.0; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81403.c b/gcc/testsuite/gcc.dg/torture/pr81403.c new file mode 100644 index 00000000000..5fca4d4d6b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81403.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +short var_9 = 19581; +unsigned char var_33 = 21; +long long int var_55 = 286697804684061197LL; +long long int var_59 = -1962393262513510540LL; +long long int var_71 = 4731868609112929952LL; +long long int var_773 = -4784633456247777769LL; +short var_776 = 5894; +long long int var_1321 = 7573221950916697355LL; +unsigned char uc = 217; + +void foo() +{ + if (var_55) + var_71 = 0; + if (var_9 != ~(0 < uc)) + var_773 = 0; + else + var_776 = 1 / ~var_9 * -1; + if (var_33) + var_59 = ~var_9 & 10393; + var_1321 = ~var_9; +} +int main() +{ + foo(); + if (var_59 != 8320) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81418.c b/gcc/testsuite/gcc.dg/torture/pr81418.c new file mode 100644 index 00000000000..245861b7f3c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81418.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ftree-loop-optimize" } */ + +int +ol (int ku) +{ + int zq = 0; + + while (ku < 1) + { + int y6; + + for (y6 = 0; y6 < 3; ++y6) + zq += (char)ku; + ++ku; + } + + return zq; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81500.c b/gcc/testsuite/gcc.dg/torture/pr81500.c new file mode 100644 index 00000000000..7aaec2189fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81500.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +typedef int a; +void c(int *b) +{ + int d; + a e, f, *g, *h = b; + for (; d; d--) { + f = *g & 1; + *h-- = *g-- | e; + e = f; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81510-2.c b/gcc/testsuite/gcc.dg/torture/pr81510-2.c new file mode 100644 index 00000000000..7e2bc9866f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81510-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ + +typedef int h; +typedef int k; +int a; +int b; +int c; +int d; +int e; +int f(int g) +{ + h *i = &e; + k *j; + if (d -= b) + for (; *j; *j += 1) { + g = g || (a = e ? c = (__UINTPTR_TYPE__)j : 0) + *i; + i = &d; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81510.c b/gcc/testsuite/gcc.dg/torture/pr81510.c new file mode 100644 index 00000000000..c93c4683629 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81510.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +typedef int d; +typedef int f; +typedef long h; +int a; +int b; +int c; +int e() +{ + f *g; + h i; + for (;;) + if (g) + for (; b; b++) { + g = c; + if (a &= c) { + d *j = &b; + h k; + for (; i; i++) { + *g ?: (*j = k); + g = &a; + } + for (; i <= 3; i++) + ; + } + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81571.c b/gcc/testsuite/gcc.dg/torture/pr81571.c new file mode 100644 index 00000000000..74bceb763ea --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81571.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ + +int a, b, c, d; +short fn1(int p1, int p2) { return p1; } + +int fn2(int p1) {} + +int main() +{ + for (; c; c++) + a |= fn1(1, a) | fn2(b |= d); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81573.c b/gcc/testsuite/gcc.dg/torture/pr81573.c new file mode 100644 index 00000000000..3930c56386b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81573.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ + +int a = 1, *c = &a, d; +signed char b; + +int main () +{ + for (; b > -27; b--) + { + *c ^= b; + *c ^= 1; + } + while (a > 1) + ; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c index 95d6ee3b4a3..830232a7ffa 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c @@ -35,9 +35,9 @@ int main(int argc, char *argv[]) } } - int retval; + void *retval; for(t=0;t<NUM_THREADS;t++) - pthread_join (threads[t], (void**)&retval); + pthread_join (threads[t], &retval); return buffer[10]; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/addadd.c b/gcc/testsuite/gcc.dg/tree-ssa/addadd.c index 16474db6565..454ec2a570d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/addadd.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/addadd.c @@ -23,11 +23,6 @@ int i(int x){ x += __INT_MAX__; return x; } -typedef int S __attribute__((vector_size(16))); -void j(S*x){ - *x += __INT_MAX__; - *x += __INT_MAX__; -} /* { dg-final { scan-tree-dump-times " \\+ 24;" 2 "optimized" } } */ /* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 2 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/assoc-1.c b/gcc/testsuite/gcc.dg/tree-ssa/assoc-1.c new file mode 100644 index 00000000000..f9821910bd0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/assoc-1.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized-raw -fno-tree-reassoc" } */ + +int f0(int a,int b,int c){ + int d = a + b; + int e = c + b; + return d - e; +} +int f1(int a,int b,int c){ + int d = a + b; + int e = b - c; + return d - e; +} +int f2(int a,int b,int c){ + int d = a + b; + int e = c - b; + return e + d; +} +int f3(int a,int b,int c){ + int d = a - b; + int e = c - b; + return d - e; +} +int f4(int a,int b,int c){ + int d = b - a; + int e = c - b; + return e + d; +} + +/* { dg-final { scan-tree-dump-times "plus_expr" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "minus_expr" 3 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c b/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c new file mode 100644 index 00000000000..cc0e9d429b4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/assoc-2.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-gimple-raw -fdump-tree-optimized-raw" } */ + +int f0(int a, int b){ + return a * 33 * b * 55; +} + +int f1(int a){ + a *= 33; + return a * 55; +} + +int f2(int a, int b){ + a *= 33; + return a * b * 55; +} + +/* { dg-final { scan-tree-dump-times "mult_expr" 7 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "mult_expr" 5 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c index 184dd10ddae..17526113d4b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/attr-hotcold-2.c @@ -1,8 +1,7 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-profile_estimate-blocks-details" } */ +/* { dg-options "-O2 -fdump-tree-profile_estimate" } */ -void g(void); -void h(void); +int v1, v2; void f(int x, int y) { if (x) goto A; @@ -10,19 +9,19 @@ void f(int x, int y) return; A: __attribute__((cold)) - g(); + v1 = x; return; B: __attribute__((hot)) - h(); + v2 = y; return; } /* { dg-final { scan-tree-dump-times "hot label heuristics" 1 "profile_estimate" } } */ /* { dg-final { scan-tree-dump-times "cold label heuristics" 1 "profile_estimate" } } */ -/* { dg-final { scan-tree-dump "A \\\[0\\\..*\\\]" "profile_estimate" } } */ +/* { dg-final { scan-tree-dump-times "combined heuristics: 0\\\..*" 1 "profile_estimate" } } */ /* Note: we're attempting to match some number > 6000, i.e. > 60%. The exact number ought to be tweekable without having to juggle the testcase around too much. */ -/* { dg-final { scan-tree-dump "B \\\[\[6-9\]\[0-9\]\\\..*\\\]" "profile_estimate" } } */ +/* { dg-final { scan-tree-dump-times "combined heuristics: \[6-9\]\[0-9\]\\\..*" 1 "profile_estimate" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c new file mode 100644 index 00000000000..e0439384dd7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c @@ -0,0 +1,62 @@ +/* PR tree-optimization/80397 - missing -Wformat-overflow with arguments + of enum types + { dg-do compile } + { dg-options "-O2 -Wall -Wformat-overflow=1 -ftrack-macro-expansion=0" } + { dg-require-effective-target int32plus } */ + +void sink (char*); + +long long integer_range (long long min, long long max) +{ + extern long long integer_value (void); + long long n = integer_value (); + return n < min || max < n ? min : n; +} + +typedef enum { i0, imax = __INT_MAX__ } Int; +typedef enum { ll0, llmax = __LONG_LONG_MAX__ } LLong; + +#define R(T, min, max) (T)integer_range (min, max) + +char buffer[1]; +#define T(fmt, ...) \ + __builtin_sprintf (buffer + 1, fmt, __VA_ARGS__), sink (buffer) + +void test_bool (_Bool b) +{ + T ("%hhi", b); // { dg-warning "writing 1 byte" } + T ( "%hi", b); // { dg-warning "writing 1 byte" } + T ( "%i", b); // { dg-warning "writing 1 byte" } +} + +void test_enum (void) +{ + T ("%hhi", R (Int, 1, 1)); // { dg-warning "writing 1 byte" } + T ("%hhi", R (Int, 1, 22)); // { dg-warning "between 1 and 2 bytes" } + + T ( "%hi", R (Int, 1, 2)); // { dg-warning "writing 1 " } + T ( "%hi", R (Int, 1, 22)); // { dg-warning "between 1 and 2 " } + T ( "%hi", R (Int, 22, 333)); // { dg-warning "between 2 and 3 " } + T ( "%hi", R (Int, 333, 4444)); // { dg-warning "between 3 and 4 " } + + T ( "%i", R (Int, 1, 1)); // { dg-warning "writing 1 " } + T ( "%i", R (Int, 1, 22)); // { dg-warning "between 1 and 2 " } + T ( "%i", R (Int, 22, 333)); // { dg-warning "between 2 and 3 " } + T ( "%i", R (Int, 333, 4444)); // { dg-warning "between 3 and 4 " } + T ( "%i", R (Int, 4444, 55555)); // { dg-warning "between 4 and 5 " } + +#if __LONG_MAX__ == __LONG_LONG_MAX__ +# define LLI "%li" +#else +# define LLI "%lli" +#endif + + T (LLI, R (LLong, 1, 1)); // { dg-warning "writing 1 " } + T (LLI, R (LLong, 1, 22)); // { dg-warning "between 1 and 2 " } + T (LLI, R (LLong, 22, 333)); // { dg-warning "between 2 and 3 " } + T (LLI, R (LLong, 333, 4444)); // { dg-warning "between 3 and 4 " } + T (LLI, R (LLong, 4444, 55555)); // { dg-warning "between 4 and 5 " } + + T (LLI, R (LLong, 4444, 1234567890)); // { dg-warning "between 4 and 10 " } + T (LLI, R (LLong, 4444, 12345678901)); // { dg-warning "between 4 and 11 " } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c new file mode 100644 index 00000000000..de3e7b242ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-1.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target c99_runtime } */ +/* { dg-options "-O2 -ffast-math -fdump-tree-gimple" } */ +/* { dg-add-options c99_runtime } */ +float f(float x) +{ + return (x > 0.f ? -1.f : 1.f); +} +float f1(float x) +{ + return (x > 0.f ? 1.f : -1.f); +} +float g(float x) +{ + return (x >= 0.f ? -1.f : 1.f); +} +float g1(float x) +{ + return (x >= 0.f ? 1.f : -1.f); +} +float h(float x) +{ + return (x < 0.f ? -1.f : 1.f); +} +float h1(float x) +{ + return (x < 0.f ? 1.f : -1.f); +} +float i(float x) +{ + return (x <= 0.f ? -1.f : 1.f); +} +float i1(float x) +{ + return (x <= 0.f ? 1.f : -1.f); +} +/* { dg-final { scan-tree-dump-times "copysign" 8 "gimple"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-2.c b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-2.c new file mode 100644 index 00000000000..de52c5f7c80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/copy-sign-2.c @@ -0,0 +1,13 @@ +/* { dg-options "-O2 -ffast-math -fdump-tree-optimized" } */ +/* { dg-do compile } */ +float f(float x) +{ + float t = __builtin_copysignf (1.0f, x); + return x * t; +} +float f1(float x) +{ + float t = __builtin_copysignf (1.0f, -x); + return x * t; +} +/* { dg-final { scan-tree-dump-times "ABS" 2 "optimized"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-12.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-12.c index 53551cabd1e..625dd92128e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-12.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-12.c @@ -18,4 +18,5 @@ int foo (int * __restrict__ ia, return oya[22] + oyb[21]; } -/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 1 "ldist" } } */ +/* Distributing the loop doesn't expose more parallelism. */ +/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-13.c index ba39d4dfce7..8c9fd567e1e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-13.c @@ -16,6 +16,5 @@ float foo (int n) return tmp; } -/* We should apply loop distribution. */ - -/* { dg-final { scan-tree-dump "Loop 1 distributed: split to 2 loops" "ldist" } } */ +/* Distributing the loop doesn't expose more parallelism. */ +/* { dg-final { scan-tree-dump-not "Loop 1 distributed: split to 2 loops" "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-14.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-14.c index 48c1040f4b3..fa4d1a82879 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-14.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-14.c @@ -21,6 +21,5 @@ float foo (int n) return tmp; } -/* We should apply loop distribution. */ - -/* { dg-final { scan-tree-dump "Loop 1 distributed: split to 2 loops" "ldist" } } */ +/* Distributing the loop doesn't expose more parallelism. */ +/* { dg-final { scan-tree-dump-not "Loop 1 distributed: split to 2 loops" "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-26.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-26.c new file mode 100644 index 00000000000..3a698846c89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-26.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -ftree-loop-distribution -fdump-tree-ldist-details" } */ + +extern void abort (void); + +int a[130], b[128], c[128]; + +int __attribute__((noinline,noclone)) +foo (int len, int x) +{ + int i; + for (i = 1; i <= len; ++i) + { + a[i] = a[i + 2] + 1; + b[i] = 0; + a[i + 1] = a[i] - 3; + if (i < x) + c[i] = a[i]; + } + return i; +} + +int main() +{ + int i; + for (i = 0; i < 130; ++i) + a[i] = i; + foo (127, 67); + if (a[0] != 0 || a[1] != 4 || a[127] != 130) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "distributed: split to 2 loops and 0 library calls" "ldist" } } */ +/* { dg-final { scan-tree-dump "distributed: split to 1 loops and 1 library calls" "ldist" } } */ +/* { dg-final { scan-tree-dump "generated memset zero" "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c index c36daf0714b..4def9b4719d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-4.c @@ -20,7 +20,5 @@ int loop1 (int k) return b[100-1][1]; } -/* The current cost model fuses the two partitions because they have - similar memory accesses. */ -/* { dg-final { scan-tree-dump "similar memory accesses" "ldist" } } */ +/* Distributing inner loop doesn't expose more parallelism. */ /* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-6.c index 8eb1c628837..e0a68d87f7f 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ldist-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-6.c @@ -34,4 +34,4 @@ int loop1 (int k) return a[1000-2] + b[1000-1] + c[1000-2] + d[1000-2]; } -/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" } } */ +/* { dg-final { scan-tree-dump-times "distributed: split to 2 loops" 0 "ldist" { xfail *-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/mulcmp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/mulcmp-1.c new file mode 100644 index 00000000000..6ff2ff5a388 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/mulcmp-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-optimized-raw" } */ + +int f(unsigned a,unsigned b){ + a *= 3; + b *= 3; + return a == b; +} + +/* { dg-final { scan-tree-dump-not "mult_expr" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c b/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c new file mode 100644 index 00000000000..d74ba2fe630 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/mult-abs-2.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target c99_runtime } */ +/* { dg-options "-O2 -ffast-math -fdump-tree-gimple" } */ +/* { dg-add-options c99_runtime } */ + +float f(float x) +{ + return x * (x > 0.f ? -1.f : 1.f); +} +float f1(float x) +{ + return x * (x > 0.f ? 1.f : -1.f); +} +float g(float x) +{ + return x * (x >= 0.f ? -1.f : 1.f); +} +float g1(float x) +{ + return x * (x >= 0.f ? 1.f : -1.f); +} +float h(float x) +{ + return x * (x < 0.f ? -1.f : 1.f); +} +float h1(float x) +{ + return x * (x < 0.f ? 1.f : -1.f); +} +float i(float x) +{ + return x * (x <= 0.f ? -1.f : 1.f); +} +float i1(float x) +{ + return x * (x <= 0.f ? 1.f : -1.f); +} +/* { dg-final { scan-tree-dump-times "ABS" 8 "gimple"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c index 3c8ee06016f..0fa5600177e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr19210-1.c @@ -1,15 +1,15 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -Wunsafe-loop-optimizations" } */ +/* { dg-options "-O2 -fopt-info-loop-missed -Wunsafe-loop-optimizations" } */ extern void g(void); void f (unsigned n) { unsigned k; - for(k = 0;k <= n;k++) /* { dg-warning "missed loop optimization.*overflow" } */ + for(k = 0;k <= n;k++) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ g(); - for(k = 0;k <= n;k += 4) /* { dg-warning "missed loop optimization.*overflow" } */ + for(k = 0;k <= n;k += 4) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ g(); /* We used to get warning for this loop. However, since then # of iterations @@ -21,9 +21,9 @@ f (unsigned n) g(); /* So we need the following loop, instead. */ - for(k = 4;k <= n;k += 5) /* { dg-warning "missed loop optimization.*overflow" } */ + for(k = 4;k <= n;k += 5) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ g(); - for(k = 15;k >= n;k--) /* { dg-warning "missed loop optimization.*overflow" } */ + for(k = 15;k >= n;k--) /* { dg-message "note: missed loop optimization: niters analysis .*" } */ g(); } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81346-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-1.c new file mode 100644 index 00000000000..c766d6ff996 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-1.c @@ -0,0 +1,37 @@ +/* PR tree-optimization/81346 */ +/* { dg-do compile { target int32 } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "return 1;" 32 "optimized" } } */ + +int f00 (int x) { return x / 49152 > -49152; } +int f01 (int x) { int a = 49152, b = -49152; return x / a > b; } +int f02 (int x) { return x / 49152 >= -49152; } +int f03 (int x) { int a = 49152, b = -49152; return x / a >= b; } +int f04 (int x) { return x / 49152 < 49152; } +int f05 (int x) { int a = 49152, b = 49152; return x / a < b; } +int f06 (int x) { return x / 49152 <= 49152; } +int f07 (int x) { int a = 49152, b = 49152; return x / a <= b; } +int f08 (int x) { return x / 46340 >= -46341; } +int f09 (int x) { int a = 46340, b = -46341; return x / a >= b; } +int f10 (int x) { return x / 46340 <= 46341; } +int f11 (int x) { int a = 46340, b = 46341; return x / a <= b; } +int f12 (int x) { return x / 49152 != -49152; } +int f13 (int x) { int a = 49152, b = -49152; return x / a != b; } +int f14 (int x) { return x / 49152 != 49152; } +int f15 (int x) { int a = 49152, b = 49152; return x / a != b; } +int f16 (int x) { return x / -49152 > -49152; } +int f17 (int x) { int a = -49152, b = -49152; return x / a > b; } +int f18 (int x) { return x / -49152 >= -49152; } +int f19 (int x) { int a = -49152, b = -49152; return x / a >= b; } +int f20 (int x) { return x / -49152 < 49152; } +int f21 (int x) { int a = -49152, b = 49152; return x / a < b; } +int f22 (int x) { return x / -49152 <= 49152; } +int f23 (int x) { int a = -49152, b = 49152; return x / a <= b; } +int f24 (int x) { return x / -46340 >= -46341; } +int f25 (int x) { int a = -46340, b = -46341; return x / a >= b; } +int f26 (int x) { return x / -46340 <= 46341; } +int f27 (int x) { int a = -46340, b = 46341; return x / a <= b; } +int f28 (int x) { return x / -49152 != 49152; } +int f29 (int x) { int a = -49152, b = 49152; return x / a != b; } +int f30 (int x) { return x / -49152 != -49152; } +int f31 (int x) { int a = -49152, b = -49152; return x / a != b; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81346-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-2.c new file mode 100644 index 00000000000..87bad395c3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-2.c @@ -0,0 +1,37 @@ +/* PR tree-optimization/81346 */ +/* { dg-do compile { target int32 } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "return 0;" 32 "optimized" } } */ + +int f00 (int x) { return x / 49152 > 49152; } +int f01 (int x) { int a = 49152, b = 49152; return x / a > b; } +int f02 (int x) { return x / 49152 >= 49152; } +int f03 (int x) { int a = 49152, b = 49152; return x / a >= b; } +int f04 (int x) { return x / 49152 < -49152; } +int f05 (int x) { int a = 49152, b = -49152; return x / a < b; } +int f06 (int x) { return x / 49152 <= -49152; } +int f07 (int x) { int a = 49152, b = -49152; return x / a <= b; } +int f08 (int x) { return x / 46340 > 46341; } +int f09 (int x) { int a = 46340, b = 46341; return x / a > b; } +int f10 (int x) { return x / 46340 < -46341; } +int f11 (int x) { int a = 46340, b = -46341; return x / a < b; } +int f12 (int x) { return x / 49152 == -49152; } +int f13 (int x) { int a = 49152, b = -49152; return x / a == b; } +int f14 (int x) { return x / 49152 == 49152; } +int f15 (int x) { int a = 49152, b = 49152; return x / a == b; } +int f16 (int x) { return x / -49152 > 49152; } +int f17 (int x) { int a = -49152, b = 49152; return x / a > b; } +int f18 (int x) { return x / -49152 >= 49152; } +int f19 (int x) { int a = -49152, b = 49152; return x / a >= b; } +int f20 (int x) { return x / -49152 < -49152; } +int f21 (int x) { int a = -49152, b = -49152; return x / a < b; } +int f22 (int x) { return x / -49152 <= -49152; } +int f23 (int x) { int a = -49152, b = -49152; return x / a <= b; } +int f24 (int x) { return x / -46340 > 46341; } +int f25 (int x) { int a = -46340, b = 46341; return x / a > b; } +int f26 (int x) { return x / -46340 < -46341; } +int f27 (int x) { int a = -46340, b = -46341; return x / a < b; } +int f28 (int x) { return x / -49152 == 49152; } +int f29 (int x) { int a = -49152, b = 49152; return x / a == b; } +int f30 (int x) { return x / -49152 == -49152; } +int f31 (int x) { int a = -49152, b = -49152; return x / a == b; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81346-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-3.c new file mode 100644 index 00000000000..bef64a8746a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-3.c @@ -0,0 +1,109 @@ +/* PR tree-optimization/81346 */ +/* { dg-do compile { target int32 } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-not " / " "optimized" } } */ + +__attribute__((noinline, noclone)) int f00 (int x) { return x / 46340 > -46341; } +__attribute__((noinline, noclone)) int f01 (int x) { int a = 46340, b = -46341; return x / a > b; } +__attribute__((noinline, noclone)) int f02 (int x) { return x / 46340 >= 46341; } +__attribute__((noinline, noclone)) int f03 (int x) { int a = 46340, b = 46341; return x / a >= b; } +__attribute__((noinline, noclone)) int f04 (int x) { return x / 46340 < 46341; } +__attribute__((noinline, noclone)) int f05 (int x) { int a = 46340, b = 46341; return x / a < b; } +__attribute__((noinline, noclone)) int f06 (int x) { return x / 46340 <= -46341; } +__attribute__((noinline, noclone)) int f07 (int x) { int a = 46340, b = -46341; return x / a <= b; } +__attribute__((noinline, noclone)) int f08 (int x) { return x / 46340 == -46341; } +__attribute__((noinline, noclone)) int f09 (int x) { int a = 46340, b = -46341; return x / a == b; } +__attribute__((noinline, noclone)) int f10 (int x) { return x / 46340 == 46341; } +__attribute__((noinline, noclone)) int f11 (int x) { int a = 46340, b = 46341; return x / a == b; } +__attribute__((noinline, noclone)) int f12 (int x) { return x / 46340 != -46341; } +__attribute__((noinline, noclone)) int f13 (int x) { int a = 46340, b = -46341; return x / a != b; } +__attribute__((noinline, noclone)) int f14 (int x) { return x / 46340 != 46341; } +__attribute__((noinline, noclone)) int f15 (int x) { int a = 46340, b = 46341; return x / a != b; } +__attribute__((noinline, noclone)) int f16 (int x) { return x / 15 > -15; } +__attribute__((noinline, noclone)) int f17 (int x) { int a = 15, b = -15; return x / a > b; } +__attribute__((noinline, noclone)) int f18 (int x) { return x / 15 > 15; } +__attribute__((noinline, noclone)) int f19 (int x) { int a = 15, b = 15; return x / a > b; } +__attribute__((noinline, noclone)) int f20 (int x) { return x / 15 >= -15; } +__attribute__((noinline, noclone)) int f21 (int x) { int a = 15, b = -15; return x / a >= b; } +__attribute__((noinline, noclone)) int f22 (int x) { return x / 15 >= 15; } +__attribute__((noinline, noclone)) int f23 (int x) { int a = 15, b = 15; return x / a >= b; } +__attribute__((noinline, noclone)) int f24 (int x) { return x / 15 < -15; } +__attribute__((noinline, noclone)) int f25 (int x) { int a = 15, b = -15; return x / a < b; } +__attribute__((noinline, noclone)) int f26 (int x) { return x / 15 < 15; } +__attribute__((noinline, noclone)) int f27 (int x) { int a = 15, b = 15; return x / a < b; } +__attribute__((noinline, noclone)) int f28 (int x) { return x / 15 <= -15; } +__attribute__((noinline, noclone)) int f29 (int x) { int a = 15, b = -15; return x / a <= b; } +__attribute__((noinline, noclone)) int f30 (int x) { return x / 15 <= 15; } +__attribute__((noinline, noclone)) int f31 (int x) { int a = 15, b = 15; return x / a <= b; } +__attribute__((noinline, noclone)) int f32 (int x) { return x / 15 == -15; } +__attribute__((noinline, noclone)) int f33 (int x) { int a = 15, b = -15; return x / a == b; } +__attribute__((noinline, noclone)) int f34 (int x) { return x / 15 == 15; } +__attribute__((noinline, noclone)) int f35 (int x) { int a = 15, b = 15; return x / a == b; } +__attribute__((noinline, noclone)) int f36 (int x) { return x / 15 != -15; } +__attribute__((noinline, noclone)) int f37 (int x) { int a = 15, b = -15; return x / a != b; } +__attribute__((noinline, noclone)) int f38 (int x) { return x / 15 != 15; } +__attribute__((noinline, noclone)) int f39 (int x) { int a = 15, b = 15; return x / a != b; } +__attribute__((noinline, noclone)) int f40 (int x) { return x / -46340 > -46341; } +__attribute__((noinline, noclone)) int f41 (int x) { int a = -46340, b = -46341; return x / a > b; } +__attribute__((noinline, noclone)) int f42 (int x) { return x / -46340 >= 46341; } +__attribute__((noinline, noclone)) int f43 (int x) { int a = -46340, b = 46341; return x / a >= b; } +__attribute__((noinline, noclone)) int f44 (int x) { return x / -46340 < 46341; } +__attribute__((noinline, noclone)) int f45 (int x) { int a = -46340, b = 46341; return x / a < b; } +__attribute__((noinline, noclone)) int f46 (int x) { return x / -46340 <= -46341; } +__attribute__((noinline, noclone)) int f47 (int x) { int a = -46340, b = -46341; return x / a <= b; } +__attribute__((noinline, noclone)) int f48 (int x) { return x / -46340 == 46341; } +__attribute__((noinline, noclone)) int f49 (int x) { int a = -46340, b = 46341; return x / a == b; } +__attribute__((noinline, noclone)) int f50 (int x) { return x / -46340 == -46341; } +__attribute__((noinline, noclone)) int f51 (int x) { int a = -46340, b = -46341; return x / a == b; } +__attribute__((noinline, noclone)) int f52 (int x) { return x / -46340 != 46341; } +__attribute__((noinline, noclone)) int f53 (int x) { int a = -46340, b = 46341; return x / a != b; } +__attribute__((noinline, noclone)) int f54 (int x) { return x / -46340 != -46341; } +__attribute__((noinline, noclone)) int f55 (int x) { int a = -46340, b = -46341; return x / a != b; } +__attribute__((noinline, noclone)) int f56 (int x) { return x / -15 > 15; } +__attribute__((noinline, noclone)) int f57 (int x) { int a = -15, b = 15; return x / a > b; } +__attribute__((noinline, noclone)) int f58 (int x) { return x / -15 > -15; } +__attribute__((noinline, noclone)) int f59 (int x) { int a = -15, b = -15; return x / a > b; } +__attribute__((noinline, noclone)) int f60 (int x) { return x / -15 >= 15; } +__attribute__((noinline, noclone)) int f61 (int x) { int a = -15, b = 15; return x / a >= b; } +__attribute__((noinline, noclone)) int f62 (int x) { return x / -15 >= -15; } +__attribute__((noinline, noclone)) int f63 (int x) { int a = -15, b = -15; return x / a >= b; } +__attribute__((noinline, noclone)) int f64 (int x) { return x / -15 < 15; } +__attribute__((noinline, noclone)) int f65 (int x) { int a = -15, b = 15; return x / a < b; } +__attribute__((noinline, noclone)) int f66 (int x) { return x / -15 < -15; } +__attribute__((noinline, noclone)) int f67 (int x) { int a = -15, b = -15; return x / a < b; } +__attribute__((noinline, noclone)) int f68 (int x) { return x / -15 <= 15; } +__attribute__((noinline, noclone)) int f69 (int x) { int a = -15, b = 15; return x / a <= b; } +__attribute__((noinline, noclone)) int f70 (int x) { return x / -15 <= -15; } +__attribute__((noinline, noclone)) int f71 (int x) { int a = -15, b = -15; return x / a <= b; } +__attribute__((noinline, noclone)) int f72 (int x) { return x / -15 == 15; } +__attribute__((noinline, noclone)) int f73 (int x) { int a = -15, b = 15; return x / a == b; } +__attribute__((noinline, noclone)) int f74 (int x) { return x / -15 == -15; } +__attribute__((noinline, noclone)) int f75 (int x) { int a = -15, b = -15; return x / a == b; } +__attribute__((noinline, noclone)) int f76 (int x) { return x / -15 != 15; } +__attribute__((noinline, noclone)) int f77 (int x) { int a = -15, b = 15; return x / a != b; } +__attribute__((noinline, noclone)) int f78 (int x) { return x / -15 != -15; } +__attribute__((noinline, noclone)) int f79 (int x) { int a = -15, b = -15; return x / a != b; } +__attribute__((noinline, noclone)) int f80 (int x) { return x / -15 > 0; } +__attribute__((noinline, noclone)) int f81 (int x) { int a = -15, b = 0; return x / a > b; } +__attribute__((noinline, noclone)) int f82 (int x) { return x / 15 > 0; } +__attribute__((noinline, noclone)) int f83 (int x) { int a = 15, b = 0; return x / a > b; } +__attribute__((noinline, noclone)) int f84 (int x) { return x / -15 >= 0; } +__attribute__((noinline, noclone)) int f85 (int x) { int a = -15, b = 0; return x / a >= b; } +__attribute__((noinline, noclone)) int f86 (int x) { return x / 15 >= 0; } +__attribute__((noinline, noclone)) int f87 (int x) { int a = 15, b = 0; return x / a >= b; } +__attribute__((noinline, noclone)) int f88 (int x) { return x / -15 < 0; } +__attribute__((noinline, noclone)) int f89 (int x) { int a = -15, b = 0; return x / a < b; } +__attribute__((noinline, noclone)) int f90 (int x) { return x / 15 < 0; } +__attribute__((noinline, noclone)) int f91 (int x) { int a = 15, b = 0; return x / a < b; } +__attribute__((noinline, noclone)) int f92 (int x) { return x / -15 <= 0; } +__attribute__((noinline, noclone)) int f93 (int x) { int a = -15, b = 0; return x / a <= b; } +__attribute__((noinline, noclone)) int f94 (int x) { return x / 15 <= 0; } +__attribute__((noinline, noclone)) int f95 (int x) { int a = 15, b = 0; return x / a <= b; } +__attribute__((noinline, noclone)) int f96 (int x) { return x / -15 == 0; } +__attribute__((noinline, noclone)) int f97 (int x) { int a = -15, b = 0; return x / a == b; } +__attribute__((noinline, noclone)) int f98 (int x) { return x / 15 == 0; } +__attribute__((noinline, noclone)) int f99 (int x) { int a = 15, b = 0; return x / a == b; } +__attribute__((noinline, noclone)) int f100 (int x) { return x / -15 != 0; } +__attribute__((noinline, noclone)) int f101 (int x) { int a = -15, b = 0; return x / a != b; } +__attribute__((noinline, noclone)) int f102 (int x) { return x / 15 != 0; } +__attribute__((noinline, noclone)) int f103 (int x) { int a = 15, b = 0; return x / a != b; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81346-4.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-4.c new file mode 100644 index 00000000000..f93ad468c3f --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-4.c @@ -0,0 +1,79 @@ +/* PR tree-optimization/81346 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include "pr81346-3.c" + +#define INT_MAX __INT_MAX__ +#define INT_MIN (-__INT_MAX__ - 1) + +extern void abort (void); + +int +main () +{ + if (__CHAR_BIT__ != 8 || __SIZEOF_INT__ != 4) + return 0; +#define TEST(fn1, fn2, v1, v2) \ + do { \ + int w1 = v1; int w2 = v2; \ + int in = 1; if (w1 > w2) { in = w1; w1 = w2; w2 = in; in = 0; } \ + if (w1 != INT_MIN) { if (fn1 (w1 - 1) != !in || fn2 (w1 - 1) != !in) abort (); } \ + if (fn1 (w1) != in || fn2 (w1) != in) abort (); \ + if (fn1 (w2) != in || fn2 (w2) != in) abort (); \ + if (w2 != INT_MAX) { if (fn1 (w2 + 1) != !in || fn2 (w2 + 1) != !in) abort (); } \ + } while (0) +TEST (f00, f01, -2147441939, INT_MAX); +TEST (f02, f03, 2147441940, INT_MAX); +TEST (f04, f05, INT_MIN, 2147441939); +TEST (f06, f07, INT_MIN, -2147441940); +TEST (f08, f09, INT_MIN, -2147441940); +TEST (f10, f11, 2147441940, INT_MAX); +TEST (f12, f13, -2147441939, INT_MAX); +TEST (f14, f15, INT_MIN, 2147441939); +TEST (f16, f17, -224, INT_MAX); +TEST (f18, f19, 240, INT_MAX); +TEST (f20, f21, -239, INT_MAX); +TEST (f22, f23, 225, INT_MAX); +TEST (f24, f25, INT_MIN, -240); +TEST (f26, f27, INT_MIN, 224); +TEST (f28, f29, INT_MIN, -225); +TEST (f30, f31, INT_MIN, 239); +TEST (f32, f33, -239, -225); +TEST (f34, f35, 225, 239); +TEST (f36, f37, -225, -239); +TEST (f38, f39, 239, 225); +TEST (f40, f41, INT_MIN, 2147441939); +TEST (f42, f43, INT_MIN, -2147441940); +TEST (f44, f45, -2147441939, INT_MAX); +TEST (f46, f47, 2147441940, INT_MAX); +TEST (f48, f49, INT_MIN, -2147441940); +TEST (f50, f51, 2147441940, INT_MAX); +TEST (f52, f53, -2147441939, INT_MAX); +TEST (f54, f55, INT_MIN, 2147441939); +TEST (f56, f57, INT_MIN, -240); +TEST (f58, f59, INT_MIN, 224); +TEST (f60, f61, INT_MIN, -225); +TEST (f62, f63, INT_MIN, 239); +TEST (f64, f65, -224, INT_MAX); +TEST (f66, f67, 240, INT_MAX); +TEST (f68, f69, -239, INT_MAX); +TEST (f70, f71, 225, INT_MAX); +TEST (f72, f73, -239, -225); +TEST (f74, f75, 225, 239); +TEST (f76, f77, -225, -239); +TEST (f78, f79, 239, 225); +TEST (f80, f81, INT_MIN, -15); +TEST (f82, f83, 15, INT_MAX); +TEST (f84, f85, INT_MIN, 14); +TEST (f86, f87, -14, INT_MAX); +TEST (f88, f89, 15, INT_MAX); +TEST (f90, f91, INT_MIN, -15); +TEST (f92, f93, -14, INT_MAX); +TEST (f94, f95, INT_MIN, 14); +TEST (f96, f97, -14, 14); +TEST (f98, f99, -14, 14); +TEST (f100, f101, 14, -14); +TEST (f102, f103, 14, -14); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81346-5.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-5.c new file mode 100644 index 00000000000..14562a11152 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81346-5.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/81346 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "\\(signed int\\) x" 10 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " <= 0;" 5 "optimized" } } */ +/* { dg-final { scan-tree-dump-times " > 0;" 5 "optimized" } } */ + +int f1 (unsigned x) { return x - 1 <= __INT_MAX__ - 1; } +int f2 (unsigned x) { unsigned a = 1, b = __INT_MAX__ - 1; return x - a <= b; } +int f3 (unsigned x) { return x - 1 < __INT_MAX__; } +int f4 (unsigned x) { unsigned a = 1, b = __INT_MAX__; return x - a < b; } +int f5 (unsigned x) { return x >= 1 && x <= __INT_MAX__; } +int f6 (unsigned x) { return x - 1 > __INT_MAX__ - 1; } +int f7 (unsigned x) { unsigned a = 1, b = __INT_MAX__ - 1; return x - a > b; } +int f8 (unsigned x) { return x - 1 >= __INT_MAX__; } +int f9 (unsigned x) { unsigned a = 1, b = __INT_MAX__; return x - a >= b; } +int f10 (unsigned x) { return x < 1 || x > __INT_MAX__; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c new file mode 100644 index 00000000000..b40477b0b41 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81369.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribution" } */ + +typedef __PTRDIFF_TYPE__ intptr_t; +int wo; + +void +sy (long int *as) +{ + for (;;) + { + *as = wo; + while (as < (long int *) (void *) 2) + { + int *y9; + + if (wo != 0) + *y9 = (int) (intptr_t) &wo; + wo /= (wo != 0 && *y9 != 0); + ++as; + } + } +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c new file mode 100644 index 00000000000..ecfe12929cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-strict-overflow -fdump-tree-ivcanon-details" } */ + +void bar(); +void foo(char *dst) +{ + char *const end = dst; + do { + bar(); + dst += 2; + } while (dst < end); +} + +/* { dg-final { scan-tree-dump-times " zero if " 1 "ivcanon" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81388-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-2.c new file mode 100644 index 00000000000..71fd2890f3d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81388-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ivcanon-details" } */ + +void bar(); +void foo(unsigned dst) +{ + unsigned end = dst; + do { + bar(); + dst += 2; + } while (dst < end); +} + +/* { dg-final { scan-tree-dump-times " zero if " 1 "ivcanon" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr81396.c b/gcc/testsuite/gcc.dg/tree-ssa/pr81396.c new file mode 100644 index 00000000000..9f4a08d1c22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr81396.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/81396 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +typedef unsigned long long uint64_t; + +uint64_t +foo (uint64_t word) +{ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG_LONG__ == 8 + const unsigned char *const ptr = (const unsigned char *) &word; + return ((uint64_t) ptr[0] + | ((uint64_t) ptr[1] << 8) + | ((uint64_t) ptr[2] << (8 * 2)) + | ((uint64_t) ptr[3] << (8 * 3)) + | ((uint64_t) ptr[4] << (8 * 4)) + | ((uint64_t) ptr[5] << (8 * 5)) + | ((uint64_t) ptr[6] << (8 * 6)) + | ((uint64_t) ptr[7] << (8 * 7))); +#else + return word; +#endif +} + +/* { dg-final { scan-tree-dump "return word_\[0-9]*\\(D\\);" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c new file mode 100644 index 00000000000..d3a2339e55e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-1.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, -1, 5, -2, 11, 0}; +int result2[10] = {0, 0, -1, -2, -2, 0}; +int result3[10] = {0, 0, 0, -1, -2, -2, 0}; +int result4[10] = {0, 0, 0, 0, -1, -2, -2, 0}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, 0}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 3] = -2; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c new file mode 100644 index 00000000000..bd5575d9502 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-10.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, 3, 5, -2, 11, 0}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len, int flag) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + if (flag) + a[i + 1] = -1; + a[i + 3] = -2; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + int i; + + foo (arr, 0, 0); + check (arr, result0, 10); + + foo (arr, 1, 0); + check (arr, result1, 10); + + return 0; +} +/* { dg-final { scan-tree-dump-not "Store-stores chain" "pcom"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c new file mode 100644 index 00000000000..9e496f68a12 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-11.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int x[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, 0, 0, 0, 0, 0, -1, -2, -2}; + +extern void abort (void); + +int __attribute__((noinline)) foo (int * __restrict__ a, int * __restrict__ b, int len, int flag) +{ + int i, sum = 0; + for (i = 0; i < len; i++) + { + a[i] = 0; + b[i + 2] = i; + a[i + 1] = -1; + sum += b[i]; + a[i + 3] = -2; + } + return sum; +} + +void check (int *a, int *res, int len, int sum, int val) +{ + int i; + + if (sum != val) + abort (); + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + int i, sum; + + sum = foo (arr, x, 0, 0); + check (arr, result0, 10, sum, 0); + + sum = foo (arr, x, 6, 0); + check (arr, result1, 10, sum, 11); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ +/* { dg-final { scan-tree-dump "Store-loads chain" "pcom"} } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c new file mode 100644 index 00000000000..c48d438e9e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-2.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, 3, -1, -2, 11, 0}; +int result2[10] = {0, 0, -1, -1, -2, 0}; +int result3[10] = {0, 0, 0, -1, -1, -2, 0}; +int result4[10] = {0, 0, 0, 0, -1, -1, -2, 0}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 2] = -1; + a[i + 3] = -2; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c new file mode 100644 index 00000000000..9c2736cd0ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-3.c @@ -0,0 +1,108 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr1[105] = {2, 3, 5, 7, 11, 13, 0}; +int arr2[105] = {2, 3, 5, 7, 11, 13, 0}; +int arr3[105] = {2, 3, 5, 7, 11, 13, 0}; +int arr4[105] = {2, 3, 5, 7, 11, 13, 0}; +int result1[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, 0}; +int result2[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -2, 0}; +int result3[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -2, 0}; +int result4[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0}; + +extern void abort (void); + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +void __attribute__((noinline)) foo1 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 2] = -2; + a[i + 3] = -3; + } +} + +void __attribute__((noinline)) foo2 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 2] = -1; + a[i + 3] = -2; + } +} + +void __attribute__((noinline)) foo3 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 3] = -2; + } +} + +void __attribute__((noinline)) foo4 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 3] = -1; + } +} + +int main (void) +{ + foo1 (arr1); + check (arr1, result1, 105); + + foo2 (arr2); + check (arr2, result2, 105); + + foo3 (arr3); + check (arr3, result3, 105); + + foo4 (arr4); + check (arr4, result4, 105); + + return 0; +} +/* { dg-final { scan-tree-dump-times "Store-stores chain" 4 "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c new file mode 100644 index 00000000000..302425a17cc --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-4.c @@ -0,0 +1,61 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, 3, 5, -1, 11, 0}; +int result2[10] = {0, 0, 5, -1, -1, 0}; +int result3[10] = {0, 0, 0, -1, -1, -1, 0}; +int result4[10] = {0, 0, 0, 0, -1, -1, -1, 0}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, 0}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 3] = -1; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c new file mode 100644 index 00000000000..a13d56098be --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-5.c @@ -0,0 +1,63 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11}; +int result0[10] = {2, 3, 5, 7, 11}; +int result1[10] = {0, -1, -2, -3, 11, 0}; +int result2[10] = {0, 0, -1, -2, -3, 0}; +int result3[10] = {0, 0, 0, -1, -2, -3, 0}; +int result4[10] = {0, 0, 0, 0, -1, -2, -3, 0}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, 0}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 2] = -2; + a[i + 3] = -3; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c new file mode 100644 index 00000000000..63d6c8f33b0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-6.c @@ -0,0 +1,65 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result1[10] = {0, -1, -2, -3, -4, -5, 17, 19}; +int result2[10] = {0, 0, -1, -2, -3, -4, -5, 19}; +int result3[10] = {0, 0, 0, -1, -2, -3, -4, -5}; +int result4[10] = {0, 0, 0, 0, -1, -2, -3, -4, -5}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -5}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 2] = -2; + a[i + 3] = -3; + a[i + 4] = -4; + a[i + 5] = -5; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c new file mode 100644 index 00000000000..0bde6e6dced --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-7.c @@ -0,0 +1,63 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result1[10] = {0, -1, 5, -3, 11, -5, 17, 19}; +int result2[10] = {0, 0, -1, -3, -3, -5, -5, 19}; +int result3[10] = {0, 0, 0, -1, -3, -3, -5, -5}; +int result4[10] = {0, 0, 0, 0, -1, -3, -3, -5, -5}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -3, -3, -5, -5}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 3] = -3; + a[i + 5] = -5; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c new file mode 100644 index 00000000000..45ffd25c424 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-8.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr[105] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result0[10] = {2, 3, 5, 7, 11, 13, 17, 19}; +int result1[10] = {0, 3, 5, 7, 11, -5, 17, 19}; +int result2[10] = {0, 0, 5, 7, 11, -5, -5, 19}; +int result3[10] = {0, 0, 0, 7, 11, -5, -5, -5}; +int result4[10] = {0, 0, 0, 0, 11, -5, -5, -5, -5}; +int result100[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -5, -5, -5, -5}; + +extern void abort (void); + +void __attribute__((noinline)) foo (int *a, int len) +{ + int i; + for (i = 0; i < len; i++) + { + a[i] = 0; + a[i + 5] = -5; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo (arr, 0); + check (arr, result0, 10); + + foo (arr, 1); + check (arr, result1, 10); + + foo (arr, 2); + check (arr, result2, 10); + + foo (arr, 3); + check (arr, result3, 10); + + foo (arr, 4); + check (arr, result4, 10); + + foo (arr, 100); + check (arr, result100, 105); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c new file mode 100644 index 00000000000..1c4e3140309 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/predcom-dse-9.c @@ -0,0 +1,90 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline -fpredictive-commoning -fdump-tree-pcom-details" } */ + +int arr1[105] = {2, 3, 5, 7, 11, 13, 17, 19}; +int arr2[105] = {2, 3, 5, 7, 11, 13, 17, 19}; +int arr3[105] = {2, 3, 5, 7, 11, 13, 17, 19}; + +int result1[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -2, -3, -4, -5}; +int result2[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -3, -3, -5, -5}; +int result3[105] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -5, -5, -5, -5}; + +extern void abort (void); + +void __attribute__((noinline)) foo1 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 2] = -2; + a[i + 3] = -3; + a[i + 4] = -4; + a[i + 5] = -5; + } +} + +void __attribute__((noinline)) foo2 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 1] = -1; + a[i + 3] = -3; + a[i + 5] = -5; + } +} + +void __attribute__((noinline)) foo3 (int *a) +{ + int i; + for (i = 0; i < 100; i++) + { + a[i] = 0; + a[i + 5] = -5; + } +} + +void check (int *a, int *res, int len) +{ + int i; + + for (i = 0; i < len; i++) + if (a[i] != res[i]) + abort (); +} + +int main (void) +{ + foo1 (arr1); + check (arr1, result1, 10); + + foo2 (arr2); + check (arr2, result2, 10); + + foo3 (arr3); + check (arr3, result3, 10); + + return 0; +} +/* { dg-final { scan-tree-dump "Store-stores chain" "pcom"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c index 9a7d8d5d253..0f57ea20b79 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-35.c @@ -3,7 +3,7 @@ phi has an argument which is a parameter. */ /* { dg-do compile } */ -/* { dg-options "-O3 -fno-code-hoisting -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ int f (int c, int i) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c index 1ab357d11c0..448d5d2cff1 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-36.c @@ -3,7 +3,7 @@ phi has an argument which is a parameter. */ /* { dg-do compile } */ -/* { dg-options "-O3 -fno-code-hoisting -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fdump-tree-optimized" } */ int f (int s, int c, int i) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c index 17d7b4c6951..1e943b737b9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-4.c @@ -23,13 +23,9 @@ f (int i) foo (y); } -/* { dg-final { scan-tree-dump-times "\\* 4" 1 "slsr" } } */ -/* { dg-final { scan-tree-dump-times "\\* 10" 1 "slsr" } } */ -/* { dg-final { scan-tree-dump-times "\\+ 20;" 1 "slsr" } } */ +/* { dg-final { scan-tree-dump-times "\\* 40" 1 "slsr" } } */ /* { dg-final { scan-tree-dump-times "\\+ 200" 1 "slsr" } } */ -/* { dg-final { scan-tree-dump-times "\\- 16;" 1 "slsr" } } */ /* { dg-final { scan-tree-dump-times "\\- 160" 1 "slsr" } } */ -/* { dg-final { scan-tree-dump-times "\\* 4" 1 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "\\* 10" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "\\* 40" 1 "optimized" } } */ /* { dg-final { scan-tree-dump-times "\\+ 200" 1 "optimized" } } */ /* { dg-final { scan-tree-dump-times "\\+ 40" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c index ece8cb2a80c..1d1fe82fda0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-30.c @@ -8,7 +8,7 @@ void test_bcopy (const void *s) { char d[33]; - /* Bcopy is transformed into memcpy and those calls are expanded + /* Bcopy is transformed into memmove and those calls are expanded inline in EVRP, before DSE runs, so this test doesn't actually verify that DSE does its job. */ __builtin_bcopy (s, d, sizeof d); @@ -28,4 +28,4 @@ void test_bzero (void) } /* { dg-final { scan-tree-dump-times "builtin_memset" 1 "dse1" } } */ -/* { dg-final { scan-tree-dump-not "builtin_(bcopy|bzero|memcpy)" "dse1" } } */ +/* { dg-final { scan-tree-dump-not "builtin_(bcopy|bzero|memcpy|memmove)" "dse1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c new file mode 100644 index 00000000000..d9d7b2394cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp116.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-vrp1" } */ + +int +f (int m1, int m2, int c) +{ + int d = m1 > m2; + int e = d * c; + return e ? m1 : m2; +} + +/* { dg-final { scan-tree-dump-times "\\? c_\[0-9\]\\(D\\) : 0" 1 "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c index 853ee21bb8f..ed49e25f87a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp24.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details" } */ +/* { dg-options "-O2 -fno-tree-forwprop -fdump-tree-vrp1-details -fdump-tree-optimized" } */ struct rtx_def; @@ -86,10 +86,8 @@ L7: /* The first n_sets > 0 test can be simplfiied into n_sets == 1 since n_sets can only have the values [0, 1] as it's the result of a - boolean operation. + boolean operation. */ - The second n_sets > 0 test can also be simplified into n_sets == 1 - as the only way to reach the tests is when n_sets <= 1 and the only - value which satisfies both conditions is n_sets == 1. */ -/* { dg-final { scan-tree-dump-times "Simplified relational" 2 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */ +/* { dg-final { scan-tree-dump-times "if " 4 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81162.c b/gcc/testsuite/gcc.dg/ubsan/pr81162.c new file mode 100644 index 00000000000..9ce98afa367 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr81162.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/81162 */ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined -O2" } */ + +short s; +int i1 = 1; +int i2 = 1; +unsigned char uc = 147; + +int main() { + s = (-uc + 2147483647) << 0; + if (9031239389974324562ULL >= (-((i1 && i2) + uc) ^ -21096) ) { + return 0; + } else { + return -1; + } +} diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81223.c b/gcc/testsuite/gcc.dg/ubsan/pr81223.c new file mode 100644 index 00000000000..e7aff5243e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr81223.c @@ -0,0 +1,12 @@ +/* PR sanitizer/81223 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=undefined" } */ + +void bar (); + +void +foo (int x) +{ + struct S { char a[x]; } v; + bar (v); +} diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81505.c b/gcc/testsuite/gcc.dg/ubsan/pr81505.c new file mode 100644 index 00000000000..1cebef56172 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr81505.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fsanitize=signed-integer-overflow" } */ + +int a, b, c, h; + +int i[5][5]; + +void +fn1 () +{ + int l = 0; + + for (a = 0; a <= 3; a++) + for (b = 1; b >= 0; b -= 1) + l |= i[0][b]; + c = l; +} diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c index a6c75c7c77f..0e4f1a71b6b 100644 --- a/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr65935.c @@ -57,4 +57,6 @@ int main() return 0; } -/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp1" } } */ +/* We should also be able to use 2-lane SLP to initialize the real and + imaginary components in the first loop of main. */ +/* { dg-final { scan-tree-dump-times "basic block vectorized" 2 "slp1" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr80815-3.c b/gcc/testsuite/gcc.dg/vect/pr80815-3.c index dae01fa7af7..50392ab1a41 100644 --- a/gcc/testsuite/gcc.dg/vect/pr80815-3.c +++ b/gcc/testsuite/gcc.dg/vect/pr80815-3.c @@ -42,4 +42,4 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump "improved number of alias checks from \[0-9\]* to 1" "vect" } } */ +/* { dg-final { scan-tree-dump "improved number of alias checks from \[0-9\]* to 1" "vect" { target vect_perm } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr81136.c b/gcc/testsuite/gcc.dg/vect/pr81136.c new file mode 100644 index 00000000000..24bd8fa3b19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81136.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +struct __attribute__((aligned (32))) +{ + char misaligner; + int foo[100]; + int bar[100]; +} *a; + +void +fn1 (int n) +{ + int *b = a->foo; + for (int i = 0; i < n; i++) + a->bar[i] = b[i]; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr81196.c b/gcc/testsuite/gcc.dg/vect/pr81196.c new file mode 100644 index 00000000000..46d7a9ebc57 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81196.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_perm_short } */ + +void f(short*p){ + p=(short*)__builtin_assume_aligned(p,64); + short*q=p+256; + for(;p!=q;++p,--q){ + short t=*p;*p=*q;*q=t; + } +} +void b(short*p){ + p=(short*)__builtin_assume_aligned(p,64); + short*q=p+256; + for(;p<q;++p,--q){ + short t=*p;*p=*q;*q=t; + } +} +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr81410.c b/gcc/testsuite/gcc.dg/vect/pr81410.c new file mode 100644 index 00000000000..8d1bd6c8efd --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr81410.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_long_long } */ + +#include "tree-vect.h" + +long long x[24]; +long long y[16]; +long long z[8]; + +void __attribute__((noinline)) foo() +{ + for (int i = 0; i < 8; ++i) + { + y[2*i] = x[3*i]; + y[2*i + 1] = x[3*i + 1]; + z[i] = 1; + } +} + +int main() +{ + check_vect (); + + for (int i = 0; i < 24; ++i) + { + x[i] = i; + __asm__ volatile ("" : : : "memory"); + } + foo (); + for (int i = 0; i < 8; ++i) + if (y[2*i] != 3*i || y[2*i+1] != 3*i + 1) + __builtin_abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-43.c b/gcc/testsuite/gcc.dg/vect/slp-43.c index fea3aadb341..880a2961ae1 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-43.c +++ b/gcc/testsuite/gcc.dg/vect/slp-43.c @@ -4,13 +4,16 @@ #include <string.h> #include "tree-vect.h" +/* AVX512BW has V64QImode, make char_1 vectorizable with that. */ +#define MAX_VEC_ELEMENTS 64 + #define FOO(T,N) \ void __attribute__((noinline,noclone)) \ foo_ ## T ## _ ## N (T * __restrict__ in_, T * __restrict__ out_, int s) \ { \ T *in = __builtin_assume_aligned (in_, __BIGGEST_ALIGNMENT__); \ T *out = __builtin_assume_aligned (out_, __BIGGEST_ALIGNMENT__); \ - for (int i = 0; i < 16; i++) \ + for (int i = 0; i < MAX_VEC_ELEMENTS; i++) \ { \ for (int j = 0; j < N; ++j) \ out[j] = in[j]; \ @@ -23,9 +26,9 @@ foo_ ## T ## _ ## N (T * __restrict__ in_, T * __restrict__ out_, int s) \ do { \ memset (out, 0, 4096); \ foo_ ## T ## _ ## N ((T *)in, (T *)out, 1); \ - if (memcmp (in, out, sizeof (T) * 16 * N) != 0) \ + if (memcmp (in, out, sizeof (T) * MAX_VEC_ELEMENTS * N) != 0) \ __builtin_abort (); \ - for (int i = sizeof (T) * 16 * N; i < 4096; ++i) \ + for (int i = sizeof (T) * MAX_VEC_ELEMENTS * N; i < 4096; ++i) \ if (out[i] != 0) \ __builtin_abort (); \ } while (0) diff --git a/gcc/testsuite/gcc.dg/vect/slp-45.c b/gcc/testsuite/gcc.dg/vect/slp-45.c index a8300a44670..20a9f815292 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-45.c +++ b/gcc/testsuite/gcc.dg/vect/slp-45.c @@ -4,13 +4,16 @@ #include <string.h> #include "tree-vect.h" +/* AVX512BW has V64QImode, make char_1 vectorizable with that. */ +#define MAX_VEC_ELEMENTS 64 + #define FOO(T,N) \ void __attribute__((noinline,noclone)) \ foo_ ## T ## _ ## N (T * __restrict__ in_, T * __restrict__ out_, int s) \ { \ T *in = __builtin_assume_aligned (in_, __BIGGEST_ALIGNMENT__); \ T *out = __builtin_assume_aligned (out_, __BIGGEST_ALIGNMENT__); \ - for (int i = 0; i < 16; i++) \ + for (int i = 0; i < MAX_VEC_ELEMENTS; i++) \ { \ for (int j = 0; j < N; ++j) \ out[j] = in[j]; \ @@ -23,9 +26,9 @@ foo_ ## T ## _ ## N (T * __restrict__ in_, T * __restrict__ out_, int s) \ do { \ memset (out, 0, 4096); \ foo_ ## T ## _ ## N ((T *)in, (T *)out, 1); \ - if (memcmp (in, out, sizeof (T) * 16 * N) != 0) \ + if (memcmp (in, out, sizeof (T) * MAX_VEC_ELEMENTS * N) != 0) \ __builtin_abort (); \ - for (int i = sizeof (T) * 16 * N; i < 4096; ++i) \ + for (int i = sizeof (T) * MAX_VEC_ELEMENTS * N; i < 4096; ++i) \ if (out[i] != 0) \ __builtin_abort (); \ } while (0) diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-8.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-8.c new file mode 100644 index 00000000000..618c800e577 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-8.c @@ -0,0 +1,48 @@ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +static int a[512], b[512]; + +void __attribute__((noinline,noclone)) +foo (int *sum1p, int *sum2p, int *sum3p) +{ + int sum1 = 0; + int sum2 = 0; + int sum3 = 0; + /* Check that we vectorize a reduction chain and a SLP reduction + at the same time. */ + for (int i = 0; i < 256; ++i) + { + sum1 += a[2*i]; + sum1 += a[2*i + 1]; + sum2 += b[2*i]; + sum3 += b[2*i + 1]; + } + *sum1p = sum1; + *sum2p = sum2; + *sum3p = sum3; +} + +int main() +{ + check_vect (); + + for (int i = 0; i < 256; ++i) + { + a[2*i] = i; + a[2*i + 1] = i/2; + b[2*i] = i + 1; + b[2*i + 1] = i/2 + 1; + __asm__ volatile ("" : : : "memory"); + } + int sum1, sum2, sum3; + foo (&sum1, &sum2, &sum3); + if (sum1 != 48896 || sum2 != 32896 || sum3 != 16512) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */ +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-11.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-11.c new file mode 100644 index 00000000000..29408edcfce --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-11.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_int } */ + +#include "tree-vect.h" + +int x[1024], y[1024], z[1024]; + +int __attribute__((noinline,noclone)) +foo (int n) +{ + int sum = 0; + /* Can vectorize this. */ + for (int i = 0; i < n; ++i) + sum = (y[i] - (x[i] - sum)); + return sum; +} + +int __attribute__((noinline,noclone)) +bar (int n) +{ + int sum = 0; + /* Cannot vectorize this, sum is negated. */ + for (int i = 0; i < n; ++i) + sum = z[i] - (y[i] - (x[i] - sum)); + return sum; +} + +int +main() +{ + check_vect (); + for (int i = 0; i < 1024; ++i) + { + x[i] = i; + y[i] = i + 1; + z[i] = 0; + __asm__ volatile ("" : : : "memory"); + } + if (foo (1024) != 1024) + __builtin_abort (); + if (bar (1023) != -1 || bar (1024) != 0) + __builtin_abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/ccmp_2.c b/gcc/testsuite/gcc.target/aarch64/ccmp_2.c new file mode 100644 index 00000000000..77ab0207886 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/ccmp_2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int g(void); +int h(int a, _Bool c) +{ + if (a != 0 && c) + return g(); + return 1; +} + +/* { dg-final { scan-assembler "\tccmp\t" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/cmp-2.c b/gcc/testsuite/gcc.target/aarch64/cmp-2.c new file mode 100644 index 00000000000..12016647061 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/cmp-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int lt (int x, int y) +{ + if ((x - y) < 0) + return 10; + + return 0; +} + +int ge (int x, int y) +{ + if ((x - y) >= 0) + return 10; + + return 0; +} + +/* { dg-final { scan-assembler-times "csel\t" 2 } } */ +/* { dg-final { scan-assembler-not "sub\t" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c b/gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c new file mode 100644 index 00000000000..e8dd01db056 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/dbl_mov_immediate_1.c @@ -0,0 +1,53 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-skip-if "Tiny model won't generate adrp" { *-*-* } { "-mcmodel=tiny" } { "" } } */ + +double d0(void) +{ + double x = 0.0d; + return x; +} + +double dn1(void) +{ + double x = -0.0d; + return x; +} + + +double d1(void) +{ + double x = 1.5d; + return x; +} + +double d2(void) +{ + double x = 123256.0d; + return x; +} + +double d3(void) +{ + double x = 123256123456.0d; + return x; +} + +double d4(void) +{ + double x = 123456123456123456.0d; + return x; +} + +/* { dg-final { scan-assembler-times "movi\td\[0-9\]+, #?0" 1 } } */ + +/* { dg-final { scan-assembler-times "adrp\tx\[0-9\]+, \.LC\[0-9\]" 2 } } */ +/* { dg-final { scan-assembler-times "ldr\td\[0-9\]+, \\\[x\[0-9\], #:lo12:\.LC\[0-9\]\\\]" 2 } } */ + +/* { dg-final { scan-assembler-times "fmov\td\[0-9\]+, 1\\\.5e\\\+0" 1 } } */ + +/* { dg-final { scan-assembler-times "mov\tx\[0-9\]+, 25838523252736" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x40fe, lsl 48" 1 } } */ +/* { dg-final { scan-assembler-times "mov\tx\[0-9\]+, -9223372036854775808" 1 } } */ +/* { dg-final { scan-assembler-times "fmov\td\[0-9\]+, x\[0-9\]+" 2 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_1.c b/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_1.c new file mode 100644 index 00000000000..1ed3831e139 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_1.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */ +/* { dg-add-options arm_v8_2a_fp16_scalar } */ + +extern __fp16 foo (); +extern void bar (__fp16* x); + +void f1 () +{ + volatile __fp16 a = 17.0; +} + + +void f2 (__fp16 *a) +{ + *a = 17.0; +} + +void f3 () +{ + __fp16 b = foo (); + b = 17.0; + bar (&b); +} + +__fp16 f4 () +{ + __fp16 a = 0; + __fp16 b = 1; + __fp16 c = 2; + __fp16 d = 4; + + __fp16 z = a + b; + z = z + c; + z = z - d; + return z; +} + +__fp16 f5 () +{ + __fp16 a = 16; + bar (&a); + return a; +} + +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, #?19520" 3 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0xbc, lsl 8" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x4c, lsl 8" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_2.c b/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_2.c new file mode 100644 index 00000000000..6f44821e9d0 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/f16_mov_immediate_2.c @@ -0,0 +1,45 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ +/* { dg-require-effective-target arm_v8_2a_fp16_scalar_ok } */ +/* { dg-add-options arm_v8_2a_fp16_scalar } */ + +#include <arm_fp16.h> + +float16_t f0(void) +{ + float16_t x = 0.0f; + return x; +} + +float16_t fn1(void) +{ + float16_t x = -0.0f; + return x; +} + +float16_t f1(void) +{ + float16_t x = 256.0f; + return x; +} + +float16_t f2(void) +{ + float16_t x = 123256.0f; + return x; +} + +float16_t f3(void) +{ + float16_t x = 17.0; + return x; +} + +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.4h, ?#0" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x80, lsl 8" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x5c, lsl 8" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x7c, lsl 8" 1 } } */ + +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, 19520" 1 } } */ +/* { dg-final { scan-assembler-times "fmov\th\[0-9\], w\[0-9\]+" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/flt_mov_immediate_1.c b/gcc/testsuite/gcc.target/aarch64/flt_mov_immediate_1.c new file mode 100644 index 00000000000..7b92a5ae40f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/flt_mov_immediate_1.c @@ -0,0 +1,52 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +float f0(void) +{ + float x = 0.0f; + return x; +} + +float fn1(void) +{ + float x = -0.0f; + return x; +} + +float f1(void) +{ + float x = 256.0f; + return x; +} + +float f2(void) +{ + float x = 123256.0f; + return x; +} + +float f3(void) +{ + float x = 2.0f; + return x; +} + +float f4(void) +{ + float x = -20000.1; + return x; +} + + +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, ?#0" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x80, lsl 24" 1 } } */ +/* { dg-final { scan-assembler-times "movi\tv\[0-9\]+\\\.2s, 0x80, lsl 24" 1 } } */ + +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, 48128" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tw\[0-9\]+, 0x47f0, lsl 16" 1 } } */ + +/* { dg-final { scan-assembler-times "fmov\ts\[0-9\]+, 2\\\.0e\\\+0" 1 } } */ + +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, 16435" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tw\[0-9\]+, 0xc69c, lsl 16" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/int_mov_immediate_1.c b/gcc/testsuite/gcc.target/aarch64/int_mov_immediate_1.c new file mode 100644 index 00000000000..6ac9065037f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/int_mov_immediate_1.c @@ -0,0 +1,59 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O3" } */ + +long long f1(void) +{ + return 0xffff6666; +} + +int f3(void) +{ + return 0xffff6666; +} + + +long f2(void) +{ + return 0x11110000ffff6666; +} + +long f4(void) +{ + return 0x11110001ffff6666; +} + +long f5(void) +{ + return 0x111100001ff6666; +} + +long f6(void) +{ + return 0x00001111ffff6666; +} + +long f7(void) +{ + return 0x000011116666ffff; +} + +long f8(void) +{ + return 0x0f0011116666ffff; +} + +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, -39322" 1 } } */ +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, 4294927974" 3 } } */ +/* { dg-final { scan-assembler-times "mov\tw\[0-9\]+, 1718026239" 1 } } */ +/* { dg-final { scan-assembler-times "mov\tx\[0-9\]+, -2576941057" 1 } } */ +/* { dg-final { scan-assembler-times "mov\tx\[0-9\]+, -39322" 1 } } */ +/* { dg-final { scan-assembler-times "mov\tx\[0-9\]+, 26214" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0xf00, lsl 48" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x1111, lsl 48" 2 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x1000, lsl 32" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x1111, lsl 32" 3 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x111, lsl 48" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x1ff, lsl 16" 1 } } */ +/* { dg-final { scan-assembler-times "movk\tx\[0-9\]+, 0x1, lsl 32" 1 } } */ + diff --git a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c index c917f81c022..114d8c1a6c3 100644 --- a/gcc/testsuite/gcc.target/aarch64/pr63304_1.c +++ b/gcc/testsuite/gcc.target/aarch64/pr63304_1.c @@ -4,10 +4,10 @@ #pragma GCC target ("+nothing+simd, cmodel=small") int -cal (float a) +cal (double a) { - float b = 1.2; - float c = 2.2; + double b = 3.2; + double c = 2.2; if ((a + b) != c) return 0; else @@ -19,11 +19,11 @@ cal (float a) #pragma GCC target ("cmodel=large") int -cal2 (float a) +cal2 (double a) { - float b = 1.2; - float c = 2.2; + double b = 3.2; + double c = 2.2; if ((a + b) != c) return 0; else @@ -33,11 +33,11 @@ cal2 (float a) #pragma GCC pop_options int -cal3 (float a) +cal3 (double a) { - float b = 1.2; - float c = 2.2; + double b = 3.2; + double c = 2.2; if ((a + b) != c) return 0; else diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c new file mode 100644 index 00000000000..a889dfdd895 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ +/* { dg-require-effective-target lp64 } */ + +__int128 +t (void) +{ + return (__int128)1 << 80; +} + +/* { dg-final { scan-assembler "adr" } } */ +/* { dg-final { scan-assembler-not "adrp" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr81414.C b/gcc/testsuite/gcc.target/aarch64/pr81414.C new file mode 100644 index 00000000000..53dfc7cf800 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr81414.C @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=cortex-a57" } */ + +typedef __Float32x2_t float32x2_t; +float32x2_t +foo1 (float32x2_t __a, float32x2_t __b, float32x2_t __c) { + return __b * __c + __a; +} + diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vminmaxnm_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vminmaxnm_1.c index 192bad9879b..8fd428115ba 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vminmaxnm_1.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vminmaxnm_1.c @@ -7,12 +7,10 @@ extern void abort (); -#define CHECK(T, N, R, E) \ +#define CHECK(R, E) \ {\ - int i = 0;\ - for (; i < N; i++)\ - if (* (T *) &R[i] != * (T *) &E[i])\ - abort ();\ + if (__builtin_memcmp (&R, &E, sizeof (R)) != 0)\ + abort ();\ } int @@ -26,8 +24,8 @@ main (int argc, char **argv) float32x2_t f32x2_ret_minnm = vminnm_f32 (f32x2_input1, f32x2_input2); float32x2_t f32x2_ret_maxnm = vmaxnm_f32 (f32x2_input1, f32x2_input2); - CHECK (uint32_t, 2, f32x2_ret_minnm, f32x2_exp_minnm); - CHECK (uint32_t, 2, f32x2_ret_maxnm, f32x2_exp_maxnm); + CHECK (f32x2_ret_minnm, f32x2_exp_minnm); + CHECK (f32x2_ret_maxnm, f32x2_exp_maxnm); /* v{min|max}nm_f32 NaN. */ f32x2_input1 = vdup_n_f32 (__builtin_nanf ("")); @@ -37,8 +35,8 @@ main (int argc, char **argv) f32x2_ret_minnm = vminnm_f32 (f32x2_input1, f32x2_input2); f32x2_ret_maxnm = vmaxnm_f32 (f32x2_input1, f32x2_input2); - CHECK (uint32_t, 2, f32x2_ret_minnm, f32x2_exp_minnm); - CHECK (uint32_t, 2, f32x2_ret_maxnm, f32x2_exp_maxnm); + CHECK (f32x2_ret_minnm, f32x2_exp_minnm); + CHECK (f32x2_ret_maxnm, f32x2_exp_maxnm); /* v{min|max}nmq_f32 normal. */ float32x4_t f32x4_input1 = vdupq_n_f32 (-1024.0); @@ -48,8 +46,8 @@ main (int argc, char **argv) float32x4_t f32x4_ret_minnm = vminnmq_f32 (f32x4_input1, f32x4_input2); float32x4_t f32x4_ret_maxnm = vmaxnmq_f32 (f32x4_input1, f32x4_input2); - CHECK (uint32_t, 4, f32x4_ret_minnm, f32x4_exp_minnm); - CHECK (uint32_t, 4, f32x4_ret_maxnm, f32x4_exp_maxnm); + CHECK (f32x4_ret_minnm, f32x4_exp_minnm); + CHECK (f32x4_ret_maxnm, f32x4_exp_maxnm); /* v{min|max}nmq_f32 NaN. */ f32x4_input1 = vdupq_n_f32 (-__builtin_nanf ("")); @@ -59,8 +57,8 @@ main (int argc, char **argv) f32x4_ret_minnm = vminnmq_f32 (f32x4_input1, f32x4_input2); f32x4_ret_maxnm = vmaxnmq_f32 (f32x4_input1, f32x4_input2); - CHECK (uint32_t, 4, f32x4_ret_minnm, f32x4_exp_minnm); - CHECK (uint32_t, 4, f32x4_ret_maxnm, f32x4_exp_maxnm); + CHECK (f32x4_ret_minnm, f32x4_exp_minnm); + CHECK (f32x4_ret_maxnm, f32x4_exp_maxnm); /* v{min|max}nm_f64 normal. */ float64x1_t f64x1_input1 = vdup_n_f64 (1.23); @@ -69,16 +67,16 @@ main (int argc, char **argv) float64x1_t f64x1_exp_maxnm = vdup_n_f64 (4.56); float64x1_t f64x1_ret_minnm = vminnm_f64 (f64x1_input1, f64x1_input2); float64x1_t f64x1_ret_maxnm = vmaxnm_f64 (f64x1_input1, f64x1_input2); - CHECK (uint64_t, 1, f64x1_ret_minnm, f64x1_exp_minnm); - CHECK (uint64_t, 1, f64x1_ret_maxnm, f64x1_exp_maxnm); + CHECK (f64x1_ret_minnm, f64x1_exp_minnm); + CHECK (f64x1_ret_maxnm, f64x1_exp_maxnm); /* v{min|max}_f64 normal. */ float64x1_t f64x1_exp_min = vdup_n_f64 (1.23); float64x1_t f64x1_exp_max = vdup_n_f64 (4.56); float64x1_t f64x1_ret_min = vmin_f64 (f64x1_input1, f64x1_input2); float64x1_t f64x1_ret_max = vmax_f64 (f64x1_input1, f64x1_input2); - CHECK (uint64_t, 1, f64x1_ret_min, f64x1_exp_min); - CHECK (uint64_t, 1, f64x1_ret_max, f64x1_exp_max); + CHECK (f64x1_ret_min, f64x1_exp_min); + CHECK (f64x1_ret_max, f64x1_exp_max); /* v{min|max}nmq_f64 normal. */ float64x2_t f64x2_input1 = vdupq_n_f64 (1.23); @@ -87,8 +85,8 @@ main (int argc, char **argv) float64x2_t f64x2_exp_maxnm = vdupq_n_f64 (4.56); float64x2_t f64x2_ret_minnm = vminnmq_f64 (f64x2_input1, f64x2_input2); float64x2_t f64x2_ret_maxnm = vmaxnmq_f64 (f64x2_input1, f64x2_input2); - CHECK (uint64_t, 2, f64x2_ret_minnm, f64x2_exp_minnm); - CHECK (uint64_t, 2, f64x2_ret_maxnm, f64x2_exp_maxnm); + CHECK (f64x2_ret_minnm, f64x2_exp_minnm); + CHECK (f64x2_ret_maxnm, f64x2_exp_maxnm); /* v{min|max}nm_f64 NaN. */ f64x1_input1 = vdup_n_f64 (-__builtin_nanf ("")); @@ -98,8 +96,8 @@ main (int argc, char **argv) f64x1_ret_minnm = vminnm_f64 (f64x1_input1, f64x1_input2); f64x1_ret_maxnm = vmaxnm_f64 (f64x1_input1, f64x1_input2); - CHECK (uint64_t, 1, f64x1_ret_minnm, f64x1_exp_minnm); - CHECK (uint64_t, 1, f64x1_ret_maxnm, f64x1_exp_maxnm); + CHECK (f64x1_ret_minnm, f64x1_exp_minnm); + CHECK (f64x1_ret_maxnm, f64x1_exp_maxnm); /* v{min|max}_f64 NaN. */ f64x1_input1 = vdup_n_f64 (-__builtin_nanf ("")); @@ -109,8 +107,8 @@ main (int argc, char **argv) f64x1_ret_minnm = vmin_f64 (f64x1_input1, f64x1_input2); f64x1_ret_maxnm = vmax_f64 (f64x1_input1, f64x1_input2); - CHECK (uint64_t, 1, f64x1_ret_minnm, f64x1_exp_minnm); - CHECK (uint64_t, 1, f64x1_ret_maxnm, f64x1_exp_maxnm); + CHECK (f64x1_ret_minnm, f64x1_exp_minnm); + CHECK (f64x1_ret_maxnm, f64x1_exp_maxnm); /* v{min|max}nmq_f64 NaN. */ f64x2_input1 = vdupq_n_f64 (-__builtin_nan ("")); @@ -120,8 +118,8 @@ main (int argc, char **argv) f64x2_ret_minnm = vminnmq_f64 (f64x2_input1, f64x2_input2); f64x2_ret_maxnm = vmaxnmq_f64 (f64x2_input1, f64x2_input2); - CHECK (uint64_t, 2, f64x2_ret_minnm, f64x2_exp_minnm); - CHECK (uint64_t, 2, f64x2_ret_maxnm, f64x2_exp_maxnm); + CHECK (f64x2_ret_minnm, f64x2_exp_minnm); + CHECK (f64x2_ret_maxnm, f64x2_exp_maxnm); return 0; } diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vmla_elem_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vmla_elem_1.c new file mode 100644 index 00000000000..df777581ab4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vmla_elem_1.c @@ -0,0 +1,67 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef short int __attribute__ ((vector_size (16))) v8hi; + +v8hi +mla8hi (v8hi v0, v8hi v1, short int v2) +{ + /* { dg-final { scan-assembler "mla\\tv\[0-9\]\+\\.8h, v\[0-9\]\+\\.8h, v\[0-9\]\+\\.h\\\[0\\\]" } } */ + return v0 + v1 * v2; +} + + +v8hi +mls8hi (v8hi v0, v8hi v1, short int v2) +{ + /* { dg-final { scan-assembler "mls\\tv\[0-9\]\+\\.8h, v\[0-9\]\+\\.8h, v\[0-9\]\+\\.h\\\[0\\\]" } } */ + return v0 - v1 * v2; +} + +typedef short int __attribute__ ((vector_size (8))) v4hi; + +v4hi +mla4hi (v4hi v0, v4hi v1, short int v2) +{ + /* { dg-final { scan-assembler "mla\\tv\[0-9\]\+\\.4h, v\[0-9\]\+\\.4h, v\[0-9\]\+\\.h\\\[0\\\]" } } */ + return v0 + v1 * v2; +} + +v4hi +mls4hi (v4hi v0, v4hi v1, short int v2) +{ + /* { dg-final { scan-assembler "mls\\tv\[0-9\]\+\\.4h, v\[0-9\]\+\\.4h, v\[0-9\]\+\\.h\\\[0\\\]" } } */ + return v0 - v1 * v2; +} + +typedef int __attribute__ ((vector_size (16))) v4si; + +v4si +mla4si (v4si v0, v4si v1, int v2) +{ + /* { dg-final { scan-assembler "mla\\tv\[0-9\]\+\\.4s, v\[0-9\]\+\\.4s, v\[0-9\]\+\\.s\\\[0\\\]" } } */ + return v0 + v1 * v2; +} + +v4si +mls4si (v4si v0, v4si v1, int v2) +{ + /* { dg-final { scan-assembler "mls\\tv\[0-9\]\+\\.4s, v\[0-9\]\+\\.4s, v\[0-9\]\+\\.s\\\[0\\\]" } } */ + return v0 - v1 * v2; +} + +typedef int __attribute__((vector_size (8))) v2si; + +v2si +mla2si (v2si v0, v2si v1, int v2) +{ + /* { dg-final { scan-assembler "mla\\tv\[0-9\]\+\\.2s, v\[0-9\]\+\\.2s, v\[0-9\]\+\\.s\\\[0\\\]" } } */ + return v0 + v1 * v2; +} + +v2si +mls2si (v2si v0, v2si v1, int v2) +{ + /* { dg-final { scan-assembler "mls\\tv\[0-9\]\+\\.2s, v\[0-9\]\+\\.2s, v\[0-9\]\+\\.s\\\[0\\\]" } } */ + return v0 - v1 * v2; +} diff --git a/gcc/testsuite/gcc.target/aarch64/stack-checking.c b/gcc/testsuite/gcc.target/aarch64/stack-checking.c index 1d1530df62b..eaa40581c86 100644 --- a/gcc/testsuite/gcc.target/aarch64/stack-checking.c +++ b/gcc/testsuite/gcc.target/aarch64/stack-checking.c @@ -1,4 +1,5 @@ /* { dg-do run { target { *-*-linux* } } } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check" } */ int main(void) diff --git a/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c b/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c new file mode 100644 index 00000000000..33a2c0f45af --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/tst_imm_split_1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +f (unsigned char *p) +{ + return p[0] == 50 || p[0] == 52; +} + +int +g (unsigned char *p) +{ + return (p[0] >> 4 & 0xfd) == 0; +} + +/* { dg-final { scan-assembler-not "and\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+.*" } } */ +/* { dg-final { scan-assembler "tst\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+" } } */ +/* { dg-final { scan-assembler "tst\\t\[xw\]\[0-9\]+, \[xw\]\[0-9\]+, lsr 4" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/var_shift_mask_1.c b/gcc/testsuite/gcc.target/aarch64/var_shift_mask_1.c new file mode 100644 index 00000000000..0bd326a879d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/var_shift_mask_1.c @@ -0,0 +1,65 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +/* The integer variable shift and rotate instructions truncate their + shift amounts by the datasize. Make sure that we don't emit a redundant + masking operation. */ + +unsigned +f1 (unsigned x, int y) +{ + return x << (y & 31); +} + +unsigned long long +f2 (unsigned long long x, int y) +{ + return x << (y & 63); +} + +unsigned long long +f3 (unsigned long long bit_addr, int y) +{ + unsigned long bitnumb = bit_addr & 63; + return (1LL << bitnumb); +} + +unsigned int +f4 (unsigned int x, unsigned int y) +{ + y &= 31; + return x >> y | (x << (32 - y)); +} + +unsigned long long +f5 (unsigned long long x, unsigned long long y) +{ + y &= 63; + return x >> y | (x << (64 - y)); +} + +unsigned int +f6 (unsigned int x, unsigned int y) +{ + return (x << (32 - (y & 31))); +} + +unsigned long long +f7 (unsigned long long x, unsigned long long y) +{ + return (x << (64 - (y & 63))); +} + +unsigned long long +f8 (unsigned long long x, unsigned long long y) +{ + return (x << -(y & 63)); +} + +/* { dg-final { scan-assembler-times "lsl\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 2 } } */ +/* { dg-final { scan-assembler-times "lsl\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 4 } } */ +/* { dg-final { scan-assembler-times "ror\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" 1 } } */ +/* { dg-final { scan-assembler-times "ror\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+" 1 } } */ +/* { dg-final { scan-assembler-not "and\tw\[0-9\]+, w\[0-9\]+, 31" } } */ +/* { dg-final { scan-assembler-not "and\tx\[0-9\]+, x\[0-9\]+, 63" } } */ +/* { dg-final { scan-assembler-not "sub\tw\[0-9\]+, w\[0-9\]+, w\[0-9\]+" } } */ diff --git a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c index 57cb95b91fc..5fd6c360363 100644 --- a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c +++ b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-1.c @@ -7,7 +7,7 @@ static int id (int i) { - asm ("": "+Xr" (i)); + asm ("": "+r" (i)); return i; } diff --git a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c index 287d96d4ee9..6ec4bc5d875 100644 --- a/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c +++ b/gcc/testsuite/gcc.target/arc/mulsi3_highpart-2.c @@ -9,7 +9,7 @@ static int id (int i) { - asm ("": "+Xr" (i)); + asm ("": "+r" (i)); return i; } diff --git a/gcc/testsuite/gcc.target/arc/naked-1.c b/gcc/testsuite/gcc.target/arc/naked-1.c new file mode 100644 index 00000000000..e45f433f73c --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/naked-1.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* Check that naked functions don't place arguments on the stack at + optimisation level '-O0'. */ +extern void bar (int); + +void __attribute__((naked)) +foo (int n, int m) +{ + bar (n + m); +} +/* { dg-final { scan-assembler "\tbl @bar" } } */ + +/* Look for things that would appear in a non-naked function, but which + should not appear in a naked function. */ +/* { dg-final { scan-assembler-not "\tj.* \\\[blink\\\]" } } */ +/* { dg-final { scan-assembler-not "\tst.* " } } */ +/* { dg-final { scan-assembler-not "\tmov fp,sp" } } */ diff --git a/gcc/testsuite/gcc.target/arc/naked-2.c b/gcc/testsuite/gcc.target/arc/naked-2.c new file mode 100644 index 00000000000..7b7262f7916 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/naked-2.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ +/* Check that naked functions don't place arguments on the stack at + optimisation level '-O0'. */ + +#if defined(__HS__) || defined(__EM__) +# define ILINK "ilink" +#else +# define ILINK "ilink1" +#endif + +extern void bar (int); + +void __attribute__((naked, interrupt(ILINK))) +foo (int n, int m) +{ + bar (n + m); +} +/* { dg-final { scan-assembler "\tbl @bar" } } */ + +/* Look for things that would appear in a non-naked function, but which + should not appear in a naked function. */ +/* { dg-final { scan-assembler-not "\trtie" } } */ +/* { dg-final { scan-assembler-not "j.*\[ilink1\]" } } */ +/* { dg-final { scan-assembler-not "\tst.* " } } */ +/* { dg-final { scan-assembler-not "\tmov fp,sp" } } */ diff --git a/gcc/testsuite/gcc.target/arc/pic-1.c b/gcc/testsuite/gcc.target/arc/pic-1.c new file mode 100644 index 00000000000..ab24763b67f --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/pic-1.c @@ -0,0 +1,11 @@ +/* Tests how complex pic constant expressions are handled. */ +/* { dg-do assemble } */ +/* { dg-skip-if "PIC not available for ARC6xx" { arc6xx } } */ +/* { dg-options "-mno-sdata -w -Os -fpic" } */ + +a() { + char *b = ""; + char c; + int d = &c - " \n\t\v\b\r\f\a/\0"; + e(b[d]); +} diff --git a/gcc/testsuite/gcc.target/arc/pr9000674901.c b/gcc/testsuite/gcc.target/arc/pr9000674901.c new file mode 100644 index 00000000000..2a15c1c1478 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/pr9000674901.c @@ -0,0 +1,58 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! { clmcpu } } } */ +/* { dg-options "-mcpu=arc700 -O2 -fpic" } */ + +/* Test if the compiler generates a constant address having that uses + a neg keyword on the pic unspec. */ + +typedef unsigned int uint32_t; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned long long int uint64_t; + +enum type { + t_undef = 0x01, + t_group = 0x02, + t_partition = 0x04, + t_spare = 0x08, + t_linear = 0x10, + t_raid0 = 0x20, + t_raid1 = 0x40, + t_raid4 = 0x80, + t_raid5_ls = 0x100, + t_raid5_rs = 0x200, + t_raid5_la = 0x400, + t_raid5_ra = 0x800, + t_raid6 = 0x1000, +}; + +struct raid_set { + enum type type; +}; + +void +_find_factors (struct raid_set *rs, uint8_t * div, uint8_t * sub) +{ + struct factors { + const uint8_t level; + const uint8_t div, sub; + }; + static struct factors factors[] = { + {0, 1, 0}, + {1, 2, 0}, + {2, 2, 0}, + {5, 1, 1}, + }; + struct factors *f = (factors + (sizeof (factors) / sizeof (*factors))); + + while (f-- > factors) { + if (rs->type == f->level) { + *div = f->div; + *sub = f->sub; + return; + } + } + + *div = 1; + *sub = 0; +} diff --git a/gcc/testsuite/gcc.target/arc/pr9001191897.c b/gcc/testsuite/gcc.target/arc/pr9001191897.c new file mode 100644 index 00000000000..fc3642629d3 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/pr9001191897.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { ! { clmcpu } } } */ +/* { dg-options "-mcpu=archs -Os -fpic -mno-sdata -mno-indexed-loads -w" } */ +a; +c() { + static char b[25]; + for (; a >= 0; a--) + if (b[a]) + b[a] = '\0'; +} diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c index ebc5f447a08..f00480b5c02 100644 --- a/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c +++ b/gcc/testsuite/gcc.target/arm/lto/pr65837-attr_0.c @@ -1,6 +1,7 @@ /* { dg-lto-do run } */ /* { dg-require-effective-target arm_neon_hw } */ -/* { dg-lto-options {{-flto}} } */ +/* { dg-require-effective-target arm_neon_ok_no_float_abi } */ +/* { dg-lto-options {{-flto -mfpu=neon}} } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c index 6b2def9985d..5d7cea7b2e4 100644 --- a/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c +++ b/gcc/testsuite/gcc.target/arm/lto/pr65837_0.c @@ -1,7 +1,7 @@ /* { dg-lto-do run } */ /* { dg-require-effective-target arm_neon_hw } */ +/* { dg-require-effective-target arm_neon_ok_no_float_abi } */ /* { dg-lto-options {{-flto -mfpu=neon}} } */ -/* { dg-suppress-ld-options {-mfpu=neon} } */ #include "arm_neon.h" diff --git a/gcc/testsuite/gcc.target/arm/stack-checking.c b/gcc/testsuite/gcc.target/arm/stack-checking.c index 88a7e6e8286..4b53bedd97b 100644 --- a/gcc/testsuite/gcc.target/arm/stack-checking.c +++ b/gcc/testsuite/gcc.target/arm/stack-checking.c @@ -1,6 +1,6 @@ /* { dg-do run { target { *-*-linux* } } } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check" } */ -/* { dg-skip-if "" { arm_thumb1 } } */ int main(void) { diff --git a/gcc/testsuite/gcc.target/avr/isr-test.h b/gcc/testsuite/gcc.target/avr/isr-test.h new file mode 100644 index 00000000000..176dbc2a15f --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/isr-test.h @@ -0,0 +1,283 @@ +#ifndef ISR_TEST_H +#define ISR_TEST_H + +#include <string.h> + +#define ISR(N,...) \ +__attribute__ ((used, externally_visible , ## __VA_ARGS__)) \ + void __vector_##N (void); \ + void __vector_##N (void) + +#define SFR(ADDR) (*(unsigned char volatile*) (__AVR_SFR_OFFSET__ + (ADDR))) +#define CORE_SFRS SFR (0x38) +#define SREG SFR (0x3F) +#define SPL SFR (0x3D) +#define EIND SFR (0x3C) +#define RAMPZ SFR (0x3B) +#define RAMPY SFR (0x3A) +#define RAMPX SFR (0x39) +#define RAMPD SFR (0x38) + +#ifdef __AVR_HAVE_JMP_CALL__ +#define VEC_SIZE 4 +#else +#define VEC_SIZE 2 +#endif + +#ifdef __AVR_TINY__ +#define FIRST_REG 16 +#else +#define FIRST_REG 0 +#endif + +#define CR "\n\t" + +typedef struct +{ + unsigned char sfrs[8]; + unsigned char gprs[32 - FIRST_REG]; +} regs_t; + +regs_t reginfo1, reginfo2; + +__attribute__((noinline,unused)) +static void clear_reginfo (void) +{ + memset (reginfo1.sfrs, 0, sizeof (reginfo1.sfrs)); + memset (reginfo2.sfrs, 0, sizeof (reginfo2.sfrs)); +} + +__attribute__((noinline,unused)) +static void compare_reginfo (unsigned long gpr_ignore) +{ + signed char regno; + const unsigned char *preg1 = ®info1.gprs[0]; + const unsigned char *preg2 = ®info2.gprs[0]; + + if (memcmp (®info1, ®info2, 8)) + __builtin_abort(); + + gpr_ignore >>= FIRST_REG; + + for (regno = FIRST_REG; regno < 32; + regno++, preg1++, preg2++, gpr_ignore >>= 1) + { + if (gpr_ignore & 1) + continue; + + if (*preg1 != *preg2) + { + static signed char volatile failed_regno; + (void) failed_regno; + failed_regno = regno; + __builtin_abort(); + } + } +} + +/* STore GPR */ +#define ST(regno,M) \ + CR "sts %[" #M "]+8-%[first]+" #regno ", r" #regno + +/* STore SFR */ +#define ST_SFR(sfr, n_sfr, M) \ + CR "in __tmp_reg__,%i[s_" #sfr "]" \ + CR "sts %[" #M "]+" #n_sfr ", __tmp_reg__" + +/* Named asm OPerand for SFR */ +#define OP_SFR(sfr) \ + , [s_ ## sfr] "n" (&(sfr)) + +/* Write funny value to SFR */ +#define XX_SFR(sfr) \ + CR "dec r31 $ out %i[s_" #sfr "], r31" + +/* Write 0 to SFR */ +#define OO_SFR(sfr) \ + CR "out %i[s_" #sfr "], __zero_reg__" + +/* Macros for SREG */ +#define ST_SREG(M) ST_SFR (SREG,0,M) +#define OP_SREG OP_SFR (SREG) +#define XX_SREG XX_SFR (SREG) + +/* Macros for EIND */ +#if defined __AVR_HAVE_EIJMP_EICALL__ +#define ST_EIND(M) ST_SFR (EIND,1,M) +#define OP_EIND OP_SFR (EIND) +#else +#define ST_EIND(M) /* empty */ +#define OP_EIND /* empty */ +#endif + +/* Macros for RAMPX */ +#if defined (__AVR_HAVE_RAMPX__) +#define ST_RAMPX(M) ST_SFR (RAMPX,2,M) +#define OP_RAMPX OP_SFR (RAMPX) +#define XX_RAMPX XX_SFR (RAMPX) +#define OO_RAMPX OO_SFR (RAMPX) +#else +#define ST_RAMPX(M) /* empty */ +#define OP_RAMPX /* empty */ +#define XX_RAMPX /* empty */ +#define OO_RAMPX /* empty */ +#endif + +/* Macros for RAMPY */ +#if defined (__AVR_HAVE_RAMPY__) +#define ST_RAMPY(M) ST_SFR (RAMPY,3,M) +#define OP_RAMPY OP_SFR (RAMPY) +#define XX_RAMPY XX_SFR (RAMPY) +#define OO_RAMPY OO_SFR (RAMPY) +#else +#define ST_RAMPY(M) /* empty */ +#define OP_RAMPY /* empty */ +#define XX_RAMPY /* empty */ +#define OO_RAMPY /* empty */ +#endif + +/* Macros for RAMPZ */ +#if defined (__AVR_HAVE_RAMPZ__) +#define ST_RAMPZ(M) ST_SFR (RAMPZ,4,M) +#define OP_RAMPZ OP_SFR (RAMPZ) +#define XX_RAMPZ XX_SFR (RAMPZ) +#define OO_RAMPZ OO_SFR (RAMPZ) +#else +#define ST_RAMPZ(M) /* empty */ +#define OP_RAMPZ /* empty */ +#define XX_RAMPZ /* empty */ +#define OO_RAMPZ /* empty */ +#endif + +/* Macros for RAMPD */ +#if defined (__AVR_HAVE_RAMPD__) +#define ST_RAMPD(M) ST_SFR (RAMPD,5,M) +#define OP_RAMPD OP_SFR (RAMPD) +#else +#define ST_RAMPD(M) /* empty */ +#define OP_RAMPD /* empty */ +#endif + +/* Macros for all GPRs */ +#if defined __AVR_TINY__ +#define ST_REGS_LO(M) /* empty */ +#else +#define ST_REGS_LO(M) \ + ST(0,M) ST(1,M) ST(2,M) ST(3,M) \ + ST(4,M) ST(5,M) ST(6,M) ST(7,M) \ + ST(8,M) ST(9,M) ST(10,M) ST(11,M) \ + ST(12,M) ST(13,M) ST(14,M) ST(15,M) +#endif /* AVR_TINY */ + +#define ST_REGS_HI(M) \ + ST(16,M) ST(17,M) ST(18,M) ST(19,M) \ + ST(20,M) ST(21,M) ST(22,M) ST(23,M) \ + ST(24,M) ST(25,M) ST(26,M) ST(27,M) \ + ST(28,M) ST(29,M) ST(30,M) ST(31,M) + +__attribute__((unused,naked,noinline,noclone)) +static void host_store1 (void) +{ + __asm __volatile__ + ("nop" + CR ".global do_stores_before" + CR ".type do_stores_before,@function" + CR "do_stores_before:" + /* Funny values to some SFRs */ + CR "ldi r31, 1 + 'Z'" + XX_RAMPZ + XX_RAMPY + XX_RAMPX + CR "dec __zero_reg__" + CR "clr r31" + XX_SREG + /* Must set I-flag due to RETI of ISR */ + CR "sei" + /* Store core regs before ISR */ + ST_RAMPX (mem1) + ST_RAMPY (mem1) + ST_RAMPZ (mem1) + ST_RAMPD (mem1) + ST_EIND (mem1) + ST_SREG (mem1) + CR "ldi r31, 0xaa" + CR "mov __tmp_reg__, r31" + CR "ldi r31, 31" + ST_REGS_LO (mem1) + ST_REGS_HI (mem1) + CR "ret" + : /* No outputs */ + : [mem1] "i" (®info1), [first] "n" (FIRST_REG) + OP_RAMPX + OP_RAMPY + OP_RAMPZ + OP_RAMPD + OP_EIND + OP_SREG + : "memory", "r31"); +} + +__attribute__((unused,naked,noinline,noclone)) +static void host_store2 (void) +{ + __asm __volatile__ + ("nop" + CR ".global do_stores_after" + CR ".type do_stores_after,@function" + CR "do_stores_after:" + /* Store core regs after ISR */ + ST_REGS_LO (mem2) + ST_REGS_HI (mem2) + ST_RAMPX (mem2) + ST_RAMPY (mem2) + ST_RAMPZ (mem2) + ST_RAMPD (mem2) + ST_EIND (mem2) + ST_SREG (mem2) + /* Undo funny values */ + CR "clr __zero_reg__" + OO_RAMPX + OO_RAMPY + OO_RAMPZ + CR "ret" + : /* No outputs */ + : [mem2] "i" (®info2), [first] "n" (FIRST_REG) + OP_RAMPX + OP_RAMPY + OP_RAMPZ + OP_RAMPD + OP_EIND + OP_SREG + : "memory"); +} + +#define MK_CALL_ISR(vecno) \ + __asm __volatile__ \ + (/* Funny values to some SFRs */ \ + /* Must set I-flag due to RETI of ISR */ \ + /* Store core regs before ISR */ \ + CR "%~call do_stores_before" \ + /* Execute ISR */ \ + CR "%~call __vectors + %[vect]" \ + /* Store core regs after ISR */ \ + /* Undo funny values */ \ + CR "%~call do_stores_after" \ + : /* No outputs */ \ + : [vect] "i" (VEC_SIZE * (vecno)) \ + , "i" (host_store1) \ + , "i" (host_store2) \ + : "memory", "r31") + + +#define MK_RUN_ISR(N, IGMSK) \ + \ +__attribute__((noinline,noclone)) \ +void run_isr_ ## N (void) \ +{ \ + clear_reginfo(); \ + MK_CALL_ISR (N); \ + compare_reginfo (IGMSK); \ +} + +#endif /* ISR_TEST_H */ + diff --git a/gcc/testsuite/gcc.target/avr/torture/isr-01-simple.c b/gcc/testsuite/gcc.target/avr/torture/isr-01-simple.c new file mode 100644 index 00000000000..271d0cf47e9 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/isr-01-simple.c @@ -0,0 +1,98 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +#include "../isr-test.h" + +int volatile v; + +/**********************************************************************/ + +ISR (1, signal) +{ +} + +MK_RUN_ISR (1, 0) + +void test1 (void) +{ + run_isr_1(); +} + +/**********************************************************************/ + +ISR (2, signal) +{ + v++; +} + +MK_RUN_ISR (2, 0) + +void test2 (void) +{ + v = 0; + run_isr_2(); + if (v != 1) + __builtin_abort(); +} + + +/**********************************************************************/ + +ISR (3, signal) +{ + __asm __volatile__ ("$ lds r27, v" + "$ swap r27" + "$ sts v, r27" + ::: "memory", "r27"); +} + +MK_RUN_ISR (3, 0) + +void test3 (void) +{ + run_isr_3(); + if (v != 0x10) + __builtin_abort(); +} + +/**********************************************************************/ + +ISR (4, signal) +{ + __asm __volatile__ ("sts v,__zero_reg__" ::: "memory"); +} + +MK_RUN_ISR (4, 0) + +void test4 (void) +{ + run_isr_4(); + if (v != 0) + __builtin_abort(); +} + +/**********************************************************************/ + +ISR (5, signal) +{ + __asm __volatile__ ("clt"); +} + +MK_RUN_ISR (5, 0) + +void test5 (void) +{ + run_isr_5(); +} + +/**********************************************************************/ + +int main (void) +{ + test1(); + test2(); + test3(); + test4(); + test5(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/isr-02-call.c b/gcc/testsuite/gcc.target/avr/torture/isr-02-call.c new file mode 100644 index 00000000000..be4f22ebb35 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/isr-02-call.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +#include "../isr-test.h" + +int volatile v; + +__attribute__((noinline,noclone)) +void inc_v (void) +{ + v++; +} + +/**********************************************************************/ + +ISR (1, signal) +{ + inc_v(); +} + +MK_RUN_ISR (1, 0) + +void test1 (void) +{ + run_isr_1(); + if (v != 1) + __builtin_abort(); +} + +/**********************************************************************/ + +ISR (2, signal) +{ + if (v == 1) + inc_v(); + else + v += 2; +} + +MK_RUN_ISR (2, 0) + +void test2 (void) +{ + run_isr_2(); + if (v != 2) + __builtin_abort(); + run_isr_2(); + if (v != 4) + __builtin_abort(); +} + + +/**********************************************************************/ + +int main (void) +{ + test1(); + test2(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/isr-03-fixed.c b/gcc/testsuite/gcc.target/avr/torture/isr-03-fixed.c new file mode 100644 index 00000000000..5606225aebc --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/isr-03-fixed.c @@ -0,0 +1,146 @@ +/* { dg-do run } */ +/* { dg-options "-std=gnu99 -fno-lto -fno-toplevel-reorder" } */ + +// No LTO for now due to PR lto/68384. + +#ifdef __AVR_TINY__ +unsigned char reg2; +#else +register unsigned char reg2 __asm("r2"); +#endif + +#include "../isr-test.h" + +#define SET_REG(reg,val) \ + do { \ + reg = (val); \ + __asm __volatile__("" : "+r" (reg)); \ + } while (0) \ + +#define GET_REG(reg) \ + ({ \ + __asm __volatile__("" : "+r" (reg)); \ + reg; \ + }) + +/**********************************************************************/ + +ISR (1, signal) +{ + reg2++; +} + +MK_RUN_ISR (1, 1ul << 2) + +void test1 (void) +{ + SET_REG (reg2, 0); + run_isr_1(); + if (GET_REG (reg2) != 1) + __builtin_abort(); +} + +/**********************************************************************/ + +__attribute__((noinline,noclone)) +void inc_r2 (void) +{ + reg2++; +} + +ISR (2, signal) +{ + inc_r2 (); +} + +MK_RUN_ISR (2, 1ul << 2) + +void test2 (void) +{ + run_isr_2(); + if (GET_REG (reg2) != 2) + __builtin_abort(); +} + + +/**********************************************************************/ + +ISR (3, signal) +{ +#ifndef __AVR_TINY__ + register char r4 __asm ("r4"); + __asm __volatile ("inc %0" : "+r" (r4)); + __asm __volatile ("inc r5" ::: "r5"); +#endif +} + +MK_RUN_ISR (3, 0) + +void test3 (void) +{ + run_isr_3(); +} + + +/**********************************************************************/ + +#define CLOBB(reg) \ + do { \ + __asm __volatile__ ("inc " #reg ::: #reg); \ + } while (0) + +ISR (4, signal) +{ + char volatile v; + v = 1; + +#ifndef __AVR_TINY__ + CLOBB (r3); + CLOBB (r4); + CLOBB (r5); + CLOBB (r6); + CLOBB (r7); + CLOBB (r8); + CLOBB (r9); + CLOBB (r10); + CLOBB (r11); + CLOBB (r12); + CLOBB (r13); + CLOBB (r14); + CLOBB (r15); + CLOBB (r16); + CLOBB (r17); +#endif + + CLOBB (r18); + CLOBB (r19); + CLOBB (r20); + CLOBB (r21); + CLOBB (r22); + CLOBB (r23); + CLOBB (r24); + CLOBB (r25); + CLOBB (r26); + CLOBB (r27); + CLOBB (r30); + CLOBB (r31); +} + +MK_RUN_ISR (4, 0) + +void test4 (void) +{ + run_isr_4(); +} + + +/**********************************************************************/ + +int main (void) +{ + test1(); + test2(); + test3(); + test4(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c index b1da555bc31..ddee754c962 100644 --- a/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c +++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx32-2.c @@ -44,9 +44,9 @@ adx_test (void) sum_ref = 0x0; /* X = 0x00000001, Y = 0x00000000, C = 0. */ - c = _subborrow_u32 (c, x, y, &x); + c = _subborrow_u32 (c, y, x, &x); /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1. */ - c = _subborrow_u32 (c, x, y, &x); + c = _subborrow_u32 (c, y, x, &x); /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1. */ if (x != sum_ref) diff --git a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c index b326291bb35..287e263a9dd 100644 --- a/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c +++ b/gcc/testsuite/gcc.target/i386/adx-addcarryx64-2.c @@ -44,9 +44,9 @@ adx_test (void) sum_ref = 0x0LL; /* X = 0x0000000000000001, Y = 0x0000000000000000, C = 0. */ - c = _subborrow_u64 (c, x, y, &x); + c = _subborrow_u64 (c, y, x, &x); /* X = 0xFFFFFFFFFFFFFFFF, Y = 0x0000000000000000, C = 1. */ - c = _subborrow_u64 (c, x, y, &x); + c = _subborrow_u64 (c, y, x, &x); /* X = 0x0000000000000000, Y = 0x0000000000000000, C = 1. */ if (x != sum_ref) diff --git a/gcc/testsuite/gcc.target/i386/avx-1.c b/gcc/testsuite/gcc.target/i386/avx-1.c index 8377555f815..085ba81a672 100644 --- a/gcc/testsuite/gcc.target/i386/avx-1.c +++ b/gcc/testsuite/gcc.target/i386/avx-1.c @@ -233,11 +233,15 @@ #define __builtin_ia32_getexppd512_mask(A, B, C, D) __builtin_ia32_getexppd512_mask(A, B, C, 8) #define __builtin_ia32_getexpps512_mask(A, B, C, D) __builtin_ia32_getexpps512_mask(A, B, C, 8) #define __builtin_ia32_getexpsd128_round(A, B, C) __builtin_ia32_getexpsd128_round(A, B, 4) +#define __builtin_ia32_getexpsd_mask_round(A, B, C, D, E) __builtin_ia32_getexpsd_mask_round(A, B, C, D, 4) #define __builtin_ia32_getexpss128_round(A, B, C) __builtin_ia32_getexpss128_round(A, B, 4) +#define __builtin_ia32_getexpss_mask_round(A, B, C, D, E) __builtin_ia32_getexpss_mask_round(A, B, C, D, 4) #define __builtin_ia32_getmantpd512_mask(A, F, C, D, E) __builtin_ia32_getmantpd512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantps512_mask(A, F, C, D, E) __builtin_ia32_getmantps512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantsd_round(A, B, C, D) __builtin_ia32_getmantsd_round(A, B, 1, 4) +#define __builtin_ia32_getmantsd_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantsd_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_getmantss_round(A, B, C, D) __builtin_ia32_getmantss_round(A, B, 1, 4) +#define __builtin_ia32_getmantss_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantss_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_insertf32x4_mask(A, B, F, D, E) __builtin_ia32_insertf32x4_mask(A, B, 1, D, E) #define __builtin_ia32_insertf64x4_mask(A, B, F, D, E) __builtin_ia32_insertf64x4_mask(A, B, 1, D, E) #define __builtin_ia32_inserti32x4_mask(A, B, F, D, E) __builtin_ia32_inserti32x4_mask(A, B, 1, D, E) diff --git a/gcc/testsuite/gcc.target/i386/avx-pr80846.c b/gcc/testsuite/gcc.target/i386/avx-pr80846.c new file mode 100644 index 00000000000..338f01039f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx-pr80846.c @@ -0,0 +1,39 @@ +/* PR target/80846 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx -mno-avx2" } */ + +typedef __int128 V __attribute__((vector_size (32))); +typedef long long W __attribute__((vector_size (32))); +typedef int X __attribute__((vector_size (16))); +typedef __int128 Y __attribute__((vector_size (64))); +typedef long long Z __attribute__((vector_size (64))); + +W f1 (__int128 x, __int128 y) { return (W) ((V) { x, y }); } +__int128 f2 (W x) { return ((V)x)[0]; } +__int128 f3 (W x) { return ((V)x)[1]; } +W f4 (X x, X y) { union { X x; __int128 i; } u = { .x = x }, v = { .x = y }; return (W) ((V) { u.i, v.i }); } +X f5 (W x) { return (X)(((V)x)[0]); } +X f6 (W x) { return (X)(((V)x)[1]); } +W f7 (void) { return (W) ((V) { 2, 3 }); } +W f8 (X x) { union { X x; __int128 i; } u = { .x = x }; return (W) ((V) { u.i, 3 }); } +W f9 (X x) { union { X x; __int128 i; } u = { .x = x }; return (W) ((V) { 2, u.i }); } +W f10 (X x) { union { X x; __int128 i; } u = { .x = x }; return (W) ((V) { u.i, u.i }); } +#ifdef __AVX512F__ +Z f11 (__int128 x, __int128 y, __int128 z, __int128 a) { return (Z) ((Y) { x, y, z, a }); } +__int128 f12 (Z x) { return ((Y)x)[0]; } +__int128 f13 (Z x) { return ((Y)x)[1]; } +__int128 f14 (Z x) { return ((Y)x)[2]; } +__int128 f15 (Z x) { return ((Y)x)[3]; } +Z f16 (X x, X y, X z, X a) { union { X x; __int128 i; } u = { .x = x }, v = { .x = y }, w = { .x = z }, t = { .x = a }; + return (Z) ((Y) { u.i, v.i, w.i, t.i }); } +X f17 (Z x) { return (X)(((Y)x)[0]); } +X f18 (Z x) { return (X)(((Y)x)[1]); } +X f19 (Z x) { return (X)(((Y)x)[2]); } +X f20 (Z x) { return (X)(((Y)x)[3]); } +Z f21 (void) { return (Z) ((Y) { 2, 3, 4, 5 }); } +Z f22 (X x) { union { X x; __int128 i; } u = { .x = x }; return (Z) ((Y) { u.i, 3, 4, 5 }); } +Z f23 (X x) { union { X x; __int128 i; } u = { .x = x }; return (Z) ((Y) { 2, u.i, 4, 5 }); } +Z f24 (X x) { union { X x; __int128 i; } u = { .x = x }; return (Z) ((Y) { 2, 3, u.i, 5 }); } +Z f25 (X x) { union { X x; __int128 i; } u = { .x = x }; return (Z) ((Y) { 2, 3, 4, u.i }); } +Z f26 (X x) { union { X x; __int128 i; } u = { .x = x }; return (Z) ((Y) { u.i, u.i, u.i, u.i }); } +#endif diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr80846.c b/gcc/testsuite/gcc.target/i386/avx2-pr80846.c new file mode 100644 index 00000000000..907fd4f7b62 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx2-pr80846.c @@ -0,0 +1,5 @@ +/* PR target/80846 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx2 -mno-avx512f" } */ + +#include "avx-pr80846.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr81532.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr81532.c new file mode 100644 index 00000000000..6ebaed6f715 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512bw-pr81532.c @@ -0,0 +1,5 @@ +/* PR target/81532 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx512bw -mavx512vl -mno-avx512dq" } */ + +#include "avx512dq-pr81532.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-pr81532.c b/gcc/testsuite/gcc.target/i386/avx512dq-pr81532.c new file mode 100644 index 00000000000..39632a2c482 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-pr81532.c @@ -0,0 +1,12 @@ +/* PR target/81532 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx512dq -mavx512vl -mno-avx512bw" } */ + +typedef unsigned __int128 V __attribute__ ((vector_size (64))); + +V +foo (V c) +{ + c >>= 0 != c; + return c; +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr80846.c b/gcc/testsuite/gcc.target/i386/avx512f-pr80846.c new file mode 100644 index 00000000000..c32c9762cf9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-pr80846.c @@ -0,0 +1,5 @@ +/* PR target/80846 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx512f" } */ + +#include "avx-pr80846.c" diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vaddsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vaddsd-3.c new file mode 100644 index 00000000000..fbe09b1220b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vaddsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_add (double *r, double *s1, double *s2) +{ + r[0] = s1[0] + s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_add_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_add_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_add_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_add_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_add (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_add (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vaddss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vaddss-3.c new file mode 100644 index 00000000000..45fb29594e5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vaddss-3.c @@ -0,0 +1,65 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_add (float *r, float *s1, float *s2) +{ + r[0] = s1[0] + s2[0]; + + int i; + for (i = 1; i < SIZE; i++) + r[i] = s1[i]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_add_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_add_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_add_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_add_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_add (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_add (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vdivsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vdivsd-3.c new file mode 100644 index 00000000000..0baaf75e194 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vdivsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_div (double *r, double *s1, double *s2) +{ + r[0] = s1[0] / s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_div_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_div_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_div_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_div_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_div (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_div (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vdivss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vdivss-3.c new file mode 100644 index 00000000000..d337bb21182 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vdivss-3.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_div (float *r, float *s1, float *s2) +{ + r[0] = s1[0] / s2[0]; + int i; + for (i = 1; i < SIZE; i++) + r[i] = s1[i]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_div_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_div_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_div_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_div_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_div (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_div (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-1.c index 63194a38b17..226cd9665ca 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-1.c @@ -1,15 +1,24 @@ /* { dg-do compile } */ /* { dg-options "-mavx512f -O2" } */ /* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\, %xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\, %xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpsd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ #include <immintrin.h> volatile __m128d x; +volatile __mmask8 m; void extern avx512f_test (void) { x = _mm_getexp_sd (x, x); + x = _mm_mask_getexp_sd (x, m, x, x); + x = _mm_maskz_getexp_sd (m, x, x); x = _mm_getexp_round_sd (x, x, _MM_FROUND_NO_EXC); + x = _mm_mask_getexp_round_sd (x, m, x, x, _MM_FROUND_NO_EXC); + x = _mm_maskz_getexp_round_sd (m, x, x, _MM_FROUND_NO_EXC); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-2.c index 4f7c94db9ae..cb82448725f 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpsd-2.c @@ -6,30 +6,61 @@ #include <math.h> #include "avx512f-check.h" +#include "avx512f-helper.h" +#include "avx512f-mask-type.h" static void compute_vgetexpsd (double *s, double *r) { r[0] = floor (log (s[0]) / log (2)); + r[1] = s[1]; } void static avx512f_test (void) { int i; - union128d res1, s1; + union128d res1, res2, res3, res4, res5, res6, s1; + MASK_TYPE mask = MASK_VALUE; double res_ref[SIZE]; for (i = 0; i < SIZE; i++) { s1.a[i] = 5.0 - i; - res_ref[i] = s1.a[i]; + res2.a[i] = DEFAULT_VALUE; + res5.a[i] = DEFAULT_VALUE; } res1.x = _mm_getexp_sd (s1.x, s1.x); + res2.x = _mm_mask_getexp_sd (res2.x, mask, s1.x, s1.x); + res3.x = _mm_maskz_getexp_sd (mask, s1.x, s1.x); + res4.x = _mm_getexp_round_sd (s1.x, s1.x, _MM_FROUND_NO_EXC); + res5.x = _mm_mask_getexp_round_sd (res5.x, mask, s1.x, s1.x, _MM_FROUND_NO_EXC); + res6.x = _mm_maskz_getexp_round_sd (mask, s1.x, s1.x, _MM_FROUND_NO_EXC); compute_vgetexpsd (s1.a, res_ref); if (check_fp_union128d (res1, res_ref)) abort (); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_fp_union128d (res2, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_fp_union128d (res3, res_ref)) + abort (); + + compute_vgetexpsd (s1.a, res_ref); + + if (check_fp_union128d (res4, res_ref)) + abort (); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_fp_union128d (res5, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_fp_union128d (res6, res_ref)) + abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-1.c index 9103e6ad84f..495b93c9c6a 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-1.c @@ -1,15 +1,24 @@ /* { dg-do compile } */ /* { dg-options "-mavx512f -O2" } */ /* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\, %xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+\, %xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetexpss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ #include <immintrin.h> volatile __m128 x; +volatile __mmask8 m; void extern avx512f_test (void) { x = _mm_getexp_ss (x, x); + x = _mm_mask_getexp_ss (x, m, x, x); + x = _mm_maskz_getexp_ss (m, x, x); x = _mm_getexp_round_ss (x, x, _MM_FROUND_NO_EXC); + x = _mm_mask_getexp_round_ss (x, m, x, x, _MM_FROUND_NO_EXC); + x = _mm_maskz_getexp_round_ss (m, x, x, _MM_FROUND_NO_EXC); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-2.c index 926f4d87ffb..ed193af78d4 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetexpss-2.c @@ -6,30 +6,63 @@ #include <math.h> #include "avx512f-check.h" +#include "avx512f-helper.h" +#include "avx512f-mask-type.h" static void compute_vgetexpss (float *s, float *r) { + int i; r[0] = floor (log (s[0]) / log (2)); + for(i = 1; i < SIZE; i++) + r[i] = s[i]; } void static avx512f_test (void) { int i; - union128 res1, s1; + union128 res1, res2, res3, res4, res5, res6, s1; + MASK_TYPE mask = MASK_VALUE; float res_ref[SIZE]; for (i = 0; i < SIZE; i++) { s1.a[i] = 5.0 - i; - res_ref[i] = s1.a[i]; + res2.a[i] = DEFAULT_VALUE; + res5.a[i] = DEFAULT_VALUE; } res1.x = _mm_getexp_ss (s1.x, s1.x); + res2.x = _mm_mask_getexp_ss (res2.x, mask, s1.x, s1.x); + res3.x = _mm_maskz_getexp_ss (mask, s1.x, s1.x); + res4.x = _mm_getexp_round_ss (s1.x, s1.x, _MM_FROUND_NO_EXC); + res5.x = _mm_mask_getexp_round_ss (res5.x, mask, s1.x, s1.x, _MM_FROUND_NO_EXC); + res6.x = _mm_maskz_getexp_round_ss (mask, s1.x, s1.x, _MM_FROUND_NO_EXC); compute_vgetexpss (s1.a, res_ref); if (check_fp_union128 (res1, res_ref)) abort (); + + MASK_MERGE () (res_ref, mask, 1); + if (check_fp_union128 (res2, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_fp_union128 (res3, res_ref)) + abort (); + + compute_vgetexpss (s1.a, res_ref); + + if (check_fp_union128 (res4, res_ref)) + abort (); + + MASK_MERGE () (res_ref, mask, 1); + if (check_fp_union128 (res5, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_fp_union128 (res6, res_ref)) + abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-1.c index c501ba6729e..25a64202ea7 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-1.c @@ -1,16 +1,24 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mavx512f" } */ /* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantsd\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ #include <immintrin.h> volatile __m128d x, y, z; +volatile __mmask8 m; void extern avx512f_test (void) { x = _mm_getmant_sd (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); - x = _mm_getmant_round_sd (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, - _MM_FROUND_NO_EXC); + x = _mm_mask_getmant_sd (x, m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); + x = _mm_maskz_getmant_sd (m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); + x = _mm_getmant_round_sd (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src,_MM_FROUND_NO_EXC); + x = _mm_mask_getmant_round_sd (x, m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + x = _mm_maskz_getmant_round_sd (m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-2.c index 3a34ca4f05d..45875b4a921 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantsd-2.c @@ -5,6 +5,10 @@ #include "avx512f-check.h" #include <math.h> +#include "avx512f-helper.h" + +#define SIZE (128/64) +#include "avx512f-mask-type.h" union fp_int_t { @@ -76,18 +80,51 @@ compute_vgetmantsd (double *r, double *s1, double *s2, int interv, static void avx512f_test (void) { - union128d res1, src1, src2; + union128d res1, res2, res3, res4, res5, res6, src1, src2; double res_ref[2]; - int interv = _MM_MANT_NORM_p5_1; - int signctrl = _MM_MANT_SIGN_src; + MASK_TYPE mask = MASK_VALUE; src1.x = _mm_set_pd (-3.0, 111.111); src2.x = _mm_set_pd (222.222, -2.0); + + int i; + for (i = 0; i < SIZE; i++) + { + res2.a[i] = DEFAULT_VALUE; + res5.a[i] = DEFAULT_VALUE; + } - res1.x = _mm_getmant_sd (src1.x, src2.x, interv, signctrl); + res1.x = _mm_getmant_sd (src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res2.x = _mm_mask_getmant_sd (res2.x, mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res3.x = _mm_maskz_getmant_sd (mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res4.x = _mm_getmant_round_sd (src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + res5.x = _mm_mask_getmant_round_sd (res5.x, mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + res6.x = _mm_maskz_getmant_round_sd (mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); - compute_vgetmantsd (res_ref, src1.a, src2.a, interv, signctrl); + compute_vgetmantsd (res_ref, src1.a, src2.a, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); if (check_union128d (res1, res_ref)) abort (); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + compute_vgetmantsd (res_ref, src1.a, src2.a, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + + if (check_union128d (res4, res_ref)) + abort (); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res5, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res6, res_ref)) + abort (); + } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-1.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-1.c index 8ce9d467806..00a055ffeee 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-1.c @@ -1,16 +1,24 @@ /* { dg-do compile } */ /* { dg-options "-O2 -mavx512f" } */ /* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%xmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ +/* { dg-final { scan-assembler-times "vgetmantss\[ \\t\]+\[^\n\]*\{sae\}\[^\{\n\]*%xmm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ #include <immintrin.h> volatile __m128 x, y, z; +volatile __mmask8 m; void extern avx512f_test (void) { x = _mm_getmant_ss (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); - x = _mm_getmant_round_ss (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, - _MM_FROUND_NO_EXC); + x = _mm_mask_getmant_ss (x, m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); + x = _mm_maskz_getmant_ss (m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src); + x = _mm_getmant_round_ss (y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + x = _mm_mask_getmant_round_ss (x, m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + x = _mm_maskz_getmant_round_ss (m, y, z, _MM_MANT_NORM_p75_1p5, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-2.c index 7c30ea7d8e6..bcd449b4ae2 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vgetmantss-2.c @@ -5,6 +5,10 @@ #include "avx512f-check.h" #include <math.h> +#include "avx512f-helper.h" + +#define SIZE (128/32) +#include "avx512f-mask-type.h" union fp_int_t { @@ -72,7 +76,7 @@ compute_vgetmantss (float *r, float *s1, float *s2, int interv, { int i; r[0] = get_norm_mant (s2[0], signctrl, interv); - for (i = 1; i < 4; i++) + for (i = 1; i < SIZE; i++) { r[i] = s1[i]; } @@ -81,18 +85,50 @@ compute_vgetmantss (float *r, float *s1, float *s2, int interv, static void avx512f_test (void) { - union128 res1, src1, src2; + union128 res1, res2, res3, res4, res5, res6, src1, src2; float res_ref[4]; - int interv = _MM_MANT_NORM_p5_1; - int signctrl = _MM_MANT_SIGN_src; + MASK_TYPE mask = MASK_VALUE; src1.x = _mm_set_ps (-24.043, 68.346, -43.35, 546.46); src2.x = _mm_set_ps (222.222, 333.333, 444.444, -2.0); - res1.x = _mm_getmant_ss (src1.x, src2.x, interv, signctrl); + int i; + for (i = 0; i < SIZE; i++) + { + res2.a[i] = DEFAULT_VALUE; + res5.a[i] = DEFAULT_VALUE; + } + + res1.x = _mm_getmant_ss (src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res2.x = _mm_mask_getmant_ss (res2.x, mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res3.x = _mm_maskz_getmant_ss (mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + res4.x = _mm_getmant_round_ss (src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + res5.x = _mm_mask_getmant_round_ss (res5.x, mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); + res6.x = _mm_maskz_getmant_round_ss (mask, src1.x, src2.x, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src, _MM_FROUND_NO_EXC); - compute_vgetmantss (res_ref, src1.a, src2.a, interv, signctrl); + compute_vgetmantss (res_ref, src1.a, src2.a, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); if (check_union128 (res1, res_ref)) abort (); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + compute_vgetmantss (res_ref, src1.a, src2.a, _MM_MANT_NORM_p5_1, _MM_MANT_SIGN_src); + + if (check_union128 (res4, res_ref)) + abort (); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res5, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res6, res_ref)) + abort (); } diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vmaxsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vmaxsd-3.c new file mode 100644 index 00000000000..95c9c6335af --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vmaxsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_max (double *r, double *s1, double *s2) +{ + r[0] = s1[0] > s2[0] ? s1[0] : s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_max_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_max_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_max_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_max_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_max (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_max (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vmaxss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vmaxss-3.c new file mode 100644 index 00000000000..e40c891001b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vmaxss-3.c @@ -0,0 +1,66 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_max (float *r, float *s1, float *s2) +{ + r[0] = s1[0] > s2[0] ? s1[0] : s2[0]; + int i; + for (i = 1; i < SIZE; i++) + { + r[i] = s1[i]; + } +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_max_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_max_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_max_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_max_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_max (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_max (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vminsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vminsd-3.c new file mode 100644 index 00000000000..eac806b0f23 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vminsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_min (double *r, double *s1, double *s2) +{ + r[0] = s1[0] < s2[0] ? s1[0] : s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_min_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_min_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_min_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_min_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_min (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_min (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vminss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vminss-3.c new file mode 100644 index 00000000000..0ecddd6803e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vminss-3.c @@ -0,0 +1,66 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_min (float *r, float *s1, float *s2) +{ + r[0] = s1[0] < s2[0] ? s1[0] : s2[0]; + int i; + for (i = 1; i < SIZE; i++) + { + r[i] = s1[i]; + } +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_min_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_min_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_min_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_min_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_min (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_min (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vmulsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vmulsd-3.c new file mode 100644 index 00000000000..f6afb693e68 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vmulsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_mul (double *r, double *s1, double *s2) +{ + r[0] = s1[0] * s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_mul_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_mul_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_mul_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_mul_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_mul (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_mul (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vmulss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vmulss-3.c new file mode 100644 index 00000000000..3d579905bae --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vmulss-3.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_mul (float *r, float *s1, float *s2) +{ + r[0] = s1[0] * s2[0]; + int i; + for (i = 1; i < SIZE; i++) + r[i] = s1[i]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_mul_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_mul_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_mul_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_mul_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_mul (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_mul (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c index dbd4544c39e..b36a9c2da0a 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermd-2.c @@ -41,18 +41,14 @@ TEST (void) res3.a[i] = DEFAULT_VALUE; } -#if AVX512F_LEN == 512 res1.x = INTRINSIC (_permutexvar_epi32) (src1.x, src2.x); -#endif res2.x = INTRINSIC (_maskz_permutexvar_epi32) (mask, src1.x, src2.x); res3.x = INTRINSIC (_mask_permutexvar_epi32) (res3.x, mask, src1.x, src2.x); CALC (src1.a, src2.a, res_ref); -#if AVX512F_LEN == 512 if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref)) abort (); -#endif MASK_ZERO (i_d) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref)) diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c index 770d5623f5f..dd88cd46c0b 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-imm-2.c @@ -40,18 +40,14 @@ TEST (void) res3.a[i] = DEFAULT_VALUE; } -#if AVX512F_LEN == 512 res1.x = INTRINSIC (_permutex_epi64) (src1.x, IMM_MASK); -#endif res2.x = INTRINSIC (_maskz_permutex_epi64) (mask, src1.x, IMM_MASK); res3.x = INTRINSIC (_mask_permutex_epi64) (res3.x, mask, src1.x, IMM_MASK); CALC (src1.a, IMM_MASK, res_ref); -#if AVX512F_LEN == 512 if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref)) abort (); -#endif MASK_ZERO (i_q) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref)) diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c index c596b1d9c40..6c222888e88 100644 --- a/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c +++ b/gcc/testsuite/gcc.target/i386/avx512f-vpermq-var-2.c @@ -41,18 +41,14 @@ TEST (void) res3.a[i] = DEFAULT_VALUE; } -#if AVX512F_LEN == 512 res1.x = INTRINSIC (_permutexvar_epi64) (src1.x, src2.x); -#endif res2.x = INTRINSIC (_maskz_permutexvar_epi64) (mask, src1.x, src2.x); res3.x = INTRINSIC (_mask_permutexvar_epi64) (res3.x, mask, src1.x, src2.x); CALC (src1.a, src2.a, res_ref); -#if AVX512F_LEN == 512 if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref)) abort (); -#endif MASK_ZERO (i_q) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref)) diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsubsd-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vsubsd-3.c new file mode 100644 index 00000000000..d9f79133937 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vsubsd-3.c @@ -0,0 +1,62 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 64) +#include "avx512f-mask-type.h" + +static void +calc_sub (double *r, double *s1, double *s2) +{ + r[0] = s1[0] - s2[0]; + r[1] = s1[1]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128d res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + double res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_sub_sd (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_sub_sd (mask, src1.x, src2.x); + res3.x = _mm_mask_sub_round_sd (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_sub_round_sd (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_sub (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res1, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res2, res_ref)) + abort (); + + calc_sub (res_ref, src1.a, src2.a); + + MASK_MERGE (d) (res_ref, mask, 1); + if (check_union128d (res3, res_ref)) + abort (); + + MASK_ZERO (d) (res_ref, mask, 1); + if (check_union128d (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512f-vsubss-3.c b/gcc/testsuite/gcc.target/i386/avx512f-vsubss-3.c new file mode 100644 index 00000000000..bd597c959a6 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-vsubss-3.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx512f" } */ +/* { dg-require-effective-target avx512f } */ + +#include "avx512f-check.h" + +#include "avx512f-helper.h" + +#define SIZE (128 / 32) +#include "avx512f-mask-type.h" + +static void +calc_sub (float *r, float *s1, float *s2) +{ + r[0] = s1[0] - s2[0]; + int i; + for (i = 1; i < SIZE; i++) + r[i] = s1[i]; +} + +void +avx512f_test (void) +{ + int i, sign; + union128 res1, res2, res3, res4, src1, src2; + MASK_TYPE mask = 0; + float res_ref[SIZE]; + + sign = -1; + for (i = 0; i < SIZE; i++) + { + src1.a[i] = 1.5 + 34.67 * i * sign; + src2.a[i] = -22.17 * i * sign + 1.0; + res1.a[i] = DEFAULT_VALUE; + res3.a[i] = DEFAULT_VALUE; + sign = sign * -1; + } + + res1.x = _mm_mask_sub_ss (res1.x, mask, src1.x, src2.x); + res2.x = _mm_maskz_sub_ss (mask, src1.x, src2.x); + res3.x = _mm_mask_sub_round_ss (res3.x, mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + res4.x = _mm_maskz_sub_round_ss (mask, src1.x, src2.x, _MM_FROUND_NO_EXC); + + calc_sub (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res1, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res2, res_ref)) + abort (); + + calc_sub (res_ref, src1.a, src2.a); + + MASK_MERGE () (res_ref, mask, 1); + if (check_union128 (res3, res_ref)) + abort (); + + MASK_ZERO () (res_ref, mask, 1); + if (check_union128 (res4, res_ref)) + abort (); +} + diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c index fa1aaa390ab..069bb5d6c63 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermd-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ +/* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermd\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ @@ -11,6 +12,7 @@ volatile __mmask8 m; void extern avx512vl_test (void) { + x = _mm256_permutexvar_epi32 (x, x); x = _mm256_maskz_permutexvar_epi32 (m, x, x); x = _mm256_mask_permutexvar_epi32 (x, m, x, x); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c index c74c8ce96c7..2340a6d9993 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-imm-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ +/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ @@ -11,6 +12,7 @@ volatile __mmask8 m; void extern avx512vl_test (void) { + x = _mm256_permutex_epi64 (x, 13); x = _mm256_mask_permutex_epi64 (x, m, x, 13); x = _mm256_maskz_permutex_epi64 (m, x, 13); } diff --git a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c index 43ccad3d6c1..69185e50f76 100644 --- a/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c +++ b/gcc/testsuite/gcc.target/i386/avx512vl-vpermq-var-1.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-mavx512vl -O2" } */ +/* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\](?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}\{z\}(?:\n|\[ \\t\]+#)" 1 } } */ /* { dg-final { scan-assembler-times "vpermq\[ \\t\]+\[^\{\n\]*%ymm\[0-9\]+\{%k\[1-7\]\}(?:\n|\[ \\t\]+#)" 1 } } */ @@ -11,6 +12,7 @@ volatile __mmask8 m; void extern avx512vl_test (void) { + x = _mm256_permutexvar_epi64 (x, x); x = _mm256_maskz_permutexvar_epi64 (m, x, x); x = _mm256_mask_permutexvar_epi64 (x, m, x, x); } diff --git a/gcc/testsuite/gcc.target/i386/cmov7.c b/gcc/testsuite/gcc.target/i386/cmov7.c index 8d637504fd7..e648fed8b2a 100644 --- a/gcc/testsuite/gcc.target/i386/cmov7.c +++ b/gcc/testsuite/gcc.target/i386/cmov7.c @@ -10,7 +10,7 @@ (set (reg:DF) (float_extend:DF (mem:SF (symbol_ref...)))). */ double -sgn (double __x) +foo (double __x) { - return __x >= 0.0 ? 1.0 : -1.0; + return __x >= 1.0 ? 0.0 : -1.0; } diff --git a/gcc/testsuite/gcc.target/i386/interrupt-5.c b/gcc/testsuite/gcc.target/i386/interrupt-5.c index 803c0636299..5742b6f4743 100644 --- a/gcc/testsuite/gcc.target/i386/interrupt-5.c +++ b/gcc/testsuite/gcc.target/i386/interrupt-5.c @@ -7,12 +7,21 @@ extern void link_error (void); typedef unsigned int uword_t __attribute__ ((mode (__word__))); +struct interrupt_frame +{ + uword_t ip; + uword_t cs; + uword_t flags; + uword_t sp; + uword_t ss; +}; + __attribute__ ((used, interrupt)) void -foo (void *frame, uword_t error) +foo (struct interrupt_frame *frame, uword_t error) { void *ra = __builtin_return_address (0); - if ((uintptr_t) ra != (uintptr_t) error) + if ((uintptr_t) ra != (uintptr_t) frame->ip) link_error (); } diff --git a/gcc/testsuite/gcc.target/i386/mvc2.c b/gcc/testsuite/gcc.target/i386/mvc2.c index 9635ec83fac..34a777c1d5e 100644 --- a/gcc/testsuite/gcc.target/i386/mvc2.c +++ b/gcc/testsuite/gcc.target/i386/mvc2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ __attribute__((target_clones("avx","arch=slm","arch=core-avx2"))) int foo (); diff --git a/gcc/testsuite/gcc.target/i386/mvc3.c b/gcc/testsuite/gcc.target/i386/mvc3.c index f940cdbbf55..1c7755fabbe 100644 --- a/gcc/testsuite/gcc.target/i386/mvc3.c +++ b/gcc/testsuite/gcc.target/i386/mvc3.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ __attribute__((target_clones("avx","arch=slm","arch=core-avx2"))) int foo (); /* { dg-error "default target was not set" } */ diff --git a/gcc/testsuite/gcc.target/i386/mvc6.c b/gcc/testsuite/gcc.target/i386/mvc6.c index d584f573328..af631394980 100644 --- a/gcc/testsuite/gcc.target/i386/mvc6.c +++ b/gcc/testsuite/gcc.target/i386/mvc6.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-ifunc "" } */ /* { dg-options "-O3" } */ /* { dg-final { scan-assembler "vpshufb" } } */ /* { dg-final { scan-assembler "punpcklbw" } } */ diff --git a/gcc/testsuite/gcc.target/i386/naked-1.c b/gcc/testsuite/gcc.target/i386/naked-1.c new file mode 100644 index 00000000000..440dbe9ee7a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/naked-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +/* Verify that __attribute__((naked)) produces a naked function + that does not use ret to return but traps at the end. */ +void +__attribute__((naked)) +foo (void) +{ + __asm__ ("# naked"); +} +/* { dg-final { scan-assembler "# naked" } } */ +/* { dg-final { scan-assembler "ud2" } } */ +/* { dg-final { scan-assembler-not "ret" } } */ diff --git a/gcc/testsuite/gcc.target/i386/naked-2.c b/gcc/testsuite/gcc.target/i386/naked-2.c new file mode 100644 index 00000000000..adcd7121541 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/naked-2.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +/* Verify that __attribute__((naked)) produces a naked function + that does not construct a frame. */ +void +__attribute__((naked)) +foo (void) +{ + __asm__ ("# naked"); +} +/* { dg-final { scan-assembler "# naked" } } */ +/* { dg-final { scan-assembler-not "push" } } */ +/* { dg-final { scan-assembler-not "pop" } } */ diff --git a/gcc/testsuite/gcc.target/i386/naked-3.c b/gcc/testsuite/gcc.target/i386/naked-3.c new file mode 100644 index 00000000000..845300d6e4a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/naked-3.c @@ -0,0 +1,39 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-O2" } */ + +#include <unistd.h> +#include <signal.h> +#include <stdlib.h> + +int data; + +/* Verify that naked function traps at the end. */ + +void +__attribute__((naked, noinline, noclone)) +naked (void) +{ + if (data == 0x12345678) + return; + asm ("ret"); +} + +void handler (int i) +{ + exit (0); +} + +int main () +{ + struct sigaction s; + + sigemptyset (&s.sa_mask); + s.sa_handler = handler; + s.sa_flags = 0; + sigaction (SIGILL, &s, NULL); + + data = 0x12345678; + naked (); + + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr48723.c b/gcc/testsuite/gcc.target/i386/pr48723.c index ad102090e9f..222c075fbf7 100644 --- a/gcc/testsuite/gcc.target/i386/pr48723.c +++ b/gcc/testsuite/gcc.target/i386/pr48723.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-fstack-check -mavx" } */ struct S0 diff --git a/gcc/testsuite/gcc.target/i386/pr55672.c b/gcc/testsuite/gcc.target/i386/pr55672.c index 6f1c898c748..f7b0d717e01 100644 --- a/gcc/testsuite/gcc.target/i386/pr55672.c +++ b/gcc/testsuite/gcc.target/i386/pr55672.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "generic" } */ /* { dg-options "-O -fstack-check=generic" } */ int main () diff --git a/gcc/testsuite/gcc.target/i386/pr67265-2.c b/gcc/testsuite/gcc.target/i386/pr67265-2.c index a9f2eb460ef..690a7845557 100644 --- a/gcc/testsuite/gcc.target/i386/pr67265-2.c +++ b/gcc/testsuite/gcc.target/i386/pr67265-2.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-O -fstack-check" } */ void foo (int n) diff --git a/gcc/testsuite/gcc.target/i386/pr67265.c b/gcc/testsuite/gcc.target/i386/pr67265.c index 7827685fe5f..2671acc043a 100644 --- a/gcc/testsuite/gcc.target/i386/pr67265.c +++ b/gcc/testsuite/gcc.target/i386/pr67265.c @@ -2,6 +2,7 @@ /* Reduced testcase by Johannes Dewender <gnu@JonnyJD.net> */ /* { dg-do compile } */ +/* { dg-require-stack-check "" } */ /* { dg-options "-O -fstack-check -fPIC" } */ int a, b, c, d, e; diff --git a/gcc/testsuite/gcc.target/i386/pr69255-2.c b/gcc/testsuite/gcc.target/i386/pr69255-2.c index ebe6828e188..af3be6c31a2 100644 --- a/gcc/testsuite/gcc.target/i386/pr69255-2.c +++ b/gcc/testsuite/gcc.target/i386/pr69255-2.c @@ -12,7 +12,8 @@ __attribute__ ((__vector_size__ (16))) int b; void foo (const long long *p) { - __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ + volatile __attribute__ ((__vector_size__ (32))) long long c; + c = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "needs isa option -m32 -mavx512vl" } */ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } .-1 } */ /* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } .-2 } */ } diff --git a/gcc/testsuite/gcc.target/i386/pr79793-1.c b/gcc/testsuite/gcc.target/i386/pr79793-1.c new file mode 100644 index 00000000000..a382fe9c5e2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79793-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-options "-O2 -mgeneral-regs-only" } */ + +void + __attribute__ ((interrupt)) +fn1 (void *frame) +{ + char fxsave_region [512] __attribute__((aligned(16))); + __builtin_ia32_fxsave64 (fxsave_region); +} + +/* { dg-final { scan-assembler-times "sub\[lq\]\[\t \]*\\\$400,\[\t \]*%\[re\]sp" 1 } } */ +/* { dg-final { scan-assembler-times "fxsave64\[\t \]*-120\\(%\[re\]sp\\)" 1 } } */ +/* { dg-final { scan-assembler-times "add\[lq\]\[\t \]*\\\$400,\[\t \]*%\[re\]sp" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr79793-2.c b/gcc/testsuite/gcc.target/i386/pr79793-2.c new file mode 100644 index 00000000000..f6ae5aed33a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr79793-2.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { *-*-linux* && { ! ia32 } } } } */ +/* { dg-options "-O2 -mgeneral-regs-only" } */ + +typedef unsigned int uword_t __attribute__ ((mode (__word__))); + +void + __attribute__ ((interrupt)) +fn1 (void *frame, uword_t error) +{ + char fxsave_region [512] __attribute__((aligned(16))); + __builtin_ia32_fxsave64 (fxsave_region); +} + +/* { dg-final { scan-assembler-times "sub\[lq\]\[\t \]*\\\$392,\[\t \]*%\[re\]sp" 1 } } */ +/* { dg-final { scan-assembler-times "fxsave64\[\t \]*-120\\(%\[re\]sp\\)" 1 } } */ +/* { dg-final { scan-assembler-times "add\[lq\]\[\t \]*\\\$400,\[\t \]*%\[re\]sp" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr80569.c b/gcc/testsuite/gcc.target/i386/pr80569.c new file mode 100644 index 00000000000..8e11c40bb08 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr80569.c @@ -0,0 +1,9 @@ +/* PR target/80569 */ +/* { dg-do assemble } */ +/* { dg-options "-O2 -m16 -march=haswell" } */ + +void load_kernel(void *setup_addr) +{ + unsigned int seg = (unsigned int)setup_addr >> 4; + asm("movl %0, %%es" : : "r"(seg)); +} diff --git a/gcc/testsuite/gcc.target/i386/pr80833-3.c b/gcc/testsuite/gcc.target/i386/pr80833-3.c new file mode 100644 index 00000000000..6d5b8bb6b69 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr80833-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -mavx512dq -mavx512vl -mno-avx512bw -mtune=intel" } */ + +__int128 test (__int128 a) +{ + asm ("" : "+v" (a) : : "xmm0", "xmm1", "xmm2", "xmm3", + "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", + "xmm12", "xmm13", "xmm14", "xmm15"); + return a; +} + +/* { dg-final { scan-assembler "pinsrq" } } */ +/* { dg-final { scan-assembler "pextrq" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81128.c b/gcc/testsuite/gcc.target/i386/pr81128.c new file mode 100644 index 00000000000..90a567ad690 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81128.c @@ -0,0 +1,65 @@ +/* PR ipa/81128 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-require-ifunc "" } */ + + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +int resolver_fn = 0; +int resolved_fn = 0; + +static inline void +do_it_right_at_runtime_A () +{ + resolved_fn++; +} + +static inline void +do_it_right_at_runtime_B () +{ + resolved_fn++; +} + +static inline void do_it_right_at_runtime (void); + +void do_it_right_at_runtime (void) + __attribute__ ((ifunc ("resolve_do_it_right_at_runtime"))); + +static void (*resolve_do_it_right_at_runtime (void)) (void) +{ + srand (time (NULL)); + int r = rand (); + resolver_fn++; + + /* Use intermediate variable to get a warning for non-matching + * prototype. */ + typeof(do_it_right_at_runtime) *func; + if (r & 1) + func = do_it_right_at_runtime_A; + else + func = do_it_right_at_runtime_B; + + return (void *) func; +} + +int +main (void) +{ + const unsigned int ITERS = 10; + + for (int i = ITERS; i > 0; i--) + { + do_it_right_at_runtime (); + } + + if (resolver_fn != 1) + __builtin_abort (); + + if (resolved_fn != 10) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81214.c b/gcc/testsuite/gcc.target/i386/pr81214.c new file mode 100644 index 00000000000..2584decdb3c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81214.c @@ -0,0 +1,14 @@ +/* PR ipa/81214. */ +/* { dg-do compile } */ +/* { dg-require-ifunc "" } */ + +__attribute__((target_clones("avx","arch=slm","arch=core-avx2","default"))) +int +foo () +{ + return -2; +} + +/* { dg-final { scan-assembler "\t.globl\tfoo" } } */ +/* { dg-final { scan-assembler "foo.resolver:" } } */ +/* { dg-final { scan-assembler "foo, @gnu_indirect_function" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81225.c b/gcc/testsuite/gcc.target/i386/pr81225.c new file mode 100644 index 00000000000..db95e941c14 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81225.c @@ -0,0 +1,14 @@ +/* PR target/81225 */ +/* { dg-do compile } */ +/* { dg-options "-mavx512ifma -O3 -ffloat-store" } */ + +long a[24]; +float b[4], c[24]; +int d; + +void +foo () +{ + for (d = 0; d < 24; d++) + c[d] = (float) d ? : b[a[d]]; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81294-1.c b/gcc/testsuite/gcc.target/i386/pr81294-1.c new file mode 100644 index 00000000000..6a15ed0a410 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81294-1.c @@ -0,0 +1,29 @@ +/* PR target/81294 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include <x86intrin.h> + +int +main () +{ + volatile unsigned char c; + unsigned int x; + volatile unsigned int y, sum_ref; + + c = 0; + x = 1; + y = 0; + sum_ref = 0x0; + + /* X = 0x00000001, Y = 0x00000000, C = 0. */ + c = _subborrow_u32 (c, y, x, &x); + /* X = 0xFFFFFFFF, Y = 0x00000000, C = 1. */ + c = _subborrow_u32 (c, y, x, &x); + /* X = 0xFFFFFFFF, Y = 0xFFFFFFFF, C = 1. */ + + if (x != sum_ref) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81294-2.c b/gcc/testsuite/gcc.target/i386/pr81294-2.c new file mode 100644 index 00000000000..3e3bdb44139 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81294-2.c @@ -0,0 +1,28 @@ +/* PR target/81294 */ +/* { dg-do run { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +#include <x86intrin.h> + +int main () +{ + volatile unsigned char c; + unsigned long long x; + volatile unsigned long long y, sum_ref; + + c = 0; + x = 1LL; + y = 0LL; + sum_ref = 0x0LL; + + /* X = 0x0000000000000001, Y = 0x0000000000000000, C = 0. */ + c = _subborrow_u64 (c, y, x, &x); + /* X = 0xFFFFFFFFFFFFFFFF, Y = 0x0000000000000000, C = 1. */ + c = _subborrow_u64 (c, y, x, &x); + /* X = 0x0000000000000000, Y = 0x0000000000000000, C = 1. */ + + if (x != sum_ref) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81300.c b/gcc/testsuite/gcc.target/i386/pr81300.c new file mode 100644 index 00000000000..11eb55fed8d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81300.c @@ -0,0 +1,30 @@ +/* PR target/81300 */ +/* { dg-do run { target { ! ia32 } } } */ +/* { dg-options "-O2" } */ + +int +__attribute__((noinline, noclone)) +foo (void) +{ + unsigned long long _discard = 0, zero = 0, maxull = 0; + unsigned char zero1 = __builtin_ia32_addcarryx_u64 (0, 0, 0, &_discard); + unsigned char zero2 = __builtin_ia32_addcarryx_u64 (zero1, 0, 0, &zero); + __builtin_ia32_sbb_u64 (0x0, 2, -1, &_discard); + unsigned char one = __builtin_ia32_sbb_u64 (0, zero, 1, &maxull); + unsigned long long x = __builtin_ia32_sbb_u64 (one, zero2, 0, &_discard); + + unsigned long long z1 = 0; + __asm__ ("mov{q}\t{%1, %0|%0, %1}" : "+r" (z1) : "r" (x)); + unsigned long long z2 = 3; + __asm__ ("mov{q}\t{%1, %0|%0, %1}" : "+r" (z2) : "r" (x)); + + return 1 - (z1 | z2); +} + +int main () +{ + if (foo ()) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81313-1.c b/gcc/testsuite/gcc.target/i386/pr81313-1.c new file mode 100644 index 00000000000..f7650035cac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81313-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */ + +extern void foo (void); + +void +bar (void) +{ + foo (); +} + +/* { dg-final { scan-assembler-not "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81313-2.c b/gcc/testsuite/gcc.target/i386/pr81313-2.c new file mode 100644 index 00000000000..2cdc645dbcc --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81313-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6 -mno-iamcu" } */ + +extern void foo (int, int, int); + +void +bar (void) +{ + foo (1, 2, 3); +} + +/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*\[0-9\]*\\(%esp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81313-3.c b/gcc/testsuite/gcc.target/i386/pr81313-3.c new file mode 100644 index 00000000000..9c1b2326616 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81313-3.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */ + +extern void foo (int, int, int) __attribute__ ((regparm(3))); + +void +bar (int i1, int i2, int i3, int i4) +{ + foo (i1, i2, i3); +} + +/* { dg-final { scan-assembler-not "lea\[l\]?\[\\t \]*\[0-9\]*\\(%esp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81313-4.c b/gcc/testsuite/gcc.target/i386/pr81313-4.c new file mode 100644 index 00000000000..bad0b3c27db --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81313-4.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */ + +extern void foo (int, int, int, int, int, int, int); + +void +bar (void) +{ + foo (1, 2, 3, 4, 5, 6, 7); +} + +/* { dg-final { scan-assembler "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81313-5.c b/gcc/testsuite/gcc.target/i386/pr81313-5.c new file mode 100644 index 00000000000..51a543ca57e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81313-5.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */ + +extern void foo (int, int, int, int, int, int); + +void +bar (int i1, int i2, int i3, int i4, int i5, int i6, int i7) +{ + foo (i1, i2, i3, i4, i5, i6); +} + +/* { dg-final { scan-assembler-not "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81375.c b/gcc/testsuite/gcc.target/i386/pr81375.c new file mode 100644 index 00000000000..256a79df719 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81375.c @@ -0,0 +1,8 @@ +/* PR target/81375 */ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-mno-80387 -mno-sse -mfpmath=sse" } */ + +float foo (float a, float b) +{ + return a / b; +} diff --git a/gcc/testsuite/gcc.target/i386/pr81471.c b/gcc/testsuite/gcc.target/i386/pr81471.c new file mode 100644 index 00000000000..68b4497c9f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81471.c @@ -0,0 +1,13 @@ +/* PR target/81471 */ +/* { dg-do compile { target { ! ia32 } } } */ +/* { dg-options "-O2 -mbmi2" } */ + +static inline unsigned int rotl (unsigned int x, int k) +{ + return (x << k) | (x >> (32 - k)); +} + +unsigned long long test (unsigned int z) +{ + return rotl (z, 55); +} diff --git a/gcc/testsuite/gcc.target/i386/pr81502.c b/gcc/testsuite/gcc.target/i386/pr81502.c new file mode 100644 index 00000000000..d28791aacd7 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81502.c @@ -0,0 +1,34 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-O2 -msse2" } */ + +#include <emmintrin.h> + +#define SIZE (sizeof (void *)) + +static int foo(unsigned char (*foo)[SIZE]) +{ + __m128i acc = _mm_set_epi32(0, 0, 0, 0); + size_t i = 0; + for(; i + sizeof(__m128i) <= SIZE; i += sizeof(__m128i)) { + __m128i word; + __builtin_memcpy(&word, foo + i, sizeof(__m128i)); + acc = _mm_add_epi32(word, acc); + } + if (i != SIZE) { + __m128i word = _mm_set_epi32(0, 0, 0, 0); + __builtin_memcpy(&word, foo + i, SIZE - i); // (1) + acc = _mm_add_epi32(word, acc); + } + int res; + __builtin_memcpy(&res, &acc, sizeof(res)); + return res; +} + +int bar(void *ptr) +{ + unsigned char buf[SIZE]; + __builtin_memcpy(buf, &ptr, SIZE); + return foo((unsigned char(*)[SIZE])buf); +} + +/* { dg-final { scan-assembler-times "mov" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr81563.c b/gcc/testsuite/gcc.target/i386/pr81563.c new file mode 100644 index 00000000000..ebfd583daf5 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81563.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2 -maccumulate-outgoing-args -mincoming-stack-boundary=2 -mpreferred-stack-boundary=3 -mregparm=3 -mtune-ctrl=epilogue_using_move" } */ + +extern void bar (long long int, int); + +long long int +fn1 (long long int x) +{ + bar (x, 1); + return x; +} + +/* { dg-final { scan-assembler-times "movl\[\\t \]*-8\\(%ebp\\),\[\\t \]*%esi" 1 } } */ +/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%edi" 1 } } */ diff --git a/gcc/testsuite/gcc.target/i386/sse-13.c b/gcc/testsuite/gcc.target/i386/sse-13.c index 79879d7cc16..c5c43b12611 100644 --- a/gcc/testsuite/gcc.target/i386/sse-13.c +++ b/gcc/testsuite/gcc.target/i386/sse-13.c @@ -250,11 +250,15 @@ #define __builtin_ia32_getexppd512_mask(A, B, C, D) __builtin_ia32_getexppd512_mask(A, B, C, 8) #define __builtin_ia32_getexpps512_mask(A, B, C, D) __builtin_ia32_getexpps512_mask(A, B, C, 8) #define __builtin_ia32_getexpsd128_round(A, B, C) __builtin_ia32_getexpsd128_round(A, B, 4) +#define __builtin_ia32_getexpsd_mask_round(A, B, C, D, E) __builtin_ia32_getexpsd_mask_round(A, B, C, D, 4) #define __builtin_ia32_getexpss128_round(A, B, C) __builtin_ia32_getexpss128_round(A, B, 4) +#define __builtin_ia32_getexpss_mask_round(A, B, C, D, E) __builtin_ia32_getexpss_mask_round(A, B, C, D, 4) #define __builtin_ia32_getmantpd512_mask(A, F, C, D, E) __builtin_ia32_getmantpd512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantps512_mask(A, F, C, D, E) __builtin_ia32_getmantps512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantsd_round(A, B, C, D) __builtin_ia32_getmantsd_round(A, B, 1, 4) +#define __builtin_ia32_getmantsd_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantsd_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_getmantss_round(A, B, C, D) __builtin_ia32_getmantss_round(A, B, 1, 4) +#define __builtin_ia32_getmantss_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantss_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_insertf32x4_mask(A, B, F, D, E) __builtin_ia32_insertf32x4_mask(A, B, 1, D, E) #define __builtin_ia32_insertf64x4_mask(A, B, F, D, E) __builtin_ia32_insertf64x4_mask(A, B, 1, D, E) #define __builtin_ia32_inserti32x4_mask(A, B, F, D, E) __builtin_ia32_inserti32x4_mask(A, B, 1, D, E) diff --git a/gcc/testsuite/gcc.target/i386/sse-14.c b/gcc/testsuite/gcc.target/i386/sse-14.c index 547314aef07..c2a19b3ccef 100644 --- a/gcc/testsuite/gcc.target/i386/sse-14.c +++ b/gcc/testsuite/gcc.target/i386/sse-14.c @@ -244,7 +244,9 @@ test_2 (_mm512_maskz_extractf64x4_pd, __m256d, __mmask8, __m512d, 1) test_2 (_mm512_maskz_extracti32x4_epi32, __m128i, __mmask8, __m512i, 1) test_2 (_mm512_maskz_extracti64x4_epi64, __m256i, __mmask8, __m512i, 1) test_2 (_mm512_maskz_getexp_round_pd, __m512d, __mmask8, __m512d, 8) +test_3 (_mm_maskz_getexp_round_sd, __m128d, __mmask8, __m128d, __m128d, 8) test_2 (_mm512_maskz_getexp_round_ps, __m512, __mmask16, __m512, 8) +test_3 (_mm_maskz_getexp_round_ss, __m128, __mmask8, __m128, __m128, 8) test_2y (_mm512_maskz_getmant_round_pd, __m512d, __mmask8, __m512d, 1, 1, 8) test_2y (_mm512_maskz_getmant_round_ps, __m512, __mmask16, __m512, 1, 1, 8) test_2 (_mm512_maskz_permute_pd, __m512d, __mmask8, __m512d, 1) @@ -300,7 +302,11 @@ test_2 (_mm_div_round_ss, __m128, __m128, __m128, 9) test_2 (_mm_getexp_round_sd, __m128d, __m128d, __m128d, 8) test_2 (_mm_getexp_round_ss, __m128, __m128, __m128, 8) test_2y (_mm_getmant_round_sd, __m128d, __m128d, __m128d, 1, 1, 8) +test_4y (_mm_mask_getmant_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 1, 1, 8) +test_3y (_mm_maskz_getmant_round_sd, __m128d, __mmask8, __m128d, __m128d, 1, 1, 8) test_2y (_mm_getmant_round_ss, __m128, __m128, __m128, 1, 1, 8) +test_4y (_mm_mask_getmant_round_ss, __m128, __m128, __mmask8, __m128, __m128, 1, 1, 8) +test_3y (_mm_maskz_getmant_round_ss, __m128, __mmask8, __m128, __m128, 1, 1, 8) test_2 (_mm_mul_round_sd, __m128d, __m128d, __m128d, 9) test_2 (_mm_mul_round_ss, __m128, __m128, __m128, 9) test_2 (_mm_scalef_round_sd, __m128d, __m128d, __m128d, 9) @@ -356,7 +362,9 @@ test_3 (_mm512_mask_extractf64x4_pd, __m256d, __m256d, __mmask8, __m512d, 1) test_3 (_mm512_mask_extracti32x4_epi32, __m128i, __m128i, __mmask8, __m512i, 1) test_3 (_mm512_mask_extracti64x4_epi64, __m256i, __m256i, __mmask8, __m512i, 1) test_3 (_mm512_mask_getexp_round_pd, __m512d, __m512d, __mmask8, __m512d, 8) +test_4 (_mm_mask_getexp_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 8) test_3 (_mm512_mask_getexp_round_ps, __m512, __m512, __mmask16, __m512, 8) +test_4 (_mm_mask_getexp_round_ss, __m128, __m128, __mmask8, __m128, __m128, 8) test_3y (_mm512_mask_getmant_round_pd, __m512d, __m512d, __mmask8, __m512d, 1, 1, 8) test_3y (_mm512_mask_getmant_round_ps, __m512, __m512, __mmask16, __m512, 1, 1, 8) test_3 (_mm512_mask_permute_pd, __m512d, __m512d, __mmask8, __m512d, 1) diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c index b8a35d11c45..cd8945be1cb 100644 --- a/gcc/testsuite/gcc.target/i386/sse-22.c +++ b/gcc/testsuite/gcc.target/i386/sse-22.c @@ -399,7 +399,9 @@ test_2 (_mm512_maskz_extracti64x4_epi64, __m256i, __mmask8, __m512i, 1) test_2 (_mm512_maskz_getexp_round_pd, __m512d, __mmask8, __m512d, 8) test_2 (_mm512_maskz_getexp_round_ps, __m512, __mmask16, __m512, 8) test_2y (_mm512_maskz_getmant_round_pd, __m512d, __mmask8, __m512d, 1, 1, 8) +test_3y (_mm_maskz_getmant_round_sd, __m128d, __mmask8, __m128d, __m128d, 1, 1, 8) test_2y (_mm512_maskz_getmant_round_ps, __m512, __mmask16, __m512, 1, 1, 8) +test_3y (_mm_maskz_getmant_round_ss, __m128, __mmask8, __m128, __m128, 1, 1, 8) test_2 (_mm512_maskz_permute_pd, __m512d, __mmask8, __m512d, 1) test_2 (_mm512_maskz_permute_ps, __m512, __mmask16, __m512, 1) test_2 (_mm512_maskz_permutex_epi64, __m512i, __mmask8, __m512i, 1) @@ -491,7 +493,9 @@ test_3 (_mm512_mask_extracti64x4_epi64, __m256i, __m256i, __mmask8, __m512i, 1) test_3 (_mm512_mask_getexp_round_pd, __m512d, __m512d, __mmask8, __m512d, 8) test_3 (_mm512_mask_getexp_round_ps, __m512, __m512, __mmask16, __m512, 8) test_3y (_mm512_mask_getmant_round_pd, __m512d, __m512d, __mmask8, __m512d, 1, 1, 8) +test_4y (_mm_mask_getmant_round_sd, __m128d, __m128d, __mmask8, __m128d, __m128d, 1, 1, 8) test_3y (_mm512_mask_getmant_round_ps, __m512, __m512, __mmask16, __m512, 1, 1, 8) +test_4y (_mm_mask_getmant_round_ss, __m128, __m128, __mmask8, __m128, __m128, 1, 1, 8) test_3 (_mm512_mask_permute_pd, __m512d, __m512d, __mmask8, __m512d, 1) test_3 (_mm512_mask_permute_ps, __m512, __m512, __mmask16, __m512, 1) test_3 (_mm512_mask_permutex_epi64, __m512i, __m512i, __mmask8, __m512i, 1) diff --git a/gcc/testsuite/gcc.target/i386/sse-23.c b/gcc/testsuite/gcc.target/i386/sse-23.c index 96c663b64d3..fc339a51e63 100644 --- a/gcc/testsuite/gcc.target/i386/sse-23.c +++ b/gcc/testsuite/gcc.target/i386/sse-23.c @@ -251,11 +251,15 @@ #define __builtin_ia32_getexppd512_mask(A, B, C, D) __builtin_ia32_getexppd512_mask(A, B, C, 8) #define __builtin_ia32_getexpps512_mask(A, B, C, D) __builtin_ia32_getexpps512_mask(A, B, C, 8) #define __builtin_ia32_getexpsd128_round(A, B, C) __builtin_ia32_getexpsd128_round(A, B, 4) +#define __builtin_ia32_getexpsd_mask_round(A, B, C, D, E) __builtin_ia32_getexpsd_mask_round(A, B, C, D, 4) #define __builtin_ia32_getexpss128_round(A, B, C) __builtin_ia32_getexpss128_round(A, B, 4) +#define __builtin_ia32_getexpss_mask_round(A, B, C, D, E) __builtin_ia32_getexpss_mask_round(A, B, C, D, 4) #define __builtin_ia32_getmantpd512_mask(A, F, C, D, E) __builtin_ia32_getmantpd512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantps512_mask(A, F, C, D, E) __builtin_ia32_getmantps512_mask(A, 1, C, D, 8) #define __builtin_ia32_getmantsd_round(A, B, C, D) __builtin_ia32_getmantsd_round(A, B, 1, 4) +#define __builtin_ia32_getmantsd_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantsd_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_getmantss_round(A, B, C, D) __builtin_ia32_getmantss_round(A, B, 1, 4) +#define __builtin_ia32_getmantss_mask_round(A, B, C, W, U, D) __builtin_ia32_getmantss_mask_round(A, B, 1, W, U, 4) #define __builtin_ia32_insertf32x4_mask(A, B, F, D, E) __builtin_ia32_insertf32x4_mask(A, B, 1, D, E) #define __builtin_ia32_insertf64x4_mask(A, B, F, D, E) __builtin_ia32_insertf64x4_mask(A, B, 1, D, E) #define __builtin_ia32_inserti32x4_mask(A, B, F, D, E) __builtin_ia32_inserti32x4_mask(A, B, 1, D, E) diff --git a/gcc/testsuite/gcc.target/i386/testimm-10.c b/gcc/testsuite/gcc.target/i386/testimm-10.c index c2bf0dbabd1..d0e9b42f2fe 100644 --- a/gcc/testsuite/gcc.target/i386/testimm-10.c +++ b/gcc/testsuite/gcc.target/i386/testimm-10.c @@ -191,5 +191,9 @@ test4bit (void) { m512 = _mm512_maskz_getmant_ps (mmask16, m512, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ m128d = _mm_getmant_sd (m128d, m128d, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ + m128d = _mm_mask_getmant_sd (m128d, mmask8, m128d, m128d, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ + m128d = _mm_maskz_getmant_sd (mmask8, m128d, m128d, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ m128 = _mm_getmant_ss (m128, m128, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ + m128 = _mm_mask_getmant_ss (m128, mmask8, m128, m128, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ + m128 = _mm_maskz_getmant_ss (mmask8, m128, m128, 1, 64); /* { dg-error "the immediate argument must be a 4-bit immediate" } */ } diff --git a/gcc/testsuite/gcc.target/i386/testround-1.c b/gcc/testsuite/gcc.target/i386/testround-1.c index 2c1338164f5..d5ab95c208e 100644 --- a/gcc/testsuite/gcc.target/i386/testround-1.c +++ b/gcc/testsuite/gcc.target/i386/testround-1.c @@ -249,7 +249,11 @@ test_round (void) m128d = _mm_cvt_roundss_sd (m128d, m128, 7); /* { dg-error "incorrect rounding operand" } */ m128 = _mm_getexp_round_ss (m128, m128, 7); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_mask_getexp_round_ss (m128, mmask8, m128, m128, 7); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_maskz_getexp_round_ss (mmask8, m128, m128, 7); /* { dg-error "incorrect rounding operand" } */ m128d = _mm_getexp_round_sd (m128d, m128d, 7); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_mask_getexp_round_sd (m128d, mmask8, m128d, m128d, 7); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_maskz_getexp_round_sd (mmask8, m128d, m128d, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_getexp_round_ps (m512, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_mask_getexp_round_ps (m512, mmask16, m512, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_maskz_getexp_round_ps (mmask16, m512, 7); /* { dg-error "incorrect rounding operand" } */ @@ -263,7 +267,11 @@ test_round (void) m512 = _mm512_mask_getmant_round_ps (m512, mmask16, m512, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_maskz_getmant_round_ps (mmask16, m512, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ m128d = _mm_getmant_round_sd (m128d, m128d, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_mask_getmant_round_sd (m128d, mmask8, m128d, m128d, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_maskz_getmant_round_sd (mmask8, m128d, m128d, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ m128 = _mm_getmant_round_ss (m128, m128, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_mask_getmant_round_ss (m128, mmask8, m128, m128, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_maskz_getmant_round_ss (mmask8, m128, m128, 0, 0, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_roundscale_round_ps (m512, 4, 7); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_mask_roundscale_round_ps (m512, mmask16, m512, 4, 7); /* { dg-error "incorrect rounding operand" } */ @@ -524,7 +532,11 @@ test_sae_only (void) m128d = _mm_cvt_roundss_sd (m128d, m128, 3); /* { dg-error "incorrect rounding operand" } */ m128 = _mm_getexp_round_ss (m128, m128, 3); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_mask_getexp_round_ss (m128, mmask8, m128, m128, 3); /* { dg-error "incorrect rounding operand" } */ + m128 = _mm_maskz_getexp_round_ss (mmask8, m128, m128, 3); /* { dg-error "incorrect rounding operand" } */ m128d = _mm_getexp_round_sd (m128d, m128d, 3); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_mask_getexp_round_sd (m128d, mmask8, m128d, m128d, 5); /* { dg-error "incorrect rounding operand" } */ + m128d = _mm_maskz_getexp_round_sd (mmask8, m128d, m128d, 5); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_getexp_round_ps (m512, 3); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_mask_getexp_round_ps (m512, mmask16, m512, 3); /* { dg-error "incorrect rounding operand" } */ m512 = _mm512_maskz_getexp_round_ps (mmask16, m512, 3); /* { dg-error "incorrect rounding operand" } */ diff --git a/gcc/testsuite/gcc.target/i386/umod-3.c b/gcc/testsuite/gcc.target/i386/umod-3.c index e1fb988263a..609ab520712 100644 --- a/gcc/testsuite/gcc.target/i386/umod-3.c +++ b/gcc/testsuite/gcc.target/i386/umod-3.c @@ -9,9 +9,11 @@ int main () { unsigned char cy; - - cy = cx / 6; if (cy != 1) exit (1); - cy = cx % 6; if (cy != 1) exit (1); + unsigned char cz = 1; + asm ("" : "+q" (cz)); + + cy = cx / 6; if (cy != cz) exit (1); + cy = cx % 6; if (cy != cz) exit (1); exit(0); } diff --git a/gcc/testsuite/gcc.target/i386/vect-insert-1.c b/gcc/testsuite/gcc.target/i386/vect-insert-1.c new file mode 100644 index 00000000000..55cc52334c2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/vect-insert-1.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -msse2 -fdump-tree-ccp1" } */ + +typedef int v4si __attribute__((vector_size(16))); + +float f; + +v4si foo (v4si a) +{ + __builtin_memcpy ((char *)&a + 4, &f, 4); + return a; +} + +/* { dg-final { scan-tree-dump "Now a gimple register: a" "ccp1" } } */ +/* { dg-final { scan-tree-dump "BIT_INSERT_EXPR <a" "ccp1" } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/decl-init.c b/gcc/testsuite/gcc.target/nvptx/decl-init.c index e9af9075756..23008fb209c 100644 --- a/gcc/testsuite/gcc.target/nvptx/decl-init.c +++ b/gcc/testsuite/gcc.target/nvptx/decl-init.c @@ -37,7 +37,7 @@ struct five five2[2] = {{12, 13}, {14, 15}}; /* { dg-final { scan-assembler ".align 1 .u8 five2\\\[10\\\] = { 12, 13, 0, 0, 0, 14, 15, 0, 0, 0 };" } } */ int __attribute__((vector_size(16))) vi = {16, 17, 18, 19}; -/* { dg-final { scan-assembler ".align 8 .u32 vi\\\[4\\\] = { 16, 17, 18, 19 };" } } */ +/* { dg-final { scan-assembler ".align 16 .u32 vi\\\[4\\\] = { 16, 17, 18, 19 };" } } */ typedef int __attribute ((mode(TI))) ti_t; diff --git a/gcc/testsuite/gcc.target/nvptx/slp-2-run.c b/gcc/testsuite/gcc.target/nvptx/slp-2-run.c new file mode 100644 index 00000000000..f9841a6b11a --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/slp-2-run.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-slp-vectorize" } */ + +#include "slp-2.c" + +int +main(void) +{ + unsigned int i; + for (i = 0; i < 1000; i += 1) + { + p[i] = i; + p2[i] = 0; + } + + foo (); + + for (i = 0; i < 1000; i += 1) + if (p2[i] != i) + return 1; + + return 0; +} diff --git a/gcc/testsuite/gcc.target/nvptx/slp-2.c b/gcc/testsuite/gcc.target/nvptx/slp-2.c new file mode 100644 index 00000000000..66394918d63 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/slp-2.c @@ -0,0 +1,25 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -ftree-slp-vectorize -save-temps" } */ + +long long int p[1000] __attribute__((aligned(16))); +long long int p2[1000] __attribute__((aligned(16))); + +void __attribute__((noinline, noclone)) +foo () +{ + long long int a, b; + + unsigned int i; + for (i = 0; i < 1000; i += 2) + { + a = p[i]; + b = p[i+1]; + + p2[i] = a; + p2[i+1] = b; + } +} + +/* { dg-final { scan-assembler "ld.v2.u64" } } */ +/* { dg-final { scan-assembler "st.v2.u64" } } */ + diff --git a/gcc/testsuite/gcc.target/nvptx/slp-run.c b/gcc/testsuite/gcc.target/nvptx/slp-run.c new file mode 100644 index 00000000000..dedec471bb9 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/slp-run.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-slp-vectorize" } */ + +#include "slp.c" + +int +main(void) +{ + unsigned int i; + for (i = 0; i < 1000; i += 1) + { + p[i] = i; + p2[i] = 0; + } + + foo (); + + for (i = 0; i < 1000; i += 1) + if (p2[i] != i) + return 1; + + return 0; +} diff --git a/gcc/testsuite/gcc.target/nvptx/slp.c b/gcc/testsuite/gcc.target/nvptx/slp.c new file mode 100644 index 00000000000..5dee147af9c --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/slp.c @@ -0,0 +1,25 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -ftree-slp-vectorize -save-temps" } */ + +int p[1000] __attribute__((aligned(8))); +int p2[1000] __attribute__((aligned(8))); + +void __attribute__((noinline, noclone)) +foo () +{ + int a, b; + + unsigned int i; + for (i = 0; i < 1000; i += 2) + { + a = p[i]; + b = p[i+1]; + + p2[i] = a; + p2[i+1] = b; + } +} + +/* { dg-final { scan-assembler "ld.v2.u32" } } */ +/* { dg-final { scan-assembler "st.v2.u32" } } */ + diff --git a/gcc/testsuite/gcc.target/nvptx/v2di.c b/gcc/testsuite/gcc.target/nvptx/v2di.c new file mode 100644 index 00000000000..f63ad35d816 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/v2di.c @@ -0,0 +1,12 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -save-temps" } */ + +typedef long long int __v2di __attribute__((__vector_size__(16))); + +#define TYPE __v2di +#include "vec.inc" + +/* { dg-final { scan-assembler ".reg\\.v2\\.u64" } } */ +/* { dg-final { scan-assembler "ld\\.v2\\.u64" } } */ +/* { dg-final { scan-assembler "st\\.v2\\.u64" } } */ +/* { dg-final { scan-assembler "mov\\.v2\\.u64.*\\{ 1, 2 \\}" } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c b/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c new file mode 100644 index 00000000000..73f86bcfa9e --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/v2si-cvt.c @@ -0,0 +1,39 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -save-temps" } */ + +typedef int __v2si __attribute__((__vector_size__(8))); + +int __attribute__((unused)) +vector_cvt (__v2si arg) +{ + __v2si val4 = arg; + char *p = (char*)&val4; + + if (p[0] != 1) + return 1; + if (p[1] != 2) + return 1; + if (p[2] != 3) + return 1; + + return 0; +} + +int +vector_cvt_2 (__v2si val, __v2si val2) +{ + char *p = (char*)&val; + char *p2 = (char*)&val2; + + if (p[0] != p2[0]) + return 1; + if (p[4] != p2[4]) + return 1; + + return 0; +} + +/* We want to test for 'mov.t' here, but given PR80845 we test for cvt.t.t + instead. + { dg-final { scan-assembler "(?n)cvt\\.u32\\.u32.*\\.x" } } */ +/* { dg-final { scan-assembler "(?n)cvt\\.u16\\.u32.*\\.x" } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/v2si-run.c b/gcc/testsuite/gcc.target/nvptx/v2si-run.c new file mode 100644 index 00000000000..5821a5a95d6 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/v2si-run.c @@ -0,0 +1,83 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include "v2si.c" + +void __attribute__((noinline, noclone)) +init_val ( __v2si *p) +{ + char *p2 = (char*)p; + p2[0] = 8; + p2[1] = 7; + p2[2] = 6; + p2[3] = 5; + p2[4] = 4; + p2[5] = 3; + p2[6] = 2; + p2[7] = 1; +} + +int +main (void) +{ + { + __v2si val; + __v2si val2; + __v2si val3; + + init_val(&val); + + /* Copy val to val2. */ + vector_store (&val2, val); + + /* Copy val2 to val3. */ + val3 = vector_load (&val2); + + /* Compare val to val3. */ + { + char *p = (char*)&val; + char *p2 = (char*)&val3; + + if (p[0] != p2[0]) + return 1; + if (p[1] != p2[1]) + return 1; + if (p[2] != p2[2]) + return 1; + if (p[3] != p2[3]) + return 1; + if (p[4] != p2[4]) + return 1; + if (p[5] != p2[5]) + return 1; + if (p[6] != p2[6]) + return 1; + if (p[7] != p2[7]) + return 1; + } + } + + { + __v2si val4 = vector_const (); + char *p = (char*)&val4; + + if (p[0] != 1) + return 1; + if (p[1] != 0) + return 1; + if (p[2] != 0) + return 1; + if (p[3] != 0) + return 1; + if (p[4] != 2) + return 1; + if (p[5] != 0) + return 1; + if (p[6] != 0) + return 1; + if (p[7] != 0) + return 1; + } + + return 0; +} diff --git a/gcc/testsuite/gcc.target/nvptx/v2si.c b/gcc/testsuite/gcc.target/nvptx/v2si.c new file mode 100644 index 00000000000..ce423d82c2c --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/v2si.c @@ -0,0 +1,12 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -save-temps" } */ + +typedef int __v2si __attribute__((__vector_size__(8))); + +#define TYPE __v2si +#include "vec.inc" + +/* { dg-final { scan-assembler ".reg\\.v2\\.u32" } } */ +/* { dg-final { scan-assembler "ld\\.v2\\.u32" } } */ +/* { dg-final { scan-assembler "st\\.v2\\.u32" } } */ +/* { dg-final { scan-assembler "(?n)mov\\.v2\\.u32.*\\{ 1, 2 \\}" } } */ diff --git a/gcc/testsuite/gcc.target/nvptx/vec.inc b/gcc/testsuite/gcc.target/nvptx/vec.inc new file mode 100644 index 00000000000..269a9749e26 --- /dev/null +++ b/gcc/testsuite/gcc.target/nvptx/vec.inc @@ -0,0 +1,18 @@ +TYPE __attribute__((noinline, noclone)) +vector_load (TYPE *p) +{ + return *p; +} + +void __attribute__((noinline, noclone)) +vector_store (TYPE *p, TYPE val) +{ + *p = val; +} + +TYPE __attribute__((noinline, noclone)) +vector_const () +{ + TYPE res = {1, 2}; + return res; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-3.c new file mode 100644 index 00000000000..e069fb49af9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-3.c @@ -0,0 +1,32 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +int +compare_exponents_eq (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + return scalar_cmp_exp_eq (exponent1, exponent2); +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (!compare_exponents_eq (&x, &y)) + abort (); + if (compare_exponents_eq (&x, &z)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-4.c new file mode 100644 index 00000000000..800c32c6e07 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-eq-4.c @@ -0,0 +1,34 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +char +compare_exponents_eq (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + if (scalar_cmp_exp_eq (exponent1, exponent2)) + return 't'; + else + return 'f'; +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_eq (&x, &y) == 'f') + abort (); + if (compare_exponents_eq (&x, &z) == 't') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-3.c new file mode 100644 index 00000000000..c0cedecaa7f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-3.c @@ -0,0 +1,31 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +int +compare_exponents_gt (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + return scalar_cmp_exp_gt (exponent1, exponent2); +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_gt (&x, &y)) + abort (); + if (!compare_exponents_gt (&x, &z)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-4.c new file mode 100644 index 00000000000..1e24355d7f1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-gt-4.c @@ -0,0 +1,34 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +char +compare_exponents_gt (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + if (scalar_cmp_exp_gt (exponent1, exponent2)) + return 't'; + else + return 'f'; +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_gt (&x, &y) == 't') + abort (); + if (compare_exponents_gt (&x, &z) == 'f') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-3.c new file mode 100644 index 00000000000..acc24b5658e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-3.c @@ -0,0 +1,31 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +int +compare_exponents_lt (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + return scalar_cmp_exp_lt (exponent1, exponent2); +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_lt (&x, &y)) + abort (); + if (!compare_exponents_lt (&z, &x)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-4.c new file mode 100644 index 00000000000..b8bd278dce5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-lt-4.c @@ -0,0 +1,34 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +char +compare_exponents_lt (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + if (scalar_cmp_exp_lt (exponent1, exponent2)) + return 't'; + else + return 'f'; +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_lt (&x, &y) == 't') + abort (); + if (compare_exponents_lt (&z, &x) == 'f') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-3.c new file mode 100644 index 00000000000..79900c21b5a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-3.c @@ -0,0 +1,36 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +int +compare_exponents_unordered (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + /* This test succeeds if either exponent1 or exponent2 is NaN. */ + return scalar_cmp_exp_unordered (exponent1, exponent2); +} + +int +main () +{ + /* NaN is denoted by exponent = 2047 and fraction != 0 */ + unsigned long long int nan_image = 0x7ff0000000000003LL; + double *nan_ptr = (double *) &nan_image; + + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (!compare_exponents_unordered (&x, nan_ptr)) + abort (); + if (compare_exponents_unordered (&x, &z)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-4.c new file mode 100644 index 00000000000..4371946a6d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-cmp-exp-unordered-4.c @@ -0,0 +1,39 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed on 32-bit and 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +char +compare_exponents_unordered (double *exponent1_p, double *exponent2_p) +{ + double exponent1 = *exponent1_p; + double exponent2 = *exponent2_p; + + /* This test succeeds if either exponent1 or exponent2 is NaN. */ + if (scalar_cmp_exp_unordered (exponent1, exponent2)) + return 't'; + else + return 'f'; +} + +int +main () +{ + /* NaN is denoted by exponent = 2047 and fraction != 0 */ + unsigned long long int nan_image = 0x7ff0000000000003LL; + double *nan_ptr = (double *) &nan_image; + + double x = (double) (0x1100LL << 50); + double y = (double) (0x1101LL << 50); + double z = (double) (0x1101LL << 37); + + if (compare_exponents_unordered (&x, nan_ptr) == 'f') + abort (); + if (compare_exponents_unordered (&x, &z) == 't') + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-3.c new file mode 100644 index 00000000000..9e6fb085d47 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +unsigned long long int +get_exponent (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_extract_exp (source); +} + +/* { dg-final { scan-assembler "xsxexpqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c new file mode 100644 index 00000000000..502241581d9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-4.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +unsigned long long int +get_exponent (__ieee128 *p) +{ + __ieee128 source = *p; + + return __builtin_vec_scalar_extract_exp (source); /* { dg-error "Builtin function __builtin_vsx_scalar_extract_expq requires" } */ +} + + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c new file mode 100644 index 00000000000..07e0c1de7e3 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-5.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test only runs on 32-bit configurations, where a compiler error + should be issued because this builtin is not available on + 32-bit configurations. */ + +#include <altivec.h> + +unsigned long long int +get_exponent (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_extract_exp (source); /* { dg-error "Builtin function __builtin_vec_scalar_extract_exp not supported in this compiler configuration" } */ +} + + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-6.c new file mode 100644 index 00000000000..a5e31bf51ab --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-6.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +unsigned int +get_unbiased_exponent (double *p) +{ + double source = *p; + + return scalar_extract_exp (source) - 1023; +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double z = (double) (0x1101LL << 37); + + if (get_unbiased_exponent (&x) != 62) + abort (); + if (get_unbiased_exponent (&z) != 49) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-7.c new file mode 100644 index 00000000000..3920594b657 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-7.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +unsigned long long int +get_unbiased_exponent (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_extract_exp (source) - 16383; +} + +int +main () +{ + __ieee128 x = (__ieee128) (((__int128) 0x1100LL) << 114); + __ieee128 z = (__ieee128) (((__int128) 0x1101LL) << 112); + + if (get_unbiased_exponent (&x) != 126) + abort (); + if (get_unbiased_exponent (&z) != 124) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-3.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-3.c new file mode 100644 index 00000000000..093ba337785 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +unsigned __int128 +get_significand (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_extract_sig (source); +} + +/* { dg-final { scan-assembler "xsxsigqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c new file mode 100644 index 00000000000..0c2ec4739f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-4.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +unsigned __int128 +get_significand (__ieee128 *p) +{ + __ieee128 source = *p; + + return __builtin_vec_scalar_extract_sig (source); /* { dg-error "Builtin function __builtin_vsx_scalar_extract_sigq requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c new file mode 100644 index 00000000000..19ca4c4a09a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-5.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test only runs on 32-bit configurations, producing a compiler + error because the builtin requires 64 bits. */ +#include <altivec.h> + +unsigned __int128 /* { dg-error "'__int128' is not supported on this target" } */ +get_significand (__ieee128 *p) +{ + __ieee128 source = *p; + + return __builtin_vec_scalar_extract_sig (source); /* { dg-error "Builtin function __builtin_vec_scalar_extract_sig not supported in this compiler configuration" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-6.c new file mode 100644 index 00000000000..298268dadf4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-6.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +unsigned long long int +get_significand (double *p) +{ + double source = *p; + + return scalar_extract_sig (source); +} + +int +main () +{ + double x = (double) (0x1100LL << 50); + double z = (double) (0x1101LL << 37); + + if (get_significand (&x) != 0x11000000000000ULL) + abort (); + if (get_significand (&z) != 0x11010000000000ULL) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-7.c new file mode 100644 index 00000000000..52081310ac5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-sig-7.c @@ -0,0 +1,36 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +unsigned __int128 +get_significand (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_extract_sig (source); +} + +int +main () +{ + __ieee128 x = (__ieee128) (((__int128) 0x1100LL) << 114); + __ieee128 z = (__ieee128) (((__int128) 0x1101LL) << 112); + + /* 113 bits in the significand */ + /* our constant mantissas have 13 bits */ + + unsigned __int128 first_anticipated_result = ((__int128) 0x1100LL) << 100; + unsigned __int128 second_anticipated_result = ((__int128) 0x1101LL) << 100; + + if (get_significand (&x) != first_anticipated_result) + abort (); + if (get_significand (&z) != second_anticipated_result) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-10.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-10.c new file mode 100644 index 00000000000..e730556c5c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-10.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +__ieee128 +insert_exponent (__ieee128 *significand_p, + unsigned long long int *exponent_p) +{ + __ieee128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return __builtin_vec_scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vsx_scalar_insert_exp_qp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c new file mode 100644 index 00000000000..d44e6ccec5b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-11.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test only runs on 32-bit configurations, where a compiler error + should be issued because this builtin is not available on + 32-bit configurations. */ + +#include <altivec.h> + +__ieee128 +insert_exponent (__ieee128 *significand_p, + unsigned long long int *exponent_p) +{ + __ieee128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vec_scalar_insert_exp not supported in this compiler configuration" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-12.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-12.c new file mode 100644 index 00000000000..b76c9c81145 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-12.c @@ -0,0 +1,40 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +double +insert_exponent (unsigned long long int *significand_p, + unsigned long long int *exponent_p) +{ + unsigned long long int significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +#define BIAS_FOR_DOUBLE_EXP 1023 + +int +main () +{ + unsigned long long int significand_1 = 0x18000000000000LL; + unsigned long long int significand_2 = 0x1a000000000000LL; + unsigned long long int exponent_1 = 62 + BIAS_FOR_DOUBLE_EXP; + unsigned long long int exponent_2 = 49 + BIAS_FOR_DOUBLE_EXP; + + double x = (double) (0x1800ULL << 50); + double z = (double) (0x1a00ULL << 37); + + + if (insert_exponent (&significand_1, &exponent_1) != x) + abort (); + if (insert_exponent (&significand_2, &exponent_2) != z) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-13.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-13.c new file mode 100644 index 00000000000..212563c84b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-13.c @@ -0,0 +1,43 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +double +insert_exponent (double *significand_p, + unsigned long long int *exponent_p) +{ + double significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +#define BIAS_FOR_DOUBLE_EXP 1023 + +int +main () +{ + unsigned long long int significand_1 = 0x11000000000000LL; + unsigned long long int significand_2 = 0x11010000000000LL; + unsigned long long int exponent_1 = 62 + BIAS_FOR_DOUBLE_EXP; + unsigned long long int exponent_2 = 49 + BIAS_FOR_DOUBLE_EXP; + + double *significand_1_ptr = (double *) &significand_1; + double *significand_2_ptr = (double *) &significand_2; + + + double x = (double) (0x1100LL << 50); + double z = (double) (0x1101LL << 37); + + if (insert_exponent (significand_1_ptr, &exponent_1) != x) + abort (); + if (insert_exponent (significand_2_ptr, &exponent_2) != z) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-14.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-14.c new file mode 100644 index 00000000000..fc6c3817b98 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-14.c @@ -0,0 +1,40 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +__ieee128 +insert_exponent (unsigned __int128 *significand_p, + unsigned long long int *exponent_p) +{ + unsigned __int128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +#define BIAS_FOR_QUAD_EXP 16383 + +int +main () +{ + /* most-significant bit @13, shift it to position 113 */ + unsigned __int128 significand_1 = ((__int128) 0x1100) << 100; + unsigned __int128 significand_2 = ((__int128) 0x1101) << 100; + unsigned long long int exponent_1 = 126 + BIAS_FOR_QUAD_EXP; + unsigned long long int exponent_2 = 124 + BIAS_FOR_QUAD_EXP; + + __ieee128 x = (__ieee128) (((__int128) 0x1100LL) << 114); + __ieee128 z = (__ieee128) (((__int128) 0x1101LL) << 112); + + if (insert_exponent (&significand_1, &exponent_1) != x) + abort (); + if (insert_exponent (&significand_2, &exponent_2) != z) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-15.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-15.c new file mode 100644 index 00000000000..5843880d382 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-15.c @@ -0,0 +1,43 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> +#include <stdlib.h> + +__ieee128 +insert_exponent (__ieee128 *significand_p, + unsigned long long int *exponent_p) +{ + __ieee128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +#define BIAS_FOR_QUAD_EXP 16383 + +int +main () +{ + /* most-significant bit @13, shift it to position 113 */ + unsigned __int128 significand_1 = ((unsigned __int128) 0x1100) << 100; + unsigned __int128 significand_2 = ((unsigned __int128) 0x1101) << 100; + unsigned long long int exponent_1 = 126 + BIAS_FOR_QUAD_EXP; + unsigned long long int exponent_2 = 124 + BIAS_FOR_QUAD_EXP; + + __ieee128 *significand_1_ptr = (__ieee128 *) &significand_1; + __ieee128 *significand_2_ptr = (__ieee128 *) &significand_2; + + __ieee128 x = (__ieee128) (((__int128) 0x1100LL) << 114); + __ieee128 z = (__ieee128) (((__int128) 0x1101LL) << 112); + + if (insert_exponent (significand_1_ptr, &exponent_1) != x) + abort (); + if (insert_exponent (significand_2_ptr, &exponent_2) != z) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-6.c new file mode 100644 index 00000000000..d896fa5d7b1 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-6.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +__ieee128 +insert_exponent (unsigned __int128 *significand_p, + unsigned long long int *exponent_p) +{ + unsigned __int128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +/* { dg-final { scan-assembler "xsiexpqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-7.c new file mode 100644 index 00000000000..fe565c8f416 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-7.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +__ieee128 +insert_exponent (unsigned __int128 *significand_p, + unsigned long long int *exponent_p) +{ + unsigned __int128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return __builtin_vec_scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vsx_scalar_insert_exp_q requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c new file mode 100644 index 00000000000..3a3f1c4aa82 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-8.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test only runs on 32-bit configurations, where a compiler error + should be issued because this builtin is not available on + 32-bit configurations. */ + +#include <altivec.h> + +__ieee128 +insert_exponent (unsigned __int128 *significand_p, /* { dg-error "'__int128' is not supported on this target" } */ + unsigned long long int *exponent_p) +{ + unsigned __int128 significand = *significand_p; /* { dg-error "'__int128' is not supported on this target" } */ + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); /* { dg-error "Builtin function __builtin_vec_scalar_insert_exp not supported in this compiler configuration" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-9.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-9.c new file mode 100644 index 00000000000..dca5c0ab5b7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-insert-exp-9.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +/* This test should succeed only on 64-bit configurations. */ +#include <altivec.h> + +__ieee128 +insert_exponent (__ieee128 *significand_p, + unsigned long long int *exponent_p) +{ + __ieee128 significand = *significand_p; + unsigned long long int exponent = *exponent_p; + + return scalar_insert_exp (significand, exponent); +} + +/* { dg-final { scan-assembler "xsiexpqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c new file mode 100644 index 00000000000..32fd8b1deee --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-10.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_data_class (__ieee128 *p, const int condition_flag) +{ + __ieee128 source = *p; + + return scalar_test_data_class (source, condition_flag); /* { dg-error "argument 2 must be a 7-bit unsigned literal" } */ +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c new file mode 100644 index 00000000000..0065b77746a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-11.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_data_class (__ieee128 *p) +{ + __ieee128 source = *p; + + return __builtin_vec_scalar_test_data_class (source, 3); /* { dg-error "Builtin function __builtin_vsx_scalar_test_data_class_qp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-12.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-12.c new file mode 100644 index 00000000000..46c4fd22735 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-12.c @@ -0,0 +1,44 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_denormal (double *p) +{ + double source = *p; + + /* + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal + */ + return scalar_test_data_class (source, 3); +} + +int +main () +{ + /* A Denormal number has a biased exponent value of zero and a + * non-zero fraction value. */ + double denormal_plus = scalar_insert_exp (0x0008000000000000ULL, 0x0ULL); + double denormal_minus = scalar_insert_exp (0x8008000000000000ULL, 0x0ULL); + double not_denormal = scalar_insert_exp (0x8000000000000000ULL, 1023ULL); + + if (!test_denormal (&denormal_plus)) + abort (); + if (!test_denormal (&denormal_minus)) + abort (); + if (test_denormal (¬_denormal)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-13.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-13.c new file mode 100644 index 00000000000..0beb66ae643 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-13.c @@ -0,0 +1,47 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_zero (float *p) +{ + float source = *p; + + /* + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal + */ + return scalar_test_data_class (source, 12); +} + +int +main () +{ + /* A Zero value has a biased exponent value of zero and a zero + * fraction value. The sign may be either positive or negative. */ + unsigned int zero_plus_image = 0x0; + unsigned int zero_minus_image = 0x80000000; + unsigned int non_zero_image = 0x60000000; + + float *zero_plus_p = (float *) &zero_plus_image; + float *zero_minus_p = (float *) &zero_minus_image; + float *not_zero_p = (float *) &non_zero_image; + + if (!test_zero (zero_plus_p)) + abort (); + if (!test_zero (zero_minus_p)) + abort (); + if (test_zero (not_zero_p)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-14.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-14.c new file mode 100644 index 00000000000..90dd64637c9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-14.c @@ -0,0 +1,54 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_nan (__ieee128 *p) +{ + __ieee128 source = *p; + + /* + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal + */ + return scalar_test_data_class (source, 0x40); +} + +int +main () +{ + /* NaN is represented with the maximum biased exponent value and a + * non-zero fraction value. The sign bit ignored. If the + * high-order bit of the fraction field is 0, then the NaN is a + * Signaling NaN. Otherwise, it is a Quiet NaN. */ + __int128 signal_significand = (__int128) 0xffffffff; + __int128 quiet_significand = (((__int128) 0x1) << 112) | 0xffffffff; + __int128 a_number_significand = (((__int128) 0x1) << 112); + unsigned long long int nan_exponent = 0x7fff; + unsigned long long int a_number_exponent = 16383; + + __ieee128 signaling_nan = + scalar_insert_exp (signal_significand, nan_exponent); + __ieee128 quiet_nan = + scalar_insert_exp (quiet_significand, nan_exponent); + __ieee128 a_number = + scalar_insert_exp (a_number_significand, a_number_exponent); + + if (!test_nan (&signaling_nan)) + abort (); + if (!test_nan (&quiet_nan)) + abort (); + if (test_nan (&a_number)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-15.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-15.c new file mode 100644 index 00000000000..5da7a3fe1b6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-15.c @@ -0,0 +1,56 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_infinity (__ieee128 *p) +{ + __ieee128 source = *p; + + /* + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal + */ + return scalar_test_data_class (source, 0x30); +} + +int +main () +{ + /* Infinity is represented by a biased exponent value of: + * 255 in single format + * 2047 in double format + * 32767 in ieee128 format + * and a zero fraction value. */ + __int128 plus_significand = (__int128) 0; + __int128 minus_significand = ((__int128) 0x1) << 127; + __int128 a_number_significand = (((__int128) 0x1) << 112); + + unsigned long long int infinite_exponent = 0x7fff; + unsigned long long int a_number_exponent = 16383; + + __ieee128 plus_infinity = + scalar_insert_exp (plus_significand, infinite_exponent); + __ieee128 minus_infinity = + scalar_insert_exp (minus_significand, infinite_exponent); + __ieee128 a_number = + scalar_insert_exp (a_number_significand, a_number_exponent); + + if (!test_infinity (&plus_infinity)) + abort (); + if (!test_infinity (&minus_infinity)) + abort (); + if (test_infinity (&a_number)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c new file mode 100644 index 00000000000..25192506992 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-8.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_data_class (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_test_data_class (source, 3); +} + +/* { dg-final { scan-assembler "xststdcqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c new file mode 100644 index 00000000000..28c1e090ce5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-data-class-9.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_data_class (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_test_data_class (source, 256); /* { dg-error "argument 2 must be a 7-bit unsigned literal" } */ +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c new file mode 100644 index 00000000000..13fee32cdf8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-4.c @@ -0,0 +1,17 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_neg (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_test_neg (source); +} + +/* { dg-final { scan-assembler "xststdcqp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c new file mode 100644 index 00000000000..041a4a1c820 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-5.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power8" } */ + +#include <altivec.h> +#include <stdbool.h> + +bool +test_neg (__ieee128 *p) +{ + __ieee128 source = *p; + + return __builtin_vec_scalar_test_neg_qp (source); /* { dg-error "Builtin function __builtin_vsx_scalar_test_neg_qp requires" } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-6.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-6.c new file mode 100644 index 00000000000..497ac7b14aa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-6.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_neg (double *p) +{ + double source = *p; + + return scalar_test_neg (source); +} + +int +main () +{ + double neg_number = (double) -1; + double plus_number = (double) 1; + + if (!test_neg (&neg_number)) + abort (); + if (test_neg (&plus_number)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-7.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-7.c new file mode 100644 index 00000000000..f7dfb5f9ed6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-7.c @@ -0,0 +1,29 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_neg (float *p) +{ + float source = *p; + + return scalar_test_neg (source); +} + +int +main () +{ + float neg_number = (float) -1; + float plus_number = (float) 1; + + if (!test_neg (&neg_number)) + abort (); + if (test_neg (&plus_number)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-8.c new file mode 100644 index 00000000000..fff837ace70 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-test-neg-8.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdbool.h> +#include <stdlib.h> + +bool +test_neg (__ieee128 *p) +{ + __ieee128 source = *p; + + return scalar_test_neg (source); +} + +int +main () +{ + __ieee128 neg_number = (__ieee128) -1; + __ieee128 plus_number = (__ieee128) 1; + + if (!test_neg (&neg_number)) + abort (); + if (test_neg (&plus_number)) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-4.c new file mode 100644 index 00000000000..ab0e05e17c8 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-4.c @@ -0,0 +1,39 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector unsigned int +get_exponents (__vector float *p) +{ + __vector float source = *p; + + return vec_extract_exp (source); +} + +unsigned int bias_float_exp (int unbiased_exp) +{ + return (unsigned int) (unbiased_exp + 127); +} + +int +main () +{ + __vector float argument; + __vector unsigned int result; + + argument[0] = (float) (0x1 << 10); + argument[1] = (float) (0x1 << 9); + argument[2] = (float) (0x1 << 8); + argument[3] = (float) (0x1 << 7); + + result = get_exponents (&argument); + if ((result[0] != bias_float_exp (10)) || + (result[1] != bias_float_exp (9)) || + (result[2] != bias_float_exp (8)) || (result[3] != bias_float_exp (7))) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c new file mode 100644 index 00000000000..1dabd6cf2c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-exp-5.c @@ -0,0 +1,37 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector unsigned long long int +get_exponents (__vector double *p) +{ + __vector double source = *p; + + return vec_extract_exp (source); +} + +unsigned long long int +bias_double_exp (long long int unbiased_exp) +{ + return (unsigned long long int) (unbiased_exp + 1023); +} + +int +main () +{ + __vector double argument; + __vector unsigned long long int result; + + argument[0] = (double) (0x1 << 22); + argument[1] = (double) (0x1 << 23); + + result = get_exponents (&argument); + if ((result[0] != bias_double_exp (22)) || + (result[1] != bias_double_exp (23))) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-4.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-4.c new file mode 100644 index 00000000000..6d4a9277f18 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-4.c @@ -0,0 +1,33 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector unsigned int +get_significands (__vector float *p) +{ + __vector float source = *p; + + return vec_extract_sig (source); +} + +int +main () +{ + __vector float argument; + __vector unsigned int result; + + argument[0] = (float) (0x1234 << 10); + argument[1] = (float) (0x4321 << 9); + argument[2] = (float) (0xbabe << 8); + argument[3] = (float) (0xcafe << 7); + + result = get_significands (&argument); + if ((result[0] != 0x91a000) || (result[1] != 0x864200) || + (result[2] != 0xbabe00) || (result[3] != 0xcafe00)) + abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-5.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-5.c new file mode 100644 index 00000000000..ff2ca48798f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-extract-sig-5.c @@ -0,0 +1,31 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector unsigned long long int +get_significands (__vector double *p) +{ + __vector double source = *p; + + return vec_extract_sig (source); +} + +int +main () +{ + __vector double argument; + __vector unsigned long long int result; + + argument[0] = (double) (0xbabeLL << 22); + argument[1] = (double) (0xcafeLL << 23); + + result = get_significands (&argument); + if ((result[0] != (0xbabeULL << 37)) || (result[1] != (0xcafeULL << 37))) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-10.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-10.c new file mode 100644 index 00000000000..020d09abe13 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-10.c @@ -0,0 +1,44 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector float +make_floats (__vector float *significands_p, + __vector unsigned int *exponents_p) +{ + __vector float significands = *significands_p; + __vector unsigned int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +int +main () +{ + __vector unsigned int significands; + __vector float *significands_p = (__vector float *) &significands; + __vector unsigned int exponents; + __vector float result; + + /* 24 bits in significand, plus the sign bit: 0x80ffffff */ + significands[0] = 0x00800000; /* 1.0 */ + significands[1] = 0x00c00000; /* 1.5 */ + significands[2] = 0x80e00000; /* -1.75 */ + significands[3] = 0x80c00000; /* -1.5 */ + + exponents[0] = 127; /* exp = 0: 1.0 */ + exponents[1] = 128; /* exp = 1: 3.0 */ + exponents[2] = 129; /* exp = 2: -7.0 */ + exponents[3] = 125; /* exp = -2: -0.375 */ + + result = make_floats (significands_p, &exponents); + if ((result[0] != 1.0f) || + (result[1] != 3.0f) || (result[2] != -7.0f) || (result[3] != -0.375f)) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-11.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-11.c new file mode 100644 index 00000000000..5bf2c9cfdaa --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-11.c @@ -0,0 +1,39 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector double +make_doubles (__vector double *significands_p, + __vector unsigned long long int *exponents_p) +{ + __vector double significands = *significands_p; + __vector unsigned long long int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +int +main () +{ + __vector unsigned long long int significands; + __vector double *significands_p = (__vector double *) &significands; + __vector unsigned long long int exponents; + __vector double result; + + /* 53 bits in significand, plus the sign bit: 0x8000_0000_0000_0000 */ + significands[0] = 0x0010000000000000; /* 1.0 */ + significands[1] = 0x801c000000000000; /* -1.75 */ + + exponents[0] = 1023; /* exp = 0: 1.0 */ + exponents[1] = 1021; /* exp = -2: -0.4375 (7/16) */ + + result = make_doubles (significands_p, &exponents); + if ((result[0] != 1.0) || (result[1] != -0.4375)) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-8.c new file mode 100644 index 00000000000..3f9bd988aad --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-8.c @@ -0,0 +1,43 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector float +make_floats (__vector unsigned int *significands_p, + __vector unsigned int *exponents_p) +{ + __vector unsigned int significands = *significands_p; + __vector unsigned int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +int +main () +{ + __vector unsigned int significands; + __vector unsigned int exponents; + __vector float result; + + /* 24 bits in significand, plus the sign bit: 0x80ffffff */ + significands[0] = 0x00800000; /* 1.0 */ + significands[1] = 0x00c00000; /* 1.5 */ + significands[2] = 0x80e00000; /* -1.75 */ + significands[3] = 0x80c00000; /* -1.5 */ + + exponents[0] = 127; /* exp = 0: 1.0 */ + exponents[1] = 128; /* exp = 1: 3.0.0 */ + exponents[2] = 129; /* exp = 2: -7.0 */ + exponents[3] = 125; /* exp = -2: -0.375 */ + + result = make_floats (&significands, &exponents); + if ((result[0] != 1.0f) || + (result[1] != 3.0f) || (result[2] != -7.0f) || (result[3] != -0.375f)) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-9.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-9.c new file mode 100644 index 00000000000..5dc71951aee --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-insert-exp-9.c @@ -0,0 +1,38 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +__vector double +make_doubles (__vector unsigned long long int *significands_p, + __vector unsigned long long int *exponents_p) +{ + __vector unsigned long long int significands = *significands_p; + __vector unsigned long long int exponents = *exponents_p; + + return vec_insert_exp (significands, exponents); +} + +int +main () +{ + __vector unsigned long long int significands; + __vector unsigned long long int exponents; + __vector double result; + + /* 53 bits in significand, plus the sign bit: 0x8000_0000_0000_0000 */ + significands[0] = 0x0010000000000000; /* 1.0 */ + significands[1] = 0x801c000000000000; /* -1.75 */ + + exponents[0] = 1023; /* exp = 0: 1.0 */ + exponents[1] = 1021; /* exp = -2: -0.4375 (7/16) */ + + result = make_doubles (&significands, &exponents); + if ((result[0] != 1.0) || (result[1] != -0.4375)) + abort(); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-8.c new file mode 100644 index 00000000000..636a3012612 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-8.c @@ -0,0 +1,112 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +/* Flags to select tests: + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal */ + +__vector bool int +test_nan (__vector float *p) +{ + __vector float source = *p; + + return vec_test_data_class (source, 0x40); +} + +__vector bool int +test_infinity (__vector float *p) +{ + __vector float source = *p; + + return vec_test_data_class (source, 0x30); +} + +__vector bool int +test_zero (__vector float *p) +{ + __vector float source = *p; + + return vec_test_data_class (source, 0x0c); +} + +__vector bool int +test_denormal (__vector float *p) +{ + __vector float source = *p; + + return vec_test_data_class (source, 0x03); +} + +float +float_scalar_insert_exp (unsigned int significand, unsigned int exponent) +{ + float result; + unsigned int *result_as_uip = (unsigned int *) &result; + + *result_as_uip = (significand & ~0x800000) | ((exponent & 0xff) << 23); + return result; +} + +int +main () +{ + __vector float argument; + __vector bool result; + + unsigned int signaling_significand = 0x00a00000; + unsigned int quiet_significand = 0x00c00000; + unsigned int one_significand = 0x00800000; + unsigned int three_significand = 0x00c00000; + unsigned int five_significand = 0x00a00000; + unsigned int zero_significand = 0x00000000; + unsigned int minus_zero_significand = 0x80000000; + + /* A NaN is represented with the maximum biased exponent value and a + * non-zero fraction value. The sign bit ignored. If the + * high-order bit of the fraction field is 0, then the NaN + * is a Signaling NaN. Otherwise, it is a Quiet NaN. */ + argument[0] = float_scalar_insert_exp (signaling_significand, 255); + argument[1] = float_scalar_insert_exp (quiet_significand, 255); + argument[2] = 1.0f; + argument[3] = -0.07f; + result = test_nan (&argument); + if (!result[0] || !result[1] || result[2] || result[3]) + abort (); + + /* Infinity is represented by a biased exponent value of: + * 255 in single format + * 2047 in double format + * and a zero fraction value. The difference between +infinity and + * -infinity is the value of the sign bit. */ + argument[2] = float_scalar_insert_exp (zero_significand, 255); + argument[3] = float_scalar_insert_exp (minus_zero_significand, 255); + result = test_infinity (&argument); + if (result[0] || result[1] || !result[2] || !result[3]) + abort (); + + /* A Zero value has a biased exponent value of zero and a zero + * fraction value. The sign may be either positive or negative. */ + argument[1] = float_scalar_insert_exp (minus_zero_significand, 0); + argument[2] = float_scalar_insert_exp (zero_significand, 0); + result = test_zero (&argument); + if (result[0] || !result[1] || !result[2] || result[3]) + abort (); + + /* A Denormal number has a biased exponent value of zero and a + * non-zero fraction value. */ + argument[0] = float_scalar_insert_exp (five_significand, 0); + argument[3] = float_scalar_insert_exp (three_significand, 0); + result = test_denormal (&argument); + if (!result[0] || result[1] || result[2] || !result[3]) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-9.c b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-9.c new file mode 100644 index 00000000000..5ccac12df87 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/bfp/vec-test-data-class-9.c @@ -0,0 +1,125 @@ +/* { dg-do run { target { powerpc*-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target p9vector_hw } */ +/* { dg-options "-mcpu=power9" } */ + +#include <altivec.h> +#include <stdlib.h> + +/* Flags to select tests: + 0x40 Test for NaN + 0x20 Test for +Infinity + 0x10 Test for -Infinity + 0x08 Test for +Zero + 0x04 Test for -Zero + 0x02 Test for +Denormal + 0x01 Test for -Denormal */ + +__vector bool long long int +test_nan (__vector double *p) +{ + __vector double source = *p; + + return vec_test_data_class (source, 0x40); +} + +__vector bool long long int +test_infinity (__vector double *p) +{ + __vector double source = *p; + + return vec_test_data_class (source, 0x30); +} + +__vector bool long long int +test_zero (__vector double *p) +{ + __vector double source = *p; + + return vec_test_data_class (source, 0x0c); +} + +__vector bool long long int +test_denormal (__vector double *p) +{ + __vector double source = *p; + + return vec_test_data_class (source, 0x03); +} + +int +main () +{ + __vector double special_argument; + __vector double nonspecial_argument; + __vector bool long long int result; + + unsigned long long int signaling_significand = + 0x0017000000000000ULL; + unsigned long long int quiet_significand = + 0x001f000000000000ULL; + unsigned long long int one_significand = + 0x0010000000000000ULL; + unsigned long long int three_significand = + 0x0018000000000000ULL; + unsigned long long int five_significand = + 0x0014000000000000ULL; + unsigned long long int zero_significand = + 0x0000000000000000ULL; + unsigned long long int minus_zero_significand = + 0x8000000000000000ULL; + + nonspecial_argument[0] = -3.825; + nonspecial_argument[1] = 3.14159; + + /* A NaN is represented with the maximum biased exponent value and a + * non-zero fraction value. The sign bit ignored. If the + * high-order bit of the fraction field is 0, then the NaN + * is a Signaling NaN. Otherwise, it is a Quiet NaN. */ + special_argument[0] = scalar_insert_exp (signaling_significand, 2047); + special_argument[1] = scalar_insert_exp (quiet_significand, 2047); + result = test_nan (&special_argument); + if (!result[0] || !result[1]) + abort (); + result = test_nan (&nonspecial_argument); + if (result[0] || result[1]) + abort (); + + /* Infinity is represented by a biased exponent value of: + * 255 in single format + * 2047 in double format + * and a zero fraction value. The difference between +infinity and + * -infinity is the value of the sign bit. */ + special_argument[0] = scalar_insert_exp (zero_significand, 2047); + special_argument[1] = scalar_insert_exp (minus_zero_significand, 2047); + result = test_infinity (&special_argument); + if (!result[0] || !result[1]) + abort (); + result = test_infinity (&nonspecial_argument); + if (result[0] || result[1]) + abort (); + + /* A Zero value has a biased exponent value of zero and a zero + * fraction value. The sign may be either positive or negative. */ + special_argument[0] = scalar_insert_exp (minus_zero_significand, 0); + special_argument[1] = scalar_insert_exp (zero_significand, 0); + result = test_zero (&special_argument); + if (!result[0] || !result[1]) + abort (); + result = test_zero (&nonspecial_argument); + if (result[0] || result[1]) + abort (); + + /* A Denormal number has a biased exponent value of zero and a + * non-zero fraction value. */ + special_argument[0] = scalar_insert_exp (five_significand, 0); + special_argument[1] = scalar_insert_exp (three_significand, 0); + result = test_denormal (&special_argument); + if (!result[0] || !result[1]) + abort (); + result = test_denormal (&nonspecial_argument); + if (result[0] || result[1]) + abort (); + return 0; +} + diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-andn-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-andn-1.c index 8d8d643e088..3702bdd77fe 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-andn-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-andn-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-andn-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-andn-2.c index a4260b51b79..a6f5d5084c9 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-andn-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-andn-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-1.c index f532c6a3bb5..45e5bdd8510 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O2 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-2.c index b3515259fca..52f78df1267 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-4.c b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-4.c index 8701d9fbd1d..3ca56665033 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-4.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-4.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-5.c b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-5.c index 2835adedced..e43e2da422a 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-bextr-5.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-bextr-5.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsi-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsi-1.c index 418d336b43e..345a7eb9def 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsi-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsi-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsi-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsi-2.c index 1d51b5a75bb..f2e1a58f5ed 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsi-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsi-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-1.c index df34d53ab86..481b09f77ce 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-2.c index e5fe12d4ee0..3ba7e97dd47 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsmsk-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsr-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsr-1.c index 645e00f05ee..c383b7914e2 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsr-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsr-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-blsr-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-blsr-2.c index f290b838001..61d962b9150 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-blsr-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-blsr-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-check.h b/gcc/testsuite/gcc.target/powerpc/bmi-check.h index 35a2ac29bc3..1a9ad13f38c 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-check.h +++ b/gcc/testsuite/gcc.target/powerpc/bmi-check.h @@ -13,6 +13,7 @@ do_test (void) int main () { +#ifdef __BUILTIN_CPU_SUPPORTS__ /* Need 64-bit for 64-bit longs as single instruction. */ if ( __builtin_cpu_supports ("ppc64") ) { @@ -25,6 +26,6 @@ main () else printf ("SKIPPED\n"); #endif - +#endif /* __BUILTIN_CPU_SUPPORTS__ */ return 0; } diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-1.c b/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-1.c index 25b096ad0bc..25ba3dc238e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-2.c b/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-2.c index 75397e53eb6..1b80ccbdaa9 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi-tzcnt-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3 -fno-inline" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi32-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi32-1.c index b2a6d4d74ea..f0943d7f974 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi32-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi32-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1.c index a09d5d24b51..33f1748b44e 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-bzhi64-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-check.h b/gcc/testsuite/gcc.target/powerpc/bmi2-check.h index fa7d4c02a45..ab032eaa7ca 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-check.h +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-check.h @@ -13,6 +13,7 @@ do_test (void) int main () { +#ifdef __BUILTIN_CPU_SUPPORTS__ /* The BMI2 test for pext test requires the Bit Permute doubleword (bpermd) instruction added in PowerISA 2.06 along with the VSX facility. So we can test for arch_2_06. */ @@ -27,7 +28,7 @@ main () else printf ("SKIPPED\n"); #endif - +#endif /* __BUILTIN_CPU_SUPPORTS__ */ return 0; } diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-1.c index eda74690589..870679c779f 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include "bmi2-check.h" diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-2.c b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-2.c index a6fc38cbf55..b8327741c3a 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx32-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-1.c index 5334de20fc5..b1e4a13c2af 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-1.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include "bmi2-check.h" diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-2.c b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-2.c index ff119262c64..d57f05503c5 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-2.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-mulx64-2.c @@ -1,6 +1,7 @@ /* { dg-do run } */ /* { dg-options "-O3" } */ /* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c index 12cf92eec2c..a07567389d0 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-pdep32-1.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target lp64 } */ /* { dg-require-effective-target vsx_hw } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c index 01e1fdaf538..1268239e61f 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-pdep64-1.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target lp64 } */ /* { dg-require-effective-target vsx_hw } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c index 9450ef56aed..762ed1b0325 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-pext32-1.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target lp64 } */ /* { dg-require-effective-target vsx_hw } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c b/gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c index b76ae81b5bc..5e269ec47de 100644 --- a/gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c +++ b/gcc/testsuite/gcc.target/powerpc/bmi2-pext64-1.c @@ -3,6 +3,7 @@ /* { dg-require-effective-target lp64 } */ /* { dg-require-effective-target vsx_hw } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ #define NO_WARN_X86_INTRINSICS 1 #include <x86intrin.h> diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c new file mode 100644 index 00000000000..acaebb60f1c --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-1-p9-runnable.c @@ -0,0 +1,26 @@ +/* { dg-do run { target { powerpc*-*-linux* && { lp64 && p9vector_hw } } } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-O2 -mcpu=power9" } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ + +#include <altivec.h> + +void abort (void); + +int main() { + int i; + vector float vfa, vfb; + vector unsigned short vur, vuexpt; + + vfa = (vector float){3.4, 5.0, 20.0, 50.9 }; + vfb = (vector float){10.0, 40.0, 70.0, 100.0 }; + vuexpt = (vector unsigned short){ 3, 5, 20, 50, + 10, 40, 70, 100}; + + vur = vec_pack_to_short_fp32 (vfa, vfb); + + for(i = 0; i< 8; i++) { + if (vur[i] != vuexpt[i]) + abort(); + } +} diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-2-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-2-p9-runnable.c new file mode 100644 index 00000000000..2f317077fcb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-2-p9-runnable.c @@ -0,0 +1,72 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9 -O2" } */ + +#include <altivec.h> // vector + +void abort (void); + +int main() { + int i; + vector int vsia; + vector unsigned int vsir, vsiexpt; + vector unsigned int vuia, vuir, vuiexpt; + vector signed long long vslla; + vector unsigned long long vsllr, vsllexpt; + vector unsigned long long vulla, vullr, vullexpt; + vector __int128_t vs128a; + vector __uint128_t vs128r, vs128expt; + vector __uint128_t vu128a, vu128r, vu128expt; + + /* Returns a vector with each element containing the parity of the low-order + bit of each of the bytes in that element. Note results are always + returned in an unsinged type, per the ABI spec. */ + vsia = (vector int) {0x10101010, 0x10101011, 0x10101111, 0x10111111}; + vsiexpt = (vector unsigned int){0x0, 0x1, 0x0, 0x1}; + + vuia = (vector unsigned int) {0x000010000, 0x00010001, + 0x10100000, 0x000010101}; + vuiexpt = (vector unsigned int){0x1, 0x0, 0x0, 0x1}; + + vslla = (vector long long) {0x0000000000010000, 0x0001000100010000}; + vsllexpt = (vector unsigned long long){0x1, 0x1}; + + vulla = (vector unsigned long long) {0x0000000000000001, + 0x0001000000000001}; + vullexpt = (vector unsigned long long){0x1, 0x0}; + + vs128a = (vector __int128_t) {0x0000000000001}; + vs128expt = (vector __uint128_t) {0x1}; + vu128a = (vector __uint128_t) {0x1000000000001}; + vu128expt = (vector __uint128_t) {0x0}; + + vsir = vec_parity_lsbb(vsia); + vuir = vec_parity_lsbb(vuia); + vsllr = vec_parity_lsbb(vslla); + vullr = vec_parity_lsbb(vulla); + vs128r = vec_parity_lsbb(vs128a); + vu128r = vec_parity_lsbb(vu128a); + + for(i = 0; i< 4; i++) { + if (vsir[i] != vsiexpt[i]) + abort(); + + if (vuir[i] != vuiexpt[i]) + abort(); + } + + for(i = 0; i< 2; i++) { + if (vsllr[i] != vsllexpt[i]) + abort(); + + if (vullr[i] != vullexpt[i]) + abort(); + } + + if (vs128r[0] != vs128expt[0]) + abort(); + + if (vu128r[0] != vu128expt[0]) + abort(); +} diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c new file mode 100644 index 00000000000..24589b55639 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p9-runnable.c @@ -0,0 +1,35 @@ +/* { dg-do run { target { powerpc64*-*-* && { lp64 && p9vector_hw } } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ + +#include <altivec.h> // vector + +void abort (void); + +int main() { + int i; + vector float vfr, vfexpt; + vector unsigned short vusha; + + /* 1.0, -2.0, 0.0, 8.5, 1.5, 0.5, 1.25, -0.25 */ + vusha = (vector unsigned short){0B011110000000000, 0B1100000000000000, + 0B000000000000000, 0B0100100001000000, + 0B011111000000000, 0B0011100000000000, + 0B011110100000000, 0B1011010000000000}; + + vfexpt = (vector float){1.0, -2.0, 0.0, 8.5}; + vfr = vec_extract_fp_from_shorth(vusha); + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } + + vfexpt = (vector float){1.5, 0.5, 1.25, -0.25}; + vfr = vec_extract_fp_from_shortl(vusha); + + for (i=0; i<4; i++) { + if (vfr[i] != vfexpt[i]) + abort(); + } +} diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c index 08b7a5395d2..17bb9b3225b 100644 --- a/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c @@ -5,53 +5,181 @@ #include <altivec.h> // vector +#ifdef DEBUG +#include <stdio.h> +#endif + #define ALL 1 #define EVEN 2 #define ODD 3 void abort (void); -void test_result_sp(int check, vector float vec_result, vector float vec_expected) +void test_int_result(int check, vector int vec_result, vector int vec_expected) { int i; - for(i = 0; i<4; i++) { - switch (check) { - case ALL: - break; - case EVEN: - if (i%2 == 0) + for (i = 0; i < 4; i++) { + switch (check) { + case ALL: break; - else - continue; - case ODD: - if (i%2 != 0) + case EVEN: + if (i%2 == 0) + break; + else + continue; + case ODD: + if (i%2 != 0) + break; + else + continue; + } + + if (vec_result[i] != vec_expected[i]) { +#ifdef DEBUG + printf("Test_int_result: "); + printf("vec_result[%d] (%d) != vec_expected[%d] (%d)\n", + i, vec_result[i], i, vec_expected[i]); +#else + abort(); +#endif + } + } +} + +void test_unsigned_int_result(int check, vector unsigned int vec_result, + vector unsigned int vec_expected) +{ + int i; + + for (i = 0; i < 4; i++) { + switch (check) { + case ALL: break; - else - continue; + case EVEN: + if (i%2 == 0) + break; + else + continue; + case ODD: + if (i%2 != 0) + break; + else + continue; + } + + if (vec_result[i] != vec_expected[i]) { +#ifdef DEBUG + printf("Test_unsigned int_result: "); + printf("vec_result[%d] (%d) != vec_expected[%d] (%d)\n", + i, vec_result[i], i, vec_expected[i]); +#else + abort(); +#endif + } + } +} - if (vec_result[i] != vec_expected[i]) - abort(); +void test_ll_int_result(vector long long int vec_result, + vector long long int vec_expected) +{ + int i; + + for (i = 0; i < 2; i++) + if (vec_result[i] != vec_expected[i]) { +#ifdef DEBUG + printf("Test_ll_int_result: "); + printf("vec_result[%d] (%lld) != vec_expected[%d] (%lld)\n", + i, vec_result[i], i, vec_expected[i]); +#else + abort(); +#endif + } +} + +void test_ll_unsigned_int_result(vector long long unsigned int vec_result, + vector long long unsigned int vec_expected) +{ + int i; + + for (i = 0; i < 2; i++) + if (vec_result[i] != vec_expected[i]) { +#ifdef DEBUG + printf("Test_ll_unsigned_int_result: "); + printf("vec_result[%d] (%lld) != vec_expected[%d] (%lld)\n", + i, vec_result[i], i, vec_expected[i]); +#else + abort(); +#endif + } +} + +void test_result_sp(int check, vector float vec_result, + vector float vec_expected) +{ + int i; + for(i = 0; i<4; i++) { + + switch (check) { + case ALL: + break; + case EVEN: + if (i%2 == 0) + break; + else + continue; + case ODD: + if (i%2 != 0) + break; + else + continue; + } + + if (vec_result[i] != vec_expected[i]) { +#ifdef DEBUG + printf("Test_result_sp: "); + printf("vec_result[%d] (%lld) != vec_expected[%d] (%lld)\n", + i, vec_result[i], i, vec_expected[i]); +#else + abort(); +#endif + } } } void test_result_dp(vector double vec_result, vector double vec_expected) { - if (vec_result[0] != vec_expected[0]) + if (vec_result[0] != vec_expected[0]) { +#ifdef DEBUG + printf("Test_result_dp: "); + printf("vec_result[0] (%lld) != vec_expected[0] (%lld)\n", + vec_result[0], vec_expected[0]); +#else abort(); +#endif + } - if (vec_result[1] != vec_expected[1]) + if (vec_result[1] != vec_expected[1]) { +#ifdef DEBUG + printf("Test_result_dp: "); + printf("vec_result[1] (%lld) != vec_expected[1] (%lld)\n", + vec_result[1], vec_expected[1]); +#else abort(); +#endif + } } int main() { int i; - vector unsigned int vec_unint; - vector signed int vec_int; + vector unsigned int vec_unint, vec_uns_int_expected, vec_uns_int_result; + vector signed int vec_int, vec_int_expected, vec_int_result; vector long long int vec_ll_int0, vec_ll_int1; + vector long long int vec_ll_int_expected, vec_ll_int_result; vector long long unsigned int vec_ll_uns_int0, vec_ll_uns_int1; + vector long long unsigned int vec_ll_uns_int_expected, vec_ll_uns_int_result; vector float vec_flt, vec_flt_result, vec_flt_expected; vector double vec_dble0, vec_dble1, vec_dble_result, vec_dble_expected; @@ -163,4 +291,67 @@ int main() vec_flt_expected = (vector float){0.00, 34.00, 0.00, 97.00}; vec_flt_result = vec_floato (vec_dble0); test_result_sp(ODD, vec_flt_result, vec_flt_expected); + + /* Convert single precision float to int */ + vec_flt = (vector float){-14.30, 34.00, 22.00, 97.00}; + vec_int_expected = (vector signed int){-14, 34, 22, 97}; + vec_int_result = vec_signed (vec_flt); + test_int_result (ALL, vec_int_result, vec_int_expected); + + /* Convert double precision float to long long int */ + vec_dble0 = (vector double){-124.930, 81234.49}; + vec_ll_int_expected = (vector long long signed int){-124, 81234}; + vec_ll_int_result = vec_signed (vec_dble0); + test_ll_int_result (vec_ll_int_result, vec_ll_int_expected); + + /* Convert two double precision vector float to vector int */ + vec_dble0 = (vector double){-124.930, 81234.49}; + vec_dble1 = (vector double){-24.370, 8354.99}; + vec_int_expected = (vector signed int){-124, 81234, -24, 8354}; + vec_int_result = vec_signed2 (vec_dble0, vec_dble1); + test_int_result (ALL, vec_int_result, vec_int_expected); + + /* Convert double precision vector float to vector int, even words */ + vec_dble0 = (vector double){-124.930, 81234.49}; + vec_int_expected = (vector signed int){-124, 0, 81234, 0}; + vec_int_result = vec_signede (vec_dble0); + test_int_result (EVEN, vec_int_result, vec_int_expected); + + /* Convert double precision vector float to vector int, odd words */ + vec_dble0 = (vector double){-124.930, 81234.49}; + vec_int_expected = (vector signed int){0, -124, 0, 81234}; + vec_int_result = vec_signedo (vec_dble0); + test_int_result (ODD, vec_int_result, vec_int_expected); + + /* Convert double precision float to long long unsigned int */ + vec_dble0 = (vector double){124.930, 8134.49}; + vec_ll_uns_int_expected = (vector long long unsigned int){124, 8134}; + vec_ll_uns_int_result = vec_unsigned (vec_dble0); + test_ll_unsigned_int_result (vec_ll_uns_int_result, + vec_ll_uns_int_expected); + + /* Convert two double precision vector float to vector unsigned int */ + vec_dble0 = (vector double){124.930, 8134.49}; + vec_dble1 = (vector double){24.370, 834.99}; + vec_uns_int_expected = (vector unsigned int){124, 8134, 24, 834}; + vec_uns_int_result = vec_unsigned2 (vec_dble0, vec_dble1); + test_unsigned_int_result (ALL, vec_uns_int_result, + vec_uns_int_expected); + + /* Convert double precision vector float to vector unsigned int, + even words */ + vec_dble0 = (vector double){3124.930, 8234.49}; + vec_uns_int_expected = (vector unsigned int){3124, 0, 8234, 0}; + vec_uns_int_result = vec_unsignede (vec_dble0); + test_unsigned_int_result (EVEN, vec_uns_int_result, + vec_uns_int_expected); + + /* Convert double precision vector float to vector unsigned int, + odd words */ + vec_dble0 = (vector double){1924.930, 81234.49}; + vec_uns_int_expected = (vector unsigned int){0, 1924, 0, 81234}; + vec_uns_int_result = vec_unsignedo (vec_dble0); + test_unsigned_int_result (ODD, vec_uns_int_result, + vec_uns_int_expected); } + diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-vec_reve-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-vec_reve-runnable.c new file mode 100644 index 00000000000..f7c3c3d9138 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-vec_reve-runnable.c @@ -0,0 +1,393 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-O2 -mvsx -mcpu=power7" } */ + +#include <altivec.h> // vector + +#ifdef DEBUG +#include <stdio.h> +#endif + +#define VBC 0 +#define VSC 1 +#define VUC 2 +#define VBS 3 +#define VSS 4 +#define VUS 5 +#define VBI 6 +#define VI 7 +#define VUI 8 +#define VLLB 9 +#define VLLI 10 +#define VLLUI 11 +#define VF 12 +#define VD 13 + +union vector_value +{ + vector bool char vbc; + vector signed char vsc; + vector unsigned char vuc; + vector bool short vbs; + vector signed short vss; + vector unsigned short vus; + vector bool int vbi; + vector signed int vi; + vector unsigned int vui; + vector bool long long vllb; + vector long long signed int vlli; + vector long long unsigned int vllui; + vector float vf; + vector double vd; +} vec_element; + +struct vector_struct +{ + int vector_id; + int element_size; // element size in bytes + union vector_value vec; +} vec; + +void abort (void); + +void test_results(struct vector_struct *vec_result, + struct vector_struct *vec_expected) +{ + int i; + int num_elements; + if (vec_result->element_size != vec_expected->element_size) +#ifdef DEBUG + printf("vec_result->element_size != vec_expected->element_size\n"); +#else + abort(); +#endif + + if (vec_result->vector_id != vec_expected->vector_id) +#ifdef DEBUG + printf("vec_result->vector_id != vec_expected->vector_id\n"); +#else + abort(); +#endif + + num_elements = 16 / vec_result->element_size; + + for (i = 0; i<num_elements; i++) { + switch (vec_result->vector_id) { + case VBC: + if (vec_result->vec.vbc[i] != vec_expected->vec.vbc[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vbc[%d] (%d) != ", + i, vec_result->vec.vbc[i]); + printf("vec_expected->vec.vbc[%d] (%d)\n", + i, vec_expected->vec.vbc[i]); +#else + abort(); +#endif + } + break; + + case VSC: + if (vec_result->vec.vsc[i] != vec_expected->vec.vsc[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vsc[%d] (%d) != ", + i, vec_result->vec.vsc[i]); + printf("vec_expected->vec.vsc[%d] (%d)\n", + i, vec_expected->vec.vsc[i]); +#else + abort(); +#endif + } + break; + + case VUC: + if (vec_result->vec.vuc[i] != vec_expected->vec.vuc[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vuc[%d] (%d) != ", + i, vec_result->vec.vuc[i]); + printf("vec_expected->vec.vuc[%d] (%d)\n", + i, vec_expected->vec.vuc[i]); +#else + abort(); +#endif + } + break; + + case VBS: + if (vec_result->vec.vbs[i] != vec_expected->vec.vbs[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vbs[%d] (%d) != ", + i, vec_result->vec.vbs[i]); + printf("vec_expected->vec.vbs[%d] (%d)\n", + i, vec_expected->vec.vbs[i]); +#else + abort(); +#endif + } + break; + + case VSS: + if (vec_result->vec.vss[i] != vec_expected->vec.vss[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vss[%d] (%d) != ", + i, vec_result->vec.vss[i]); + printf("vec_expected->vec.vss[%d] (%d)\n", + i, vec_expected->vec.vss[i]); +#else + abort(); +#endif + } + break; + + case VUS: + if (vec_result->vec.vus[i] != vec_expected->vec.vus[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vus[%d] (%d) != ", + i, vec_expected->vec.vus[i]); + printf("vec_expected->vec.vus[%d] (%d)\n", + i, vec_expected->vec.vus[i]); +#else + abort(); +#endif + } + break; + + case VBI: + if (vec_result->vec.vbi[i] != vec_expected->vec.vbi[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vbi[%d] (%d) != ", + i, vec_result->vec.vbi[i]); + printf("vec_expected->vec.vbi[%d] (%d)\n", + i, vec_expected->vec.vbi[i]); +#else + abort(); +#endif + } + break; + + case VI: + if (vec_result->vec.vi[i] != vec_expected->vec.vi[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vi[%d] (%d) != ", + i, vec_result->vec.vi[i]); + printf("vec_expected->vec.vi[%d] (%d)\n", + i, vec_expected->vec.vi[i]); +#else + abort(); +#endif + } + break; + + case VUI: + if (vec_result->vec.vui[i] != vec_expected->vec.vui[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vui[%d] (%u) != ", + i, vec_result->vec.vui[i]); + printf("vec_expected->vec.vui[%u] (%d)\n", + i, vec_expected->vec.vui[i]); +#else + abort(); +#endif + } + break; + + case VLLB: + if (vec_result->vec.vllb[i] != vec_expected->vec.vllb[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vllb[%d] (%lld != ", + i, vec_result->vec.vllb[i]); + printf("vec_expected->vec.vllb[%lld] (%d)\n", + i, vec_expected->vec.vllb[i]); +#else + abort(); +#endif + } + break; + + case VLLI: + if (vec_result->vec.vlli[i] != vec_expected->vec.vlli[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vlli[%d] (%d) != ", + i, vec_result->vec.vlli[i]); + printf("vec_expected->vec.vlli[%d] (%d)\n", + i, vec_expected->vec.vlli[i]); +#else + abort(); +#endif + } + break; + + case VLLUI: + if (vec_result->vec.vllui[i] != vec_expected->vec.vllui[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vllui[%d] (%llu) != ", + i, vec_result->vec.vllui[i]); + printf("vec_expected->vec.vllui[%d] (%llu)\n", + i, vec_expected->vec.vllui[i]); +#else + abort(); +#endif + } + break; + + case VF: + if (vec_result->vec.vf[i] != vec_expected->vec.vf[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vf[%d] (%f) != ", + i, vec_result->vec.vf[i]); + printf("vec_expected->vec.vf[%d] (%f)\n", + i, vec_expected->vec.vf[i]); +#else + abort(); +#endif + } + break; + + case VD: + if (vec_result->vec.vd[i] != vec_expected->vec.vd[i]) + { +#ifdef DEBUG + printf("vec_result->vec.vd[%d] (%f) != ", + i, vec_result->vec.vd[i]); + printf("vec_expected->vec.vd[%d] (%f)\n", + i, vec_expected->vec.vd[i]); +#else + abort(); +#endif + } + break; + + default: +#ifdef DEBUG + printf("Unknown case.\n"); +#else + abort(); +#endif + } + } +} + +int main() +{ + int i; + struct vector_struct vec_src, vec_expected, vec_result; + + vec_src.vec.vbc = (vector bool char){ 0, 1, 0, 0, 1, 1, 0, 0, + 0, 1, 1, 1, 0, 0, 0, 0 }; + vec_expected.vec.vbc = (vector bool char){ 0, 0, 0, 0, 1, 1, 1, 0, + 0, 0, 1, 1, 0, 0, 1, 0 }; + vec_result.element_size = vec_expected.element_size = 1; + vec_result.vector_id = vec_expected.vector_id = VBC; + vec_result.vec.vbc = vec_reve (vec_src.vec.vbc); + test_results(&vec_result, &vec_expected); + + vec_src.vec.vsc = (vector signed char){ 0, 1, -2, -3, 4, 5, -6, -7, 8, + 9, -10, -11, 12, 13, -14, -15 }; + vec_expected.vec.vsc = (vector signed char){ -15, -14, 13, 12, -11, -10, + 9, 8, -7, -6, 5, 4, -3, -2, + 1, 0 }; + vec_result.element_size = vec_expected.element_size = 1; + vec_result.vector_id = vec_expected.vector_id = VSC; + vec_result.vec.vsc = vec_reve (vec_src.vec.vsc); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vuc = (vector unsigned char){ 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25 }; + vec_expected.vec.vuc = (vector unsigned char){ 25, 24, 23, 22, 21, 20, + 19, 18, 17, 16, 15, 14, 13, + 12, 11, 10 }; + vec_result.element_size = vec_expected.element_size = 1; + vec_result.vector_id = vec_expected.vector_id = VUC; + vec_result.vec.vuc = vec_reve (vec_src.vec.vuc); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vbs = (vector bool short){ 0, 0, 1, 1, 0, 1, 0, 1 }; + vec_expected.vec.vbs = (vector bool short){ 1, 0, 1, 0, 1, 1, 0, 0 }; + vec_result.element_size = vec_expected.element_size = 2; + vec_result.vector_id = vec_expected.vector_id = VBS; + vec_result.vec.vbs = vec_reve (vec_src.vec.vbs); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vss = (vector signed short){ -1, -2, 3, 4, -5, -6, 7, 8 }; + vec_expected.vec.vss = (vector signed short){ 8, 7, -6, -5, 4, 3, -2, -1 }; + vec_result.element_size = vec_expected.element_size = 2; + vec_result.vector_id = vec_expected.vector_id = VSS; + vec_result.vec.vss = vec_reve (vec_src.vec.vss); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vus = (vector unsigned short){ 11, 22, 33, 44, 55, 66, 77, 88 }; + vec_expected.vec.vus = (vector unsigned short){ 88, 77, 66, 55, + 44, 33, 22, 11 }; + vec_result.element_size = vec_expected.element_size = 2; + vec_result.vector_id = vec_expected.vector_id = VUS; + vec_result.vec.vus = vec_reve (vec_src.vec.vus); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vbi = (vector bool int){ 0, 1, 1, 1 }; + vec_expected.vec.vbi = (vector bool int){ 1, 1, 1, 0 }; + vec_result.element_size = vec_expected.element_size = 4; + vec_result.vector_id = vec_expected.vector_id = VBI; + vec_result.vec.vbi = vec_reve (vec_src.vec.vbi); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vi = (vector signed int){ -1, 3, -5, 1234567 }; + vec_expected.vec.vi = (vector signed int){1234567, -5, 3, -1}; + vec_result.element_size = vec_expected.element_size = 4; + vec_result.vector_id = vec_expected.vector_id = VI; + vec_result.vec.vi = vec_reve (vec_src.vec.vi); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vui = (vector unsigned int){ 9, 11, 15, 2468013579 }; + vec_expected.vec.vui = (vector unsigned int){2468013579, 15, 11, 9}; + vec_result.element_size = vec_expected.element_size = 4; + vec_result.vector_id = vec_expected.vector_id = VUI; + vec_result.vec.vui = vec_reve (vec_src.vec.vui); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vllb = (vector bool long long ){ 0, 1 }; + vec_expected.vec.vllb = (vector bool long long){1, 0}; + vec_result.element_size = vec_expected.element_size = 8; + vec_result.vector_id = vec_expected.vector_id = VLLB; + vec_result.vec.vllb = vec_reve (vec_src.vec.vllb); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vlli = (vector long long int){ -12, -12345678901234 }; + vec_expected.vec.vlli = (vector long long int){-12345678901234, -12}; + vec_result.element_size = vec_expected.element_size = 8; + vec_result.vector_id = vec_expected.vector_id = VLLI; + vec_result.vec.vlli = vec_reve (vec_src.vec.vlli); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vllui = (vector unsigned long long int){ 102, 9753108642 }; + vec_expected.vec.vllui = (vector unsigned long long int){9753108642, 102}; + vec_result.element_size = vec_expected.element_size = 8; + vec_result.vector_id = vec_expected.vector_id = VLLUI; + vec_result.vec.vllui = vec_reve (vec_src.vec.vllui); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vf = (vector float){ -21., 3.5, -53., 78. }; + vec_expected.vec.vf = (vector float){78., -53, 3.5, -21}; + vec_result.element_size = vec_expected.element_size = 4; + vec_result.vector_id = vec_expected.vector_id = VF; + vec_result.vec.vf = vec_reve (vec_src.vec.vf); + test_results (&vec_result, &vec_expected); + + vec_src.vec.vd = (vector double){ 34.0, 97.0 }; + vec_expected.vec.vd = (vector double){97.0, 34.0}; + vec_result.element_size = vec_expected.element_size = 8; + vec_result.vector_id = vec_expected.vector_id = VD; + vec_result.vec.vd = vec_reve (vec_src.vec.vd); + test_results (&vec_result, &vec_expected); +} diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-4-p9-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-4-p9-runnable.c new file mode 100644 index 00000000000..8e8fcabbe82 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/builtins-4-p9-runnable.c @@ -0,0 +1,95 @@ +/* { dg-do run { target { powerpc*-*-* && { p9vector_hw } } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-options "-mcpu=power9 -O2 " } */ + +#include <altivec.h> // vector + +void abort (void); + +int main() { + int i; + + vector signed char vsca, vscr, vscexpt; + vector unsigned char vuca, vucr, vucexpt; + vector signed short int vssa, vssr, vssexpt; + vector unsigned short int vusa, vusr, vusexpt; + vector signed int vsia, vsir, vsiexpt; + vector unsigned int vuia, vuir, vuiexpt; + vector signed long long vslla, vsllr, vsllexpt; + vector unsigned long long vulla, vullr, vullexpt; + + vsca = (vector signed char) {0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15}; + + vscexpt = (vector signed char) {8, 0, 1, 0, 2, 0, 1, 0, + 3, 0, 1, 0, 2, 0, 1, 0}; + + vuca = (vector unsigned char) {'0', '3', '6', '9', 'A', 'B', 'E', 'F', + 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'}; + + vucexpt = (vector unsigned char) {4, 0, 1, 0, 0, 1, 0, 1, + 0, 3, 0, 1, 0, 2, 0, 1}; + + vssa = (vector short int) {0x1, 0x10, 0x100, 0x1000, + 0x2, 0x20, 0x200, 0x2000}; + + vssexpt = (vector short int) {0, 4, 8, 12, 1, 5, 9, 13}; + + vusa = (vector unsigned short int) {0x4, 0x40, 0x400, 0x4000, + 0x8, 0x80, 0x800, 0x8000}; + vusexpt = (vector unsigned short int) {2, 6, 10, 14, 3, 7, 11, 15}; + + vsia = (vector int) {0x10000, 0x100000, 0x1000000, 0x10000000}; + vsiexpt = (vector int){16, 20, 24, 28}; + + vuia = (vector unsigned int) {0x2, 0x20, 0x200, 0x2000}; + vuiexpt = (vector unsigned int){1, 5, 9, 13}; + + vslla = (vector long long) {0x0000000000010000LL, 0x0001000100010000LL}; + vsllexpt = (vector long long){16, 16}; + + vulla = (vector unsigned long long) {0x0000400000000000LL, 0x0080000000000000ULL}; + + vullexpt = (vector unsigned long long) {46, 55}; + + vscr = vec_cnttz (vsca); + vucr = vec_cnttz (vuca); + vssr = vec_cnttz (vssa); + vusr = vec_cnttz (vusa); + vsir = vec_cnttz (vsia); + vuir = vec_cnttz (vuia); + vsllr = vec_cnttz (vslla); + vullr = vec_cnttz (vulla); + + for (i=0; i<16; i++) { + if (vscr[i] != vscexpt[i]) + abort(); + + if (vucr[i] != vucexpt[i]) + abort(); + } + + for (i=0; i<8; i++) { + if (vssr[i] != vssexpt[i]) + abort(); + + if (vusr[i] != vusexpt[i]) + abort(); + } + + for (i=0; i<4; i++) { + if (vsir[i] != vsiexpt[i]) + abort(); + + if (vuir[i] != vuiexpt[i]) + abort(); + } + + for (i=0; i<2; i++) { + if (vsllr[i] != vsllexpt[i]) + abort(); + + if (vullr[i] != vullexpt[i]) + abort(); + } +} diff --git a/gcc/testsuite/gcc.target/powerpc/clone1.c b/gcc/testsuite/gcc.target/powerpc/clone1.c index 5c69db8e217..eb13a7b2dbd 100644 --- a/gcc/testsuite/gcc.target/powerpc/clone1.c +++ b/gcc/testsuite/gcc.target/powerpc/clone1.c @@ -2,6 +2,7 @@ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-options "-mcpu=power8 -O2" } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ /* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8 (aka, ISA 2.07) has to do modulus with divide and multiply. Make sure diff --git a/gcc/testsuite/gcc.target/powerpc/clone2.c b/gcc/testsuite/gcc.target/powerpc/clone2.c new file mode 100644 index 00000000000..ecad5eb8e29 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/clone2.c @@ -0,0 +1,31 @@ +/* { dg-do run { target { powerpc*-*-linux* } } } */ +/* { dg-options "-mvsx -O2" } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-require-effective-target ppc_cpu_supports_hw } */ + +#include <stddef.h> +#include <stdlib.h> + +/* Power9 (aka, ISA 3.0) has a MODSD instruction to do modulus, while Power8 + (aka, ISA 2.07) has to do modulus with divide and multiply. Make sure that + the basic support for target_clones runs. + + Restrict ourselves to Linux, since IFUNC might not be supported in other + operating systems. */ + +__attribute__((__target_clones__("cpu=power9,default"))) +long mod_func (long a, long b) +{ + return a % b; +} + +#define X 53L +#define Y 7L +int +main (void) +{ + if (mod_func (X, Y) != (X % Y)) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c index 684c0f6d17d..c190f246231 100644 --- a/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c +++ b/gcc/testsuite/gcc.target/powerpc/cpu-builtin-1.c @@ -4,6 +4,11 @@ void use_cpu_is_builtins (unsigned int *p) { + /* If GCC was configured to use an old GLIBC (before 2.23), the + __builtin_cpu_is and __builtin_cpu_supports built-in functions return 0, + and the compiler issues a warning that you need a newer glibc to use them. + Use #ifdef to avoid the warning. */ +#ifdef __BUILTIN_CPU_SUPPORTS__ p[0] = __builtin_cpu_is ("power9"); p[1] = __builtin_cpu_is ("power8"); p[2] = __builtin_cpu_is ("power7"); @@ -19,11 +24,15 @@ use_cpu_is_builtins (unsigned int *p) p[12] = __builtin_cpu_is ("ppc440"); p[13] = __builtin_cpu_is ("ppc405"); p[14] = __builtin_cpu_is ("ppc-cell-be"); +#else + p[0] = 0; +#endif } void use_cpu_supports_builtins (unsigned int *p) { +#ifdef __BUILTIN_CPU_SUPPORTS__ p[0] = __builtin_cpu_supports ("4xxmac"); p[1] = __builtin_cpu_supports ("altivec"); p[2] = __builtin_cpu_supports ("arch_2_05"); @@ -62,4 +71,9 @@ use_cpu_supports_builtins (unsigned int *p) p[35] = __builtin_cpu_supports ("ucache"); p[36] = __builtin_cpu_supports ("vcrypto"); p[37] = __builtin_cpu_supports ("vsx"); + p[38] = __builtin_cpu_supports ("darn"); + p[39] = __builtin_cpu_supports ("scv"); +#else + p[0] = 0; +#endif } diff --git a/gcc/testsuite/gcc.target/powerpc/dform-1.c b/gcc/testsuite/gcc.target/powerpc/dform-1.c index 12623f20262..37a30d1c92f 100644 --- a/gcc/testsuite/gcc.target/powerpc/dform-1.c +++ b/gcc/testsuite/gcc.target/powerpc/dform-1.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -mpower9-dform -O2 -mlra" } */ +/* { dg-options "-mcpu=power9 -mpower9-dform -O2" } */ #ifndef TYPE #define TYPE double diff --git a/gcc/testsuite/gcc.target/powerpc/dform-2.c b/gcc/testsuite/gcc.target/powerpc/dform-2.c index 86d65b5b1fd..b4c4199c0b3 100644 --- a/gcc/testsuite/gcc.target/powerpc/dform-2.c +++ b/gcc/testsuite/gcc.target/powerpc/dform-2.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -mpower9-dform -O2 -mlra" } */ +/* { dg-options "-mcpu=power9 -mpower9-dform -O2" } */ #ifndef TYPE #define TYPE float diff --git a/gcc/testsuite/gcc.target/powerpc/dform-3.c b/gcc/testsuite/gcc.target/powerpc/dform-3.c index b1c481fbf6d..c261c4e6f5d 100644 --- a/gcc/testsuite/gcc.target/powerpc/dform-3.c +++ b/gcc/testsuite/gcc.target/powerpc/dform-3.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -mpower9-dform -O2 -mlra" } */ +/* { dg-options "-mcpu=power9 -mpower9-dform -O2" } */ #ifndef TYPE #define TYPE vector double diff --git a/gcc/testsuite/gcc.target/powerpc/fold-vec-missing-lhs.c b/gcc/testsuite/gcc.target/powerpc/fold-vec-missing-lhs.c new file mode 100644 index 00000000000..6add9038288 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/fold-vec-missing-lhs.c @@ -0,0 +1,24 @@ +/* This test is meant to verify that the gimple-folding does not + occur when the LHS portion of an expression is missing. + The intent of this test is to verify that we do not generate an ICE. + This was noticed during debug of PR81317. */ + +/* { dg-do compile } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +vector signed short +test1_nolhs (vector bool short x, vector signed short y) +{ + vec_add (x, y); + return vec_add (x, y); +} + +vector signed short +test2_nolhs (vector signed short x, vector bool short y) +{ + vec_add (x, y); + return vec_add (x, y); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-check.h b/gcc/testsuite/gcc.target/powerpc/mmx-check.h new file mode 100644 index 00000000000..e08077f6d80 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-check.h @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <stdlib.h> + +static void mmx_test (void); + +static void +__attribute__ ((noinline)) +do_test (void) +{ + mmx_test (); +} + +int +main () + { +#ifdef __BUILTIN_CPU_SUPPORTS__ + /* Many MMX intrinsics are simpler / faster to implement by + transferring the __m64 (long int) to vector registers for SIMD + operations. To be efficient we also need the direct register + transfer instructions from POWER8. So we can test for + arch_2_07. */ + if ( __builtin_cpu_supports ("arch_2_07") ) + { + do_test (); +#ifdef DEBUG + printf ("PASSED\n"); +#endif + } +#ifdef DEBUG + else + printf ("SKIPPED\n"); +#endif +#endif /* __BUILTIN_CPU_SUPPORTS__ */ + return 0; + } diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packs.c b/gcc/testsuite/gcc.target/powerpc/mmx-packs.c new file mode 100644 index 00000000000..18faa5a18eb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packs.c @@ -0,0 +1,91 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#include <mmintrin.h> +#include "mmx-check.h" + +#ifndef TEST +#define TEST mmx_test +#endif + +static void +__attribute__ ((noinline)) +check_packs_pu16 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pu16 ((__m64 ) src1, (__m64 ) src2); + + if (res != res_ref) + abort (); +} + +static void +__attribute__ ((noinline)) +check_packs_pi16 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pi16 ((__m64 ) src1, (__m64 ) src2); + + + if (res != res_ref) + abort (); +} + +static void +__attribute__ ((noinline)) +check_packs_pi32 (unsigned long long int src1, unsigned long long int src2, + unsigned long long int res_ref) +{ + unsigned long long int res; + + res = (unsigned long long int) _mm_packs_pi32 ((__m64 ) src1, (__m64 ) src2); + + if (res != res_ref) + abort (); +} + +static unsigned long long int src1[] = + { 0xffff0000fffe0000UL, 0x0001000000020000UL, 0xfffffffffffffffeUL, + 0x0000000100000002UL, 0x0001000200030004UL, 0xfffffffefffdfffcUL, + 0x0100020003000400UL, 0xff00fe01fe02fe03UL }; + +static unsigned long long int src2[] = + { 0xfffffffdfffffffcUL, 0x0000000200000003UL, 0xfffffffdfffffffcUL, + 0x0000000300000004UL, 0x0005000600070008UL, 0xfffbfffafff9fff8UL, + 0x0005000600070008UL, 0xfffbfffafff9fff8UL }; + +static unsigned long long int res_pi16[] = + { 0xfffdfffcff00fe00UL, 0x0002000301000200UL, 0xfffdfffcfffffffeUL, + 0x0003000400010002UL, 0x0506070801020304UL, 0xfbfaf9f8fffefdfcUL, + 0x050607087f7f7f7fUL, 0xfbfaf9f880808080UL }; + +static unsigned long long int res_pi32[] = + { 0xfffdfffc80008000UL, 0x000200037fff7fffUL, 0xfffdfffcfffffffeUL, + 0x0003000400010002UL, 0x7fff7fff7fff7fffUL, 0x80008000fffe8000UL, + 0x7fff7fff7fff7fffUL, 0x8000800080008000UL }; + +static unsigned long long int res_pu16[] = + { 0x0000000000000000UL, 0x0002000301000200UL, 0x0000000000000000UL, + 0x0003000400010002UL, 0x0506070801020304UL, 0x000000000000000UL, + 0x5060708ffffffffUL, 0x0000000000000000UL }; + +static void +TEST () +{ + long i; + + for (i = 0; i < 8; i++) + { + check_packs_pu16 (src1[i], src2[i], res_pu16[i]); + check_packs_pi16 (src1[i], src2[i], res_pi16[i]); + check_packs_pi32 (src1[i], src2[i], res_pi32[i]); + } +} + diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c new file mode 100644 index 00000000000..8698d55f012 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packssdw-1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (2134, -128); + s2.as_m64 = _mm_set_pi32 (41124, 234); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + if (s1.as_int[i] > 32767) + e.as_short[i] = 32767; + else if (s1.as_int[i] < -32768) + e.as_short[i] = -32768; + else + e.as_short[i] = s1.as_int[i]; + } + + for (i = 0; i < 2; i++) + { + if (s2.as_int[i] > 32767) + e.as_short[i+2] = 32767; + else if (s2.as_int[i] < -32768) + e.as_short[i+2] = -32768; + else + e.as_short[i+2] = s2.as_int[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c new file mode 100644 index 00000000000..96bea7b81ab --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packsswb-1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (2134, -128, 1234, 6354); + s2.as_m64 = _mm_set_pi16 (41124, 234, 2344, 2354); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + if (s1.as_short[i] > 127) + e.as_char[i] = 127; + else if (s1.as_short[i] < -128) + e.as_char[i] = -128; + else + e.as_char[i] = s1.as_short[i]; + } + + for (i = 0; i < 4; i++) + { + if (s2.as_short[i] > 127) + e.as_char[i+4] = 127; + else if (s2.as_short[i] < -128) + e.as_char[i+4] = -128; + else + e.as_char[i+4] = s2.as_short[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c new file mode 100644 index 00000000000..029d5687d71 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-packuswb-1.c @@ -0,0 +1,50 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_packs_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union s1, s2; + __m64_union u; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (-9, -10, -11, -12); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i=0; i<4; i++) + { + tmp = s1.as_short[i]<0 ? 0 : s1.as_short[i]; + tmp = tmp>255 ? 255 : tmp; + e.as_char[i] = tmp; + + tmp = s2.as_short[i]<0 ? 0 : s2.as_short[i]; + tmp = tmp>255 ? 255 : tmp; + e.as_char[i+4] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c new file mode 100644 index 00000000000..46b0584549e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = s1.as_char[i] + s2.as_char[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c new file mode 100644 index 00000000000..a006dda0ee4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (30, 90); + s2.as_m64 = _mm_set_pi32 (76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] + s2.as_int[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c new file mode 100644 index 00000000000..5722302095e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddsb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_signed_char[i] + s2.as_signed_char[i]; + + if (tmp > 127) + tmp = 127; + if (tmp < -128) + tmp = -128; + + e.as_signed_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c new file mode 100644 index 00000000000..f7518b4dbae --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddsw-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] + s2.as_short[i]; + + if (tmp > 32767) + tmp = 32767; + if (tmp < -32768) + tmp = -32768; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c new file mode 100644 index 00000000000..a209e3e30dd --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddusb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pu8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (30, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 33, 22, 11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_char[i] + s2.as_char[i]; + + if (tmp > 255) + tmp = -1; + if (tmp < 0) + tmp = 0; + + e.as_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c new file mode 100644 index 00000000000..b46b7f636bb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddusw-1.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_adds_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (1, 2, 3, 4); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = (unsigned short)s1.as_short[i] + (unsigned short)s2.as_short[i]; + + if (tmp > 65535) + tmp = -1; + + if (tmp < 0) + tmp = 0; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c new file mode 100644 index 00000000000..748fe2b5703 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-paddw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_add_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 90); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] + s2.as_short[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c new file mode 100644 index 00000000000..c779b26e691 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 30, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = (s1.as_char[i] == s2.as_char[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c new file mode 100644 index 00000000000..a7807a2fdd9 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (98, 25); + s2.as_m64 = _mm_set_pi32 (98, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_int[i] == s2.as_int[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c new file mode 100644 index 00000000000..e25fd54c6b5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpeqw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpeq_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (20, 30, 90, 80); + s2.as_m64 = _mm_set_pi16 (34, 78, 90, 6); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = (s1.as_short[i] == s2.as_short[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c new file mode 100644 index 00000000000..7f841b0b26e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtb-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 28, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = (s1.as_char[i] > s2.as_char[i]) ? -1 : 0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c new file mode 100644 index 00000000000..9f503b5ec9e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtd-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi32 (99, 25); + s2.as_m64 = _mm_set_pi32 (98, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_int[i] > s2.as_int[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c new file mode 100644 index 00000000000..85716937e0d --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pcmpgtw-1.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_cmpgt_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (20, 30, 90, 80); + s2.as_m64 = _mm_set_pi16 (34, 78, 90, 6); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = (s1.as_short[i] > s2.as_short[i]) ? -1:0; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c new file mode 100644 index 00000000000..220b4f65209 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmaddwd-1.c @@ -0,0 +1,43 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_madd_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (2134, 3334, 1234, 6354); + s2.as_m64 = _mm_set_pi16 (1, 3, 4, 5); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = (s1.as_short[i * 2] * s2.as_short[i * 2]) + + (s1.as_short[(i * 2) + 1] * s2.as_short[(i * 2) + 1]); + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c new file mode 100644 index 00000000000..79b7c7b1838 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmulhw-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_mulhi_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 2067, -3033, 90); + s2.as_m64 = _mm_set_pi16 (11, 9834, 7444, -10222); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] * s2.as_short[i]; + + e.as_short[i] = (tmp & 0xffff0000)>>16; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c new file mode 100644 index 00000000000..6d041691772 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pmullw-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_mullo_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 2067, -3033, 90); + s2.as_m64 = _mm_set_pi16 (11, 9834, 7444, -10222); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] * s2.as_short[i]; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c new file mode 100644 index 00000000000..af687cd1e96 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-pslld-1.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sll_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1, -2); + u.as_m64 = test (s1.as_m64); + + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] << N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c new file mode 100644 index 00000000000..415f6a84176 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psllw-1.c @@ -0,0 +1,45 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sll_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, 2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] << N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c new file mode 100644 index 00000000000..eaaf214292e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrad-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sra_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1000, -20000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c new file mode 100644 index 00000000000..eb7c3aec150 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psraw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_sra_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, -2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c new file mode 100644 index 00000000000..1eb9d2897a7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrld-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_srl_pi32 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (1000, -20000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 2; i++) + e.as_int[i] = (unsigned int)s1.as_int[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c new file mode 100644 index 00000000000..d066159e8eb --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psrlw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#define N 0xb + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1) +{ + return _mm_srl_pi16 (s1, N); +} + +static void +TEST (void) +{ + __m64_union u, s1; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi16 (1, -2, 0x7000, 0x9000); + u.as_m64 = test (s1.as_m64); + + if (N < 16) + for (i = 0; i < 4; i++) + e.as_short[i] = (unsigned short)s1.as_short[i] >> N; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c new file mode 100644 index 00000000000..c64204afa41 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubb-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + e.as_char[i] = s1.as_char[i] - s2.as_char[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c new file mode 100644 index 00000000000..3260f611748 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubd-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_setr_pi32 (30, 90); + s2.as_m64 = _mm_setr_pi32 (76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + e.as_int[i] = s1.as_int[i] - s2.as_int[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c new file mode 100644 index 00000000000..3f0fb2af899 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubsb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (1, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_signed_char[i] - s2.as_signed_char[i]; + + if (tmp > 127) + tmp = 127; + if (tmp < -128) + tmp = -128; + + e.as_signed_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c new file mode 100644 index 00000000000..ae819e19c25 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubsw-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 00); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = s1.as_short[i] - s2.as_short[i]; + + if (tmp > 32767) + tmp = 32767; + if (tmp < -32768) + tmp = -32768; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c new file mode 100644 index 00000000000..bbdc0977109 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubusb-1.c @@ -0,0 +1,51 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pu8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi8 (30, 2, 3, 4, 10, 20, 30, 90); + s2.as_m64 = _mm_set_pi8 (88, 44, 3, 22, 11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 8; i++) + { + tmp = s1.as_char[i] - s2.as_char[i]; + + if (tmp > 255) + tmp = -1; + if (tmp < 0) + tmp = 0; + + e.as_char[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c new file mode 100644 index 00000000000..e26c380daee --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubusw-1.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_subs_pu16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i, tmp; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 40); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, 100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + tmp = (unsigned short)s1.as_short[i] - (unsigned short)s2.as_short[i]; + + if (tmp > 65535) + tmp = -1; + + if (tmp < 0) + tmp = 0; + + e.as_short[i] = tmp; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c b/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c new file mode 100644 index 00000000000..39e4cdea04a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-psubw-2.c @@ -0,0 +1,42 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_sub_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2; + __m64_union e; + int i; + + s1.as_m64 = _mm_set_pi16 (10, 20, 30, 90); + s2.as_m64 = _mm_set_pi16 (11, 98, 76, -100); + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + e.as_short[i] = s1.as_short[i] - s2.as_short[i]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c new file mode 100644 index 00000000000..dba56ca205b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhbw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + e.as_char[2*i] = s1.as_char[4+i]; + e.as_char[2*i + 1] = s2.as_char[4+i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c new file mode 100644 index 00000000000..f2f53c434c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhdq-1.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + e.as_int[0] = s1.as_int[1]; + e.as_int[1] = s2.as_int[1]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c new file mode 100644 index 00000000000..f0264463a81 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckhwd-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpackhi_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + e.as_short[2*i] = s1.as_short[2+i]; + e.as_short[2*i + 1] = s2.as_short[2+i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c new file mode 100644 index 00000000000..36cf241ab19 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklbw-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi8 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 4; i++) + { + e.as_char[2*i] = s1.as_char[i]; + e.as_char[2*i + 1] = s2.as_char[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c new file mode 100644 index 00000000000..8fb0251560a --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpckldq-1.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi32 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + e.as_int[0] = s1.as_int[0]; + e.as_int[1] = s2.as_int[0]; + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c new file mode 100644 index 00000000000..37b6b6ff8c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/mmx-punpcklwd-1.c @@ -0,0 +1,44 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -mpower8-vector" } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-require-effective-target p8vector_hw } */ + +#define NO_WARN_X86_INTRINSICS 1 +#ifndef CHECK_H +#define CHECK_H "mmx-check.h" +#endif + +#ifndef TEST +#define TEST mmx_test +#endif + +#include CHECK_H + +#include <mmintrin.h> + +static __m64 +__attribute__((noinline, unused)) +test (__m64 s1, __m64 s2) +{ + return _mm_unpacklo_pi16 (s1, s2); +} + +static void +TEST (void) +{ + __m64_union u, s1, s2, e; + int i; + + s1.as_m64 = 0x0706050403020100UL; + s2.as_m64 = 0x1716151413121110UL; + u.as_m64 = test (s1.as_m64, s2.as_m64); + + for (i = 0; i < 2; i++) + { + e.as_short[2*i] = s1.as_short[i]; + e.as_short[2*i + 1] = s2.as_short[i]; + } + + if (u.as_m64 != e.as_m64) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-8.c b/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-8.c index 33347740d0c..4b0370bb863 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-8.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-builtin-8.c @@ -11,7 +11,8 @@ vector unsigned char vuca, vucb, vucc; vector bool char vbca, vbcb; vector unsigned short vusa, vusb; vector bool short vbsa, vbsb; -vector unsigned int vuia, vuib; +vector signed int vsia, vsib, vsic; +vector unsigned int vuia, vuib, vuic; vector bool int vbia, vbib; vector signed long long vsla, vslb; vector unsigned long long vula, vulb, vulc; @@ -24,6 +25,7 @@ void foo (vector unsigned char *vucr, vector bool char *vbcr, vector unsigned short *vusr, vector bool short *vbsr, + vector signed int *vsir, vector unsigned int *vuir, vector bool int *vbir, vector unsigned long long *vulr, @@ -32,10 +34,16 @@ void foo (vector unsigned char *vucr, vector unsigned __int128 *vuxr, vector double *vdr) { + *vsir++ = vec_addc (vsia, vsib); + *vuir++ = vec_addc (vuia, vuib); *vsxr++ = vec_addc (vsxa, vsxb); *vuxr++ = vec_addc (vuxa, vuxb); + *vsir++ = vec_adde (vsia, vsib, vsic); + *vuir++ = vec_adde (vuia, vuib, vuic); *vsxr++ = vec_adde (vsxa, vsxb, vsxc); *vuxr++ = vec_adde (vuxa, vuxb, vuxc); + *vsir++ = vec_addec (vsia, vsib, vsic); + *vuir++ = vec_addec (vuia, vuib, vuic); *vsxr++ = vec_addec (vsxa, vsxb, vsxc); *vuxr++ = vec_addec (vuxa, vuxb, vuxc); *vucr++ = vec_bperm (vuca, vucb); @@ -60,11 +68,30 @@ void foo (vector unsigned char *vucr, *vuxr++ = vec_pmsum_be (vula, vulb); *vuir++ = vec_shasigma_be (vuia, 0, 1); *vulr++ = vec_shasigma_be (vula, 0, 1); + *vsir++ = vec_subc (vsia, vsib); + *vuir++ = vec_subc (vuia, vuib); + *vsxr++ = vec_subc (vsxa, vsxb); + *vuxr++ = vec_subc (vuxa, vuxb); + *vsir++ = vec_sube (vsia, vsib, vsic); + *vuir++ = vec_sube (vuia, vuib, vuic); + *vsxr++ = vec_sube (vsxa, vsxb, vsxc); + *vuxr++ = vec_sube (vuxa, vuxb, vuxc); + *vsir++ = vec_subec (vsia, vsib, vsic); + *vuir++ = vec_subec (vuia, vuib, vuic); + *vsxr++ = vec_subec (vsxa, vsxb, vsxc); + *vuxr++ = vec_subec (vuxa, vuxb, vuxc); } /* { dg-final { scan-assembler-times "vaddcuq" 2 } } */ /* { dg-final { scan-assembler-times "vaddeuqm" 2 } } */ /* { dg-final { scan-assembler-times "vaddecuq" 2 } } */ +/* { dg-final { scan-assembler-times "vaddcuw" 6 } } */ +/* { dg-final { scan-assembler-times "vadduwm" 4 } } */ +/* { dg-final { scan-assembler-times "vsubcuq" 2 } } */ +/* { dg-final { scan-assembler-times "vsubeuqm" 2 } } */ +/* { dg-final { scan-assembler-times "vsubecuq" 2 } } */ +/* { dg-final { scan-assembler-times "vsubcuw" 4 } } */ +/* { dg-final { scan-assembler-times "vsubuwm" 4 } } */ /* { dg-final { scan-assembler-times "vbpermq" 2 } } */ /* { dg-final { scan-assembler-times "xxleqv" 4 } } */ /* { dg-final { scan-assembler-times "vgbbd" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c b/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c index 17b73bbc7b3..7b30e4c4e23 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-fp.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf -fno-math-errno" } */ +/* { dg-options "-mcpu=power8 -O2 -fno-math-errno" } */ float abs_sf (float *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c b/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c index 23663b96da6..992ed225d5f 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-int128-1.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O3 -mvsx-timode -mlra" } */ +/* { dg-options "-mcpu=power8 -O3 -mvsx-timode" } */ #include <altivec.h> diff --git a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c index 58e1f4485be..e683d614d62 100644 --- a/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c +++ b/gcc/testsuite/gcc.target/powerpc/p8vector-ldst.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */ +/* { dg-options "-mcpu=power8 -O2" } */ float load_store_sf (unsigned long num, diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c b/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c index c29b69d3e9e..64f0e31fb00 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-dimode1.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power9 -O2" } */ /* Verify P9 changes to allow DImode into Altivec registers, and generate constants using XXSPLTIB. */ @@ -43,8 +43,8 @@ p9_minus_1 (void) return ret; } -/* { dg-final { scan-assembler "\[ \t\]xxspltib" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]mtvsrd" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]lfd" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]ld" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]lxsd" } } */ +/* { dg-final { scan-assembler {\mxxspltib\M} } } */ +/* { dg-final { scan-assembler-not {\mmtvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mlfd\M} } } */ +/* { dg-final { scan-assembler-not {\mld\M} } } */ +/* { dg-final { scan-assembler-not {\mlxsd\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c b/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c index f33d18c6078..9e27936d748 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-dimode2.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power9 -O2" } */ /* Verify that large integer constants are loaded via direct move instead of being loaded from memory. */ @@ -21,7 +21,7 @@ p9_large (void) return ret; } -/* { dg-final { scan-assembler "\[ \t\]mtvsrd" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]ld" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]lfd" } } */ -/* { dg-final { scan-assembler-not "\[ \t\]lxsd" } } */ +/* { dg-final { scan-assembler {\mmtvsrd\M} } } */ +/* { dg-final { scan-assembler-not {\mld\M} } } */ +/* { dg-final { scan-assembler-not {\mlfd\M} } } */ +/* { dg-final { scan-assembler-not {\mlxsd\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-vparity.c b/gcc/testsuite/gcc.target/powerpc/p9-vparity.c index af5b5905a6f..6e49606fe0b 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-vparity.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-vparity.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mlra -mvsx-timode" } */ +/* { dg-options "-mcpu=power9 -O2 -mvsx-timode" } */ #include <altivec.h> diff --git a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c index cd4ba7384de..164f11f6ea3 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-1.c @@ -13,6 +13,12 @@ rev_char (vector char a) return vec_revb (a); /* XXBRQ. */ } +vector bool char +rev_bool_char (vector bool char a) +{ + return vec_revb (a); /* XXBRQ. */ +} + vector signed char rev_schar (vector signed char a) { @@ -31,6 +37,12 @@ rev_short (vector short a) return vec_revb (a); /* XXBRH. */ } +vector bool short +rev_bool_short (vector bool short a) +{ + return vec_revb (a); /* XXBRH. */ +} + vector unsigned short rev_ushort (vector unsigned short a) { @@ -43,6 +55,12 @@ rev_int (vector int a) return vec_revb (a); /* XXBRW. */ } +vector bool int +rev_bool_int (vector bool int a) +{ + return vec_revb (a); /* XXBRW. */ +} + vector unsigned int rev_uint (vector unsigned int a) { @@ -62,6 +80,6 @@ rev_double (vector double a) } /* { dg-final { scan-assembler-times "xxbrd" 1 } } */ -/* { dg-final { scan-assembler-times "xxbrh" 2 } } */ -/* { dg-final { scan-assembler-times "xxbrq" 3 } } */ -/* { dg-final { scan-assembler-times "xxbrw" 3 } } */ +/* { dg-final { scan-assembler-times "xxbrh" 3 } } */ +/* { dg-final { scan-assembler-times "xxbrq" 4 } } */ +/* { dg-final { scan-assembler-times "xxbrw" 4 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c index 97f6186bf91..a4a19390d7b 100644 --- a/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c +++ b/gcc/testsuite/gcc.target/powerpc/p9-xxbr-2.c @@ -20,6 +20,18 @@ rev_ulong (vector unsigned long a) return vec_revb (a); /* XXBRD. */ } +vector long long +rev_long_long (vector long long a) +{ + return vec_revb (a); /* XXBRD. */ +} + +vector unsigned long long +rev_ulong_ulong (vector unsigned long long a) +{ + return vec_revb (a); /* XXBRD. */ +} + vector __int128_t rev_int128 (vector __int128_t a) { @@ -32,5 +44,5 @@ rev_uint128 (vector __uint128_t a) return vec_revb (a); /* XXBRQ. */ } -/* { dg-final { scan-assembler-times "xxbrd" 2 } } */ +/* { dg-final { scan-assembler-times "xxbrd" 4 } } */ /* { dg-final { scan-assembler-times "xxbrq" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-1.c b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-1.c index 2efa952a239..de508b784c9 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-1.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-1.c @@ -2,15 +2,13 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O2 -mcpu=power7 -ffast-math -mno-upper-regs-df" } */ -/* { dg-final { scan-assembler-times "lfiwax" 2 } } */ -/* { dg-final { scan-assembler-times "lfiwzx" 2 } } */ -/* { dg-final { scan-assembler-times "fcfids " 3 } } */ -/* { dg-final { scan-assembler-times "fcfidus " 1 } } */ -/* { dg-final { scan-assembler-times "fcfid " 3 } } */ -/* { dg-final { scan-assembler-times "fcfidu " 1 } } */ -/* { dg-final { scan-assembler-not "xscvdpsxds" } } */ -/* { dg-final { scan-assembler-not "xscvdpuxds" } } */ +/* { dg-options "-O2 -mcpu=power7 -ffast-math" } */ +/* { dg-final { scan-assembler-times {\mlfiwax\M|\mlxsiwax\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mlfiwzx\M|\mlxsiwzx\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfcfids\M|\mxscvsxdsp\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mfcfidus\M|\mxscvuxdsp\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mfcfid\M|\mxscvsxddp\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mfcfidu\M|\mxscvuxddp\M} 1 } } */ void int_to_float (float *dest, int *src) { diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-10.c b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-10.c index 9e192d13398..cb6dea41b06 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-10.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-10.c @@ -2,8 +2,8 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O2 -mcpu=power7 -ffast-math -mno-upper-regs-df" } */ -/* { dg-final { scan-assembler "friz" } } */ +/* { dg-options "-O2 -mcpu=power7 -ffast-math" } */ +/* { dg-final { scan-assembler {\mfriz\M|\mxsrdpiz\M} } } */ double round_double_llong (double a) { diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-5.c b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-5.c index b59cac3a5bb..6bffa164fcd 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-5.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-5.c @@ -2,13 +2,11 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O3 -mcpu=power7 -ffast-math -mno-upper-regs-df" } */ -/* { dg-final { scan-assembler-times "fctiwz " 2 } } */ -/* { dg-final { scan-assembler-times "fctiwuz " 2 } } */ -/* { dg-final { scan-assembler-times "fctidz " 2 } } */ -/* { dg-final { scan-assembler-times "fctiduz " 2 } } */ -/* { dg-final { scan-assembler-not "xscvdpsxds" } } */ -/* { dg-final { scan-assembler-not "xscvdpuxds" } } */ +/* { dg-options "-O3 -mcpu=power7 -ffast-math" } */ +/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfctidz\M|\mxscvdpsxds\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfctiduz\M|\mxscvdpuxds\M} 2 } } */ void float_to_int (int *dest, float src) { *dest = (int) src; } void double_to_int (int *dest, double src) { *dest = (int) src; } diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-9.c b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-9.c index 372b2334686..d376936a750 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-9.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-fpconv-9.c @@ -2,12 +2,12 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O3 -mcpu=power7 -ffast-math -mno-upper-regs-df" } */ -/* { dg-final { scan-assembler-times "fctidz" 2 } } */ -/* { dg-final { scan-assembler-not "lwz" } } */ -/* { dg-final { scan-assembler-not "stw" } } */ -/* { dg-final { scan-assembler-not "ld " } } */ -/* { dg-final { scan-assembler-not "std" } } */ +/* { dg-options "-O3 -mcpu=power7 -ffast-math" } */ +/* { dg-final { scan-assembler-times {\mfctidz\M|\mxscvdpsxds\M} 2 } } */ +/* { dg-final { scan-assembler-not {\mlwz\M} } } */ +/* { dg-final { scan-assembler-not {\mstw\M} } } */ +/* { dg-final { scan-assembler-not {\mld\M} } } */ +/* { dg-final { scan-assembler-not {\mstd\M} } } */ void float_to_llong (long long *dest, float src) { *dest = (long long) src; } void double_to_llong (long long *dest, double src) { *dest = (long long) src; } diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-round.c b/gcc/testsuite/gcc.target/powerpc/ppc-round.c index 0cfa0da2a72..50ab078f55a 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-round.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-round.c @@ -2,15 +2,15 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O2 -mcpu=power7 -mno-upper-regs-df" } */ -/* { dg-final { scan-assembler-times "stfiwx" 4 } } */ -/* { dg-final { scan-assembler-times "lfiwax" 2 } } */ -/* { dg-final { scan-assembler-times "lfiwzx" 2 } } */ -/* { dg-final { scan-assembler-times "fctiwz " 2 } } */ -/* { dg-final { scan-assembler-times "fctiwuz " 2 } } */ -/* { dg-final { scan-assembler-times "fcfids " 2 } } */ -/* { dg-final { scan-assembler-not "lwz" } } */ -/* { dg-final { scan-assembler-not "stw" } } */ +/* { dg-options "-O2 -mcpu=power7" } */ +/* { dg-final { scan-assembler-times {\mstfiwx\M|\mstxsiwx\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mlfiwax\M|\mlxsiwax\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mlfiwzx\M|\mlxsiwzx\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfctiwz\M|\mxscvdpsxws\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfctiwuz\M|\mxscvdpuxws\M} 2 } } */ +/* { dg-final { scan-assembler-times {\mfcfids\M|\mxscvsxdsp\M} 2 } } */ +/* { dg-final { scan-assembler-not {\mlwz\M} } } */ +/* { dg-final { scan-assembler-not {\mstw\M} } } */ /* Make sure we don't have loads/stores to the GPR unit. */ double diff --git a/gcc/testsuite/gcc.target/powerpc/pr63491.c b/gcc/testsuite/gcc.target/powerpc/pr63491.c index a1518912308..be6a40eb32d 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr63491.c +++ b/gcc/testsuite/gcc.target/powerpc/pr63491.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-options "-O1 -mcpu=power8 -mlra" } */ +/* { dg-options "-O1 -mcpu=power8" } */ typedef __int128_t __attribute__((__vector_size__(16))) vector_128_t; typedef unsigned long long scalar_64_t; diff --git a/gcc/testsuite/gcc.target/powerpc/pr65849-1.c b/gcc/testsuite/gcc.target/powerpc/pr65849-1.c deleted file mode 100644 index 288fdeed2ca..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr65849-1.c +++ /dev/null @@ -1,728 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ -/* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-mcpu=power7 -O2 -mno-upper-regs-df" } */ - -/* Test whether we can enable the -mupper-regs-df with target pragmas. Make - sure double values are allocated to the Altivec registers as well as the - traditional FPR registers. */ - -#ifndef TYPE -#define TYPE double -#endif - -#ifndef MASK_TYPE -#define MASK_TYPE unsigned long long -#endif - -#define MASK_ONE ((MASK_TYPE)1) -#define ZERO ((TYPE) 0.0) - -#pragma GCC target ("upper-regs-df") -TYPE -test_add (const MASK_TYPE *add_mask, const TYPE *add_values, - const MASK_TYPE *sub_mask, const TYPE *sub_values, - const MASK_TYPE *mul_mask, const TYPE *mul_values, - const MASK_TYPE *div_mask, const TYPE *div_values, - const MASK_TYPE *eq0_mask, int *eq0_ptr) -{ - TYPE value; - TYPE value00 = ZERO; - TYPE value01 = ZERO; - TYPE value02 = ZERO; - TYPE value03 = ZERO; - TYPE value04 = ZERO; - TYPE value05 = ZERO; - TYPE value06 = ZERO; - TYPE value07 = ZERO; - TYPE value08 = ZERO; - TYPE value09 = ZERO; - TYPE value10 = ZERO; - TYPE value11 = ZERO; - TYPE value12 = ZERO; - TYPE value13 = ZERO; - TYPE value14 = ZERO; - TYPE value15 = ZERO; - TYPE value16 = ZERO; - TYPE value17 = ZERO; - TYPE value18 = ZERO; - TYPE value19 = ZERO; - TYPE value20 = ZERO; - TYPE value21 = ZERO; - TYPE value22 = ZERO; - TYPE value23 = ZERO; - TYPE value24 = ZERO; - TYPE value25 = ZERO; - TYPE value26 = ZERO; - TYPE value27 = ZERO; - TYPE value28 = ZERO; - TYPE value29 = ZERO; - TYPE value30 = ZERO; - TYPE value31 = ZERO; - TYPE value32 = ZERO; - TYPE value33 = ZERO; - TYPE value34 = ZERO; - TYPE value35 = ZERO; - TYPE value36 = ZERO; - TYPE value37 = ZERO; - TYPE value38 = ZERO; - TYPE value39 = ZERO; - MASK_TYPE mask; - int eq0; - - while ((mask = *add_mask++) != 0) - { - value = *add_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 += value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 += value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 += value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 += value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 += value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 += value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 += value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 += value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 += value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 += value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 += value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 += value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 += value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 += value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 += value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 += value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 += value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 += value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 += value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 += value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 += value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 += value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 += value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 += value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 += value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 += value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 += value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 += value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 += value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 += value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 += value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 += value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 += value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 += value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 += value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 += value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 += value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 += value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 += value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 += value; - } - - while ((mask = *sub_mask++) != 0) - { - value = *sub_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 -= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 -= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 -= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 -= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 -= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 -= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 -= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 -= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 -= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 -= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 -= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 -= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 -= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 -= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 -= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 -= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 -= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 -= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 -= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 -= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 -= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 -= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 -= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 -= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 -= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 -= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 -= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 -= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 -= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 -= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 -= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 -= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 -= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 -= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 -= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 -= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 -= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 -= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 -= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 -= value; - } - - while ((mask = *mul_mask++) != 0) - { - value = *mul_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 *= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 *= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 *= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 *= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 *= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 *= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 *= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 *= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 *= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 *= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 *= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 *= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 *= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 *= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 *= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 *= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 *= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 *= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 *= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 *= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 *= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 *= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 *= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 *= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 *= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 *= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 *= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 *= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 *= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 *= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 *= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 *= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 *= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 *= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 *= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 *= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 *= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 *= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 *= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 *= value; - } - - while ((mask = *div_mask++) != 0) - { - value = *div_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 /= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 /= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 /= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 /= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 /= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 /= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 /= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 /= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 /= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 /= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 /= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 /= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 /= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 /= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 /= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 /= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 /= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 /= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 /= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 /= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 /= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 /= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 /= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 /= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 /= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 /= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 /= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 /= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 /= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 /= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 /= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 /= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 /= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 /= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 /= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 /= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 /= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 /= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 /= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 /= value; - } - - while ((mask = *eq0_mask++) != 0) - { - eq0 = 0; - - if ((mask & (MASK_ONE << 0)) != 0) - eq0 |= (value00 == ZERO); - - if ((mask & (MASK_ONE << 1)) != 0) - eq0 |= (value01 == ZERO); - - if ((mask & (MASK_ONE << 2)) != 0) - eq0 |= (value02 == ZERO); - - if ((mask & (MASK_ONE << 3)) != 0) - eq0 |= (value03 == ZERO); - - if ((mask & (MASK_ONE << 4)) != 0) - eq0 |= (value04 == ZERO); - - if ((mask & (MASK_ONE << 5)) != 0) - eq0 |= (value05 == ZERO); - - if ((mask & (MASK_ONE << 6)) != 0) - eq0 |= (value06 == ZERO); - - if ((mask & (MASK_ONE << 7)) != 0) - eq0 |= (value07 == ZERO); - - if ((mask & (MASK_ONE << 8)) != 0) - eq0 |= (value08 == ZERO); - - if ((mask & (MASK_ONE << 9)) != 0) - eq0 |= (value09 == ZERO); - - if ((mask & (MASK_ONE << 10)) != 0) - eq0 |= (value10 == ZERO); - - if ((mask & (MASK_ONE << 11)) != 0) - eq0 |= (value11 == ZERO); - - if ((mask & (MASK_ONE << 12)) != 0) - eq0 |= (value12 == ZERO); - - if ((mask & (MASK_ONE << 13)) != 0) - eq0 |= (value13 == ZERO); - - if ((mask & (MASK_ONE << 14)) != 0) - eq0 |= (value14 == ZERO); - - if ((mask & (MASK_ONE << 15)) != 0) - eq0 |= (value15 == ZERO); - - if ((mask & (MASK_ONE << 16)) != 0) - eq0 |= (value16 == ZERO); - - if ((mask & (MASK_ONE << 17)) != 0) - eq0 |= (value17 == ZERO); - - if ((mask & (MASK_ONE << 18)) != 0) - eq0 |= (value18 == ZERO); - - if ((mask & (MASK_ONE << 19)) != 0) - eq0 |= (value19 == ZERO); - - if ((mask & (MASK_ONE << 20)) != 0) - eq0 |= (value20 == ZERO); - - if ((mask & (MASK_ONE << 21)) != 0) - eq0 |= (value21 == ZERO); - - if ((mask & (MASK_ONE << 22)) != 0) - eq0 |= (value22 == ZERO); - - if ((mask & (MASK_ONE << 23)) != 0) - eq0 |= (value23 == ZERO); - - if ((mask & (MASK_ONE << 24)) != 0) - eq0 |= (value24 == ZERO); - - if ((mask & (MASK_ONE << 25)) != 0) - eq0 |= (value25 == ZERO); - - if ((mask & (MASK_ONE << 26)) != 0) - eq0 |= (value26 == ZERO); - - if ((mask & (MASK_ONE << 27)) != 0) - eq0 |= (value27 == ZERO); - - if ((mask & (MASK_ONE << 28)) != 0) - eq0 |= (value28 == ZERO); - - if ((mask & (MASK_ONE << 29)) != 0) - eq0 |= (value29 == ZERO); - - if ((mask & (MASK_ONE << 30)) != 0) - eq0 |= (value30 == ZERO); - - if ((mask & (MASK_ONE << 31)) != 0) - eq0 |= (value31 == ZERO); - - if ((mask & (MASK_ONE << 32)) != 0) - eq0 |= (value32 == ZERO); - - if ((mask & (MASK_ONE << 33)) != 0) - eq0 |= (value33 == ZERO); - - if ((mask & (MASK_ONE << 34)) != 0) - eq0 |= (value34 == ZERO); - - if ((mask & (MASK_ONE << 35)) != 0) - eq0 |= (value35 == ZERO); - - if ((mask & (MASK_ONE << 36)) != 0) - eq0 |= (value36 == ZERO); - - if ((mask & (MASK_ONE << 37)) != 0) - eq0 |= (value37 == ZERO); - - if ((mask & (MASK_ONE << 38)) != 0) - eq0 |= (value38 == ZERO); - - if ((mask & (MASK_ONE << 39)) != 0) - eq0 |= (value39 == ZERO); - - *eq0_ptr++ = eq0; - } - - return ( value00 + value01 + value02 + value03 + value04 - + value05 + value06 + value07 + value08 + value09 - + value10 + value11 + value12 + value13 + value14 - + value15 + value16 + value17 + value18 + value19 - + value20 + value21 + value22 + value23 + value24 - + value25 + value26 + value27 + value28 + value29 - + value30 + value31 + value32 + value33 + value34 - + value35 + value36 + value37 + value38 + value39); -} - -/* { dg-final { scan-assembler "fadd" } } */ -/* { dg-final { scan-assembler "fsub" } } */ -/* { dg-final { scan-assembler "fmul" } } */ -/* { dg-final { scan-assembler "fdiv" } } */ -/* { dg-final { scan-assembler "fcmpu" } } */ -/* { dg-final { scan-assembler "xsadddp" } } */ -/* { dg-final { scan-assembler "xssubdp" } } */ -/* { dg-final { scan-assembler "xsmuldp" } } */ -/* { dg-final { scan-assembler "xsdivdp" } } */ -/* { dg-final { scan-assembler "xscmpudp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr65849-2.c b/gcc/testsuite/gcc.target/powerpc/pr65849-2.c deleted file mode 100644 index 0af6a4a51c7..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr65849-2.c +++ /dev/null @@ -1,728 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "" { powerpc*-*-darwin* } } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs-sf" } */ - -/* Test whether we can enable the -mupper-regs-sf with target pragmas. Make - sure float values are allocated to the Altivec registers as well as the - traditional FPR registers. */ - -#ifndef TYPE -#define TYPE float -#endif - -#ifndef MASK_TYPE -#define MASK_TYPE unsigned long long -#endif - -#define MASK_ONE ((MASK_TYPE)1) -#define ZERO ((TYPE) 0.0) - -#pragma GCC target ("upper-regs-sf") -TYPE -test_add (const MASK_TYPE *add_mask, const TYPE *add_values, - const MASK_TYPE *sub_mask, const TYPE *sub_values, - const MASK_TYPE *mul_mask, const TYPE *mul_values, - const MASK_TYPE *div_mask, const TYPE *div_values, - const MASK_TYPE *eq0_mask, int *eq0_ptr) -{ - TYPE value; - TYPE value00 = ZERO; - TYPE value01 = ZERO; - TYPE value02 = ZERO; - TYPE value03 = ZERO; - TYPE value04 = ZERO; - TYPE value05 = ZERO; - TYPE value06 = ZERO; - TYPE value07 = ZERO; - TYPE value08 = ZERO; - TYPE value09 = ZERO; - TYPE value10 = ZERO; - TYPE value11 = ZERO; - TYPE value12 = ZERO; - TYPE value13 = ZERO; - TYPE value14 = ZERO; - TYPE value15 = ZERO; - TYPE value16 = ZERO; - TYPE value17 = ZERO; - TYPE value18 = ZERO; - TYPE value19 = ZERO; - TYPE value20 = ZERO; - TYPE value21 = ZERO; - TYPE value22 = ZERO; - TYPE value23 = ZERO; - TYPE value24 = ZERO; - TYPE value25 = ZERO; - TYPE value26 = ZERO; - TYPE value27 = ZERO; - TYPE value28 = ZERO; - TYPE value29 = ZERO; - TYPE value30 = ZERO; - TYPE value31 = ZERO; - TYPE value32 = ZERO; - TYPE value33 = ZERO; - TYPE value34 = ZERO; - TYPE value35 = ZERO; - TYPE value36 = ZERO; - TYPE value37 = ZERO; - TYPE value38 = ZERO; - TYPE value39 = ZERO; - MASK_TYPE mask; - int eq0; - - while ((mask = *add_mask++) != 0) - { - value = *add_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 += value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 += value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 += value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 += value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 += value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 += value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 += value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 += value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 += value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 += value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 += value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 += value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 += value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 += value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 += value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 += value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 += value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 += value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 += value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 += value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 += value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 += value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 += value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 += value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 += value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 += value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 += value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 += value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 += value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 += value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 += value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 += value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 += value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 += value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 += value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 += value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 += value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 += value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 += value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 += value; - } - - while ((mask = *sub_mask++) != 0) - { - value = *sub_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 -= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 -= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 -= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 -= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 -= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 -= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 -= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 -= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 -= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 -= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 -= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 -= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 -= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 -= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 -= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 -= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 -= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 -= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 -= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 -= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 -= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 -= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 -= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 -= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 -= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 -= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 -= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 -= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 -= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 -= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 -= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 -= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 -= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 -= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 -= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 -= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 -= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 -= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 -= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 -= value; - } - - while ((mask = *mul_mask++) != 0) - { - value = *mul_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 *= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 *= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 *= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 *= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 *= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 *= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 *= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 *= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 *= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 *= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 *= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 *= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 *= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 *= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 *= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 *= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 *= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 *= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 *= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 *= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 *= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 *= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 *= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 *= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 *= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 *= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 *= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 *= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 *= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 *= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 *= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 *= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 *= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 *= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 *= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 *= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 *= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 *= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 *= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 *= value; - } - - while ((mask = *div_mask++) != 0) - { - value = *div_values++; - - __asm__ (" #reg %0" : "+d" (value)); - - if ((mask & (MASK_ONE << 0)) != 0) - value00 /= value; - - if ((mask & (MASK_ONE << 1)) != 0) - value01 /= value; - - if ((mask & (MASK_ONE << 2)) != 0) - value02 /= value; - - if ((mask & (MASK_ONE << 3)) != 0) - value03 /= value; - - if ((mask & (MASK_ONE << 4)) != 0) - value04 /= value; - - if ((mask & (MASK_ONE << 5)) != 0) - value05 /= value; - - if ((mask & (MASK_ONE << 6)) != 0) - value06 /= value; - - if ((mask & (MASK_ONE << 7)) != 0) - value07 /= value; - - if ((mask & (MASK_ONE << 8)) != 0) - value08 /= value; - - if ((mask & (MASK_ONE << 9)) != 0) - value09 /= value; - - if ((mask & (MASK_ONE << 10)) != 0) - value10 /= value; - - if ((mask & (MASK_ONE << 11)) != 0) - value11 /= value; - - if ((mask & (MASK_ONE << 12)) != 0) - value12 /= value; - - if ((mask & (MASK_ONE << 13)) != 0) - value13 /= value; - - if ((mask & (MASK_ONE << 14)) != 0) - value14 /= value; - - if ((mask & (MASK_ONE << 15)) != 0) - value15 /= value; - - if ((mask & (MASK_ONE << 16)) != 0) - value16 /= value; - - if ((mask & (MASK_ONE << 17)) != 0) - value17 /= value; - - if ((mask & (MASK_ONE << 18)) != 0) - value18 /= value; - - if ((mask & (MASK_ONE << 19)) != 0) - value19 /= value; - - if ((mask & (MASK_ONE << 20)) != 0) - value20 /= value; - - if ((mask & (MASK_ONE << 21)) != 0) - value21 /= value; - - if ((mask & (MASK_ONE << 22)) != 0) - value22 /= value; - - if ((mask & (MASK_ONE << 23)) != 0) - value23 /= value; - - if ((mask & (MASK_ONE << 24)) != 0) - value24 /= value; - - if ((mask & (MASK_ONE << 25)) != 0) - value25 /= value; - - if ((mask & (MASK_ONE << 26)) != 0) - value26 /= value; - - if ((mask & (MASK_ONE << 27)) != 0) - value27 /= value; - - if ((mask & (MASK_ONE << 28)) != 0) - value28 /= value; - - if ((mask & (MASK_ONE << 29)) != 0) - value29 /= value; - - if ((mask & (MASK_ONE << 30)) != 0) - value30 /= value; - - if ((mask & (MASK_ONE << 31)) != 0) - value31 /= value; - - if ((mask & (MASK_ONE << 32)) != 0) - value32 /= value; - - if ((mask & (MASK_ONE << 33)) != 0) - value33 /= value; - - if ((mask & (MASK_ONE << 34)) != 0) - value34 /= value; - - if ((mask & (MASK_ONE << 35)) != 0) - value35 /= value; - - if ((mask & (MASK_ONE << 36)) != 0) - value36 /= value; - - if ((mask & (MASK_ONE << 37)) != 0) - value37 /= value; - - if ((mask & (MASK_ONE << 38)) != 0) - value38 /= value; - - if ((mask & (MASK_ONE << 39)) != 0) - value39 /= value; - } - - while ((mask = *eq0_mask++) != 0) - { - eq0 = 0; - - if ((mask & (MASK_ONE << 0)) != 0) - eq0 |= (value00 == ZERO); - - if ((mask & (MASK_ONE << 1)) != 0) - eq0 |= (value01 == ZERO); - - if ((mask & (MASK_ONE << 2)) != 0) - eq0 |= (value02 == ZERO); - - if ((mask & (MASK_ONE << 3)) != 0) - eq0 |= (value03 == ZERO); - - if ((mask & (MASK_ONE << 4)) != 0) - eq0 |= (value04 == ZERO); - - if ((mask & (MASK_ONE << 5)) != 0) - eq0 |= (value05 == ZERO); - - if ((mask & (MASK_ONE << 6)) != 0) - eq0 |= (value06 == ZERO); - - if ((mask & (MASK_ONE << 7)) != 0) - eq0 |= (value07 == ZERO); - - if ((mask & (MASK_ONE << 8)) != 0) - eq0 |= (value08 == ZERO); - - if ((mask & (MASK_ONE << 9)) != 0) - eq0 |= (value09 == ZERO); - - if ((mask & (MASK_ONE << 10)) != 0) - eq0 |= (value10 == ZERO); - - if ((mask & (MASK_ONE << 11)) != 0) - eq0 |= (value11 == ZERO); - - if ((mask & (MASK_ONE << 12)) != 0) - eq0 |= (value12 == ZERO); - - if ((mask & (MASK_ONE << 13)) != 0) - eq0 |= (value13 == ZERO); - - if ((mask & (MASK_ONE << 14)) != 0) - eq0 |= (value14 == ZERO); - - if ((mask & (MASK_ONE << 15)) != 0) - eq0 |= (value15 == ZERO); - - if ((mask & (MASK_ONE << 16)) != 0) - eq0 |= (value16 == ZERO); - - if ((mask & (MASK_ONE << 17)) != 0) - eq0 |= (value17 == ZERO); - - if ((mask & (MASK_ONE << 18)) != 0) - eq0 |= (value18 == ZERO); - - if ((mask & (MASK_ONE << 19)) != 0) - eq0 |= (value19 == ZERO); - - if ((mask & (MASK_ONE << 20)) != 0) - eq0 |= (value20 == ZERO); - - if ((mask & (MASK_ONE << 21)) != 0) - eq0 |= (value21 == ZERO); - - if ((mask & (MASK_ONE << 22)) != 0) - eq0 |= (value22 == ZERO); - - if ((mask & (MASK_ONE << 23)) != 0) - eq0 |= (value23 == ZERO); - - if ((mask & (MASK_ONE << 24)) != 0) - eq0 |= (value24 == ZERO); - - if ((mask & (MASK_ONE << 25)) != 0) - eq0 |= (value25 == ZERO); - - if ((mask & (MASK_ONE << 26)) != 0) - eq0 |= (value26 == ZERO); - - if ((mask & (MASK_ONE << 27)) != 0) - eq0 |= (value27 == ZERO); - - if ((mask & (MASK_ONE << 28)) != 0) - eq0 |= (value28 == ZERO); - - if ((mask & (MASK_ONE << 29)) != 0) - eq0 |= (value29 == ZERO); - - if ((mask & (MASK_ONE << 30)) != 0) - eq0 |= (value30 == ZERO); - - if ((mask & (MASK_ONE << 31)) != 0) - eq0 |= (value31 == ZERO); - - if ((mask & (MASK_ONE << 32)) != 0) - eq0 |= (value32 == ZERO); - - if ((mask & (MASK_ONE << 33)) != 0) - eq0 |= (value33 == ZERO); - - if ((mask & (MASK_ONE << 34)) != 0) - eq0 |= (value34 == ZERO); - - if ((mask & (MASK_ONE << 35)) != 0) - eq0 |= (value35 == ZERO); - - if ((mask & (MASK_ONE << 36)) != 0) - eq0 |= (value36 == ZERO); - - if ((mask & (MASK_ONE << 37)) != 0) - eq0 |= (value37 == ZERO); - - if ((mask & (MASK_ONE << 38)) != 0) - eq0 |= (value38 == ZERO); - - if ((mask & (MASK_ONE << 39)) != 0) - eq0 |= (value39 == ZERO); - - *eq0_ptr++ = eq0; - } - - return ( value00 + value01 + value02 + value03 + value04 - + value05 + value06 + value07 + value08 + value09 - + value10 + value11 + value12 + value13 + value14 - + value15 + value16 + value17 + value18 + value19 - + value20 + value21 + value22 + value23 + value24 - + value25 + value26 + value27 + value28 + value29 - + value30 + value31 + value32 + value33 + value34 - + value35 + value36 + value37 + value38 + value39); -} - -/* { dg-final { scan-assembler "fadds" } } */ -/* { dg-final { scan-assembler "fsubs" } } */ -/* { dg-final { scan-assembler "fmuls" } } */ -/* { dg-final { scan-assembler "fdivs" } } */ -/* { dg-final { scan-assembler "fcmpu" } } */ -/* { dg-final { scan-assembler "xsaddsp" } } */ -/* { dg-final { scan-assembler "xssubsp" } } */ -/* { dg-final { scan-assembler "xsmulsp" } } */ -/* { dg-final { scan-assembler "xsdivsp" } } */ -/* { dg-final { scan-assembler "xscmpudp" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr67808.c b/gcc/testsuite/gcc.target/powerpc/pr67808.c index 16b309c151e..3ee8003bebc 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr67808.c +++ b/gcc/testsuite/gcc.target/powerpc/pr67808.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O1 -mvsx -mlra -mcpu=power7 -mlong-double-128" } */ +/* { dg-options "-O1 -mvsx -mcpu=power7 -mlong-double-128" } */ /* PR 67808: LRA ICEs on simple double to long double conversion test case */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr68805.c b/gcc/testsuite/gcc.target/powerpc/pr68805.c index 5510811107d..f4454a9e2d2 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr68805.c +++ b/gcc/testsuite/gcc.target/powerpc/pr68805.c @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc64le-*-* } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-O2 -mvsx-timode -mcpu=power8 -mlra" } */ +/* { dg-options "-O2 -mvsx-timode -mcpu=power8" } */ typedef struct bar { void *a; diff --git a/gcc/testsuite/gcc.target/powerpc/pr69461.c b/gcc/testsuite/gcc.target/powerpc/pr69461.c index 406e7049d29..f693a5f0146 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr69461.c +++ b/gcc/testsuite/gcc.target/powerpc/pr69461.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -mlra" } */ +/* { dg-options "-O3" } */ extern void _setjmp (void); typedef struct { diff --git a/gcc/testsuite/gcc.target/powerpc/pr71656-1.c b/gcc/testsuite/gcc.target/powerpc/pr71656-1.c index fa6b4ffb816..1cb809f8b2a 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71656-1.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71656-1.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-O1 -mcpu=power9 -mpower9-dform-vector -mno-lra" } */ +/* { dg-options "-O1 -mcpu=power9 -mpower9-dform-vector" } */ typedef __attribute__((altivec(vector__))) int type_t; type_t diff --git a/gcc/testsuite/gcc.target/powerpc/pr71656-2.c b/gcc/testsuite/gcc.target/powerpc/pr71656-2.c index 99855fa1667..f953ebe4f9e 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71656-2.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71656-2.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-O3 -mcpu=power9 -mpower9-dform-vector -mno-lra -funroll-loops -fno-aggressive-loop-optimizations" } */ +/* { dg-options "-O3 -mcpu=power9 -mpower9-dform-vector -funroll-loops -fno-aggressive-loop-optimizations" } */ typedef double vec[3]; struct vec_t diff --git a/gcc/testsuite/gcc.target/powerpc/pr71680.c b/gcc/testsuite/gcc.target/powerpc/pr71680.c index fe5260f73d9..cdb7b5143ed 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71680.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71680.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O1 -mlra" } */ +/* { dg-options "-mcpu=power8 -O1" } */ #pragma pack(1) struct diff --git a/gcc/testsuite/gcc.target/powerpc/pr71698.c b/gcc/testsuite/gcc.target/powerpc/pr71698.c index c752f64e1c7..eba47b0951f 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71698.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71698.c @@ -3,7 +3,7 @@ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-require-effective-target dfp } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-O1 -mcpu=power9 -mno-lra" } */ +/* { dg-options "-O1 -mcpu=power9" } */ extern void testvad128 (int n, ...); void diff --git a/gcc/testsuite/gcc.target/powerpc/pr71720.c b/gcc/testsuite/gcc.target/powerpc/pr71720.c index a0c330db931..732daf97595 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr71720.c +++ b/gcc/testsuite/gcc.target/powerpc/pr71720.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power9 -O2" } */ /* Verify that we generate xxspltw <reg>,<reg>,0 for V4SFmode splat. */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr72853.c b/gcc/testsuite/gcc.target/powerpc/pr72853.c index 8a086087088..9dc1bd2344c 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr72853.c +++ b/gcc/testsuite/gcc.target/powerpc/pr72853.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O3 -mupper-regs-df -mupper-regs-sf -funroll-loops" } */ +/* { dg-options "-mcpu=power9 -O3 -funroll-loops" } */ /* derived from 20021120-1.c, compiled for -mcpu=power9. */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr77289.c b/gcc/testsuite/gcc.target/powerpc/pr77289.c index 295aa27acdc..474bdbf0b16 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr77289.c +++ b/gcc/testsuite/gcc.target/powerpc/pr77289.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ -/* { dg-options "-O3 -mcpu=power7 -funroll-loops -ffast-math -mlra -mupdate -fno-auto-inc-dec" } */ +/* { dg-options "-O3 -mcpu=power7 -funroll-loops -ffast-math -mupdate -fno-auto-inc-dec" } */ /* PR 77289: LRA ICEs due to invalid constraint checking. */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr78458.c b/gcc/testsuite/gcc.target/powerpc/pr78458.c index 777ac43bcad..a27876375af 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr78458.c +++ b/gcc/testsuite/gcc.target/powerpc/pr78458.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-mcpu=8548 -mspe -mabi=spe -mlra" } */ +/* { dg-options "-mcpu=8548 -mspe -mabi=spe" } */ /* { dg-skip-if "not an SPE target" { ! powerpc_spe_nocache } } */ extern void bar (void); diff --git a/gcc/testsuite/gcc.target/powerpc/pr78543.c b/gcc/testsuite/gcc.target/powerpc/pr78543.c index 0421344d3ce..13b34e58a0b 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr78543.c +++ b/gcc/testsuite/gcc.target/powerpc/pr78543.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O1 -mno-lra" } */ +/* { dg-options "-mcpu=power8 -O1" } */ typedef long a; enum c { e, f, g, h, i, ab } j(); diff --git a/gcc/testsuite/gcc.target/powerpc/pr78953.c b/gcc/testsuite/gcc.target/powerpc/pr78953.c index 34a3083918d..fd26f073499 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr78953.c +++ b/gcc/testsuite/gcc.target/powerpc/pr78953.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power9 -O2" } */ #include <altivec.h> @@ -16,4 +16,4 @@ foo (vector int *vp, int *ip) ip[4] = vec_extract (v, 0); } -/* { dg-final { scan-assembler "xxextractuw\|vextuw\[lr\]x" } } */ +/* { dg-final { scan-assembler {\mxxextractuw\M|\mvextuw[lr]x\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr79907.c b/gcc/testsuite/gcc.target/powerpc/pr79907.c index c0e669b3264..240a1f46713 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr79907.c +++ b/gcc/testsuite/gcc.target/powerpc/pr79907.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O3 -mno-upper-regs-df" } */ +/* { dg-options "-mcpu=power8 -O3" } */ int foo (short a[], int x) { diff --git a/gcc/testsuite/gcc.target/powerpc/pr80099-1.c b/gcc/testsuite/gcc.target/powerpc/pr80099-1.c deleted file mode 100644 index 9f34c5fbef8..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr80099-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs-sf" } */ - -/* PR target/80099: compiler internal error if -mno-upper-regs-sf used. */ - -int a; -int int_from_mem (vector float *c) -{ - return __builtin_vec_extract (*c, a); -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr80099-2.c b/gcc/testsuite/gcc.target/powerpc/pr80099-2.c deleted file mode 100644 index 5800db63212..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr80099-2.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs-sf" } */ - -/* PR target/80099 was an issue with -mno-upper-regs-sf. Test for all variable - extract types with various -mno-upper-regs-* options. */ - -double -d_extract_arg_n (vector double v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -float -f_extract_arg_n (vector float v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -long -sl_extract_arg_n (vector long v, unsigned long n) -{ - return (long) __builtin_vec_extract (v, n); -} - -unsigned long -ul_extract_arg_n (vector unsigned long v, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (v, n); -} - -long -si_extract_arg_n (vector int v, unsigned long n) -{ - return (int) __builtin_vec_extract (v, n); -} - -unsigned long -ui_extract_arg_n (vector unsigned int v, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (v, n); -} - -long -ss_extract_arg_n (vector short v, unsigned long n) -{ - return (short) __builtin_vec_extract (v, n); -} - -unsigned long -us_extract_arg_n (vector unsigned short v, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (v, n); -} - -long -sc_extract_arg_n (vector signed char v, unsigned long n) -{ - return (signed char) __builtin_vec_extract (v, n); -} - -unsigned long -uc_extract_arg_n (vector unsigned char v, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (v, n); -} - - -double -d_extract_mem_n (vector double *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -float -f_extract_mem_n (vector float *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -long -sl_extract_mem_n (vector long *p, unsigned long n) -{ - return (long) __builtin_vec_extract (*p, n); -} - -unsigned long -ul_extract_mem_n (vector unsigned long *p, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (*p, n); -} - -long -si_extract_mem_n (vector int *p, unsigned long n) -{ - return (int) __builtin_vec_extract (*p, n); -} - -unsigned long -ui_extract_mem_n (vector unsigned int *p, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (*p, n); -} - -long -ss_extract_mem_n (vector short *p, unsigned long n) -{ - return (short) __builtin_vec_extract (*p, n); -} - -unsigned long -us_extract_mem_n (vector unsigned short *p, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (*p, n); -} - -long -sc_extract_mem_n (vector signed char *p, unsigned long n) -{ - return (signed char) __builtin_vec_extract (*p, n); -} - -unsigned long -uc_extract_mem_n (vector unsigned char *p, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (*p, n); -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr80099-3.c b/gcc/testsuite/gcc.target/powerpc/pr80099-3.c deleted file mode 100644 index 71c2b40b0d1..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr80099-3.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs-df" } */ - -/* PR target/80099 was an issue with -mno-upper-regs-sf. Test for all variable - extract types with various -mno-upper-regs-* options. */ - -double -d_extract_arg_n (vector double v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -float -f_extract_arg_n (vector float v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -long -sl_extract_arg_n (vector long v, unsigned long n) -{ - return (long) __builtin_vec_extract (v, n); -} - -unsigned long -ul_extract_arg_n (vector unsigned long v, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (v, n); -} - -long -si_extract_arg_n (vector int v, unsigned long n) -{ - return (int) __builtin_vec_extract (v, n); -} - -unsigned long -ui_extract_arg_n (vector unsigned int v, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (v, n); -} - -long -ss_extract_arg_n (vector short v, unsigned long n) -{ - return (short) __builtin_vec_extract (v, n); -} - -unsigned long -us_extract_arg_n (vector unsigned short v, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (v, n); -} - -long -sc_extract_arg_n (vector signed char v, unsigned long n) -{ - return (signed char) __builtin_vec_extract (v, n); -} - -unsigned long -uc_extract_arg_n (vector unsigned char v, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (v, n); -} - - -double -d_extract_mem_n (vector double *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -float -f_extract_mem_n (vector float *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -long -sl_extract_mem_n (vector long *p, unsigned long n) -{ - return (long) __builtin_vec_extract (*p, n); -} - -unsigned long -ul_extract_mem_n (vector unsigned long *p, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (*p, n); -} - -long -si_extract_mem_n (vector int *p, unsigned long n) -{ - return (int) __builtin_vec_extract (*p, n); -} - -unsigned long -ui_extract_mem_n (vector unsigned int *p, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (*p, n); -} - -long -ss_extract_mem_n (vector short *p, unsigned long n) -{ - return (short) __builtin_vec_extract (*p, n); -} - -unsigned long -us_extract_mem_n (vector unsigned short *p, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (*p, n); -} - -long -sc_extract_mem_n (vector signed char *p, unsigned long n) -{ - return (signed char) __builtin_vec_extract (*p, n); -} - -unsigned long -uc_extract_mem_n (vector unsigned char *p, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (*p, n); -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr80099-4.c b/gcc/testsuite/gcc.target/powerpc/pr80099-4.c deleted file mode 100644 index 145dd1724af..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr80099-4.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs-di" } */ - -/* PR target/80099 was an issue with -mno-upper-regs-sf. Test for all variable - extract types with various -mno-upper-regs-* options. */ - -double -d_extract_arg_n (vector double v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -float -f_extract_arg_n (vector float v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -long -sl_extract_arg_n (vector long v, unsigned long n) -{ - return (long) __builtin_vec_extract (v, n); -} - -unsigned long -ul_extract_arg_n (vector unsigned long v, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (v, n); -} - -long -si_extract_arg_n (vector int v, unsigned long n) -{ - return (int) __builtin_vec_extract (v, n); -} - -unsigned long -ui_extract_arg_n (vector unsigned int v, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (v, n); -} - -long -ss_extract_arg_n (vector short v, unsigned long n) -{ - return (short) __builtin_vec_extract (v, n); -} - -unsigned long -us_extract_arg_n (vector unsigned short v, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (v, n); -} - -long -sc_extract_arg_n (vector signed char v, unsigned long n) -{ - return (signed char) __builtin_vec_extract (v, n); -} - -unsigned long -uc_extract_arg_n (vector unsigned char v, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (v, n); -} - - -double -d_extract_mem_n (vector double *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -float -f_extract_mem_n (vector float *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -long -sl_extract_mem_n (vector long *p, unsigned long n) -{ - return (long) __builtin_vec_extract (*p, n); -} - -unsigned long -ul_extract_mem_n (vector unsigned long *p, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (*p, n); -} - -long -si_extract_mem_n (vector int *p, unsigned long n) -{ - return (int) __builtin_vec_extract (*p, n); -} - -unsigned long -ui_extract_mem_n (vector unsigned int *p, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (*p, n); -} - -long -ss_extract_mem_n (vector short *p, unsigned long n) -{ - return (short) __builtin_vec_extract (*p, n); -} - -unsigned long -us_extract_mem_n (vector unsigned short *p, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (*p, n); -} - -long -sc_extract_mem_n (vector signed char *p, unsigned long n) -{ - return (signed char) __builtin_vec_extract (*p, n); -} - -unsigned long -uc_extract_mem_n (vector unsigned char *p, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (*p, n); -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr80099-5.c b/gcc/testsuite/gcc.target/powerpc/pr80099-5.c deleted file mode 100644 index 9ebc0fe466d..00000000000 --- a/gcc/testsuite/gcc.target/powerpc/pr80099-5.c +++ /dev/null @@ -1,128 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-* && lp64 } } } */ -/* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mno-upper-regs" } */ - -/* PR target/80099 was an issue with -mno-upper-regs-sf. Test for all variable - extract types with various -mno-upper-regs-* options. */ - -double -d_extract_arg_n (vector double v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -float -f_extract_arg_n (vector float v, unsigned long n) -{ - return __builtin_vec_extract (v, n); -} - -long -sl_extract_arg_n (vector long v, unsigned long n) -{ - return (long) __builtin_vec_extract (v, n); -} - -unsigned long -ul_extract_arg_n (vector unsigned long v, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (v, n); -} - -long -si_extract_arg_n (vector int v, unsigned long n) -{ - return (int) __builtin_vec_extract (v, n); -} - -unsigned long -ui_extract_arg_n (vector unsigned int v, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (v, n); -} - -long -ss_extract_arg_n (vector short v, unsigned long n) -{ - return (short) __builtin_vec_extract (v, n); -} - -unsigned long -us_extract_arg_n (vector unsigned short v, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (v, n); -} - -long -sc_extract_arg_n (vector signed char v, unsigned long n) -{ - return (signed char) __builtin_vec_extract (v, n); -} - -unsigned long -uc_extract_arg_n (vector unsigned char v, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (v, n); -} - - -double -d_extract_mem_n (vector double *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -float -f_extract_mem_n (vector float *p, unsigned long n) -{ - return __builtin_vec_extract (*p, n); -} - -long -sl_extract_mem_n (vector long *p, unsigned long n) -{ - return (long) __builtin_vec_extract (*p, n); -} - -unsigned long -ul_extract_mem_n (vector unsigned long *p, unsigned long n) -{ - return (unsigned long) __builtin_vec_extract (*p, n); -} - -long -si_extract_mem_n (vector int *p, unsigned long n) -{ - return (int) __builtin_vec_extract (*p, n); -} - -unsigned long -ui_extract_mem_n (vector unsigned int *p, unsigned long n) -{ - return (unsigned int) __builtin_vec_extract (*p, n); -} - -long -ss_extract_mem_n (vector short *p, unsigned long n) -{ - return (short) __builtin_vec_extract (*p, n); -} - -unsigned long -us_extract_mem_n (vector unsigned short *p, unsigned long n) -{ - return (unsigned short) __builtin_vec_extract (*p, n); -} - -long -sc_extract_mem_n (vector signed char *p, unsigned long n) -{ - return (signed char) __builtin_vec_extract (*p, n); -} - -unsigned long -uc_extract_mem_n (vector unsigned char *p, unsigned long n) -{ - return (unsigned char) __builtin_vec_extract (*p, n); -} diff --git a/gcc/testsuite/gcc.target/powerpc/pr80103-1.c b/gcc/testsuite/gcc.target/powerpc/pr80103-1.c index 35d48c4d8ce..bbec707df20 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr80103-1.c +++ b/gcc/testsuite/gcc.target/powerpc/pr80103-1.c @@ -12,5 +12,5 @@ int a; void b (__attribute__ ((__vector_size__ (16))) char c) { - a = ((__attributes__ ((__vector_size__ (2 * sizeof (long)))) long) c)[0]; + a = ((__attribute__ ((__vector_size__ (2 * sizeof (long)))) long) c)[0]; } diff --git a/gcc/testsuite/gcc.target/powerpc/pr81348.c b/gcc/testsuite/gcc.target/powerpc/pr81348.c new file mode 100644 index 00000000000..e8e10bb598b --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr81348.c @@ -0,0 +1,24 @@ +/* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ +/* { dg-require-effective-target powerpc_p9vector_ok } */ +/* { dg-options "-mcpu=power9 -Og" } */ + +/* PR target/81348: Compiler died in doing short->float conversion due to using + the wrong register in a define_split. */ + +int a; +short b; +float ***c; + +void d(void) +{ + int e = 3; + + if (a) + e = b; + + ***c = e; +} + +/* { dg-final { scan-assembler {\mlxsihzx\M} } } */ +/* { dg-final { scan-assembler {\mvextsh2d\M} } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/upper-regs-df.c b/gcc/testsuite/gcc.target/powerpc/upper-regs-df.c index 17f01bfbfca..0df579797ad 100644 --- a/gcc/testsuite/gcc.target/powerpc/upper-regs-df.c +++ b/gcc/testsuite/gcc.target/powerpc/upper-regs-df.c @@ -2,10 +2,10 @@ /* { dg-require-effective-target powerpc_vsx_ok } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power7 -O2 -mupper-regs-df" } */ +/* { dg-options "-mcpu=power7 -O2" } */ -/* Test for the -mupper-regs-df option to make sure double values are allocated - to the Altivec registers as well as the traditional FPR registers. */ +/* Test to make sure double values are allocated to the Altivec registers as + well as the traditional FPR registers. */ #ifndef TYPE #define TYPE double diff --git a/gcc/testsuite/gcc.target/powerpc/upper-regs-sf.c b/gcc/testsuite/gcc.target/powerpc/upper-regs-sf.c index 8c246796805..fd29fb5fd6e 100644 --- a/gcc/testsuite/gcc.target/powerpc/upper-regs-sf.c +++ b/gcc/testsuite/gcc.target/powerpc/upper-regs-sf.c @@ -2,10 +2,10 @@ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-sf" } */ +/* { dg-options "-mcpu=power8 -O2" } */ -/* Test for the -mupper-regs-df option to make sure double values are allocated - to the Altivec registers as well as the traditional FPR registers. */ +/* Test make sure single precision values are allocated to the Altivec + registers as well as the traditional FPR registers. */ #ifndef TYPE #define TYPE float diff --git a/gcc/testsuite/gcc.target/powerpc/vec-extract-1.c b/gcc/testsuite/gcc.target/powerpc/vec-extract-1.c index 2f9624d4c86..9c8e6f3a684 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-extract-1.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-extract-1.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-df -mupper-regs-di" } */ +/* { dg-options "-mcpu=power8 -O2" } */ #include <altivec.h> diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-3.c b/gcc/testsuite/gcc.target/powerpc/vec-init-3.c index d6d546942da..f4a536a2ea9 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-init-3.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-init-3.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power9 -O2" } */ vector long merge (long a, long b) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-6.c b/gcc/testsuite/gcc.target/powerpc/vec-init-6.c index 14e605ca435..8d610e158cc 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-init-6.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-init-6.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power8 -O2" } */ vector int merge (int a, int b, int c, int d) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-init-7.c b/gcc/testsuite/gcc.target/powerpc/vec-init-7.c index b5e531ea7f1..c44fa9b2a3d 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-init-7.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-init-7.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ -/* { dg-options "-mcpu=power8 -O2 -mupper-regs-di" } */ +/* { dg-options "-mcpu=power8 -O2" } */ vector int splat (int a) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-char.c b/gcc/testsuite/gcc.target/powerpc/vec-set-char.c index 2da79ef9e9d..5df260ded29 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-set-char.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-set-char.c @@ -3,7 +3,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ vector char insert_0_0 (vector char v) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-int.c b/gcc/testsuite/gcc.target/powerpc/vec-set-int.c index dc97ac9d4d3..deaa6acfa6e 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-set-int.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-set-int.c @@ -3,7 +3,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ vector int insert_0_0 (vector int v) diff --git a/gcc/testsuite/gcc.target/powerpc/vec-set-short.c b/gcc/testsuite/gcc.target/powerpc/vec-set-short.c index d82760955fd..eabcf3488de 100644 --- a/gcc/testsuite/gcc.target/powerpc/vec-set-short.c +++ b/gcc/testsuite/gcc.target/powerpc/vec-set-short.c @@ -3,7 +3,7 @@ /* { dg-do compile { target { powerpc64*-*-* && lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ -/* { dg-options "-mcpu=power9 -O2 -mupper-regs-di -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ vector short insert_0_0 (vector short v) diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-himode.c b/gcc/testsuite/gcc.target/powerpc/vsx-himode.c index 8f710e5c5bd..2a4e610de72 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-himode.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-himode.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ double load_asm_d_constraint (short *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-himode2.c b/gcc/testsuite/gcc.target/powerpc/vsx-himode2.c index e6f26a8e014..6ee08cf109a 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-himode2.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-himode2.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ unsigned int foo (unsigned short u) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-himode3.c b/gcc/testsuite/gcc.target/powerpc/vsx-himode3.c index 3c0e66d14ca..972be677dd6 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-himode3.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-himode3.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ double load_asm_v_constraint (short *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-qimode.c b/gcc/testsuite/gcc.target/powerpc/vsx-qimode.c index a252457f314..1c224cb1b61 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-qimode.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-qimode.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ double load_asm_d_constraint (signed char *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-qimode2.c b/gcc/testsuite/gcc.target/powerpc/vsx-qimode2.c index d321970d0ac..478c9da3051 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-qimode2.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-qimode2.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ unsigned int foo (unsigned char u) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-qimode3.c b/gcc/testsuite/gcc.target/powerpc/vsx-qimode3.c index 50142e8d86d..6537d8b80a0 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-qimode3.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-qimode3.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p9vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power9" } } */ -/* { dg-options "-mcpu=power9 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power9 -O2" } */ double load_asm_v_constraint (signed char *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-simode.c b/gcc/testsuite/gcc.target/powerpc/vsx-simode.c index 91d55bb8791..77049008845 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-simode.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-simode.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power8 -O2" } */ double load_asm_d_constraint (int *p) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-simode2.c b/gcc/testsuite/gcc.target/powerpc/vsx-simode2.c index 56793a16222..92053d9ac35 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-simode2.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-simode2.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power8 -O2" } */ unsigned int foo (unsigned int u) { diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-simode3.c b/gcc/testsuite/gcc.target/powerpc/vsx-simode3.c index a35e6db0b79..62f5ab46c04 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-simode3.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-simode3.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_p8vector_ok } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ -/* { dg-options "-mcpu=power8 -O2 -mvsx-small-integer" } */ +/* { dg-options "-mcpu=power8 -O2" } */ double load_asm_v_constraint (int *p) { diff --git a/gcc/testsuite/gcc.target/s390/nodatarel-1.c b/gcc/testsuite/gcc.target/s390/nodatarel-1.c new file mode 100644 index 00000000000..1d589a10947 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/nodatarel-1.c @@ -0,0 +1,83 @@ +/* Test -mno-pic-data-is-text-relative option. No relative addressing + of elements in .data and .bss are allowed with that option. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-optimize-sibling-calls -fpic -mno-pic-data-is-text-relative -march=z10 -mtune=z9-109 -mzarch" } */ + +static int a = 3; + +/* With -mno-pic-data-is-text-relative these must be addressed via + GOT. */ + +int __attribute__((noinline,noclone)) +foo () +{ + return a; +} + +static int __attribute__((noinline,noclone)) +foostatic (void) +{ + return a; +} + +/* Just to make a potentially modified. */ + +void +bar (int b) +{ + a = b; +} + +/* { dg-final { scan-assembler-times "a@GOTENT" 3 } } */ + +/* The exrl target is a label_ref which should not be affected at + all. */ + +void +mymemcpy (char *dst, char *src, long size) +{ + __builtin_memcpy (dst, src, size); +} + +/* { dg-final { scan-assembler "exrl" } } */ + + +/* PLT slots can still be addressed relatively. */ + +int +callfoo () +{ + return foo (); +} + +/* { dg-final { scan-assembler-times "foo@PLT" 1 } } */ + + +/* GOT entries can still be addressed relatively. */ + +void * +fooptr () +{ + return &foo; +} + +/* { dg-final { scan-assembler-times "foo@GOTENT" 1 } } */ + + +/* A static function can be addressed relatively. */ + +int +callfoostatic () +{ + return foostatic (); +} + +void * +foostaticptr () +{ + return &foostatic; +} + + +/* { dg-final { scan-assembler-not "foostatic@" } } */ diff --git a/gcc/testsuite/gcc.target/s390/pr81534.c b/gcc/testsuite/gcc.target/s390/pr81534.c new file mode 100644 index 00000000000..0e1bd99b9cb --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr81534.c @@ -0,0 +1,17 @@ +/* PR81534 This testcase used to fail because the HI/QI + "atomic_fetch_<atomic><mode>" expander accepted symbolic references + and emitted CAS patterns whose insn definition rejected them. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -march=zEC12" } */ + +struct { + short b; + long c; +} a = {}; + +void +d () +{ + __atomic_fetch_add(&a.b, 0, 5); +} diff --git a/gcc/testsuite/gcc.target/sparc/dictunpack.c b/gcc/testsuite/gcc.target/sparc/dictunpack.c new file mode 100644 index 00000000000..4334dee2b2e --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/dictunpack.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-mvis4b" } */ + +typedef unsigned char vec8 __attribute__((vector_size(8))); +typedef short vec16 __attribute__((vector_size(8))); +typedef int vec32 __attribute__((vector_size(8))); + +vec8 test_dictunpack8 (double a) +{ + return __builtin_vis_dictunpack8 (a, 6); +} + +vec16 test_dictunpack16 (double a) +{ + return __builtin_vis_dictunpack16 (a, 14); +} + +vec32 test_dictunpack32 (double a) +{ + return __builtin_vis_dictunpack32 (a, 30); +} + +/* { dg-final { scan-assembler "dictunpack\t%" } } */ +/* { dg-final { scan-assembler "dictunpack\t%" } } */ +/* { dg-final { scan-assembler "dictunpack\t%" } } */ diff --git a/gcc/testsuite/gcc.target/sparc/fpcmpdeshl.c b/gcc/testsuite/gcc.target/sparc/fpcmpdeshl.c new file mode 100644 index 00000000000..3e3daa6e99f --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/fpcmpdeshl.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-mvis4b" } */ + +typedef unsigned char vec8 __attribute__((vector_size(8))); +typedef short vec16 __attribute__((vector_size(8))); +typedef int vec32 __attribute__((vector_size(8))); + +long test_fpcmpde8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpde8shl (a, b, 2); +} + +long test_fpcmpde16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpde16shl (a, b, 2); +} + +long test_fpcmpde32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpde32shl (a, b, 2); +} + +/* { dg-final { scan-assembler "fpcmpde8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpde16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpde32shl\t%" } } */ diff --git a/gcc/testsuite/gcc.target/sparc/fpcmpshl.c b/gcc/testsuite/gcc.target/sparc/fpcmpshl.c new file mode 100644 index 00000000000..0985251cbfd --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/fpcmpshl.c @@ -0,0 +1,81 @@ +/* { dg-do compile } */ +/* { dg-options "-mvis4b" } */ + +typedef unsigned char vec8 __attribute__((vector_size(8))); +typedef short vec16 __attribute__((vector_size(8))); +typedef int vec32 __attribute__((vector_size(8))); + +long test_fpcmple8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmple8shl (a, b, 2); +} + +long test_fpcmpgt8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpgt8shl (a, b, 2); +} + +long test_fpcmpeq8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpeq8shl (a, b, 2); +} + +long test_fpcmpne8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpne8shl (a, b, 2); +} + +long test_fpcmple16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmple16shl (a, b, 2); +} + +long test_fpcmpgt16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpgt16shl (a, b, 2); +} + +long test_fpcmpeq16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpeq16shl (a, b, 2); +} + +long test_fpcmpne16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpne16shl (a, b, 2); +} + +long test_fpcmple32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmple32shl (a, b, 2); +} + +long test_fpcmpgt32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpgt32shl (a, b, 2); +} + +long test_fpcmpeq32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpeq32shl (a, b, 2); +} + +long test_fpcmpne32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpne32shl (a, b, 2); +} + +/* { dg-final { scan-assembler "fpcmple8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpgt8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpeq8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpne8shl\t%" } } */ + +/* { dg-final { scan-assembler "fpcmple16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpgt16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpeq16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpne16shl\t%" } } */ + +/* { dg-final { scan-assembler "fpcmple32shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpgt32shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpeq32shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpne32shl\t%" } } */ diff --git a/gcc/testsuite/gcc.target/sparc/fpcmpurshl.c b/gcc/testsuite/gcc.target/sparc/fpcmpurshl.c new file mode 100644 index 00000000000..db74e01b5f2 --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/fpcmpurshl.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-options "-mvis4b" } */ + +typedef unsigned char vec8 __attribute__((vector_size(8))); +typedef short vec16 __attribute__((vector_size(8))); +typedef int vec32 __attribute__((vector_size(8))); + +long test_fpcmpur8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpur8shl (a, b, 2); +} + +long test_fpcmpur16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpur16shl (a, b, 2); +} + +long test_fpcmpur32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpur32shl (a, b, 2); +} + +/* { dg-final { scan-assembler "fpcmpur8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpur16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpur32shl\t%" } } */ diff --git a/gcc/testsuite/gcc.target/sparc/fpcmpushl.c b/gcc/testsuite/gcc.target/sparc/fpcmpushl.c new file mode 100644 index 00000000000..fc58deddb45 --- /dev/null +++ b/gcc/testsuite/gcc.target/sparc/fpcmpushl.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-mvis4b" } */ + +typedef unsigned char vec8 __attribute__((vector_size(8))); +typedef short vec16 __attribute__((vector_size(8))); +typedef int vec32 __attribute__((vector_size(8))); + +long test_fpcmpule8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpule8shl (a, b, 2); +} + +long test_fpcmpugt8shl (vec8 a, vec8 b) +{ + return __builtin_vis_fpcmpugt8shl (a, b, 2); +} + +long test_fpcmpule16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpule16shl (a, b, 2); +} + +long test_fpcmpugt16shl (vec16 a, vec16 b) +{ + return __builtin_vis_fpcmpugt16shl (a, b, 2); +} + +long test_fpcmpule32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpule32shl (a, b, 2); +} + +long test_fpcmpugt32shl (vec32 a, vec32 b) +{ + return __builtin_vis_fpcmpugt32shl (a, b, 2); +} + +/* { dg-final { scan-assembler "fpcmpule8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpugt8shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpule16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpugt16shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpule32shl\t%" } } */ +/* { dg-final { scan-assembler "fpcmpugt32shl\t%" } } */ diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S index 1395235fd1e..ffe011bcc68 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/do-test.S @@ -23,141 +23,101 @@ a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ -#ifdef __x86_64__ - -# ifdef __ELF__ -# define ELFFN_BEGIN(fn) .type fn,@function -# define ELFFN_END(fn) .size fn,.-fn -# else -# define ELFFN_BEGIN(fn) -# define ELFFN_END(fn) -# endif - -# define FUNC(fn) \ - .global fn; \ - ELFFN_BEGIN(fn); \ -fn: - -#define FUNC_END(fn) ELFFN_END(fn) - -# ifdef __AVX__ -# define MOVAPS vmovaps -# else -# define MOVAPS movaps -# endif - -/* TODO: Is there a cleaner way to provide these offsets? */ - .struct 0 -test_data_save: - - .struct test_data_save + 224 -test_data_input: - - .struct test_data_save + 448 -test_data_output: - - .struct test_data_save + 672 -test_data_fn: - - .struct test_data_save + 680 -test_data_retaddr: +#if defined(__x86_64__) && defined(__SSE2__) + +/* These macros currently support GNU/Linux, Solaris and Darwin. */ + +#ifdef __ELF__ +# define FN_TYPE(fn) .type fn,@function +# define FN_SIZE(fn) .size fn,.-fn +#else +# define FN_TYPE(fn) +# define FN_SIZE(fn) +#endif + +#ifdef __USER_LABEL_PREFIX__ +# define ASMNAME2(prefix, name) prefix ## name +# define ASMNAME1(prefix, name) ASMNAME2(prefix, name) +# define ASMNAME(name) ASMNAME1(__USER_LABEL_PREFIX__, name) +#else +# define ASMNAME(name) name +#endif + +#define FUNC_BEGIN(fn) \ + .globl ASMNAME(fn); \ + FN_TYPE (ASMNAME(fn)); \ +ASMNAME(fn): + +#define FUNC_END(fn) FN_SIZE(ASMNAME(fn)) + +#ifdef __AVX__ +# define MOVAPS vmovaps +#else +# define MOVAPS movaps +#endif .text -regs_to_mem: - MOVAPS %xmm6, (%rax) - MOVAPS %xmm7, 0x10(%rax) - MOVAPS %xmm8, 0x20(%rax) - MOVAPS %xmm9, 0x30(%rax) - MOVAPS %xmm10, 0x40(%rax) - MOVAPS %xmm11, 0x50(%rax) - MOVAPS %xmm12, 0x60(%rax) - MOVAPS %xmm13, 0x70(%rax) - MOVAPS %xmm14, 0x80(%rax) - MOVAPS %xmm15, 0x90(%rax) - mov %rsi, 0xa0(%rax) - mov %rdi, 0xa8(%rax) - mov %rbx, 0xb0(%rax) - mov %rbp, 0xb8(%rax) - mov %r12, 0xc0(%rax) - mov %r13, 0xc8(%rax) - mov %r14, 0xd0(%rax) - mov %r15, 0xd8(%rax) +FUNC_BEGIN(regs_to_mem) + MOVAPS %xmm6, (%r10) + MOVAPS %xmm7, 0x10(%r10) + MOVAPS %xmm8, 0x20(%r10) + MOVAPS %xmm9, 0x30(%r10) + MOVAPS %xmm10, 0x40(%r10) + MOVAPS %xmm11, 0x50(%r10) + MOVAPS %xmm12, 0x60(%r10) + MOVAPS %xmm13, 0x70(%r10) + MOVAPS %xmm14, 0x80(%r10) + MOVAPS %xmm15, 0x90(%r10) + mov %rsi, 0xa0(%r10) + mov %rdi, 0xa8(%r10) + mov %rbx, 0xb0(%r10) + mov %rbp, 0xb8(%r10) + mov %r12, 0xc0(%r10) + mov %r13, 0xc8(%r10) + mov %r14, 0xd0(%r10) + mov %r15, 0xd8(%r10) retq - -mem_to_regs: - MOVAPS (%rax), %xmm6 - MOVAPS 0x10(%rax),%xmm7 - MOVAPS 0x20(%rax),%xmm8 - MOVAPS 0x30(%rax),%xmm9 - MOVAPS 0x40(%rax),%xmm10 - MOVAPS 0x50(%rax),%xmm11 - MOVAPS 0x60(%rax),%xmm12 - MOVAPS 0x70(%rax),%xmm13 - MOVAPS 0x80(%rax),%xmm14 - MOVAPS 0x90(%rax),%xmm15 - mov 0xa0(%rax),%rsi - mov 0xa8(%rax),%rdi - mov 0xb0(%rax),%rbx - mov 0xb8(%rax),%rbp - mov 0xc0(%rax),%r12 - mov 0xc8(%rax),%r13 - mov 0xd0(%rax),%r14 - mov 0xd8(%rax),%r15 +FUNC_END(regs_to_mem) + +FUNC_BEGIN(mem_to_regs) + MOVAPS (%r10), %xmm6 + MOVAPS 0x10(%r10),%xmm7 + MOVAPS 0x20(%r10),%xmm8 + MOVAPS 0x30(%r10),%xmm9 + MOVAPS 0x40(%r10),%xmm10 + MOVAPS 0x50(%r10),%xmm11 + MOVAPS 0x60(%r10),%xmm12 + MOVAPS 0x70(%r10),%xmm13 + MOVAPS 0x80(%r10),%xmm14 + MOVAPS 0x90(%r10),%xmm15 + mov 0xa0(%r10),%rsi + mov 0xa8(%r10),%rdi + mov 0xb0(%r10),%rbx + mov 0xb8(%r10),%rbp + mov 0xc0(%r10),%r12 + mov 0xc8(%r10),%r13 + mov 0xd0(%r10),%r14 + mov 0xd8(%r10),%r15 retq +FUNC_END(mem_to_regs) # NOTE: Not MT safe -FUNC(do_test_unaligned) - .cfi_startproc +FUNC_BEGIN(do_test_unaligned) # The below alignment checks are to verify correctness of the test # its self. # Verify that incoming stack is aligned + 8 - pushf - test $0x8, %rsp - jne L0 + test $0xf, %rsp + je ASMNAME(do_test_body) int $3 # Stack not unaligned +FUNC_END(do_test_unaligned) -FUNC(do_test_aligned) +FUNC_BEGIN(do_test_aligned) # Verify that incoming stack is aligned - pushf - test $0xf, %rsp - je L0 + test $0x8, %rsp + jne ASMNAME(do_test_body) int $3 # Stack not aligned -L0: - popf - - # Save registers - lea test_data(%rip), %rax - call regs_to_mem - - # Load register with random data - lea test_data + test_data_input(%rip), %rax - call mem_to_regs - - # Save original return address - pop %rax - movq %rax, test_data + test_data_retaddr(%rip) - - # Call the test function - call *test_data + test_data_fn(%rip) - - # Restore the original return address - movq test_data + test_data_retaddr(%rip), %rcx - push %rcx - - # Save test function return value and store resulting register values - push %rax - lea test_data + test_data_output(%rip), %rax - call regs_to_mem - - # Restore registers - lea test_data(%rip), %rax - call mem_to_regs - pop %rax - retq - .cfi_endproc FUNC_END(do_test_aligned) -FUNC_END(do_test_unaligned) #endif /* __x86_64__ */ diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c index 2a011f5103d..5fdd1e20674 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.c @@ -46,6 +46,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see is then called. After the function returns, the value of all volatile registers is verified against the random data and then restored. */ +/* { dg-do run } */ +/* { dg-additional-sources "do-test.S" } */ +/* { dg-additional-options "-Wall" } */ + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -58,8 +62,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <errno.h> #include <ctype.h> -#ifndef __x86_64__ -# error Test only valid on x86_64 +#if !defined(__x86_64__) || !defined(__SSE2__) +# error Test only valid on x86_64 with -msse2 #endif enum reg_data_sets @@ -144,6 +148,72 @@ static __attribute__((ms_abi)) long static int arbitrarily_fail; static const char *argv0; + +#define PASTE_STR2(a) #a +#define PASTE_STR1(a, b) PASTE_STR2(a ## b) +#define PASTE_STR(a, b) PASTE_STR1(a, b) + +#ifdef __USER_LABEL_PREFIX__ +# define ASMNAME(name) PASTE_STR(__USER_LABEL_PREFIX__, name) +#else +# define ASMNAME(name) #name +#endif + +#ifdef __MACH__ +# define LOAD_TEST_DATA_ADDR(dest) \ + " mov " ASMNAME(test_data) "@GOTPCREL(%%rip), " dest "\n" +#else +# define LOAD_TEST_DATA_ADDR(dest) \ + " lea " ASMNAME(test_data) "(%%rip), " dest "\n" +#endif + +#define TEST_DATA_OFFSET(f) ((int)__builtin_offsetof(struct test_data, f)) + +void __attribute__((naked)) +do_test_body (void) +{__asm__ ( + " # rax, r10 and r11 are usable here.\n" + "\n" + " # Save registers.\n" + LOAD_TEST_DATA_ADDR("%%rax") + " lea %p0(%%rax), %%r10\n" + " call " ASMNAME(regs_to_mem) "\n" + "\n" + " # Load registers with random data.\n" + " lea %p1(%%rax), %%r10\n" + " call " ASMNAME(mem_to_regs) "\n" + "\n" + " # Pop and save original return address.\n" + " pop %%r10\n" + " mov %%r10, %p4(%%rax)\n" + "\n" + " # Call the test function, after which rcx, rdx and r8-11\n" + " # become usable.\n" + " lea %p3(%%rax), %%rax\n" + " call *(%%rax)\n" + "\n" + " # Store resulting register values.\n" + LOAD_TEST_DATA_ADDR("%%rcx") + " lea %p2(%%rcx), %%r10\n" + " call " ASMNAME(regs_to_mem) "\n" + "\n" + " # Push the original return address.\n" + " lea %p4(%%rcx), %%r10\n" + " push (%%r10)\n" + "\n" + " # Restore registers.\n" + " lea %p0(%%rcx), %%r10\n" + " call " ASMNAME(mem_to_regs) "\n" + "\n" + " retq\n" + :: + "i"(TEST_DATA_OFFSET(regdata[REG_SET_SAVE])), + "i"(TEST_DATA_OFFSET(regdata[REG_SET_INPUT])), + "i"(TEST_DATA_OFFSET(regdata[REG_SET_OUTPUT])), + "i"(TEST_DATA_OFFSET(fn)), + "i"(TEST_DATA_OFFSET(retaddr)) : "memory"); +} + static void __attribute__((noinline)) init_test (void *fn, const char *name, enum alignment_option alignment, enum shrink_wrap_option shrink_wrap, long ret_expected) diff --git a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp index 26777e0b59f..87f81690bc7 100644 --- a/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp +++ b/gcc/testsuite/gcc.target/x86_64/abi/ms-sysv/ms-sysv.exp @@ -56,52 +56,48 @@ proc host_supports_c++11 {} { # Exit immediately if this isn't a native x86_64 target. if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) - || ![is-effective-target lp64] || ![isnative] - || ![host_supports_c++11] } then { - unsupported "$subdir" + || ![is-effective-target lp64] || ![isnative] + || ![host_supports_c++11] } then { + + # Gate "unsupported" message return value of first runtest_file_p call. + if [runtest_file_p $runtests "$srcdir/$subdir/ms-sysv.c"] { + unsupported "$subdir" + } return } -global GCC_RUNTEST_PARALLELIZE_DIR - proc runtest_ms_sysv { cflags generator_args } { global GCC_UNDER_TEST HOSTCXX HOSTCXXFLAGS tmpdir srcdir subdir \ - parallel_dir next_test + TEST_ALWAYS_FLAGS runtests set objdir "$tmpdir/ms-sysv" set generator "$tmpdir/ms-sysv-generate.exe" set generated_header "$objdir/ms-sysv-generated.h" - set do_test_o "$objdir/do-test.o" - set ms_sysv_o "$objdir/ms-sysv.o" - set ms_sysv_exe "$objdir/ms-sysv.exe" set status 0 set warn_flags "-Wall" - set this_test $next_test - incr next_test - - # Do parallelization here - if [catch {set fd [open "$parallel_dir/$this_test" \ - [list RDWR CREAT EXCL]]} ] { - if { [lindex $::errorCode 1] eq "EEXIST" } then { - # Another job is running this test - return - } else { - error "Failed to open $parallel_dir/$this_test: $::errorCode" - set status 1 - } - } else { - close $fd - } # Detect when hard frame pointers are enabled (or required) so we know not # to generate bp clobbers. - if [regexp "^(.+ +| *)-(O0|fno-omit-frame-pointer|p|pg)( +.*)?$" \ - $cflags match] then { + if { [regexp "(^| )-(O0|fno-omit-frame-pointer|p|pg)( |$)" \ + "$TEST_ALWAYS_FLAGS $cflags" match] + || [istarget *-*-solaris*] } then { set generator_args "$generator_args --omit-rbp-clobbers" } - set descr "$subdir CFLAGS=\"$cflags\" generator_args=\"$generator_args\"" - verbose "$tmpdir: Running test $descr" 1 + # Add all other flags + set escaped_generator_args [regsub -all " " $generator_args "\\ "] + set cflags "$cflags\"-DGEN_ARGS=$escaped_generator_args\"" + + gcc_parallel_test_enable 1 + if ![runtest_file_p $runtests "$srcdir/$subdir/ms-sysv.c"] then { + return + } + + #verbose "runtest_ms_sysv $cflags" 0 + + # Make sure there's no previous header file so that we can't accidentally + # pass if generation fails. + file delete -force $generated_header # Cleanup any previous test in objdir file delete -force $objdir @@ -109,18 +105,16 @@ proc runtest_ms_sysv { cflags generator_args } { # Build the generator (only needs to be done once). set src "$srcdir/$subdir/gen.cc" - if { $status == 0 } then { - if { (![file exists "$generator"]) || ([file mtime "$generator"] - < [file mtime "$src"]) } { - # Temporarily switch to the environment for the host compiler. - restore_ld_library_path_env_vars - set cxx "$HOSTCXX $HOSTCXXFLAGS $warn_flags -std=c++11" - set status [remote_exec host "$cxx -o $generator $src"] - set status [lindex $status 0] - set_ld_library_path_env_vars - if { $status != 0 } then { - warning "Could not build $subdir generator" - } + if { (![file exists "$generator"]) || ([file mtime "$generator"] + < [file mtime "$src"]) } { + # Temporarily switch to the environment for the host compiler. + restore_ld_library_path_env_vars + set cxx "$HOSTCXX $HOSTCXXFLAGS $TEST_ALWAYS_FLAGS $warn_flags -std=c++11" + set status [remote_exec host "$cxx -o $generator $src"] + set status [lindex $status 0] + set_ld_library_path_env_vars + if { $status != 0 } then { + warning "Could not build $subdir generator" } } @@ -133,75 +127,26 @@ proc runtest_ms_sysv { cflags generator_args } { } } - set cc "$GCC_UNDER_TEST -I$objdir -I$srcdir/$subdir $cflags $warn_flags" - - # Assemble do-test.S - set src "$srcdir/$subdir/do-test.S" - if { $status == 0 } then { - set status [remote_exec build "$cc -c -o $do_test_o $src"] - set status [lindex $status 0] - if { $status != 0 } then { - warning "Could not assemble $src" - } - } - - # Build ms-sysv.c - set src "$srcdir/$subdir/ms-sysv.c" - if { $status == 0 } then { - set status [remote_exec build "$cc -c -o $ms_sysv_o $src" "" "" "" 1200] - set status [lindex $status 0] - if { $status != 0 } then { - warning "Could not build $src." - } - } - - # Link - if { $status == 0 } then { - set status [remote_exec build "$cc -o $ms_sysv_exe $ms_sysv_o $do_test_o"] - set status [lindex $status 0] - if { $status != 0 } then { - warning "Link failed." - } - } - - # Execute - if { $status == 0 } then { - set status [remote_exec build "$ms_sysv_exe"] - set status [lindex $status 0] - } - - if { $status != 0 } then { - fail $descr - } else { - pass $descr - } + gcc_parallel_test_enable 0 + dg-runtest $srcdir/$subdir/ms-sysv.c "$cflags" "-I$objdir -I$srcdir/$subdir $warn_flags" + gcc_parallel_test_enable 1 } dg-init -# Setup parallelization -set next_test 0 -set parallel_dir "$env(GCC_RUNTEST_PARALLELIZE_DIR)/abi-ms-sysv" -file mkdir "$env(GCC_RUNTEST_PARALLELIZE_DIR)" -file mkdir "$parallel_dir" - -if { ![file isdirectory "$parallel_dir"] } then { - error "Failed to create directory $parallel_dir: $::errorCode" - return -} +# Standard test parameters. +set gen_pcount_opts [list "-p0" "-p1" "-p5"] +set base_cflags_arr [list " -O2 " " -O0 -g3 "] -set gen_opts "-p0-5" -set all_options [list "-O2" "-O0 -g3"] +foreach gen_opts $gen_pcount_opts { + foreach cflags $base_cflags_arr { + # Run without -mcall-ms2sysv-xlogues always + runtest_ms_sysv "$cflags" "$gen_opts" -# Run without -mcall-ms2sysv-xlogues always -foreach opt $all_options { - runtest_ms_sysv "$opt" "$gen_opts" -} - -# Skip -mcall-ms2sysv-xlogues on Windows (not supported) -if { ![istarget *-*-cygwin*] && ![istarget *-*-mingw*] } { - foreach opt $all_options { - runtest_ms_sysv "-mcall-ms2sysv-xlogues $opt" "$gen_opts" + # Skip unsupported -mcall-ms2sysv-xlogues on Windows + if { ![istarget *-*-cygwin*] && ![istarget *-*-mingw*] } { + runtest_ms_sysv "-mcall-ms2sysv-xlogues$cflags" "$gen_opts" + } } } diff --git a/gcc/testsuite/gfortran.dg/array_temporaries_4.f90 b/gcc/testsuite/gfortran.dg/array_temporaries_4.f90 new file mode 100644 index 00000000000..d022ce88557 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/array_temporaries_4.f90 @@ -0,0 +1,59 @@ +! { dg-do compile } +! { dg-options "-Warray-temporaries" } +! Tests the fix for PR80164, in which the compiler segfaulted on this +! when using -Warray-temporaries +! +!****************************************************************************** +module global + type :: a + integer :: b + character(8):: c + end type a + interface assignment(=) + module procedure a_to_a, c_to_a, a_to_c + end interface + interface operator(.ne.) + module procedure a_ne_a + end interface + + type(a) :: x(4), y(4) + logical :: l1(4), t = .true., f= .false. +contains +!****************************************************************************** + elemental subroutine a_to_a (m, n) + type(a), intent(in) :: n + type(a), intent(out) :: m + m%b = len ( trim(n%c)) + m%c = n%c + end subroutine a_to_a + elemental subroutine c_to_a (m, n) + character(8), intent(in) :: n + type(a), intent(out) :: m + m%b = m%b + 1 + m%c = n + end subroutine c_to_a + elemental subroutine a_to_c (m, n) + type(a), intent(in) :: n + character(8), intent(out) :: m + m = n%c + end subroutine a_to_c +!****************************************************************************** + elemental logical function a_ne_a (m, n) + type(a), intent(in) :: n + type(a), intent(in) :: m + a_ne_a = (m%b .ne. n%b) .or. (m%c .ne. n%c) + end function a_ne_a +!****************************************************************************** + elemental function foo (m) + type(a) :: foo + type(a), intent(in) :: m + foo%b = 0 + foo%c = m%c + end function foo +end module global +!****************************************************************************** +program test + use global + x = (/a (0, "one"),a (0, "two"),a (0, "three"),a (0, "four")/) ! { dg-warning "Creating array temporary" } + y = x +end program test diff --git a/gcc/testsuite/gfortran.dg/coarray_44.f90 b/gcc/testsuite/gfortran.dg/coarray_44.f90 new file mode 100644 index 00000000000..15fb8c76ce4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_44.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-fcoarray=single" } +! +! PR fortran/70071 +! Based on testcases by Gerhard Steinmetz + +program pr70071 + implicit none + integer, allocatable :: z(:)[:,:] + allocate (z(2)[1::2,*]) ! { dg-error "Bad array dimension" } + allocate (z(1::2)[2,*]) ! { dg-error "Bad array specification in ALLOCATE" } +end program pr70071 diff --git a/gcc/testsuite/gfortran.dg/coarray_event_2.f08 b/gcc/testsuite/gfortran.dg/coarray_event_2.f08 new file mode 100644 index 00000000000..20a37f332fb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray_event_2.f08 @@ -0,0 +1,13 @@ +! { dg-do compile } +! { dg-options "-fcoarray=lib -lcaf_single" } + +! Check that pr79866 is really fixed. + + use iso_fortran_env + type(event_type) :: x ! { dg-error "of type EVENT_TYPE or with subcomponent of type EVENT_TYPE must be a coarray" } + +contains + subroutine exchange + event post (x[1]) ! { dg-error "Syntax error in EVENT POST statement at .1." } + end subroutine +end diff --git a/gcc/testsuite/gfortran.dg/dim_sum_1.f90 b/gcc/testsuite/gfortran.dg/dim_sum_1.f90 new file mode 100644 index 00000000000..b2fb94312d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dim_sum_1.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! { dg-shouldfail "Dim argument incorrect in SUM intrinsic: is 5, should be between 1 and 2" } + +program summation + + integer, parameter :: n1=5, n2=7 + integer, dimension(1:n1,1:n2) :: arr + integer, dimension(1:n1) :: r2 + integer, dimension(1:n2) :: r1 + integer :: i,j + character(len=80) :: c1, c2 + character(len=50) :: fmt = '(10I5)' + do j=1,n2 + do i=1,n1 + arr(i,j) = i+j*10 + end do + end do + + r1 = sum(arr,dim=1) + write (unit=c2, fmt=fmt) r1 + call print_sum(1,c1) + if (c1 /= c2) call abort + r2 = sum(arr,dim=2) + write (unit=c2, fmt=fmt) r2 + call print_sum(2,c1) + if (c1 /= c2) call abort + call print_sum(5,c1) + +contains + + subroutine print_sum(d, c) + integer, intent(in) :: d + character(len=80), intent(out) :: c + write (unit=c, fmt=fmt) sum(arr,dim=d) + end subroutine + +end diff --git a/gcc/testsuite/gfortran.dg/dim_sum_2.f90 b/gcc/testsuite/gfortran.dg/dim_sum_2.f90 new file mode 100644 index 00000000000..6290444a81d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dim_sum_2.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! { dg-shouldfail "Dim argument incorrect in SUM intrinsic: is 5, should be between 1 and 2" } + +program summation + + integer, parameter :: n1=5, n2=7 + integer, dimension(1:n1,1:n2) :: arr + integer, dimension(1:n1) :: r2 + integer, dimension(1:n2) :: r1 + integer :: i,j + character(len=80) :: c1, c2 + character(len=50) :: fmt = '(10I5)' + do j=1,n2 + do i=1,n1 + arr(i,j) = i+j*10 + end do + end do + + r1 = sum(arr,dim=1,mask=arr>23) + write (unit=c2, fmt=fmt) r1 + call print_sum(1,c1) + if (c1 /= c2) call abort + r2 = sum(arr,dim=2,mask=arr>23) + write (unit=c2, fmt=fmt) r2 + call print_sum(2,c1) + if (c1 /= c2) call abort + call print_sum(5,c1) + +contains + + subroutine print_sum(d, c) + integer, intent(in) :: d + character(len=80), intent(out) :: c + write (unit=c, fmt=fmt) sum(arr,dim=d,mask=arr>23) + end subroutine + +end diff --git a/gcc/testsuite/gfortran.dg/dim_sum_3.f90 b/gcc/testsuite/gfortran.dg/dim_sum_3.f90 new file mode 100644 index 00000000000..2661b3700fd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dim_sum_3.f90 @@ -0,0 +1,37 @@ +! { dg-do run } +! { dg-shouldfail "Dim argument incorrect in SUM intrinsic: is 5, should be between 1 and 2" } + +program summation + + integer, parameter :: n1=5, n2=7 + integer, dimension(1:n1,1:n2) :: arr + integer, dimension(1:n1) :: r2 + integer, dimension(1:n2) :: r1 + integer :: i,j + character(len=80) :: c1, c2 + character(len=50) :: fmt = '(10I5)' + do j=1,n2 + do i=1,n1 + arr(i,j) = i+j*10 + end do + end do + + r1 = sum(arr,dim=1,mask=.true.) + write (unit=c2, fmt=fmt) r1 + call print_sum(1,c1) + if (c1 /= c2) call abort + r2 = sum(arr,dim=2,mask=.true.) + write (unit=c2, fmt=fmt) r2 + call print_sum(2,c1) + if (c1 /= c2) call abort + call print_sum(5,c1) + +contains + + subroutine print_sum(d, c) + integer, intent(in) :: d + character(len=80), intent(out) :: c + write (unit=c, fmt=fmt) sum(arr,dim=d,mask=.true.) + end subroutine + +end diff --git a/gcc/testsuite/gfortran.dg/eoshift_3.f90 b/gcc/testsuite/gfortran.dg/eoshift_3.f90 new file mode 100644 index 00000000000..d1087aa8654 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/eoshift_3.f90 @@ -0,0 +1,178 @@ +! { dg-do run } +! Check that eoshift works for three-dimensional arrays. +module x + implicit none +contains + subroutine eoshift_0 (array, shift, boundary, dim, res) + real, dimension(:,:,:), intent(in) :: array + real, dimension(:,:,:), intent(out) :: res + integer, value :: shift + real, optional, intent(in) :: boundary + integer, optional, intent(in) :: dim + integer :: s1, s2, s3 + integer :: n1, n2, n3 + + real :: b + integer :: d + if (present(boundary)) then + b = boundary + else + b = 0.0 + end if + + if (present(dim)) then + d = dim + else + d = 1 + end if + + n1 = size(array,1) + n2 = size(array,2) + n3 = size(array,3) + + select case(dim) + case(1) + if (shift > 0) then + shift = min(shift, n1) + do s3=1,n3 + do s2=1,n2 + do s1= 1, n1 - shift + res(s1,s2,s3) = array(s1+shift,s2,s3) + end do + do s1 = n1 - shift + 1,n1 + res(s1,s2,s3) = b + end do + end do + end do + + else + shift = max(shift, -n1) + do s3=1,n3 + do s2=1,n2 + do s1=1,-shift + res(s1,s2,s3) = b + end do + do s1= 1-shift,n1 + res(s1,s2,s3) = array(s1+shift,s2,s3) + end do + end do + end do + end if + + case(2) + if (shift > 0) then + shift = min(shift, n2) + do s3=1,n3 + do s2=1, n2 - shift + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2+shift,s3) + end do + end do + do s2=n2 - shift + 1, n2 + do s1=1,n1 + res(s1,s2,s3) = b + end do + end do + end do + else + shift = max(shift, -n2) + do s3=1,n3 + do s2=1,-shift + do s1=1,n1 + res(s1,s2,s3) = b + end do + end do + do s2=1-shift,n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2+shift,s3) + end do + end do + end do + end if + + case(3) + if (shift > 0) then + shift = min(shift, n3) + do s3=1,n3 - shift + do s2=1, n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2,s3+shift) + end do + end do + end do + do s3=n3 - shift + 1, n3 + do s2=1, n2 + do s1=1,n1 + res(s1,s2,s3) = b + end do + end do + end do + else + shift = max(shift, -n3) + do s3=1,-shift + do s2=1,n2 + do s1=1,n1 + res(s1,s2,s3) = b + end do + end do + end do + do s3=1-shift,n3 + do s2=1,n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2,s3+shift) + end do + end do + end do + end if + + case default + stop "Illegal dim" + end select + end subroutine eoshift_0 +end module x + +program main + use x + implicit none + integer, parameter :: n1=2,n2=4,n3=2 + real, dimension(n1,n2,n3) :: a,b,c + integer :: dim, shift, shift_lim + call random_number(a) + + do dim=1,3 + if (dim == 1) then + shift_lim = n1 + 1 + else if (dim == 2) then + shift_lim = n2 + 1 + else + shift_lim = n3 + 1 + end if + do shift=-shift_lim, shift_lim + b = eoshift(a,shift,dim=dim) + call eoshift_0 (a, shift=shift, dim=dim, res=c) + if (any (b /= c)) then + print *,"dim = ", dim, "shift = ", shift + call abort + end if + end do + end do + call random_number(b) + c = b + + do dim=1,3 + if (dim == 1) then + shift_lim = n1/2 + 1 + else if (dim == 2) then + shift_lim = n2/2 + 1 + else + shift_lim = n3/2 + 1 + end if + + do shift=-shift_lim, shift_lim + b(1:n1:2,:,:) = eoshift(a(1:n1/2,:,:),shift,dim=dim) + call eoshift_0 (a(1:n1/2,:,:), shift=shift, dim=dim, res=c(1:n1:2,:,:)) + if (any (b /= c)) call abort + end do + end do + +end program main diff --git a/gcc/testsuite/gfortran.dg/eoshift_4.f90 b/gcc/testsuite/gfortran.dg/eoshift_4.f90 new file mode 100644 index 00000000000..6d1a28a8479 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/eoshift_4.f90 @@ -0,0 +1,187 @@ +! { dg-do run } +! Check that eoshift works for three-dimensional arrays. +module x + implicit none +contains + subroutine eoshift_2 (array, shift, boundary, dim, res) + real, dimension(:,:,:), intent(in) :: array + real, dimension(:,:,:), intent(out) :: res + integer, value :: shift + real, optional, dimension(:,:), intent(in) :: boundary + integer, optional, intent(in) :: dim + integer :: s1, s2, s3 + integer :: n1, n2, n3 + + real :: b + integer :: d + + if (present(dim)) then + d = dim + else + d = 1 + end if + + n1 = size(array,1) + n2 = size(array,2) + n3 = size(array,3) + + select case(dim) + case(1) + if (shift > 0) then + shift = min(shift, n1) + do s3=1,n3 + do s2=1,n2 + b = boundary(s2,s3) + do s1= 1, n1 - shift + res(s1,s2,s3) = array(s1+shift,s2,s3) + end do + do s1 = n1 - shift + 1,n1 + res(s1,s2,s3) = b + end do + end do + end do + + else + shift = max(shift, -n1) + do s3=1,n3 + do s2=1,n2 + b = boundary(s2,s3) + do s1=1,-shift + res(s1,s2,s3) = b + end do + do s1= 1-shift,n1 + res(s1,s2,s3) = array(s1+shift,s2,s3) + end do + end do + end do + end if + + case(2) + if (shift > 0) then + shift = min(shift, n2) + do s3=1,n3 + do s2=1, n2 - shift + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2+shift,s3) + end do + end do + do s2=n2 - shift + 1, n2 + do s1=1,n1 + b = boundary(s1,s3) + res(s1,s2,s3) = b + end do + end do + end do + else + shift = max(shift, -n2) + do s3=1,n3 + do s2=1,-shift + do s1=1,n1 + b = boundary(s1,s3) + res(s1,s2,s3) = b + end do + end do + do s2=1-shift,n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2+shift,s3) + end do + end do + end do + end if + + case(3) + if (shift > 0) then + shift = min(shift, n3) + do s3=1,n3 - shift + do s2=1, n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2,s3+shift) + end do + end do + end do + do s3=n3 - shift + 1, n3 + do s2=1, n2 + do s1=1,n1 + b = boundary(s1,s2) + res(s1,s2,s3) = b + end do + end do + end do + else + shift = max(shift, -n3) + do s3=1,-shift + do s2=1,n2 + do s1=1,n1 + b = boundary(s1,s2) + res(s1,s2,s3) = b + end do + end do + end do + do s3=1-shift,n3 + do s2=1,n2 + do s1=1,n1 + res(s1,s2,s3) = array(s1,s2,s3+shift) + end do + end do + end do + end if + + case default + stop "Illegal dim" + end select + end subroutine eoshift_2 +end module x + +program main + use x + implicit none + integer, parameter :: n1=20,n2=30,n3=40 + real, dimension(n1,n2,n3) :: a,b,c + real, dimension(2*n1,n2,n3) :: a2,c2 + integer :: dim, shift, shift_lim + real, dimension(n2,n3), target :: b1 + real, dimension(n1,n3), target :: b2 + real, dimension(n1,n2), target :: b3 + real, dimension(:,:), pointer :: bp + + call random_number(a) + call random_number (b1) + call random_number (b2) + call random_number (b3) + do dim=1,3 + if (dim == 1) then + shift_lim = n1 + 1 + bp => b1 + else if (dim == 2) then + shift_lim = n2 + 1 + bp => b2 + else + shift_lim = n3 + 1 + bp => b3 + end if + do shift=-shift_lim, shift_lim + b = eoshift(a,shift,dim=dim, boundary=bp) + call eoshift_2 (a, shift=shift, dim=dim, boundary=bp, res=c) + if (any (b /= c)) then + print *,"dim = ", dim, "shift = ", shift + print *,b + print *,c + call abort + end if + a2 = 42. + a2(1:2*n1:2,:,:) = a + b = eoshift(a2(1:2*n1:2,:,:), shift, dim=dim, boundary=bp) + if (any (b /= c)) then + call abort + end if + c2 = 43. + c2(1:2*n1:2,:,:) = eoshift(a,shift,dim=dim, boundary=bp) + if (any(c2(1:2*n1:2,:,:) /= c)) then + call abort + end if + if (any(c2(2:2*n1:2,:,:) /= 43)) then + call abort + end if + end do + end do +end program main diff --git a/gcc/testsuite/gfortran.dg/eoshift_5.f90 b/gcc/testsuite/gfortran.dg/eoshift_5.f90 new file mode 100644 index 00000000000..a8c2494ad76 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/eoshift_5.f90 @@ -0,0 +1,182 @@ +! { dg-do run } +! Check that eoshift works for three-dimensional arrays. +module x + implicit none +contains + subroutine eoshift_1 (array, shift, boundary, dim, res) + real, dimension(:,:,:), intent(in) :: array + real, dimension(:,:,:), intent(out) :: res + integer, dimension(:,:), intent(in) :: shift + real, optional, intent(in) :: boundary + integer, optional, intent(in) :: dim + integer :: s1, s2, s3 + integer :: n1, n2, n3 + integer :: sh + real :: b + integer :: d + + if (present(boundary)) then + b = boundary + else + b = 0.0 + end if + + if (present(dim)) then + d = dim + else + d = 1 + end if + + n1 = size(array,1) + n2 = size(array,2) + n3 = size(array,3) + + select case(dim) + case(1) + do s3=1,n3 + do s2=1,n2 + sh = shift(s2,s3) + if (sh > 0) then + sh = min(sh, n1) + do s1= 1, n1 - sh + res(s1,s2,s3) = array(s1+sh,s2,s3) + end do + do s1 = n1 - sh + 1,n1 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n1) + do s1=1,-sh + res(s1,s2,s3) = b + end do + do s1= 1-sh,n1 + res(s1,s2,s3) = array(s1+sh,s2,s3) + end do + end if + end do + end do + case(2) + do s3=1,n3 + do s1=1,n1 + sh = shift(s1,s3) + if (sh > 0) then + sh = min (sh, n2) + do s2=1, n2 - sh + res(s1,s2,s3) = array(s1,s2+sh,s3) + end do + do s2=n2 - sh + 1, n2 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n2) + do s2=1,-sh + res(s1,s2,s3) = b + end do + do s2=1-sh,n2 + res(s1,s2,s3) = array(s1,s2+sh,s3) + end do + end if + end do + end do + + case(3) + do s2=1, n2 + do s1=1,n1 + sh = shift(s1, s2) + if (sh > 0) then + sh = min(sh, n3) + do s3=1,n3 - sh + res(s1,s2,s3) = array(s1,s2,s3+sh) + end do + do s3=n3 - sh + 1, n3 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n3) + do s3=1,-sh + res(s1,s2,s3) = b + end do + do s3=1-sh,n3 + res(s1,s2,s3) = array(s1,s2,s3+sh) + end do + end if + end do + end do + + case default + stop "Illegal dim" + end select + end subroutine eoshift_1 + subroutine fill_shift(x, n) + integer, intent(out), dimension(:,:) :: x + integer, intent(in) :: n + integer :: n1, n2, s1, s2 + integer :: v + v = -n - 1 + n1 = size(x,1) + n2 = size(x,2) + do s2=1,n2 + do s1=1,n1 + x(s1,s2) = v + v = v + 1 + if (v > n + 1) v = -n - 1 + end do + end do + end subroutine fill_shift +end module x + +program main + use x + implicit none + integer, parameter :: n1=20,n2=30,n3=40 + real, dimension(n1,n2,n3) :: a,b,c + real, dimension(2*n1,n2,n3) :: a2, c2 + integer :: dim + integer, dimension(n2,n3), target :: sh1 + integer, dimension(n1,n3), target :: sh2 + integer, dimension(n1,n2), target :: sh3 + real, dimension(n2,n3), target :: b1 + real, dimension(n1,n3), target :: b2 + real, dimension(n1,n2), target :: b3 + + integer, dimension(:,:), pointer :: sp + real, dimension(:,:), pointer :: bp + + call random_number(a) + call fill_shift(sh1, n1) + call fill_shift(sh2, n2) + call fill_shift(sh3, n3) + + do dim=1,3 + if (dim == 1) then + sp => sh1 + else if (dim == 2) then + sp => sh2 + else + sp => sh3 + end if + b = eoshift(a,shift=sp,dim=dim,boundary=-0.5) + call eoshift_1 (a, shift=sp, dim=dim, boundary=-0.5,res=c) + if (any (b /= c)) then + print *,"dim = ", dim + print *,"sp = ", sp + print '(99F8.4)',b + print '(99F8.4)',c + call abort + end if + a2 = 42. + a2(1:2*n1:2,:,:) = a + b = eoshift(a2(1:2*n1:2,:,:), shift=sp, dim=dim, boundary=-0.5) + if (any(b /= c)) then + call abort + end if + c2 = 43. + c2(1:2*n1:2,:,:) = eoshift(a, shift=sp, dim=dim, boundary=-0.5) + if (any(c2(1:2*n1:2,:,:) /= c)) then + call abort + end if + if (any(c2(2:2*n1:2,:,:) /= 43.)) then + call abort + end if + end do +end program main diff --git a/gcc/testsuite/gfortran.dg/eoshift_6.f90 b/gcc/testsuite/gfortran.dg/eoshift_6.f90 new file mode 100644 index 00000000000..f3f833cc941 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/eoshift_6.f90 @@ -0,0 +1,181 @@ +! { dg-do run } +! Check that eoshift works for three-dimensional arrays. +module x + implicit none +contains + subroutine eoshift_3 (array, shift, boundary, dim, res) + real, dimension(:,:,:), intent(in) :: array + real, dimension(:,:,:), intent(out) :: res + integer, dimension(:,:), intent(in) :: shift + real, optional, dimension(:,:), intent(in) :: boundary + integer, optional, intent(in) :: dim + integer :: s1, s2, s3 + integer :: n1, n2, n3 + integer :: sh + real :: b + integer :: d + + if (present(dim)) then + d = dim + else + d = 1 + end if + + n1 = size(array,1) + n2 = size(array,2) + n3 = size(array,3) + + select case(dim) + case(1) + do s3=1,n3 + do s2=1,n2 + sh = shift(s2,s3) + b = boundary(s2,s3) + if (sh > 0) then + sh = min(sh, n1) + do s1= 1, n1 - sh + res(s1,s2,s3) = array(s1+sh,s2,s3) + end do + do s1 = n1 - sh + 1,n1 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n1) + do s1=1,-sh + res(s1,s2,s3) = b + end do + do s1= 1-sh,n1 + res(s1,s2,s3) = array(s1+sh,s2,s3) + end do + end if + end do + end do + case(2) + do s3=1,n3 + do s1=1,n1 + sh = shift(s1,s3) + b = boundary(s1,s3) + if (sh > 0) then + sh = min (sh, n2) + do s2=1, n2 - sh + res(s1,s2,s3) = array(s1,s2+sh,s3) + end do + do s2=n2 - sh + 1, n2 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n2) + do s2=1,-sh + res(s1,s2,s3) = b + end do + do s2=1-sh,n2 + res(s1,s2,s3) = array(s1,s2+sh,s3) + end do + end if + end do + end do + + case(3) + do s2=1, n2 + do s1=1,n1 + sh = shift(s1, s2) + b = boundary(s1, s2) + if (sh > 0) then + sh = min(sh, n3) + do s3=1,n3 - sh + res(s1,s2,s3) = array(s1,s2,s3+sh) + end do + do s3=n3 - sh + 1, n3 + res(s1,s2,s3) = b + end do + else + sh = max(sh, -n3) + do s3=1,-sh + res(s1,s2,s3) = b + end do + do s3=1-sh,n3 + res(s1,s2,s3) = array(s1,s2,s3+sh) + end do + end if + end do + end do + + case default + stop "Illegal dim" + end select + end subroutine eoshift_3 + subroutine fill_shift(x, n) + integer, intent(out), dimension(:,:) :: x + integer, intent(in) :: n + integer :: n1, n2, s1, s2 + integer :: v + v = -n - 1 + n1 = size(x,1) + n2 = size(x,2) + do s2=1,n2 + do s1=1,n1 + x(s1,s2) = v + v = v + 1 + if (v > n + 1) v = -n - 1 + end do + end do + end subroutine fill_shift +end module x + +program main + use x + implicit none + integer, parameter :: n1=10,n2=30,n3=40 + real, dimension(n1,n2,n3) :: a,b,c + real, dimension(2*n1,n2,n3) :: a2, c2 + integer :: dim + integer, dimension(n2,n3), target :: sh1 + integer, dimension(n1,n3), target :: sh2 + integer, dimension(n1,n2), target :: sh3 + real, dimension(n2,n3), target :: b1 + real, dimension(n1,n3), target :: b2 + real, dimension(n1,n2), target :: b3 + + integer, dimension(:,:), pointer :: sp + real, dimension(:,:), pointer :: bp + + call random_number(a) + call random_number(b1) + call random_number(b2) + call random_number(b3) + call fill_shift(sh1, n1) + call fill_shift(sh2, n2) + call fill_shift(sh3, n3) + + do dim=1,3 + if (dim == 1) then + sp => sh1 + bp => b1 + else if (dim == 2) then + sp => sh2 + bp => b2 + else + sp => sh3 + bp => b3 + end if + b = eoshift(a,shift=sp,dim=dim,boundary=bp) + call eoshift_3 (a, shift=sp, dim=dim, boundary=bp,res=c) + if (any (b /= c)) then + call abort + end if + a2 = 42. + a2(1:2*n1:2,:,:) = a + b = eoshift(a2(1:2*n1:2,:,:), shift=sp, dim=dim, boundary=bp) + if (any(b /= c)) then + call abort + end if + c2 = 43. + c2(1:2*n1:2,:,:) = eoshift(a, shift=sp, dim=dim, boundary=bp) + if (any(c2(1:2*n1:2,:,:) /= c)) then + call abort + end if + if (any(c2(2:2*n1:2,:,:) /= 43.)) then + call abort + end if + end do +end program main diff --git a/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 b/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 new file mode 100644 index 00000000000..3819cf70c04 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/pr77765.f90 @@ -0,0 +1,19 @@ +! Test the presence of an ACC ROUTINE directive inside a function +! containg an error. + +! { dg-do compile } + +module m +contains + recursive function f(x) + end function f + recursive function f(x) + !$acc routine (f) + end function f +end module m + +! { dg-error "Procedure 'f' at .1. is already defined" "" { target *-*-* } 8 } +! { dg-error "Duplicate RECURSIVE attribute specified" "" { target *-*-* } 8 } +! { dg-error ".1." "" { target *-*-* } 10 } +! { dg-error "Unexpected ..ACC ROUTINE" "" { target *-*-* } 11 } +! { dg-error "Expecting END MODULE statement" "" { target *-*-* } 12 } diff --git a/gcc/testsuite/gfortran.dg/namelist_3.f90 b/gcc/testsuite/gfortran.dg/namelist_3.f90 index f37946d53c9..3f20ea400c4 100644 --- a/gcc/testsuite/gfortran.dg/namelist_3.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_3.f90 @@ -4,5 +4,5 @@ program namelist_3 integer,pointer :: x allocate (x) - namelist /n/ x ! { dg-error "NAMELIST attribute with POINTER attribute" } + namelist /n/ x ! { dg-error "NAMELIST attribute conflicts with POINTER attribute" } end program namelist_3 diff --git a/gcc/testsuite/gfortran.dg/pointer_intent_2.f90 b/gcc/testsuite/gfortran.dg/pointer_intent_2.f90 index 692570339a3..02f91b80495 100644 --- a/gcc/testsuite/gfortran.dg/pointer_intent_2.f90 +++ b/gcc/testsuite/gfortran.dg/pointer_intent_2.f90 @@ -14,6 +14,6 @@ program test call a(p) ! { dg-error "Type mismatch in argument" } contains subroutine a(p)! { dg-error "has no IMPLICIT type" } - integer, pointer,intent(in) :: p ! { dg-error "POINTER attribute with INTENT attribute" } + integer, pointer,intent(in) :: p ! { dg-error "POINTER attribute conflicts with INTENT attribute" } end subroutine end program diff --git a/gcc/testsuite/gfortran.dg/pr81175.f b/gcc/testsuite/gfortran.dg/pr81175.f new file mode 100644 index 00000000000..130ba9c1632 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81175.f @@ -0,0 +1,23 @@ +! { dg-do compile } +! { dg-options "-Ofast -fwrapv" } +! { dg-additional-options "-march=broadwell" { target x86_64-*-* i?86-*-* } } + SUBROUTINE ECPDRA(IC4C,FP,FQ,G) + IMPLICIT DOUBLE PRECISION (A-H,O-Z) + DIMENSION FP(*),FQ(*),G(*) + DIMENSION CKLU(23,12,12) +! + DO 240 I=IAMIN,IAMAX + DO 240 J=JAMIN,MMAX + DO 230 K=1,NPNP + DO 230 L=1,K + DO 230 MU=1,2*L-1 + CKLTEM= CKLU(MU,L,K) + IF(IC4C.LE.0) THEN + IF(ABS(CKLTEM).GT.TOL) SUM= SUM+FP(N)*CKLTEM + ELSE + IF(ABS(CKLTEM).GT.TOL) SUM= SUM+FQ(N)*CKLTEM + END IF + 230 N= N+1 + G(NN)= G(NN)+DUMJ*SUM + 240 NN= NN+1 + END diff --git a/gcc/testsuite/gfortran.dg/pr81464.f90 b/gcc/testsuite/gfortran.dg/pr81464.f90 new file mode 100644 index 00000000000..425cae9470c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81464.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-options "--param parloops-chunk-size=2 -ftree-parallelize-loops=2 -O1" } + +program main + implicit none + real, dimension(:,:),allocatable :: a, b, c + real :: sm + + allocate (a(2,2), b(2,2), c(2,2)) + + call random_number(a) + call random_number(b) + + c = matmul(a,b) + sm = sum(c) + + deallocate(a,b,c) + +end program main diff --git a/gcc/testsuite/gfortran.dg/pr81529.f90 b/gcc/testsuite/gfortran.dg/pr81529.f90 new file mode 100644 index 00000000000..92e3d48e727 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81529.f90 @@ -0,0 +1,32 @@ +! { dg-do compile } +! { dg-options "-std=gnu -fno-tree-scev-cprop -Ofast" } + +subroutine CalcCgr(C,rmax,ordgr_max) + integer, intent(in) :: rmax,ordgr_max + double complex :: Zadj(2,2), Zadj2(2,2) + double complex, intent(out) :: C(0:rmax,0:rmax,0:rmax) + double complex, allocatable :: Cexpgr(:,:,:,:) + double complex :: Caux + integer :: rmaxB,rmaxExp,r,n0,n1,n2,k,l,i,j,m,n,nn + + rmaxB = 2*rmax + rmaxExp = rmaxB + allocate(Cexpgr(0:rmaxExp/2,0:rmaxExp,0:rmaxExp,0:ordgr_max)) + + rloop: do r=0,rmaxExp/2 + do n0=r,1,-1 + do nn=r-n0,0,-1 + do i=1,2 + Caux = Caux - Zadj(i,l) + end do + Cexpgr(n0,0,0,0) = Caux/(2*(nn+1)) + end do + end do + do n1=0,r + n2 = r-n1 + if (r.le.rmax) then + C(0,n1,n2) = Cexpgr(0,n1,n2,0) + end if + end do + end do rloop +end subroutine CalcCgr diff --git a/gcc/testsuite/gfortran.dg/realloc_on_assign_28.f90 b/gcc/testsuite/gfortran.dg/realloc_on_assign_28.f90 new file mode 100644 index 00000000000..2e338e470fd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/realloc_on_assign_28.f90 @@ -0,0 +1,40 @@ +! { dg-do run } +! +! PR fortran/66102 +! +! Contributed by Vladimir Fuka <vladimir.fuka@gmail.com> +! + type t + integer,allocatable :: i + end type + + type(t) :: e + type(t), allocatable, dimension(:) :: a, b + integer :: chksum = 0 + + do i=1,3 ! Was 100 in original + e%i = i + chksum = chksum + i + if (.not.allocated(a)) then + a = [e] + b = first_arg([e], [e]) + else + call foo + end if + end do + + if (sum ([(a(i)%i, i=1,size(a))]) .ne. chksum) call abort + if (any([(a(i)%i, i=1,size(a))] /= [(i, i=1,size(a))])) call abort + if (size(a) /= size(b)) call abort + if (any([(b(i)%i, i=1,size(b))] /= [(i, i=1,size(b))])) call abort +contains + subroutine foo + b = first_arg([b, e], [a, e]) + a = [a, e] + end subroutine + elemental function first_arg(arg1, arg2) + type(t), intent(in) :: arg1, arg2 + type(t) :: first_arg + first_arg = arg1 + end function first_arg +end diff --git a/gcc/testsuite/gfortran.dg/vect/pr60510.f b/gcc/testsuite/gfortran.dg/vect/pr60510.f new file mode 100644 index 00000000000..5e2c085d761 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr60510.f @@ -0,0 +1,30 @@ +! { dg-do run } +! { dg-require-effective-target vect_double } +! { dg-additional-options "-fno-inline -ffast-math" } + subroutine foo(a,x,y,n) + implicit none + integer n,i + + real*8 y(n),x(n),a + + do i=1,n + a=a+x(i)*y(i)+x(i) + enddo + + return + end + + program test + real*8 x(1024),y(1024),a + do i=1,1024 + x(i) = i + y(i) = i+1 + enddo + call foo(a,x,y,1024) + if (a.ne.359488000.0) call abort() + end +! If there's no longer a reduction chain detected this doesn't test what +! it was supposed to test, vectorizing a reduction chain w/o SLP. +! { dg-final { scan-tree-dump "reduction chain" "vect" } } +! We should vectorize the reduction in foo and the induction in test. +! { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } diff --git a/gcc/testsuite/gfortran.dg/vect/pr61171.f b/gcc/testsuite/gfortran.dg/vect/pr61171.f new file mode 100644 index 00000000000..f94b8f31283 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/pr61171.f @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options "-Ofast" } + SUBROUTINE GAUBON(NV,PTS,PP) + IMPLICIT DOUBLE PRECISION(A-H,O-Z) + PARAMETER (MXSP=250) + DIMENSION PTS(3,10),PP(3) + COMMON /PCMPLY/ XE(MXSP),YE(MXSP),ZE(MXSP) + DATA PI/3.141592653589793D+00/ + DATA ZERO/0.0D+00/ + DO I = 1, NV + PP(1) = PP(1) + (PTS(1,I)-XE(NS)) + PP(2) = PP(2) + (PTS(2,I)-YE(NS)) + PP(3) = PP(3) + (PTS(3,I)-ZE(NS)) + ENDDO + END diff --git a/gcc/testsuite/gnat.dg/opt49.adb b/gcc/testsuite/gnat.dg/opt49.adb index 4b91973a19d..42ab953a2e0 100644 --- a/gcc/testsuite/gnat.dg/opt49.adb +++ b/gcc/testsuite/gnat.dg/opt49.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-O -fstack-check" } procedure Opt49 is diff --git a/gcc/testsuite/gnat.dg/opt65.adb b/gcc/testsuite/gnat.dg/opt65.adb new file mode 100644 index 00000000000..7b429b6b1a3 --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt65.adb @@ -0,0 +1,30 @@ +-- { dg-do run } +-- { dg-options "-O2" } + +with Ada.Command_Line; use Ada.Command_Line; + +procedure Opt65 is + + procedure Check_Version_And_Help (Version_String : String) is + Help_Switch_Present : Boolean := False; + Next_Arg : Natural := 1; + begin + while Next_Arg <= Argument_Count loop + declare + Next_Argv : constant String := Argument (Next_Arg); + begin + if Next_Argv = "--help" then + Help_Switch_Present := True; + end if; + Next_Arg := Next_Arg + 1; + end; + end loop; + + if Help_Switch_Present then + raise Program_Error; + end if; + end; + +begin + Check_Version_And_Help ("version"); +end; diff --git a/gcc/testsuite/gnat.dg/opt66.adb b/gcc/testsuite/gnat.dg/opt66.adb new file mode 100644 index 00000000000..94a1790737c --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt66.adb @@ -0,0 +1,13 @@ +-- { dg-do compile } +-- { dg-options "-O" } + +procedure Opt66 (I : Integer) is + E : exception; +begin + if I = 0 then + raise E; + end if; + Opt66 (I - I / abs (I)); +exception + when others => null; +end; diff --git a/gcc/testsuite/gnat.dg/stack_check1.adb b/gcc/testsuite/gnat.dg/stack_check1.adb index 51ee1a633b3..eaad745bdf6 100644 --- a/gcc/testsuite/gnat.dg/stack_check1.adb +++ b/gcc/testsuite/gnat.dg/stack_check1.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-fstack-check" } -- This test requires architecture- and OS-specific support code for unwinding diff --git a/gcc/testsuite/gnat.dg/stack_check2.adb b/gcc/testsuite/gnat.dg/stack_check2.adb index 4a3008ba02b..f34d647c862 100644 --- a/gcc/testsuite/gnat.dg/stack_check2.adb +++ b/gcc/testsuite/gnat.dg/stack_check2.adb @@ -1,4 +1,5 @@ -- { dg-do run } +-- { dg-require-stack-check "" } -- { dg-options "-fstack-check" } -- This test requires architecture- and OS-specific support code for unwinding diff --git a/gcc/testsuite/gnat.dg/stack_check3.adb b/gcc/testsuite/gnat.dg/stack_check3.adb index 734ed422733..3bb859c82f8 100644 --- a/gcc/testsuite/gnat.dg/stack_check3.adb +++ b/gcc/testsuite/gnat.dg/stack_check3.adb @@ -1,4 +1,5 @@ -- { dg-do compile } +-- { dg-require-stack-check "" } -- { dg-options "-O -fstack-check" } package body Stack_Check3 is diff --git a/gcc/testsuite/gnat.dg/vect15.adb b/gcc/testsuite/gnat.dg/vect15.adb index ad66836a401..b19a2240409 100644 --- a/gcc/testsuite/gnat.dg/vect15.adb +++ b/gcc/testsuite/gnat.dg/vect15.adb @@ -5,8 +5,9 @@ package body Vect15 is procedure Add (X, Y : Sarray; R : out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); + R(1) := X(5) + Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); end loop; end; diff --git a/gcc/testsuite/gnat.dg/vect15.ads b/gcc/testsuite/gnat.dg/vect15.ads index 91375127deb..5c813246087 100644 --- a/gcc/testsuite/gnat.dg/vect15.ads +++ b/gcc/testsuite/gnat.dg/vect15.ads @@ -1,6 +1,6 @@ package Vect15 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add (X, Y : Sarray; R : out Sarray); diff --git a/gcc/testsuite/gnat.dg/vect16.adb b/gcc/testsuite/gnat.dg/vect16.adb index 99fe32081de..9ef5e32449c 100644 --- a/gcc/testsuite/gnat.dg/vect16.adb +++ b/gcc/testsuite/gnat.dg/vect16.adb @@ -5,9 +5,11 @@ package body Vect16 is procedure Add_Sub (X, Y : Sarray; R,S : out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); - S(I) := X(I) - Y(I); + R(1) := X(5) + Y(5); + S(1) := X(5) - Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); + S(I + 1) := X(I) - Y(I); end loop; end; diff --git a/gcc/testsuite/gnat.dg/vect16.ads b/gcc/testsuite/gnat.dg/vect16.ads index 0192dccb13e..882bf2a740c 100644 --- a/gcc/testsuite/gnat.dg/vect16.ads +++ b/gcc/testsuite/gnat.dg/vect16.ads @@ -1,6 +1,6 @@ package Vect16 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add_Sub (X, Y : Sarray; R,S : out Sarray); diff --git a/gcc/testsuite/gnat.dg/vect17.adb b/gcc/testsuite/gnat.dg/vect17.adb index f574ea22157..76b6fc7de5a 100644 --- a/gcc/testsuite/gnat.dg/vect17.adb +++ b/gcc/testsuite/gnat.dg/vect17.adb @@ -5,8 +5,9 @@ package body Vect17 is procedure Add (X, Y : aliased Sarray; R : aliased out Sarray) is begin - for I in Sarray'Range loop - R(I) := X(I) + Y(I); + R(1) := X(5) + Y(5); + for I in 1 .. 4 loop + R(I + 1) := X(I) + Y(I); end loop; end; diff --git a/gcc/testsuite/gnat.dg/vect17.ads b/gcc/testsuite/gnat.dg/vect17.ads index 5c26157924e..3a6ab660f89 100644 --- a/gcc/testsuite/gnat.dg/vect17.ads +++ b/gcc/testsuite/gnat.dg/vect17.ads @@ -1,6 +1,6 @@ package Vect17 is - type Sarray is array (1 .. 4) of Long_Float; + type Sarray is array (1 .. 5) of Long_Float; for Sarray'Alignment use 16; procedure Add (X, Y : aliased Sarray; R : aliased out Sarray); diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index e55557491bc..cb5d1843c92 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -43,6 +43,9 @@ if { [ishost "*-*-cygwin*"] } { setenv LANG C.ASCII } +# Avoid sporadic data-losses with expect +match_max -d 10000 + # Ensure GCC_COLORS is unset, for the rare testcases that verify # how output is colorized. if [info exists ::env(GCC_COLORS) ] { diff --git a/gcc/testsuite/lib/profopt.exp b/gcc/testsuite/lib/profopt.exp index 0ea8e7a048e..93bb23ce93f 100644 --- a/gcc/testsuite/lib/profopt.exp +++ b/gcc/testsuite/lib/profopt.exp @@ -285,7 +285,7 @@ proc auto-profopt-execute { src } { if { ! [check_profiling_available "-fauto-profile"] } { regsub "(?q)$srcdir/" $src "" testcase - unsupported "$src -fauto-profile" + unsupported "$testcase -fauto-profile" return } set profile_wrapper [profopt-perf-wrapper] @@ -451,7 +451,7 @@ proc profopt-execute { src } { verbose "Running $cmd" set id [remote_spawn "" $cmd] if { $id < 0 } { - unsupported "$src -fauto-profile: cannot run create_gcov" + unsupported "$testcase -fauto-profile: cannot run create_gcov" set status "fail" return } diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index 6400d643409..d50d8b07ada 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -265,6 +265,21 @@ proc dg-require-linker-plugin { args } { } } +# If this target does not support the "stack-check" option, skip this +# test. + +proc dg-require-stack-check { args } { + set stack_check_available [ check_stack_check_available [lindex $args 1 ] ] + if { $stack_check_available == -1 } { + upvar name name + unresolved "$name" + } + if { $stack_check_available != 1 } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} + # Add any target-specific flags needed for accessing the given list # of features. This must come after all dg-options. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 502986e71fb..5a6562794b2 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1063,6 +1063,17 @@ proc check_effective_target_fstack_protector {} { } "-fstack-protector"] } +# Return 1 if the target supports -fstack-check or -fstack-check=$stack_kind +proc check_stack_check_available { stack_kind } { + if [string match "" $stack_kind] then { + set stack_opt "-fstack-check" + } else { set stack_opt "-fstack-check=$stack_kind" } + + return [check_no_compiler_messages stack_check_$stack_kind executable { + int main (void) { return 0; } + } "$stack_opt"] +} + # Return 1 if compilation with -freorder-blocks-and-partition is error-free # for trivial code, 0 otherwise. As some targets (ARM for example) only # warn when -fprofile-use is also supplied we test that combination too. @@ -1930,6 +1941,37 @@ proc check_effective_target_powerpc64_no_dm { } { } {-O2}] } +# Return 1 if the target supports the __builtin_cpu_supports built-in, +# including having a new enough library to support the test. Cache the result. +# Require at least a power7 to run on. + +proc check_ppc_cpu_supports_hw_available { } { + return [check_cached_effective_target ppc_cpu_supports_hw_available { + # Some simulators are known to not support VSX/power8 instructions. + # For now, disable on Darwin + if { [istarget powerpc-*-eabi] + || [istarget powerpc*-*-eabispe] + || [istarget *-*-darwin*]} { + expr 0 + } else { + set options "-mvsx" + check_runtime_nocache ppc_cpu_supports_hw_available { + int main() + { + #ifdef __MACH__ + asm volatile ("xxlor vs0,vs0,vs0"); + #else + asm volatile ("xxlor 0,0,0"); + #endif + if (!__builtin_cpu_supports ("vsx")) + return 1; + return 0; + } + } $options + } + }] +} + # Return 1 if the target supports executing power8 vector instructions, 0 # otherwise. Cache the result. @@ -2943,7 +2985,7 @@ proc check_effective_target_vect_int { } { || [istarget alpha*-*-*] || [istarget ia64-*-*] || [istarget aarch64*-*-*] - || [check_effective_target_arm32] + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && ([et-is-effective-target mips_loongson] || [et-is-effective-target mips_msa])) } { @@ -2971,8 +3013,7 @@ proc check_effective_target_vect_intfloat_cvt { } { if { [istarget i?86-*-*] || [istarget x86_64-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { set et_vect_intfloat_cvt_saved($et_index) 1 @@ -3014,8 +3055,7 @@ proc check_effective_target_vect_uintfloat_cvt { } { || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) || [istarget aarch64*-*-*] - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { set et_vect_uintfloat_cvt_saved($et_index) 1 @@ -3043,8 +3083,7 @@ proc check_effective_target_vect_floatint_cvt { } { if { [istarget i?86-*-*] || [istarget x86_64-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { set et_vect_floatint_cvt_saved($et_index) 1 @@ -3070,8 +3109,7 @@ proc check_effective_target_vect_floatuint_cvt { } { set et_vect_floatuint_cvt_saved($et_index) 0 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { set et_vect_floatuint_cvt_saved($et_index) 1 @@ -3398,7 +3436,7 @@ proc add_options_for_arm_v8_1a_neon { flags } { return "$flags" } global et_arm_v8_1a_neon_flags - return "$flags $et_arm_v8_1a_neon_flags -march=armv8.1-a" + return "$flags $et_arm_v8_1a_neon_flags" } # Add the options needed for ARMv8.2 with the scalar FP16 extension. @@ -3461,8 +3499,9 @@ proc check_effective_target_arm_neon_ok_nocache { } { global et_arm_neon_flags set et_arm_neon_flags "" if { [check_effective_target_arm32] } { - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -march=armv7-a"} { + foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -march=armv7-a" "-mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard -march=armv7-a"} { if { [check_no_compiler_messages_nocache arm_neon_ok object { + #include <arm_neon.h> int dummy; #ifndef __ARM_NEON__ #error not NEON @@ -3487,6 +3526,38 @@ proc check_effective_target_arm_neon_ok { } { check_effective_target_arm_neon_ok_nocache] } +# Return 1 if this is an ARM target supporting -mfpu=neon without any +# -mfloat-abi= option. Useful in tests where add_options is not +# supported (such as lto tests). + +proc check_effective_target_arm_neon_ok_no_float_abi_nocache { } { + if { [check_effective_target_arm32] } { + foreach flags {"-mfpu=neon"} { + if { [check_no_compiler_messages_nocache arm_neon_ok_no_float_abi object { + #include <arm_neon.h> + int dummy; + #ifndef __ARM_NEON__ + #error not NEON + #endif + /* Avoid the case where a test adds -mfpu=neon, but the toolchain is + configured for -mcpu=arm926ej-s, for example. */ + #if __ARM_ARCH < 7 || __ARM_ARCH_PROFILE == 'M' + #error Architecture does not support NEON. + #endif + } "$flags"] } { + return 1 + } + } + } + + return 0 +} + +proc check_effective_target_arm_neon_ok_no_float_abi { } { + return [check_cached_effective_target arm_neon_ok_no_float_abi \ + check_effective_target_arm_neon_ok_no_float_abi_nocache] +} + proc check_effective_target_arm_crc_ok_nocache { } { global et_arm_crc_flags set et_arm_crc_flags "-march=armv8-a+crc" @@ -3830,7 +3901,8 @@ foreach { armfunc armflag armdefs } { v8_2a "-march=armv8.2a" __ARM_ARCH_8A__ v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft" __ARM_ARCH_8M_BASE__ - v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } { + v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ + v8r "-march=armv8-r" __ARM_ARCH_8R__ } { eval [string map [list FUNC $armfunc FLAG $armflag DEFS $armdefs ] { proc check_effective_target_arm_arch_FUNC_ok { } { if { [ string match "*-marm*" "FLAG" ] && @@ -4055,13 +4127,15 @@ proc check_effective_target_arm_v8_1a_neon_ok_nocache { } { # since AArch64 only needs the -march setting. foreach flags {"" "-mfpu=neon-fp-armv8" "-mfloat-abi=softfp" \ "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} { - if { [check_no_compiler_messages_nocache arm_v8_1a_neon_ok object { - #if !defined (__ARM_FEATURE_QRDMX) - #error "__ARM_FEATURE_QRDMX not defined" - #endif - } "$flags -march=armv8.1-a"] } { - set et_arm_v8_1a_neon_flags "$flags -march=armv8.1-a" - return 1 + foreach arches { "-march=armv8-a+rdma" "-march=armv8.1-a" } { + if { [check_no_compiler_messages_nocache arm_v8_1a_neon_ok object { + #if !defined (__ARM_FEATURE_QRDMX) + #error "__ARM_FEATURE_QRDMX not defined" + #endif + } "$flags $arches"] } { + set et_arm_v8_1a_neon_flags "$flags $arches" + return 1 + } } } @@ -4914,7 +4988,7 @@ proc check_effective_target_vect_shift { } { || [istarget ia64-*-*] || [istarget i?86-*-*] || [istarget x86_64-*-*] || [istarget aarch64*-*-*] - || [check_effective_target_arm32] + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && ([et-is-effective-target mips_msa] || [et-is-effective-target mips_loongson])) } { @@ -4932,7 +5006,7 @@ proc check_effective_target_whole_vector_shift { } { || [istarget ia64-*-*] || [istarget aarch64*-*-*] || [istarget powerpc64*-*-*] - || ([check_effective_target_arm32] + || ([is-effective-target arm_neon] && [check_effective_target_arm_little_endian]) || ([istarget mips*-*-*] && [et-is-effective-target mips_loongson]) } { @@ -4956,8 +5030,7 @@ proc check_effective_target_vect_bswap { } { } else { set et_vect_bswap_saved($et_index) 0 if { [istarget aarch64*-*-*] - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon]) + || [is-effective-target arm_neon] } { set et_vect_bswap_saved($et_index) 1 } @@ -4980,7 +5053,7 @@ proc check_effective_target_vect_shift_char { } { set et_vect_shift_char_saved($et_index) 0 if { ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || [check_effective_target_arm32] + || [is-effective-target arm_neon] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) } { set et_vect_shift_char_saved($et_index) 1 @@ -4998,10 +5071,10 @@ proc check_effective_target_vect_shift_char { } { proc check_effective_target_vect_long { } { if { [istarget i?86-*-*] || [istarget x86_64-*-*] - || (([istarget powerpc*-*-*] - && ![istarget powerpc-*-linux*paired*]) + || (([istarget powerpc*-*-*] + && ![istarget powerpc-*-linux*paired*]) && [check_effective_target_ilp32]) - || [check_effective_target_arm32] + || [is-effective-target arm_neon] || ([istarget sparc*-*-*] && [check_effective_target_ilp32]) || [istarget aarch64*-*-*] || ([istarget mips*-*-*] @@ -5036,7 +5109,7 @@ proc check_effective_target_vect_float { } { || [istarget aarch64*-*-*] || ([istarget mips*-*-*] && [et-is-effective-target mips_msa]) - || [check_effective_target_arm32] } { + || [is-effective-target arm_neon] } { set et_vect_float_saved($et_index) 1 } } @@ -5185,7 +5258,7 @@ proc check_effective_target_vect_perm { } { verbose "check_effective_target_vect_perm: using cached result" 2 } else { set et_vect_perm_saved($et_index) 0 - if { [is-effective-target arm_neon_ok] + if { [is-effective-target arm_neon] || [istarget aarch64*-*-*] || [istarget powerpc*-*-*] || [istarget spu-*-*] @@ -5214,7 +5287,7 @@ proc check_effective_target_vect_perm_byte { } { verbose "check_effective_target_vect_perm_byte: using cached result" 2 } else { set et_vect_perm_byte_saved($et_index) 0 - if { ([is-effective-target arm_neon_ok] + if { ([is-effective-target arm_neon] && [is-effective-target arm_little_endian]) || ([istarget aarch64*-*-*] && [is-effective-target aarch64_little_endian]) @@ -5243,7 +5316,7 @@ proc check_effective_target_vect_perm_short { } { verbose "check_effective_target_vect_perm_short: using cached result" 2 } else { set et_vect_perm_short_saved($et_index) 0 - if { ([is-effective-target arm_neon_ok] + if { ([is-effective-target arm_neon] && [is-effective-target arm_little_endian]) || ([istarget aarch64*-*-*] && [is-effective-target aarch64_little_endian]) @@ -5275,8 +5348,7 @@ proc check_effective_target_vect_widen_sum_hi_to_si_pattern { } { set et_vect_widen_sum_hi_to_si_pattern_saved($et_index) 0 if { [istarget powerpc*-*-*] || [istarget aarch64*-*-*] - || ([istarget arm*-*-*] && - [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || [istarget ia64-*-*] } { set et_vect_widen_sum_hi_to_si_pattern_saved($et_index) 1 } @@ -5330,7 +5402,7 @@ proc check_effective_target_vect_widen_sum_qi_to_hi { } { } else { set et_vect_widen_sum_qi_to_hi_saved($et_index) 0 if { [check_effective_target_vect_unpack] - || [check_effective_target_arm_neon_ok] + || [is-effective-target arm_neon] || [istarget ia64-*-*] } { set et_vect_widen_sum_qi_to_hi_saved($et_index) 1 } @@ -5388,7 +5460,7 @@ proc check_effective_target_vect_widen_mult_qi_to_hi { } { } if { [istarget powerpc*-*-*] || [istarget aarch64*-*-*] - || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } { + || [is-effective-target arm_neon] } { set et_vect_widen_mult_qi_to_hi_saved($et_index) 1 } } @@ -5425,8 +5497,7 @@ proc check_effective_target_vect_widen_mult_hi_to_si { } { || [istarget ia64-*-*] || [istarget aarch64*-*-*] || [istarget i?86-*-*] || [istarget x86_64-*-*] - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok]) } { + || [is-effective-target arm_neon] } { set et_vect_widen_mult_hi_to_si_saved($et_index) 1 } } @@ -5450,8 +5521,7 @@ proc check_effective_target_vect_widen_mult_qi_to_hi_pattern { } { } else { set et_vect_widen_mult_qi_to_hi_pattern_saved($et_index) 0 if { [istarget powerpc*-*-*] - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok] + || ([is-effective-target arm_neon] && [check_effective_target_arm_little_endian]) } { set et_vect_widen_mult_qi_to_hi_pattern_saved($et_index) 1 } @@ -5479,8 +5549,7 @@ proc check_effective_target_vect_widen_mult_hi_to_si_pattern { } { || [istarget spu-*-*] || [istarget ia64-*-*] || [istarget i?86-*-*] || [istarget x86_64-*-*] - || ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok] + || ([is-effective-target arm_neon] && [check_effective_target_arm_little_endian]) } { set et_vect_widen_mult_hi_to_si_pattern_saved($et_index) 1 } @@ -5527,7 +5596,7 @@ proc check_effective_target_vect_widen_shift { } { verbose "check_effective_target_vect_widen_shift: using cached result" 2 } else { set et_vect_widen_shift_saved($et_index) 0 - if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } { + if { [is-effective-target arm_neon] } { set et_vect_widen_shift_saved($et_index) 1 } } @@ -6081,7 +6150,7 @@ proc check_effective_target_vect_extract_even_odd { } { set et_vect_extract_even_odd_saved($et_index) 0 if { [istarget aarch64*-*-*] || [istarget powerpc*-*-*] - || [is-effective-target arm_neon_ok] + || [is-effective-target arm_neon] || [istarget i?86-*-*] || [istarget x86_64-*-*] || [istarget ia64-*-*] || [istarget spu-*-*] @@ -6109,7 +6178,7 @@ proc check_effective_target_vect_interleave { } { set et_vect_interleave_saved($et_index) 0 if { [istarget aarch64*-*-*] || [istarget powerpc*-*-*] - || [is-effective-target arm_neon_ok] + || [is-effective-target arm_neon] || [istarget i?86-*-*] || [istarget x86_64-*-*] || [istarget ia64-*-*] || [istarget spu-*-*] @@ -6163,7 +6232,7 @@ proc check_effective_target_vect_multiple_sizes { } { set et_vect_multiple_sizes_saved($et_index) 0 if { [istarget aarch64*-*-*] - || ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) + || [is-effective-target arm_neon] || (([istarget i?86-*-*] || [istarget x86_64-*-*]) && ([check_avx_available] && ![check_prefer_avx128])) } { set et_vect_multiple_sizes_saved($et_index) 1 @@ -6184,8 +6253,7 @@ proc check_effective_target_vect64 { } { verbose "check_effective_target_vect64: using cached result" 2 } else { set et_vect64_saved($et_index) 0 - if { ([istarget arm*-*-*] - && [check_effective_target_arm_neon_ok] + if { ([is-effective-target arm_neon] && [check_effective_target_arm_little_endian]) || [istarget aarch64*-*-*] || [istarget sparc*-*-*] } { @@ -6922,6 +6990,7 @@ proc is-effective-target { arg } { "ppc_float128_sw" { set selected [check_ppc_float128_sw_available] } "ppc_float128_hw" { set selected [check_ppc_float128_hw_available] } "ppc_recip_hw" { set selected [check_ppc_recip_hw_available] } + "ppc_cpu_supports_hw" { set selected [check_ppc_cpu_supports_hw_available] } "dfp_hw" { set selected [check_dfp_hw_available] } "htm_hw" { set selected [check_htm_hw_available] } "named_sections" { set selected [check_named_sections_available] } @@ -8209,7 +8278,7 @@ proc check_effective_target_builtin_eh_return { } { # Return 1 if the target supports max reduction for vectors. proc check_effective_target_vect_max_reduc { } { - if { [istarget aarch64*-*-*] || [istarget arm*-*-*] } { + if { [istarget aarch64*-*-*] || [is-effective-target arm_neon] } { return 1 } return 0 |