diff options
author | yroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-11 21:08:09 +0000 |
---|---|---|
committer | yroux <yroux@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-03-11 21:08:09 +0000 |
commit | 31ff2bcaeb342b9ecd7bda12d30ad83ae7f7c819 (patch) | |
tree | 2860bda2c330da87682685781d7c9b62fa3cf81e | |
parent | 1b505641e26f98cb52fee9ce0a729187d68fb3c4 (diff) | |
download | linaro-gcc-31ff2bcaeb342b9ecd7bda12d30ad83ae7f7c819.tar.gz linaro-gcc-31ff2bcaeb342b9ecd7bda12d30ad83ae7f7c819.tar.bz2 linaro-gcc-31ff2bcaeb342b9ecd7bda12d30ad83ae7f7c819.zip |
Merge branches/gcc-4_9-branch rev 221341
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_9-branch@221360 138bc75d-0d04-0410-961f-82ee72b054a4
158 files changed, 3446 insertions, 959 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7bb14f74fc..9a152916076 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,415 @@ +2015-03-10 Yvan Roux <yvan.roux@linaro.org> + + Backport from trunk r220489. + 2015-02-06 Jakub Jelinek <jakub@redhat.com> + + PR ipa/64896 + * cgraphunit.c (cgraph_node::expand_thunk): If + restype is not is_gimple_reg_type nor the thunk_fndecl + returns aggregate_value_p, set restmp to a temporary variable + instead of resdecl. + +2015-03-10 Jakub Jelinek <jakub@redhat.com> + + PR target/65286 + * config/rs6000/t-linux: For powerpc64* target set + MULTILIB_OSDIRNAMES instead of MULTIARCH_DIRNAME. + +2015-03-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/53988 + * config/sh/sh.md (*tst<mode>_t_zero): Remove insns. + +2015-03-10 Alan Modra <amodra@gmail.com> + + PR target/65286 + * config.gcc (powerpc*-*-linux*): Arrange for powerpc64le-linux + to be single-arch by default. Set cpu_is_64bit for powerpc64 + given --with-cpu=native. + * config/rs6000/t-fprules: Do not set default MULTILIB vars. + * config/rs6000/t-linux (MULTIARCH_DIRNAME): Support powerpc64 + and powerpc64le. + * config/rs6000/linux64.h (SUBSUBTARGET_OVERRIDE_OPTIONS): Test + rs6000_isa_flags rather than TARGET_64BIT. + +2015-03-05 Michael Meissner <meissner@linux.vnet.ibm.com> + + Backport from trunk + 2015-03-03 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR 65138/target + * config/rs6000/rs6000-cpus.def (powerpc64le): Add new generic + processor type for 64-bit little endian PowerPC. + + * config/rs6000/rs6000.c (rs6000_option_override_internal): If + -mdebug=reg, print TARGET_DEFAULT. Fix logic to use + TARGET_DEFAULT if there is no default cpu. Fix -mdebug=reg + printing built-in mask so it does not pass NULL pointers. + + * config/rs6000/rs6000-tables.opt: Regenerate. + + * doc/invoke.texi (IBM RS/6000 and PowerPC options): Document + -mcpu=powerpc64le. + + Backport from trunk + 2015-01-19 David Edelsohn <dje.gcc@gmail.com> + + * config/rs6000/default64.h: Include rs6000-cpus.def. + (TARGET_DEFAULT) [LITTLE_ENDIAN]: Use ISA 2.7 (POWER8). + (TARGET_DEFAULT) [BIG_ENDIAN]: Use POWER4. + * config/rs6000/driver-rs6000.c (detect_processor_aix): Add POWER7 + and POWER8. + * config/rs6000/linux64.h (PROCESSOR_DEFAULT64): Always default to + POWER8. + * config/rs6000/rs6000.c (rs6000_file_start): Emit .machine + pseudo-op to specify assembler dialect. + +2015-03-04 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2014-11-27 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR target/59593 + * config/arm/arm.c (dump_minipool): dispatch to consttable pattern + based on mode size. + * config/arm/arm.md (consttable_1): Make it TARGET_EITHER. + (consttable_2): Make it TARGET_EITHER and move HFmode handling from + consttable_4 to it. + (consttable_4): Move HFmode handling to consttable_2 pattern. + +2015-03-03 Kaz Kojima <kkojima@gcc.gnu.org> + + PR target/65249 + * config/sh/sh.md (symGOT_load): Use R0 reg for operands[2] when + called for __stack_chk_guard symbol. + +2015-03-03 Georg-Johann Lay <avr@gjlay.de> + + PR target/64331 + * config/avr/avr.c (context.h, tree-pass.h): Include them. + (avr_pass_data_recompute_notes): New static variable. + (avr_pass_recompute_notes): New class. + (avr_register_passes): New static function. + (avr_option_override): Call it. + +2015-03-03 Eric Botcazou <ebotcazou@adacore.com> + + * config/ia64/ia64.c (expand_vec_perm_interleave_2): Use gen_raw_REG + to create a register in testing mode. + +2015-03-03 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2015-01-14 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR target/64453 + * config/arm/arm.c (callee_saved_reg_p): Define. + (arm_compute_save_reg0_reg12_mask): Use callee_saved_reg_p to check if + register is callee saved instead of !call_used_regs[reg]. + (thumb1_compute_save_reg_mask): Likewise. + +2015-02-27 Richard Biener <rguenther@suse.de> + + PR middle-end/63175 + * builtins.c (get_object_alignment_2): Make sure to re-apply + the ANDed mask after recursing to its operand gets us a new + misalignment bit position. + +2015-02-27 Andrew Pinski <apinski@cavium.com> + Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> + + * config/aarch64/aarch64.c (*aarch64_load_symref_appropriately): + Check whether the destination of SYMBOL_SMALL_TPREL is Pmode. + +2015-02-27 Richard Biener <rguenther@suse.de> + + PR lto/65193 + Backport from mainline + 2014-07-24 Jan Hubicka <hubicka@ucw.cz> + + * lto-streamer-out.c (tree_is_indexable): Consider IMPORTED_DECL + as non-indexable. + +2015-02-25 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + 2015-02-25 Adhemerval Zanella <azanella@linux.vnet.ibm.com> + + * config/rs6000/htm.md (tcheck): Fix assembly encoding. + +2015-02-26 Matthew Fortune <matthew.fortune@imgtec.com> + + PR target/64569 + Backported from mainline: r213872, r217446, r217939, r219867 + + * config.in [!USED_FOR_TARGET] (HAVE_AS_DOT_MODULE): Undefine. + * config/mips/mips.h (FP_ASM_SPEC): New macro. + (ASM_SPEC): Use FP_ASM_SPEC. + * configure.ac (HAVE_AS_DOT_MODULE): Detect support for .module + and FPXX extensions. + * configure: Regenerate. + +2015-02-25 Jason Merrill <jason@redhat.com> + + * common.opt (-flifetime-dse): New. + +2015-02-25 Kai Tietz <ktietz@redhat.com> + + PR tree-optimization/61917 + * tree-vect-loop.c (vectorizable_reduction): Handle obvious case + that reduc_def_stmt is null. + + Merged from mainline + PR target/64212 + * symtab.c (symtab::make_decl_local): Set DECL_IMPORT_P explicit to 0. + (symtab::noninterposable_alias): Likewise. + +2015-02-25 Richard Biener <rguenther@suse.de> + Kai Tietz <ktietz@redhat.com> + + Backported from mainline + PR tree-optimization/61917 + * tree-vect-loop.c (vectorizable_reduction): Allow + vect_internal_def without reduction to exit graceful. + +2015-02-25 Georg-Johann Lay <avr@gjlay.de> + + PR target/65196 + * config/avr/avr.c (avr_adjust_insn_length): Call recog_memoized + only with NONDEBUG_INSN_P. + +2015-02-25 Kaz Kojima <kkojima@gcc.gnu.org> + + Backport from mainline + 2015-02-23 Kaz Kojima <kkojima@gcc.gnu.org> + + PR target/65153 + * config/sh/sh.md (movsicc_true+3): Remove peephole. + * config/sh/sh-protos.h (replace_n_hard_rtx): Don't declare. + * config/sh/sh.c (replace_n_hard_rtx): Remove. + +2015-02-24 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-02-11 Richard Biener <rguenther@suse.de> + + PR lto/65015 + * dwarf2out.c (gen_producer_string): Drop -fltrans-output-list + and -fresolution. + + 2015-02-13 Richard Biener <rguenther@suse.de> + + PR lto/65015 + * dwarf2out.c (dwarf2out_finish): Use <artificial> as DW_AT_name + for LTO produced CUs. + + 2015-02-16 Richard Biener <rguenther@suse.de> + + PR lto/65015 + * varasm.c (default_file_start): For LTO produced units + emit <artificial> as file directive. + + 2015-01-17 Jan Kratochvil <jan.kratochvil@redhat.com> + + * dwarf2out.c (gen_producer_string): Ignore also OPT_fpreprocessed. + +2015-02-23 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2015-02-23 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/65163 + * config/sh/sh.md (swapbsi2, related peephole2): Use const_int -65536 + instead of const_int 4294901760. + +2015-02-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-11-19 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63844 + * omp-low.c (fixup_child_record_type): Use a restrict qualified + referece type for the receiver parameter. + + 2014-11-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61634 + * tree-vect-slp.c: Include gimple-walk.h. + (vect_detect_hybrid_slp_stmts): Rewrite to propagate hybrid + down the SLP tree for one scalar statement. + (vect_detect_hybrid_slp_1): New walker function. + (vect_detect_hybrid_slp_2): Likewise. + (vect_detect_hybrid_slp): Properly handle pattern statements + in a pre-scan over all loop stmts. + + 2015-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59354 + * tree-vect-slp.c (vect_build_slp_tree_1): Treat loads from + groups larger than the slp group size as having gaps. + + 2015-02-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64909 + * tree-vect-loop.c (vect_estimate_min_profitable_iters): Properly + pass a scalar-stmt count estimate to the cost model. + * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost): Likewise. + +2015-02-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-02-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64.md (*aarch64_lshr_sisd_or_int_<mode>3): + Mark operand 0 as earlyclobber in 2nd alternative. + (1st define_split below *aarch64_lshr_sisd_or_int_<mode>3): + Write negated shift amount into QI lowpart operand 0 and use it + in the shift step. + (2nd define_split below *aarch64_lshr_sisd_or_int_<mode>3): Likewise. + +2015-02-20 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2015-02-20 trunk r220847. + + PR target/64452 + * config/avr/avr.md (pushhi_insn): New insn. + (push<mode>1): Push virtual regs in one chunk using pushhi1_insn. + +2015-02-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-01-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64530 + * tree-loop-distribution.c (pg_add_dependence_edges): Shuffle + back dr1. + + 2015-02-13 Richard Biener <rguenther@suse.de> + + PR lto/64373 + * lto-streamer-out.c (tree_is_indexable): Guard for NULL + DECL_CONTEXT. + + 2015-02-16 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63593 + * tree-predcom.c (execute_pred_commoning_chain): Delay removing + stmts and releasing SSA names until... + (execute_pred_commoning): ... after processing all chains. + + 2015-02-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/65063 + * tree-predcom.c (determine_unroll_factor): Return 1 if we + have replaced looparound PHIs. + +2015-02-19 John David Anglin <danlgin@gcc.gnu.org> + + * config/pa/pa.c (pa_reloc_rw_mask): New function. + (TARGET_ASM_RELOC_RW_MASK): Define. + (pa_cannot_force_const_mem): Revert previous change. + +2015-02-19 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-12-09 Richard Biener <rguenther@suse.de> + + PR middle-end/64199 + * fold-const.c (fold_binary_loc): Use TREE_OVERFLOW_P. + + 2015-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64493 + PR tree-optimization/64495 + * tree-vect-loop.c (vect_finalize_reduction): For double-reductions + assign the proper vectorized PHI to the inner loop exit PHIs. + + 2015-01-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/56273 + PR tree-optimization/59124 + PR tree-optimization/64277 + * tree-vrp.c (vrp_finalize): Emit array-bound warnings only + from the first VRP pass. + + 2015-02-19 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-01-15 Richard Biener <rguenther@suse.de> + + PR middle-end/64365 + * tree-data-ref.c (dr_analyze_indices): Make sure that accesses + for MEM_REF access functions with the same base can never partially + overlap. + +2015-02-17 Ilya Tocar <ilya.tocar@intel.com> + + Backported from mainline + 2015-01-14 Ilya Tocar <ilya.tocar@intel.com> + + PR target/64387 + * config/i386/sse.md (vec_unpacks_hi_v8sf): Fix predicate. + (vec_unpacks_hi_v16sf): Ditto. + +2015-02-15 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/pa.c (pa_secondary_reload): Request a secondary reload + for all floading point loads and stores except those using a register + index address. + * config/pa/pa.md: Add new patterns to load a lo_sum DLT operand + to a register. + +2015-02-13 John David Anglin <danglin@gcc.gnu.org> + + * config/pa/constraints.md: Change "Q" and "T" constraints to memory + constraints. + * config/pa/pa.c (pa_cannot_force_const_mem): Don't allow constant + symbolic references to data to be forced to constant memory on the + SOM target. + +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-02-09 Jakub Jelinek <jakub@redhat.com> + + PR target/64979 + * tree-stdarg.c (pass_stdarg::execute): Scan phi node args for + va_list escapes. + +2015-02-11 Uros Bizjak <ubizjak@gmail.com> + + * config/alpha/alpha.md (reload_out<mode>_aligned): Make operands 2 + and 3 earlyclobber operands. + +2015-02-09 Dominik Vogt <vogt@linux.vnet.ibm.com> + + * doc/extend.texi: s/390: Update documentation of hotpatch attribute. + * doc/invoke.texi (-mhotpatch): s/390: Update documentation of + -mhotpatch= option. + * config/s390/s390.opt (mhotpatch): s/390: Remove -mhotpatch and + -mno-hotpatch options. Change syntax of -mhotpatch= option. + * config/s390/s390.c (s390_hotpatch_trampoline_halfwords_default): + Renamed. + (s390_hotpatch_trampoline_halfwords_max): Renamed. + (s390_hotpatch_hw_max): New name. + (s390_hotpatch_trampoline_halfwords): Renamed. + (s390_hotpatch_hw_before_label): New name. + (get_hotpatch_attribute): Removed. + (s390_hotpatch_hw_after_label): New name. + (s390_handle_hotpatch_attribute): Add second parameter to hotpatch + attribute. + (s390_attribute_table): Ditto. + (s390_function_num_hotpatch_trampoline_halfwords): Renamed. + (s390_function_num_hotpatch_hw): New name. + Remove special handling of inline functions and hotpatching. + Return number of nops before and after the function label. + (s390_can_inline_p): Removed. + (s390_asm_output_function_label): Emit a configurable number of nops + after the function label. + (s390_option_override): Update -mhotpatch= syntax and remove -mhotpatch. + (TARGET_CAN_INLINE_P) Removed. + (TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P): New. + 2015-02-05 Segher Boessenkool <segher@kernel.crashing.org> PR target/64580 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index badd154f9f4..8b2e7f6c2ad 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20150209 +20150311 diff --git a/gcc/builtins.c b/gcc/builtins.c index dd57b1ae42a..0825391a0d3 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -369,13 +369,15 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, tree addr = TREE_OPERAND (exp, 0); unsigned ptr_align; unsigned HOST_WIDE_INT ptr_bitpos; + unsigned HOST_WIDE_INT ptr_bitmask = ~0; + /* If the address is explicitely aligned, handle that. */ if (TREE_CODE (addr) == BIT_AND_EXPR && TREE_CODE (TREE_OPERAND (addr, 1)) == INTEGER_CST) { - align = (TREE_INT_CST_LOW (TREE_OPERAND (addr, 1)) - & -TREE_INT_CST_LOW (TREE_OPERAND (addr, 1))); - align *= BITS_PER_UNIT; + ptr_bitmask = TREE_INT_CST_LOW (TREE_OPERAND (addr, 1)); + ptr_bitmask *= BITS_PER_UNIT; + align = ptr_bitmask & -ptr_bitmask; addr = TREE_OPERAND (addr, 0); } @@ -383,6 +385,9 @@ get_object_alignment_2 (tree exp, unsigned int *alignp, = get_pointer_alignment_1 (addr, &ptr_align, &ptr_bitpos); align = MAX (ptr_align, align); + /* Re-apply explicit alignment to the bitpos. */ + ptr_bitpos &= ptr_bitmask; + /* The alignment of the pointer operand in a TARGET_MEM_REF has to take the variable offset parts into account. */ if (TREE_CODE (exp) == TARGET_MEM_REF) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 701d1cef771..f5003324497 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,36 @@ +2015-03-06 Eric Botcazou <ebotcazou@adacore.com> + + * g++.dg/other/dump-ada-spec-3.C: Remove include and adjust. + +2015-03-06 Eric Botcazou <ebotcazou@adacore.com> + Jonathan Wakely <jwakely.gcc@gmail.com> + + * c-ada-spec.c (dump_ada_double_name): Fix pasto. + +2015-03-05 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/65319 + * c-ada-spec.c (print_destructor): Remove obsolete code. + +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-02-04 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + PR c/64868 + * c-omp.c (c_finish_omp_atomic): Use TRUNC_DIV_EXPR + instead of RDIV_EXPR. Use build_binary_op instead of + build2_loc. + +2015-02-11 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-07-24 Marek Polacek <polacek@redhat.com> + + PR c/57653 + * c-opts.c (c_finish_options): If -imacros is in effect, return. + 2015-01-20 Marek Polacek <polacek@redhat.com> Backport from mainline diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index fc21b629aaa..f23869ed14f 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -1392,7 +1392,7 @@ dump_ada_double_name (pretty_printer *buffer, tree t1, tree t2, const char *s) pp_underscore (buffer); - if (DECL_NAME (t1)) + if (DECL_NAME (t2)) pp_ada_tree_identifier (buffer, DECL_NAME (t2), t2, false); else { @@ -2538,18 +2538,9 @@ static void print_destructor (pretty_printer *buffer, tree t) { tree decl_name = DECL_NAME (DECL_ORIGIN (t)); - const char *s = IDENTIFIER_POINTER (decl_name); - if (*s == '_') - { - for (s += 2; *s != ' '; s++) - pp_character (buffer, *s); - } - else - { - pp_string (buffer, "Delete_"); - pp_ada_tree_identifier (buffer, decl_name, t, false); - } + pp_string (buffer, "Delete_"); + pp_ada_tree_identifier (buffer, decl_name, t, false); } /* Return the name of type T. */ diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 6a0e41988a7..bdcedb22e81 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -156,6 +156,9 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, return error_mark_node; } + if (opcode == RDIV_EXPR) + opcode = TRUNC_DIV_EXPR; + /* ??? Validate that rhs does not overlap lhs. */ /* Take and save the address of the lhs. From then on we'll reference it @@ -190,7 +193,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code, to do this, and then take it apart again. */ if (swapped) { - rhs = build2_loc (loc, opcode, TREE_TYPE (lhs), rhs, lhs); + rhs = build_binary_op (loc, opcode, rhs, lhs, 1); opcode = NOP_EXPR; } bool save = in_late_binary_op; diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index 29e9a355bee..dd5fd230782 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1363,6 +1363,12 @@ c_finish_options (void) static void push_command_line_include (void) { + /* This can happen if disabled by -imacros for example. + Punt so that we don't set "<command-line>" as the filename for + the header. */ + if (include_cursor > deferred_count) + return; + if (!done_preinclude) { done_preinclude = true; diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 57be674171d..0fc999caaee 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,24 @@ +2015-02-27 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2015-02-27 Marek Polacek <polacek@redhat.com> + + PR c/65228 + * c-decl.c (start_decl): Return NULL_TREE if decl is an error node. + +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + * c-parser.c (c_parser_binary_expression): Fix OpenMP stack[sp].prec + check in the POP macro. + + Backported from mainline + 2015-02-04 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + PR c/64868 + * c-parser.c (c_parser_omp_atomic): Handle RDIV_EXPR. + 2015-02-01 Jakub Jelinek <jakub@redhat.com> Backported from mainline diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 47907d5ec7f..df88edb8470 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4067,8 +4067,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, decl = grokdeclarator (declarator, declspecs, NORMAL, initialized, NULL, &attributes, &expr, NULL, deprecated_state); - if (!decl) - return 0; + if (!decl || decl == error_mark_node) + return NULL_TREE; if (expr) add_stmt (fold_convert (void_type_node, expr)); diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 3ab01c0d7de..4fbf4f2e157 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -6106,8 +6106,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after, if (__builtin_expect (omp_atomic_lhs != NULL_TREE, 0) && sp == 1 \ && c_parser_peek_token (parser)->type == CPP_SEMICOLON \ && ((1 << stack[sp].prec) \ - & (1 << (PREC_BITOR | PREC_BITXOR | PREC_BITAND | PREC_SHIFT \ - | PREC_ADD | PREC_MULT))) \ + & ((1 << PREC_BITOR) | (1 << PREC_BITXOR) | (1 << PREC_BITAND) \ + | (1 << PREC_SHIFT) | (1 << PREC_ADD) | (1 << PREC_MULT))) \ && stack[sp].op != TRUNC_MOD_EXPR \ && stack[0].expr.value != error_mark_node \ && stack[1].expr.value != error_mark_node \ @@ -11426,6 +11426,7 @@ restart: { case MULT_EXPR: case TRUNC_DIV_EXPR: + case RDIV_EXPR: case PLUS_EXPR: case MINUS_EXPR: case LSHIFT_EXPR: diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 8f576076b65..130fc0debcb 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1572,9 +1572,14 @@ expand_thunk (struct cgraph_node *node, bool output_asm_thunks) restmp = gimple_fold_indirect_ref (resdecl); else if (!is_gimple_reg_type (restype)) { - restmp = resdecl; - add_local_decl (cfun, restmp); - BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; + if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) + { + restmp = resdecl; + add_local_decl (cfun, restmp); + BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; + } + else + restmp = create_tmp_var (restype, "retval"); } else restmp = create_tmp_reg (restype, "retval"); diff --git a/gcc/common.opt b/gcc/common.opt index 2259f29d19e..51ddd77c9a9 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1745,6 +1745,11 @@ fregmove Common Ignore Does nothing. Preserved for backward compatibility. +flifetime-dse +Common Report Var(flag_lifetime_dse) Init(1) Optimization +Tell DSE that the storage for a C++ object is dead when the constructor +starts and when the destructor finishes. + flive-range-shrinkage Common Report Var(flag_live_range_shrinkage) Init(0) Optimization Relief of register pressure through live range shrinkage diff --git a/gcc/config.gcc b/gcc/config.gcc index 6b848c1c378..08f8d63302a 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2274,28 +2274,32 @@ powerpc-*-rtems*) powerpc*-*-linux*) tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h" extra_options="${extra_options} rs6000/sysv4.opt" - tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppccomm" extra_objs="$extra_objs rs6000-linux.o" case ${target} in powerpc*le-*-*) tm_file="${tm_file} rs6000/sysv4le.h" ;; esac - maybe_biarch=yes + case ${target}:${with_cpu} in + powerpc64*: | powerpc64*:native) cpu_is_64bit=yes ;; + esac + maybe_biarch=${cpu_is_64bit} + case ${enable_targets} in + *powerpc64*) maybe_biarch=yes ;; + esac case ${target} in powerpc64*-*-linux*spe* | powerpc64*-*-linux*paired*) - echo "*** Configuration ${target} not supported" 1>&2 + echo "*** Configuration ${target} not supported" 1>&2 exit 1 ;; powerpc*-*-linux*spe* | powerpc*-*-linux*paired*) maybe_biarch= ;; - powerpc64*-*-linux*) - test x$with_cpu != x || cpu_is_64bit=yes - maybe_biarch=always - ;; esac - case ${maybe_biarch}:${enable_targets}:${cpu_is_64bit} in - always:* | yes:*powerpc64* | yes:all:* | yes:*:yes) + case ${target}:${enable_targets}:${maybe_biarch} in + powerpc64-* | powerpc-*:*:yes | *:*powerpc64-*:yes | *:all:yes \ + | powerpc64le*:*powerpcle* | powerpc64le*:*powerpc-* \ + | powerpcle-*:*powerpc64le*:yes) if test x$cpu_is_64bit = xyes; then tm_file="${tm_file} rs6000/default64.h" fi @@ -2316,9 +2320,14 @@ powerpc*-*-linux*) esac extra_options="${extra_options} rs6000/linux64.opt" ;; + powerpc64*) + tm_file="${tm_file} rs6000/default64.h rs6000/linux64.h glibc-stdint.h" + extra_options="${extra_options} rs6000/linux64.opt" + tmake_file="${tmake_file} rs6000/t-linux" + ;; *) tm_file="${tm_file} rs6000/linux.h glibc-stdint.h" - tmake_file="$tmake_file rs6000/t-linux" + tmake_file="${tmake_file} rs6000/t-ppcos rs6000/t-linux" ;; esac case ${target} in diff --git a/gcc/config.in b/gcc/config.in index 71cf0c93b91..de4f09017f4 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -447,6 +447,12 @@ #endif +/* Define if the assembler understands .module. */ +#ifndef USED_FOR_TARGET +#undef HAVE_AS_DOT_MODULE +#endif + + /* Define if your assembler supports the -no-mul-bug-abort option. */ #ifndef USED_FOR_TARGET #undef HAVE_AS_NO_MUL_BUG_ABORT_OPTION diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 3f476240dd7..768c1154163 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -805,6 +805,10 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, case SYMBOL_SMALL_TPREL: { rtx tp = aarch64_load_tp (NULL); + + if (GET_MODE (dest) != Pmode) + tp = gen_lowpart (GET_MODE (dest), tp); + emit_insn (gen_tlsle_small (dest, tp, imm)); set_unique_reg_note (get_last_insn (), REG_EQUIV, imm); return; diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 1179d572da6..3eabba2e3fc 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -4496,8 +4496,8 @@ (define_insn_and_split "reload_out<mode>_aligned" [(set (match_operand:I12MODE 0 "memory_operand" "=m") (match_operand:I12MODE 1 "register_operand" "r")) - (clobber (match_operand:SI 2 "register_operand" "=r")) - (clobber (match_operand:SI 3 "register_operand" "=r"))] + (clobber (match_operand:SI 2 "register_operand" "=&r")) + (clobber (match_operand:SI 3 "register_operand" "=&r"))] "!TARGET_BWX && (reload_in_progress || reload_completed)" "#" "!TARGET_BWX && reload_completed" diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 4d65038d1f7..0fcabee4ab9 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -16642,7 +16642,7 @@ dump_minipool (rtx scan) fputc ('\n', dump_file); } - switch (mp->fix_size) + switch (GET_MODE_SIZE (mp->mode)) { #ifdef HAVE_consttable_1 case 1: @@ -18985,6 +18985,14 @@ output_ascii_pseudo_op (FILE *stream, const unsigned char *p, int len) fputs ("\"\n", stream); } +/* Whether a register is callee saved or not. This is necessary because high + registers are marked as caller saved when optimizing for size on Thumb-1 + targets despite being callee saved in order to avoid using them. */ +#define callee_saved_reg_p(reg) \ + (!call_used_regs[reg] \ + || (TARGET_THUMB1 && optimize_size \ + && reg >= FIRST_HI_REGNUM && reg <= LAST_HI_REGNUM)) + /* Compute the register save mask for registers 0 through 12 inclusive. This code is used by arm_compute_save_reg_mask. */ @@ -19045,7 +19053,7 @@ arm_compute_save_reg0_reg12_mask (void) /* In the normal case we only need to save those registers which are call saved and which are used by this function. */ for (reg = 0; reg <= 11; reg++) - if (df_regs_ever_live_p (reg) && ! call_used_regs[reg]) + if (df_regs_ever_live_p (reg) && callee_saved_reg_p (reg)) save_reg_mask |= (1 << reg); /* Handle the frame pointer as a special case. */ @@ -19208,7 +19216,7 @@ thumb1_compute_save_reg_mask (void) mask = 0; for (reg = 0; reg < 12; reg ++) - if (df_regs_ever_live_p (reg) && !call_used_regs[reg]) + if (df_regs_ever_live_p (reg) && callee_saved_reg_p (reg)) mask |= 1 << reg; if (flag_pic @@ -19241,7 +19249,7 @@ thumb1_compute_save_reg_mask (void) if (reg * UNITS_PER_WORD <= (unsigned) arm_size_return_regs ()) reg = LAST_LO_REGNUM; - if (! call_used_regs[reg]) + if (callee_saved_reg_p (reg)) mask |= 1 << reg; } @@ -30178,8 +30186,7 @@ arm_conditional_register_usage (void) /* When optimizing for size on Thumb-1, it's better not to use the HI regs, because of the overhead of stacking them. */ - for (regno = FIRST_HI_REGNUM; - regno <= LAST_HI_REGNUM; ++regno) + for (regno = FIRST_HI_REGNUM; regno <= LAST_HI_REGNUM; ++regno) fixed_regs[regno] = call_used_regs[regno] = 1; } diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index b0551ee8ed5..d931ed45d76 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -12245,7 +12245,7 @@ (define_insn "consttable_1" [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_1)] - "TARGET_THUMB1" + "TARGET_EITHER" "* making_const_table = TRUE; assemble_integer (operands[0], 1, BITS_PER_WORD, 1); @@ -12258,14 +12258,23 @@ (define_insn "consttable_2" [(unspec_volatile [(match_operand 0 "" "")] VUNSPEC_POOL_2)] - "TARGET_THUMB1" + "TARGET_EITHER" "* - making_const_table = TRUE; - gcc_assert (GET_MODE_CLASS (GET_MODE (operands[0])) != MODE_FLOAT); - assemble_integer (operands[0], 2, BITS_PER_WORD, 1); - assemble_zeros (2); - return \"\"; - " + { + rtx x = operands[0]; + making_const_table = TRUE; + switch (GET_MODE_CLASS (GET_MODE (x))) + { + case MODE_FLOAT: + arm_emit_fp16_const (x); + break; + default: + assemble_integer (operands[0], 2, BITS_PER_WORD, 1); + assemble_zeros (2); + break; + } + return \"\"; + }" [(set_attr "length" "4") (set_attr "type" "no_insn")] ) @@ -12280,15 +12289,12 @@ switch (GET_MODE_CLASS (GET_MODE (x))) { case MODE_FLOAT: - if (GET_MODE (x) == HFmode) - arm_emit_fp16_const (x); - else - { - REAL_VALUE_TYPE r; - REAL_VALUE_FROM_CONST_DOUBLE (r, x); - assemble_real (r, GET_MODE (x), BITS_PER_WORD); - } - break; + { + REAL_VALUE_TYPE r; + REAL_VALUE_FROM_CONST_DOUBLE (r, x); + assemble_real (r, GET_MODE (x), BITS_PER_WORD); + break; + } default: /* XXX: Sometimes gcc does something really dumb and ends up with a HIGH in a constant pool entry, usually because it's trying to diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 4c65f5efaba..3130c0cf0b2 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -51,6 +51,8 @@ #include "target-def.h" #include "params.h" #include "df.h" +#include "context.h" +#include "tree-pass.h" /* Maximal allowed offset for an address in the LD command */ #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE)) @@ -285,6 +287,58 @@ avr_to_int_mode (rtx x) } +static const pass_data avr_pass_data_recompute_notes = +{ + RTL_PASS, // type + "", // name (will be patched) + OPTGROUP_NONE, // optinfo_flags + false, // has_gate + true, // has_execute + TV_DF_SCAN, // tv_id + 0, // properties_required + 0, // properties_provided + 0, // properties_destroyed + 0, // todo_flags_start + // todo_flags_finish + TODO_df_finish | TODO_verify_rtl_sharing | TODO_verify_flow +}; + + +class avr_pass_recompute_notes : public rtl_opt_pass +{ +public: + avr_pass_recompute_notes (gcc::context *ctxt, const char *name) + : rtl_opt_pass (avr_pass_data_recompute_notes, ctxt) + { + this->name = name; + } + + unsigned int execute (void) + { + df_note_add_problem (); + df_analyze (); + + return 0; + } +}; // avr_pass_recompute_notes + + +static void +avr_register_passes (void) +{ + /* This avr-specific pass (re)computes insn notes, in particular REG_DEAD + notes which are used by `avr.c::reg_unused_after' and branch offset + computations. These notes must be correct, i.e. there must be no + dangling REG_DEAD notes; otherwise wrong code might result, cf. PR64331. + + DF needs (correct) CFG, hence right before free_cfg is the last + opportunity to rectify notes. */ + + register_pass (new avr_pass_recompute_notes (g, "avr-notes-free-cfg"), + PASS_POS_INSERT_BEFORE, "*free_cfg", 1); +} + + /* Implement `TARGET_OPTION_OVERRIDE'. */ static void @@ -346,6 +400,11 @@ avr_option_override (void) init_machine_status = avr_init_machine_status; avr_log_set_avr_log(); + + /* Register some avr-specific pass(es). There is no canonical place for + pass registration. This function is convenient. */ + + avr_register_passes (); } /* Function to set up the backend function structure. */ @@ -7778,7 +7837,8 @@ avr_adjust_insn_length (rtx insn, int len) It is easier to state this in an insn attribute "adjust_len" than to clutter up code here... */ - if (-1 == recog_memoized (insn)) + if (!NONDEBUG_INSN_P (insn) + || -1 == recog_memoized (insn)) { return len; } diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 3f4181dabff..07286206d0f 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -352,6 +352,13 @@ push __zero_reg__" [(set_attr "length" "1,1")]) +(define_insn "pushhi1_insn" + [(set (mem:HI (post_dec:HI (reg:HI REG_SP))) + (match_operand:HI 0 "register_operand" "r"))] + "" + "push %B0\;push %A0" + [(set_attr "length" "2")]) + ;; All modes for a multi-byte push. We must include complex modes here too, ;; lest emit_single_push_insn "helpfully" create the auto-inc itself. (define_mode_iterator MPUSH @@ -367,17 +374,42 @@ [(match_operand:MPUSH 0 "" "")] "" { - int i; - - // Avoid (subreg (mem)) for non-generic address spaces below. Because - // of the poor addressing capabilities of these spaces it's better to - // load them in one chunk. And it avoids PR61443. - if (MEM_P (operands[0]) && !ADDR_SPACE_GENERIC_P (MEM_ADDR_SPACE (operands[0]))) - operands[0] = copy_to_mode_reg (<MODE>mode, operands[0]); + { + // Avoid (subreg (mem)) for non-generic address spaces. Because + // of the poor addressing capabilities of these spaces it's better to + // load them in one chunk. And it avoids PR61443. + + operands[0] = copy_to_mode_reg (<MODE>mode, operands[0]); + } + else if (REG_P (operands[0]) + && IN_RANGE (REGNO (operands[0]), FIRST_VIRTUAL_REGISTER, + LAST_VIRTUAL_REGISTER)) + { + // Byte-wise pushing of virtual regs might result in something like + // + // (set (mem:QI (post_dec:HI (reg:HI 32 SP))) + // (subreg:QI (plus:HI (reg:HI 28) + // (const_int 17)) 0)) + // + // after elimination. This cannot be handled by reload, cf. PR64452. + // Reload virtuals in one chunk. That way it's possible to reload + // above situation and finally + // + // (set (reg:HI **) + // (const_int 17)) + // (set (reg:HI **) + // (plus:HI (reg:HI **) + // (reg:HI 28))) + // (set (mem:HI (post_dec:HI (reg:HI 32 SP)) + // (reg:HI **))) + + emit_insn (gen_pushhi1_insn (operands[0])); + DONE; + } - for (i = GET_MODE_SIZE (<MODE>mode) - 1; i >= 0; --i) + for (int i = GET_MODE_SIZE (<MODE>mode) - 1; i >= 0; --i) { rtx part = simplify_gen_subreg (QImode, operands[0], <MODE>mode, i); if (part != const0_rtx) diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 5a62572b0cd..439ced0dde5 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -4385,7 +4385,7 @@ (define_expand "vec_unpacks_hi_v8sf" [(set (match_dup 2) (vec_select:V4SF - (match_operand:V8SF 1 "nonimmediate_operand") + (match_operand:V8SF 1 "register_operand") (parallel [(const_int 4) (const_int 5) (const_int 6) (const_int 7)]))) (set (match_operand:V4DF 0 "register_operand") @@ -4397,7 +4397,7 @@ (define_expand "vec_unpacks_hi_v16sf" [(set (match_dup 2) (vec_select:V8SF - (match_operand:V16SF 1 "nonimmediate_operand") + (match_operand:V16SF 1 "register_operand") (parallel [(const_int 8) (const_int 9) (const_int 10) (const_int 11) (const_int 12) (const_int 13) diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index 41adc4adc96..229a0f386b4 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -11495,7 +11495,10 @@ expand_vec_perm_interleave_2 (struct expand_vec_perm_d *d) gcc_assert (e < nelt); dfinal.perm[i] = e; } - dfinal.op0 = gen_reg_rtx (dfinal.vmode); + if (d->testing_p) + dfinal.op0 = gen_raw_REG (dfinal.vmode, LAST_VIRTUAL_REGISTER + 1); + else + dfinal.op0 = gen_reg_rtx (dfinal.vmode); dfinal.op1 = dfinal.op0; dfinal.one_operand_p = true; dremap.target = dfinal.op0; diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 4b2d4259821..6849f0ba6af 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1163,6 +1163,22 @@ struct mips_cpu_info { #define SUBTARGET_ASM_SPEC "" #endif +/* FP_ASM_SPEC represents the floating-point options that must be passed + to the assembler when FPXX support exists. Prior to that point the + assembler could accept the options but were not required for + correctness. We only add the options when absolutely necessary + because passing -msoft-float to the assembler will cause it to reject + all hard-float instructions which may require some user code to be + updated. */ + +#ifdef HAVE_AS_DOT_MODULE +#define FP_ASM_SPEC "\ +%{mhard-float} %{msoft-float} \ +%{msingle-float} %{mdouble-float}" +#else +#define FP_ASM_SPEC +#endif + #undef ASM_SPEC #define ASM_SPEC "\ %{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} \ @@ -1188,7 +1204,8 @@ struct mips_cpu_info { %{mfp32} %{mfp64} %{mnan=*} \ %{mshared} %{mno-shared} \ %{msym32} %{mno-sym32} \ -%{mtune=*} \ +%{mtune=*}" \ +FP_ASM_SPEC "\ %(subtarget_asm_spec)" /* Extra switches sometimes passed to the linker. */ diff --git a/gcc/config/pa/constraints.md b/gcc/config/pa/constraints.md index a9117b9889e..bfcba37346e 100644 --- a/gcc/config/pa/constraints.md +++ b/gcc/config/pa/constraints.md @@ -106,7 +106,7 @@ (and (match_code "mem") (match_test "IS_LO_SUM_DLT_ADDR_P (XEXP (op, 0))"))) -(define_constraint "Q" +(define_memory_constraint "Q" "A memory operand that can be used as the destination operand of an integer store, or the source operand of an integer load. That is any memory operand that isn't a symbolic, indexed or lo_sum memory @@ -122,7 +122,7 @@ (and (match_code "mem") (match_test "IS_INDEX_ADDR_P (XEXP (op, 0))"))) -(define_constraint "T" +(define_memory_constraint "T" "A memory operand for floating-point loads and stores." (match_test "floating_point_store_memory_operand (op, mode)")) diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 80198206851..e9c4b0b0789 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -119,6 +119,7 @@ static void pa_output_function_epilogue (FILE *, HOST_WIDE_INT); static int pa_adjust_cost (rtx, rtx, rtx, int); static int pa_adjust_priority (rtx, int); static int pa_issue_rate (void); +static int pa_reloc_rw_mask (void); static void pa_som_asm_init_sections (void) ATTRIBUTE_UNUSED; static section *pa_som_tm_clone_table_section (void) ATTRIBUTE_UNUSED; static section *pa_select_section (tree, int, unsigned HOST_WIDE_INT) @@ -294,6 +295,9 @@ static size_t n_deferred_plabels = 0; #define TARGET_ASM_FILE_END output_deferred_plabels #endif +#undef TARGET_ASM_RELOC_RW_MASK +#define TARGET_ASM_RELOC_RW_MASK pa_reloc_rw_mask + #undef TARGET_PRINT_OPERAND_PUNCT_VALID_P #define TARGET_PRINT_OPERAND_PUNCT_VALID_P pa_print_operand_punct_valid_p @@ -6013,18 +6017,15 @@ pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i, { x = XEXP (x, 0); - /* We don't need an intermediate for indexed and LO_SUM DLT - memory addresses. When INT14_OK_STRICT is true, it might - appear that we could directly allow register indirect - memory addresses. However, this doesn't work because we - don't support SUBREGs in floating-point register copies - and reload doesn't tell us when it's going to use a SUBREG. */ - if (IS_INDEX_ADDR_P (x) - || IS_LO_SUM_DLT_ADDR_P (x)) - return NO_REGS; + /* We don't need a secondary reload for indexed memory addresses. - /* Request intermediate general register. */ - return GENERAL_REGS; + When INT14_OK_STRICT is true, it might appear that we could + directly allow register indirect memory addresses. However, + this doesn't work because we don't support SUBREGs in + floating-point register copies and reload doesn't tell us + when it's going to use a SUBREG. */ + if (IS_INDEX_ADDR_P (x)) + return NO_REGS; } /* Request a secondary reload with a general scratch register @@ -9820,6 +9821,19 @@ pa_select_section (tree exp, int reloc, return data_section; } +/* Implement pa_reloc_rw_mask. */ + +static int +pa_reloc_rw_mask (void) +{ + /* We force (const (plus (symbol) (const_int))) to memory when the + const_int doesn't fit in a 14-bit integer. The SOM linker can't + handle this construct in read-only memory and we want to avoid + this for ELF. So, we always force an RTX needing relocation to + the data section. */ + return 3; +} + static void pa_globalize_label (FILE *stream, const char *name) { diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 43b909e35ba..559b15772c8 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -2680,6 +2680,29 @@ [(set_attr "type" "binary") (set_attr "length" "4")]) +(define_insn "" + [(set (match_operand:SI 0 "register_operand" "=r") + (lo_sum:SI (match_operand:SI 1 "register_operand" "r") + (unspec:SI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))] + "symbolic_operand (operands[2], Pmode) + && ! function_label_operand (operands[2], Pmode) + && flag_pic" + "ldo RT'%G2(%1),%0" + [(set_attr "type" "binary") + (set_attr "length" "4")]) + +(define_insn "" + [(set (match_operand:DI 0 "register_operand" "=r") + (lo_sum:DI (match_operand:DI 1 "register_operand" "r") + (unspec:DI [(match_operand 2 "" "")] UNSPEC_DLTIND14R)))] + "symbolic_operand (operands[2], Pmode) + && ! function_label_operand (operands[2], Pmode) + && TARGET_64BIT + && flag_pic" + "ldo RT'%G2(%1),%0" + [(set_attr "type" "binary") + (set_attr "length" "4")]) + ;; Always use addil rather than ldil;add sequences. This allows the ;; HP linker to eliminate the dp relocation if the symbolic operand ;; lives in the TEXT space. diff --git a/gcc/config/rs6000/default64.h b/gcc/config/rs6000/default64.h index 48dcdf04ae8..7a29672a1ea 100644 --- a/gcc/config/rs6000/default64.h +++ b/gcc/config/rs6000/default64.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for 64 bit powerpc linux defaulting to -m64. - Copyright (C) 2003-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -18,10 +18,14 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ +#define RS6000_CPU(NAME, CPU, FLAGS) +#include "rs6000-cpus.def" +#undef RS6000_CPU + #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) #undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT | MASK_LITTLE_ENDIAN) +#define TARGET_DEFAULT (ISA_2_7_MASKS_SERVER | MASK_POWERPC64 | MASK_64BIT | MASK_LITTLE_ENDIAN) #else #undef TARGET_DEFAULT -#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_POWERPC64 | MASK_64BIT) +#define TARGET_DEFAULT (MASK_PPC_GFXOPT | MASK_PPC_GPOPT | MASK_MFCRF | MASK_POWERPC64 | MASK_64BIT) #endif diff --git a/gcc/config/rs6000/driver-rs6000.c b/gcc/config/rs6000/driver-rs6000.c index 7df5fbaa5e1..af324712b20 100644 --- a/gcc/config/rs6000/driver-rs6000.c +++ b/gcc/config/rs6000/driver-rs6000.c @@ -1,5 +1,5 @@ /* Subroutines for the gcc driver. - Copyright (C) 2007-2014 Free Software Foundation, Inc. + Copyright (C) 2007-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -327,6 +327,12 @@ detect_processor_aix (void) case 0x4000: return "power6"; + case 0x8000: + return "power7"; + + case 0x10000: + return "power8"; + default: return "powerpc"; } diff --git a/gcc/config/rs6000/htm.md b/gcc/config/rs6000/htm.md index ca7f7fdf4fb..f8b02cb14ce 100644 --- a/gcc/config/rs6000/htm.md +++ b/gcc/config/rs6000/htm.md @@ -245,7 +245,7 @@ (unspec_volatile:CC [(match_operand 0 "u3bit_cint_operand" "n")] UNSPECV_HTM_TCHECK))] "TARGET_HTM" - "tcheck. %0" + "tcheck %0" [(set_attr "type" "htm") (set_attr "length" "4")]) diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 0ca05d2f6a2..4394db906eb 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for 64 bit PowerPC linux. - Copyright (C) 2000-2014 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. This file is part of GCC. @@ -71,11 +71,7 @@ extern int dot_symbols; #undef PROCESSOR_DEFAULT #define PROCESSOR_DEFAULT PROCESSOR_POWER7 #undef PROCESSOR_DEFAULT64 -#ifdef LINUX64_DEFAULT_ABI_ELFv2 #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8 -#else -#define PROCESSOR_DEFAULT64 PROCESSOR_POWER7 -#endif /* We don't need to generate entries in .fixup, except when -mrelocatable or -mrelocatable-lib is given. */ @@ -101,7 +97,7 @@ extern int dot_symbols; { \ if (!global_options_set.x_rs6000_alignment_flags) \ rs6000_alignment_flags = MASK_ALIGN_NATURAL; \ - if (TARGET_64BIT) \ + if (rs6000_isa_flags & OPTION_MASK_64BIT) \ { \ if (DEFAULT_ABI != ABI_AIX) \ { \ diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index ba56df83dd1..abe0ce6b7ac 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -1,5 +1,5 @@ /* IBM RS/6000 CPU names.. - Copyright (C) 1991-2014 Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GCC. @@ -189,4 +189,5 @@ RS6000_CPU ("power7", PROCESSOR_POWER7, /* Don't add MASK_ISEL by default */ RS6000_CPU ("power8", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) RS6000_CPU ("powerpc", PROCESSOR_POWERPC, 0) RS6000_CPU ("powerpc64", PROCESSOR_POWERPC64, MASK_PPC_GFXOPT | MASK_POWERPC64) +RS6000_CPU ("powerpc64le", PROCESSOR_POWER8, MASK_POWERPC64 | ISA_2_7_MASKS_SERVER) RS6000_CPU ("rs64", PROCESSOR_RS64A, MASK_PPC_GFXOPT | MASK_POWERPC64) diff --git a/gcc/config/rs6000/rs6000-tables.opt b/gcc/config/rs6000/rs6000-tables.opt index 85678d2bc6a..41e7e149b53 100644 --- a/gcc/config/rs6000/rs6000-tables.opt +++ b/gcc/config/rs6000/rs6000-tables.opt @@ -186,5 +186,8 @@ EnumValue Enum(rs6000_cpu_opt_value) String(powerpc64) Value(52) EnumValue -Enum(rs6000_cpu_opt_value) String(rs64) Value(53) +Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(53) + +EnumValue +Enum(rs6000_cpu_opt_value) String(rs64) Value(54) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f5df7d592b7..f1068f7e9d8 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1,5 +1,5 @@ /* Subroutines used for code generation on IBM RS/6000. - Copyright (C) 1991-2014 Free Software Foundation, Inc. + Copyright (C) 1991-2015 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) This file is part of GCC. @@ -3100,6 +3100,10 @@ rs6000_option_override_internal (bool global_init_p) = ((global_init_p || target_option_default_node == NULL) ? NULL : TREE_TARGET_OPTION (target_option_default_node)); + /* Print defaults. */ + if ((TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) && global_init_p) + rs6000_print_isa_options (stderr, 0, "TARGET_DEFAULT", TARGET_DEFAULT); + /* Remember the explicit arguments. */ if (global_init_p) rs6000_isa_flags_explicit = global_options_set.x_rs6000_isa_flags; @@ -3176,7 +3180,13 @@ rs6000_option_override_internal (bool global_init_p) } else { - const char *default_cpu = (TARGET_POWERPC64 ? "powerpc64" : "powerpc"); + /* PowerPC 64-bit LE requires at least ISA 2.07. */ + const char *default_cpu = ((!TARGET_POWERPC64) + ? "powerpc" + : ((BYTES_BIG_ENDIAN) + ? "powerpc64" + : "powerpc64le")); + rs6000_cpu_index = cpu_index = rs6000_cpu_name_lookup (default_cpu); have_cpu = false; } @@ -3195,15 +3205,18 @@ rs6000_option_override_internal (bool global_init_p) & set_masks); } else - rs6000_isa_flags |= (processor_target_table[cpu_index].target_enable - & ~rs6000_isa_flags_explicit); + { + /* If no -mcpu=<xxx>, inherit any default options that were cleared via + POWERPC_MASKS. Originally, TARGET_DEFAULT was used to initialize + target_flags via the TARGET_DEFAULT_TARGET_FLAGS hook. When we switched + to using rs6000_isa_flags, we need to do the initialization here. - /* If no -mcpu=<xxx>, inherit any default options that were cleared via - POWERPC_MASKS. Originally, TARGET_DEFAULT was used to initialize - target_flags via the TARGET_DEFAULT_TARGET_FLAGS hook. When we switched - to using rs6000_isa_flags, we need to do the initialization here. */ - if (!have_cpu) - rs6000_isa_flags |= (TARGET_DEFAULT & ~rs6000_isa_flags_explicit); + If there is a TARGET_DEFAULT, use that. Otherwise fall back to using + -mcpu=powerpc, -mcpu=powerpc64, or -mcpu=powerpc64le defaults. */ + HOST_WIDE_INT flags = ((TARGET_DEFAULT) ? TARGET_DEFAULT + : processor_target_table[cpu_index].target_enable); + rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit); + } if (rs6000_tune_index >= 0) tune_index = rs6000_tune_index; @@ -4055,12 +4068,8 @@ rs6000_option_override_internal (bool global_init_p) target_flags. */ rs6000_builtin_mask = rs6000_builtin_mask_calculate (); if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET) - { - fprintf (stderr, - "new builtin mask = " HOST_WIDE_INT_PRINT_HEX ", ", - rs6000_builtin_mask); - rs6000_print_builtin_options (stderr, 0, NULL, rs6000_builtin_mask); - } + rs6000_print_builtin_options (stderr, 0, "builtin mask", + rs6000_builtin_mask); /* Initialize all of the registers. */ rs6000_init_hard_regno_mode_ok (global_init_p); @@ -4930,6 +4939,28 @@ rs6000_file_start (void) switch_to_section (toc_section); switch_to_section (text_section); } + +#ifdef USING_ELFOS_H + if (rs6000_default_cpu == 0 || rs6000_default_cpu[0] == '\0' + || !global_options_set.x_rs6000_cpu_index) + { + fputs ("\t.machine ", asm_out_file); + if ((rs6000_isa_flags & OPTION_MASK_DIRECT_MOVE) != 0) + fputs ("power8\n", asm_out_file); + else if ((rs6000_isa_flags & OPTION_MASK_POPCNTD) != 0) + fputs ("power7\n", asm_out_file); + else if ((rs6000_isa_flags & OPTION_MASK_CMPB) != 0) + fputs ("power6\n", asm_out_file); + else if ((rs6000_isa_flags & OPTION_MASK_POPCNTB) != 0) + fputs ("power5\n", asm_out_file); + else if ((rs6000_isa_flags & OPTION_MASK_MFCRF) != 0) + fputs ("power4\n", asm_out_file); + else if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) != 0) + fputs ("ppc64\n", asm_out_file); + else + fputs ("ppc\n", asm_out_file); + } +#endif } diff --git a/gcc/config/rs6000/t-fprules b/gcc/config/rs6000/t-fprules index 5361ff3032a..cde43641334 100644 --- a/gcc/config/rs6000/t-fprules +++ b/gcc/config/rs6000/t-fprules @@ -18,9 +18,3 @@ SOFT_FLOAT_CPUS = e300c2 401 403 405 440 464 476 ec603e 801 821 823 860 MULTILIB_MATCHES_FLOAT = $(foreach cpu, $(SOFT_FLOAT_CPUS), msoft-float=mcpu?$(cpu)) - -# Build the libraries for both hard and soft floating point by default - -MULTILIB_OPTIONS = msoft-float -MULTILIB_DIRNAMES = soft-float -MULTILIB_MATCHES = ${MULTILIB_MATCHES_FLOAT} diff --git a/gcc/config/rs6000/t-linux b/gcc/config/rs6000/t-linux index 0b92eba4617..4cb63bdca5d 100644 --- a/gcc/config/rs6000/t-linux +++ b/gcc/config/rs6000/t-linux @@ -1,10 +1,20 @@ # do not define the multiarch name if configured for a soft-float cpu # or soft-float. ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float))) +ifneq (,$(findstring powerpc64,$(target))) +MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu) +else ifneq (,$(findstring spe,$(target))) -MULTIARCH_DIRNAME = powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1) +MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1) else -MULTIARCH_DIRNAME = powerpc-linux-gnu +MULTIARCH_DIRNAME := powerpc-linux-gnu +endif +endif +ifneq (,$(findstring powerpcle,$(target))) +MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME)) +endif +ifneq (,$(findstring powerpc64le,$(target))) +MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES)) endif endif diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index c56689969a2..8ff63475a38 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -436,24 +436,9 @@ struct GTY(()) machine_function bytes on a z10 (or higher) CPU. */ #define PREDICT_DISTANCE (TARGET_Z10 ? 384 : 2048) -static const int s390_hotpatch_trampoline_halfwords_default = 12; -static const int s390_hotpatch_trampoline_halfwords_max = 1000000; -static int s390_hotpatch_trampoline_halfwords = -1; - -/* Return the argument of the given hotpatch attribute or the default value if - no argument is present. */ - -static inline int -get_hotpatch_attribute (tree hotpatch_attr) -{ - const_tree args; - - args = TREE_VALUE (hotpatch_attr); - - return (args) ? - TREE_INT_CST_LOW (TREE_VALUE (args)): - s390_hotpatch_trampoline_halfwords_default; -} +static const int s390_hotpatch_hw_max = 1000000; +static int s390_hotpatch_hw_before_label = 0; +static int s390_hotpatch_hw_after_label = 0; /* Check whether the hotpatch attribute is applied to a function and, if it has an argument, the argument is valid. */ @@ -462,34 +447,48 @@ static tree s390_handle_hotpatch_attribute (tree *node, tree name, tree args, int flags ATTRIBUTE_UNUSED, bool *no_add_attrs) { + tree expr; + tree expr2; + int err; + if (TREE_CODE (*node) != FUNCTION_DECL) { warning (OPT_Wattributes, "%qE attribute only applies to functions", name); *no_add_attrs = true; } - else if (args) + if (args != NULL && TREE_CHAIN (args) != NULL) + { + expr = TREE_VALUE (args); + expr2 = TREE_VALUE (TREE_CHAIN (args)); + } + if (args == NULL || TREE_CHAIN (args) == NULL) + err = 1; + else if (TREE_CODE (expr) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (expr)) + || TREE_INT_CST_HIGH (expr) != 0 + || TREE_INT_CST_LOW (expr) > (unsigned int)s390_hotpatch_hw_max) + err = 1; + else if (TREE_CODE (expr2) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (expr2)) + || TREE_INT_CST_HIGH (expr2) != 0 + || TREE_INT_CST_LOW (expr2) > (unsigned int)s390_hotpatch_hw_max) + err = 1; + else + err = 0; + if (err) { - tree expr = TREE_VALUE (args); - - if (TREE_CODE (expr) != INTEGER_CST - || !INTEGRAL_TYPE_P (TREE_TYPE (expr)) - || TREE_INT_CST_HIGH (expr) != 0 - || TREE_INT_CST_LOW (expr) > (unsigned int) - s390_hotpatch_trampoline_halfwords_max) - { - error ("requested %qE attribute is not a non-negative integer" - " constant or too large (max. %d)", name, - s390_hotpatch_trampoline_halfwords_max); - *no_add_attrs = true; - } + error ("requested %qE attribute is not a comma separated pair of" + " non-negative integer constants or too large (max. %d)", name, + s390_hotpatch_hw_max); + *no_add_attrs = true; } return NULL_TREE; } static const struct attribute_spec s390_attribute_table[] = { - { "hotpatch", 0, 1, true, false, false, s390_handle_hotpatch_attribute, false + { "hotpatch", 2, 2, true, false, false, s390_handle_hotpatch_attribute, false }, /* End element. */ { NULL, 0, 0, false, false, false, NULL, false } @@ -5254,53 +5253,51 @@ get_some_local_dynamic_name (void) gcc_unreachable (); } -/* Returns -1 if the function should not be made hotpatchable. Otherwise it - returns a number >= 0 that is the desired size of the hotpatch trampoline - in halfwords. */ +/* Returns false if the function should not be made hotpatchable. + Otherwise it assigns the number of NOP halfwords to be emitted + before and after the function label to hw_before and hw_after. + Both must not be NULL. */ -static int s390_function_num_hotpatch_trampoline_halfwords (tree decl, - bool do_warn) +static bool +s390_function_num_hotpatch_hw (tree decl, + int *hw_before, + int *hw_after) { tree attr; - if (DECL_DECLARED_INLINE_P (decl) - || DECL_ARTIFICIAL (decl) - || MAIN_NAME_P (DECL_NAME (decl))) + *hw_before = 0; + *hw_after = 0; + + attr = lookup_attribute ("hotpatch", DECL_ATTRIBUTES (decl)); + + /* Handle the arguments of the hotpatch attribute. The values + specified via attribute might override the cmdline argument + values. */ + if (attr) { - /* - Explicitly inlined functions cannot be hotpatched. - - Artificial functions need not be hotpatched. - - Making the main function hotpatchable is useless. */ - return -1; + tree args = TREE_VALUE (attr); + + *hw_before = TREE_INT_CST_LOW (TREE_VALUE (args)); + *hw_after = TREE_INT_CST_LOW (TREE_VALUE (TREE_CHAIN (args))); } - attr = lookup_attribute ("hotpatch", DECL_ATTRIBUTES (decl)); - if (attr || s390_hotpatch_trampoline_halfwords >= 0) + else { - if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl))) - { - if (do_warn) - warning (OPT_Wattributes, "function %qE with the %qs attribute" - " is not hotpatchable", DECL_NAME (decl), "always_inline"); - return -1; - } - else - { - return (attr) ? - get_hotpatch_attribute (attr) : s390_hotpatch_trampoline_halfwords; - } + /* Use the values specified by the cmdline arguments. */ + *hw_before = s390_hotpatch_hw_before_label; + *hw_after = s390_hotpatch_hw_after_label; } - return -1; -} - -/* Hook to determine if one function can safely inline another. */ - -static bool -s390_can_inline_p (tree caller, tree callee) -{ - if (s390_function_num_hotpatch_trampoline_halfwords (callee, false) >= 0) + if (*hw_before == 0 && *hw_after == 0) return false; - return default_target_can_inline_p (caller, callee); + if (decl_function_context (decl) != NULL_TREE) + { + warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch_, + "hotpatching is not compatible with nested functions"); + return false; + } + + return true; } /* Write the extra assembler code needed to declare a function properly. */ @@ -5309,29 +5306,20 @@ void s390_asm_output_function_label (FILE *asm_out_file, const char *fname, tree decl) { - int hotpatch_trampoline_halfwords = -1; + int hw_before, hw_after; + bool hotpatch_p = (decl + ? s390_function_num_hotpatch_hw (decl, + &hw_before, &hw_after) + : false); - if (decl) - { - hotpatch_trampoline_halfwords = - s390_function_num_hotpatch_trampoline_halfwords (decl, true); - if (hotpatch_trampoline_halfwords >= 0 - && decl_function_context (decl) != NULL_TREE) - { - warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch, - "hotpatching is not compatible with nested functions"); - hotpatch_trampoline_halfwords = -1; - } - } - - if (hotpatch_trampoline_halfwords > 0) + if (hotpatch_p) { int i; /* Add a trampoline code area before the function label and initialize it with two-byte nop instructions. This area can be overwritten with code that jumps to a patched version of the function. */ - for (i = 0; i < hotpatch_trampoline_halfwords; i++) + for (i = 0; i < hw_before; i++) asm_fprintf (asm_out_file, "\tnopr\t%%r7\n"); /* Note: The function label must be aligned so that (a) the bytes of the following nop do not cross a cacheline boundary, and (b) a jump address @@ -5343,10 +5331,30 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname, ASM_OUTPUT_LABEL (asm_out_file, fname); - /* Output a four-byte nop if hotpatching is enabled. This can be overwritten - atomically with a relative backwards jump to the trampoline area. */ - if (hotpatch_trampoline_halfwords >= 0) - asm_fprintf (asm_out_file, "\tnop\t0\n"); + /* Output a series of NOPs after the function label. */ + if (hotpatch_p) + { + while (hw_after > 0) + { + if (hw_after >= 3 && TARGET_CPU_ZARCH) + { + asm_fprintf (asm_out_file, "\tbrcl\t\t0,0\n"); + hw_after -= 3; + } + else if (hw_after >= 2) + { + gcc_assert (hw_after == 2 || !TARGET_CPU_ZARCH); + asm_fprintf (asm_out_file, "\tnop\t0\n"); + hw_after -= 2; + } + else + { + gcc_assert (hw_after == 1); + asm_fprintf (asm_out_file, "\tnopr\t%%r7\n"); + hw_after -= 1; + } + } + } } /* Output machine-dependent UNSPECs occurring in address constant X @@ -11863,29 +11871,44 @@ s390_option_override (void) { switch (opt->opt_index) { - case OPT_mhotpatch: - s390_hotpatch_trampoline_halfwords = (opt->value) ? - s390_hotpatch_trampoline_halfwords_default : -1; - break; case OPT_mhotpatch_: { - int val; - - val = integral_argument (opt->arg); - if (val == -1) + int val1; + int val2; + char s[256]; + char *t; + + strncpy (s, opt->arg, 256); + s[255] = 0; + t = strchr (s, ','); + if (t != NULL) + { + *t = 0; + t++; + val1 = integral_argument (s); + val2 = integral_argument (t); + } + else + { + val1 = -1; + val2 = -1; + } + if (val1 == -1 || val2 == -1) { /* argument is not a plain number */ - error ("argument to %qs should be a non-negative integer", - "-mhotpatch="); + error ("arguments to %qs should be non-negative integers", + "-mhotpatch=n,m"); break; } - else if (val > s390_hotpatch_trampoline_halfwords_max) + else if (val1 > s390_hotpatch_hw_max + || val2 > s390_hotpatch_hw_max) { error ("argument to %qs is too large (max. %d)", - "-mhotpatch=", s390_hotpatch_trampoline_halfwords_max); + "-mhotpatch=n,m", s390_hotpatch_hw_max); break; } - s390_hotpatch_trampoline_halfwords = val; + s390_hotpatch_hw_before_label = val1; + s390_hotpatch_hw_after_label = val2; break; } default: @@ -12267,8 +12290,8 @@ s390_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size, #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE s390_attribute_table -#undef TARGET_CAN_INLINE_P -#define TARGET_CAN_INLINE_P s390_can_inline_p +#undef TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P +#define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_const_tree_true #undef TARGET_SET_UP_BY_PROLOGUE #define TARGET_SET_UP_BY_PROLOGUE s300_set_up_by_prologue diff --git a/gcc/config/s390/s390.opt b/gcc/config/s390/s390.opt index 7780f877c7a..c4b5269206f 100644 --- a/gcc/config/s390/s390.opt +++ b/gcc/config/s390/s390.opt @@ -96,13 +96,15 @@ mhard-float Target Report RejectNegative Negative(msoft-float) InverseMask(SOFT_FLOAT, HARD_FLOAT) Enable hardware floating point -mhotpatch -Target Report Var(s390_deferred_options) Defer -Prepend the function label with 12 two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching. - mhotpatch= Target RejectNegative Report Joined Var(s390_deferred_options) Defer -Prepend the function label with the given number of two-byte Nop instructions, and add a four byte Nop instruction after the label for hotpatching. +Takes two non-negative integer numbers separated by a comma. +Prepend the function label with the number of two-byte Nop +instructions indicated by the first. Append Nop instructions +covering the number of halfwords indicated by the second after the +label. Nop instructions of the largest possible size are used +(six, four or two bytes), beginning with the largest possible +size. Using 0 for both values disables hotpatching. mlong-double-128 Target Report RejectNegative Negative(mlong-double-64) Mask(LONG_DOUBLE_128) diff --git a/gcc/config/sh/sh-protos.h b/gcc/config/sh/sh-protos.h index defc76a3243..44a045f45c3 100644 --- a/gcc/config/sh/sh-protos.h +++ b/gcc/config/sh/sh-protos.h @@ -221,7 +221,6 @@ extern void sh_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, signed int, enum machine_mode); extern rtx sh_dwarf_register_span (rtx); -extern rtx replace_n_hard_rtx (rtx, rtx *, int , int); extern int shmedia_cleanup_truncate (rtx *, void *); extern bool sh_contains_memref_p (rtx); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index de0d0d7f673..af68033b76c 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -12757,146 +12757,6 @@ sh_init_cumulative_args (CUMULATIVE_ARGS * pcum, } } -/* Replace any occurrence of FROM(n) in X with TO(n). The function does - not enter into CONST_DOUBLE for the replace. - - Note that copying is not done so X must not be shared unless all copies - are to be modified. - - This is like replace_rtx, except that we operate on N_REPLACEMENTS - replacements simultaneously - FROM(n) is replacements[n*2] and to(n) is - replacements[n*2+1] - and that we take mode changes into account. - - If a replacement is ambiguous, return NULL_RTX. - - If MODIFY is zero, don't modify any rtl in place, - just return zero or nonzero for failure / success. */ -rtx -replace_n_hard_rtx (rtx x, rtx *replacements, int n_replacements, int modify) -{ - int i, j; - const char *fmt; - - /* The following prevents loops occurrence when we change MEM in - CONST_DOUBLE onto the same CONST_DOUBLE. */ - if (x != NULL_RTX && GET_CODE (x) == CONST_DOUBLE) - return x; - - for (i = n_replacements - 1; i >= 0 ; i--) - if (x == replacements[i*2] && GET_MODE (x) == GET_MODE (replacements[i*2+1])) - return replacements[i*2+1]; - - /* Allow this function to make replacements in EXPR_LISTs. */ - if (x == NULL_RTX) - return NULL_RTX; - - if (GET_CODE (x) == SUBREG) - { - rtx new_rtx = replace_n_hard_rtx (SUBREG_REG (x), replacements, - n_replacements, modify); - - if (CONST_INT_P (new_rtx)) - { - x = simplify_subreg (GET_MODE (x), new_rtx, - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x)); - if (! x) - abort (); - } - else if (modify) - SUBREG_REG (x) = new_rtx; - - return x; - } - else if (REG_P (x)) - { - unsigned regno = REGNO (x); - unsigned nregs = (regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (regno, GET_MODE (x)) : 1); - rtx result = NULL_RTX; - - for (i = n_replacements - 1; i >= 0; i--) - { - rtx from = replacements[i*2]; - rtx to = replacements[i*2+1]; - unsigned from_regno, from_nregs, to_regno, new_regno; - - if (!REG_P (from)) - continue; - from_regno = REGNO (from); - from_nregs = (from_regno < FIRST_PSEUDO_REGISTER - ? HARD_REGNO_NREGS (from_regno, GET_MODE (from)) : 1); - if (regno < from_regno + from_nregs && regno + nregs > from_regno) - { - if (regno < from_regno - || regno + nregs > from_regno + nregs - || !REG_P (to) - || result) - return NULL_RTX; - to_regno = REGNO (to); - if (to_regno < FIRST_PSEUDO_REGISTER) - { - new_regno = regno + to_regno - from_regno; - if ((unsigned) HARD_REGNO_NREGS (new_regno, GET_MODE (x)) - != nregs) - return NULL_RTX; - result = gen_rtx_REG (GET_MODE (x), new_regno); - } - else if (GET_MODE (x) <= GET_MODE (to)) - result = gen_lowpart_common (GET_MODE (x), to); - else - result = gen_lowpart_SUBREG (GET_MODE (x), to); - } - } - return result ? result : x; - } - else if (GET_CODE (x) == ZERO_EXTEND) - { - rtx new_rtx = replace_n_hard_rtx (XEXP (x, 0), replacements, - n_replacements, modify); - - if (CONST_INT_P (new_rtx)) - { - x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x), - new_rtx, GET_MODE (XEXP (x, 0))); - if (! x) - abort (); - } - else if (modify) - XEXP (x, 0) = new_rtx; - - return x; - } - - fmt = GET_RTX_FORMAT (GET_CODE (x)); - for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) - { - rtx new_rtx; - - if (fmt[i] == 'e') - { - new_rtx = replace_n_hard_rtx (XEXP (x, i), replacements, - n_replacements, modify); - if (!new_rtx) - return NULL_RTX; - if (modify) - XEXP (x, i) = new_rtx; - } - else if (fmt[i] == 'E') - for (j = XVECLEN (x, i) - 1; j >= 0; j--) - { - new_rtx = replace_n_hard_rtx (XVECEXP (x, i, j), replacements, - n_replacements, modify); - if (!new_rtx) - return NULL_RTX; - if (modify) - XVECEXP (x, i, j) = new_rtx; - } - } - - return x; -} - rtx sh_gen_truncate (enum machine_mode mode, rtx x, int need_sign_ext) { diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index d957e55400b..a0688e63645 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -651,32 +651,6 @@ "tst #255,%0" [(set_attr "type" "mt_group")]) -;; This pattern might be risky because it also tests the upper bits and not -;; only the subreg. However, it seems that combine will get to this only -;; when testing sign/zero extended values. In this case the extended upper -;; bits do not matter. -(define_insn "*tst<mode>_t_zero" - [(set (reg:SI T_REG) - (eq:SI - (subreg:QIHI - (and:SI (match_operand:SI 0 "arith_reg_operand" "%r") - (match_operand:SI 1 "arith_reg_operand" "r")) <lowpart_le>) - (const_int 0)))] - "TARGET_SH1 && TARGET_LITTLE_ENDIAN" - "tst %0,%1" - [(set_attr "type" "mt_group")]) - -(define_insn "*tst<mode>_t_zero" - [(set (reg:SI T_REG) - (eq:SI - (subreg:QIHI - (and:SI (match_operand:SI 0 "arith_reg_operand" "%r") - (match_operand:SI 1 "arith_reg_operand" "r")) <lowpart_be>) - (const_int 0)))] - "TARGET_SH1 && TARGET_BIG_ENDIAN" - "tst %0,%1" - [(set_attr "type" "mt_group")]) - ;; Extract LSB, negate and store in T bit. (define_insn "tstsi_t_and_not" [(set (reg:SI T_REG) @@ -1545,78 +1519,6 @@ replace_rtx (operands[4], operands[0], operands[1]); }) -(define_peephole2 - [(set (match_operand 0 "any_register_operand" "") - (match_operand 1 "any_register_operand" "")) - (set (match_operand 2 "any_register_operand" "") (match_operand 3 "" "")) - (set (match_operand 4 "" "") (match_operand 5 "" ""))] - "(HARD_REGNO_NREGS (REGNO (operands[0]), GET_MODE (operands[2])) - <= HARD_REGNO_NREGS (REGNO (operands[0]), GET_MODE (operands[0]))) - && peep2_reg_dead_p (3, operands[0]) && peep2_reg_dead_p (3, operands[2]) - && ! FIND_REG_INC_NOTE (peep2_next_insn (2), operands[0]) - && ! FIND_REG_INC_NOTE (peep2_next_insn (2), operands[2]) - && ! reg_overlap_mentioned_p (operands[0], operands[3]) - && ! reg_overlap_mentioned_p (operands[2], operands[0]) - && ! reg_overlap_mentioned_p (operands[0], operands[1]) - && (REGNO_REG_CLASS (REGNO (operands[0])) - == REGNO_REG_CLASS (REGNO (operands[2]))) - && (REGNO_REG_CLASS (REGNO (operands[1])) - == REGNO_REG_CLASS (REGNO (operands[0])))" - [(set (match_dup 0) (match_dup 3)) - (set (match_dup 4) (match_dup 5))] -{ - rtx set1, set2, insn2; - rtx replacements[4]; - - /* We want to replace occurrences of operands[0] with operands[1] and - operands[2] with operands[0] in operands[4]/operands[5]. - Doing just two replace_rtx calls naively would result in the second - replacement undoing all that the first did if operands[1] and operands[2] - are identical, so we must do this simultaneously. */ - replacements[0] = operands[0]; - replacements[1] = operands[1]; - replacements[2] = operands[2]; - replacements[3] = operands[0]; - if (!replace_n_hard_rtx (operands[5], replacements, 2, 0) - || !replace_n_hard_rtx (operands[4], replacements, 2, 0) - || !replace_n_hard_rtx (operands[2], replacements, 2, 0)) - FAIL; - - operands[5] = replace_n_hard_rtx (operands[5], replacements, 2, 1); - replace_n_hard_rtx (operands[4], replacements, 2, 1); - operands[2] = replace_n_hard_rtx (operands[2], replacements, 2, 1); - /* The operands array is aliased to recog_data.operand, which gets - clobbered by extract_insn, so finish with it now. */ - set1 = gen_rtx_SET (VOIDmode, operands[2], operands[3]); - set2 = gen_rtx_SET (VOIDmode, operands[4], operands[5]); - /* ??? The last insn might be a jump insn, but the generic peephole2 code - always uses emit_insn. */ - /* Check that we don't violate matching constraints or earlyclobbers. */ - extract_insn (emit_insn (set1)); - if (! constrain_operands (1)) - goto failure; - insn2 = emit (set2); - if (GET_CODE (insn2) == BARRIER) - goto failure; - extract_insn (insn2); - if (! constrain_operands (1)) - { - rtx tmp; - failure: - tmp = replacements[0]; - replacements[0] = replacements[1]; - replacements[1] = tmp; - tmp = replacements[2]; - replacements[2] = replacements[3]; - replacements[3] = tmp; - replace_n_hard_rtx (SET_DEST (set1), replacements, 2, 1); - replace_n_hard_rtx (SET_DEST (set2), replacements, 2, 1); - replace_n_hard_rtx (SET_SRC (set2), replacements, 2, 1); - FAIL; - } - DONE; -}) - ;; The register allocator is rather clumsy in handling multi-way conditional ;; moves, so allow the combiner to make them, and we split them up after ;; reload. */ @@ -5847,7 +5749,7 @@ label: (define_insn "swapbsi2" [(set (match_operand:SI 0 "arith_reg_dest" "=r") (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "r") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) @@ -5915,7 +5817,7 @@ label: (define_peephole2 [(set (match_operand:SI 0 "arith_reg_dest" "") (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) @@ -5925,7 +5827,7 @@ label: "TARGET_SH1 && peep2_reg_dead_p (2, operands[0])" [(set (match_dup 2) (ior:SI (and:SI (match_operand:SI 1 "arith_reg_operand" "") - (const_int 4294901760)) + (const_int -65536)) ;; 0xFFFF0000 (ior:SI (and:SI (ashift:SI (match_dup 1) (const_int 8)) (const_int 65280)) (and:SI (ashiftrt:SI (match_dup 1) (const_int 8)) @@ -10236,10 +10138,25 @@ label: "" { rtx mem; + bool stack_chk_guard_p = false; operands[2] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); operands[3] = !can_create_pseudo_p () ? operands[0] : gen_reg_rtx (Pmode); + if (!TARGET_SHMEDIA + && flag_stack_protect + && GET_CODE (operands[1]) == CONST + && GET_CODE (XEXP (operands[1], 0)) == UNSPEC + && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF + && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0), + "__stack_chk_guard") == 0) + stack_chk_guard_p = true; + + /* Use R0 to avoid long R0 liveness which stack-protector tends to + produce. */ + if (stack_chk_guard_p && ! reload_in_progress && ! reload_completed) + operands[2] = gen_rtx_REG (Pmode, R0_REG); + if (TARGET_SHMEDIA) { rtx reg = operands[2]; @@ -10267,13 +10184,7 @@ label: insn to avoid combining (set A (plus rX r12)) and (set op0 (mem A)) when rX is a GOT address for the guard symbol. Ugly but doesn't matter because this is a rare situation. */ - if (!TARGET_SHMEDIA - && flag_stack_protect - && GET_CODE (operands[1]) == CONST - && GET_CODE (XEXP (operands[1], 0)) == UNSPEC - && GET_CODE (XVECEXP (XEXP (operands[1], 0), 0, 0)) == SYMBOL_REF - && strcmp (XSTR (XVECEXP (XEXP (operands[1], 0), 0, 0), 0), - "__stack_chk_guard") == 0) + if (stack_chk_guard_p) emit_insn (gen_chk_guard_add (operands[3], operands[2])); else emit_move_insn (operands[3], gen_rtx_PLUS (Pmode, operands[2], diff --git a/gcc/configure b/gcc/configure index cd5bc90abf0..836fc983c7f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -26141,6 +26141,38 @@ $as_echo "#define HAVE_AS_GNU_ATTRIBUTE 1" >>confdefs.h fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .module support" >&5 +$as_echo_n "checking assembler for .module support... " >&6; } +if test "${gcc_cv_as_mips_dot_module+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_mips_dot_module=no + if test x$gcc_cv_as != x; then + $as_echo '.module mips2 + .module fp=xx' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -32 -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_mips_dot_module=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mips_dot_module" >&5 +$as_echo "$gcc_cv_as_mips_dot_module" >&6; } +if test $gcc_cv_as_mips_dot_module = yes; then + +$as_echo "#define HAVE_AS_DOT_MODULE 1" >>confdefs.h + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for .micromips support" >&5 $as_echo_n "checking assembler for .micromips support... " >&6; } if test "${gcc_cv_as_micromips_support+set}" = set; then : diff --git a/gcc/configure.ac b/gcc/configure.ac index a9bd1132760..98144c60f1e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -4251,6 +4251,13 @@ LCF0: [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1, [Define if your assembler supports .gnu_attribute.])]) + gcc_GAS_CHECK_FEATURE([.module support], + gcc_cv_as_mips_dot_module,,[-32], + [.module mips2 + .module fp=xx],, + [AC_DEFINE(HAVE_AS_DOT_MODULE, 1, + [Define if your assembler supports .module.])]) + gcc_GAS_CHECK_FEATURE([.micromips support], gcc_cv_as_micromips_support,,[--fatal-warnings], [.set micromips],, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 83bf91d54bc..bdea7d5737e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,34 @@ +2015-03-04 Jason Merrill <jason@redhat.com> + + PR c++/65209 + PR c++/65309 + * decl2.c (constrain_visibility_for_template): Handle reference + arguments. + +2015-02-25 Jason Merrill <jason@redhat.com> + + PR c++/62255 + * pt.c (instantiate_decl): Handle recursive instantiation of + static data member. + + * decl.c (begin_destructor_body): Condition clobber on + -flifetime-dse. + +2015-02-13 Jason Merrill <jason@redhat.com> + + PR c++/62017 + * decl.c (begin_destructor_body): Only clobber the as-base part of + *this. + +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-02-04 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + PR c/64868 + * parser.c (cp_parser_omp_atomic): Handle RDIV_EXPR. + 2015-02-04 Ville Voutilainen <ville.voutilainen@gmail.com> PR c++/64901 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 4cc386e117f..b0bbf9e4fb2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13667,13 +13667,19 @@ begin_destructor_body (void) initialize_vtbl_ptrs (current_class_ptr); finish_compound_stmt (compound_stmt); - /* Insert a cleanup to let the back end know that the object is dead - when we exit the destructor, either normally or via exception. */ - tree clobber = build_constructor (current_class_type, NULL); - TREE_THIS_VOLATILE (clobber) = true; - tree exprstmt = build2 (MODIFY_EXPR, current_class_type, - current_class_ref, clobber); - finish_decl_cleanup (NULL_TREE, exprstmt); + if (flag_lifetime_dse) + { + /* Insert a cleanup to let the back end know that the object is dead + when we exit the destructor, either normally or via exception. */ + tree btype = CLASSTYPE_AS_BASE (current_class_type); + tree clobber = build_constructor (btype, NULL); + TREE_THIS_VOLATILE (clobber) = true; + tree bref = build_nop (build_reference_type (btype), + current_class_ptr); + bref = convert_from_reference (bref); + tree exprstmt = build2 (MODIFY_EXPR, btype, bref, clobber); + finish_decl_cleanup (NULL_TREE, exprstmt); + } /* And insert cleanups for our bases and members so that they will be properly destroyed if we throw. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 78c1124e277..808c94f2715 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2122,9 +2122,12 @@ constrain_visibility_for_template (tree decl, tree targs) tree arg = TREE_VEC_ELT (args, i-1); if (TYPE_P (arg)) vis = type_visibility (arg); - else if (TREE_TYPE (arg) && POINTER_TYPE_P (TREE_TYPE (arg))) + else { - STRIP_NOPS (arg); + if (REFERENCE_REF_P (arg)) + arg = TREE_OPERAND (arg, 0); + if (TREE_TYPE (arg)) + STRIP_NOPS (arg); if (TREE_CODE (arg) == ADDR_EXPR) arg = TREE_OPERAND (arg, 0); if (VAR_OR_FUNCTION_DECL_P (arg)) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 93f94d260c1..18c706846ba 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -28748,6 +28748,7 @@ restart: { case MULT_EXPR: case TRUNC_DIV_EXPR: + case RDIV_EXPR: case PLUS_EXPR: case MINUS_EXPR: case LSHIFT_EXPR: diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2abfc70ef6d..fc8300ae2a7 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -19794,13 +19794,18 @@ instantiate_decl (tree d, int defer_ok, args, tf_warning_or_error, NULL_TREE, /*integral_constant_expression_p=*/false); - /* Make sure the initializer is still constant, in case of - circular dependency (template/instantiate6.C). */ - const_init - = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (code_pattern); - cp_finish_decl (d, init, /*init_const_expr_p=*/const_init, - /*asmspec_tree=*/NULL_TREE, - LOOKUP_ONLYCONVERTING); + /* If instantiating the initializer involved instantiating this + again, don't call cp_finish_decl twice. */ + if (!DECL_INITIAL (d)) + { + /* Make sure the initializer is still constant, in case of + circular dependency (template/instantiate6.C). */ + const_init + = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (code_pattern); + cp_finish_decl (d, init, /*init_const_expr_p=*/const_init, + /*asmspec_tree=*/NULL_TREE, + LOOKUP_ONLYCONVERTING); + } pop_nested_class (); pop_nested_namespace (ns); } diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index e51a214efff..1a457da79ea 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3323,16 +3323,19 @@ this function attribute to make GCC generate the ``hot-patching'' function prologue used in Win32 API functions in Microsoft Windows XP Service Pack 2 and newer. -@item hotpatch [(@var{prologue-halfwords})] +@item hotpatch (@var{halfwords-before-function-label},@var{halfwords-after-function-label}) @cindex @code{hotpatch} attribute On S/390 System z targets, you can use this function attribute to -make GCC generate a ``hot-patching'' function prologue. The -@code{hotpatch} has no effect on funtions that are explicitly -inline. If the @option{-mhotpatch} or @option{-mno-hotpatch} -command-line option is used at the same time, the @code{hotpatch} -attribute takes precedence. If an argument is given, the maximum -allowed value is 1000000. +make GCC generate a ``hot-patching'' function prologue. If the +@option{-mhotpatch=} command-line option is used at the same time, +the @code{hotpatch} attribute takes precedence. The first of the +two arguments specifies the number of halfwords to be added before +the function label. A second argument can be used to specify the +number of halfwords to be added after the function label. For +both arguments the maximum allowed value is 1000000. + +If both ar guments are zero, hotpatching is disabled. @item naked @cindex function without a prologue/epilogue code diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index e0563416a22..9accb77d132 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 1988-2014 Free Software Foundation, Inc. +@c Copyright (C) 1988-2015 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -948,7 +948,7 @@ See RS/6000 and PowerPC Options. -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol --mhotpatch[=@var{halfwords}] -mno-hotpatch} +-mhotpatch=@var{halfwords},@var{halfwords}} @emph{Score Options} @gccoptlist{-meb -mel @gol @@ -7401,6 +7401,16 @@ registers after writing to their lower 32-bit half. Enabled for Alpha, AArch64 and x86 at levels @option{-O2}, @option{-O3}, @option{-Os}. +@item -fno-lifetime-dse +@opindex fno-lifetime-dse +In C++ the value of an object is only affected by changes within its +lifetime: when the constructor begins, the object has an indeterminate +value, and any changes during the lifetime of the object are dead when +the object is destroyed. Normally dead store elimination will take +advantage of this; if your code relies on the value of the object +storage persisting beyond the lifetime of the object, you can use this +flag to disable this optimization. + @item -flive-range-shrinkage @opindex flive-range-shrinkage Attempt to decrease register pressure through register live range @@ -18968,12 +18978,13 @@ Supported values for @var{cpu_type} are @samp{401}, @samp{403}, @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5}, @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8}, @samp{powerpc}, -@samp{powerpc64}, and @samp{rs64}. +@samp{powerpc64}, @samp{powerpc64le}, and @samp{rs64}. -@option{-mcpu=powerpc}, and @option{-mcpu=powerpc64} specify pure 32-bit -PowerPC and 64-bit PowerPC architecture machine -types, with an appropriate, generic processor model assumed for -scheduling purposes. +@option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and +@option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either +endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC +architecture machine types, with an appropriate, generic processor +model assumed for scheduling purposes. The other options specify a specific processor. Code generated under those options runs best on that processor, and may not run at all on @@ -20323,17 +20334,17 @@ In order to be efficient the extra code makes the assumption that the stack star at an address aligned to the value given by @var{stack-size}. The @var{stack-guard} option can only be used in conjunction with @var{stack-size}. -@item -mhotpatch[=@var{halfwords}] -@itemx -mno-hotpatch +@item -mhotpatch=@var{pre-halfwords},@var{post-halfwords} @opindex mhotpatch If the hotpatch option is enabled, a ``hot-patching'' function prologue is generated for all functions in the compilation unit. The funtion label is prepended with the given number of two-byte -Nop instructions (@var{halfwords}, maximum 1000000) or 12 Nop -instructions if no argument is present. Functions with a -hot-patching prologue are never inlined automatically, and a -hot-patching prologue is never generated for functions functions -that are explicitly inline. +Nop instructions (@var{pre-halfwords}, maximum 1000000). After +the label, 2 * @var{post-halfwords} bytes are appended, using the +larges nop like instructions the architecture allows (maximum +1000000). + +If both arguments are zero, hotpatching is disabled. This option can be overridden for individual functions with the @code{hotpatch} attribute. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 23319d0d17d..c7d7181baed 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19196,6 +19196,9 @@ gen_producer_string (void) case OPT__sysroot_: case OPT_nostdinc: case OPT_nostdinc__: + case OPT_fpreprocessed: + case OPT_fltrans_output_list_: + case OPT_fresolution_: /* Ignore these. */ continue; default: @@ -23984,8 +23987,13 @@ dwarf2out_finish (const char *filename) gen_remaining_tmpl_value_param_die_attribute (); /* Add the name for the main input file now. We delayed this from - dwarf2out_init to avoid complications with PCH. */ - add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); + dwarf2out_init to avoid complications with PCH. + For LTO produced units use a fixed artificial name to avoid + leaking tempfile names into the dwarf. */ + if (!in_lto_p) + add_name_attribute (comp_unit_die (), remap_debug_filename (filename)); + else + add_name_attribute (comp_unit_die (), "<artificial>"); if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir) add_comp_dir_attribute (comp_unit_die ()); else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f96427f411c..3658bc6c822 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10809,8 +10809,8 @@ fold_binary_loc (location_t loc, /* Don't introduce overflows through reassociation. */ if (!any_overflows - && ((lit0 && TREE_OVERFLOW (lit0)) - || (minus_lit0 && TREE_OVERFLOW (minus_lit0)))) + && ((lit0 && TREE_OVERFLOW_P (lit0)) + || (minus_lit0 && TREE_OVERFLOW_P (minus_lit0)))) return NULL_TREE; if (minus_lit0) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f9509e6665a..38f8b96c79b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,30 @@ +2015-03-10 Paul Thomas <pault@gcc.gnu.org> + + Backported from mainline + PR fortran/65024 + * trans-expr.c (gfc_conv_component_ref): If the component + backend declaration is missing and the derived type symbol is + available in the reference, call gfc_build_derived_type. + +2015-02-13 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/63744 + * module.c (check_for_ambiguous): Change argument type + from gfc_symbol to gfc_symtree. Check local (symtree) name + instead of original (symbol) name. + (read_module): Update caller. + +2015-02-12 Paul Thomas <pault@gcc.gnu.org> + + Backported from mainline + 2015-02-12 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/64932 + * trans-stmt.c (gfc_trans_deallocate): If a component array + expression is not a descriptor type and it is a derived type + that has allocatable components and is not finalizable, then + deallocate the allocatable components. + 2015-02-03 Steven G. Kargl <kargl@gcc.gnu.org> * intrinsic.texi (CO_ASSOCIATED): c_prt_1 should be c_ptr_1. diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index f50c5b74040..26c4552d8cf 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4849,19 +4849,21 @@ read_cleanup (pointer_info *p) /* It is not quite enough to check for ambiguity in the symbols by the loaded symbol and the new symbol not being identical. */ static bool -check_for_ambiguous (gfc_symbol *st_sym, pointer_info *info) +check_for_ambiguous (gfc_symtree *st, pointer_info *info) { gfc_symbol *rsym; module_locus locus; symbol_attribute attr; + gfc_symbol *st_sym; - if (gfc_current_ns->proc_name && st_sym->name == gfc_current_ns->proc_name->name) + if (gfc_current_ns->proc_name && st->name == gfc_current_ns->proc_name->name) { gfc_error ("'%s' of module '%s', imported at %C, is also the name of the " - "current program unit", st_sym->name, module_name); + "current program unit", st->name, module_name); return true; } + st_sym = st->n.sym; rsym = info->u.rsym.sym; if (st_sym == rsym) return false; @@ -5093,7 +5095,7 @@ read_module (void) if (st != NULL) { /* Check for ambiguous symbols. */ - if (check_for_ambiguous (st->n.sym, info)) + if (check_for_ambiguous (st, info)) st->ambiguous = 1; else info->u.rsym.symtree = st; diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 2b06304cb08..098bfdfec5b 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1657,10 +1657,12 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) c = ref->u.c.component; - gcc_assert (c->backend_decl); + if (c->backend_decl == NULL_TREE + && ref->u.c.sym != NULL) + gfc_get_derived_type (ref->u.c.sym); field = c->backend_decl; - gcc_assert (TREE_CODE (field) == FIELD_DECL); + gcc_assert (field && TREE_CODE (field) == FIELD_DECL); decl = se->expr; /* Components can correspond to fields of different containing diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 6d2db5ef70f..62a63d68fa6 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -5458,11 +5458,13 @@ gfc_trans_deallocate (gfc_code *code) if (expr->rank || gfc_is_coarray (expr)) { + gfc_ref *ref; + if (expr->ts.type == BT_DERIVED && expr->ts.u.derived->attr.alloc_comp && !gfc_is_finalizable (expr->ts.u.derived, NULL)) { - gfc_ref *ref; gfc_ref *last = NULL; + for (ref = expr->ref; ref; ref = ref->next) if (ref->type == REF_COMPONENT) last = ref; @@ -5473,13 +5475,45 @@ gfc_trans_deallocate (gfc_code *code) && !(!last && expr->symtree->n.sym->attr.pointer)) { tmp = gfc_deallocate_alloc_comp (expr->ts.u.derived, se.expr, - expr->rank); + expr->rank); gfc_add_expr_to_block (&se.pre, tmp); } } - tmp = gfc_array_deallocate (se.expr, pstat, errmsg, errlen, - label_finish, expr); - gfc_add_expr_to_block (&se.pre, tmp); + + if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se.expr))) + { + tmp = gfc_array_deallocate (se.expr, pstat, errmsg, errlen, + label_finish, expr); + gfc_add_expr_to_block (&se.pre, tmp); + } + else if (TREE_CODE (se.expr) == COMPONENT_REF + && TREE_CODE (TREE_TYPE (se.expr)) == ARRAY_TYPE + && TREE_CODE (TREE_TYPE (TREE_TYPE (se.expr))) + == RECORD_TYPE) + { + /* class.c(finalize_component) generates these, when a + finalizable entity has a non-allocatable derived type array + component, which has allocatable components. Obtain the + derived type of the array and deallocate the allocatable + components. */ + for (ref = expr->ref; ref; ref = ref->next) + { + if (ref->u.c.component->attr.dimension + && ref->u.c.component->ts.type == BT_DERIVED) + break; + } + + if (ref && ref->u.c.component->ts.u.derived->attr.alloc_comp + && !gfc_is_finalizable (ref->u.c.component->ts.u.derived, + NULL)) + { + tmp = gfc_deallocate_alloc_comp + (ref->u.c.component->ts.u.derived, + se.expr, expr->rank); + gfc_add_expr_to_block (&se.pre, tmp); + } + } + if (al->expr->ts.type == BT_CLASS) gfc_reset_vptr (&se.pre, al->expr); } diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 6b5df1a611c..2a022dee666 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -135,8 +135,12 @@ tree_is_indexable (tree t) /* Parameters and return values of functions of variably modified types must go to global stream, because they may be used in the type definition. */ - if (TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) + if ((TREE_CODE (t) == PARM_DECL || TREE_CODE (t) == RESULT_DECL) + && DECL_CONTEXT (t)) return variably_modified_type_p (TREE_TYPE (DECL_CONTEXT (t)), NULL_TREE); + /* IMPORTED_DECL is put into BLOCK and thus it never can be shared. */ + else if (TREE_CODE (t) == IMPORTED_DECL) + return false; else if (((TREE_CODE (t) == VAR_DECL && !TREE_STATIC (t)) || TREE_CODE (t) == TYPE_DECL || TREE_CODE (t) == CONST_DECL diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 4b9c827eea9..f4222a8d97a 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1483,7 +1483,8 @@ fixup_child_record_type (omp_context *ctx) layout_type (type); } - TREE_TYPE (ctx->receiver_decl) = build_pointer_type (type); + TREE_TYPE (ctx->receiver_decl) + = build_qualified_type (build_reference_type (type), TYPE_QUAL_RESTRICT); } /* Instantiate decls as necessary in CTX to satisfy the data sharing diff --git a/gcc/symtab.c b/gcc/symtab.c index 288821d58ab..a4c7da9ef89 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -969,6 +969,7 @@ symtab_make_decl_local (tree decl) DECL_VISIBILITY_SPECIFIED (decl) = 0; DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT; TREE_PUBLIC (decl) = 0; + DECL_DLLIMPORT_P (decl) = 0; if (!DECL_RTL_SET_P (decl)) return; @@ -1222,6 +1223,7 @@ symtab_nonoverwritable_alias (symtab_node *node) /* Otherwise create a new one. */ new_decl = copy_node (node->decl); + DECL_DLLIMPORT_P (new_decl) = 0; DECL_NAME (new_decl) = clone_function_name (node->decl, "localalias"); if (TREE_CODE (new_decl) == FUNCTION_DECL) DECL_STRUCT_FUNCTION (new_decl) = NULL; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1c6a7803dc3..a25355ad0fa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,345 @@ +2015-03-10 Paul Thomas <pault@gcc.gnu.org> + + Backported from mainline + PR fortran/65024 + * gfortran.dg/unlimited_polymorphic_23.f90: New test + +2015-03-10 Martin Sebor <msebor@redhat.com> + + PR testsuite/63175 + * gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c (main1): Move + checking of results into main to prevent it from getting optimized + away. + * gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c: New test. + +2015-03-10 Yvan Roux <yvan.roux@linaro.org> + + Backport from trunk r220489. + 2015-02-06 Jakub Jelinek <jakub@redhat.com> + + PR ipa/64896 + * g++.dg/ipa/pr64896.C: New test + +2015-03-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/53988 + * gcc.target/sh/pr53988.c: Mark tests as xfail. + +2015-03-06 Eric Botcazou <ebotcazou@adacore.com> + + * g++.dg/other/dump-ada-spec-3.C: Remove include and adjust. + +2015-03-05 Eric Botcazou <ebotcazou@adacore.com> + + * g++.dg/other/dump-ada-spec-3.C: New test. + +2015-03-04 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2014-11-27 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR target/59593 + * gcc.target/arm/constant-pool.c: New test. + +2015-03-03 Georg-Johann Lay <avr@gjlay.de> + + PR target/64331 + * gcc.target/avr/torture/pr64331.c: New test. + +2015-03-03 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2015-01-14 Thomas Preud'homme <thomas.preudhomme@arm.com> + + PR target/64453 + * gcc.target/arm/pr64453.c: New. + +2015-02-27 Pat Haugen <pthaugen@us.ibm.com> + + * gcc.dg/vect/pr59354.c: Move vector producing code to separate function. + +2015-02-27 Marek Polacek <polacek@redhat.com> + + Backported from mainline + 2015-02-27 Marek Polacek <polacek@redhat.com> + + PR c/65228 + * gcc.dg/pr65228.c: New test. + +2015-02-27 Richard Biener <rguenther@suse.de> + + PR lto/65193 + * g++.dg/lto/pr65193_0.C: New testcase. + +2015-02-26 Peter Bergner <bergner@vnet.ibm.com> + + Backport from mainline + 2015-02-25 Peter Bergner <bergner@vnet.ibm.com> + + * gcc.target/powerpc/htm-builtin-1.c (dg-do) Change to assemble. + (dg-options): Add -save-temps. + (dg-final): Add cleanup-saved-temps. + + 2015-02-25 Adhemerval Zanella <azanella@linux.vnet.ibm.com> + + * gcc.target/powerpc/htm-builtin-1.c: Fix tcheck expect value. + +2015-02-25 Kai Tietz <ktietz@redhat.com> + + Backported from mainline + PR tree-optimization/61917 + * gcc.dg/vect/vect-pr61917.c: New file. + +2015-02-23 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2015-02-23 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/65163 + * gcc.c-torture/compile/pr65163.c: New. + +2015-02-23 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-11-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/61634 + * gcc.dg/vect/pr61634.c: New testcase. + + 2015-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/59354 + * gcc.dg/vect/pr59354.c: New testcase. + + 2015-02-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64909 + * gcc.dg/vect/costmodel/x86_64/costmodel-pr64909.c: New testcase. + +2015-02-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + Backport from mainline + 2015-02-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + * gcc.target/s390/hotpatch-1.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-10.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-11.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-12.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-13.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-14.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-15.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-16.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-17.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-18.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-19.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-2.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-20.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-3.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-4.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-5.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-6.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-7.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-8.c: Remove --save-temps option. + * gcc.target/s390/hotpatch-9.c: Remove --save-temps option. + * gcc.target/s390/htm-nofloat-1.c: Cleanup --save-temps files. + +2015-02-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + + Backport from mainline + 2015-02-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com> + * gcc.target/s390/hotpatch-8.c: Add -march=g5. + * gcc.target/s390/hotpatch-9.c: Add -march=g5. + * gcc.target/s390/hotpatch-compile-1.c: Fix error message. + * gcc.target/s390/hotpatch-compile-10.c: Likewise. + * gcc.target/s390/hotpatch-compile-11.c: Likewise. + * gcc.target/s390/hotpatch-compile-12.c: Likewise. + * gcc.target/s390/hotpatch-compile-13.c: Likewise. + * gcc.target/s390/hotpatch-compile-14.c: Likewise. + * gcc.target/s390/hotpatch-compile-2.c: Likewise. + * gcc.target/s390/hotpatch-compile-3.c: Likewise. + * gcc.target/s390/hotpatch-compile-4.c: Likewise. + * gcc.target/s390/hotpatch-compile-5.c: Likewise. + * gcc.target/s390/hotpatch-compile-6.c: Likewise. + * gcc.target/s390/hotpatch-compile-7.c: Likewise. + * gcc.target/s390/hotpatch-compile-8.c: Likewise. + * gcc.target/s390/hotpatch-compile-9.c: Likewise. + +2015-02-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2015-02-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/aarch64/sisd-shft-neg_1.c: New test. + +2015-02-20 Georg-Johann Lay <avr@gjlay.de> + + Backport from 2015-02-20 trunk r220847. + + PR target/64452 + * gcc.target/avr/torture/pr64452.c: New test. + +2015-02-20 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-01-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64530 + * gfortran.dg/pr64530.f90: New testcase. + + 2015-02-13 Richard Biener <rguenther@suse.de> + + PR lto/64373 + * gcc.dg/lto/pr64373_0.c: New testcase. + + 2015-02-16 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63593 + * gcc.dg/pr63593.c: New testcase. + + 2015-02-18 Richard Biener <rguenther@suse.de> + + PR tree-optimization/65063 + * gcc.dg/pr65063.c: New testcase. + +2015-02-19 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-12-09 Richard Biener <rguenther@suse.de> + + PR middle-end/64199 + * gcc.dg/torture/pr64199.c: New testcase. + + 2015-01-14 Richard Biener <rguenther@suse.de> + + PR tree-optimization/64493 + PR tree-optimization/64495 + * gcc.dg/vect/pr64493.c: New testcase. + * gcc.dg/vect/pr64495.c: Likewise. + + 2015-01-27 Richard Biener <rguenther@suse.de> + + PR tree-optimization/56273 + PR tree-optimization/59124 + PR tree-optimization/64277 + * g++.dg/warn/Warray-bounds-6.C: New testcase. + * gcc.dg/Warray-bounds-12.c: Likewise. + * gcc.dg/Warray-bounds-13.c: Likewise. + + 2015-02-19 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2015-01-15 Richard Biener <rguenther@suse.de> + + PR middle-end/64365 + * gcc.dg/torture/pr64365.c: New testcase. + +2015-02-19 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + Revert: + + 2015-02-19 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + Backport from mainline + 2015-02-19 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * lib/target-supports.exp (check_compile): Save/restore + additional_sources that may belong to an actual test. + +2015-02-19 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + Backport from mainline + 2015-02-19 Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> + + * lib/target-supports.exp (check_compile): Save/restore + additional_sources that may belong to an actual test. + +2015-02-17 Sandra Loosemore <sandra@codesourcery.com> + + Backported from mainline + 2015-02-17 Sandra Loosemore <sandra@codesourcery.com> + + * gcc.target/arm/divzero.c: New test case. + +2015-02-17 Ilya Tocar <ilya.tocar@intel.com> + + Backport from mainline + 2015-01-14 Ilya Tocar <ilya.tocar@intel.com> + + PR target/64387 + * gcc.target/i386/pr64387.c: New test. + +2015-02-13 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/63744 + gfortran.dg/use_rename_8.f90: New. + +2015-02-12 Paul Thomas <pault@gcc.gnu.org> + + Backported from mainline + 2015-02-12 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/64932 + * gfortran.dg/finalize_28.f90: New test + +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-02-09 Jakub Jelinek <jakub@redhat.com> + + PR target/64979 + * gcc.dg/tree-ssa/stdarg-7.c: New test. + * gcc.c-torture/execute/pr64979.c: New test. + +2015-02-11 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-07-24 Marek Polacek <polacek@redhat.com> + + PR c/57653 + * c-c++-common/pr57653.c: New test. + * c-c++-common/pr57653.h: New file. + * c-c++-common/pr57653-2.c: New test. + * c-c++-common/pr57653-2.h: New file. + +2015-02-09 Dominik Vogt <vogt@linux.vnet.ibm.com> + + * gcc/testsuite/gcc.target/s390/hotpatch-13.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-14.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-15.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-16.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-17.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-18.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-19.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-20.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-10.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-11.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-12.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-13.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-14.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-15.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-16.c: New testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-9.c: New + testcase. + * gcc/testsuite/gcc.target/s390/hotpatch-1.c: Testcase adjusted to + new -mhotpatch. + * gcc/testsuite/gcc.target/s390/hotpatch-10.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-11.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-12.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-2.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-3.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-4.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-5.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-6.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-7.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-8.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-9.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c: Likewise. + * gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c: Likewise. + 2015-02-04 Matthias Klose <doko@ubuntu.com> Backport from mainline diff --git a/gcc/testsuite/c-c++-common/pr57653-2.c b/gcc/testsuite/c-c++-common/pr57653-2.c new file mode 100644 index 00000000000..086f6be5ce1 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653-2.c @@ -0,0 +1,4 @@ +/* { dg-do preprocess } */ +/* { dg-options "-imacros ${srcdir}/c-c++-common/pr57653-2.h" } */ + +/* Empty. */ diff --git a/gcc/testsuite/c-c++-common/pr57653-2.h b/gcc/testsuite/c-c++-common/pr57653-2.h new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653-2.h @@ -0,0 +1 @@ + diff --git a/gcc/testsuite/c-c++-common/pr57653.c b/gcc/testsuite/c-c++-common/pr57653.c new file mode 100644 index 00000000000..620471e2419 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-imacros ${srcdir}/c-c++-common/pr57653.h" } */ + +__attribute__((used)) static const char s[] = F; + +/* { dg-final { scan-assembler-not "command-line" } } */ diff --git a/gcc/testsuite/c-c++-common/pr57653.h b/gcc/testsuite/c-c++-common/pr57653.h new file mode 100644 index 00000000000..5a93388e9fd --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr57653.h @@ -0,0 +1 @@ +#define F __FILE__ diff --git a/gcc/testsuite/g++.dg/abi/anon4.C b/gcc/testsuite/g++.dg/abi/anon4.C new file mode 100644 index 00000000000..088ba994019 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/anon4.C @@ -0,0 +1,41 @@ +// PR c++/65209 +// { dg-final { scan-assembler-not "comdat" } } + +// Everything involving the anonymous namespace bits should be private, not +// COMDAT. + +struct Bar +{ + static Bar *self(); + char pad[24]; +}; + +template <Bar *(&holderFunction)()> +struct BarGlobalStatic +{ + Bar *operator()() { return holderFunction(); } +}; + +namespace { + namespace Q_QGS_s_self { + inline Bar *innerFunction() { + static struct Holder { + Bar value; + ~Holder() {} + } holder; + return &holder.value; + } + } +} +static BarGlobalStatic<Q_QGS_s_self::innerFunction> s_self; + +Bar *Bar::self() +{ + return s_self(); +} + +int main(int argc, char *argv[]) +{ + Bar* bar = Bar::self(); + return 0; +} diff --git a/gcc/testsuite/g++.dg/ipa/pr64896.C b/gcc/testsuite/g++.dg/ipa/pr64896.C new file mode 100644 index 00000000000..0a78220be8a --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr64896.C @@ -0,0 +1,29 @@ +// PR ipa/64896 +// { dg-do compile } +// { dg-options "-O2" } + +struct A { int a, b; }; +struct B { A c; int d; }; +struct C { virtual B fn1 () const; }; +struct D { B fn2 () const; int fn3 () const; C *fn4 () const; }; + +int +D::fn3 () const +{ + fn4 ()->fn1 (); +} + +B +D::fn2 () const +{ + return B (); +} + +class F : C +{ + B + fn1 () const + { + return B (); + } +}; diff --git a/gcc/testsuite/g++.dg/lto/pr65193_0.C b/gcc/testsuite/g++.dg/lto/pr65193_0.C new file mode 100644 index 00000000000..d778fcabb7f --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr65193_0.C @@ -0,0 +1,71 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target fpic } */ +/* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g}} } */ + +void frexp (int, int *); +namespace std +{ + int ldexp (int, int); + struct A + { + }; + template <class T> T get_min_shift_value (); + template <class> struct min_shift_initializer + { + struct B + { + B () { get_min_shift_value<long double> (); } + } static const b; + static void + m_fn1 () + { + b; + } + }; + template <class T> + const typename min_shift_initializer<T>::B min_shift_initializer<T>::b; + template <class T> + inline T + get_min_shift_value () + { + using std::ldexp; + static T c = ldexp (0, 0); + min_shift_initializer<T>::m_fn1; + } + template <class T, class Policy> + void + float_next_imp (T p1, Policy p2) + { + using std::ldexp; + int d; + float_next (0, p2); + frexp (p1, &d); + } + template <class T, class Policy> + int + float_next (const T &p1, Policy &p2) + { + float_next_imp (p1, p2); + } + template <class T, class Policy> void float_prior_imp (T, Policy) + { + get_min_shift_value<T> (); + } + template <class T, class Policy> int float_prior (T, Policy) + { + float_prior_imp (static_cast<T> (0), 0); + } + template <class T, class U, class Policy> + void + nextafter (T p1, U p2, Policy p3) + { + p2 ? float_next (0, p3) : float_prior (p1, 0); + } + long double e; + int f; + void + nextafter () + { + nextafter (e, f, A ()); + } +} diff --git a/gcc/testsuite/g++.dg/opt/flifetime-dse1.C b/gcc/testsuite/g++.dg/opt/flifetime-dse1.C new file mode 100644 index 00000000000..733d28a794f --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/flifetime-dse1.C @@ -0,0 +1,23 @@ +// { dg-options "-O3 -fno-lifetime-dse" } +// { dg-do run } + +typedef __SIZE_TYPE__ size_t; +inline void * operator new (size_t, void *p) { return p; } + +struct A +{ + int i; + A() {} + ~A() {} +}; + +int main() +{ + int ar[1]; + + A* ap = new(ar) A; + ap->i = 42; + ap->~A(); + + if (ar[0] != 42) __builtin_abort(); +} diff --git a/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C b/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C new file mode 100644 index 00000000000..ae4985cb594 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/dump-ada-spec-3.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-ada-spec" } */ + +using namespace std; + +class Base { + public: + int My_V; + virtual void Primitive (); + + Base (); +}; + +void Base::Primitive () { +} + +Base::Base () { +} + +void Dispatch (Base * B) { + B->Primitive (); +} + +/* { dg-final { cleanup-ada-spec } } */ diff --git a/gcc/testsuite/g++.dg/template/recurse4.C b/gcc/testsuite/g++.dg/template/recurse4.C new file mode 100644 index 00000000000..ee8d1b70df9 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/recurse4.C @@ -0,0 +1,18 @@ +// PR c++/62255 + +// It's not clear whether this is well-formed; instantiating the +// initializer of 'value' causes the instantiation of Derived, which in +// turn requires the value of 'value', but the recursion ends there, so it +// seems reasonable to allow it. + +template <typename T> struct Test { + template<typename X> static int check(typename X::Type*); + template<typename> static char check(...); + static const bool value = (sizeof(check<T>(0)) == sizeof(int)); +}; +template <int> struct Sink { }; +template <typename T> struct Derived : Sink<Test<Derived<T> >::value> { + typedef int Type; +}; + +Sink<Test<Derived<int> >::value> s; diff --git a/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C b/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C new file mode 100644 index 00000000000..f2e5f2f597a --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-O3 -Warray-bounds" } + +struct type { + bool a, b; + bool get_b() { return b; } +}; + +type stuff[9u]; + +void bar(); + +void foo() +{ + for(unsigned i = 0u; i < 9u; i++) + { + if(!stuff[i].a) + continue; + + bar(); + + for(unsigned j = i + 1u; j < 9u; j++) + if(stuff[j].a && stuff[j].get_b()) // { dg-bogus "above array bounds" } + return; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65163.c b/gcc/testsuite/gcc.c-torture/compile/pr65163.c new file mode 100644 index 00000000000..3a6b2880e31 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr65163.c @@ -0,0 +1,22 @@ +/* PR target/65163 */ + +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +union unaligned_32 { uint32_t l; } __attribute__((packed)); +union unaligned_16 { uint16_t l; } __attribute__((packed)); + +int +test_00 (unsigned char* buf, int bits_per_component) +{ + (((union unaligned_32*)(buf))->l) = + __builtin_bswap32 (bits_per_component == 10 ? 1 : 0); + return 0; +} + +int +test_01 (unsigned char* buf, int bits_per_component) +{ + (((union unaligned_16*)(buf))->l) = + __builtin_bswap16 (bits_per_component == 10 ? 1 : 0); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr64979.c b/gcc/testsuite/gcc.c-torture/execute/pr64979.c new file mode 100644 index 00000000000..ccb46087e02 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr64979.c @@ -0,0 +1,36 @@ +/* PR target/64979 */ + +#include <stdarg.h> + +void __attribute__((noinline, noclone)) +bar (int x, va_list *ap) +{ + if (ap) + { + int i; + for (i = 0; i < 10; i++) + if (i != va_arg (*ap, int)) + __builtin_abort (); + if (va_arg (*ap, double) != 0.5) + __builtin_abort (); + } +} + +void __attribute__((noinline, noclone)) +foo (int x, ...) +{ + va_list ap; + int n; + + va_start (ap, x); + n = va_arg (ap, int); + bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap)); + va_end (ap); +} + +int +main () +{ + foo (100, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0.5); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-12.c b/gcc/testsuite/gcc.dg/Warray-bounds-12.c new file mode 100644 index 00000000000..ef26c6596bf --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-12.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -Warray-bounds" } */ +/* { dg-additional-options "-mssse3" { target x86_64-*-* i?86-*-* } } */ + +void foo(short a[], short m) +{ + int i, j; + int f1[10]; + short nc; + + nc = m + 1; + if (nc > 3) + { + for (i = 0; i <= nc; i++) + { + f1[i] = f1[i] + 1; + } + } + + for (i = 0, j = m; i < nc; i++, j--) + { + a[i] = f1[i]; /* { dg-bogus "above array bounds" } */ + a[j] = i; + } + return; +} diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-13.c b/gcc/testsuite/gcc.dg/Warray-bounds-13.c new file mode 100644 index 00000000000..7b40a83887d --- /dev/null +++ b/gcc/testsuite/gcc.dg/Warray-bounds-13.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -Warray-bounds" } */ + +extern char *bar[17]; + +int foo(int argc, char **argv) +{ + int i; + int n = 0; + + for (i = 0; i < argc; i++) + n++; + + for (i = 0; i < argc; i++) + argv[i] = bar[i + n]; /* { dg-bogus "above array bounds" } */ + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr64373_0.c b/gcc/testsuite/gcc.dg/lto/pr64373_0.c new file mode 100644 index 00000000000..b4f3fdf1863 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr64373_0.c @@ -0,0 +1,10 @@ +/* { dg-lto-do assemble } */ + +extern void b(int L, float (*data)[L]); + +void a(void) +{ + float* p = 0; + int i = 0; + b(10, (float (*)[10])(p + i)); +} diff --git a/gcc/testsuite/gcc.dg/pr63593.c b/gcc/testsuite/gcc.dg/pr63593.c new file mode 100644 index 00000000000..08bc8f976d2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63593.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fno-tree-vectorize" } */ + +int in[2 * 4][4]; +int out[4]; + +void +foo (void) +{ + int sum; + int i, j, k; + for (k = 0; k < 4; k++) + { + sum = 1; + for (j = 0; j < 4; j++) + for (i = 0; i < 4; i++) + sum *= in[i + k][j]; + out[k] = sum; + } +} diff --git a/gcc/testsuite/gcc.dg/pr65063.c b/gcc/testsuite/gcc.dg/pr65063.c new file mode 100644 index 00000000000..bcbdbf098d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65063.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-loop-ivcanon -fno-tree-vectorize" } */ + +static int in[8][4]; +static int out[4]; +static const int check_result[] = {0, 16, 256, 4096}; + +static inline void foo () +{ + int sum; + int i, j, k; + for (k = 0; k < 4; k++) + { + sum = 1; + for (j = 0; j < 4; j++) + for (i = 0; i < 4; i++) + sum *= in[i + k][j]; + out[k] = sum; + } +} + +int main () +{ + int i, j, k; + for (i = 0; i < 8; i++) + for (j = 0; j < 4; j++) + in[i][j] = (i + 2) / 3; + foo (); + for (k = 0; k < 4; k++) + if (out[k] != check_result[k]) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr65228.c b/gcc/testsuite/gcc.dg/pr65228.c new file mode 100644 index 00000000000..fd8323876c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65228.c @@ -0,0 +1,11 @@ +/* PR c/65228 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +__auto_type a = b; /* { dg-error "undeclared" } */ + +void +f (void) +{ + __auto_type c = d; /* { dg-error "undeclared" } */ +} diff --git a/gcc/testsuite/gcc.dg/torture/pr64199.c b/gcc/testsuite/gcc.dg/torture/pr64199.c new file mode 100644 index 00000000000..e3f1002f1bd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr64199.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ffast-math -frounding-math" } */ + +float +foo (void) +{ + return 1.1f + 2.2f + 2.2f; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr64365.c b/gcc/testsuite/gcc.dg/torture/pr64365.c new file mode 100644 index 00000000000..169993e6df0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr64365.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +extern void abort (void); +extern int memcmp (const void * , const void *, __SIZE_TYPE__); + +void __attribute__((noinline,noclone)) +foo(int *in) +{ + int i; + for (i = 62; i >= 10; i--) + { + in[i - 8] -= in[i]; + in[i - 5] += in[i] * 2; + in[i - 4] += in[i]; + } +} + +int main() +{ + int x[64]; + int y[64] = { 0, 1, -2380134, -1065336, -1026376, 3264240, 3113534, 2328130, 3632054, 3839634, 2380136, 1065339, 1026380, 1496037, 1397286, 789976, 386408, 450984, 597112, 497464, 262008, 149184, 194768, 231519, 173984, 87753, 60712, 82042, 87502, 60014, 30050, 25550, 33570, 32386, 20464, 10675, 10868, 13329, 11794, 6892, 3988, 4564, 5148, 4228, 2284, 1568, 1848, 1943, 1472, 741, 628, 702, 714, 474, 230, 234, 238, 242, 120, 59, 60, 61, 62, 63 }; + int i; + + for (i = 0; i < 64; ++i) + { + x[i] = i; + __asm__ volatile (""); + } + + foo (x); + + if (memcmp (x, y, sizeof (x)) != 0) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/stdarg-7.c b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-7.c new file mode 100644 index 00000000000..9b497c07270 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/stdarg-7.c @@ -0,0 +1,22 @@ +/* PR target/64979 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-stdarg" } */ + +#include <stdarg.h> + +void bar (int x, va_list *ap); + +void +foo (int x, ...) +{ + va_list ap; + int n; + + va_start (ap, x); + n = va_arg (ap, int); + bar (x, (va_list *) ((n == 0) ? ((void *) 0) : &ap)); + va_end (ap); +} + +/* { dg-final { scan-tree-dump "foo: va_list escapes 1, needs to save all GPR units and all FPR units" "stdarg" } } */ +/* { dg-final { cleanup-tree-dump "stdarg" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c new file mode 100644 index 00000000000..73c0afa02dc --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c @@ -0,0 +1,30 @@ +/* { dg-require-effective-target vect_int } */ +/* { dg-do compile } */ + +#define N 16 + +const unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +unsigned int out[N]; + +__attribute__ ((noinline)) int +main1 (void) +{ + const unsigned int *pin = &in[1]; + unsigned int *pout = &out[0]; + + /* Misaligned load. */ + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + *pout++ = *pin++; + + return 0; +} + +/* Verify that the assembly contains vector instructions alone + with no word loads (lw, lwu, lwz, lwzu, or their indexed forms) + or word stores (stw, stwu, stwx, stwux, or their indexed forms). */ + +/* { dg-final { scan-assembler "\t\(lxv|lvsr|stxv\)" } } */ +/* { dg-final { scan-assembler-not "\tlwz?u?x? " } } */ +/* { dg-final { scan-assembler-not "\tstwu?x? " } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c index 4e8d71b9673..a092bcd54f0 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a.c @@ -1,6 +1,5 @@ /* { dg-require-effective-target vect_int } */ -#include <stdarg.h> #include "../../tree-vect.h" #define N 16 @@ -9,12 +8,10 @@ unsigned int out[N]; unsigned int in[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; __attribute__ ((noinline)) int -main1 (unsigned int x, unsigned int y) +main1 (void) { - int i; unsigned int *pin = &in[1]; unsigned int *pout = &out[0]; - unsigned int a0, a1, a2, a3; /* Misaligned load. */ *pout++ = *pin++; @@ -22,13 +19,6 @@ main1 (unsigned int x, unsigned int y) *pout++ = *pin++; *pout++ = *pin++; - /* Check results. */ - if (out[0] != in[1] - || out[1] != in[2] - || out[2] != in[3] - || out[3] != in[4]) - abort(); - return 0; } @@ -36,11 +26,18 @@ int main (void) { check_vect (); - main1 (2, 3); + main1 (); + + /* Check results. */ + if (out[0] != in[1] + || out[1] != in[2] + || out[2] != in[3] + || out[3] != in[4]) + abort(); return 0; } -/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { xfail vect_no_align } } } */ +/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "slp" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr64909.c b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr64909.c new file mode 100644 index 00000000000..0f9feac6a33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/costmodel/x86_64/costmodel-pr64909.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ +/* { dg-additional-options "-mtune=bdver1" } */ + +unsigned short a[32]; +unsigned int b[32]; +void t() +{ + int i; + for (i=0;i<12;i++) + b[i]=a[i]; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr59354.c b/gcc/testsuite/gcc.dg/vect/pr59354.c new file mode 100644 index 00000000000..309ad3c73f6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr59354.c @@ -0,0 +1,41 @@ +/* { dg-do run } */ +/* { dg-additional-options "-O3" } */ + +#include "tree-vect.h" + +void abort (void); + +unsigned int a[256]; +unsigned char b[256]; + +__attribute__ ((noinline)) void +main1() +{ + int i, z, x, y; + + for(i = 0; i < 256; i++) + { + a[i] = i % 5; + __asm__ volatile (""); + } + + for (z = 0; z < 16; z++) + for (y = 0; y < 4; y++) + for (x = 0; x < 4; x++) + b[y*64 + z*4 + x] = a[z*16 + y*4 + x]; + + if (b[4] != 1) + abort (); +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loop" "vect" { target { vect_pack_trunc } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr61634.c b/gcc/testsuite/gcc.dg/vect/pr61634.c new file mode 100644 index 00000000000..80b2c3a2546 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr61634.c @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +int a, b, c, d; +short *e; +void fn1 (int p1[], int p2, int p3[], int p4[], int p5[], int *p6) +{ + int f; + c = *p1; + d = *p5; + (void)p6; + for (; a; a--) + { + f = *e >> 2; + *e++ = f; + b += f * f; + f = *e >> 2; + *e++ = f; + } + p4[0] = p3[0]; + for (;; p2--) + ; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr64493.c b/gcc/testsuite/gcc.dg/vect/pr64493.c new file mode 100644 index 00000000000..a7dee4d66eb --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr64493.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ + +#include "tree-vect.h" + +int a, b, c, d, e, f, g, h; + +int +main () +{ + check_vect (); + + for (; a; a--) + for (d = 1; d <= 0; d++) + for (; d;) + if (h) + { + if (!g) __builtin_abort (); + if (!0) __builtin_abort (); + } + + for (f = 4; f; f--) + { + for (b = 0; b < 2; b++) + c |= 1; + e |= c; + } + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr64495.c b/gcc/testsuite/gcc.dg/vect/pr64495.c new file mode 100644 index 00000000000..aad87526ee5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr64495.c @@ -0,0 +1,35 @@ +/* { dg-do run } */ + +#include <assert.h> +#include "tree-vect.h" + +int a, b, c, d, e, f, g, i, j; +static int *h = &e; + +int +main () +{ + check_vect (); + + for (; a;) + for (; g; g++) + for (; f; f++) + if (j) + { + assert(b); + assert(0); + } + for (i = 24; i; i--) + { + for (c = 0; c < 6; c++) + d |= 1; + *h |= d; + } + + if (e != 1) + __builtin_abort (); + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-pr61917.c b/gcc/testsuite/gcc.dg/vect/vect-pr61917.c new file mode 100644 index 00000000000..c55c6206ab0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-pr61917.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O3" } */ + +int a, b, c, d; + +int +fn1 () +{ + for (; c; c++) + for (b = 0; b < 2; b++) + d = a - d; + return d; +} diff --git a/gcc/testsuite/gcc.target/arm/constant-pool.c b/gcc/testsuite/gcc.target/arm/constant-pool.c new file mode 100644 index 00000000000..8427dfb1a80 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/constant-pool.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +unsigned short v = 0x5678; +int i; +int j = 0; +int *ptr = &j; + +int +func (void) +{ + for (i = 0; i < 1; ++i) + { + *ptr = -1; + v = 0x1234; + } + return v; +} + +int +main (void) +{ + func (); + if (v != 0x1234) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/divzero.c b/gcc/testsuite/gcc.target/arm/divzero.c new file mode 100644 index 00000000000..7d398a5683b --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/divzero.c @@ -0,0 +1,85 @@ +/* { dg-require-effective-target arm_eabi } */ +/* { dg-options "" } */ +/* { dg-do run } */ + +/* Check that long long divmod functions pass the right argument to + __aeabi_ldiv0 on divide by zero. */ + +#ifdef DEBUGME +#include <stdio.h> +#else +extern void abort (void); +#endif + +/* Override div zero handler and simply return the provided value. */ +long long __aeabi_ldiv0 (long long r) +{ + return r; +} + +long long lldiv (long long a, long long b) +{ + return a / b; +} + +unsigned long long ulldiv (unsigned long long a, unsigned long long b) +{ + return a / b; +} + +void check (long long num, long long expected) +{ + long long res = lldiv (num, 0LL); + if (res != expected) +#ifdef DEBUGME + { + printf ("num=%08X:%08X\n", (unsigned)(num >> 32), (unsigned)num); + printf ("res=%08X:%08X\n", (unsigned)(res >> 32), (unsigned)res); + } +#else + abort (); +#endif +} + +void ucheck (unsigned long long num, unsigned long long expected) +{ + unsigned long long res = ulldiv (num, 0ULL); + if (res != expected) +#ifdef DEBUGME + { + printf ("num=%08X:%08X\n", (unsigned)(num >> 32), (unsigned)num); + printf ("res=%08X:%08X\n", (unsigned)(res >> 32), (unsigned)res); + } +#else + abort (); +#endif +} + +#define POS_BIG 0x7fffffffffffffffLL +#define NEG_BIG 0x8000000000000000LL +#define UNS_BIG 0xffffffffffffffffULL + +int main () +{ + check (0LL, 0LL); + check (1LL, POS_BIG); + check (0x000000007fffffffLL, POS_BIG); + check (0x00000000ffffffffLL, POS_BIG); + check (0x0000000100000000LL, POS_BIG); + check (POS_BIG, POS_BIG); + check (-1LL, NEG_BIG); + check (-0x000000007fffffffLL, NEG_BIG); + check (-0x00000000ffffffffLL, NEG_BIG); + check (-0x0000000100000000LL, NEG_BIG); + check (NEG_BIG, NEG_BIG); + + ucheck (0ULL, 0ULL); + ucheck (1ULL, UNS_BIG); + ucheck (0x000000007fffffffULL, UNS_BIG); + ucheck (0x00000000ffffffffULL, UNS_BIG); + ucheck (0x0000000100000000ULL, UNS_BIG); + ucheck ((unsigned long long)POS_BIG, UNS_BIG); + ucheck (UNS_BIG, UNS_BIG); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/pr64453.c b/gcc/testsuite/gcc.target/arm/pr64453.c new file mode 100644 index 00000000000..17155afc9d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr64453.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-mthumb -Os " } */ +/* { dg-require-effective-target arm_thumb1_ok } */ + +void save_regs () { + __asm volatile ("" ::: "r8"); +} + +/* { dg-final { scan-assembler "\tmov\tr., r8" } } */ diff --git a/gcc/testsuite/gcc.target/avr/torture/pr64331.c b/gcc/testsuite/gcc.target/avr/torture/pr64331.c new file mode 100644 index 00000000000..1934ccfd294 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr64331.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ + +typedef struct +{ + unsigned a, b; +} T2; + + +__attribute__((__noinline__, __noclone__)) +void foo2 (T2 *t, int x) +{ + if (x != t->a) + { + t->a = x; + + if (x && x == t->b) + t->a = 20; + } +} + + +T2 t; + +int main (void) +{ + t.a = 1; + t.b = 1234; + + foo2 (&t, 1234); + + if (t.a != 20) + __builtin_abort(); + + __builtin_exit (0); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/avr/torture/pr64452.c b/gcc/testsuite/gcc.target/avr/torture/pr64452.c new file mode 100644 index 00000000000..44cb2e057dd --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr64452.c @@ -0,0 +1,34 @@ +/* { dg-do compile } */ +/* { dg-options "-std=c99" } */ + +struct A +{ + char str[8]; + void* v; +}; + +int varf (char* fmt, ...); + +void foo (struct A a, struct A b) +{ + varf ("%s%s", b.str, b.str); +} + +long long x64; + +void foo2 (long long j0, + struct A a, struct A b, struct A c, struct A d, + struct A e, struct A f, struct A g, struct A h, struct A i, + long long j1) +{ + varf ("%s%s", i.str, i.str, x64, j1+j0); +} + + +void foo3 (long long j0, + struct A a, struct A b, struct A c, struct A d, + struct A e, struct A f, struct A g, struct A h, struct A i, + long long j1) +{ + varf ("%s%s", &i.str, &b.str, x64, j1+j0); +} diff --git a/gcc/testsuite/gcc.target/i386/pr64387.c b/gcc/testsuite/gcc.target/i386/pr64387.c new file mode 100644 index 00000000000..dd381425a27 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr64387.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-vectorize -ffloat-store -mavx512er" } */ + +float x[256]; + +double * +foo (void) +{ + double *z = __builtin_malloc (sizeof (double) * 256); + int i; + for (i = 0; i < 256; ++i) + z[i] = x[i] + 1.0f; + foo (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c index e58816a7f0f..3e4b72919e9 100644 --- a/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c +++ b/gcc/testsuite/gcc.target/powerpc/htm-builtin-1.c @@ -1,7 +1,7 @@ -/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-do assemble { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_htm_ok } */ -/* { dg-options "-O2 -mhtm" } */ +/* { dg-options "-O2 -mhtm -save-temps" } */ /* { dg-final { scan-assembler-times "tbegin\\." 1 } } */ /* { dg-final { scan-assembler-times "tend\\." 2 } } */ @@ -10,7 +10,7 @@ /* { dg-final { scan-assembler-times "tabortdci\\." 1 } } */ /* { dg-final { scan-assembler-times "tabortwc\\." 1 } } */ /* { dg-final { scan-assembler-times "tabortwci\\." 2 } } */ -/* { dg-final { scan-assembler-times "tcheck\\." 1 } } */ +/* { dg-final { scan-assembler-times "tcheck" 1 } } */ /* { dg-final { scan-assembler-times "trechkpt\\." 1 } } */ /* { dg-final { scan-assembler-times "treclaim\\." 1 } } */ /* { dg-final { scan-assembler-times "tsr\\." 3 } } */ @@ -49,3 +49,4 @@ void use_builtins (long *p, char code, long *a, long *b) __builtin_set_tfhar (a[22]); __builtin_set_tfiar (a[23]); } +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-1.c index b9d6139b080..61d8f39f52a 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-1.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-1.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ #include <stdio.h> @@ -10,11 +10,7 @@ void hp1(void) printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-10.c index b91b3478ee3..1097ab437bb 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-10.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-10.c @@ -1,21 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mno-hotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ #include <stdio.h> -__attribute__ ((hotpatch(2))) void hp1(void) { printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-11.c index 49167734253..be08acc7922 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-11.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-11.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch -mno-hotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,0" } */ #include <stdio.h> @@ -10,11 +10,7 @@ void hp1(void) printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-12.c index b3e9427d4e2..6e909c0ec48 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-12.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-12.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mno-hotpatch -mhotpatch=1 --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=999,0" } */ #include <stdio.h> @@ -10,11 +10,7 @@ void hp1(void) printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 999 } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-13.c new file mode 100644 index 00000000000..959789cf13d --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-13.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(1,0))) +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-14.c b/gcc/testsuite/gcc.target/s390/hotpatch-14.c new file mode 100644 index 00000000000..0f1f41f2502 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-14.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(0,2))) +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-15.c b/gcc/testsuite/gcc.target/s390/hotpatch-15.c new file mode 100644 index 00000000000..e3064953c32 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-15.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(1,2))) +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-16.c b/gcc/testsuite/gcc.target/s390/hotpatch-16.c new file mode 100644 index 00000000000..66f13fe3c5c --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-16.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,0" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(1,2))) +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-17.c b/gcc/testsuite/gcc.target/s390/hotpatch-17.c new file mode 100644 index 00000000000..b301c5cd294 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-17.c @@ -0,0 +1,17 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(0,0))) +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-18.c b/gcc/testsuite/gcc.target/s390/hotpatch-18.c new file mode 100644 index 00000000000..1c06783f4bc --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-18.c @@ -0,0 +1,16 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2 -mhotpatch=0,0" } */ + +#include <stdio.h> + +void hp1(void) +{ + printf("hello, world!\n"); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-19.c b/gcc/testsuite/gcc.target/s390/hotpatch-19.c new file mode 100644 index 00000000000..a1ec9c76c8b --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-19.c @@ -0,0 +1,23 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1,2" } */ + +#include <stdio.h> + +/* { dg-prune-output "always_inline function might not be inlinable" } */ +__attribute__ ((always_inline)) +static void hp2(void) +{ + printf("hello, world!\n"); +} + +void hp1(void) +{ + hp2(); +} + +/* Check number of occurences of certain instructions. */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-2.c b/gcc/testsuite/gcc.target/s390/hotpatch-2.c index 6cc29447de4..0c82a5a966c 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-2.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-2.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,1" } */ #include <stdio.h> @@ -10,11 +10,7 @@ void hp1(void) printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-20.c b/gcc/testsuite/gcc.target/s390/hotpatch-20.c new file mode 100644 index 00000000000..09ef5caaea3 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-20.c @@ -0,0 +1,20 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +#include <stdio.h> + +/* { dg-prune-output "always_inline function might not be inlinable" } */ +__attribute__ ((hotpatch(1,2))) +__attribute__ ((always_inline)) +static void hp2(void) +{ + printf("hello, world!\n"); +} + +/* { dg-prune-output "called from here" } */ +void hp1(void) +{ + hp2(); +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-3.c b/gcc/testsuite/gcc.target/s390/hotpatch-3.c index 9f0b2b756a4..041ef9ce83c 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-3.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-3.c @@ -1,7 +1,7 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0 --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,2" } */ #include <stdio.h> @@ -10,11 +10,7 @@ void hp1(void) printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-4.c b/gcc/testsuite/gcc.target/s390/hotpatch-4.c index c1dba20a379..050a0651406 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-4.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-4.c @@ -1,26 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,3" } */ #include <stdio.h> -inline void hp1(void) +void hp1(void) { printf("hello, world!\n"); } -__attribute__ ((always_inline)) -void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */ - -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-5.c b/gcc/testsuite/gcc.target/s390/hotpatch-5.c index ec267d65aae..785dba7066f 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-5.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-5.c @@ -1,21 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,4" } */ #include <stdio.h> -__attribute__ ((hotpatch)) void hp1(void) { printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 12 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-6.c b/gcc/testsuite/gcc.target/s390/hotpatch-6.c index 5af090d03a6..da96e4368af 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-6.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-6.c @@ -1,21 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,5" } */ #include <stdio.h> -__attribute__ ((hotpatch(1))) void hp1(void) { printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ /* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-times "brcl\t\t0,0" 1 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-7.c b/gcc/testsuite/gcc.target/s390/hotpatch-7.c index e73a510b4d6..b7c19d7d6fe 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-7.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-7.c @@ -1,21 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,6" } */ #include <stdio.h> -__attribute__ ((hotpatch(0))) void hp1(void) { printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ /* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-times "brcl\t\t0,0" 2 } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-8.c index 399aa7260b4..0874bbc5ce7 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-8.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-8.c @@ -1,28 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mesa -m31 -march=g5 -mhotpatch=0,3" } */ #include <stdio.h> -__attribute__ ((hotpatch)) -inline void hp1(void) +void hp1(void) { printf("hello, world!\n"); } -__attribute__ ((hotpatch)) -__attribute__ ((always_inline)) -void hp2(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp2' with the 'always_inline' attribute is not hotpatchable" } */ - -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ -/* { dg-final { scan-assembler-not "nop\t0" } } */ +/* { dg-final { scan-assembler-times "nopr\t%r7" 1 } } */ +/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-9.c b/gcc/testsuite/gcc.target/s390/hotpatch-9.c index 5da675866b3..d6fb29ae274 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-9.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-9.c @@ -1,21 +1,16 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1 --save-temps" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mesa -m31 -march=g5 -mhotpatch=0,4" } */ #include <stdio.h> -__attribute__ ((hotpatch(2))) void hp1(void) { printf("hello, world!\n"); } -int main (void) -{ - return 0; -} - /* Check number of occurences of certain instructions. */ -/* { dg-final { scan-assembler-times "nopr\t%r7" 2 } } */ -/* { dg-final { scan-assembler-times "nop\t0" 1 } } */ +/* { dg-final { scan-assembler-not "nopr\t%r7" } } */ +/* { dg-final { scan-assembler-times "nop\t0" 2 } } */ +/* { dg-final { scan-assembler-not "brcl\t\t0,0" } } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c index 45a2cc5dc20..ca47f6be5de 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-1.c @@ -1,27 +1,5 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch" } */ - -#include <stdio.h> - -void hp1(void) -{ - printf("hello, world!\n"); -} - -inline void hp2(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((always_inline)) -void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ - -int main (void) -{ - return 0; -} +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=-1,0" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-10.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-10.c new file mode 100644 index 00000000000..8b6441d771e --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-10.c @@ -0,0 +1,10 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +__attribute__((hotpatch(0,0,0))) +int main (void) +{/* { dg-error "wrong number of arguments specified" } */ + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-11.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-11.c new file mode 100644 index 00000000000..36c0e225e4d --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-11.c @@ -0,0 +1,12 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +int a; + +__attribute__((hotpatch(a,0))) +int main (void) +{ /* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */ + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-12.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-12.c new file mode 100644 index 00000000000..9b5fbd3f927 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-12.c @@ -0,0 +1,12 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +int a; + +__attribute__((hotpatch(0,a))) +int main (void) +{ /* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */ + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-13.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-13.c new file mode 100644 index 00000000000..a8752412742 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-13.c @@ -0,0 +1,29 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1000000,1000000" } */ + +#include <stdio.h> + +void hp1(void) +{ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(1000000,1000000))) +void hp2(void) +{ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(1000001,1000000))) +void hp3(void) +{ /* { dg-error " requested .hotpatch. attribute is not a comma separated pair" } */ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(1000000,1000001))) +void hp4(void) +{ /* { dg-error " requested .hotpatch. attribute is not a comma separated pair" } */ + printf("hello, world!\n"); +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-14.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-14.c new file mode 100644 index 00000000000..0b5e674d407 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-14.c @@ -0,0 +1,11 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=1000001,1000000" } */ + +viod main(void) +{ + return 0; +} + +/* { dg-error "argument to .-mhotpatch=n,m. is too large" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-15.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-15.c new file mode 100644 index 00000000000..4ce7375a7c3 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-15.c @@ -0,0 +1,43 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +/* { dg-prune-output "always_inline function might not be inlinable" } */ +/* { dg-prune-output "called from here" } */ + +#include <stdio.h> + +__attribute__ ((hotpatch(1,2))) +static void hp1(void) +{ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(1,2))) +static inline void hp2(void) +{ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(0,0))) +__attribute__ ((always_inline)) +static void hp3(void) +{ + printf("hello, world!\n"); +} + +__attribute__ ((hotpatch(1,2))) +__attribute__ ((always_inline)) +static void hp4(void) +{ + printf("hello, world!\n"); +} + +void main(void) +{ + hp1(); + hp2(); + hp3(); + hp4(); +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-16.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-16.c new file mode 100644 index 00000000000..3c5c7827206 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-16.c @@ -0,0 +1,24 @@ +/* A warning will be issued when requesting hotpatching on a nested function. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +typedef int (*fn_t)(void); + +fn_t hp1(void) +{ + __attribute__((hotpatch(0,0))) + int nested1(void) + { return 1; } + + return nested1; +} + +fn_t hp2(void) +{ + __attribute__ ((hotpatch(1,2))) + int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */ + { return 2; } + + return nested2; +} diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c index 5947f564f53..78253f59583 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-2.c @@ -1,27 +1,5 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch=0" } */ - -#include <stdio.h> - -void hp1(void) -{ - printf("hello, world!\n"); -} - -inline void hp2(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((always_inline)) -void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ - -int main (void) -{ - return 0; -} +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,-1" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c index e0c7f6f52c1..6dde22422b0 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-3.c @@ -1,27 +1,5 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1" } */ - -#include <stdio.h> - -void hp1(void) -{ - printf("hello, world!\n"); -} - -inline void hp2(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((always_inline)) -void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ - -int main (void) -{ - return 0; -} +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c index d9f13425adc..fbb30833775 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-4.c @@ -1,11 +1,5 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=-1" } */ - -int main (void) -{ - return 0; -} - -/* { dg-excess-errors "argument to '-mhotpatch=' should be a non-negative integer" } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,0,0" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c index 53f7eac9e54..dc0ff6775b8 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-5.c @@ -1,28 +1,5 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1000000" } */ - -#include <stdio.h> - -void hp1(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(1000000))) -void hp2(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(1000001))) -void hp3(void) -{ /* { dg-error "requested 'hotpatch' attribute is not a non-negative integer constant or too large .max. 1000000." } */ - printf("hello, world!\n"); -} - -int main (void) -{ - return 0; -} +/* { dg-options "-O3 -mzarch -mhotpatch=a,0" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c index cb10b66f0d3..d04045eecd5 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-6.c @@ -1,11 +1,5 @@ /* Functional tests for the function hotpatching feature. */ /* { dg-do compile } */ -/* { dg-options "-O3 -mzarch -mhotpatch=1000001" } */ - -int main (void) -{ - return 0; -} - -/* { dg-excess-errors "argument to '-mhotpatch=' is too large .max. 1000000." } */ +/* { dg-options "-O3 -mzarch -mhotpatch=0,a" } */ +/* { dg-error "arguments to .-mhotpatch=n,m. should be non-negative integers" "" { target *-*-* } 1 } */ diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c index 98ccb42c003..3505703fe8c 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-7.c @@ -1,68 +1,10 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mno-hotpatch" } */ - -#include <stdio.h> - -__attribute__ ((hotpatch)) -void hp1(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch)) -inline void hp2(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch)) -__attribute__ ((always_inline)) -void hp3(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp3' with the 'always_inline' attribute is not hotpatchable" } */ - -__attribute__ ((hotpatch(0))) -void hp4(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(0))) -inline void hp5(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(0))) -__attribute__ ((always_inline)) -void hp6(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp6' with the 'always_inline' attribute is not hotpatchable" } */ - -__attribute__ ((hotpatch(1))) -void hp7(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(1))) -inline void hp8(void) -{ - printf("hello, world!\n"); -} - -__attribute__ ((hotpatch(1))) -__attribute__ ((always_inline)) -void hp9(void) /* { dg-warning "always_inline function might not be inlinable" } */ -{ - printf("hello, world!\n"); -} /* { dg-warning "function 'hp9' with the 'always_inline' attribute is not hotpatchable" } */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ +__attribute__((hotpatch(-1,0))) int main (void) -{ +{/* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */ return 0; } diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c index 489fc5dd9f0..fd354313627 100644 --- a/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c @@ -1,23 +1,10 @@ /* Functional tests for the function hotpatching feature. */ -/* { dg-do run } */ -/* { dg-options "-O3 -mzarch -mhotpatch" } */ - -#include <stdio.h> - -int hp1(void) -{ - int nested1(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */ - { return 1; } - - __attribute__ ((hotpatch)) - int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */ - { return 1; } - - return nested1() - nested2(); -} +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ +__attribute__((hotpatch(0,-1))) int main (void) -{ - return hp1(); +{/* { dg-error "attribute is not a comma separated pair of non-negative integer constants or too large" } */ + return 0; } diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-9.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-9.c new file mode 100644 index 00000000000..dcefbe4aac7 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-9.c @@ -0,0 +1,10 @@ +/* Functional tests for the function hotpatching feature. */ + +/* { dg-do compile } */ +/* { dg-options "-O3 -mzarch" } */ + +__attribute__((hotpatch(0))) +int main (void) +{/* { dg-error "wrong number of arguments specified" } */ + return 0; +} diff --git a/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c index 6022efb97fe..62f2d68e909 100644 --- a/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c +++ b/gcc/testsuite/gcc.target/s390/htm-nofloat-1.c @@ -48,3 +48,4 @@ int main(void) /* Make sure no FPR saves/restores are emitted. */ /* { dg-final { scan-assembler-not "\tstd\t" } } */ /* { dg-final { scan-assembler-not "\tld\t" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc/testsuite/gcc.target/sh/pr53988.c b/gcc/testsuite/gcc.target/sh/pr53988.c index a2e7213cd8f..926bb047385 100644 --- a/gcc/testsuite/gcc.target/sh/pr53988.c +++ b/gcc/testsuite/gcc.target/sh/pr53988.c @@ -5,9 +5,9 @@ /* { dg-do compile } */ /* { dg-options "-O1" } */ /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */ -/* { dg-final { scan-assembler-times "tst\tr" 8 } } */ -/* { dg-final { scan-assembler-not "tst\t#255" } } */ -/* { dg-final { scan-assembler-not "exts|extu|and|movu" } } */ +/* { dg-final { scan-assembler-times "tst\tr" 8 { xfail *-*-*} } } */ +/* { dg-final { scan-assembler-not "tst\t#255" { xfail *-*-*} } } */ +/* { dg-final { scan-assembler-not "exts|extu|and|movu" { xfail *-*-*} } } */ int test00 (char* a, char* b, int c, int d) diff --git a/gcc/testsuite/gfortran.dg/finalize_28.f90 b/gcc/testsuite/gfortran.dg/finalize_28.f90 new file mode 100644 index 00000000000..03de5d0d28b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/finalize_28.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! Test the fix for PR64932. +! +! Reported by Daniel Shapiro <shapero@uw.edu> +! +module coo_graphs + implicit none + type :: dynamic_array + integer :: length, capacity, min_capacity + integer, allocatable :: array(:) + end type + type :: coo_graph + type(dynamic_array) :: edges(2) + integer, private :: ne + end type coo_graph +contains + subroutine coo_dump_edges(g, edges) + class(coo_graph), intent(in) :: g + integer, intent(out) :: edges(:,:) + end subroutine coo_dump_edges +end module coo_graphs +! { dg-final { scan-tree-dump-times "__builtin_free" 3 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pr64530.f90 b/gcc/testsuite/gfortran.dg/pr64530.f90 new file mode 100644 index 00000000000..9805f628c83 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr64530.f90 @@ -0,0 +1,38 @@ +! { dg-do run } + +program bug + ! Bug triggered with at least three elements + integer, parameter :: asize = 3 + + double precision,save :: ave(asize) + double precision,save :: old(asize) + double precision,save :: tmp(asize) + + ave(:) = 10.d0 + old(:) = 3.d0 + tmp(:) = 0.d0 + + call buggy(2.d0,asize,ave,old,tmp) + if (any (tmp(:) .ne. 3.5)) call abort +end + +subroutine buggy(scale_factor, asize, ave, old, tmp) + + implicit none + ! Args + double precision scale_factor + integer asize + double precision ave(asize) + double precision old(asize) + double precision tmp(asize) + + ! Local + integer i + + do i = 1, asize + tmp(i) = ave(i) - old(i) + old(i) = ave(i) + tmp(i) = tmp(i) / scale_factor + end do + +end subroutine buggy diff --git a/gcc/testsuite/gfortran.dg/unlimited_polymorphic_23.f90 b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_23.f90 new file mode 100644 index 00000000000..27eff310532 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unlimited_polymorphic_23.f90 @@ -0,0 +1,35 @@ +! {dg-do run } +! +! Test the fix for PR65024, in which the structure for the 'info' +! component of type 'T' was not being converted into TREE_SSA and +! so caused an ICE in trans-expr.c:gfc_conv_component_ref. +! +! Reported by <matt@gneilson.plus.com> +! +MODULE X + TYPE T + CLASS(*), pointer :: info + END TYPE +END MODULE + +PROGRAM P + call bug +CONTAINS + SUBROUTINE BUG + USE X + CLASS(T), pointer :: e + integer, target :: i = 42 + allocate(e) + e%info => NULL () ! used to ICE + if (.not.associated(e%info)) e%info => i ! used to ICE + select type (z => e%info) + type is (integer) + if (z .ne.i) call abort + end select + END SUBROUTINE + + SUBROUTINE NEXT + USE X + CLASS (T), pointer :: e + END SUBROUTINE +END diff --git a/gcc/testsuite/gfortran.dg/use_rename_8.f90 b/gcc/testsuite/gfortran.dg/use_rename_8.f90 new file mode 100644 index 00000000000..ad3ab3977c5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/use_rename_8.f90 @@ -0,0 +1,50 @@ +! { dg-do compile } +! +! PR fortran/63744 +! duplicate use rename used to be rejected when the target name +! was that of the current program unit +! +! Original testcase from Roger Ferrer Ibanez <roger.ferrer@bsc.es> + +MODULE MOO + INTEGER :: A, B, C, D, E, F, G, H, I +END MODULE MOO + +SUBROUTINE S + USE MOO, ONLY: X => A, X => A +END SUBROUTINE S + +SUBROUTINE T + USE MOO, ONLY: X => B + USE MOO, ONLY: X => B +END SUBROUTINE T + +SUBROUTINE C + USE MOO, ONLY: C ! { dg-error "is also the name of the current program unit" } +END SUBROUTINE C + +SUBROUTINE D + USE MOO, ONLY: X => D +END SUBROUTINE D + +SUBROUTINE E + USE MOO, ONLY: X => E, X => E +END SUBROUTINE E + +SUBROUTINE F + USE MOO, ONLY: X => F + USE MOO, ONLY: X => F +END SUBROUTINE F + +SUBROUTINE X + USE MOO, ONLY: X => G ! { dg-error "is also the name of the current program unit" } +END SUBROUTINE X + +SUBROUTINE Y + USE MOO, ONLY: Y => H ! { dg-error "is also the name of the current program unit" } +END SUBROUTINE Y + +SUBROUTINE Z + USE MOO, ONLY: Z => I, Z => I ! { dg-error "is also the name of the current program unit" } +END SUBROUTINE Z + diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 64ac4e99a61..0099f5ed285 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -973,6 +973,24 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop) fold_convert (ssizetype, memoff)); memoff = build_int_cst (TREE_TYPE (memoff), 0); } + /* Adjust the offset so it is a multiple of the access type + size and thus we separate bases that can possibly be used + to produce partial overlaps (which the access_fn machinery + cannot handle). */ + double_int rem; + if (TYPE_SIZE_UNIT (TREE_TYPE (ref)) + && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (ref))) == INTEGER_CST + && !integer_zerop (TYPE_SIZE_UNIT (TREE_TYPE (ref)))) + rem = tree_to_double_int (off).mod + (tree_to_double_int (TYPE_SIZE_UNIT (TREE_TYPE (ref))), false, + TRUNC_MOD_EXPR); + else + /* If we can't compute the remainder simply force the initial + condition to zero. */ + rem = tree_to_double_int (off); + off = double_int_to_tree (ssizetype, tree_to_double_int (off) - rem); + memoff = double_int_to_tree (TREE_TYPE (memoff), rem); + /* And finally replace the initial condition. */ access_fn = chrec_replace_initial_condition (access_fn, fold_convert (orig_type, off)); /* ??? This is still not a suitable base object for diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 9db92dbf9bf..892de148de2 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1342,6 +1342,7 @@ pg_add_dependence_edges (struct graph *rdg, vec<loop_p> loops, int dir, for (int ii = 0; drs1.iterate (ii, &dr1); ++ii) for (int jj = 0; drs2.iterate (jj, &dr2); ++jj) { + data_reference_p saved_dr1 = dr1; int this_dir = 1; ddr_p ddr; /* Re-shuffle data-refs to be in dominator order. */ @@ -1387,6 +1388,8 @@ pg_add_dependence_edges (struct graph *rdg, vec<loop_p> loops, int dir, dir = this_dir; else if (dir != this_dir) return 2; + /* Shuffle "back" dr1. */ + dr1 = saved_dr1; } return dir; } diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 20b0e3b0ab8..8f2413d4423 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -1715,9 +1715,8 @@ execute_pred_commoning_chain (struct loop *loop, chain_p chain, if (chain->combined) { /* For combined chains, just remove the statements that are used to - compute the values of the expression (except for the root one). */ - for (i = 1; chain->refs.iterate (i, &a); i++) - remove_stmt (a->stmt); + compute the values of the expression (except for the root one). + We delay this until after all chains are processed. */ } else { @@ -1746,9 +1745,21 @@ determine_unroll_factor (vec<chain_p> chains) FOR_EACH_VEC_ELT (chains, i, chain) { - if (chain->type == CT_INVARIANT || chain->combined) + if (chain->type == CT_INVARIANT) continue; + if (chain->combined) + { + /* For combined chains, we can't handle unrolling if we replace + looparound PHIs. */ + dref a; + unsigned j; + for (j = 1; chain->refs.iterate (j, &a); j++) + if (gimple_code (a->stmt) == GIMPLE_PHI) + return 1; + continue; + } + /* The best unroll factor for this chain is equal to the number of temporary variables that we create for it. */ af = chain->length; @@ -1781,6 +1792,21 @@ execute_pred_commoning (struct loop *loop, vec<chain_p> chains, execute_pred_commoning_chain (loop, chain, tmp_vars); } + FOR_EACH_VEC_ELT (chains, i, chain) + { + if (chain->type == CT_INVARIANT) + ; + else if (chain->combined) + { + /* For combined chains, just remove the statements that are used to + compute the values of the expression (except for the root one). */ + dref a; + unsigned j; + for (j = 1; chain->refs.iterate (j, &a); j++) + remove_stmt (a->stmt); + } + } + update_ssa (TODO_update_ssa_only_virtuals); } diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index feb6eced014..21f77c4285c 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -823,21 +823,22 @@ execute_optimize_stdarg (void) /* For va_list_simple_ptr, we have to check PHI nodes too. We treat them as assignments for the purpose of escape analysis. This is not needed for non-simple va_list because virtual phis don't perform - any real data movement. */ - if (va_list_simple_ptr) - { - tree lhs, rhs; - use_operand_p uop; - ssa_op_iter soi; + any real data movement. Also, check PHI nodes for taking address of + the va_list vars. */ + tree lhs, rhs; + use_operand_p uop; + ssa_op_iter soi; - for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i)) - { - gimple phi = gsi_stmt (i); - lhs = PHI_RESULT (phi); + for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i)) + { + gimple phi = gsi_stmt (i); + lhs = PHI_RESULT (phi); - if (virtual_operand_p (lhs)) - continue; + if (virtual_operand_p (lhs)) + continue; + if (va_list_simple_ptr) + { FOR_EACH_PHI_ARG (uop, phi, soi, SSA_OP_USE) { rhs = USE_FROM_PTR (uop); @@ -860,6 +861,22 @@ execute_optimize_stdarg (void) } } } + + for (unsigned j = 0; !va_list_escapes + && j < gimple_phi_num_args (phi); ++j) + if ((!va_list_simple_ptr + || TREE_CODE (gimple_phi_arg_def (phi, j)) != SSA_NAME) + && walk_tree (gimple_phi_arg_def_ptr (phi, j), + find_va_list_reference, &wi, NULL)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fputs ("va_list escapes in ", dump_file); + print_gimple_stmt (dump_file, phi, 0, dump_flags); + fputc ('\n', dump_file); + } + va_list_escapes = true; + } } for (i = gsi_start_bb (bb); @@ -882,8 +899,8 @@ execute_optimize_stdarg (void) if (is_gimple_assign (stmt)) { - tree lhs = gimple_assign_lhs (stmt); - tree rhs = gimple_assign_rhs1 (stmt); + lhs = gimple_assign_lhs (stmt); + rhs = gimple_assign_rhs1 (stmt); if (va_list_simple_ptr) { diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 49303b1b58a..04d6dc9d4f0 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1150,10 +1150,13 @@ vect_peeling_hash_get_lowest_cost (_vect_peel_info **slot, } single_iter_cost = vect_get_single_scalar_iteration_cost (loop_vinfo); - outside_cost += vect_get_known_peeling_cost (loop_vinfo, elem->npeel, - &dummy, single_iter_cost, - &prologue_cost_vec, - &epilogue_cost_vec); + outside_cost += vect_get_known_peeling_cost + (loop_vinfo, elem->npeel, &dummy, + /* ??? We use this cost as number of stmts with scalar_stmt cost, + thus divide by that. This introduces rounding errors, thus better + introduce a new cost kind (raw_cost? scalar_iter_cost?). */ + single_iter_cost / vect_get_stmt_cost (scalar_stmt), + &prologue_cost_vec, &epilogue_cost_vec); /* Prologue and epilogue costs are added to the target model later. These costs depend only on the scalar iteration cost, the diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 89186e07a3b..87ea654abcb 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -2801,6 +2801,11 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, statements. */ scalar_single_iter_cost = vect_get_single_scalar_iteration_cost (loop_vinfo); + /* ??? Below we use this cost as number of stmts with scalar_stmt cost, + thus divide by that. This introduces rounding errors, thus better + introduce a new cost kind (raw_cost? scalar_iter_cost?). */ + int scalar_single_iter_stmts + = scalar_single_iter_cost / vect_get_stmt_cost (scalar_stmt); /* Add additional cost for the peeled instructions in prologue and epilogue loop. @@ -2835,10 +2840,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, /* FORNOW: Don't attempt to pass individual scalar instructions to the model; just assume linear cost for scalar iterations. */ (void) add_stmt_cost (target_cost_data, - peel_iters_prologue * scalar_single_iter_cost, + peel_iters_prologue * scalar_single_iter_stmts, scalar_stmt, NULL, 0, vect_prologue); (void) add_stmt_cost (target_cost_data, - peel_iters_epilogue * scalar_single_iter_cost, + peel_iters_epilogue * scalar_single_iter_stmts, scalar_stmt, NULL, 0, vect_epilogue); } else @@ -2854,7 +2859,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo, (void) vect_get_known_peeling_cost (loop_vinfo, peel_iters_prologue, &peel_iters_epilogue, - scalar_single_iter_cost, + scalar_single_iter_stmts, &prologue_cost_vec, &epilogue_cost_vec); @@ -4534,7 +4539,10 @@ vect_finalize_reduction: && !STMT_VINFO_LIVE_P (exit_phi_vinfo)) || double_reduc); - STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt; + if (double_reduc) + STMT_VINFO_VEC_STMT (exit_phi_vinfo) = inner_phi; + else + STMT_VINFO_VEC_STMT (exit_phi_vinfo) = epilog_stmt; if (!double_reduc || STMT_VINFO_DEF_TYPE (exit_phi_vinfo) != vect_double_reduction_def) @@ -4914,6 +4922,12 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, if (!vectype_in) vectype_in = tem; gcc_assert (is_simple_use); + if (!found_nested_cycle_def) + reduc_def_stmt = def_stmt; + + if (reduc_def_stmt && gimple_code (reduc_def_stmt) != GIMPLE_PHI) + return false; + if (!(dt == vect_reduction_def || dt == vect_nested_cycle || ((dt == vect_internal_def || dt == vect_external_def @@ -4926,10 +4940,7 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, gcc_assert (orig_stmt); return false; } - if (!found_nested_cycle_def) - reduc_def_stmt = def_stmt; - gcc_assert (gimple_code (reduc_def_stmt) == GIMPLE_PHI); if (orig_stmt) gcc_assert (orig_stmt == vect_is_simple_reduction (loop_vinfo, reduc_def_stmt, diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 59842291a99..7a03b2e9f65 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "optabs.h" #include "tree-vectorizer.h" #include "langhooks.h" +#include "gimple-walk.h" /* Extract the location of the basic block in the source code. Return the basic block location if succeed and NULL if not. */ @@ -671,8 +672,11 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, ??? We should enhance this to only disallow gaps inside vectors. */ if ((unrolling_factor > 1 - && GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt - && GROUP_GAP (vinfo_for_stmt (stmt)) != 0) + && ((GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt + && GROUP_GAP (vinfo_for_stmt (stmt)) != 0) + /* If the group is split up then GROUP_GAP + isn't correct here, nor is GROUP_FIRST_ELEMENT. */ + || GROUP_SIZE (vinfo_for_stmt (stmt)) > group_size)) || (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) != stmt && GROUP_GAP (vinfo_for_stmt (stmt)) != 1)) { @@ -1761,51 +1765,83 @@ vect_make_slp_decision (loop_vec_info loop_vinfo) can't be SLPed) in the tree rooted at NODE. Mark such stmts as HYBRID. */ static void -vect_detect_hybrid_slp_stmts (slp_tree node) +vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype) { - int i; - vec<gimple> stmts = SLP_TREE_SCALAR_STMTS (node); - gimple stmt = stmts[0]; + gimple stmt = SLP_TREE_SCALAR_STMTS (node)[i]; imm_use_iterator imm_iter; gimple use_stmt; - stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt); + stmt_vec_info use_vinfo, stmt_vinfo = vinfo_for_stmt (stmt); slp_tree child; loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); - struct loop *loop = NULL; - bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); - basic_block bb = NULL; + struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); + int j; + + /* Propagate hybrid down the SLP tree. */ + if (stype == hybrid) + ; + else if (HYBRID_SLP_STMT (stmt_vinfo)) + stype = hybrid; + else + { + /* Check if a pure SLP stmt has uses in non-SLP stmts. */ + gcc_checking_assert (PURE_SLP_STMT (stmt_vinfo)); + if (TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME) + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0)) + if (gimple_bb (use_stmt) + && flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)) + && (use_vinfo = vinfo_for_stmt (use_stmt)) + && !STMT_SLP_TYPE (use_vinfo) + && (STMT_VINFO_RELEVANT (use_vinfo) + || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (use_vinfo)) + || (STMT_VINFO_IN_PATTERN_P (use_vinfo) + && STMT_VINFO_RELATED_STMT (use_vinfo) + && !STMT_SLP_TYPE (vinfo_for_stmt + (STMT_VINFO_RELATED_STMT (use_vinfo))))) + && !(gimple_code (use_stmt) == GIMPLE_PHI + && STMT_VINFO_DEF_TYPE (use_vinfo) == vect_reduction_def)) + stype = hybrid; + } + + if (stype == hybrid) + STMT_SLP_TYPE (stmt_vinfo) = hybrid; + + FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child) + vect_detect_hybrid_slp_stmts (child, i, stype); +} - if (!node) - return; +/* Helpers for vect_detect_hybrid_slp walking pattern stmt uses. */ - if (loop_vinfo) - loop = LOOP_VINFO_LOOP (loop_vinfo); - else - bb = BB_VINFO_BB (bb_vinfo); +static tree +vect_detect_hybrid_slp_1 (tree *tp, int *, void *data) +{ + walk_stmt_info *wi = (walk_stmt_info *)data; + struct loop *loopp = (struct loop *)wi->info; - FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt) - if (PURE_SLP_STMT (vinfo_for_stmt (stmt)) - && TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME) - FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, gimple_op (stmt, 0)) - if (gimple_bb (use_stmt) - && ((loop && flow_bb_inside_loop_p (loop, gimple_bb (use_stmt))) - || bb == gimple_bb (use_stmt)) - && (stmt_vinfo = vinfo_for_stmt (use_stmt)) - && !STMT_SLP_TYPE (stmt_vinfo) - && (STMT_VINFO_RELEVANT (stmt_vinfo) - || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)) - || (STMT_VINFO_IN_PATTERN_P (stmt_vinfo) - && STMT_VINFO_RELATED_STMT (stmt_vinfo) - && !STMT_SLP_TYPE (vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_vinfo))))) - && !(gimple_code (use_stmt) == GIMPLE_PHI - && STMT_VINFO_DEF_TYPE (stmt_vinfo) - == vect_reduction_def)) - vect_mark_slp_stmts (node, hybrid, i); + if (wi->is_lhs) + return NULL_TREE; - FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child) - vect_detect_hybrid_slp_stmts (child); + if (TREE_CODE (*tp) == SSA_NAME + && !SSA_NAME_IS_DEFAULT_DEF (*tp)) + { + gimple def_stmt = SSA_NAME_DEF_STMT (*tp); + if (flow_bb_inside_loop_p (loopp, gimple_bb (def_stmt)) + && PURE_SLP_STMT (vinfo_for_stmt (def_stmt))) + STMT_SLP_TYPE (vinfo_for_stmt (def_stmt)) = hybrid; + } + + return NULL_TREE; } +static tree +vect_detect_hybrid_slp_2 (gimple_stmt_iterator *gsi, bool *handled, + walk_stmt_info *) +{ + /* If the stmt is in a SLP instance then this isn't a reason + to mark use definitions in other SLP instances as hybrid. */ + if (STMT_SLP_TYPE (vinfo_for_stmt (gsi_stmt (*gsi))) != loop_vect) + *handled = true; + return NULL_TREE; +} /* Find stmts that must be both vectorized and SLPed. */ @@ -1820,8 +1856,41 @@ vect_detect_hybrid_slp (loop_vec_info loop_vinfo) dump_printf_loc (MSG_NOTE, vect_location, "=== vect_detect_hybrid_slp ===" "\n"); + /* First walk all pattern stmt in the loop and mark defs of uses as + hybrid because immediate uses in them are not recorded. */ + for (i = 0; i < LOOP_VINFO_LOOP (loop_vinfo)->num_nodes; ++i) + { + basic_block bb = LOOP_VINFO_BBS (loop_vinfo)[i]; + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); + gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + if (STMT_VINFO_IN_PATTERN_P (stmt_info)) + { + walk_stmt_info wi; + memset (&wi, 0, sizeof (wi)); + wi.info = LOOP_VINFO_LOOP (loop_vinfo); + gimple_stmt_iterator gsi2 + = gsi_for_stmt (STMT_VINFO_RELATED_STMT (stmt_info)); + walk_gimple_stmt (&gsi2, vect_detect_hybrid_slp_2, + vect_detect_hybrid_slp_1, &wi); + walk_gimple_seq (STMT_VINFO_PATTERN_DEF_SEQ (stmt_info), + vect_detect_hybrid_slp_2, + vect_detect_hybrid_slp_1, &wi); + } + } + } + + /* Then walk the SLP instance trees marking stmts with uses in + non-SLP stmts as hybrid, also propagating hybrid down the + SLP tree, collecting the above info on-the-fly. */ FOR_EACH_VEC_ELT (slp_instances, i, instance) - vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance)); + { + for (unsigned i = 0; i < SLP_INSTANCE_GROUP_SIZE (instance); ++i) + vect_detect_hybrid_slp_stmts (SLP_INSTANCE_TREE (instance), + i, pure_slp); + } } diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 2f93c7e9593..fb3e05d85c2 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -9730,7 +9730,7 @@ vrp_finalize (void) substitute_and_fold (op_with_constant_singleton_value_range, vrp_fold_stmt, false); - if (warn_array_bounds) + if (warn_array_bounds && first_pass_instance) check_all_array_refs (); /* We must identify jump threading opportunities before we release diff --git a/gcc/varasm.c b/gcc/varasm.c index 2f56ff77f35..faea19018a1 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -6962,7 +6962,13 @@ default_file_start (void) fputs (ASM_APP_OFF, asm_out_file); if (targetm.asm_file_start_file_directive) - output_file_directive (asm_out_file, main_input_filename); + { + /* LTO produced units have no meaningful main_input_filename. */ + if (in_lto_p) + output_file_directive (asm_out_file, "<artificial>"); + else + output_file_directive (asm_out_file, main_input_filename); + } } /* This is a generic routine suitable for use as TARGET_ASM_FILE_END diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 1a02eb4322e..db82cd4569f 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,21 @@ +2015-02-26 Matthew Fortune <matthew.fortune@imgtec.com> + + Backported from mainline r213870 + + * config/mips/mips16.S: Do not build for soft-float. + +2015-02-17 Sandra Loosemore <sandra@codesourcery.com> + + Backported from mainline + 2015-02-17 Sandra Loosemore <sandra@codesourcery.com> + + * config/arm/bpabi.S (test_div_by_zero): Make label names + consistent between thumb2 and arm mode cases. Separate the + signed comparison on the high word of the numerator from the + unsigned comparison on the low word. + * config/arm/bpabi-v6m.S (test_div_by_zero): Similarly separate + signed comparison. + 2015-02-01 H.J. Lu <hongjiu.lu@intel.com> Backported from mainline diff --git a/libgcc/config/arm/bpabi-v6m.S b/libgcc/config/arm/bpabi-v6m.S index d549fa6a277..52eda82753e 100644 --- a/libgcc/config/arm/bpabi-v6m.S +++ b/libgcc/config/arm/bpabi-v6m.S @@ -85,19 +85,21 @@ FUNC_START aeabi_ulcmp cmp yyl, #0 bne 7f cmp xxh, #0 + .ifc \signed, unsigned bne 2f cmp xxl, #0 2: - .ifc \signed, unsigned beq 3f mov xxh, #0 mvn xxh, xxh @ 0xffffffff mov xxl, xxh 3: .else - beq 5f blt 6f - mov xxl, #0 + bgt 4f + cmp xxl, #0 + beq 5f +4: mov xxl, #0 mvn xxl, xxl @ 0xffffffff lsr xxh, xxl, #1 @ 0x7fffffff b 5f diff --git a/libgcc/config/arm/bpabi.S b/libgcc/config/arm/bpabi.S index 959ecb157be..5512755ffbc 100644 --- a/libgcc/config/arm/bpabi.S +++ b/libgcc/config/arm/bpabi.S @@ -80,26 +80,29 @@ ARM_FUNC_START aeabi_ulcmp /* Tail-call to divide-by-zero handlers which may be overridden by the user, so unwinding works properly. */ #if defined(__thumb2__) - cbnz yyh, 1f - cbnz yyl, 1f + cbnz yyh, 2f + cbnz yyl, 2f cmp xxh, #0 + .ifc \signed, unsigned do_it eq cmpeq xxl, #0 - .ifc \signed, unsigned - beq 2f - mov xxh, #0xffffffff - mov xxl, xxh -2: + do_it ne, t + movne xxh, #0xffffffff + movne xxl, #0xffffffff .else - do_it lt, t + do_it lt, tt movlt xxl, #0 movlt xxh, #0x80000000 - do_it gt, t - movgt xxh, #0x7fffffff - movgt xxl, #0xffffffff + blt 1f + do_it eq + cmpeq xxl, #0 + do_it ne, t + movne xxh, #0x7fffffff + movne xxl, #0xffffffff .endif +1: b SYM (__aeabi_ldiv0) __PLT__ -1: +2: #else /* Note: Thumb-1 code calls via an ARM shim on processors which support ARM mode. */ @@ -107,16 +110,19 @@ ARM_FUNC_START aeabi_ulcmp cmpeq yyl, #0 bne 2f cmp xxh, #0 - cmpeq xxl, #0 .ifc \signed, unsigned + cmpeq xxl, #0 movne xxh, #0xffffffff movne xxl, #0xffffffff .else movlt xxh, #0x80000000 movlt xxl, #0 - movgt xxh, #0x7fffffff - movgt xxl, #0xffffffff + blt 1f + cmpeq xxl, #0 + movne xxh, #0x7fffffff + movne xxl, #0xffffffff .endif +1: b SYM (__aeabi_ldiv0) __PLT__ 2: #endif diff --git a/libgcc/config/mips/mips16.S b/libgcc/config/mips/mips16.S index 6a43a9839e7..dde8939b4a3 100644 --- a/libgcc/config/mips/mips16.S +++ b/libgcc/config/mips/mips16.S @@ -21,8 +21,12 @@ 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 __mips_micromips - /* DO NOTHING */ +#if defined(__mips_micromips) || defined(__mips_soft_float) + /* Do nothing because this code is only needed when linking + against mips16 hard-float objects. Neither micromips code + nor soft-float code can be linked against mips16 hard-float + objects so we do not need these routines when building libgcc + for those cases. */ #else /* This file contains mips16 floating point support functions. These @@ -749,4 +753,4 @@ CALL_STUB_RET (__mips16_call_stub_dc_10, 10, DC) #endif /* !__mips_single_float */ #endif -#endif /* __mips_micromips */ +#endif /* defined(__mips_micromips) || defined(__mips_soft_float) */ diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 81c62da380b..c1a983a5094 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,19 @@ +2015-02-11 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + * testsuite/libgomp.c/atomic-18.c: New test. + * testsuite/libgomp.c++/atomic-16.C: New test. + + Backported from mainline + 2015-02-04 Jakub Jelinek <jakub@redhat.com> + + PR c/64824 + PR c/64868 + * testsuite/libgomp.c/pr64824.c: New test. + * testsuite/libgomp.c/pr64868.c: New test. + * testsuite/libgomp.c++/pr64824.C: New test. + * testsuite/libgomp.c++/pr64868.C: New test. + 2015-01-23 Jakub Jelinek <jakub@redhat.com> PR middle-end/64734 diff --git a/libgomp/testsuite/libgomp.c++/atomic-16.C b/libgomp/testsuite/libgomp.c++/atomic-16.C new file mode 100644 index 00000000000..afccd52bb66 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/atomic-16.C @@ -0,0 +1,5 @@ +// PR c/64824 +// { dg-do run } +// { dg-options "-O2 -fopenmp" } + +#include "../libgomp.c/atomic-18.c" diff --git a/libgomp/testsuite/libgomp.c++/pr64824.C b/libgomp/testsuite/libgomp.c++/pr64824.C new file mode 100644 index 00000000000..348f6d6e0c2 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr64824.C @@ -0,0 +1,5 @@ +// PR c/64824 +// { dg-do run } +// { dg-options "-O2 -fopenmp" } + +#include "../libgomp.c/pr64824.c" diff --git a/libgomp/testsuite/libgomp.c++/pr64868.C b/libgomp/testsuite/libgomp.c++/pr64868.C new file mode 100644 index 00000000000..2d730ac4924 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr64868.C @@ -0,0 +1,5 @@ +// PR c/64868 +// { dg-do run } +// { dg-options "-O2 -fopenmp" } + +#include "../libgomp.c/pr64868.c" diff --git a/libgomp/testsuite/libgomp.c/atomic-18.c b/libgomp/testsuite/libgomp.c/atomic-18.c new file mode 100644 index 00000000000..bd048c1094c --- /dev/null +++ b/libgomp/testsuite/libgomp.c/atomic-18.c @@ -0,0 +1,61 @@ +/* PR c/64824 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ + +void +f1 (void) +{ + short a; + short b = 1; + int c = 3; +#pragma omp atomic capture + a = b = c << b; + if (b != 6 || a != 6) + __builtin_abort (); +} + +void +f2 (void) +{ + short a; + short b = 1; + int c = 3; +#pragma omp atomic capture + a = b = c + b; + if (b != 4 || a != 4) + __builtin_abort (); +} + +void +f3 (void) +{ + short a; + short b = 1; + long long int c = 3; +#pragma omp atomic capture + a = b = c + b; + if (b != 4 || a != 4) + __builtin_abort (); +} + +void +f4 (void) +{ + char a; + char b = 1; + long long int c = 3LL; +#pragma omp atomic capture + a = b = c << b; + if (b != 6 || a != 6) + __builtin_abort (); +} + +int +main () +{ + f1 (); + f2 (); + f3 (); + f4 (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr64824.c b/libgomp/testsuite/libgomp.c/pr64824.c new file mode 100644 index 00000000000..544d0b0fc1f --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr64824.c @@ -0,0 +1,16 @@ +/* PR c/64824 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ + +int +main () +{ + long long a; + long long b = 1LL; + int c = 3; +#pragma omp atomic capture + a = b = c << b; + if (b != 6LL || a != 6LL) + __builtin_abort (); + return 0; +} diff --git a/libgomp/testsuite/libgomp.c/pr64868.c b/libgomp/testsuite/libgomp.c/pr64868.c new file mode 100644 index 00000000000..acdf9984108 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr64868.c @@ -0,0 +1,87 @@ +/* PR c/64868 */ +/* { dg-do run } */ +/* { dg-options "-O2 -fopenmp" } */ + +float f = 2.0f; +double d = 4.0; +long double ld = 8.0L; + +void +foo () +{ +#pragma omp atomic + f = 1.0f / f; +#pragma omp atomic + f = 1 / f; +#pragma omp atomic + f = f / 2.0f; +#pragma omp atomic + f = f / 2; +#pragma omp atomic + f /= 2.0f; +#pragma omp atomic + f /= 2; +#pragma omp atomic + d = 1.0 / d; +#pragma omp atomic + d = 1 / d; +#pragma omp atomic + d = d / 2.0; +#pragma omp atomic + d = d / 2; +#pragma omp atomic + d /= 2.0; +#pragma omp atomic + d /= 2; +#pragma omp atomic + ld = 1.0L / ld; +#pragma omp atomic + ld = 1 / ld; +#pragma omp atomic + ld = ld / 2.0L; +#pragma omp atomic + ld = ld / 2; +#pragma omp atomic + ld /= 2.0L; +#pragma omp atomic + ld /= 2; + if (f != 0.125f || d != 0.25 || ld != 0.5L) + __builtin_abort (); +} + +#ifdef __cplusplus +template <typename T, int N1, int N2> +void +bar () +{ + T v = ::d; +#pragma omp atomic + v *= 16; +#pragma omp atomic + v = 1.0 / v; +#pragma omp atomic + v = N1 / v; +#pragma omp atomic + v = v / 2.0; +#pragma omp atomic + v = v / N2; +#pragma omp atomic + v /= 2.0; +#pragma omp atomic + v /= N2; + if (v != 0.25) + __builtin_abort (); +} +#endif + +int +main () +{ + foo (); +#ifdef __cplusplus + bar<float, 1, 2> (); + bar<double, 1, 2> (); + bar<long double, 1, 2> (); +#endif + return 0; +} |