diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 17:45:52 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-10 17:45:52 +0000 |
commit | eb76579392e0d61b9f33c90fdd8b620e563d0a12 (patch) | |
tree | 4307edacc6d226e528b690b44a329d430fe03a61 | |
parent | 2d9d01985a7a7866916fafa19c5c296702e69714 (diff) | |
download | gcc-eb76579392e0d61b9f33c90fdd8b620e563d0a12.tar.gz |
2016-02-10 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9
svn merge -r227401:227700 ^/trunk
}}
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@233282 138bc75d-0d04-0410-961f-82ee72b054a4
743 files changed, 21043 insertions, 4212 deletions
diff --git a/ChangeLog.MELT b/ChangeLog.MELT index 54418ffb340..1f37dee3faf 100644 --- a/ChangeLog.MELT +++ b/ChangeLog.MELT @@ -1,6 +1,11 @@ 2016-02-10 Basile Starynkevitch <basile@starynkevitch.net> {{merging with even more of GCC 6, using subversion 1.9 + svn merge -r227401:227700 ^/trunk + }} + +2016-02-10 Basile Starynkevitch <basile@starynkevitch.net> + {{merging with even more of GCC 6, using subversion 1.9 svn merge -r227001:227400 ^/trunk ; there is some gengtype issue before svn r228000... }} diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 4493c19dfd1..cfd3abbf3f2 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,8 @@ +2015-09-11 Markus Trippelsdorf <markus@trippelsdorf.de> + + * download_prerequisites: Make sure that script is run from + top level source directory. + 2015-08-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * update-copyright.py (GCCCmdLine): Add libvtv. diff --git a/contrib/download_prerequisites b/contrib/download_prerequisites index de0e7c41847..69403301b81 100755 --- a/contrib/download_prerequisites +++ b/contrib/download_prerequisites @@ -24,6 +24,11 @@ # be downloaded. GRAPHITE_LOOP_OPT=yes +if [ ! -e gcc/BASE-VER ] ; then + echo "You must run this script in the top level GCC source directory." + exit 1 +fi + # Necessary to build GCC. MPFR=mpfr-2.4.2 GMP=gmp-4.3.2 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e686783f232..abb1d6d0e53 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,698 @@ +2015-09-11 Jeff Law <law@redhat.com> + + PR tree-optimization/47679 + * tree-ssa-dom.c (struct cond_equivalence): Update comment. + * tree-ssa-scopedtables.h (class const_and_copies): Prefix data + member with m_. Update inline member functions as necessary. Add + toplevel comment. + * tree-ssa-scopedtables.c: Update const_and_copies's member + functions to use m_ prefix to access the stack. + +2015-09-11 Aditya Kumar <aditya.k7@samsung.com> + + * graphite-optimize-isl.c (disable_tiling): Remove. + (get_schedule_for_band): Do not use disable_tiling. + (get_prevector_map): Delete function. + (enable_polly_vector): Remove. + (get_schedule_for_band_list): Remove dead code. + +2015-09-11 Aditya Kumar <aditya.k7@samsung.com> + + * graphite-optimize-isl.c (get_tile_map): Refactor. + (get_schedule_for_band): Same. + (getScheduleForBand): Same. + (get_prevector_map): Same. + (get_schedule_for_band_list): Same. + (get_schedule_map): Same. + (get_single_map): Same. + (apply_schedule_map_to_scop): Same. + (optimize_isl): Same. + +2015-09-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> + + PR target/63304 + * config/aarch64/aarch.md (mov<mode>:GPF_F16): Use GPF_TF_F16. + (movtf): Delete. + * config/aarch64/iterators.md (GPF_TF_F16): New. + (GPF_F16): Delete. + +2015-09-10 Nathan Sidwell <nathan@acm.org> + + * config/nvptx/nvptx.c (nvptx_expand_call): Add spacing. + (nvptx_reorg): Adjust comments. + +2015-09-15 John David Anglin <danglin@gcc.gnu.org> + + PR bootstrap/67363 + * configure.ac: Check if setenv and unsetenv are declared. + * configure: Rebuild. + * config.in: Rebuild. + * system.h: Declare setenv and unsetenv if not declared. + +2015-09-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * config/rs6000/rs6000.c (swap_web_entry): Update preceding + commentary to simplify permute mask adjustment equation. + (special_handling_values): Add SH_VPERM. + (const_load_sequence_p): New function. + (insn_is_swappable_p): Add logic to recognize an UNSPEC_VPERM with + the mask loaded from the constant pool. + (adjust_vperm): New function. + (handle_special_swappables): Call adjust_vperm. + (dump_swap_insn_table): Handle SH_VPERM. + +2015-09-10 H.J. Lu <hongjiu.lu@intel.com> + + * shrink-wrap.c (requires_stack_frame_p): Remove static. + * shrink-wrap.h (requires_stack_frame_p): Put back. + +2015-09-10 Richard Sandiford <richard.sandiford@arm.com> + + * reload1.c (elimination_costs_in_insn): Locally turn + -Wmaybe-uninitialized into a warning. + +2015-09-10 Segher Boessenkool <segher@kernel.crashing.org> + + * shrink-wrap.c (requires_stack_frame_p): Make static. + (prepare_shrink_wrap): Likewise. + (dup_block_and_redirect): Likewise. + * shrink-wrap.h: Remove declarations of those functions. + +2015-09-10 Mark Wielaard <mjw@redhat.com> + + * doc/invoke.texi (Wnonnull): Also warns when comparing against NULL. + +2015-09-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/67506 + * config/sh/sh.c (sh_extending_set_of_reg::use_as_extended_reg): Add + missing simplify_gen_subreg. + +2015-09-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * config/s390/s390.c (s390_contiguous_bitmask_vector_p): Reject if + the vector element is bigger than 64 bit. + +2015-09-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * config/s390/vx-builtins.md ("vec_vmal<mode>", "vec_vmah<mode>") + ("vec_vmalh<mode>"): Change mode iterator from VI_HW to VI_HW_QHS. + +2015-09-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * config/s390/s390.c: Add V1TImode to constant pool modes. + +2015-09-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/67439 + * config/arm/arm.md (*arm32_movhf): Remove !arm_restrict_it from + predicate. Set predicable_short_it attr to "no". + +2015-09-10 Jiong Wang <jiong.wang@arm.com> + + PR rtl-optimization/67421 + * expr.c (expand_expr_real_2): Cost instrcution sequences when doing + left wide shift tranformation. + +2015-09-10 Claudiu Zissulescu <claziss@synopsys.com> + + * common/config/arc/arc-common.c: Remove references to A5. + * config/arc/arc-opts.h: Likewise. + * config/arc/arc.c, config/arc/arc.h, config/arc/arc.md: Likewise. + * config/arc/arc.opt, config/arc/constraints.md: Likewise. + * config/arc/t-arc-newlib: Likewise. + +2015-09-10 Claudiu Zissulescu <claziss@synopsys.com> + + * config/arc/arc.md (length): Fix attribute length for conditional + executed instructions with long immediate. + +2015-09-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64.md (*and<mode>3nr_compare0): Use logics_imm + type for second alternative. + +2015-09-10 Markus Trippelsdorf <markus@trippelsdorf.de> + + * doc/invoke.texi (Downloading GCC): Mention + contrib/download_prerequisites script. + +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/67523 + * gimplify.c (gimplify_omp_for): If inner stmt is not found + for combined loop, assert seen_error () and return GS_ERROR. + + PR middle-end/67521 + * gimplify.c (gimplify_omp_for): Don't call omp_add_variable + if decl is already in outer->variables. + + PR middle-end/67517 + * gimplify.c (gimplify_scan_omp_clauses): Instead of + asserting that decl is not specified in octx->variables, + break out of the loop if it is. + + PR c++/67514 + * gimplify.c (gimplify_omp_for): For loop SIMD construct, if + iterator is not explicitly determined, but is defined inside + of the combined workshare region, handle it like if it has + DECL_EXPR in OMP_FOR_PRE_BODY. + +2015-09-09 Nathan Sidwell <nathan@acm.org> + + * config/nvptx/nvptx.md (call_operation): Move bound out of loop. + (*cmp<mode>): Add assembler spacing. + (setcc_int<mode>, set_cc_float<mode>): Likewise. + * config/nvptx/nvptx.c (nvptx_option_override): Override debug + level. + (write_func_decl_from_insn): Refactor argument loops & comma emission. + (nvptx_expand_call): Likewise. + (nvptx_output_call_insn): Likewise. + (nvptx_reorg_subreg): Add spacing. + +2015-09-09 Marek Polacek <polacek@redhat.com> + + PR middle-end/67512 + * tree-ssa-uninit.c (pred_equal_p): Only call invert_tree_comparison + for comparisons. + +2015-09-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53184 + * doc/invoke.texi ([Wsubobject-linkage]): Document. + +2015-09-09 Tom de Vries <tom@codesourcery.com> + + * params-list.h: Add missing copyright notice. + +2015-09-09 Nathan Sidwell <nathan@acm.org> + + * config/nvptx/nvptx.md (atomic_compare_and_swap<mode>): Use + sel_truesi, not andsi. + +2015-09-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/arm/arm.md (*subsi3_compare0): Rename to... + (subsi3_compare0): ... This. + (modsi3): New define_expand. + * config/arm/arm.c (arm_new_rtx_costs, MOD case): Handle case + when operand is power of 2. + +2015-09-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * config/aarch64/aarch64.md (mod<mode>3): New define_expand. + (*neg<mode>2_compare0): Rename to... + (neg<mode>2_compare0): ... This. + * config/aarch64/aarch64.c (aarch64_rtx_costs, MOD case): + Move check for speed inside the if-then-elses. Reflect + CSNEG sequence in MOD by power of 2 case. + +2015-09-09 Alan Modra <amodra@gmail.com> + + PR target/67378 + * config/rs6000/rs6000.c (rs6000_secondary_reload_gpr): Find + reload replacement for PRE_MODIFY address reg. + +2015-09-09 Sebastian Pop <s.pop@samsung.com> + + PR tree-optimization/53852 + * config.in: Regenerate. + * configure: Regenerate. + * configure.ac (HAVE_ISL_CTX_MAX_OPERATIONS): Detect. + * graphite-optimize-isl.c (optimize_isl): Stop computation when + PARAM_MAX_ISL_OPERATIONS is reached. + * params.def (PARAM_MAX_ISL_OPERATIONS): Add. + * graphite-dependences.c (extend_schedule): Remove gcc_asserts on + result equal to isl_stat_ok as the status now can be isl_error_quota. + (subtract_commutative_associative_deps): Same. + (compute_deps): Same. + +2015-09-08 Aditya Kumar <hiraditya@msn.com> + Sebastian Pop <s.pop@samsung.com> + + * graphite-isl-ast-to-gimple.c (gcc_expression_from_isl_ast_expr_id): + Return the parameter if it was saved in corresponding + parameter_rename_map of the region. + (copy_def): Copy def from sese region to the newly created region. + (copy_internal_parameters): Copy all the internal parameters defined + within a region to the newly created region. + (graphite_regenerate_ast_isl): Copy parameters to the new region before + translating isl to gimple. + * graphite-scop-detection.c (graphite_can_represent_loop): Bail out if + the loop-nest does not have any data-references. + (build_graphite_scops): Create a scop only when there is at least one + loop inside it. + (contains_only_close_phi_nodes): Deleted. + (print_graphite_scop_statistics): Deleted + (print_graphite_statistics): Deleted + (limit_scops): Deleted. + (build_scops): Removed call to limit_scops. + * sese.c (new_sese): Construct. + (free_sese): Destruct. + (sese_add_exit_phis_edge): update_stmt after exit phi edge has been + added. + (set_rename): Pass sese region so that parameters inside the region can + be added to its parameter_rename_map. + (rename_uses): Pass sese region. + (graphite_copy_stmts_from_block): Do not copy parameters that have been + generated in the header of the scop. For each SSA_NAME in the + parameter_rename_map rename its usage. + (invariant_in_sese_p_rec): Return false if tree t is defined outside + sese region. + (scalar_evolution_in_region): If the tree t is invariant just return t. + * sese.h: Added a parameter renamne map (parameter_rename_map_t) to + struct sese to keep track of all the parameters which need renaming. + * tree-data-ref.c (loop_nest_has_data_refs): Check if a loop nest has + any data-refs. + * tree-data-ref.h: Declaration of loop_nest_has_data_refs. + +2015-09-08 Tom de Vries <tom@codesourcery.com> + + * Makefile.in (generated_files): Add params.list. + (params.list, s-params.list): Add rule. + * params.h (enum compiler_param): Include params-list.h. Move define + DEFPARAM, include params.def and undef DEFPARAM ... + * params-list.h: ... here. New file. + +2015-09-08 David Malcolm <dmalcolm@redhat.com> + + * pretty-print.h (printer_fn): Fix typo in comment. + +2015-09-07 Jeff Law <law@redhat.com> + + * tree-ssa-scopedtables.h (class const_and_copies): Fix comment typo. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * doc/sourcebuild.texi (arm_neon_fp16): Correct cross-reference. + (arm_neon_fp16_ok): Document adding of -mfp16-format=ieee flag. + (arm_neon_fp16_hw): New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * fold-const.c (native_interpret_real): Fix HFmode for bigendian where + UNITS_PER_WORD >= 4. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_simd_vec_unpacks_lo_<mode>, + aarch64_simd_vec_unpacks_hi_<mode>): New insn. + (vec_unpacks_lo_v4sf, vec_unpacks_hi_v4sf): Delete insn. + (vec_unpacks_lo_<mode>, vec_unpacks_hi_<mode>): New expand. + (aarch64_float_extend_lo_v2df): Rename to... + (aarch64_float_extend_lo_<Vwide>): this, using VDF and so adding V4SF. + + * config/aarch64/aarch64-simd-builtins.def (vec_unpacks_hi): Add v8hf. + (float_extend_lo): Add v4sf. + + * config/aarch64/arm_neon.h (vcvt_f32_f16, vcvt_high_f32_f16): New. + * config/aarch64/iterators.md (VQ_HSF): New iterator. + (VWIDE, Vwtype, Vhalftype): Add V8HF, V4SF. + (Vwide): New mode_attr. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_simd_dup<mode>, + aarch64_dup_lane<mode>, aarch64_dup_lane_<vswap_width_name><mode>, + aarch64_simd_vec_set<mode>, vec_set<mode>, vec_perm_const<mode>, + vec_init<mode>, *aarch64_simd_ld1r<mode>, vec_extract<mode>): Add + V4HF and V8HF variants to iterator. + + * config/aarch64/aarch64.c (aarch64_evpc_dup): Add V4HF and V8HF cases. + + * config/aarch64/iterators.md (VDQF_F16): New. + (VSWAP_WIDTH, vswap_width_name): Add V4HF and V8HF cases. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/arm_neon.h (vreinterpret_p8_f16, vreinterpret_p16_f16, + vreinterpret_f16_f64, vreinterpret_f16_s8, vreinterpret_f16_s16, + vreinterpret_f16_s32, vreinterpret_f16_s64, vreinterpret_f16_f32, + vreinterpret_f16_u8, vreinterpret_f16_u16, vreinterpret_f16_u32, + vreinterpret_f16_u64, vreinterpret_f16_p8, vreinterpret_f16_p16, + vreinterpretq_f16_f64, vreinterpretq_f16_s8, vreinterpretq_f16_s16, + vreinterpretq_f16_s32, vreinterpretq_f16_s64, vreinterpretq_f16_f32, + vreinterpretq_f16_u8, vreinterpretq_f16_u16, vreinterpretq_f16_u32, + vreinterpretq_f16_u64, vreinterpretq_f16_p8, vreinterpretq_f16_p16, + vreinterpret_f32_f16, vreinterpret_f64_f16, vreinterpret_s64_f16, + vreinterpret_u64_f16, vreinterpretq_u64_f16, vreinterpret_s8_f16, + vreinterpret_s16_f16, vreinterpret_s32_f16, vreinterpret_u8_f16, + vreinterpret_u16_f16, vreinterpret_u32_f16, vreinterpretq_p8_f16, + vreinterpretq_p16_f16, vreinterpretq_f32_f16, vreinterpretq_f64_f16, + vreinterpretq_s64_f16, vreinterpretq_s8_f16, vreinterpretq_s16_f16, + vreinterpretq_s32_f16, vreinterpretq_u8_f16, vreinterpretq_u16_f16, + vreinterpretq_u32_f16, vget_low_f16, vget_high_f16, vld1_dup_f16, + vld1q_dup_f16): New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/aarch64-simd.md (aarch64_float_truncate_lo_v2sf): + Reparameterize to... + (aarch64_float_truncate_lo_<mode>): ...this, for both V2SF and V4HF. + (aarch64_float_truncate_hi_v4sf): Reparameterize to... + (aarch64_float_truncate_hi_<Vdbl>): ...this, for both V4SF and V8HF. + + * config/aarch64/aarch64-simd-builtins.def (float_truncate_hi_): Add + v8hf variant. + (float_truncate_lo_): Use BUILTIN_VDF iterator. + + * config/aarch64/arm_neon.h (vcvt_f16_f32, vcvt_high_f16_f32): New. + + * config/aarch64/iterators.md (VDF, Vdtype): New. + (VWIDE, Vmwtype): Add cases for V4HF and V2SF. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/aarch64.c (aarch64_split_simd_combine): Add V4HFmode. + * config/aarch64/aarch64-builtins.c (VAR13, VAR14): New. + (aarch64_scalar_builtin_types, aarch64_init_simd_builtin_scalar_types): + Add __builtin_aarch64_simd_hf. + * config/aarch64/arm_neon.h (float16x4x2_t, float16x8x2_t, + float16x4x3_t, float16x8x3_t, float16x4x4_t, float16x8x4_t, + vcombine_f16, vst2_lane_f16, vst2q_lane_f16, vst3_lane_f16, + vst3q_lane_f16, vst4_lane_f16, vst4q_lane_f16, vld2_f16, vld2q_f16, + vld3_f16, vld3q_f16, vld4_f16, vld4q_f16, vld2_dup_f16, vld2q_dup_f16, + vld3_dup_f16, vld3q_dup_f16, vld4_dup_f16, vld4q_dup_f16, + vld2_lane_f16, vld2q_lane_f16, vld3_lane_f16, vld3q_lane_f16, + vld4_lane_f16, vld4q_lane_f16, vst2_f16, vst2q_f16, vst3_f16, + vst3q_f16, vst4_f16, vst4q_f16, vcreate_f16): New. + + * config/aarch64/iterators.md (VALLDIF, Vtype, Vetype, Vbtype, + V_cmp_result, v_cmp_result): Add cases for V4HF and V8HF. + (VDC, Vdbl): Add V4HF. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/aarch64/aarch64.c (aarch64_vector_mode_supported_p): Support + V4HFmode and V8HFmode. + (aarch64_split_simd_move): Add case for V8HFmode. + * config/aarch64/aarch64-builtins.c (v4hf_UP, v8hf_UP): Define. + (aarch64_simd_builtin_std_type): Handle HFmode. + (aarch64_init_simd_builtin_types): Include Float16x4_t and Float16x8_t. + + * config/aarch64/aarch64-simd.md (mov<mode>, aarch64_get_lane<mode>, + aarch64_ld1<VALL:mode>, aarch64_st1<VALL:mode): Use VALL_F16 iterator. + (aarch64_be_ld1<mode>, aarch64_be_st1<mode>): Use VALLDI_F16 iterator. + + * config/aarch64/aarch64-simd-builtin-types.def: Add Float16x4_t, + Float16x8_t. + + * config/aarch64/aarch64-simd-builtins.def (ld1, st1): Use VALL_F16. + * config/aarch64/arm_neon.h (float16x4_t, float16x8_t, float16_t): + New typedefs. + (vget_lane_f16, vgetq_lane_f16, vset_lane_f16, vsetq_lane_f16, + vld1_f16, vld1q_f16, vst1_f16, vst1q_f16, vst1_lane_f16, + vst1q_lane_f16): New. + * config/aarch64/iterators.md (VD, VQ, VQ_NO2E): Add vectors of HFmode. + (VALLDI_F16, VALL_F16): New. + (Vmtype, VEL, VCONQ, VHALF, V_TWO_ELEM, V_THREE_ELEM, V_FOUR_ELEM, q): + Add cases for V4HF and V8HF. + (VDBL, VRL2, VRL3, VRL4): Add V4HF case. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/arm/arm-builtins.c (VAR11, VAR12): New. + * config/arm/arm_neon_builtins.def (vcombine, vld2_dup, vld3_dup, + vld4_dup): Add v4hf variant. + (vget_high, vget_low): Add v8hf variant. + (vld1, vst1, vst1_lane, vld2, vld2_lane, vst2, vst2_lane, vld3, + vld3_lane, vst3, vst3_lane, vld4, vld4_lane, vst4, vst4_lane): Add + v4hf and v8hf variants. + + * config/arm/iterators.md (VD_LANE, VD_RE, VQ2, VQ_HS): New. + (VDX): Add V4HF. + (V_DOUBLE): Add case for V4HF. + (VQX): Add V8HF. + (V_HALF): Add case for V8HF. + (VDQX): Add V4HF, V8HF. + (V_elem, V_two_elem, V_three_elem, V_four_elem, V_cmp_result, + V_uf_sclr, V_sz_elem, V_mode_nunits, q): Add cases for V4HF & V8HF. + + * config/arm/neon.md (vec_set<mode>internal, vec_extract<mode>, + neon_vget_lane<mode>_sext_internal, neon_vget_lane<mode>_zext_internal, + vec_load_lanesoi<mode>, neon_vld2<mode>, vec_store_lanesoi<mode>, + neon_vst2<mode>, vec_load_lanesci<mode>, neon_vld3<mode>, + neon_vld3qa<mode>, neon_vld3qb<mode>, vec_store_lanesci<mode>, + neon_vst3<mode>, neon_vst3qa<mode>, neon_vst3qb<mode>, + vec_load_lanesxi<mode>, neon_vld4<mode>, neon_vld4qa<mode>, + neon_vld4qb<mode>, vec_store_lanesxi<mode>, neon_vst4<mode>, + neon_vst4qa<mode>, neon_vst4qb<mode>): Change VQ iterator to VQ2. + + (neon_vcreate, neon_vreinterpretv8qi<mode>, + neon_vreinterpretv4hi<mode>, neon_vreinterpretv2si<mode>, + neon_vreinterpretv2sf<mode>, neon_vreinterpretdi<mode>): + Change VDX to VD_RE. + + (neon_vld2_lane<mode>, neon_vst2_lane<mode>, neon_vld3_lane<mode>, + neon_vst3_lane<mode>, neon_vld4_lane<mode>, neon_vst4_lane<mode>): + Change VD iterator to VD_LANE, and VMQ iterator to VQ_HS. + + * config/arm/arm_neon.h (float16x4x2_t, float16x8x2_t, float16x4x3_t, + float16x8x3_t, float16x4x4_t, float16x8x4_t, vcombine_f16, + vget_high_f16, vget_low_f16, vld1_f16, vld1q_f16, vst1_f16, vst1q_f16, + vst1_lane_f16, vst1q_lane_f16, vld2_f16, vld2q_f16, vld2_lane_f16, + vld2q_lane_f16, vld2_dup_f16, vst2_f16, vst2q_f16, vst2_lane_f16, + vst2q_lane_f16, vld3_f16, vld3q_f16, vld3_lane_f16, vld3q_lane_f16, + vld3_dup_f16, vst3_f16, vst3q_f16, vst3_lane_f16, vst3q_lane_f16, + vld4_f16, vld4q_f16, vld4_lane_f16, vld4q_lane_f16, vld4_dup_f16, + vst4_f16, vst4q_f16, vst4_lane_f16, vst4q_lane_f16): New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/arm/arm_neon.h (vgetq_lane_f16, vsetq_lane_f16, vld1q_lane_f16, + vld1q_dup_f16, vreinterpretq_p8_f16, vreinterpretq_p16_f16, + vreinterpretq_f16_p8, vreinterpretq_f16_p16, vreinterpretq_f16_f32, + vreinterpretq_f16_p64, vreinterpretq_f16_p128, vreinterpretq_f16_s64, + vreinterpretq_f16_u64, vreinterpretq_f16_s8, vreinterpretq_f16_s16, + vreinterpretq_f16_s32, vreinterpretq_f16_u8, vreinterpretq_f16_u16, + vreinterpretq_f16_u32, vreinterpretq_f32_f16, vreinterpretq_p64_f16, + vreinterpretq_p128_f16, vreinterpretq_s64_f16, vreinterpretq_u64_f16, + vreinterpretq_s8_f16, vreinterpretq_s16_f16, vreinterpretq_s32_f16, + vreinterpretq_u8_f16, vreinterpretq_u16_f16, vreinterpretq_u32_f16): + New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/arm/arm.h (VALID_NEON_QREG_MODE): Add V8HFmode. + + * config/arm/arm.c (arm_vector_mode_supported_p): Support V8HFmode. + + * config/arm/arm-builtins.c (v8hf_UP): New. + (arm_init_simd_builtin_types): Initialise Float16x8_t. + + * config/arm/arm-simd-builtin-types.def (Float16x8_t): New. + + * config/arm/arm_neon.h (float16x8_t): New typedef. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * config/arm/arm_neon.h (float16_t, vget_lane_f16, vset_lane_f16, + vcreate_f16, vld1_lane_f16, vld1_dup_f16, vreinterpret_p8_f16, + vreinterpret_p16_f16, vreinterpret_f16_p8, vreinterpret_f16_p16, + vreinterpret_f16_f32, vreinterpret_f16_p64, vreinterpret_f16_s64, + vreinterpret_f16_u64, vreinterpret_f16_s8, vreinterpret_f16_s16, + vreinterpret_f16_s32, vreinterpret_f16_u8, vreinterpret_f16_u16, + vreinterpret_f16_u32, vreinterpret_f32_f16, vreinterpret_p64_f16, + vreinterpret_s64_f16, vreinterpret_u64_f16, vreinterpret_s8_f16, + vreinterpret_s16_f16, vreinterpret_s32_f16, vreinterpret_u8_f16, + vreinterpret_u16_f16, vreinterpret_u32_f16): New. + +2015-09-07 Ilya Verbin <ilya.verbin@intel.com> + + * config/i386/intelmic-mkoffload.c (prepare_target_image): Handle all + non-alphanumeric characters in the symbol name. + +2015-09-07 Marek Polacek <polacek@redhat.com> + + PR inline-asm/67448 + * gimplify.c (gimplify_asm_expr): Don't allow MODIFY_EXPR as + a memory input. + +2015-09-07 Marek Polacek <polacek@redhat.com> + + * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning. + +2015-09-04 Paolo Bonzini <bonzini@gnu.org> + + * config/i386/cygming.h (SUBTARGET_OVERRIDE_OPTIONS): Do + not warn. + +2015-09-04 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/67452 + * tree-ssa-live.c: Include cfgloop.h. + (remove_unused_locals): Clear loop->simduid if simduid is about + to be removed from cfun->local_decls. + +2015-09-02 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + PR target/65210 + * config/avr/avr.c (avr_eval_addr_attrib): Look for io_low + attribute as well. + +2015-09-04 Tom de Vries <tom@codesourcery.com> + + * doc/invoke.texi (@item -ftrapv, @item -fwrapv): Document interaction. + +2015-09-04 Jeff Law <law@redhat.com> + + * tree-ssa-scopedtables.c (const_and_copies::const_and_copies): Remove + unnecessary constructor. It's now trivial and implemented inside... + * tree-ssa-scopedtables.h (const_and_copies): Implement trivial + constructor. Add comments to various methods. Remove unused + private fields. + * tree-ssa-dom.c (pass_dominator::execute): Corresponding changes. + * tree-vrp.c (identify_jump_threads): Likewise. + * tree-ssa-threadedge.c (thread_through_normal_block): Fix minor + indentation issues. + (thread_across_edge): Similarly. + (record_temporary_equivalences_from_stmts_at_dest): Remove unused + arguments in constructor call. + +2015-09-04 Jonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de> + + * config/i386/intelmic-mkoffload.c (prepare_target_image): Fix if the + temp path contains a '-'. + +2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com> + Petr Murzin <petr.murzin@intel.com> + Kirill Yukhin <kirill.yukhin@intel.com> + + * config/i386/i386-builtin-types.def + (VOID_PFLOAT_HI_V8DI_V16SF_INT): New. + (VOID_PDOUBLE_QI_V16SI_V8DF_INT): Ditto. + (VOID_PINT_HI_V8DI_V16SI_INT): Ditto. + (VOID_PLONGLONG_QI_V16SI_V8DI_INT): Ditto. + * config/i386/i386.c + (ix86_builtins): Add IX86_BUILTIN_SCATTERALTSIV8DF, + IX86_BUILTIN_SCATTERALTDIV16SF, IX86_BUILTIN_SCATTERALTSIV8DI, + IX86_BUILTIN_SCATTERALTDIV16SI. + (ix86_init_mmx_sse_builtins): Define __builtin_ia32_scatteraltsiv8df, + __builtin_ia32_scatteraltdiv8sf, __builtin_ia32_scatteraltsiv8di, + __builtin_ia32_scatteraltdiv8si. + (ix86_expand_builtin): Handle IX86_BUILTIN_SCATTERALTSIV8DF, + IX86_BUILTIN_SCATTERALTDIV16SF, IX86_BUILTIN_SCATTERALTSIV8DI, + IX86_BUILTIN_SCATTERALTDIV16SI. + (ix86_vectorize_builtin_scatter): New. + (TARGET_VECTORIZE_BUILTIN_SCATTER): Define as + ix86_vectorize_builtin_scatter. + +2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com> + Petr Murzin <petr.murzin@intel.com> + Kirill Yukhin <kirill.yukhin@intel.com> + + * doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_SCATTER): New. + * doc/tm.texi: Regenerate. + * target.def: Add scatter builtin. + * tree-vectorizer.h: Rename gather_p to gather_scatter_p and use it + for loads/stores in case of gather/scatter accordingly. + (STMT_VINFO_GATHER_SCATTER_P(S)): Use it instead of STMT_VINFO_GATHER_P(S). + (vect_check_gather): Rename to ... + (vect_check_gather_scatter): this. + * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Use + STMT_VINFO_GATHER_SCATTER_P instead of STMT_VINFO_SCATTER_P. + (vect_check_gather_scatter): Use it instead of vect_check_gather. + (vect_analyze_data_refs): Add gatherscatter enum and maybe_scatter variable + and new checkings for it accordingly. + * tree-vect-stmts.c + (STMT_VINFO_GATHER_SCATTER_P(S)): Use it instead of STMT_VINFO_GATHER_P(S). + (vect_check_gather_scatter): Use it instead of vect_check_gather. + (vectorizable_store): Add checkings for STMT_VINFO_GATHER_SCATTER_P. + +2015-09-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com> + + * config/rs6000/altivec.md (altivec_vperm_v8hiv16qi): New + define_insn. + (mulv16qi3): New define_expand. + +2015-09-03 Martin Sebor <msebor@redhat.com> + + PR c/66516 + * doc/extend.texi (Other Builtins): Document when the address + of a built-in function can be taken. + +2015-09-03 Richard Biener <rguenther@suse.de> + + * dwarf2out.c (flush_limbo_die_list): Split out from ... + (dwarf2out_early_finish): ... here. + (dwarf2out_finish): Do not call dwarf2out_early_finish but + flush_limbo_die_list. Assert we have no deferred asm names. + +2015-09-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * optabs.c (expand_binop): Don't create a broadcast vector with a + source element wider than the inner mode. + +2015-09-03 Richard Biener <rguenther@suse.de> + + * varasm.c (output_constant): Use fold_convert instead of + wide_int_to_tree. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * omp-low.c (expand_omp_for_static_chunk): Handle case that fin_bb has 2 + predecessors. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * omp-low.c (find_phi_with_arg_on_edge): New function. + (expand_omp_for_static_chunk): Fix inner loop phi. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * omp-low.c (expand_omp_for_static_chunk): Fix gcc_assert for the case + that head is NULL. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + * doc/invoke.texi (parloops-chunk-size): Add item. + * params.def (PARAM_PARLOOPS_CHUNK_SIZE): Add DEFPARAM. + * tree-parloops.c: Include params.h. + (create_parallel_loop): Set chunk-size of schedule of omp-for loop, if + param parloops-chunk-size is used. + +2015-09-03 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> + + PR middle-end/67351 + * fold-const.c (fold_binary_loc) : Move + Transform (x >> c) << c into x & (-1<<c) or + transform (x << c) >> c into x & ((unsigned)-1 >> c) for unsigned + types using simplify and match. + * match.pd (lshift (rshift @0 INTEGER_CST@1) @1) : New simplifier. + (rshift (lshift @0 INTEGER_CST@1) @1) : New Simplifier + +2015-09-03 Richard Biener <rguenther@suse.de> + + PR ipa/66705 + * tree-ssa-structalias.c (ctor_for_analysis): New function. + (create_variable_info_for_1): Use ctor_for_analysis instead + of get_constructor. + (create_variable_info_for): Likewise. + +2015-09-02 Charles Baylis <charles.baylis@linaro.org> + + PR ipa/67280 + * cgraphunit.c (cgraph_node::create_wrapper): Set can_throw_external + in new callgraph edge. + +2015-09-02 Christophe Lyon <christophe.lyon@linaro.org> + + PR target/59810 + PR target/63652 + PR target/63653 + * config/aarch64/aarch64-simd.md + (aarch64_ld<VSTRUCT:nregs><VQ:mode>): Call + gen_aarch64_simd_ld<VSTRUCT:nregs><VQ:mode>. + (aarch64_st<VSTRUCT:nregs><VQ:mode>): Call + gen_aarch64_simd_st<VSTRUCT:nregs><VQ:mode>. + 2015-09-02 Alan Modra <amodra@gmail.com> * config/rs6000/sysv4le.h (LINK_TARGET_SPEC): Don't define. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4c97cf77e19..68e1defad14 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20150902 +20150911 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 191cdf177ec..0343d7a4ac0 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2532,7 +2532,7 @@ generated_files = config.h tm.h $(TM_P_H) $(TM_H) multilib.h \ $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h gcov-iov.h \ options.h target-hooks-def.h insn-opinit.h \ common/common-target-hooks-def.h pass-instances.def \ - c-family/c-target-hooks-def.h + c-family/c-target-hooks-def.h params.list # # How to compile object files to run on the build machine. @@ -3366,6 +3366,12 @@ installdirs: $(mkinstalldirs) $(DESTDIR)$(man1dir) $(mkinstalldirs) $(DESTDIR)$(man7dir) +params.list: s-params.list; @true +s-params.list: $(srcdir)/params-list.h $(srcdir)/params.def + $(CPP) $(srcdir)/params-list.h | sed 's/^#.*//;/^$$/d' > tmp-params.list + $(SHELL) $(srcdir)/../move-if-change tmp-params.list params.list + $(STAMP) s-params.list + PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(HASH_TABLE_H) \ tree-ssa-alias.h $(INTERNAL_FN_H) gimple-fold.h tree-eh.h gimple-expr.h \ diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 8b4009e85fd..3acc84f433b 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,26 @@ +2015-09-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53184 + * c.opt ([Wsubobject-linkage]): Add. + +2015-09-03 Martin Sebor <msebor@redhat.com> + + PR c/66516 + * c-common.h (c_decl_implicit, reject_gcc_builtin): Declare new + functions. + * c-common.c (reject_gcc_builtin): Define. + +2015-09-02 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR middle-end/60586 + * c-common.h (cilk_gimplify_call_params_in_spawned_fn): New + prototype. + * c-gimplify.c (c_gimplify_expr): Added a call to the function + cilk_gimplify_call_params_in_spawned_fn. + * cilk.c (cilk_gimplify_call_params_in_spawned_fn): New function. + (gimplify_cilk_spawn): Removed EXPR_STMT and CLEANUP_POINT_EXPR + unwrapping. + 2015-08-25 Marek Polacek <polacek@redhat.com> PR middle-end/67330 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index adfd1e6c301..02866235119 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -12882,4 +12882,41 @@ pointer_to_zero_sized_aggr_p (tree t) return (TYPE_SIZE (t) && integer_zerop (TYPE_SIZE (t))); } +/* For an EXPR of a FUNCTION_TYPE that references a GCC built-in function + with no library fallback or for an ADDR_EXPR whose operand is such type + issues an error pointing to the location LOC. + Returns true when the expression has been diagnosed and false + otherwise. */ +bool +reject_gcc_builtin (const_tree expr, location_t loc /* = UNKNOWN_LOCATION */) +{ + if (TREE_CODE (expr) == ADDR_EXPR) + expr = TREE_OPERAND (expr, 0); + + if (TREE_TYPE (expr) + && TREE_CODE (TREE_TYPE (expr)) == FUNCTION_TYPE + && DECL_P (expr) + /* The intersection of DECL_BUILT_IN and DECL_IS_BUILTIN avoids + false positives for user-declared built-ins such as abs or + strlen, and for C++ operators new and delete. + The c_decl_implicit() test avoids false positives for implicitly + declared built-ins with library fallbacks (such as abs). */ + && DECL_BUILT_IN (expr) + && DECL_IS_BUILTIN (expr) + && !c_decl_implicit (expr) + && !DECL_ASSEMBLER_NAME_SET_P (expr)) + { + if (loc == UNKNOWN_LOCATION) + loc = EXPR_LOC_OR_LOC (expr, input_location); + + /* Reject arguments that are built-in functions with + no library fallback. */ + error_at (loc, "built-in function %qE must be directly called", expr); + + return true; + } + + return false; +} + #include "gt-c-family-c-common.h" diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index d1f6cba20e3..33d228af259 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -573,6 +573,7 @@ extern int field_decl_cmp (const void *, const void *); extern void resort_sorted_fields (void *, void *, gt_pointer_operator, void *); extern bool has_c_linkage (const_tree decl); +extern bool c_decl_implicit (const_tree); /* Switches common to the C front ends. */ @@ -1425,6 +1426,8 @@ extern vec <tree, va_gc> *fix_sec_implicit_args extern tree insert_cilk_frame (tree); extern void cilk_init_builtins (void); extern int gimplify_cilk_spawn (tree *); +extern void cilk_gimplify_call_params_in_spawned_fn (tree *, gimple_seq *, + gimple_seq *); extern void cilk_install_body_with_frame_cleanup (tree, tree, void *); extern bool cilk_detect_spawn_and_unwrap (tree *); extern bool cilk_set_spawn_marker (location_t, tree); @@ -1438,5 +1441,6 @@ extern bool contains_cilk_spawn_stmt (tree); extern tree cilk_for_number_of_iterations (tree); extern bool check_no_cilk (tree, const char *, const char *, location_t loc = UNKNOWN_LOCATION); +extern bool reject_gcc_builtin (const_tree, location_t = UNKNOWN_LOCATION); #endif /* ! GCC_C_COMMON_H */ diff --git a/gcc/c-family/c-gimplify.c b/gcc/c-family/c-gimplify.c index 1c81773a91c..92987b588f7 100644 --- a/gcc/c-family/c-gimplify.c +++ b/gcc/c-family/c-gimplify.c @@ -288,8 +288,10 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, /* If errors are seen, then just process it as a CALL_EXPR. */ if (!seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); - + { + cilk_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } case MODIFY_EXPR: case INIT_EXPR: case CALL_EXPR: @@ -299,7 +301,10 @@ c_gimplify_expr (tree *expr_p, gimple_seq *pre_p ATTRIBUTE_UNUSED, original expression (MODIFY/INIT/CALL_EXPR) is processes as it is supposed to be. */ && !seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + { + cilk_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } default:; } diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 050dcb02734..d519d7a000b 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -944,6 +944,11 @@ Wuseless-cast C++ ObjC++ Var(warn_useless_cast) Warning Warn about useless casts +Wsubobject-linkage +C++ ObjC++ Var(warn_subobject_linkage) Warning Init(1) +Warn if a class type has a base or a field whose type uses the anonymous +namespace or depends on a type with no linkage + ansi C ObjC C++ ObjC++ A synonym for -std=c89 (for C) or -std=c++98 (for C++) diff --git a/gcc/c-family/cilk.c b/gcc/c-family/cilk.c index 1012a4fd3aa..1c316a4eb78 100644 --- a/gcc/c-family/cilk.c +++ b/gcc/c-family/cilk.c @@ -762,6 +762,34 @@ create_cilk_wrapper (tree exp, tree *args_out) return fndecl; } +/* Gimplify all the parameters for the Spawned function. *EXPR_P can be a + CALL_EXPR, INIT_EXPR, MODIFY_EXPR or TARGET_EXPR. *PRE_P and *POST_P are + gimple sequences from the caller of gimplify_cilk_spawn. */ + +void +cilk_gimplify_call_params_in_spawned_fn (tree *expr_p, gimple_seq *pre_p, + gimple_seq *post_p) +{ + int ii = 0; + tree *fix_parm_expr = expr_p; + + /* Remove CLEANUP_POINT_EXPR and EXPR_STMT from *spawn_p. */ + while (TREE_CODE (*fix_parm_expr) == CLEANUP_POINT_EXPR + || TREE_CODE (*fix_parm_expr) == EXPR_STMT) + *fix_parm_expr = TREE_OPERAND (*fix_parm_expr, 0); + + if ((TREE_CODE (*expr_p) == INIT_EXPR) + || (TREE_CODE (*expr_p) == TARGET_EXPR) + || (TREE_CODE (*expr_p) == MODIFY_EXPR)) + fix_parm_expr = &TREE_OPERAND (*expr_p, 1); + + if (TREE_CODE (*fix_parm_expr) == CALL_EXPR) + for (ii = 0; ii < call_expr_nargs (*fix_parm_expr); ii++) + gimplify_expr (&CALL_EXPR_ARG (*fix_parm_expr, ii), pre_p, post_p, + is_gimple_reg, fb_rvalue); +} + + /* Transform *SPAWN_P, a spawned CALL_EXPR, to gimple. *SPAWN_P can be a CALL_EXPR, INIT_EXPR or MODIFY_EXPR. Returns GS_OK if everything is fine, and GS_UNHANDLED, otherwise. */ @@ -779,12 +807,6 @@ gimplify_cilk_spawn (tree *spawn_p) cfun->calls_cilk_spawn = 1; cfun->is_cilk_function = 1; - - /* Remove CLEANUP_POINT_EXPR and EXPR_STMT from *spawn_p. */ - while (TREE_CODE (expr) == CLEANUP_POINT_EXPR - || TREE_CODE (expr) == EXPR_STMT) - expr = TREE_OPERAND (expr, 0); - new_args = NULL; function = create_cilk_wrapper (expr, &new_args); diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 275d7879fd6..325686a4b1c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,57 @@ +2015-09-09 Mark Wielaard <mjw@redhat.com> + + * c-typeck.c (build_binary_op): Check and warn when nonnull arg + parm against NULL. + +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c/67502 + * c-parser.c (c_parser_omp_for_loop): Emit DECL_EXPR stmts + into OMP_FOR_PRE_BODY rather than before the loop. + +2015-09-09 Jakub Jelinek <jakub@redhat.com> + + PR c/67501 + * c-parser.c (c_parser_oacc_all_clauses, + c_parser_omp_all_clauses): Remove invalid clause from + list of clauses even if parser->error is set. + + PR c/67500 + * c-parser.c (c_parser_omp_clause_aligned, + c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen): Fix up + test for errors. + * c-decl.c (temp_pop_parm_decls): Allow b->decl equal to + error_mark_node. + + PR c/67495 + * c-parser.c (c_parser_omp_atomic): Use c_parser_cast_expression + instead of c_parser_unary_expression. If the result is !lvalue_p, + wrap the result of c_fully_fold into NON_LVALUE_EXPR. + +2015-09-04 Marek Polacek <polacek@redhat.com> + + PR sanitizer/67279 + * c-typeck.c (build_binary_op): Don't instrument static initializers. + +2015-09-03 Martin Sebor <msebor@redhat.com> + + PR c/66516 + * c-typeck.c (convert_arguments, parser_build_unary_op, + build_conditional_expr, c_cast_expr, convert_for_assignment, + build_binary_op, _objc_common_truthvalue_conversion): Call + reject_gcc_builtin. + (c_decl_implicit): Define. + +2015-09-02 Marek Polacek <polacek@redhat.com> + + PR c/67432 + * c-parser.c (c_parser_enum_specifier): Give a better error for + an empty enum. + +2015-08-18 Trevor Saunders <tbsaunde@tbsaunde.org> + + * c-aux-info.c, c-parser.c, c-tree.h: Remove useless typedefs. + 2015-08-12 Marek Polacek <polacek@redhat.com> * c-decl.c (grokdeclarator): Call error_at instead of error and pass diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b83c584c701..5e5b6d7dfc2 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -8912,7 +8912,8 @@ temp_pop_parm_decls (void) current_scope->bindings = NULL; for (; b; b = free_binding_and_advance (b)) { - gcc_assert (TREE_CODE (b->decl) == PARM_DECL); + gcc_assert (TREE_CODE (b->decl) == PARM_DECL + || b->decl == error_mark_node); gcc_assert (I_SYMBOL_BINDING (b->id) == b); I_SYMBOL_BINDING (b->id) = b->shadowed; if (b->shadowed && b->shadowed->u.type) diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 30b4302b09e..52eec97152b 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -2555,7 +2555,16 @@ c_parser_enum_specifier (c_parser *parser) location_t decl_loc, value_loc; if (c_parser_next_token_is_not (parser, CPP_NAME)) { - c_parser_error (parser, "expected identifier"); + /* Give a nicer error for "enum {}". */ + if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE) + && !parser->error) + { + error_at (c_parser_peek_token (parser)->location, + "empty enum is invalid"); + parser->error = true; + } + else + c_parser_error (parser, "expected identifier"); c_parser_skip_until_found (parser, CPP_CLOSE_BRACE, NULL); values = error_mark_node; break; @@ -11222,9 +11231,9 @@ c_parser_omp_clause_aligned (c_parser *parser, tree list) tree alignment = c_parser_expr_no_commas (parser, NULL).value; mark_exp_read (alignment); alignment = c_fully_fold (alignment, false, NULL); - if (!INTEGRAL_TYPE_P (TREE_TYPE (alignment)) - && TREE_CODE (alignment) != INTEGER_CST - && tree_int_cst_sgn (alignment) != 1) + if (TREE_CODE (alignment) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (alignment)) + || tree_int_cst_sgn (alignment) != 1) { error_at (clause_loc, "%<aligned%> clause alignment expression must " "be positive constant integer expression"); @@ -11301,9 +11310,9 @@ c_parser_omp_clause_safelen (c_parser *parser, tree list) t = c_parser_expr_no_commas (parser, NULL).value; mark_exp_read (t); t = c_fully_fold (t, false, NULL); - if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) - && TREE_CODE (t) != INTEGER_CST - && tree_int_cst_sgn (t) != 1) + if (TREE_CODE (t) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (t)) + || tree_int_cst_sgn (t) != 1) { error_at (clause_loc, "%<safelen%> clause expression must " "be positive constant integer expression"); @@ -11337,9 +11346,9 @@ c_parser_omp_clause_simdlen (c_parser *parser, tree list) t = c_parser_expr_no_commas (parser, NULL).value; mark_exp_read (t); t = c_fully_fold (t, false, NULL); - if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) - && TREE_CODE (t) != INTEGER_CST - && tree_int_cst_sgn (t) != 1) + if (TREE_CODE (t) != INTEGER_CST + || !INTEGRAL_TYPE_P (TREE_TYPE (t)) + || tree_int_cst_sgn (t) != 1) { error_at (clause_loc, "%<simdlen%> clause expression must " "be positive constant integer expression"); @@ -11743,7 +11752,7 @@ c_parser_oacc_all_clauses (c_parser *parser, omp_clause_mask mask, first = false; - if (((mask >> c_kind) & 1) == 0 && !parser->error) + if (((mask >> c_kind) & 1) == 0) { /* Remove the invalid clause(s) from the list to avoid confusing the rest of the compiler. */ @@ -11972,7 +11981,7 @@ c_parser_omp_all_clauses (c_parser *parser, omp_clause_mask mask, first = false; - if (((mask >> c_kind) & 1) == 0 && !parser->error) + if (((mask >> c_kind) & 1) == 0) { /* Remove the invalid clause(s) from the list to avoid confusing the rest of the compiler. */ @@ -12413,6 +12422,7 @@ c_parser_omp_atomic (location_t loc, c_parser *parser) bool structured_block = false; bool swapped = false; bool seq_cst = false; + bool non_lvalue_p; if (c_parser_next_token_is (parser, CPP_NAME)) { @@ -12466,20 +12476,33 @@ c_parser_omp_atomic (location_t loc, c_parser *parser) { case OMP_ATOMIC_READ: case NOP_EXPR: /* atomic write */ - v = c_parser_unary_expression (parser).value; + v = c_parser_cast_expression (parser, NULL).value; + non_lvalue_p = !lvalue_p (v); v = c_fully_fold (v, false, NULL); if (v == error_mark_node) goto saw_error; + if (non_lvalue_p) + v = non_lvalue (v); loc = c_parser_peek_token (parser)->location; if (!c_parser_require (parser, CPP_EQ, "expected %<=%>")) goto saw_error; if (code == NOP_EXPR) - lhs = c_parser_expression (parser).value; + { + lhs = c_parser_expression (parser).value; + lhs = c_fully_fold (lhs, false, NULL); + if (lhs == error_mark_node) + goto saw_error; + } else - lhs = c_parser_unary_expression (parser).value; - lhs = c_fully_fold (lhs, false, NULL); - if (lhs == error_mark_node) - goto saw_error; + { + lhs = c_parser_cast_expression (parser, NULL).value; + non_lvalue_p = !lvalue_p (lhs); + lhs = c_fully_fold (lhs, false, NULL); + if (lhs == error_mark_node) + goto saw_error; + if (non_lvalue_p) + lhs = non_lvalue (lhs); + } if (code == NOP_EXPR) { /* atomic write is represented by OMP_ATOMIC with NOP_EXPR @@ -12498,10 +12521,13 @@ c_parser_omp_atomic (location_t loc, c_parser *parser) } else { - v = c_parser_unary_expression (parser).value; + v = c_parser_cast_expression (parser, NULL).value; + non_lvalue_p = !lvalue_p (v); v = c_fully_fold (v, false, NULL); if (v == error_mark_node) goto saw_error; + if (non_lvalue_p) + v = non_lvalue (v); if (!c_parser_require (parser, CPP_EQ, "expected %<=%>")) goto saw_error; } @@ -12514,7 +12540,7 @@ c_parser_omp_atomic (location_t loc, c_parser *parser) old or new x should be captured. */ restart: eloc = c_parser_peek_token (parser)->location; - expr = c_parser_unary_expression (parser); + expr = c_parser_cast_expression (parser, NULL); lhs = expr.value; expr = default_function_array_conversion (eloc, expr); unfolded_lhs = expr.value; @@ -12607,6 +12633,8 @@ restart: } /* FALLTHRU */ default: + if (!lvalue_p (unfolded_lhs)) + lhs = non_lvalue (lhs); switch (c_parser_peek_token (parser)->type) { case CPP_MULT_EQ: @@ -12721,20 +12749,25 @@ stmt_done: { if (!c_parser_require (parser, CPP_SEMICOLON, "expected %<;%>")) goto saw_error; - v = c_parser_unary_expression (parser).value; + v = c_parser_cast_expression (parser, NULL).value; + non_lvalue_p = !lvalue_p (v); v = c_fully_fold (v, false, NULL); if (v == error_mark_node) goto saw_error; + if (non_lvalue_p) + v = non_lvalue (v); if (!c_parser_require (parser, CPP_EQ, "expected %<=%>")) goto saw_error; eloc = c_parser_peek_token (parser)->location; - expr = c_parser_unary_expression (parser); + expr = c_parser_cast_expression (parser, NULL); lhs1 = expr.value; expr = default_function_array_read_conversion (eloc, expr); unfolded_lhs1 = expr.value; lhs1 = c_fully_fold (lhs1, false, NULL); if (lhs1 == error_mark_node) goto saw_error; + if (!lvalue_p (unfolded_lhs1)) + lhs1 = non_lvalue (lhs1); } if (structured_block) { @@ -12836,7 +12869,8 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, tree clauses, tree *cclauses) { tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl; - tree declv, condv, incrv, initv, ret = NULL; + tree declv, condv, incrv, initv, ret = NULL_TREE; + tree pre_body = NULL_TREE, this_pre_body; bool fail = false, open_brace_parsed = false; int i, collapse = 1, nbraces = 0; location_t for_loc; @@ -12880,8 +12914,23 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, { if (i > 0) vec_safe_push (for_block, c_begin_compound_stmt (true)); + this_pre_body = push_stmt_list (); c_parser_declaration_or_fndef (parser, true, true, true, true, true, NULL, vNULL); + if (this_pre_body) + { + this_pre_body = pop_stmt_list (this_pre_body); + if (pre_body) + { + tree t = pre_body; + pre_body = push_stmt_list (); + add_stmt (t); + add_stmt (this_pre_body); + pre_body = pop_stmt_list (pre_body); + } + else + pre_body = this_pre_body; + } decl = check_for_loop_decls (for_loc, flag_isoc99); if (decl == NULL) goto error_init; @@ -13076,7 +13125,7 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, if (!fail) { stmt = c_finish_omp_for (loc, code, declv, initv, condv, - incrv, body, NULL); + incrv, body, pre_body); if (stmt) { if (cclauses != NULL diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index e8c818989ee..4108f27ab7c 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3339,6 +3339,10 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist, error (invalid_func_diag); return -1; } + else if (TREE_CODE (val) == ADDR_EXPR && reject_gcc_builtin (val)) + { + return -1; + } else /* Convert `short' and `char' to full-size `int'. */ parmval = default_conversion (val); @@ -3376,12 +3380,20 @@ parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg) { struct c_expr result; - result.value = build_unary_op (loc, code, arg.value, 0); result.original_code = code; result.original_type = NULL; + if (reject_gcc_builtin (arg.value)) + { + result.value = error_mark_node; + } + else + { + result.value = build_unary_op (loc, code, arg.value, 0); + if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg.value)) overflow_warning (loc, result.value); + } return result; } @@ -4484,6 +4496,12 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp, type2 = TREE_TYPE (op2); code2 = TREE_CODE (type2); + if (code1 == POINTER_TYPE && reject_gcc_builtin (op1)) + return error_mark_node; + + if (code2 == POINTER_TYPE && reject_gcc_builtin (op2)) + return error_mark_node; + /* C90 does not permit non-lvalue arrays in conditional expressions. In C99 they will be pointers by now. */ if (code1 == ARRAY_TYPE || code2 == ARRAY_TYPE) @@ -5222,6 +5240,10 @@ c_cast_expr (location_t loc, struct c_type_name *type_name, tree expr) type = groktypename (type_name, &type_expr, &type_expr_const); warn_strict_prototypes = saved_wsp; + if (TREE_CODE (expr) == ADDR_EXPR && !VOID_TYPE_P (type) + && reject_gcc_builtin (expr)) + return error_mark_node; + ret = build_c_cast (loc, type, expr); if (type_expr) { @@ -5861,6 +5883,10 @@ convert_for_assignment (location_t location, location_t expr_loc, tree type, rhs = require_complete_type (rhs); if (rhs == error_mark_node) return error_mark_node; + + if (coder == POINTER_TYPE && reject_gcc_builtin (rhs)) + return error_mark_node; + /* A non-reference type can convert to a reference. This handles va_start, va_copy and possibly port built-ins. */ if (codel == REFERENCE_TYPE && coder != REFERENCE_TYPE) @@ -10350,6 +10376,14 @@ build_binary_op (location_t location, enum tree_code code, if (code0 == ERROR_MARK || code1 == ERROR_MARK) return error_mark_node; + if (code0 == POINTER_TYPE + && reject_gcc_builtin (op0, EXPR_LOCATION (orig_op0))) + return error_mark_node; + + if (code1 == POINTER_TYPE + && reject_gcc_builtin (op1, EXPR_LOCATION (orig_op1))) + return error_mark_node; + if ((invalid_op_diag = targetm.invalid_binary_op (code, type0, type1))) { @@ -10769,6 +10803,11 @@ build_binary_op (location_t location, enum tree_code code, short_compare = 1; else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1)) { + if (warn_nonnull + && TREE_CODE (op0) == PARM_DECL && nonnull_arg_p (op0)) + warning_at (location, OPT_Wnonnull, + "nonnull argument %qD compared to NULL", op0); + if (TREE_CODE (op0) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))) { @@ -10789,6 +10828,11 @@ build_binary_op (location_t location, enum tree_code code, } else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0)) { + if (warn_nonnull + && TREE_CODE (op1) == PARM_DECL && nonnull_arg_p (op1)) + warning_at (location, OPT_Wnonnull, + "nonnull argument %qD compared to NULL", op1); + if (TREE_CODE (op1) == ADDR_EXPR && decl_with_nonnull_addr_p (TREE_OPERAND (op1, 0))) { @@ -11258,7 +11302,8 @@ build_binary_op (location_t location, enum tree_code code, if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_FLOAT_DIVIDE)) && do_ubsan_in_current_function () - && (doing_div_or_mod || doing_shift)) + && (doing_div_or_mod || doing_shift) + && !require_constant_value) { /* OP0 and/or OP1 might have side-effects. */ op0 = c_save_expr (op0); @@ -11330,6 +11375,11 @@ c_objc_common_truthvalue_conversion (location_t location, tree expr) error_at (location, "void value not ignored as it ought to be"); return error_mark_node; + case POINTER_TYPE: + if (reject_gcc_builtin (expr)) + return error_mark_node; + break; + case FUNCTION_TYPE: gcc_unreachable (); @@ -12882,3 +12932,13 @@ cilk_install_body_with_frame_cleanup (tree fndecl, tree body, void *w) append_to_statement_list (build_stmt (EXPR_LOCATION (body), TRY_FINALLY_EXPR, body_list, dtor), &list); } + +/* Returns true when the function declaration FNDECL is implicit, + introduced as a result of a call to an otherwise undeclared + function, and false otherwise. */ + +bool +c_decl_implicit (const_tree fndecl) +{ + return C_DECL_IMPLICIT (fndecl); +} diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index be16f5d0d04..278515da096 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2543,6 +2543,7 @@ cgraph_node::create_wrapper (cgraph_node *target) memset (&thunk, 0, sizeof (cgraph_thunk_info)); thunk.thunk_p = true; create_edge (target, NULL, count, CGRAPH_FREQ_BASE); + callees->can_throw_external = !TREE_NOTHROW (target->decl); tree arguments = DECL_ARGUMENTS (decl); diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c index 95993df355e..489bdb22533 100644 --- a/gcc/common/config/arc/arc-common.c +++ b/gcc/common/config/arc/arc-common.c @@ -33,7 +33,7 @@ arc_option_init_struct (struct gcc_options *opts) { opts->x_flag_no_common = 255; /* Mark as not user-initialized. */ - /* Which cpu we're compiling for (A5, ARC600, ARC601, ARC700). */ + /* Which cpu we're compiling for (ARC600, ARC601, ARC700). */ arc_cpu = PROCESSOR_NONE; } @@ -82,7 +82,6 @@ arc_handle_option (struct gcc_options *opts, struct gcc_options *opts_set, switch (value) { - case PROCESSOR_A5: case PROCESSOR_ARC600: case PROCESSOR_ARC700: if (! (opts_set->x_target_flags & MASK_BARREL_SHIFTER) ) diff --git a/gcc/config.in b/gcc/config.in index 22a4e6b7cb2..431d26218d1 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -934,6 +934,13 @@ #endif +/* Define to 1 if we found a declaration for 'setenv', otherwise define to 0. + */ +#ifndef USED_FOR_TARGET +#undef HAVE_DECL_SETENV +#endif + + /* Define to 1 if we found a declaration for 'setrlimit', otherwise define to 0. */ #ifndef USED_FOR_TARGET @@ -1025,6 +1032,13 @@ #endif +/* Define to 1 if we found a declaration for 'unsetenv', otherwise define to + 0. */ +#ifndef USED_FOR_TARGET +#undef HAVE_DECL_UNSETENV +#endif + + /* Define to 1 if we found a declaration for 'vasprintf', otherwise define to 0. */ #ifndef USED_FOR_TARGET @@ -1332,6 +1346,12 @@ #endif +/* Define if isl_ctx_get_max_operations exists. */ +#ifndef USED_FOR_TARGET +#undef HAVE_ISL_CTX_MAX_OPERATIONS +#endif + + /* Define if isl_options_set_schedule_serialize_sccs exists. */ #ifndef USED_FOR_TARGET #undef HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index e3a90b5e4dd..5a0426348ee 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -61,6 +61,7 @@ #define v8qi_UP V8QImode #define v4hi_UP V4HImode +#define v4hf_UP V4HFmode #define v2si_UP V2SImode #define v2sf_UP V2SFmode #define v1df_UP V1DFmode @@ -68,6 +69,7 @@ #define df_UP DFmode #define v16qi_UP V16QImode #define v8hi_UP V8HImode +#define v8hf_UP V8HFmode #define v4si_UP V4SImode #define v4sf_UP V4SFmode #define v2di_UP V2DImode @@ -295,6 +297,12 @@ aarch64_types_storestruct_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] #define VAR12(T, N, MAP, A, B, C, D, E, F, G, H, I, J, K, L) \ VAR11 (T, N, MAP, A, B, C, D, E, F, G, H, I, J, K) \ VAR1 (T, N, MAP, L) +#define VAR13(T, N, MAP, A, B, C, D, E, F, G, H, I, J, K, L, M) \ + VAR12 (T, N, MAP, A, B, C, D, E, F, G, H, I, J, K, L) \ + VAR1 (T, N, MAP, M) +#define VAR14(T, X, MAP, A, B, C, D, E, F, G, H, I, J, K, L, M, N) \ + VAR13 (T, X, MAP, A, B, C, D, E, F, G, H, I, J, K, L, M) \ + VAR1 (T, X, MAP, N) #include "aarch64-builtin-iterators.h" @@ -372,6 +380,7 @@ const char *aarch64_scalar_builtin_types[] = { "__builtin_aarch64_simd_qi", "__builtin_aarch64_simd_hi", "__builtin_aarch64_simd_si", + "__builtin_aarch64_simd_hf", "__builtin_aarch64_simd_sf", "__builtin_aarch64_simd_di", "__builtin_aarch64_simd_df", @@ -520,6 +529,8 @@ aarch64_simd_builtin_std_type (enum machine_mode mode, return aarch64_simd_intCI_type_node; case XImode: return aarch64_simd_intXI_type_node; + case HFmode: + return aarch64_fp16_type_node; case SFmode: return float_type_node; case DFmode: @@ -604,6 +615,8 @@ aarch64_init_simd_builtin_types (void) aarch64_simd_types[Poly64x2_t].eltype = aarch64_simd_types[Poly64_t].itype; /* Continue with standard types. */ + aarch64_simd_types[Float16x4_t].eltype = aarch64_fp16_type_node; + aarch64_simd_types[Float16x8_t].eltype = aarch64_fp16_type_node; aarch64_simd_types[Float32x2_t].eltype = float_type_node; aarch64_simd_types[Float32x4_t].eltype = float_type_node; aarch64_simd_types[Float64x1_t].eltype = double_type_node; @@ -655,6 +668,8 @@ aarch64_init_simd_builtin_scalar_types (void) "__builtin_aarch64_simd_qi"); (*lang_hooks.types.register_builtin_type) (intHI_type_node, "__builtin_aarch64_simd_hi"); + (*lang_hooks.types.register_builtin_type) (aarch64_fp16_type_node, + "__builtin_aarch64_simd_hf"); (*lang_hooks.types.register_builtin_type) (intSI_type_node, "__builtin_aarch64_simd_si"); (*lang_hooks.types.register_builtin_type) (float_type_node, diff --git a/gcc/config/aarch64/aarch64-simd-builtin-types.def b/gcc/config/aarch64/aarch64-simd-builtin-types.def index bb54e56ce63..ea219b72ff9 100644 --- a/gcc/config/aarch64/aarch64-simd-builtin-types.def +++ b/gcc/config/aarch64/aarch64-simd-builtin-types.def @@ -44,6 +44,8 @@ ENTRY (Poly16x8_t, V8HI, poly, 12) ENTRY (Poly64x1_t, DI, poly, 12) ENTRY (Poly64x2_t, V2DI, poly, 12) + ENTRY (Float16x4_t, V4HF, none, 13) + ENTRY (Float16x8_t, V8HF, none, 13) ENTRY (Float32x2_t, V2SF, none, 13) ENTRY (Float32x4_t, V4SF, none, 13) ENTRY (Float64x1_t, V1DF, none, 13) diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index d0f298a1f07..2c13cfb0823 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -361,17 +361,19 @@ BUILTIN_VSDQ_I_DI (UNOP, abs, 0) BUILTIN_VDQF (UNOP, abs, 2) - VAR1 (UNOP, vec_unpacks_hi_, 10, v4sf) + BUILTIN_VQ_HSF (UNOP, vec_unpacks_hi_, 10) VAR1 (BINOP, float_truncate_hi_, 0, v4sf) + VAR1 (BINOP, float_truncate_hi_, 0, v8hf) VAR1 (UNOP, float_extend_lo_, 0, v2df) - VAR1 (UNOP, float_truncate_lo_, 0, v2sf) + VAR1 (UNOP, float_extend_lo_, 0, v4sf) + BUILTIN_VDF (UNOP, float_truncate_lo_, 0) - /* Implemented by aarch64_ld1<VALL:mode>. */ - BUILTIN_VALL (LOAD1, ld1, 0) + /* Implemented by aarch64_ld1<VALL_F16:mode>. */ + BUILTIN_VALL_F16 (LOAD1, ld1, 0) - /* Implemented by aarch64_st1<VALL:mode>. */ - BUILTIN_VALL (STORE1, st1, 0) + /* Implemented by aarch64_st1<VALL_F16:mode>. */ + BUILTIN_VALL_F16 (STORE1, st1, 0) /* Implemented by fma<mode>4. */ BUILTIN_VDQF (TERNOP, fma, 4) diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 97774181fab..a4eaecae2a0 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -19,8 +19,8 @@ ;; <http://www.gnu.org/licenses/>. (define_expand "mov<mode>" - [(set (match_operand:VALL 0 "nonimmediate_operand" "") - (match_operand:VALL 1 "general_operand" ""))] + [(set (match_operand:VALL_F16 0 "nonimmediate_operand" "") + (match_operand:VALL_F16 1 "general_operand" ""))] "TARGET_SIMD" " if (GET_CODE (operands[0]) == MEM) @@ -53,18 +53,19 @@ ) (define_insn "aarch64_simd_dup<mode>" - [(set (match_operand:VDQF 0 "register_operand" "=w") - (vec_duplicate:VDQF (match_operand:<VEL> 1 "register_operand" "w")))] + [(set (match_operand:VDQF_F16 0 "register_operand" "=w") + (vec_duplicate:VDQF_F16 + (match_operand:<VEL> 1 "register_operand" "w")))] "TARGET_SIMD" "dup\\t%0.<Vtype>, %1.<Vetype>[0]" [(set_attr "type" "neon_dup<q>")] ) (define_insn "aarch64_dup_lane<mode>" - [(set (match_operand:VALL 0 "register_operand" "=w") - (vec_duplicate:VALL + [(set (match_operand:VALL_F16 0 "register_operand" "=w") + (vec_duplicate:VALL_F16 (vec_select:<VEL> - (match_operand:VALL 1 "register_operand" "w") + (match_operand:VALL_F16 1 "register_operand" "w") (parallel [(match_operand:SI 2 "immediate_operand" "i")]) )))] "TARGET_SIMD" @@ -76,8 +77,8 @@ ) (define_insn "aarch64_dup_lane_<vswap_width_name><mode>" - [(set (match_operand:VALL 0 "register_operand" "=w") - (vec_duplicate:VALL + [(set (match_operand:VALL_F16 0 "register_operand" "=w") + (vec_duplicate:VALL_F16 (vec_select:<VEL> (match_operand:<VSWAP_WIDTH> 1 "register_operand" "w") (parallel [(match_operand:SI 2 "immediate_operand" "i")]) @@ -834,11 +835,11 @@ ) (define_insn "aarch64_simd_vec_set<mode>" - [(set (match_operand:VDQF 0 "register_operand" "=w") - (vec_merge:VDQF - (vec_duplicate:VDQF + [(set (match_operand:VDQF_F16 0 "register_operand" "=w") + (vec_merge:VDQF_F16 + (vec_duplicate:VDQF_F16 (match_operand:<VEL> 1 "register_operand" "w")) - (match_operand:VDQF 3 "register_operand" "0") + (match_operand:VDQF_F16 3 "register_operand" "0") (match_operand:SI 2 "immediate_operand" "i")))] "TARGET_SIMD" { @@ -851,7 +852,7 @@ ) (define_expand "vec_set<mode>" - [(match_operand:VDQF 0 "register_operand" "+w") + [(match_operand:VDQF_F16 0 "register_operand" "+w") (match_operand:<VEL> 1 "register_operand" "w") (match_operand:SI 2 "immediate_operand" "")] "TARGET_SIMD" @@ -1691,58 +1692,79 @@ ;; Float widening operations. -(define_insn "vec_unpacks_lo_v4sf" - [(set (match_operand:V2DF 0 "register_operand" "=w") - (float_extend:V2DF - (vec_select:V2SF - (match_operand:V4SF 1 "register_operand" "w") - (parallel [(const_int 0) (const_int 1)]) - )))] +(define_insn "aarch64_simd_vec_unpacks_lo_<mode>" + [(set (match_operand:<VWIDE> 0 "register_operand" "=w") + (float_extend:<VWIDE> (vec_select:<VHALF> + (match_operand:VQ_HSF 1 "register_operand" "w") + (match_operand:VQ_HSF 2 "vect_par_cnst_lo_half" "") + )))] "TARGET_SIMD" - "fcvtl\\t%0.2d, %1.2s" + "fcvtl\\t%0.<Vwtype>, %1.<Vhalftype>" [(set_attr "type" "neon_fp_cvt_widen_s")] ) -(define_insn "aarch64_float_extend_lo_v2df" - [(set (match_operand:V2DF 0 "register_operand" "=w") - (float_extend:V2DF - (match_operand:V2SF 1 "register_operand" "w")))] +(define_expand "vec_unpacks_lo_<mode>" + [(match_operand:<VWIDE> 0 "register_operand" "") + (match_operand:VQ_HSF 1 "register_operand" "")] "TARGET_SIMD" - "fcvtl\\t%0.2d, %1.2s" + { + rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, false); + emit_insn (gen_aarch64_simd_vec_unpacks_lo_<mode> (operands[0], + operands[1], p)); + DONE; + } +) + +(define_insn "aarch64_simd_vec_unpacks_hi_<mode>" + [(set (match_operand:<VWIDE> 0 "register_operand" "=w") + (float_extend:<VWIDE> (vec_select:<VHALF> + (match_operand:VQ_HSF 1 "register_operand" "w") + (match_operand:VQ_HSF 2 "vect_par_cnst_hi_half" "") + )))] + "TARGET_SIMD" + "fcvtl2\\t%0.<Vwtype>, %1.<Vtype>" [(set_attr "type" "neon_fp_cvt_widen_s")] ) -(define_insn "vec_unpacks_hi_v4sf" - [(set (match_operand:V2DF 0 "register_operand" "=w") - (float_extend:V2DF - (vec_select:V2SF - (match_operand:V4SF 1 "register_operand" "w") - (parallel [(const_int 2) (const_int 3)]) - )))] +(define_expand "vec_unpacks_hi_<mode>" + [(match_operand:<VWIDE> 0 "register_operand" "") + (match_operand:VQ_HSF 1 "register_operand" "")] "TARGET_SIMD" - "fcvtl2\\t%0.2d, %1.4s" + { + rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, true); + emit_insn (gen_aarch64_simd_vec_unpacks_lo_<mode> (operands[0], + operands[1], p)); + DONE; + } +) +(define_insn "aarch64_float_extend_lo_<Vwide>" + [(set (match_operand:<VWIDE> 0 "register_operand" "=w") + (float_extend:<VWIDE> + (match_operand:VDF 1 "register_operand" "w")))] + "TARGET_SIMD" + "fcvtl\\t%0<Vmwtype>, %1<Vmtype>" [(set_attr "type" "neon_fp_cvt_widen_s")] ) ;; Float narrowing operations. -(define_insn "aarch64_float_truncate_lo_v2sf" - [(set (match_operand:V2SF 0 "register_operand" "=w") - (float_truncate:V2SF - (match_operand:V2DF 1 "register_operand" "w")))] +(define_insn "aarch64_float_truncate_lo_<mode>" + [(set (match_operand:VDF 0 "register_operand" "=w") + (float_truncate:VDF + (match_operand:<VWIDE> 1 "register_operand" "w")))] "TARGET_SIMD" - "fcvtn\\t%0.2s, %1.2d" + "fcvtn\\t%0.<Vtype>, %1<Vmwtype>" [(set_attr "type" "neon_fp_cvt_narrow_d_q")] ) -(define_insn "aarch64_float_truncate_hi_v4sf" - [(set (match_operand:V4SF 0 "register_operand" "=w") - (vec_concat:V4SF - (match_operand:V2SF 1 "register_operand" "0") - (float_truncate:V2SF - (match_operand:V2DF 2 "register_operand" "w"))))] +(define_insn "aarch64_float_truncate_hi_<Vdbl>" + [(set (match_operand:<VDBL> 0 "register_operand" "=w") + (vec_concat:<VDBL> + (match_operand:VDF 1 "register_operand" "0") + (float_truncate:VDF + (match_operand:<VWIDE> 2 "register_operand" "w"))))] "TARGET_SIMD" - "fcvtn2\\t%0.4s, %2.2d" + "fcvtn2\\t%0.<Vdtype>, %2<Vmwtype>" [(set_attr "type" "neon_fp_cvt_narrow_d_q")] ) @@ -2450,7 +2472,7 @@ (define_insn "aarch64_get_lane<mode>" [(set (match_operand:<VEL> 0 "aarch64_simd_nonimmediate_operand" "=r, w, Utv") (vec_select:<VEL> - (match_operand:VALL 1 "register_operand" "w, w, w") + (match_operand:VALL_F16 1 "register_operand" "w, w, w") (parallel [(match_operand:SI 2 "immediate_operand" "i, i, i")])))] "TARGET_SIMD" { @@ -4243,8 +4265,9 @@ ) (define_insn "aarch64_be_ld1<mode>" - [(set (match_operand:VALLDI 0 "register_operand" "=w") - (unspec:VALLDI [(match_operand:VALLDI 1 "aarch64_simd_struct_operand" "Utv")] + [(set (match_operand:VALLDI_F16 0 "register_operand" "=w") + (unspec:VALLDI_F16 [(match_operand:VALLDI_F16 1 + "aarch64_simd_struct_operand" "Utv")] UNSPEC_LD1))] "TARGET_SIMD" "ld1\\t{%0<Vmtype>}, %1" @@ -4252,8 +4275,8 @@ ) (define_insn "aarch64_be_st1<mode>" - [(set (match_operand:VALLDI 0 "aarch64_simd_struct_operand" "=Utv") - (unspec:VALLDI [(match_operand:VALLDI 1 "register_operand" "w")] + [(set (match_operand:VALLDI_F16 0 "aarch64_simd_struct_operand" "=Utv") + (unspec:VALLDI_F16 [(match_operand:VALLDI_F16 1 "register_operand" "w")] UNSPEC_ST1))] "TARGET_SIMD" "st1\\t{%1<Vmtype>}, %0" @@ -4542,16 +4565,16 @@ DONE; }) -(define_expand "aarch64_ld1<VALL:mode>" - [(match_operand:VALL 0 "register_operand") +(define_expand "aarch64_ld1<VALL_F16:mode>" + [(match_operand:VALL_F16 0 "register_operand") (match_operand:DI 1 "register_operand")] "TARGET_SIMD" { - machine_mode mode = <VALL:MODE>mode; + machine_mode mode = <VALL_F16:MODE>mode; rtx mem = gen_rtx_MEM (mode, operands[1]); if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_be_ld1<VALL:mode> (operands[0], mem)); + emit_insn (gen_aarch64_be_ld1<VALL_F16:mode> (operands[0], mem)); else emit_move_insn (operands[0], mem); DONE; @@ -4566,7 +4589,7 @@ machine_mode mode = <VSTRUCT:MODE>mode; rtx mem = gen_rtx_MEM (mode, operands[1]); - emit_insn (gen_vec_load_lanes<VSTRUCT:mode><VQ:mode> (operands[0], mem)); + emit_insn (gen_aarch64_simd_ld<VSTRUCT:nregs><VQ:mode> (operands[0], mem)); DONE; }) @@ -4669,9 +4692,9 @@ ;; vec_perm support (define_expand "vec_perm_const<mode>" - [(match_operand:VALL 0 "register_operand") - (match_operand:VALL 1 "register_operand") - (match_operand:VALL 2 "register_operand") + [(match_operand:VALL_F16 0 "register_operand") + (match_operand:VALL_F16 1 "register_operand") + (match_operand:VALL_F16 2 "register_operand") (match_operand:<V_cmp_result> 3)] "TARGET_SIMD" { @@ -4849,7 +4872,7 @@ machine_mode mode = <VSTRUCT:MODE>mode; rtx mem = gen_rtx_MEM (mode, operands[0]); - emit_insn (gen_vec_store_lanes<VSTRUCT:mode><VQ:mode> (mem, operands[1])); + emit_insn (gen_aarch64_simd_st<VSTRUCT:nregs><VQ:mode> (mem, operands[1])); DONE; }) @@ -4895,16 +4918,16 @@ DONE; }) -(define_expand "aarch64_st1<VALL:mode>" +(define_expand "aarch64_st1<VALL_F16:mode>" [(match_operand:DI 0 "register_operand") - (match_operand:VALL 1 "register_operand")] + (match_operand:VALL_F16 1 "register_operand")] "TARGET_SIMD" { - machine_mode mode = <VALL:MODE>mode; + machine_mode mode = <VALL_F16:MODE>mode; rtx mem = gen_rtx_MEM (mode, operands[0]); if (BYTES_BIG_ENDIAN) - emit_insn (gen_aarch64_be_st1<VALL:mode> (mem, operands[1])); + emit_insn (gen_aarch64_be_st1<VALL_F16:mode> (mem, operands[1])); else emit_move_insn (mem, operands[1]); DONE; @@ -4935,7 +4958,7 @@ ;; Standard pattern name vec_init<mode>. (define_expand "vec_init<mode>" - [(match_operand:VALL 0 "register_operand" "") + [(match_operand:VALL_F16 0 "register_operand" "") (match_operand 1 "" "")] "TARGET_SIMD" { @@ -4944,8 +4967,8 @@ }) (define_insn "*aarch64_simd_ld1r<mode>" - [(set (match_operand:VALL 0 "register_operand" "=w") - (vec_duplicate:VALL + [(set (match_operand:VALL_F16 0 "register_operand" "=w") + (vec_duplicate:VALL_F16 (match_operand:<VEL> 1 "aarch64_simd_struct_operand" "Utv")))] "TARGET_SIMD" "ld1r\\t{%0.<Vtype>}, %1" @@ -4992,7 +5015,7 @@ (define_expand "vec_extract<mode>" [(match_operand:<VEL> 0 "aarch64_simd_nonimmediate_operand" "") - (match_operand:VALL 1 "register_operand" "") + (match_operand:VALL_F16 1 "register_operand" "") (match_operand:SI 2 "immediate_operand" "")] "TARGET_SIMD" { diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index bc612e47d4f..b2a481b4c29 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -1335,6 +1335,9 @@ aarch64_split_simd_combine (rtx dst, rtx src1, rtx src2) case V2SImode: gen = gen_aarch64_simd_combinev2si; break; + case V4HFmode: + gen = gen_aarch64_simd_combinev4hf; + break; case V2SFmode: gen = gen_aarch64_simd_combinev2sf; break; @@ -1383,6 +1386,9 @@ aarch64_split_simd_move (rtx dst, rtx src) case V2DImode: gen = gen_aarch64_split_simd_movv2di; break; + case V8HFmode: + gen = gen_aarch64_split_simd_movv8hf; + break; case V4SFmode: gen = gen_aarch64_split_simd_movv4sf; break; @@ -6763,6 +6769,25 @@ cost_plus: return true; case MOD: + /* We can expand signed mod by power of 2 using a NEGS, two parallel + ANDs and a CSNEG. Assume here that CSNEG is the same as the cost of + an unconditional negate. This case should only ever be reached through + the set_smod_pow2_cheap check in expmed.c. */ + if (CONST_INT_P (XEXP (x, 1)) + && exact_log2 (INTVAL (XEXP (x, 1))) > 0 + && (mode == SImode || mode == DImode)) + { + /* We expand to 4 instructions. Reset the baseline. */ + *cost = COSTS_N_INSNS (4); + + if (speed) + *cost += 2 * extra_cost->alu.logical + + 2 * extra_cost->alu.arith; + + return true; + } + + /* Fall-through. */ case UMOD: if (speed) { @@ -9780,6 +9805,7 @@ aarch64_vector_mode_supported_p (machine_mode mode) || mode == V2SImode || mode == V4HImode || mode == V8QImode || mode == V2SFmode || mode == V4SFmode || mode == V2DFmode + || mode == V4HFmode || mode == V8HFmode || mode == V1DFmode)) return true; @@ -11899,6 +11925,8 @@ aarch64_evpc_dup (struct expand_vec_perm_d *d) case V4SImode: gen = gen_aarch64_dup_lanev4si; break; case V2SImode: gen = gen_aarch64_dup_lanev2si; break; case V2DImode: gen = gen_aarch64_dup_lanev2di; break; + case V8HFmode: gen = gen_aarch64_dup_lanev8hf; break; + case V4HFmode: gen = gen_aarch64_dup_lanev4hf; break; case V4SFmode: gen = gen_aarch64_dup_lanev4sf; break; case V2SFmode: gen = gen_aarch64_dup_lanev2sf; break; case V2DFmode: gen = gen_aarch64_dup_lanev2df; break; diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 1e5f5dbd4fa..9669e014882 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -875,7 +875,8 @@ extern enum aarch64_code_model aarch64_cmodel; /* Modes valid for AdvSIMD Q registers. */ #define AARCH64_VALID_SIMD_QREG_MODE(MODE) \ ((MODE) == V4SImode || (MODE) == V8HImode || (MODE) == V16QImode \ - || (MODE) == V4SFmode || (MODE) == V2DImode || mode == V2DFmode) + || (MODE) == V4SFmode || (MODE) == V8HFmode || (MODE) == V2DImode \ + || (MODE) == V2DFmode) #define ENDIAN_LANE_N(mode, n) \ (BYTES_BIG_ENDIAN ? GET_MODE_NUNITS (mode) - 1 - n : n) diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 25229824fb5..5a005b572c8 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -313,6 +313,62 @@ } ) +;; Expansion of signed mod by a power of 2 using CSNEG. +;; For x0 % n where n is a power of 2 produce: +;; negs x1, x0 +;; and x0, x0, #(n - 1) +;; and x1, x1, #(n - 1) +;; csneg x0, x0, x1, mi + +(define_expand "mod<mode>3" + [(match_operand:GPI 0 "register_operand" "") + (match_operand:GPI 1 "register_operand" "") + (match_operand:GPI 2 "const_int_operand" "")] + "" + { + HOST_WIDE_INT val = INTVAL (operands[2]); + + if (val <= 0 + || exact_log2 (val) <= 0 + || !aarch64_bitmask_imm (val - 1, <MODE>mode)) + FAIL; + + rtx mask = GEN_INT (val - 1); + + /* In the special case of x0 % 2 we can do the even shorter: + cmp x0, xzr + and x0, x0, 1 + cneg x0, x0, lt. */ + if (val == 2) + { + rtx masked = gen_reg_rtx (<MODE>mode); + rtx ccreg = aarch64_gen_compare_reg (LT, operands[1], const0_rtx); + emit_insn (gen_and<mode>3 (masked, operands[1], mask)); + rtx x = gen_rtx_LT (VOIDmode, ccreg, const0_rtx); + emit_insn (gen_csneg3<mode>_insn (operands[0], x, masked, masked)); + DONE; + } + + rtx neg_op = gen_reg_rtx (<MODE>mode); + rtx_insn *insn = emit_insn (gen_neg<mode>2_compare0 (neg_op, operands[1])); + + /* Extract the condition register and mode. */ + rtx cmp = XVECEXP (PATTERN (insn), 0, 0); + rtx cc_reg = SET_DEST (cmp); + rtx cond = gen_rtx_GE (VOIDmode, cc_reg, const0_rtx); + + rtx masked_pos = gen_reg_rtx (<MODE>mode); + emit_insn (gen_and<mode>3 (masked_pos, operands[1], mask)); + + rtx masked_neg = gen_reg_rtx (<MODE>mode); + emit_insn (gen_and<mode>3 (masked_neg, neg_op, mask)); + + emit_insn (gen_csneg3<mode>_insn (operands[0], cond, + masked_neg, masked_pos)); + DONE; + } +) + (define_insn "*condjump" [(set (pc) (if_then_else (match_operator 0 "aarch64_comparison_operator" [(match_operand 1 "cc_register" "") (const_int 0)]) @@ -1043,8 +1099,8 @@ }) (define_expand "mov<mode>" - [(set (match_operand:GPF_F16 0 "nonimmediate_operand" "") - (match_operand:GPF_F16 1 "general_operand" ""))] + [(set (match_operand:GPF_TF_F16 0 "nonimmediate_operand" "") + (match_operand:GPF_TF_F16 1 "general_operand" ""))] "" { if (!TARGET_FLOAT) @@ -1118,24 +1174,6 @@ f_loadd,f_stored,load1,store1,mov_reg")] ) -(define_expand "movtf" - [(set (match_operand:TF 0 "nonimmediate_operand" "") - (match_operand:TF 1 "general_operand" ""))] - "" - { - if (!TARGET_FLOAT) - { - aarch64_err_no_fpadvsimd (TFmode, "code"); - FAIL; - } - - if (GET_CODE (operands[0]) == MEM - && ! (GET_CODE (operands[1]) == CONST_DOUBLE - && aarch64_float_const_zero_rtx_p (operands[1]))) - operands[1] = force_reg (TFmode, operands[1]); - } -) - (define_insn "*movtf_aarch64" [(set (match_operand:TF 0 "nonimmediate_operand" "=w,?&r,w ,?r,w,?w,w,m,?r ,Ump,Ump") @@ -2457,7 +2495,7 @@ [(set_attr "type" "adc_reg")] ) -(define_insn "*neg<mode>2_compare0" +(define_insn "neg<mode>2_compare0" [(set (reg:CC_NZ CC_REGNUM) (compare:CC_NZ (neg:GPI (match_operand:GPI 1 "register_operand" "r")) (const_int 0))) @@ -3501,7 +3539,7 @@ (const_int 0)))] "" "tst\\t%<w>0, %<w>1" - [(set_attr "type" "logics_reg")] + [(set_attr "type" "logics_reg,logics_imm")] ) (define_insn "*and_<SHIFT:optab><mode>3nr_compare0" diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index 6dfebe7eea6..91ada618b79 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -39,6 +39,7 @@ typedef __Int8x8_t int8x8_t; typedef __Int16x4_t int16x4_t; typedef __Int32x2_t int32x2_t; typedef __Int64x1_t int64x1_t; +typedef __Float16x4_t float16x4_t; typedef __Float32x2_t float32x2_t; typedef __Poly8x8_t poly8x8_t; typedef __Poly16x4_t poly16x4_t; @@ -51,6 +52,7 @@ typedef __Int8x16_t int8x16_t; typedef __Int16x8_t int16x8_t; typedef __Int32x4_t int32x4_t; typedef __Int64x2_t int64x2_t; +typedef __Float16x8_t float16x8_t; typedef __Float32x4_t float32x4_t; typedef __Float64x2_t float64x2_t; typedef __Poly8x16_t poly8x16_t; @@ -66,6 +68,7 @@ typedef __Poly16_t poly16_t; typedef __Poly64_t poly64_t; typedef __Poly128_t poly128_t; +typedef __fp16 float16_t; typedef float float32_t; typedef double float64_t; @@ -149,6 +152,16 @@ typedef struct uint64x2x2_t uint64x2_t val[2]; } uint64x2x2_t; +typedef struct float16x4x2_t +{ + float16x4_t val[2]; +} float16x4x2_t; + +typedef struct float16x8x2_t +{ + float16x8_t val[2]; +} float16x8x2_t; + typedef struct float32x2x2_t { float32x2_t val[2]; @@ -269,6 +282,16 @@ typedef struct uint64x2x3_t uint64x2_t val[3]; } uint64x2x3_t; +typedef struct float16x4x3_t +{ + float16x4_t val[3]; +} float16x4x3_t; + +typedef struct float16x8x3_t +{ + float16x8_t val[3]; +} float16x8x3_t; + typedef struct float32x2x3_t { float32x2_t val[3]; @@ -389,6 +412,16 @@ typedef struct uint64x2x4_t uint64x2_t val[4]; } uint64x2x4_t; +typedef struct float16x4x4_t +{ + float16x4_t val[4]; +} float16x4x4_t; + +typedef struct float16x8x4_t +{ + float16x8_t val[4]; +} float16x8x4_t; + typedef struct float32x2x4_t { float32x2_t val[4]; @@ -2640,6 +2673,12 @@ vcreate_s64 (uint64_t __a) return (int64x1_t) {__a}; } +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vcreate_f16 (uint64_t __a) +{ + return (float16x4_t) __a; +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vcreate_f32 (uint64_t __a) { @@ -2690,6 +2729,12 @@ vcreate_p16 (uint64_t __a) /* vget_lane */ +__extension__ static __inline float16_t __attribute__ ((__always_inline__)) +vget_lane_f16 (float16x4_t __a, const int __b) +{ + return __aarch64_vget_lane_any (__a, __b); +} + __extension__ static __inline float32_t __attribute__ ((__always_inline__)) vget_lane_f32 (float32x2_t __a, const int __b) { @@ -2764,6 +2809,12 @@ vget_lane_u64 (uint64x1_t __a, const int __b) /* vgetq_lane */ +__extension__ static __inline float16_t __attribute__ ((__always_inline__)) +vgetq_lane_f16 (float16x8_t __a, const int __b) +{ + return __aarch64_vget_lane_any (__a, __b); +} + __extension__ static __inline float32_t __attribute__ ((__always_inline__)) vgetq_lane_f32 (float32x4_t __a, const int __b) { @@ -2839,6 +2890,12 @@ vgetq_lane_u64 (uint64x2_t __a, const int __b) /* vreinterpret */ __extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) +vreinterpret_p8_f16 (float16x4_t __a) +{ + return (poly8x8_t) __a; +} + +__extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) vreinterpret_p8_f64 (float64x1_t __a) { return (poly8x8_t) __a; @@ -2935,6 +2992,12 @@ vreinterpretq_p8_s64 (int64x2_t __a) } __extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_p8_f16 (float16x8_t __a) +{ + return (poly8x16_t) __a; +} + +__extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) vreinterpretq_p8_f32 (float32x4_t __a) { return (poly8x16_t) __a; @@ -2971,6 +3034,12 @@ vreinterpretq_p8_p16 (poly16x8_t __a) } __extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) +vreinterpret_p16_f16 (float16x4_t __a) +{ + return (poly16x4_t) __a; +} + +__extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) vreinterpret_p16_f64 (float64x1_t __a) { return (poly16x4_t) __a; @@ -3067,6 +3136,12 @@ vreinterpretq_p16_s64 (int64x2_t __a) } __extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_p16_f16 (float16x8_t __a) +{ + return (poly16x8_t) __a; +} + +__extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) vreinterpretq_p16_f32 (float32x4_t __a) { return (poly16x8_t) __a; @@ -3102,6 +3177,156 @@ vreinterpretq_p16_p8 (poly8x16_t __a) return (poly16x8_t) __a; } +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_f64 (float64x1_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s8 (int8x8_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s16 (int16x4_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s32 (int32x2_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s64 (int64x1_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_f32 (float32x2_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u8 (uint8x8_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u16 (uint16x4_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u32 (uint32x2_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u64 (uint64x1_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_p8 (poly8x8_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_p16 (poly16x4_t __a) +{ + return (float16x4_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_f64 (float64x2_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s8 (int8x16_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s16 (int16x8_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s32 (int32x4_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s64 (int64x2_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_f32 (float32x4_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u8 (uint8x16_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u16 (uint16x8_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u32 (uint32x4_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u64 (uint64x2_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p8 (poly8x16_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p16 (poly16x8_t __a) +{ + return (float16x8_t) __a; +} + +__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) +vreinterpret_f32_f16 (float16x4_t __a) +{ + return (float32x2_t) __a; +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vreinterpret_f32_f64 (float64x1_t __a) { @@ -3169,6 +3394,12 @@ vreinterpret_f32_p16 (poly16x4_t __a) } __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_f32_f16 (float16x8_t __a) +{ + return (float32x4_t) __a; +} + +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vreinterpretq_f32_f64 (float64x2_t __a) { return (float32x4_t) __a; @@ -3235,6 +3466,12 @@ vreinterpretq_f32_p16 (poly16x8_t __a) } __extension__ static __inline float64x1_t __attribute__((__always_inline__)) +vreinterpret_f64_f16 (float16x4_t __a) +{ + return (float64x1_t) __a; +} + +__extension__ static __inline float64x1_t __attribute__((__always_inline__)) vreinterpret_f64_f32 (float32x2_t __a) { return (float64x1_t) __a; @@ -3301,6 +3538,12 @@ vreinterpret_f64_u64 (uint64x1_t __a) } __extension__ static __inline float64x2_t __attribute__((__always_inline__)) +vreinterpretq_f64_f16 (float16x8_t __a) +{ + return (float64x2_t) __a; +} + +__extension__ static __inline float64x2_t __attribute__((__always_inline__)) vreinterpretq_f64_f32 (float32x4_t __a) { return (float64x2_t) __a; @@ -3367,6 +3610,12 @@ vreinterpretq_f64_u64 (uint64x2_t __a) } __extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) +vreinterpret_s64_f16 (float16x4_t __a) +{ + return (int64x1_t) __a; +} + +__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) vreinterpret_s64_f64 (float64x1_t __a) { return (int64x1_t) __a; @@ -3457,6 +3706,12 @@ vreinterpretq_s64_s32 (int32x4_t __a) } __extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) +vreinterpretq_s64_f16 (float16x8_t __a) +{ + return (int64x2_t) __a; +} + +__extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) vreinterpretq_s64_f32 (float32x4_t __a) { return (int64x2_t) __a; @@ -3499,6 +3754,12 @@ vreinterpretq_s64_p16 (poly16x8_t __a) } __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) +vreinterpret_u64_f16 (float16x4_t __a) +{ + return (uint64x1_t) __a; +} + +__extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) vreinterpret_u64_f64 (float64x1_t __a) { return (uint64x1_t) __a; @@ -3595,6 +3856,12 @@ vreinterpretq_u64_s64 (int64x2_t __a) } __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) +vreinterpretq_u64_f16 (float16x8_t __a) +{ + return (uint64x2_t) __a; +} + +__extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) vreinterpretq_u64_f32 (float32x4_t __a) { return (uint64x2_t) __a; @@ -3631,6 +3898,12 @@ vreinterpretq_u64_p16 (poly16x8_t __a) } __extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +vreinterpret_s8_f16 (float16x4_t __a) +{ + return (int8x8_t) __a; +} + +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) vreinterpret_s8_f64 (float64x1_t __a) { return (int8x8_t) __a; @@ -3721,6 +3994,12 @@ vreinterpretq_s8_s64 (int64x2_t __a) } __extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_s8_f16 (float16x8_t __a) +{ + return (int8x16_t) __a; +} + +__extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) vreinterpretq_s8_f32 (float32x4_t __a) { return (int8x16_t) __a; @@ -3763,6 +4042,12 @@ vreinterpretq_s8_p16 (poly16x8_t __a) } __extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +vreinterpret_s16_f16 (float16x4_t __a) +{ + return (int16x4_t) __a; +} + +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) vreinterpret_s16_f64 (float64x1_t __a) { return (int16x4_t) __a; @@ -3853,6 +4138,12 @@ vreinterpretq_s16_s64 (int64x2_t __a) } __extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_s16_f16 (float16x8_t __a) +{ + return (int16x8_t) __a; +} + +__extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) vreinterpretq_s16_f32 (float32x4_t __a) { return (int16x8_t) __a; @@ -3895,6 +4186,12 @@ vreinterpretq_s16_p16 (poly16x8_t __a) } __extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +vreinterpret_s32_f16 (float16x4_t __a) +{ + return (int32x2_t) __a; +} + +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) vreinterpret_s32_f64 (float64x1_t __a) { return (int32x2_t) __a; @@ -3985,6 +4282,12 @@ vreinterpretq_s32_s64 (int64x2_t __a) } __extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_s32_f16 (float16x8_t __a) +{ + return (int32x4_t) __a; +} + +__extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) vreinterpretq_s32_f32 (float32x4_t __a) { return (int32x4_t) __a; @@ -4027,6 +4330,12 @@ vreinterpretq_s32_p16 (poly16x8_t __a) } __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +vreinterpret_u8_f16 (float16x4_t __a) +{ + return (uint8x8_t) __a; +} + +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) vreinterpret_u8_f64 (float64x1_t __a) { return (uint8x8_t) __a; @@ -4123,6 +4432,12 @@ vreinterpretq_u8_s64 (int64x2_t __a) } __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_u8_f16 (float16x8_t __a) +{ + return (uint8x16_t) __a; +} + +__extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) vreinterpretq_u8_f32 (float32x4_t __a) { return (uint8x16_t) __a; @@ -4159,6 +4474,12 @@ vreinterpretq_u8_p16 (poly16x8_t __a) } __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +vreinterpret_u16_f16 (float16x4_t __a) +{ + return (uint16x4_t) __a; +} + +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) vreinterpret_u16_f64 (float64x1_t __a) { return (uint16x4_t) __a; @@ -4255,6 +4576,12 @@ vreinterpretq_u16_s64 (int64x2_t __a) } __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_u16_f16 (float16x8_t __a) +{ + return (uint16x8_t) __a; +} + +__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) vreinterpretq_u16_f32 (float32x4_t __a) { return (uint16x8_t) __a; @@ -4291,6 +4618,12 @@ vreinterpretq_u16_p16 (poly16x8_t __a) } __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +vreinterpret_u32_f16 (float16x4_t __a) +{ + return (uint32x2_t) __a; +} + +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) vreinterpret_u32_f64 (float64x1_t __a) { return (uint32x2_t) __a; @@ -4387,6 +4720,12 @@ vreinterpretq_u32_s64 (int64x2_t __a) } __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_u32_f16 (float16x8_t __a) +{ + return (uint32x4_t) __a; +} + +__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) vreinterpretq_u32_f32 (float32x4_t __a) { return (uint32x4_t) __a; @@ -4424,6 +4763,12 @@ vreinterpretq_u32_p16 (poly16x8_t __a) /* vset_lane */ +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vset_lane_f16 (float16_t __elem, float16x4_t __vec, const int __index) +{ + return __aarch64_vset_lane_any (__elem, __vec, __index); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vset_lane_f32 (float32_t __elem, float32x2_t __vec, const int __index) { @@ -4498,6 +4843,12 @@ vset_lane_u64 (uint64_t __elem, uint64x1_t __vec, const int __index) /* vsetq_lane */ +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vsetq_lane_f16 (float16_t __elem, float16x8_t __vec, const int __index) +{ + return __aarch64_vset_lane_any (__elem, __vec, __index); +} + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vsetq_lane_f32 (float32_t __elem, float32x4_t __vec, const int __index) { @@ -4575,6 +4926,12 @@ vsetq_lane_u64 (uint64_t __elem, uint64x2_t __vec, const int __index) uint64x1_t lo = vcreate_u64 (vgetq_lane_u64 (tmp, 0)); \ return vreinterpret_##__TYPE##_u64 (lo); +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vget_low_f16 (float16x8_t __a) +{ + __GET_LOW (f16); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vget_low_f32 (float32x4_t __a) { @@ -4654,6 +5011,12 @@ vget_low_u64 (uint64x2_t __a) uint64x1_t hi = vcreate_u64 (vgetq_lane_u64 (tmp, 1)); \ return vreinterpret_##__TYPE##_u64 (hi); +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vget_high_f16 (float16x8_t __a) +{ + __GET_HIGH (f16); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vget_high_f32 (float32x4_t __a) { @@ -4752,6 +5115,12 @@ vcombine_s64 (int64x1_t __a, int64x1_t __b) return __builtin_aarch64_combinedi (__a[0], __b[0]); } +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vcombine_f16 (float16x4_t __a, float16x4_t __b) +{ + return __builtin_aarch64_combinev4hf (__a, __b); +} + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vcombine_f32 (float32x2_t __a, float32x2_t __b) { @@ -5656,14 +6025,6 @@ vaddlvq_u32 (uint32x4_t a) result; \ }) -/* vcvt_f16_f32 not supported */ - -/* vcvt_f32_f16 not supported */ - -/* vcvt_high_f16_f32 not supported */ - -/* vcvt_high_f32_f16 not supported */ - #define vcvt_n_f32_s32(a, b) \ __extension__ \ ({ \ @@ -9880,7 +10241,7 @@ vtstq_p16 (poly16x8_t a, poly16x8_t b) +------+----+----+----+----+ |uint | Y | Y | N | N | +------+----+----+----+----+ - |float | - | - | N | N | + |float | - | Y | N | N | +------+----+----+----+----+ |poly | Y | Y | - | - | +------+----+----+----+----+ @@ -9894,7 +10255,7 @@ vtstq_p16 (poly16x8_t a, poly16x8_t b) +------+----+----+----+----+ |uint | Y | Y | Y | Y | +------+----+----+----+----+ - |float | - | - | Y | Y | + |float | - | Y | Y | Y | +------+----+----+----+----+ |poly | Y | Y | - | - | +------+----+----+----+----+ @@ -9908,7 +10269,7 @@ vtstq_p16 (poly16x8_t a, poly16x8_t b) +------+----+----+----+----+ |uint | Y | N | N | Y | +------+----+----+----+----+ - |float | - | - | N | Y | + |float | - | N | N | Y | +------+----+----+----+----+ |poly | Y | N | - | - | +------+----+----+----+----+ @@ -9924,6 +10285,7 @@ __STRUCTN (int, 8, 2) __STRUCTN (int, 16, 2) __STRUCTN (uint, 8, 2) __STRUCTN (uint, 16, 2) +__STRUCTN (float, 16, 2) __STRUCTN (poly, 8, 2) __STRUCTN (poly, 16, 2) /* 3-element structs. */ @@ -9935,6 +10297,7 @@ __STRUCTN (uint, 8, 3) __STRUCTN (uint, 16, 3) __STRUCTN (uint, 32, 3) __STRUCTN (uint, 64, 3) +__STRUCTN (float, 16, 3) __STRUCTN (float, 32, 3) __STRUCTN (float, 64, 3) __STRUCTN (poly, 8, 3) @@ -9972,6 +10335,8 @@ vst2_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __o, __c); \ } +__ST2_LANE_FUNC (float16x4x2_t, float16x8x2_t, float16_t, v4hf, v8hf, hf, f16, + float16x8_t) __ST2_LANE_FUNC (float32x2x2_t, float32x4x2_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __ST2_LANE_FUNC (float64x1x2_t, float64x2x2_t, float64_t, df, v2df, df, f64, @@ -10010,6 +10375,7 @@ vst2q_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __temp.__o, __c); \ } +__ST2_LANE_FUNC (float16x8x2_t, float16_t, v8hf, hf, f16) __ST2_LANE_FUNC (float32x4x2_t, float32_t, v4sf, sf, f32) __ST2_LANE_FUNC (float64x2x2_t, float64_t, v2df, df, f64) __ST2_LANE_FUNC (poly8x16x2_t, poly8_t, v16qi, qi, p8) @@ -10051,6 +10417,8 @@ vst3_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __o, __c); \ } +__ST3_LANE_FUNC (float16x4x3_t, float16x8x3_t, float16_t, v4hf, v8hf, hf, f16, + float16x8_t) __ST3_LANE_FUNC (float32x2x3_t, float32x4x3_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __ST3_LANE_FUNC (float64x1x3_t, float64x2x3_t, float64_t, df, v2df, df, f64, @@ -10089,6 +10457,7 @@ vst3q_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __temp.__o, __c); \ } +__ST3_LANE_FUNC (float16x8x3_t, float16_t, v8hf, hf, f16) __ST3_LANE_FUNC (float32x4x3_t, float32_t, v4sf, sf, f32) __ST3_LANE_FUNC (float64x2x3_t, float64_t, v2df, df, f64) __ST3_LANE_FUNC (poly8x16x3_t, poly8_t, v16qi, qi, p8) @@ -10135,6 +10504,8 @@ vst4_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __o, __c); \ } +__ST4_LANE_FUNC (float16x4x4_t, float16x8x4_t, float16_t, v4hf, v8hf, hf, f16, + float16x8_t) __ST4_LANE_FUNC (float32x2x4_t, float32x4x4_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __ST4_LANE_FUNC (float64x1x4_t, float64x2x4_t, float64_t, df, v2df, df, f64, @@ -10173,6 +10544,7 @@ vst4q_lane_ ## funcsuffix (ptrtype *__ptr, \ __ptr, __temp.__o, __c); \ } +__ST4_LANE_FUNC (float16x8x4_t, float16_t, v8hf, hf, f16) __ST4_LANE_FUNC (float32x4x4_t, float32_t, v4sf, sf, f32) __ST4_LANE_FUNC (float64x2x4_t, float64_t, v2df, df, f64) __ST4_LANE_FUNC (poly8x16x4_t, poly8_t, v16qi, qi, p8) @@ -13034,6 +13406,18 @@ vcntq_u8 (uint8x16_t __a) /* vcvt (double -> float). */ +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vcvt_f16_f32 (float32x4_t __a) +{ + return __builtin_aarch64_float_truncate_lo_v4hf (__a); +} + +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vcvt_high_f16_f32 (float16x4_t __a, float32x4_t __b) +{ + return __builtin_aarch64_float_truncate_hi_v8hf (__a, __b); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vcvt_f32_f64 (float64x2_t __a) { @@ -13048,6 +13432,12 @@ vcvt_high_f32_f64 (float32x2_t __a, float64x2_t __b) /* vcvt (float -> double). */ +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vcvt_f32_f16 (float16x4_t __a) +{ + return __builtin_aarch64_float_extend_lo_v4sf (__a); +} + __extension__ static __inline float64x2_t __attribute__ ((__always_inline__)) vcvt_f64_f32 (float32x2_t __a) { @@ -13055,6 +13445,12 @@ vcvt_f64_f32 (float32x2_t __a) return __builtin_aarch64_float_extend_lo_v2df (__a); } +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vcvt_high_f32_f16 (float16x8_t __a) +{ + return __builtin_aarch64_vec_unpacks_hi_v8hf (__a); +} + __extension__ static __inline float64x2_t __attribute__ ((__always_inline__)) vcvt_high_f64_f32 (float32x4_t __a) { @@ -14628,6 +15024,12 @@ vfmsq_laneq_f64 (float64x2_t __a, float64x2_t __b, /* vld1 */ +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_f16 (const float16_t *__a) +{ + return __builtin_aarch64_ld1v4hf (__a); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_f32 (const float32_t *a) { @@ -14707,6 +15109,12 @@ vld1_u64 (const uint64_t *a) /* vld1q */ +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_f16 (const float16_t *__a) +{ + return __builtin_aarch64_ld1v8hf (__a); +} + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_f32 (const float32_t *a) { @@ -14787,6 +15195,13 @@ vld1q_u64 (const uint64_t *a) /* vld1_dup */ +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_dup_f16 (const float16_t* __a) +{ + float16_t __f = *__a; + return (float16x4_t) { __f, __f, __f, __f }; +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_dup_f32 (const float32_t* __a) { @@ -14861,6 +15276,13 @@ vld1_dup_u64 (const uint64_t* __a) /* vld1q_dup */ +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_dup_f16 (const float16_t* __a) +{ + float16_t __f = *__a; + return (float16x8_t) { __f, __f, __f, __f, __f, __f, __f, __f }; +} + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_dup_f32 (const float32_t* __a) { @@ -14935,6 +15357,12 @@ vld1q_dup_u64 (const uint64_t* __a) /* vld1_lane */ +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_lane_f16 (const float16_t *__src, float16x4_t __vec, const int __lane) +{ + return __aarch64_vset_lane_any (*__src, __vec, __lane); +} + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_lane_f32 (const float32_t *__src, float32x2_t __vec, const int __lane) { @@ -15009,6 +15437,12 @@ vld1_lane_u64 (const uint64_t *__src, uint64x1_t __vec, const int __lane) /* vld1q_lane */ +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_lane_f16 (const float16_t *__src, float16x8_t __vec, const int __lane) +{ + return __aarch64_vset_lane_any (*__src, __vec, __lane); +} + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_lane_f32 (const float32_t *__src, float32x4_t __vec, const int __lane) { @@ -15204,6 +15638,17 @@ vld2_u32 (const uint32_t * __a) return ret; } +__extension__ static __inline float16x4x2_t __attribute__ ((__always_inline__)) +vld2_f16 (const float16_t * __a) +{ + float16x4x2_t ret; + __builtin_aarch64_simd_oi __o; + __o = __builtin_aarch64_ld2v4hf (__a); + ret.val[0] = __builtin_aarch64_get_dregoiv4hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_dregoiv4hf (__o, 1); + return ret; +} + __extension__ static __inline float32x2x2_t __attribute__ ((__always_inline__)) vld2_f32 (const float32_t * __a) { @@ -15325,6 +15770,17 @@ vld2q_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x2_t __attribute__ ((__always_inline__)) +vld2q_f16 (const float16_t * __a) +{ + float16x8x2_t ret; + __builtin_aarch64_simd_oi __o; + __o = __builtin_aarch64_ld2v8hf (__a); + ret.val[0] = __builtin_aarch64_get_qregoiv8hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_qregoiv8hf (__o, 1); + return ret; +} + __extension__ static __inline float32x4x2_t __attribute__ ((__always_inline__)) vld2q_f32 (const float32_t * __a) { @@ -15479,6 +15935,18 @@ vld3_u32 (const uint32_t * __a) return ret; } +__extension__ static __inline float16x4x3_t __attribute__ ((__always_inline__)) +vld3_f16 (const float16_t * __a) +{ + float16x4x3_t ret; + __builtin_aarch64_simd_ci __o; + __o = __builtin_aarch64_ld3v4hf (__a); + ret.val[0] = __builtin_aarch64_get_dregciv4hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_dregciv4hf (__o, 1); + ret.val[2] = __builtin_aarch64_get_dregciv4hf (__o, 2); + return ret; +} + __extension__ static __inline float32x2x3_t __attribute__ ((__always_inline__)) vld3_f32 (const float32_t * __a) { @@ -15611,6 +16079,18 @@ vld3q_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x3_t __attribute__ ((__always_inline__)) +vld3q_f16 (const float16_t * __a) +{ + float16x8x3_t ret; + __builtin_aarch64_simd_ci __o; + __o = __builtin_aarch64_ld3v8hf (__a); + ret.val[0] = __builtin_aarch64_get_qregciv8hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_qregciv8hf (__o, 1); + ret.val[2] = __builtin_aarch64_get_qregciv8hf (__o, 2); + return ret; +} + __extension__ static __inline float32x4x3_t __attribute__ ((__always_inline__)) vld3q_f32 (const float32_t * __a) { @@ -15778,6 +16258,19 @@ vld4_u32 (const uint32_t * __a) return ret; } +__extension__ static __inline float16x4x4_t __attribute__ ((__always_inline__)) +vld4_f16 (const float16_t * __a) +{ + float16x4x4_t ret; + __builtin_aarch64_simd_xi __o; + __o = __builtin_aarch64_ld4v4hf (__a); + ret.val[0] = __builtin_aarch64_get_dregxiv4hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_dregxiv4hf (__o, 1); + ret.val[2] = __builtin_aarch64_get_dregxiv4hf (__o, 2); + ret.val[3] = __builtin_aarch64_get_dregxiv4hf (__o, 3); + return ret; +} + __extension__ static __inline float32x2x4_t __attribute__ ((__always_inline__)) vld4_f32 (const float32_t * __a) { @@ -15921,6 +16414,19 @@ vld4q_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x4_t __attribute__ ((__always_inline__)) +vld4q_f16 (const float16_t * __a) +{ + float16x8x4_t ret; + __builtin_aarch64_simd_xi __o; + __o = __builtin_aarch64_ld4v8hf (__a); + ret.val[0] = __builtin_aarch64_get_qregxiv8hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_qregxiv8hf (__o, 1); + ret.val[2] = __builtin_aarch64_get_qregxiv8hf (__o, 2); + ret.val[3] = __builtin_aarch64_get_qregxiv8hf (__o, 3); + return ret; +} + __extension__ static __inline float32x4x4_t __attribute__ ((__always_inline__)) vld4q_f32 (const float32_t * __a) { @@ -15982,6 +16488,17 @@ vld2_dup_s32 (const int32_t * __a) return ret; } +__extension__ static __inline float16x4x2_t __attribute__ ((__always_inline__)) +vld2_dup_f16 (const float16_t * __a) +{ + float16x4x2_t ret; + __builtin_aarch64_simd_oi __o; + __o = __builtin_aarch64_ld2rv4hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = __builtin_aarch64_get_dregoiv4hf (__o, 0); + ret.val[1] = (float16x4_t) __builtin_aarch64_get_dregoiv4hf (__o, 1); + return ret; +} + __extension__ static __inline float32x2x2_t __attribute__ ((__always_inline__)) vld2_dup_f32 (const float32_t * __a) { @@ -16191,6 +16708,17 @@ vld2q_dup_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x2_t __attribute__ ((__always_inline__)) +vld2q_dup_f16 (const float16_t * __a) +{ + float16x8x2_t ret; + __builtin_aarch64_simd_oi __o; + __o = __builtin_aarch64_ld2rv8hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = (float16x8_t) __builtin_aarch64_get_qregoiv8hf (__o, 0); + ret.val[1] = __builtin_aarch64_get_qregoiv8hf (__o, 1); + return ret; +} + __extension__ static __inline float32x4x2_t __attribute__ ((__always_inline__)) vld2q_dup_f32 (const float32_t * __a) { @@ -16345,6 +16873,18 @@ vld3_dup_u32 (const uint32_t * __a) return ret; } +__extension__ static __inline float16x4x3_t __attribute__ ((__always_inline__)) +vld3_dup_f16 (const float16_t * __a) +{ + float16x4x3_t ret; + __builtin_aarch64_simd_ci __o; + __o = __builtin_aarch64_ld3rv4hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = (float16x4_t) __builtin_aarch64_get_dregciv4hf (__o, 0); + ret.val[1] = (float16x4_t) __builtin_aarch64_get_dregciv4hf (__o, 1); + ret.val[2] = (float16x4_t) __builtin_aarch64_get_dregciv4hf (__o, 2); + return ret; +} + __extension__ static __inline float32x2x3_t __attribute__ ((__always_inline__)) vld3_dup_f32 (const float32_t * __a) { @@ -16477,6 +17017,18 @@ vld3q_dup_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x3_t __attribute__ ((__always_inline__)) +vld3q_dup_f16 (const float16_t * __a) +{ + float16x8x3_t ret; + __builtin_aarch64_simd_ci __o; + __o = __builtin_aarch64_ld3rv8hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = (float16x8_t) __builtin_aarch64_get_qregciv8hf (__o, 0); + ret.val[1] = (float16x8_t) __builtin_aarch64_get_qregciv8hf (__o, 1); + ret.val[2] = (float16x8_t) __builtin_aarch64_get_qregciv8hf (__o, 2); + return ret; +} + __extension__ static __inline float32x4x3_t __attribute__ ((__always_inline__)) vld3q_dup_f32 (const float32_t * __a) { @@ -16644,6 +17196,19 @@ vld4_dup_u32 (const uint32_t * __a) return ret; } +__extension__ static __inline float16x4x4_t __attribute__ ((__always_inline__)) +vld4_dup_f16 (const float16_t * __a) +{ + float16x4x4_t ret; + __builtin_aarch64_simd_xi __o; + __o = __builtin_aarch64_ld4rv4hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = (float16x4_t) __builtin_aarch64_get_dregxiv4hf (__o, 0); + ret.val[1] = (float16x4_t) __builtin_aarch64_get_dregxiv4hf (__o, 1); + ret.val[2] = (float16x4_t) __builtin_aarch64_get_dregxiv4hf (__o, 2); + ret.val[3] = (float16x4_t) __builtin_aarch64_get_dregxiv4hf (__o, 3); + return ret; +} + __extension__ static __inline float32x2x4_t __attribute__ ((__always_inline__)) vld4_dup_f32 (const float32_t * __a) { @@ -16787,6 +17352,19 @@ vld4q_dup_u64 (const uint64_t * __a) return ret; } +__extension__ static __inline float16x8x4_t __attribute__ ((__always_inline__)) +vld4q_dup_f16 (const float16_t * __a) +{ + float16x8x4_t ret; + __builtin_aarch64_simd_xi __o; + __o = __builtin_aarch64_ld4rv8hf ((const __builtin_aarch64_simd_hf *) __a); + ret.val[0] = (float16x8_t) __builtin_aarch64_get_qregxiv8hf (__o, 0); + ret.val[1] = (float16x8_t) __builtin_aarch64_get_qregxiv8hf (__o, 1); + ret.val[2] = (float16x8_t) __builtin_aarch64_get_qregxiv8hf (__o, 2); + ret.val[3] = (float16x8_t) __builtin_aarch64_get_qregxiv8hf (__o, 3); + return ret; +} + __extension__ static __inline float32x4x4_t __attribute__ ((__always_inline__)) vld4q_dup_f32 (const float32_t * __a) { @@ -16839,6 +17417,8 @@ vld2_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ return __b; \ } +__LD2_LANE_FUNC (float16x4x2_t, float16x4_t, float16x8x2_t, float16_t, v4hf, + v8hf, hf, f16, float16x8_t) __LD2_LANE_FUNC (float32x2x2_t, float32x2_t, float32x4x2_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __LD2_LANE_FUNC (float64x1x2_t, float64x1_t, float64x2x2_t, float64_t, df, v2df, @@ -16883,6 +17463,7 @@ vld2q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ return ret; \ } +__LD2_LANE_FUNC (float16x8x2_t, float16x8_t, float16_t, v8hf, hf, f16) __LD2_LANE_FUNC (float32x4x2_t, float32x4_t, float32_t, v4sf, sf, f32) __LD2_LANE_FUNC (float64x2x2_t, float64x2_t, float64_t, v2df, df, f64) __LD2_LANE_FUNC (poly8x16x2_t, poly8x16_t, poly8_t, v16qi, qi, p8) @@ -16930,6 +17511,8 @@ vld3_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ return __b; \ } +__LD3_LANE_FUNC (float16x4x3_t, float16x4_t, float16x8x3_t, float16_t, v4hf, + v8hf, hf, f16, float16x8_t) __LD3_LANE_FUNC (float32x2x3_t, float32x2_t, float32x4x3_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __LD3_LANE_FUNC (float64x1x3_t, float64x1_t, float64x2x3_t, float64_t, df, v2df, @@ -16976,6 +17559,7 @@ vld3q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ return ret; \ } +__LD3_LANE_FUNC (float16x8x3_t, float16x8_t, float16_t, v8hf, hf, f16) __LD3_LANE_FUNC (float32x4x3_t, float32x4_t, float32_t, v4sf, sf, f32) __LD3_LANE_FUNC (float64x2x3_t, float64x2_t, float64_t, v2df, df, f64) __LD3_LANE_FUNC (poly8x16x3_t, poly8x16_t, poly8_t, v16qi, qi, p8) @@ -17031,6 +17615,8 @@ vld4_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ /* vld4q_lane */ +__LD4_LANE_FUNC (float16x4x4_t, float16x4_t, float16x8x4_t, float16_t, v4hf, + v8hf, hf, f16, float16x8_t) __LD4_LANE_FUNC (float32x2x4_t, float32x2_t, float32x4x4_t, float32_t, v2sf, v4sf, sf, f32, float32x4_t) __LD4_LANE_FUNC (float64x1x4_t, float64x1_t, float64x2x4_t, float64_t, df, v2df, @@ -17079,6 +17665,7 @@ vld4q_lane_##funcsuffix (const ptrtype * __ptr, intype __b, const int __c) \ return ret; \ } +__LD4_LANE_FUNC (float16x8x4_t, float16x8_t, float16_t, v8hf, hf, f16) __LD4_LANE_FUNC (float32x4x4_t, float32x4_t, float32_t, v4sf, sf, f32) __LD4_LANE_FUNC (float64x2x4_t, float64x2_t, float64_t, v2df, df, f64) __LD4_LANE_FUNC (poly8x16x4_t, poly8x16_t, poly8_t, v16qi, qi, p8) @@ -21977,6 +22564,12 @@ vsrid_n_u64 (uint64_t __a, uint64_t __b, const int __c) /* vst1 */ __extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_f16 (float16_t *__a, float16x4_t __b) +{ + __builtin_aarch64_st1v4hf (__a, __b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst1_f32 (float32_t *a, float32x2_t b) { __builtin_aarch64_st1v2sf ((__builtin_aarch64_simd_sf *) a, b); @@ -22056,6 +22649,12 @@ vst1_u64 (uint64_t *a, uint64x1_t b) /* vst1q */ __extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_f16 (float16_t *__a, float16x8_t __b) +{ + __builtin_aarch64_st1v8hf (__a, __b); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst1q_f32 (float32_t *a, float32x4_t b) { __builtin_aarch64_st1v4sf ((__builtin_aarch64_simd_sf *) a, b); @@ -22136,6 +22735,12 @@ vst1q_u64 (uint64_t *a, uint64x2_t b) /* vst1_lane */ __extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_lane_f16 (float16_t *__a, float16x4_t __b, const int __lane) +{ + *__a = __aarch64_vget_lane_any (__b, __lane); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst1_lane_f32 (float32_t *__a, float32x2_t __b, const int __lane) { *__a = __aarch64_vget_lane_any (__b, __lane); @@ -22210,6 +22815,12 @@ vst1_lane_u64 (uint64_t *__a, uint64x1_t __b, const int __lane) /* vst1q_lane */ __extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_lane_f16 (float16_t *__a, float16x8_t __b, const int __lane) +{ + *__a = __aarch64_vget_lane_any (__b, __lane); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst1q_lane_f32 (float32_t *__a, float32x4_t __b, const int __lane) { *__a = __aarch64_vget_lane_any (__b, __lane); @@ -22416,6 +23027,18 @@ vst2_u32 (uint32_t * __a, uint32x2x2_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst2_f16 (float16_t * __a, float16x4x2_t val) +{ + __builtin_aarch64_simd_oi __o; + float16x8x2_t temp; + temp.val[0] = vcombine_f16 (val.val[0], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[1] = vcombine_f16 (val.val[1], vcreate_f16 (__AARCH64_UINT64_C (0))); + __o = __builtin_aarch64_set_qregoiv8hf (__o, temp.val[0], 0); + __o = __builtin_aarch64_set_qregoiv8hf (__o, temp.val[1], 1); + __builtin_aarch64_st2v4hf (__a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst2_f32 (float32_t * __a, float32x2x2_t val) { __builtin_aarch64_simd_oi __o; @@ -22518,6 +23141,15 @@ vst2q_u64 (uint64_t * __a, uint64x2x2_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst2q_f16 (float16_t * __a, float16x8x2_t val) +{ + __builtin_aarch64_simd_oi __o; + __o = __builtin_aarch64_set_qregoiv8hf (__o, val.val[0], 0); + __o = __builtin_aarch64_set_qregoiv8hf (__o, val.val[1], 1); + __builtin_aarch64_st2v8hf (__a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst2q_f32 (float32_t * __a, float32x4x2_t val) { __builtin_aarch64_simd_oi __o; @@ -22690,6 +23322,20 @@ vst3_u32 (uint32_t * __a, uint32x2x3_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst3_f16 (float16_t * __a, float16x4x3_t val) +{ + __builtin_aarch64_simd_ci __o; + float16x8x3_t temp; + temp.val[0] = vcombine_f16 (val.val[0], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[1] = vcombine_f16 (val.val[1], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[2] = vcombine_f16 (val.val[2], vcreate_f16 (__AARCH64_UINT64_C (0))); + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) temp.val[0], 0); + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) temp.val[1], 1); + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) temp.val[2], 2); + __builtin_aarch64_st3v4hf ((__builtin_aarch64_simd_hf *) __a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst3_f32 (float32_t * __a, float32x2x3_t val) { __builtin_aarch64_simd_ci __o; @@ -22804,6 +23450,16 @@ vst3q_u64 (uint64_t * __a, uint64x2x3_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst3q_f16 (float16_t * __a, float16x8x3_t val) +{ + __builtin_aarch64_simd_ci __o; + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) val.val[0], 0); + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) val.val[1], 1); + __o = __builtin_aarch64_set_qregciv8hf (__o, (float16x8_t) val.val[2], 2); + __builtin_aarch64_st3v8hf ((__builtin_aarch64_simd_hf *) __a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst3q_f32 (float32_t * __a, float32x4x3_t val) { __builtin_aarch64_simd_ci __o; @@ -23000,6 +23656,22 @@ vst4_u32 (uint32_t * __a, uint32x2x4_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst4_f16 (float16_t * __a, float16x4x4_t val) +{ + __builtin_aarch64_simd_xi __o; + float16x8x4_t temp; + temp.val[0] = vcombine_f16 (val.val[0], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[1] = vcombine_f16 (val.val[1], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[2] = vcombine_f16 (val.val[2], vcreate_f16 (__AARCH64_UINT64_C (0))); + temp.val[3] = vcombine_f16 (val.val[3], vcreate_f16 (__AARCH64_UINT64_C (0))); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) temp.val[0], 0); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) temp.val[1], 1); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) temp.val[2], 2); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) temp.val[3], 3); + __builtin_aarch64_st4v4hf ((__builtin_aarch64_simd_hf *) __a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst4_f32 (float32_t * __a, float32x2x4_t val) { __builtin_aarch64_simd_xi __o; @@ -23126,6 +23798,17 @@ vst4q_u64 (uint64_t * __a, uint64x2x4_t val) } __extension__ static __inline void __attribute__ ((__always_inline__)) +vst4q_f16 (float16_t * __a, float16x8x4_t val) +{ + __builtin_aarch64_simd_xi __o; + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) val.val[0], 0); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) val.val[1], 1); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) val.val[2], 2); + __o = __builtin_aarch64_set_qregxiv8hf (__o, (float16x8_t) val.val[3], 3); + __builtin_aarch64_st4v8hf ((__builtin_aarch64_simd_hf *) __a, __o); +} + +__extension__ static __inline void __attribute__ ((__always_inline__)) vst4q_f32 (float32_t * __a, float32x4x4_t val) { __builtin_aarch64_simd_xi __o; diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 475aa6e6d37..ff698001d68 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -38,8 +38,11 @@ ;; Iterator for General Purpose Floating-point registers (32- and 64-bit modes) (define_mode_iterator GPF [SF DF]) -;; Iterator for General Purpose Float registers, inc __fp16. -(define_mode_iterator GPF_F16 [HF SF DF]) +;; Iterator for all scalar floating point modes (HF, SF, DF and TF) +(define_mode_iterator GPF_TF_F16 [HF SF DF TF]) + +;; Double vector modes. +(define_mode_iterator VDF [V2SF V4HF]) ;; Integer vector modes. (define_mode_iterator VDQ_I [V8QI V16QI V4HI V8HI V2SI V4SI V2DI]) @@ -52,7 +55,7 @@ (define_mode_iterator VSDQ_I_DI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI DI]) ;; Double vector modes. -(define_mode_iterator VD [V8QI V4HI V2SI V2SF]) +(define_mode_iterator VD [V8QI V4HI V4HF V2SI V2SF]) ;; vector, 64-bit container, all integer modes (define_mode_iterator VD_BHSI [V8QI V4HI V2SI]) @@ -61,10 +64,10 @@ (define_mode_iterator VDQ_BHSI [V8QI V16QI V4HI V8HI V2SI V4SI]) ;; Quad vector modes. -(define_mode_iterator VQ [V16QI V8HI V4SI V2DI V4SF V2DF]) +(define_mode_iterator VQ [V16QI V8HI V4SI V2DI V8HF V4SF V2DF]) ;; VQ without 2 element modes. -(define_mode_iterator VQ_NO2E [V16QI V8HI V4SI V4SF]) +(define_mode_iterator VQ_NO2E [V16QI V8HI V4SI V8HF V4SF]) ;; Quad vector with only 2 element modes. (define_mode_iterator VQ_2E [V2DI V2DF]) @@ -79,7 +82,10 @@ ;; pointer-sized quantities. Exactly one of the two alternatives will match. (define_mode_iterator PTR [(SI "ptr_mode == SImode") (DI "ptr_mode == DImode")]) -;; Vector Float modes. +;; Vector Float modes suitable for moving, loading and storing. +(define_mode_iterator VDQF_F16 [V4HF V8HF V2SF V4SF V2DF]) + +;; Vector Float modes, barring HF modes. (define_mode_iterator VDQF [V2SF V4SF V2DF]) ;; Vector Float modes, and DF. @@ -88,6 +94,9 @@ ;; Vector single Float modes. (define_mode_iterator VDQSF [V2SF V4SF]) +;; Quad vector Float modes with half/single elements. +(define_mode_iterator VQ_HSF [V8HF V4SF]) + ;; Modes suitable to use as the return type of a vcond expression. (define_mode_iterator VDQF_COND [V2SF V2SI V4SF V4SI V2DF V2DI]) @@ -97,15 +106,23 @@ ;; Vector Float modes with 2 elements. (define_mode_iterator V2F [V2SF V2DF]) -;; All modes. +;; All vector modes on which we support any arithmetic operations. (define_mode_iterator VALL [V8QI V16QI V4HI V8HI V2SI V4SI V2DI V2SF V4SF V2DF]) -;; All vector modes and DI. +;; All vector modes suitable for moving, loading, and storing. +(define_mode_iterator VALL_F16 [V8QI V16QI V4HI V8HI V2SI V4SI V2DI + V4HF V8HF V2SF V4SF V2DF]) + +;; All vector modes barring HF modes, plus DI. (define_mode_iterator VALLDI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI V2SF V4SF V2DF DI]) -;; All vector modes and DI and DF. +;; All vector modes and DI. +(define_mode_iterator VALLDI_F16 [V8QI V16QI V4HI V8HI V2SI V4SI V2DI + V4HF V8HF V2SF V4SF V2DF DI]) + +;; All vector modes, plus DI and DF. (define_mode_iterator VALLDIF [V8QI V16QI V4HI V8HI V2SI V4SI - V2DI V2SF V4SF V2DF DI DF]) + V2DI V4HF V8HF V2SF V4SF V2DF DI DF]) ;; Vector modes for Integer reduction across lanes. (define_mode_iterator VDQV [V8QI V16QI V4HI V8HI V4SI V2DI]) @@ -126,7 +143,7 @@ (define_mode_iterator VQW [V16QI V8HI V4SI]) ;; Double vector modes for combines. -(define_mode_iterator VDC [V8QI V4HI V2SI V2SF DI DF]) +(define_mode_iterator VDC [V8QI V4HI V4HF V2SI V2SF DI DF]) ;; Vector modes except double int. (define_mode_iterator VDQIF [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF V2DF]) @@ -353,7 +370,8 @@ (V2SI "2s") (V4SI "4s") (DI "1d") (DF "1d") (V2DI "2d") (V2SF "2s") - (V4SF "4s") (V2DF "2d")]) + (V4SF "4s") (V2DF "2d") + (V4HF "4h") (V8HF "8h")]) (define_mode_attr Vrevsuff [(V4HI "16") (V8HI "16") (V2SI "32") (V4SI "32") (V2DI "64")]) @@ -361,7 +379,8 @@ (define_mode_attr Vmtype [(V8QI ".8b") (V16QI ".16b") (V4HI ".4h") (V8HI ".8h") (V2SI ".2s") (V4SI ".4s") - (V2DI ".2d") (V2SF ".2s") + (V2DI ".2d") (V4HF ".4h") + (V8HF ".8h") (V2SF ".2s") (V4SF ".4s") (V2DF ".2d") (DI "") (SI "") (HI "") (QI "") @@ -378,7 +397,8 @@ (define_mode_attr Vetype [(V8QI "b") (V16QI "b") (V4HI "h") (V8HI "h") (V2SI "s") (V4SI "s") - (V2DI "d") (V2SF "s") + (V2DI "d") (V4HF "h") + (V8HF "h") (V2SF "s") (V4SF "s") (V2DF "d") (SF "s") (DF "d") (QI "b") (HI "h") @@ -388,7 +408,8 @@ (define_mode_attr Vbtype [(V8QI "8b") (V16QI "16b") (V4HI "8b") (V8HI "16b") (V2SI "8b") (V4SI "16b") - (V2DI "16b") (V2SF "8b") + (V2DI "16b") (V4HF "8b") + (V8HF "16b") (V2SF "8b") (V4SF "16b") (V2DF "16b") (DI "8b") (DF "8b") (SI "8b")]) @@ -398,6 +419,7 @@ (V4HI "HI") (V8HI "HI") (V2SI "SI") (V4SI "SI") (DI "DI") (V2DI "DI") + (V4HF "HF") (V8HF "HF") (V2SF "SF") (V4SF "SF") (V2DF "DF") (DF "DF") (SI "SI") (HI "HI") @@ -416,6 +438,7 @@ (V4HI "V8HI") (V8HI "V8HI") (V2SI "V4SI") (V4SI "V4SI") (DI "V2DI") (V2DI "V2DI") + (V4HF "V8HF") (V8HF "V8HF") (V2SF "V2SF") (V4SF "V4SF") (V2DF "V2DF") (SI "V4SI") (HI "V8HI") (QI "V16QI")]) @@ -425,16 +448,22 @@ (V4HI "V2HI") (V8HI "V4HI") (V2SI "SI") (V4SI "V2SI") (V2DI "DI") (V2SF "SF") - (V4SF "V2SF") (V2DF "DF")]) + (V4SF "V2SF") (V4HF "V2HF") + (V8HF "V4HF") (V2DF "DF")]) ;; Double modes of vector modes. (define_mode_attr VDBL [(V8QI "V16QI") (V4HI "V8HI") + (V4HF "V8HF") (V2SI "V4SI") (V2SF "V4SF") (SI "V2SI") (DI "V2DI") (DF "V2DF")]) +;; Register suffix for double-length mode. +(define_mode_attr Vdtype [(V4HF "8h") (V2SF "4s")]) + ;; Double modes of vector modes (lower case). (define_mode_attr Vdbl [(V8QI "v16qi") (V4HI "v8hi") + (V4HF "v8hf") (V2SI "v4si") (V2SF "v4sf") (SI "v2si") (DI "v2di") (DF "v2df")]) @@ -465,24 +494,31 @@ (define_mode_attr VWIDE [(V8QI "V8HI") (V4HI "V4SI") (V2SI "V2DI") (V16QI "V8HI") (V8HI "V4SI") (V4SI "V2DI") - (HI "SI") (SI "DI")] - + (HI "SI") (SI "DI") + (V8HF "V4SF") (V4SF "V2DF") + (V4HF "V4SF") (V2SF "V2DF")] ) -;; Widened mode register suffixes for VD_BHSI/VQW. +;; Widened modes of vector modes, lowercase +(define_mode_attr Vwide [(V2SF "v2df") (V4HF "v4sf")]) + +;; Widened mode register suffixes for VD_BHSI/VQW/VQ_HSF. (define_mode_attr Vwtype [(V8QI "8h") (V4HI "4s") (V2SI "2d") (V16QI "8h") - (V8HI "4s") (V4SI "2d")]) + (V8HI "4s") (V4SI "2d") + (V8HF "4s") (V4SF "2d")]) ;; Widened mode register suffixes for VDW/VQW. (define_mode_attr Vmwtype [(V8QI ".8h") (V4HI ".4s") (V2SI ".2d") (V16QI ".8h") (V8HI ".4s") (V4SI ".2d") + (V4HF ".4s") (V2SF ".2d") (SI "") (HI "")]) -;; Lower part register suffixes for VQW. +;; Lower part register suffixes for VQW/VQ_HSF. (define_mode_attr Vhalftype [(V16QI "8b") (V8HI "4h") - (V4SI "2s")]) + (V4SI "2s") (V8HF "4h") + (V4SF "2s")]) ;; Define corresponding core/FP element mode for each vector mode. (define_mode_attr vw [(V8QI "w") (V16QI "w") @@ -509,6 +545,7 @@ (V4HI "V4HI") (V8HI "V8HI") (V2SI "V2SI") (V4SI "V4SI") (DI "DI") (V2DI "V2DI") + (V4HF "V4HI") (V8HF "V8HI") (V2SF "V2SI") (V4SF "V4SI") (V2DF "V2DI") (DF "DI") (SF "SI")]) @@ -518,6 +555,7 @@ (V4HI "v4hi") (V8HI "v8hi") (V2SI "v2si") (V4SI "v4si") (DI "di") (V2DI "v2di") + (V4HF "v4hi") (V8HF "v8hi") (V2SF "v2si") (V4SF "v4si") (V2DF "v2di") (DF "di") (SF "si")]) @@ -539,14 +577,17 @@ (define_mode_attr nregs [(OI "2") (CI "3") (XI "4")]) (define_mode_attr VRL2 [(V8QI "V32QI") (V4HI "V16HI") + (V4HF "V16HF") (V2SI "V8SI") (V2SF "V8SF") (DI "V4DI") (DF "V4DF")]) (define_mode_attr VRL3 [(V8QI "V48QI") (V4HI "V24HI") + (V4HF "V24HF") (V2SI "V12SI") (V2SF "V12SF") (DI "V6DI") (DF "V6DF")]) (define_mode_attr VRL4 [(V8QI "V64QI") (V4HI "V32HI") + (V4HF "V32HF") (V2SI "V16SI") (V2SF "V16SF") (DI "V8DI") (DF "V8DF")]) @@ -559,6 +600,7 @@ (V2SI "V2SI") (V4SI "V2SI") (DI "V2DI") (V2DI "V2DI") (V2SF "V2SF") (V4SF "V2SF") + (V4HF "SF") (V8HF "SF") (DF "V2DI") (V2DF "V2DI")]) ;; Similar, for three elements. @@ -567,6 +609,7 @@ (V2SI "BLK") (V4SI "BLK") (DI "EI") (V2DI "EI") (V2SF "BLK") (V4SF "BLK") + (V4HF "BLK") (V8HF "BLK") (DF "EI") (V2DF "EI")]) ;; Similar, for four elements. @@ -575,6 +618,7 @@ (V2SI "V4SI") (V4SI "V4SI") (DI "OI") (V2DI "OI") (V2SF "V4SF") (V4SF "V4SF") + (V4HF "V4HF") (V8HF "V4HF") (DF "OI") (V2DF "OI")]) @@ -594,12 +638,14 @@ (V2SI "V4SI") (V4SI "V2SI") (DI "V2DI") (V2DI "DI") (V2SF "V4SF") (V4SF "V2SF") + (V4HF "V8HF") (V8HF "V4HF") (DF "V2DF") (V2DF "DF")]) (define_mode_attr vswap_width_name [(V8QI "to_128") (V16QI "to_64") (V4HI "to_128") (V8HI "to_64") (V2SI "to_128") (V4SI "to_64") (DI "to_128") (V2DI "to_64") + (V4HF "to_128") (V8HF "to_64") (V2SF "to_128") (V4SF "to_64") (DF "to_128") (V2DF "to_64")]) @@ -633,6 +679,7 @@ (V4HI "") (V8HI "_q") (V2SI "") (V4SI "_q") (DI "") (V2DI "_q") + (V4HF "") (V8HF "_q") (V2SF "") (V4SF "_q") (V2DF "_q") (QI "") (HI "") (SI "") (DI "") (SF "") (DF "")]) diff --git a/gcc/config/arc/arc-opts.h b/gcc/config/arc/arc-opts.h index f259a470e9d..cca1f035636 100644 --- a/gcc/config/arc/arc-opts.h +++ b/gcc/config/arc/arc-opts.h @@ -21,7 +21,6 @@ enum processor_type { PROCESSOR_NONE, - PROCESSOR_A5, PROCESSOR_ARC600, PROCESSOR_ARC601, PROCESSOR_ARC700 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index b5b644c5eb1..e9ecc908cb8 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -77,7 +77,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "rtl-iter.h" -/* Which cpu we're compiling for (A5, ARC600, ARC601, ARC700). */ +/* Which cpu we're compiling for (ARC600, ARC601, ARC700). */ static const char *arc_cpu_string = ""; /* ??? Loads can handle any constant, stores can only handle small ones. */ @@ -702,11 +702,7 @@ arc_init (void) { enum attr_tune tune_dflt = TUNE_NONE; - if (TARGET_A5) - { - arc_cpu_string = "A5"; - } - else if (TARGET_ARC600) + if (TARGET_ARC600) { arc_cpu_string = "ARC600"; tune_dflt = TUNE_ARC600; @@ -755,7 +751,7 @@ arc_init (void) break; } - /* Support mul64 generation only for A5 and ARC600. */ + /* Support mul64 generation only for ARC600. */ if (TARGET_MUL64_SET && TARGET_ARC700) error ("-mmul64 not supported for ARC700"); @@ -1280,7 +1276,7 @@ arc_conditional_register_usage (void) i <= ARC_LAST_SIMD_DMA_CONFIG_REG; i++) reg_alloc_order [i] = i; } - /* For Arctangent-A5 / ARC600, lp_count may not be read in an instruction + /* For ARC600, lp_count may not be read in an instruction following immediately after another one setting it to a new value. There was some discussion on how to enforce scheduling constraints for processors with missing interlocks on the gcc mailing list: @@ -2093,7 +2089,7 @@ arc_compute_frame_size (int size) /* size = # of var. bytes allocated. */ total_size = ARC_STACK_ALIGN (total_size); /* Compute offset of register save area from stack pointer: - A5 Frame: pretend_size <blink> reg_size <fp> var_size args_size <--sp + Frame: pretend_size <blink> reg_size <fp> var_size args_size <--sp */ reg_offset = (total_size - (pretend_size + reg_size + extra_size) + (frame_pointer_needed ? 4 : 0)); diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index d98cce11257..874b118421d 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -66,9 +66,7 @@ along with GCC; see the file COPYING3. If not see #define TARGET_CPU_CPP_BUILTINS() \ do { \ builtin_define ("__arc__"); \ - if (TARGET_A5) \ - builtin_define ("__A5__"); \ - else if (TARGET_ARC600) \ + if (TARGET_ARC600) \ { \ builtin_define ("__A6__"); \ builtin_define ("__ARC600__"); \ @@ -133,7 +131,6 @@ along with GCC; see the file COPYING3. If not see #define ASM_SPEC "\ %{mbig-endian|EB:-EB} %{EL} \ -%{mcpu=A5|mcpu=a5|mA5:-mA5} \ %{mcpu=ARC600:-mARC600} \ %{mcpu=ARC601:-mARC601} \ %{mcpu=ARC700:-mARC700} \ @@ -224,7 +221,6 @@ along with GCC; see the file COPYING3. If not see #endif #define DRIVER_SELF_SPECS DRIVER_ENDIAN_SELF_SPECS \ - "%{mARC5|mA5: -mcpu=A5 %<mARC5 %<mA5}" \ "%{mARC600|mA6: -mcpu=ARC600 %<mARC600 %<mA6}" \ "%{mARC601: -mcpu=ARC601 %<mARC601}" \ "%{mARC700|mA7: -mcpu=ARC700 %<mARC700 %<mA7}" \ @@ -277,7 +273,6 @@ along with GCC; see the file COPYING3. If not see use conditional execution? */ #define TARGET_AT_DBR_CONDEXEC (!TARGET_ARC700) -#define TARGET_A5 (arc_cpu == PROCESSOR_A5) #define TARGET_ARC600 (arc_cpu == PROCESSOR_ARC600) #define TARGET_ARC601 (arc_cpu == PROCESSOR_ARC601) #define TARGET_ARC700 (arc_cpu == PROCESSOR_ARC700) diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 931f9a18703..e1da4d70085 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -188,7 +188,7 @@ ;; Attribute describing the processor -(define_attr "cpu" "none,A5,ARC600,ARC700" +(define_attr "cpu" "none,ARC600,ARC700" (const (symbol_ref "arc_cpu_attr"))) ;; true for compact instructions (those with _s suffix) @@ -337,9 +337,13 @@ (match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 4)] (const_int 2)) - (eq_attr "iscompact" "true_limm,maybe_limm") + (eq_attr "iscompact" "true_limm") (const_int 6) + (eq_attr "iscompact" "maybe_limm") + (cond [(match_test "GET_CODE (PATTERN (insn)) == COND_EXEC") (const_int 8)] + (const_int 6)) + (eq_attr "type" "load") (if_then_else (match_operand 1 "long_immediate_loadstore_operand" "") @@ -4899,9 +4903,7 @@ ; operand 0 is the loop count pseudo register ; operand 1 is the label to jump to at the top of the loop -; Use this for the ARC600 and ARC700. For ARCtangent-A5, this is unsafe -; without further checking for nearby branches etc., and without proper -; annotation of shift patterns that clobber lp_count +; Use this for the ARC600 and ARC700. ; ??? ARC600 might want to check if the loop has few iteration and only a ; single insn - loop setup is expensive then. (define_expand "doloop_end" diff --git a/gcc/config/arc/arc.opt b/gcc/config/arc/arc.opt index 6352a2e82de..7c859e4bfcd 100644 --- a/gcc/config/arc/arc.opt +++ b/gcc/config/arc/arc.opt @@ -33,10 +33,6 @@ mno-cond-exec Target Report RejectNegative Mask(NO_COND_EXEC) Disable ARCompact specific pass to generate conditional execution instructions -mA5 -Target Report -Generate ARCompact 32-bit code for ARCtangent-A5 processor - mA6 Target Report Generate ARCompact 32-bit code for ARC600 processor @@ -61,7 +57,7 @@ mmixed-code Target Report Mask(MIXED_CODE_SET) Tweak register allocation to help 16-bit instruction generation ; originally this was: -;Generate ARCompact 16-bit instructions intermixed with 32-bit instructions for ARCtangent-A5 and higher processors +;Generate ARCompact 16-bit instructions intermixed with 32-bit instructions ; but we do that without -mmixed-code, too, it's just a different instruction ; count / size tradeoff. @@ -163,9 +159,6 @@ Enum Name(processor_type) Type(enum processor_type) EnumValue -Enum(processor_type) String(A5) Value(PROCESSOR_A5) - -EnumValue Enum(processor_type) String(ARC600) Value(PROCESSOR_ARC600) EnumValue diff --git a/gcc/config/arc/constraints.md b/gcc/config/arc/constraints.md index 9540075f369..8902246ff21 100644 --- a/gcc/config/arc/constraints.md +++ b/gcc/config/arc/constraints.md @@ -21,7 +21,7 @@ ; Most instructions accept arbitrary core registers for their inputs, even ; if the core register in question cannot be written to, like the multiply -; result registers of the ARCtangent-A5 and ARC600 . +; result registers of ARC600. ; First, define a class for core registers that can be read cheaply. This ; is most or all core registers for ARC600, but only r0-r31 for ARC700 (define_register_constraint "c" "CHEAP_CORE_REGS" diff --git a/gcc/config/arc/t-arc-newlib b/gcc/config/arc/t-arc-newlib index 135bef665c9..8823805b8aa 100644 --- a/gcc/config/arc/t-arc-newlib +++ b/gcc/config/arc/t-arc-newlib @@ -17,8 +17,6 @@ # with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -# Selecting -mA5 uses the same functional multilib files/libraries -# as get used for -mARC600 aka -mA6. MULTILIB_OPTIONS=mcpu=ARC600/mcpu=ARC601 mmul64/mmul32x16 mnorm MULTILIB_DIRNAMES=arc600 arc601 mul64 mul32x16 norm # @@ -26,7 +24,6 @@ MULTILIB_DIRNAMES=arc600 arc601 mul64 mul32x16 norm MULTILIB_MATCHES = mcpu?ARC600=mcpu?arc600 MULTILIB_MATCHES += mcpu?ARC600=mARC600 MULTILIB_MATCHES += mcpu?ARC600=mA6 -MULTILIB_MATCHES += mcpu?ARC600=mA5 MULTILIB_MATCHES += mcpu?ARC600=mno-mpy MULTILIB_MATCHES += mcpu?ARC601=mcpu?arc601 MULTILIB_MATCHES += EL=mlittle-endian diff --git a/gcc/config/arm/arm-builtins.c b/gcc/config/arm/arm-builtins.c index 4391f17c655..0f5a1f1aaf8 100644 --- a/gcc/config/arm/arm-builtins.c +++ b/gcc/config/arm/arm-builtins.c @@ -190,6 +190,7 @@ arm_storestruct_lane_qualifiers[SIMD_MAX_BUILTIN_ARGS] #define di_UP DImode #define v16qi_UP V16QImode #define v8hi_UP V8HImode +#define v8hf_UP V8HFmode #define v4si_UP V4SImode #define v4sf_UP V4SFmode #define v2di_UP V2DImode @@ -238,6 +239,12 @@ typedef struct { #define VAR10(T, N, A, B, C, D, E, F, G, H, I, J) \ VAR9 (T, N, A, B, C, D, E, F, G, H, I) \ VAR1 (T, N, J) +#define VAR11(T, N, A, B, C, D, E, F, G, H, I, J, K) \ + VAR10 (T, N, A, B, C, D, E, F, G, H, I, J) \ + VAR1 (T, N, K) +#define VAR12(T, N, A, B, C, D, E, F, G, H, I, J, K, L) \ + VAR11 (T, N, A, B, C, D, E, F, G, H, I, J, K) \ + VAR1 (T, N, L) /* The NEON builtin data can be found in arm_neon_builtins.def. The mode entries in the following table correspond to the "key" type of the @@ -819,6 +826,7 @@ arm_init_simd_builtin_types (void) /* The __builtin_simd{64,128}_float16 types are kept private unless we have a scalar __fp16 type. */ arm_simd_types[Float16x4_t].eltype = arm_simd_floatHF_type_node; + arm_simd_types[Float16x8_t].eltype = arm_simd_floatHF_type_node; arm_simd_types[Float32x2_t].eltype = float_type_node; arm_simd_types[Float32x4_t].eltype = float_type_node; diff --git a/gcc/config/arm/arm-simd-builtin-types.def b/gcc/config/arm/arm-simd-builtin-types.def index bcbd20be057..b178ae6c05f 100644 --- a/gcc/config/arm/arm-simd-builtin-types.def +++ b/gcc/config/arm/arm-simd-builtin-types.def @@ -44,5 +44,7 @@ ENTRY (Float16x4_t, V4HF, none, 64, float16, 18) ENTRY (Float32x2_t, V2SF, none, 64, float32, 18) + + ENTRY (Float16x8_t, V8HF, none, 128, float16, 19) ENTRY (Float32x4_t, V4SF, none, 128, float32, 19) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index fa4e083adfe..5f3180d38ce 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -9580,6 +9580,24 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code, return false; /* All arguments must be in registers. */ case MOD: + /* MOD by a power of 2 can be expanded as: + rsbs r1, r0, #0 + and r0, r0, #(n - 1) + and r1, r1, #(n - 1) + rsbpl r0, r1, #0. */ + if (CONST_INT_P (XEXP (x, 1)) + && exact_log2 (INTVAL (XEXP (x, 1))) > 0 + && mode == SImode) + { + *cost += COSTS_N_INSNS (3); + + if (speed_p) + *cost += 2 * extra_cost->alu.logical + + extra_cost->alu.arith; + return true; + } + + /* Fall-through. */ case UMOD: *cost = LIBCALL_COST (2); return false; /* All arguments must be in registers. */ @@ -26278,7 +26296,8 @@ arm_vector_mode_supported_p (machine_mode mode) { /* Neon also supports V2SImode, etc. listed in the clause below. */ if (TARGET_NEON && (mode == V2SFmode || mode == V4SImode || mode == V8HImode - || mode == V4HFmode || mode == V16QImode || mode == V4SFmode || mode == V2DImode)) + || mode == V4HFmode || mode == V16QImode || mode == V4SFmode + || mode == V2DImode || mode == V8HFmode)) return true; if ((TARGET_NEON || TARGET_IWMMXT) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index eee9e8b551f..f7a9d638673 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1016,7 +1016,7 @@ extern int arm_arch_crc; /* Modes valid for Neon Q registers. */ #define VALID_NEON_QREG_MODE(MODE) \ ((MODE) == V4SImode || (MODE) == V8HImode || (MODE) == V16QImode \ - || (MODE) == V4SFmode || (MODE) == V2DImode) + || (MODE) == V8HFmode || (MODE) == V4SFmode || (MODE) == V2DImode) /* Structure modes valid for Neon registers. */ #define VALID_NEON_STRUCT_MODE(MODE) \ diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index b6c20478f9c..878576a3cd5 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -1229,7 +1229,7 @@ "" ) -(define_insn "*subsi3_compare0" +(define_insn "subsi3_compare0" [(set (reg:CC_NOOV CC_REGNUM) (compare:CC_NOOV (minus:SI (match_operand:SI 1 "arm_rhs_operand" "r,r,I") @@ -6620,7 +6620,7 @@ (define_insn "*arm32_movhf" [(set (match_operand:HF 0 "nonimmediate_operand" "=r,m,r,r") (match_operand:HF 1 "general_operand" " m,r,r,F"))] - "TARGET_32BIT && !(TARGET_HARD_FLOAT && TARGET_FP16) && !arm_restrict_it + "TARGET_32BIT && !(TARGET_HARD_FLOAT && TARGET_FP16) && ( s_register_operand (operands[0], HFmode) || s_register_operand (operands[1], HFmode))" "* @@ -6658,7 +6658,8 @@ [(set_attr "conds" "unconditional") (set_attr "type" "load1,store1,mov_reg,multiple") (set_attr "length" "4,4,4,8") - (set_attr "predicable" "yes")] + (set_attr "predicable" "yes") + (set_attr "predicable_short_it" "no")] ) (define_expand "movsf" @@ -11142,6 +11143,75 @@ "" ) +;; ARM-specific expansion of signed mod by power of 2 +;; using conditional negate. +;; For r0 % n where n is a power of 2 produce: +;; rsbs r1, r0, #0 +;; and r0, r0, #(n - 1) +;; and r1, r1, #(n - 1) +;; rsbpl r0, r1, #0 + +(define_expand "modsi3" + [(match_operand:SI 0 "register_operand" "") + (match_operand:SI 1 "register_operand" "") + (match_operand:SI 2 "const_int_operand" "")] + "TARGET_32BIT" + { + HOST_WIDE_INT val = INTVAL (operands[2]); + + if (val <= 0 + || exact_log2 (val) <= 0) + FAIL; + + rtx mask = GEN_INT (val - 1); + + /* In the special case of x0 % 2 we can do the even shorter: + cmp r0, #0 + and r0, r0, #1 + rsblt r0, r0, #0. */ + + if (val == 2) + { + rtx cc_reg = arm_gen_compare_reg (LT, + operands[1], const0_rtx, NULL_RTX); + rtx cond = gen_rtx_LT (SImode, cc_reg, const0_rtx); + rtx masked = gen_reg_rtx (SImode); + + emit_insn (gen_andsi3 (masked, operands[1], mask)); + emit_move_insn (operands[0], + gen_rtx_IF_THEN_ELSE (SImode, cond, + gen_rtx_NEG (SImode, + masked), + masked)); + DONE; + } + + rtx neg_op = gen_reg_rtx (SImode); + rtx_insn *insn = emit_insn (gen_subsi3_compare0 (neg_op, const0_rtx, + operands[1])); + + /* Extract the condition register and mode. */ + rtx cmp = XVECEXP (PATTERN (insn), 0, 0); + rtx cc_reg = SET_DEST (cmp); + rtx cond = gen_rtx_GE (SImode, cc_reg, const0_rtx); + + emit_insn (gen_andsi3 (operands[0], operands[1], mask)); + + rtx masked_neg = gen_reg_rtx (SImode); + emit_insn (gen_andsi3 (masked_neg, neg_op, mask)); + + /* We want a conditional negate here, but emitting COND_EXEC rtxes + during expand does not always work. Do an IF_THEN_ELSE instead. */ + emit_move_insn (operands[0], + gen_rtx_IF_THEN_ELSE (SImode, cond, + gen_rtx_NEG (SImode, masked_neg), + operands[0])); + + + DONE; + } +) + (define_expand "bswapsi2" [(set (match_operand:SI 0 "s_register_operand" "=r") (bswap:SI (match_operand:SI 1 "s_register_operand" "r")))] diff --git a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h index 2b30be61a46..66622dfcfe2 100644 --- a/gcc/config/arm/arm_neon.h +++ b/gcc/config/arm/arm_neon.h @@ -42,6 +42,7 @@ typedef __simd64_int16_t int16x4_t; typedef __simd64_int32_t int32x2_t; typedef __builtin_neon_di int64x1_t; #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef __fp16 float16_t; typedef __simd64_float16_t float16x4_t; #endif typedef __simd64_float32_t float32x2_t; @@ -59,6 +60,9 @@ typedef __simd128_int8_t int8x16_t; typedef __simd128_int16_t int16x8_t; typedef __simd128_int32_t int32x4_t; typedef __simd128_int64_t int64x2_t; +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef __simd128_float16_t float16x8_t; +#endif typedef __simd128_float32_t float32x4_t; typedef __simd128_poly8_t poly8x16_t; typedef __simd128_poly16_t poly16x8_t; @@ -162,6 +166,20 @@ typedef struct uint64x2x2_t uint64x2_t val[2]; } uint64x2x2_t; +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x4x2_t +{ + float16x4_t val[2]; +} float16x4x2_t; +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x8x2_t +{ + float16x8_t val[2]; +} float16x8x2_t; +#endif + typedef struct float32x2x2_t { float32x2_t val[2]; @@ -288,6 +306,20 @@ typedef struct uint64x2x3_t uint64x2_t val[3]; } uint64x2x3_t; +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x4x3_t +{ + float16x4_t val[3]; +} float16x4x3_t; +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x8x3_t +{ + float16x8_t val[3]; +} float16x8x3_t; +#endif + typedef struct float32x2x3_t { float32x2_t val[3]; @@ -414,6 +446,20 @@ typedef struct uint64x2x4_t uint64x2_t val[4]; } uint64x2x4_t; +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x4x4_t +{ + float16x4_t val[4]; +} float16x4x4_t; +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +typedef struct float16x8x4_t +{ + float16x8_t val[4]; +} float16x8x4_t; +#endif + typedef struct float32x2x4_t { float32x2_t val[4]; @@ -5203,6 +5249,21 @@ vget_lane_s32 (int32x2_t __a, const int __b) return (int32_t)__builtin_neon_vget_lanev2si (__a, __b); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +/* Functions cannot accept or return __FP16 types. Even if the function + were marked always-inline so there were no call sites, the declaration + would nonetheless raise an error. Hence, we must use a macro instead. */ + +#define vget_lane_f16(__v, __idx) \ + __extension__ \ + ({ \ + float16x4_t __vec = (__v); \ + __builtin_arm_lane_check (4, __idx); \ + float16_t __res = __vec[__idx]; \ + __res; \ + }) +#endif + __extension__ static __inline float32_t __attribute__ ((__always_inline__)) vget_lane_f32 (float32x2_t __a, const int __b) { @@ -5269,6 +5330,17 @@ vgetq_lane_s32 (int32x4_t __a, const int __b) return (int32_t)__builtin_neon_vget_lanev4si (__a, __b); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define vgetq_lane_f16(__v, __idx) \ + __extension__ \ + ({ \ + float16x8_t __vec = (__v); \ + __builtin_arm_lane_check (8, __idx); \ + float16_t __res = __vec[__idx]; \ + __res; \ + }) +#endif + __extension__ static __inline float32_t __attribute__ ((__always_inline__)) vgetq_lane_f32 (float32x4_t __a, const int __b) { @@ -5335,6 +5407,18 @@ vset_lane_s32 (int32_t __a, int32x2_t __b, const int __c) return (int32x2_t)__builtin_neon_vset_lanev2si ((__builtin_neon_si) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define vset_lane_f16(__e, __v, __idx) \ + __extension__ \ + ({ \ + float16_t __elem = (__e); \ + float16x4_t __vec = (__v); \ + __builtin_arm_lane_check (4, __idx); \ + __vec[__idx] = __elem; \ + __vec; \ + }) +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vset_lane_f32 (float32_t __a, float32x2_t __b, const int __c) { @@ -5401,6 +5485,18 @@ vsetq_lane_s32 (int32_t __a, int32x4_t __b, const int __c) return (int32x4_t)__builtin_neon_vset_lanev4si ((__builtin_neon_si) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define vsetq_lane_f16(__e, __v, __idx) \ + __extension__ \ + ({ \ + float16_t __elem = (__e); \ + float16x8_t __vec = (__v); \ + __builtin_arm_lane_check (8, __idx); \ + __vec[__idx] = __elem; \ + __vec; \ + }) +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vsetq_lane_f32 (float32_t __a, float32x4_t __b, const int __c) { @@ -5481,6 +5577,14 @@ vcreate_s64 (uint64_t __a) return (int64x1_t)__builtin_neon_vcreatedi ((__builtin_neon_di) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vcreate_f16 (uint64_t __a) +{ + return (float16x4_t) __a; +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vcreate_f32 (uint64_t __a) { @@ -5983,6 +6087,14 @@ vcombine_s64 (int64x1_t __a, int64x1_t __b) return (int64x2_t)__builtin_neon_vcombinedi (__a, __b); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vcombine_f16 (float16x4_t __a, float16x4_t __b) +{ + return __builtin_neon_vcombinev4hf (__a, __b); +} +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vcombine_f32 (float32x2_t __a, float32x2_t __b) { @@ -6057,6 +6169,14 @@ vget_high_s64 (int64x2_t __a) return (int64x1_t)__builtin_neon_vget_highv2di (__a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vget_high_f16 (float16x8_t __a) +{ + return __builtin_neon_vget_highv8hf (__a); +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vget_high_f32 (float32x4_t __a) { @@ -6117,6 +6237,14 @@ vget_low_s32 (int32x4_t __a) return (int32x2_t)__builtin_neon_vget_lowv4si (__a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vget_low_f16 (float16x8_t __a) +{ + return __builtin_neon_vget_lowv8hf (__a); +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vget_low_f32 (float32x4_t __a) { @@ -8668,6 +8796,14 @@ vld1_s64 (const int64_t * __a) return (int64x1_t)__builtin_neon_vld1di ((const __builtin_neon_di *) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_f16 (const float16_t * __a) +{ + return __builtin_neon_vld1v4hf (__a); +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_f32 (const float32_t * __a) { @@ -8742,6 +8878,14 @@ vld1q_s64 (const int64_t * __a) return (int64x2_t)__builtin_neon_vld1v2di ((const __builtin_neon_di *) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_f16 (const float16_t * __a) +{ + return __builtin_neon_vld1v8hf (__a); +} +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_f32 (const float32_t * __a) { @@ -8802,6 +8946,14 @@ vld1_lane_s32 (const int32_t * __a, int32x2_t __b, const int __c) return (int32x2_t)__builtin_neon_vld1_lanev2si ((const __builtin_neon_si *) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_lane_f16 (const float16_t * __a, float16x4_t __b, const int __c) +{ + return vset_lane_f16 (*__a, __b, __c); +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_lane_f32 (const float32_t * __a, float32x2_t __b, const int __c) { @@ -8876,6 +9028,14 @@ vld1q_lane_s32 (const int32_t * __a, int32x4_t __b, const int __c) return (int32x4_t)__builtin_neon_vld1_lanev4si ((const __builtin_neon_si *) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_lane_f16 (const float16_t * __a, float16x8_t __b, const int __c) +{ + return vsetq_lane_f16 (*__a, __b, __c); +} +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_lane_f32 (const float32_t * __a, float32x4_t __b, const int __c) { @@ -8950,6 +9110,15 @@ vld1_dup_s32 (const int32_t * __a) return (int32x2_t)__builtin_neon_vld1_dupv2si ((const __builtin_neon_si *) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vld1_dup_f16 (const float16_t * __a) +{ + float16_t __f = *__a; + return (float16x4_t) { __f, __f, __f, __f }; +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vld1_dup_f32 (const float32_t * __a) { @@ -9024,6 +9193,15 @@ vld1q_dup_s32 (const int32_t * __a) return (int32x4_t)__builtin_neon_vld1_dupv4si ((const __builtin_neon_si *) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vld1q_dup_f16 (const float16_t * __a) +{ + float16_t __f = *__a; + return (float16x8_t) { __f, __f, __f, __f, __f, __f, __f, __f }; +} +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vld1q_dup_f32 (const float32_t * __a) { @@ -9112,6 +9290,14 @@ vst1_s64 (int64_t * __a, int64x1_t __b) __builtin_neon_vst1di ((__builtin_neon_di *) __a, __b); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_f16 (float16_t * __a, float16x4_t __b) +{ + __builtin_neon_vst1v4hf (__a, __b); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst1_f32 (float32_t * __a, float32x2_t __b) { @@ -9186,6 +9372,14 @@ vst1q_s64 (int64_t * __a, int64x2_t __b) __builtin_neon_vst1v2di ((__builtin_neon_di *) __a, __b); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_f16 (float16_t * __a, float16x8_t __b) +{ + __builtin_neon_vst1v8hf (__a, __b); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst1q_f32 (float32_t * __a, float32x4_t __b) { @@ -9246,6 +9440,14 @@ vst1_lane_s32 (int32_t * __a, int32x2_t __b, const int __c) __builtin_neon_vst1_lanev2si ((__builtin_neon_si *) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1_lane_f16 (float16_t * __a, float16x4_t __b, const int __c) +{ + __builtin_neon_vst1_lanev4hf (__a, __b, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst1_lane_f32 (float32_t * __a, float32x2_t __b, const int __c) { @@ -9320,6 +9522,14 @@ vst1q_lane_s32 (int32_t * __a, int32x4_t __b, const int __c) __builtin_neon_vst1_lanev4si ((__builtin_neon_si *) __a, __b, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst1q_lane_f16 (float16_t * __a, float16x8_t __b, const int __c) +{ + __builtin_neon_vst1_lanev8hf (__a, __b, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst1q_lane_f32 (float32_t * __a, float32x4_t __b, const int __c) { @@ -9400,6 +9610,16 @@ vld2_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x2_t __attribute__ ((__always_inline__)) +vld2_f16 (const float16_t * __a) +{ + union { float16x4x2_t __i; __builtin_neon_ti __o; } __rv; + __rv.__o = __builtin_neon_vld2v4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x2_t __attribute__ ((__always_inline__)) vld2_f32 (const float32_t * __a) { @@ -9498,6 +9718,16 @@ vld2q_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x2_t __attribute__ ((__always_inline__)) +vld2q_f16 (const float16_t * __a) +{ + union { float16x8x2_t __i; __builtin_neon_oi __o; } __rv; + __rv.__o = __builtin_neon_vld2v8hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x2_t __attribute__ ((__always_inline__)) vld2q_f32 (const float32_t * __a) { @@ -9573,6 +9803,17 @@ vld2_lane_s32 (const int32_t * __a, int32x2x2_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x2_t __attribute__ ((__always_inline__)) +vld2_lane_f16 (const float16_t * __a, float16x4x2_t __b, const int __c) +{ + union { float16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; + union { float16x4x2_t __i; __builtin_neon_ti __o; } __rv; + __rv.__o = __builtin_neon_vld2_lanev4hf ( __a, __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x2_t __attribute__ ((__always_inline__)) vld2_lane_f32 (const float32_t * __a, float32x2x2_t __b, const int __c) { @@ -9645,6 +9886,17 @@ vld2q_lane_s32 (const int32_t * __a, int32x4x2_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x2_t __attribute__ ((__always_inline__)) +vld2q_lane_f16 (const float16_t * __a, float16x8x2_t __b, const int __c) +{ + union { float16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; + union { float16x8x2_t __i; __builtin_neon_oi __o; } __rv; + __rv.__o = __builtin_neon_vld2_lanev8hf (__a, __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x2_t __attribute__ ((__always_inline__)) vld2q_lane_f32 (const float32_t * __a, float32x4x2_t __b, const int __c) { @@ -9705,6 +9957,16 @@ vld2_dup_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x2_t __attribute__ ((__always_inline__)) +vld2_dup_f16 (const float16_t * __a) +{ + union { float16x4x2_t __i; __builtin_neon_ti __o; } __rv; + __rv.__o = __builtin_neon_vld2_dupv4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x2_t __attribute__ ((__always_inline__)) vld2_dup_f32 (const float32_t * __a) { @@ -9800,6 +10062,15 @@ vst2_s32 (int32_t * __a, int32x2x2_t __b) __builtin_neon_vst2v2si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst2_f16 (float16_t * __a, float16x4x2_t __b) +{ + union { float16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; + __builtin_neon_vst2v4hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst2_f32 (float32_t * __a, float32x2x2_t __b) { @@ -9886,6 +10157,15 @@ vst2q_s32 (int32_t * __a, int32x4x2_t __b) __builtin_neon_vst2v4si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst2q_f16 (float16_t * __a, float16x8x2_t __b) +{ + union { float16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; + __builtin_neon_vst2v8hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst2q_f32 (float32_t * __a, float32x4x2_t __b) { @@ -9949,6 +10229,15 @@ vst2_lane_s32 (int32_t * __a, int32x2x2_t __b, const int __c) __builtin_neon_vst2_lanev2si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst2_lane_f16 (float16_t * __a, float16x4x2_t __b, const int __c) +{ + union { float16x4x2_t __i; __builtin_neon_ti __o; } __bu = { __b }; + __builtin_neon_vst2_lanev4hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst2_lane_f32 (float32_t * __a, float32x2x2_t __b, const int __c) { @@ -10005,6 +10294,15 @@ vst2q_lane_s32 (int32_t * __a, int32x4x2_t __b, const int __c) __builtin_neon_vst2_lanev4si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst2q_lane_f16 (float16_t * __a, float16x8x2_t __b, const int __c) +{ + union { float16x8x2_t __i; __builtin_neon_oi __o; } __bu = { __b }; + __builtin_neon_vst2_lanev8hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst2q_lane_f32 (float32_t * __a, float32x4x2_t __b, const int __c) { @@ -10057,6 +10355,16 @@ vld3_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x3_t __attribute__ ((__always_inline__)) +vld3_f16 (const float16_t * __a) +{ + union { float16x4x3_t __i; __builtin_neon_ei __o; } __rv; + __rv.__o = __builtin_neon_vld3v4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x3_t __attribute__ ((__always_inline__)) vld3_f32 (const float32_t * __a) { @@ -10155,6 +10463,16 @@ vld3q_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x3_t __attribute__ ((__always_inline__)) +vld3q_f16 (const float16_t * __a) +{ + union { float16x8x3_t __i; __builtin_neon_ci __o; } __rv; + __rv.__o = __builtin_neon_vld3v8hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x3_t __attribute__ ((__always_inline__)) vld3q_f32 (const float32_t * __a) { @@ -10230,6 +10548,17 @@ vld3_lane_s32 (const int32_t * __a, int32x2x3_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x3_t __attribute__ ((__always_inline__)) +vld3_lane_f16 (const float16_t * __a, float16x4x3_t __b, const int __c) +{ + union { float16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; + union { float16x4x3_t __i; __builtin_neon_ei __o; } __rv; + __rv.__o = __builtin_neon_vld3_lanev4hf (__a, __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x3_t __attribute__ ((__always_inline__)) vld3_lane_f32 (const float32_t * __a, float32x2x3_t __b, const int __c) { @@ -10302,6 +10631,17 @@ vld3q_lane_s32 (const int32_t * __a, int32x4x3_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x3_t __attribute__ ((__always_inline__)) +vld3q_lane_f16 (const float16_t * __a, float16x8x3_t __b, const int __c) +{ + union { float16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; + union { float16x8x3_t __i; __builtin_neon_ci __o; } __rv; + __rv.__o = __builtin_neon_vld3_lanev8hf (__a, __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x3_t __attribute__ ((__always_inline__)) vld3q_lane_f32 (const float32_t * __a, float32x4x3_t __b, const int __c) { @@ -10362,6 +10702,16 @@ vld3_dup_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x3_t __attribute__ ((__always_inline__)) +vld3_dup_f16 (const float16_t * __a) +{ + union { float16x4x3_t __i; __builtin_neon_ei __o; } __rv; + __rv.__o = __builtin_neon_vld3_dupv4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x3_t __attribute__ ((__always_inline__)) vld3_dup_f32 (const float32_t * __a) { @@ -10457,6 +10807,15 @@ vst3_s32 (int32_t * __a, int32x2x3_t __b) __builtin_neon_vst3v2si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst3_f16 (float16_t * __a, float16x4x3_t __b) +{ + union { float16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; + __builtin_neon_vst3v4hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst3_f32 (float32_t * __a, float32x2x3_t __b) { @@ -10543,6 +10902,15 @@ vst3q_s32 (int32_t * __a, int32x4x3_t __b) __builtin_neon_vst3v4si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst3q_f16 (float16_t * __a, float16x8x3_t __b) +{ + union { float16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; + __builtin_neon_vst3v8hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst3q_f32 (float32_t * __a, float32x4x3_t __b) { @@ -10606,6 +10974,15 @@ vst3_lane_s32 (int32_t * __a, int32x2x3_t __b, const int __c) __builtin_neon_vst3_lanev2si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst3_lane_f16 (float16_t * __a, float16x4x3_t __b, const int __c) +{ + union { float16x4x3_t __i; __builtin_neon_ei __o; } __bu = { __b }; + __builtin_neon_vst3_lanev4hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst3_lane_f32 (float32_t * __a, float32x2x3_t __b, const int __c) { @@ -10662,6 +11039,15 @@ vst3q_lane_s32 (int32_t * __a, int32x4x3_t __b, const int __c) __builtin_neon_vst3_lanev4si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst3q_lane_f16 (float16_t * __a, float16x8x3_t __b, const int __c) +{ + union { float16x8x3_t __i; __builtin_neon_ci __o; } __bu = { __b }; + __builtin_neon_vst3_lanev8hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst3q_lane_f32 (float32_t * __a, float32x4x3_t __b, const int __c) { @@ -10714,6 +11100,16 @@ vld4_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x4_t __attribute__ ((__always_inline__)) +vld4_f16 (const float16_t * __a) +{ + union { float16x4x4_t __i; __builtin_neon_oi __o; } __rv; + __rv.__o = __builtin_neon_vld4v4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x4_t __attribute__ ((__always_inline__)) vld4_f32 (const float32_t * __a) { @@ -10812,6 +11208,16 @@ vld4q_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x4_t __attribute__ ((__always_inline__)) +vld4q_f16 (const float16_t * __a) +{ + union { float16x8x4_t __i; __builtin_neon_xi __o; } __rv; + __rv.__o = __builtin_neon_vld4v8hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x4_t __attribute__ ((__always_inline__)) vld4q_f32 (const float32_t * __a) { @@ -10887,6 +11293,18 @@ vld4_lane_s32 (const int32_t * __a, int32x2x4_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x4_t __attribute__ ((__always_inline__)) +vld4_lane_f16 (const float16_t * __a, float16x4x4_t __b, const int __c) +{ + union { float16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; + union { float16x4x4_t __i; __builtin_neon_oi __o; } __rv; + __rv.__o = __builtin_neon_vld4_lanev4hf (__a, + __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x4_t __attribute__ ((__always_inline__)) vld4_lane_f32 (const float32_t * __a, float32x2x4_t __b, const int __c) { @@ -10959,6 +11377,18 @@ vld4q_lane_s32 (const int32_t * __a, int32x4x4_t __b, const int __c) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8x4_t __attribute__ ((__always_inline__)) +vld4q_lane_f16 (const float16_t * __a, float16x8x4_t __b, const int __c) +{ + union { float16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; + union { float16x8x4_t __i; __builtin_neon_xi __o; } __rv; + __rv.__o = __builtin_neon_vld4_lanev8hf (__a, + __bu.__o, __c); + return __rv.__i; +} +#endif + __extension__ static __inline float32x4x4_t __attribute__ ((__always_inline__)) vld4q_lane_f32 (const float32_t * __a, float32x4x4_t __b, const int __c) { @@ -11019,6 +11449,16 @@ vld4_dup_s32 (const int32_t * __a) return __rv.__i; } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4x4_t __attribute__ ((__always_inline__)) +vld4_dup_f16 (const float16_t * __a) +{ + union { float16x4x4_t __i; __builtin_neon_oi __o; } __rv; + __rv.__o = __builtin_neon_vld4_dupv4hf (__a); + return __rv.__i; +} +#endif + __extension__ static __inline float32x2x4_t __attribute__ ((__always_inline__)) vld4_dup_f32 (const float32_t * __a) { @@ -11114,6 +11554,15 @@ vst4_s32 (int32_t * __a, int32x2x4_t __b) __builtin_neon_vst4v2si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst4_f16 (float16_t * __a, float16x4x4_t __b) +{ + union { float16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; + __builtin_neon_vst4v4hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst4_f32 (float32_t * __a, float32x2x4_t __b) { @@ -11200,6 +11649,15 @@ vst4q_s32 (int32_t * __a, int32x4x4_t __b) __builtin_neon_vst4v4si ((__builtin_neon_si *) __a, __bu.__o); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst4q_f16 (float16_t * __a, float16x8x4_t __b) +{ + union { float16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; + __builtin_neon_vst4v8hf (__a, __bu.__o); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst4q_f32 (float32_t * __a, float32x4x4_t __b) { @@ -11263,6 +11721,15 @@ vst4_lane_s32 (int32_t * __a, int32x2x4_t __b, const int __c) __builtin_neon_vst4_lanev2si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst4_lane_f16 (float16_t * __a, float16x4x4_t __b, const int __c) +{ + union { float16x4x4_t __i; __builtin_neon_oi __o; } __bu = { __b }; + __builtin_neon_vst4_lanev4hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst4_lane_f32 (float32_t * __a, float32x2x4_t __b, const int __c) { @@ -11319,6 +11786,15 @@ vst4q_lane_s32 (int32_t * __a, int32x4x4_t __b, const int __c) __builtin_neon_vst4_lanev4si ((__builtin_neon_si *) __a, __bu.__o, __c); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline void __attribute__ ((__always_inline__)) +vst4q_lane_f16 (float16_t * __a, float16x8x4_t __b, const int __c) +{ + union { float16x8x4_t __i; __builtin_neon_xi __o; } __bu = { __b }; + __builtin_neon_vst4_lanev8hf (__a, __bu.__o, __c); +} +#endif + __extension__ static __inline void __attribute__ ((__always_inline__)) vst4q_lane_f32 (float32_t * __a, float32x4x4_t __b, const int __c) { @@ -11833,6 +12309,14 @@ vreinterpret_p8_p16 (poly16x4_t __a) return (poly8x8_t)__builtin_neon_vreinterpretv8qiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) +vreinterpret_p8_f16 (float16x4_t __a) +{ + return (poly8x8_t) __a; +} +#endif + __extension__ static __inline poly8x8_t __attribute__ ((__always_inline__)) vreinterpret_p8_f32 (float32x2_t __a) { @@ -11901,6 +12385,14 @@ vreinterpret_p16_p8 (poly8x8_t __a) return (poly16x4_t)__builtin_neon_vreinterpretv4hiv8qi ((int8x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) +vreinterpret_p16_f16 (float16x4_t __a) +{ + return (poly16x4_t) __a; +} +#endif + __extension__ static __inline poly16x4_t __attribute__ ((__always_inline__)) vreinterpret_p16_f32 (float32x2_t __a) { @@ -11963,6 +12455,104 @@ vreinterpret_p16_u32 (uint32x2_t __a) return (poly16x4_t)__builtin_neon_vreinterpretv4hiv2si ((int32x2_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_p8 (poly8x8_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_p16 (poly16x4_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_f32 (float32x2_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#ifdef __ARM_FEATURE_CRYPTO +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_p64 (poly64x1_t __a) +{ + return (float16x4_t) __a; +} +#endif +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s64 (int64x1_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u64 (uint64x1_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s8 (int8x8_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s16 (int16x4_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_s32 (int32x2_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u8 (uint8x8_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u16 (uint16x4_t __a) +{ + return (float16x4_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x4_t __attribute__ ((__always_inline__)) +vreinterpret_f16_u32 (uint32x2_t __a) +{ + return (float16x4_t) __a; +} +#endif + __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vreinterpret_f32_p8 (poly8x8_t __a) { @@ -11975,6 +12565,14 @@ vreinterpret_f32_p16 (poly16x4_t __a) return (float32x2_t)__builtin_neon_vreinterpretv2sfv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) +vreinterpret_f32_f16 (float16x4_t __a) +{ + return (float32x2_t) __a; +} +#endif + #ifdef __ARM_FEATURE_CRYPTO __extension__ static __inline float32x2_t __attribute__ ((__always_inline__)) vreinterpret_f32_p64 (poly64x1_t __a) @@ -12047,6 +12645,17 @@ vreinterpret_p64_p16 (poly16x4_t __a) } #endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#ifdef __ARM_FEATURE_CRYPTO +__extension__ static __inline poly64x1_t __attribute__ ((__always_inline__)) +vreinterpret_p64_f16 (float16x4_t __a) +{ + return (poly64x1_t) __a; +} +#endif +#endif + #ifdef __ARM_FEATURE_CRYPTO __extension__ static __inline poly64x1_t __attribute__ ((__always_inline__)) vreinterpret_p64_f32 (float32x2_t __a) @@ -12131,6 +12740,14 @@ vreinterpret_s64_p16 (poly16x4_t __a) return (int64x1_t)__builtin_neon_vreinterpretdiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) +vreinterpret_s64_f16 (float16x4_t __a) +{ + return (int64x1_t) __a; +} +#endif + __extension__ static __inline int64x1_t __attribute__ ((__always_inline__)) vreinterpret_s64_f32 (float32x2_t __a) { @@ -12199,6 +12816,14 @@ vreinterpret_u64_p16 (poly16x4_t __a) return (uint64x1_t)__builtin_neon_vreinterpretdiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) +vreinterpret_u64_f16 (float16x4_t __a) +{ + return (uint64x1_t) __a; +} +#endif + __extension__ static __inline uint64x1_t __attribute__ ((__always_inline__)) vreinterpret_u64_f32 (float32x2_t __a) { @@ -12267,6 +12892,14 @@ vreinterpret_s8_p16 (poly16x4_t __a) return (int8x8_t)__builtin_neon_vreinterpretv8qiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) +vreinterpret_s8_f16 (float16x4_t __a) +{ + return (int8x8_t) __a; +} +#endif + __extension__ static __inline int8x8_t __attribute__ ((__always_inline__)) vreinterpret_s8_f32 (float32x2_t __a) { @@ -12335,6 +12968,14 @@ vreinterpret_s16_p16 (poly16x4_t __a) return (int16x4_t)__builtin_neon_vreinterpretv4hiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) +vreinterpret_s16_f16 (float16x4_t __a) +{ + return (int16x4_t) __a; +} +#endif + __extension__ static __inline int16x4_t __attribute__ ((__always_inline__)) vreinterpret_s16_f32 (float32x2_t __a) { @@ -12403,6 +13044,14 @@ vreinterpret_s32_p16 (poly16x4_t __a) return (int32x2_t)__builtin_neon_vreinterpretv2siv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) +vreinterpret_s32_f16 (float16x4_t __a) +{ + return (int32x2_t) __a; +} +#endif + __extension__ static __inline int32x2_t __attribute__ ((__always_inline__)) vreinterpret_s32_f32 (float32x2_t __a) { @@ -12471,6 +13120,14 @@ vreinterpret_u8_p16 (poly16x4_t __a) return (uint8x8_t)__builtin_neon_vreinterpretv8qiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) +vreinterpret_u8_f16 (float16x4_t __a) +{ + return (uint8x8_t) __a; +} +#endif + __extension__ static __inline uint8x8_t __attribute__ ((__always_inline__)) vreinterpret_u8_f32 (float32x2_t __a) { @@ -12539,6 +13196,14 @@ vreinterpret_u16_p16 (poly16x4_t __a) return (uint16x4_t)__builtin_neon_vreinterpretv4hiv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) +vreinterpret_u16_f16 (float16x4_t __a) +{ + return (uint16x4_t) __a; +} +#endif + __extension__ static __inline uint16x4_t __attribute__ ((__always_inline__)) vreinterpret_u16_f32 (float32x2_t __a) { @@ -12607,6 +13272,14 @@ vreinterpret_u32_p16 (poly16x4_t __a) return (uint32x2_t)__builtin_neon_vreinterpretv2siv4hi ((int16x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) +vreinterpret_u32_f16 (float16x4_t __a) +{ + return (uint32x2_t) __a; +} +#endif + __extension__ static __inline uint32x2_t __attribute__ ((__always_inline__)) vreinterpret_u32_f32 (float32x2_t __a) { @@ -12669,6 +13342,14 @@ vreinterpretq_p8_p16 (poly16x8_t __a) return (poly8x16_t)__builtin_neon_vreinterpretv16qiv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_p8_f16 (float16x8_t __a) +{ + return (poly8x16_t) __a; +} +#endif + __extension__ static __inline poly8x16_t __attribute__ ((__always_inline__)) vreinterpretq_p8_f32 (float32x4_t __a) { @@ -12745,6 +13426,14 @@ vreinterpretq_p16_p8 (poly8x16_t __a) return (poly16x8_t)__builtin_neon_vreinterpretv8hiv16qi ((int8x16_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_p16_f16 (float16x8_t __a) +{ + return (poly16x8_t) __a; +} +#endif + __extension__ static __inline poly16x8_t __attribute__ ((__always_inline__)) vreinterpretq_p16_f32 (float32x4_t __a) { @@ -12815,6 +13504,114 @@ vreinterpretq_p16_u32 (uint32x4_t __a) return (poly16x8_t)__builtin_neon_vreinterpretv8hiv4si ((int32x4_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p8 (poly8x16_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p16 (poly16x8_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_f32 (float32x4_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#ifdef __ARM_FEATURE_CRYPTO +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p64 (poly64x2_t __a) +{ + return (float16x8_t) __a; +} +#endif +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#ifdef __ARM_FEATURE_CRYPTO +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_p128 (poly128_t __a) +{ + return (float16x8_t) __a; +} +#endif +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s64 (int64x2_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u64 (uint64x2_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s8 (int8x16_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s16 (int16x8_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_s32 (int32x4_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u8 (uint8x16_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u16 (uint16x8_t __a) +{ + return (float16x8_t) __a; +} +#endif + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_f16_u32 (uint32x4_t __a) +{ + return (float16x8_t) __a; +} +#endif + __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vreinterpretq_f32_p8 (poly8x16_t __a) { @@ -12827,6 +13624,14 @@ vreinterpretq_f32_p16 (poly16x8_t __a) return (float32x4_t)__builtin_neon_vreinterpretv4sfv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_f32_f16 (float16x8_t __a) +{ + return (float32x4_t) __a; +} +#endif + #ifdef __ARM_FEATURE_CRYPTO __extension__ static __inline float32x4_t __attribute__ ((__always_inline__)) vreinterpretq_f32_p64 (poly64x2_t __a) @@ -12907,6 +13712,17 @@ vreinterpretq_p64_p16 (poly16x8_t __a) } #endif + +#ifdef __ARM_FEATURE_CRYPTO +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly64x2_t __attribute__ ((__always_inline__)) +vreinterpretq_p64_f16 (float16x8_t __a) +{ + return (poly64x2_t) __a; +} +#endif +#endif + #ifdef __ARM_FEATURE_CRYPTO __extension__ static __inline poly64x2_t __attribute__ ((__always_inline__)) vreinterpretq_p64_f32 (float32x4_t __a) @@ -13001,8 +13817,18 @@ vreinterpretq_p128_p16 (poly16x8_t __a) { return (poly128_t)__builtin_neon_vreinterprettiv8hi ((int16x8_t) __a); } +#endif +#ifdef __ARM_FEATURE_CRYPTO +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline poly128_t __attribute__ ((__always_inline__)) +vreinterpretq_p128_f16 (float16x8_t __a) +{ + return (poly128_t) __a; +} #endif +#endif + #ifdef __ARM_FEATURE_CRYPTO __extension__ static __inline poly128_t __attribute__ ((__always_inline__)) vreinterpretq_p128_f32 (float32x4_t __a) @@ -13095,6 +13921,14 @@ vreinterpretq_s64_p16 (poly16x8_t __a) return (int64x2_t)__builtin_neon_vreinterpretv2div8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) +vreinterpretq_s64_f16 (float16x8_t __a) +{ + return (int64x2_t) __a; +} +#endif + __extension__ static __inline int64x2_t __attribute__ ((__always_inline__)) vreinterpretq_s64_f32 (float32x4_t __a) { @@ -13171,6 +14005,14 @@ vreinterpretq_u64_p16 (poly16x8_t __a) return (uint64x2_t)__builtin_neon_vreinterpretv2div8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) +vreinterpretq_u64_f16 (float16x8_t __a) +{ + return (uint64x2_t) __a; +} +#endif + __extension__ static __inline uint64x2_t __attribute__ ((__always_inline__)) vreinterpretq_u64_f32 (float32x4_t __a) { @@ -13247,6 +14089,14 @@ vreinterpretq_s8_p16 (poly16x8_t __a) return (int8x16_t)__builtin_neon_vreinterpretv16qiv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_s8_f16 (float16x8_t __a) +{ + return (int8x16_t) __a; +} +#endif + __extension__ static __inline int8x16_t __attribute__ ((__always_inline__)) vreinterpretq_s8_f32 (float32x4_t __a) { @@ -13323,6 +14173,14 @@ vreinterpretq_s16_p16 (poly16x8_t __a) return (int16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_s16_f16 (float16x8_t __a) +{ + return (int16x8_t) __a; +} +#endif + __extension__ static __inline int16x8_t __attribute__ ((__always_inline__)) vreinterpretq_s16_f32 (float32x4_t __a) { @@ -13399,6 +14257,14 @@ vreinterpretq_s32_p16 (poly16x8_t __a) return (int32x4_t)__builtin_neon_vreinterpretv4siv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_s32_f16 (float16x8_t __a) +{ + return (int32x4_t)__builtin_neon_vreinterpretv4siv8hi ((int16x8_t) __a); +} +#endif + __extension__ static __inline int32x4_t __attribute__ ((__always_inline__)) vreinterpretq_s32_f32 (float32x4_t __a) { @@ -13475,6 +14341,14 @@ vreinterpretq_u8_p16 (poly16x8_t __a) return (uint8x16_t)__builtin_neon_vreinterpretv16qiv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) +vreinterpretq_u8_f16 (float16x8_t __a) +{ + return (uint8x16_t) __a; +} +#endif + __extension__ static __inline uint8x16_t __attribute__ ((__always_inline__)) vreinterpretq_u8_f32 (float32x4_t __a) { @@ -13551,6 +14425,14 @@ vreinterpretq_u16_p16 (poly16x8_t __a) return (uint16x8_t)__builtin_neon_vreinterpretv8hiv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) +vreinterpretq_u16_f16 (float16x8_t __a) +{ + return (uint16x8_t) __a; +} +#endif + __extension__ static __inline uint16x8_t __attribute__ ((__always_inline__)) vreinterpretq_u16_f32 (float32x4_t __a) { @@ -13627,6 +14509,14 @@ vreinterpretq_u32_p16 (poly16x8_t __a) return (uint32x4_t)__builtin_neon_vreinterpretv4siv8hi ((int16x8_t) __a); } +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +__extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) +vreinterpretq_u32_f16 (float16x8_t __a) +{ + return (uint32x4_t) __a; +} +#endif + __extension__ static __inline uint32x4_t __attribute__ ((__always_inline__)) vreinterpretq_u32_f32 (float32x4_t __a) { diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def index f150b98b809..0b719df7607 100644 --- a/gcc/config/arm/arm_neon_builtins.def +++ b/gcc/config/arm/arm_neon_builtins.def @@ -164,9 +164,9 @@ VAR10 (UNOP, vdup_n, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) VAR10 (GETLANE, vdup_lane, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) -VAR5 (COMBINE, vcombine, v8qi, v4hi, v2si, v2sf, di) -VAR5 (UNOP, vget_high, v16qi, v8hi, v4si, v4sf, v2di) -VAR5 (UNOP, vget_low, v16qi, v8hi, v4si, v4sf, v2di) +VAR6 (COMBINE, vcombine, v8qi, v4hi, v4hf, v2si, v2sf, di) +VAR6 (UNOP, vget_high, v16qi, v8hi, v8hf, v4si, v4sf, v2di) +VAR6 (UNOP, vget_low, v16qi, v8hi, v8hf, v4si, v4sf, v2di) VAR3 (UNOP, vmovn, v8hi, v4si, v2di) VAR3 (UNOP, vqmovns, v8hi, v4si, v2di) VAR3 (UNOP, vqmovnu, v8hi, v4si, v2di) @@ -242,40 +242,40 @@ VAR6 (UNOP, vreinterpretv4si, v16qi, v8hi, v4si, v4sf, v2di, ti) VAR6 (UNOP, vreinterpretv4sf, v16qi, v8hi, v4si, v4sf, v2di, ti) VAR6 (UNOP, vreinterpretv2di, v16qi, v8hi, v4si, v4sf, v2di, ti) VAR6 (UNOP, vreinterpretti, v16qi, v8hi, v4si, v4sf, v2di, ti) -VAR10 (LOAD1, vld1, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) +VAR12 (LOAD1, vld1, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di) VAR10 (LOAD1LANE, vld1_lane, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) VAR10 (LOAD1, vld1_dup, v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) -VAR10 (STORE1, vst1, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) -VAR10 (STORE1LANE, vst1_lane, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di) -VAR9 (LOAD1, vld2, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (LOAD1LANE, vld2_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) -VAR5 (LOAD1, vld2_dup, v8qi, v4hi, v2si, v2sf, di) -VAR9 (STORE1, vst2, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (STORE1LANE, vst2_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) -VAR9 (LOAD1, vld3, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (LOAD1LANE, vld3_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) -VAR5 (LOAD1, vld3_dup, v8qi, v4hi, v2si, v2sf, di) -VAR9 (STORE1, vst3, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (STORE1LANE, vst3_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) -VAR9 (LOAD1, vld4, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (LOAD1LANE, vld4_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) -VAR5 (LOAD1, vld4_dup, v8qi, v4hi, v2si, v2sf, di) -VAR9 (STORE1, vst4, - v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf) -VAR7 (STORE1LANE, vst4_lane, - v8qi, v4hi, v2si, v2sf, v8hi, v4si, v4sf) +VAR12 (STORE1, vst1, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di) +VAR12 (STORE1LANE, vst1_lane, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di) +VAR11 (LOAD1, vld2, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (LOAD1LANE, vld2_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR6 (LOAD1, vld2_dup, v8qi, v4hi, v4hf, v2si, v2sf, di) +VAR11 (STORE1, vst2, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (STORE1LANE, vst2_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR11 (LOAD1, vld3, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (LOAD1LANE, vld3_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR6 (LOAD1, vld3_dup, v8qi, v4hi, v4hf, v2si, v2sf, di) +VAR11 (STORE1, vst3, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (STORE1LANE, vst3_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR11 (LOAD1, vld4, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (LOAD1LANE, vld4_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) +VAR6 (LOAD1, vld4_dup, v8qi, v4hi, v4hf, v2si, v2sf, di) +VAR11 (STORE1, vst4, + v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf) +VAR9 (STORE1LANE, vst4_lane, + v8qi, v4hi, v4hf, v2si, v2sf, v8hi, v8hf, v4si, v4sf) diff --git a/gcc/config/arm/iterators.md b/gcc/config/arm/iterators.md index 1e7f3f17a8a..47cc1eebecd 100644 --- a/gcc/config/arm/iterators.md +++ b/gcc/config/arm/iterators.md @@ -65,20 +65,32 @@ ;; Integer modes supported by Neon and IWMMXT, except V2DI (define_mode_iterator VINTW [V2SI V4HI V8QI V4SI V8HI V16QI]) -;; Double-width vector modes. +;; Double-width vector modes, on which we support arithmetic (no HF!) (define_mode_iterator VD [V8QI V4HI V2SI V2SF]) +;; Double-width vector modes plus 64-bit elements for vreinterpret + vcreate. +(define_mode_iterator VD_RE [V8QI V4HI V2SI V2SF DI]) + ;; Double-width vector modes plus 64-bit elements. -(define_mode_iterator VDX [V8QI V4HI V2SI V2SF DI]) +(define_mode_iterator VDX [V8QI V4HI V4HF V2SI V2SF DI]) + +;; Double-width vector modes, with V4HF - for vldN_lane and vstN_lane. +(define_mode_iterator VD_LANE [V8QI V4HI V4HF V2SI V2SF]) ;; Double-width vector modes without floating-point elements. (define_mode_iterator VDI [V8QI V4HI V2SI]) -;; Quad-width vector modes. +;; Quad-width vector modes supporting arithmetic (no HF!). (define_mode_iterator VQ [V16QI V8HI V4SI V4SF]) +;; Quad-width vector modes, including V8HF. +(define_mode_iterator VQ2 [V16QI V8HI V8HF V4SI V4SF]) + +;; Quad-width vector modes with 16- or 32-bit elements +(define_mode_iterator VQ_HS [V8HI V8HF V4SI V4SF]) + ;; Quad-width vector modes plus 64-bit elements. -(define_mode_iterator VQX [V16QI V8HI V4SI V4SF V2DI]) +(define_mode_iterator VQX [V16QI V8HI V8HF V4SI V4SF V2DI]) ;; Quad-width vector modes without floating-point elements. (define_mode_iterator VQI [V16QI V8HI V4SI]) @@ -111,7 +123,8 @@ (define_mode_iterator VDQI [V8QI V16QI V4HI V8HI V2SI V4SI V2DI]) ;; Vector modes, including 64-bit integer elements. -(define_mode_iterator VDQX [V8QI V16QI V4HI V8HI V2SI V4SI V2SF V4SF DI V2DI]) +(define_mode_iterator VDQX [V8QI V16QI V4HI V8HI V2SI V4SI + V4HF V8HF V2SF V4SF DI V2DI]) ;; Vector modes including 64-bit integer elements, but no floats. (define_mode_iterator VDQIX [V8QI V16QI V4HI V8HI V2SI V4SI DI V2DI]) @@ -366,7 +379,8 @@ ;; Define element mode for each vector mode. (define_mode_attr V_elem [(V8QI "QI") (V16QI "QI") - (V4HI "HI") (V8HI "HI") + (V4HI "HI") (V8HI "HI") + (V4HF "HF") (V8HF "HF") (V2SI "SI") (V4SI "SI") (V2SF "SF") (V4SF "SF") (DI "DI") (V2DI "DI")]) @@ -383,6 +397,7 @@ ;; size for structure lane/dup loads and stores. (define_mode_attr V_two_elem [(V8QI "HI") (V16QI "HI") (V4HI "SI") (V8HI "SI") + (V4HF "SF") (V8HF "SF") (V2SI "V2SI") (V4SI "V2SI") (V2SF "V2SF") (V4SF "V2SF") (DI "V2DI") (V2DI "V2DI")]) @@ -390,6 +405,7 @@ ;; Similar, for three elements. (define_mode_attr V_three_elem [(V8QI "BLK") (V16QI "BLK") (V4HI "BLK") (V8HI "BLK") + (V4HF "BLK") (V8HF "BLK") (V2SI "BLK") (V4SI "BLK") (V2SF "BLK") (V4SF "BLK") (DI "EI") (V2DI "EI")]) @@ -397,6 +413,7 @@ ;; Similar, for four elements. (define_mode_attr V_four_elem [(V8QI "SI") (V16QI "SI") (V4HI "V4HI") (V8HI "V4HI") + (V4HF "V4HF") (V8HF "V4HF") (V2SI "V4SI") (V4SI "V4SI") (V2SF "V4SF") (V4SF "V4SF") (DI "OI") (V2DI "OI")]) @@ -421,7 +438,8 @@ ;; Modes with half the number of equal-sized elements. (define_mode_attr V_HALF [(V16QI "V8QI") (V8HI "V4HI") - (V4SI "V2SI") (V4SF "V2SF") (V2DF "DF") + (V8HF "V4HF") (V4SI "V2SI") + (V4SF "V2SF") (V2DF "DF") (V2DI "DI")]) ;; Same, but lower-case. @@ -431,8 +449,9 @@ ;; Modes with twice the number of equal-sized elements. (define_mode_attr V_DOUBLE [(V8QI "V16QI") (V4HI "V8HI") - (V2SI "V4SI") (V2SF "V4SF") (DF "V2DF") - (DI "V2DI")]) + (V2SI "V4SI") (V4HF "V8HF") + (V2SF "V4SF") (DF "V2DF") + (DI "V2DI")]) ;; Same, but lower-case. (define_mode_attr V_double [(V8QI "v16qi") (V4HI "v8hi") @@ -454,8 +473,9 @@ ;; Mode of result of comparison operations (and bit-select operand 1). (define_mode_attr V_cmp_result [(V8QI "V8QI") (V16QI "V16QI") - (V4HI "V4HI") (V8HI "V8HI") + (V4HI "V4HI") (V8HI "V8HI") (V2SI "V2SI") (V4SI "V4SI") + (V4HF "V4HI") (V8HF "V8HI") (V2SF "V2SI") (V4SF "V4SI") (DI "DI") (V2DI "V2DI")]) @@ -492,12 +512,14 @@ (define_mode_attr V_uf_sclr [(V8QI "u8") (V16QI "u8") (V4HI "u16") (V8HI "u16") (V2SI "32") (V4SI "32") + (V4HF "u16") (V8HF "u16") (V2SF "32") (V4SF "32")]) (define_mode_attr V_sz_elem [(V8QI "8") (V16QI "8") (V4HI "16") (V8HI "16") (V2SI "32") (V4SI "32") (DI "64") (V2DI "64") + (V4HF "16") (V8HF "16") (V2SF "32") (V4SF "32")]) (define_mode_attr V_elem_ch [(V8QI "b") (V16QI "b") @@ -564,6 +586,7 @@ (DI "true") (V2DI "false")]) (define_mode_attr V_mode_nunits [(V8QI "8") (V16QI "16") + (V4HF "4") (V8HF "8") (V4HI "4") (V8HI "8") (V2SI "2") (V4SI "4") (V2SF "2") (V4SF "4") @@ -607,6 +630,7 @@ (define_mode_attr q [(V8QI "") (V16QI "_q") (V4HI "") (V8HI "_q") (V2SI "") (V4SI "_q") + (V4HF "") (V8HF "_q") (V2SF "") (V4SF "_q") (DI "") (V2DI "_q") (DF "") (V2DF "_q")]) diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md index 873330fc7de..26678663a64 100644 --- a/gcc/config/arm/neon.md +++ b/gcc/config/arm/neon.md @@ -320,11 +320,11 @@ [(set_attr "type" "neon_load1_all_lanes<q>,neon_from_gp<q>")]) (define_insn "vec_set<mode>_internal" - [(set (match_operand:VQ 0 "s_register_operand" "=w,w") - (vec_merge:VQ - (vec_duplicate:VQ + [(set (match_operand:VQ2 0 "s_register_operand" "=w,w") + (vec_merge:VQ2 + (vec_duplicate:VQ2 (match_operand:<V_elem> 1 "nonimmediate_operand" "Um,r")) - (match_operand:VQ 3 "s_register_operand" "0,0") + (match_operand:VQ2 3 "s_register_operand" "0,0") (match_operand:SI 2 "immediate_operand" "i,i")))] "TARGET_NEON" { @@ -407,7 +407,7 @@ (define_insn "vec_extract<mode>" [(set (match_operand:<V_elem> 0 "nonimmediate_operand" "=Um,r") (vec_select:<V_elem> - (match_operand:VQ 1 "s_register_operand" "w,w") + (match_operand:VQ2 1 "s_register_operand" "w,w") (parallel [(match_operand:SI 2 "immediate_operand" "i,i")])))] "TARGET_NEON" { @@ -2607,7 +2607,7 @@ [(set (match_operand:SI 0 "s_register_operand" "=r") (sign_extend:SI (vec_select:<V_elem> - (match_operand:VQ 1 "s_register_operand" "w") + (match_operand:VQ2 1 "s_register_operand" "w") (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] "TARGET_NEON" { @@ -2634,7 +2634,7 @@ [(set (match_operand:SI 0 "s_register_operand" "=r") (zero_extend:SI (vec_select:<V_elem> - (match_operand:VQ 1 "s_register_operand" "w") + (match_operand:VQ2 1 "s_register_operand" "w") (parallel [(match_operand:SI 2 "immediate_operand" "i")]))))] "TARGET_NEON" { @@ -2789,7 +2789,7 @@ if (BYTES_BIG_ENDIAN) }) (define_expand "neon_vcreate<mode>" - [(match_operand:VDX 0 "s_register_operand" "") + [(match_operand:VD_RE 0 "s_register_operand" "") (match_operand:DI 1 "general_operand" "")] "TARGET_NEON" { @@ -4140,7 +4140,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vreinterpretv8qi<mode>" [(match_operand:V8QI 0 "s_register_operand" "") - (match_operand:VDX 1 "s_register_operand" "")] + (match_operand:VD_RE 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); @@ -4149,7 +4149,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vreinterpretv4hi<mode>" [(match_operand:V4HI 0 "s_register_operand" "") - (match_operand:VDX 1 "s_register_operand" "")] + (match_operand:VD_RE 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); @@ -4158,7 +4158,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vreinterpretv2si<mode>" [(match_operand:V2SI 0 "s_register_operand" "") - (match_operand:VDX 1 "s_register_operand" "")] + (match_operand:VD_RE 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); @@ -4167,7 +4167,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vreinterpretv2sf<mode>" [(match_operand:V2SF 0 "s_register_operand" "") - (match_operand:VDX 1 "s_register_operand" "")] + (match_operand:VD_RE 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); @@ -4176,7 +4176,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vreinterpretdi<mode>" [(match_operand:DI 0 "s_register_operand" "") - (match_operand:VDX 1 "s_register_operand" "")] + (match_operand:VD_RE 1 "s_register_operand" "")] "TARGET_NEON" { neon_reinterpret (operands[0], operands[1]); @@ -4435,14 +4435,14 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_load_lanesoi<mode>" [(set (match_operand:OI 0 "s_register_operand") (unspec:OI [(match_operand:OI 1 "neon_struct_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD2))] "TARGET_NEON") (define_insn "neon_vld2<mode>" [(set (match_operand:OI 0 "s_register_operand" "=w") (unspec:OI [(match_operand:OI 1 "neon_struct_operand" "Um") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD2))] "TARGET_NEON" "vld2.<V_sz_elem>\t%h0, %A1" @@ -4453,7 +4453,7 @@ if (BYTES_BIG_ENDIAN) (unspec:TI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um") (match_operand:TI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD2_LANE))] "TARGET_NEON" { @@ -4478,7 +4478,7 @@ if (BYTES_BIG_ENDIAN) (unspec:OI [(match_operand:<V_two_elem> 1 "neon_struct_operand" "Um") (match_operand:OI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD2_LANE))] "TARGET_NEON" { @@ -4549,14 +4549,14 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_store_lanesoi<mode>" [(set (match_operand:OI 0 "neon_struct_operand") (unspec:OI [(match_operand:OI 1 "s_register_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST2))] "TARGET_NEON") (define_insn "neon_vst2<mode>" [(set (match_operand:OI 0 "neon_struct_operand" "=Um") (unspec:OI [(match_operand:OI 1 "s_register_operand" "w") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST2))] "TARGET_NEON" "vst2.<V_sz_elem>\t%h1, %A0" @@ -4568,7 +4568,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_two_elem> [(match_operand:TI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST2_LANE))] "TARGET_NEON" { @@ -4593,7 +4593,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_two_elem> [(match_operand:OI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST2_LANE))] "TARGET_NEON" { @@ -4646,7 +4646,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_load_lanesci<mode>" [(match_operand:CI 0 "s_register_operand") (match_operand:CI 1 "neon_struct_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { emit_insn (gen_neon_vld3<mode> (operands[0], operands[1])); @@ -4656,7 +4656,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vld3<mode>" [(match_operand:CI 0 "s_register_operand") (match_operand:CI 1 "neon_struct_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { rtx mem; @@ -4671,7 +4671,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vld3qa<mode>" [(set (match_operand:CI 0 "s_register_operand" "=w") (unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD3A))] "TARGET_NEON" { @@ -4691,7 +4691,7 @@ if (BYTES_BIG_ENDIAN) [(set (match_operand:CI 0 "s_register_operand" "=w") (unspec:CI [(match_operand:EI 1 "neon_struct_operand" "Um") (match_operand:CI 2 "s_register_operand" "0") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD3B))] "TARGET_NEON" { @@ -4712,7 +4712,7 @@ if (BYTES_BIG_ENDIAN) (unspec:EI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um") (match_operand:EI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD3_LANE))] "TARGET_NEON" { @@ -4739,7 +4739,7 @@ if (BYTES_BIG_ENDIAN) (unspec:CI [(match_operand:<V_three_elem> 1 "neon_struct_operand" "Um") (match_operand:CI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD3_LANE))] "TARGET_NEON" { @@ -4819,7 +4819,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_store_lanesci<mode>" [(match_operand:CI 0 "neon_struct_operand") (match_operand:CI 1 "s_register_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { emit_insn (gen_neon_vst3<mode> (operands[0], operands[1])); @@ -4829,7 +4829,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vst3<mode>" [(match_operand:CI 0 "neon_struct_operand") (match_operand:CI 1 "s_register_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { rtx mem; @@ -4844,7 +4844,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vst3qa<mode>" [(set (match_operand:EI 0 "neon_struct_operand" "=Um") (unspec:EI [(match_operand:CI 1 "s_register_operand" "w") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST3A))] "TARGET_NEON" { @@ -4863,7 +4863,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vst3qb<mode>" [(set (match_operand:EI 0 "neon_struct_operand" "=Um") (unspec:EI [(match_operand:CI 1 "s_register_operand" "w") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST3B))] "TARGET_NEON" { @@ -4884,7 +4884,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_three_elem> [(match_operand:EI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST3_LANE))] "TARGET_NEON" { @@ -4911,7 +4911,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_three_elem> [(match_operand:CI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST3_LANE))] "TARGET_NEON" { @@ -4966,7 +4966,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_load_lanesxi<mode>" [(match_operand:XI 0 "s_register_operand") (match_operand:XI 1 "neon_struct_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { emit_insn (gen_neon_vld4<mode> (operands[0], operands[1])); @@ -4976,7 +4976,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vld4<mode>" [(match_operand:XI 0 "s_register_operand") (match_operand:XI 1 "neon_struct_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { rtx mem; @@ -4991,7 +4991,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vld4qa<mode>" [(set (match_operand:XI 0 "s_register_operand" "=w") (unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD4A))] "TARGET_NEON" { @@ -5012,7 +5012,7 @@ if (BYTES_BIG_ENDIAN) [(set (match_operand:XI 0 "s_register_operand" "=w") (unspec:XI [(match_operand:OI 1 "neon_struct_operand" "Um") (match_operand:XI 2 "s_register_operand" "0") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD4B))] "TARGET_NEON" { @@ -5034,7 +5034,7 @@ if (BYTES_BIG_ENDIAN) (unspec:OI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um") (match_operand:OI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD4_LANE))] "TARGET_NEON" { @@ -5062,7 +5062,7 @@ if (BYTES_BIG_ENDIAN) (unspec:XI [(match_operand:<V_four_elem> 1 "neon_struct_operand" "Um") (match_operand:XI 2 "s_register_operand" "0") (match_operand:SI 3 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VLD4_LANE))] "TARGET_NEON" { @@ -5147,7 +5147,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "vec_store_lanesxi<mode>" [(match_operand:XI 0 "neon_struct_operand") (match_operand:XI 1 "s_register_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { emit_insn (gen_neon_vst4<mode> (operands[0], operands[1])); @@ -5157,7 +5157,7 @@ if (BYTES_BIG_ENDIAN) (define_expand "neon_vst4<mode>" [(match_operand:XI 0 "neon_struct_operand") (match_operand:XI 1 "s_register_operand") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] "TARGET_NEON" { rtx mem; @@ -5172,7 +5172,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vst4qa<mode>" [(set (match_operand:OI 0 "neon_struct_operand" "=Um") (unspec:OI [(match_operand:XI 1 "s_register_operand" "w") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST4A))] "TARGET_NEON" { @@ -5192,7 +5192,7 @@ if (BYTES_BIG_ENDIAN) (define_insn "neon_vst4qb<mode>" [(set (match_operand:OI 0 "neon_struct_operand" "=Um") (unspec:OI [(match_operand:XI 1 "s_register_operand" "w") - (unspec:VQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ2 [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST4B))] "TARGET_NEON" { @@ -5214,7 +5214,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_four_elem> [(match_operand:OI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VD [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VD_LANE [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST4_LANE))] "TARGET_NEON" { @@ -5242,7 +5242,7 @@ if (BYTES_BIG_ENDIAN) (unspec:<V_four_elem> [(match_operand:XI 1 "s_register_operand" "w") (match_operand:SI 2 "immediate_operand" "i") - (unspec:VMQ [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] + (unspec:VQ_HS [(const_int 0)] UNSPEC_VSTRUCTDUMMY)] UNSPEC_VST4_LANE))] "TARGET_NEON" { diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index bec9a8bb788..9f5bc88ce30 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -9069,6 +9069,8 @@ avr_eval_addr_attrib (rtx x) if (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_IO) { attr = lookup_attribute ("io", DECL_ATTRIBUTES (decl)); + if (!attr || !TREE_VALUE (attr)) + attr = lookup_attribute ("io_low", DECL_ATTRIBUTES (decl)); gcc_assert (attr); } if (!attr || !TREE_VALUE (attr)) diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index fda59fb3c06..71506ecbcd0 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -198,20 +198,7 @@ along with GCC; see the file COPYING3. If not see #undef SUBTARGET_OVERRIDE_OPTIONS #define SUBTARGET_OVERRIDE_OPTIONS \ do { \ - if (TARGET_64BIT && flag_pic != 1) \ - { \ - if (flag_pic > 1) \ - warning (0, \ - "-fPIC ignored for target (all code is position independent)"\ - ); \ - flag_pic = 1; \ - } \ - else if (!TARGET_64BIT && flag_pic) \ - { \ - warning (0, "-f%s ignored for target (all code is position independent)",\ - (flag_pic > 1) ? "PIC" : "pic"); \ - flag_pic = 0; \ - } \ + flag_pic = TARGET_64BIT ? 1 : 0; \ } while (0) /* Define this macro if references to a symbol must be treated diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def index ee31ee34c48..b892f086798 100644 --- a/gcc/config/i386/i386-builtin-types.def +++ b/gcc/config/i386/i386-builtin-types.def @@ -1021,6 +1021,10 @@ DEF_FUNCTION_TYPE (VOID, PINT, QI, V8DI, V8SI, INT) DEF_FUNCTION_TYPE (VOID, PINT, QI, V4DI, V4SI, INT) DEF_FUNCTION_TYPE (VOID, PINT, QI, V2DI, V4SI, INT) DEF_FUNCTION_TYPE (VOID, PLONGLONG, QI, V8DI, V8DI, INT) +DEF_FUNCTION_TYPE (VOID, PFLOAT, HI, V8DI, V16SF, INT) +DEF_FUNCTION_TYPE (VOID, PDOUBLE, QI, V16SI, V8DF, INT) +DEF_FUNCTION_TYPE (VOID, PINT, HI, V8DI, V16SI, INT) +DEF_FUNCTION_TYPE (VOID, PLONGLONG, QI, V16SI, V8DI, INT) DEF_FUNCTION_TYPE (VOID, QI, V8SI, PCINT64, INT, INT) DEF_FUNCTION_TYPE (VOID, PLONGLONG, QI, V4DI, V4DI, INT) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index c69c738caa0..d78f4e7f175 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -30388,6 +30388,10 @@ enum ix86_builtins IX86_BUILTIN_GATHER3SIV16SI, IX86_BUILTIN_GATHER3SIV8DF, IX86_BUILTIN_GATHER3SIV8DI, + IX86_BUILTIN_SCATTERALTSIV8DF, + IX86_BUILTIN_SCATTERALTDIV16SF, + IX86_BUILTIN_SCATTERALTSIV8DI, + IX86_BUILTIN_SCATTERALTDIV16SI, IX86_BUILTIN_SCATTERDIV16SF, IX86_BUILTIN_SCATTERDIV16SI, IX86_BUILTIN_SCATTERDIV8DF, @@ -34204,6 +34208,21 @@ ix86_init_mmx_sse_builtins (void) def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv2di", VOID_FTYPE_PLONGLONG_QI_V2DI_V2DI_INT, IX86_BUILTIN_SCATTERDIV2DI); + def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatteraltsiv8df ", + VOID_FTYPE_PDOUBLE_QI_V16SI_V8DF_INT, + IX86_BUILTIN_SCATTERALTSIV8DF); + + def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatteraltdiv8sf ", + VOID_FTYPE_PFLOAT_HI_V8DI_V16SF_INT, + IX86_BUILTIN_SCATTERALTDIV16SF); + + def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatteraltsiv8di ", + VOID_FTYPE_PLONGLONG_QI_V16SI_V8DI_INT, + IX86_BUILTIN_SCATTERALTSIV8DI); + + def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatteraltdiv8si ", + VOID_FTYPE_PINT_HI_V8DI_V16SI_INT, + IX86_BUILTIN_SCATTERALTDIV16SI); /* AVX512PF */ def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd", @@ -39860,6 +39879,18 @@ rdseed_step: case IX86_BUILTIN_GATHERPFDPD: icode = CODE_FOR_avx512pf_gatherpfv8sidf; goto vec_prefetch_gen; + case IX86_BUILTIN_SCATTERALTSIV8DF: + icode = CODE_FOR_avx512f_scattersiv8df; + goto scatter_gen; + case IX86_BUILTIN_SCATTERALTDIV16SF: + icode = CODE_FOR_avx512f_scatterdiv16sf; + goto scatter_gen; + case IX86_BUILTIN_SCATTERALTSIV8DI: + icode = CODE_FOR_avx512f_scattersiv8di; + goto scatter_gen; + case IX86_BUILTIN_SCATTERALTDIV16SI: + icode = CODE_FOR_avx512f_scatterdiv16si; + goto scatter_gen; case IX86_BUILTIN_GATHERPFDPS: icode = CODE_FOR_avx512pf_gatherpfv16sisf; goto vec_prefetch_gen; @@ -40123,6 +40154,36 @@ rdseed_step: mode3 = insn_data[icode].operand[3].mode; mode4 = insn_data[icode].operand[4].mode; + /* Scatter instruction stores operand op3 to memory with + indices from op2 and scale from op4 under writemask op1. + If index operand op2 has more elements then source operand + op3 one need to use only its low half. And vice versa. */ + switch (fcode) + { + case IX86_BUILTIN_SCATTERALTSIV8DF: + case IX86_BUILTIN_SCATTERALTSIV8DI: + half = gen_reg_rtx (V8SImode); + if (!nonimmediate_operand (op2, V16SImode)) + op2 = copy_to_mode_reg (V16SImode, op2); + emit_insn (gen_vec_extract_lo_v16si (half, op2)); + op2 = half; + break; + case IX86_BUILTIN_SCATTERALTDIV16SF: + case IX86_BUILTIN_SCATTERALTDIV16SI: + half = gen_reg_rtx (mode3); + if (mode3 == V8SFmode) + gen = gen_vec_extract_lo_v16sf; + else + gen = gen_vec_extract_lo_v16si; + if (!nonimmediate_operand (op3, GET_MODE (op3))) + op3 = copy_to_mode_reg (GET_MODE (op3), op3); + emit_insn (gen (half, op3)); + op3 = half; + break; + default: + break; + } + /* Force memory operand only with base register here. But we don't want to do it on memory operand for other builtin functions. */ @@ -41202,6 +41263,62 @@ ix86_vectorize_builtin_gather (const_tree mem_vectype, return ix86_get_builtin (code); } +/* Returns a decl of a function that implements scatter store with + register type VECTYPE and index type INDEX_TYPE and SCALE. + Return NULL_TREE if it is not available. */ + +static tree +ix86_vectorize_builtin_scatter (const_tree vectype, + const_tree index_type, int scale) +{ + bool si; + enum ix86_builtins code; + + if (!TARGET_AVX512F) + return NULL_TREE; + + if ((TREE_CODE (index_type) != INTEGER_TYPE + && !POINTER_TYPE_P (index_type)) + || (TYPE_MODE (index_type) != SImode + && TYPE_MODE (index_type) != DImode)) + return NULL_TREE; + + if (TYPE_PRECISION (index_type) > POINTER_SIZE) + return NULL_TREE; + + /* v*scatter* insn sign extends index to pointer mode. */ + if (TYPE_PRECISION (index_type) < POINTER_SIZE + && TYPE_UNSIGNED (index_type)) + return NULL_TREE; + + /* Scale can be 1, 2, 4 or 8. */ + if (scale <= 0 + || scale > 8 + || (scale & (scale - 1)) != 0) + return NULL_TREE; + + si = TYPE_MODE (index_type) == SImode; + switch (TYPE_MODE (vectype)) + { + case V8DFmode: + code = si ? IX86_BUILTIN_SCATTERALTSIV8DF : IX86_BUILTIN_SCATTERDIV8DF; + break; + case V8DImode: + code = si ? IX86_BUILTIN_SCATTERALTSIV8DI : IX86_BUILTIN_SCATTERDIV8DI; + break; + case V16SFmode: + code = si ? IX86_BUILTIN_SCATTERSIV16SF : IX86_BUILTIN_SCATTERALTDIV16SF; + break; + case V16SImode: + code = si ? IX86_BUILTIN_SCATTERSIV16SI : IX86_BUILTIN_SCATTERALTDIV16SI; + break; + default: + return NULL_TREE; + } + + return ix86_builtins[code]; +} + /* Returns a code for a target-specific builtin that implements reciprocal of the function, or NULL_TREE if not available. */ @@ -52332,6 +52449,9 @@ ix86_operands_ok_for_move_multiple (rtx *operands, bool load, #undef TARGET_VECTORIZE_BUILTIN_GATHER #define TARGET_VECTORIZE_BUILTIN_GATHER ix86_vectorize_builtin_gather +#undef TARGET_VECTORIZE_BUILTIN_SCATTER +#define TARGET_VECTORIZE_BUILTIN_SCATTER ix86_vectorize_builtin_scatter + #undef TARGET_BUILTIN_RECIPROCAL #define TARGET_BUILTIN_RECIPROCAL ix86_builtin_reciprocal diff --git a/gcc/config/i386/intelmic-mkoffload.c b/gcc/config/i386/intelmic-mkoffload.c index ca15868dde1..4a7812c2499 100644 --- a/gcc/config/i386/intelmic-mkoffload.c +++ b/gcc/config/i386/intelmic-mkoffload.c @@ -453,17 +453,18 @@ prepare_target_image (const char *target_compiler, int argc, char **argv) fork_execute (objcopy_argv[0], CONST_CAST (char **, objcopy_argv), false); /* Objcopy has created symbols, containing the input file name with - special characters replaced with '_'. We are going to rename these - new symbols. */ + non-alphanumeric characters replaced by underscores. + We are going to rename these new symbols. */ size_t symbol_name_len = strlen (target_so_filename); char *symbol_name = XALLOCAVEC (char, symbol_name_len + 1); - for (size_t i = 0; i <= symbol_name_len; i++) + for (size_t i = 0; i < symbol_name_len; i++) { char c = target_so_filename[i]; - if ((c == '/') || (c == '.')) + if (!ISALNUM (c)) c = '_'; symbol_name[i] = c; } + symbol_name[symbol_name_len] = '\0'; char *opt_for_objcopy[3]; opt_for_objcopy[0] = XALLOCAVEC (char, sizeof ("_binary__start=") diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index e6853680078..1069d0e85c1 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -102,6 +102,8 @@ nvptx_option_override (void) flag_toplevel_reorder = 1; /* Assumes that it will see only hard registers. */ flag_var_tracking = 0; + write_symbols = NO_DEBUG; + debug_info_level = DINFO_LEVEL_NONE; declared_fndecls_htab = hash_table<tree_hasher>::create_ggc (17); needed_fndecls_htab = hash_table<tree_hasher>::create_ggc (17); @@ -681,29 +683,30 @@ write_func_decl_from_insn (std::stringstream &s, rtx result, rtx pat, s << name; - int nargs = XVECLEN (pat, 0) - 1; - if (nargs > 0) + int arg_end = XVECLEN (pat, 0); + + if (1 < arg_end) { + const char *comma = ""; s << " ("; - for (int i = 0; i < nargs; i++) + for (int i = 1; i < arg_end; i++) { - rtx t = XEXP (XVECEXP (pat, 0, i + 1), 0); + rtx t = XEXP (XVECEXP (pat, 0, i), 0); machine_mode mode = GET_MODE (t); int count = maybe_split_mode (&mode); - while (count-- > 0) + while (count--) { - s << ".param"; + s << comma << ".param"; s << nvptx_ptx_type_from_mode (mode, false); s << " "; if (callprototype) s << "_"; else - s << "%arg" << i; + s << "%arg" << i - 1; if (mode == QImode || mode == HImode) s << "[1]"; - if (i + 1 < nargs || count > 0) - s << ", "; + comma = ", "; } } s << ")"; @@ -775,19 +778,17 @@ nvptx_end_call_args (void) void nvptx_expand_call (rtx retval, rtx address) { - int nargs; + int nargs = 0; rtx callee = XEXP (address, 0); rtx pat, t; rtvec vec; bool external_decl = false; + rtx varargs = NULL_RTX; + tree decl_type = NULL_TREE; - nargs = 0; for (t = cfun->machine->call_args; t; t = XEXP (t, 1)) nargs++; - bool has_varargs = false; - tree decl_type = NULL_TREE; - if (!call_insn_operand (callee, Pmode)) { callee = force_reg (Pmode, callee); @@ -806,6 +807,7 @@ nvptx_expand_call (rtx retval, rtx address) external_decl = true; } } + if (cfun->machine->funtype /* It's possible to construct testcases where we call a variable. See compile/20020129-1.c. stdarg_p will crash so avoid calling it @@ -814,31 +816,18 @@ nvptx_expand_call (rtx retval, rtx address) || TREE_CODE (cfun->machine->funtype) == METHOD_TYPE) && stdarg_p (cfun->machine->funtype)) { - has_varargs = true; - cfun->machine->has_call_with_varargs = true; - } - vec = rtvec_alloc (nargs + 1 + (has_varargs ? 1 : 0)); - pat = gen_rtx_PARALLEL (VOIDmode, vec); - if (has_varargs) - { - rtx this_arg = gen_reg_rtx (Pmode); + varargs = gen_reg_rtx (Pmode); if (Pmode == DImode) - emit_move_insn (this_arg, stack_pointer_rtx); + emit_move_insn (varargs, stack_pointer_rtx); else - emit_move_insn (this_arg, stack_pointer_rtx); - XVECEXP (pat, 0, nargs + 1) = gen_rtx_USE (VOIDmode, this_arg); - } - - /* Construct the call insn, including a USE for each argument pseudo - register. These will be used when printing the insn. */ - int i; - rtx arg; - for (i = 1, arg = cfun->machine->call_args; arg; arg = XEXP (arg, 1), i++) - { - rtx this_arg = XEXP (arg, 0); - XVECEXP (pat, 0, i) = gen_rtx_USE (VOIDmode, this_arg); + emit_move_insn (varargs, stack_pointer_rtx); + cfun->machine->has_call_with_varargs = true; } + vec = rtvec_alloc (nargs + 1 + (varargs ? 1 : 0)); + pat = gen_rtx_PARALLEL (VOIDmode, vec); + int vec_pos = 0; + rtx tmp_retval = retval; t = gen_rtx_CALL (VOIDmode, address, const0_rtx); if (retval != NULL_RTX) @@ -847,7 +836,20 @@ nvptx_expand_call (rtx retval, rtx address) tmp_retval = gen_reg_rtx (GET_MODE (retval)); t = gen_rtx_SET (tmp_retval, t); } - XVECEXP (pat, 0, 0) = t; + XVECEXP (pat, 0, vec_pos++) = t; + + /* Construct the call insn, including a USE for each argument pseudo + register. These will be used when printing the insn. */ + for (rtx arg = cfun->machine->call_args; arg; arg = XEXP (arg, 1)) + { + rtx this_arg = XEXP (arg, 0); + XVECEXP (pat, 0, vec_pos++) = gen_rtx_USE (VOIDmode, this_arg); + } + + if (varargs) + XVECEXP (pat, 0, vec_pos++) = gen_rtx_USE (VOIDmode, varargs); + + gcc_assert (vec_pos = XVECLEN (pat, 0)); /* If this is a libcall, decl_type is NULL. For a call to a non-libcall undeclared function, we'll have an external decl without arg types. @@ -1498,16 +1500,14 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) static int labelno; bool needs_tgt = register_operand (callee, Pmode); rtx pat = PATTERN (insn); - int nargs = XVECLEN (pat, 0) - 1; + int arg_end = XVECLEN (pat, 0); tree decl = NULL_TREE; fprintf (asm_out_file, "\t{\n"); if (result != NULL) - { - fprintf (asm_out_file, "\t\t.param%s %%retval_in;\n", - nvptx_ptx_type_from_mode (arg_promotion (GET_MODE (result)), - false)); - } + fprintf (asm_out_file, "\t\t.param%s %%retval_in;\n", + nvptx_ptx_type_from_mode (arg_promotion (GET_MODE (result)), + false)); /* Ensure we have a ptx declaration in the output if necessary. */ if (GET_CODE (callee) == SYMBOL_REF) @@ -1527,20 +1527,20 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) fputs (s.str().c_str(), asm_out_file); } - for (int i = 0, argno = 0; i < nargs; i++) + for (int i = 1, argno = 0; i < arg_end; i++) { - rtx t = XEXP (XVECEXP (pat, 0, i + 1), 0); + rtx t = XEXP (XVECEXP (pat, 0, i), 0); machine_mode mode = GET_MODE (t); int count = maybe_split_mode (&mode); - while (count-- > 0) + while (count--) fprintf (asm_out_file, "\t\t.param%s %%out_arg%d%s;\n", nvptx_ptx_type_from_mode (mode, false), argno++, mode == QImode || mode == HImode ? "[1]" : ""); } - for (int i = 0, argno = 0; i < nargs; i++) + for (int i = 1, argno = 0; i < arg_end; i++) { - rtx t = XEXP (XVECEXP (pat, 0, i + 1), 0); + rtx t = XEXP (XVECEXP (pat, 0, i), 0); gcc_assert (REG_P (t)); machine_mode mode = GET_MODE (t); int count = maybe_split_mode (&mode); @@ -1552,7 +1552,7 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) else { int n = 0; - while (count-- > 0) + while (count--) fprintf (asm_out_file, "\t\tst.param%s [%%out_arg%d], %%r%d$%d;\n", nvptx_ptx_type_from_mode (mode, false), argno++, REGNO (t), n++); @@ -1572,33 +1572,30 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee) else output_address (callee); - if (nargs > 0 || (decl && DECL_STATIC_CHAIN (decl))) + if (arg_end > 1 || (decl && DECL_STATIC_CHAIN (decl))) { + const char *comma = ""; + fprintf (asm_out_file, ", ("); - int i, argno; - for (i = 0, argno = 0; i < nargs; i++) + for (int i = 1, argno = 0; i < arg_end; i++) { - rtx t = XEXP (XVECEXP (pat, 0, i + 1), 0); + rtx t = XEXP (XVECEXP (pat, 0, i), 0); machine_mode mode = GET_MODE (t); int count = maybe_split_mode (&mode); - while (count-- > 0) + while (count--) { - fprintf (asm_out_file, "%%out_arg%d", argno++); - if (i + 1 < nargs || count > 0) - fprintf (asm_out_file, ", "); + fprintf (asm_out_file, "%s%%out_arg%d", comma, argno++); + comma = ", "; } } if (decl && DECL_STATIC_CHAIN (decl)) - { - if (i > 0) - fprintf (asm_out_file, ", "); - fprintf (asm_out_file, "%s", - reg_names [OUTGOING_STATIC_CHAIN_REGNUM]); - } + fprintf (asm_out_file, "%s%s", comma, + reg_names [OUTGOING_STATIC_CHAIN_REGNUM]); fprintf (asm_out_file, ")"); } + if (needs_tgt) { fprintf (asm_out_file, ", "); @@ -1922,12 +1919,14 @@ nvptx_reorg_subreg (void) || GET_CODE (PATTERN (insn)) == USE || GET_CODE (PATTERN (insn)) == CLOBBER) continue; + qiregs.n_in_use = 0; hiregs.n_in_use = 0; siregs.n_in_use = 0; diregs.n_in_use = 0; extract_insn (insn); enum attr_subregs_ok s_ok = get_attr_subregs_ok (insn); + for (int i = 0; i < recog_data.n_operands; i++) { rtx op = recog_data.operand[i]; @@ -1983,9 +1982,10 @@ nvptx_reorg_subreg (void) } /* PTX-specific reorganization - 1) mark now-unused registers, so function begin doesn't declare + - Compute live registers + - Mark now-unused registers, so function begin doesn't declare unused registers. - 2) replace subregs with suitable sequences. + - Replace subregs with suitable sequences. */ static void @@ -1997,6 +1997,7 @@ nvptx_reorg (void) thread_prologue_and_epilogue_insns (); + /* Compute live regs */ df_clear_flags (DF_LR_RUN_DCE); df_set_flags (DF_NO_INSN_RESCAN | DF_NO_HARD_REGS); df_analyze (); diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md index b857e53bb22..049f34c6fbf 100644 --- a/gcc/config/nvptx/nvptx.md +++ b/gcc/config/nvptx/nvptx.md @@ -197,9 +197,9 @@ (define_predicate "call_operation" (match_code "parallel") { - int i; + int arg_end = XVECLEN (op, 0); - for (i = 1; i < XVECLEN (op, 0); i++) + for (int i = 1; i < arg_end; i++) { rtx elt = XVECEXP (op, 0, i); @@ -783,7 +783,7 @@ [(match_operand:HSDIM 2 "nvptx_register_operand" "R") (match_operand:HSDIM 3 "nvptx_nonmemory_operand" "Ri")]))] "" - "%.\\tsetp%c1 %0,%2,%3;") + "%.\\tsetp%c1\\t%0, %2, %3;") (define_insn "*cmp<mode>" [(set (match_operand:BI 0 "nvptx_register_operand" "=R") @@ -791,7 +791,7 @@ [(match_operand:SDFM 2 "nvptx_register_operand" "R") (match_operand:SDFM 3 "nvptx_nonmemory_operand" "RF")]))] "" - "%.\\tsetp%c1 %0,%2,%3;") + "%.\\tsetp%c1\\t%0, %2, %3;") (define_insn "jump" [(set (pc) @@ -908,7 +908,7 @@ [(match_operand:HSDIM 2 "nvptx_register_operand" "R") (match_operand:HSDIM 3 "nvptx_nonmemory_operand" "Ri")]))] "" - "%.\\tset%t0%c1 %0,%2,%3;") + "%.\\tset%t0%c1\\t%0, %2, %3;") (define_insn "setcc_int<mode>" [(set (match_operand:SI 0 "nvptx_register_operand" "=R") @@ -916,7 +916,7 @@ [(match_operand:SDFM 2 "nvptx_register_operand" "R") (match_operand:SDFM 3 "nvptx_nonmemory_operand" "RF")]))] "" - "%.\\tset%t0%c1 %0,%2,%3;") + "%.\\tset%t0%c1\\t%0, %2, %3;") (define_insn "setcc_float<mode>" [(set (match_operand:SF 0 "nvptx_register_operand" "=R") @@ -924,7 +924,7 @@ [(match_operand:HSDIM 2 "nvptx_register_operand" "R") (match_operand:HSDIM 3 "nvptx_nonmemory_operand" "Ri")]))] "" - "%.\\tset%t0%c1 %0,%2,%3;") + "%.\\tset%t0%c1\\t%0, %2, %3;") (define_insn "setcc_float<mode>" [(set (match_operand:SF 0 "nvptx_register_operand" "=R") @@ -932,7 +932,7 @@ [(match_operand:SDFM 2 "nvptx_register_operand" "R") (match_operand:SDFM 3 "nvptx_nonmemory_operand" "RF")]))] "" - "%.\\tset%t0%c1 %0,%2,%3;") + "%.\\tset%t0%c1\\t%0, %2, %3;") (define_expand "cstorebi4" [(set (match_operand:SI 0 "nvptx_register_operand") @@ -1351,14 +1351,12 @@ (match_operand:SI 7 "const_int_operand")] ;; failure model "" { - emit_insn (gen_atomic_compare_and_swap<mode>_1 (operands[1], operands[2], operands[3], - operands[4], operands[6])); - - rtx tmp = gen_reg_rtx (GET_MODE (operands[0])); - emit_insn (gen_cstore<mode>4 (tmp, - gen_rtx_EQ (SImode, operands[1], operands[3]), - operands[1], operands[3])); - emit_insn (gen_andsi3 (operands[0], tmp, GEN_INT (1))); + emit_insn (gen_atomic_compare_and_swap<mode>_1 + (operands[1], operands[2], operands[3], operands[4], operands[6])); + + rtx cond = gen_reg_rtx (BImode); + emit_move_insn (cond, gen_rtx_EQ (BImode, operands[1], operands[3])); + emit_insn (gen_sel_truesi (operands[0], cond, GEN_INT (1), GEN_INT (0))); DONE; }) diff --git a/gcc/config/rs6000/altivec.md b/gcc/config/rs6000/altivec.md index 4170f38b7db..9cacca49050 100644 --- a/gcc/config/rs6000/altivec.md +++ b/gcc/config/rs6000/altivec.md @@ -1957,6 +1957,16 @@ "vperm %0,%1,%2,%3" [(set_attr "type" "vecperm")]) +(define_insn "altivec_vperm_v8hiv16qi" + [(set (match_operand:V16QI 0 "register_operand" "=v") + (unspec:V16QI [(match_operand:V8HI 1 "register_operand" "v") + (match_operand:V8HI 2 "register_operand" "v") + (match_operand:V16QI 3 "register_operand" "v")] + UNSPEC_VPERM))] + "TARGET_ALTIVEC" + "vperm %0,%1,%2,%3" + [(set_attr "type" "vecperm")]) + (define_expand "altivec_vperm_<mode>_uns" [(set (match_operand:VM 0 "register_operand" "=v") (unspec:VM [(match_operand:VM 1 "register_operand" "v") @@ -3161,6 +3171,33 @@ "<VI_unit>" "") +(define_expand "mulv16qi3" + [(set (match_operand:V16QI 0 "register_operand" "=v") + (mult:V16QI (match_operand:V16QI 1 "register_operand" "v") + (match_operand:V16QI 2 "register_operand" "v")))] + "TARGET_ALTIVEC" + " +{ + rtx even = gen_reg_rtx (V8HImode); + rtx odd = gen_reg_rtx (V8HImode); + rtx mask = gen_reg_rtx (V16QImode); + rtvec v = rtvec_alloc (16); + int i; + + for (i = 0; i < 8; ++i) { + RTVEC_ELT (v, 2 * i) + = gen_rtx_CONST_INT (QImode, BYTES_BIG_ENDIAN ? 2 * i + 1 : 31 - 2 * i); + RTVEC_ELT (v, 2 * i + 1) + = gen_rtx_CONST_INT (QImode, BYTES_BIG_ENDIAN ? 2 * i + 17 : 15 - 2 * i); + } + + emit_insn (gen_vec_initv16qi (mask, gen_rtx_PARALLEL (V16QImode, v))); + emit_insn (gen_altivec_vmulesb (even, operands[1], operands[2])); + emit_insn (gen_altivec_vmulosb (odd, operands[1], operands[2])); + emit_insn (gen_altivec_vperm_v8hiv16qi (operands[0], even, odd, mask)); + DONE; +}") + (define_expand "altivec_negv4sf2" [(use (match_operand:V4SF 0 "register_operand" "")) (use (match_operand:V4SF 1 "register_operand" ""))] diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8107bec8e6e..7278792d0dc 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -18198,8 +18198,21 @@ rs6000_secondary_reload_gpr (rtx reg, rtx mem, rtx scratch, bool store_p) if (GET_CODE (addr) == PRE_MODIFY) { + gcc_assert (REG_P (XEXP (addr, 0)) + && GET_CODE (XEXP (addr, 1)) == PLUS + && XEXP (XEXP (addr, 1), 0) == XEXP (addr, 0)); scratch_or_premodify = XEXP (addr, 0); - gcc_assert (REG_P (scratch_or_premodify)); + if (!HARD_REGISTER_P (scratch_or_premodify)) + /* If we have a pseudo here then reload will have arranged + to have it replaced, but only in the original insn. + Use the replacement here too. */ + scratch_or_premodify = find_replacement (&XEXP (addr, 0)); + + /* RTL emitted by rs6000_secondary_reload_gpr uses RTL + expressions from the original insn, without unsharing them. + Any RTL that points into the original insn will of course + have register replacements applied. That is why we don't + need to look for replacements under the PLUS. */ addr = XEXP (addr, 1); } gcc_assert (GET_CODE (addr) == PLUS || GET_CODE (addr) == LO_SUM); @@ -34930,10 +34943,8 @@ emit_fusion_gpr_load (rtx target, rtx mem) throughout the computation, we can get correct behavior by replacing M with M' as follows: - { M[i+8]+8 : i < 8, M[i+8] in [0,7] U [16,23] - M'[i] = { M[i+8]-8 : i < 8, M[i+8] in [8,15] U [24,31] - { M[i-8]+8 : i >= 8, M[i-8] in [0,7] U [16,23] - { M[i-8]-8 : i >= 8, M[i-8] in [8,15] U [24,31] + M'[i] = { (M[i]+8)%16 : M[i] in [0,15] + { ((M[i]+8)%16)+16 : M[i] in [16,31] This seems promising at first, since we are just replacing one mask with another. But certain masks are preferable to others. If M @@ -34951,7 +34962,11 @@ emit_fusion_gpr_load (rtx target, rtx mem) mask to be produced by an UNSPEC_LVSL, in which case the mask cannot be known at compile time. In such a case we would have to generate several instructions to compute M' as above at run time, - and a cost model is needed again. */ + and a cost model is needed again. + + However, when the mask M for an UNSPEC_VPERM is loaded from the + constant pool, we can replace M with M' as above at no cost + beyond adding a constant pool entry. */ /* This is based on the union-find logic in web.c. web_entry_base is defined in df.h. */ @@ -35003,7 +35018,8 @@ enum special_handling_values { SH_EXTRACT, SH_SPLAT, SH_XXPERMDI, - SH_CONCAT + SH_CONCAT, + SH_VPERM }; /* Union INSN with all insns containing definitions that reach USE. @@ -35138,6 +35154,64 @@ insn_is_swap_p (rtx insn) return 1; } +/* Return TRUE if insn is a swap fed by a load from the constant pool. */ +static bool +const_load_sequence_p (swap_web_entry *insn_entry, rtx insn) +{ + unsigned uid = INSN_UID (insn); + if (!insn_entry[uid].is_swap || insn_entry[uid].is_load) + return false; + + /* Find the unique use in the swap and locate its def. If the def + isn't unique, punt. */ + struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); + df_ref use; + FOR_EACH_INSN_INFO_USE (use, insn_info) + { + struct df_link *def_link = DF_REF_CHAIN (use); + if (!def_link || def_link->next) + return false; + + rtx def_insn = DF_REF_INSN (def_link->ref); + unsigned uid2 = INSN_UID (def_insn); + if (!insn_entry[uid2].is_load || !insn_entry[uid2].is_swap) + return false; + + rtx body = PATTERN (def_insn); + if (GET_CODE (body) != SET + || GET_CODE (SET_SRC (body)) != VEC_SELECT + || GET_CODE (XEXP (SET_SRC (body), 0)) != MEM) + return false; + + rtx mem = XEXP (SET_SRC (body), 0); + rtx base_reg = XEXP (mem, 0); + + df_ref base_use; + insn_info = DF_INSN_INFO_GET (def_insn); + FOR_EACH_INSN_INFO_USE (base_use, insn_info) + { + if (!rtx_equal_p (DF_REF_REG (base_use), base_reg)) + continue; + + struct df_link *base_def_link = DF_REF_CHAIN (base_use); + if (!base_def_link || base_def_link->next) + return false; + + rtx tocrel_insn = DF_REF_INSN (base_def_link->ref); + rtx tocrel_body = PATTERN (tocrel_insn); + rtx base, offset; + if (GET_CODE (tocrel_body) != SET) + return false; + if (!toc_relative_expr_p (SET_SRC (tocrel_body), false)) + return false; + split_const (XVECEXP (tocrel_base, 0, 0), &base, &offset); + if (GET_CODE (base) != SYMBOL_REF || !CONSTANT_POOL_ADDRESS_P (base)) + return false; + } + } + return true; +} + /* Return 1 iff OP is an operand that will not be affected by having vector doublewords swapped in memory. */ static unsigned int @@ -35397,6 +35471,32 @@ insn_is_swappable_p (swap_web_entry *insn_entry, rtx insn, return 1; } + /* An UNSPEC_VPERM is ok if the mask operand is loaded from the + constant pool. */ + if (GET_CODE (body) == SET + && GET_CODE (SET_SRC (body)) == UNSPEC + && XINT (SET_SRC (body), 1) == UNSPEC_VPERM + && XVECLEN (SET_SRC (body), 0) == 3 + && GET_CODE (XVECEXP (SET_SRC (body), 0, 2)) == REG) + { + rtx mask_reg = XVECEXP (SET_SRC (body), 0, 2); + struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); + df_ref use; + FOR_EACH_INSN_INFO_USE (use, insn_info) + if (rtx_equal_p (DF_REF_REG (use), mask_reg)) + { + struct df_link *def_link = DF_REF_CHAIN (use); + /* Punt if multiple definitions for this reg. */ + if (def_link && !def_link->next && + const_load_sequence_p (insn_entry, + DF_REF_INSN (def_link->ref))) + { + *special = SH_VPERM; + return 1; + } + } + } + /* Otherwise check the operands for vector lane violations. */ return rtx_is_swappable_p (body, special); } @@ -35729,6 +35829,105 @@ adjust_concat (rtx_insn *insn) fprintf (dump_file, "Reversing inputs for concat %d\n", INSN_UID (insn)); } +/* Given an UNSPEC_VPERM insn, modify the mask loaded from the + constant pool to reflect swapped doublewords. */ +static void +adjust_vperm (rtx_insn *insn) +{ + /* We previously determined that the UNSPEC_VPERM was fed by a + swap of a swapping load of a TOC-relative constant pool symbol. + Find the MEM in the swapping load and replace it with a MEM for + the adjusted mask constant. */ + rtx set = PATTERN (insn); + rtx mask_reg = XVECEXP (SET_SRC (set), 0, 2); + + /* Find the swap. */ + struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn); + df_ref use; + rtx_insn *swap_insn = 0; + FOR_EACH_INSN_INFO_USE (use, insn_info) + if (rtx_equal_p (DF_REF_REG (use), mask_reg)) + { + struct df_link *def_link = DF_REF_CHAIN (use); + gcc_assert (def_link && !def_link->next); + swap_insn = DF_REF_INSN (def_link->ref); + break; + } + gcc_assert (swap_insn); + + /* Find the load. */ + insn_info = DF_INSN_INFO_GET (swap_insn); + rtx_insn *load_insn = 0; + FOR_EACH_INSN_INFO_USE (use, insn_info) + { + struct df_link *def_link = DF_REF_CHAIN (use); + gcc_assert (def_link && !def_link->next); + load_insn = DF_REF_INSN (def_link->ref); + break; + } + gcc_assert (load_insn); + + /* Find the TOC-relative symbol access. */ + insn_info = DF_INSN_INFO_GET (load_insn); + rtx_insn *tocrel_insn = 0; + FOR_EACH_INSN_INFO_USE (use, insn_info) + { + struct df_link *def_link = DF_REF_CHAIN (use); + gcc_assert (def_link && !def_link->next); + tocrel_insn = DF_REF_INSN (def_link->ref); + break; + } + gcc_assert (tocrel_insn); + + /* Find the embedded CONST_VECTOR. We have to call toc_relative_expr_p + to set tocrel_base; otherwise it would be unnecessary as we've + already established it will return true. */ + rtx base, offset; + if (!toc_relative_expr_p (SET_SRC (PATTERN (tocrel_insn)), false)) + gcc_unreachable (); + split_const (XVECEXP (tocrel_base, 0, 0), &base, &offset); + rtx const_vector = get_pool_constant (base); + gcc_assert (GET_CODE (const_vector) == CONST_VECTOR); + + /* Create an adjusted mask from the initial mask. */ + unsigned int new_mask[16], i, val; + for (i = 0; i < 16; ++i) { + val = INTVAL (XVECEXP (const_vector, 0, i)); + if (val < 16) + new_mask[i] = (val + 8) % 16; + else + new_mask[i] = ((val + 8) % 16) + 16; + } + + /* Create a new CONST_VECTOR and a MEM that references it. */ + rtx vals = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16)); + for (i = 0; i < 16; ++i) + XVECEXP (vals, 0, i) = GEN_INT (new_mask[i]); + rtx new_const_vector = gen_rtx_CONST_VECTOR (V16QImode, XVEC (vals, 0)); + rtx new_mem = force_const_mem (V16QImode, new_const_vector); + /* This gives us a MEM whose base operand is a SYMBOL_REF, which we + can't recognize. Force the SYMBOL_REF into a register. */ + if (!REG_P (XEXP (new_mem, 0))) { + rtx base_reg = force_reg (Pmode, XEXP (new_mem, 0)); + XEXP (new_mem, 0) = base_reg; + /* Move the newly created insn ahead of the load insn. */ + rtx_insn *force_insn = get_last_insn (); + remove_insn (force_insn); + rtx_insn *before_load_insn = PREV_INSN (load_insn); + add_insn_after (force_insn, before_load_insn, BLOCK_FOR_INSN (load_insn)); + df_insn_rescan (before_load_insn); + df_insn_rescan (force_insn); + } + + /* Replace the MEM in the load instruction and rescan it. */ + XEXP (SET_SRC (PATTERN (load_insn)), 0) = new_mem; + INSN_CODE (load_insn) = -1; /* Force re-recognition. */ + df_insn_rescan (load_insn); + + if (dump_file) + fprintf (dump_file, "Adjusting mask for vperm %d\n", INSN_UID (insn)); +} + /* The insn described by INSN_ENTRY[I] can be swapped, but only with special handling. Take care of that here. */ static void @@ -35783,6 +35982,10 @@ handle_special_swappables (swap_web_entry *insn_entry, unsigned i) /* Reverse the order of a concatenation operation. */ adjust_concat (insn); break; + case SH_VPERM: + /* Change the mask loaded from the constant pool for a VPERM. */ + adjust_vperm (insn); + break; } } @@ -35859,6 +36062,8 @@ dump_swap_insn_table (swap_web_entry *insn_entry) fputs ("special:xxpermdi ", dump_file); else if (insn_entry[i].special_handling == SH_CONCAT) fputs ("special:concat ", dump_file); + else if (insn_entry[i].special_handling == SH_VPERM) + fputs ("special:vperm ", dump_file); } if (insn_entry[i].web_not_optimizable) fputs ("unoptimizable ", dump_file); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index cbfc80073c9..d276ab21ab3 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -2265,6 +2265,11 @@ s390_contiguous_bitmask_vector_p (rtx op, int *start, int *end) return false; size = GET_MODE_UNIT_BITSIZE (GET_MODE (op)); + + /* We cannot deal with V1TI/V1TF. This would require a vgmq. */ + if (size > 64) + return false; + mask = UINTVAL (elt); if (s390_contiguous_bitmask_p (mask, size, start, end != NULL ? &length : NULL)) @@ -7703,11 +7708,12 @@ replace_ltrel_base (rtx *x) /* We keep a list of constants which we have to add to internal constant tables in the middle of large functions. */ -#define NR_C_MODES 31 +#define NR_C_MODES 32 machine_mode constant_modes[NR_C_MODES] = { TFmode, TImode, TDmode, - V16QImode, V8HImode, V4SImode, V2DImode, V4SFmode, V2DFmode, V1TFmode, + V16QImode, V8HImode, V4SImode, V2DImode, V1TImode, + V4SFmode, V2DFmode, V1TFmode, DFmode, DImode, DDmode, V8QImode, V4HImode, V2SImode, V1DImode, V2SFmode, V1DFmode, SFmode, SImode, SDmode, diff --git a/gcc/config/s390/vx-builtins.md b/gcc/config/s390/vx-builtins.md index 35ada1371ff..7e20d2b6986 100644 --- a/gcc/config/s390/vx-builtins.md +++ b/gcc/config/s390/vx-builtins.md @@ -870,11 +870,11 @@ ; vec_mladd -> vec_vmal ; vmalb, vmalh, vmalf, vmalg (define_insn "vec_vmal<mode>" - [(set (match_operand:VI_HW 0 "register_operand" "=v") - (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v") - (match_operand:VI_HW 2 "register_operand" "v") - (match_operand:VI_HW 3 "register_operand" "v")] - UNSPEC_VEC_VMAL))] + [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") + (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") + (match_operand:VI_HW_QHS 2 "register_operand" "v") + (match_operand:VI_HW_QHS 3 "register_operand" "v")] + UNSPEC_VEC_VMAL))] "TARGET_VX" "vmal<bhfgq><w>\t%v0,%v1,%v2,%v3" [(set_attr "op_type" "VRR")]) @@ -883,22 +883,22 @@ ; vmahb; vmahh, vmahf, vmahg (define_insn "vec_vmah<mode>" - [(set (match_operand:VI_HW 0 "register_operand" "=v") - (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v") - (match_operand:VI_HW 2 "register_operand" "v") - (match_operand:VI_HW 3 "register_operand" "v")] - UNSPEC_VEC_VMAH))] + [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") + (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") + (match_operand:VI_HW_QHS 2 "register_operand" "v") + (match_operand:VI_HW_QHS 3 "register_operand" "v")] + UNSPEC_VEC_VMAH))] "TARGET_VX" "vmah<bhfgq>\t%v0,%v1,%v2,%v3" [(set_attr "op_type" "VRR")]) ; vmalhb; vmalhh, vmalhf, vmalhg (define_insn "vec_vmalh<mode>" - [(set (match_operand:VI_HW 0 "register_operand" "=v") - (unspec:VI_HW [(match_operand:VI_HW 1 "register_operand" "v") - (match_operand:VI_HW 2 "register_operand" "v") - (match_operand:VI_HW 3 "register_operand" "v")] - UNSPEC_VEC_VMALH))] + [(set (match_operand:VI_HW_QHS 0 "register_operand" "=v") + (unspec:VI_HW_QHS [(match_operand:VI_HW_QHS 1 "register_operand" "v") + (match_operand:VI_HW_QHS 2 "register_operand" "v") + (match_operand:VI_HW_QHS 3 "register_operand" "v")] + UNSPEC_VEC_VMALH))] "TARGET_VX" "vmalh<bhfgq>\t%v0,%v1,%v2,%v3" [(set_attr "op_type" "VRR")]) diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 1442b7fc790..25149a60ff7 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -14016,6 +14016,9 @@ sh_extending_set_of_reg::use_as_extended_reg (rtx_insn* use_at_insn) const else { rtx extension_dst = XEXP (set_rtx, 0); + if (GET_MODE (extension_dst) != SImode) + extension_dst = simplify_gen_subreg (SImode, extension_dst, + GET_MODE (extension_dst), 0); if (modified_between_p (extension_dst, insn, use_at_insn)) { if (dump_file) diff --git a/gcc/configure b/gcc/configure index 0d313831aac..846c996342f 100755 --- a/gcc/configure +++ b/gcc/configure @@ -10926,7 +10926,7 @@ _ACEOF for ac_func in getenv atol atoll asprintf sbrk abort atof getcwd getwd \ madvise stpcpy strnlen strsignal strverscmp \ - strtol strtoul strtoll strtoull \ + strtol strtoul strtoll strtoull setenv unsetenv \ errno snprintf vsnprintf vasprintf malloc realloc calloc \ free getopt clock getpagesize ffs clearerr_unlocked feof_unlocked ferror_unlocked fflush_unlocked fgetc_unlocked fgets_unlocked fileno_unlocked fprintf_unlocked fputc_unlocked fputs_unlocked fread_unlocked fwrite_unlocked getchar_unlocked getc_unlocked putchar_unlocked putc_unlocked do @@ -28625,6 +28625,29 @@ rm -f core conftest.err conftest.$ac_objext \ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_options_set_schedule_serialize_sccs" >&5 $as_echo "$ac_has_isl_options_set_schedule_serialize_sccs" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking Checking for isl_ctx_get_max_operations" >&5 +$as_echo_n "checking Checking for isl_ctx_get_max_operations... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <isl/ctx.h> +int +main () +{ +isl_ctx_get_max_operations (isl_ctx_alloc ()); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + ac_has_isl_ctx_get_max_operations=yes +else + ac_has_isl_ctx_get_max_operations=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_isl_ctx_get_max_operations" >&5 +$as_echo "$ac_has_isl_ctx_get_max_operations" >&6; } + LIBS="$saved_LIBS" CXXFLAGS="$saved_CXXFLAGS" @@ -28639,6 +28662,11 @@ $as_echo "#define HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE 1" >>confdefs.h $as_echo "#define HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS 1" >>confdefs.h fi + if test x"$ac_has_isl_ctx_get_max_operations" = x"yes"; then + +$as_echo "#define HAVE_ISL_CTX_MAX_OPERATIONS 1" >>confdefs.h + + fi fi # Check for plugin support diff --git a/gcc/configure.ac b/gcc/configure.ac index 846651d01f9..34c43d54228 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -1247,7 +1247,7 @@ AC_CHECK_DECLS([basename(const char*), strstr(const char*,const char*)], , ,[ gcc_AC_CHECK_DECLS(getenv atol atoll asprintf sbrk abort atof getcwd getwd \ madvise stpcpy strnlen strsignal strverscmp \ - strtol strtoul strtoll strtoull \ + strtol strtoul strtoll strtoull setenv unsetenv \ errno snprintf vsnprintf vasprintf malloc realloc calloc \ free getopt clock getpagesize ffs gcc_UNLOCKED_FUNCS, , ,[ #include "ansidecl.h" @@ -5790,6 +5790,13 @@ if test "x${ISLLIBS}" != "x" ; then [ac_has_isl_options_set_schedule_serialize_sccs=no]) AC_MSG_RESULT($ac_has_isl_options_set_schedule_serialize_sccs) + AC_MSG_CHECKING([Checking for isl_ctx_get_max_operations]) + AC_TRY_LINK([#include <isl/ctx.h>], + [isl_ctx_get_max_operations (isl_ctx_alloc ());], + [ac_has_isl_ctx_get_max_operations=yes], + [ac_has_isl_ctx_get_max_operations=no]) + AC_MSG_RESULT($ac_has_isl_ctx_get_max_operations) + LIBS="$saved_LIBS" CXXFLAGS="$saved_CXXFLAGS" @@ -5802,6 +5809,10 @@ if test "x${ISLLIBS}" != "x" ; then AC_DEFINE(HAVE_ISL_OPTIONS_SET_SCHEDULE_SERIALIZE_SCCS, 1, [Define if isl_options_set_schedule_serialize_sccs exists.]) fi + if test x"$ac_has_isl_ctx_get_max_operations" = x"yes"; then + AC_DEFINE(HAVE_ISL_CTX_MAX_OPERATIONS, 1, + [Define if isl_ctx_get_max_operations exists.]) + fi fi GCC_ENABLE_PLUGINS diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 477bb209388..a9952fcae75 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,69 @@ +2015-09-10 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67318 + * parser.c (cp_parser_parameter_declaration): Consume the ellipsis + and set template_parameter_pack_p also when the type is null. + +2015-09-09 Mark Wielaard <mjw@redhat.com> + + * typeck.c (cp_build_binary_op): Check and warn when nonnull arg + parm against NULL. + +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/67522 + * semantics.c (handle_omp_array_sections_1): Only run + type_dependent_expression_p on VAR_DECL/PARM_DECLs. + (finish_omp_clauses) <case OMP_CLAUSE_LINEAR>: Likewise. + Don't adjust OMP_CLAUSE_LINEAR_STEP if OMP_CLAUSE_DECL + is not a VAR_DECL/PARM_DECL. + + PR c++/67511 + * semantics.c (handle_omp_for_class_iterator): Don't wrap + error_mark_node into a NOP_EXPR to void_type_node. + +2015-09-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53184 + * decl2.c (constrain_class_visibility): Use Wsubobject-linkage. + +2015-09-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/67504 + * parser.c (cp_parser_omp_clause_collapse): Test tree_fits_shwi_p + before INTEGRAL_TYPE_P test. + +2015-09-08 Jason Merrill <jason@redhat.com> + + PR c++/67041 + * pt.c (tsubst_copy_and_build): Handle variables like functions. + +2015-09-08 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67369 + * pt.c (tsubst_copy, [case FUNCTION_DECL]): Do not call tsubst + if the first argument isn't a template. + +2015-09-03 Martin Sebor <msebor@redhat.com> + + PR c/66516 + * cp-tree.h (mark_rvalue_use, decay_conversion): Add new + argument(s). + * expr.c (mark_rvalue_use): Use new argument. + * call.c (build_addr_func): Call decay_conversion with new + argument. + * pt.c (convert_template_argument): Call reject_gcc_builtin. + * typeck.c (decay_conversion): Use new argument. + (c_decl_implicit): Define. + +2015-09-02 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR middle-end/60586 + * cp-gimplify.c (cilk_cp_gimplify_call_params_in_spawned_fn): New + function. + (cp_gimplify_expr): Added a call to the function + cilk_cp_gimplify_call_params_in_spawned_fn. + 2015-09-01 Paolo Carlini <paolo.carlini@oracle.com> PR c++/61753 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 909ac990189..bf9f68fb638 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -289,7 +289,7 @@ build_addr_func (tree function, tsubst_flags_t complain) function = build_address (function); } else - function = decay_conversion (function, complain); + function = decay_conversion (function, complain, /*reject_builtin=*/false); return function; } diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index c36d3399133..5ab060431a3 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -95,6 +95,25 @@ finish_bc_block (tree *block, enum bc_t bc, tree label) DECL_CHAIN (label) = NULL_TREE; } +/* This function is a wrapper for cilk_gimplify_call_params_in_spawned_fn. + *EXPR_P can be a CALL_EXPR, INIT_EXPR, MODIFY_EXPR, AGGR_INIT_EXPR or + TARGET_EXPR. *PRE_P and *POST_P are gimple sequences from the caller + of gimplify_cilk_spawn. */ + +static void +cilk_cp_gimplify_call_params_in_spawned_fn (tree *expr_p, gimple_seq *pre_p, + gimple_seq *post_p) +{ + int ii = 0; + + cilk_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + if (TREE_CODE (*expr_p) == AGGR_INIT_EXPR) + for (ii = 0; ii < aggr_init_expr_nargs (*expr_p); ii++) + gimplify_expr (&AGGR_INIT_EXPR_ARG (*expr_p, ii), pre_p, post_p, + is_gimple_reg, fb_rvalue); +} + + /* Get the LABEL_EXPR to represent a break or continue statement in the current block scope. BC indicates which. */ @@ -603,7 +622,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) if (fn_contains_cilk_spawn_p (cfun) && cilk_detect_spawn_and_unwrap (expr_p) && !seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + { + cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } cp_gimplify_init_expr (expr_p); if (TREE_CODE (*expr_p) != INIT_EXPR) return GS_OK; @@ -614,8 +636,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) if (fn_contains_cilk_spawn_p (cfun) && cilk_detect_spawn_and_unwrap (expr_p) && !seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); - + { + cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } /* If the back end isn't clever enough to know that the lhs and rhs types are the same, add an explicit conversion. */ tree op0 = TREE_OPERAND (*expr_p, 0); @@ -715,14 +739,18 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) /* If errors are seen, then just process it as a CALL_EXPR. */ if (!seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); - + { + cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } case CALL_EXPR: if (fn_contains_cilk_spawn_p (cfun) && cilk_detect_spawn_and_unwrap (expr_p) && !seen_error ()) - return (enum gimplify_status) gimplify_cilk_spawn (expr_p); - + { + cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p); + return (enum gimplify_status) gimplify_cilk_spawn (expr_p); + } /* DR 1030 says that we need to evaluate the elements of an initializer-list in forward order even when it's used as arguments to a constructor. So if the target wants to evaluate them in reverse diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 529eeeca9c0..6bd0b1efcff 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5788,7 +5788,9 @@ extern tree create_try_catch_expr (tree, tree); /* in expr.c */ extern tree cplus_expand_constant (tree); -extern tree mark_rvalue_use (tree); +extern tree mark_rvalue_use (tree, + location_t = UNKNOWN_LOCATION, + bool = true); extern tree mark_lvalue_use (tree); extern tree mark_type_use (tree); extern void mark_exp_read (tree); @@ -6462,7 +6464,9 @@ extern tree cxx_alignas_expr (tree); extern tree cxx_sizeof_nowarn (tree); extern tree is_bitfield_expr_with_lowered_type (const_tree); extern tree unlowered_expr_type (const_tree); -extern tree decay_conversion (tree, tsubst_flags_t); +extern tree decay_conversion (tree, + tsubst_flags_t, + bool = true); extern tree build_class_member_access_expr (tree, tree, tree, bool, tsubst_flags_t); extern tree finish_class_member_access_expr (tree, tree, bool, diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 74ba380c44d..6c1f0842331 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2564,10 +2564,25 @@ constrain_class_visibility (tree type) if (subvis == VISIBILITY_ANON) { - if (!in_main_input_context ()) - warning (0, "\ + if (!in_main_input_context()) + { + tree nlt = no_linkage_check (ftype, /*relaxed_p=*/false); + if (nlt) + { + if (same_type_p (TREE_TYPE (t), nlt)) + warning (OPT_Wsubobject_linkage, "\ +%qT has a field %qD whose type has no linkage", + type, t); + else + warning (OPT_Wsubobject_linkage, "\ +%qT has a field %qD whose type depends on the type %qT which has no linkage", + type, t, nlt); + } + else + warning (OPT_Wsubobject_linkage, "\ %qT has a field %qD whose type uses the anonymous namespace", - type, t); + type, t); + } } else if (MAYBE_CLASS_TYPE_P (ftype) && vis < VISIBILITY_HIDDEN @@ -2585,9 +2600,24 @@ constrain_class_visibility (tree type) if (subvis == VISIBILITY_ANON) { if (!in_main_input_context()) - warning (0, "\ + { + tree nlt = no_linkage_check (TREE_TYPE (t), /*relaxed_p=*/false); + if (nlt) + { + if (same_type_p (TREE_TYPE (t), nlt)) + warning (OPT_Wsubobject_linkage, "\ +%qT has a base %qT whose type has no linkage", + type, TREE_TYPE (t)); + else + warning (OPT_Wsubobject_linkage, "\ +%qT has a base %qT whose type depends on the type %qT which has no linkage", + type, TREE_TYPE (t), nlt); + } + else + warning (OPT_Wsubobject_linkage, "\ %qT has a base %qT whose type uses the anonymous namespace", - type, TREE_TYPE (t)); + type, TREE_TYPE (t)); + } } else if (vis < VISIBILITY_HIDDEN && subvis >= VISIBILITY_HIDDEN) diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 6d2d658c7fa..71dec3da033 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -91,18 +91,24 @@ cplus_expand_constant (tree cst) return cst; } -/* Called whenever an expression is used - in a rvalue context. */ - +/* Called whenever the expression EXPR is used in an rvalue context. + When REJECT_BUILTIN is true the expression is checked to make sure + it doesn't make it possible to obtain the address of a GCC built-in + function with no library fallback (or any of its bits, such as in + a conversion to bool). */ tree -mark_rvalue_use (tree expr) +mark_rvalue_use (tree expr, + location_t loc /* = UNKNOWN_LOCATION */, + bool reject_builtin /* = true */) { + if (reject_builtin && reject_gcc_builtin (expr, loc)) + return error_mark_node; + mark_exp_read (expr); return expr; } -/* Called whenever an expression is used - in a lvalue context. */ +/* Called whenever an expression is used in an lvalue context. */ tree mark_lvalue_use (tree expr) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index a0b249bbf5b..2e8e34eaf5e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -19613,11 +19613,12 @@ cp_parser_parameter_declaration (cp_parser *parser, } } - /* If the next token is an ellipsis, and we have not seen a - declarator name, and the type of the declarator contains parameter - packs but it is not a TYPE_PACK_EXPANSION, then we actually have - a parameter pack expansion expression. Otherwise, leave the - ellipsis for a C-style variadic function. */ + /* If the next token is an ellipsis, and we have not seen a declarator + name, and if either the type of the declarator contains parameter + packs but it is not a TYPE_PACK_EXPANSION or is null (this happens + for, eg, abbreviated integral type names), then we actually have a + parameter pack expansion expression. Otherwise, leave the ellipsis + for a C-style variadic function. */ token = cp_lexer_peek_token (parser->lexer); if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS)) { @@ -19626,11 +19627,12 @@ cp_parser_parameter_declaration (cp_parser *parser, if (type && DECL_P (type)) type = TREE_TYPE (type); - if (type - && TREE_CODE (type) != TYPE_PACK_EXPANSION - && declarator_can_be_parameter_pack (declarator) - && (template_parm_p || uses_parameter_packs (type))) - { + if (((type + && TREE_CODE (type) != TYPE_PACK_EXPANSION + && (template_parm_p || uses_parameter_packs (type))) + || (!type && template_parm_p)) + && declarator_can_be_parameter_pack (declarator)) + { /* Consume the `...'. */ cp_lexer_consume_token (parser->lexer); maybe_warn_variadic_templates (); @@ -29228,8 +29230,8 @@ cp_parser_omp_clause_collapse (cp_parser *parser, tree list, location_t location if (num == error_mark_node) return list; num = fold_non_dependent_expr (num); - if (!INTEGRAL_TYPE_P (TREE_TYPE (num)) - || !tree_fits_shwi_p (num) + if (!tree_fits_shwi_p (num) + || !INTEGRAL_TYPE_P (TREE_TYPE (num)) || (n = tree_to_shwi (num)) <= 0 || (int) n != n) { diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index fb7b9d21056..05e6d83a396 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7199,6 +7199,18 @@ convert_template_argument (tree parm, else if (val == error_mark_node && (complain & tf_error)) error ("could not convert template argument %qE to %qT", orig_arg, t); + if (INDIRECT_REF_P (val)) + { + /* Reject template arguments that are references to built-in + functions with no library fallbacks. */ + const_tree inner = TREE_OPERAND (val, 0); + if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE + && TREE_CODE (TREE_TYPE (TREE_TYPE (inner))) == FUNCTION_TYPE + && TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE + && reject_gcc_builtin (TREE_OPERAND (inner, 0))) + return error_mark_node; + } + if (TREE_CODE (val) == SCOPE_REF) { /* Strip typedefs from the SCOPE_REF. */ @@ -13587,8 +13599,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) if (r) { /* Make sure that the one we found is the one we want. */ - tree ctx = tsubst (DECL_CONTEXT (t), args, - complain, in_decl); + tree ctx = DECL_CONTEXT (t); + if (DECL_LANG_SPECIFIC (ctx) && DECL_TEMPLATE_INFO (ctx)) + ctx = tsubst (ctx, args, complain, in_decl); if (ctx != DECL_CONTEXT (r)) r = NULL_TREE; } @@ -16308,15 +16321,14 @@ tsubst_copy_and_build (tree t, LAMBDA_EXPR_MUTABLE_P (r) = LAMBDA_EXPR_MUTABLE_P (t); LAMBDA_EXPR_DISCRIMINATOR (r) = (LAMBDA_EXPR_DISCRIMINATOR (t)); - /* For a function scope, we want to use tsubst so that we don't - complain about referring to an auto function before its return - type has been deduced. Otherwise, we want to use tsubst_copy so - that we look up the existing field/parameter/variable rather - than build a new one. */ tree scope = LAMBDA_EXPR_EXTRA_SCOPE (t); - if (scope && TREE_CODE (scope) == FUNCTION_DECL) + if (!scope) + /* No substitution needed. */; + else if (VAR_OR_FUNCTION_DECL_P (scope)) + /* For a function or variable scope, we want to use tsubst so that we + don't complain about referring to an auto before deduction. */ scope = tsubst (scope, args, complain, in_decl); - else if (scope && TREE_CODE (scope) == PARM_DECL) + else if (TREE_CODE (scope) == PARM_DECL) { /* Look up the parameter we want directly, as tsubst_copy doesn't do what we need. */ @@ -16329,8 +16341,12 @@ tsubst_copy_and_build (tree t, if (DECL_CONTEXT (scope) == NULL_TREE) DECL_CONTEXT (scope) = fn; } - else + else if (TREE_CODE (scope) == FIELD_DECL) + /* For a field, use tsubst_copy so that we look up the existing field + rather than build a new one. */ scope = RECUR (scope); + else + gcc_unreachable (); LAMBDA_EXPR_EXTRA_SCOPE (r) = scope; LAMBDA_EXPR_RETURN_TYPE (r) = tsubst (LAMBDA_EXPR_RETURN_TYPE (t), args, complain, in_decl); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 7bbae06f717..618b54ecba2 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4294,8 +4294,6 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, { if (error_operand_p (t)) return error_mark_node; - if (type_dependent_expression_p (t)) - return NULL_TREE; if (!VAR_P (t) && TREE_CODE (t) != PARM_DECL) { if (processing_template_decl) @@ -4318,6 +4316,8 @@ handle_omp_array_sections_1 (tree c, tree t, vec<tree> &types, omp_clause_code_name[OMP_CLAUSE_CODE (c)]); return error_mark_node; } + if (type_dependent_expression_p (t)) + return NULL_TREE; t = convert_from_reference (t); return t; } @@ -5332,7 +5332,8 @@ finish_omp_clauses (tree clauses) goto check_dup_generic; case OMP_CLAUSE_LINEAR: t = OMP_CLAUSE_DECL (c); - if (!type_dependent_expression_p (t) + if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL) + && !type_dependent_expression_p (t) && !INTEGRAL_TYPE_P (TREE_TYPE (t)) && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE) { @@ -5359,7 +5360,9 @@ finish_omp_clauses (tree clauses) else { t = mark_rvalue_use (t); - if (!processing_template_decl) + if (!processing_template_decl + && (VAR_P (OMP_CLAUSE_DECL (c)) + || TREE_CODE (OMP_CLAUSE_DECL (c)) == PARM_DECL)) { if (TREE_CODE (OMP_CLAUSE_DECL (c)) == PARM_DECL) t = maybe_constant_value (t); @@ -6453,7 +6456,8 @@ handle_omp_for_class_iterator (int i, location_t locus, tree declv, tree initv, iter_init = build_x_modify_expr (elocus, iter, PLUS_EXPR, iter_init, tf_warning_or_error); - iter_init = build1 (NOP_EXPR, void_type_node, iter_init); + if (iter_init != error_mark_node) + iter_init = build1 (NOP_EXPR, void_type_node, iter_init); finish_expr_stmt (iter_init); finish_expr_stmt (build_x_modify_expr (elocus, last, NOP_EXPR, decl, diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 83fd34ca80a..482e42c819b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1911,7 +1911,9 @@ unlowered_expr_type (const_tree exp) that the return value is no longer an lvalue. */ tree -decay_conversion (tree exp, tsubst_flags_t complain) +decay_conversion (tree exp, + tsubst_flags_t complain, + bool reject_builtin /* = true */) { tree type; enum tree_code code; @@ -1921,7 +1923,7 @@ decay_conversion (tree exp, tsubst_flags_t complain) if (type == error_mark_node) return error_mark_node; - exp = mark_rvalue_use (exp); + exp = mark_rvalue_use (exp, loc, reject_builtin); exp = resolve_nondeduced_context (exp); if (type_unknown_p (exp)) @@ -4436,6 +4438,11 @@ cp_build_binary_op (location_t location, || (code0 == POINTER_TYPE && TYPE_PTR_P (type1) && integer_zerop (op1))) { + if (warn_nonnull + && TREE_CODE (op0) == PARM_DECL && nonnull_arg_p (op0)) + warning_at (location, OPT_Wnonnull, + "nonnull argument %qD compared to NULL", op0); + if (TYPE_PTR_P (type1)) result_type = composite_pointer_type (type0, type1, op0, op1, CPO_COMPARISON, complain); @@ -4475,6 +4482,11 @@ cp_build_binary_op (location_t location, || (code1 == POINTER_TYPE && TYPE_PTR_P (type0) && integer_zerop (op0))) { + if (warn_nonnull + && TREE_CODE (op1) == PARM_DECL && nonnull_arg_p (op1)) + warning_at (location, OPT_Wnonnull, + "nonnull argument %qD compared to NULL", op1); + if (TYPE_PTR_P (type0)) result_type = composite_pointer_type (type0, type1, op0, op1, CPO_COMPARISON, complain); @@ -9397,3 +9409,12 @@ check_literal_operator_args (const_tree decl, return true; } } + +/* Always returns false since unlike C90, C++ has no concept of implicit + function declarations. */ + +bool +c_decl_implicit (const_tree) +{ + return false; +} diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index dba8b4382b2..23e6a76b8a8 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -10316,14 +10316,22 @@ recommend general use of these functions. The remaining functions are provided for optimization purposes. +With the exception of built-ins that have library equivalents such as +the standard C library functions discussed below, or that expand to +library calls, GCC built-in functions are always expanded inline and +thus do not have corresponding entry points and their address cannot +be obtained. Attempting to use them in an expression other than +a function call results in a compile-time error. + @opindex fno-builtin GCC includes built-in versions of many of the functions in the standard -C library. The versions prefixed with @code{__builtin_} are always -treated as having the same meaning as the C library function even if you -specify the @option{-fno-builtin} option. (@pxref{C Dialect Options}) -Many of these functions are only optimized in certain cases; if they are -not optimized in a particular case, a call to the library function is -emitted. +C library. These functions come in two forms: one whose names start with +the @code{__builtin_} prefix, and the other without. Both forms have the +same type (including prototype), the same address (when their address is +taken), and the same meaning as the C library functions even if you specify +the @option{-fno-builtin} option @pxref{C Dialect Options}). Many of these +functions are only optimized in certain cases; if they are not optimized in +a particular case, a call to the library function is emitted. @opindex ansi @opindex std diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 24e7eed1380..c18dbdd9a74 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -565,7 +565,10 @@ components of the binutils you intend to build alongside the compiler @file{opcodes}, @dots{}) to the directory containing the GCC sources. Likewise the GMP, MPFR and MPC libraries can be automatically built -together with GCC. Unpack the GMP, MPFR and/or MPC source +together with GCC. You may simply run the +./contrib/download_prerequisites script in the GCC source directory +to set up everything. +Otherwise unpack the GMP, MPFR and/or MPC source distributions in the directory containing the GCC sources and rename their directories to @file{gmp}, @file{mpfr} and @file{mpc}, respectively (or use symbolic links with the same name). diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 7726368da60..25775cf9305 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -282,7 +282,7 @@ Objective-C and Objective-C++ Dialects}. -Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol --Wmissing-format-attribute @gol +-Wmissing-format-attribute -Wsubobject-linkage @gol -Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol -Wtype-limits -Wundef @gol @@ -3724,6 +3724,9 @@ formats that may yield only a two-digit year. Warn about passing a null pointer for arguments marked as requiring a non-null value by the @code{nonnull} function attribute. +Also warns when comparing an argument marked with the @code{nonnull} +function attribute against null inside the function. + @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It can be disabled with the @option{-Wno-nonnull} option. @@ -4927,6 +4930,13 @@ types. @option{-Wconversion-null} is enabled by default. Warn when a literal '0' is used as null pointer constant. This can be useful to facilitate the conversion to @code{nullptr} in C++11. +@item -Wsubobject-linkage @r{(C++ and Objective-C++ only)} +@opindex Wsubobject-linkage +@opindex Wno-subobject-linkage +Warn if a class type has a base or a field whose type uses the anonymous +namespace or depends on a type with no linkage. This warning is +enabled by default. + @item -Wdate-time @opindex Wdate-time @opindex Wno-date-time @@ -11006,6 +11016,10 @@ path. The default is 10. Maximum number of new jump thread paths to create for a finite state automaton. The default is 50. +@item parloops-chunk-size +Chunk size of omp schedule for loops parallelized by parloops. The default +is 0. + @end table @end table @@ -23697,6 +23711,11 @@ option is used to control the temporary stack reuse optimization. @opindex ftrapv This option generates traps for signed overflow on addition, subtraction, multiplication operations. +The options @option{-ftrapv} and @option{-fwrapv} override each other, so using +@option{-ftrapv} @option{-fwrapv} on the command-line results in +@option{-fwrapv} being effective. Note that only active options override, so +using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line +results in @option{-ftrapv} being effective. @item -fwrapv @opindex fwrapv @@ -23705,6 +23724,11 @@ overflow of addition, subtraction and multiplication wraps around using twos-complement representation. This flag enables some optimizations and disables others. This option is enabled by default for the Java front end, as required by the Java language specification. +The options @option{-ftrapv} and @option{-fwrapv} override each other, so using +@option{-ftrapv} @option{-fwrapv} on the command-line results in +@option{-fwrapv} being effective. Note that only active options override, so +using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line +results in @option{-ftrapv} being effective. @item -fexceptions @opindex fexceptions diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 7aa9c9dfa03..5dc7c81bdda 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1549,7 +1549,12 @@ options. Some multilibs may be incompatible with these options. @item arm_neon_fp16_ok @anchor{arm_neon_fp16_ok} ARM Target supports @code{-mfpu=neon-fp16 -mfloat-abi=softfp} or compatible -options. Some multilibs may be incompatible with these options. +options, including @code{-mfp16-format=ieee} if necessary to obtain the +@code{__fp16} type. Some multilibs may be incompatible with these options. + +@item arm_neon_fp16_hw +Test system supports executing Neon half-precision float instructions. +(Implies previous.) @item arm_thumb1_ok ARM target generates Thumb-1 code for @code{-mthumb}. @@ -2035,7 +2040,7 @@ keyword}. @item arm_neon_fp16 NEON and half-precision floating point support. Only ARM targets support this feature, and only then in certain modes; see -the @ref{arm_neon_ok,,arm_neon_fp16_ok effective target keyword}. +the @ref{arm_neon_fp16_ok,,arm_neon_fp16_ok effective target keyword}. @item arm_vfp3 arm vfp3 floating point support; see diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f5a1f84793e..d548d96b234 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5720,6 +5720,14 @@ The default is @code{NULL_TREE} which means to not vectorize gather loads. @end deftypefn +@deftypefn {Target Hook} tree TARGET_VECTORIZE_BUILTIN_SCATTER (const_tree @var{vectype}, const_tree @var{index_type}, int @var{scale}) +Target builtin that implements vector scatter operation. @var{vectype} +is the vector type of the store and @var{index_type} is scalar type of +the index, scaled by @var{scale}. +The default is @code{NULL_TREE} which means to not vectorize scatter +stores. +@end deftypefn + @deftypefn {Target Hook} int TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN (struct cgraph_node *@var{}, struct cgraph_simd_clone *@var{}, @var{tree}, @var{int}) This hook should set @var{vecsize_mangle}, @var{vecsize_int}, @var{vecsize_float} fields in @var{simd_clone} structure pointed by @var{clone_info} argument and also diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 9d5ac0a10e4..9bef4a59bed 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4239,6 +4239,8 @@ address; but often a machine-dependent strategy can generate better code. @hook TARGET_VECTORIZE_BUILTIN_GATHER +@hook TARGET_VECTORIZE_BUILTIN_SCATTER + @hook TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN @hook TARGET_SIMD_CLONE_ADJUST diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d9d3063be1d..b6ab869e0d1 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -25127,6 +25127,62 @@ optimize_location_lists (dw_die_ref die) optimize_location_lists_1 (die, &htab); } +/* Traverse the limbo die list, and add parent/child links. The only + dies without parents that should be here are concrete instances of + inline functions, and the comp_unit_die. We can ignore the comp_unit_die. + For concrete instances, we can get the parent die from the abstract + instance. */ + +static void +flush_limbo_die_list (void) +{ + limbo_die_node *node, *next_node; + + for (node = limbo_die_list; node; node = next_node) + { + dw_die_ref die = node->die; + next_node = node->next; + + if (die->die_parent == NULL) + { + dw_die_ref origin = get_AT_ref (die, DW_AT_abstract_origin); + + if (origin && origin->die_parent) + add_child_die (origin->die_parent, die); + else if (is_cu_die (die)) + ; + else if (seen_error ()) + /* It's OK to be confused by errors in the input. */ + add_child_die (comp_unit_die (), die); + else + { + /* In certain situations, the lexical block containing a + nested function can be optimized away, which results + in the nested function die being orphaned. Likewise + with the return type of that nested function. Force + this to be a child of the containing function. + + It may happen that even the containing function got fully + inlined and optimized out. In that case we are lost and + assign the empty child. This should not be big issue as + the function is likely unreachable too. */ + gcc_assert (node->created_for); + + if (DECL_P (node->created_for)) + origin = get_context_die (DECL_CONTEXT (node->created_for)); + else if (TYPE_P (node->created_for)) + origin = scope_die_for (node->created_for, comp_unit_die ()); + else + origin = comp_unit_die (); + + add_child_die (origin, die); + } + } + } + + limbo_die_list = NULL; +} + /* Output stuff that dwarf requires at the end of every file, and generate the DWARF-2 debugging info. */ @@ -25137,7 +25193,11 @@ dwarf2out_finish (const char *filename) dw_die_ref main_comp_unit_die; /* Flush out any latecomers to the limbo party. */ - dwarf2out_early_finish (); + flush_limbo_die_list (); + + /* We shouldn't have any symbols with delayed asm names for + DIEs generated after early finish. */ + gcc_assert (deferred_asm_name == NULL); /* PCH might result in DW_AT_producer string being restored from the header compilation, so always fill it with empty string initially @@ -25483,7 +25543,7 @@ dwarf2out_finish (const char *filename) static void dwarf2out_early_finish (void) { - limbo_die_node *node, *next_node; + limbo_die_node *node; /* Add DW_AT_linkage_name for all deferred DIEs. */ for (node = deferred_asm_name; node; node = node->next) @@ -25501,57 +25561,9 @@ dwarf2out_early_finish (void) } deferred_asm_name = NULL; - /* Traverse the limbo die list, and add parent/child links. The only - dies without parents that should be here are concrete instances of - inline functions, and the comp_unit_die. We can ignore the comp_unit_die. - For concrete instances, we can get the parent die from the abstract - instance. - - The point here is to flush out the limbo list so that it is empty + /* The point here is to flush out the limbo list so that it is empty and we don't need to stream it for LTO. */ - for (node = limbo_die_list; node; node = next_node) - { - dw_die_ref die = node->die; - next_node = node->next; - - if (die->die_parent == NULL) - { - dw_die_ref origin = get_AT_ref (die, DW_AT_abstract_origin); - - if (origin && origin->die_parent) - add_child_die (origin->die_parent, die); - else if (is_cu_die (die)) - ; - else if (seen_error ()) - /* It's OK to be confused by errors in the input. */ - add_child_die (comp_unit_die (), die); - else - { - /* In certain situations, the lexical block containing a - nested function can be optimized away, which results - in the nested function die being orphaned. Likewise - with the return type of that nested function. Force - this to be a child of the containing function. - - It may happen that even the containing function got fully - inlined and optimized out. In that case we are lost and - assign the empty child. This should not be big issue as - the function is likely unreachable too. */ - gcc_assert (node->created_for); - - if (DECL_P (node->created_for)) - origin = get_context_die (DECL_CONTEXT (node->created_for)); - else if (TYPE_P (node->created_for)) - origin = scope_die_for (node->created_for, comp_unit_die ()); - else - origin = comp_unit_die (); - - add_child_die (origin, die); - } - } - } - - limbo_die_list = NULL; + flush_limbo_die_list (); } /* Reset all state within dwarf2out.c so that we can rerun the compiler diff --git a/gcc/expr.c b/gcc/expr.c index ee0c1f93249..cf28f449309 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8892,7 +8892,6 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, && ! unsignedp && mode == GET_MODE_WIDER_MODE (word_mode) && GET_MODE_SIZE (mode) == 2 * GET_MODE_SIZE (word_mode) - && ! have_insn_for (ASHIFT, mode) && TREE_CONSTANT (treeop1) && TREE_CODE (treeop0) == SSA_NAME) { @@ -8908,6 +8907,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, && ((TREE_INT_CST_LOW (treeop1) + GET_MODE_BITSIZE (rmode)) >= GET_MODE_BITSIZE (word_mode))) { + rtx_insn *seq, *seq_old; unsigned int high_off = subreg_highpart_offset (word_mode, mode); rtx low = lowpart_subreg (word_mode, op0, mode); @@ -8918,6 +8918,7 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, - TREE_INT_CST_LOW (treeop1)); tree rshift = build_int_cst (TREE_TYPE (treeop1), ramount); + start_sequence (); /* dest_high = src_low >> (word_size - C). */ temp = expand_variable_shift (RSHIFT_EXPR, word_mode, low, rshift, dest_high, unsignedp); @@ -8930,7 +8931,28 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, if (temp != dest_low) emit_move_insn (dest_low, temp); + seq = get_insns (); + end_sequence (); temp = target ; + + if (have_insn_for (ASHIFT, mode)) + { + bool speed_p = optimize_insn_for_speed_p (); + start_sequence (); + rtx ret_old = expand_variable_shift (code, mode, op0, + treeop1, target, + unsignedp); + + seq_old = get_insns (); + end_sequence (); + if (seq_cost (seq, speed_p) + >= seq_cost (seq_old, speed_p)) + { + seq = seq_old; + temp = ret_old; + } + } + emit_insn (seq); } } } diff --git a/gcc/fold-const.c b/gcc/fold-const.c index d478c4dc1c2..e9366e2de6e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7182,7 +7182,6 @@ native_interpret_real (tree type, const unsigned char *ptr, int len) { machine_mode mode = TYPE_MODE (type); int total_bytes = GET_MODE_SIZE (mode); - int byte, offset, word, words, bitpos; unsigned char value; /* There are always 32 bits in each long, no matter the size of the hosts long. We handle floating point representations with @@ -7193,16 +7192,18 @@ native_interpret_real (tree type, const unsigned char *ptr, int len) total_bytes = GET_MODE_SIZE (TYPE_MODE (type)); if (total_bytes > len || total_bytes > 24) return NULL_TREE; - words = (32 / BITS_PER_UNIT) / UNITS_PER_WORD; + int words = (32 / BITS_PER_UNIT) / UNITS_PER_WORD; memset (tmp, 0, sizeof (tmp)); - for (bitpos = 0; bitpos < total_bytes * BITS_PER_UNIT; + for (int bitpos = 0; bitpos < total_bytes * BITS_PER_UNIT; bitpos += BITS_PER_UNIT) { - byte = (bitpos / BITS_PER_UNIT) & 3; + /* Both OFFSET and BYTE index within a long; + bitpos indexes the whole float. */ + int offset, byte = (bitpos / BITS_PER_UNIT) & 3; if (UNITS_PER_WORD < 4) { - word = byte / UNITS_PER_WORD; + int word = byte / UNITS_PER_WORD; if (WORDS_BIG_ENDIAN) word = (words - 1) - word; offset = word * UNITS_PER_WORD; @@ -7212,7 +7213,16 @@ native_interpret_real (tree type, const unsigned char *ptr, int len) offset += byte % UNITS_PER_WORD; } else - offset = BYTES_BIG_ENDIAN ? 3 - byte : byte; + { + offset = byte; + if (BYTES_BIG_ENDIAN) + { + /* Reverse bytes within each long, or within the entire float + if it's smaller than a long (for HFmode). */ + offset = MIN (3, total_bytes - 1) - offset; + gcc_assert (offset >= 0); + } + } value = ptr[offset + ((bitpos / BITS_PER_UNIT) & ~3)]; tmp[bitpos / 32] |= (unsigned long)value << (bitpos & 31); @@ -10412,32 +10422,6 @@ fold_binary_loc (location_t loc, prec = element_precision (type); - /* Transform (x >> c) << c into x & (-1<<c), or transform (x << c) >> c - into x & ((unsigned)-1 >> c) for unsigned types. */ - if (((code == LSHIFT_EXPR && TREE_CODE (arg0) == RSHIFT_EXPR) - || (TYPE_UNSIGNED (type) - && code == RSHIFT_EXPR && TREE_CODE (arg0) == LSHIFT_EXPR)) - && tree_fits_uhwi_p (arg1) - && tree_to_uhwi (arg1) < prec - && tree_fits_uhwi_p (TREE_OPERAND (arg0, 1)) - && tree_to_uhwi (TREE_OPERAND (arg0, 1)) < prec) - { - HOST_WIDE_INT low0 = tree_to_uhwi (TREE_OPERAND (arg0, 1)); - HOST_WIDE_INT low1 = tree_to_uhwi (arg1); - tree lshift; - tree arg00; - - if (low0 == low1) - { - arg00 = fold_convert_loc (loc, type, TREE_OPERAND (arg0, 0)); - - lshift = build_minus_one_cst (type); - lshift = const_binop (code, lshift, arg1); - - return fold_build2_loc (loc, BIT_AND_EXPR, type, arg00, lshift); - } - } - /* If we have a rotate of a bit operation with the rotate count and the second operand of the bit operation both constant, permute the two operations. */ diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 88c1a117caa..13bb7b3fd63 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,29 @@ +2015-09-10 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67526 + * expr.c (gfc_check_init_expr): Do not dereference a NULL pointer. + +2015-09-10 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/66993 + * module.c (read_module): If a symtree exists and the symbol has + been associated in a submodule from a parent (sub)module, attach + the symbol to a 'unique symtree' and the new symbol to the + existing symtree. + +2015-09-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * intrinsic.h (gfc_simplify_mvbits): Remove. + * simplify.c (gfc_simplify_mvbits): Remove. + * intrinsic.c (add_subroutines): Remove reference to + gfc_simplify_mvbits. + +2015-09-04 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR fortran/67429 + * error.c (gfc_clear_pp_buffer): Reset last_location, otherwise + caret lines might be skipped when actually giving a diagnostic. + 2015-08-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR fortran/54833 diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 7689bbd8941..3825751ddd0 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -757,6 +757,9 @@ gfc_clear_pp_buffer (output_buffer *this_buffer) pp->buffer = this_buffer; pp_clear_output_area (pp); pp->buffer = tmp_buffer; + /* We need to reset last_location, otherwise we may skip caret lines + when we actually give a diagnostic. */ + global_dc->last_location = UNKNOWN_LOCATION; } diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 1d6f310f28c..3a0ef4d8f55 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2600,14 +2600,18 @@ gfc_check_init_expr (gfc_expr *e) break; case EXPR_SUBSTRING: - t = gfc_check_init_expr (e->ref->u.ss.start); - if (!t) - break; - - t = gfc_check_init_expr (e->ref->u.ss.end); - if (t) - t = gfc_simplify_expr (e, 0); + if (e->ref) + { + t = gfc_check_init_expr (e->ref->u.ss.start); + if (!t) + break; + t = gfc_check_init_expr (e->ref->u.ss.end); + if (t) + t = gfc_simplify_expr (e, 0); + } + else + t = false; break; case EXPR_STRUCTURE: diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index b46a5b21b79..17410925245 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -3290,8 +3290,7 @@ add_subroutines (void) t, BT_UNKNOWN, 0, REQUIRED, INTENT_OUT); add_sym_5s ("mvbits", GFC_ISYM_MVBITS, CLASS_ELEMENTAL, BT_UNKNOWN, 0, - GFC_STD_F95, gfc_check_mvbits, gfc_simplify_mvbits, - gfc_resolve_mvbits, + GFC_STD_F95, gfc_check_mvbits, NULL, gfc_resolve_mvbits, f, BT_INTEGER, di, REQUIRED, INTENT_IN, fp, BT_INTEGER, di, REQUIRED, INTENT_IN, ln, BT_INTEGER, di, REQUIRED, INTENT_IN, diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h index 4e91b822b22..971cf7c9feb 100644 --- a/gcc/fortran/intrinsic.h +++ b/gcc/fortran/intrinsic.h @@ -345,8 +345,6 @@ gfc_expr *gfc_simplify_maxexponent (gfc_expr *); gfc_expr *gfc_simplify_minexponent (gfc_expr *); gfc_expr *gfc_simplify_mod (gfc_expr *, gfc_expr *); gfc_expr *gfc_simplify_modulo (gfc_expr *, gfc_expr *); -gfc_expr *gfc_simplify_mvbits (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *, - gfc_expr *); gfc_expr *gfc_simplify_nearest (gfc_expr *, gfc_expr *); gfc_expr *gfc_simplify_new_line (gfc_expr *); gfc_expr *gfc_simplify_nint (gfc_expr *, gfc_expr *); diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 86dca1c5382..572bd501370 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -5134,7 +5134,8 @@ read_module (void) st = gfc_find_symtree (gfc_current_ns->sym_root, p); - if (st != NULL) + if (st != NULL + && !(st->n.sym && st->n.sym->attr.used_in_submodule)) { /* Check for ambiguous symbols. */ if (check_for_ambiguous (st, info)) @@ -5144,14 +5145,23 @@ read_module (void) } else { - st = gfc_find_symtree (gfc_current_ns->sym_root, name); - - /* Create a symtree node in the current namespace for this - symbol. */ - st = check_unique_name (p) - ? gfc_get_unique_symtree (gfc_current_ns) - : gfc_new_symtree (&gfc_current_ns->sym_root, p); - st->ambiguous = ambiguous; + if (st) + { + /* This symbol is host associated from a module in a + submodule. Hide it with a unique symtree. */ + gfc_symtree *s = gfc_get_unique_symtree (gfc_current_ns); + s->n.sym = st->n.sym; + st->n.sym = NULL; + } + else + { + /* Create a symtree node in the current namespace for this + symbol. */ + st = check_unique_name (p) + ? gfc_get_unique_symtree (gfc_current_ns) + : gfc_new_symtree (&gfc_current_ns->sym_root, p); + st->ambiguous = ambiguous; + } sym = info->u.rsym.sym; diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 124558efa5d..6a81dc32eca 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -4443,18 +4443,6 @@ gfc_simplify_modulo (gfc_expr *a, gfc_expr *p) } -/* Exists for the sole purpose of consistency with other intrinsics. */ -gfc_expr * -gfc_simplify_mvbits (gfc_expr *f ATTRIBUTE_UNUSED, - gfc_expr *fp ATTRIBUTE_UNUSED, - gfc_expr *l ATTRIBUTE_UNUSED, - gfc_expr *to ATTRIBUTE_UNUSED, - gfc_expr *tp ATTRIBUTE_UNUSED) -{ - return NULL; -} - - gfc_expr * gfc_simplify_nearest (gfc_expr *x, gfc_expr *s) { diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c8f27188418..10f84d47ec2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5210,7 +5210,8 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) if (TREE_CODE (inputv) == PREDECREMENT_EXPR || TREE_CODE (inputv) == PREINCREMENT_EXPR || TREE_CODE (inputv) == POSTDECREMENT_EXPR - || TREE_CODE (inputv) == POSTINCREMENT_EXPR) + || TREE_CODE (inputv) == POSTINCREMENT_EXPR + || TREE_CODE (inputv) == MODIFY_EXPR) TREE_VALUE (link) = error_mark_node; tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p, is_gimple_lvalue, fb_lvalue | fb_mayfail); @@ -6213,9 +6214,12 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, } else break; - gcc_checking_assert (splay_tree_lookup (octx->variables, - (splay_tree_key) - decl) == NULL); + if (splay_tree_lookup (octx->variables, + (splay_tree_key) decl) != NULL) + { + octx = NULL; + break; + } flags = GOVD_SEEN; if (!OMP_CLAUSE_LINEAR_NO_COPYIN (c)) flags |= GOVD_FIRSTPRIVATE; @@ -6997,7 +7001,7 @@ find_combined_omp_for (tree *tp, int *walk_subtrees, void *) static enum gimplify_status gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { - tree for_stmt, orig_for_stmt, decl, var, t; + tree for_stmt, orig_for_stmt, inner_for_stmt = NULL_TREE, decl, var, t; enum gimplify_status ret = GS_ALL_DONE; enum gimplify_status tret; gomp_for *gfor; @@ -7040,6 +7044,19 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) } } + if (OMP_FOR_INIT (for_stmt) == NULL_TREE) + { + gcc_assert (TREE_CODE (for_stmt) != OACC_LOOP); + inner_for_stmt = walk_tree (&OMP_FOR_BODY (for_stmt), + find_combined_omp_for, NULL, NULL); + if (inner_for_stmt == NULL_TREE) + { + gcc_assert (seen_error ()); + *expr_p = NULL_TREE; + return GS_ERROR; + } + } + gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p, simd ? ORT_SIMD : ORT_WORKSHARE); if (TREE_CODE (for_stmt) == OMP_DISTRIBUTE) @@ -7075,10 +7092,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) if (OMP_FOR_INIT (for_stmt) == NULL_TREE) { - gcc_assert (TREE_CODE (for_stmt) != OACC_LOOP); - for_stmt = walk_tree (&OMP_FOR_BODY (for_stmt), find_combined_omp_for, - NULL, NULL); - gcc_assert (for_stmt != NULL_TREE); + for_stmt = inner_for_stmt; gimplify_omp_ctxp->combined_loop = true; } @@ -7122,13 +7136,27 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) OMP_CLAUSE_LINEAR_NO_COPYOUT (c) = 1; flags |= GOVD_LINEAR_LASTPRIVATE_NO_OUTER; } + struct gimplify_omp_ctx *outer + = gimplify_omp_ctxp->outer_context; + if (outer && !OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) + { + if (outer->region_type == ORT_WORKSHARE + && outer->combined_loop) + { + n = splay_tree_lookup (outer->variables, + (splay_tree_key)decl); + if (n != NULL && (n->value & GOVD_LOCAL) != 0) + { + OMP_CLAUSE_LINEAR_NO_COPYOUT (c) = 1; + flags |= GOVD_LINEAR_LASTPRIVATE_NO_OUTER; + } + } + } + OMP_CLAUSE_DECL (c) = decl; OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (for_stmt); OMP_FOR_CLAUSES (for_stmt) = c; - omp_add_variable (gimplify_omp_ctxp, decl, flags); - struct gimplify_omp_ctx *outer - = gimplify_omp_ctxp->outer_context; if (outer && !OMP_CLAUSE_LINEAR_NO_COPYOUT (c)) { if (outer->region_type == ORT_WORKSHARE @@ -7145,10 +7173,16 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) outer = NULL; if (outer) { - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer->outer_context) - omp_notice_variable (outer->outer_context, decl, true); + n = splay_tree_lookup (outer->variables, + (splay_tree_key)decl); + if (n == NULL || (n->value & GOVD_DATA_SHARE_CLASS) == 0) + { + omp_add_variable (outer, decl, + GOVD_LASTPRIVATE | GOVD_SEEN); + if (outer->outer_context) + omp_notice_variable (outer->outer_context, decl, + true); + } } } } @@ -7165,9 +7199,16 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) if (outer->region_type == ORT_WORKSHARE && outer->combined_loop) { - if (outer->outer_context - && (outer->outer_context->region_type - == ORT_COMBINED_PARALLEL)) + n = splay_tree_lookup (outer->variables, + (splay_tree_key)decl); + if (n != NULL && (n->value & GOVD_LOCAL) != 0) + { + lastprivate = false; + outer = NULL; + } + else if (outer->outer_context + && (outer->outer_context->region_type + == ORT_COMBINED_PARALLEL)) outer = outer->outer_context; else if (omp_check_private (outer, decl, false)) outer = NULL; @@ -7176,10 +7217,16 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) outer = NULL; if (outer) { - omp_add_variable (outer, decl, - GOVD_LASTPRIVATE | GOVD_SEEN); - if (outer->outer_context) - omp_notice_variable (outer->outer_context, decl, true); + n = splay_tree_lookup (outer->variables, + (splay_tree_key)decl); + if (n == NULL || (n->value & GOVD_DATA_SHARE_CLASS) == 0) + { + omp_add_variable (outer, decl, + GOVD_LASTPRIVATE | GOVD_SEEN); + if (outer->outer_context) + omp_notice_variable (outer->outer_context, decl, + true); + } } } diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 90520ded455..2fa56ab0ac0 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,8 @@ +2015-09-10 Chris Manghane <cmang@google.com> + + * go-gcc.cc (Gcc_backend::type_size): Return -1 for + unrepresentable size. + 2015-08-24 Marek Polacek <polacek@redhat.com> PR tree-optimization/67284 diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index cb4c2e5c73a..13143440761 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -1099,7 +1099,8 @@ Gcc_backend::type_size(Btype* btype) gcc_assert(tree_fits_uhwi_p (t)); unsigned HOST_WIDE_INT val_wide = TREE_INT_CST_LOW(t); int64_t ret = static_cast<int64_t>(val_wide); - gcc_assert(ret >= 0 && static_cast<unsigned HOST_WIDE_INT>(ret) == val_wide); + if (ret < 0 || static_cast<unsigned HOST_WIDE_INT>(ret) != val_wide) + return -1; return ret; } diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 5fcf1bd7961..ef21b544a5f 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a63e173b20baa1a48470dd31a1fb1f2704b37011 +aea4360ca9c37f8e929f177ae7e42593ee62aa79 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 1df9f326561..dc37cf0b01e 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -3626,8 +3626,13 @@ Unary_expression::do_flatten(Gogo* gogo, Named_object*, Type* ptype = this->expr_->type()->points_to(); if (!ptype->is_void_type()) { - Btype* pbtype = ptype->get_backend(gogo); - int64_t s = gogo->backend()->type_size(pbtype); + int64_t s; + bool ok = ptype->backend_type_size(gogo, &s); + if (!ok) + { + go_assert(saw_errors()); + return Expression::make_error(this->location()); + } if (s >= 4096 || this->issue_nil_check_) { Temporary_statement* temp = @@ -4131,7 +4136,13 @@ Unary_expression::do_get_backend(Translate_context* context) Btype* pbtype = ptype->get_backend(gogo); if (!ptype->is_void_type()) { - int64_t s = gogo->backend()->type_size(pbtype); + int64_t s; + bool ok = ptype->backend_type_size(gogo, &s); + if (!ok) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } if (s >= 4096 || this->issue_nil_check_) { go_assert(this->expr_->is_variable()); @@ -4523,6 +4534,12 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc, return false; if (!is_shift && !right_nc->set_type(type, true, location)) return false; + if (is_shift + && ((left_type->integer_type() == NULL + && !left_type->is_abstract()) + || (right_type->integer_type() == NULL + && !right_type->is_abstract()))) + return false; bool r; if (type->complex_type() != NULL) @@ -4567,6 +4584,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, if (mpz_sizeinbase(val, 2) > 0x100000) { error_at(location, "constant addition overflow"); + nc->set_invalid(); mpz_set_ui(val, 1); } break; @@ -4575,6 +4593,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, if (mpz_sizeinbase(val, 2) > 0x100000) { error_at(location, "constant subtraction overflow"); + nc->set_invalid(); mpz_set_ui(val, 1); } break; @@ -4589,6 +4608,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, if (mpz_sizeinbase(val, 2) > 0x100000) { error_at(location, "constant multiplication overflow"); + nc->set_invalid(); mpz_set_ui(val, 1); } break; @@ -4598,6 +4618,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, else { error_at(location, "division by zero"); + nc->set_invalid(); mpz_set_ui(val, 0); } break; @@ -4607,6 +4628,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, else { error_at(location, "division by zero"); + nc->set_invalid(); mpz_set_ui(val, 0); } break; @@ -4618,6 +4640,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, else { error_at(location, "shift count overflow"); + nc->set_invalid(); mpz_set_ui(val, 1); } break; @@ -4629,6 +4652,7 @@ Binary_expression::eval_integer(Operator op, const Numeric_constant* left_nc, if (mpz_cmp_ui(right_val, shift) != 0) { error_at(location, "shift count overflow"); + nc->set_invalid(); mpz_set_ui(val, 1); } else @@ -4723,6 +4747,7 @@ Binary_expression::eval_float(Operator op, const Numeric_constant* left_nc, else { error_at(location, "division by zero"); + nc->set_invalid(); mpfr_set_ui(val, 0, GMP_RNDN); } break; @@ -4787,6 +4812,7 @@ Binary_expression::eval_complex(Operator op, const Numeric_constant* left_nc, if (mpc_cmp_si(right_val, 0) == 0) { error_at(location, "division by zero"); + nc->set_invalid(); mpc_set_ui(val, 0, MPC_RNDNN); break; } @@ -4849,7 +4875,14 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*, Numeric_constant nc; if (!Binary_expression::eval_constant(op, &left_nc, &right_nc, location, &nc)) - return this; + { + if (nc.is_invalid()) + { + go_assert(saw_errors()); + return Expression::make_error(location); + } + return this; + } return nc.expression(location); } } @@ -8317,8 +8350,14 @@ Builtin_call_expression::do_get_backend(Translate_context* context) Expression::make_conditional(cond, arg1_len, arg2_len, location); Type* element_type = at->element_type(); - Btype* element_btype = element_type->get_backend(gogo); - int64_t element_size = gogo->backend()->type_size(element_btype); + int64_t element_size; + bool ok = element_type->backend_type_size(gogo, &element_size); + if (!ok) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } + Expression* size_expr = Expression::make_integer_int64(element_size, length->type(), location); @@ -8359,8 +8398,12 @@ Builtin_call_expression::do_get_backend(Translate_context* context) { arg2_val = at->get_value_pointer(gogo, arg2); arg2_len = at->get_length(gogo, arg2); - Btype* element_btype = element_type->get_backend(gogo); - size = gogo->backend()->type_size(element_btype); + bool ok = element_type->backend_type_size(gogo, &size); + if (!ok) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } } Expression* element_size = Expression::make_integer_int64(size, NULL, location); @@ -11517,14 +11560,20 @@ Allocation_expression::do_get_backend(Translate_context* context) Gogo* gogo = context->gogo(); Location loc = this->location(); - Btype* btype = this->type_->get_backend(gogo); if (this->allocate_on_stack_) { - int64_t size = gogo->backend()->type_size(btype); + int64_t size; + bool ok = this->type_->backend_type_size(gogo, &size); + if (!ok) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } return gogo->backend()->stack_allocation_expression(size, loc); } - Bexpression* space = + Btype* btype = this->type_->get_backend(gogo); + Bexpression* space = gogo->allocate_memory(this->type_, loc)->get_backend(context); Btype* pbtype = gogo->backend()->pointer_type(btype); return gogo->backend()->convert_expression(pbtype, space, loc); @@ -13709,23 +13758,28 @@ Type_info_expression::do_type() Bexpression* Type_info_expression::do_get_backend(Translate_context* context) { - Btype* btype = this->type_->get_backend(context->gogo()); Gogo* gogo = context->gogo(); + bool ok = true; int64_t val; switch (this->type_info_) { case TYPE_INFO_SIZE: - val = gogo->backend()->type_size(btype); + ok = this->type_->backend_type_size(gogo, &val); break; case TYPE_INFO_ALIGNMENT: - val = gogo->backend()->type_alignment(btype); + ok = this->type_->backend_type_align(gogo, &val); break; case TYPE_INFO_FIELD_ALIGNMENT: - val = gogo->backend()->type_field_alignment(btype); + ok = this->type_->backend_type_field_align(gogo, &val); break; default: go_unreachable(); } + if (!ok) + { + go_assert(saw_errors()); + return gogo->backend()->error_expression(); + } Expression* e = Expression::make_integer_int64(val, this->type(), this->location()); return e->get_backend(context); @@ -15189,7 +15243,7 @@ Numeric_constant::set_type(Type* type, bool issue_error, Location loc) bool Numeric_constant::check_int_type(Integer_type* type, bool issue_error, - Location location) const + Location location) { mpz_t val; switch (this->classification_) @@ -15203,7 +15257,11 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error, if (!mpfr_integer_p(this->u_.float_val)) { if (issue_error) - error_at(location, "floating point constant truncated to integer"); + { + error_at(location, + "floating point constant truncated to integer"); + this->set_invalid(); + } return false; } mpz_init(val); @@ -15215,7 +15273,10 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error, || !mpfr_zero_p(mpc_imagref(this->u_.complex_val))) { if (issue_error) - error_at(location, "complex constant truncated to integer"); + { + error_at(location, "complex constant truncated to integer"); + this->set_invalid(); + } return false; } mpz_init(val); @@ -15253,7 +15314,10 @@ Numeric_constant::check_int_type(Integer_type* type, bool issue_error, } if (!ret && issue_error) - error_at(location, "integer constant overflow"); + { + error_at(location, "integer constant overflow"); + this->set_invalid(); + } return ret; } @@ -15281,7 +15345,10 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, if (!mpfr_zero_p(mpc_imagref(this->u_.complex_val))) { if (issue_error) - error_at(location, "complex constant truncated to float"); + { + this->set_invalid(); + error_at(location, "complex constant truncated to float"); + } return false; } mpfr_init_set(val, mpc_realref(this->u_.complex_val), GMP_RNDN); @@ -15344,7 +15411,10 @@ Numeric_constant::check_float_type(Float_type* type, bool issue_error, mpfr_clear(val); if (!ret && issue_error) - error_at(location, "floating point constant overflow"); + { + error_at(location, "floating point constant overflow"); + this->set_invalid(); + } return ret; } @@ -15399,7 +15469,10 @@ Numeric_constant::check_complex_type(Complex_type* type, bool issue_error, && mpfr_get_exp(mpc_realref(val)) > max_exp) { if (issue_error) - error_at(location, "complex real part overflow"); + { + error_at(location, "complex real part overflow"); + this->set_invalid(); + } ret = false; } @@ -15409,7 +15482,10 @@ Numeric_constant::check_complex_type(Complex_type* type, bool issue_error, && mpfr_get_exp(mpc_imagref(val)) > max_exp) { if (issue_error) - error_at(location, "complex imaginary part overflow"); + { + error_at(location, "complex imaginary part overflow"); + this->set_invalid(); + } ret = false; } @@ -15455,6 +15531,9 @@ Numeric_constant::expression(Location loc) const return Expression::make_float(&this->u_.float_val, this->type_, loc); case NC_COMPLEX: return Expression::make_complex(&this->u_.complex_val, this->type_, loc); + case NC_INVALID: + go_assert(saw_errors()); + return Expression::make_error(loc); default: go_unreachable(); } diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h index 5358b021339..3e3950985cb 100644 --- a/gcc/go/gofrontend/expressions.h +++ b/gcc/go/gofrontend/expressions.h @@ -3460,6 +3460,11 @@ class Numeric_constant void set_complex(Type*, const mpc_t); + // Mark numeric constant as invalid. + void + set_invalid() + { this->classification_ = NC_INVALID; } + // Classifiers. bool is_int() const @@ -3477,6 +3482,10 @@ class Numeric_constant is_complex() const { return this->classification_ == Numeric_constant::NC_COMPLEX; } + bool + is_invalid() const + { return this->classification_ == Numeric_constant::NC_INVALID; } + // Value retrievers. These will initialize the values as well as // set them. GET_INT is only valid if IS_INT returns true, and // likewise respectively. @@ -3554,7 +3563,7 @@ class Numeric_constant mpfr_to_unsigned_long(const mpfr_t fval, unsigned long *val) const; bool - check_int_type(Integer_type*, bool, Location) const; + check_int_type(Integer_type*, bool, Location); bool check_float_type(Float_type*, bool, Location); diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index 233ee274cf0..5ecc55d0dbb 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -1818,7 +1818,11 @@ Gogo::start_function(const std::string& name, Function_type* type, function); } else - go_unreachable(); + { + error_at(type->receiver()->location(), + "invalid receiver type (receiver must be a named type)"); + ret = Named_object::make_function(name, NULL, function); + } } this->package_->bindings()->add_method(ret); } diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 67f78034266..98d98da74ec 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -1752,7 +1752,9 @@ Lex::skip_cpp_comment() // For field tracking analysis: a //go:nointerface comment means // that the next interface method should not be stored in the type // descriptor. This permits it to be discarded if it is not needed. - if (this->lineoff_ == 2 && memcmp(p, "go:nointerface", 14) == 0) + if (this->lineoff_ == 2 + && pend - p > 14 + && memcmp(p, "go:nointerface", 14) == 0) this->saw_nointerface_ = true; while (p < pend) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 8331678578d..dcc6bc829c6 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -2524,6 +2524,20 @@ Type::backend_type_size(Gogo* gogo, int64_t *psize) return false; Btype* bt = this->get_backend_placeholder(gogo); *psize = gogo->backend()->type_size(bt); + if (*psize == -1) + { + if (this->named_type() != NULL) + error_at(this->named_type()->location(), + "type %s larger than address space", + Gogo::message_name(this->named_type()->name()).c_str()); + else + error("type %s larger than address space", + this->reflection(gogo).c_str()); + + // Make this an error type to avoid knock-on errors. + this->classification_ = TYPE_ERROR; + return false; + } return true; } @@ -6400,8 +6414,12 @@ Array_type::slice_gc_symbol(Gogo* gogo, Expression_list** vals, // Differentiate between slices with zero-length and non-zero-length values. Type* element_type = this->element_type(); - Btype* ebtype = element_type->get_backend(gogo); - int64_t element_size = gogo->backend()->type_size(ebtype); + int64_t element_size; + bool ok = element_type->backend_type_size(gogo, &element_size); + if (!ok) { + go_assert(saw_errors()); + element_size = 4; + } Type* uintptr_type = Type::lookup_integer_type("uintptr"); unsigned long opval = element_size == 0 ? GC_APTR : GC_SLICE; @@ -6432,7 +6450,13 @@ Array_type::array_gc_symbol(Gogo* gogo, Expression_list** vals, Btype* pbtype = gogo->backend()->pointer_type(gogo->backend()->void_type()); int64_t pwidth = gogo->backend()->type_size(pbtype); - int64_t iwidth = gogo->backend()->type_size(this->get_backend(gogo)); + int64_t iwidth; + bool ok = this->backend_type_size(gogo, &iwidth); + if (!ok) + { + go_assert(saw_errors()); + iwidth = 4; + } Type* element_type = this->element_type(); if (bound < 1 || !element_type->has_pointer()) diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index c3c20909144..85f16f3933b 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -256,17 +256,12 @@ __isl_give isl_union_map * extend_schedule (__isl_take isl_union_map *x) { int max = 0; - isl_stat res; struct extend_schedule_str str; - res = isl_union_map_foreach_map (x, max_number_of_out_dimensions, (void *) &max); - gcc_assert (res == isl_stat_ok); - + isl_union_map_foreach_map (x, max_number_of_out_dimensions, (void *) &max); str.max = max; str.umap = isl_union_map_empty (isl_union_map_get_space (x)); - res = isl_union_map_foreach_map (x, extend_schedule_1, (void *) &str); - gcc_assert (res == isl_stat_ok); - + isl_union_map_foreach_map (x, extend_schedule_1, (void *) &str); isl_union_map_free (x); return str.umap; } @@ -395,7 +390,6 @@ subtract_commutative_associative_deps (scop_p scop, FOR_EACH_VEC_ELT (pbbs, i, pbb) if (PBB_IS_REDUCTION (pbb)) { - int res; isl_union_map *r = isl_union_map_empty (isl_space_copy (space)); isl_union_map *must_w = isl_union_map_empty (isl_space_copy (space)); isl_union_map *may_w = isl_union_map_empty (isl_space_copy (space)); @@ -432,27 +426,24 @@ subtract_commutative_associative_deps (scop_p scop, (isl_union_map_copy (must_w), isl_union_map_copy (may_w)); empty = isl_union_map_empty (isl_union_map_get_space (all_w)); - res = isl_union_map_compute_flow (isl_union_map_copy (r), - isl_union_map_copy (must_w), - isl_union_map_copy (may_w), - isl_union_map_copy (original), - &x_must_raw, &x_may_raw, - &x_must_raw_no_source, - &x_may_raw_no_source); - gcc_assert (res == 0); - res = isl_union_map_compute_flow (isl_union_map_copy (all_w), - r, empty, - isl_union_map_copy (original), - &x_must_war, &x_may_war, - &x_must_war_no_source, - &x_may_war_no_source); - gcc_assert (res == 0); - res = isl_union_map_compute_flow (all_w, must_w, may_w, - isl_union_map_copy (original), - &x_must_waw, &x_may_waw, - &x_must_waw_no_source, - &x_may_waw_no_source); - gcc_assert (res == 0); + isl_union_map_compute_flow (isl_union_map_copy (r), + isl_union_map_copy (must_w), + isl_union_map_copy (may_w), + isl_union_map_copy (original), + &x_must_raw, &x_may_raw, + &x_must_raw_no_source, + &x_may_raw_no_source); + isl_union_map_compute_flow (isl_union_map_copy (all_w), + r, empty, + isl_union_map_copy (original), + &x_must_war, &x_may_war, + &x_must_war_no_source, + &x_may_war_no_source); + isl_union_map_compute_flow (all_w, must_w, may_w, + isl_union_map_copy (original), + &x_must_waw, &x_may_waw, + &x_must_waw_no_source, + &x_may_waw_no_source); if (must_raw) *must_raw = isl_union_map_subtract (*must_raw, x_must_raw); @@ -551,26 +542,22 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs, isl_space *space = isl_union_map_get_space (all_writes); isl_union_map *empty = isl_union_map_empty (space); isl_union_map *original = scop_get_original_schedule (scop, pbbs); - int res; - res = isl_union_map_compute_flow (isl_union_map_copy (reads), - isl_union_map_copy (must_writes), - isl_union_map_copy (may_writes), - isl_union_map_copy (original), - must_raw, may_raw, must_raw_no_source, - may_raw_no_source); - gcc_assert (res == 0); - res = isl_union_map_compute_flow (isl_union_map_copy (all_writes), - reads, empty, - isl_union_map_copy (original), - must_war, may_war, must_war_no_source, - may_war_no_source); - gcc_assert (res == 0); - res = isl_union_map_compute_flow (all_writes, must_writes, may_writes, - isl_union_map_copy (original), - must_waw, may_waw, must_waw_no_source, - may_waw_no_source); - gcc_assert (res == 0); + isl_union_map_compute_flow (isl_union_map_copy (reads), + isl_union_map_copy (must_writes), + isl_union_map_copy (may_writes), + isl_union_map_copy (original), + must_raw, may_raw, must_raw_no_source, + may_raw_no_source); + isl_union_map_compute_flow (isl_union_map_copy (all_writes), + reads, empty, + isl_union_map_copy (original), + must_war, may_war, must_war_no_source, + may_war_no_source); + isl_union_map_compute_flow (all_writes, must_writes, may_writes, + isl_union_map_copy (original), + must_waw, may_waw, must_waw_no_source, + may_waw_no_source); subtract_commutative_associative_deps (scop, pbbs, original, diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 5434bfdeb6f..a8c99c3faad 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -57,7 +57,9 @@ extern "C" { #include "tree-ssa-loop-manip.h" #include "tree-scalar-evolution.h" #include "gimple-ssa.h" +#include "tree-phinodes.h" #include "tree-into-ssa.h" +#include "ssa-iterators.h" #include <map> #include "graphite-isl-ast-to-gimple.h" @@ -286,7 +288,12 @@ gcc_expression_from_isl_ast_expr_id (tree type, gcc_assert (res != ip.end () && "Could not map isl_id to tree expression"); isl_ast_expr_free (expr_id); - return fold_convert (type, res->second); + tree t = res->second; + tree *val = region->parameter_rename_map->get(t); + + if (!val) + val = &t; + return fold_convert (type, *val); } /* Converts an isl_ast_expr_int expression E to a GCC expression tree of @@ -1063,6 +1070,69 @@ scop_to_isl_ast (scop_p scop, ivs_params &ip) return ast_isl; } +/* Copy def from sese REGION to the newly created TO_REGION. TR is defined by + DEF_STMT. GSI points to entry basic block of the TO_REGION. */ + +static void +copy_def(tree tr, gimple def_stmt, sese region, sese to_region, gimple_stmt_iterator *gsi) +{ + if (!defined_in_sese_p (tr, region)) + return; + ssa_op_iter iter; + use_operand_p use_p; + + FOR_EACH_SSA_USE_OPERAND (use_p, def_stmt, iter, SSA_OP_USE) + { + tree use_tr = USE_FROM_PTR (use_p); + + /* Do not copy parameters that have been generated in the header of the + scop. */ + if (region->parameter_rename_map->get(use_tr)) + continue; + + gimple def_of_use = SSA_NAME_DEF_STMT (use_tr); + if (!def_of_use) + continue; + + copy_def (use_tr, def_of_use, region, to_region, gsi); + } + + gimple copy = gimple_copy (def_stmt); + gsi_insert_after (gsi, copy, GSI_NEW_STMT); + + /* Create new names for all the definitions created by COPY and + add replacement mappings for each new name. */ + def_operand_p def_p; + ssa_op_iter op_iter; + FOR_EACH_SSA_DEF_OPERAND (def_p, copy, op_iter, SSA_OP_ALL_DEFS) + { + tree old_name = DEF_FROM_PTR (def_p); + tree new_name = create_new_def_for (old_name, copy, def_p); + region->parameter_rename_map->put(old_name, new_name); + } + + update_stmt (copy); +} + +static void +copy_internal_parameters(sese region, sese to_region) +{ + /* For all the parameters which definitino is in the if_region->false_region, + insert code on true_region (if_region->true_region->entry). */ + + int i; + tree tr; + gimple_stmt_iterator gsi = gsi_start_bb(to_region->entry->dest); + + FOR_EACH_VEC_ELT (region->params, i, tr) + { + // If def is not in region. + gimple def_stmt = SSA_NAME_DEF_STMT (tr); + if (def_stmt) + copy_def (tr, def_stmt, region, to_region, &gsi); + } +} + /* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for the given SCOP. Return true if code generation succeeded. @@ -1102,10 +1172,13 @@ graphite_regenerate_ast_isl (scop_p scop) context_loop = SESE_ENTRY (region)->src->loop_father; - translate_isl_ast_to_gimple t (region); + /* Copy all the parameters which are defined in the region. */ + copy_internal_parameters(if_region->false_region, if_region->true_region); - t.translate_isl_ast (context_loop, root_node, if_region->true_region->entry, - ip); + translate_isl_ast_to_gimple t(region); + edge e = single_succ_edge (if_region->true_region->entry->dest); + split_edge (e); + t.translate_isl_ast (context_loop, root_node, e, ip); mark_virtual_operands_for_renaming (cfun); update_ssa (TODO_update_ssa); diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c index ffa44652f63..bd13978f42d 100644 --- a/gcc/graphite-optimize-isl.c +++ b/gcc/graphite-optimize-isl.c @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include <isl/band.h> #include <isl/aff.h> #include <isl/options.h> +#include <isl/ctx.h> #include "system.h" #include "coretypes.h" @@ -63,335 +64,203 @@ scop_get_domains (scop_p scop ATTRIBUTE_UNUSED) return res; } -/* getTileMap - Create a map that describes a n-dimensonal tiling. - - getTileMap creates a map from a n-dimensional scattering space into an +/* get_tile_map - Create a map that describes a n-dimensonal tiling. + + get_tile_map creates a map from a n-dimensional scattering space into an 2*n-dimensional scattering space. The map describes a rectangular tiling. - + Example: - scheduleDimensions = 2, parameterDimensions = 1, tileSize = 32 - - tileMap := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]: - t0 % 32 = 0 and t0 <= s0 < t0 + 32 and - t1 % 32 = 0 and t1 <= s1 < t1 + 32} - + SCHEDULE_DIMENSIONS = 2, PARAMETER_DIMENSIONS = 1, TILE_SIZE = 32 + + tile_map := [p0] -> {[s0, s1] -> [t0, t1, s0, s1]: + t0 % 32 = 0 and t0 <= s0 < t0 + 32 and + t1 % 32 = 0 and t1 <= s1 < t1 + 32} + Before tiling: - + for (i = 0; i < N; i++) for (j = 0; j < M; j++) - S(i,j) - + S(i,j) + After tiling: - + for (t_i = 0; t_i < N; i+=32) for (t_j = 0; t_j < M; j+=32) - for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0 - for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0 - S(i,j) - */ - + for (i = t_i; i < min(t_i + 32, N); i++) | Unknown that N % 32 = 0 + for (j = t_j; j < t_j + 32; j++) | Known that M % 32 = 0 + S(i,j) + */ + static isl_basic_map * -getTileMap (isl_ctx *ctx, int scheduleDimensions, int tileSize) +get_tile_map (isl_ctx *ctx, int schedule_dimensions, int tile_size) { - int x; /* We construct - tileMap := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]: - s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and - s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32} + tile_map := [p0] -> {[s0, s1] -> [t0, t1, p0, p1, a0, a1]: + s0 = a0 * 32 and s0 = p0 and t0 <= p0 < t0 + 32 and + s1 = a1 * 32 and s1 = p1 and t1 <= p1 < t1 + 32} and project out the auxilary dimensions a0 and a1. */ - isl_space *Space = isl_space_alloc (ctx, 0, scheduleDimensions, - scheduleDimensions * 3); - isl_basic_map *tileMap = isl_basic_map_universe (isl_space_copy (Space)); + isl_space *space + = isl_space_alloc (ctx, 0, schedule_dimensions, schedule_dimensions * 3); + isl_basic_map *tile_map = isl_basic_map_universe (isl_space_copy (space)); - isl_local_space *LocalSpace = isl_local_space_from_space (Space); + isl_local_space *local_space = isl_local_space_from_space (space); - for (x = 0; x < scheduleDimensions; x++) + for (int x = 0; x < schedule_dimensions; x++) { int sX = x; int tX = x; - int pX = scheduleDimensions + x; - int aX = 2 * scheduleDimensions + x; + int pX = schedule_dimensions + x; + int aX = 2 * schedule_dimensions + x; isl_constraint *c; - /* sX = aX * tileSize; */ - c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); + /* sX = aX * tile_size; */ + c = isl_equality_alloc (isl_local_space_copy (local_space)); isl_constraint_set_coefficient_si (c, isl_dim_out, sX, 1); - isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tileSize); - tileMap = isl_basic_map_add_constraint (tileMap, c); + isl_constraint_set_coefficient_si (c, isl_dim_out, aX, -tile_size); + tile_map = isl_basic_map_add_constraint (tile_map, c); /* pX = sX; */ - c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); + c = isl_equality_alloc (isl_local_space_copy (local_space)); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); isl_constraint_set_coefficient_si (c, isl_dim_in, sX, -1); - tileMap = isl_basic_map_add_constraint (tileMap, c); + tile_map = isl_basic_map_add_constraint (tile_map, c); /* tX <= pX */ - c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); + c = isl_inequality_alloc (isl_local_space_copy (local_space)); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, tX, -1); - tileMap = isl_basic_map_add_constraint (tileMap, c); + tile_map = isl_basic_map_add_constraint (tile_map, c); - /* pX <= tX + (tileSize - 1) */ - c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); + /* pX <= tX + (tile_size - 1) */ + c = isl_inequality_alloc (isl_local_space_copy (local_space)); isl_constraint_set_coefficient_si (c, isl_dim_out, tX, 1); isl_constraint_set_coefficient_si (c, isl_dim_out, pX, -1); - isl_constraint_set_constant_si (c, tileSize - 1); - tileMap = isl_basic_map_add_constraint (tileMap, c); + isl_constraint_set_constant_si (c, tile_size - 1); + tile_map = isl_basic_map_add_constraint (tile_map, c); } /* Project out auxiliary dimensions. - The auxiliary dimensions are transformed into existentially quantified ones. - This reduces the number of visible scattering dimensions and allows Cloog + The auxiliary dimensions are transformed into existentially quantified + ones. + This reduces the number of visible scattering dimensions and allows isl to produces better code. */ - tileMap = isl_basic_map_project_out (tileMap, isl_dim_out, - 2 * scheduleDimensions, - scheduleDimensions); - isl_local_space_free (LocalSpace); - return tileMap; + tile_map = + isl_basic_map_project_out (tile_map, isl_dim_out, + 2 * schedule_dimensions, schedule_dimensions); + isl_local_space_free (local_space); + return tile_map; } -/* getScheduleForBand - Get the schedule for this band. - - Polly applies transformations like tiling on top of the isl calculated value. +/* get_schedule_for_band - Get the schedule for this BAND. + + Polly applies transformations like tiling on top of the isl calculated + value. This can influence the number of scheduling dimension. The number of - schedule dimensions is returned in the parameter 'Dimension'. */ -static bool DisableTiling = false; + schedule dimensions is returned in DIMENSIONS. */ static isl_union_map * -getScheduleForBand (isl_band *Band, int *Dimensions) +get_schedule_for_band (isl_band *band, int *dimensions) { - isl_union_map *PartialSchedule; + isl_union_map *partial_schedule; isl_ctx *ctx; - isl_space *Space; - isl_basic_map *TileMap; - isl_union_map *TileUMap; + isl_space *space; + isl_basic_map *tile_map; + isl_union_map *tile_umap; - PartialSchedule = isl_band_get_partial_schedule (Band); - *Dimensions = isl_band_n_member (Band); - - if (DisableTiling) - return PartialSchedule; + partial_schedule = isl_band_get_partial_schedule (band); + *dimensions = isl_band_n_member (band); /* It does not make any sense to tile a band with just one dimension. */ - if (*Dimensions == 1) + if (*dimensions == 1) { if (dump_file && dump_flags) fprintf (dump_file, "not tiled\n"); - return PartialSchedule; + return partial_schedule; } if (dump_file && dump_flags) fprintf (dump_file, "tiled by %d\n", PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); - ctx = isl_union_map_get_ctx (PartialSchedule); - Space = isl_union_map_get_space (PartialSchedule); - - TileMap = getTileMap (ctx, *Dimensions, - PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); - TileUMap = isl_union_map_from_map (isl_map_from_basic_map (TileMap)); - TileUMap = isl_union_map_align_params (TileUMap, Space); - *Dimensions = 2 * *Dimensions; + ctx = isl_union_map_get_ctx (partial_schedule); + space = isl_union_map_get_space (partial_schedule); - return isl_union_map_apply_range (PartialSchedule, TileUMap); -} - -/* Create a map that pre-vectorizes one scheduling dimension. - - getPrevectorMap creates a map that maps each input dimension to the same - output dimension, except for the dimension DimToVectorize. DimToVectorize is - strip mined by 'VectorWidth' and the newly created point loop of - DimToVectorize is moved to the innermost level. - - Example (DimToVectorize=0, ScheduleDimensions=2, VectorWidth=4): - - | Before transformation - | - | A[i,j] -> [i,j] - | - | for (i = 0; i < 128; i++) - | for (j = 0; j < 128; j++) - | A(i,j); - - Prevector map: - [i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip - - | After transformation: - | - | A[i,j] -> [it,j,ip] : it % 4 = 0 and it <= ip <= it + 3 and i = ip - | - | for (it = 0; it < 128; it+=4) - | for (j = 0; j < 128; j++) - | for (ip = max(0,it); ip < min(128, it + 3); ip++) - | A(ip,j); - - The goal of this transformation is to create a trivially vectorizable loop. - This means a parallel loop at the innermost level that has a constant number - of iterations corresponding to the target vector width. - - This transformation creates a loop at the innermost level. The loop has a - constant number of iterations, if the number of loop iterations at - DimToVectorize can be devided by VectorWidth. The default VectorWidth is - currently constant and not yet target specific. This function does not reason - about parallelism. */ -static isl_map * -getPrevectorMap (isl_ctx *ctx, int DimToVectorize, - int ScheduleDimensions, - int VectorWidth) -{ - isl_space *Space; - isl_local_space *LocalSpace, *LocalSpaceRange; - isl_set *Modulo; - isl_map *TilingMap; - isl_constraint *c; - isl_aff *Aff; - int PointDimension; /* ip */ - int TileDimension; /* it */ - isl_val *VectorWidthMP; - int i; - - /* assert (0 <= DimToVectorize && DimToVectorize < ScheduleDimensions);*/ - - Space = isl_space_alloc (ctx, 0, ScheduleDimensions, ScheduleDimensions + 1); - TilingMap = isl_map_universe (isl_space_copy (Space)); - LocalSpace = isl_local_space_from_space (Space); - PointDimension = ScheduleDimensions; - TileDimension = DimToVectorize; - - /* Create an identity map for everything except DimToVectorize and map - DimToVectorize to the point loop at the innermost dimension. */ - for (i = 0; i < ScheduleDimensions; i++) - { - c = isl_equality_alloc (isl_local_space_copy (LocalSpace)); - isl_constraint_set_coefficient_si (c, isl_dim_in, i, -1); - - if (i == DimToVectorize) - isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1); - else - isl_constraint_set_coefficient_si (c, isl_dim_out, i, 1); - - TilingMap = isl_map_add_constraint (TilingMap, c); - } + tile_map = get_tile_map (ctx, *dimensions, + PARAM_VALUE (PARAM_LOOP_BLOCK_TILE_SIZE)); + tile_umap = isl_union_map_from_map (isl_map_from_basic_map (tile_map)); + tile_umap = isl_union_map_align_params (tile_umap, space); + *dimensions = 2 * *dimensions; - /* it % 'VectorWidth' = 0 */ - LocalSpaceRange = isl_local_space_range (isl_local_space_copy (LocalSpace)); - Aff = isl_aff_zero_on_domain (LocalSpaceRange); - Aff = isl_aff_set_constant_si (Aff, VectorWidth); - Aff = isl_aff_set_coefficient_si (Aff, isl_dim_in, TileDimension, 1); - - VectorWidthMP = isl_val_int_from_si (ctx, VectorWidth); - Aff = isl_aff_mod_val (Aff, VectorWidthMP); - Modulo = isl_pw_aff_zero_set (isl_pw_aff_from_aff (Aff)); - TilingMap = isl_map_intersect_range (TilingMap, Modulo); - - /* it <= ip */ - c = isl_inequality_alloc (isl_local_space_copy (LocalSpace)); - isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, -1); - isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, 1); - TilingMap = isl_map_add_constraint (TilingMap, c); - - /* ip <= it + ('VectorWidth' - 1) */ - c = isl_inequality_alloc (LocalSpace); - isl_constraint_set_coefficient_si (c, isl_dim_out, TileDimension, 1); - isl_constraint_set_coefficient_si (c, isl_dim_out, PointDimension, -1); - isl_constraint_set_constant_si (c, VectorWidth - 1); - TilingMap = isl_map_add_constraint (TilingMap, c); - - return TilingMap; + return isl_union_map_apply_range (partial_schedule, tile_umap); } -static bool EnablePollyVector = false; -/* getScheduleForBandList - Get the scheduling map for a list of bands. +/* get_schedule_for_band_list - Get the scheduling map for a list of bands. We walk recursively the forest of bands to combine the schedules of the - individual bands to the overall schedule. In case tiling is requested, + individual bands to the overall schedule. In case tiling is requested, the individual bands are tiled. */ + static isl_union_map * -getScheduleForBandList (isl_band_list *BandList) +get_schedule_for_band_list (isl_band_list *band_list) { - int NumBands, i; - isl_union_map *Schedule; + int num_bands, i; + isl_union_map *schedule; isl_ctx *ctx; - ctx = isl_band_list_get_ctx (BandList); - NumBands = isl_band_list_n_band (BandList); - Schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0)); + ctx = isl_band_list_get_ctx (band_list); + num_bands = isl_band_list_n_band (band_list); + schedule = isl_union_map_empty (isl_space_params_alloc (ctx, 0)); - for (i = 0; i < NumBands; i++) + for (i = 0; i < num_bands; i++) { - isl_band *Band; - isl_union_map *PartialSchedule; - int ScheduleDimensions; - isl_space *Space; + isl_band *band; + isl_union_map *partial_schedule; + int schedule_dimensions; + isl_space *space; - Band = isl_band_list_get_band (BandList, i); - PartialSchedule = getScheduleForBand (Band, &ScheduleDimensions); - Space = isl_union_map_get_space (PartialSchedule); + band = isl_band_list_get_band (band_list, i); + partial_schedule = get_schedule_for_band (band, &schedule_dimensions); + space = isl_union_map_get_space (partial_schedule); - if (isl_band_has_children (Band)) - { - isl_band_list *Children; - isl_union_map *SuffixSchedule; - - Children = isl_band_get_children (Band); - SuffixSchedule = getScheduleForBandList (Children); - PartialSchedule = isl_union_map_flat_range_product (PartialSchedule, - SuffixSchedule); - isl_band_list_free (Children); - } - else if (EnablePollyVector) + if (isl_band_has_children (band)) { - for (i = ScheduleDimensions - 1 ; i >= 0 ; i--) - { -#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE - if (isl_band_member_is_coincident (Band, i)) -#else - if (isl_band_member_is_zero_distance (Band, i)) -#endif - { - isl_map *TileMap; - isl_union_map *TileUMap; - - TileMap = getPrevectorMap (ctx, i, ScheduleDimensions, 4); - TileUMap = isl_union_map_from_map (TileMap); - TileUMap = isl_union_map_align_params - (TileUMap, isl_space_copy (Space)); - PartialSchedule = isl_union_map_apply_range - (PartialSchedule, TileUMap); - break; - } - } + isl_band_list *children = isl_band_get_children (band); + isl_union_map *suffixSchedule + = get_schedule_for_band_list (children); + partial_schedule + = isl_union_map_flat_range_product (partial_schedule, + suffixSchedule); + isl_band_list_free (children); } - Schedule = isl_union_map_union (Schedule, PartialSchedule); + schedule = isl_union_map_union (schedule, partial_schedule); - isl_band_free (Band); - isl_space_free (Space); + isl_band_free (band); + isl_space_free (space); } - return Schedule; + return schedule; } static isl_union_map * -getScheduleMap (isl_schedule *Schedule) +get_schedule_map (isl_schedule *schedule) { - isl_band_list *BandList = isl_schedule_get_band_forest (Schedule); - isl_union_map *ScheduleMap = getScheduleForBandList (BandList); - isl_band_list_free (BandList); - return ScheduleMap; + isl_band_list *bandList = isl_schedule_get_band_forest (schedule); + isl_union_map *schedule_map = get_schedule_for_band_list (bandList); + isl_band_list_free (bandList); + return schedule_map; } static isl_stat -getSingleMap (__isl_take isl_map *map, void *user) +get_single_map (__isl_take isl_map *map, void *user) { - isl_map **singleMap = (isl_map **) user; - *singleMap = map; - + isl_map **single_map = (isl_map **)user; + *single_map = map; return isl_stat_ok; } @@ -404,54 +273,55 @@ apply_schedule_map_to_scop (scop_p scop, isl_union_map *schedule_map) FOR_EACH_VEC_ELT (scop->bbs, i, pbb) { isl_set *domain = isl_set_copy (pbb->domain); - isl_union_map *stmtBand; - isl_map *stmtSchedule; + isl_map *stmt_schedule; - stmtBand = isl_union_map_intersect_domain - (isl_union_map_copy (schedule_map), - isl_union_set_from_set (domain)); - isl_union_map_foreach_map (stmtBand, getSingleMap, &stmtSchedule); + isl_union_map *stmt_band + = isl_union_map_intersect_domain (isl_union_map_copy (schedule_map), + isl_union_set_from_set (domain)); + isl_union_map_foreach_map (stmt_band, get_single_map, &stmt_schedule); isl_map_free (pbb->transformed); - pbb->transformed = stmtSchedule; - isl_union_map_free (stmtBand); + pbb->transformed = stmt_schedule; + isl_union_map_free (stmt_band); } } static const int CONSTANT_BOUND = 20; +/* Compute the schedule for SCOP based on its parameters, domain and set of + constraints. Then apply the schedule to SCOP. */ + bool optimize_isl (scop_p scop) { - - isl_schedule *schedule; -#ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE - isl_schedule_constraints *schedule_constraints; +#ifdef HAVE_ISL_CTX_MAX_OPERATIONS + int old_max_operations = isl_ctx_get_max_operations (scop->ctx); + int max_operations = PARAM_VALUE (PARAM_MAX_ISL_OPERATIONS); + if (max_operations) + isl_ctx_set_max_operations (scop->ctx, max_operations); #endif - isl_union_set *domain; - isl_union_map *validity, *proximity, *dependences; - isl_union_map *schedule_map; - - domain = scop_get_domains (scop); - dependences = scop_get_dependences (scop); - dependences = isl_union_map_gist_domain (dependences, - isl_union_set_copy (domain)); - dependences = isl_union_map_gist_range (dependences, - isl_union_set_copy (domain)); - validity = dependences; + isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE); - proximity = isl_union_map_copy (validity); + isl_union_set *domain = scop_get_domains (scop); + isl_union_map *dependences = scop_get_dependences (scop); + dependences + = isl_union_map_gist_domain (dependences, isl_union_set_copy (domain)); + dependences + = isl_union_map_gist_range (dependences, isl_union_set_copy (domain)); + isl_union_map *validity = dependences; + isl_union_map *proximity = isl_union_map_copy (validity); #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE + isl_schedule_constraints *schedule_constraints; schedule_constraints = isl_schedule_constraints_on_domain (domain); schedule_constraints - = isl_schedule_constraints_set_proximity (schedule_constraints, - proximity); + = isl_schedule_constraints_set_proximity (schedule_constraints, + proximity); schedule_constraints - = isl_schedule_constraints_set_validity (schedule_constraints, - isl_union_map_copy (validity)); + = isl_schedule_constraints_set_validity (schedule_constraints, + isl_union_map_copy (validity)); schedule_constraints - = isl_schedule_constraints_set_coincidence (schedule_constraints, - validity); + = isl_schedule_constraints_set_coincidence (schedule_constraints, + validity); #endif isl_options_set_schedule_max_constant_term (scop->ctx, CONSTANT_BOUND); @@ -461,27 +331,40 @@ optimize_isl (scop_p scop) #else isl_options_set_schedule_fuse (scop->ctx, ISL_SCHEDULE_FUSE_MIN); #endif - isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_CONTINUE); #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE - schedule = isl_schedule_constraints_compute_schedule(schedule_constraints); + isl_schedule *schedule + = isl_schedule_constraints_compute_schedule (schedule_constraints); #else - schedule = isl_union_set_compute_schedule (domain, validity, proximity); + isl_schedule *schedule + = isl_union_set_compute_schedule (domain, validity, proximity); #endif isl_options_set_on_error (scop->ctx, ISL_ON_ERROR_ABORT); +#ifdef HAVE_ISL_CTX_MAX_OPERATIONS + isl_ctx_reset_operations (scop->ctx); + isl_ctx_set_max_operations (scop->ctx, old_max_operations); + if (!schedule || isl_ctx_last_error (scop->ctx) == isl_error_quota) + { + if (dump_file && dump_flags) + fprintf (dump_file, "ISL timed out at %d operations\n", + max_operations); + if (schedule) + isl_schedule_free (schedule); + return false; + } +#else if (!schedule) return false; +#endif - schedule_map = getScheduleMap (schedule); - + isl_union_map *schedule_map = get_schedule_map (schedule); apply_schedule_map_to_scop (scop, schedule_map); isl_schedule_free (schedule); isl_union_map_free (schedule_map); - return true; } -#endif /* HAVE_isl */ +#endif /* HAVE_isl */ diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index dbd98428265..3ac56dedd04 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -472,6 +472,17 @@ graphite_can_represent_loop (basic_block scop_entry, loop_p loop) tree niter; struct tree_niter_desc niter_desc; + if (!loop_nest_has_data_refs (loop)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "[scop-detection-fail] "); + fprintf (dump_file, "Loop %d does not have any data reference.\n", + loop->num); + } + return false; + } + /* FIXME: For the moment, graphite cannot be used on loops that iterate using induction variables that wrap. */ @@ -1155,8 +1166,17 @@ build_graphite_scops (vec<sd_region> regions, if (!exit) continue; - scop = new_scop (new_sese (entry, exit)); - scops->safe_push (scop); + sese sese_reg = new_sese (entry, exit); + scop = new_scop (sese_reg); + + build_sese_loop_nests (sese_reg); + + /* Scops with one or no loops are not interesting. */ + if (SESE_LOOP_NEST (sese_reg).length () > 1) + scops->safe_push (scop); + else if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Discarded scop: %d loops\n", + SESE_LOOP_NEST (sese_reg).length ()); /* Are there overlapping SCoPs? */ #ifdef ENABLE_CHECKING @@ -1172,151 +1192,6 @@ build_graphite_scops (vec<sd_region> regions, } } -/* Returns true when BB contains only close phi nodes. */ - -static bool -contains_only_close_phi_nodes (basic_block bb) -{ - gimple_stmt_iterator gsi; - - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - if (gimple_code (gsi_stmt (gsi)) != GIMPLE_LABEL) - return false; - - return true; -} - -/* Print statistics for SCOP to FILE. */ - -static void -print_graphite_scop_statistics (FILE* file, scop_p scop) -{ - long n_bbs = 0; - long n_loops = 0; - long n_stmts = 0; - long n_conditions = 0; - long n_p_bbs = 0; - long n_p_loops = 0; - long n_p_stmts = 0; - long n_p_conditions = 0; - - basic_block bb; - - FOR_ALL_BB_FN (bb, cfun) - { - gimple_stmt_iterator psi; - loop_p loop = bb->loop_father; - - if (!bb_in_sese_p (bb, SCOP_REGION (scop))) - continue; - - n_bbs++; - n_p_bbs += bb->count; - - if (EDGE_COUNT (bb->succs) > 1) - { - n_conditions++; - n_p_conditions += bb->count; - } - - for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi)) - { - n_stmts++; - n_p_stmts += bb->count; - } - - if (loop->header == bb && loop_in_sese_p (loop, SCOP_REGION (scop))) - { - n_loops++; - n_p_loops += bb->count; - } - - } - - fprintf (file, "\nBefore limit_scops SCoP statistics ("); - fprintf (file, "BBS:%ld, ", n_bbs); - fprintf (file, "LOOPS:%ld, ", n_loops); - fprintf (file, "CONDITIONS:%ld, ", n_conditions); - fprintf (file, "STMTS:%ld)\n", n_stmts); - fprintf (file, "\nBefore limit_scops SCoP profiling statistics ("); - fprintf (file, "BBS:%ld, ", n_p_bbs); - fprintf (file, "LOOPS:%ld, ", n_p_loops); - fprintf (file, "CONDITIONS:%ld, ", n_p_conditions); - fprintf (file, "STMTS:%ld)\n", n_p_stmts); -} - -/* Print statistics for SCOPS to FILE. */ - -static void -print_graphite_statistics (FILE* file, vec<scop_p> scops) -{ - int i; - scop_p scop; - - FOR_EACH_VEC_ELT (scops, i, scop) - print_graphite_scop_statistics (file, scop); -} - -/* We limit all SCoPs to SCoPs, that are completely surrounded by a loop. - - Example: - - for (i | - { | - for (j | SCoP 1 - for (k | - } | - - * SCoP frontier, as this line is not surrounded by any loop. * - - for (l | SCoP 2 - - This is necessary as scalar evolution and parameter detection need a - outermost loop to initialize parameters correctly. - - TODO: FIX scalar evolution and parameter detection to allow more flexible - SCoP frontiers. */ - -static void -limit_scops (vec<scop_p> *scops) -{ - auto_vec<sd_region, 3> regions; - - int i; - scop_p scop; - - FOR_EACH_VEC_ELT (*scops, i, scop) - { - int j; - loop_p loop; - sese region = SCOP_REGION (scop); - build_sese_loop_nests (region); - - FOR_EACH_VEC_ELT (SESE_LOOP_NEST (region), j, loop) - if (!loop_in_sese_p (loop_outer (loop), region) - && single_exit (loop)) - { - sd_region open_scop; - open_scop.entry = loop->header; - open_scop.exit = single_exit (loop)->dest; - - /* This is a hack on top of the limit_scops hack. The - limit_scops hack should disappear all together. */ - if (single_succ_p (open_scop.exit) - && contains_only_close_phi_nodes (open_scop.exit)) - open_scop.exit = single_succ_edge (open_scop.exit)->dest; - - regions.safe_push (open_scop); - } - } - - free_scops (*scops); - scops->create (3); - - create_sese_edges (regions); - build_graphite_scops (regions, scops); -} - /* Returns true when P1 and P2 are close phis with the same argument. */ @@ -1501,10 +1376,6 @@ build_scops (vec<scop_p> *scops) create_sese_edges (regions); build_graphite_scops (regions, scops); - if (dump_file && (dump_flags & TDF_DETAILS)) - print_graphite_statistics (dump_file, *scops); - - limit_scops (scops); regions.release (); if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/match.pd b/gcc/match.pd index fb4b342d31d..bd5c267f1f8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -931,6 +931,20 @@ along with GCC; see the file COPYING3. If not see && tree_expr_nonnegative_p (@1)) @0)) +/* Optimize (x >> c) << c into x & (-1<<c). */ +(simplify + (lshift (rshift @0 INTEGER_CST@1) @1) + (if (wi::ltu_p (@1, element_precision (type))) + (bit_and @0 (lshift { build_minus_one_cst (type); } @1)))) + +/* Optimize (x << c) >> c into x & ((unsigned)-1 >> c) for unsigned + types. */ +(simplify + (rshift (lshift @0 INTEGER_CST@1) @1) + (if (TYPE_UNSIGNED (type) + && (wi::ltu_p (@1, element_precision (type)))) + (bit_and @0 (rshift { build_minus_one_cst (type); } @1)))) + (for shiftrotate (lrotate rrotate lshift rshift) (simplify (shiftrotate @0 integer_zerop) diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 36d81288c83..60c502a79a4 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6885,6 +6885,24 @@ expand_omp_for_static_nochunk (struct omp_region *region, } } +/* Return phi in E->DEST with ARG on edge E. */ + +static gphi * +find_phi_with_arg_on_edge (tree arg, edge e) +{ + basic_block bb = e->dest; + + for (gphi_iterator gpi = gsi_start_phis (bb); + !gsi_end_p (gpi); + gsi_next (&gpi)) + { + gphi *phi = gpi.phi (); + if (PHI_ARG_DEF_FROM_EDGE (phi, e) == arg) + return phi; + } + + return NULL; +} /* A subroutine of expand_omp_for. Generate code for a parallel loop with static schedule and a specified chunk size. Given @@ -6960,7 +6978,8 @@ expand_omp_for_static_chunk (struct omp_region *region, body_bb = single_succ (seq_start_bb); if (!broken_loop) { - gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb); + gcc_assert (BRANCH_EDGE (cont_bb)->dest == body_bb + || single_succ (BRANCH_EDGE (cont_bb)->dest) == body_bb); gcc_assert (EDGE_COUNT (cont_bb->succs) == 2); trip_update_bb = split_edge (FALLTHRU_EDGE (cont_bb)); } @@ -7016,7 +7035,7 @@ expand_omp_for_static_chunk (struct omp_region *region, se->probability = REG_BR_PROB_BASE / 2000 - 1; if (gimple_in_ssa_p (cfun)) { - int dest_idx = find_edge (entry_bb, fin_bb)->dest_idx; + int dest_idx = find_edge (iter_part_bb, fin_bb)->dest_idx; for (gphi_iterator gpi = gsi_start_phis (fin_bb); !gsi_end_p (gpi); gsi_next (&gpi)) { @@ -7261,6 +7280,11 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { se = find_edge (cont_bb, body_bb); + if (se == NULL) + { + se = BRANCH_EDGE (cont_bb); + gcc_assert (single_succ (se->dest) == body_bb); + } if (gimple_omp_for_combined_p (fd->for_stmt)) { remove_edge (se); @@ -7292,7 +7316,7 @@ expand_omp_for_static_chunk (struct omp_region *region, /* When we redirect the edge from trip_update_bb to iter_part_bb, we remove arguments of the phi nodes in fin_bb. We need to create appropriate phi nodes in iter_part_bb instead. */ - se = single_pred_edge (fin_bb); + se = find_edge (iter_part_bb, fin_bb); re = single_succ_edge (trip_update_bb); vec<edge_var_map> *head = redirect_edge_var_map_vector (re); ene = single_succ_edge (entry_bb); @@ -7307,6 +7331,10 @@ expand_omp_for_static_chunk (struct omp_region *region, phi = psi.phi (); t = gimple_phi_result (phi); gcc_assert (t == redirect_edge_var_map_result (vm)); + + if (!single_pred_p (fin_bb)) + t = copy_ssa_name (t, phi); + nphi = create_phi_node (t, iter_part_bb); t = PHI_ARG_DEF_FROM_EDGE (phi, se); @@ -7318,17 +7346,33 @@ expand_omp_for_static_chunk (struct omp_region *region, t = vextra; add_phi_arg (nphi, t, ene, locus); locus = redirect_edge_var_map_location (vm); - add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus); + tree back_arg = redirect_edge_var_map_def (vm); + add_phi_arg (nphi, back_arg, re, locus); + edge ce = find_edge (cont_bb, body_bb); + if (ce == NULL) + { + ce = BRANCH_EDGE (cont_bb); + gcc_assert (single_succ (ce->dest) == body_bb); + ce = single_succ_edge (ce->dest); + } + gphi *inner_loop_phi = find_phi_with_arg_on_edge (back_arg, ce); + gcc_assert (inner_loop_phi != NULL); + add_phi_arg (inner_loop_phi, gimple_phi_result (nphi), + find_edge (seq_start_bb, body_bb), locus); + + if (!single_pred_p (fin_bb)) + add_phi_arg (phi, gimple_phi_result (nphi), se, locus); } - gcc_assert (gsi_end_p (psi) && i == head->length ()); + gcc_assert (gsi_end_p (psi) && (head == NULL || i == head->length ())); redirect_edge_var_map_clear (re); - while (1) - { - psi = gsi_start_phis (fin_bb); - if (gsi_end_p (psi)) - break; - remove_phi_node (&psi, false); - } + if (single_pred_p (fin_bb)) + while (1) + { + psi = gsi_start_phis (fin_bb); + if (gsi_end_p (psi)) + break; + remove_phi_node (&psi, false); + } /* Make phi node for trip. */ phi = create_phi_node (trip_main, iter_part_bb); @@ -7351,14 +7395,24 @@ expand_omp_for_static_chunk (struct omp_region *region, if (!broken_loop) { + struct loop *loop = body_bb->loop_father; struct loop *trip_loop = alloc_loop (); trip_loop->header = iter_part_bb; trip_loop->latch = trip_update_bb; add_loop (trip_loop, iter_part_bb->loop_father); + if (loop != entry_bb->loop_father) + { + gcc_assert (loop->header == body_bb); + gcc_assert (loop->latch == region->cont + || single_pred (loop->latch) == region->cont); + trip_loop->inner = loop; + return; + } + if (!gimple_omp_for_combined_p (fd->for_stmt)) { - struct loop *loop = alloc_loop (); + loop = alloc_loop (); loop->header = body_bb; if (collapse_bb == NULL) loop->latch = cont_bb; diff --git a/gcc/optabs.c b/gcc/optabs.c index e533e6efb36..79c6f06b991 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -1608,6 +1608,15 @@ expand_binop (machine_mode mode, optab binoptab, rtx op0, rtx op1, if (otheroptab && optab_handler (otheroptab, mode) != CODE_FOR_nothing) { + /* The scalar may have been extended to be too wide. Truncate + it back to the proper size to fit in the broadcast vector. */ + machine_mode inner_mode = GET_MODE_INNER (mode); + if (!CONST_INT_P (op1) + && (GET_MODE_BITSIZE (inner_mode) + < GET_MODE_BITSIZE (GET_MODE (op1)))) + op1 = force_reg (inner_mode, + simplify_gen_unary (TRUNCATE, inner_mode, op1, + GET_MODE (op1))); rtx vop1 = expand_vector_broadcast (mode, op1); if (vop1) { diff --git a/gcc/params-list.h b/gcc/params-list.h new file mode 100644 index 00000000000..ee33ef52b36 --- /dev/null +++ b/gcc/params-list.h @@ -0,0 +1,23 @@ +/* File used to generate params.list + Copyright (C) 2015 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 3, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING3. If not see +<http://www.gnu.org/licenses/>. */ + +#define DEFPARAM(enumerator, option, nocmsgid, default, min, max) \ + enumerator, +#include "params.def" +#undef DEFPARAM diff --git a/gcc/params.def b/gcc/params.def index a7291feb2b6..7d240d29b4f 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -868,6 +868,11 @@ DEFPARAM (PARAM_GRAPHITE_MAX_BBS_PER_FUNCTION, "maximum number of basic blocks per function to be analyzed by Graphite", 100, 0, 0) +DEFPARAM (PARAM_MAX_ISL_OPERATIONS, + "max-isl-operations", + "maximum number of ISL operations, 0 means unlimited", + 350000, 0, 0) + /* Avoid data dependence analysis on very large loops. */ DEFPARAM (PARAM_LOOP_MAX_DATAREFS_FOR_DATADEPS, "loop-max-datarefs-for-datadeps", @@ -1159,6 +1164,11 @@ DEFPARAM (PARAM_MAX_FSM_THREAD_PATHS, "max-fsm-thread-paths", "Maximum number of new jump thread paths to create for a finite state automaton", 50, 1, 999999) + +DEFPARAM (PARAM_PARLOOPS_CHUNK_SIZE, + "parloops-chunk-size", + "Chunk size of omp schedule for loops parallelized by parloops", + 0, 0, 0) /* Local variables: diff --git a/gcc/params.h b/gcc/params.h index f53426dfea6..9f7618ac1d1 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -81,10 +81,7 @@ extern void set_param_value (const char *name, int value, enum compiler_param { -#define DEFPARAM(enumerator, option, nocmsgid, default, min, max) \ - enumerator, -#include "params.def" -#undef DEFPARAM +#include "params.list" LAST_PARAM }; diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h index 6e8a300fbeb..36d4e37a0d2 100644 --- a/gcc/pretty-print.h +++ b/gcc/pretty-print.h @@ -187,7 +187,7 @@ struct pp_wrapping_mode_t /* Get or set the wrapping mode as a single entity. */ #define pp_wrapping_mode(PP) (PP)->wrapping -/* The type of a hook that formats client-specific data onto a pretty_pinter. +/* The type of a hook that formats client-specific data onto a pretty_printer. A client-supplied formatter returns true if everything goes well, otherwise it returns false. */ typedef bool (*printer_fn) (pretty_printer *, text_info *, const char *, diff --git a/gcc/reload1.c b/gcc/reload1.c index ad243e321d1..c7cc37bc94f 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -3636,6 +3636,8 @@ eliminate_regs_in_insn (rtx_insn *insn, int replace) eliminations in its operands and record cases where eliminating a reg with an invariant equivalence would add extra cost. */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wmaybe-uninitialized" static void elimination_costs_in_insn (rtx_insn *insn) { @@ -3785,6 +3787,7 @@ elimination_costs_in_insn (rtx_insn *insn) return; } +#pragma GCC diagnostic pop /* Loop through all elimination pairs. Recalculate the number not at initial offset. diff --git a/gcc/sese.c b/gcc/sese.c index 2dedd9516b6..3b716f54e1a 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -267,6 +267,7 @@ new_sese (edge entry, edge exit) SESE_LOOP_NEST (region).create (3); SESE_ADD_PARAMS (region) = true; SESE_PARAMS (region).create (3); + region->parameter_rename_map = new parameter_rename_map_t; return region; } @@ -281,6 +282,8 @@ free_sese (sese region) SESE_PARAMS (region).release (); SESE_LOOP_NEST (region).release (); + delete region->parameter_rename_map; + region->parameter_rename_map = NULL; XDELETE (region); } @@ -294,6 +297,7 @@ sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e) create_new_def_for (use, phi, gimple_phi_result_ptr (phi)); add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION); add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION); + update_stmt (phi); } /* Insert in the block BB phi nodes for variables defined in REGION @@ -373,12 +377,19 @@ get_rename (rename_map_type *rename_map, tree old_name) /* Register in RENAME_MAP the rename tuple (OLD_NAME, EXPR). */ static void -set_rename (rename_map_type *rename_map, tree old_name, tree expr) +set_rename (rename_map_type *rename_map, tree old_name, tree expr, sese region) { if (old_name == expr) return; rename_map->put (old_name, expr); + + tree t; + int i; + /* For a parameter of a scop we dont want to rename it. */ + FOR_EACH_VEC_ELT (SESE_PARAMS (region), i, t) + if (old_name == t) + region->parameter_rename_map->put(old_name, expr); } /* Renames the scalar uses of the statement COPY, using the @@ -484,7 +495,7 @@ rename_uses (gimple copy, rename_map_type *rename_map, recompute_tree_invariant_for_addr_expr (rhs); } - set_rename (rename_map, old_name, new_expr); + set_rename (rename_map, old_name, new_expr, region); } return changed; @@ -525,6 +536,14 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, && scev_analyzable_p (lhs, region)) continue; + /* Do not copy parameters that have been generated in the header of the + scop. */ + if (is_gimple_assign (stmt) + && (lhs = gimple_assign_lhs (stmt)) + && TREE_CODE (lhs) == SSA_NAME + && region->parameter_rename_map->get(lhs)) + continue; + /* Create a new copy of STMT and duplicate STMT's virtual operands. */ copy = gimple_copy (stmt); @@ -539,7 +558,7 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, { tree old_name = DEF_FROM_PTR (def_p); tree new_name = create_new_def_for (old_name, copy, def_p); - set_rename (rename_map, old_name, new_name); + set_rename (rename_map, old_name, new_name, region); } if (rename_uses (copy, rename_map, &gsi_tgt, region, loop, iv_map, @@ -549,6 +568,25 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, fold_stmt_inplace (&gsi_tgt); } + /* For each SSA_NAME in the parameter_rename_map rename their usage. */ + ssa_op_iter iter; + use_operand_p use_p; + if (!is_gimple_debug (copy)) + FOR_EACH_SSA_USE_OPERAND (use_p, copy, iter, SSA_OP_USE) + { + tree old_name = USE_FROM_PTR (use_p); + + if (TREE_CODE (old_name) != SSA_NAME + || SSA_NAME_IS_DEFAULT_DEF (old_name)) + continue; + + tree *new_expr = region->parameter_rename_map->get (old_name); + if (!new_expr) + continue; + + replace_exp (use_p, *new_expr); + } + update_stmt (copy); } } @@ -722,6 +760,35 @@ set_ifsese_condition (ifsese if_region, tree condition) gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT); } +/* Return false if T is completely defined outside REGION. */ + +static bool +invariant_in_sese_p_rec (tree t, sese region) +{ + ssa_op_iter iter; + use_operand_p use_p; + if (!defined_in_sese_p (t, region)) + return true; + + gimple stmt = SSA_NAME_DEF_STMT (t); + + if (gimple_code (stmt) == GIMPLE_PHI + || gimple_code (stmt) == GIMPLE_CALL) + return false; + + FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) + { + tree use = USE_FROM_PTR (use_p); + if (!defined_in_sese_p (use, region)) + continue; + + if (!invariant_in_sese_p_rec (use, region)) + return false; + } + + return true; +} + /* Returns the scalar evolution of T in REGION. Every variable that is not defined in the REGION is considered a parameter. */ @@ -752,6 +819,9 @@ scalar_evolution_in_region (sese region, loop_p loop, tree t) t = compute_overall_effect_of_inner_loop (def_loop, t); return t; } - else - return instantiate_scev (before, loop, t); + + if (invariant_in_sese_p_rec (t, region)) + return t; + + return instantiate_scev (before, loop, t); } diff --git a/gcc/sese.h b/gcc/sese.h index 52aa8688cbf..b025a4dd821 100644 --- a/gcc/sese.h +++ b/gcc/sese.h @@ -22,6 +22,8 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_SESE_H #define GCC_SESE_H +typedef hash_map<tree, tree> parameter_rename_map_t; + /* A Single Entry, Single Exit region is a part of the CFG delimited by two edges. */ typedef struct sese_s @@ -32,6 +34,9 @@ typedef struct sese_s /* Parameters used within the SCOP. */ vec<tree> params; + /* Parameters to be renamed. */ + parameter_rename_map_t *parameter_rename_map; + /* Loops completely contained in the SCOP. */ bitmap loops; vec<loop_p> loop_nest; diff --git a/gcc/shrink-wrap.c b/gcc/shrink-wrap.c index c90c40a2429..d10795a0b3a 100644 --- a/gcc/shrink-wrap.c +++ b/gcc/shrink-wrap.c @@ -420,7 +420,7 @@ move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn, to call-saved registers because their values are live across one or more calls during the function. */ -void +static void prepare_shrink_wrap (basic_block entry_block) { rtx_insn *insn, *curr; @@ -465,7 +465,7 @@ prepare_shrink_wrap (basic_block entry_block) /* Create a copy of BB instructions and insert at BEFORE. Redirect preds of BB to COPY_BB if they don't appear in NEED_PROLOGUE. */ -void +static void dup_block_and_redirect (basic_block bb, basic_block copy_bb, rtx_insn *before, bitmap_head *need_prologue) { diff --git a/gcc/shrink-wrap.h b/gcc/shrink-wrap.h index dda9b926f5c..681990134f5 100644 --- a/gcc/shrink-wrap.h +++ b/gcc/shrink-wrap.h @@ -24,10 +24,6 @@ along with GCC; see the file COPYING3. If not see /* In shrink-wrap.c. */ extern bool requires_stack_frame_p (rtx_insn *, HARD_REG_SET, HARD_REG_SET); -extern void prepare_shrink_wrap (basic_block entry_block); -extern void dup_block_and_redirect (basic_block bb, basic_block copy_bb, - rtx_insn *before, - bitmap_head *need_prologue); extern void try_shrink_wrapping (edge *entry_edge, edge orig_entry_edge, bitmap_head *bb_flags, rtx_insn *prologue_seq); extern edge get_unconverted_simple_return (edge, bitmap_head, diff --git a/gcc/system.h b/gcc/system.h index 9ca5b5fadd3..1cc5d408df0 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -307,7 +307,7 @@ extern int errno; /* The outer cast is needed to work around a bug in Cray C 5.0.3.0. It is necessary at least when t == time_t. */ #define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \ - ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) + ? (t) 1 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) #define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t))) /* Use that infrastructure to provide a few constants. */ @@ -465,6 +465,10 @@ extern char *getwd (char *); extern void *sbrk (int); #endif +#if defined (HAVE_DECL_SETENV) && !HAVE_DECL_SETENV +int setenv(const char *, const char *, int); +#endif + #if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR extern char *strstr (const char *, const char *); #endif @@ -473,6 +477,10 @@ extern char *strstr (const char *, const char *); extern char *stpcpy (char *, const char *); #endif +#if defined (HAVE_DECL_UNSETENV) && !HAVE_DECL_UNSETENV +int unsetenv(const char *); +#endif + #ifdef __cplusplus } #endif diff --git a/gcc/target.def b/gcc/target.def index 4edc209c464..aa5a1f1b193 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -1801,6 +1801,18 @@ loads.", (const_tree mem_vectype, const_tree index_type, int scale), NULL) +/* Target builtin that implements vector scatter operation. */ +DEFHOOK +(builtin_scatter, +"Target builtin that implements vector scatter operation. @var{vectype}\n\ +is the vector type of the store and @var{index_type} is scalar type of\n\ +the index, scaled by @var{scale}.\n\ +The default is @code{NULL_TREE} which means to not vectorize scatter\n\ +stores.", + tree, + (const_tree vectype, const_tree index_type, int scale), + NULL) + /* Target function to initialize the cost model for a loop or block. */ DEFHOOK (init_cost, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e4de51f671..f75a579bc04 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,384 @@ +2015-09-11 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc.dg/pie-link.c: Add -pie to dg-options. + +2015-09-11 Alex Velenko <Alex.Velenko@arm.com> + + * gcc.target/arm/pr63210.c (dg-skip-if): Skip armv4t. + (dg-additional-options): Add -march=armv5t if arm_arch_v5t_ok. + +2015-09-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/swaps-p8-20.c: New test. + * gcc.target/powerpc/swaps-p8-21.c: New test. + +2015-09-10 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/67526 + * gfortran.dg/pr67526.f90: New test. + +2015-09-10 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67318 + * g++.dg/cpp0x/variadic166.C: New. + +2015-09-09 Mark Wielaard <mjw@redhat.com> + + * c-c++-common/nonnull-1.c: New test. + +2015-09-10 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/66993 + * gfortran.dg/submodule_11.f08: New test. + +2015-09-10 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/67506 + * gcc.c-torture/compile/pr67506.c: New test. + +2015-09-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * gcc.target/s390/vector/vec-genbytemask-1.c: Add check for V1TI + initialization with a byte mask. No change expected here. + * gcc.target/s390/vector/vec-genmask-1.c: Fix whitespace. + * gcc.target/s390/vector/vec-genmask-2.c: Add check for V1TI + initialization with contigious bitmask. Literal pool is expectd + to be used here. + +2015-09-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/67439 + * gcc.target/arm/pr67439_1.c: New test. + +2015-09-10 Jiong Wang <jiong.wang@arm.com> + + * gcc.target/aarch64/pic-small.c (dg-skip-if): Skip tiny and large code + model. + +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c++/67523 + * g++.dg/gomp/pr67523.C: New test. + + PR c++/67522 + * g++.dg/gomp/pr67522.C: New test. + + PR middle-end/67521 + * c-c++-common/gomp/pr67521.c: New test. + + PR middle-end/67517 + * c-c++-common/gomp/pr67517.c: New test. + + PR c++/67514 + * g++.dg/gomp/pr67514.C: New test. + + PR c++/67511 + * g++.dg/gomp/pr67511.C: New test. + + PR c/67502 + * c-c++-common/gomp/pr67502.c: New test. + +2015-09-09 Marek Polacek <polacek@redhat.com> + + PR middle-end/67512 + * gcc.dg/pr67512.c: New test. + +2015-09-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53184 + * g++.dg/warn/Wsubobject-linkage-1.C: New. + * g++.dg/warn/Wsubobject-linkage-2.C: Likewise. + * g++.dg/warn/Wsubobject-linkage-3.C: Likewise. + * g++.dg/warn/Wsubobject-linkage-4.C: Likewise. + +2015-09-09 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + * gcc.target/aarch64/mod_2.x: New file. + * gcc.target/aarch64/mod_256.x: Likewise. + * gcc.target/arm/mod_2.c: New test. + * gcc.target/arm/mod_256.c: Likewise. + * gcc.target/aarch64/mod_2.c: Likewise. + * gcc.target/aarch64/mod_256.c: Likewise. + +2015-09-09 Jakub Jelinek <jakub@redhat.com> + + PR c++/67504 + * g++.dg/gomp/pr67504.C: New test. + + PR c/67501 + * c-c++-common/gomp/pr67501.c: New test. + + PR c/67500 + * gcc.dg/gomp/pr67500.c: New test. + + PR c/67495 + * gcc.dg/gomp/pr67495.c: New test. + +2015-09-09 Aditya Kumar <hiraditya@msn.com> + Sebastian Pop <s.pop@samsung.com> + + PR tree-optimization/53852 + * gcc.dg/graphite/uns-interchange-12.c: Adjust pattern to pass with + both isl-0.12 and isl-0.15. + * gcc.dg/graphite/uns-interchange-14.c: Same. + * gcc.dg/graphite/uns-interchange-15.c: Same. + * gcc.dg/graphite/uns-interchange-mvt.c: Same. + +2015-09-08 Aditya Kumar <hiraditya@msn.com> + Sebastian Pop <s.pop@samsung.com> + + * gcc.dg/graphite/block-0.c: Modifed test case to match current output. + * gcc.dg/graphite/block-1.c: Same. + * gcc.dg/graphite/block-5.c: Same. + * gcc.dg/graphite/block-6.c: Same. + * gcc.dg/graphite/interchange-1.c: Same. + * gcc.dg/graphite/interchange-10.c: Same. + * gcc.dg/graphite/interchange-11.c: Same. + * gcc.dg/graphite/interchange-13.c: Same. + * gcc.dg/graphite/interchange-14.c: Same. + * gcc.dg/graphite/interchange-3.c: Same. + * gcc.dg/graphite/interchange-4.c: Same. + * gcc.dg/graphite/interchange-7.c: Same. + * gcc.dg/graphite/interchange-8.c: Same. + * gcc.dg/graphite/interchange-9.c: Same. + * gcc.dg/graphite/isl-codegen-loop-dumping.c: Same. + * gcc.dg/graphite/pr35356-1.c (foo): Same. + * gcc.dg/graphite/pr37485.c: Same. + * gcc.dg/graphite/scop-0.c (int toto): Same. + * gcc.dg/graphite/scop-1.c: Same. + * gcc.dg/graphite/scop-10.c: Same. + * gcc.dg/graphite/scop-11.c: Same. + * gcc.dg/graphite/scop-12.c: Same. + * gcc.dg/graphite/scop-13.c: Same. + * gcc.dg/graphite/scop-16.c: Same. + * gcc.dg/graphite/scop-17.c: Same. + * gcc.dg/graphite/scop-18.c: Same. + * gcc.dg/graphite/scop-2.c: Same. + * gcc.dg/graphite/scop-21.c (int test): Same. + * gcc.dg/graphite/scop-22.c (void foo): Same. + * gcc.dg/graphite/scop-4.c: Same. + * gcc.dg/graphite/scop-5.c: Same. + * gcc.dg/graphite/scop-6.c: Same. + * gcc.dg/graphite/scop-7.c: Same. + * gcc.dg/graphite/scop-8.c: Same. + * gcc.dg/graphite/scop-9.c: Same. + * gcc.dg/graphite/scop-mvt.c (void mvt): Introduced dependency so that + data-refs remain inside the inner loop. + * gcc.dg/graphite/uns-block-1.c: Modifed test case to match o/p. + * gcc.dg/graphite/uns-interchange-14.c: Same. + * gcc.dg/graphite/uns-interchange-9.c: Same. + * gfortran.dg/graphite/interchange-3.f90 + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + PR target/63870 + * gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vld3_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vld4_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst2_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst3_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst4_lane_f16_indices_1.c: New. + * gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_f16_indices_1.c: New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * gcc.target/aarch64/advsimd-intrinsics/vcvt_f16.c: New. + * lib/target-supports.exp + (check_effective_target_arm_neon_fp16_hw): New. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: + Set additional_flags for neon-fp16 if supported, else fallback to neon. + + * gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h + (hfloat16_t): New. + (result, expected, clean_results, DECL_VARIABLE_64BITS_VARIANTS, + DECL_VARIABLE_128BITS_VARIANTS): Add float16x4_t and float16x8_t cases + if supported. + (CHECK_RESULTS): Redefine using CHECK_RESULTS_NAMED. + (CHECK_RESULTS_NAMED): Move body to CHECK_RESULTS_NAMED_NO_FP16; + redefine in terms of CHECK_RESULTS_NAMED_NO_FP16 with float16 variants + when those are supported. + (CHECK_RESULTS_NAMED_NO_FP16, CHECK_RESULTS_NO_FP16): New. + (vdup_n_f16): New. + + * gcc.target/aarch64/advsimd-intrinsics/compute-ref-data.h (buffer, + buffer_pad, buffer_dup, buffer_dup_pad): Add float16x4 and float16x8_t + cases if supported. + + * gcc.target/aarch64/advsimd-intrinsics/vbsl.c (exec_vbsl): + Use CHECK_RESULTS_NO_FP16 in place of CHECK_RESULTS. + * gcc.target/aarch64/advsimd-intrinsics/vdup-vmov.c (exec_vdup_vmov): + Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vdup_lane.c (exec_vdup_lane): + Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vext.c (exec_vext): Likewise. + + * gcc.target/aarch64/advsimd-intrinsics/vcombine.c (expected): + Add float16x8_t case. + (main, exec_vcombine): test float16x4_t -> float16x8_t, if supported. + * gcc.target/aarch64/advsimd-intrinsics/vcreate.c (expected, + main, exec_vcreate): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vget_high (expected, + exec_vget_high): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vget_low.c (expected, + exec_vget_low): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vld1.c (expected, exec_vld1): + Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vld1_dup.c (expected, + exec_vld1_dup): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vld1_lane.c (expected, + exec_vld1_lane): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vldX.c (expected, exec_vldX): + Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c (expected, + exec_vldX_dup): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c (expected, + exec_vldX_lane): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vset_lane.c (expected, + exec_vset_lane): Likewise. + * gcc.target/aarch64/advsimd-intrinsics/vst1_lane.c (expected, + exec_vst1_lane): Likewise. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * gcc.target/aarch64/vget_high_1.c: Add float16x8->float16x4 case. + * gcc.target/aarch64/vget_low_1.c: Likewise. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * gcc.target/aarch64/vldN_1.c: Add float16x4_t and float16x8_t cases. + * gcc.target/aarch64/vldN_dup_1.c: Likewise. + * gcc.target/aarch64/vldN_lane_1.c: Likewise. + (main): update orig_data to avoid float16 NaN on bigendian. + +2015-09-08 Alan Lawrence <alan.lawrence@arm.com> + + * g++.dg/abi/mangle-neon-aarch64.C: Add cases for float16x4_t and + float16x8_t. + * gcc.target/aarch64/vset_lane_1.c: Likewise. + * gcc.target/aarch64/vld1-vst1_1.c: Likewise. + * gcc.target/aarch64/vld1_lane.c: Likewise. + +2015-09-08 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/67369 + * g++.dg/cpp1y/lambda-generic-ice4.C: New. + +2015-09-07 Marek Polacek <polacek@redhat.com> + + PR inline-asm/67448 + * gcc.dg/asm-10.c: New test. + +2015-09-04 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/67452 + * gcc.dg/lto/pr67452_0.c: New test. + +2015-09-02 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> + + PR target/65210 + * gcc.target/avr/pr65210.c: New test. + +2015-09-04 H.J. Lu <hongjiu.lu@intel.com> + + PR testsuite/67450 + * lib/target-supports.exp (check_cached_effective_target): + Apppend $prop to et_prop_list only if needed. + +2015-09-04 Marek Polacek <polacek@redhat.com> + + PR sanitizer/67279 + * gcc.dg/ubsan/pr67279.c: New test. + +2015-09-04 Andrey Turetskiy <andrey.turetskiy@intel.com> + Petr Murzin <petr.murzin@intel.com> + Kirill Yukhin <kirill.yukhin@intel.com> + + * gcc.target/i386/avx512f-scatter-1.c: New. + * gcc.target/i386/avx512f-scatter-2.c: Ditto. + * gcc.target/i386/avx512f-scatter-3.c: Ditto. + +2015-09-04 Janne Blomqvist <jb@gcc.gnu.org> + + * gfortran.dg/read_dir.f90: Delete empty directory when closing + rather than calling rmdir, cleanup if open fails. + +2015-09-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com> + + * gcc.target/powerpc/vec-mult-char-1.c: New test. + * gcc.target/powerpc/vec-mult-char-2.c: New test. + * lib/target-supports.exp (check_effective_target_vect_char_mult): + Return true for PowerPC targets that implement Altivec. + +2015-09-03 Renlin Li <renlin.li@arm.com> + + * gcc.target/aarch64/arm_align_max_pwr.c: Make it a compile test case, + check the assembly. + * gcc.target/aarch64/arm_align_max_stack_pwr.c: Likewise. + +2015-09-03 Martin Sebor <msebor@redhat.com> + + PR c/66516 + * g++.dg/addr_builtin-1.C: New test. + * gcc.dg/addr_builtin-1.c: New test. + +2015-09-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/vec-shift.c: New test. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * gcc.dg/autopar/reduc-4.c: New test. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * gcc.dg/autopar/pr46099-2.c: New test. + +2015-09-03 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> + + PR middle-end/67351 + * g++.dg/pr67351.C: New test. + +2015-09-03 Richard Biener <rguenther@suse.de> + + PR ipa/66705 + * g++.dg/lto/pr66705_0.C: New testcase. + +2015-09-02 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR middle-end/60586 + * c-c++-common/cilk-plus/CK/pr60586.c: New file. + * g++.dg/cilk-plus/CK/pr60586.cc: Likewise. + +2015-09-02 Marek Polacek <polacek@redhat.com> + + PR c/67432 + * gcc.dg/pr67432.c: New test. + +2015-09-02 Christophe Lyon <christophe.lyon@linaro.org> + + * lib/target-supports.exp (clear_effective_target_cache): New. + (check_cached_effective_target): Update et_prop_list. + * lib/asan-dg.exp (asan_finish): Call clear_effective_target_cache. + * g++.dg/compat/compat.exp: Likewise. + * g++.dg/compat/struct-layout-1.exp: Likewise. + * lib/asan-dg.exp: Likewise. + * lib/atomic-dg.exp: Likewise. + * lib/cilk-plus-dg.exp: Likewise. + * lib/clearcap.exp: Likewise. + * lib/mpx-dg.exp: Likewise. + * lib/tsan-dg.exp: Likewise. + * lib/ubsan-dg.exp: Likewise. + 2015-09-01 Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.c-torture/execute/ieee/20000320-1.c Fixed misplaced test case. @@ -128,7 +509,7 @@ 2015-08-28 Andrew Bennett <andrew.bennett@imgtec.com> - * gcc.target/mips/madd-8.c: Add lo register to clobber list. + * gcc.target/mips/madd-8.c: Add lo register to clobber list. * gcc.target/mips/msub-8.c: Ditto 2015-08-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> diff --git a/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60586.c b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60586.c new file mode 100644 index 00000000000..c4012a0a4b1 --- /dev/null +++ b/gcc/testsuite/c-c++-common/cilk-plus/CK/pr60586.c @@ -0,0 +1,28 @@ +/* { dg-do run { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-fcilkplus -O2" } */ +/* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */ + +int noop(int x) +{ + return x; +} + +int post_increment(int *x) +{ + return (*x)++; +} + +int main(int argc, char *argv[]) +{ + int m = 5; + int n = m; + int r = _Cilk_spawn noop(post_increment(&n)); + int n2 = n; + _Cilk_sync; + + if (r != m || n2 != m + 1) + return 1; + else + return 0; +} + diff --git a/gcc/testsuite/c-c++-common/gomp/pr67501.c b/gcc/testsuite/c-c++-common/gomp/pr67501.c new file mode 100644 index 00000000000..8a7140faf28 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67501.c @@ -0,0 +1,12 @@ +/* PR c/67501 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (void) +{ + int i, j; + #pragma omp for simd copyprivate(j /* { dg-error "before end of line" } */ + for (i = 0; i < 16; ++i) /* { dg-error "is not valid for" "" { target *-*-* } 9 } */ + ; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67502.c b/gcc/testsuite/c-c++-common/gomp/pr67502.c new file mode 100644 index 00000000000..74fef4d9123 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67502.c @@ -0,0 +1,16 @@ +/* PR c/67502 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ +/* { dg-additional-options "-std=c99" { target c } } */ + +void bar (int, int); + +void +foo (void) +{ +#pragma omp parallel +#pragma omp for simd collapse(2) + for (int i = 0; i < 16; ++i) + for (int j = 0; j < 16; ++j) + bar (i, j); +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67517.c b/gcc/testsuite/c-c++-common/gomp/pr67517.c new file mode 100644 index 00000000000..3055ffb34eb --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67517.c @@ -0,0 +1,13 @@ +/* PR middle-end/67517 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +foo (int x, int y, int z) +{ + int i; + #pragma omp parallel for simd linear (y : x & 15) linear (x : 16) linear (z : x & 15) + for (i = 0; i < 256; ++i) + x += 16, y += x & 15, z += x & 15; + return x + y + z; +} diff --git a/gcc/testsuite/c-c++-common/gomp/pr67521.c b/gcc/testsuite/c-c++-common/gomp/pr67521.c new file mode 100644 index 00000000000..b34c117ae32 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr67521.c @@ -0,0 +1,20 @@ +/* PR middle-end/67521 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (int x) +{ + int i = 0; + #pragma omp parallel for simd + for (i = (i & x); i < 10; i = i + 2) + ; + i = 0; + #pragma omp parallel for simd + for (i = 0; i < (i & x) + 10; i = i + 2) + ; + i = 0; + #pragma omp parallel for simd + for (i = 0; i < 10; i = i + ((i & x) + 2)) + ; +} diff --git a/gcc/testsuite/c-c++-common/nonnull-1.c b/gcc/testsuite/c-c++-common/nonnull-1.c new file mode 100644 index 00000000000..b5c3d7f8866 --- /dev/null +++ b/gcc/testsuite/c-c++-common/nonnull-1.c @@ -0,0 +1,28 @@ +/* Test for the bad usage of "nonnull" function attribute parms. */ +/* */ +/* { dg-do compile } */ +/* { dg-options "-Wnonnull" } */ + +#include <stddef.h> +#include <stdlib.h> + +void foo(void *bar) __attribute__((nonnull(1))); + +void foo(void *bar) { if (!bar) abort(); } /* { dg-warning "nonnull argument" "bar compared to NULL" } */ + +extern int func (char *, char *, char *, char *) __attribute__((nonnull)); + +int +func (char *cp1, char *cp2, char *cp3, char *cp4) +{ + if (cp1) /* { dg-warning "nonnull argument" "cp1 compared to NULL" } */ + return 1; + + if (cp2 == NULL) /* { dg-warning "nonnull argument" "cp2 compared to NULL" } */ + return 2; + + if (NULL != cp3) /* { dg-warning "nonnull argument" "cp3 compared to NULL" } */ + return 3; + + return (cp4 != 0) ? 0 : 1; /* { dg-warning "nonnull argument" "cp4 compared to NULL" } */ +} diff --git a/gcc/testsuite/g++.dg/abi/mangle-neon-aarch64.C b/gcc/testsuite/g++.dg/abi/mangle-neon-aarch64.C index 09a20dc985e..5740c0281b2 100644 --- a/gcc/testsuite/g++.dg/abi/mangle-neon-aarch64.C +++ b/gcc/testsuite/g++.dg/abi/mangle-neon-aarch64.C @@ -13,6 +13,7 @@ void f3 (uint8x8_t a) {} void f4 (uint16x4_t a) {} void f5 (uint32x2_t a) {} void f23 (uint64x1_t a) {} +void f61 (float16x4_t a) {} void f6 (float32x2_t a) {} void f7 (poly8x8_t a) {} void f8 (poly16x4_t a) {} @@ -25,6 +26,7 @@ void f13 (uint8x16_t a) {} void f14 (uint16x8_t a) {} void f15 (uint32x4_t a) {} void f16 (uint64x2_t a) {} +void f171 (float16x8_t a) {} void f17 (float32x4_t a) {} void f18 (float64x2_t a) {} void f19 (poly8x16_t a) {} @@ -42,6 +44,7 @@ void g1 (int8x16_t, int8x16_t) {} // { dg-final { scan-assembler "_Z2f412__Uint16x4_t:" } } // { dg-final { scan-assembler "_Z2f512__Uint32x2_t:" } } // { dg-final { scan-assembler "_Z3f2312__Uint64x1_t:" } } +// { dg-final { scan-assembler "_Z3f6113__Float16x4_t:" } } // { dg-final { scan-assembler "_Z2f613__Float32x2_t:" } } // { dg-final { scan-assembler "_Z2f711__Poly8x8_t:" } } // { dg-final { scan-assembler "_Z2f812__Poly16x4_t:" } } @@ -53,6 +56,7 @@ void g1 (int8x16_t, int8x16_t) {} // { dg-final { scan-assembler "_Z3f1412__Uint16x8_t:" } } // { dg-final { scan-assembler "_Z3f1512__Uint32x4_t:" } } // { dg-final { scan-assembler "_Z3f1612__Uint64x2_t:" } } +// { dg-final { scan-assembler "_Z4f17113__Float16x8_t:" } } // { dg-final { scan-assembler "_Z3f1713__Float32x4_t:" } } // { dg-final { scan-assembler "_Z3f1813__Float64x2_t:" } } // { dg-final { scan-assembler "_Z3f1912__Poly8x16_t:" } } diff --git a/gcc/testsuite/g++.dg/cilk-plus/CK/pr60586.cc b/gcc/testsuite/g++.dg/cilk-plus/CK/pr60586.cc new file mode 100644 index 00000000000..6a27cade876 --- /dev/null +++ b/gcc/testsuite/g++.dg/cilk-plus/CK/pr60586.cc @@ -0,0 +1,89 @@ +/* { dg-options "-fcilkplus" } */ +/* { dg-do run { target i?86-*-* x86_64-*-* arm*-*-* } } */ +/* { dg-options "-fcilkplus -lcilkrts" { target { i?86-*-* x86_64-*-* arm*-*-* } } } */ + +class Rectangle +{ + int area_val, h, w; + public: + Rectangle (int, int); + Rectangle (int, int, int); + ~Rectangle (); + int area (); +}; +Rectangle::~Rectangle () +{ + h = 0; + w = 0; + area_val = 0; +} +Rectangle::Rectangle (int height, int width) +{ + h = height; + w = width; + area_val = 0; +} + +int some_func(int &x) +{ + x++; + return x; +} + +Rectangle::Rectangle (int height, int width, int area_orig) +{ + h = height; + w = width; + area_val = area_orig; +} + +int Rectangle::area() +{ + return (area_val += (h*w)); +} + + +int some_func (int &); + +/* Spawning constructor. */ +int main1 (void) +{ + int x = 3; + Rectangle r = _Cilk_spawn Rectangle (some_func(x), 3); + return r.area(); +} + +/* Spawning constructor 2. */ +int main2 (void) +{ + Rectangle r (_Cilk_spawn Rectangle (4, 3)); + return r.area(); +} + +/* Spawning copy constructor. */ +int main3 (void) +{ + int x = 3; + Rectangle r = _Cilk_spawn Rectangle (some_func(x), 3, 2); + return r.area (); +} + +/* Spawning copy constructor 2. */ +int main4 (void) +{ + Rectangle r ( _Cilk_spawn Rectangle (4, 3, 2)); + return r.area(); +} + +int main (void) +{ + if (main1 () != 12) + __builtin_abort (); + if (main2 () != 12) + __builtin_abort (); + if (main3 () != 14) + __builtin_abort (); + if (main4() != 14) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic166.C b/gcc/testsuite/g++.dg/cpp0x/variadic166.C new file mode 100644 index 00000000000..91455cbf037 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic166.C @@ -0,0 +1,14 @@ +// PR c++/67318 +// { dg-do compile { target c++11 } } + +template<signed...> +struct MyStruct1; + +template<unsigned...> +struct MyStruct2; + +template<short...> +struct MyStruct3; + +template<long...> +struct MyStruct4; diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C new file mode 100644 index 00000000000..ec4db83b6e4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C @@ -0,0 +1,10 @@ +// PR c++/67369 +// { dg-do compile { target c++14 } } + +int main() { + unsigned const nsz = 0; + auto repeat_conditional = [&](auto) { + auto new_sz = nsz; + }; + repeat_conditional(1); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-var-templ1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-var-templ1.C new file mode 100644 index 00000000000..4c2a3cb3e60 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-var-templ1.C @@ -0,0 +1,11 @@ +// PR c++/67041 +// { dg-do compile { target c++14 } } + +template<typename T> +auto test = [](){ + return T{}; +}; + +int main() { + test<int>(); +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67504.C b/gcc/testsuite/g++.dg/gomp/pr67504.C new file mode 100644 index 00000000000..0f1758b6f14 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67504.C @@ -0,0 +1,15 @@ +// PR c++/67504 +// { dg-do compile } +// { dg-options "-fopenmp" } + +int bar (int); +double bar (double); + +template <typename T> +void +foo (T x) +{ + #pragma omp for collapse (x + 1) // { dg-error "collapse argument needs positive constant integer expression" } + for (int i = 0; i < 10; i++) + ; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67511.C b/gcc/testsuite/g++.dg/gomp/pr67511.C new file mode 100644 index 00000000000..3e0e9a388f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67511.C @@ -0,0 +1,20 @@ +// PR c++/67511 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct I +{ + I (); + I (const I &); + I &operator++ (); + bool operator< (const I &) const; +}; +__PTRDIFF_TYPE__ operator- (const I &, const I &); + +void +foo (I &x, I &y) +{ +#pragma omp for + for (I i = x; i < y; ++i) // { dg-error "no match for" } + ; +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67514.C b/gcc/testsuite/g++.dg/gomp/pr67514.C new file mode 100644 index 00000000000..a631b8bfedb --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67514.C @@ -0,0 +1,30 @@ +// PR c++/67514 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template <class T> +void +foo (T x, T y) +{ + #pragma omp parallel + #pragma omp for simd + for (T i = x; i < y; ++i) + ; + #pragma omp parallel + #pragma omp for simd collapse (2) + for (T i = x; i < y; ++i) + for (T j = x; j < y; j++) + ; +} + +void +bar (int *x, int *y) +{ + foo (x, y); +} + +void +baz (int x, int y) +{ + foo (x, y); +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67522.C b/gcc/testsuite/g++.dg/gomp/pr67522.C new file mode 100644 index 00000000000..84c854afd92 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67522.C @@ -0,0 +1,26 @@ +// PR c++/67522 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct S; + +template <int N> +void +foo (void) +{ + #pragma omp simd linear (S) // { dg-error "is not a variable in clause" } + for (int i = 0; i < 16; i++) + ; + + #pragma omp target map (S[0:10]) // { dg-error "is not a variable in" } + ; + + #pragma omp task depend (inout: S[0:10]) // { dg-error "is not a variable in" } + ; +} + +void +bar () +{ + foo <0> (); +} diff --git a/gcc/testsuite/g++.dg/gomp/pr67523.C b/gcc/testsuite/g++.dg/gomp/pr67523.C new file mode 100644 index 00000000000..fb12c8c4695 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr67523.C @@ -0,0 +1,29 @@ +// PR c++/67523 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct S { int s; }; + +template <typename T> +void foo (T &x, T &y) +{ +#pragma omp for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp parallel for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp target teams distribute parallel for simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +#pragma omp target teams distribute simd + for (T i = x; i < y; i++) // { dg-error "used with class iteration variable" } + ; +} + +void +bar () +{ + S x, y; + foo <S> (x, y); +} diff --git a/gcc/testsuite/g++.dg/lto/pr66705_0.C b/gcc/testsuite/g++.dg/lto/pr66705_0.C new file mode 100644 index 00000000000..faf3f2d24c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr66705_0.C @@ -0,0 +1,15 @@ +// { dg-lto-do link } +// { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } } +// { dg-extra-ld-options "-r -nostdlib" } + +class A { +public: + A(); +}; +int a = 0; +void foo() { + a = 0; + A b; + for (; a;) + ; +} diff --git a/gcc/testsuite/g++.dg/pr67351.C b/gcc/testsuite/g++.dg/pr67351.C new file mode 100644 index 00000000000..f5bdda6cca7 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr67351.C @@ -0,0 +1,106 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +typedef unsigned char uchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long long uint64; + +class MyRgba +{ + uint rgba; + +public: + explicit MyRgba (uint c):rgba (c) + { + }; + + static MyRgba fromRgba (uchar r, uchar g, uchar b, uchar a) + { + return MyRgba (uint (r) << 24 + | uint (g) << 16 | uint (b) << 8 | uint (a)); + } + + uchar r () + { + return rgba >> 24; + } + uchar g () + { + return rgba >> 16; + } + uchar b () + { + return rgba >> 8; + } + uchar a () + { + return rgba; + } + + void setG (uchar _g) + { + *this = fromRgba (r (), _g, b (), a ()); + } +}; + +extern MyRgba giveMe (); + +MyRgba +test () +{ + MyRgba a = giveMe (); + a.setG (0xf0); + return a; +} + +class MyRgba64 +{ + uint64 rgba; + +public: + explicit MyRgba64 (uint64 c):rgba (c) + { + }; + + static MyRgba64 fromRgba64 (ushort r, ushort g, ushort b, ushort a) + { + return MyRgba64 (uint64 (r) << 48 + | uint64 (g) << 32 | uint64 (b) << 16 | uint64 (a)); + } + + ushort r () + { + return rgba >> 48; + } + ushort g () + { + return rgba >> 32; + } + ushort b () + { + return rgba >> 16; + } + ushort a () + { + return rgba; + } + + void setG (ushort _g) + { + *this = fromRgba64 (r (), _g, b (), a ()); + } +}; + +extern MyRgba64 giveMe64 (); + +MyRgba64 +test64 () +{ + MyRgba64 a = giveMe64 (); + a.setG (0xf0f0); + return a; +} + +/* { dg-final { scan-tree-dump-not "<<" "optimized" } } */ +/* { dg-final { scan-tree-dump-not ">>" "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/ubsan/vptr-10.C b/gcc/testsuite/g++.dg/ubsan/vptr-10.C new file mode 100644 index 00000000000..e05c33b90ba --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/vptr-10.C @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-options "-fsanitize=vptr -fno-sanitize-recover=vptr" } + +struct A +{ + virtual ~A() {} +}; +struct B : virtual A {}; +struct C : virtual A {}; +struct D : B, virtual C {}; + +int main() +{ + D d; +} diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-1.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-1.C new file mode 100644 index 00000000000..adcaa6dbdaf --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-1.C @@ -0,0 +1,9 @@ +// PR c++/53184 + +typedef volatile struct { } Foo; + +#line 6 "foo.C" +struct Bar { Foo foo; }; // { dg-warning "no linkage" } +// { dg-bogus "anonymous namespace" "" { target *-*-* } 6 } +struct Bar2 : Foo { }; // { dg-warning "no linkage" } +// { dg-bogus "anonymous namespace" "" { target *-*-* } 8 } diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-2.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-2.C new file mode 100644 index 00000000000..4bb255c79a1 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-2.C @@ -0,0 +1,8 @@ +// PR c++/53184 +// { dg-options "-Wno-subobject-linkage" } + +typedef volatile struct { } Foo; + +#line 7 "foo.C" +struct Bar { Foo foo; }; +struct Bar2 : Foo { }; diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C new file mode 100644 index 00000000000..e9acb633a1c --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C @@ -0,0 +1,9 @@ +// PR c++/53184 + +namespace { struct Foo { }; } + +#line 6 "foo.C" +struct Bar { Foo foo; }; // { dg-warning "anonymous namespace" } +// { dg-bogus "no linkage" "" { target *-*-* } 6 } +struct Bar2 : Foo { }; // { dg-warning "anonymous namespace" } +// { dg-bogus "no linkage" "" { target *-*-* } 8 } diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-4.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-4.C new file mode 100644 index 00000000000..033bc473005 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-4.C @@ -0,0 +1,8 @@ +// PR c++/53184 +// { dg-options "-Wno-subobject-linkage" } + +namespace { struct Foo { }; } + +#line 7 "foo.C" +struct Bar { Foo foo; }; +struct Bar2 : Foo { }; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr67506.c b/gcc/testsuite/gcc.c-torture/compile/pr67506.c new file mode 100644 index 00000000000..2826d0b3aa7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr67506.c @@ -0,0 +1,53 @@ +extern struct _IO_FILE *stderr; +typedef long integer; +typedef unsigned char byte; +short nl; +byte * tfmfilearray; +integer charbase, ligkernbase; +unsigned char charsonline; +short c; +unsigned short r; +struct { + short cc; + integer rr; +} labeltable[259]; +short sortptr; +unsigned char activity[(32510) + 1]; +integer ai, acti; +extern void _IO_putc (char, struct _IO_FILE *); + +void +mainbody (void) +{ + register integer for_end; + if (c <= for_end) + do { + if (((tfmfilearray + 1001)[4 * (charbase + c) + 2] % 4) == 1) + { + if ( r < nl ) + ; + else + { + while (labeltable[sortptr ].rr > r) + labeltable[sortptr + 1 ]= labeltable[sortptr]; + } + } + } while (c++ < for_end); + + if (ai <= for_end) + do { + if (activity[ai]== 2) + { + r = (tfmfilearray + 1001)[4 * (ligkernbase + (ai))]; + if (r < 128) + { + r = r + ai + 1 ; + if (r >= nl) + { + if (charsonline > 0) + _IO_putc ('\n', stderr); + } + } + } + } while (ai++ < for_end); +} diff --git a/gcc/testsuite/gcc.dg/asm-10.c b/gcc/testsuite/gcc.dg/asm-10.c new file mode 100644 index 00000000000..e6c03c62cab --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-10.c @@ -0,0 +1,12 @@ +/* PR inline-asm/67448 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void +f (int i) +{ + asm ("" : : "m"(i += 1)); /* { dg-error "not directly addressable" } */ + asm ("" : : "m"(i++)); /* { dg-error "not directly addressable" } */ + asm ("" : : "m"(++i)); /* { dg-error "not directly addressable" } */ + asm ("" : : "m"(i = 0)); /* { dg-error "not directly addressable" } */ +} diff --git a/gcc/testsuite/gcc.dg/autopar/pr46099-2.c b/gcc/testsuite/gcc.dg/autopar/pr46099-2.c new file mode 100644 index 00000000000..2883408365e --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr46099-2.c @@ -0,0 +1,5 @@ +/* PR tree-optimization/46099. */ +/* { dg-do compile } */ +/* { dg-options "-ftree-parallelize-loops=2 -fcompare-debug -O --param parloops-chunk-size=100" } */ + +#include "pr46099.c" diff --git a/gcc/testsuite/gcc.dg/autopar/reduc-4.c b/gcc/testsuite/gcc.dg/autopar/reduc-4.c new file mode 100644 index 00000000000..80b15e2852d --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/reduc-4.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops-details -fdump-tree-optimized --param parloops-chunk-size=100" } */ + +#include "reduc-3.c" diff --git a/gcc/testsuite/gcc.dg/gomp/pr67495.c b/gcc/testsuite/gcc.dg/gomp/pr67495.c new file mode 100644 index 00000000000..1011a266972 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr67495.c @@ -0,0 +1,38 @@ +/* PR c/67495 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int a, b, c; + +void +foo (void) +{ +#pragma omp atomic capture + a = (float)a + b; /* { dg-error "invalid operator" } */ +#pragma omp atomic read + (float) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic write + (float) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic read + a = (float) b; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + (float) a = b += c; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; (float) c = a; } /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; c = (float) a; } /* { dg-error "uses two different expressions for memory" } */ +#pragma omp atomic capture + a = (int)a + b; /* { dg-error "invalid operator" } */ +#pragma omp atomic read + (int) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic write + (int) a = b; /* { dg-error "lvalue required" } */ +#pragma omp atomic read + a = (int) b; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + (int) a = b += c; /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; (int) c = a; } /* { dg-error "lvalue required" } */ +#pragma omp atomic capture + { a += b; c = (int) a; } /* { dg-error "lvalue required" } */ +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr67500.c b/gcc/testsuite/gcc.dg/gomp/pr67500.c new file mode 100644 index 00000000000..13a6903d72d --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr67500.c @@ -0,0 +1,42 @@ +/* PR c/67500 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +#pragma omp declare simd simdlen(d) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f1 (int); /* { dg-error "undeclared here" "" { target *-*-* } 5 } */ +#pragma omp declare simd simdlen(0.5) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f2 (int); +#pragma omp declare simd simdlen(-2) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f3 (int); +#pragma omp declare simd simdlen(0) /* { dg-error "clause expression must be positive constant integer expression" } */ +void f4 (int); + +void +foo (int *p) +{ + int i; + #pragma omp simd safelen(d) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) /* { dg-error "undeclared" "" { target *-*-* } 18 } */ + ; + #pragma omp simd safelen(0.5) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd safelen(-2) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd safelen(0) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:d) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:0.5) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:-2) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; + #pragma omp simd aligned(p:0) /* { dg-error "must be positive constant integer expression" } */ + for (i = 0; i < 16; ++i) + ; +} diff --git a/gcc/testsuite/gcc.dg/graphite/block-0.c b/gcc/testsuite/gcc.dg/graphite/block-0.c index cb08a5fe56f..24b3bd060a9 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-0.c +++ b/gcc/testsuite/gcc.dg/graphite/block-0.c @@ -42,4 +42,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "not tiled" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "not tiled" 2 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c index 19f9f20c3bc..bb81a95d421 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-1.c +++ b/gcc/testsuite/gcc.dg/graphite/block-1.c @@ -45,4 +45,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c index d30abf80fda..2f4b2f503b0 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-5.c +++ b/gcc/testsuite/gcc.dg/graphite/block-5.c @@ -53,4 +53,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c index 9f03448b957..36e9783d151 100644 --- a/gcc/testsuite/gcc.dg/graphite/block-6.c +++ b/gcc/testsuite/gcc.dg/graphite/block-6.c @@ -48,4 +48,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c index b9f12c7d20d..2c58ac21e98 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-1.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c @@ -49,4 +49,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-10.c b/gcc/testsuite/gcc.dg/graphite/interchange-10.c index 29e11c72257..9d486448d08 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-10.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-10.c @@ -46,4 +46,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-11.c b/gcc/testsuite/gcc.dg/graphite/interchange-11.c index afd71230a63..4f6918dc691 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-11.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-11.c @@ -46,4 +46,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-13.c b/gcc/testsuite/gcc.dg/graphite/interchange-13.c index 0e722e2632e..c9ea048e482 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-13.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-13.c @@ -50,4 +50,4 @@ main (void) } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-14.c b/gcc/testsuite/gcc.dg/graphite/interchange-14.c index 55c600247c0..151bfe71f1f 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-14.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-14.c @@ -54,4 +54,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 7 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c index cdc02020197..ebdeef7ea8e 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-3.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c @@ -47,4 +47,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c index 67125658286..9a50e7a0833 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-4.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c @@ -46,4 +46,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-7.c b/gcc/testsuite/gcc.dg/graphite/interchange-7.c index d99a16a291a..e53d30e8cfe 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-7.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-7.c @@ -46,4 +46,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-8.c b/gcc/testsuite/gcc.dg/graphite/interchange-8.c index 123106bb475..c5e714175a0 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-8.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-8.c @@ -82,4 +82,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-9.c b/gcc/testsuite/gcc.dg/graphite/interchange-9.c index e4c54ae181d..44a5452213e 100644 --- a/gcc/testsuite/gcc.dg/graphite/interchange-9.c +++ b/gcc/testsuite/gcc.dg/graphite/interchange-9.c @@ -44,4 +44,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c b/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c index cb5d802db8e..70ac24c46d7 100644 --- a/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c +++ b/gcc/testsuite/gcc.dg/graphite/isl-codegen-loop-dumping.c @@ -12,4 +12,6 @@ main (int n, int *a) return 0; } -/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \nfor \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\)\n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n S_4\\(c1, c3\\);" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "ISL AST generated by ISL: \n\\{\n S_2\\();\n if \\(P_19 >= 1\\)\n + for \\(int c1 = 0; c1 < n - 1; c1 \\+= 1\\) \\{ \n for \\(int c3 = 0; c3 < n; c3 \\+= 1\\)\n + S_4\\(c1, c3\\); \n S_6\\(c1\\);\n \\} \n\\}" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c index 10aa49337b7..7f0e8246e03 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr35356-1.c +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-1.c @@ -11,6 +11,10 @@ foo (int bar, int n, int k) if (i == k) a[i] = bar; + for (i = 0; i < n; i++) + if (i == k) + a[i] = bar; + return a[bar]; } diff --git a/gcc/testsuite/gcc.dg/graphite/pr37485.c b/gcc/testsuite/gcc.dg/graphite/pr37485.c index 0a6dfbceefc..47138d303af 100644 --- a/gcc/testsuite/gcc.dg/graphite/pr37485.c +++ b/gcc/testsuite/gcc.dg/graphite/pr37485.c @@ -31,4 +31,4 @@ void fallbackSort ( UInt32* fmap, AssertH ( j < 256, 1005 ); } -/* { dg-final { scan-tree-dump-times "tiled by" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-0.c b/gcc/testsuite/gcc.dg/graphite/scop-0.c index 9cfd5dd14dc..abeabce98a8 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-0.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-0.c @@ -9,7 +9,7 @@ int toto() int b[100]; int N = foo (); - for (i = 0; i < 2*N+ 100; i++) + for (i = 0; i < N+ 100; i++) for (j = 0; j < 200; j++) a[j][i] = a[j+1][10] + 2; diff --git a/gcc/testsuite/gcc.dg/graphite/scop-1.c b/gcc/testsuite/gcc.dg/graphite/scop-1.c index 16070d425b8..a569065d095 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-1.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-1.c @@ -27,4 +27,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-10.c b/gcc/testsuite/gcc.dg/graphite/scop-10.c index f14aabce4c3..39ed5d7ea7b 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-10.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-10.c @@ -12,8 +12,6 @@ int toto() b[i+j] = b[i+j-1] + 2; if (i * 2 == i + 8) - bar (); - else { for (j = 1; j < 100; j++) b[i+j] = b[i+j-1] + 2; @@ -27,4 +25,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-11.c b/gcc/testsuite/gcc.dg/graphite/scop-11.c index 4a7286993c5..97fe5393b37 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-11.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-11.c @@ -10,7 +10,6 @@ int toto() for (j = 0; j <= 20; j++) a[j] = b + i; b = 3; - bar(); } else { @@ -28,4 +27,4 @@ int toto() return a[b]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-12.c b/gcc/testsuite/gcc.dg/graphite/scop-12.c index 221d987bfba..68e12050488 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-12.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-12.c @@ -32,4 +32,4 @@ int toto() return a[b]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 5" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-13.c b/gcc/testsuite/gcc.dg/graphite/scop-13.c index 195b7569389..53a17196d3e 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-13.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-13.c @@ -37,4 +37,4 @@ int toto() return a[b]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 0" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-16.c b/gcc/testsuite/gcc.dg/graphite/scop-16.c index cacd564e9e5..676817014b2 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-16.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-16.c @@ -21,4 +21,4 @@ int test () foo (a[i][j]); } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-17.c b/gcc/testsuite/gcc.dg/graphite/scop-17.c index 2252766b796..3c0d8804549 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-17.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-17.c @@ -20,4 +20,4 @@ int test () foo (a[i][j]); } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-18.c b/gcc/testsuite/gcc.dg/graphite/scop-18.c index 6e1080bc701..3416304075d 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-18.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-18.c @@ -22,4 +22,4 @@ void test (void) A[i][j] = B[i][k] * C[k][j]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-2.c b/gcc/testsuite/gcc.dg/graphite/scop-2.c index a16717c600a..fb1a4e7b692 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-2.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-2.c @@ -35,4 +35,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 4" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-21.c b/gcc/testsuite/gcc.dg/graphite/scop-21.c index 48a6d2ff5a8..bd3f811d9d1 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-21.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-21.c @@ -6,6 +6,9 @@ int test () int i; for (i = 0; i < N; i++) + a[i] += 32; + + for (i = 0; i < N; i++) { a[i] = i + 12; diff --git a/gcc/testsuite/gcc.dg/graphite/scop-22.c b/gcc/testsuite/gcc.dg/graphite/scop-22.c index c936428b7bb..6ff5ccd5b56 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-22.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-22.c @@ -7,6 +7,9 @@ void foo(int N, int *res) double sum = 0.0; for (i = 0; i < N; i++) + sum += u[i]; + + for (i = 0; i < N; i++) { a = u[i]; u[i] = i * i; diff --git a/gcc/testsuite/gcc.dg/graphite/scop-4.c b/gcc/testsuite/gcc.dg/graphite/scop-4.c index c6d719e2dd0..4fb0e5ea471 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-4.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-4.c @@ -25,4 +25,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-5.c b/gcc/testsuite/gcc.dg/graphite/scop-5.c index fa1c64a0ca8..8309257554c 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-5.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-5.c @@ -9,6 +9,8 @@ int toto() { for (j = 0; j <= 20; j++) a[j] = b + i; + for (j = 2; j <= 23; j++) + a[j] = b + i; b = 3; bar(); } @@ -31,4 +33,4 @@ int toto() return a[b]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-6.c b/gcc/testsuite/gcc.dg/graphite/scop-6.c index 2a45d6ee559..1da486a2ddf 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-6.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-6.c @@ -17,7 +17,6 @@ int toto() { for (k = 1; k < 100; k++) b[i+k] = b[i+k-1] + 2; - bar (); } for (k = 1; k < 100; k++) @@ -27,4 +26,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-7.c b/gcc/testsuite/gcc.dg/graphite/scop-7.c index 5866ca736f6..3e337d0c603 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-7.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-7.c @@ -13,7 +13,6 @@ int toto() if (i * 2 == i + 8) { - bar (); for (j = 1; j < 100; j++) b[i+j] = b[i+j-1] + 2; } @@ -27,4 +26,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 3" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-8.c b/gcc/testsuite/gcc.dg/graphite/scop-8.c index 9cdc69f670d..71d5c531fb8 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-8.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-8.c @@ -14,8 +14,7 @@ int toto() if (i * 2 == i + 8) { for (j = 1; j < 100; j++) - if (bar ()) - b[i+j] = b[i+j-1] + 2; + b[i+j] = b[i+j-1] + 2; } else a[i][i] = 2; @@ -27,4 +26,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-9.c b/gcc/testsuite/gcc.dg/graphite/scop-9.c index d879d9afda3..93888728b0d 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-9.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-9.c @@ -12,8 +12,6 @@ int toto() b[i+j] = b[i+j-1] + 2; if (i * 2 == i + 8) - bar (); - else a[i][i] = 2; for (k = 1; k < 100; k++) @@ -23,4 +21,4 @@ int toto() return a[3][5] + b[1]; } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite"} } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite"} } */ diff --git a/gcc/testsuite/gcc.dg/graphite/scop-mvt.c b/gcc/testsuite/gcc.dg/graphite/scop-mvt.c index 5d3d19f7413..442a3a0bafa 100644 --- a/gcc/testsuite/gcc.dg/graphite/scop-mvt.c +++ b/gcc/testsuite/gcc.dg/graphite/scop-mvt.c @@ -8,16 +8,16 @@ void mvt(long N) { for (i=0; i<N; i++) { for (j=0; j<N; j++) { - x1[i] = x1[i] + a[i][j] * y_1[j]; + x1[j] = x1[j] + a[i][j] * y_1[j]; } } for (i=0; i<N; i++) { for (j=0; j<N; j++) { - x2[i] = x2[i] + a[j][i] * y_2[j]; + x2[j] = x2[j] + a[j][i] * y_2[j]; } } } -/* { dg-final { scan-tree-dump-times "number of SCoPs: 2" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "number of SCoPs: 1" 1 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c index 12a62919b5f..64ca761c40c 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-block-1.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-block-1.c @@ -45,4 +45,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c index d9c07e2fe21..4e3c705a13a 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-12.c @@ -54,4 +54,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 4 "graphite" } } */ +/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c index 7ef575b667d..a9d4950a525 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-14.c @@ -55,4 +55,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 6 "graphite" } } */ +/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c index 0e32fd61456..fe2669f1578 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-15.c @@ -49,4 +49,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c index 31b132253c6..601169ec39e 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-9.c @@ -45,4 +45,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c index eebece38698..211c9ab82bd 100644 --- a/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c +++ b/gcc/testsuite/gcc.dg/graphite/uns-interchange-mvt.c @@ -59,4 +59,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "tiled by" 3 "graphite" } } */ +/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/pr67452_0.c b/gcc/testsuite/gcc.dg/lto/pr67452_0.c new file mode 100644 index 00000000000..a4984ffcc9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr67452_0.c @@ -0,0 +1,23 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -O2 -flto -fopenmp-simd } } } */ + +float b[3][3]; + +__attribute__((used, noinline)) void +foo () +{ + int v1, v2; +#pragma omp simd collapse(2) + for (v1 = 0; v1 < 3; v1++) + for (v2 = 0; v2 < 3; v2++) + b[v1][v2] = 2.5; +} + +int +main () +{ + asm volatile ("" : : "g" (b) : "memory"); + foo (); + asm volatile ("" : : "g" (b) : "memory"); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pie-link.c b/gcc/testsuite/gcc.dg/pie-link.c index c16086cc19e..2be07615f96 100644 --- a/gcc/testsuite/gcc.dg/pie-link.c +++ b/gcc/testsuite/gcc.dg/pie-link.c @@ -1,5 +1,5 @@ /* { dg-do link { target pie } } */ -/* { dg-options "-fpie" } */ +/* { dg-options "-fpie -pie" } */ int main(void) { diff --git a/gcc/testsuite/gcc.dg/pr67432.c b/gcc/testsuite/gcc.dg/pr67432.c new file mode 100644 index 00000000000..74367a97251 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67432.c @@ -0,0 +1,6 @@ +/* PR c/67432 */ +/* { dg-do compile } */ + +enum {}; /* { dg-error "empty enum is invalid" } */ +enum E {}; /* { dg-error "empty enum is invalid" } */ +enum F {} e; /* { dg-error "empty enum is invalid" } */ diff --git a/gcc/testsuite/gcc.dg/pr67512.c b/gcc/testsuite/gcc.dg/pr67512.c new file mode 100644 index 00000000000..95f836aea00 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr67512.c @@ -0,0 +1,15 @@ +/* PR middle-end/67512 */ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized" } */ + +extern int fn2 (void); +extern int fn3 (int); +void +fn1 (void) +{ + int z, m; + if (1 & m) /* { dg-warning "is used uninitialized" } */ + z = fn2 (); + z = 1 == m ? z : 2 == m; + fn3 (z); +} diff --git a/gcc/testsuite/gcc.dg/ubsan/pr67279.c b/gcc/testsuite/gcc.dg/ubsan/pr67279.c new file mode 100644 index 00000000000..5b5db42f96a --- /dev/null +++ b/gcc/testsuite/gcc.dg/ubsan/pr67279.c @@ -0,0 +1,14 @@ +/* PR sanitizer/67279 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=undefined -w" } */ + +#define INT_MIN (-__INT_MAX__ - 1) + +void +foo (void) +{ + static int a1 = 1 << 31; + static int a2 = 10 << 30; + static int a3 = 100 << 28; + static int a4 = INT_MIN / -1; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp index ceada839d98..462696315e0 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp @@ -52,8 +52,12 @@ if {[istarget arm*-*-*]} then { torture-init set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS -# Make sure Neon flags are provided, if necessary. -set additional_flags [add_options_for_arm_neon ""] +# Make sure Neon flags are provided, if necessary. Use fp16 if we can. +if {[check_effective_target_arm_neon_fp16_ok]} then { + set additional_flags [add_options_for_arm_neon_fp16 ""] +} else { + set additional_flags [add_options_for_arm_neon ""] +} # Main loop. gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] \ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h index 4e728d5572c..49fbd843e50 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/arm-neon-ref.h @@ -7,6 +7,7 @@ #include <inttypes.h> /* helper type, to help write floating point results in integer form. */ +typedef uint16_t hfloat16_t; typedef uint32_t hfloat32_t; typedef uint64_t hfloat64_t; @@ -132,6 +133,9 @@ static ARRAY(result, uint, 32, 2); static ARRAY(result, uint, 64, 1); static ARRAY(result, poly, 8, 8); static ARRAY(result, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +static ARRAY(result, float, 16, 4); +#endif static ARRAY(result, float, 32, 2); static ARRAY(result, int, 8, 16); static ARRAY(result, int, 16, 8); @@ -143,6 +147,9 @@ static ARRAY(result, uint, 32, 4); static ARRAY(result, uint, 64, 2); static ARRAY(result, poly, 8, 16); static ARRAY(result, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +static ARRAY(result, float, 16, 8); +#endif static ARRAY(result, float, 32, 4); #ifdef __aarch64__ static ARRAY(result, float, 64, 2); @@ -160,6 +167,7 @@ extern ARRAY(expected, uint, 32, 2); extern ARRAY(expected, uint, 64, 1); extern ARRAY(expected, poly, 8, 8); extern ARRAY(expected, poly, 16, 4); +extern ARRAY(expected, hfloat, 16, 4); extern ARRAY(expected, hfloat, 32, 2); extern ARRAY(expected, int, 8, 16); extern ARRAY(expected, int, 16, 8); @@ -171,38 +179,11 @@ extern ARRAY(expected, uint, 32, 4); extern ARRAY(expected, uint, 64, 2); extern ARRAY(expected, poly, 8, 16); extern ARRAY(expected, poly, 16, 8); +extern ARRAY(expected, hfloat, 16, 8); extern ARRAY(expected, hfloat, 32, 4); extern ARRAY(expected, hfloat, 64, 2); -/* Check results. Operates on all possible vector types. */ -#define CHECK_RESULTS(test_name,comment) \ - { \ - CHECK(test_name, int, 8, 8, PRIx8, expected, comment); \ - CHECK(test_name, int, 16, 4, PRIx16, expected, comment); \ - CHECK(test_name, int, 32, 2, PRIx32, expected, comment); \ - CHECK(test_name, int, 64, 1, PRIx64, expected, comment); \ - CHECK(test_name, uint, 8, 8, PRIx8, expected, comment); \ - CHECK(test_name, uint, 16, 4, PRIx16, expected, comment); \ - CHECK(test_name, uint, 32, 2, PRIx32, expected, comment); \ - CHECK(test_name, uint, 64, 1, PRIx64, expected, comment); \ - CHECK(test_name, poly, 8, 8, PRIx8, expected, comment); \ - CHECK(test_name, poly, 16, 4, PRIx16, expected, comment); \ - CHECK_FP(test_name, float, 32, 2, PRIx32, expected, comment); \ - \ - CHECK(test_name, int, 8, 16, PRIx8, expected, comment); \ - CHECK(test_name, int, 16, 8, PRIx16, expected, comment); \ - CHECK(test_name, int, 32, 4, PRIx32, expected, comment); \ - CHECK(test_name, int, 64, 2, PRIx64, expected, comment); \ - CHECK(test_name, uint, 8, 16, PRIx8, expected, comment); \ - CHECK(test_name, uint, 16, 8, PRIx16, expected, comment); \ - CHECK(test_name, uint, 32, 4, PRIx32, expected, comment); \ - CHECK(test_name, uint, 64, 2, PRIx64, expected, comment); \ - CHECK(test_name, poly, 8, 16, PRIx8, expected, comment); \ - CHECK(test_name, poly, 16, 8, PRIx16, expected, comment); \ - CHECK_FP(test_name, float, 32, 4, PRIx32, expected, comment); \ - } \ - -#define CHECK_RESULTS_NAMED(test_name,EXPECTED,comment) \ +#define CHECK_RESULTS_NAMED_NO_FP16(test_name,EXPECTED,comment) \ { \ CHECK(test_name, int, 8, 8, PRIx8, EXPECTED, comment); \ CHECK(test_name, int, 16, 4, PRIx16, EXPECTED, comment); \ @@ -229,6 +210,24 @@ extern ARRAY(expected, hfloat, 64, 2); CHECK_FP(test_name, float, 32, 4, PRIx32, EXPECTED, comment); \ } \ +/* Check results against EXPECTED. Operates on all possible vector types. */ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define CHECK_RESULTS_NAMED(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_NAMED_NO_FP16(test_name, EXPECTED, comment) \ + CHECK_FP(test_name, float, 16, 4, PRIx16, EXPECTED, comment); \ + CHECK_FP(test_name, float, 16, 8, PRIx16, EXPECTED, comment); \ + } +#else +#define CHECK_RESULTS_NAMED(test_name,EXPECTED,comment) \ + CHECK_RESULTS_NAMED_NO_FP16(test_name, EXPECTED, comment) +#endif + +#define CHECK_RESULTS_NO_FP16(test_name,comment) \ + CHECK_RESULTS_NAMED_NO_FP16(test_name, expected, comment) + +#define CHECK_RESULTS(test_name,comment) \ + CHECK_RESULTS_NAMED(test_name, expected, comment) #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ @@ -380,6 +379,9 @@ static void clean_results (void) CLEAN(result, uint, 64, 1); CLEAN(result, poly, 8, 8); CLEAN(result, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + CLEAN(result, float, 16, 4); +#endif CLEAN(result, float, 32, 2); CLEAN(result, int, 8, 16); @@ -392,6 +394,9 @@ static void clean_results (void) CLEAN(result, uint, 64, 2); CLEAN(result, poly, 8, 16); CLEAN(result, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + CLEAN(result, float, 16, 8); +#endif CLEAN(result, float, 32, 4); #if defined(__aarch64__) @@ -443,21 +448,40 @@ static void clean_results (void) DECL_VARIABLE(VAR, uint, 64, 2) /* Declare all 64 bits variants. */ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define DECL_VARIABLE_64BITS_VARIANTS(VAR) \ + DECL_VARIABLE_64BITS_SIGNED_VARIANTS(VAR); \ + DECL_VARIABLE_64BITS_UNSIGNED_VARIANTS(VAR); \ + DECL_VARIABLE(VAR, poly, 8, 8); \ + DECL_VARIABLE(VAR, poly, 16, 4); \ + DECL_VARIABLE(VAR, float, 16, 4); \ + DECL_VARIABLE(VAR, float, 32, 2) +#else #define DECL_VARIABLE_64BITS_VARIANTS(VAR) \ DECL_VARIABLE_64BITS_SIGNED_VARIANTS(VAR); \ DECL_VARIABLE_64BITS_UNSIGNED_VARIANTS(VAR); \ DECL_VARIABLE(VAR, poly, 8, 8); \ DECL_VARIABLE(VAR, poly, 16, 4); \ DECL_VARIABLE(VAR, float, 32, 2) +#endif /* Declare all 128 bits variants. */ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) #define DECL_VARIABLE_128BITS_VARIANTS(VAR) \ DECL_VARIABLE_128BITS_SIGNED_VARIANTS(VAR); \ DECL_VARIABLE_128BITS_UNSIGNED_VARIANTS(VAR); \ DECL_VARIABLE(VAR, poly, 8, 16); \ DECL_VARIABLE(VAR, poly, 16, 8); \ + DECL_VARIABLE(VAR, float, 16, 8); \ DECL_VARIABLE(VAR, float, 32, 4) - +#else +#define DECL_VARIABLE_128BITS_VARIANTS(VAR) \ + DECL_VARIABLE_128BITS_SIGNED_VARIANTS(VAR); \ + DECL_VARIABLE_128BITS_UNSIGNED_VARIANTS(VAR); \ + DECL_VARIABLE(VAR, poly, 8, 16); \ + DECL_VARIABLE(VAR, poly, 16, 8); \ + DECL_VARIABLE(VAR, float, 32, 4) +#endif /* Declare all variants. */ #define DECL_VARIABLE_ALL_VARIANTS(VAR) \ DECL_VARIABLE_64BITS_VARIANTS(VAR); \ @@ -476,6 +500,15 @@ static void clean_results (void) /* Helpers to initialize vectors. */ #define VDUP(VAR, Q, T1, T2, W, N, V) \ VECT_VAR(VAR, T1, W, N) = vdup##Q##_n_##T2##W(V) +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +/* Work around that there is no vdup_n_f16 intrinsic. */ +#define vdup_n_f16(VAL) \ + __extension__ \ + ({ \ + float16_t f = VAL; \ + vld1_dup_f16(&f); \ + }) +#endif #define VSET_LANE(VAR, Q, T1, T2, W, N, L, V) \ VECT_VAR(VAR, T1, W, N) = vset##Q##_lane_##T2##W(V, \ diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/compute-ref-data.h b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/compute-ref-data.h index 26203cc0a69..c8d43367bef 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/compute-ref-data.h +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/compute-ref-data.h @@ -118,6 +118,10 @@ VECT_VAR_DECL_INIT(buffer, uint, 32, 2); PAD(buffer_pad, uint, 32, 2); VECT_VAR_DECL_INIT(buffer, uint, 64, 1); PAD(buffer_pad, uint, 64, 1); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer, float, 16, 4); +PAD(buffer_pad, float, 16, 4); +#endif VECT_VAR_DECL_INIT(buffer, float, 32, 2); PAD(buffer_pad, float, 32, 2); VECT_VAR_DECL_INIT(buffer, int, 8, 16); @@ -140,6 +144,10 @@ VECT_VAR_DECL_INIT(buffer, poly, 8, 16); PAD(buffer_pad, poly, 8, 16); VECT_VAR_DECL_INIT(buffer, poly, 16, 8); PAD(buffer_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer, float, 16, 8); +PAD(buffer_pad, float, 16, 8); +#endif VECT_VAR_DECL_INIT(buffer, float, 32, 4); PAD(buffer_pad, float, 32, 4); #ifdef __aarch64__ @@ -170,6 +178,10 @@ VECT_VAR_DECL_INIT(buffer_dup, poly, 8, 8); VECT_VAR_DECL(buffer_dup_pad, poly, 8, 8); VECT_VAR_DECL_INIT(buffer_dup, poly, 16, 4); VECT_VAR_DECL(buffer_dup_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT4(buffer_dup, float, 16, 4); +VECT_VAR_DECL(buffer_dup_pad, float, 16, 4); +#endif VECT_VAR_DECL_INIT4(buffer_dup, float, 32, 2); VECT_VAR_DECL(buffer_dup_pad, float, 32, 2); @@ -193,5 +205,9 @@ VECT_VAR_DECL_INIT(buffer_dup, poly, 8, 16); VECT_VAR_DECL(buffer_dup_pad, poly, 8, 16); VECT_VAR_DECL_INIT(buffer_dup, poly, 16, 8); VECT_VAR_DECL(buffer_dup_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer_dup, float, 16, 8); +VECT_VAR_DECL(buffer_dup_pad, float, 16, 8); +#endif VECT_VAR_DECL_INIT(buffer_dup, float, 32, 4); VECT_VAR_DECL(buffer_dup_pad, float, 32, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vbsl.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vbsl.c index bb17f0a9649..c4fdbb45102 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vbsl.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vbsl.c @@ -114,7 +114,7 @@ void exec_vbsl (void) TEST_VBSL(uint, , float, f, 32, 2); TEST_VBSL(uint, q, float, f, 32, 4); - CHECK_RESULTS (TEST_MSG, ""); + CHECK_RESULTS_NO_FP16 (TEST_MSG, ""); } int main (void) diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcombine.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcombine.c index 295768a0348..5100375e5fe 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcombine.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcombine.c @@ -27,6 +27,8 @@ VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0x66, 0x66, 0x66, 0x66 }; VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0x40533333, 0x40533333 }; +VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0x4080, 0x4080, 0x4080, 0x4080 }; #define TEST_MSG "VCOMBINE" void exec_vcombine (void) @@ -44,6 +46,9 @@ void exec_vcombine (void) /* Initialize input "vector64_a" from "buffer". */ TEST_MACRO_64BITS_VARIANTS_2_5(VLOAD, vector64_a, buffer); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VLOAD(vector64_a, buffer, , float, f, 16, 4); +#endif VLOAD(vector64_a, buffer, , float, f, 32, 2); /* Choose init value arbitrarily. */ @@ -57,6 +62,9 @@ void exec_vcombine (void) VDUP(vector64_b, , uint, u, 64, 1, 0x88); VDUP(vector64_b, , poly, p, 8, 8, 0x55); VDUP(vector64_b, , poly, p, 16, 4, 0x66); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VDUP(vector64_b, , float, f, 16, 4, 2.25); +#endif VDUP(vector64_b, , float, f, 32, 2, 3.3f); clean_results (); @@ -72,6 +80,9 @@ void exec_vcombine (void) TEST_VCOMBINE(uint, u, 64, 1, 2); TEST_VCOMBINE(poly, p, 8, 8, 16); TEST_VCOMBINE(poly, p, 16, 4, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VCOMBINE(float, f, 16, 4, 8); +#endif TEST_VCOMBINE(float, f, 32, 2, 4); CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, ""); @@ -84,6 +95,9 @@ void exec_vcombine (void) CHECK(TEST_MSG, uint, 64, 2, PRIx64, expected, ""); CHECK(TEST_MSG, poly, 8, 16, PRIx8, expected, ""); CHECK(TEST_MSG, poly, 16, 8, PRIx16, expected, ""); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + CHECK_FP(TEST_MSG, float, 16, 8, PRIx16, expected, ""); +#endif CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected, ""); } diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcreate.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcreate.c index b2289d3a628..b8b338ef3c0 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcreate.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcreate.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0x123456789abcdef0 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x9abcdef0, 0x12345678 }; #define INSN_NAME vcreate @@ -38,6 +39,9 @@ FNNAME (INSN_NAME) DECL_VAL(val, int, 16, 4); DECL_VAL(val, int, 32, 2); DECL_VAL(val, int, 64, 1); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + DECL_VAL(val, float, 16, 4); +#endif DECL_VAL(val, float, 32, 2); DECL_VAL(val, uint, 8, 8); DECL_VAL(val, uint, 16, 4); @@ -50,6 +54,9 @@ FNNAME (INSN_NAME) DECL_VARIABLE(vector_res, int, 16, 4); DECL_VARIABLE(vector_res, int, 32, 2); DECL_VARIABLE(vector_res, int, 64, 1); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + DECL_VARIABLE(vector_res, float, 16, 4); +#endif DECL_VARIABLE(vector_res, float, 32, 2); DECL_VARIABLE(vector_res, uint, 8, 8); DECL_VARIABLE(vector_res, uint, 16, 4); @@ -65,6 +72,9 @@ FNNAME (INSN_NAME) VECT_VAR(val, int, 16, 4) = 0x123456789abcdef0LL; VECT_VAR(val, int, 32, 2) = 0x123456789abcdef0LL; VECT_VAR(val, int, 64, 1) = 0x123456789abcdef0LL; +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_VAR(val, float, 16, 4) = 0x123456789abcdef0LL; +#endif VECT_VAR(val, float, 32, 2) = 0x123456789abcdef0LL; VECT_VAR(val, uint, 8, 8) = 0x123456789abcdef0ULL; VECT_VAR(val, uint, 16, 4) = 0x123456789abcdef0ULL; @@ -76,6 +86,9 @@ FNNAME (INSN_NAME) TEST_VCREATE(int, s, 8, 8); TEST_VCREATE(int, s, 16, 4); TEST_VCREATE(int, s, 32, 2); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VCREATE(float, f, 16, 4); +#endif TEST_VCREATE(float, f, 32, 2); TEST_VCREATE(int, s, 64, 1); TEST_VCREATE(uint, u, 8, 8); @@ -95,6 +108,9 @@ FNNAME (INSN_NAME) CHECK(TEST_MSG, uint, 64, 1, PRIx64, expected, ""); CHECK(TEST_MSG, poly, 8, 8, PRIx8, expected, ""); CHECK(TEST_MSG, poly, 16, 4, PRIx16, expected, ""); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected, ""); +#endif CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, ""); } diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcvt_f16.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcvt_f16.c new file mode 100644 index 00000000000..48e50e18263 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vcvt_f16.c @@ -0,0 +1,98 @@ +/* { dg-require-effective-target arm_neon_fp16_hw { target { arm*-*-* } } } */ +#include <arm_neon.h> +#include "arm-neon-ref.h" +#include "compute-ref-data.h" +#include <math.h> + +/* Expected results for vcvt. */ +VECT_VAR_DECL (expected,hfloat,32,4) [] = { 0x41800000, 0x41700000, + 0x41600000, 0x41500000 }; +VECT_VAR_DECL (expected,hfloat,16,4) [] = { 0x3e00, 0x4100, 0x4300, 0x4480 }; + +/* Expected results for vcvt_high_f32_f16. */ +VECT_VAR_DECL (expected_high,hfloat,32,4) [] = { 0xc1400000, 0xc1300000, + 0xc1200000, 0xc1100000 }; +/* Expected results for vcvt_high_f16_f32. */ +VECT_VAR_DECL (expected_high,hfloat,16,8) [] = { 0x4000, 0x4000, 0x4000, 0x4000, + 0xcc00, 0xcb80, 0xcb00, 0xca80 }; + +void +exec_vcvt (void) +{ + clean_results (); + +#define TEST_MSG vcvt_f32_f16 + { + VECT_VAR_DECL (buffer_src, float, 16, 4) [] = { 16.0, 15.0, 14.0, 13.0 }; + + DECL_VARIABLE (vector_src, float, 16, 4); + + VLOAD (vector_src, buffer_src, , float, f, 16, 4); + DECL_VARIABLE (vector_res, float, 32, 4) = + vcvt_f32_f16 (VECT_VAR (vector_src, float, 16, 4)); + vst1q_f32 (VECT_VAR (result, float, 32, 4), + VECT_VAR (vector_res, float, 32, 4)); + + CHECK_FP (TEST_MSG, float, 32, 4, PRIx32, expected, ""); + } +#undef TEST_MSG + + clean_results (); + +#define TEST_MSG vcvt_f16_f32 + { + VECT_VAR_DECL (buffer_src, float, 32, 4) [] = { 1.5, 2.5, 3.5, 4.5 }; + DECL_VARIABLE (vector_src, float, 32, 4); + + VLOAD (vector_src, buffer_src, q, float, f, 32, 4); + DECL_VARIABLE (vector_res, float, 16, 4) = + vcvt_f16_f32 (VECT_VAR (vector_src, float, 32, 4)); + vst1_f16 (VECT_VAR (result, float, 16, 4), + VECT_VAR (vector_res, float, 16 ,4)); + + CHECK_FP (TEST_MSG, float, 16, 4, PRIx16, expected, ""); + } +#undef TEST_MSG + +#if defined (__aarch64__) + clean_results (); + +#define TEST_MSG "vcvt_high_f32_f16" + { + DECL_VARIABLE (vector_src, float, 16, 8); + VLOAD (vector_src, buffer, q, float, f, 16, 8); + DECL_VARIABLE (vector_res, float, 32, 4); + VECT_VAR (vector_res, float, 32, 4) = + vcvt_high_f32_f16 (VECT_VAR (vector_src, float, 16, 8)); + vst1q_f32 (VECT_VAR (result, float, 32, 4), + VECT_VAR (vector_res, float, 32, 4)); + CHECK_FP (TEST_MSG, float, 32, 4, PRIx32, expected_high, ""); + } +#undef TEST_MSG + clean_results (); + +#define TEST_MSG "vcvt_high_f16_f32" + { + DECL_VARIABLE (vector_low, float, 16, 4); + VDUP (vector_low, , float, f, 16, 4, 2.0); + + DECL_VARIABLE (vector_src, float, 32, 4); + VLOAD (vector_src, buffer, q, float, f, 32, 4); + + DECL_VARIABLE (vector_res, float, 16, 8) = + vcvt_high_f16_f32 (VECT_VAR (vector_low, float, 16, 4), + VECT_VAR (vector_src, float, 32, 4)); + vst1q_f16 (VECT_VAR (result, float, 16, 8), + VECT_VAR (vector_res, float, 16, 8)); + + CHECK_FP (TEST_MSG, float, 16, 8, PRIx16, expected_high, ""); + } +#endif +} + +int +main (void) +{ + exec_vcvt (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup-vmov.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup-vmov.c index b5132f41ac4..22d45d56c8e 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup-vmov.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup-vmov.c @@ -187,13 +187,13 @@ void exec_vdup_vmov (void) switch (i) { case 0: - CHECK_RESULTS_NAMED (TEST_MSG, expected0, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected0, ""); break; case 1: - CHECK_RESULTS_NAMED (TEST_MSG, expected1, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected1, ""); break; case 2: - CHECK_RESULTS_NAMED (TEST_MSG, expected2, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected2, ""); break; default: abort(); @@ -232,13 +232,13 @@ void exec_vdup_vmov (void) switch (i) { case 0: - CHECK_RESULTS_NAMED (TEST_MSG, expected0, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected0, ""); break; case 1: - CHECK_RESULTS_NAMED (TEST_MSG, expected1, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected1, ""); break; case 2: - CHECK_RESULTS_NAMED (TEST_MSG, expected2, ""); + CHECK_RESULTS_NAMED_NO_FP16 (TEST_MSG, expected2, ""); break; default: abort(); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup_lane.c index c1ff6dd3007..ef708dcba17 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdup_lane.c @@ -90,7 +90,7 @@ void exec_vdup_lane (void) TEST_VDUP_LANE(q, poly, p, 16, 8, 4, 1); TEST_VDUP_LANE(q, float, f, 32, 4, 2, 1); - CHECK_RESULTS (TEST_MSG, ""); + CHECK_RESULTS_NO_FP16 (TEST_MSG, ""); } int main (void) diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vext.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vext.c index 0b014ebda87..98f88a69898 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vext.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vext.c @@ -113,7 +113,7 @@ void exec_vext (void) TEST_VEXT(q, poly, p, 16, 8, 6); TEST_VEXT(q, float, f, 32, 4, 3); - CHECK_RESULTS (TEST_MSG, ""); + CHECK_RESULTS_NO_FP16 (TEST_MSG, ""); } int main (void) diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_high.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_high.c index d7581125edd..9f0a1687f18 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_high.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_high.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; #define TEST_MSG "VGET_HIGH" @@ -31,6 +32,9 @@ void exec_vget_high (void) DECL_VARIABLE_128BITS_VARIANTS(vector128); TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VLOAD(vector128, buffer, q, float, f, 16, 8); +#endif VLOAD(vector128, buffer, q, float, f, 32, 4); clean_results (); @@ -46,6 +50,9 @@ void exec_vget_high (void) TEST_VGET_HIGH(uint, u, 64, 1, 2); TEST_VGET_HIGH(poly, p, 8, 8, 16); TEST_VGET_HIGH(poly, p, 16, 4, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VGET_HIGH(float, f, 16, 4, 8); +#endif TEST_VGET_HIGH(float, f, 32, 2, 4); CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_low.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_low.c index 12ecfc21ba0..2b875b9b7b8 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_low.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vget_low.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; #define TEST_MSG "VGET_LOW" @@ -31,6 +32,9 @@ void exec_vget_low (void) DECL_VARIABLE_128BITS_VARIANTS(vector128); TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VLOAD(vector128, buffer, q, float, f, 16, 8); +#endif VLOAD(vector128, buffer, q, float, f, 32, 4); clean_results (); @@ -46,6 +50,9 @@ void exec_vget_low (void) TEST_VGET_LOW(uint, u, 64, 1, 2); TEST_VGET_LOW(poly, p, 8, 8, 16); TEST_VGET_LOW(poly, p, 16, 4, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VGET_LOW(float, f, 16, 4, 8); +#endif TEST_VGET_LOW(float, f, 32, 2, 4); CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); @@ -58,6 +65,9 @@ void exec_vget_low (void) CHECK(TEST_MSG, uint, 64, 1, PRIx64, expected, ""); CHECK(TEST_MSG, poly, 8, 8, PRIx8, expected, ""); CHECK(TEST_MSG, poly, 16, 4, PRIx16, expected, ""); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected, ""); +#endif CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, ""); } diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1.c index ced9d736d6d..4ed0e464f9c 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, @@ -44,6 +45,8 @@ VECT_VAR_DECL(expected,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0xc1500000 }; @@ -62,6 +65,10 @@ void exec_vld1 (void) TEST_MACRO_ALL_VARIANTS_2_5(TEST_VLD1, vector, buffer); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VLD1(vector, buffer, , float, f, 16, 4); + TEST_VLD1(vector, buffer, q, float, f, 16, 8); +#endif TEST_VLD1(vector, buffer, , float, f, 32, 2); TEST_VLD1(vector, buffer, q, float, f, 32, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_dup.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_dup.c index 0e052743926..34be214e912 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_dup.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_dup.c @@ -17,6 +17,7 @@ VECT_VAR_DECL(expected0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected0,poly,8,8) [] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 }; VECT_VAR_DECL(expected0,poly,16,4) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,16,4) [] = { 0xcc00, 0xcc00, 0xcc00, 0xcc00 }; VECT_VAR_DECL(expected0,hfloat,32,2) [] = { 0xc1800000, 0xc1800000 }; VECT_VAR_DECL(expected0,int,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, @@ -44,6 +45,8 @@ VECT_VAR_DECL(expected0,poly,8,16) [] = { 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 }; VECT_VAR_DECL(expected0,poly,16,8) [] = { 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0, 0xfff0 }; +VECT_VAR_DECL(expected0,hfloat,16,8) [] = { 0xcc00, 0xcc00, 0xcc00, 0xcc00, + 0xcc00, 0xcc00, 0xcc00, 0xcc00 }; VECT_VAR_DECL(expected0,hfloat,32,4) [] = { 0xc1800000, 0xc1800000, 0xc1800000, 0xc1800000 }; @@ -61,6 +64,7 @@ VECT_VAR_DECL(expected1,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected1,poly,8,8) [] = { 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1 }; VECT_VAR_DECL(expected1,poly,16,4) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,hfloat,16,4) [] = { 0xcb80, 0xcb80, 0xcb80, 0xcb80 }; VECT_VAR_DECL(expected1,hfloat,32,2) [] = { 0xc1700000, 0xc1700000 }; VECT_VAR_DECL(expected1,int,8,16) [] = { 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, @@ -88,6 +92,8 @@ VECT_VAR_DECL(expected1,poly,8,16) [] = { 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1 }; VECT_VAR_DECL(expected1,poly,16,8) [] = { 0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff1, 0xfff1 }; +VECT_VAR_DECL(expected1,hfloat,16,8) [] = { 0xcb80, 0xcb80, 0xcb80, 0xcb80, + 0xcb80, 0xcb80, 0xcb80, 0xcb80 }; VECT_VAR_DECL(expected1,hfloat,32,4) [] = { 0xc1700000, 0xc1700000, 0xc1700000, 0xc1700000 }; @@ -105,6 +111,7 @@ VECT_VAR_DECL(expected2,uint,64,1) [] = { 0xfffffffffffffff2 }; VECT_VAR_DECL(expected2,poly,8,8) [] = { 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2 }; VECT_VAR_DECL(expected2,poly,16,4) [] = { 0xfff2, 0xfff2, 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected2,hfloat,16,4) [] = { 0xcb00, 0xcb00, 0xcb00, 0xcb00 }; VECT_VAR_DECL(expected2,hfloat,32,2) [] = { 0xc1600000, 0xc1600000 }; VECT_VAR_DECL(expected2,int,8,16) [] = { 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, @@ -132,6 +139,8 @@ VECT_VAR_DECL(expected2,poly,8,16) [] = { 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2 }; VECT_VAR_DECL(expected2,poly,16,8) [] = { 0xfff2, 0xfff2, 0xfff2, 0xfff2, 0xfff2, 0xfff2, 0xfff2, 0xfff2 }; +VECT_VAR_DECL(expected2,hfloat,16,8) [] = { 0xcb00, 0xcb00, 0xcb00, 0xcb00, + 0xcb00, 0xcb00, 0xcb00, 0xcb00 }; VECT_VAR_DECL(expected2,hfloat,32,4) [] = { 0xc1600000, 0xc1600000, 0xc1600000, 0xc1600000 }; @@ -154,6 +163,10 @@ void exec_vld1_dup (void) TEST_MACRO_ALL_VARIANTS_2_5(TEST_VLD1_DUP, vector, buffer_dup); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VLD1_DUP(vector, buffer_dup, , float, f, 16, 4); + TEST_VLD1_DUP(vector, buffer_dup, q, float, f, 16, 8); +#endif TEST_VLD1_DUP(vector, buffer_dup, , float, f, 32, 2); TEST_VLD1_DUP(vector, buffer_dup, q, float, f, 32, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_lane.c index d5c5d22a8ce..1f39006498d 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld1_lane.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xf0 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xcc00, 0xaaaa }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xaaaaaaaa, 0xc1800000 }; VECT_VAR_DECL(expected,int,8,16) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, @@ -43,6 +44,8 @@ VECT_VAR_DECL(expected,poly,8,16) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xf0, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0, 0xaaaa }; +VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xcc00, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xc1800000, 0xaaaaaaaa }; @@ -72,6 +75,9 @@ void exec_vld1_lane (void) ARRAY(buffer_src, uint, 64, 1); ARRAY(buffer_src, poly, 8, 8); ARRAY(buffer_src, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + ARRAY(buffer_src, float, 16, 4); +#endif ARRAY(buffer_src, float, 32, 2); ARRAY(buffer_src, int, 8, 16); @@ -84,6 +90,9 @@ void exec_vld1_lane (void) ARRAY(buffer_src, uint, 64, 2); ARRAY(buffer_src, poly, 8, 16); ARRAY(buffer_src, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + ARRAY(buffer_src, float, 16, 8); +#endif ARRAY(buffer_src, float, 32, 4); clean_results (); @@ -99,6 +108,9 @@ void exec_vld1_lane (void) TEST_VLD1_LANE(, uint, u, 64, 1, 0); TEST_VLD1_LANE(, poly, p, 8, 8, 7); TEST_VLD1_LANE(, poly, p, 16, 4, 3); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VLD1_LANE(, float, f, 16, 4, 2); +#endif TEST_VLD1_LANE(, float, f, 32, 2, 1); TEST_VLD1_LANE(q, int, s, 8, 16, 15); @@ -111,6 +123,9 @@ void exec_vld1_lane (void) TEST_VLD1_LANE(q, uint, u, 64, 2, 0); TEST_VLD1_LANE(q, poly, p, 8, 16, 12); TEST_VLD1_LANE(q, poly, p, 16, 8, 6); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VLD1_LANE(q, float, f, 16, 8, 5); +#endif TEST_VLD1_LANE(q, float, f, 32, 4, 2); CHECK_RESULTS (TEST_MSG, ""); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f16_indices_1.c new file mode 100644 index 00000000000..2174d6eaa8f --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x4x2_t +f_vld2_lane_f16 (float16_t * p, float16x4x2_t v) +{ + float16x4x2_t res; + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld2_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld2_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_f16_indices_1.c new file mode 100644 index 00000000000..83ae82c8242 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld2q_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x8x2_t +f_vld2q_lane_f16 (float16_t * p, float16x8x2_t v) +{ + float16x8x2_t res; + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld2q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld2q_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_f16_indices_1.c new file mode 100644 index 00000000000..21b7861ba75 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x4x3_t +f_vld3_lane_f16 (float16_t * p, float16x4x3_t v) +{ + float16x4x3_t res; + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld3_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld3_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_f16_indices_1.c new file mode 100644 index 00000000000..95ec3913eef --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld3q_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x8x3_t +f_vld3q_lane_f16 (float16_t * p, float16x8x3_t v) +{ + float16x8x3_t res; + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld3q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld3q_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_f16_indices_1.c new file mode 100644 index 00000000000..bd7ecf06690 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x4x4_t +f_vld4_lane_f16 (float16_t * p, float16x4x4_t v) +{ + float16x4x4_t res; + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld4_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + res = vld4_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_f16_indices_1.c new file mode 100644 index 00000000000..c27559f4ee8 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vld4q_lane_f16_indices_1.c @@ -0,0 +1,16 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +float16x8x4_t +f_vld4q_lane_f16 (float16_t * p, float16x8x4_t v) +{ + float16x8x4_t res; + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld4q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + res = vld4q_lane_f16 (p, v, -1); + return res; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX.c index f20aa03f51b..1e02dc3fa10 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX.c @@ -18,6 +18,7 @@ VECT_VAR_DECL(expected_vld2_0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected_vld2_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }; VECT_VAR_DECL(expected_vld2_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld2_0,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld2_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld2_0,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, @@ -41,6 +42,8 @@ VECT_VAR_DECL(expected_vld2_0,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld2_0,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_0,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld2_0,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0xc1500000 }; @@ -58,6 +61,7 @@ VECT_VAR_DECL(expected_vld2_1,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected_vld2_1,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld2_1,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld2_1,hfloat,16,4) [] = { 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld2_1,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; VECT_VAR_DECL(expected_vld2_1,int,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, @@ -81,6 +85,8 @@ VECT_VAR_DECL(expected_vld2_1,poly,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0xc, 0xd, 0xe, 0xf }; VECT_VAR_DECL(expected_vld2_1,poly,16,8) [] = { 0xfff8, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd, 0xfffe, 0xffff }; +VECT_VAR_DECL(expected_vld2_1,hfloat,16,8) [] = { 0xc800, 0xc700, 0xc600, 0xc500, + 0xc400, 0xc200, 0xc000, 0xbc00 }; VECT_VAR_DECL(expected_vld2_1,hfloat,32,4) [] = { 0xc1400000, 0xc1300000, 0xc1200000, 0xc1100000 }; @@ -98,6 +104,7 @@ VECT_VAR_DECL(expected_vld3_0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected_vld3_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }; VECT_VAR_DECL(expected_vld3_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld3_0,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld3_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld3_0,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, @@ -121,6 +128,8 @@ VECT_VAR_DECL(expected_vld3_0,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld3_0,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld3_0,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld3_0,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0xc1500000 }; @@ -138,6 +147,7 @@ VECT_VAR_DECL(expected_vld3_1,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected_vld3_1,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld3_1,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld3_1,hfloat,16,4) [] = { 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld3_1,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; VECT_VAR_DECL(expected_vld3_1,int,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, @@ -161,6 +171,8 @@ VECT_VAR_DECL(expected_vld3_1,poly,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0xc, 0xd, 0xe, 0xf }; VECT_VAR_DECL(expected_vld3_1,poly,16,8) [] = { 0xfff8, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd, 0xfffe, 0xffff }; +VECT_VAR_DECL(expected_vld3_1,hfloat,16,8) [] = { 0xc800, 0xc700, 0xc600, 0xc500, + 0xc400, 0xc200, 0xc000, 0xbc00 }; VECT_VAR_DECL(expected_vld3_1,hfloat,32,4) [] = { 0xc1400000, 0xc1300000, 0xc1200000, 0xc1100000 }; @@ -181,6 +193,7 @@ VECT_VAR_DECL(expected_vld3_2,poly,8,8) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; VECT_VAR_DECL(expected_vld3_2,poly,16,4) [] = { 0xfff8, 0xfff9, 0xfffa, 0xfffb }; +VECT_VAR_DECL(expected_vld3_2,hfloat,16,4) [] = { 0xc800, 0xc700, 0xc600, 0xc500 }; VECT_VAR_DECL(expected_vld3_2,hfloat,32,2) [] = { 0xc1400000, 0xc1300000 }; VECT_VAR_DECL(expected_vld3_2,int,8,16) [] = { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -204,6 +217,8 @@ VECT_VAR_DECL(expected_vld3_2,poly,8,16) [] = { 0x10, 0x11, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x1f }; VECT_VAR_DECL(expected_vld3_2,poly,16,8) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +VECT_VAR_DECL(expected_vld3_2,hfloat,16,8) [] = { 0x0000, 0x3c00, 0x4000, 0x4200, + 0x4400, 0x4500, 0x4600, 0x4700 }; VECT_VAR_DECL(expected_vld3_2,hfloat,32,4) [] = { 0xc1000000, 0xc0e00000, 0xc0c00000, 0xc0a00000 }; @@ -223,6 +238,7 @@ VECT_VAR_DECL(expected_vld4_0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected_vld4_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7 }; VECT_VAR_DECL(expected_vld4_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_0,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld4_0,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, @@ -246,6 +262,8 @@ VECT_VAR_DECL(expected_vld4_0,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld4_0,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld4_0,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld4_0,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0xc1500000 }; @@ -263,6 +281,7 @@ VECT_VAR_DECL(expected_vld4_1,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected_vld4_1,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }; VECT_VAR_DECL(expected_vld4_1,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; +VECT_VAR_DECL(expected_vld4_1,hfloat,16,4) [] = { 0xca00, 0xc980, 0xc900, 0xc880 }; VECT_VAR_DECL(expected_vld4_1,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; VECT_VAR_DECL(expected_vld4_1,int,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, @@ -286,6 +305,8 @@ VECT_VAR_DECL(expected_vld4_1,poly,8,16) [] = { 0x0, 0x1, 0x2, 0x3, 0xc, 0xd, 0xe, 0xf }; VECT_VAR_DECL(expected_vld4_1,poly,16,8) [] = { 0xfff8, 0xfff9, 0xfffa, 0xfffb, 0xfffc, 0xfffd, 0xfffe, 0xffff }; +VECT_VAR_DECL(expected_vld4_1,hfloat,16,8) [] = { 0xc800, 0xc700, 0xc600, 0xc500, + 0xc400, 0xc200, 0xc000, 0xbc00 }; VECT_VAR_DECL(expected_vld4_1,hfloat,32,4) [] = { 0xc1400000, 0xc1300000, 0xc1200000, 0xc1100000 }; @@ -303,6 +324,7 @@ VECT_VAR_DECL(expected_vld4_2,uint,64,1) [] = { 0xfffffffffffffff2 }; VECT_VAR_DECL(expected_vld4_2,poly,8,8) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; VECT_VAR_DECL(expected_vld4_2,poly,16,4) [] = { 0xfff8, 0xfff9, 0xfffa, 0xfffb }; +VECT_VAR_DECL(expected_vld4_2,hfloat,16,4) [] = { 0xc800, 0xc700, 0xc600, 0xc500 }; VECT_VAR_DECL(expected_vld4_2,hfloat,32,2) [] = { 0xc1400000, 0xc1300000 }; VECT_VAR_DECL(expected_vld4_2,int,8,16) [] = { 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -326,6 +348,8 @@ VECT_VAR_DECL(expected_vld4_2,poly,8,16) [] = { 0x10, 0x11, 0x12, 0x13, 0x1c, 0x1d, 0x1e, 0x1f }; VECT_VAR_DECL(expected_vld4_2,poly,16,8) [] = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7 }; +VECT_VAR_DECL(expected_vld4_2,hfloat,16,8) [] = { 0x0000, 0x3c00, 0x4000, 0x4200, + 0x4400, 0x4500, 0x4600, 0x4700 }; VECT_VAR_DECL(expected_vld4_2,hfloat,32,4) [] = { 0xc1000000, 0xc0e00000, 0xc0c00000, 0xc0a00000 }; @@ -343,6 +367,7 @@ VECT_VAR_DECL(expected_vld4_3,uint,64,1) [] = { 0xfffffffffffffff3 }; VECT_VAR_DECL(expected_vld4_3,poly,8,8) [] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; VECT_VAR_DECL(expected_vld4_3,poly,16,4) [] = { 0xfffc, 0xfffd, 0xfffe, 0xffff }; +VECT_VAR_DECL(expected_vld4_3,hfloat,16,4) [] = { 0xc400, 0xc200, 0xc000, 0xbc00 }; VECT_VAR_DECL(expected_vld4_3,hfloat,32,2) [] = { 0xc1200000, 0xc1100000 }; VECT_VAR_DECL(expected_vld4_3,int,8,16) [] = { 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, @@ -366,6 +391,8 @@ VECT_VAR_DECL(expected_vld4_3,poly,8,16) [] = { 0x20, 0x21, 0x22, 0x23, 0x2c, 0x2d, 0x2e, 0x2f }; VECT_VAR_DECL(expected_vld4_3,poly,16,8) [] = { 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }; +VECT_VAR_DECL(expected_vld4_3,hfloat,16,8) [] = { 0x4800, 0x4880, 0x4900, 0x4980, + 0x4a00, 0x4a80, 0x4b00, 0x4b80 }; VECT_VAR_DECL(expected_vld4_3,hfloat,32,4) [] = { 0xc0800000, 0xc0400000, 0xc0000000, 0xbf800000 }; @@ -398,7 +425,7 @@ void exec_vldX (void) sizeof(VECT_VAR(result, T1, W, N))); /* We need all variants in 64 bits, but there is no 64x2 variant. */ -#define DECL_ALL_VLDX(X) \ +#define DECL_ALL_VLDX_NO_FP16(X) \ DECL_VLDX(int, 8, 8, X); \ DECL_VLDX(int, 16, 4, X); \ DECL_VLDX(int, 32, 2, X); \ @@ -420,7 +447,16 @@ void exec_vldX (void) DECL_VLDX(poly, 16, 8, X); \ DECL_VLDX(float, 32, 4, X) -#define TEST_ALL_VLDX(X) \ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define DECL_ALL_VLDX(X) \ + DECL_ALL_VLDX_NO_FP16(X); \ + DECL_VLDX(float, 16, 4, X); \ + DECL_VLDX(float, 16, 8, X) +#else +#define DECL_ALL_VLDX(X) DECL_ALL_VLDX_NO_FP16(X) +#endif + +#define TEST_ALL_VLDX_NO_FP16(X) \ TEST_VLDX(, int, s, 8, 8, X); \ TEST_VLDX(, int, s, 16, 4, X); \ TEST_VLDX(, int, s, 32, 2, X); \ @@ -442,7 +478,16 @@ void exec_vldX (void) TEST_VLDX(q, poly, p, 16, 8, X); \ TEST_VLDX(q, float, f, 32, 4, X) -#define TEST_ALL_EXTRA_CHUNKS(X, Y) \ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_VLDX(X) \ + TEST_ALL_VLDX_NO_FP16(X); \ + TEST_VLDX(, float, f, 16, 4, X); \ + TEST_VLDX(q, float, f, 16, 8, X) +#else +#define TEST_ALL_VLDX(X) TEST_ALL_VLDX_NO_FP16(X) +#endif + +#define TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) \ TEST_EXTRA_CHUNK(int, 8, 8, X, Y); \ TEST_EXTRA_CHUNK(int, 16, 4, X, Y); \ TEST_EXTRA_CHUNK(int, 32, 2, X, Y); \ @@ -464,9 +509,17 @@ void exec_vldX (void) TEST_EXTRA_CHUNK(poly, 16, 8, X, Y); \ TEST_EXTRA_CHUNK(float, 32, 4, X, Y) +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_EXTRA_CHUNKS(X, Y) \ + TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) \ + TEST_EXTRA_CHUNK(float, 16, 4, X, Y); \ + TEST_EXTRA_CHUNK(float, 16, 8, X, Y); +#else +#define TEST_ALL_EXTRA_CHUNKS(X, Y) TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) +#endif + /* vldX supports all vector types except [u]int64x2. */ -#define CHECK_RESULTS_VLDX(test_name,EXPECTED,comment) \ - { \ +#define CHECK_RESULTS_VLDX_NO_FP16(test_name,EXPECTED,comment) \ CHECK(test_name, int, 8, 8, PRIx8, EXPECTED, comment); \ CHECK(test_name, int, 16, 4, PRIx16, EXPECTED, comment); \ CHECK(test_name, int, 32, 2, PRIx32, EXPECTED, comment); \ @@ -487,8 +540,19 @@ void exec_vldX (void) CHECK(test_name, uint, 32, 4, PRIx32, EXPECTED, comment); \ CHECK(test_name, poly, 8, 16, PRIx8, EXPECTED, comment); \ CHECK(test_name, poly, 16, 8, PRIx16, EXPECTED, comment); \ - CHECK_FP(test_name, float, 32, 4, PRIx32, EXPECTED, comment); \ - } \ + CHECK_FP(test_name, float, 32, 4, PRIx32, EXPECTED, comment) + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define CHECK_RESULTS_VLDX(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_VLDX_NO_FP16(test_name, EXPECTED, comment); \ + CHECK_FP(test_name, float, 16, 4, PRIx16, EXPECTED, comment); \ + CHECK_FP(test_name, float, 16, 8, PRIx16, EXPECTED, comment); \ + } +#else +#define CHECK_RESULTS_VLDX(test_name, EXPECTED, comment) \ + { CHECK_RESULTS_VLDX_NO_FP16(test_name, EXPECTED, comment); } +#endif DECL_ALL_VLDX(2); DECL_ALL_VLDX(3); @@ -516,6 +580,10 @@ void exec_vldX (void) PAD(buffer_vld2_pad, poly, 8, 8); VECT_ARRAY_INIT2(buffer_vld2, poly, 16, 4); PAD(buffer_vld2_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT2(buffer_vld2, float, 16, 4); + PAD(buffer_vld2_pad, float, 16, 4); +#endif VECT_ARRAY_INIT2(buffer_vld2, float, 32, 2); PAD(buffer_vld2_pad, float, 32, 2); @@ -539,6 +607,10 @@ void exec_vldX (void) PAD(buffer_vld2_pad, poly, 8, 16); VECT_ARRAY_INIT2(buffer_vld2, poly, 16, 8); PAD(buffer_vld2_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT2(buffer_vld2, float, 16, 8); + PAD(buffer_vld2_pad, float, 16, 8); +#endif VECT_ARRAY_INIT2(buffer_vld2, float, 32, 4); PAD(buffer_vld2_pad, float, 32, 4); @@ -563,6 +635,10 @@ void exec_vldX (void) PAD(buffer_vld3_pad, poly, 8, 8); VECT_ARRAY_INIT3(buffer_vld3, poly, 16, 4); PAD(buffer_vld3_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT3(buffer_vld3, float, 16, 4); + PAD(buffer_vld3_pad, float, 16, 4); +#endif VECT_ARRAY_INIT3(buffer_vld3, float, 32, 2); PAD(buffer_vld3_pad, float, 32, 2); @@ -586,6 +662,10 @@ void exec_vldX (void) PAD(buffer_vld3_pad, poly, 8, 16); VECT_ARRAY_INIT3(buffer_vld3, poly, 16, 8); PAD(buffer_vld3_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT3(buffer_vld3, float, 16, 8); + PAD(buffer_vld3_pad, float, 16, 8); +#endif VECT_ARRAY_INIT3(buffer_vld3, float, 32, 4); PAD(buffer_vld3_pad, float, 32, 4); @@ -610,6 +690,10 @@ void exec_vldX (void) PAD(buffer_vld4_pad, poly, 8, 8); VECT_ARRAY_INIT4(buffer_vld4, poly, 16, 4); PAD(buffer_vld4_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT4(buffer_vld4, float, 16, 4); + PAD(buffer_vld4_pad, float, 16, 4); +#endif VECT_ARRAY_INIT4(buffer_vld4, float, 32, 2); PAD(buffer_vld4_pad, float, 32, 2); @@ -633,6 +717,10 @@ void exec_vldX (void) PAD(buffer_vld4_pad, poly, 8, 16); VECT_ARRAY_INIT4(buffer_vld4, poly, 16, 8); PAD(buffer_vld4_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT4(buffer_vld4, float, 16, 8); + PAD(buffer_vld4_pad, float, 16, 8); +#endif VECT_ARRAY_INIT4(buffer_vld4, float, 32, 4); PAD(buffer_vld4_pad, float, 32, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c index c66dade8e45..e4cde46725f 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_dup.c @@ -18,6 +18,7 @@ VECT_VAR_DECL(expected_vld2_0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected_vld2_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf0, 0xf1, 0xf0, 0xf1, 0xf0, 0xf1 }; VECT_VAR_DECL(expected_vld2_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_0,hfloat,16,4) [] = {0xcc00, 0xcb80, 0xcc00, 0xcb80 }; VECT_VAR_DECL(expected_vld2_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; /* vld2_dup/chunk 1. */ @@ -35,6 +36,7 @@ VECT_VAR_DECL(expected_vld2_1,poly,8,8) [] = { 0xf0, 0xf1, 0xf0, 0xf1, 0xf0, 0xf1, 0xf0, 0xf1 }; VECT_VAR_DECL(expected_vld2_1,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcc00, 0xcb80 }; VECT_VAR_DECL(expected_vld2_1,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; /* vld3_dup/chunk 0. */ @@ -54,6 +56,7 @@ VECT_VAR_DECL(expected_vld3_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf0, 0xf1, 0xf2, 0xf0, 0xf1 }; VECT_VAR_DECL(expected_vld3_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff0 }; +VECT_VAR_DECL(expected_vld3_0,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xcc00 }; VECT_VAR_DECL(expected_vld3_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; /* vld3_dup/chunk 1. */ @@ -73,6 +76,7 @@ VECT_VAR_DECL(expected_vld3_1,poly,8,8) [] = { 0xf2, 0xf0, 0xf1, 0xf2, 0xf0, 0xf1, 0xf2, 0xf0 }; VECT_VAR_DECL(expected_vld3_1,poly,16,4) [] = { 0xfff1, 0xfff2, 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld3_1,hfloat,16,4) [] = { 0xcb80, 0xcb00, 0xcc00, 0xcb80 }; VECT_VAR_DECL(expected_vld3_1,hfloat,32,2) [] = { 0xc1600000, 0xc1800000 }; /* vld3_dup/chunk 2. */ @@ -92,6 +96,7 @@ VECT_VAR_DECL(expected_vld3_2,poly,8,8) [] = { 0xf1, 0xf2, 0xf0, 0xf1, 0xf2, 0xf0, 0xf1, 0xf2 }; VECT_VAR_DECL(expected_vld3_2,poly,16,4) [] = { 0xfff2, 0xfff0, 0xfff1, 0xfff2 }; +VECT_VAR_DECL(expected_vld3_2,hfloat,16,4) [] = { 0xcb00, 0xcc00, 0xcb80, 0xcb00 }; VECT_VAR_DECL(expected_vld3_2,hfloat,32,2) [] = { 0xc1700000, 0xc1600000 }; /* vld4_dup/chunk 0. */ @@ -109,6 +114,7 @@ VECT_VAR_DECL(expected_vld4_0,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected_vld4_0,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf0, 0xf1, 0xf2, 0xf3 }; VECT_VAR_DECL(expected_vld4_0,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_0,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; /* vld4_dup/chunk 1. */ @@ -125,6 +131,7 @@ VECT_VAR_DECL(expected_vld4_1,uint,64,1) [] = { 0xfffffffffffffff1 }; VECT_VAR_DECL(expected_vld4_1,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf0, 0xf1, 0xf2, 0xf3 }; VECT_VAR_DECL(expected_vld4_1,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_1,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_1,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; /* vld4_dup/chunk 2. */ @@ -141,6 +148,7 @@ VECT_VAR_DECL(expected_vld4_2,uint,64,1) [] = { 0xfffffffffffffff2 }; VECT_VAR_DECL(expected_vld4_2,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf0, 0xf1, 0xf2, 0xf3 }; VECT_VAR_DECL(expected_vld4_2,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_2,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_2,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; /* vld4_dup/chunk3. */ @@ -157,6 +165,7 @@ VECT_VAR_DECL(expected_vld4_3,uint,64,1) [] = { 0xfffffffffffffff3 }; VECT_VAR_DECL(expected_vld4_3,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf0, 0xf1, 0xf2, 0xf3 }; VECT_VAR_DECL(expected_vld4_3,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_3,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_3,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; void exec_vldX_dup (void) @@ -188,7 +197,7 @@ void exec_vldX_dup (void) &(VECT_VAR(result_bis_##X, T1, W, N)[Y*N]), \ sizeof(VECT_VAR(result, T1, W, N))); -#define DECL_ALL_VLDX_DUP(X) \ +#define DECL_ALL_VLDX_DUP_NO_FP16(X) \ DECL_VLDX_DUP(int, 8, 8, X); \ DECL_VLDX_DUP(int, 16, 4, X); \ DECL_VLDX_DUP(int, 32, 2, X); \ @@ -201,7 +210,15 @@ void exec_vldX_dup (void) DECL_VLDX_DUP(poly, 16, 4, X); \ DECL_VLDX_DUP(float, 32, 2, X) -#define TEST_ALL_VLDX_DUP(X) \ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define DECL_ALL_VLDX_DUP(X) \ + DECL_ALL_VLDX_DUP_NO_FP16(X); \ + DECL_VLDX_DUP(float, 16, 4, X) +#else +#define DECL_ALL_VLDX_DUP(X) DECL_ALL_VLDX_DUP_NO_FP16(X) +#endif + +#define TEST_ALL_VLDX_DUP_NO_FP16(X) \ TEST_VLDX_DUP(, int, s, 8, 8, X); \ TEST_VLDX_DUP(, int, s, 16, 4, X); \ TEST_VLDX_DUP(, int, s, 32, 2, X); \ @@ -214,7 +231,15 @@ void exec_vldX_dup (void) TEST_VLDX_DUP(, poly, p, 16, 4, X); \ TEST_VLDX_DUP(, float, f, 32, 2, X) -#define TEST_ALL_EXTRA_CHUNKS(X, Y) \ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_VLDX_DUP(X) \ + TEST_ALL_VLDX_DUP_NO_FP16(X); \ + TEST_VLDX_DUP(, float, f, 16, 4, X) +#else +#define TEST_ALL_VLDX_DUP(X) TEST_ALL_VLDX_DUP_NO_FP16(X) +#endif + +#define TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) \ TEST_EXTRA_CHUNK(int, 8, 8, X, Y); \ TEST_EXTRA_CHUNK(int, 16, 4, X, Y); \ TEST_EXTRA_CHUNK(int, 32, 2, X, Y); \ @@ -227,9 +252,16 @@ void exec_vldX_dup (void) TEST_EXTRA_CHUNK(poly, 16, 4, X, Y); \ TEST_EXTRA_CHUNK(float, 32, 2, X, Y) +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_EXTRA_CHUNKS(X, Y) \ + TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y); \ + TEST_EXTRA_CHUNK(float, 16, 4, X, Y) +#else +#define TEST_ALL_EXTRA_CHUNKS(X, Y) TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) +#endif + /* vldX_dup supports only 64-bit inputs. */ -#define CHECK_RESULTS_VLDX_DUP(test_name,EXPECTED,comment) \ - { \ +#define CHECK_RESULTS_VLDX_DUP_NO_FP16(test_name,EXPECTED,comment) \ CHECK(test_name, int, 8, 8, PRIx8, EXPECTED, comment); \ CHECK(test_name, int, 16, 4, PRIx16, EXPECTED, comment); \ CHECK(test_name, int, 32, 2, PRIx32, EXPECTED, comment); \ @@ -240,8 +272,20 @@ void exec_vldX_dup (void) CHECK(test_name, uint, 64, 1, PRIx64, EXPECTED, comment); \ CHECK(test_name, poly, 8, 8, PRIx8, EXPECTED, comment); \ CHECK(test_name, poly, 16, 4, PRIx16, EXPECTED, comment); \ - CHECK_FP(test_name, float, 32, 2, PRIx32, EXPECTED, comment); \ - } \ + CHECK_FP(test_name, float, 32, 2, PRIx32, EXPECTED, comment) + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define CHECK_RESULTS_VLDX_DUP(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_VLDX_DUP_NO_FP16(test_name,EXPECTED,comment); \ + CHECK_FP(test_name, float, 16, 4, PRIx16, EXPECTED, comment); \ + } +#else +#define CHECK_RESULTS_VLDX_DUP(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_VLDX_DUP_NO_FP16(test_name,EXPECTED,comment); \ + } +#endif DECL_ALL_VLDX_DUP(2); DECL_ALL_VLDX_DUP(3); @@ -269,6 +313,10 @@ void exec_vldX_dup (void) PAD(buffer_vld2_pad, poly, 8, 8); VECT_ARRAY_INIT2(buffer_vld2, poly, 16, 4); PAD(buffer_vld2_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT2(buffer_vld2, float, 16, 4); + PAD(buffer_vld2_pad, float, 16, 4); +#endif VECT_ARRAY_INIT2(buffer_vld2, float, 32, 2); PAD(buffer_vld2_pad, float, 32, 2); @@ -292,6 +340,10 @@ void exec_vldX_dup (void) PAD(buffer_vld2_pad, poly, 8, 16); VECT_ARRAY_INIT2(buffer_vld2, poly, 16, 8); PAD(buffer_vld2_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT2(buffer_vld2, float, 16, 8); + PAD(buffer_vld2_pad, float, 16, 8); +#endif VECT_ARRAY_INIT2(buffer_vld2, float, 32, 4); PAD(buffer_vld2_pad, float, 32, 4); @@ -316,6 +368,10 @@ void exec_vldX_dup (void) PAD(buffer_vld3_pad, poly, 8, 8); VECT_ARRAY_INIT3(buffer_vld3, poly, 16, 4); PAD(buffer_vld3_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT3(buffer_vld3, float, 16, 4); + PAD(buffer_vld3_pad, float, 16, 4); +#endif VECT_ARRAY_INIT3(buffer_vld3, float, 32, 2); PAD(buffer_vld3_pad, float, 32, 2); @@ -339,6 +395,10 @@ void exec_vldX_dup (void) PAD(buffer_vld3_pad, poly, 8, 16); VECT_ARRAY_INIT3(buffer_vld3, poly, 16, 8); PAD(buffer_vld3_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT3(buffer_vld3, float, 16, 8); + PAD(buffer_vld3_pad, float, 16, 8); +#endif VECT_ARRAY_INIT3(buffer_vld3, float, 32, 4); PAD(buffer_vld3_pad, float, 32, 4); @@ -363,6 +423,10 @@ void exec_vldX_dup (void) PAD(buffer_vld4_pad, poly, 8, 8); VECT_ARRAY_INIT4(buffer_vld4, poly, 16, 4); PAD(buffer_vld4_pad, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT4(buffer_vld4, float, 16, 4); + PAD(buffer_vld4_pad, float, 16, 4); +#endif VECT_ARRAY_INIT4(buffer_vld4, float, 32, 2); PAD(buffer_vld4_pad, float, 32, 2); @@ -386,6 +450,10 @@ void exec_vldX_dup (void) PAD(buffer_vld4_pad, poly, 8, 16); VECT_ARRAY_INIT4(buffer_vld4, poly, 16, 8); PAD(buffer_vld4_pad, poly, 16, 8); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VECT_ARRAY_INIT4(buffer_vld4, float, 16, 8); + PAD(buffer_vld4_pad, float, 16, 8); +#endif VECT_ARRAY_INIT4(buffer_vld4, float, 32, 4); PAD(buffer_vld4_pad, float, 32, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c index 2f2e62f0e3e..33b0eafbadb 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vldX_lane.c @@ -18,6 +18,7 @@ VECT_VAR_DECL(expected_vld2_0,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld2_0,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld2_0,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld2_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld2_0,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -29,6 +30,8 @@ VECT_VAR_DECL(expected_vld2_0,uint,32,4) [] = { 0xfffffff0, 0xfffffff1, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld2_0,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld2_0,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa } ; VECT_VAR_DECL(expected_vld2_0,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -44,6 +47,7 @@ VECT_VAR_DECL(expected_vld2_1,uint,32,2) [] = { 0xfffffff0, 0xfffffff1 }; VECT_VAR_DECL(expected_vld2_1,poly,8,8) [] = { 0xf0, 0xf1, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld2_1,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xfff0, 0xfff1 }; +VECT_VAR_DECL(expected_vld2_1,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld2_1,hfloat,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld2_1,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0, 0xfff1, 0xaaaa, 0xaaaa }; @@ -55,6 +59,8 @@ VECT_VAR_DECL(expected_vld2_1,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld2_1,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xfff0, 0xfff1, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld2_1,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xcc00, 0xcb80, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld2_1,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -70,6 +76,7 @@ VECT_VAR_DECL(expected_vld3_0,uint,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_0,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld3_0,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld3_0,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld3_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld3_0,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -81,6 +88,8 @@ VECT_VAR_DECL(expected_vld3_0,uint,32,4) [] = { 0xfffffff0, 0xfffffff1, 0xfffffff2, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_0,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld3_0,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld3_0,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -96,6 +105,7 @@ VECT_VAR_DECL(expected_vld3_1,uint,32,2) [] = { 0xaaaaaaaa, 0xfffffff0 }; VECT_VAR_DECL(expected_vld3_1,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xf0, 0xf1, 0xf2, 0xaa }; VECT_VAR_DECL(expected_vld3_1,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld3_1,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xcc00, 0xcb80 }; VECT_VAR_DECL(expected_vld3_1,hfloat,32,2) [] = { 0xc1600000, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_1,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -107,6 +117,8 @@ VECT_VAR_DECL(expected_vld3_1,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_1,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0 }; +VECT_VAR_DECL(expected_vld3_1,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld3_1,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xc1800000, 0xc1700000 }; @@ -122,6 +134,7 @@ VECT_VAR_DECL(expected_vld3_2,uint,32,2) [] = { 0xfffffff1, 0xfffffff2 }; VECT_VAR_DECL(expected_vld3_2,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld3_2,poly,16,4) [] = { 0xaaaa, 0xfff0, 0xfff1, 0xfff2 }; +VECT_VAR_DECL(expected_vld3_2,hfloat,16,4) [] = { 0xcb00, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld3_2,hfloat,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_2,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xfff0, 0xfff1, 0xfff2, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -133,6 +146,8 @@ VECT_VAR_DECL(expected_vld3_2,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld3_2,poly,16,8) [] = { 0xfff1, 0xfff2, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld3_2,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xcc00, 0xcb80, + 0xcb00, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld3_2,hfloat,32,4) [] = { 0xc1600000, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -148,6 +163,7 @@ VECT_VAR_DECL(expected_vld4_0,uint,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_0,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld4_0,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_0,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_0,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; VECT_VAR_DECL(expected_vld4_0,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -159,6 +175,8 @@ VECT_VAR_DECL(expected_vld4_0,uint,32,4) [] = { 0xfffffff0, 0xfffffff1, 0xfffffff2, 0xfffffff3 }; VECT_VAR_DECL(expected_vld4_0,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_0,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_0,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -174,6 +192,7 @@ VECT_VAR_DECL(expected_vld4_1,uint,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_1,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld4_1,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_1,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_1,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; VECT_VAR_DECL(expected_vld4_1,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -185,6 +204,8 @@ VECT_VAR_DECL(expected_vld4_1,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_1,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_1,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_1,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -200,6 +221,7 @@ VECT_VAR_DECL(expected_vld4_2,uint,32,2) [] = { 0xfffffff0, 0xfffffff1 }; VECT_VAR_DECL(expected_vld4_2,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld4_2,poly,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_2,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; VECT_VAR_DECL(expected_vld4_2,hfloat,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_2,int,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -211,6 +233,8 @@ VECT_VAR_DECL(expected_vld4_2,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_2,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_2,hfloat,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_2,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0xc1500000 }; @@ -226,6 +250,7 @@ VECT_VAR_DECL(expected_vld4_3,uint,32,2) [] = { 0xfffffff2, 0xfffffff3 }; VECT_VAR_DECL(expected_vld4_3,poly,8,8) [] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; VECT_VAR_DECL(expected_vld4_3,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; +VECT_VAR_DECL(expected_vld4_3,hfloat,16,4) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_3,hfloat,32,2) [] = { 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_3,int,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; @@ -237,6 +262,8 @@ VECT_VAR_DECL(expected_vld4_3,uint,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; VECT_VAR_DECL(expected_vld4_3,poly,16,8) [] = { 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; +VECT_VAR_DECL(expected_vld4_3,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa }; VECT_VAR_DECL(expected_vld4_3,hfloat,32,4) [] = { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa }; @@ -252,6 +279,9 @@ VECT_VAR_DECL_INIT(buffer_vld2_lane, uint, 32, 2); VECT_VAR_DECL_INIT(buffer_vld2_lane, uint, 64, 2); VECT_VAR_DECL_INIT(buffer_vld2_lane, poly, 8, 2); VECT_VAR_DECL_INIT(buffer_vld2_lane, poly, 16, 2); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer_vld2_lane, float, 16, 2); +#endif VECT_VAR_DECL_INIT(buffer_vld2_lane, float, 32, 2); /* Input buffers for vld3_lane */ @@ -265,6 +295,9 @@ VECT_VAR_DECL_INIT(buffer_vld3_lane, uint, 32, 3); VECT_VAR_DECL_INIT(buffer_vld3_lane, uint, 64, 3); VECT_VAR_DECL_INIT(buffer_vld3_lane, poly, 8, 3); VECT_VAR_DECL_INIT(buffer_vld3_lane, poly, 16, 3); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer_vld3_lane, float, 16, 3); +#endif VECT_VAR_DECL_INIT(buffer_vld3_lane, float, 32, 3); /* Input buffers for vld4_lane */ @@ -278,6 +311,9 @@ VECT_VAR_DECL_INIT(buffer_vld4_lane, uint, 32, 4); VECT_VAR_DECL_INIT(buffer_vld4_lane, uint, 64, 4); VECT_VAR_DECL_INIT(buffer_vld4_lane, poly, 8, 4); VECT_VAR_DECL_INIT(buffer_vld4_lane, poly, 16, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +VECT_VAR_DECL_INIT(buffer_vld4_lane, float, 16, 4); +#endif VECT_VAR_DECL_INIT(buffer_vld4_lane, float, 32, 4); void exec_vldX_lane (void) @@ -321,7 +357,7 @@ void exec_vldX_lane (void) sizeof(VECT_VAR(result, T1, W, N))); /* We need all variants in 64 bits, but there is no 64x2 variant. */ -#define DECL_ALL_VLDX_LANE(X) \ +#define DECL_ALL_VLDX_LANE_NO_FP16(X) \ DECL_VLDX_LANE(int, 8, 8, X); \ DECL_VLDX_LANE(int, 16, 4, X); \ DECL_VLDX_LANE(int, 32, 2, X); \ @@ -338,6 +374,15 @@ void exec_vldX_lane (void) DECL_VLDX_LANE(float, 32, 2, X); \ DECL_VLDX_LANE(float, 32, 4, X) +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define DECL_ALL_VLDX_LANE(X) \ + DECL_ALL_VLDX_LANE_NO_FP16(X); \ + DECL_VLDX_LANE(float, 16, 4, X); \ + DECL_VLDX_LANE(float, 16, 8, X) +#else +#define DECL_ALL_VLDX_LANE(X) DECL_ALL_VLDX_LANE_NO_FP16(X) +#endif + /* Add some padding to try to catch out of bound accesses. */ #define ARRAY1(V, T, W, N) VECT_VAR_DECL(V,T,W,N)[1]={42} #define DUMMY_ARRAY(V, T, W, N, L) \ @@ -346,7 +391,7 @@ void exec_vldX_lane (void) /* Use the same lanes regardless of the size of the array (X), for simplicity. */ -#define TEST_ALL_VLDX_LANE(X) \ +#define TEST_ALL_VLDX_LANE_NO_FP16(X) \ TEST_VLDX_LANE(, int, s, 8, 8, X, 7); \ TEST_VLDX_LANE(, int, s, 16, 4, X, 2); \ TEST_VLDX_LANE(, int, s, 32, 2, X, 0); \ @@ -363,7 +408,16 @@ void exec_vldX_lane (void) TEST_VLDX_LANE(, float, f, 32, 2, X, 0); \ TEST_VLDX_LANE(q, float, f, 32, 4, X, 2) -#define TEST_ALL_EXTRA_CHUNKS(X, Y) \ +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_VLDX_LANE(X) \ + TEST_ALL_VLDX_LANE_NO_FP16(X); \ + TEST_VLDX_LANE(, float, f, 16, 4, X, 2); \ + TEST_VLDX_LANE(q, float, f, 16, 8, X, 6) +#else +#define TEST_ALL_VLDX_LANE(X) TEST_ALL_VLDX_LANE_NO_FP16(X) +#endif + +#define TEST_ALL_EXTRA_CHUNKS_NO_FP16(X,Y) \ TEST_EXTRA_CHUNK(int, 8, 8, X, Y); \ TEST_EXTRA_CHUNK(int, 16, 4, X, Y); \ TEST_EXTRA_CHUNK(int, 32, 2, X, Y); \ @@ -380,9 +434,17 @@ void exec_vldX_lane (void) TEST_EXTRA_CHUNK(float, 32, 2, X, Y); \ TEST_EXTRA_CHUNK(float, 32, 4, X, Y) +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define TEST_ALL_EXTRA_CHUNKS(X,Y) \ + TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y); \ + TEST_EXTRA_CHUNK(float, 16, 4, X, Y); \ + TEST_EXTRA_CHUNK(float, 16, 8, X, Y) +#else +#define TEST_ALL_EXTRA_CHUNKS(X,Y) TEST_ALL_EXTRA_CHUNKS_NO_FP16(X, Y) +#endif + /* vldX_lane supports only a subset of all variants. */ -#define CHECK_RESULTS_VLDX_LANE(test_name,EXPECTED,comment) \ - { \ +#define CHECK_RESULTS_VLDX_LANE_NO_FP16(test_name,EXPECTED,comment) \ CHECK(test_name, int, 8, 8, PRIx8, EXPECTED, comment); \ CHECK(test_name, int, 16, 4, PRIx16, EXPECTED, comment); \ CHECK(test_name, int, 32, 2, PRIx32, EXPECTED, comment); \ @@ -397,8 +459,21 @@ void exec_vldX_lane (void) CHECK(test_name, uint, 16, 8, PRIx16, EXPECTED, comment); \ CHECK(test_name, uint, 32, 4, PRIx32, EXPECTED, comment); \ CHECK(test_name, poly, 16, 8, PRIx16, EXPECTED, comment); \ - CHECK_FP(test_name, float, 32, 4, PRIx32, EXPECTED, comment); \ - } \ + CHECK_FP(test_name, float, 32, 4, PRIx32, EXPECTED, comment) + +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) +#define CHECK_RESULTS_VLDX_LANE(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_VLDX_LANE_NO_FP16(test_name,EXPECTED,comment); \ + CHECK_FP(test_name, float, 16, 4, PRIx16, EXPECTED, comment); \ + CHECK_FP(test_name, float, 16, 8, PRIx16, EXPECTED, comment); \ + } +#else +#define CHECK_RESULTS_VLDX_LANE(test_name,EXPECTED,comment) \ + { \ + CHECK_RESULTS_VLDX_LANE_NO_FP16(test_name,EXPECTED,comment); \ + } +#endif /* Declare the temporary buffers / variables. */ DECL_ALL_VLDX_LANE(2); @@ -419,6 +494,10 @@ void exec_vldX_lane (void) DUMMY_ARRAY(buffer_src, uint, 16, 8, 4); DUMMY_ARRAY(buffer_src, uint, 32, 4, 4); DUMMY_ARRAY(buffer_src, poly, 16, 8, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + DUMMY_ARRAY(buffer_src, float, 16, 4, 4); + DUMMY_ARRAY(buffer_src, float, 16, 8, 4); +#endif DUMMY_ARRAY(buffer_src, float, 32, 2, 4); DUMMY_ARRAY(buffer_src, float, 32, 4, 4); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vset_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vset_lane.c index 51594068364..e0499df5170 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vset_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vset_lane.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0x88 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0x55, 0xf7 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff1, 0x66, 0xfff3 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0x4840, 0xca80 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1800000, 0x4204cccd }; VECT_VAR_DECL(expected,int,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, @@ -41,6 +42,8 @@ VECT_VAR_DECL(expected,poly,8,16) [] = { 0xf0, 0xf1, 0xf2, 0xf3, 0xfc, 0xfd, 0xdd, 0xff }; VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3, 0xfff4, 0xfff5, 0xee, 0xfff7 }; +VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80, + 0xca00, 0x4480, 0xc900, 0xc880 }; VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1800000, 0xc1700000, 0xc1600000, 0x41333333 }; @@ -61,6 +64,10 @@ void exec_vset_lane (void) /* Initialize input "vector" from "buffer". */ TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + VLOAD(vector, buffer, , float, f, 16, 4); + VLOAD(vector, buffer, q, float, f, 16, 8); +#endif VLOAD(vector, buffer, , float, f, 32, 2); VLOAD(vector, buffer, q, float, f, 32, 4); @@ -75,6 +82,9 @@ void exec_vset_lane (void) TEST_VSET_LANE(, uint, u, 64, 1, 0x88, 0); TEST_VSET_LANE(, poly, p, 8, 8, 0x55, 6); TEST_VSET_LANE(, poly, p, 16, 4, 0x66, 2); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VSET_LANE(, float, f, 16, 4, 8.5f, 2); +#endif TEST_VSET_LANE(, float, f, 32, 2, 33.2f, 1); TEST_VSET_LANE(q, int, s, 8, 16, 0x99, 15); @@ -87,6 +97,9 @@ void exec_vset_lane (void) TEST_VSET_LANE(q, uint, u, 64, 2, 0x11, 1); TEST_VSET_LANE(q, poly, p, 8, 16, 0xDD, 14); TEST_VSET_LANE(q, poly, p, 16, 8, 0xEE, 6); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VSET_LANE(q, float, f, 16, 8, 4.5f, 5); +#endif TEST_VSET_LANE(q, float, f, 32, 4, 11.2f, 3); CHECK_RESULTS(TEST_MSG, ""); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1_lane.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1_lane.c index 08583b88cf3..825d07dbf77 100644 --- a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst1_lane.c @@ -16,6 +16,7 @@ VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf6, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }; VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff2, 0x3333, 0x3333, 0x3333 }; +VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcb80, 0x3333, 0x3333, 0x3333 }; VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1700000, 0x33333333 }; VECT_VAR_DECL(expected,int,8,16) [] = { 0xff, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, @@ -42,6 +43,8 @@ VECT_VAR_DECL(expected,poly,8,16) [] = { 0xfa, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33 }; VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff4, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333, 0x3333 }; +VECT_VAR_DECL(expected,hfloat,16,8) [] = { 0xc900, 0x3333, 0x3333, 0x3333, + 0x3333, 0x3333, 0x3333, 0x3333 }; VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1700000, 0x33333333, 0x33333333, 0x33333333 }; @@ -69,6 +72,9 @@ void exec_vst1_lane (void) TEST_VST1_LANE(, uint, u, 64, 1, 0); TEST_VST1_LANE(, poly, p, 8, 8, 6); TEST_VST1_LANE(, poly, p, 16, 4, 2); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VST1_LANE(, float, f, 16, 4, 1); +#endif TEST_VST1_LANE(, float, f, 32, 2, 1); TEST_VST1_LANE(q, int, s, 8, 16, 15); @@ -81,6 +87,9 @@ void exec_vst1_lane (void) TEST_VST1_LANE(q, uint, u, 64, 2, 0); TEST_VST1_LANE(q, poly, p, 8, 16, 10); TEST_VST1_LANE(q, poly, p, 16, 8, 4); +#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) + TEST_VST1_LANE(q, float, f, 16, 8, 6); +#endif TEST_VST1_LANE(q, float, f, 32, 4, 1); CHECK_RESULTS(TEST_MSG, ""); diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_f16_indices_1.c new file mode 100644 index 00000000000..dbf5241b591 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst2_lane_f16 (float16_t * p, float16x4x2_t v) +{ + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst2_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst2_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_f16_indices_1.c new file mode 100644 index 00000000000..e3c0296534b --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst2q_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst2q_lane_f16 (float16_t * p, float16x8x2_t v) +{ + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst2q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst2q_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_f16_indices_1.c new file mode 100644 index 00000000000..406dfd410a1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst3_lane_f16 (float16_t * p, float16x4x3_t v) +{ + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst3_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst3_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_f16_indices_1.c new file mode 100644 index 00000000000..4e8b24cff8a --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst3q_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst3q_lane_f16 (float16_t * p, float16x8x3_t v) +{ + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst3q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst3q_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_f16_indices_1.c new file mode 100644 index 00000000000..0fe65116712 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst4_lane_f16 (float16_t * p, float16x4x4_t v) +{ + /* { dg-error "lane 4 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst4_lane_f16 (p, v, 4); + /* { dg-error "lane -1 out of range 0 - 3" "" { xfail arm*-*-* } 0 } */ + vst4_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_f16_indices_1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_f16_indices_1.c new file mode 100644 index 00000000000..9a5f09aa5fa --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vst4q_lane_f16_indices_1.c @@ -0,0 +1,15 @@ +#include <arm_neon.h> + +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */ +/* { dg-excess-errors "" { xfail arm*-*-* } } */ + +void +f_vst4q_lane_f16 (float16_t * p, float16x8x4_t v) +{ + /* { dg-error "lane 8 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst4q_lane_f16 (p, v, 8); + /* { dg-error "lane -1 out of range 0 - 7" "" { xfail arm*-*-* } 0 } */ + vst4q_lane_f16 (p, v, -1); + return; +} diff --git a/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c index bbb4c6f9d04..ffa4d229922 100644 --- a/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_pwr.c @@ -1,15 +1,23 @@ -/* { dg-do run } */ - -#include <stdio.h> -#include <assert.h> +/* { dg-do compile } */ +/* { dg-options "-O1" } */ #define align (1ul << __ARM_ALIGN_MAX_PWR) static int x __attribute__ ((aligned (align))); +static int y __attribute__ ((aligned (align))); + +extern void foo (int *x, int *y); +extern int bar (int x, int y); int -main () +dummy () { - assert ((((unsigned long)&x) & (align - 1)) == 0); + int result; - return 0; + foo (&x, &y); + result = bar (x, y); + + return result; } + +/* { dg-final { scan-assembler-times "zero\t4" 2 } } */ +/* { dg-final { scan-assembler "zero\t268435452" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c b/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c index 7a6355b054e..7f356fe300a 100644 --- a/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c +++ b/gcc/testsuite/gcc.target/aarch64/arm_align_max_stack_pwr.c @@ -1,15 +1,20 @@ -/* { dg-do run } */ - -#include <stdio.h> -#include <assert.h> +/* { dg-do compile } */ +/* { dg-options "-O1" } */ #define align (1ul << __ARM_ALIGN_MAX_STACK_PWR) +extern void foo (int *x); +extern int bar (int x); int -main () +dummy () { int x __attribute__ ((aligned (align))); + int result; + + foo (&x); + result = bar (x); - assert ((((unsigned long)&x) & (align - 1)) == 0); - return 0; + return result; } + +/* { dg-final { scan-assembler "and\tx\[0-9\]+, x\[0-9\]+, -65536" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mod_2.c b/gcc/testsuite/gcc.target/aarch64/mod_2.c new file mode 100644 index 00000000000..2645c18e741 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mod_2.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=cortex-a57 -save-temps" } */ + +#include "mod_2.x" + +/* { dg-final { scan-assembler "csneg\t\[wx\]\[0-9\]*" } } */ +/* { dg-final { scan-assembler-times "and\t\[wx\]\[0-9\]*" 1 } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mod_2.x b/gcc/testsuite/gcc.target/aarch64/mod_2.x new file mode 100644 index 00000000000..2b079a4b883 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mod_2.x @@ -0,0 +1,5 @@ +int +f (int x) +{ + return x % 2; +} diff --git a/gcc/testsuite/gcc.target/aarch64/mod_256.c b/gcc/testsuite/gcc.target/aarch64/mod_256.c new file mode 100644 index 00000000000..567332c04e1 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mod_256.c @@ -0,0 +1,6 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcpu=cortex-a57 -save-temps" } */ + +#include "mod_256.x" + +/* { dg-final { scan-assembler "csneg\t\[wx\]\[0-9\]*" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/mod_256.x b/gcc/testsuite/gcc.target/aarch64/mod_256.x new file mode 100644 index 00000000000..c1de42ce389 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/mod_256.x @@ -0,0 +1,5 @@ +int +f (int x) +{ + return x % 256; +} diff --git a/gcc/testsuite/gcc.target/aarch64/pic-small.c b/gcc/testsuite/gcc.target/aarch64/pic-small.c index 282e4d073c0..2ea056af27d 100644 --- a/gcc/testsuite/gcc.target/aarch64/pic-small.c +++ b/gcc/testsuite/gcc.target/aarch64/pic-small.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target aarch64_small_fpic } */ /* { dg-options "-O2 -fpic -fno-inline --save-temps" } */ +/* { dg-skip-if "-fpic for AArch64 small code model" { aarch64*-*-* } { "-mcmodel=tiny" "-mcmodel=large" } { "" } } */ void abort (); int global_a; diff --git a/gcc/testsuite/gcc.target/aarch64/vget_high_1.c b/gcc/testsuite/gcc.target/aarch64/vget_high_1.c index 4cb872da2cd..b6b57e0c546 100644 --- a/gcc/testsuite/gcc.target/aarch64/vget_high_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vget_high_1.c @@ -14,6 +14,7 @@ VARIANT (int8_t, 8, int8x8_t, int8x16_t, s8) \ VARIANT (int16_t, 4, int16x4_t, int16x8_t, s16) \ VARIANT (int32_t, 2, int32x2_t, int32x4_t, s32) \ VARIANT (int64_t, 1, int64x1_t, int64x2_t, s64) \ +VARIANT (float16_t, 4, float16x4_t, float16x8_t, f16) \ VARIANT (float32_t, 2, float32x2_t, float32x4_t, f32) \ VARIANT (float64_t, 1, float64x1_t, float64x2_t, f64) @@ -51,6 +52,8 @@ main (int argc, char **argv) int16_t int16_t_data[8] = { -17, 19, 3, -999, 44048, 505, 9999, 1000}; int32_t int32_t_data[4] = { 123456789, -987654321, -135792468, 975318642 }; int64_t int64_t_data[2] = {0xfedcba9876543210LL, 0xdeadbabecafebeefLL }; + float16_t float16_t_data[8] = { 1.25, 4.5, 7.875, 2.3125, 5.675, 8.875, + 3.6875, 6.75}; float32_t float32_t_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; float64_t float64_t_data[2] = { 1.01001000100001, 12345.6789 }; diff --git a/gcc/testsuite/gcc.target/aarch64/vget_low_1.c b/gcc/testsuite/gcc.target/aarch64/vget_low_1.c index f8016ef7312..2223676521c 100644 --- a/gcc/testsuite/gcc.target/aarch64/vget_low_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vget_low_1.c @@ -14,6 +14,7 @@ VARIANT (int8_t, 8, int8x8_t, int8x16_t, s8) \ VARIANT (int16_t, 4, int16x4_t, int16x8_t, s16) \ VARIANT (int32_t, 2, int32x2_t, int32x4_t, s32) \ VARIANT (int64_t, 1, int64x1_t, int64x2_t, s64) \ +VARIANT (float16_t, 4, float16x4_t, float16x8_t, f16) \ VARIANT (float32_t, 2, float32x2_t, float32x4_t, f32) \ VARIANT (float64_t, 1, float64x1_t, float64x2_t, f64) @@ -51,6 +52,8 @@ main (int argc, char **argv) int16_t int16_t_data[8] = { -17, 19, 3, -999, 44048, 505, 9999, 1000}; int32_t int32_t_data[4] = { 123456789, -987654321, -135792468, 975318642 }; int64_t int64_t_data[2] = {0xfedcba9876543210LL, 0xdeadbabecafebeefLL }; + float16_t float16_t_data[8] = { 1.25, 4.5, 7.875, 2.3125, 5.675, 8.875, + 3.6875, 6.75}; float32_t float32_t_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; float64_t float64_t_data[2] = { 1.01001000100001, 12345.6789 }; diff --git a/gcc/testsuite/gcc.target/aarch64/vld1-vst1_1.c b/gcc/testsuite/gcc.target/aarch64/vld1-vst1_1.c index f8c6edb3bcf..fa9ef0f4e43 100644 --- a/gcc/testsuite/gcc.target/aarch64/vld1-vst1_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vld1-vst1_1.c @@ -31,6 +31,7 @@ THING (int8x8_t, 8, int8_t, _s8) \ THING (uint8x8_t, 8, uint8_t, _u8) \ THING (int16x4_t, 4, int16_t, _s16) \ THING (uint16x4_t, 4, uint16_t, _u16) \ +THING (float16x4_t, 4, float16_t, _f16) \ THING (int32x2_t, 2, int32_t, _s32) \ THING (uint32x2_t, 2, uint32_t, _u32) \ THING (float32x2_t, 2, float32_t, _f32) \ @@ -38,6 +39,7 @@ THING (int8x16_t, 16, int8_t, q_s8) \ THING (uint8x16_t, 16, uint8_t, q_u8) \ THING (int16x8_t, 8, int16_t, q_s16) \ THING (uint16x8_t, 8, uint16_t, q_u16) \ +THING (float16x8_t, 8, float16_t, q_f16)\ THING (int32x4_t, 4, int32_t, q_s32) \ THING (uint32x4_t, 4, uint32_t, q_u32) \ THING (float32x4_t, 4, float32_t, q_f32)\ diff --git a/gcc/testsuite/gcc.target/aarch64/vld1_lane.c b/gcc/testsuite/gcc.target/aarch64/vld1_lane.c index 463c88c0a5f..c70df7135c1 100644 --- a/gcc/testsuite/gcc.target/aarch64/vld1_lane.c +++ b/gcc/testsuite/gcc.target/aarch64/vld1_lane.c @@ -16,6 +16,7 @@ VARIANT (int32, , 2, _s32, 0) \ VARIANT (int64, , 1, _s64, 0) \ VARIANT (poly8, , 8, _p8, 7) \ VARIANT (poly16, , 4, _p16, 2) \ +VARIANT (float16, , 4, _f16, 3) \ VARIANT (float32, , 2, _f32, 1) \ VARIANT (float64, , 1, _f64, 0) \ VARIANT (uint8, q, 16, _u8, 13) \ @@ -28,6 +29,7 @@ VARIANT (int32, q, 4, _s32, 1) \ VARIANT (int64, q, 2, _s64, 1) \ VARIANT (poly8, q, 16, _p8, 7) \ VARIANT (poly16, q, 8, _p16, 4) \ +VARIANT (float16, q, 8, _f16, 3)\ VARIANT (float32, q, 4, _f32, 2)\ VARIANT (float64, q, 2, _f64, 1) @@ -76,6 +78,7 @@ main (int argc, char **argv) int64_t int64_data = 0x1234567890abcdefLL; poly8_t poly8_data = 13; poly16_t poly16_data = 11111; + float16_t float16_data = 8.75; float32_t float32_data = 3.14159; float64_t float64_data = 1.010010001; diff --git a/gcc/testsuite/gcc.target/aarch64/vldN_1.c b/gcc/testsuite/gcc.target/aarch64/vldN_1.c index b64de16a165..caac94f86ce 100644 --- a/gcc/testsuite/gcc.target/aarch64/vldN_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vldN_1.c @@ -39,6 +39,7 @@ VARIANT (int32, 2, STRUCT, _s32) \ VARIANT (int64, 1, STRUCT, _s64) \ VARIANT (poly8, 8, STRUCT, _p8) \ VARIANT (poly16, 4, STRUCT, _p16) \ +VARIANT (float16, 4, STRUCT, _f16) \ VARIANT (float32, 2, STRUCT, _f32) \ VARIANT (float64, 1, STRUCT, _f64) \ VARIANT (uint8, 16, STRUCT, q_u8) \ @@ -51,6 +52,7 @@ VARIANT (int32, 4, STRUCT, q_s32) \ VARIANT (int64, 2, STRUCT, q_s64) \ VARIANT (poly8, 16, STRUCT, q_p8) \ VARIANT (poly16, 8, STRUCT, q_p16) \ +VARIANT (float16, 8, STRUCT, q_f16) \ VARIANT (float32, 4, STRUCT, q_f32) \ VARIANT (float64, 2, STRUCT, q_f64) diff --git a/gcc/testsuite/gcc.target/aarch64/vldN_dup_1.c b/gcc/testsuite/gcc.target/aarch64/vldN_dup_1.c index 9af0565d617..68c3fc34f5a 100644 --- a/gcc/testsuite/gcc.target/aarch64/vldN_dup_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vldN_dup_1.c @@ -16,6 +16,7 @@ VARIANT (int32, , 2, _s32, STRUCT) \ VARIANT (int64, , 1, _s64, STRUCT) \ VARIANT (poly8, , 8, _p8, STRUCT) \ VARIANT (poly16, , 4, _p16, STRUCT) \ +VARIANT (float16, , 4, _f16, STRUCT) \ VARIANT (float32, , 2, _f32, STRUCT) \ VARIANT (float64, , 1, _f64, STRUCT) \ VARIANT (uint8, q, 16, _u8, STRUCT) \ @@ -28,6 +29,7 @@ VARIANT (int32, q, 4, _s32, STRUCT) \ VARIANT (int64, q, 2, _s64, STRUCT) \ VARIANT (poly8, q, 16, _p8, STRUCT) \ VARIANT (poly16, q, 8, _p16, STRUCT) \ +VARIANT (float16, q, 8, _f16, STRUCT) \ VARIANT (float32, q, 4, _f32, STRUCT) \ VARIANT (float64, q, 2, _f64, STRUCT) @@ -74,6 +76,7 @@ main (int argc, char **argv) int64_t *int64_data = (int64_t *)uint64_data; poly8_t poly8_data[4] = { 0, 7, 13, 18, }; poly16_t poly16_data[4] = { 11111, 2222, 333, 44 }; + float16_t float16_data[4] = { 1.0625, 3.125, 0.03125, 7.75 }; float32_t float32_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; float64_t float64_data[4] = { 1.010010001, 12345.6789, -9876.54321, 1.618 }; diff --git a/gcc/testsuite/gcc.target/aarch64/vldN_lane_1.c b/gcc/testsuite/gcc.target/aarch64/vldN_lane_1.c index 13ab45459f4..6837a116117 100644 --- a/gcc/testsuite/gcc.target/aarch64/vldN_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vldN_lane_1.c @@ -16,6 +16,7 @@ VARIANT (int32, , 2, _s32, 0, STRUCT) \ VARIANT (int64, , 1, _s64, 0, STRUCT) \ VARIANT (poly8, , 8, _p8, 7, STRUCT) \ VARIANT (poly16, , 4, _p16, 1, STRUCT) \ +VARIANT (float16, , 4, _f16, 3, STRUCT) \ VARIANT (float32, , 2, _f32, 1, STRUCT) \ VARIANT (float64, , 1, _f64, 0, STRUCT) \ VARIANT (uint8, q, 16, _u8, 14, STRUCT) \ @@ -28,6 +29,7 @@ VARIANT (int32, q, 4, _s32, 2, STRUCT) \ VARIANT (int64, q, 2, _s64, 1, STRUCT) \ VARIANT (poly8, q, 16, _p8, 12, STRUCT) \ VARIANT (poly16, q, 8, _p16, 5, STRUCT) \ +VARIANT (float16, q, 8, _f16, 7, STRUCT)\ VARIANT (float32, q, 4, _f32, 1, STRUCT)\ VARIANT (float64, q, 2, _f64, 0, STRUCT) @@ -71,7 +73,7 @@ main (int argc, char **argv) { /* Original data for all vector formats. */ uint64_t orig_data[8] = {0x1234567890abcdefULL, 0x13579bdf02468aceULL, - 0x012389ab4567cdefULL, 0xfeeddadacafe0431ULL, + 0x012389ab4567cdefULL, 0xdeeddadacafe0431ULL, 0x1032547698badcfeULL, 0xbadbadbadbad0badULL, 0x0102030405060708ULL, 0x0f0e0d0c0b0a0908ULL}; @@ -87,6 +89,7 @@ main (int argc, char **argv) int64_t *int64_data = (int64_t *)uint64_data; poly8_t poly8_data[4] = { 0, 7, 13, 18, }; poly16_t poly16_data[4] = { 11111, 2222, 333, 44 }; + float16_t float16_data[4] = { 0.8125, 7.5, 19, 0.046875 }; float32_t float32_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; float64_t float64_data[4] = { 1.010010001, 12345.6789, -9876.54321, 1.618 }; diff --git a/gcc/testsuite/gcc.target/aarch64/vset_lane_1.c b/gcc/testsuite/gcc.target/aarch64/vset_lane_1.c index 5fb11399f20..bc0132c20a7 100644 --- a/gcc/testsuite/gcc.target/aarch64/vset_lane_1.c +++ b/gcc/testsuite/gcc.target/aarch64/vset_lane_1.c @@ -16,6 +16,7 @@ VARIANT (int32_t, , 2, int32x2_t, _s32, 0) \ VARIANT (int64_t, , 1, int64x1_t, _s64, 0) \ VARIANT (poly8_t, , 8, poly8x8_t, _p8, 6) \ VARIANT (poly16_t, , 4, poly16x4_t, _p16, 2) \ +VARIANT (float16_t, , 4, float16x4_t, _f16, 3) \ VARIANT (float32_t, , 2, float32x2_t, _f32, 1) \ VARIANT (float64_t, , 1, float64x1_t, _f64, 0) \ VARIANT (uint8_t, q, 16, uint8x16_t, _u8, 11) \ @@ -28,6 +29,7 @@ VARIANT (int32_t, q, 4, int32x4_t, _s32, 3) \ VARIANT (int64_t, q, 2, int64x2_t, _s64, 0) \ VARIANT (poly8_t, q, 16, poly8x16_t, _p8, 14) \ VARIANT (poly16_t, q, 8, poly16x8_t, _p16, 6) \ +VARIANT (float16_t, q, 8, float16x8_t, _f16, 6) \ VARIANT (float32_t, q, 4, float32x4_t, _f32, 2) \ VARIANT (float64_t, q, 2, float64x2_t, _f64, 1) @@ -76,6 +78,9 @@ main (int argc, char **argv) poly8_t poly8_t_data[16] = { 0, 7, 13, 18, 22, 25, 27, 28, 29, 31, 34, 38, 43, 49, 56, 64 }; poly16_t poly16_t_data[8] = { 11111, 2222, 333, 44, 5, 65432, 54321, 43210 }; + float16_t float16_t_data[8] = { 1.25, 4.5, 7.875, 2.3125, 5.675, 8.875, + 3.6875, 6.75}; + float32_t float32_t_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; float64_t float64_t_data[2] = { 1.01001000100001, 12345.6789 }; diff --git a/gcc/testsuite/gcc.target/arm/mod_2.c b/gcc/testsuite/gcc.target/arm/mod_2.c new file mode 100644 index 00000000000..93017a10683 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mod_2.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O2 -mcpu=cortex-a57 -save-temps" } */ + +#include "../aarch64/mod_2.x" + +/* { dg-final { scan-assembler "rsblt\tr\[0-9\]*" } } */ +/* { dg-final { scan-assembler-times "and\tr\[0-9\].*1" 1 } } */ diff --git a/gcc/testsuite/gcc.target/arm/mod_256.c b/gcc/testsuite/gcc.target/arm/mod_256.c new file mode 100644 index 00000000000..ccb7f3cf68d --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mod_256.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm32 } */ +/* { dg-options "-O2 -mcpu=cortex-a57 -save-temps" } */ + +#include "../aarch64/mod_256.x" + +/* { dg-final { scan-assembler "rsbpl\tr\[0-9\]*" } } */ + diff --git a/gcc/testsuite/gcc.target/arm/pr63210.c b/gcc/testsuite/gcc.target/arm/pr63210.c index c3ae92801f5..9b63a67d3f0 100644 --- a/gcc/testsuite/gcc.target/arm/pr63210.c +++ b/gcc/testsuite/gcc.target/arm/pr63210.c @@ -1,6 +1,8 @@ /* { dg-do assemble } */ /* { dg-options "-mthumb -Os " } */ /* { dg-require-effective-target arm_thumb1_ok } */ +/* { dg-skip-if "do not test on armv4t" { *-*-* } { "-march=armv4t" } } */ +/* { dg-additional-options "-march=armv5t" {target arm_arch_v5t_ok} } */ int foo1 (int c); int foo2 (int c); diff --git a/gcc/testsuite/gcc.target/arm/pr67439_1.c b/gcc/testsuite/gcc.target/arm/pr67439_1.c new file mode 100644 index 00000000000..f7a6128758a --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr67439_1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_thumb2_ok } */ +/* { dg-options "-O1 -mfp16-format=ieee -march=armv7-a -mfpu=neon -mthumb -mrestrict-it" } */ + +__fp16 h0 = -1.0; + +void +f (__fp16 *p) +{ + h0 = 1.0; +} diff --git a/gcc/testsuite/gcc.target/avr/pr65210.c b/gcc/testsuite/gcc.target/avr/pr65210.c new file mode 100644 index 00000000000..1aed4417c1f --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/pr65210.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ + +/* This testcase exposes PR65210. Usage of the io_low attribute + causes assertion failure because code only looks for the io + attribute if SYMBOL_FLAG_IO is set. */ + +volatile char q __attribute__((io_low,address(0x81))); diff --git a/gcc/testsuite/gcc.target/i386/avx512f-scatter-1.c b/gcc/testsuite/gcc.target/i386/avx512f-scatter-1.c new file mode 100644 index 00000000000..575f3bfa70c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-scatter-1.c @@ -0,0 +1,218 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx512f } */ +/* { dg-options "-O3 -mavx512f" } */ + +#define AVX512F + +#include "avx512f-check.h" + +#define N 1024 +float vf1[N], vf2[2*N+16]; +double vd1[N], vd2[2*N+16]; +int vi1[N], vi2[2*N+16], k[N]; +long vl1[N], vl2[2*N+16], l[N]; + +__attribute__((noinline, noclone)) void +f1 (void) +{ + int i; + for (i = 0; i < N; i++) + vf2[k[i]] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f2 (void) +{ + int i; + for (i = 0; i < N; i++) + vi2[k[i]] = vi1[i]; +} + +__attribute__((noinline, noclone)) void +f3 (int x) +{ + int i; + for (i = 0; i < N; i++) + vf2[k[i] + x] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f4 (int x) +{ + int i; + for (i = 0; i < N; i++) + vi2[k[i] + x] = vi1[i]; +} + +__attribute__((noinline, noclone)) void +f5 (void) +{ + int i; + for (i = 0; i < N; i++) + vd2[k[i]] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f6 (void) +{ + int i; + for (i = 0; i < N; i++) + vl2[k[i]] = vl1[i]; +} + +__attribute__((noinline, noclone)) void +f7 (int x) +{ + int i; + for (i = 0; i < N; i++) + vd2[k[i] + x] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f8 (int x) +{ + int i; + for (i = 0; i < N; i++) + vl2[k[i] + x] = vl1[i]; +} + +__attribute__((noinline, noclone)) void +f9 (void) +{ + int i; + for (i = 0; i < N; i++) + vf2[l[i]] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f10 (void) +{ + int i; + for (i = 0; i < N; i++) + vi2[l[i]] = vi1[i]; +} + +__attribute__((noinline, noclone)) void +f11 (long x) +{ + int i; + for (i = 0; i < N; i++) + vf2[l[i] + x] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f12 (long x) +{ + int i; + for (i = 0; i < N; i++) + vi2[l[i] + x] = vi1[i]; +} + +__attribute__((noinline, noclone)) void +f13 (void) +{ + int i; + for (i = 0; i < N; i++) + vd2[l[i]] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f14 (void) +{ + int i; + for (i = 0; i < N; i++) + vl2[l[i]] = vl1[i]; +} + +__attribute__((noinline, noclone)) void +f15 (long x) +{ + int i; + for (i = 0; i < N; i++) + vd2[l[i] + x] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f16 (long x) +{ + int i; + for (i = 0; i < N; i++) + vl2[l[i] + x] = vl1[i]; +} + +static void +avx512f_test (void) +{ + int i; + + for (i = 0; i < N; i++) + { + asm (""); + vf1[i] = 17.0f + i; + vd1[i] = 19.0 + i; + vi1[i] = 21 + i; + vl1[i] = 23L + i; + } + for (i = 0; i < N; i++) + { + asm (""); + k[i] = (i % 2) ? (N / 2 + i) : (N / 2 - i / 2); + l[i] = 2 * i + i % 2; + } + + f1 (); + f2 (); + for (i = 0; i < N; i++) + if (vf2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 17 + || vi2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 21) + abort (); + + f3 (12); + f4 (14); + for (i = 0; i < N; i++) + if (vf2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 12] != i + 17 + || vi2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 14] != i + 21) + abort (); + + f5 (); + f6 (); + for (i = 0; i < N; i++) + if (vd2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 19 + || vl2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 23) + abort (); + + f7 (7); + f8 (9); + for (i = 0; i < N; i++) + if (vd2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 7] != i + 19 + || vl2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 9] != i + 23) + abort (); + + f9 (); + f10 (); + for (i = 0; i < N; i++) + if (vf2[2 * i + i % 2] != i + 17 + || vi2[2 * i + i % 2] != i + 21) + abort (); + + f11 (2); + f12 (4); + for (i = 0; i < N; i++) + if (vf2[2 * i + i % 2 + 2] != i + 17 + || vi2[2 * i + i % 2 + 4] != i + 21) + abort (); + + f13 (); + f14 (); + for (i = 0; i < N; i++) + if (vd2[2 * i + i % 2] != i + 19 + || vl2[2 * i + i % 2] != i + 23) + abort (); + + f15 (13); + f16 (15); + for (i = 0; i < N; i++) + if (vd2[2 * i + i % 2 + 13] != i + 19 + || vl2[2 * i + i % 2 + 15] != i + 23) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-scatter-2.c b/gcc/testsuite/gcc.target/i386/avx512f-scatter-2.c new file mode 100644 index 00000000000..c59ce234f17 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-scatter-2.c @@ -0,0 +1,217 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx512f } */ +/* { dg-options "-O3 -mavx512f" } */ + +#define AVX512F + +#include "avx512f-check.h" + +#define N 1024 +float vf1[N], vf2[2*N+16]; +double vd1[N], vd2[2*N+16]; +int k[N]; +long l[N]; +short n[2*N+16]; + +__attribute__((noinline, noclone)) void +f1 (void) +{ + int i; + for (i = 0; i < N; i++) + vf2[k[i]] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f2 (void) +{ + int i; + for (i = 0; i < N; i++) + n[k[i]] = (int) vf1[i]; +} + +__attribute__((noinline, noclone)) void +f3 (int x) +{ + int i; + for (i = 0; i < N; i++) + vf2[k[i] + x] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f4 (int x) +{ + int i; + for (i = 0; i < N; i++) + n[k[i] + x] = (int) vf1[i]; +} + +__attribute__((noinline, noclone)) void +f5 (void) +{ + int i; + for (i = 0; i < N; i++) + vd2[k[i]] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f6 (void) +{ + int i; + for (i = 0; i < N; i++) + n[k[i]] = (int) vd1[i]; +} + +__attribute__((noinline, noclone)) void +f7 (int x) +{ + int i; + for (i = 0; i < N; i++) + vd2[k[i] + x] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f8 (int x) +{ + int i; + for (i = 0; i < N; i++) + n[k[i] + x] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f9 (void) +{ + int i; + for (i = 0; i < N; i++) + vf2[l[i]] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f10 (void) +{ + int i; + for (i = 0; i < N; i++) + n[l[i]] = (int) vf1[i]; +} + +__attribute__((noinline, noclone)) void +f11 (long x) +{ + int i; + for (i = 0; i < N; i++) + vf2[l[i] + x] = vf1[i]; +} + +__attribute__((noinline, noclone)) void +f12 (long x) +{ + int i; + for (i = 0; i < N; i++) + n[l[i] + x] = (int) vf1[i]; +} + +__attribute__((noinline, noclone)) void +f13 (void) +{ + int i; + for (i = 0; i < N; i++) + vd2[l[i]] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f14 (void) +{ + int i; + for (i = 0; i < N; i++) + n[l[i]] = (int) vd1[i]; +} + +__attribute__((noinline, noclone)) void +f15 (long x) +{ + int i; + for (i = 0; i < N; i++) + vd2[l[i] + x] = vd1[i]; +} + +__attribute__((noinline, noclone)) void +f16 (long x) +{ + int i; + for (i = 0; i < N; i++) + n[l[i] + x] = (int) vd1[i]; +} + +static void +avx512f_test (void) +{ + int i; + + for (i = 0; i < N; i++) + { + asm (""); + vf1[i] = 17.0f + i; + vd1[i] = 19.0 + i; + } + for (i = 0; i < N; i++) + { + asm (""); + k[i] = (i % 2) ? (N / 2 + i) : (N / 2 - i / 2); + l[i] = 2 * i + i % 2; + } + + f1 (); + f2 (); + for (i = 0; i < N; i++) + if (vf2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 17 + || n[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 17) + abort (); + + f3 (12); + f4 (14); + for (i = 0; i < N; i++) + if (vf2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 12] != i + 17 + || n[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 14] != i + 17) + abort (); + + f5 (); + f6 (); + for (i = 0; i < N; i++) + if (vd2[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 19 + || n[(i % 2) ? (N / 2 + i) : (N / 2 - i / 2)] != i + 19) + abort (); + + f7 (7); + f8 (9); + for (i = 0; i < N; i++) + if (vd2[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 7] != i + 19 + || n[((i % 2) ? (N / 2 + i) : (N / 2 - i / 2)) + 9] != i + 19) + abort (); + + f9 (); + f10 (); + for (i = 0; i < N; i++) + if (vf2[2 * i + i % 2] != i + 17 + || n[2 * i + i % 2] != i + 17) + abort (); + + f11 (2); + f12 (4); + for (i = 0; i < N; i++) + if (vf2[2 * i + i % 2 + 2] != i + 17 + || n[2 * i + i % 2 + 4] != i + 17) + abort (); + + f13 (); + f14 (); + for (i = 0; i < N; i++) + if (vd2[2 * i + i % 2] != i + 19 + || n[2 * i + i % 2] != i + 19) + abort (); + + f15 (13); + f16 (15); + for (i = 0; i < N; i++) + if (vd2[2 * i + i % 2 + 13] != i + 19 + || n[2 * i + i % 2 + 15] != i + 19) + abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/avx512f-scatter-3.c b/gcc/testsuite/gcc.target/i386/avx512f-scatter-3.c new file mode 100644 index 00000000000..37137fd268a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512f-scatter-3.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx512f } */ +/* { dg-options "-O3 -mavx512f" } */ + +#define AVX512F + +#include "avx512f-check.h" + +#define N 1024 +int a[N], b[N]; + +__attribute__((noinline, noclone)) void +foo (float *__restrict p, float *__restrict q, + int s1, int s2, int s3) +{ + int i; + for (i = 0; i < (N / 8); i++) + p[a[i] * s1 + b[i] * s2 + s3] = q[i]; +} + +static void +avx512f_test (void) +{ + int i; + float c[N], d[N]; + for (i = 0; i < N; i++) + { + a[i] = (i * 7) & (N / 8 - 1); + b[i] = (i * 13) & (N / 8 - 1); + c[i] = 179.13 + i; + } + foo (d, c, 3, 2, 4); + for (i = 0; i < (N / 8); i++) + if (d[a[i] * 3 + b[i] * 2 + 4] != (float) (179.13 + i)) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c new file mode 100644 index 00000000000..7463781281e --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-20.c @@ -0,0 +1,29 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -mcpu=power8 -maltivec" } */ + +/* The expansion for vector character multiply introduces a vperm operation. + This tests that the swap optimization to remove swaps by changing the + vperm mask results in correct code. */ + +#include <altivec.h> + +void abort (); + +vector unsigned char r; +vector unsigned char v = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +vector unsigned char i = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; +vector unsigned char e = + {0, 2, 6, 12, 20, 30, 42, 56, 72, 90, 110, 132, 156, 182, 210, 240}; + +int main () +{ + int j; + r = v * i; + if (!vec_all_eq (r, e)) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c b/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c new file mode 100644 index 00000000000..b981fcf2f36 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/swaps-p8-21.c @@ -0,0 +1,27 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } +/* { dg-options "-O2 -mcpu=power8 -maltivec" } */ + +/* The expansion for vector character multiply introduces a vperm operation. + This tests that changing the vperm mask allows us to remove all swaps + from the generated code. */ + +#include <altivec.h> + +void abort (); + +vector unsigned char r; +vector unsigned char v = + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +vector unsigned char i = + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; + +int main () +{ + int j; + r = v * i; + return 0; +} + +/* { dg-final { scan-assembler-times "vperm" 1 } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vec-mult-char-1.c b/gcc/testsuite/gcc.target/powerpc/vec-mult-char-1.c new file mode 100644 index 00000000000..4c9dbdc8188 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-mult-char-1.c @@ -0,0 +1,53 @@ +/* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +extern void abort (void); + +vector unsigned char vmului(vector unsigned char v, + vector unsigned char i) +{ + return v * i; +} + +vector signed char vmulsi(vector signed char v, + vector signed char i) +{ + return v * i; +} + +int main () +{ + vector unsigned char a = {2, 4, 6, 8, 10, 12, 14, 16, + 18, 20, 22, 24, 26, 28, 30, 32}; + vector unsigned char b = {3, 6, 9, 12, 15, 18, 21, 24, + 27, 30, 33, 36, 39, 42, 45, 48}; + vector unsigned char c = vmului (a, b); + vector unsigned char expect_c = {6, 24, 54, 96, 150, 216, 38, 128, + 230, 88, 214, 96, 246, 152, 70, 0}; + + vector signed char d = {2, -4, 6, -8, 10, -12, 14, -16, + 18, -20, 22, -24, 26, -28, 30, -32}; + vector signed char e = {3, 6, -9, -12, 15, 18, -21, -24, + 27, 30, -33, -36, 39, 42, -45, -48}; + vector signed char f = vmulsi (d, e); + vector signed char expect_f = {6, -24, -54, 96, -106, 40, -38, -128, + -26, -88, 42, 96, -10, 104, -70, 0}; + + vector signed char g = {127, -128, 126, -126, 125, -125, 124, -124, + 123, -123, 122, -122, 121, -121, 120, -120}; + vector signed char h = { 2, 2, -2, -2, 127, 127, -128, -128, + 10, 10, -10, -10, 64, 65, -64, -65}; + vector signed char i = vmulsi (g, h); + vector signed char expect_i = {-2, 0, 4, -4, 3, -3, 0, 0, + -50, 50, 60, -60, 64, 71, 0, 120}; + + if (!vec_all_eq (c, expect_c)) + abort (); + if (!vec_all_eq (f, expect_f)) + abort (); + if (!vec_all_eq (i, expect_i)) + abort (); +} diff --git a/gcc/testsuite/gcc.target/powerpc/vec-mult-char-2.c b/gcc/testsuite/gcc.target/powerpc/vec-mult-char-2.c new file mode 100644 index 00000000000..04c67109bef --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-mult-char-2.c @@ -0,0 +1,21 @@ +/* { dg-do compile { target { powerpc*-*-* && vmx_hw } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-maltivec" } */ + +#include <altivec.h> + +vector unsigned char vmului(vector unsigned char v, + vector unsigned char i) +{ + return v * i; +} + +vector signed char vmulsi(vector signed char v, + vector signed char i) +{ + return v * i; +} + +/* { dg-final { scan-assembler-times "vmulesb" 2 } } */ +/* { dg-final { scan-assembler-times "vmulosb" 2 } } */ +/* { dg-final { scan-assembler-times "vperm" 2 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/vec-shift.c b/gcc/testsuite/gcc.target/powerpc/vec-shift.c new file mode 100644 index 00000000000..80b59a2d3e7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/vec-shift.c @@ -0,0 +1,20 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */ +/* { dg-options "-mcpu=power7 -O2" } */ + +/* This used to ICE. During gimplification, "i" is widened to an unsigned + int. We used to fail at expand time as we tried to cram an SImode item + into a QImode memory slot. This has been fixed to properly truncate the + shift amount when splatting it into a vector. */ + +typedef unsigned char v16ui __attribute__((vector_size(16))); + +v16ui vslb(v16ui v, unsigned char i) +{ + return v << i; +} + +/* { dg-final { scan-assembler "vspltb" } } */ +/* { dg-final { scan-assembler "vslb" } } */ diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c index b8cf3140bd7..26c189af15d 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-genbytemask-1.c @@ -1,11 +1,13 @@ /* { dg-do run } */ /* { dg-options "-O3 -mzarch -march=z13 --save-temps" } */ /* { dg-require-effective-target vector } */ +/* { dg-require-effective-target int128 } */ typedef unsigned char uv16qi __attribute__((vector_size(16))); typedef unsigned short uv8hi __attribute__((vector_size(16))); typedef unsigned int uv4si __attribute__((vector_size(16))); typedef unsigned long long uv2di __attribute__((vector_size(16))); +typedef unsigned __int128 uv1ti __attribute__((vector_size(16))); uv2di __attribute__((noinline)) foo1 () @@ -45,6 +47,13 @@ foo4 () 0xff, 0, 0xff, 0, 0, 0xff, 0, 0xff }; } + +uv1ti __attribute__((noinline)) +foo5 () +{ + return (uv1ti){ 0xff00ff00ff00ff00ULL }; +} + /* { dg-final { scan-assembler-times "vgbm\t%v24,61605" 1 } } */ int @@ -64,6 +73,10 @@ main () if (foo4()[1] != 0xff) __builtin_abort (); + + if (foo5()[0] != 0xff00ff00ff00ff00ULL) + __builtin_abort (); + return 0; } diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-1.c b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-1.c index b0747f713bb..6093422fd0d 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-1.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-1.c @@ -66,4 +66,3 @@ main () __builtin_abort (); return 0; } - diff --git a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c index e3ae34154ca..46256e92531 100644 --- a/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c +++ b/gcc/testsuite/gcc.target/s390/vector/vec-genmask-2.c @@ -1,10 +1,12 @@ /* { dg-do compile } */ /* { dg-options "-O3 -mzarch -march=z13" } */ +/* { dg-require-effective-target int128 } */ typedef unsigned char uv16qi __attribute__((vector_size(16))); typedef unsigned short uv8hi __attribute__((vector_size(16))); typedef unsigned int uv4si __attribute__((vector_size(16))); typedef unsigned long long uv2di __attribute__((vector_size(16))); +typedef unsigned __int128 uv1ti __attribute__((vector_size(16))); /* The elements differ. */ uv2di __attribute__((noinline)) @@ -43,4 +45,11 @@ foo4 () 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82 }; } + +/* We do not have vgmq. */ +uv1ti +foo5() +{ + return (uv1ti){ ((unsigned __int128)1 << 53) - 1 }; +} /* { dg-final { scan-assembler-not "vgm" } } */ diff --git a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 index a99cf153d9e..d401638ccc8 100644 --- a/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 +++ b/gcc/testsuite/gfortran.dg/graphite/interchange-3.f90 @@ -24,4 +24,4 @@ Program FOO end Program FOO -! { dg-final { scan-tree-dump-times "tiled by" 2 "graphite" } } +! { dg-final { scan-tree-dump-times "tiled by" 5 "graphite" } } diff --git a/gcc/testsuite/gfortran.dg/pr67526.f90 b/gcc/testsuite/gfortran.dg/pr67526.f90 new file mode 100644 index 00000000000..3c0834f28dc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67526.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! Original code from gerhard dot steinmetz dot fortran at t-online dot de +! PR fortran/67526 +program p + character :: c1 = 'abc'(: ! { dg-error "error in SUBSTRING" } + character :: c2 = 'abc'(3: ! { dg-error "error in SUBSTRING" } + character :: c3 = 'abc'(:1 ! { dg-error "error in SUBSTRING" } + character :: c4 = 'abc'(2:2 ! { dg-error "error in SUBSTRING" } +end diff --git a/gcc/testsuite/gfortran.dg/read_dir.f90 b/gcc/testsuite/gfortran.dg/read_dir.f90 index 0e28f9f497e..4009ed69e63 100644 --- a/gcc/testsuite/gfortran.dg/read_dir.f90 +++ b/gcc/testsuite/gfortran.dg/read_dir.f90 @@ -7,13 +7,14 @@ program bug integer ios call system('[ -d junko.dir ] || mkdir junko.dir') open(unit=10, file='junko.dir',iostat=ios,action='read',access='stream') - if (ios.ne.0) call abort + if (ios.ne.0) then + call system('rmdir junko.dir') + call abort + end if read(10, iostat=ios) c if (ios.ne.21) then - close(10) - call system('rmdir junko.dir') + close(10, status='delete') call abort end if - close(10) - call system('rmdir junko.dir') + close(10, status='delete') end program bug diff --git a/gcc/testsuite/gfortran.dg/submodule_11.f08 b/gcc/testsuite/gfortran.dg/submodule_11.f08 new file mode 100644 index 00000000000..20367a9d19d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/submodule_11.f08 @@ -0,0 +1,45 @@ +! { dg-do run } +! Test the fix for PR66993, in which the use associated version of 'i' +! was incorrectly determined to be ambiguous with the 'i', host associated +! in submodule 'sm' from the module 'm'. The principle has been tested with +! the function 'time_two' in addition. +! +! Contributed by Mikael Morin <mikael.morin@sfr.fr> +! +module m + integer, parameter :: i = -1 + interface + module subroutine show_i + end subroutine show_i + end interface +contains + integer function times_two (arg) + integer :: arg + times_two = -2*arg + end function +end module m + +module n + integer, parameter :: i = 2 +contains + integer function times_two (arg) + integer :: arg + times_two = 2*arg + end function +end module n + +submodule (m) sm + use n +contains + module subroutine show_i + if (i .ne. 2) call abort + if (times_two (i) .ne. 4) call abort + end subroutine show_i +end submodule sm + +program p + use m + call show_i + if (i .ne. -1) call abort + if (times_two (i) .ne. 2) call abort +end program diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 363f7fe3877..84aebc9a798 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -124,6 +124,11 @@ proc check_cached_effective_target { prop args } { verbose "check_cached_effective_target $prop: checking $target" 2 set et_cache($prop,target) $target set et_cache($prop,value) [uplevel eval $args] + if {![info exists et_prop_list] + || [lsearch $et_prop_list $prop] < 0} { + lappend et_prop_list $prop + } + verbose "check_cached_effective_target cached list is now: $et_prop_list" 2 } set value $et_cache($prop,value) verbose "check_cached_effective_target $prop: returning $value for $target" 2 @@ -2778,6 +2783,21 @@ proc check_effective_target_arm_neon_fp16_ok { } { check_effective_target_arm_neon_fp16_ok_nocache] } +proc check_effective_target_arm_neon_fp16_hw { } { + if {! [check_effective_target_arm_neon_fp16_ok] } { + return 0 + } + global et_arm_neon_fp16_flags + check_runtime_nocache arm_neon_fp16_hw { + int + main (int argc, char **argv) + { + asm ("vcvt.f32.f16 q1, d0"); + return 0; + } + } $et_arm_neon_fp16_flags +} + proc add_options_for_arm_neon_fp16 { flags } { if { ! [check_effective_target_arm_neon_fp16_ok] } { return "$flags" @@ -4551,7 +4571,8 @@ proc check_effective_target_vect_char_mult { } { if { [istarget aarch64*-*-*] || [istarget ia64-*-*] || [istarget i?86-*-*] || [istarget x86_64-*-*] - || [check_effective_target_arm32] } { + || [check_effective_target_arm32] + || [check_effective_target_powerpc_altivec] } { set et_vect_char_mult_saved 1 } } diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index ebf9dd23f77..c0eab40b139 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3927,6 +3927,49 @@ get_references_in_stmt (gimple stmt, vec<data_ref_loc, va_heap> *references) return clobbers_memory; } + +/* Returns true if the loop-nest has any data reference. */ + +bool +loop_nest_has_data_refs (loop_p loop) +{ + basic_block *bbs = get_loop_body (loop); + vec<data_ref_loc> references; + references.create (3); + + for (unsigned i = 0; i < loop->num_nodes; i++) + { + basic_block bb = bbs[i]; + gimple_stmt_iterator bsi; + + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + gimple stmt = gsi_stmt (bsi); + get_references_in_stmt (stmt, &references); + if (references.length ()) + { + free (bbs); + references.release (); + return true; + } + } + } + free (bbs); + references.release (); + + if (loop->inner) + { + loop = loop->inner; + while (loop) + { + if (loop_nest_has_data_refs (loop)) + return true; + loop = loop->next; + } + } + return false; +} + /* Stores the data references in STMT to DATAREFS. If there is an unanalyzable reference, returns false, otherwise returns true. NEST is the outermost loop of the loop nest in which the references should be analyzed. */ diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h index 18bcc5c89bb..064843933f3 100644 --- a/gcc/tree-data-ref.h +++ b/gcc/tree-data-ref.h @@ -322,6 +322,7 @@ extern bool find_data_references_in_stmt (struct loop *, gimple, extern bool graphite_find_data_references_in_stmt (loop_p, loop_p, gimple, vec<data_reference_p> *); tree find_data_references_in_loop (struct loop *, vec<data_reference_p> *); +bool loop_nest_has_data_refs (loop_p loop); struct data_reference *create_data_ref (loop_p, loop_p, tree, gimple, bool); extern bool find_loop_nest (struct loop *, vec<loop_p> *); extern struct data_dependence_relation *initialize_data_dependence_relation diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index d017479ec2e..c164121fdb4 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -57,6 +57,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-nested.h" #include "cgraph.h" #include "tree-ssa.h" +#include "params.h" /* This pass tries to distribute iterations of loops into several threads. The implementation is straightforward -- for each loop we test whether its @@ -2092,6 +2093,10 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, type = TREE_TYPE (cvar); t = build_omp_clause (loc, OMP_CLAUSE_SCHEDULE); OMP_CLAUSE_SCHEDULE_KIND (t) = OMP_CLAUSE_SCHEDULE_STATIC; + int chunk_size = PARAM_VALUE (PARAM_PARLOOPS_CHUNK_SIZE); + if (chunk_size != 0) + OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (t) + = build_int_cst (integer_type_node, chunk_size); for_stmt = gimple_build_omp_for (NULL, GF_OMP_FOR_KIND_FOR, t, 1, NULL); gimple_set_location (for_stmt, loc); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 9be65de0cd2..10ae5f86d41 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -92,8 +92,7 @@ struct cond_equivalence }; -/* Structure for recording edge equivalences as well as any pending - edge redirections during the dominator optimizer. +/* Structure for recording edge equivalences. Computing and storing the edge equivalences instead of creating them on-demand can save significant amounts of time, particularly @@ -101,10 +100,7 @@ struct cond_equivalence These structures live for a single iteration of the dominator optimizer in the edge's AUX field. At the end of an iteration we - free each of these structures and update the AUX field to point - to any requested redirection target (the code for updating the - CFG and SSA graph for edge redirection expects redirection edge - targets to be in the AUX field for each edge. */ + free each of these structures. */ struct edge_info { @@ -1168,7 +1164,7 @@ pass_dominator::execute (function *fun) /* Create our hash tables. */ avail_exprs = new hash_table<expr_elt_hasher> (1024); avail_exprs_stack.create (20); - const_and_copies = new class const_and_copies (dump_file, dump_flags); + const_and_copies = new class const_and_copies (); need_eh_cleanup = BITMAP_ALLOC (NULL); need_noreturn_fixup.create (0); diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 47725585be9..e944a9ac191 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa.h" #include "cgraph.h" #include "ipa-utils.h" +#include "cfgloop.h" #ifdef ENABLE_CHECKING static void verify_live_on_entry (tree_live_info_p); @@ -820,6 +821,14 @@ remove_unused_locals (void) } } + if (cfun->has_simduid_loops) + { + struct loop *loop; + FOR_EACH_LOOP (loop, 0) + if (loop->simduid && !is_used_p (loop->simduid)) + loop->simduid = NULL_TREE; + } + cfun->has_local_explicit_reg_vars = false; /* Remove unmarked local and global vars from local_decls. */ diff --git a/gcc/tree-ssa-scopedtables.c b/gcc/tree-ssa-scopedtables.c index 41bf8879448..fedd92a850a 100644 --- a/gcc/tree-ssa-scopedtables.c +++ b/gcc/tree-ssa-scopedtables.c @@ -28,13 +28,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-scopedtables.h" #include "tree-ssa-threadedge.h" -const_and_copies::const_and_copies (FILE *file, int flags) -{ - stack.create (20); - dump_file = file; - dump_flags = flags; -} - /* Pop entries off the stack until we hit the NULL marker. For each entry popped, use the SRC/DEST pair to restore SRC to its prior value. */ @@ -42,11 +35,11 @@ const_and_copies::const_and_copies (FILE *file, int flags) void const_and_copies::pop_to_marker (void) { - while (stack.length () > 0) + while (m_stack.length () > 0) { tree prev_value, dest; - dest = stack.pop (); + dest = m_stack.pop (); /* A NULL value indicates we should stop unwinding, otherwise pop off the next entry as they're recorded in pairs. */ @@ -62,7 +55,7 @@ const_and_copies::pop_to_marker (void) fprintf (dump_file, "\n"); } - prev_value = stack.pop (); + prev_value = m_stack.pop (); set_ssa_name_value (dest, prev_value); } } @@ -97,9 +90,9 @@ const_and_copies::record_const_or_copy (tree x, tree y, tree prev_x) } set_ssa_name_value (x, y); - stack.reserve (2); - stack.quick_push (prev_x); - stack.quick_push (x); + m_stack.reserve (2); + m_stack.quick_push (prev_x); + m_stack.quick_push (x); } /* A new value has been assigned to LHS. If necessary, invalidate any @@ -121,16 +114,16 @@ const_and_copies::invalidate (tree lhs) then it's a "stop unwinding" marker. Else the current marker is the SSA_NAME with an equivalence and the prior entry in the stack is what the current element is equivalent to. */ - for (int i = stack.length() - 1; i >= 0; i--) + for (int i = m_stack.length() - 1; i >= 0; i--) { /* Ignore the stop unwinding markers. */ - if ((stack)[i] == NULL) + if ((m_stack)[i] == NULL) continue; /* We want to check the current value of stack[i] to see if it matches LHS. If so, then invalidate. */ - if (SSA_NAME_VALUE ((stack)[i]) == lhs) - record_const_or_copy ((stack)[i], NULL_TREE); + if (SSA_NAME_VALUE ((m_stack)[i]) == lhs) + record_const_or_copy ((m_stack)[i], NULL_TREE); /* Remember, we're dealing with two elements in this case. */ i--; diff --git a/gcc/tree-ssa-scopedtables.h b/gcc/tree-ssa-scopedtables.h index bc30ee67583..f7d9ca4320c 100644 --- a/gcc/tree-ssa-scopedtables.h +++ b/gcc/tree-ssa-scopedtables.h @@ -20,21 +20,40 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_TREE_SSA_SCOPED_TABLES_H #define GCC_TREE_SSA_SCOPED_TABLES_H +/* This class defines an unwindable const/copy equivalence table + layered on top of SSA_NAME_VALUE/set_ssa_name_value. + + Essentially it's just a stack of name,prev value pairs with a + special marker (NULL) to indicate unwind points. */ + class const_and_copies { public: - const_and_copies (FILE *, int); - ~const_and_copies (void) { stack.release (); } - void push_marker (void) { stack.safe_push (NULL_TREE); } + const_and_copies (void) { m_stack.create (20); }; + ~const_and_copies (void) { m_stack.release (); } + + /* Push the unwinding marker onto the stack. */ + void push_marker (void) { m_stack.safe_push (NULL_TREE); } + + /* Restore the const/copies table to its state when the last marker + was pushed. */ void pop_to_marker (void); + + /* Record a single const/copy pair that can be unwound. */ void record_const_or_copy (tree, tree); + + /* Special entry point when we want to provide an explicit previous + value for the first argument. Try to get rid of this in the future. */ void record_const_or_copy (tree, tree, tree); + + /* When threading we need to invalidate certain equivalences after + following a loop backedge. The entries we need to invalidate will + always be in this unwindable stack. This entry point handles + finding and invalidating those entries. */ void invalidate (tree); private: - vec<tree> stack; - FILE *dump_file; - int dump_flags; + vec<tree> m_stack; }; #endif /* GCC_TREE_SSA_SCOPED_TABLES_H */ diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index c1f3c32b526..615eb9f104a 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5619,7 +5619,6 @@ create_variable_info_for_1 (tree decl, const char *name) auto_vec<fieldoff_s> fieldstack; fieldoff_s *fo; unsigned int i; - varpool_node *vnode; if (!declsize || !tree_fits_uhwi_p (declsize)) @@ -5637,12 +5636,10 @@ create_variable_info_for_1 (tree decl, const char *name) /* Collect field information. */ if (use_field_sensitive && var_can_have_subvars (decl) - /* ??? Force us to not use subfields for global initializers - in IPA mode. Else we'd have to parse arbitrary initializers. */ + /* ??? Force us to not use subfields for globals in IPA mode. + Else we'd have to parse arbitrary initializers. */ && !(in_ipa_mode - && is_global_var (decl) - && (vnode = varpool_node::get (decl)) - && vnode->get_constructor ())) + && is_global_var (decl))) { fieldoff_s *fo = NULL; bool notokay = false; @@ -5774,13 +5771,13 @@ create_variable_info_for (tree decl, const char *name) /* If this is a global variable with an initializer and we are in IPA mode generate constraints for it. */ - if (vnode->get_constructor () - && vnode->definition) + ipa_ref *ref; + for (unsigned idx = 0; vnode->iterate_reference (idx, ref); ++idx) { auto_vec<ce_s> rhsc; struct constraint_expr lhs, *rhsp; unsigned i; - get_constraint_for_rhs (vnode->get_constructor (), &rhsc); + get_constraint_for_address_of (ref->referred->decl, &rhsc); lhs.var = vi->id; lhs.offset = 0; lhs.type = SCALAR; diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 451dc2e1c2e..0ad24834feb 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -432,7 +432,8 @@ record_temporary_equivalences_from_stmts_at_dest (edge e, if (cached_lhs && (TREE_CODE (cached_lhs) == SSA_NAME || is_gimple_min_invariant (cached_lhs))) - const_and_copies->record_const_or_copy (gimple_get_lhs (stmt), cached_lhs); + const_and_copies->record_const_or_copy (gimple_get_lhs (stmt), + cached_lhs); else if (backedge_seen) const_and_copies->invalidate (gimple_get_lhs (stmt)); } @@ -1208,7 +1209,8 @@ thread_through_normal_block (edge e, /* Now walk each statement recording any context sensitive temporary equivalences we can detect. */ gimple stmt - = record_temporary_equivalences_from_stmts_at_dest (e, const_and_copies, simplify, + = record_temporary_equivalences_from_stmts_at_dest (e, const_and_copies, + simplify, *backedge_seen_p); /* There's two reasons STMT might be null, and distinguishing @@ -1474,8 +1476,8 @@ thread_across_edge (gcond *dummy_cond, if (!found) found = thread_through_normal_block (path->last ()->e, dummy_cond, handle_dominating_asserts, - const_and_copies, simplify, path, visited, - &backedge_seen) > 0; + const_and_copies, simplify, path, + visited, &backedge_seen) > 0; /* If we were able to thread through a successor of E->dest, then record the jump threading opportunity. */ diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index 3f007b5d3b1..c08479f0b77 100644 --- a/gcc/tree-ssa-uninit.c +++ b/gcc/tree-ssa-uninit.c @@ -1296,7 +1296,8 @@ pred_equal_p (pred_info x1, pred_info x2) return false; c1 = x1.cond_code; - if (x1.invert != x2.invert) + if (x1.invert != x2.invert + && TREE_CODE_CLASS (x2.cond_code) == tcc_comparison) c2 = invert_tree_comparison (x2.cond_code, false); else c2 = x2.cond_code; diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index f1eaef40048..2439bd6390b 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -267,8 +267,8 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, return false; } - if (STMT_VINFO_GATHER_P (stmtinfo_a) - || STMT_VINFO_GATHER_P (stmtinfo_b)) + if (STMT_VINFO_GATHER_SCATTER_P (stmtinfo_a) + || STMT_VINFO_GATHER_SCATTER_P (stmtinfo_b)) { if (dump_enabled_p ()) { @@ -315,8 +315,8 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr, return false; } - if (STMT_VINFO_GATHER_P (stmtinfo_a) - || STMT_VINFO_GATHER_P (stmtinfo_b)) + if (STMT_VINFO_GATHER_SCATTER_P (stmtinfo_a) + || STMT_VINFO_GATHER_SCATTER_P (stmtinfo_b)) { if (dump_enabled_p ()) { @@ -2344,10 +2344,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "zero step in outer loop.\n"); - if (DR_IS_READ (dr)) - return true; - else - return false; + return DR_IS_READ (dr); } } @@ -2997,12 +2994,12 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo) return true; } -/* Check whether a non-affine read in stmt is suitable for gather load - and if so, return a builtin decl for that operation. */ +/* Check whether a non-affine read or write in stmt is suitable for gather load + or scatter store and if so, return a builtin decl for that operation. */ tree -vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep, - tree *offp, int *scalep) +vect_check_gather_scatter (gimple stmt, loop_vec_info loop_vinfo, tree *basep, + tree *offp, int *scalep) { HOST_WIDE_INT scale = 1, pbitpos, pbitsize; struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); @@ -3031,7 +3028,7 @@ vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep, base = TREE_OPERAND (gimple_assign_rhs1 (def_stmt), 0); } - /* The gather builtins need address of the form + /* The gather and scatter builtins need address of the form loop_invariant + vector * {1, 2, 4, 8} or loop_invariant + sign_extend (vector) * { 1, 2, 4, 8 }. @@ -3194,8 +3191,13 @@ vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep, if (offtype == NULL_TREE) offtype = TREE_TYPE (off); - decl = targetm.vectorize.builtin_gather (STMT_VINFO_VECTYPE (stmt_info), - offtype, scale); + if (DR_IS_READ (dr)) + decl = targetm.vectorize.builtin_gather (STMT_VINFO_VECTYPE (stmt_info), + offtype, scale); + else + decl = targetm.vectorize.builtin_scatter (STMT_VINFO_VECTYPE (stmt_info), + offtype, scale); + if (decl == NULL_TREE) return NULL_TREE; @@ -3344,7 +3346,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, gimple stmt; stmt_vec_info stmt_info; tree base, offset, init; - bool gather = false; + enum { SG_NONE, GATHER, SCATTER } gatherscatter = SG_NONE; bool simd_lane_access = false; int vf; @@ -3383,18 +3385,22 @@ again: = DR_IS_READ (dr) && !TREE_THIS_VOLATILE (DR_REF (dr)) && targetm.vectorize.builtin_gather != NULL; + bool maybe_scatter + = DR_IS_WRITE (dr) + && !TREE_THIS_VOLATILE (DR_REF (dr)) + && targetm.vectorize.builtin_scatter != NULL; bool maybe_simd_lane_access = loop_vinfo && loop->simduid; - /* If target supports vector gather loads, or if this might be - a SIMD lane access, see if they can't be used. */ + /* If target supports vector gather loads or scatter stores, or if + this might be a SIMD lane access, see if they can't be used. */ if (loop_vinfo - && (maybe_gather || maybe_simd_lane_access) + && (maybe_gather || maybe_scatter || maybe_simd_lane_access) && !nested_in_vect_loop_p (loop, stmt)) { struct data_reference *newdr = create_data_ref (NULL, loop_containing_stmt (stmt), - DR_REF (dr), stmt, true); + DR_REF (dr), stmt, maybe_scatter ? false : true); gcc_assert (newdr != NULL && DR_REF (newdr)); if (DR_BASE_ADDRESS (newdr) && DR_OFFSET (newdr) @@ -3447,17 +3453,20 @@ again: } } } - if (!simd_lane_access && maybe_gather) + if (!simd_lane_access && (maybe_gather || maybe_scatter)) { dr = newdr; - gather = true; + if (maybe_gather) + gatherscatter = GATHER; + else + gatherscatter = SCATTER; } } - if (!gather && !simd_lane_access) + if (gatherscatter == SG_NONE && !simd_lane_access) free_data_ref (newdr); } - if (!gather && !simd_lane_access) + if (gatherscatter == SG_NONE && !simd_lane_access) { if (dump_enabled_p ()) { @@ -3485,7 +3494,7 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) free_data_ref (dr); return false; } @@ -3520,7 +3529,7 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) free_data_ref (dr); return false; } @@ -3540,7 +3549,7 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) free_data_ref (dr); return false; } @@ -3565,7 +3574,7 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) free_data_ref (dr); return false; } @@ -3703,7 +3712,7 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) free_data_ref (dr); return false; } @@ -3736,10 +3745,10 @@ again: if (bb_vinfo) break; - if (gather || simd_lane_access) + if (gatherscatter != SG_NONE || simd_lane_access) { STMT_VINFO_DATA_REF (stmt_info) = NULL; - if (gather) + if (gatherscatter != SG_NONE) free_data_ref (dr); } return false; @@ -3763,23 +3772,22 @@ again: if (vf > *min_vf) *min_vf = vf; - if (gather) + if (gatherscatter != SG_NONE) { tree off; - - gather = 0 != vect_check_gather (stmt, loop_vinfo, NULL, &off, NULL); - if (gather - && get_vectype_for_scalar_type (TREE_TYPE (off)) == NULL_TREE) - gather = false; - if (!gather) + if (!vect_check_gather_scatter (stmt, loop_vinfo, NULL, &off, NULL) + || get_vectype_for_scalar_type (TREE_TYPE (off)) == NULL_TREE) { STMT_VINFO_DATA_REF (stmt_info) = NULL; free_data_ref (dr); if (dump_enabled_p ()) { - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "not vectorized: not suitable for gather " - "load "); + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + (gatherscatter == GATHER) ? + "not vectorized: not suitable for gather " + "load " : + "not vectorized: not suitable for scatter " + "store "); dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); } @@ -3787,8 +3795,9 @@ again: } datarefs[i] = dr; - STMT_VINFO_GATHER_P (stmt_info) = true; + STMT_VINFO_GATHER_SCATTER_P (stmt_info) = gatherscatter; } + else if (loop_vinfo && TREE_CODE (DR_STEP (dr)) != INTEGER_CST) { diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index f87c0664e5b..359e010f7f9 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -810,10 +810,10 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) return false; } - if (STMT_VINFO_GATHER_P (stmt_vinfo)) + if (STMT_VINFO_GATHER_SCATTER_P (stmt_vinfo)) { tree off; - tree decl = vect_check_gather (stmt, loop_vinfo, NULL, &off, NULL); + tree decl = vect_check_gather_scatter (stmt, loop_vinfo, NULL, &off, NULL); gcc_assert (decl); if (!process_use (stmt, off, loop_vinfo, live_p, relevant, &worklist, true)) @@ -1815,11 +1815,11 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi, if (STMT_VINFO_STRIDED_P (stmt_info)) return false; - if (STMT_VINFO_GATHER_P (stmt_info)) + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) { gimple def_stmt; tree def; - gather_decl = vect_check_gather (stmt, loop_vinfo, &gather_base, + gather_decl = vect_check_gather_scatter (stmt, loop_vinfo, &gather_base, &gather_off, &gather_scale); gcc_assert (gather_decl); if (!vect_is_simple_use_1 (gather_off, NULL, loop_vinfo, NULL, @@ -1879,7 +1879,7 @@ vectorizable_mask_load_store (gimple stmt, gimple_stmt_iterator *gsi, /** Transform. **/ - if (STMT_VINFO_GATHER_P (stmt_info)) + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) { tree vec_oprnd0 = NULL_TREE, op; tree arglist = TYPE_ARG_TYPES (TREE_TYPE (gather_decl)); @@ -5140,6 +5140,12 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, unsigned int vec_num; bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); tree aggr_type; + tree scatter_base = NULL_TREE, scatter_off = NULL_TREE; + tree scatter_off_vectype = NULL_TREE, scatter_decl = NULL_TREE; + int scatter_scale = 1; + enum vect_def_type scatter_idx_dt = vect_unknown_def_type; + enum vect_def_type scatter_src_dt = vect_unknown_def_type; + gimple new_stmt; if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo) return false; @@ -5297,6 +5303,24 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, } } + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) + { + gimple def_stmt; + tree def; + scatter_decl = vect_check_gather_scatter (stmt, loop_vinfo, &scatter_base, + &scatter_off, &scatter_scale); + gcc_assert (scatter_decl); + if (!vect_is_simple_use_1 (scatter_off, NULL, loop_vinfo, bb_vinfo, + &def_stmt, &def, &scatter_idx_dt, + &scatter_off_vectype)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "scatter index use not simple."); + return false; + } + } + if (!vec_stmt) /* transformation not required. */ { STMT_VINFO_TYPE (stmt_info) = store_vec_info_type; @@ -5311,6 +5335,146 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ensure_base_align (stmt_info, dr); + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) + { + tree vec_oprnd0 = NULL_TREE, vec_oprnd1 = NULL_TREE, op, src; + tree arglist = TYPE_ARG_TYPES (TREE_TYPE (scatter_decl)); + tree rettype, srctype, ptrtype, idxtype, masktype, scaletype; + tree ptr, mask, var, scale, perm_mask = NULL_TREE; + edge pe = loop_preheader_edge (loop); + gimple_seq seq; + basic_block new_bb; + enum { NARROW, NONE, WIDEN } modifier; + int scatter_off_nunits = TYPE_VECTOR_SUBPARTS (scatter_off_vectype); + + if (nunits == (unsigned int) scatter_off_nunits) + modifier = NONE; + else if (nunits == (unsigned int) scatter_off_nunits / 2) + { + unsigned char *sel = XALLOCAVEC (unsigned char, scatter_off_nunits); + modifier = WIDEN; + + for (i = 0; i < (unsigned int) scatter_off_nunits; ++i) + sel[i] = i | nunits; + + perm_mask = vect_gen_perm_mask_checked (scatter_off_vectype, sel); + gcc_assert (perm_mask != NULL_TREE); + } + else if (nunits == (unsigned int) scatter_off_nunits * 2) + { + unsigned char *sel = XALLOCAVEC (unsigned char, nunits); + modifier = NARROW; + + for (i = 0; i < (unsigned int) nunits; ++i) + sel[i] = i | scatter_off_nunits; + + perm_mask = vect_gen_perm_mask_checked (vectype, sel); + gcc_assert (perm_mask != NULL_TREE); + ncopies *= 2; + } + else + gcc_unreachable (); + + rettype = TREE_TYPE (TREE_TYPE (scatter_decl)); + ptrtype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist); + masktype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist); + idxtype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist); + srctype = TREE_VALUE (arglist); arglist = TREE_CHAIN (arglist); + scaletype = TREE_VALUE (arglist); + + gcc_checking_assert (TREE_CODE (masktype) == INTEGER_TYPE + && TREE_CODE (rettype) == VOID_TYPE); + + ptr = fold_convert (ptrtype, scatter_base); + if (!is_gimple_min_invariant (ptr)) + { + ptr = force_gimple_operand (ptr, &seq, true, NULL_TREE); + new_bb = gsi_insert_seq_on_edge_immediate (pe, seq); + gcc_assert (!new_bb); + } + + /* Currently we support only unconditional scatter stores, + so mask should be all ones. */ + mask = build_int_cst (masktype, -1); + mask = vect_init_vector (stmt, mask, masktype, NULL); + + scale = build_int_cst (scaletype, scatter_scale); + + prev_stmt_info = NULL; + for (j = 0; j < ncopies; ++j) + { + if (j == 0) + { + src = vec_oprnd1 + = vect_get_vec_def_for_operand (gimple_assign_rhs1 (stmt), stmt, NULL); + op = vec_oprnd0 + = vect_get_vec_def_for_operand (scatter_off, stmt, NULL); + } + else if (modifier != NONE && (j & 1)) + { + if (modifier == WIDEN) + { + src = vec_oprnd1 + = vect_get_vec_def_for_stmt_copy (scatter_src_dt, vec_oprnd1); + op = permute_vec_elements (vec_oprnd0, vec_oprnd0, perm_mask, + stmt, gsi); + } + else if (modifier == NARROW) + { + src = permute_vec_elements (vec_oprnd1, vec_oprnd1, perm_mask, + stmt, gsi); + op = vec_oprnd0 + = vect_get_vec_def_for_stmt_copy (scatter_idx_dt, vec_oprnd0); + } + else + gcc_unreachable (); + } + else + { + src = vec_oprnd1 + = vect_get_vec_def_for_stmt_copy (scatter_src_dt, vec_oprnd1); + op = vec_oprnd0 + = vect_get_vec_def_for_stmt_copy (scatter_idx_dt, vec_oprnd0); + } + + if (!useless_type_conversion_p (srctype, TREE_TYPE (src))) + { + gcc_assert (TYPE_VECTOR_SUBPARTS (TREE_TYPE (src)) + == TYPE_VECTOR_SUBPARTS (srctype)); + var = vect_get_new_vect_var (srctype, vect_simple_var, NULL); + var = make_ssa_name (var); + src = build1 (VIEW_CONVERT_EXPR, srctype, src); + new_stmt = gimple_build_assign (var, VIEW_CONVERT_EXPR, src); + vect_finish_stmt_generation (stmt, new_stmt, gsi); + src = var; + } + + if (!useless_type_conversion_p (idxtype, TREE_TYPE (op))) + { + gcc_assert (TYPE_VECTOR_SUBPARTS (TREE_TYPE (op)) + == TYPE_VECTOR_SUBPARTS (idxtype)); + var = vect_get_new_vect_var (idxtype, vect_simple_var, NULL); + var = make_ssa_name (var); + op = build1 (VIEW_CONVERT_EXPR, idxtype, op); + new_stmt = gimple_build_assign (var, VIEW_CONVERT_EXPR, op); + vect_finish_stmt_generation (stmt, new_stmt, gsi); + op = var; + } + + new_stmt + = gimple_build_call (scatter_decl, 5, ptr, mask, op, src, scale); + + vect_finish_stmt_generation (stmt, new_stmt, gsi); + + if (prev_stmt_info == NULL) + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + else + STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; + prev_stmt_info = vinfo_for_stmt (new_stmt); + } + return true; + } + if (grouped_store) { first_dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_stmt)); @@ -5584,7 +5748,6 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, prev_stmt_info = NULL; for (j = 0; j < ncopies; j++) { - gimple new_stmt; if (j == 0) { @@ -6071,7 +6234,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, { grouped_load = true; /* FORNOW */ - gcc_assert (! nested_in_vect_loop && !STMT_VINFO_GATHER_P (stmt_info)); + gcc_assert (!nested_in_vect_loop && !STMT_VINFO_GATHER_SCATTER_P (stmt_info)); first_stmt = GROUP_FIRST_ELEMENT (stmt_info); @@ -6134,12 +6297,12 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, } - if (STMT_VINFO_GATHER_P (stmt_info)) + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) { gimple def_stmt; tree def; - gather_decl = vect_check_gather (stmt, loop_vinfo, &gather_base, - &gather_off, &gather_scale); + gather_decl = vect_check_gather_scatter (stmt, loop_vinfo, &gather_base, + &gather_off, &gather_scale); gcc_assert (gather_decl); if (!vect_is_simple_use_1 (gather_off, NULL, loop_vinfo, bb_vinfo, &def_stmt, &def, &gather_dt, @@ -6225,7 +6388,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ensure_base_align (stmt_info, dr); - if (STMT_VINFO_GATHER_P (stmt_info)) + if (STMT_VINFO_GATHER_SCATTER_P (stmt_info)) { tree vec_oprnd0 = NULL_TREE, op; tree arglist = TYPE_ARG_TYPES (TREE_TYPE (gather_decl)); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 4b9837861a6..5145371217e 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -646,8 +646,8 @@ typedef struct _stmt_vec_info { vectorization. */ bool vectorizable; - /* For loads only, true if this is a gather load. */ - bool gather_p; + /* For loads if this is a gather, for stores if this is a scatter. */ + bool gather_scatter_p; /* True if this is an access with loop-invariant stride. */ bool strided_p; @@ -667,7 +667,7 @@ typedef struct _stmt_vec_info { #define STMT_VINFO_VEC_STMT(S) (S)->vectorized_stmt #define STMT_VINFO_VECTORIZABLE(S) (S)->vectorizable #define STMT_VINFO_DATA_REF(S) (S)->data_ref_info -#define STMT_VINFO_GATHER_P(S) (S)->gather_p +#define STMT_VINFO_GATHER_SCATTER_P(S) (S)->gather_scatter_p #define STMT_VINFO_STRIDED_P(S) (S)->strided_p #define STMT_VINFO_SIMD_LANE_ACCESS_P(S) (S)->simd_lane_access_p @@ -1063,8 +1063,8 @@ extern bool vect_analyze_data_refs_alignment (loop_vec_info, bb_vec_info); extern bool vect_verify_datarefs_alignment (loop_vec_info, bb_vec_info); extern bool vect_analyze_data_ref_accesses (loop_vec_info, bb_vec_info); extern bool vect_prune_runtime_alias_test_list (loop_vec_info); -extern tree vect_check_gather (gimple, loop_vec_info, tree *, tree *, - int *); +extern tree vect_check_gather_scatter (gimple, loop_vec_info, tree *, tree *, + int *); extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *, unsigned *); extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree, diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 685eb726a0d..d85481e0103 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10149,7 +10149,7 @@ identify_jump_threads (void) /* Allocate our unwinder stack to unwind any temporary equivalences that might be recorded. */ - equiv_stack = new const_and_copies (dump_file, dump_flags); + equiv_stack = new const_and_copies (); /* To avoid lots of silly node creation, we create a single conditional and just modify it in-place when attempting to diff --git a/gcc/varasm.c b/gcc/varasm.c index d9290a17cbb..706e6527cfd 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4699,7 +4699,7 @@ output_constant (tree exp, unsigned HOST_WIDE_INT size, unsigned int align) exp = build1 (ADDR_EXPR, saved_type, TREE_OPERAND (exp, 0)); /* Likewise for constant ints. */ else if (TREE_CODE (exp) == INTEGER_CST) - exp = wide_int_to_tree (saved_type, exp); + exp = fold_convert (saved_type, exp); } diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog index f44a73d7cc0..5d182e9fc34 100644 --- a/libbacktrace/ChangeLog +++ b/libbacktrace/ChangeLog @@ -1,3 +1,32 @@ +2015-09-11 Ian Lance Taylor <iant@google.com> + + * Makefile.am (backtrace.lo): Depend on internal.h. + (sort.lo, stest.lo): Add explicit dependencies. + * Makefile.in: Rebuild. + +2015-09-09 Hans-Peter Nilsson <hp@axis.com> + + * backtrace.c: #include <sys/types.h>. + +2015-09-08 Ian Lance Taylor <iant@google.com> + + PR other/67457 + * backtrace.c: #include "internal.h". + (struct backtrace_data): Add can_alloc field. + (unwind): If can_alloc is false, don't try to get file/line + information. + (backtrace_full): Set can_alloc field in bdata. + * alloc.c (backtrace_alloc): Don't call error_callback if it is + NULL. + * mmap.c (backtrace_alloc): Likewise. + * internal.h: Update comments for backtrace_alloc and + backtrace_free. + +2015-09-08 Ian Lance Taylor <iant@google.com> + + PR other/67457 + * mmap.c (backtrace_alloc): Correct test for mmap failure. + 2015-08-31 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * configure.ac: For spu-*-* targets, set have_fcntl to no. diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am index c5f0dcbcf7a..e28993c728e 100644 --- a/libbacktrace/Makefile.am +++ b/libbacktrace/Makefile.am @@ -116,7 +116,7 @@ endif NATIVE INCDIR = $(top_srcdir)/../include alloc.lo: config.h backtrace.h internal.h -backtrace.lo: config.h backtrace.h +backtrace.lo: config.h backtrace.h internal.h btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ $(INCDIR)/filenames.h backtrace.h internal.h @@ -130,5 +130,7 @@ posix.lo: config.h backtrace.h internal.h print.lo: config.h backtrace.h internal.h read.lo: config.h backtrace.h internal.h simple.lo: config.h backtrace.h internal.h +sort.lo: config.h backtrace.h internal.h +stest.lo: config.h backtrace.h internal.h state.lo: config.h backtrace.h backtrace-supported.h internal.h unknown.lo: config.h backtrace.h internal.h diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in index b434d76edb6..586b6a6eaa1 100644 --- a/libbacktrace/Makefile.in +++ b/libbacktrace/Makefile.in @@ -162,6 +162,7 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BACKTRACE_FILE = @BACKTRACE_FILE@ BACKTRACE_SUPPORTED = @BACKTRACE_SUPPORTED@ +BACKTRACE_SUPPORTS_DATA = @BACKTRACE_SUPPORTS_DATA@ BACKTRACE_SUPPORTS_THREADS = @BACKTRACE_SUPPORTS_THREADS@ BACKTRACE_USES_MALLOC = @BACKTRACE_USES_MALLOC@ CC = @CC@ @@ -745,7 +746,7 @@ uninstall-am: uninstall-am alloc.lo: config.h backtrace.h internal.h -backtrace.lo: config.h backtrace.h +backtrace.lo: config.h backtrace.h internal.h btest.lo: (INCDIR)/filenames.h backtrace.h backtrace-supported.h dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ $(INCDIR)/filenames.h backtrace.h internal.h @@ -759,6 +760,8 @@ posix.lo: config.h backtrace.h internal.h print.lo: config.h backtrace.h internal.h read.lo: config.h backtrace.h internal.h simple.lo: config.h backtrace.h internal.h +sort.lo: config.h backtrace.h internal.h +stest.lo: config.h backtrace.h internal.h state.lo: config.h backtrace.h backtrace-supported.h internal.h unknown.lo: config.h backtrace.h internal.h diff --git a/libbacktrace/alloc.c b/libbacktrace/alloc.c index 143ef68ca51..772d3bfb8ad 100644 --- a/libbacktrace/alloc.c +++ b/libbacktrace/alloc.c @@ -44,7 +44,8 @@ POSSIBILITY OF SUCH DAMAGE. */ backtrace functions may not be safely invoked from a signal handler. */ -/* Allocate memory like malloc. */ +/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't + report an error. */ void * backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED, @@ -55,7 +56,10 @@ backtrace_alloc (struct backtrace_state *state ATTRIBUTE_UNUSED, ret = malloc (size); if (ret == NULL) - error_callback (data, "malloc", errno); + { + if (error_callback) + error_callback (data, "malloc", errno); + } return ret; } diff --git a/libbacktrace/backtrace.c b/libbacktrace/backtrace.c index d352d27a400..19671fa0686 100644 --- a/libbacktrace/backtrace.c +++ b/libbacktrace/backtrace.c @@ -32,8 +32,11 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" +#include <sys/types.h> + #include "unwind.h" #include "backtrace.h" +#include "internal.h" /* The main backtrace_full routine. */ @@ -53,6 +56,8 @@ struct backtrace_data void *data; /* Value to return from backtrace_full. */ int ret; + /* Whether there is any memory available. */ + int can_alloc; }; /* Unwind library callback routine. This is passed to @@ -80,8 +85,11 @@ unwind (struct _Unwind_Context *context, void *vdata) if (!ip_before_insn) --pc; - bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback, - bdata->error_callback, bdata->data); + if (!bdata->can_alloc) + bdata->ret = bdata->callback (bdata->data, pc, NULL, 0, NULL); + else + bdata->ret = backtrace_pcinfo (bdata->state, pc, bdata->callback, + bdata->error_callback, bdata->data); if (bdata->ret != 0) return _URC_END_OF_STACK; @@ -96,6 +104,7 @@ backtrace_full (struct backtrace_state *state, int skip, backtrace_error_callback error_callback, void *data) { struct backtrace_data bdata; + void *p; bdata.skip = skip + 1; bdata.state = state; @@ -103,6 +112,18 @@ backtrace_full (struct backtrace_state *state, int skip, bdata.error_callback = error_callback; bdata.data = data; bdata.ret = 0; + + /* If we can't allocate any memory at all, don't try to produce + file/line information. */ + p = backtrace_alloc (state, 4096, NULL, NULL); + if (p == NULL) + bdata.can_alloc = 0; + else + { + backtrace_free (state, p, 4096, NULL, NULL); + bdata.can_alloc = 1; + } + _Unwind_Backtrace (unwind, &bdata); return bdata.ret; } diff --git a/libbacktrace/internal.h b/libbacktrace/internal.h index 30f99ca127f..b139e50f9e8 100644 --- a/libbacktrace/internal.h +++ b/libbacktrace/internal.h @@ -201,13 +201,15 @@ extern int backtrace_close (int descriptor, extern void backtrace_qsort (void *base, size_t count, size_t size, int (*compar) (const void *, const void *)); -/* Allocate memory. This is like malloc. */ +/* Allocate memory. This is like malloc. If ERROR_CALLBACK is NULL, + this does not report an error, it just returns NULL. */ extern void *backtrace_alloc (struct backtrace_state *state, size_t size, backtrace_error_callback error_callback, void *data) ATTRIBUTE_MALLOC; -/* Free memory allocated by backtrace_alloc. */ +/* Free memory allocated by backtrace_alloc. If ERROR_CALLBACK is + NULL, this does not report an error. */ extern void backtrace_free (struct backtrace_state *state, void *mem, size_t size, diff --git a/libbacktrace/mmap.c b/libbacktrace/mmap.c index 1ecf1311911..1910cb1f9eb 100644 --- a/libbacktrace/mmap.c +++ b/libbacktrace/mmap.c @@ -77,7 +77,8 @@ backtrace_free_locked (struct backtrace_state *state, void *addr, size_t size) } } -/* Allocate memory like malloc. */ +/* Allocate memory like malloc. If ERROR_CALLBACK is NULL, don't + report an error. */ void * backtrace_alloc (struct backtrace_state *state, @@ -139,8 +140,11 @@ backtrace_alloc (struct backtrace_state *state, asksize = (size + pagesize - 1) & ~ (pagesize - 1); page = mmap (NULL, asksize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (page == NULL) - error_callback (data, "mmap", errno); + if (page == MAP_FAILED) + { + if (error_callback) + error_callback (data, "mmap", errno); + } else { size = (size + 7) & ~ (size_t) 7; diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 28ce2d8ace3..3173bf558d1 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,7 @@ +2015-09-07 Marek Polacek <polacek@redhat.com> + + * system.h (INTTYPE_MINIMUM): Rewrite to avoid shift warning. + 2015-08-06 Yaakov Selkowitz <yselkowi@redhat.com> * configure: Regenerate. diff --git a/libcpp/system.h b/libcpp/system.h index b18d658a9a2..a2e8c26b0b0 100644 --- a/libcpp/system.h +++ b/libcpp/system.h @@ -230,7 +230,7 @@ extern int errno; /* The outer cast is needed to work around a bug in Cray C 5.0.3.0. It is necessary at least when t == time_t. */ #define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \ - ? ~ (t) 0 << (sizeof(t) * CHAR_BIT - 1) : (t) 0)) + ? (t) 1 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) #define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t))) /* Use that infrastructure to provide a few constants. */ diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 0d1acf302df..bca8328b831 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,64 @@ +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/gthr-rtems.h (__GTHREADS_CXX0X): New. + (__GTHREAD_HAS_COND): Likewise. + (__gthread_t): Likewise. + (__gthread_cond_t): Likewise. + (__gthread_time_t): Likewise. + (__GTHREAD_MUTEX_INIT): Likewise. + (__GTHREAD_RECURSIVE_MUTEX_INIT): Likewise. + (__GTHREAD_COND_INIT): Likewise. + (__GTHREAD_COND_INIT_FUNCTION): Likewise. + (__GTHREAD_TIME_INIT): Likewise. + (__gthread_create): Likewise. + (__gthread_join): Likewise. + (__gthread_detach): Likewise. + (__gthread_equal): Likewise. + (__gthread_self): Likewise. + (__gthread_yield): Likewise. + (__gthread_cond_broadcast): Likewise. + (__gthread_cond_signal): Likewise. + (__gthread_cond_wait): Likewise. + (__gthread_cond_timedwait): Likewise. + (__gthread_cond_wait_recursive): Likewise. + (__gthread_cond_destroy): Likewise. + (rtems_gxx_once): Delete. + (rtems_gxx_key_create): Likewise. + (rtems_gxx_key_delete): Likewise. + (rtems_gxx_getspecific): Likewise. + (rtems_gxx_setspecific): Likewise. + (rtems_gxx_mutex_init): Likewise. + (rtems_gxx_mutex_destroy): Likewise. + (rtems_gxx_mutex_lock): Likewise. + (rtems_gxx_mutex_trylock): Likewise. + (rtems_gxx_mutex_unlock): Likewise. + (rtems_gxx_recursive_mutex_init): Likewise. + (rtems_gxx_recursive_mutex_lock): Likewise. + (rtems_gxx_recursive_mutex_trylock): Likewise. + (rtems_gxx_recursive_mutex_unlock): Likewise. + (__GTHREAD_ONCE_INIT): Use <pthread.h> initializer. + (__GTHREAD_MUTEX_INIT_FUNCTION): Use <pthread.h> function. + (__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION): Likewise. + (__gthread_once): Likewise. + (__gthread_key_create): Likewise. + (__gthread_key_delete): Likewise. + (__gthread_getspecific): Likewise. + (__gthread_setspecific): Likewise. + (__gthread_key_t): Use <pthread.h> type. + (__gthread_once_t): Likewise + (__gthread_mutex_t): Use <sys/lock.h> type. + (__gthread_recursive_mutex_t): Likewise + (__gthread_mutex_lock): Use <sys/lock.h> function. + (__gthread_mutex_trylock): Likewise. + (__gthread_mutex_timedlock): Likewise. + (__gthread_mutex_unlock): Likewise. + (__gthread_mutex_destroy): Likewise. + (__gthread_recursive_mutex_lock): Likewise. + (__gthread_recursive_mutex_trylock): Likewise. + (__gthread_recursive_mutex_timedlock): Likewise. + (__gthread_recursive_mutex_unlock): Likewise. + (__gthread_recursive_mutex_destroy): Likewise. + 2015-08-18 Max Filippov <jcmvbkbc@gmail.com> * config/xtensa/unwind-dw2-xtensa.c (_Unwind_GetCFA): Return diff --git a/libgcc/config/gthr-rtems.h b/libgcc/config/gthr-rtems.h index 23038c6c9ad..1aff329d5d0 100644 --- a/libgcc/config/gthr-rtems.h +++ b/libgcc/config/gthr-rtems.h @@ -27,134 +27,217 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifndef GCC_GTHR_RTEMS_H #define GCC_GTHR_RTEMS_H +#include <sys/lock.h> +#include <pthread.h> +#include <sched.h> + #ifdef __cplusplus extern "C" { #endif #define __GTHREADS 1 +#define __GTHREADS_CXX0X 1 +#define __GTHREAD_HAS_COND 1 + +typedef pthread_t __gthread_t; +typedef pthread_key_t __gthread_key_t; +typedef pthread_once_t __gthread_once_t; +typedef struct _Mutex_Control __gthread_mutex_t; +typedef struct _Mutex_recursive_Control __gthread_recursive_mutex_t; +typedef struct _Condition_Control __gthread_cond_t; +typedef struct timespec __gthread_time_t; + +#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT +#define __GTHREAD_MUTEX_INIT _MUTEX_INITIALIZER +#define __GTHREAD_MUTEX_INIT_FUNCTION _Mutex_Initialize +#define __GTHREAD_RECURSIVE_MUTEX_INIT _MUTEX_RECURSIVE_INITIALIZER +#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION _Mutex_recursive_Initialize +#define __GTHREAD_COND_INIT _CONDITION_INITIALIZER +#define __GTHREAD_COND_INIT_FUNCTION _Condition_Initialize +#define __GTHREAD_TIME_INIT {0, 0} -#define __GTHREAD_ONCE_INIT 0 -#define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init -#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION rtems_gxx_recursive_mutex_init - -/* Avoid dependency on rtems specific headers. */ -typedef void *__gthread_key_t; -typedef int __gthread_once_t; -typedef void *__gthread_mutex_t; -typedef void *__gthread_recursive_mutex_t; - -/* - * External functions provided by RTEMS. They are very similar to their POSIX - * counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS - * header files. - */ - -/* generic per task variables */ -extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void)); -extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *)); -extern int rtems_gxx_key_delete (__gthread_key_t __key); -extern void *rtems_gxx_getspecific (__gthread_key_t __key); -extern int rtems_gxx_setspecific (__gthread_key_t __key, const void *__ptr); - -/* mutex support */ -extern void rtems_gxx_mutex_init (__gthread_mutex_t *__mutex); -extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *__mutex); -extern int rtems_gxx_mutex_lock (__gthread_mutex_t *__mutex); -extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *__mutex); -extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *__mutex); - -/* recursive mutex support */ -extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *__mutex); -extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex); -extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex); -extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex); - -/* RTEMS threading is always active */ static inline int __gthread_active_p (void) { return 1; } -/* Wrapper calls */ +static inline int +__gthread_create (__gthread_t *__threadid, void *(*__func) (void *), + void *__args) +{ + return pthread_create (__threadid, NULL, __func, __args); +} + +static inline int +__gthread_join (__gthread_t __threadid, void **__value_ptr) +{ + return pthread_join (__threadid, __value_ptr); +} + +static inline int +__gthread_detach (__gthread_t __threadid) +{ + return pthread_detach (__threadid); +} + +static inline int +__gthread_equal (__gthread_t __t1, __gthread_t __t2) +{ + return pthread_equal (__t1, __t2); +} + +static inline __gthread_t +__gthread_self (void) +{ + return pthread_self (); +} + +static inline int +__gthread_yield (void) +{ + return sched_yield (); +} + static inline int __gthread_once (__gthread_once_t *__once, void (*__func) (void)) { - return rtems_gxx_once( __once, __func ); + return pthread_once (__once, __func); } static inline int __gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *)) { - return rtems_gxx_key_create( __key, __dtor ); + return pthread_key_create (__key, __dtor); } static inline int __gthread_key_delete (__gthread_key_t __key) { - return rtems_gxx_key_delete (__key); + return pthread_key_delete (__key); } static inline void * __gthread_getspecific (__gthread_key_t __key) { - return rtems_gxx_getspecific (__key); + return pthread_getspecific (__key); } static inline int __gthread_setspecific (__gthread_key_t __key, const void *__ptr) { - return rtems_gxx_setspecific (__key, __ptr); + return pthread_setspecific (__key, __ptr); } static inline int -__gthread_mutex_destroy (__gthread_mutex_t *__mutex) +__gthread_mutex_lock (__gthread_mutex_t *__mutex) { - return rtems_gxx_mutex_destroy (__mutex); + _Mutex_Acquire (__mutex); + return 0; } static inline int -__gthread_mutex_lock (__gthread_mutex_t *__mutex) +__gthread_mutex_trylock (__gthread_mutex_t *__mutex) { - return rtems_gxx_mutex_lock (__mutex); + return _Mutex_Try_acquire (__mutex); } static inline int -__gthread_mutex_trylock (__gthread_mutex_t *__mutex) +__gthread_mutex_timedlock (__gthread_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) { - return rtems_gxx_mutex_trylock (__mutex); + return _Mutex_Acquire_timed (__mutex, __abs_timeout); } static inline int __gthread_mutex_unlock (__gthread_mutex_t *__mutex) { - return rtems_gxx_mutex_unlock( __mutex ); + _Mutex_Release (__mutex); + return 0; +} + +static inline int +__gthread_mutex_destroy (__gthread_mutex_t *__mutex) +{ + _Mutex_Destroy (__mutex); + return 0; } static inline int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex) { - return rtems_gxx_recursive_mutex_lock (__mutex); + _Mutex_recursive_Acquire (__mutex); + return 0; } static inline int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex) { - return rtems_gxx_recursive_mutex_trylock (__mutex); + return _Mutex_recursive_Try_acquire (__mutex); +} + +static inline int +__gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) +{ + return _Mutex_recursive_Acquire_timed (__mutex, __abs_timeout); } static inline int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex) { - return rtems_gxx_recursive_mutex_unlock( __mutex ); + _Mutex_recursive_Release (__mutex); + return 0; } static inline int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex) { - /* This requires that recursive and non-recursive mutexes have the same - representation. */ - return rtems_gxx_mutex_destroy (__mutex ); + _Mutex_recursive_Destroy (__mutex); + return 0; +} + +static inline int +__gthread_cond_broadcast (__gthread_cond_t *__cond) +{ + _Condition_Broadcast (__cond); + return 0; +} + +static inline int +__gthread_cond_signal (__gthread_cond_t *__cond) +{ + _Condition_Signal (__cond); + return 0; +} + +static inline int +__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex) +{ + _Condition_Wait (__cond, __mutex); + return 0; +} + +static inline int +__gthread_cond_timedwait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex, + const __gthread_time_t *__abs_timeout) +{ + return _Condition_Wait_timed (__cond, __mutex, __abs_timeout); +} + +static inline int +__gthread_cond_wait_recursive (__gthread_cond_t *__cond, + __gthread_recursive_mutex_t *__mutex) +{ + _Condition_Wait_recursive (__cond, __mutex); + return 0; +} + +static inline int +__gthread_cond_destroy (__gthread_cond_t *__cond) +{ + _Condition_Destroy (__cond); + return 0; } #ifdef __cplusplus diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index b3fa7633418..8b4c27cbc95 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,45 @@ +2015-09-05 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/53379 + * libgfortran.h (exit_error): New prototype. + * runtime/error.c (exit_error): New function. + (os_error): Call exit_error instead of exit. + (runtime_error): Likewise. + (runtime_error_at): Likewise. + (internal_error): Likewise. + (generate_error): Likewise. + (notify_std): Likewise. + * runtime/stop.c (error_stop_string): Likewise. + (error_stop_numeric): Likewise. + +2015-09-04 Janne Blomqvist <jb@gcc.gnu.org> + + * io/unix.h (delete_file): Remove prototype. + * io/unix.c (delete_file): Remove function. + * io/close.c (st_close): Replace delete_file and unlink with + remove. + * io/open.c (already_open): Replace unlink with remove. + +2015-09-02 Janne Blomqvist <jb@gcc.gnu.org> + + PR libfortran/67414 + * io/write.c (gfc_itoa): Move to runtime/string.c. + * libgfortran.h (show_backtrace): Make arg bool. + (gfc_itoa): New prototype. + * runtime/backtrace.c (struct mystate): Change type of try_simple + field, add in_signal_handler field. + (error_callback): Print out error number, or if not in a signal + handler, the error message. + (show_backtrace): Change type of arg, change initialization of + struct mystate. + (backtrace): Call show_backtrace with correct arg type. + * runtime/compile_options.c (backtrace_handler): Call with correct + arg type. + * runtime/error.c (sys_abort): Likewise. + (gf_strerror): Handle newlocale() failure. + * runtime/string.c (gfc_itoa): Function moved here from + io/write.c. + 2015-08-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/47571 diff --git a/libgfortran/io/close.c b/libgfortran/io/close.c index 38855ee9832..1e109933397 100644 --- a/libgfortran/io/close.c +++ b/libgfortran/io/close.c @@ -80,7 +80,7 @@ st_close (st_parameter_close *clp) if (status == CLOSE_DELETE) { #if HAVE_UNLINK_OPEN_FILE - delete_file (u); + remove (u->filename); #else path = strdup (u->filename); #endif @@ -92,7 +92,7 @@ st_close (st_parameter_close *clp) #if !HAVE_UNLINK_OPEN_FILE if (path != NULL) { - unlink (path); + remove (path); free (path); } #endif diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c index 4654de27bd1..630bca6f8d0 100644 --- a/libgfortran/io/open.c +++ b/libgfortran/io/open.c @@ -664,7 +664,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags) #if !HAVE_UNLINK_OPEN_FILE if (u->filename && u->flags.status == STATUS_SCRATCH) - unlink (u->filename); + remove (u->filename); #endif free (u->filename); u->filename = NULL; diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c index fd5f2779021..5385d8b7700 100644 --- a/libgfortran/io/unix.c +++ b/libgfortran/io/unix.c @@ -1716,16 +1716,6 @@ flush_all_units (void) } -/* delete_file()-- Given a unit structure, delete the file associated - * with the unit. Returns nonzero if something went wrong. */ - -int -delete_file (gfc_unit * u) -{ - return unlink (u->filename); -} - - /* file_exists()-- Returns nonzero if the current filename exists on * the system */ diff --git a/libgfortran/io/unix.h b/libgfortran/io/unix.h index 78a41f79f4b..d1aa75dbf4e 100644 --- a/libgfortran/io/unix.h +++ b/libgfortran/io/unix.h @@ -141,9 +141,6 @@ internal_proto(compare_file_filename); extern gfc_unit *find_file (const char *file, gfc_charlen_type file_len); internal_proto(find_file); -extern int delete_file (gfc_unit *); -internal_proto(delete_file); - extern int file_exists (const char *file, gfc_charlen_type file_len); internal_proto(file_exists); diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 75996598d0a..e226236a4b5 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1032,47 +1032,6 @@ ztoa_big (const char *s, char *buffer, int len, GFC_UINTEGER_LARGEST *n) return buffer; } -/* gfc_itoa()-- Integer to decimal conversion. - The itoa function is a widespread non-standard extension to standard - C, often declared in <stdlib.h>. Even though the itoa defined here - is a static function we take care not to conflict with any prior - non-static declaration. Hence the 'gfc_' prefix, which is normally - reserved for functions with external linkage. */ - -static const char * -gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len) -{ - int negative; - char *p; - GFC_UINTEGER_LARGEST t; - - assert (len >= GFC_ITOA_BUF_SIZE); - - if (n == 0) - return "0"; - - negative = 0; - t = n; - if (n < 0) - { - negative = 1; - t = -n; /*must use unsigned to protect from overflow*/ - } - - p = buffer + GFC_ITOA_BUF_SIZE - 1; - *p = '\0'; - - while (t != 0) - { - *--p = '0' + (t % 10); - t /= 10; - } - - if (negative) - *--p = '-'; - return p; -} - void write_i (st_parameter_dt *dtp, const fnode *f, const char *p, int len) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 553cef15b99..81240e591b8 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -651,7 +651,7 @@ export_proto(store_exe_path); /* backtrace.c */ -extern void show_backtrace (int); +extern void show_backtrace (bool); internal_proto(show_backtrace); @@ -675,6 +675,9 @@ internal_proto(show_backtrace); extern _Noreturn void sys_abort (void); internal_proto(sys_abort); +extern _Noreturn void exit_error (int); +internal_proto(exit_error); + extern ssize_t estr_write (const char *); internal_proto(estr_write); @@ -838,6 +841,9 @@ internal_proto(fc_strdup); extern char *fc_strdup_notrim(const char *, gfc_charlen_type); internal_proto(fc_strdup_notrim); +extern const char *gfc_itoa(GFC_INTEGER_LARGEST, char *, size_t); +internal_proto(gfc_itoa); + /* io/intrinsics.c */ extern void flush_all_units (void); diff --git a/libgfortran/runtime/backtrace.c b/libgfortran/runtime/backtrace.c index 0d7c1fcea22..12ad76aac12 100644 --- a/libgfortran/runtime/backtrace.c +++ b/libgfortran/runtime/backtrace.c @@ -26,6 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <string.h> #include <stdlib.h> +#include <errno.h> #ifdef HAVE_UNISTD_H #include <unistd.h> @@ -38,8 +39,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Store our own state while backtracing. */ struct mystate { - int try_simple; int frame; + bool try_simple; + bool in_signal_handler; }; @@ -65,15 +67,35 @@ static void error_callback (void *data, const char *msg, int errnum) { struct mystate *state = (struct mystate *) data; +#define ERRHDR "\nCould not print backtrace: " + if (errnum < 0) { - state->try_simple = 1; + state->try_simple = true; return; } - - estr_write ("\nSomething went wrong while printing the backtrace: "); - estr_write (msg); - estr_write ("\n"); + else if (errnum == 0) + { + estr_write (ERRHDR); + estr_write (msg); + estr_write ("\n"); + } + else + { + char errbuf[256]; + if (state->in_signal_handler) + { + estr_write (ERRHDR); + estr_write (msg); + estr_write (", errno: "); + const char *p = gfc_itoa (errnum, errbuf, sizeof (errbuf)); + estr_write (p); + estr_write ("\n"); + } + else + st_printf (ERRHDR "%s: %s\n", msg, + gf_strerror (errnum, errbuf, sizeof (errbuf))); + } } static int @@ -110,10 +132,10 @@ full_callback (void *data, uintptr_t pc, const char *filename, /* Display the backtrace. */ void -show_backtrace (int in_signal_handler) +show_backtrace (bool in_signal_handler) { struct backtrace_state *lbstate; - struct mystate state = { 0, 0 }; + struct mystate state = { 0, false, in_signal_handler }; lbstate = backtrace_create_state (NULL, 1, error_callback, NULL); @@ -147,6 +169,6 @@ export_proto (backtrace); void backtrace (void) { - show_backtrace (0); + show_backtrace (false); } diff --git a/libgfortran/runtime/compile_options.c b/libgfortran/runtime/compile_options.c index f44256b43b4..087c070d3de 100644 --- a/libgfortran/runtime/compile_options.c +++ b/libgfortran/runtime/compile_options.c @@ -126,7 +126,7 @@ backtrace_handler (int signum) show_signal (signum); estr_write ("\nBacktrace for this error:\n"); - show_backtrace (1); + show_backtrace (true); /* Now reraise the signal. We reactivate the signal's default handling, which is to terminate the process. diff --git a/libgfortran/runtime/error.c b/libgfortran/runtime/error.c index 9eb07645411..d357edb460d 100644 --- a/libgfortran/runtime/error.c +++ b/libgfortran/runtime/error.c @@ -74,15 +74,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 2.3.5 also explains how co-images synchronize during termination. - In libgfortran we have two ways of ending a program. exit(code) is - a normal exit; calling exit() also causes open units to be - closed. No backtrace or core dump is needed here. When something - goes wrong, we have sys_abort() which tries to print the backtrace - if -fbacktrace is enabled, and then dumps core; whether a core file - is generated is system dependent. When aborting, we don't flush and - close open units, as program memory might be corrupted and we'd - rather risk losing dirty data in the buffers rather than corrupting - files on disk. + In libgfortran we have three ways of ending a program. exit(code) + is a normal exit; calling exit() also causes open units to be + closed. No backtrace or core dump is needed here. For error + termination, we have exit_error(status), which prints a backtrace + if backtracing is enabled, then exits. Finally, when something + goes terribly wrong, we have sys_abort() which tries to print the + backtrace if -fbacktrace is enabled, and then dumps core; whether a + core file is generated is system dependent. When aborting, we don't + flush and close open units, as program memory might be corrupted + and we'd rather risk losing dirty data in the buffers rather than + corrupting files on disk. */ @@ -173,7 +175,7 @@ sys_abort (void) || (options.backtrace == -1 && compile_options.backtrace == 1)) { estr_write ("\nProgram aborted. Backtrace:\n"); - show_backtrace (0); + show_backtrace (false); signal (SIGABRT, SIG_DFL); } @@ -181,6 +183,23 @@ sys_abort (void) } +/* Exit in case of error termination. If backtracing is enabled, print + backtrace, then exit. */ + +void +exit_error (int status) +{ + if (options.backtrace == 1 + || (options.backtrace == -1 && compile_options.backtrace == 1)) + { + estr_write ("\nError termination. Backtrace:\n"); + show_backtrace (false); + } + exit (status); +} + + + /* gfc_xtoa()-- Integer to hexadecimal conversion. */ const char * @@ -221,8 +240,16 @@ gf_strerror (int errnum, #ifdef HAVE_STRERROR_L locale_t myloc = newlocale (LC_CTYPE_MASK | LC_MESSAGES_MASK, "", (locale_t) 0); - char *p = strerror_l (errnum, myloc); - freelocale (myloc); + char *p; + if (myloc) + { + p = strerror_l (errnum, myloc); + freelocale (myloc); + } + else + /* newlocale might fail e.g. due to running out of memory, fall + back to the simpler strerror. */ + p = strerror (errnum); return p; #elif defined(HAVE_STRERROR_R) #ifdef HAVE_USELOCALE @@ -318,7 +345,7 @@ os_error (const char *message) estr_write ("\n"); estr_write (message); estr_write ("\n"); - exit (1); + exit_error (1); } iexport(os_error); @@ -337,7 +364,7 @@ runtime_error (const char *message, ...) st_vprintf (message, ap); va_end (ap); estr_write ("\n"); - exit (2); + exit_error (2); } iexport(runtime_error); @@ -356,7 +383,7 @@ runtime_error_at (const char *where, const char *message, ...) st_vprintf (message, ap); va_end (ap); estr_write ("\n"); - exit (2); + exit_error (2); } iexport(runtime_error_at); @@ -394,7 +421,7 @@ internal_error (st_parameter_common *cmp, const char *message) because hopefully it doesn't happen too often). */ stupid_function_name_for_static_linking(); - exit (3); + exit_error (3); } @@ -566,7 +593,7 @@ generate_error (st_parameter_common *cmp, int family, const char *message) estr_write ("Fortran runtime error: "); estr_write (message); estr_write ("\n"); - exit (2); + exit_error (2); } iexport(generate_error); @@ -628,7 +655,7 @@ notify_std (st_parameter_common *cmp, int std, const char * message) estr_write ("Fortran runtime error: "); estr_write (message); estr_write ("\n"); - exit (2); + exit_error (2); } else { diff --git a/libgfortran/runtime/stop.c b/libgfortran/runtime/stop.c index 5c5483bd530..8b8a41f7274 100644 --- a/libgfortran/runtime/stop.c +++ b/libgfortran/runtime/stop.c @@ -145,7 +145,7 @@ error_stop_string (const char *string, GFC_INTEGER_4 len) (void) write (STDERR_FILENO, string, len); estr_write ("\n"); - exit (1); + exit_error (1); } @@ -159,5 +159,5 @@ error_stop_numeric (GFC_INTEGER_4 code) { report_exception (); st_printf ("ERROR STOP %d\n", (int) code); - exit (code); + exit_error (code); } diff --git a/libgfortran/runtime/string.c b/libgfortran/runtime/string.c index 3c339da22a4..5bd0f61928e 100644 --- a/libgfortran/runtime/string.c +++ b/libgfortran/runtime/string.c @@ -1,7 +1,7 @@ /* Copyright (C) 2002-2015 Free Software Foundation, Inc. Contributed by Paul Brook -This file is part of the GNU Fortran 95 runtime library (libgfortran). +This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -167,3 +167,48 @@ find_option (st_parameter_common *cmp, const char *s1, gfc_charlen_type s1_len, return -1; } + + +/* gfc_itoa()-- Integer to decimal conversion. + The itoa function is a widespread non-standard extension to + standard C, often declared in <stdlib.h>. Even though the itoa + defined here is a static function we take care not to conflict with + any prior non-static declaration. Hence the 'gfc_' prefix, which + is normally reserved for functions with external linkage. Notably, + in contrast to the *printf() family of functions, this ought to be + async-signal-safe. */ + +const char * +gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len) +{ + int negative; + char *p; + GFC_UINTEGER_LARGEST t; + + if (len < GFC_ITOA_BUF_SIZE) + sys_abort (); + + if (n == 0) + return "0"; + + negative = 0; + t = n; + if (n < 0) + { + negative = 1; + t = -n; /*must use unsigned to protect from overflow*/ + } + + p = buffer + GFC_ITOA_BUF_SIZE - 1; + *p = '\0'; + + while (t != 0) + { + *--p = '0' + (t % 10); + t /= 10; + } + + if (negative) + *--p = '-'; + return p; +} diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 1676624360d..cd1c51de721 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -880,7 +880,11 @@ endif endif if LIBGO_IS_SOLARIS +if HAVE_STAT_TIMESPEC +go_os_stat_file = go/os/stat_atim.go +else go_os_stat_file = go/os/stat_solaris.go +endif else if LIBGO_IS_LINUX go_os_stat_file = go/os/stat_atim.go diff --git a/libgo/Makefile.in b/libgo/Makefile.in index a07b072a109..96f4093cd4f 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -1130,6 +1130,8 @@ go_netgo_files = \ @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_unix.go @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_FREEBSD_FALSE@go_os_cloexec_file = go/os/sys_darwin.go @LIBGO_IS_FREEBSD_TRUE@go_os_cloexec_file = go/os/sys_freebsd.go +@HAVE_STAT_TIMESPEC_FALSE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_solaris.go +@HAVE_STAT_TIMESPEC_TRUE@@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_atim.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_DRAGONFLY_TRUE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_dragonfly.go @LIBGO_IS_DARWIN_FALSE@@LIBGO_IS_FREEBSD_FALSE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_NETBSD_TRUE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go @@ -1137,7 +1139,6 @@ go_netgo_files = \ @LIBGO_IS_DARWIN_TRUE@@LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_FALSE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atimespec.go @LIBGO_IS_LINUX_FALSE@@LIBGO_IS_OPENBSD_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go @LIBGO_IS_LINUX_TRUE@@LIBGO_IS_SOLARIS_FALSE@go_os_stat_file = go/os/stat_atim.go -@LIBGO_IS_SOLARIS_TRUE@go_os_stat_file = go/os/stat_solaris.go @LIBGO_IS_LINUX_FALSE@go_os_pipe_file = go/os/pipe_bsd.go @LIBGO_IS_LINUX_TRUE@go_os_pipe_file = go/os/pipe_linux.go go_os_files = \ diff --git a/libgo/configure b/libgo/configure index 03d4e150358..617fe158148 100755 --- a/libgo/configure +++ b/libgo/configure @@ -602,6 +602,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +HAVE_STAT_TIMESPEC_FALSE +HAVE_STAT_TIMESPEC_TRUE STRUCT_EPOLL_EVENT_FD_OFFSET SIZEOF_STRUCT_EPOLL_EVENT MATH_FLAG @@ -11118,7 +11120,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11121 "configure" +#line 11123 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11224,7 +11226,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11227 "configure" +#line 11229 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15076,6 +15078,28 @@ $as_echo "$libgo_cv_c_epoll_event_fd_offset" >&6; } STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/stat.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "timespec_t.*st_atim" >/dev/null 2>&1; then : + have_stat_timespec=yes +else + have_stat_timespec=no +fi +rm -f conftest* + + if test $have_stat_timespec = yes; then + HAVE_STAT_TIMESPEC_TRUE= + HAVE_STAT_TIMESPEC_FALSE='#' +else + HAVE_STAT_TIMESPEC_TRUE='#' + HAVE_STAT_TIMESPEC_FALSE= +fi + + ac_fn_c_check_type "$LINENO" "struct exception" "ac_cv_type_struct_exception" "#include <math.h> " if test "x$ac_cv_type_struct_exception" = x""yes; then : @@ -15696,6 +15720,10 @@ if test -z "${HAVE_WAIT4_TRUE}" && test -z "${HAVE_WAIT4_FALSE}"; then as_fn_error "conditional \"HAVE_WAIT4\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${HAVE_STAT_TIMESPEC_TRUE}" && test -z "${HAVE_STAT_TIMESPEC_FALSE}"; then + as_fn_error "conditional \"HAVE_STAT_TIMESPEC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 diff --git a/libgo/configure.ac b/libgo/configure.ac index 7c403a5d78c..a175d46220d 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -645,6 +645,12 @@ AC_CACHE_CHECK([epoll_event data.fd offset], STRUCT_EPOLL_EVENT_FD_OFFSET=${libgo_cv_c_epoll_event_fd_offset} AC_SUBST(STRUCT_EPOLL_EVENT_FD_OFFSET) +dnl Check if <sys/stat.h> uses timespec_t for st_?tim members. Introduced +dnl in Solaris 12 for XPG7 compatibility. +AC_EGREP_HEADER([timespec_t.*st_atim], [sys/stat.h], + [have_stat_timespec=yes], [have_stat_timespec=no]) +AM_CONDITIONAL(HAVE_STAT_TIMESPEC, test $have_stat_timespec = yes) + dnl See if struct exception is defined in <math.h>. AC_CHECK_TYPE([struct exception], [libgo_has_struct_exception=yes], diff --git a/libgo/runtime/go-main.c b/libgo/runtime/go-main.c index 8e9ceab9f3a..026469b2377 100644 --- a/libgo/runtime/go-main.c +++ b/libgo/runtime/go-main.c @@ -38,7 +38,7 @@ main (int argc, char **argv) runtime_isarchive = false; if (runtime_isstarted) - return NULL; + return 0; runtime_isstarted = true; runtime_check (); diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 71e1fbaae42..29665c226e1 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,70 @@ +2015-09-08 Aditya Kumar <hiraditya@msn.com> + Sebastian Pop <s.pop@samsung.com> + + * testsuite/libgomp.graphite/bounds.c (int foo): Modifed test case to + match o/p. + * testsuite/libgomp.graphite/force-parallel-1.c (void parloop): Same. + * testsuite/libgomp.graphite/force-parallel-4.c: Same. + * testsuite/libgomp.graphite/force-parallel-5.c: Same. + * testsuite/libgomp.graphite/force-parallel-7.c: Same. + * testsuite/libgomp.graphite/force-parallel-8.c: Same. + +2015-09-03 Jakub Jelinek <jakub@redhat.com> + + * configure.tgt: Add missing ;; in between nvptx and rtems + snippets. + +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/posix/pool.h (gomp_adjust_thread_attr): New. + * config/rtems/pool.h (gomp_adjust_thread_attr): Likewise. + (gomp_thread_pool_reservoir): Add priority member. + * confi/rtems/proc.c (allocate_thread_pool_reservoir): Add + priority. + (parse_thread_pools): Likewise. + * team.c (gomp_team_start): Call configuration provided + gomp_adjust_thread_attr(). Destroy thread attributes if + necessary. + * libgomp.texi: Document GOMP_RTEMS_THREAD_POOLS. + +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/posix/pool.h: New. + * config/rtems/pool.h: Likewise. + * config/rtems/proc.c: Likewise. + * libgomp.h (gomp_thread_destructor): Declare. + * team.c: Include configuration provided "pool.h". + (gomp_get_thread_pool): Define in configuration. + (gomp_team_end): Call configuration defined + gomp_release_thread_pool(). + +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/rtems/bar.c: New. + * config/rtems/bar.h: Likewise. + * config/rtems/mutex.c: Likewise. + * config/rtems/mutex.h: Likewise. + * config/rtems/sem.c: Likewise. + * config/rtems/sem.h: Likewise. + * configure.ac (*-*-rtems*): Check that Newlib provides a proper + <sys/lock.h> header file. + * configure.tgt (*-*-rtems*): Enable RTEMS configuration if + supported by Newlib. + * configure: Regenerate. + +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * team.c (gomp_new_thread_pool): Delete and move content to ... + (gomp_get_thread_pool): ... new function. Allocate and + initialize thread pool on demand. + (get_last_team): Use gomp_get_thread_pool(). + (gomp_team_start): Delete thread pool initialization. + +2015-09-03 Tom de Vries <tom@codesourcery.com> + + PR tree-optimization/65637 + * testsuite/libgomp.c/autopar-2.c: New test. + 2015-08-29 Tom de Vries <tom@codesourcery.com> PR tree-optimization/46193 diff --git a/libgomp/config/posix/pool.h b/libgomp/config/posix/pool.h new file mode 100644 index 00000000000..35ccc9240d8 --- /dev/null +++ b/libgomp/config/posix/pool.h @@ -0,0 +1,67 @@ +/* Copyright (C) 2005-2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Offloading and Multi Processing Library + (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the default implementation of the thread pool management + for libgomp. This type is private to the library. */ + +#ifndef GOMP_POOL_H +#define GOMP_POOL_H 1 + +#include "libgomp.h" + +/* Get the thread pool, allocate and initialize it on demand. */ + +static inline struct gomp_thread_pool * +gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads) +{ + struct gomp_thread_pool *pool = thr->thread_pool; + if (__builtin_expect (pool == NULL, 0)) + { + pool = gomp_malloc (sizeof (*pool)); + pool->threads = NULL; + pool->threads_size = 0; + pool->threads_used = 0; + pool->last_team = NULL; + pool->threads_busy = nthreads; + thr->thread_pool = pool; + pthread_setspecific (gomp_thread_destructor, thr); + } + return pool; +} + +static inline void +gomp_release_thread_pool (struct gomp_thread_pool *pool) +{ + /* Do nothing in the default implementation. */ +} + +static inline pthread_attr_t * +gomp_adjust_thread_attr (pthread_attr_t *attr, pthread_attr_t *mutable_attr) +{ + /* Do nothing in the default implementation. */ + return attr; +} + +#endif /* GOMP_POOL_H */ diff --git a/libgomp/config/rtems/bar.c b/libgomp/config/rtems/bar.c new file mode 100644 index 00000000000..e5b3f76c581 --- /dev/null +++ b/libgomp/config/rtems/bar.c @@ -0,0 +1,255 @@ +/* Copyright (C) 2005-2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the RTEMS implementation of a barrier synchronization + mechanism for libgomp. It is identical to the Linux implementation, except + that the futex API is slightly different. This type is private to the + library. */ + +#include "libgomp.h" +#include "bar.h" +#include <limits.h> + +static gomp_barrier_t * +generation_to_barrier (int *addr) +{ + return (gomp_barrier_t *) + ((char *) addr - __builtin_offsetof (gomp_barrier_t, generation)); +} + +static void +futex_wait (int *addr, int val) +{ + gomp_barrier_t *bar = generation_to_barrier (addr); + _Futex_Wait (&bar->futex, addr, val); +} + +static void +futex_wake (int *addr, int count) +{ + gomp_barrier_t *bar = generation_to_barrier (addr); + _Futex_Wake (&bar->futex, count); +} + +static int +do_spin (int *addr, int val) +{ + unsigned long long i, count = gomp_spin_count_var; + + if (__builtin_expect (gomp_managed_threads > gomp_available_cpus, 0)) + count = gomp_throttled_spin_count_var; + for (i = 0; i < count; i++) + if (__builtin_expect (__atomic_load_n (addr, MEMMODEL_RELAXED) != val, 0)) + return 0; + return 1; +} + +static void +do_wait (int *addr, int val) +{ + if (do_spin (addr, val)) + futex_wait (addr, val); +} + +/* Everything below this point should be identical to the Linux + implementation. */ + +void +gomp_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state) +{ + if (__builtin_expect (state & BAR_WAS_LAST, 0)) + { + /* Next time we'll be awaiting TOTAL threads again. */ + bar->awaited = bar->total; + __atomic_store_n (&bar->generation, bar->generation + BAR_INCR, + MEMMODEL_RELEASE); + futex_wake ((int *) &bar->generation, INT_MAX); + } + else + { + do + do_wait ((int *) &bar->generation, state); + while (__atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE) == state); + } +} + +void +gomp_barrier_wait (gomp_barrier_t *bar) +{ + gomp_barrier_wait_end (bar, gomp_barrier_wait_start (bar)); +} + +/* Like gomp_barrier_wait, except that if the encountering thread + is not the last one to hit the barrier, it returns immediately. + The intended usage is that a thread which intends to gomp_barrier_destroy + this barrier calls gomp_barrier_wait, while all other threads + call gomp_barrier_wait_last. When gomp_barrier_wait returns, + the barrier can be safely destroyed. */ + +void +gomp_barrier_wait_last (gomp_barrier_t *bar) +{ + gomp_barrier_state_t state = gomp_barrier_wait_start (bar); + if (state & BAR_WAS_LAST) + gomp_barrier_wait_end (bar, state); +} + +void +gomp_team_barrier_wake (gomp_barrier_t *bar, int count) +{ + futex_wake ((int *) &bar->generation, count == 0 ? INT_MAX : count); +} + +void +gomp_team_barrier_wait_end (gomp_barrier_t *bar, gomp_barrier_state_t state) +{ + unsigned int generation, gen; + + if (__builtin_expect (state & BAR_WAS_LAST, 0)) + { + /* Next time we'll be awaiting TOTAL threads again. */ + struct gomp_thread *thr = gomp_thread (); + struct gomp_team *team = thr->ts.team; + + bar->awaited = bar->total; + team->work_share_cancelled = 0; + if (__builtin_expect (team->task_count, 0)) + { + gomp_barrier_handle_tasks (state); + state &= ~BAR_WAS_LAST; + } + else + { + state &= ~BAR_CANCELLED; + state += BAR_INCR - BAR_WAS_LAST; + __atomic_store_n (&bar->generation, state, MEMMODEL_RELEASE); + futex_wake ((int *) &bar->generation, INT_MAX); + return; + } + } + + generation = state; + state &= ~BAR_CANCELLED; + do + { + do_wait ((int *) &bar->generation, generation); + gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + if (__builtin_expect (gen & BAR_TASK_PENDING, 0)) + { + gomp_barrier_handle_tasks (state); + gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + } + generation |= gen & BAR_WAITING_FOR_TASK; + } + while (gen != state + BAR_INCR); +} + +void +gomp_team_barrier_wait (gomp_barrier_t *bar) +{ + gomp_team_barrier_wait_end (bar, gomp_barrier_wait_start (bar)); +} + +void +gomp_team_barrier_wait_final (gomp_barrier_t *bar) +{ + gomp_barrier_state_t state = gomp_barrier_wait_final_start (bar); + if (__builtin_expect (state & BAR_WAS_LAST, 0)) + bar->awaited_final = bar->total; + gomp_team_barrier_wait_end (bar, state); +} + +bool +gomp_team_barrier_wait_cancel_end (gomp_barrier_t *bar, + gomp_barrier_state_t state) +{ + unsigned int generation, gen; + + if (__builtin_expect (state & BAR_WAS_LAST, 0)) + { + /* Next time we'll be awaiting TOTAL threads again. */ + /* BAR_CANCELLED should never be set in state here, because + cancellation means that at least one of the threads has been + cancelled, thus on a cancellable barrier we should never see + all threads to arrive. */ + struct gomp_thread *thr = gomp_thread (); + struct gomp_team *team = thr->ts.team; + + bar->awaited = bar->total; + team->work_share_cancelled = 0; + if (__builtin_expect (team->task_count, 0)) + { + gomp_barrier_handle_tasks (state); + state &= ~BAR_WAS_LAST; + } + else + { + state += BAR_INCR - BAR_WAS_LAST; + __atomic_store_n (&bar->generation, state, MEMMODEL_RELEASE); + futex_wake ((int *) &bar->generation, INT_MAX); + return false; + } + } + + if (__builtin_expect (state & BAR_CANCELLED, 0)) + return true; + + generation = state; + do + { + do_wait ((int *) &bar->generation, generation); + gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + if (__builtin_expect (gen & BAR_CANCELLED, 0)) + return true; + if (__builtin_expect (gen & BAR_TASK_PENDING, 0)) + { + gomp_barrier_handle_tasks (state); + gen = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + } + generation |= gen & BAR_WAITING_FOR_TASK; + } + while (gen != state + BAR_INCR); + + return false; +} + +bool +gomp_team_barrier_wait_cancel (gomp_barrier_t *bar) +{ + return gomp_team_barrier_wait_cancel_end (bar, gomp_barrier_wait_start (bar)); +} + +void +gomp_team_barrier_cancel (struct gomp_team *team) +{ + gomp_mutex_lock (&team->task_lock); + if (team->barrier.generation & BAR_CANCELLED) + { + gomp_mutex_unlock (&team->task_lock); + return; + } + team->barrier.generation |= BAR_CANCELLED; + gomp_mutex_unlock (&team->task_lock); + futex_wake ((int *) &team->barrier.generation, INT_MAX); +} diff --git a/libgomp/config/rtems/bar.h b/libgomp/config/rtems/bar.h new file mode 100644 index 00000000000..c85dce3c86e --- /dev/null +++ b/libgomp/config/rtems/bar.h @@ -0,0 +1,170 @@ +/* Copyright (C) 2005-2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the RTEMS implementation of a barrier synchronization + mechanism for libgomp. It is identical to the Linux implementation, except + that the futex API is slightly different. This type is private to the + library. */ + +#ifndef GOMP_BARRIER_H +#define GOMP_BARRIER_H 1 + +#include <sys/lock.h> + +typedef struct +{ + /* Make sure total/generation is in a mostly read cacheline, while + awaited in a separate cacheline. */ + unsigned total __attribute__((aligned (64))); + unsigned generation; + struct _Futex_Control futex; + unsigned awaited __attribute__((aligned (64))); + unsigned awaited_final; +} gomp_barrier_t; + +typedef unsigned int gomp_barrier_state_t; + +/* The generation field contains a counter in the high bits, with a few + low bits dedicated to flags. Note that TASK_PENDING and WAS_LAST can + share space because WAS_LAST is never stored back to generation. */ +#define BAR_TASK_PENDING 1 +#define BAR_WAS_LAST 1 +#define BAR_WAITING_FOR_TASK 2 +#define BAR_CANCELLED 4 +#define BAR_INCR 8 + +static inline void gomp_barrier_init (gomp_barrier_t *bar, unsigned count) +{ + bar->total = count; + bar->awaited = count; + bar->awaited_final = count; + bar->generation = 0; + _Futex_Initialize (&bar->futex); +} + +static inline void gomp_barrier_reinit (gomp_barrier_t *bar, unsigned count) +{ + __atomic_add_fetch (&bar->awaited, count - bar->total, MEMMODEL_ACQ_REL); + bar->total = count; +} + +static inline void gomp_barrier_destroy (gomp_barrier_t *bar) +{ +} + +extern void gomp_barrier_wait (gomp_barrier_t *); +extern void gomp_barrier_wait_last (gomp_barrier_t *); +extern void gomp_barrier_wait_end (gomp_barrier_t *, gomp_barrier_state_t); +extern void gomp_team_barrier_wait (gomp_barrier_t *); +extern void gomp_team_barrier_wait_final (gomp_barrier_t *); +extern void gomp_team_barrier_wait_end (gomp_barrier_t *, + gomp_barrier_state_t); +extern bool gomp_team_barrier_wait_cancel (gomp_barrier_t *); +extern bool gomp_team_barrier_wait_cancel_end (gomp_barrier_t *, + gomp_barrier_state_t); +extern void gomp_team_barrier_wake (gomp_barrier_t *, int); +struct gomp_team; +extern void gomp_team_barrier_cancel (struct gomp_team *); + +static inline gomp_barrier_state_t +gomp_barrier_wait_start (gomp_barrier_t *bar) +{ + unsigned int ret = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + ret &= -BAR_INCR | BAR_CANCELLED; + /* A memory barrier is needed before exiting from the various forms + of gomp_barrier_wait, to satisfy OpenMP API version 3.1 section + 2.8.6 flush Construct, which says there is an implicit flush during + a barrier region. This is a convenient place to add the barrier, + so we use MEMMODEL_ACQ_REL here rather than MEMMODEL_ACQUIRE. */ + if (__atomic_add_fetch (&bar->awaited, -1, MEMMODEL_ACQ_REL) == 0) + ret |= BAR_WAS_LAST; + return ret; +} + +static inline gomp_barrier_state_t +gomp_barrier_wait_cancel_start (gomp_barrier_t *bar) +{ + return gomp_barrier_wait_start (bar); +} + +/* This is like gomp_barrier_wait_start, except it decrements + bar->awaited_final rather than bar->awaited and should be used + for the gomp_team_end barrier only. */ +static inline gomp_barrier_state_t +gomp_barrier_wait_final_start (gomp_barrier_t *bar) +{ + unsigned int ret = __atomic_load_n (&bar->generation, MEMMODEL_ACQUIRE); + ret &= -BAR_INCR | BAR_CANCELLED; + /* See above gomp_barrier_wait_start comment. */ + if (__atomic_add_fetch (&bar->awaited_final, -1, MEMMODEL_ACQ_REL) == 0) + ret |= BAR_WAS_LAST; + return ret; +} + +static inline bool +gomp_barrier_last_thread (gomp_barrier_state_t state) +{ + return state & BAR_WAS_LAST; +} + +/* All the inlines below must be called with team->task_lock + held. */ + +static inline void +gomp_team_barrier_set_task_pending (gomp_barrier_t *bar) +{ + bar->generation |= BAR_TASK_PENDING; +} + +static inline void +gomp_team_barrier_clear_task_pending (gomp_barrier_t *bar) +{ + bar->generation &= ~BAR_TASK_PENDING; +} + +static inline void +gomp_team_barrier_set_waiting_for_tasks (gomp_barrier_t *bar) +{ + bar->generation |= BAR_WAITING_FOR_TASK; +} + +static inline bool +gomp_team_barrier_waiting_for_tasks (gomp_barrier_t *bar) +{ + return (bar->generation & BAR_WAITING_FOR_TASK) != 0; +} + +static inline bool +gomp_team_barrier_cancelled (gomp_barrier_t *bar) +{ + return __builtin_expect ((bar->generation & BAR_CANCELLED) != 0, 0); +} + +static inline void +gomp_team_barrier_done (gomp_barrier_t *bar, gomp_barrier_state_t state) +{ + bar->generation = (state & -BAR_INCR) + BAR_INCR; +} + +#endif /* GOMP_BARRIER_H */ diff --git a/libgomp/config/rtems/mutex.c b/libgomp/config/rtems/mutex.c new file mode 100644 index 00000000000..39bb64da0f9 --- /dev/null +++ b/libgomp/config/rtems/mutex.c @@ -0,0 +1 @@ +/* Everything is in the header. */ diff --git a/libgomp/config/rtems/mutex.h b/libgomp/config/rtems/mutex.h new file mode 100644 index 00000000000..39901ee93bb --- /dev/null +++ b/libgomp/config/rtems/mutex.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the RTEMS implementation of a mutex synchronization + mechanism for libgomp. This type is private to the library. */ + +#ifndef GOMP_MUTEX_H +#define GOMP_MUTEX_H 1 + +#include <sys/lock.h> + +typedef struct _Mutex_Control gomp_mutex_t; + +#define GOMP_MUTEX_INIT_0 1 + +static inline void gomp_mutex_init (gomp_mutex_t *mutex) +{ + _Mutex_Initialize (mutex); +} + +static inline void gomp_mutex_lock (gomp_mutex_t *mutex) +{ + _Mutex_Acquire (mutex); +} + +static inline void gomp_mutex_unlock (gomp_mutex_t *mutex) +{ + _Mutex_Release (mutex); +} + +static inline void gomp_mutex_destroy (gomp_mutex_t *mutex) +{ + _Mutex_Destroy (mutex); +} + +#endif /* GOMP_MUTEX_H */ diff --git a/libgomp/config/rtems/pool.h b/libgomp/config/rtems/pool.h new file mode 100644 index 00000000000..8028b27484a --- /dev/null +++ b/libgomp/config/rtems/pool.h @@ -0,0 +1,157 @@ +/* Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Offloading and Multi Processing Library + (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the RTEMS implementation of the thread pool management + for libgomp. This type is private to the library. */ + +#ifndef GOMP_POOL_H +#define GOMP_POOL_H 1 + +#include "libgomp.h" +#include <sys/lock.h> +#include <string.h> + +/* For each scheduler instance there may be a thread pool reservoir + to limit the number of thread pools used by the OpenMP master threads of this + scheduler instance. The reservoirs are configured via the + GOMP_RTEMS_THREAD_POOLS environment variable. */ +struct gomp_thread_pool_reservoir { + gomp_sem_t available; + gomp_mutex_t lock; + size_t index; + int priority; + struct gomp_thread_pool *pools[]; +}; + +struct gomp_tls_rtems_data { + struct gomp_thread_pool_reservoir *thread_pool_reservoir; +}; + +extern struct gomp_thread_pool_reservoir **gomp_thread_pool_reservoirs; + +extern __thread struct gomp_tls_rtems_data gomp_tls_rtems_data; + +static inline struct gomp_thread_pool_reservoir * +gomp_get_thread_pool_reservoir (void) +{ + struct gomp_thread_pool_reservoir *res = + gomp_tls_rtems_data.thread_pool_reservoir; + + if (res == NULL && gomp_thread_pool_reservoirs != NULL) + { + struct gomp_thread *thr = gomp_thread (); + thr->thread_pool = gomp_malloc_cleared (sizeof (*thr->thread_pool)); + res = gomp_thread_pool_reservoirs[_Sched_Index ()]; + gomp_tls_rtems_data.thread_pool_reservoir = res; + } + + return res; +} + +static inline struct gomp_thread_pool * +gomp_get_own_thread_pool (struct gomp_thread *thr, unsigned nthreads) +{ + struct gomp_thread_pool *pool = thr->thread_pool; + if (__builtin_expect (pool == NULL, 0)) + { + pool = gomp_malloc_cleared (sizeof (*pool)); + pool->threads_busy = nthreads; + thr->thread_pool = pool; + } + return pool; +} + +static inline struct gomp_thread_pool * +gomp_get_thread_pool (struct gomp_thread *thr, unsigned nthreads) +{ + struct gomp_thread_pool *pool; + + if (__builtin_expect (thr->thread_pool == NULL, 0)) + pthread_setspecific (gomp_thread_destructor, thr); + + if (nthreads != 1) + { + struct gomp_thread_pool_reservoir *res = + gomp_get_thread_pool_reservoir (); + if (res != NULL) + { + gomp_sem_wait (&res->available); + gomp_mutex_lock (&res->lock); + pool = res->pools[--res->index]; + gomp_mutex_unlock (&res->lock); + pool->threads_busy = nthreads; + thr->thread_pool = pool; + } + else + pool = gomp_get_own_thread_pool (thr, nthreads); + } + else + pool = NULL; + return pool; +} + +static inline void +gomp_release_thread_pool (struct gomp_thread_pool *pool) +{ + struct gomp_thread_pool_reservoir *res = + gomp_tls_rtems_data.thread_pool_reservoir; + if (res != NULL) + { + gomp_mutex_lock (&res->lock); + res->pools[res->index++] = pool; + gomp_mutex_unlock (&res->lock); + gomp_sem_post (&res->available); + } +} + +static inline pthread_attr_t * +gomp_adjust_thread_attr (pthread_attr_t *attr, pthread_attr_t *mutable_attr) +{ + struct gomp_thread_pool_reservoir *res = gomp_get_thread_pool_reservoir (); + if (res != NULL && res->priority > 0) + { + struct sched_param param; + int err; + if (attr != mutable_attr) + { + attr = mutable_attr; + pthread_attr_init (attr); + } + memset (¶m, 0, sizeof (param)); + param.sched_priority = res->priority; + err = pthread_attr_setschedparam (attr, ¶m); + if (err != 0) + gomp_fatal ("Thread attribute set scheduler parameters failed: %s", strerror (err)); + err = pthread_attr_setschedpolicy (attr, SCHED_FIFO); + if (err != 0) + gomp_fatal ("Thread attribute set scheduler policy failed: %s", strerror (err)); + err = pthread_attr_setinheritsched (attr, PTHREAD_EXPLICIT_SCHED); + if (err != 0) + gomp_fatal ("Thread attribute set explicit scheduler failed: %s", strerror (err)); + } + return attr; +} + +#endif /* GOMP_POOL_H */ diff --git a/libgomp/config/rtems/proc.c b/libgomp/config/rtems/proc.c new file mode 100644 index 00000000000..0c3a79bf2d8 --- /dev/null +++ b/libgomp/config/rtems/proc.c @@ -0,0 +1,160 @@ +/* Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Offloading and Multi Processing Library + (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This file contains RTEMS specific routines related to counting + online processors and dynamic load balancing. */ + +#include "libgomp.h" +#include "pool.h" +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +struct gomp_thread_pool_reservoir **gomp_thread_pool_reservoirs; + +__thread struct gomp_tls_rtems_data gomp_tls_rtems_data; + +static void +allocate_thread_pool_reservoirs (void) +{ + struct gomp_thread_pool_reservoir **reservoirs; + size_t size = _Sched_Count () * sizeof (*reservoirs); + reservoirs = gomp_malloc (size); + gomp_thread_pool_reservoirs = reservoirs; + memset (reservoirs, 0, size); +} + +static void +allocate_thread_pool_reservoir (unsigned long count, unsigned long priority, + unsigned long scheduler) +{ + struct gomp_thread_pool_reservoir *res; + struct gomp_thread_pool *pools; + unsigned long i; + size_t size; + + res = gomp_thread_pool_reservoirs[scheduler]; + if (res != NULL) + gomp_fatal ("Multiple thread pool reservoir initialization"); + size = sizeof (*res) + count * (sizeof(pools) + sizeof(*pools)); + pools = gomp_malloc (size); + memset (pools, 0, size); + res = (struct gomp_thread_pool_reservoir *) (pools + count); + res->index = count; + res->priority = priority; + gomp_sem_init (&res->available, count); + gomp_mutex_init (&res->lock); + for (i = 0; i < count; ++i) + res->pools[i] = &pools[i]; + gomp_thread_pool_reservoirs[scheduler] = res; +} + +static char * +parse_thread_pools (char *env, unsigned long *count, unsigned long *priority, + unsigned long *scheduler) +{ + size_t len; + int i; + + if (*env == ':') + ++env; + + errno = 0; + *count = strtoul (env, &env, 10); + if (errno != 0) + gomp_fatal ("Invalid thread pool count"); + + if (*env == '$') + { + ++env; + errno = 0; + *priority = strtoul (env, &env, 10); + if (errno != 0) + gomp_fatal ("Invalid thread pool priority"); + } + else + *priority = -1; + + if (*env != '@') + gomp_fatal ("Invalid thread pool scheduler prefix"); + ++env; + + len = 0; + while (env[len] != '\0' && env[len] != ':') + ++len; + i = _Sched_Name_to_index (env, len); + if (i < 0) + gomp_fatal ("Invalid thread pool scheduler"); + *scheduler = i; + env += len; + + return env; +} + +static void +init_thread_pool_reservoirs (void) +{ + char *env = getenv ("GOMP_RTEMS_THREAD_POOLS"); + if (env != NULL) + { + allocate_thread_pool_reservoirs (); + while (*env != '\0') + { + unsigned long count; + unsigned long priority; + unsigned long scheduler; + env = parse_thread_pools (env, &count, &priority, &scheduler); + allocate_thread_pool_reservoir (count, priority, scheduler); + } + } +} + +void +gomp_init_num_threads (void) +{ + gomp_global_icv.nthreads_var = omp_get_num_procs(); + init_thread_pool_reservoirs (); +} + +unsigned +gomp_dynamic_max_threads (void) +{ + unsigned n_onln = (unsigned) omp_get_num_procs(); + unsigned nthreads_var = gomp_icv (false)->nthreads_var; + + if (n_onln > nthreads_var) + return nthreads_var; + else + return n_onln; +} + +int +omp_get_num_procs (void) +{ + return sysconf (_SC_NPROCESSORS_ONLN); +} + +ialias (omp_get_num_procs) diff --git a/libgomp/config/rtems/sem.c b/libgomp/config/rtems/sem.c new file mode 100644 index 00000000000..39bb64da0f9 --- /dev/null +++ b/libgomp/config/rtems/sem.c @@ -0,0 +1 @@ +/* Everything is in the header. */ diff --git a/libgomp/config/rtems/sem.h b/libgomp/config/rtems/sem.h new file mode 100644 index 00000000000..0d6765b2ac7 --- /dev/null +++ b/libgomp/config/rtems/sem.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2015 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU OpenMP Library (libgomp). + + Libgomp is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + 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/>. */ + +/* This is the RTEMS implementation of a semaphore synchronization + mechanism for libgomp. This type is private to the library. */ + +#ifndef GOMP_SEM_H +#define GOMP_SEM_H 1 + +#include <sys/lock.h> + +typedef struct _Semaphore_Control gomp_sem_t; + +static inline void gomp_sem_init (gomp_sem_t *sem, int value) +{ + _Semaphore_Initialize (sem, (unsigned int) value); +} + +static inline void gomp_sem_wait (gomp_sem_t *sem) +{ + _Semaphore_Wait (sem); +} + +static inline void gomp_sem_post (gomp_sem_t *sem) +{ + _Semaphore_Post (sem); +} + +static inline void gomp_sem_destroy (gomp_sem_t *sem) +{ + _Semaphore_Destroy (sem); +} + +#endif /* GOMP_SEM_H */ diff --git a/libgomp/configure b/libgomp/configure index c93e8776241..74d4e822c9e 100755 --- a/libgomp/configure +++ b/libgomp/configure @@ -15340,6 +15340,23 @@ $as_echo "#define HAVE_BROKEN_POSIX_SEMAPHORES 1" >>confdefs.h ;; esac +# RTEMS specific checks +case "$host" in + *-*-rtems*) + ac_fn_c_check_type "$LINENO" "struct _Mutex_Control" "ac_cv_type_struct__Mutex_Control" "#include <sys/lock.h> +" +if test "x$ac_cv_type_struct__Mutex_Control" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT__MUTEX_CONTROL 1 +_ACEOF + + +fi + + ;; +esac + # Check whether --enable-linux-futex was given. if test "${enable_linux_futex+set}" = set; then : enableval=$enable_linux_futex; diff --git a/libgomp/configure.ac b/libgomp/configure.ac index b1696d05514..2e41ca8aee5 100644 --- a/libgomp/configure.ac +++ b/libgomp/configure.ac @@ -216,6 +216,13 @@ case "$host" in ;; esac +# RTEMS specific checks +case "$host" in + *-*-rtems*) + AC_CHECK_TYPES([struct _Mutex_Control],[],[],[#include <sys/lock.h>]) + ;; +esac + GCC_LINUX_FUTEX(:) # Check for pthread_{,attr_}[sg]etaffinity_np. diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt index 8fad977a211..77e73f01f1a 100644 --- a/libgomp/configure.tgt +++ b/libgomp/configure.tgt @@ -155,6 +155,13 @@ case "${target}" in config_path="nvptx" ;; + *-*-rtems*) + # Use self-contained synchronization objects if provided by Newlib + if test "x$ac_cv_type_struct__Mutex_Control" = xyes ; then + config_path="rtems posix" + fi + ;; + *) ;; diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h index 62454b8527a..2ea1c5d857b 100644 --- a/libgomp/libgomp.h +++ b/libgomp/libgomp.h @@ -513,6 +513,8 @@ static inline struct gomp_task_icv *gomp_icv (bool write) /* The attributes to be used during thread creation. */ extern pthread_attr_t gomp_thread_attr; +extern pthread_key_t gomp_thread_destructor; + /* Function prototypes. */ /* affinity.c */ diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index 6c7f1aed641..06b1c67fc02 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -1306,23 +1306,24 @@ section 4 of the OpenMP specification in version 4.0, while those beginning with @env{GOMP_} are GNU extensions. @menu -* OMP_CANCELLATION:: Set whether cancellation is activated -* OMP_DISPLAY_ENV:: Show OpenMP version and environment variables -* OMP_DEFAULT_DEVICE:: Set the device used in target regions -* OMP_DYNAMIC:: Dynamic adjustment of threads -* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions -* OMP_NESTED:: Nested parallel regions -* OMP_NUM_THREADS:: Specifies the number of threads to use -* OMP_PROC_BIND:: Whether theads may be moved between CPUs -* OMP_PLACES:: Specifies on which CPUs the theads should be placed -* OMP_STACKSIZE:: Set default thread stack size -* OMP_SCHEDULE:: How threads are scheduled -* OMP_THREAD_LIMIT:: Set the maximum number of threads -* OMP_WAIT_POLICY:: How waiting threads are handled -* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs -* GOMP_DEBUG:: Enable debugging output -* GOMP_STACKSIZE:: Set default thread stack size -* GOMP_SPINCOUNT:: Set the busy-wait spin count +* OMP_CANCELLATION:: Set whether cancellation is activated +* OMP_DISPLAY_ENV:: Show OpenMP version and environment variables +* OMP_DEFAULT_DEVICE:: Set the device used in target regions +* OMP_DYNAMIC:: Dynamic adjustment of threads +* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions +* OMP_NESTED:: Nested parallel regions +* OMP_NUM_THREADS:: Specifies the number of threads to use +* OMP_PROC_BIND:: Whether theads may be moved between CPUs +* OMP_PLACES:: Specifies on which CPUs the theads should be placed +* OMP_STACKSIZE:: Set default thread stack size +* OMP_SCHEDULE:: How threads are scheduled +* OMP_THREAD_LIMIT:: Set the maximum number of threads +* OMP_WAIT_POLICY:: How waiting threads are handled +* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs +* GOMP_DEBUG:: Enable debugging output +* GOMP_STACKSIZE:: Set default thread stack size +* GOMP_SPINCOUNT:: Set the busy-wait spin count +* GOMP_RTEMS_THREAD_POOLS:: Set the RTEMS specific thread pools @end menu @@ -1705,6 +1706,46 @@ or @env{OMP_WAIT_POLICY} is @code{PASSIVE}. +@node GOMP_RTEMS_THREAD_POOLS +@section @env{GOMP_RTEMS_THREAD_POOLS} -- Set the RTEMS specific thread pools +@cindex Environment Variable +@cindex Implementation specific setting +@table @asis +@item @emph{Description}: +This environment variable is only used on the RTEMS real-time operating system. +It determines the scheduler instance specific thread pools. The format for +@env{GOMP_RTEMS_THREAD_POOLS} is a list of optional +@code{<thread-pool-count>[$<priority>]@@<scheduler-name>} configurations +separated by @code{:} where: +@itemize @bullet +@item @code{<thread-pool-count>} is the thread pool count for this scheduler +instance. +@item @code{$<priority>} is an optional priority for the worker threads of a +thread pool according to @code{pthread_setschedparam}. In case a priority +value is omitted, then a worker thread will inherit the priority of the OpenMP +master thread that created it. The priority of the worker thread is not +changed after creation, even if a new OpenMP master thread using the worker has +a different priority. +@item @code{@@<scheduler-name>} is the scheduler instance name according to the +RTEMS application configuration. +@end itemize +In case no thread pool configuration is specified for a scheduler instance, +then each OpenMP master thread of this scheduler instance will use its own +dynamically allocated thread pool. To limit the worker thread count of the +thread pools, each OpenMP master thread must call @code{omp_set_num_threads}. +@item @emph{Example}: +Lets suppose we have three scheduler instances @code{IO}, @code{WRK0}, and +@code{WRK1} with @env{GOMP_RTEMS_THREAD_POOLS} set to +@code{"1@@WRK0:3$4@@WRK1"}. Then there are no thread pool restrictions for +scheduler instance @code{IO}. In the scheduler instance @code{WRK0} there is +one thread pool available. Since no priority is specified for this scheduler +instance, the worker thread inherits the priority of the OpenMP master thread +that created it. In the scheduler instance @code{WRK1} there are three thread +pools available and their worker threads run at priority four. +@end table + + + @c --------------------------------------------------------------------- @c The libgomp ABI @c --------------------------------------------------------------------- diff --git a/libgomp/team.c b/libgomp/team.c index 7671b05c5bd..67e25b3cf7e 100644 --- a/libgomp/team.c +++ b/libgomp/team.c @@ -27,6 +27,7 @@ creation and termination. */ #include "libgomp.h" +#include "pool.h" #include <stdlib.h> #include <string.h> @@ -140,16 +141,13 @@ get_last_team (unsigned nthreads) struct gomp_thread *thr = gomp_thread (); if (thr->ts.team == NULL) { - struct gomp_thread_pool *pool = thr->thread_pool; - if (pool != NULL) - { - struct gomp_team *last_team = pool->last_team; - if (last_team != NULL && last_team->nthreads == nthreads) - { - pool->last_team = NULL; - return last_team; - } - } + struct gomp_thread_pool *pool = gomp_get_thread_pool (thr, nthreads); + struct gomp_team *last_team = pool->last_team; + if (last_team != NULL && last_team->nthreads == nthreads) + { + pool->last_team = NULL; + return last_team; + } } return NULL; } @@ -219,19 +217,6 @@ free_team (struct gomp_team *team) free (team); } -/* Allocate and initialize a thread pool. */ - -static struct gomp_thread_pool *gomp_new_thread_pool (void) -{ - struct gomp_thread_pool *pool - = gomp_malloc (sizeof(struct gomp_thread_pool)); - pool->threads = NULL; - pool->threads_size = 0; - pool->threads_used = 0; - pool->last_team = NULL; - return pool; -} - static void gomp_free_pool_helper (void *thread_pool) { @@ -316,12 +301,6 @@ gomp_team_start (void (*fn) (void *), void *data, unsigned nthreads, thr = gomp_thread (); nested = thr->ts.team != NULL; - if (__builtin_expect (thr->thread_pool == NULL, 0)) - { - thr->thread_pool = gomp_new_thread_pool (); - thr->thread_pool->threads_busy = nthreads; - pthread_setspecific (gomp_thread_destructor, thr); - } pool = thr->thread_pool; task = thr->task; icv = task ? &task->icv : &gomp_global_icv; @@ -820,12 +799,13 @@ gomp_team_start (void (*fn) (void *), void *data, unsigned nthreads, start_data->thread_pool = pool; start_data->nested = nested; + attr = gomp_adjust_thread_attr (attr, &thread_attr); err = pthread_create (&pt, attr, gomp_thread_start, start_data++); if (err != 0) gomp_fatal ("Thread creation failed: %s", strerror (err)); } - if (__builtin_expect (gomp_places_list != NULL, 0)) + if (__builtin_expect (attr == &thread_attr, 0)) pthread_attr_destroy (&thread_attr); do_release: @@ -932,6 +912,7 @@ gomp_team_end (void) if (pool->last_team) free_team (pool->last_team); pool->last_team = team; + gomp_release_thread_pool (pool); } } diff --git a/libgomp/testsuite/libgomp.c/autopar-2.c b/libgomp/testsuite/libgomp.c/autopar-2.c new file mode 100644 index 00000000000..821a4dabc47 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/autopar-2.c @@ -0,0 +1,4 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-parallelize-loops=4 -ffast-math --param parloops-chunk-size=100" } */ + +#include "autopar-1.c" diff --git a/libgomp/testsuite/libgomp.graphite/bounds.c b/libgomp/testsuite/libgomp.graphite/bounds.c index 822eb6a6f95..3d2fd7aaec8 100644 --- a/libgomp/testsuite/libgomp.graphite/bounds.c +++ b/libgomp/testsuite/libgomp.graphite/bounds.c @@ -3,6 +3,8 @@ int foo(int *a, int n) int i; for (i = 2; i < n; i++) a[i] += a[i+1]; + for (i = 2; i < n; i++) + a[i] += a[i+1]; } /* Check that Graphite dependency checking notes the dependency. */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c index 245e64c6271..0393356f9f2 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c @@ -7,6 +7,9 @@ void parloop (int N) int i; for (i = 0; i < N; i++) + x[i] = i + 1; + + for (i = 0; i < N; i++) x[i] = i + 3; for (i = 0; i < N; i++) @@ -24,5 +27,5 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "loopfn" 8 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c index 513d58d7391..b58883c377a 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-4.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-4.c @@ -47,7 +47,6 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c index d5994677253..de31d6436f5 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-5.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-5.c @@ -31,6 +31,6 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c index 5a54d474771..9d2b37cbd4b 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-7.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-7.c @@ -31,5 +31,5 @@ int main (void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c index dc60f2f32b4..32ba5ab84ef 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-8.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-8.c @@ -43,8 +43,6 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ -/* { dg-final { scan-tree-dump-times "3 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "5 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn.0" 4 "optimized" } } */ /* { dg-final { scan-tree-dump-times "loopfn.1" 4 "optimized" } } */ diff --git a/liboffloadmic/ChangeLog b/liboffloadmic/ChangeLog index 67a3f6aee5d..4a726c8636d 100644 --- a/liboffloadmic/ChangeLog +++ b/liboffloadmic/ChangeLog @@ -1,3 +1,123 @@ +2015-09-08 Ilya Verbin <ilya.verbin@intel.com> + + * Makefile.am (liboffloadmic_host_la_DEPENDENCIES): Remove libcoi_host + and libmyo-client. liboffloadmic_host loads them dynamically. + * Makefile.in: Regenerate. + * doc/doxygen/header.tex: Merge from upstream, version 20150803 + <https://openmprtl.org/sites/default/files/liboffload_oss_20150803.tgz>. + * runtime/cean_util.cpp: Likewise. + * runtime/cean_util.h: Likewise. + * runtime/coi/coi_client.cpp: Likewise. + * runtime/coi/coi_client.h: Likewise. + * runtime/coi/coi_server.cpp: Likewise. + * runtime/coi/coi_server.h: Likewise. + * runtime/compiler_if_host.cpp: Likewise. + * runtime/compiler_if_host.h: Likewise. + * runtime/compiler_if_target.cpp: Likewise. + * runtime/compiler_if_target.h: Likewise. + * runtime/dv_util.cpp: Likewise. + * runtime/dv_util.h: Likewise. + * runtime/liboffload_error.c: Likewise. + * runtime/liboffload_error_codes.h: Likewise. + * runtime/liboffload_msg.c: Likewise. + * runtime/liboffload_msg.h: Likewise. + * runtime/mic_lib.f90: Likewise. + * runtime/offload.h: Likewise. + * runtime/offload_common.cpp: Likewise. + * runtime/offload_common.h: Likewise. + * runtime/offload_engine.cpp: Likewise. + * runtime/offload_engine.h: Likewise. + * runtime/offload_env.cpp: Likewise. + * runtime/offload_env.h: Likewise. + * runtime/offload_host.cpp: Likewise. + * runtime/offload_host.h: Likewise. + * runtime/offload_iterator.h: Likewise. + * runtime/offload_myo_host.cpp: Likewise. + * runtime/offload_myo_host.h: Likewise. + * runtime/offload_myo_target.cpp: Likewise. + * runtime/offload_myo_target.h: Likewise. + * runtime/offload_omp_host.cpp: Likewise. + * runtime/offload_omp_target.cpp: Likewise. + * runtime/offload_orsl.cpp: Likewise. + * runtime/offload_orsl.h: Likewise. + * runtime/offload_table.cpp: Likewise. + * runtime/offload_table.h: Likewise. + * runtime/offload_target.cpp: Likewise. + * runtime/offload_target.h: Likewise. + * runtime/offload_target_main.cpp: Likewise. + * runtime/offload_timer.h: Likewise. + * runtime/offload_timer_host.cpp: Likewise. + * runtime/offload_timer_target.cpp: Likewise. + * runtime/offload_trace.cpp: Likewise. + * runtime/offload_trace.h: Likewise. + * runtime/offload_util.cpp: Likewise. + * runtime/offload_util.h: Likewise. + * runtime/ofldbegin.cpp: Likewise. + * runtime/ofldend.cpp: Likewise. + * runtime/orsl-lite/include/orsl-lite.h: Likewise. + * runtime/orsl-lite/lib/orsl-lite.c: Likewise. + * runtime/use_mpss2.txt: Likewise. + * include/coi/common/COIEngine_common.h: Merge from upstream, MPSS + version 3.5 + <http://registrationcenter.intel.com/irc_nas/7445/mpss-src-3.5.tar>. + * include/coi/common/COIEvent_common.h: Likewise. + * include/coi/common/COIMacros_common.h: Likewise. + * include/coi/common/COIPerf_common.h: Likewise. + * include/coi/common/COIResult_common.h: Likewise. + * include/coi/common/COISysInfo_common.h: Likewise. + * include/coi/common/COITypes_common.h: Likewise. + * include/coi/sink/COIBuffer_sink.h: Likewise. + * include/coi/sink/COIPipeline_sink.h: Likewise. + * include/coi/sink/COIProcess_sink.h: Likewise. + * include/coi/source/COIBuffer_source.h: Likewise. + * include/coi/source/COIEngine_source.h: Likewise. + * include/coi/source/COIEvent_source.h: Likewise. + * include/coi/source/COIPipeline_source.h: Likewise. + * include/coi/source/COIProcess_source.h: Likewise. + * include/myo/myo.h: Likewise. + * include/myo/myoimpl.h: Likewise. + * include/myo/myotypes.h: Likewise. + * plugin/Makefile.am (myo_inc_dir): Remove. + (libgomp_plugin_intelmic_la_CPPFLAGS): Do not define MYO_SUPPORT. + (AM_CPPFLAGS): Likewise for offload_target_main. + * plugin/Makefile.in: Regenerate. + * runtime/emulator/coi_common.h: Update copyright years. + (OFFLOAD_EMUL_KNC_NUM_ENV): Replace with ... + (OFFLOAD_EMUL_NUM_ENV): ... this. + (enum cmd_t): Add CMD_CLOSE_LIBRARY. + * runtime/emulator/coi_device.cpp: Update copyright years. + (COIProcessWaitForShutdown): Add space between string constants. + Return handle to host in CMD_OPEN_LIBRARY. + Support CMD_CLOSE_LIBRARY. + * runtime/emulator/coi_device.h: Update copyright years. + * runtime/emulator/coi_host.cpp: Update copyright years. + (knc_engines_num): Replace with ... + (num_engines): ... this. + (init): Replace OFFLOAD_EMUL_KNC_NUM_ENV with OFFLOAD_EMUL_NUM_ENV. + (COIEngineGetCount): Replace COI_ISA_KNC with COI_ISA_MIC, and + knc_engines_num with num_engines. + (COIEngineGetHandle): Likewise. + (COIProcessCreateFromMemory): Add space between string constants. + (COIProcessCreateFromFile): New function. + (COIProcessLoadLibraryFromMemory): Rename arguments according to + COIProcess_source.h. Return handle, received from target. + (COIProcessUnloadLibrary): New function. + (COIPipelineClearCPUMask): New function. + (COIPipelineSetCPUMask): New function. + (COIEngineGetInfo): New function. + * runtime/emulator/coi_host.h: Update copyright years. + * runtime/emulator/coi_version_asm.h: Regenerate. + * runtime/emulator/coi_version_linker_script.map: Regenerate. + * runtime/emulator/myo_client.cpp: Update copyright years. + * runtime/emulator/myo_service.cpp: Update copyright years. + (myoArenaRelease): New function. + (myoArenaAcquire): New function. + (myoArenaAlignedFree): New function. + (myoArenaAlignedMalloc): New function. + * runtime/emulator/myo_service.h: Update copyright years. + * runtime/emulator/myo_version_asm.h: Regenerate. + * runtime/emulator/myo_version_linker_script.map: Regenerate. + 2015-08-24 Nathan Sidwell <nathan@codesourcery.com> * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_version): New. @@ -17,11 +137,11 @@ * configure: Reflects renaming of configure.in to configure.ac 2015-07-17 Nathan Sidwell <nathan@acm.org> - Ilya Verbin <iverbin@gmail.com> + Ilya Verbin <ilya.verbin@intel.com> * plugin/libgomp-plugin-intelmic.cpp (ImgDevAddrMap): Constify. (offload_image, GOMP_OFFLOAD_load_image, - OMP_OFFLOAD_unload_image): Constify target data. + GOMP_OFFLOAD_unload_image): Constify target data. 2015-07-08 Thomas Schwinge <thomas@codesourcery.com> diff --git a/liboffloadmic/Makefile.am b/liboffloadmic/Makefile.am index adc7c4cf55a..b1454513a09 100644 --- a/liboffloadmic/Makefile.am +++ b/liboffloadmic/Makefile.am @@ -84,8 +84,6 @@ liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \ liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1 liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0 -liboffloadmic_host_la_LIBADD = libcoi_host.la libmyo-client.la -liboffloadmic_host_la_DEPENDENCIES = $(liboffloadmic_host_la_LIBADD) liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \ runtime/coi/coi_server.cpp \ diff --git a/liboffloadmic/Makefile.in b/liboffloadmic/Makefile.in index 22b0193e13f..74fb3d27180 100644 --- a/liboffloadmic/Makefile.in +++ b/liboffloadmic/Makefile.in @@ -165,6 +165,7 @@ libmyo_service_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(CXXFLAGS) $(libmyo_service_la_LDFLAGS) $(LDFLAGS) -o $@ @LIBOFFLOADMIC_HOST_FALSE@am_libmyo_service_la_rpath = -rpath \ @LIBOFFLOADMIC_HOST_FALSE@ $(toolexeclibdir) +liboffloadmic_host_la_LIBADD = am__objects_1 = liboffloadmic_host_la-dv_util.lo \ liboffloadmic_host_la-liboffload_error.lo \ liboffloadmic_host_la-liboffload_msg.lo \ @@ -445,8 +446,6 @@ liboffloadmic_host_la_SOURCES = $(liboffloadmic_sources) \ liboffloadmic_host_la_CPPFLAGS = $(liboffloadmic_cppflags) -DHOST_LIBRARY=1 liboffloadmic_host_la_LDFLAGS = @lt_cv_dlopen_libs@ -version-info 5:0:0 -liboffloadmic_host_la_LIBADD = libcoi_host.la libmyo-client.la -liboffloadmic_host_la_DEPENDENCIES = $(liboffloadmic_host_la_LIBADD) liboffloadmic_target_la_SOURCES = $(liboffloadmic_sources) \ runtime/coi/coi_server.cpp \ runtime/compiler_if_target.cpp \ diff --git a/liboffloadmic/doc/doxygen/header.tex b/liboffloadmic/doc/doxygen/header.tex index b64a4636b9a..eaa563ca29b 100644 --- a/liboffloadmic/doc/doxygen/header.tex +++ b/liboffloadmic/doc/doxygen/header.tex @@ -82,7 +82,7 @@ Notice revision \#20110804 Intel, Xeon, and Intel Xeon Phi are trademarks of Intel Corporation in the U.S. and/or other countries. -This document is Copyright \textcopyright 2014, Intel Corporation. All rights reserved. +This document is Copyright \textcopyright 2014-2015, Intel Corporation. All rights reserved. \pagenumbering{roman} \tableofcontents diff --git a/liboffloadmic/include/coi/common/COIEngine_common.h b/liboffloadmic/include/coi/common/COIEngine_common.h index 87123128cf9..b8f31669b89 100644 --- a/liboffloadmic/include/coi/common/COIEngine_common.h +++ b/liboffloadmic/include/coi/common/COIEngine_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -64,7 +64,7 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////// /// -/// List of ISA types of supported engines. +/// List of ISA types of supported engines. /// typedef enum { @@ -89,7 +89,7 @@ typedef enum /// [out] The zero-based index of this engine in the collection of /// engines of the ISA returned in out_pType. /// -/// @return COI_INVALID_POINTER if the any of the parameters are NULL. +/// @return COI_INVALID_POINTER if any of the parameters are NULL. /// /// @return COI_SUCCESS /// diff --git a/liboffloadmic/include/coi/common/COIEvent_common.h b/liboffloadmic/include/coi/common/COIEvent_common.h new file mode 100644 index 00000000000..21c93138a0c --- /dev/null +++ b/liboffloadmic/include/coi/common/COIEvent_common.h @@ -0,0 +1,84 @@ +/* + * Copyright 2010-2015 Intel Corporation. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Disclaimer: The codes contained in these modules may be specific + * to the Intel Software Development Platform codenamed Knights Ferry, + * and the Intel product codenamed Knights Corner, and are not backward + * compatible with other Intel products. Additionally, Intel will NOT + * support the codes or instruction set in future products. + * + * Intel offers no warranty of any kind regarding the code. This code is + * licensed on an "AS IS" basis and Intel is not obligated to provide + * any support, assistance, installation, training, or other services + * of any kind. Intel is also not obligated to provide any updates, + * enhancements or extensions. Intel specifically disclaims any warranty + * of merchantability, non-infringement, fitness for any particular + * purpose, and any other warranty. + * + * Further, Intel disclaims all liability of any kind, including but + * not limited to liability for infringement of any proprietary rights, + * relating to the use of the code, even if Intel is notified of the + * possibility of such liability. Except as expressly stated in an Intel + * license agreement provided with this code and agreed upon with Intel, + * no license, express or implied, by estoppel or otherwise, to any + * intellectual property rights is granted herein. + */ + +#ifndef _COIEVENT_COMMON_H +#define _COIEVENT_COMMON_H + +/** @ingroup COIEvent + * @addtogroup COIEventcommon +@{ +* @file common/COIEvent_common.h +*/ +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +#include "../common/COITypes_common.h" +#include "../common/COIResult_common.h" + +#ifdef __cplusplus +extern "C" { +#endif +#endif // DOXYGEN_SHOULD_SKIP_THIS + + +/////////////////////////////////////////////////////////////////////////////// +/// +/// Signal one shot user event. User events created on source can be +/// signaled from both sink and source. This fires the event and wakes up +/// threads waiting on COIEventWait. +/// +/// Note: For events that are not registered or already signaled this call +/// will behave as a NOP. Users need to make sure that they pass valid +/// events on the sink side. +/// +/// @param in_Event +/// Event Handle to be signaled. +/// +/// @return COI_INVAILD_HANDLE if in_Event was not a User event. +/// +/// @return COI_ERROR if the signal fails to be sent from the sink. +/// +/// @return COI_SUCCESS if the event was successfully signaled or ignored. +/// +COIACCESSAPI +COIRESULT COIEventSignalUserEvent(COIEVENT in_Event); +/// +/// +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _COIEVENT_COMMON_H */ + +/*! @} */ diff --git a/liboffloadmic/include/coi/common/COIMacros_common.h b/liboffloadmic/include/coi/common/COIMacros_common.h index 6abddfedaf3..07c9b8cb356 100644 --- a/liboffloadmic/include/coi/common/COIMacros_common.h +++ b/liboffloadmic/include/coi/common/COIMacros_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -41,12 +41,17 @@ #ifndef _COIMACROS_COMMON_H #define _COIMACROS_COMMON_H +#include <string.h> +#include "../source/COIPipeline_source.h" +#include "../common/COITypes_common.h" + /// @file common/COIMacros_common.h /// Commonly used macros // Note that UNUSUED_ATTR means that it is "possibly" unused, not "definitely". // This should compile out in release mode if indeed it is unused. #define UNUSED_ATTR __attribute__((unused)) + #include <sched.h> #ifndef UNREFERENCED_CONST_PARAM #define UNREFERENCED_CONST_PARAM(P) { void* x UNUSED_ATTR = \ (void*)(uint64_t)P; \ @@ -66,4 +71,150 @@ #endif +/* The following are static inline definitions of functions used for manipulating + COI_CPU_MASK info (The COI_CPU_MASK type is declared as an array of 16 uint64_t's + in COITypes_common.h "typedef uint64_t COI_CPU_MASK[16]"). + + These static inlined functions are intended on being roughly the same as the Linux + CPU_* macros defined in sched.h - with the important difference being a different + fundamental type difference: cpu_set_t versus COI_CPU_MASK. + + The motivation for writing this code was to ease portability on the host side of COI + applications to both Windows and Linux. +*/ + +/* Roughly equivalent to CPU_ISSET(). */ +static inline uint64_t COI_CPU_MASK_ISSET(int bitNumber, const COI_CPU_MASK cpu_mask) +{ + if ((size_t)bitNumber < sizeof(COI_CPU_MASK)*8) + return ((cpu_mask)[bitNumber/64] & (((uint64_t)1) << (bitNumber%64))); + return 0; +} + +/* Roughly equivalent to CPU_SET(). */ +static inline void COI_CPU_MASK_SET(int bitNumber, COI_CPU_MASK cpu_mask) +{ + if ((size_t)bitNumber < sizeof(COI_CPU_MASK)*8) + ((cpu_mask)[bitNumber/64] |= (((uint64_t)1) << (bitNumber%64))); +} + +/* Roughly equivalent to CPU_ZERO(). */ +static inline void COI_CPU_MASK_ZERO(COI_CPU_MASK cpu_mask) +{ + memset(cpu_mask,0,sizeof(COI_CPU_MASK)); +} + +/* Roughly equivalent to CPU_AND(). */ +static inline void COI_CPU_MASK_AND(COI_CPU_MASK dst, const COI_CPU_MASK src1, const COI_CPU_MASK src2) +{ + const unsigned int loopIterations = sizeof(COI_CPU_MASK) / sizeof(dst[0]); + + for(unsigned int i=0;i<loopIterations;++i) + dst[i] = src1[i] & src2[i]; +} + +/* Roughly equivalent to CPU_XOR(). */ +static inline void COI_CPU_MASK_XOR(COI_CPU_MASK dst, const COI_CPU_MASK src1, const COI_CPU_MASK src2) +{ + const unsigned int loopIterations = sizeof(COI_CPU_MASK) / sizeof(dst[0]); + + for(unsigned int i=0;i<loopIterations;++i) + dst[i] = src1[i] ^ src2[i]; +} + +/* Roughly equivalent to CPU_OR(). */ +static inline void COI_CPU_MASK_OR(COI_CPU_MASK dst, const COI_CPU_MASK src1, const COI_CPU_MASK src2) +{ + const unsigned int loopIterations = sizeof(COI_CPU_MASK) / sizeof(dst[0]); + + for(unsigned int i=0;i<loopIterations;++i) + dst[i] = src1[i] | src2[i]; +} + +/* Utility function for COI_CPU_MASK_COUNT() below. */ +static inline int __COI_CountBits(uint64_t n) +{ + int cnt=0; + + for (;n;cnt++) + n &= (n-1); + return cnt; +} + +/* Roughly equivalent to CPU_COUNT(). */ +static inline int COI_CPU_MASK_COUNT(const COI_CPU_MASK cpu_mask) +{ + int cnt=0; + const unsigned int loopIterations = sizeof(COI_CPU_MASK) / sizeof(cpu_mask[0]); + + for(unsigned int i=0;i < loopIterations;++i) + { + cnt += __COI_CountBits(cpu_mask[i]); + } + return cnt; +} + +/* Roughly equivalent to CPU_EQUAL(). */ +static inline int COI_CPU_MASK_EQUAL(const COI_CPU_MASK cpu_mask1,const COI_CPU_MASK cpu_mask2) +{ + const unsigned int loopIterations = sizeof(COI_CPU_MASK) / sizeof(cpu_mask1[0]); + + for(unsigned int i=0;i < loopIterations;++i) + { + if (cpu_mask1[i] != cpu_mask2[i]) + return 0; + } + return 1; +} + + +/* Utility function to translate from cpu_set * to COI_CPU_MASK. */ +static inline void COI_CPU_MASK_XLATE(COI_CPU_MASK dest,const cpu_set_t *src) +{ + COI_CPU_MASK_ZERO(dest); +#if 0 + /* Slightly slower version than the following #else/#endif block. Left here only to + document the intent of the code. */ + for(unsigned int i=0;i < sizeof(cpu_set_t)*8;++i) + if (CPU_ISSET(i,src)) + COI_CPU_MASK_SET(i,dest); +#else + for(unsigned int i=0;i < sizeof(COI_CPU_MASK)/sizeof(dest[0]);++i) + { + for(unsigned int j=0;j < 64;++j) + { + if (CPU_ISSET(i*64+j,src)) + dest[i] |= ((uint64_t)1) << j; + } + } +#endif +} + +/* Utility function to translate from COI_CPU_MASK to cpu_set *. */ +static inline void COI_CPU_MASK_XLATE_EX(cpu_set_t *dest,const COI_CPU_MASK src) +{ + CPU_ZERO(dest); +#if 0 + /* Slightly slower version than the following #else/#endif block. Left here only to + document the intent of the code. */ + for(unsigned int i=0;i < sizeof(COI_CPU_MASK)*8;++i) + if (COI_CPU_MASK_ISSET(i,src)) + CPU_SET(i,dest); +#else + for(unsigned int i=0;i < sizeof(COI_CPU_MASK)/sizeof(src[0]);++i) + { + const uint64_t cpu_mask = src[i]; + + for(unsigned int j=0;j < 64;++j) + { + const uint64_t bit = ((uint64_t)1) << j; + + if (bit & cpu_mask) + CPU_SET(i*64+j,dest); + } + } +#endif +} + + #endif /* _COIMACROS_COMMON_H */ diff --git a/liboffloadmic/include/coi/common/COIPerf_common.h b/liboffloadmic/include/coi/common/COIPerf_common.h index b81756f1cc1..f542786452f 100644 --- a/liboffloadmic/include/coi/common/COIPerf_common.h +++ b/liboffloadmic/include/coi/common/COIPerf_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published diff --git a/liboffloadmic/include/coi/common/COIResult_common.h b/liboffloadmic/include/coi/common/COIResult_common.h index df8a4f68149..947e93cbdc2 100644 --- a/liboffloadmic/include/coi/common/COIResult_common.h +++ b/liboffloadmic/include/coi/common/COIResult_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -110,12 +110,13 @@ typedef enum COIRESULT ///< Offload Infrastructure on the host ///< is not compatible with the version ///< on the device. - COI_BAD_PORT, ///< The port that the host is set to + COI_BAD_PORT, ///< The port that the host is set to ///< connect to is invalid. COI_AUTHENTICATION_FAILURE, ///< The daemon was unable to authenticate ///< the user that requested an engine. ///< Only reported if daemon is set up for - ///< authorization. + ///< authorization. Is also reported in + ///< Windows if host can not find user. COI_NUM_RESULTS ///< Reserved, do not use. } COIRESULT; diff --git a/liboffloadmic/include/coi/common/COISysInfo_common.h b/liboffloadmic/include/coi/common/COISysInfo_common.h new file mode 100644 index 00000000000..0fae2312f2d --- /dev/null +++ b/liboffloadmic/include/coi/common/COISysInfo_common.h @@ -0,0 +1,126 @@ +/* + * Copyright 2010-2015 Intel Corporation. + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * Disclaimer: The codes contained in these modules may be specific + * to the Intel Software Development Platform codenamed Knights Ferry, + * and the Intel product codenamed Knights Corner, and are not backward + * compatible with other Intel products. Additionally, Intel will NOT + * support the codes or instruction set in future products. + * + * Intel offers no warranty of any kind regarding the code. This code is + * licensed on an "AS IS" basis and Intel is not obligated to provide + * any support, assistance, installation, training, or other services + * of any kind. Intel is also not obligated to provide any updates, + * enhancements or extensions. Intel specifically disclaims any warranty + * of merchantability, non-infringement, fitness for any particular + * purpose, and any other warranty. + * + * Further, Intel disclaims all liability of any kind, including but + * not limited to liability for infringement of any proprietary rights, + * relating to the use of the code, even if Intel is notified of the + * possibility of such liability. Except as expressly stated in an Intel + * license agreement provided with this code and agreed upon with Intel, + * no license, express or implied, by estoppel or otherwise, to any + * intellectual property rights is granted herein. + */ + +#ifndef _COISYSINFO_COMMON_H +#define _COISYSINFO_COMMON_H + +/** @ingroup COISysInfo + * @addtogroup COISysInfoCommon +@{ +* @file common/COISysInfo_common.h +* This interface allows developers to query the platform for system level +* information. */ + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#include "../common/COITypes_common.h" +#include <assert.h> +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif +#endif // DOXYGEN_SHOULD_SKIP_THIS + +#define INITIAL_APIC_ID_BITS 0xFF000000 // EBX[31:24] unique APIC ID + +/////////////////////////////////////////////////////////////////////////////// +/// \fn uint32_t COISysGetAPICID(void) +/// @return The Advanced Programmable Interrupt Controller (APIC) ID of +/// the hardware thread on which the caller is running. +/// +/// @warning APIC IDs are unique to each hardware thread within a processor, +/// but may not be sequential. +COIACCESSAPI +uint32_t COISysGetAPICID(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The number of cores exposed by the processor on which the caller is +/// running. Returns 0 if there is an error loading the processor info. +COIACCESSAPI +uint32_t COISysGetCoreCount(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The number of hardware threads exposed by the processor on which +/// the caller is running. Returns 0 if there is an error loading processor +/// info. +COIACCESSAPI +uint32_t COISysGetHardwareThreadCount(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The index of the hardware thread on which the caller is running. +/// +/// The indexes of neighboring hardware threads will differ by a value of one +/// and are within the range zero through COISysGetHardwareThreadCount()-1. +/// Returns ((uint32_t)-1) if there was an error loading processor info. +COIACCESSAPI +uint32_t COISysGetHardwareThreadIndex(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The index of the core on which the caller is running. +/// +/// The indexes of neighboring cores will differ by a value of one and are +/// within the range zero through COISysGetCoreCount()-1. Returns ((uint32_t)-1) +/// if there was an error loading processor info. +COIACCESSAPI +uint32_t COISysGetCoreIndex(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The number of level 2 caches within the processor on which the +/// caller is running. Returns ((uint32_t)-1) if there was an error loading +/// processor info. +COIACCESSAPI +uint32_t COISysGetL2CacheCount(void); + +/////////////////////////////////////////////////////////////////////////////// +/// +/// @return The index of the level 2 cache on which the caller is running. +/// Returns ((uint32_t)-1) if there was an error loading processor info. +/// +/// The indexes of neighboring cores will differ by a value of one and are +/// within the range zero through COISysGetL2CacheCount()-1. +COIACCESSAPI +uint32_t COISysGetL2CacheIndex(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif +/*! @} */ + +#endif /* _COISYSINFO_COMMON_H */ diff --git a/liboffloadmic/include/coi/common/COITypes_common.h b/liboffloadmic/include/coi/common/COITypes_common.h index 78180dce81b..001ddc979c0 100644 --- a/liboffloadmic/include/coi/common/COITypes_common.h +++ b/liboffloadmic/include/coi/common/COITypes_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -73,8 +73,8 @@ typedef struct coimapinst * COIMAPINSTANCE; typedef uint64_t COI_CPU_MASK[16]; -/** - * On Windows, coi_wchar_t is a uint32_t. On Windows, wchar_t is 16 bits wide, and on Linux it is 32 bits wide, so uint32_t is used for portability. +/** + * On Windows, coi_wchar_t is a uint32_t. On Windows, wchar_t is 16 bits wide, and on Linux it is 32 bits wide, so uint32_t is used for portability. */ typedef wchar_t coi_wchar_t; diff --git a/liboffloadmic/include/coi/sink/COIBuffer_sink.h b/liboffloadmic/include/coi/sink/COIBuffer_sink.h index 66d0549010d..2e51e92f920 100644 --- a/liboffloadmic/include/coi/sink/COIBuffer_sink.h +++ b/liboffloadmic/include/coi/sink/COIBuffer_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -45,7 +45,7 @@ * @addtogroup COIBufferSink @{ -* @file sink\COIBuffer_sink.h +* @file sink\COIBuffer_sink.h */ #ifndef DOXYGEN_SHOULD_SKIP_THIS #include "../common/COITypes_common.h" @@ -54,29 +54,29 @@ #ifdef __cplusplus extern "C" { -#endif +#endif ////////////////////////////////////////////////////////////////////////////// /// -/// Adds a reference to the memory of a buffer. The memory of the buffer -/// will remain on the device until both a corresponding COIBufferReleaseRef() +/// Adds a reference to the memory of a buffer. The memory of the buffer +/// will remain on the device until both a corresponding COIBufferReleaseRef() /// call is made and the run function that delivered the buffer returns. /// -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) streaming buffers should not be AddRef'd. Doing so may result in -/// unpredictable results or may cause the sink process to crash. +/// Running this API in a thread spawned within the run function is not +/// supported and will cause unpredictable results and may cause data corruption. /// -/// @warning 1.It is possible for enqueued run functions to be unable to -/// execute due to all card memory being occupied by addref'ed +/// @warning 1.It is possible for enqueued run functions to be unable to +/// execute due to all card memory being occupied by AddRef'd /// buffers. As such, it is important that whenever a buffer is -/// addref'd that there be no dependencies on future run functions +/// AddRef'd that there be no dependencies on future run functions /// for progress to be made towards releasing the buffer. -/// 2.It is important that AddRef is called within the scope of -/// run function that carries the buffer to be addref'ed. +/// 2.It is important that AddRef is called within the scope of +/// run function that carries the buffer to be AddRef'd. /// /// @param in_pBuffer -/// [in] Pointer to the start of a buffer being addref'ed, that was +/// [in] Pointer to the start of a buffer being AddRef'd, that was /// passed in at the start of the run function. -/// +/// /// @return COI_SUCCESS if the buffer ref count was successfully incremented. /// /// @return COI_INVALID_POINTER if the buffer pointer is NULL. @@ -90,30 +90,33 @@ COIBufferAddRef( ////////////////////////////////////////////////////////////////////////////// /// -/// Removes a reference to the memory of a buffer. The memory of the buffer +/// Removes a reference to the memory of a buffer. The memory of the buffer /// will be eligible for being freed on the device when the following /// conditions are met: the run function that delivered the buffer -/// returns, and the number of calls to COIBufferReleaseRef() matches the +/// returns, and the number of calls to COIBufferReleaseRef() matches the /// number of calls to COIBufferAddRef(). +// +/// Running this API in a thread spawned within the run function is not +/// supported and will cause unpredictable results and may cause data corruption. /// -/// @warning When a buffer is addref'ed it is assumed that it is in use and all +/// @warning When a buffer is AddRef'd it is assumed that it is in use and all /// other operations on that buffer waits for ReleaseRef() to happen. -/// So you cannot pass the addref'ed buffer's handle to RunFunction -/// that calls ReleaseRef(). This is a circular dependency and will -/// cause a deadlock. Buffer's pointer (buffer's sink side +/// So you cannot pass the AddRef'd buffer's handle to RunFunction +/// that calls ReleaseRef(). This is a circular dependency and will +/// cause a deadlock. Buffer's pointer (buffer's sink side /// address/pointer which is different than source side BUFFER handle) -/// needs to be stored somewhere to retrieve it later to use in +/// needs to be stored somewhere to retrieve it later to use in /// ReleaseRef. /// /// @param in_pBuffer -/// [in] Pointer to the start of a buffer previously addref'ed, that +/// [in] Pointer to the start of a buffer previously AddRef'd, that /// was passed in at the start of the run function. -/// +/// /// @return COI_SUCCESS if the buffer refcount was successfully decremented. /// /// @return COI_INVALID_POINTER if the buffer pointer was invalid. /// -/// @return COI_INVALID_HANDLE if the buffer did not have COIBufferAddRef() +/// @return COI_INVALID_HANDLE if the buffer did not have COIBufferAddRef() /// previously called on it. /// COIRESULT @@ -123,7 +126,7 @@ COIBufferReleaseRef( #ifdef __cplusplus } /* extern "C" */ -#endif +#endif #endif /* _COIBUFFER_SINK_H */ diff --git a/liboffloadmic/include/coi/sink/COIPipeline_sink.h b/liboffloadmic/include/coi/sink/COIPipeline_sink.h index ccfde205dea..c70872ad12c 100644 --- a/liboffloadmic/include/coi/sink/COIPipeline_sink.h +++ b/liboffloadmic/include/coi/sink/COIPipeline_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published diff --git a/liboffloadmic/include/coi/sink/COIProcess_sink.h b/liboffloadmic/include/coi/sink/COIProcess_sink.h index 90603262c8b..6e2ef19df18 100644 --- a/liboffloadmic/include/coi/sink/COIProcess_sink.h +++ b/liboffloadmic/include/coi/sink/COIProcess_sink.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -63,10 +63,11 @@ extern "C" { /// main() function from exiting until it is directed to by the source. When /// the shutdown message is received this function will stop any future run /// functions from executing but will wait for any current run functions to -/// complete. All Intel® Coprocessor Offload Infrastructure (Intel® COI) resources will be cleaned up and no additional Intel® Coprocessor Offload Infrastructure (Intel® COI) APIs -/// should be called after this function returns. This function does not -/// invoke exit() so the application can perform any of its own cleanup once -/// this call returns. +/// complete. All Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// resources will be cleaned up and no additional Intel® Coprocessor Offload +/// Infrastructure (Intel® COI) APIs should be called after this function +/// returns. This function does not invoke exit() so the application +/// can perform any of its own cleanup once this call returns. /// /// @return COI_SUCCESS once the process receives the shutdown message. /// @@ -86,8 +87,9 @@ COIProcessWaitForShutdown(); /// from this call. /// /// @return COI_SUCCESS once the proxy output has been flushed to and written -/// written by the host. Note that Intel® Coprocessor Offload Infrastructure (Intel® COI) on the source writes to stdout -/// and stderr, but does not flush this output. +/// written by the host. Note that Intel® Coprocessor Offload +/// Infrastructure (Intel® COI) on the source writes to stdout and +/// stderr, but does not flush this output. /// @return COI_SUCCESS if the process was created without enabling /// proxy IO this function. /// diff --git a/liboffloadmic/include/coi/source/COIBuffer_source.h b/liboffloadmic/include/coi/source/COIBuffer_source.h index 4a08856f5d1..bfd066ca916 100644 --- a/liboffloadmic/include/coi/source/COIBuffer_source.h +++ b/liboffloadmic/include/coi/source/COIBuffer_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -68,21 +68,16 @@ typedef enum COI_BUFFER_TYPE /// Sink physical memory. Mapping the buffer may stall the pipelines. COI_BUFFER_NORMAL = 1, - /// A streaming buffer creates new versions each time it is passed to - /// Runfunction. These new versions are consumed by run functions. - - /// To_SINK buffers are used to send data from SOURCE to SINK - /// These buffers are SOURCE write only buffers. If read, won't - /// get Data written by SINK - COI_BUFFER_STREAMING_TO_SINK, - - /// To_SOURCE buffers are used to get data from SINK to SOURCE - /// These buffers are SOURCE Read only buffers. If written, data - /// won't get reflected on SINK side. - COI_BUFFER_STREAMING_TO_SOURCE, + // Reserved values, not used by COI any more + COI_BUFFER_RESERVED_1, + COI_BUFFER_RESERVED_2, /// A pinned buffer exists in a shared memory region and is always /// available for read or write operations. + /// Note: Pinned Buffers larger than 4KB are not supported in + /// Windows 7 kernels. + /// The value of COI_BUFFER_PINNED is set to specific value + /// to maintain compatibility with older versions of COI COI_BUFFER_PINNED, /// OpenCL buffers are similar to Normal buffers except they don't @@ -126,12 +121,15 @@ typedef enum COI_BUFFER_TYPE /// check to see if this memory is read only. Ordinarily this is checked /// and an error is thrown upon buffer creation. With this flag, the error /// might occur later, and cause undetermined behavior. Be sure to always -/// use writeable memory for COIBuffers. +/// use writable memory for COIBuffers. #define COI_OPTIMIZE_NO_DMA 0x00000040 /// Hint to the runtime to try to use huge page sizes for backing store on the -/// sink. Is currently not compatible with PINNED buffers or the SAME_ADDRESS -/// flags or the SINK_MEMORY flag. +/// sink. Is currently not compatible with PINNED buffers or the SAME_ADDRESS +/// flags or the SINK_MEMORY flag. It is important to note that this is a hint +/// and internally the runtime may not actually promote to huge pages. +/// Specifically if the buffer is too small (less than 4KiB for example) then +/// the runtime will not promote the buffer to use huge pages. #define COI_OPTIMIZE_HUGE_PAGE_SIZE 0x00000080 /// Used to tell Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) @@ -167,12 +165,12 @@ COI_VALID_BUFFER_TYPES_AND_FLAGS[COI_BUFFER_OPENCL+1] = { | ADDR | SINK | SRC | SRC | SINK | SINK | NO | PAGE | SINK | | SINKS | SRC | READ | WRITE | READ | WRITE | DMA | SIZE | MEM | +-------+------+------+-------+------+-------+-----+------+-----*/ -MTM(INVALID , F , F , F , F , F , F , F , F , F ), -MTM(NORMAL , T , T , T , T , T , T , T , T , T ), -MTM(TO_SINK , F , F , F , T , T , T , F , F , F ), -MTM(TO_SOURCE, F , F , T , F , F , T , F , F , F ), -MTM(PINNED , T , T , T , T , T , T , F , F , F ), -MTM(OPENCL , T , T , T , T , T , T , T , T , F ), +MTM(INVALID , F , F , F , F , F , F , F , F , F ), +MTM(NORMAL , T , T , T , T , T , T , T , T , T ), +MTM(RESERVED1 , F , F , F , F , F , F , F , F , F ), +MTM(RESERVED2 , F , F , F , F , F , F , F , F , F ), +MTM(PINNED , T , T , T , T , T , T , F , F , F ), +MTM(OPENCL , T , T , T , T , T , T , T , T , F ), }; ///\endcode #undef MTM @@ -223,8 +221,8 @@ COI_VALID_BUFFER_TYPES_AND_MAP +-------+-------+-------+*/ MMM(INVALID , F , F , F ), MMM(NORMAL , T , T , T ), -MMM(STREAMING_TO_SINK , F , F , T ), -MMM(STREAMING_TO_SOURCE , F , T , F ), +MMM(RESERVED1 , F , F , F ), +MMM(RESERVED2 , F , F , F ), MMM(PINNED , T , T , T ), MMM(OPENCL , T , T , T ), }; @@ -250,7 +248,19 @@ typedef enum COI_COPY_TYPE /// The runtime should use a CPU copy to copy the data. /// CPU copy is a synchronous copy. So the resulting operations are always /// blocking (even though a out_pCompletion event is specified). - COI_COPY_USE_CPU + COI_COPY_USE_CPU, + + /// Same as above, but forces moving entire buffer to target process in Ex + /// extended APIs, even if the full buffer is not written. + COI_COPY_UNSPECIFIED_MOVE_ENTIRE, + + /// Same as above, but forces moving entire buffer to target process in Ex + /// extended APIs, even if the full buffer is not written. + COI_COPY_USE_DMA_MOVE_ENTIRE, + + /// Same as above, but forces moving entire buffer to target process in Ex + /// extended APIs, even if the full buffer is not written. + COI_COPY_USE_CPU_MOVE_ENTIRE } COI_COPY_TYPE; @@ -260,9 +270,7 @@ typedef enum COI_COPY_TYPE /// access in a COIPROCESS. This is used with COIBufferSetState. /// /// Buffer state holds only for NORMAL Buffers and OPENCL buffers. Pinned -/// buffers are always valid everywhere they get created. Streaming buffers -/// do not follow the state transition rules, as a new version of the -/// buffer is created every time it is Mapped or you issue a RunFunction. +/// buffers are always valid everywhere they get created. /// /// Rules on State Transition of the buffer: /// -. When a Buffer is created by default it is valid only on the source, @@ -296,11 +304,11 @@ typedef enum COI_COPY_TYPE /// /// - COIBufferWrite makes the buffer exclusively valid where the write /// happens. Write gives preference to Source over Sink. In other words -/// if a buffer is valid on the Source and multiple Sinks, Write will -/// happen on the Source and will Invalidate all other Sinks. If the -/// buffer is valid on multiple Sinks ( and not on the Source) then -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) -/// selects process handle with the lowest numerical value to do the +/// if a buffer is valid on the Source and multiple Sinks, Write will +/// happen on the Source and will Invalidate all other Sinks. If the +/// buffer is valid on multiple Sinks ( and not on the Source) then +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) +/// selects process handle with the lowest numerical value to do the /// exclusive write Again, OPENCL buffers are invalidated only if the /// buffer is not in use on that SINK/SOURCE. /// @@ -308,41 +316,41 @@ typedef enum COI_COPY_TYPE /// when data needs to be moved from a valid location. The selection of /// valid location happens as stated above. /// -/// - It is possible to alter only parts of the buffer and change it state -/// In other words it is possible for different parts of the buffer to have -/// different states on different devices. A byte is the minimum size at +/// - It is possible to alter only parts of the buffer and change it state +/// In other words it is possible for different parts of the buffer to have +/// different states on different devices. A byte is the minimum size at /// which state can be maintained internally. Granularity level is completely /// determined by how the buffer gets fragmented. /// -/// Note: Buffer is considered 'in use' if is +/// Note: Buffer is considered 'in use' if is /// - Being used in RunFunction : In use on a Sink /// - Mapped: In use on a Source /// - AddRef'd: In use on Sink /// ////////////////////////////////////////////////////////////////////////////// -/// The buffer states used with COIBufferSetState call to indicate the new +/// The buffer states used with COIBufferSetState call to indicate the new /// state of the buffer on a given process /// typedef enum { COI_BUFFER_VALID = 0, // Buffer is valid and up-to-date on the process COI_BUFFER_INVALID , // Buffer is not valid, need valid data COI_BUFFER_VALID_MAY_DROP, // Same as valid but will drop the content when - // evicted to avoid overwriting the shadow + // evicted to avoid overwriting the shadow // memory COI_BUFFER_RESERVED // Reserved for internal use } COI_BUFFER_STATE; /// /// Note: A VALID_MAY_DROP declares a buffer's copy as secondary on a given /// process. This means that there needs to be at least one primary copy of the -/// the buffer somewhere in order to mark the buffer as VALID_MAY_DROP on a +/// the buffer somewhere in order to mark the buffer as VALID_MAY_DROP on a /// process. In other words to make a buffer VALID_MAY_DROP on a given process /// it needs to be in COI_BUFFER_VALID state somewhere else. The operation gets /// ignored (or is a nop) if there is no primary copy of the buffer. The nature -/// of this state to "drop the content" when evicted is a side effect of -/// marking the buffer as secondary copy. So when a buffer marked -/// VALID_MAY_DROP is evicted Intel® Coprocessor Offload Infrastructure -/// (Intel® COI) doesn't back it up as it is assumed that +/// of this state to "drop the content" when evicted is a side effect of +/// marking the buffer as secondary copy. So when a buffer marked +/// VALID_MAY_DROP is evicted Intel(R) Coprocessor Offload Infrastructure +/// (Intel(R) COI) doesn't back it up as it is assumed that /// there is a primary copy somewhere. ////////////////////////////////////////////////////////////////////////////// @@ -355,19 +363,37 @@ typedef enum { // A process handle for COIBufferSetState call to indicate all the sink // processes where the given buffer is valid -#define COI_SINK_OWNERS ((COIPROCESS)-2) +#define COI_SINK_OWNERS ((COIPROCESS)-2) + +// Matrix descriptors used with MultiD Read/Write +typedef struct dim_desc { + int64_t size; // Size of data type + int64_t lindex; // Lower index, used in Fortran + int64_t lower; // Lower section bound + int64_t upper; // Upper section bound + int64_t stride; // Stride, or number of bytes between the start + // of one element and start of next one divided + // by size. +} dim_desc; + +typedef struct arr_desc { + int64_t base; // Base address + int64_t rank; // Rank of array, i.e. number of dimensions + dim_desc dim[3]; // This array has as many elements as “rank” + // currently limited to 3. +} arr_desc; ////////////////////////////////////////////////////////////////////////////// /// /// Creates a buffer that can be used in RunFunctions that are queued in /// pipelines. The address space for the buffer is reserved when it is /// created although the memory may not be committed until the buffer is -/// used for the first time. Please note that the Intel® Coprocessor Offload -/// Infrastructure (Intel® COI) runtime may also -/// allocate space for the source process to use as shadow memory for -/// certain types of buffers. If Intel® Coprocessor Offload Infrastructure -/// (Intel® COI) does allocate this memory it will not -/// be released or reallocated until the COIBuffer is destroyed. +/// used for the first time. Please note that the Intel(R) Coprocessor Offload +/// Infrastructure (Intel(R) COI) runtime may also allocate space for the +/// source process to use as shadow memory for certain types of buffers. +/// If Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) +/// does allocate this memory it will not be released or reallocated +/// until the COIBuffer is destroyed. /// /// @param in_Size /// [in] The number of bytes to allocate for the buffer. If in_Size @@ -408,13 +434,13 @@ typedef enum { /// which flags and types are compatible. /// /// @return COI_OUT_OF_RANGE if in_Size is zero, if the bits set in -/// the in_Flags parameter are not recognized flags, or if -/// in_NumProcesses is zero. +/// the in_Flags parameter are not recognized flags, or if in_NumProcesses is zero. /// /// @return COI_INVALID_POINTER if the in_pProcesses or out_pBuffer parameter /// is NULL. /// -/// @return COI_NOT_SUPPORTED if one of the in_Flags is COI_SINK_MEMORY. +/// @return COI_NOT_SUPPORTED if in_Type has invalid value or if +/// one of the in_Flags is COI_SINK_MEMORY. /// /// @return COI_NOT_SUPPORTED if the flags include either /// COI_SAME_ADDRESS_SINKS or COI_SAME_ADDRESS_SINKS_AND_SOURCE and @@ -425,7 +451,10 @@ typedef enum { /// /// @return COI_OUT_OF_MEMORY if allocating the buffer fails. /// -/// @return COI_RESOURCE_EXHAUSTED if the sink is out of buffer memory. +/// @return COI_RESOURCE_EXHAUSTED if the sink is out of buffer memory. This +/// error can also be thrown from Windows 7 operating systems if +/// COI_BUFFER_PINNED and a size larger than 4KB is requested. +/// This is due to a limitation of the Windows 7 memory management unit. /// COIACCESSAPI COIRESULT @@ -442,22 +471,22 @@ COIBufferCreate( /// /// Creates a buffer from some existing memory that can be used in /// RunFunctions that are queued in pipelines. If the flag COI_SINK_MEMORY -/// is specified then Intel® Coprocessor Offload I -/// nfrastructure (Intel® COI) will use that memory for the buffer on the sink. -/// If that flag isn't set then the memory provided is used as backing store +/// is specified then Intel(R) Coprocessor Offload +/// Infrastructure (Intel(R) COI) will use that memory for the buffer on the sink. +/// If that flag isn't set then the memory provided is used as backing store /// for the buffer on the source. In either case the memory must not be freed /// before the buffer is destroyed. -/// While the user still owns the memory passed in they must use the +/// While the user still owns the memory passed in they must use the /// appropriate access flags when accessing the buffer in COIPipelinRunFunction /// or COIBufferMap calls so that the runtime knows when the /// memory has been modified. If the user just writes directly to the memory -/// location then those changes may not be visible when the corresponding +/// location then those changes may not be visible when the corresponding /// buffer is accessed. /// Whatever values are already present in the memory location when this call /// is made are preserved. The memory values are also preserved when /// COIBufferDestroy is called. /// -/// @warning: Use of this function is highly discouraged if the calling program +/// @warning: Use of this function is highly discouraged if the calling /// program forks at all (including calls to system(3), popen(3), or similar /// functions) during the life of this buffer. See the discussion around the /// in_Memory parameter below regarding this. @@ -467,8 +496,7 @@ COIBufferCreate( /// is not page aligned, it will be rounded up. /// /// @param in_Type -/// [in] The type of the buffer to create. Note that streaming buffers -/// can not be created from user memory. Only COI_BUFFER_NORMAL and +/// [in] The type of the buffer to create. Only COI_BUFFER_NORMAL and /// COI_BUFFER_PINNED buffer types are supported. /// /// @param in_Flags @@ -496,7 +524,7 @@ COIBufferCreate( /// system(3), popen(3), among others). /// /// For forked processes, Linux uses copy-on-write semantics for -/// performances reasons. Conseqeuently, if the parent forks and then +/// performance reasons. Consequently, if the parent forks and then /// writes to this memory, the physical page mapping changes causing /// the DMA to fail (and thus data corruption). /// @@ -522,8 +550,8 @@ COIBufferCreate( /// /// @return COI_SUCCESS if the buffer was created /// -/// @return COI_NOT_SUPPORTED if the in_Type value is not COI_BUFFER_NORMAL or -/// COI_BUFFER_PINNED. +/// @return COI_NOT_SUPPORTED if the in_Type value is not COI_BUFFER_NORMAL, +/// COI_BUFFER_PINNED, or COI_BUFFER_OPENCL. /// /// @return COI_NOT_SUPPORTED if in_Memory is read-only memory /// @@ -547,8 +575,7 @@ COIBufferCreate( /// COI_OPTIMIZE_HUGE_PAGE_SIZE are both set. /// /// @return COI_OUT_OF_RANGE if in_Size is zero, if the bits set in -/// the in_Flags parameter are not recognized flags, or if -/// in_NumProcesses is zero. +/// the in_Flags parameter are not recognized flags, or if in_NumProcesses is zero. /// /// @return COI_INVALID_POINTER if in_Memory, in_pProcesses or /// out_pBuffer parameter is NULL. @@ -560,7 +587,7 @@ COIACCESSAPI COIRESULT COIBufferCreateFromMemory( uint64_t in_Size, - COI_BUFFER_TYPE in_Type, + COI_BUFFER_TYPE in_Type, uint32_t in_Flags, void* in_Memory, uint32_t in_NumProcesses, @@ -570,10 +597,10 @@ COIBufferCreateFromMemory( ////////////////////////////////////////////////////////////////////////////// /// -/// Destroys a buffer. Will block on completion of any operations on the -/// buffer, such as COIPipelineRunFunction or COIBufferCopy. Will block until +/// Destroys a buffer. Will block on completion of any operations on the +/// buffer, such as COIPipelineRunFunction or COIBufferCopy. Will block until /// all COIBufferAddRef calls have had a matching COIBufferReleaseRef call -/// made. Will not block on an outstanding COIBufferUnmap but will instead +/// made. will not block on an outstanding COIBufferUnmap but will instead /// return COI_RETRY. /// /// @param in_Buffer @@ -599,32 +626,30 @@ COIBufferDestroy( /// /// This call initiates a request to access a region of a buffer. Multiple /// overlapping (or non overlapping) regions can be mapped simultaneously for -/// any given buffer. If a completion event is specified this call will +/// any given buffer. If a completion event is specified this call will /// queue a request for the data which will be satisfied when the buffer is -/// available. Once all conditions are met the completion event will be -/// signaled and the user can access the data at out_ppData. The user can call +/// available. Once all conditions are met the completion event will be +/// signaled and the user can access the data at out_ppData. The user can call /// COIEventWait with out_pCompletion to find out when the map operation has /// completed. If the user accesses the data before the map operation is -/// complete the results are undefined. If out_pCompletion is NULL then this +/// complete the results are undefined. If out_pCompletion is NULL then this /// call blocks until the map operation completes and when this call returns -/// out_ppData can be safely accessed. This call returns a map instance handle +/// out_ppData can be safely accessed. This call returns a map instance handle /// in an out parameter which must be passed into COIBufferUnmap when the user /// no longer needs access to that region of the buffer. /// /// The address returned from COIBufferMap may point to memory that -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// manages on behalf of the user. The user must not free or reallocate this -/// memory, Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// memory, Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// will perform any necessary cleanup when the buffer is /// destroyed. /// /// Note that different types of buffers behave differently when mapped. /// For instance, mapping a COI_BUFFER_NORMAL for write must stall if the -/// buffer is currently being written to by a run function. Mapping a -/// COI_BUFFER_STREAMING_TO_SINK will create a new physical copy of the buffer -/// and make it available immediately. Mapping a COI_BUFFER_PINNED buffer will -/// not affect other functions that use that buffer since a COI_BUFFER_PINNED -/// buffer can be mapped at any time. +/// buffer is currently being written to by a run function. Mapping +/// a COI_BUFFER_PINNED buffer will not affect other functions that use +/// that buffer since a COI_BUFFER_PINNED buffer can be mapped at any time. /// The asynchronous operation of COIBufferMap will likely be most useful when /// paired with a COI_BUFFER_NORMAL. /// @@ -633,15 +658,15 @@ COIBufferDestroy( /// /// @param in_Offset /// [in] Offset into the buffer that a pointer should be returned -/// for. The value 0 can be passed in to signify that the mapped +/// for. The value 0 can be passed in to signify that the mapped /// region should start at the beginning of the buffer. /// /// @param in_Length /// [in] Length of the buffer area to map. This parameter, in /// combination with in_Offset, allows the caller to specify -/// that only a subset of an entire buffer need be mapped. A -/// value of 0 can be passed in only if in_Offset is 0, to signify -/// that the mapped region is the entire buffer. +/// that only a subset of an entire buffer need be mapped. A +/// value of 0 can be passed in only if in_Offset is 0, to signify +/// that the mapped region is the entire buffer. /// /// @param in_Type /// [in] The access type that is needed by the application. This will @@ -700,11 +725,6 @@ COIBufferDestroy( /// @return COI_ARGUMENT_MISMATCH if the in_Type of map is not a valid type /// for in_Buffer's type of buffer. /// -/// @return COI_RESOURCE_EXHAUSTED if could not create a version for TO_SINK -/// streaming buffer. It can fail if enough memory is not available to -/// register. This call will succeed eventually when the registered -/// memory becomes available. -/// /// @return COI_INVALID_HANDLE if in_Buffer is not a valid buffer handle. /// /// @return COI_INVALID_POINTER if out_pMapInstance or out_ppData is NULL. @@ -725,9 +745,9 @@ COIBufferMap( ////////////////////////////////////////////////////////////////////////////// /// /// Disables Source access to the region of the buffer that was provided -/// through the corresponding call to COIBufferMap. The number of calls to +/// through the corresponding call to COIBufferMap. The number of calls to /// COIBufferUnmap() should always match the number of calls made to -/// COIBufferMap(). The data pointer returned from the COIBufferMap() call +/// COIBufferMap(). The data pointer returned from the COIBufferMap() call /// will be invalid after this call. /// /// @param in_MapInstance @@ -750,7 +770,7 @@ COIBufferMap( /// /// @param out_pCompletion /// [out] An optional pointer to a COIEVENT object that will be -/// signaled when the unmap is complete. The user may pass in NULL if +/// signaled when the unmap is complete. The user may pass in NULL if /// the user wants COIBufferUnmap to perform a blocking unmap /// operation. /// @@ -774,11 +794,12 @@ COIBufferUnmap( ////////////////////////////////////////////////////////////////////////////// /// -/// Gets the Sink's virtual address of the buffer. This is the same -/// address that is passed to the run function on the Sink. The virtual +/// Gets the Sink's virtual address of the buffer for the first process +/// that is using the buffer. This is the same address +/// that is passed to the run function on the Sink. The virtual /// address assigned to the buffer for use on the sink is fixed; /// the buffer will always be present at that virtual address on the sink -/// and will not get a different virtual address across different +/// and will not get a different virtual address across different /// RunFunctions. /// This address is only valid on the Sink and should not be dereferenced on /// the Source (except for the special case of buffers created with the @@ -796,9 +817,6 @@ COIBufferUnmap( /// /// @return COI_INVALID_POINTER if the out_pAddress parameter was invalid. /// -/// @return COI_NOT_SUPPORTED if the buffer passed in is of type -/// COI_BUFFER_STREAMING_TO_SOURCE or COI_BUFFER_STREAMING_TO_SINK. -/// COIACCESSAPI COIRESULT COIBufferGetSinkAddress( @@ -807,9 +825,47 @@ COIBufferGetSinkAddress( ////////////////////////////////////////////////////////////////////////////// /// +/// Gets the Sink's virtual address of the buffer. This is the same +/// address that is passed to the run function on the Sink. The virtual +/// address assigned to the buffer for use on the sink is fixed; +/// the buffer will always be present at that virtual address on the sink +/// and will not get a different virtual address across different +/// RunFunctions. +/// This address is only valid on the Sink and should not be dereferenced on +/// the Source (except for the special case of buffers created with the +/// COI_SAME_ADDRESS flag). +/// +/// @param in_Process +/// [in] The process for which the address should be returned. +/// Special handle value 0 can be passed to the function; +/// in this case, address for the first valid process will be returned +/// +/// @param in_Buffer +/// [in] Buffer handle +/// +/// @param out_pAddress +/// [out] pointer to a uint64_t* that will be filled with the address. +/// +/// @return COI_SUCCESS upon successful return of the buffer's address. +/// +/// @return COI_INVALID_HANDLE if the passed in buffer or process +/// handle was invalid. +/// +/// @return COI_INVALID_POINTER if the out_pAddress parameter was invalid. +/// +/// @return COI_OUT_OF_RANGE if the in_Process is not valid for in_Buffer at the +/// moment of calling the function. +/// +COIACCESSAPI +COIRESULT +COIBufferGetSinkAddressEx( + COIPROCESS in_Process, + COIBUFFER in_Buffer, + uint64_t* out_pAddress); + +////////////////////////////////////////////////////////////////////////////// +/// /// Copy data from a normal virtual address into an existing COIBUFFER. -/// Note that it is not possible to use this API with any type of -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers. /// Please note that COIBufferWrite does not follow implicit buffer /// dependencies. If a buffer is in use in a run function or has been added /// to a process using COIBufferAddRef the call to COIBufferWrite will not @@ -817,19 +873,22 @@ COIBufferGetSinkAddress( /// This is to facilitate a usage model where a buffer is being used outside /// of a run function, for example in a spawned thread, but data still needs /// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. /// /// @param in_DestBuffer /// [in] Buffer to write into. /// -#ifdef COI_PROTOTYPE_TARGET_PROCESS /// @param in_DestProcess -/// [in] A pointer to the processes which are used as hints -/// to to COI. Buffers are updated upon these processes first. +/// [in] A pointer to the process to which the data will be written. +/// Buffer is updated only in this process and invalidated in other +/// processes. Only a single process can be specified. /// Can be left NULL and default behavior will be chosen, which -/// chooses the lowest SCIF node with an active regions first. Others -/// buffer regions are invalidated in both cases. Will only update a single -/// process at this time. -#endif +/// chooses the first valid process in which regions are found. Other +/// buffer regions are invalidated if not updated. /// /// @param in_Offset /// [in] Location in the buffer to start writing to. @@ -869,7 +928,7 @@ COIBufferGetSinkAddress( /// synchronous and will block until the transfer is complete. /// /// -/// @return COI_SUCCESS if the buffer was copied successfully. +/// @return COI_SUCCESS if the buffer was written successfully. /// /// @return COI_INVALID_HANDLE if the buffer handle was invalid. /// @@ -881,9 +940,6 @@ COIBufferGetSinkAddress( /// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but /// in_NumDependencies is not 0. /// -/// @return COI_NOT_SUPPORTED if the source buffer is of type -/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE. -/// /// @return COI_INVALID_POINTER if the in_pSourceData pointer is NULL. /// /// @return COI_OUT_OF_RANGE if in_Offset + in_Length exceeds the size of @@ -894,10 +950,9 @@ COIBufferGetSinkAddress( /// @return COI_RETRY if in_DestBuffer is mapped and is not a COI_BUFFER_PINNED /// buffer or COI_BUFFER_OPENCL buffer. /// -#ifdef COI_PROTOTYPE_TARGET_PROCESS COIACCESSAPI COIRESULT -COIBufferWrite( +COIBufferWriteEx( COIBUFFER in_DestBuffer, const COIPROCESS in_DestProcess, uint64_t in_Offset, @@ -907,8 +962,299 @@ COIBufferWrite( uint32_t in_NumDependencies, const COIEVENT* in_pDependencies, COIEVENT* out_pCompletion); -__asm__(".symver COIBufferWrite,COIBufferWrite@COI_2.0"); -#else + +////////////////////////////////////////////////////////////////////////////// +/// +/// Copy data specified by multi-dimensional array data structure into another +/// multi-dimensional array in an existing COIBUFFER. +/// Arrays with more than 3 dimensions are not supported. +/// Different numbers of elements between src and destination is not supported. +/// Please note that COIBufferWriteMultiD does not follow implicit buffer +/// dependencies. If a buffer is in use in a run function or has been added +/// to a process using COIBufferAddRef the call to COIBufferWriteMultiD will not +/// wait, it will still copy data immediately. +/// This is to facilitate a usage model where a buffer is being used outside +/// of a run function, for example in a spawned thread, but data still needs +/// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. +/// +/// +/// @param in_DestBuffer +/// [in] Buffer to write into. +/// +/// @param in_DestProcess +/// [in] A pointer to the process to which the data will be written. +/// Buffer is updated only in this process and invalidated in other +/// processes. Only a single process can be specified. +/// Can be left NULL and default behavior will be chosen, which +/// chooses the first valid process in which regions are found. Other +/// buffer regions are invalidated if not updated. +/// +/// @param in_Offset +/// [in] Start location of the destination array within the buffer. +/// +/// @param in_DestArray +/// [in] A pointer to a data structure describing the structure of +/// the data array in the buffer. Total size must not be larger than +/// the size of in_DestBuffer. The base field of this structure will +/// be ignored. +/// +/// @param in_SrcArray +/// [in] A pointer to a data structure describing the structure of +/// the data array in local memory that should be copied. in_SrcArray +/// and in_DestArry must have the same number of elements. The base +/// field of this structure should be the virtual pointer to the local +/// memory in which this array is located. +/// +/// @param in_Type +/// [in] The type of copy operation to use, one of either +/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU. +/// +/// @param in_NumDependencies +/// [in] The number of dependencies specified in the in_pDependencies +/// array. This may be 0 if the caller does not want the write call to +/// wait for any additional events to be signaled before starting the +/// write operation. +/// +/// @param in_pDependencies +/// [in] An optional array of handles to previously created COIEVENT +/// objects that this write operation will wait for before starting. +/// This allows the user to create dependencies between buffer write +/// calls and other operations such as run functions and map calls. The +/// user may pass in NULL if they do not wish to wait for any +/// additional dependencies to complete before doing the write. +/// +/// @param out_pCompletion +/// [out] An optional event to be signaled when the write has +/// completed. This event can be used as a dependency to order +/// the write with regard to future operations. +/// If no completion event is passed in then the write is +/// synchronous and will block until the transfer is complete. +/// +/// +/// @return COI_SUCCESS if the buffer was copied successfully. +/// +/// @return COI_INVALID_HANDLE if the buffer or process handle was invalid. +/// +/// @return COI_OUT_OF_RANGE if in_Offset is beyond the end of the buffer. +/// +/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but +/// in_NumDependencies is 0. +/// +/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but +/// in_NumDependencies is not 0. +/// +/// @return COI_NOT_SUPPORTED or dimension of destination or source arrays +/// are greater than 3 or less than 1 +/// +/// @return COI_INVALID_POINTER if the pointer in_SrcArray->base is NULL. +/// +/// @return COI_OUT_OF_RANGE if in_Offset + size of in_DestArray exceeds the +/// size of the buffer. +/// +/// @return COI_OUT_OF_MEMORY if any allocation of memory fails +/// +/// @return COI_RETRY if in_DestBuffer is mapped and is not a COI_BUFFER_PINNED +/// buffer or COI_BUFFER_OPENCL buffer. +/// +COIACCESSAPI +COIRESULT +COIBufferWriteMultiD( + COIBUFFER in_DestBuffer, + const COIPROCESS in_DestProcess, + uint64_t in_Offset, + struct arr_desc* in_DestArray, + struct arr_desc* in_SrcArray, + COI_COPY_TYPE in_Type, + uint32_t in_NumDependencies, + const COIEVENT* in_pDependencies, + COIEVENT* out_pCompletion); + +////////////////////////////////////////////////////////////////////////////// +/// +/// Copy data specified by multi-dimensional array data structure from an +/// existing COIBUFFER to another multi-dimensional array located in memory. +/// Arrays with more than 3 dimensions are not supported. +/// Different numbers of elements between source and destination are not supported. +/// Please note that COIBufferReadMultiD does not follow implicit buffer +/// dependencies. If a buffer is in use in a run function or has been added +/// to a process using COIBufferAddRef the call to COIBufferReadMultiD will not +/// wait, it will still copy data immediately. +/// This is to facilitate a usage model where a buffer is being used outside +/// of a run function, for example in a spawned thread, but data still needs +/// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. +/// +/// +/// @param in_SourceBuffer +/// [in] Buffer to read from. +/// +/// @param in_Offset +/// [in] Start location of the source array within the buffer. +/// +/// @param in_DestArray +/// [in] A pointer to a data structure describing the structure of +/// the data array in the buffer. Total size must not be larger than +/// the size of in_DestBuffer. The base field of this structure will +/// be ignored. +/// +/// @param in_SrcArray +/// [in] A pointer to a data structure describing the structure of +/// the data array in local memory that should be copied. in_SrcArray +/// and in_DestArry must have the same number of elements. The base +/// field of this structure should be the virtual pointer to the local +/// memory in which this array is located. +/// +/// @param in_Type +/// [in] The type of copy operation to use, one of either +/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU. +/// +/// @param in_NumDependencies +/// [in] The number of dependencies specified in the in_pDependencies +/// array. This may be 0 if the caller does not want the write call to +/// wait for any additional events to be signaled before starting the +/// write operation. +/// +/// @param in_pDependencies +/// [in] An optional array of handles to previously created COIEVENT +/// objects that this write operation will wait for before starting. +/// This allows the user to create dependencies between buffer write +/// calls and other operations such as run functions and map calls. The +/// user may pass in NULL if they do not wish to wait for any +/// additional dependencies to complete before doing the write. +/// +/// @param out_pCompletion +/// [out] An optional event to be signaled when the write has +/// completed. This event can be used as a dependency to order +/// the write with regard to future operations. +/// If no completion event is passed in then the write is +/// synchronous and will block until the transfer is complete. +/// +/// +/// @return COI_SUCCESS if the buffer was written successfully. +/// +/// @return COI_INVALID_HANDLE if the buffer or process handle was invalid. +/// +/// @return COI_OUT_OF_RANGE if in_Offset is beyond the end of the buffer. +/// +/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but +/// in_NumDependencies is 0. +/// +/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but +/// in_NumDependencies is not 0. +/// +/// @return COI_NOT_SUPPORTED or dimension of destination or source arrays +/// are greater than 3 or less than 1 +/// +/// @return COI_INVALID_POINTER if the pointer in_DestArray->base is NULL. +/// +/// @return COI_OUT_OF_RANGE if in_Offset + size of in_SourceArray exceeds the +/// size of the buffer. +/// +/// @return COI_OUT_OF_MEMORY if any allocation of memory fails +/// +/// @return COI_RETRY if in_SourceBuffer is mapped and is not a COI_BUFFER_PINNED +/// buffer or COI_BUFFER_OPENCL buffer. +/// +COIACCESSAPI +COIRESULT +COIBufferReadMultiD( + COIBUFFER in_SourceBuffer, + uint64_t in_Offset, + struct arr_desc* in_DestArray, + struct arr_desc* in_SrcArray, + COI_COPY_TYPE in_Type, + uint32_t in_NumDependencies, + const COIEVENT* in_pDependencies, + COIEVENT* out_pCompletion); + +////////////////////////////////////////////////////////////////////////////// +/// +/// Copy data from a normal virtual address into an existing COIBUFFER. +/// Please note that COIBufferWrite does not follow implicit buffer +/// dependencies. If a buffer is in use in a run function or has been added +/// to a process using COIBufferAddRef the call to COIBufferWrite will not +/// wait, it will still copy data immediately. +/// This is to facilitate a usage model where a buffer is being used outside +/// of a run function, for example in a spawned thread, but data still needs +/// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. +/// +/// @param in_DestBuffer +/// [in] Buffer to write into. +/// +/// @param in_Offset +/// [in] Location in the buffer to start writing to. +/// +/// @param in_pSourceData +/// [in] A pointer to local memory that should be copied into the +/// provided buffer. +/// +/// @param in_Length +/// [in] The number of bytes to write from in_pSourceData into +/// in_DestBuffer. Must not be larger than the size of in_DestBuffer +/// and must not over run in_DestBuffer if an in_Offset is provided. +/// +/// @param in_Type +/// [in] The type of copy operation to use, one of either +/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU. +/// +/// @param in_NumDependencies +/// [in] The number of dependencies specified in the in_pDependencies +/// array. This may be 0 if the caller does not want the write call to +/// wait for any additional events to be signaled before starting the +/// write operation. +/// +/// @param in_pDependencies +/// [in] An optional array of handles to previously created COIEVENT +/// objects that this write operation will wait for before starting. +/// This allows the user to create dependencies between buffer write +/// calls and other operations such as run functions and map calls. The +/// user may pass in NULL if they do not wish to wait for any +/// additional dependencies to complete before doing the write. +/// +/// @param out_pCompletion +/// [out] An optional event to be signaled when the write has +/// completed. This event can be used as a dependency to order +/// the write with regard to future operations. +/// If no completion event is passed in then the write is +/// synchronous and will block until the transfer is complete. +/// +/// +/// @return COI_SUCCESS if the buffer was copied successfully. +/// +/// @return COI_INVALID_HANDLE if the buffer handle was invalid. +/// +/// @return COI_OUT_OF_RANGE if in_Offset is beyond the end of the buffer. +/// +/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but +/// in_NumDependencies is 0. +/// +/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but +/// in_NumDependencies is not 0. +/// +/// @return COI_INVALID_POINTER if the in_pSourceData pointer is NULL. +/// +/// @return COI_OUT_OF_RANGE if in_Offset + in_Length exceeds the size of +/// the buffer. +/// +/// @return COI_OUT_OF_RANGE if in_Length is 0. +/// +/// @return COI_RETRY if in_DestBuffer is mapped and is not a COI_BUFFER_PINNED +/// buffer or COI_BUFFER_OPENCL buffer. +/// COIACCESSAPI COIRESULT COIBufferWrite( @@ -920,14 +1266,10 @@ COIBufferWrite( uint32_t in_NumDependencies, const COIEVENT* in_pDependencies, COIEVENT* out_pCompletion); -__asm__(".symver COIBufferWrite,COIBufferWrite@COI_1.0"); -#endif ////////////////////////////////////////////////////////////////////////////// /// /// Copy data from a buffer into local memory. -/// Note that it is not possible to use this API with any type of -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers. /// Please note that COIBufferRead does not follow implicit buffer /// dependencies. If a buffer is in use in a run function or has been added /// to a process using COIBufferAddRef the call to COIBufferRead will not @@ -935,6 +1277,11 @@ __asm__(".symver COIBufferWrite,COIBufferWrite@COI_1.0"); /// This is to facilitate a usage model where a buffer is being used outside /// of a run function, for example in a spawned thread, but data still needs /// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. /// /// /// @param in_SourceBuffer @@ -989,9 +1336,6 @@ __asm__(".symver COIBufferWrite,COIBufferWrite@COI_1.0"); /// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but /// in_NumDependencies is not 0. /// -/// @return COI_NOT_SUPPORTED if the source buffer is of type -/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE. -/// /// @return COI_OUT_OF_RANGE if in_Offset + in_Length exceeds the size of /// the buffer. /// @@ -1019,8 +1363,6 @@ COIBufferRead( /// Copy data between two buffers. It also allows copying within the same /// buffer. For copy within the same buffer, if source and destination regions /// overlap then this API returns error. -/// Note that it is not possible to use this API with any type of -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Streaming Buffers. /// Please note that COIBufferCopy does not follow implicit buffer /// dependencies. If a buffer is in use in a run function or has been added /// to a process using COIBufferAddRef the call to COIBufferCopy will not @@ -1028,18 +1370,22 @@ COIBufferRead( /// This is to facilitate a usage model where a buffer is being used outside /// of a run function, for example in a spawned thread, but data still needs /// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. /// /// @param in_DestBuffer /// [in] Buffer to copy into. -#ifdef COI_PROTOTYPE_TARGET_PROCESS +/// /// @param in_DestProcess -/// [in] A pointer to the processes which are used as hints -/// to to COI. Buffers are updated upon these processes first. +/// [in] A pointer to the process to which the data will be written. +/// Buffer is updated only in this process and invalidated in other +/// processes. Only a single process can be specified. /// Can be left NULL and default behavior will be chosen, which -/// chooses the lowest SCIF node with an active regions first. Others -/// buffer regions are invalidated in both cases. Will only update a single -/// process at this time. -#endif +/// chooses the first valid process in which regions are found. Other +/// buffer regions are invalidated if not updated. /// /// @param in_SourceBuffer /// [in] Buffer to copy from. @@ -1089,7 +1435,7 @@ COIBufferRead( /// @return COI_INVALID_HANDLE if either buffer handle was invalid. /// /// @return COI_MEMORY_OVERLAP if in_SourceBuffer and in_DestBuffer are the -/// same buffer(or have the same parent buffer) and the source and +/// same buffer(or have the same parent buffer) and the source and /// destination regions overlap /// /// @return COI_OUT_OF_RANGE if in_DestOffset is is beyond the end of @@ -1110,19 +1456,12 @@ COIBufferRead( /// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but /// in_NumDependencies is not 0. /// -/// @return COI_NOT_SUPPORTED if the source or destination buffers are of type -/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE. -/// -/// @return COI_NOT_SUPPORTED if either buffer is of type -/// COI_BUFFER_STREAMING_TO_SINK or COI_BUFFER_STREAMING_TO_SOURCE. -/// /// @return COI_RETRY if in_DestBuffer or in_SourceBuffer are mapped and not /// COI_BUFFER_PINNED buffers or COI_BUFFER_OPENCL buffers. /// -#ifdef COI_PROTOTYPE_TARGET_PROCESS COIACCESSAPI COIRESULT -COIBufferCopy( +COIBufferCopyEx( COIBUFFER in_DestBuffer, const COIPROCESS in_DestProcess, COIBUFFER in_SourceBuffer, @@ -1133,8 +1472,100 @@ COIBufferCopy( uint32_t in_NumDependencies, const COIEVENT* in_pDependencies, COIEVENT* out_pCompletion); -__asm__(".symver COIBufferCopy,COIBufferCopy@COI_2.0"); -#else + +////////////////////////////////////////////////////////////////////////////// +/// +/// Copy data between two buffers. It also allows copying within the same +/// buffer. For copy within the same buffer, if source and destination regions +/// overlap then this API returns error. +/// Please note that COIBufferCopy does not follow implicit buffer +/// dependencies. If a buffer is in use in a run function or has been added +/// to a process using COIBufferAddRef the call to COIBufferCopy will not +/// wait, it will still copy data immediately. +/// This is to facilitate a usage model where a buffer is being used outside +/// of a run function, for example in a spawned thread, but data still needs +/// to be transferred to or from the buffer. +/// Additionally this means that if more than one DMA channel is enabled, +/// (See COIProcessConfigureDMA) operations to the same buffer may +/// happen in parallel if they can be assigned to different DMA hardware. +/// So it is highly recommended to use explicit event dependencies to +/// order operations where needed. +/// +/// @param in_DestBuffer +/// [in] Buffer to copy into. +/// +/// @param in_SourceBuffer +/// [in] Buffer to copy from. +/// +/// @param in_DestOffset +/// [in] Location in the destination buffer to start writing to. +/// +/// @param in_SourceOffset +/// [in] Location in the source buffer to start reading from. +/// +/// @param in_Length +/// [in] The number of bytes to copy from in_SourceBuffer into +/// in_DestinationBuffer. +/// If the length is specified as zero then length to be copied +/// is entire destination buffer's length. +/// Must not be larger than the size of in_SourceBuffer or +/// in_DestBuffer and must not over run in_SourceBuffer or +/// in_DestBuffer if offsets are specified. +/// +/// @param in_Type +/// [in] The type of copy operation to use, one of either +/// COI_COPY_UNSPECIFIED, COI_COPY_USE_DMA, COI_COPY_USE_CPU. +/// +/// @param in_NumDependencies +/// [in] The number of dependencies specified in the in_pDependencies +/// array. This may be 0 if the caller does not want the copy call to +/// wait for any additional events to be signaled before starting the +/// copy operation. +/// +/// @param in_pDependencies +/// [in] An optional array of handles to previously created COIEVENT +/// objects that this copy operation will wait for before starting. +/// This allows the user to create dependencies between buffer copy +/// calls and other operations such as run functions and map calls. The +/// user may pass in NULL if they do not wish to wait for any +/// additional dependencies to complete before doing the copy. +/// +/// @param out_pCompletion +/// [out] An optional event to be signaled when the copy has +/// completed. This event can be used as a dependency to order +/// the copy with regard to future operations. +/// If no completion event is passed in then the copy is +/// synchronous and will block until the transfer is complete. +/// +/// @return COI_SUCCESS if the buffer was copied successfully. +/// +/// @return COI_INVALID_HANDLE if either buffer handle was invalid. +/// +/// @return COI_MEMORY_OVERLAP if in_SourceBuffer and in_DestBuffer are the +/// same buffer(or have the same parent buffer) and the source and +/// destination regions overlap +/// +/// @return COI_OUT_OF_RANGE if in_DestOffset is is beyond the end of +/// in_DestBuffer +/// +/// @return COI_OUT_OF_RANGE if in_SourceOffset is beyond the end of +/// in_SourceBuffer. +/// +/// @return COI_OUT_OF_RANGE if in_DestOffset + in_Length exceeds the size of +/// the in_DestBuffer +/// +/// @return COI_OUT_OF_RANGE if in_SourceOffset + in_Length exceeds +/// the size of in_SourceBuffer. +/// +/// @return COI_ARGUMENT_MISMATCH if the in_pDependencies is non NULL but +/// in_NumDependencies is 0. +/// +/// @return COI_ARGUMENT_MISMATCH if in_pDependencies is NULL but +/// in_NumDependencies is not 0. +/// +/// @return COI_RETRY if in_DestBuffer or in_SourceBuffer are mapped and not +/// COI_BUFFER_PINNED buffers or COI_BUFFER_OPENCL buffers. +/// COIACCESSAPI COIRESULT COIBufferCopy( @@ -1147,21 +1578,20 @@ COIBufferCopy( uint32_t in_NumDependencies, const COIEVENT* in_pDependencies, COIEVENT* out_pCompletion); -__asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0"); -#endif + ////////////////////////////////////////////////////////////////////////////// /// -/// This API allows an experienced Intel® Coprocessor Offload Infrastructure -/// (Intel® COI) developer to set where a COIBUFFER is +/// This API allows an experienced Intel(R) Coprocessor Offload Infrastructure +/// (Intel(R) COI) developer to set where a COIBUFFER is /// located and when the COIBUFFER's data is moved. This functionality is /// useful when the developer knows when and where a buffer is going to be /// accessed. It allows the data movement to happen sooner than if the -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// runtime tried to manage the buffer placement itself. The advantage of /// this API is that the developer knows much more about their own /// application's data access patterns and can therefore optimize the data -/// access to be much more efficient than the Intel® Coprocessor Offload -/// Infrastructure (Intel® COI) runtime. Using this API may yield better +/// access to be much more efficient than the Intel(R)Coprocessor Offload +/// Infrastructure (Intel(R) COI) runtime. Using this API may yield better /// memory utilization, lower latency and overall improved workload /// throughput. /// This API does respect implicit dependencies for buffer read/write hazards. @@ -1169,17 +1599,17 @@ __asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0"); /// requests the buffer be placed in another COIPROCESS then this API will wait /// for the first access to complete before moving the buffer. /// This API is not required for program correctness. It is intended solely -/// for advanced Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// for advanced Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// developers who wish to fine tune their application performance /// Cases where "a change in state" is an error condition the change just gets -/// ignored without any error. This is because the SetState can be a +/// ignored without any error. This is because the SetState can be a /// nonblocking call and in such cases we can't rely on the state of the buffer /// at the time of the call. We can do the transition checks only at the time /// when the actual state change happens (which is something in future). /// Currently there is no way to report an error from something that happens in /// future and that is why such state transitions are nop. One example is using -/// VALID_MAY_DROP with COI_SINK_OWNERS when buffer is not valid at source. -/// This operation will be a nop if at the time of actual state change the +/// VALID_MAY_DROP with COI_SINK_OWNERS when buffer is not valid at source. +/// This operation will be a nop if at the time of actual state change the /// buffer is not valid at source. /// /// @param in_Buffer @@ -1188,7 +1618,7 @@ __asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0"); /// @param in_Process /// [in] The process where the state is being modified for this /// buffer. To modify buffer's state on source process use -/// COI_PROCESS_SOURCE as process handle. To modify buffer's +/// COI_PROCESS_SOURCE as process handle. To modify buffer's /// state on all processes where buffer is valid use COI_SINK_OWNERS /// as the process handle. /// @@ -1222,7 +1652,7 @@ __asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0"); /// [out] An optional event to be signaled when the SetState has /// completed. This event can be used as a dependency to order /// the SetState with regard to future operations. -/// If no completion event is passed in then the is +/// If no completion event is passed in then the state changing is /// synchronous and will block until the SetState and dma transfers /// related to this operation are complete. /// @@ -1239,10 +1669,9 @@ __asm__(".symver COIBufferCopy,COIBufferCopy@COI_1.0"); /// @return COI_ARGUMENT_MISMATCH if the in_Process is COI_SINK_OWNERS and the /// COI_BUFFER_MOVE is passed as move flag. /// -/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process +/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process /// handle that was passed in. /// - COIACCESSAPI COIRESULT COIBufferSetState( @@ -1257,9 +1686,9 @@ COIBufferSetState( ////////////////////////////////////////////////////////////////////////////// /// /// Creates a sub-buffer that is a reference to a portion of an existing -/// buffer. The returned buffer handle can be used in all API calls that the +/// buffer. The returned buffer handle can be used in all API calls that the /// original buffer handle could be used in except COIBufferCreateSubBuffer. -/// Sub buffers out of Huge Page Buffer are also supported but the original +/// Sub buffers out of Huge Page Buffer are also supported but the original /// buffer needs to be a OPENCL buffer created with COI_OPTIMIZE_HUGE_PAGE_SIZE /// flag. /// @@ -1279,7 +1708,7 @@ COIBufferSetState( /// @param out_pSubBuffer /// [out] Pointer to a buffer handle that is filled in with the newly /// created sub-buffer. -/// +/// /// @return COI_SUCCESS if the sub-buffer was created /// /// @return COI_INVALID_HANDLE if in_Buffer is not a valid buffer handle. @@ -1302,6 +1731,79 @@ COIBufferCreateSubBuffer( uint64_t in_Offset, COIBUFFER* out_pSubBuffer); +////////////////////////////////////////////////////////////////////////////// +/// +/// Releases the reference count on the specified buffer and process by +/// in_ReleaseRefcnt. The returned result being COI_SUCCESS indicates that the +/// specified process contains a reference to the specified buffer that has a +/// refcnt that can be decremented. Otherwise, if the buffer or process +/// specified do not exist, then COI_INVALID_HANDLE will be returned. If the +/// process does not contain a reference to the specified buffer then +/// COI_OUT_OF_RANGE will be returned. +/// +/// +/// @param in_Process +/// [in] The COI Process whose reference count for the specified buffer +/// the user wants to decrement. +/// +/// @param in_Buffer +/// [in] The buffer used in the specified coi process in which the user +/// wants to decrement the reference count. +/// +/// @param in_ReleaseRefcnt +/// [in] The value the reference count will be decremented by. +/// +/// @return COI_SUCCESS if the reference count was successfully decremented. +/// +/// @return COI_INVALID_HANDLE if in_Buffer or in_Process are invalid handles. +/// +/// @return COI_OUT_OF_RANGE if the reference for the specified buffer or +/// process does not exist. +/// + +COIACCESSAPI +COIRESULT +COIBufferReleaseRefcnt( + COIPROCESS in_Process, + COIBUFFER in_Buffer, + uint64_t in_ReleaseRefcnt); + +////////////////////////////////////////////////////////////////////////////// +/// +/// Increments the reference count on the specified buffer and process by +/// in_AddRefcnt. The returned result being COI_SUCCESS indicates that the +/// specified process contains a reference to the specified buffer or a new +/// reference has been created and that reference has a new refcnt. Otherwise, +/// if the buffer or process specified do not exist, then COI_INVALID_HANDLE +/// will be returned. If the input buffer is not valid on the target process +/// then COI_NOT_INITIALIZED will be returned since the buffer is not current +/// or allocated on the process. +/// +/// @param in_Process +/// [in] The COI Process whose reference count for the specified buffer +/// the user wants to increment. +/// +/// @param in_Buffer +/// [in] The buffer used in the specified coi process in which the user +/// wants to increment the reference count. +/// +/// @param in_AddRefcnt +/// [in] The value the reference count will be incremented by. +/// +/// @return COI_SUCCESS if the reference count was successfully incremented. +/// +/// @return COI_INVALID_HANDLE if in_Buffer or in_Process are invalid handles. +/// +/// @return COI_NOT_INITIALIZED if in_Buffer does not have a buffer state of +/// COI_BUFFER_VALID on the in_Process. +/// +COIACCESSAPI +COIRESULT +COIBufferAddRefcnt( + COIPROCESS in_Process, + COIBUFFER in_Buffer, + uint64_t in_AddRefcnt); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/liboffloadmic/include/coi/source/COIEngine_source.h b/liboffloadmic/include/coi/source/COIEngine_source.h index 19a63e43409..a3b7799cfb5 100644 --- a/liboffloadmic/include/coi/source/COIEngine_source.h +++ b/liboffloadmic/include/coi/source/COIEngine_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -75,7 +75,7 @@ typedef enum /////////////////////////////////////////////////////////////////////////////// -/// This structure returns information about an Intel(r) Xeon Phi(tm) +/// This structure returns information about an Intel(R) Xeon Phi(TM) /// coprocessor. /// A pointer to this structure is passed into the COIGetEngineInfo() function, /// which fills in the data before returning to the caller. @@ -101,6 +101,7 @@ typedef struct COI_ENGINE_INFO uint32_t CoreMaxFrequency; /// The load percentage for each of the hardware threads on the engine. + /// Currently this is limited to reporting out a maximum of 1024 HW threads uint32_t Load[COI_MAX_HW_THREADS]; /// The amount of physical memory managed by the OS. @@ -133,9 +134,9 @@ typedef struct COI_ENGINE_INFO /////////////////////////////////////////////////////////////////////////////// /// -/// Returns information related to a specified engine. Note that if Intel® Coprocessor Offload Infrastructure (Intel® COI) is -/// unable to query a value it will be returned as zero but the call will -/// still succeed. +/// Returns information related to a specified engine. Note that if Intel(R) +/// Coprocessor Offload Infrastructure (Intel(R) COI) is unable to query +/// a value it will be returned as zero but the call will still succeed. /// /// /// @param in_EngineHandle @@ -173,14 +174,15 @@ COIEngineGetInfo( /// /// Returns the number of engines in the system that match the provided ISA. /// -/// Note that while it is possible to enumerate different types of Intel(r) -/// Xeon Phi(tm) coprocessors on a single host this is not currently -/// supported. Intel® Coprocessor Offload Infrastructure (Intel® COI) makes an assumption that all Intel(r) Xeon Phi(tm) -/// coprocessors found in the system are the same architecture as the first -/// coprocessor device. +/// Note that while it is possible to enumerate different types of Intel(R) +/// Xeon Phi(TM) coprocessors on a single host this is not currently +/// supported. Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) +/// makes an assumption that all Intel(R) Xeon Phi(TM) coprocessors found +/// in the system are the same architecture as the first coprocessor device. /// -/// Also, note that this function returns the number of engines that Intel® Coprocessor Offload Infrastructure (Intel® COI) -/// is able to detect. Not all of them may be online. +/// Also, note that this function returns the number of engines that Intel(R) +/// Coprocessor Offload Infrastructure (Intel(R) COI) is able to detect. Not +/// all of them may be online. /// /// @param in_ISA /// [in] Specifies the ISA type of the engine requested. @@ -211,7 +213,7 @@ COIEngineGetCount( /// /// @param in_EngineIndex /// [in] A unsigned integer which specifies the zero-based position of -/// the engine in a collection of engines. The makeup of this +/// the engine in a collection of engines. The makeup of this /// collection is defined by the in_ISA parameter. /// /// @param out_pEngineHandle @@ -226,7 +228,8 @@ COIEngineGetCount( /// /// @return COI_INVALID_POINTER if the out_pEngineHandle parameter is NULL. /// -/// @return COI_VERSION_MISMATCH if the version of Intel® Coprocessor Offload Infrastructure (Intel® COI) on the host is not +/// @return COI_VERSION_MISMATCH if the version of Intel(R) Coprocessor Offload +/// Infrastructure (Intel(R) COI) on the host is not /// compatible with the version on the device. /// /// @return COI_NOT_INITIALIZED if the engine requested exists but is offline. diff --git a/liboffloadmic/include/coi/source/COIEvent_source.h b/liboffloadmic/include/coi/source/COIEvent_source.h index 99fa00d6a27..ecb00fafe2d 100644 --- a/liboffloadmic/include/coi/source/COIEvent_source.h +++ b/liboffloadmic/include/coi/source/COIEvent_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -59,12 +59,10 @@ extern "C" { /// /// Special case event values which can be passed in to APIs to specify /// how the API should behave. In COIBuffer APIs passing in NULL for the -/// completion event is the equivalent of passing COI_EVENT_SYNC. For -/// COIPipelineRunFunction passing in NULL is the equivalent of -/// COI_EVENT_ASYNC. +/// completion event is the equivalent of passing COI_EVENT_SYNC. /// Note that passing COI_EVENT_ASYNC can be used when the caller wishes the /// operation to be performed asynchronously but does not care when the -/// operation completes. This can be useful for opertions that by definition +/// operation completes. This can be useful for operations that by definition /// must complete in order (DMAs, run functions on a single pipeline). If /// the caller does care when the operation completes then they should pass /// in a valid completion event which they can later wait on. @@ -72,6 +70,16 @@ extern "C" { #define COI_EVENT_ASYNC ((COIEVENT*)1) #define COI_EVENT_SYNC ((COIEVENT*)2) +////////////////////////////////////////////////////////////////////////////// +/// +/// This can be used to initialize a COIEVENT to a known invalid state. +/// This is not required to use, but can be useful in some cases +/// if a program is unsure if the event will be initialized by the runtime. +/// Simply set the event to this value: COIEVENT event = COI_EVENT_INITIALIZER; +/// +#define COI_EVENT_INITIALIZER { { 0, -1 } } + + /////////////////////////////////////////////////////////////////////////////// /// /// Wait for an arbitrary number of COIEVENTs to be signaled as completed, @@ -94,17 +102,17 @@ extern "C" { /// and returns immediately, -1 blocks indefinitely. /// /// @param in_WaitForAll -/// [in] Boolean value specifying behavior. If true, wait for all +/// [in] Boolean value specifying behavior. If true, wait for all /// events to be signaled, or for timeout, whichever happens first. /// If false, return when any event is signaled, or at timeout. /// /// @param out_pNumSignaled -/// [out] The number of events that were signaled. If in_NumEvents +/// [out] The number of events that were signaled. If in_NumEvents /// is 1 or in_WaitForAll = True, this parameter is optional. /// /// @param out_pSignaledIndices -/// [out] Pointer to an array of indicies into the original event -/// array. Those denoted have been signaled. The user must provide an +/// [out] Pointer to an array of indices into the original event +/// array. Those denoted have been signaled. The user must provide an /// array that is no smaller than the in_Events array. If in_NumEvents /// is 1 or in_WaitForAll = True, this parameter is optional. /// @@ -132,6 +140,10 @@ extern "C" { /// @return COI_PROCESS_DIED if the remote process died. See COIProcessDestroy /// for more details. /// +/// @return COI_<REAL ERROR> if only a single event is passed in, and that event +/// failed, COI will attempt to return the real error code that caused +/// the original operation to fail, otherwise COI_PROCESS_DIED is reported. +/// COIACCESSAPI COIRESULT COIEventWait( @@ -183,6 +195,103 @@ COIRESULT COIEventUnregisterUserEvent( COIEVENT in_Event); + +////////////////////////////////////////////////////////////////////////////// +/// +/// A callback that will be invoked to notify the user of an internal +/// runtime event completion. +/// +/// As with any callback mechanism it is up to the user to make sure that +/// there are no possible deadlocks due to reentrancy (ie the callback being +/// invoked in the same context that triggered the notification) and also +/// that the callback does not slow down overall processing. If the user +/// performs too much work within the callback it could delay further +/// processing. The callback will be invoked prior to the signaling of +/// the corresponding COIEvent. For example, if a user is waiting +/// for a COIEvent associated with a run function completing they will +/// receive the callback before the COIEvent is marked as signaled. +/// +/// @param in_Event +/// [in] The completion event that is associated with the +/// operation that is being notified. +/// +/// @param in_Result +/// [in] The COIRESULT of the operation. +/// +/// @param in_UserData +/// [in] Opaque data that was provided when the callback was +/// registered. Intel(R) Coprocessor Offload Infrastructure +/// (Intel(R) COI) simply passes this back to the user so that +/// they can interpret it as they choose. +/// +typedef void (*COI_EVENT_CALLBACK)( + COIEVENT in_Event, + const COIRESULT in_Result, + const void* in_UserData); + + + +////////////////////////////////////////////////////////////////////////////// +/// +/// Registers any COIEVENT to receive a one time callback, when the event +/// is marked complete in the offload runtime. If the event has completed +/// before the COIEventRegisterCallback() is called then the callback will +/// immediately be invoked by the calling thread. When the event is +/// registered before the event completes, the runtime gaurantees that +/// the callback will be invoked before COIEventWait() is notified of +/// the same event completing. In well written user code, this may provide +/// a slight performance advantage. +/// +/// Users should treat the callback much like an interrupt routine, in regards +/// of performance. Specifically designing the callback to be as short and +/// non blocking as possible. Since the thread that runs the callback is +/// non deterministic blocking or stalling of the callback, may have severe +/// performance impacts on the offload runtime. Thus, it is important to not +/// create deadlocks between the callback and other signaling/waiting +/// mechanisms. It is recommended to never invoke COIEventWait() inside +/// a callback function, as this could lead to immediate deadlocks. +/// +/// It is important to note that the runtime cannot distinguish between +/// already triggered events and invalid events. Thus the user needs to pass +/// in a valid event, or the callback will be invoked immediately. +/// Failed events will still receive a callback and the user can query +/// COIEventWait() after the callback for the failed return code. +/// +/// If more than one callback is registered for the same event, only the +/// single most current callback will be used, i.e. the older one will +/// be replaced. +/// +/// @param in_Event +/// [in] A valid single event handle to be registered to receive a callback. +/// +/// @param in_Callback +/// [in] Pointer to a user function used to signal an +/// event completion. +/// +/// @param in_UserData +/// [in] Opaque data to pass to the callback when it is invoked. +/// +/// @param in_Flags +/// [in] Reserved parameter for future expansion, required to be zero for now. +/// +/// @return COI_INVALID_HANDLE if in_Event is not a valid COIEVENT +/// +/// @return COI_INVALID_HANDLE if in_Callback is not a valid pointer. +/// +/// @return COI_ARGUMENT_MISMATCH if the in_Flags is not zero. +/// +/// @return COI_SUCCESS an event is successfully registered +/// +COIACCESSAPI +COIRESULT +COIEventRegisterCallback( + const COIEVENT in_Event, + COI_EVENT_CALLBACK in_Callback, + const void* in_UserData, + const uint64_t in_Flags); + + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/liboffloadmic/include/coi/source/COIPipeline_source.h b/liboffloadmic/include/coi/source/COIPipeline_source.h index d210a1f5025..78c49ec2e09 100644 --- a/liboffloadmic/include/coi/source/COIPipeline_source.h +++ b/liboffloadmic/include/coi/source/COIPipeline_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -59,12 +59,13 @@ extern "C" { ////////////////////////////////////////////////////////////////////////////// -/// These flags specify how a buffer will be used within a run function. They -/// allow Intel® Coprocessor Offload Infrastructure (Intel® COI) to make optimizations in how it moves data around the system. +/// These flags specify how a buffer will be used within a run function. They +/// allow the runtime to make optimizations in how it moves the data around. /// These flags can affect the correctness of an application, so they must be -/// set properly. For example, if a buffer is used in a run function with the -/// COI_SINK_READ flag and then mapped on the source, Intel® Coprocessor Offload Infrastructure (Intel® COI) may use a previously -/// cached version of the buffer instead of retrieving data from the sink. +/// set properly. For example, if a buffer is used in a run function with the +/// COI_SINK_READ flag and then mapped on the source, the runtime may use a +/// previously cached version of the buffer instead of retrieving data from +/// the sink. typedef enum COI_ACCESS_FLAGS { /// Specifies that the run function will only read the associated buffer. @@ -76,7 +77,23 @@ typedef enum COI_ACCESS_FLAGS /// Specifies that the run function will overwrite the entire associated /// buffer and therefore the buffer will not be synchronized with the /// source before execution. - COI_SINK_WRITE_ENTIRE + COI_SINK_WRITE_ENTIRE, + + /// Specifies that the run function will only read the associated buffer + /// and will maintain the reference count on the buffer after + /// run function exit. + COI_SINK_READ_ADDREF, + + /// Specifies that the run function will write to the associated buffer + /// and will maintain the reference count on the buffer after + /// run function exit. + COI_SINK_WRITE_ADDREF, + + /// Specifies that the run function will overwrite the entire associated + /// buffer and therefore the buffer will not be synchronized with the + /// source before execution and will maintain the reference count on the + /// buffer after run function exit. + COI_SINK_WRITE_ENTIRE_ADDREF } COI_ACCESS_FLAGS; #define COI_PIPELINE_MAX_PIPELINES 512 @@ -86,7 +103,7 @@ typedef enum COI_ACCESS_FLAGS /////////////////////////////////////////////////////////////////////////////// /// -/// Create a pipeline assoiated with a remote process. This pipeline can +/// Create a pipeline associated with a remote process. This pipeline can /// then be used to execute remote functions and to share data using /// COIBuffers. /// @@ -133,8 +150,8 @@ typedef enum COI_ACCESS_FLAGS /// @return COI_TIME_OUT_REACHED if establishing the communication channel with /// the remote pipeline timed out. /// -/// @return COI_RETRY if the pipeline cannot be created due to the number of -/// source-to-sink connections in use. A subsequent call to +/// @return COI_RETRY if the pipeline cannot be created due to the number of +/// source-to-sink connections in use. A subsequent call to /// COIPipelineCreate may succeed if resources are freed up. /// /// @return COI_PROCESS_DIED if in_Process died. @@ -149,7 +166,7 @@ COIPipelineCreate( /////////////////////////////////////////////////////////////////////////////// /// -/// Destroys the inidicated pipeline, releasing its resources. +/// Destroys the indicated pipeline, releasing its resources. /// /// @param in_Pipeline /// [in] Pipeline to destroy. @@ -175,22 +192,21 @@ COIPipelineDestroy( /// /// 1. Proper care has to be taken while setting the input dependencies for /// RunFunctions. Setting it incorrectly can lead to cyclic dependencies -/// and can cause the respective pipeline (as a result Intel® Coprocessor Offload Infrastructure (Intel® COI) Runtime) to -/// stall. +/// and can cause the respective pipeline to stall. /// 2. RunFunctions can also segfault if enough memory space is not available /// on the sink for the buffers passed in. Pinned buffers and buffers that /// are AddRef'd need to be accounted for available memory space. In other /// words, this memory is not available for use until it is freed up. -/// 3. Unexpected segmentation faults or erroneous behaviour can occur if -/// handles or data passed in to Runfunction gets destroyed before the +/// 3. Unexpected segmentation faults or erroneous behavior can occur if +/// handles or data passed in to Runfunction gets destroyed before the /// RunFunction finishes. /// For example, if a variable passed in as Misc data or the buffer gets -/// destroyed before the Intel® Coprocessor Offload Infrastructure (Intel® COI) runtime receives the completion notification -/// of the Runfunction, it can cause unexpected behaviour. So it is always +/// destroyed before the runtime receives the completion notification +/// of the Runfunction, it can cause unexpected behavior. So it is always /// recommended to wait for RunFunction completion event before any related /// destroy event occurs. /// -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) Runtime expects users to handle such scenarios. COIPipelineRunFunction +/// The runtime expects users to handle such scenarios. COIPipelineRunFunction /// returns COI_SUCCESS for above cases because it was queued up successfully. /// Also if you try to destroy a pipeline with a stalled function then the /// destroy call will hang. COIPipelineDestroy waits until all the functions @@ -240,7 +256,7 @@ COIPipelineDestroy( /// [in] Pointer to user defined data, typically used to pass /// parameters to Sink side functions. Should only be used for small /// amounts data since the data will be placed directly in the -/// Driver's command buffer. COIBuffers should be used to pass large +/// Driver's command buffer. COIBuffers should be used to pass large /// amounts of data. /// /// @param in_MiscDataLen @@ -250,8 +266,8 @@ COIPipelineDestroy( /// /// @param out_pAsyncReturnValue /// [out] Pointer to user-allocated memory where the return value from -/// the run function will be placed. This memory should not be read -/// until out_pCompletion has been signalled. +/// the run function will be placed. This memory should not be read +/// until out_pCompletion has been signaled. /// /// @param in_AsyncReturnValueLen /// [in] Size of the out_pAsyncReturnValue in bytes. @@ -259,11 +275,14 @@ COIPipelineDestroy( /// @param out_pCompletion /// [out] An optional pointer to a COIEVENT object /// that will be signaled when this run function has completed -/// execution. The user may pass in NULL if they do not wish to signal -/// any COIEVENTs when this run function completes. +/// execution. The user may pass in NULL if they wish for this function +/// to be synchronous, otherwise if a COIEVENT object is passed in the +/// function is then asynchronous and closes after enqueuing the +/// RunFunction and passes back the COIEVENT that will be signaled +/// once the RunFunction has completed. /// /// @return COI_SUCCESS if the function was successfully placed in a -/// pipeline for future execution. Note that the actual +/// pipeline for future execution. Note that the actual /// execution of the function will occur in the future. /// /// @return COI_OUT_OF_RANGE if in_NumBuffers is greater than @@ -303,18 +322,10 @@ COIPipelineDestroy( /// @return COI_ARGUMENT_MISMATCH if in_pReturnValue is non-NULL but /// in_ReturnValueLen is zero. /// -/// @return COI_ARGUMENT_MISMATCH if a COI_BUFFER_STREAMING_TO_SOURCE buffer -/// is not passed with COI_SINK_WRITE_ENTIRE access flag. -/// -/// @return COI_RESOURCE_EXHAUSTED if could not create a version for TO_SOURCE -/// streaming buffer. It can fail if enough memory is not available to -/// register. This call will succeed eventually when the registered -/// memory becomes available. -/// /// @return COI_RETRY if any input buffers, which are not pinned buffers, /// are still mapped when passed to the run function. /// -/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process +/// @return COI_MISSING_DEPENDENCY if buffer was not created on the process /// associated with the pipeline that was passed in. /// /// @return COI_OUT_OF_RANGE if any of the access flags in diff --git a/liboffloadmic/include/coi/source/COIProcess_source.h b/liboffloadmic/include/coi/source/COIProcess_source.h index b60e5522515..8cc6ffc3bf8 100644 --- a/liboffloadmic/include/coi/source/COIProcess_source.h +++ b/liboffloadmic/include/coi/source/COIProcess_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -61,11 +61,17 @@ extern "C" { /// This is a special COIPROCESS handle that can be used to indicate that /// the source process should be used for an operation. /// -#define COI_PROCESS_SOURCE ((COIPROCESS)-1) +#define COI_PROCESS_SOURCE ((COIPROCESS)-1) #define COI_MAX_FILE_NAME_LENGTH 256 /////////////////////////////////////////////////////////////////////////////// +/// This is a flag for COIProcessCreateFromMemory that indicates the passed in +/// memory pointer is a fat binary file and should not have regular validation. +/// +#define COI_FAT_BINARY ((uint64_t)-1) + +/////////////////////////////////////////////////////////////////////////////// /// /// Create a remote process on the Sink and start executing its main() /// function. @@ -74,14 +80,14 @@ extern "C" { /// /// @param in_Engine /// [in] A handle retrieved via a call to COIEngineGetHandle() that -/// indicates which device to create the process on. This is +/// indicates which device to create the process on. This is /// necessary because there can be more than one device /// within the system. /// /// @param in_pBinaryName /// [in] Pointer to a null-terminated string that contains the /// path to the program binary to be instantiated as a process on -/// the sink device. The file name will be accessed via +/// the sink device. The file name will be accessed via /// fopen and fread, as such, the passed in binary name must /// be locatable via these commands. Also, the file name (without /// directory information) will be used automatically by the system @@ -121,8 +127,8 @@ extern "C" { /// @param in_InitialBufferSpace /// [in] The initial memory (in bytes) that will be pre-allocated at /// process creation for use by buffers associated with this remote -/// process. In addition to allocating, Intel® Coprocessor Offload -/// Infrastructure (Intel® COI) will also fault in the +/// process. In addition to allocating, Intel(R) Coprocessor Offload +/// Infrastructure (Intel(R) COI) will also fault in the /// memory during process creation. If the total size of the buffers /// in use by this process exceed this initial size, memory on the /// sink may continue to be allocated on demand, as needed, subject @@ -186,7 +192,7 @@ COIProcessCreateFromFile( /// /// @param in_Engine /// [in] A handle retrieved via a call to COIEngineGetHandle() that -/// indicates which device to create the process on. This is +/// indicates which device to create the process on. This is /// necessary because there can be more than one device /// within the system. /// @@ -236,8 +242,8 @@ COIProcessCreateFromFile( /// @param in_InitialBufferSpace /// [in] The initial memory (in bytes) that will be pre-allocated at /// process creation for use by buffers associated with this remote -/// process. In addition to allocating, Intel® Coprocessor -/// Offload Infrastructure (Intel® COI) will also fault in the +/// process. In addition to allocating, Intel(R) Coprocessor +/// Offload Infrastructure (Intel(R) COI) will also fault in the /// memory during process creation. If the total size of the buffers /// in use by this process exceed this initial size, memory on the /// sink may continue to be allocated on demand, as needed, subject @@ -314,8 +320,8 @@ COIProcessCreateFromFile( /// @return COI_PROCESS_DIED if at some point during the loading of the remote /// process the remote process terminated abnormally. /// -/// @return COI_VERSION_MISMATCH if the version of Intel® Coprocessor -/// Offload Infrastructure (Intel® COI) on the host is not +/// @return COI_VERSION_MISMATCH if the version of Intel(R) Coprocessor +/// Offload Infrastructure (Intel(R) COI) on the host is not /// compatible with the version on the device. /// COIACCESSAPI @@ -354,7 +360,7 @@ COIProcessCreateFromMemory( /// [in] If this flag is set to true, then the sink process will be /// forcibly terminated after the timeout has been reached. A timeout /// value of 0 will kill the process immediately, while a timeout of -/// -1 is invalid. If the flag is set to false then a message will +/// -1 is invalid. If the flag is set to false then a message will /// be sent to the sink process requesting a clean shutdown. A value /// of false along with a timeout of 0 does not send a shutdown /// message, instead simply polls the process to see if it is alive. @@ -374,8 +380,8 @@ COIProcessCreateFromMemory( /// be 0 if the remote process exited cleanly. If the remote process /// exited abnormally this will contain the termination code given /// by the operating system of the remote process. This is an optional -/// parameter and the caller may pass in NULL if they are not -/// interested in the termination code. The output value of this +/// parameter and the caller may pass in NULL if they are not +/// interested in the termination code. The output value of this /// pointer is only meaningful if COI_SUCCESS is returned. /// /// @return COI_SUCCESS if the process was destroyed. @@ -390,8 +396,8 @@ COIProcessCreateFromMemory( /// /// @return COI_TIME_OUT_REACHED if the sink process is still running after /// waiting in_WaitForMainTimeout milliseconds and in_ForceDestroy -/// is false. This is true even if in_WaitForMainTimeout was 0. -/// In this case, out_pProcessReturn and out_pTerminationCode +/// is false. This is true even if in_WaitForMainTimeout was 0. +/// In this case, out_pProcessReturn and out_pTerminationCode /// are undefined. /// COIACCESSAPI @@ -410,10 +416,10 @@ COIProcessDestroy( /// /// Given a loaded native process, gets an array of function handles that can /// be used to schedule run functions on a pipeline associated with that -/// process. See the documentation for COIPipelineRunFunction() for -/// additional information. All functions that are to be retrieved in this -/// fashion must have the define COINATIVEPROCESSEXPORT preceeding their type -/// specification. For functions that are written in C++, either the entries +/// process. See the documentation for COIPipelineRunFunction() for +/// additional information. All functions that are to be retrieved in this +/// fashion must have the define COINATIVEPROCESSEXPORT preceding their type +/// specification. For functions that are written in C++, either the entries /// in in_pFunctionNameArray in must be pre-mangled, or the functions must be /// declared as extern "C". It is also necessary to link the binary containing /// the exported functions with the -rdynamic linker flag. @@ -432,7 +438,7 @@ COIProcessDestroy( /// @param in_ppFunctionNameArray /// [in] Pointer to an array of null-terminated strings that match /// the name of functions present in the code of the binary -/// previously loaded via COIProcessCreate(). Note that if a C++ +/// previously loaded via COIProcessCreate(). Note that if a C++ /// function is used, then the string passed in must already be /// properly name-mangled, or extern "C" must be used for where /// the function is declared. @@ -462,7 +468,7 @@ COIProcessDestroy( /// the null. /// /// @warning This operation can take several milliseconds so it is recommended -/// that it only be be done at load time. +/// that it only be done at load time. /// COIACCESSAPI COIRESULT @@ -486,7 +492,7 @@ COIProcessGetFunctionHandles( #define COI_LOADLIBRARY_DEEPBIND 0x00008 #define COI_LOADLIBRARY_NODELETE 0x01000 -/// Flags to replicate the behavior of the original version of +/// Flags to replicate the behaviour of the original version of /// COIProcessLoadLibrary* APIs. #define COI_LOADLIBRARY_V1_FLAGS (COI_LOADLIBRARY_GLOBAL|COI_LOADLIBRARY_NOW) @@ -796,13 +802,13 @@ COIProcessRegisterLibraries( ////////////////////////////////////////////////////////////////////////////// /// The user can choose to have notifications for these internal events /// so that they can build their own profiling and performance layer on -/// top of Intel® Coprocessor Offload Infrastructure (Intel® COI) . +/// top of Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI). /// typedef enum COI_NOTIFICATIONS { /// This event occurs when all explicit and implicit dependencies are - /// satisified and Intel® Coprocessor Offload Infrastructure - /// (Intel® COI) schedules the run function to begin execution. + /// satisfied and Intel(R) Coprocessor Offload Infrastructure + /// (Intel(R) COI) schedules the run function to begin execution. RUN_FUNCTION_READY = 0, /// This event occurs just before the run function actually starts @@ -835,20 +841,17 @@ typedef enum COI_NOTIFICATIONS ////////////////////////////////////////////////////////////////////////////// /// /// A callback that will be invoked to notify the user of an internal -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// event. Note that the callback is registered per process so any of the /// above notifications that happen on the registered process will receive /// the callback. /// As with any callback mechanism it is up to the user to make sure that -/// there are no possible deadlocks due to reentrancy (ie the callback being +/// there are no possible deadlocks due to reentrancy (i.e. the callback being /// invoked in the same context that triggered the notification) and also /// that the callback does not slow down overall processing. If the user /// performs too much work within the callback it could delay further -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) -/// processing. -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) -/// promises to invoke the callback for an internal event prior to -/// signaling the corresponding COIEvent. For example, if a user is waiting +/// processing. The callback will be invoked prior to the signaling of +/// the corresponding COIEvent. For example, if a user is waiting /// for a COIEvent associated with a run function completing they will /// receive the callback before the COIEvent is marked as signaled. /// @@ -865,11 +868,12 @@ typedef enum COI_NOTIFICATIONS /// /// @param in_UserData /// [in] Opaque data that was provided when the callback was -/// registered. Intel® Coprocessor Offload Infrastructure (Intel® COI) simply passes this back to the user so that +/// registered. Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) +/// simply passes this back to the user so that /// they can interpret it as they choose. /// typedef void (*COI_NOTIFICATION_CALLBACK)( - COI_NOTIFICATIONS in_Type, + COI_NOTIFICATIONS in_Type, COIPROCESS in_Process, COIEVENT in_Event, const void* in_UserData); @@ -878,7 +882,7 @@ typedef void (*COI_NOTIFICATION_CALLBACK)( ////////////////////////////////////////////////////////////////////////////// /// /// Register a callback to be invoked to notify that an internal -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) event +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) event /// has occured on the process that is associated with the callback. /// Note that it is legal to have more than one callback registered with /// a given process but those must all be unique callback pointers. @@ -942,13 +946,13 @@ COIRESULT COIUnregisterNotificationCallback( /// /// Set the user data that will be returned in the notification callback. /// This data is sticky and per thread so must be set prior to the -/// Intel® Coprocessor Offload Infrastructure (Intel® COI) // +/// Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) /// operation being invoked. If you wish to set the context to be returned /// for a specific instance of a user event notification then the context /// must be set using this API prior to registering that user event with /// COIEventRegisterUserEvent. -/// The value may be set prior to each Intel® Coprocessor Offload -/// Infrastructure (Intel® COI) operation being called to +/// The value may be set prior to each Intel(R) Coprocessor Offload +/// Infrastructure (Intel(R) COI) operation being called to /// effectively have a unique UserData per callback. /// Setting this value overrides any value that was set when the /// callback was registered and will also override any future registrations @@ -962,6 +966,266 @@ COIACCESSAPI void COINotificationCallbackSetContext( const void* in_UserData); + +/// @name COIProcessSetCacheSize flags. +/// Flags are divided into two categories: _MODE_ and _ACTION_ +/// only one of each is valid with each call. +/// _ACTIONS_ and _MODES_ should be bitwised OR'ed together, i.e. | +//@{ + +/// Current set of DEFINED bits for _MODE_, can be used +/// to clear or check fields, not useful to pass into APIs. Used internally. +#define COI_CACHE_MODE_MASK 0x00000007 + +/// Flag to indicate to keep the previous mode of operation. By default +/// this would be COI_CACHE_MODE_ONDEMAND_SYNC. As of this release +/// This is the only mode available. This mode is valid with _ACTION_ +/// flags. +#define COI_CACHE_MODE_NOCHANGE 0x00000001 + +/// Mode of operation that indicates that COI will allocate physical +/// cache memory exactly when it is is needed. COIPipeline execution in +/// the given process will momentarily block until the allocation request +/// is completed. This is and has been the default mode. +#define COI_CACHE_MODE_ONDEMAND_SYNC 0x00000002 + +/// Not yet implemented. Future mode that will not stall a COIPipeline +/// but prefer eviction/paging if possible as to immediately execute pipeline. +/// At the same time, enqueue background requests to allocate extra cache +/// so as to provide optimze behavior on subsequent runs. +#define COI_CACHE_MODE_ONDEMAND_ASYNC 0x00000004 + + +/// Current set of DEFINED bits for _ACTION_ can be used +/// to clear fields, but not useful to pass into API's. Used internally. +#define COI_CACHE_ACTION_MASK 0x00070000 + +/// No action requested. With this flag specified +/// it is recommended to NOT provide a out_pCompletion event, +/// as with this flag, modes and values are immediately set. +/// This is valid with _MODE_ flags. +#define COI_CACHE_ACTION_NONE 0x00010000 + +/// This _ACTION_ flag will immediately attempt to increase the cache +/// physical memory size to the current set pool size(s). Used to +/// pre-allocate memory on remote processes, so that runfunction will +/// enqueue faster. Also may prevent unused buffer eviction from process +/// reducing overhead in trade for memory allocation cost. +#define COI_CACHE_ACTION_GROW_NOW 0x00020000 + +/// Not yet implemented. Future _ACTION_ that will attempt to find unused +/// allocated cache and free it, with the express goal of reducing the +/// footprint on the remote process down to the value of the currently set +/// pool size(s). +#define COI_CACHE_ACTION_FREE_UNUSED 0x00040000 + +//@} + +////////////////////////////////////////////////////////////////////////////// +/// +/// Set the minimum preferred COIProcess cache size. By default these values +/// are set to 1GB. With the default size of 1GB, Intel(R) COI will only +/// grow the cache with each new buffer up until the set limit is consumed, +/// after which, only required to accommodate additional buffers. +/// This means that after the cache preference is met, a process will act +/// as conservative as possible for memory consumption. +/// This API will allow users to adjust memory consumption aggressiveness. +/// +/// Additional performance may be gained if the user sets a value higher than +/// default. With high memory consumption user can choose to trade performance +/// between memory allocation cost and transfer speeds to and from the +/// remote process. A last consideration is that if buffers are used only +/// once, it may be best to keep a small cache size, or ensure buffers are +/// fully destroyed after their use. +/// +/// Adjusting this value to high may result in out of resource conditions. +/// +/// @param in_pProcess +/// [in] Handle to uniquely identify the process for which the cache +/// is to be adjusted. +/// +/// @param in_HugePagePoolSize +/// [in] The suggested size of the remote huge page cache in bytes. +/// This value defaults to 1GB. A process will only allocate cache +/// memory if the current cache is smaller than this limit, or it is +/// absolutely necessary to fulfill a request, but preferring to +/// re-use existing memory and paging unused buffers back to the host +/// Increasing this value will cause a process to +/// aggressively allocate memory on demand up to this value, before +/// evicting/paging memory from the remote process back to the host +/// process. +/// +/// The net result is that memory consumption is increased, but the +/// user can 'cache' more buffers on the remote process. More time +/// may be spent during first use of run functions as more memory +/// may be allocated, but subsequent run functions will likely +/// see an increase in queueing performance as the data is already +/// valid in the remote process. +/// +/// Users should tune this value for optimum performance balanced +/// against memory consumption. This value does not affect 4K page +/// cache. Please use in_SmallPagePoolSize for 4K pages. +/// +/// @param in_HugeFlags +/// [in] Flags to select mode or action for huge page cache. One _MODE_ +/// and one _ACTION_ flag are specified together. Default _MODE_ is +/// COI_CACHE_MODE_ONDEMAND_SYNC. See all COI_CACHE_MODE_* and +/// COI_CACHE_ACTION_* for other modes and actions. Default _ACTION_ +/// is COI_CACHE_ACTION_NONE. +/// +/// @param in_SmallPagePoolSize +/// [in] The suggested size of the remote 4K cache in bytes. Same +/// function as in_HugePagePoolSize but affecting only 4K page cache. +/// Defaults to 1GB. +/// +/// @param in_SmallFlags +/// [in] Flags to select mode or action for 4K page cache. One _MODE_ +/// and one _ACTION_ flag are be specified together. Default _MODE_ is +/// COI_CACHE_MODE_ONDEMAND_SYNC. See all COI_CACHE_MODE_* and +/// COI_CACHE_ACTION_* for other modes and actions. +/// +/// @param in_NumDependencies +/// [in] The number of dependencies specified in the in_pDependencies +/// array. This may be 0 if the caller does not want the call to +/// wait for any events to be signaled. +/// +/// @param in_pDependencies +/// [in] An optional array of handles to previously created COIEVENT +/// objects that this operation will wait for before starting. +/// This allows the user to create dependencies between asynchronous +/// calls and other operations such as run functions. The user may +/// pass in NULL if they do not wish to wait for any dependencies. +/// Only useful with _ACTION_ flags, otherwise there is no action +/// to wait on. All _MODE_ changes happen immediately. +/// +/// @param out_pCompletion +/// [out] An optional pointer to a COIEVENT object that will be +/// signaled when the operation is complete. The user may pass in +/// NULL if the user wants the operation to block until completed. +/// Note: This flag is not useful unless paired with a +/// valid _ACTION_ flag. +/// +/// @return COI_SUCCESS if the cache was successfully adjusted. In case of +/// valid flags including _ACTION_, if out_pCompletion was specified, +/// this does not indicate the operation succeeded, but rather only +/// it was successfully queued. For further information see +/// that COIEventWait() for getting return values. +/// +/// @return COI_INVALID_HANDLE if the in_Process handle passed in was invalid. +/// +/// @return COI_RESOURCE_EXHAUSTED if no more cache can be created, +/// possibly, but not necessarily because a pool size was set to large +/// and COI_CACHE_ACTION_GROW_NOW was specified. +/// +/// @return COI_NOT_SUPPORTED if more than one _MODE_ or _ACTION_ was +/// specified. +/// +/// @return COI_NOT_SUPPORTED if an invalid _MODE_ or _ACTION_ was +/// specified. +/// +/// @return COI_ARGUMENT_MISMATCH if in_NumDependencies is non-zero while +/// in_pDependencies was passed in as NULL. +/// +/// @return COI_OUT_OF_RANGE if one of the pool sizes was invalid. +/// +/// @return COI_PROCESS_DIED if at some point during the mode or action the +/// remote process terminated abnormally. Possible due to an out of +/// memory condition. +/// +COIACCESSAPI +COIRESULT COIProcessSetCacheSize( + const COIPROCESS in_Process, + const uint64_t in_HugePagePoolSize, + const uint32_t in_HugeFlags, + const uint64_t in_SmallPagePoolSize, + const uint32_t in_SmallFlags, + uint32_t in_NumDependencies, + const COIEVENT* in_pDependencies, + COIEVENT* out_pCompletion); + + +////////////////////////////////////////////////////////////////////////////// +/// These are the different modes of operation that can be selected for +/// the COI_DMA_MODE by the API COIProcessConfigureDMA. They allow the user +/// to customize the DMA layer behaviour. +/// +typedef enum COI_DMA_MODE +{ + /// This mode will use one common logical channel for all DMA operations. + /// Using this mode requires a channel count of one. + COI_DMA_MODE_SINGLE = 0, + + /// This mode will dedicate on logical channel for write operations + /// and one logical channel for read operations. Requires a minimum of + /// two logical channels, if more than two are used they are ignored + /// in the current implementation. + COI_DMA_MODE_READ_WRITE, + + /// This mode is not yet implemented and is a placeholder for future + /// releases. Check here for updates when it is implemented. + /// Will require a minimum of two logical channels and a maximum + /// of four channels. + COI_DMA_MODE_ROUND_ROBIN, + + /// Reserved for internal use. + COI_DMA_RESERVED +} COI_DMA_MODE; + + +////////////////////////////////////////////////////////////////////////////// +/// +/// Set the number and mode of the physical DMA channels that each COIProcess +/// will establish during COIProcess creation. +/// +/// By default the runtime will operate in COI_DMA_MODE_SINGLE mode. +/// This API is intended to be called before COIProcessCreateFromFile() or +/// COIProcessCreateFromMemory(). The values are stored globally and will +/// be used by the creation API's. It is possible to call this API once +/// before each new COIPROCESS is created and thus have each COIPROCESS +/// run in different modes. It is not possible to change the mode on an +/// existing COIPROCESS. +/// +/// The larger number of logical connections requested will impose a +/// performance penalty on the COIBUFFER creation API's, but unlock better +/// parallelism for DMA transfers during runtime. +/// +/// A maximum value of four (4) channels is available today, but current +/// implementation will only take advantage of two DMA channels. The option +/// is left available for programmers to use in case future implementations +/// provide performance advantages. +/// +/// It is important to note that for some operations that enabling this +/// options may increase parallelism and require the user to enforce +/// explicit dependencies for operations on the same buffers. See documentation +/// for COIBufferRead/Write/Copy operations for more details. +/// +/// @param in_Channels +/// [in] Number of logical connections to the remote COIProcess that +/// the runtime will establish and use for DMA transfer requests. +/// Will be ignored if in_Mode is set to COI_DMA_MODE_SINGLE. +/// +/// @param in_Mode +/// [in] The mode of operation in which the runtime will use the +/// logical connections to the remote COIProcess. +/// +/// @return COI_SUCCESS if the mode and number of DMA channels requested +/// is valid. The actual create creation of channels and modes is +/// done during COIProcessCreateFromFile() and +/// COIProcessCreateFromMemory(). +/// +/// @return COI_NOT_SUPPORTED if an invalid value for in_Channels or +/// in_Mode was requested. +/// +/// @return COI_ARGUMENT_MISMATCH if an invalid combination of in_Channels and +/// in_Mode was requested. Example could be 2 channels with +/// COI_DMA_MODE_SINGLE, or 1 channel with COI_DMA_MODE_READ_WRITE. +/// +COIACCESSAPI +COIRESULT COIProcessConfigureDMA( + const uint64_t in_Channels, + const COI_DMA_MODE in_Mode); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/liboffloadmic/include/myo/myo.h b/liboffloadmic/include/myo/myo.h index c6e5f56ede2..f6f14015c25 100644 --- a/liboffloadmic/include/myo/myo.h +++ b/liboffloadmic/include/myo/myo.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published diff --git a/liboffloadmic/include/myo/myoimpl.h b/liboffloadmic/include/myo/myoimpl.h index d998ef3feb6..c5a1a41935e 100644 --- a/liboffloadmic/include/myo/myoimpl.h +++ b/liboffloadmic/include/myo/myoimpl.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -459,11 +459,37 @@ extern MyoError myoiTargetSharedMallocTableRegister( * return -1; * } * @endcode - * This intialization is required only in the client/host side - * of the application. The server/card side executable should be - * executed only on the second card in this case. + * This intialization is required only in the client/host side + * of the application. The server/card side executable should be + * executed only on the second card in this case. + * + * Another capability for the MyoiUserParams structure in MYO is specifying + * a remote procedure call to be executed on the host or card, immediately after + * myoiLibInit() completes. This capability is useful because some calls in + * MYO return immediately, but do not actually complete until after the MYO + * library is completely initialized on all peers. An example follows, + * showing how to cause MYO to execute the registered function named + * "PostMyoLibInitFunction" on the first card only: + * @code + * MyoiUserParams UserParas[64]; + * UserParas[0].type = MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC; + * UserParas[0].nodeid = 1; + * SetPostLibInitFuncName(UserParas[1], "PostMyoLibInitFunction"); + * UserParas[2].type = MYOI_USERPARAMS_LAST_MSG; + * if(MYO_SUCCESS != myoiLibInit(&UserParas, (void*)&myoiUserInit)) { + * printf("Failed to initialize MYO runtime\n"); + * return -1; + * } + * @endcode + * + * Note, to cause PostMyoLibInitFunction to be executed on ALL cards, + * specify: MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES for the nodeid. + * That is: + * @code + * UserParas[0].nodeid = MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES; + * @endcode * - * @param userInitFunc Shared variables and remote funtions are + * @param userInitFunc Shared variables and remote functions are * registered in this routine, which is called by the runtime during * library initialization. * @return @@ -473,6 +499,22 @@ extern MyoError myoiTargetSharedMallocTableRegister( MYOACCESSAPI MyoError myoiLibInit(void * in_args, void *userInitFunc /*userInitFunc must be: MyoError (*userInitFunc)(void) */); +/** @fn extern MyoError myoiSupportsFeature(MyoFeatureType myoFeature) + * @brief Supports runtime query to determine whether a feature is supported + * by the myo that is installed on the system. This function is intended to + * support client code to query the myo library to determine whether its set + * of capabilities are able to support the client's needs. + * + * @param myoFeature The feature that is to be inquired about. + * @return + * MYO_SUCCESS; if the feature is supported. + * MYO_FEATURE_NOT_IMPLEMENTED if the feature is not supported. + * + * (For more information, please also see the declaration of the MyoFeatureType enum declaration.) + **/ +MYOACCESSAPI +MyoError myoiSupportsFeature(MyoFeatureType myoFeature); + /** @fn void myoiLibFini() * @brief Finalize the MYO library, all resources held by the runtime are * released by this routine. @@ -519,17 +561,56 @@ MyoError myoiSetMemConsistent(void *in_pAddr, size_t in_Size); EXTERN_C MYOACCESSAPI unsigned int myoiMyId; /* MYO_MYID if on accelerators */ EXTERN_C MYOACCESSAPI volatile int myoiInitFlag; - - //! Structure of the array element that is passed to myoiLibInit() to initialize a subset of the available cards. -typedef struct{ - //!type = MYOI_USERPARAMS_DEVID for each element in the array except the last element ; type = MYOI_USERPARAMS_LAST_MSG for the last element in the array. + //! Structure of the array element that is passed to myoiLibInit() to initialize a subset of the available cards, or + //! to specify a remote call function to be called after successful myo library initialization: +typedef struct { + //!type = MYOI_USERPARAMS_DEVID or MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC for each element in the array except + //!the last element, type should be: MYOI_USERPARAMS_LAST_MSG. int type; - //!nodeid refers to the card index. + //! nodeid refers to the 'one-based' card index. Specifying, 1 represents the first card, mic0, 2 represents the + // second card, mic1, 3 represents the third card, mic2, ....). + // NOTE: for type == MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC, specifying MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES + // for nodeid, will execute the named function, on each card in the system, mic0, mic1, mic2, .... micn. int nodeid; -}MyoiUserParams; - -#define MYOI_USERPARAMS_DEVID 1 -#define MYOI_USERPARAMS_LAST_MSG -1 +} MyoiUserParams; + +//!The following two types are dealt with entirely with just one MyoiUserParams structure: +//!MYOI_USERPARAMS_DEVID maps node ids. +#define MYOI_USERPARAMS_DEVID 1 +//!MYOI_USERPARAMS_LAST_MSG terminates the array of MyoiUserParams. +#define MYOI_USERPARAMS_LAST_MSG -1 + +//!The following type requires setting the node id in a MyoiUserParams structure, and then following the struct +//!with a MyoiUserParamsPostLibInit union: +#define MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC 2 +//!nodeid can be one of the following macros, or a number >=1, corresponding to the card number (1 == mic0, +//!2 == mic1, 3 == mic2, ....) +//!Setting nodeid to MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES causes the function to be called on all +//!cards: +#define MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES 0 +//!Setting nodeid to MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_HOST_NODE causes the function to be called on the +//!host instead of the card: +#define MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_HOST_NODE -1 + +//!The postLibInit union contains two members that serves two different purposes: +//!1. It can be used to stipulate the name of the function to be remotely called from host to card, on successful +//!myo library initialization, (member postLibInitRemoveFuncName) using the type: +//!MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC. OR +//!2. It can be an actual function pointer (member name: postLibInitHostFuncAddress) that will be called on the host, +//!on successful myo library initialization, using the type: MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC, with nodeid: +//!MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_HOST_NODE +typedef union { + const char *postLibInitRemoveFuncName; + void (*postLibInitHostFuncAddress)(void); +} MyoiUserParamsPostLibInit; + +/* These are two macros to help get the information in a MyoiUserParamsPostLibInit union from a MyoiUserParams struct; */ +#define GetPostLibInitFuncName(USERPARAMS) ((MyoiUserParamsPostLibInit *) (& (USERPARAMS)))->postLibInitRemoveFuncName +#define GetPostLibInitFuncAddr(USERPARAMS) ((MyoiUserParamsPostLibInit *) (& (USERPARAMS)))->postLibInitHostFuncAddress + +/* These are two macros to help set the information in a MyoiUserParamsPostLibInit union from a MyoiUserParams struct; */ +#define SetPostLibInitFuncName(USERPARAMS,FUNC_NAME) GetPostLibInitFuncName(USERPARAMS) = FUNC_NAME +#define SetPostLibInitFuncAddr(USERPARAMS,FUNC_ADDR) GetPostLibInitFuncAddr(USERPARAMS) = FUNC_ADDR #ifdef __cplusplus } diff --git a/liboffloadmic/include/myo/myotypes.h b/liboffloadmic/include/myo/myotypes.h index 81464d1666f..596ad05280c 100644 --- a/liboffloadmic/include/myo/myotypes.h +++ b/liboffloadmic/include/myo/myotypes.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -74,7 +74,8 @@ typedef enum { MYO_ALREADY_EXISTS, /*!< Already Exists */ - MYO_EOF, /*!< EOF */ + MYO_EOF, /*!< EOF */ + MYO_FEATURE_NOT_IMPLEMENTED = -1, /*!< Feature not implemented (see myoiSupportsFeature(). */ } MyoError; @@ -84,6 +85,40 @@ typedef enum { MYO_ARENA_OURS, /*!< Arena OURS Ownership */ } MyoOwnershipType; + /*! MYO Features */ +typedef enum { + /*!< EVERY VALUE that is less than MYO_FEATURE_BEGIN is not implemented. */ + MYO_FEATURE_BEGIN = 1, /*!< The first feature that is supported. */ + MYO_FEATURE_POST_LIB_INIT = MYO_FEATURE_BEGIN, /*!< Allows specifying a function to be executed immediately */ + /* after myoiLibInit() completes. This feature was implemented in version */ + /* 3.3 of MPSS. */ + /* MYO_FEATURE_FUTURE_CAPABILITY = 2, at some time in the future, as new features are added to MYO, new enumeration constants */ + /* will be added to the MyoFeatureType, and the value of the new enumeration constant will be greater */ + /* than the current value of MYO_FEATURE_LAST constant, and then the MYO_FEATURE_LAST constant too, */ + /* will be changed to be the value of the new enumeration constant. For example, in April, 2014, */ + /* the POST_LIB_INIT feature was implemented in version 3.3 of MPSS, and the MYO_FEATURE_BEGIN */ + /* enumeration constant is the same as the MYO_FEATURE_LAST enumeration constant, and both are equal */ + /* to 1. */ + /* Suppose in December, 2014, a new feature is added to the MYO library, for version 3.4 of MPSS. */ + /* Then, MYO_FEATURE_BEGIN enumeration constant will be still the value 1, but the MYO_FEATURE_LAST */ + /* enumeration constant will be set to 2. */ + /* At runtime, one client binary can determine if the MYO that is installed is capable of any */ + /* capability. For example, suppose a future client binary queries version 3.3 of MYO if it is */ + /* capable of some future feature. Version 3.3 of MYO will indicate that the feature is not */ + /* implemented to the client. But, conversely, suppose the future client queries version 3.4 of MYO */ + /* if it is capable of some future feature. Version 3.4 of MYO will indicate that the feature isd */ + /* supported. */ + /* */ + /* Date: | MYO_FEATURE_BEGIN: | MYO_FEATURE_LAST: | MPSS VERSION: | myoiSupportsFeature(MYO_FEATURE_FUTURE_CAPABILITY) */ + /* ---------------+---------------------+--------------------+---------------+--------------------------------------------------- */ + /* April, 2014 | 1 | 1 | 3.3 | MYO_FEATURE_NOT_IMPLEMENTED */ + /* December, 2014 | 1 | 2 | 3.4 | MYO_SUCCESS */ + /* ---------------+---------------------+--------------------+---------------+--------------------------------------------------- */ + MYO_FEATURE_LAST = MYO_FEATURE_POST_LIB_INIT, /*!< The last feature that is supported. */ + /*!< EVERY VALUE that is greater than MYO_FEATURE_LAST is not implemented. */ + /*!< EVERY VALUE that is greater than or equal to MYO_FEATURE_BEGIN AND less than or equal to MYO_FEATURE_LAST is implemented. */ +} MyoFeatureType; /* (For more information, please also see myoiSupportsFeature() function declaration.) */ + /************************************************************* * define the property of MYO Arena ***********************************************************/ diff --git a/liboffloadmic/plugin/Makefile.am b/liboffloadmic/plugin/Makefile.am index 6ec444ccb4c..9ff8c9a06be 100644 --- a/liboffloadmic/plugin/Makefile.am +++ b/liboffloadmic/plugin/Makefile.am @@ -35,7 +35,6 @@ ACLOCAL_AMFLAGS = -I ../.. -I ../../config build_dir = $(top_builddir) source_dir = $(top_srcdir) coi_inc_dir = $(top_srcdir)/../include/coi -myo_inc_dir = $(top_srcdir)/../include/myo include_src_dir = $(top_srcdir)/../../include libgomp_src_dir = $(top_srcdir)/../../libgomp libgomp_dir = $(build_dir)/../../libgomp @@ -53,12 +52,12 @@ target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$ if PLUGIN_HOST toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp - libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(include_src_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include + libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(include_src_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0 else # PLUGIN_TARGET plugin_includedir = $(libsubincludedir) plugin_include_HEADERS = main_target_image.h - AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) + AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) AM_CXXFLAGS = $(CXXFLAGS) AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic endif diff --git a/liboffloadmic/plugin/Makefile.in b/liboffloadmic/plugin/Makefile.in index 458c9b20bc5..7d60476f70f 100644 --- a/liboffloadmic/plugin/Makefile.in +++ b/liboffloadmic/plugin/Makefile.in @@ -305,7 +305,6 @@ ACLOCAL_AMFLAGS = -I ../.. -I ../../config build_dir = $(top_builddir) source_dir = $(top_srcdir) coi_inc_dir = $(top_srcdir)/../include/coi -myo_inc_dir = $(top_srcdir)/../include/myo include_src_dir = $(top_srcdir)/../../include libgomp_src_dir = $(top_srcdir)/../../libgomp libgomp_dir = $(build_dir)/../../libgomp @@ -321,11 +320,11 @@ target_build_dir = $(accel_search_dir)/$(accel_target)$(MULTISUBDIR)/liboffloadm target_install_dir = $(accel_search_dir)/lib/gcc/$(accel_target)/$(gcc_version)$(MULTISUBDIR) @PLUGIN_HOST_TRUE@toolexeclib_LTLIBRARIES = libgomp-plugin-intelmic.la @PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_SOURCES = libgomp-plugin-intelmic.cpp -@PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(include_src_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include +@PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=1 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_src_dir) -I$(libgomp_dir) -I$(include_src_dir) -I$(target_prefix_dir)/include -I$(target_build_dir) -I$(target_install_dir)/include @PLUGIN_HOST_TRUE@libgomp_plugin_intelmic_la_LDFLAGS = -L$(liboffload_dir)/.libs -loffloadmic_host -version-info 1:0:0 @PLUGIN_HOST_FALSE@plugin_includedir = $(libsubincludedir) @PLUGIN_HOST_FALSE@plugin_include_HEADERS = main_target_image.h -@PLUGIN_HOST_FALSE@AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DMYO_SUPPORT -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(myo_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) +@PLUGIN_HOST_FALSE@AM_CPPFLAGS = $(CPPFLAGS) -DLINUX -DCOI_LIBRARY_VERSION=2 -DOFFLOAD_DEBUG=1 -DSEP_SUPPORT -DTIMING_SUPPORT -DHOST_LIBRARY=0 -I$(coi_inc_dir) -I$(liboffload_src_dir) -I$(libgomp_dir) @PLUGIN_HOST_FALSE@AM_CXXFLAGS = $(CXXFLAGS) @PLUGIN_HOST_FALSE@AM_LDFLAGS = -L$(liboffload_dir)/.libs -L$(libgomp_dir)/.libs -loffloadmic_target -lcoi_device -lmyo-service -lgomp -rdynamic diff --git a/liboffloadmic/runtime/cean_util.cpp b/liboffloadmic/runtime/cean_util.cpp index 3258d7f3ade..88bfa0d735f 100644 --- a/liboffloadmic/runtime/cean_util.cpp +++ b/liboffloadmic/runtime/cean_util.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ // 1. allocate element of CeanReadRanges type // 2. initialized it for reading consequently contiguous ranges // described by "ap" argument -CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap) +CeanReadRanges * init_read_ranges_arr_desc(const Arr_Desc *ap) { CeanReadRanges * res; @@ -57,6 +57,8 @@ CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap) (ap->rank - rank) * sizeof(CeanReadDim)); if (res == NULL) LIBOFFLOAD_ERROR(c_malloc); + + res->arr_desc = const_cast<Arr_Desc*>(ap); res->current_number = 0; res->range_size = length; res->last_noncont_ind = rank; @@ -82,7 +84,7 @@ CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap) return res; } -// check if ranges described by 1 argument could be transfered into ranges +// check if ranges described by 1 argument could be transferred into ranges // described by 2-nd one bool cean_ranges_match( CeanReadRanges * read_rng1, @@ -118,7 +120,7 @@ bool get_next_range( return true; } -bool is_arr_desc_contiguous(const arr_desc *ap) +bool is_arr_desc_contiguous(const Arr_Desc *ap) { int64_t rank = ap->rank - 1; int64_t length = ap->dim[rank].size; @@ -146,14 +148,22 @@ int64_t cean_get_transf_size(CeanReadRanges * read_rng) } static uint64_t last_left, last_right; -typedef void (*fpp)(const char *spaces, uint64_t low, uint64_t high, int esize); + +typedef void (*fpp)( + const char *spaces, + uint64_t low, + uint64_t high, + int esize, + bool print_values +); static void generate_one_range( const char *spaces, uint64_t lrange, uint64_t rrange, fpp fp, - int esize + int esize, + bool print_values ) { OFFLOAD_TRACE(3, @@ -168,20 +178,35 @@ static void generate_one_range( // Extend previous range, don't print } else { - (*fp)(spaces, last_left, last_right, esize); + (*fp)(spaces, last_left, last_right, esize, print_values); last_left = lrange; } } last_right = rrange; } +static bool element_is_contiguous( + uint64_t rank, + const struct Dim_Desc *ddp +) +{ + if (rank == 1) { + return (ddp[0].lower == ddp[0].upper || ddp[0].stride == 1); + } + else { + return ((ddp[0].size == (ddp[1].upper-ddp[1].lower+1)*ddp[1].size) && + element_is_contiguous(rank-1, ddp++)); + } +} + static void generate_mem_ranges_one_rank( const char *spaces, uint64_t base, uint64_t rank, - const struct dim_desc *ddp, + const struct Dim_Desc *ddp, fpp fp, - int esize + int esize, + bool print_values ) { uint64_t lindex = ddp->lindex; @@ -194,35 +219,40 @@ static void generate_mem_ranges_one_rank( "generate_mem_ranges_one_rank(base=%p, rank=%lld, lindex=%lld, " "lower=%lld, upper=%lld, stride=%lld, size=%lld, esize=%d)\n", spaces, (void*)base, rank, lindex, lower, upper, stride, size, esize); - if (rank == 1) { + + if (element_is_contiguous(rank, ddp)) { uint64_t lrange, rrange; - if (stride == 1) { - lrange = base + (lower-lindex)*size; - rrange = lrange + (upper-lower+1)*size - 1; - generate_one_range(spaces, lrange, rrange, fp, esize); - } - else { + lrange = base + (lower-lindex)*size; + rrange = lrange + (upper-lower+1)*size - 1; + generate_one_range(spaces, lrange, rrange, fp, esize, print_values); + } + else { + if (rank == 1) { for (int i=lower-lindex; i<=upper-lindex; i+=stride) { + uint64_t lrange, rrange; lrange = base + i*size; rrange = lrange + size - 1; - generate_one_range(spaces, lrange, rrange, fp, esize); + generate_one_range(spaces, lrange, rrange, + fp, esize, print_values); } } - } - else { - for (int i=lower-lindex; i<=upper-lindex; i+=stride) { - generate_mem_ranges_one_rank( - spaces, base+i*size, rank-1, ddp+1, fp, esize); + else { + for (int i=lower-lindex; i<=upper-lindex; i+=stride) { + generate_mem_ranges_one_rank( + spaces, base+i*size, rank-1, ddp+1, + fp, esize, print_values); + } } } } static void generate_mem_ranges( const char *spaces, - const arr_desc *adp, + const Arr_Desc *adp, bool deref, - fpp fp + fpp fp, + bool print_values ) { uint64_t esize; @@ -241,13 +271,13 @@ static void generate_mem_ranges( // For c_cean_var the base addr is the address of the data // For c_cean_var_ptr the base addr is dereferenced to get to the data spaces, deref ? *((uint64_t*)(adp->base)) : adp->base, - adp->rank, &adp->dim[0], fp, esize); - (*fp)(spaces, last_left, last_right, esize); + adp->rank, &adp->dim[0], fp, esize, print_values); + (*fp)(spaces, last_left, last_right, esize, print_values); } // returns offset and length of the data to be transferred void __arr_data_offset_and_length( - const arr_desc *adp, + const Arr_Desc *adp, int64_t &offset, int64_t &length ) @@ -284,11 +314,12 @@ void __arr_data_offset_and_length( #if OFFLOAD_DEBUG > 0 -void print_range( +static void print_range( const char *spaces, uint64_t low, uint64_t high, - int esize + int esize, + bool print_values ) { char buffer[1024]; @@ -297,7 +328,7 @@ void print_range( OFFLOAD_TRACE(3, "%s print_range(low=%p, high=%p, esize=%d)\n", spaces, (void*)low, (void*)high, esize); - if (console_enabled < 4) { + if (console_enabled < 4 || !print_values) { return; } OFFLOAD_TRACE(4, "%s values:\n", spaces); @@ -340,8 +371,9 @@ void print_range( void __arr_desc_dump( const char *spaces, const char *name, - const arr_desc *adp, - bool deref + const Arr_Desc *adp, + bool deref, + bool print_values ) { OFFLOAD_TRACE(2, "%s%s CEAN expression %p\n", spaces, name, adp); @@ -360,7 +392,7 @@ void __arr_desc_dump( } // For c_cean_var the base addr is the address of the data // For c_cean_var_ptr the base addr is dereferenced to get to the data - generate_mem_ranges(spaces, adp, deref, &print_range); + generate_mem_ranges(spaces, adp, deref, &print_range, print_values); } } #endif // OFFLOAD_DEBUG diff --git a/liboffloadmic/runtime/cean_util.h b/liboffloadmic/runtime/cean_util.h index 83140479269..8b7c4376739 100644 --- a/liboffloadmic/runtime/cean_util.h +++ b/liboffloadmic/runtime/cean_util.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -32,9 +32,10 @@ #define CEAN_UTIL_H_INCLUDED #include <stdint.h> +#include "offload_util.h" // CEAN expression representation -struct dim_desc { +struct Dim_Desc { int64_t size; // Length of data type int64_t lindex; // Lower index int64_t lower; // Lower section bound @@ -42,10 +43,10 @@ struct dim_desc { int64_t stride; // Stride }; -struct arr_desc { +struct Arr_Desc { int64_t base; // Base address int64_t rank; // Rank of array - dim_desc dim[1]; + Dim_Desc dim[1]; }; struct CeanReadDim { @@ -55,6 +56,7 @@ struct CeanReadDim { }; struct CeanReadRanges { + Arr_Desc* arr_desc; void * ptr; int64_t current_number; // the number of ranges read int64_t range_max_number; // number of contiguous ranges @@ -66,23 +68,23 @@ struct CeanReadRanges { // array descriptor length #define __arr_desc_length(rank) \ - (sizeof(int64_t) + sizeof(dim_desc) * (rank)) + (sizeof(int64_t) + sizeof(Dim_Desc) * (rank)) // returns offset and length of the data to be transferred -void __arr_data_offset_and_length(const arr_desc *adp, +DLL_LOCAL void __arr_data_offset_and_length(const Arr_Desc *adp, int64_t &offset, int64_t &length); // define if data array described by argument is contiguous one -bool is_arr_desc_contiguous(const arr_desc *ap); +DLL_LOCAL bool is_arr_desc_contiguous(const Arr_Desc *ap); // allocate element of CeanReadRanges type initialized // to read consequently contiguous ranges described by "ap" argument -CeanReadRanges * init_read_ranges_arr_desc(const arr_desc *ap); +DLL_LOCAL CeanReadRanges * init_read_ranges_arr_desc(const Arr_Desc *ap); -// check if ranges described by 1 argument could be transfered into ranges +// check if ranges described by 1 argument could be transferred into ranges // described by 2-nd one -bool cean_ranges_match( +DLL_LOCAL bool cean_ranges_match( CeanReadRanges * read_rng1, CeanReadRanges * read_rng2 ); @@ -90,27 +92,27 @@ bool cean_ranges_match( // first argument - returned value by call to init_read_ranges_arr_desc. // returns true if offset and length of next range is set successfuly. // returns false if the ranges is over. -bool get_next_range( +DLL_LOCAL bool get_next_range( CeanReadRanges * read_rng, int64_t *offset ); -// returns number of transfered bytes -int64_t cean_get_transf_size(CeanReadRanges * read_rng); +// returns number of transferred bytes +DLL_LOCAL int64_t cean_get_transf_size(CeanReadRanges * read_rng); #if OFFLOAD_DEBUG > 0 // prints array descriptor contents to stderr -void __arr_desc_dump( +DLL_LOCAL void __arr_desc_dump( const char *spaces, const char *name, - const arr_desc *adp, - bool dereference); + const Arr_Desc *adp, + bool dereference, + bool print_values); +#define ARRAY_DESC_DUMP(spaces, name, adp, dereference, print_values) \ + if (console_enabled >= 2) \ + __arr_desc_dump(spaces, name, adp, dereference, print_values); #else -#define __arr_desc_dump( - spaces, - name, - adp, - dereference) +#define ARRAY_DESC_DUMP(spaces, name, adp, dereference, print_values) #endif // OFFLOAD_DEBUG #endif // CEAN_UTIL_H_INCLUDED diff --git a/liboffloadmic/runtime/coi/coi_client.cpp b/liboffloadmic/runtime/coi/coi_client.cpp index 0fb2c398855..ca18e5f9525 100644 --- a/liboffloadmic/runtime/coi/coi_client.cpp +++ b/liboffloadmic/runtime/coi/coi_client.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -50,6 +50,13 @@ COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*, const void*, const char**, uint8_t, const char*, uint64_t, const char*, const char*, uint64_t, COIPROCESS*); +COIRESULT (*ProcessCreateFromFile)(COIENGINE, const char*, + int, const char**, uint8_t, + const char**, uint8_t, const char*, + uint64_t, const char*,COIPROCESS*); +COIRESULT (*ProcessSetCacheSize)(COIPROCESS, uint64_t, uint32_t, + uint64_t, uint32_t, uint32_t, + const COIEVENT*, COIEVENT*); COIRESULT (*ProcessDestroy)(COIPROCESS, int32_t, uint8_t, int8_t*, uint32_t*); COIRESULT (*ProcessGetFunctionHandles)(COIPROCESS, uint32_t, const char**, COIFUNCTION*); @@ -57,6 +64,8 @@ COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS, const void*, uint64_t, const char*, const char*, const char*, uint64_t, uint32_t, COILIBRARY*); +COIRESULT (*ProcessUnloadLibrary)(COIPROCESS, + COILIBRARY); COIRESULT (*ProcessRegisterLibraries)(uint32_t, const void**, const uint64_t*, const char**, const uint64_t*); @@ -80,6 +89,13 @@ COIRESULT (*BufferWrite)(COIBUFFER, uint64_t, const void*, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); COIRESULT (*BufferRead)(COIBUFFER, uint64_t, void*, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); +COIRESULT (*BufferReadMultiD)(COIBUFFER, uint64_t, + void *, void *, COI_COPY_TYPE, + uint32_t, const COIEVENT*, COIEVENT*); +COIRESULT (*BufferWriteMultiD)(COIBUFFER, const COIPROCESS, + uint64_t, void *, void *, + COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); + COIRESULT (*BufferCopy)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); COIRESULT (*BufferGetSinkAddress)(COIBUFFER, uint64_t*); @@ -92,6 +108,20 @@ COIRESULT (*EventWait)(uint16_t, const COIEVENT*, int32_t, uint8_t, uint32_t*, uint64_t (*PerfGetCycleFrequency)(void); +COIRESULT (*PipelineClearCPUMask) (COI_CPU_MASK); + +COIRESULT (*PipelineSetCPUMask) (COIPROCESS, uint32_t, + uint8_t, COI_CPU_MASK); +COIRESULT (*EngineGetInfo)(COIENGINE, uint32_t, COI_ENGINE_INFO*); + +COIRESULT (*EventRegisterCallback)( + const COIEVENT, + void (*)(COIEVENT, const COIRESULT, const void*), + const void*, + const uint64_t); + +COIRESULT (*ProcessConfigureDMA)(const uint64_t, const int); + bool init(void) { #ifndef TARGET_WINNT @@ -140,6 +170,32 @@ bool init(void) return false; } + ProcessSetCacheSize = + (COIRESULT (*)(COIPROCESS, uint64_t, uint32_t, + uint64_t, uint32_t, uint32_t, + const COIEVENT*, COIEVENT*)) + DL_sym(lib_handle, "COIProcessSetCacheSize", COI_VERSION1); + if (ProcessSetCacheSize == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIProcessSetCacheSize"); +#if 0 // for now disable as ProcessSetCacheSize is not available on < MPSS 3.4 + fini(); + return false; +#endif + } + + ProcessCreateFromFile = + (COIRESULT (*)(COIENGINE, const char*, int, const char**, uint8_t, + const char**, uint8_t, const char*, uint64_t, + const char*, COIPROCESS*)) + DL_sym(lib_handle, "COIProcessCreateFromFile", COI_VERSION1); + if (ProcessCreateFromFile == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIProcessCreateFromFile"); + fini(); + return false; + } + ProcessDestroy = (COIRESULT (*)(COIPROCESS, int32_t, uint8_t, int8_t*, uint32_t*)) @@ -173,6 +229,17 @@ bool init(void) return false; } + ProcessUnloadLibrary = + (COIRESULT (*)(COIPROCESS, + COILIBRARY)) + DL_sym(lib_handle, "COIProcessUnloadLibrary", COI_VERSION1); + if (ProcessUnloadLibrary == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIProcessUnloadLibrary"); + fini(); + return false; + } + ProcessRegisterLibraries = (COIRESULT (*)(uint32_t, const void**, const uint64_t*, const char**, const uint64_t*)) @@ -295,6 +362,22 @@ bool init(void) return false; } + BufferReadMultiD = + (COIRESULT (*)(COIBUFFER, uint64_t, + void *, void *, COI_COPY_TYPE, + uint32_t, const COIEVENT*, COIEVENT*)) + DL_sym(lib_handle, "COIBufferReadMultiD", COI_VERSION1); + // We accept that coi library has no COIBufferReadMultiD routine. + // So there is no check for zero value + + BufferWriteMultiD = + (COIRESULT (*)(COIBUFFER, const COIPROCESS, + uint64_t, void *, void *, + COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*)) + DL_sym(lib_handle, "COIBufferWriteMultiD", COI_VERSION1); + // We accept that coi library has no COIBufferWriteMultiD routine. + // So there is no check for zero value + BufferCopy = (COIRESULT (*)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, @@ -350,6 +433,47 @@ bool init(void) return false; } + PipelineClearCPUMask = + (COIRESULT (*)(COI_CPU_MASK)) + DL_sym(lib_handle, "COIPipelineClearCPUMask", COI_VERSION1); + if (PipelineClearCPUMask == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIPipelineClearCPUMask"); + fini(); + return false; + } + + PipelineSetCPUMask = + (COIRESULT (*)(COIPROCESS, uint32_t,uint8_t, COI_CPU_MASK)) + DL_sym(lib_handle, "COIPipelineSetCPUMask", COI_VERSION1); + if (PipelineSetCPUMask == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIPipelineSetCPUMask"); + fini(); + return false; + } + + EngineGetInfo = + (COIRESULT (*)(COIENGINE, uint32_t, COI_ENGINE_INFO*)) + DL_sym(lib_handle, "COIEngineGetInfo", COI_VERSION1); + if (COIEngineGetInfo == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in COI library\n", + "COIEngineGetInfo"); + fini(); + return false; + } + + EventRegisterCallback = + (COIRESULT (*)(COIEVENT, + void (*)(COIEVENT, const COIRESULT, const void*), + const void*, + const uint64_t)) + DL_sym(lib_handle, "COIEventRegisterCallback", COI_VERSION1); + + ProcessConfigureDMA = + (COIRESULT (*)(const uint64_t, const int)) + DL_sym(lib_handle, "COIProcessConfigureDMA", COI_VERSION1); + is_available = true; return true; diff --git a/liboffloadmic/runtime/coi/coi_client.h b/liboffloadmic/runtime/coi/coi_client.h index 54b83a9d965..9c91077aac6 100644 --- a/liboffloadmic/runtime/coi/coi_client.h +++ b/liboffloadmic/runtime/coi/coi_client.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,7 +28,7 @@ */ -// The interface betwen offload library and the COI API on the host +// The interface between offload library and the COI API on the host #ifndef COI_CLIENT_H_INCLUDED #define COI_CLIENT_H_INCLUDED @@ -54,16 +54,16 @@ // COI library interface namespace COI { -extern bool init(void); -extern void fini(void); +DLL_LOCAL extern bool init(void); +DLL_LOCAL extern void fini(void); -extern bool is_available; +DLL_LOCAL extern bool is_available; // pointers to functions from COI library -extern COIRESULT (*EngineGetCount)(COI_ISA_TYPE, uint32_t*); -extern COIRESULT (*EngineGetHandle)(COI_ISA_TYPE, uint32_t, COIENGINE*); +DLL_LOCAL extern COIRESULT (*EngineGetCount)(COI_ISA_TYPE, uint32_t*); +DLL_LOCAL extern COIRESULT (*EngineGetHandle)(COI_ISA_TYPE, uint32_t, COIENGINE*); -extern COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*, +DLL_LOCAL extern COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*, const void*, uint64_t, int, const char**, uint8_t, const char**, uint8_t, @@ -71,12 +71,23 @@ extern COIRESULT (*ProcessCreateFromMemory)(COIENGINE, const char*, const char*, const char*, uint64_t, COIPROCESS*); -extern COIRESULT (*ProcessDestroy)(COIPROCESS, int32_t, uint8_t, +DLL_LOCAL extern COIRESULT (*ProcessCreateFromFile)(COIENGINE, const char*, int, + const char**, uint8_t, + const char**, + uint8_t, + const char*, + uint64_t, + const char*, + COIPROCESS*); +DLL_LOCAL extern COIRESULT (*ProcessSetCacheSize)(COIPROCESS, uint64_t, uint32_t, + uint64_t, uint32_t, uint32_t, + const COIEVENT*, COIEVENT*); +DLL_LOCAL extern COIRESULT (*ProcessDestroy)(COIPROCESS, int32_t, uint8_t, int8_t*, uint32_t*); -extern COIRESULT (*ProcessGetFunctionHandles)(COIPROCESS, uint32_t, +DLL_LOCAL extern COIRESULT (*ProcessGetFunctionHandles)(COIPROCESS, uint32_t, const char**, COIFUNCTION*); -extern COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS, +DLL_LOCAL extern COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS, const void*, uint64_t, const char*, @@ -85,54 +96,80 @@ extern COIRESULT (*ProcessLoadLibraryFromMemory)(COIPROCESS, uint64_t, uint32_t, COILIBRARY*); -extern COIRESULT (*ProcessRegisterLibraries)(uint32_t, + +DLL_LOCAL extern COIRESULT (*ProcessUnloadLibrary)(COIPROCESS, + COILIBRARY); + +DLL_LOCAL extern COIRESULT (*ProcessRegisterLibraries)(uint32_t, const void**, const uint64_t*, const char**, const uint64_t*); -extern COIRESULT (*PipelineCreate)(COIPROCESS, COI_CPU_MASK, uint32_t, +DLL_LOCAL extern COIRESULT (*PipelineCreate)(COIPROCESS, COI_CPU_MASK, uint32_t, COIPIPELINE*); -extern COIRESULT (*PipelineDestroy)(COIPIPELINE); -extern COIRESULT (*PipelineRunFunction)(COIPIPELINE, COIFUNCTION, +DLL_LOCAL extern COIRESULT (*PipelineDestroy)(COIPIPELINE); +DLL_LOCAL extern COIRESULT (*PipelineRunFunction)(COIPIPELINE, COIFUNCTION, uint32_t, const COIBUFFER*, const COI_ACCESS_FLAGS*, uint32_t, const COIEVENT*, const void*, uint16_t, void*, uint16_t, COIEVENT*); -extern COIRESULT (*BufferCreate)(uint64_t, COI_BUFFER_TYPE, uint32_t, +DLL_LOCAL extern COIRESULT (*BufferCreate)(uint64_t, COI_BUFFER_TYPE, uint32_t, const void*, uint32_t, const COIPROCESS*, COIBUFFER*); -extern COIRESULT (*BufferCreateFromMemory)(uint64_t, COI_BUFFER_TYPE, +DLL_LOCAL extern COIRESULT (*BufferCreateFromMemory)(uint64_t, COI_BUFFER_TYPE, uint32_t, void*, uint32_t, const COIPROCESS*, COIBUFFER*); -extern COIRESULT (*BufferDestroy)(COIBUFFER); -extern COIRESULT (*BufferMap)(COIBUFFER, uint64_t, uint64_t, +DLL_LOCAL extern COIRESULT (*BufferDestroy)(COIBUFFER); +DLL_LOCAL extern COIRESULT (*BufferMap)(COIBUFFER, uint64_t, uint64_t, COI_MAP_TYPE, uint32_t, const COIEVENT*, COIEVENT*, COIMAPINSTANCE*, void**); -extern COIRESULT (*BufferUnmap)(COIMAPINSTANCE, uint32_t, +DLL_LOCAL extern COIRESULT (*BufferUnmap)(COIMAPINSTANCE, uint32_t, const COIEVENT*, COIEVENT*); -extern COIRESULT (*BufferWrite)(COIBUFFER, uint64_t, const void*, +DLL_LOCAL extern COIRESULT (*BufferWrite)(COIBUFFER, uint64_t, const void*, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); -extern COIRESULT (*BufferRead)(COIBUFFER, uint64_t, void*, uint64_t, +DLL_LOCAL extern COIRESULT (*BufferRead)(COIBUFFER, uint64_t, void*, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); -extern COIRESULT (*BufferCopy)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, +DLL_LOCAL extern COIRESULT (*BufferReadMultiD)(COIBUFFER, uint64_t, + void *, void *, COI_COPY_TYPE, + uint32_t, const COIEVENT*, COIEVENT*); +DLL_LOCAL extern COIRESULT (*BufferWriteMultiD)(COIBUFFER, const COIPROCESS, + uint64_t, void *, void *, + COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); + +DLL_LOCAL extern COIRESULT (*BufferCopy)(COIBUFFER, COIBUFFER, uint64_t, uint64_t, uint64_t, COI_COPY_TYPE, uint32_t, const COIEVENT*, COIEVENT*); -extern COIRESULT (*BufferGetSinkAddress)(COIBUFFER, uint64_t*); -extern COIRESULT (*BufferSetState)(COIBUFFER, COIPROCESS, COI_BUFFER_STATE, +DLL_LOCAL extern COIRESULT (*BufferGetSinkAddress)(COIBUFFER, uint64_t*); +DLL_LOCAL extern COIRESULT (*BufferSetState)(COIBUFFER, COIPROCESS, COI_BUFFER_STATE, COI_BUFFER_MOVE_FLAG, uint32_t, const COIEVENT*, COIEVENT*); -extern COIRESULT (*EventWait)(uint16_t, const COIEVENT*, int32_t, +DLL_LOCAL extern COIRESULT (*EventWait)(uint16_t, const COIEVENT*, int32_t, uint8_t, uint32_t*, uint32_t*); -extern uint64_t (*PerfGetCycleFrequency)(void); +DLL_LOCAL extern uint64_t (*PerfGetCycleFrequency)(void); + +DLL_LOCAL extern COIRESULT (*ProcessConfigureDMA)(const uint64_t, const int); + +extern COIRESULT (*PipelineClearCPUMask)(COI_CPU_MASK); + +extern COIRESULT (*PipelineSetCPUMask)(COIPROCESS, uint32_t, + uint8_t, COI_CPU_MASK); +extern COIRESULT (*EngineGetInfo)(COIENGINE, uint32_t, COI_ENGINE_INFO*); +extern COIRESULT (*EventRegisterCallback)( + const COIEVENT, + void (*)(COIEVENT, const COIRESULT, const void*), + const void*, + const uint64_t); + +const int DMA_MODE_READ_WRITE = 1; } // namespace COI #endif // COI_CLIENT_H_INCLUDED diff --git a/liboffloadmic/runtime/coi/coi_server.cpp b/liboffloadmic/runtime/coi/coi_server.cpp index 7eebf5a306e..88dde9157da 100644 --- a/liboffloadmic/runtime/coi/coi_server.cpp +++ b/liboffloadmic/runtime/coi/coi_server.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -38,6 +38,22 @@ #include "../offload_myo_target.h" // for __offload_myoLibInit/Fini #endif // MYO_SUPPORT +#if !defined(CPU_COUNT) +// if CPU_COUNT is not defined count number of CPUs manually +static +int my_cpu_count(cpu_set_t const *cpu_set) +{ + int res = 0; + for (int i = 0; i < sizeof(cpu_set_t) / sizeof(__cpu_mask); ++i) { + res += __builtin_popcountl(cpu_set->__bits[i]); + } + return res; +} +// Map CPU_COUNT to our function +#define CPU_COUNT(x) my_cpu_count(x) + +#endif + COINATIVELIBEXPORT void server_compute( uint32_t buffer_count, @@ -118,6 +134,20 @@ void server_var_table_copy( __offload_vars.table_copy(buffers[0], *static_cast<int64_t*>(misc_data)); } +COINATIVELIBEXPORT +void server_set_stream_affinity( + uint32_t buffer_count, + void** buffers, + uint64_t* buffers_len, + void* misc_data, + uint16_t misc_data_len, + void* return_data, + uint16_t return_data_len +) +{ + /* kmp affinity is not supported by GCC. */ +} + #ifdef MYO_SUPPORT // temporary workaround for blocking behavior of myoiLibInit/Fini calls COINATIVELIBEXPORT diff --git a/liboffloadmic/runtime/coi/coi_server.h b/liboffloadmic/runtime/coi/coi_server.h index 14376108e9d..2ea67b79562 100644 --- a/liboffloadmic/runtime/coi/coi_server.h +++ b/liboffloadmic/runtime/coi/coi_server.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,7 +28,7 @@ */ -//The interface betwen offload library and the COI API on the target. +// The interface between offload library and the COI API on the target #ifndef COI_SERVER_H_INCLUDED #define COI_SERVER_H_INCLUDED diff --git a/liboffloadmic/runtime/compiler_if_host.cpp b/liboffloadmic/runtime/compiler_if_host.cpp index c4e2a15633f..7bac0e54de8 100644 --- a/liboffloadmic/runtime/compiler_if_host.cpp +++ b/liboffloadmic/runtime/compiler_if_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -35,7 +35,7 @@ #include <alloca.h> #endif // TARGET_WINNT -// Global counter on host. +// Global counter on host. // This variable is used if P2OPT_offload_do_data_persistence == 2. // The variable used to identify offload constructs contained in one procedure. // Increment of OFFLOAD_CALL_COUNT is inserted at entries of HOST routines with @@ -72,7 +72,7 @@ extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE( OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize); - // initalize all devices is init_type is on_offload_all + // initialize all devices is init_type is on_offload_all if (retval && __offload_init_type == c_init_on_offload_all) { for (int i = 0; i < mic_engines_total; i++) { mic_engines[i].init(); @@ -241,7 +241,128 @@ extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1( return ofld; } -int offload_offload_wrap( +extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE2( + TARGET_TYPE target_type, + int target_number, + int is_optional, + _Offload_status* status, + const char* file, + uint64_t line, + const void** stream +) +{ + bool retval; + OFFLOAD ofld; + + // initialize status + if (status != 0) { + status->result = OFFLOAD_UNAVAILABLE; + status->device_number = -1; + status->data_sent = 0; + status->data_received = 0; + } + + // make sure libray is initialized + retval = __offload_init_library(); + // OFFLOAD_TIMER_INIT must follow call to __offload_init_library + OffloadHostTimerData * timer_data = OFFLOAD_TIMER_INIT(file, line); + + OFFLOAD_TIMER_START(timer_data, c_offload_host_total_offload); + + OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize); + + // initalize all devices if init_type is on_offload_all + if (retval && __offload_init_type == c_init_on_offload_all) { + for (int i = 0; i < mic_engines_total; i++) { + mic_engines[i].init(); + } + } + OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize); + + OFFLOAD_TIMER_START(timer_data, c_offload_host_target_acquire); + + if (target_type == TARGET_HOST) { + // Host always available + retval = true; + } + else if (target_type == TARGET_MIC) { + _Offload_stream handle = *(reinterpret_cast<_Offload_stream*>(stream)); + Stream * stream = handle ? Stream::find_stream(handle, false) : NULL; + if (target_number >= -1) { + if (retval) { + // device number is defined by stream + if (stream) { + target_number = stream->get_device(); + target_number = target_number % mic_engines_total; + } + + // reserve device in ORSL + if (target_number != -1) { + if (is_optional) { + if (!ORSL::try_reserve(target_number)) { + target_number = -1; + } + } + else { + if (!ORSL::reserve(target_number)) { + target_number = -1; + } + } + } + + // initialize device + if (target_number >= 0 && + __offload_init_type == c_init_on_offload) { + OFFLOAD_TIMER_START(timer_data, c_offload_host_initialize); + mic_engines[target_number].init(); + OFFLOAD_TIMER_STOP(timer_data, c_offload_host_initialize); + } + } + else { + // fallback to CPU + target_number = -1; + } + if (!(target_number == -1 && handle == 0)) { + if (target_number < 0 || !retval) { + if (!is_optional && status == 0) { + LIBOFFLOAD_ERROR(c_device_is_not_available); + exit(1); + } + + retval = false; + } + } + } + else { + LIBOFFLOAD_ERROR(c_invalid_device_number); + exit(1); + } + } + + if (retval) { + ofld = new OffloadDescriptor(target_number, status, + !is_optional, false, timer_data); + OFFLOAD_TIMER_HOST_MIC_NUM(timer_data, target_number); + Offload_Report_Prolog(timer_data); + OFFLOAD_DEBUG_TRACE_1(2, timer_data->offload_number, c_offload_start, + "Starting offload: target_type = %d, " + "number = %d, is_optional = %d\n", + target_type, target_number, is_optional); + + OFFLOAD_TIMER_STOP(timer_data, c_offload_host_target_acquire); + } + else { + ofld = NULL; + + OFFLOAD_TIMER_STOP(timer_data, c_offload_host_target_acquire); + OFFLOAD_TIMER_STOP(timer_data, c_offload_host_total_offload); + offload_report_free_data(timer_data); + } + + return ofld; +} + +static int offload_offload_wrap( OFFLOAD ofld, const char *name, int is_empty, @@ -252,12 +373,15 @@ int offload_offload_wrap( const void **waits, const void **signal, int entry_id, - const void *stack_addr + const void *stack_addr, + OffloadFlags offload_flags ) { bool ret = ofld->offload(name, is_empty, vars, vars2, num_vars, - waits, num_waits, signal, entry_id, stack_addr); - if (!ret || signal == 0) { + waits, num_waits, signal, entry_id, + stack_addr, offload_flags); + if (!ret || (signal == 0 && ofld->get_stream() == 0 && + !offload_flags.bits.omp_async)) { delete ofld; } return ret; @@ -278,7 +402,7 @@ extern "C" int OFFLOAD_OFFLOAD1( return offload_offload_wrap(ofld, name, is_empty, num_vars, vars, vars2, num_waits, waits, - signal, NULL, NULL); + signal, 0, NULL, {0}); } extern "C" int OFFLOAD_OFFLOAD2( @@ -298,7 +422,35 @@ extern "C" int OFFLOAD_OFFLOAD2( return offload_offload_wrap(ofld, name, is_empty, num_vars, vars, vars2, num_waits, waits, - signal, entry_id, stack_addr); + signal, entry_id, stack_addr, {0}); +} + +extern "C" int OFFLOAD_OFFLOAD3( + OFFLOAD ofld, + const char *name, + int is_empty, + int num_vars, + VarDesc *vars, + VarDesc2 *vars2, + int num_waits, + const void** waits, + const void** signal, + int entry_id, + const void *stack_addr, + OffloadFlags offload_flags, + const void** stream +) +{ + // 1. if the source is compiled with -traceback then stream is 0 + // 2. if offload has a stream clause then stream is address of stream value + if (stream) { + ofld->set_stream(*(reinterpret_cast<_Offload_stream *>(stream))); + } + + return offload_offload_wrap(ofld, name, is_empty, + num_vars, vars, vars2, + num_waits, waits, + signal, entry_id, stack_addr, offload_flags); } extern "C" int OFFLOAD_OFFLOAD( diff --git a/liboffloadmic/runtime/compiler_if_host.h b/liboffloadmic/runtime/compiler_if_host.h index 1a7135088f6..b8f36db7de5 100644 --- a/liboffloadmic/runtime/compiler_if_host.h +++ b/liboffloadmic/runtime/compiler_if_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -39,9 +39,11 @@ #define OFFLOAD_TARGET_ACQUIRE OFFLOAD_PREFIX(target_acquire) #define OFFLOAD_TARGET_ACQUIRE1 OFFLOAD_PREFIX(target_acquire1) +#define OFFLOAD_TARGET_ACQUIRE2 OFFLOAD_PREFIX(target_acquire2) #define OFFLOAD_OFFLOAD OFFLOAD_PREFIX(offload) #define OFFLOAD_OFFLOAD1 OFFLOAD_PREFIX(offload1) #define OFFLOAD_OFFLOAD2 OFFLOAD_PREFIX(offload2) +#define OFFLOAD_OFFLOAD3 OFFLOAD_PREFIX(offload3) #define OFFLOAD_CALL_COUNT OFFLOAD_PREFIX(offload_call_count) @@ -75,6 +77,26 @@ extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE1( uint64_t line ); +/*! \fn OFFLOAD_TARGET_ACQUIRE2 + \brief Attempt to acquire the target. + \param target_type The type of target. + \param target_number The device number. + \param is_optional Whether CPU fall-back is allowed. + \param status Address of variable to hold offload status. + \param file Filename in which this offload occurred. + \param line Line number in the file where this offload occurred. + \param stream Pointer to stream value. +*/ +extern "C" OFFLOAD OFFLOAD_TARGET_ACQUIRE2( + TARGET_TYPE target_type, + int target_number, + int is_optional, + _Offload_status* status, + const char* file, + uint64_t line, + const void** stream +); + /*! \fn OFFLOAD_OFFLOAD1 \brief Run function on target using interface for old data persistence. \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE. @@ -127,6 +149,40 @@ extern "C" int OFFLOAD_OFFLOAD2( const void *stack_addr ); + +/*! \fn OFFLOAD_OFFLOAD3 + \brief Run function on target, API introduced in 15.0 Update 1 + \brief when targetptr, preallocated feature was introduced. + \param o Offload descriptor created by OFFLOAD_TARGET_ACQUIRE. + \param name Name of offload entry point. + \param is_empty If no code to execute (e.g. offload_transfer) + \param num_vars Number of variable descriptors. + \param vars Pointer to VarDesc array. + \param vars2 Pointer to VarDesc2 array. + \param num_waits Number of "wait" values. + \param waits Pointer to array of wait values. + \param signal Pointer to signal value or NULL. + \param entry_id A signature for the function doing the offload. + \param stack_addr The stack frame address of the function doing offload. + \param offload_flags Flags to indicate Fortran traceback, OpenMP async. + \param stream Pointer to stream value or NULL. +*/ +extern "C" int OFFLOAD_OFFLOAD3( + OFFLOAD ofld, + const char *name, + int is_empty, + int num_vars, + VarDesc *vars, + VarDesc2 *vars2, + int num_waits, + const void** waits, + const void** signal, + int entry_id, + const void *stack_addr, + OffloadFlags offload_flags, + const void** stream +); + // Run function on target (obsolete). // @param o OFFLOAD object // @param name function name diff --git a/liboffloadmic/runtime/compiler_if_target.cpp b/liboffloadmic/runtime/compiler_if_target.cpp index 839ef14ed63..bc51d242ef0 100644 --- a/liboffloadmic/runtime/compiler_if_target.cpp +++ b/liboffloadmic/runtime/compiler_if_target.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/compiler_if_target.h b/liboffloadmic/runtime/compiler_if_target.h index c4de1260d34..9554238916c 100644 --- a/liboffloadmic/runtime/compiler_if_target.h +++ b/liboffloadmic/runtime/compiler_if_target.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/dv_util.cpp b/liboffloadmic/runtime/dv_util.cpp index 63f50592e00..e31714b8d41 100644 --- a/liboffloadmic/runtime/dv_util.cpp +++ b/liboffloadmic/runtime/dv_util.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -102,8 +102,8 @@ CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp) } res = (CeanReadRanges *)malloc( sizeof(CeanReadRanges) + (rank - i) * sizeof(CeanReadDim)); - if (res == NULL) - LIBOFFLOAD_ERROR(c_malloc); + if (res == NULL) + LIBOFFLOAD_ERROR(c_malloc); res -> last_noncont_ind = rank - i - 1; count = 1; for (; i < rank; i++) { diff --git a/liboffloadmic/runtime/dv_util.h b/liboffloadmic/runtime/dv_util.h index d62cecc6aa1..9095c32c510 100644 --- a/liboffloadmic/runtime/dv_util.h +++ b/liboffloadmic/runtime/dv_util.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #define DV_UTIL_H_INCLUDED #include <stdint.h> +#include "offload_util.h" // Dope vector declarations #define ArrDescMaxArrayRank 31 @@ -64,18 +65,18 @@ typedef struct ArrDesc { typedef ArrDesc* pArrDesc; -bool __dv_is_contiguous(const ArrDesc *dvp); +DLL_LOCAL bool __dv_is_contiguous(const ArrDesc *dvp); -bool __dv_is_allocated(const ArrDesc *dvp); +DLL_LOCAL bool __dv_is_allocated(const ArrDesc *dvp); -uint64_t __dv_data_length(const ArrDesc *dvp); +DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp); -uint64_t __dv_data_length(const ArrDesc *dvp, int64_t nelems); +DLL_LOCAL uint64_t __dv_data_length(const ArrDesc *dvp, int64_t nelems); -CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp); +DLL_LOCAL CeanReadRanges * init_read_ranges_dv(const ArrDesc *dvp); #if OFFLOAD_DEBUG > 0 -void __dv_desc_dump(const char *name, const ArrDesc *dvp); +DLL_LOCAL void __dv_desc_dump(const char *name, const ArrDesc *dvp); #else // OFFLOAD_DEBUG #define __dv_desc_dump(name, dvp) #endif // OFFLOAD_DEBUG diff --git a/liboffloadmic/runtime/emulator/coi_common.h b/liboffloadmic/runtime/emulator/coi_common.h index 482c8885437..7eae324ee74 100644 --- a/liboffloadmic/runtime/emulator/coi_common.h +++ b/liboffloadmic/runtime/emulator/coi_common.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -62,8 +62,8 @@ /* Environment variable for target executable run command. */ #define OFFLOAD_EMUL_RUN_ENV "OFFLOAD_EMUL_RUN" -/* Environment variable for number ok KNC devices. */ -#define OFFLOAD_EMUL_KNC_NUM_ENV "OFFLOAD_EMUL_KNC_NUM" +/* Environment variable for number of emulated devices. */ +#define OFFLOAD_EMUL_NUM_ENV "OFFLOAD_EMUL_NUM" /* Path to engine directory. */ @@ -133,6 +133,7 @@ typedef enum CMD_BUFFER_UNMAP, CMD_GET_FUNCTION_HANDLE, CMD_OPEN_LIBRARY, + CMD_CLOSE_LIBRARY, CMD_RUN_FUNCTION, CMD_SHUTDOWN } cmd_t; diff --git a/liboffloadmic/runtime/emulator/coi_device.cpp b/liboffloadmic/runtime/emulator/coi_device.cpp index 1a89a3f55df..8773a7910ce 100644 --- a/liboffloadmic/runtime/emulator/coi_device.cpp +++ b/liboffloadmic/runtime/emulator/coi_device.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -109,8 +109,8 @@ SYMBOL_VERSION (COIProcessWaitForShutdown, 1) () strlen (PIPE_HOST_PATH) + strlen (mic_dir) + 1); MALLOC (char *, pipe_target_path, strlen (PIPE_TARGET_PATH) + strlen (mic_dir) + 1); - sprintf (pipe_host_path, "%s"PIPE_HOST_PATH, mic_dir); - sprintf (pipe_target_path, "%s"PIPE_TARGET_PATH, mic_dir); + sprintf (pipe_host_path, "%s" PIPE_HOST_PATH, mic_dir); + sprintf (pipe_target_path, "%s" PIPE_TARGET_PATH, mic_dir); pipe_host = open (pipe_host_path, O_CLOEXEC | O_WRONLY); if (pipe_host < 0) COIERROR ("Cannot open target-to-host pipe."); @@ -237,6 +237,7 @@ SYMBOL_VERSION (COIProcessWaitForShutdown, 1) () { char *lib_path; size_t len; + void *handle; /* Receive data from host. */ READ (pipe_target, &len, sizeof (size_t)); @@ -244,14 +245,28 @@ SYMBOL_VERSION (COIProcessWaitForShutdown, 1) () READ (pipe_target, lib_path, len); /* Open library. */ - if (dlopen (lib_path, RTLD_LAZY | RTLD_GLOBAL) == 0) + handle = dlopen (lib_path, RTLD_LAZY | RTLD_GLOBAL); + if (handle == NULL) COIERROR ("Cannot load %s: %s", lib_path, dlerror ()); + /* Send data to host. */ + WRITE (pipe_host, &handle, sizeof (void *)); + /* Clean up. */ free (lib_path); break; } + case CMD_CLOSE_LIBRARY: + { + /* Receive data from host. */ + void *handle; + READ (pipe_target, &handle, sizeof (void *)); + + dlclose (handle); + + break; + } case CMD_RUN_FUNCTION: { uint16_t misc_data_len, return_data_len; diff --git a/liboffloadmic/runtime/emulator/coi_device.h b/liboffloadmic/runtime/emulator/coi_device.h index 779fdae69e7..616c91849ac 100644 --- a/liboffloadmic/runtime/emulator/coi_device.h +++ b/liboffloadmic/runtime/emulator/coi_device.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/emulator/coi_host.cpp b/liboffloadmic/runtime/emulator/coi_host.cpp index 3425920a4a1..cdc04c208e4 100644 --- a/liboffloadmic/runtime/emulator/coi_host.cpp +++ b/liboffloadmic/runtime/emulator/coi_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -40,8 +40,8 @@ extern char **environ; char **tmp_dirs; unsigned tmp_dirs_num = 0; -/* Number of KNC engines. */ -long knc_engines_num; +/* Number of emulated MIC engines. */ +long num_engines; /* Mutex to sync parallel execution. */ pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; @@ -116,8 +116,7 @@ __attribute__((constructor)) static void init () { - if (read_long_env (OFFLOAD_EMUL_KNC_NUM_ENV, &knc_engines_num, 1) - == COI_ERROR) + if (read_long_env (OFFLOAD_EMUL_NUM_ENV, &num_engines, 1) == COI_ERROR) exit (0); } @@ -665,10 +664,10 @@ SYMBOL_VERSION (COIEngineGetCount, 1) (COI_ISA_TYPE isa, COITRACE ("COIEngineGetCount"); /* Features of liboffload. */ - assert (isa == COI_ISA_KNC); + assert (isa == COI_ISA_MIC); /* Prepare output arguments. */ - *count = knc_engines_num; + *count = num_engines; return COI_SUCCESS; } @@ -684,10 +683,10 @@ SYMBOL_VERSION (COIEngineGetHandle, 1) (COI_ISA_TYPE isa, Engine *engine; /* Features of liboffload. */ - assert (isa == COI_ISA_KNC); + assert (isa == COI_ISA_MIC); /* Check engine index. */ - if (index >= knc_engines_num) + if (index >= num_engines) COIERROR ("Wrong engine index."); /* Create engine handle. */ @@ -889,7 +888,7 @@ SYMBOL_VERSION (COIProcessCreateFromMemory, 1) (COIENGINE engine, /* Create directory for pipes to prevent names collision. */ MALLOC (char *, pipes_path, strlen (PIPES_PATH) + strlen (eng->dir) + 1); - sprintf (pipes_path, "%s"PIPES_PATH, eng->dir); + sprintf (pipes_path, "%s" PIPES_PATH, eng->dir); if (mkdir (pipes_path, S_IRWXU) < 0) COIERROR ("Cannot create folder %s.", pipes_path); @@ -900,8 +899,8 @@ SYMBOL_VERSION (COIProcessCreateFromMemory, 1) (COIENGINE engine, strlen (PIPE_TARGET_PATH) + strlen (eng->dir) + 1); if (pipe_target_path == NULL) COIERROR ("Cannot allocate memory."); - sprintf (pipe_host_path, "%s"PIPE_HOST_PATH, eng->dir); - sprintf (pipe_target_path, "%s"PIPE_TARGET_PATH, eng->dir); + sprintf (pipe_host_path, "%s" PIPE_HOST_PATH, eng->dir); + sprintf (pipe_target_path, "%s" PIPE_TARGET_PATH, eng->dir); if (mkfifo (pipe_host_path, S_IRUSR | S_IWUSR) < 0) COIERROR ("Cannot create pipe %s.", pipe_host_path); if (mkfifo (pipe_target_path, S_IRUSR | S_IWUSR) < 0) @@ -1019,6 +1018,27 @@ SYMBOL_VERSION (COIProcessCreateFromMemory, 1) (COIENGINE engine, COIRESULT +SYMBOL_VERSION (COIProcessCreateFromFile, 1) (COIENGINE in_Engine, + const char *in_pBinaryName, + int in_Argc, + const char **in_ppArgv, + uint8_t in_DupEnv, + const char **in_ppAdditionalEnv, + uint8_t in_ProxyActive, + const char *in_Reserved, + uint64_t in_BufferSpace, + const char *in_LibrarySearchPath, + COIPROCESS *out_pProcess) +{ + COITRACE ("COIProcessCreateFromFile"); + + /* liboffloadmic with GCC compiled binaries should never go here. */ + assert (false); + return COI_ERROR; +} + + +COIRESULT SYMBOL_VERSION (COIProcessDestroy, 1) (COIPROCESS process, int32_t wait_timeout, // Ignored uint8_t force, @@ -1129,38 +1149,39 @@ SYMBOL_VERSION (COIProcessGetFunctionHandles, 1) (COIPROCESS process, COIRESULT -SYMBOL_VERSION (COIProcessLoadLibraryFromMemory, 2) (COIPROCESS process, - const void *lib_buffer, - uint64_t lib_buffer_len, - const char *lib_name, - const char *lib_search_path, - const char *file_of_origin, // Ignored - uint64_t file_from_origin_offset, // Ignored - uint32_t flags, // Ignored - COILIBRARY *library) // Ignored +SYMBOL_VERSION (COIProcessLoadLibraryFromMemory, 2) (COIPROCESS in_Process, + const void *in_pLibraryBuffer, + uint64_t in_LibraryBufferLength, + const char *in_pLibraryName, + const char *in_LibrarySearchPath, // Ignored + const char *in_FileOfOrigin, // Ignored + uint64_t in_FileOfOriginOffset, // Ignored + uint32_t in_Flags, // Ignored + COILIBRARY *out_pLibrary) { COITRACE ("COIProcessLoadLibraryFromMemory"); + const cmd_t cmd = CMD_OPEN_LIBRARY; char *lib_path; - cmd_t cmd = CMD_OPEN_LIBRARY; int fd; FILE *file; size_t len; /* Convert input arguments. */ - Process *proc = (Process *) process; + Process *proc = (Process *) in_Process; /* Create target library file. */ MALLOC (char *, lib_path, - strlen (proc->engine->dir) + strlen (lib_name) + 2); - sprintf (lib_path, "%s/%s", proc->engine->dir, lib_name); + strlen (proc->engine->dir) + strlen (in_pLibraryName) + 2); + sprintf (lib_path, "%s/%s", proc->engine->dir, in_pLibraryName); fd = open (lib_path, O_CLOEXEC | O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) COIERROR ("Cannot create file %s.", lib_path); file = fdopen (fd, "wb"); if (file == NULL) COIERROR ("Cannot associate stream with file descriptor."); - if (fwrite (lib_buffer, 1, lib_buffer_len, file) != lib_buffer_len) + if (fwrite (in_pLibraryBuffer, 1, in_LibraryBufferLength, file) + != in_LibraryBufferLength) COIERROR ("Cannot write in file %s.", lib_path); if (fclose (file) != 0) COIERROR ("Cannot close file %s.", lib_path); @@ -1176,6 +1197,10 @@ SYMBOL_VERSION (COIProcessLoadLibraryFromMemory, 2) (COIPROCESS process, WRITE (proc->pipeline->pipe_target, &len, sizeof (size_t)); WRITE (proc->pipeline->pipe_target, lib_path, len); + /* Receive data from target. */ + void *handle; + READ (proc->pipeline->pipe_host, &handle, sizeof (void *)); + /* Finish critical section. */ if (pthread_mutex_unlock (&mutex) != 0) COIERROR ("Cannot unlock mutex."); @@ -1183,6 +1208,7 @@ SYMBOL_VERSION (COIProcessLoadLibraryFromMemory, 2) (COIPROCESS process, /* Clean up. */ free (lib_path); + *out_pLibrary = (COILIBRARY) handle; return COI_SUCCESS; } @@ -1202,6 +1228,33 @@ SYMBOL_VERSION (COIProcessRegisterLibraries, 1) (uint32_t libraries_num, } +COIRESULT +SYMBOL_VERSION (COIProcessUnloadLibrary, 1) (COIPROCESS in_Process, + COILIBRARY in_Library) +{ + COITRACE ("COIProcessUnloadLibrary"); + + const cmd_t cmd = CMD_CLOSE_LIBRARY; + + /* Convert input arguments. */ + Process *proc = (Process *) in_Process; + + /* Start critical section. */ + if (pthread_mutex_lock (&mutex) != 0) + COIERROR ("Cannot lock mutex."); + + /* Make target close library. */ + WRITE (proc->pipeline->pipe_target, &cmd, sizeof (cmd_t)); + WRITE (proc->pipeline->pipe_target, &in_Library, sizeof (void *)); + + /* Finish critical section. */ + if (pthread_mutex_unlock (&mutex) != 0) + COIERROR ("Cannot unlock mutex."); + + return COI_SUCCESS; +} + + uint64_t SYMBOL_VERSION (COIPerfGetCycleFrequency, 1) () { @@ -1210,5 +1263,51 @@ SYMBOL_VERSION (COIPerfGetCycleFrequency, 1) () return (uint64_t) CYCLE_FREQUENCY; } + +COIRESULT +SYMBOL_VERSION (COIPipelineClearCPUMask, 1) (COI_CPU_MASK *in_Mask) +{ + COITRACE ("COIPipelineClearCPUMask"); + + /* Looks like we have nothing to do here. */ + + return COI_SUCCESS; +} + + +COIRESULT +SYMBOL_VERSION (COIPipelineSetCPUMask, 1) (COIPROCESS in_Process, + uint32_t in_CoreID, + uint8_t in_ThreadID, + COI_CPU_MASK *out_pMask) +{ + COITRACE ("COIPipelineSetCPUMask"); + + /* Looks like we have nothing to do here. */ + + return COI_SUCCESS; +} + + +COIRESULT +SYMBOL_VERSION (COIEngineGetInfo, 1) (COIENGINE in_EngineHandle, + uint32_t in_EngineInfoSize, + COI_ENGINE_INFO *out_pEngineInfo) +{ + COITRACE ("COIEngineGetInfo"); + + out_pEngineInfo->ISA = COI_ISA_x86_64; + out_pEngineInfo->NumCores = 1; + out_pEngineInfo->NumThreads = 8; + out_pEngineInfo->CoreMaxFrequency = SYMBOL_VERSION(COIPerfGetCycleFrequency,1)() / 1000000; + out_pEngineInfo->PhysicalMemory = 1024; + out_pEngineInfo->PhysicalMemoryFree = 1024; + out_pEngineInfo->SwapMemory = 1024; + out_pEngineInfo->SwapMemoryFree = 1024; + out_pEngineInfo->MiscFlags = COI_ENG_ECC_DISABLED; + + return COI_SUCCESS; +} + } // extern "C" diff --git a/liboffloadmic/runtime/emulator/coi_host.h b/liboffloadmic/runtime/emulator/coi_host.h index 58ebd97ed7e..82260da9db9 100644 --- a/liboffloadmic/runtime/emulator/coi_host.h +++ b/liboffloadmic/runtime/emulator/coi_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/emulator/coi_version_asm.h b/liboffloadmic/runtime/emulator/coi_version_asm.h index 672d062d72f..25806391b29 100644 --- a/liboffloadmic/runtime/emulator/coi_version_asm.h +++ b/liboffloadmic/runtime/emulator/coi_version_asm.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -38,31 +38,54 @@ * intellectual property rights is granted herein. */ -__asm__ (".symver COIBufferAddRef1,COIBufferAddRef@@COI_1.0"); -__asm__ (".symver COIBufferCopy1,COIBufferCopy@@COI_1.0"); -__asm__ (".symver COIBufferCreate1,COIBufferCreate@@COI_1.0"); -__asm__ (".symver COIBufferCreateFromMemory1,COIBufferCreateFromMemory@@COI_1.0"); -__asm__ (".symver COIBufferDestroy1,COIBufferDestroy@@COI_1.0"); -__asm__ (".symver COIBufferGetSinkAddress1,COIBufferGetSinkAddress@@COI_1.0"); -__asm__ (".symver COIBufferMap1,COIBufferMap@@COI_1.0"); -__asm__ (".symver COIBufferRead1,COIBufferRead@@COI_1.0"); -__asm__ (".symver COIBufferReleaseRef1,COIBufferReleaseRef@@COI_1.0"); -__asm__ (".symver COIBufferSetState1,COIBufferSetState@@COI_1.0"); -__asm__ (".symver COIBufferUnmap1,COIBufferUnmap@@COI_1.0"); -__asm__ (".symver COIBufferWrite1,COIBufferWrite@@COI_1.0"); -__asm__ (".symver COIEngineGetCount1,COIEngineGetCount@@COI_1.0"); -__asm__ (".symver COIEngineGetHandle1,COIEngineGetHandle@@COI_1.0"); -__asm__ (".symver COIEngineGetIndex1,COIEngineGetIndex@@COI_1.0"); -__asm__ (".symver COIEventWait1,COIEventWait@@COI_1.0"); -__asm__ (".symver COIPerfGetCycleFrequency1,COIPerfGetCycleFrequency@@COI_1.0"); -__asm__ (".symver COIPipelineCreate1,COIPipelineCreate@@COI_1.0"); -__asm__ (".symver COIPipelineDestroy1,COIPipelineDestroy@@COI_1.0"); -__asm__ (".symver COIPipelineRunFunction1,COIPipelineRunFunction@@COI_1.0"); -__asm__ (".symver COIPipelineStartExecutingRunFunctions1,COIPipelineStartExecutingRunFunctions@@COI_1.0"); -__asm__ (".symver COIProcessCreateFromMemory1,COIProcessCreateFromMemory@@COI_1.0"); -__asm__ (".symver COIProcessDestroy1,COIProcessDestroy@@COI_1.0"); -__asm__ (".symver COIProcessGetFunctionHandles1,COIProcessGetFunctionHandles@@COI_1.0"); -__asm__ (".symver COIProcessLoadLibraryFromMemory2,COIProcessLoadLibraryFromMemory@COI_2.0"); -__asm__ (".symver COIProcessRegisterLibraries1,COIProcessRegisterLibraries@@COI_1.0"); -__asm__ (".symver COIProcessWaitForShutdown1,COIProcessWaitForShutdown@@COI_1.0"); - +// Originally generated via: +// cd include; +// ctags -x --c-kinds=fp -R sink/ source/ common/ | grep -v COIX | awk '{print "__asm__(\".symver "$1"1,"$1"@@COI_1.0\");"}' +// +// These directives must have an associated linker script with VERSION stuff. +// See coi_version_linker_script.map +// Passed in as +// -Wl,--version-script coi_version_linker_script.map +// when building Intel(R) Coprocessor Offload Infrastructure (Intel(R) COI) +// +// See http://sourceware.org/binutils/docs/ld/VERSION.html#VERSION for more info +// +// This is not strictly a .h file, so no need to #pragma once or anything. +// You must include these asm directives in the same translation unit as the +// one where the function body is. +// Otherwise we'd have add this file to the list of files needed to build +// libcoi*, instead of including it in each of the api/*/*cpp files. +// +__asm__(".symver COIBufferAddRef1,COIBufferAddRef@@COI_1.0"); +__asm__(".symver COIBufferCopy1,COIBufferCopy@@COI_1.0"); +__asm__(".symver COIBufferCreate1,COIBufferCreate@@COI_1.0"); +__asm__(".symver COIBufferCreateFromMemory1,COIBufferCreateFromMemory@@COI_1.0"); +__asm__(".symver COIBufferDestroy1,COIBufferDestroy@@COI_1.0"); +__asm__(".symver COIBufferGetSinkAddress1,COIBufferGetSinkAddress@@COI_1.0"); +__asm__(".symver COIBufferMap1,COIBufferMap@@COI_1.0"); +__asm__(".symver COIBufferRead1,COIBufferRead@@COI_1.0"); +__asm__(".symver COIBufferReleaseRef1,COIBufferReleaseRef@@COI_1.0"); +__asm__(".symver COIBufferSetState1,COIBufferSetState@@COI_1.0"); +__asm__(".symver COIBufferUnmap1,COIBufferUnmap@@COI_1.0"); +__asm__(".symver COIBufferWrite1,COIBufferWrite@@COI_1.0"); +__asm__(".symver COIEngineGetCount1,COIEngineGetCount@@COI_1.0"); +__asm__(".symver COIEngineGetHandle1,COIEngineGetHandle@@COI_1.0"); +__asm__(".symver COIEngineGetIndex1,COIEngineGetIndex@@COI_1.0"); +__asm__(".symver COIEngineGetInfo1,COIEngineGetInfo@@COI_1.0"); +__asm__(".symver COIEventRegisterCallback1,COIEventRegisterCallback@@COI_1.0"); +__asm__(".symver COIEventWait1,COIEventWait@@COI_1.0"); +__asm__(".symver COIPerfGetCycleFrequency1,COIPerfGetCycleFrequency@@COI_1.0"); +__asm__(".symver COIPipelineClearCPUMask1,COIPipelineClearCPUMask@@COI_1.0"); +__asm__(".symver COIPipelineCreate1,COIPipelineCreate@@COI_1.0"); +__asm__(".symver COIPipelineDestroy1,COIPipelineDestroy@@COI_1.0"); +__asm__(".symver COIPipelineRunFunction1,COIPipelineRunFunction@@COI_1.0"); +__asm__(".symver COIPipelineSetCPUMask1,COIPipelineSetCPUMask@@COI_1.0"); +__asm__(".symver COIPipelineStartExecutingRunFunctions1,COIPipelineStartExecutingRunFunctions@@COI_1.0"); +__asm__(".symver COIProcessCreateFromFile1,COIProcessCreateFromFile@@COI_1.0"); +__asm__(".symver COIProcessCreateFromMemory1,COIProcessCreateFromMemory@@COI_1.0"); +__asm__(".symver COIProcessDestroy1,COIProcessDestroy@@COI_1.0"); +__asm__(".symver COIProcessGetFunctionHandles1,COIProcessGetFunctionHandles@@COI_1.0"); +__asm__(".symver COIProcessLoadLibraryFromMemory2,COIProcessLoadLibraryFromMemory@COI_2.0"); +__asm__(".symver COIProcessRegisterLibraries1,COIProcessRegisterLibraries@@COI_1.0"); +__asm__(".symver COIProcessUnloadLibrary1,COIProcessUnloadLibrary@@COI_1.0"); +__asm__(".symver COIProcessWaitForShutdown1,COIProcessWaitForShutdown@@COI_1.0"); diff --git a/liboffloadmic/runtime/emulator/coi_version_linker_script.map b/liboffloadmic/runtime/emulator/coi_version_linker_script.map index 496713fb4f7..a98cbc6e784 100644 --- a/liboffloadmic/runtime/emulator/coi_version_linker_script.map +++ b/liboffloadmic/runtime/emulator/coi_version_linker_script.map @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -38,6 +38,12 @@ * intellectual property rights is granted herein. */ +/*** +* See http://sourceware.org/binutils/docs/ld/VERSION.html#VERSION for more info. +* Use this in conjunction with coi_version_asm.h. +* // Comments don't work in this file. +***/ + COI_1.0 { global: @@ -56,17 +62,23 @@ COI_1.0 COIEngineGetCount; COIEngineGetHandle; COIEngineGetIndex; + COIEngineGetInfo; COIEventWait; + COIEventRegisterCallback; COIPerfGetCycleFrequency; + COIPipelineClearCPUMask; COIPipelineCreate; COIPipelineDestroy; COIPipelineRunFunction; + COIPipelineSetCPUMask; COIPipelineStartExecutingRunFunctions; + COIProcessCreateFromFile; COIProcessCreateFromMemory; COIProcessDestroy; COIProcessGetFunctionHandles; COIProcessLoadLibraryFromMemory; COIProcessRegisterLibraries; + COIProcessUnloadLibrary; COIProcessWaitForShutdown; local: *; diff --git a/liboffloadmic/runtime/emulator/myo_client.cpp b/liboffloadmic/runtime/emulator/myo_client.cpp index bee59f0e113..d9d5f309ed1 100644 --- a/liboffloadmic/runtime/emulator/myo_client.cpp +++ b/liboffloadmic/runtime/emulator/myo_client.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/emulator/myo_service.cpp b/liboffloadmic/runtime/emulator/myo_service.cpp index e18abecd05c..0473253f731 100644 --- a/liboffloadmic/runtime/emulator/myo_service.cpp +++ b/liboffloadmic/runtime/emulator/myo_service.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -155,5 +155,49 @@ SYMBOL_VERSION (myoiTargetFptrTableRegister, 1) (void *table, return MYO_ERROR; } + +MYOACCESSAPI MyoError +SYMBOL_VERSION (myoArenaRelease, 1) (MyoArena in_Arena) +{ + MYOTRACE ("myoArenaRelease"); + + assert (false); + + return MYO_ERROR; +} + + +MYOACCESSAPI MyoError +SYMBOL_VERSION (myoArenaAcquire, 1) (MyoArena in_Arena) +{ + MYOTRACE ("myoArenaAcquire"); + + assert (false); + + return MYO_ERROR; +} + + +MYOACCESSAPI void +SYMBOL_VERSION (myoArenaAlignedFree, 1) (MyoArena in_Arena, void *in_pPtr) +{ + MYOTRACE ("myoArenaAlignedFree"); + + assert (false); +} + + +MYOACCESSAPI void * +SYMBOL_VERSION (myoArenaAlignedMalloc, 1) (MyoArena in_Arena, size_t in_Size, + size_t in_Alignment) +{ + MYOTRACE ("myoArenaAlignedMalloc"); + + assert (false); + + return 0; +} + + } // extern "C" diff --git a/liboffloadmic/runtime/emulator/myo_service.h b/liboffloadmic/runtime/emulator/myo_service.h index 776e8c2c40d..ffa4a5f8dcd 100644 --- a/liboffloadmic/runtime/emulator/myo_service.h +++ b/liboffloadmic/runtime/emulator/myo_service.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/emulator/myo_version_asm.h b/liboffloadmic/runtime/emulator/myo_version_asm.h index 2bd8302ab6a..f4db3ca4ab7 100644 --- a/liboffloadmic/runtime/emulator/myo_version_asm.h +++ b/liboffloadmic/runtime/emulator/myo_version_asm.h @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -38,16 +38,24 @@ * intellectual property rights is granted herein. */ -__asm__ (".symver myoAcquire1,myoAcquire@@MYO_1.0"); -__asm__ (".symver myoRelease1,myoRelease@@MYO_1.0"); -__asm__ (".symver myoSharedAlignedFree1,myoSharedAlignedFree@@MYO_1.0"); -__asm__ (".symver myoSharedAlignedMalloc1,myoSharedAlignedMalloc@@MYO_1.0"); -__asm__ (".symver myoSharedFree1,myoSharedFree@@MYO_1.0"); -__asm__ (".symver myoSharedMalloc1,myoSharedMalloc@@MYO_1.0"); +/*Version for Symbols( only Functions currently versioned) +Only that Linux Host Side code is versioned currently*/ +#if (! defined MYO_MIC_CARD) && (! defined _WIN32) -__asm__ (".symver myoiLibInit1,myoiLibInit@@MYO_1.0"); -__asm__ (".symver myoiLibFini1,myoiLibFini@@MYO_1.0"); -__asm__ (".symver myoiMicVarTableRegister1,myoiMicVarTableRegister@@MYO_1.0"); -__asm__ (".symver myoiRemoteFuncRegister1,myoiRemoteFuncRegister@@MYO_1.0"); -__asm__ (".symver myoiTargetFptrTableRegister1,myoiTargetFptrTableRegister@@MYO_1.0"); + __asm__(".symver myoArenaAlignedMalloc1,myoArenaAlignedMalloc@@MYO_1.0"); + __asm__(".symver myoArenaAlignedFree1,myoArenaAlignedFree@@MYO_1.0"); + __asm__(".symver myoArenaAcquire1,myoArenaAcquire@@MYO_1.0"); + __asm__(".symver myoArenaRelease1,myoArenaRelease@@MYO_1.0"); + __asm__(".symver myoAcquire1,myoAcquire@@MYO_1.0"); + __asm__(".symver myoRelease1,myoRelease@@MYO_1.0"); + __asm__(".symver myoSharedAlignedFree1,myoSharedAlignedFree@@MYO_1.0"); + __asm__(".symver myoSharedAlignedMalloc1,myoSharedAlignedMalloc@@MYO_1.0"); + __asm__(".symver myoSharedFree1,myoSharedFree@@MYO_1.0"); + __asm__(".symver myoSharedMalloc1,myoSharedMalloc@@MYO_1.0"); + __asm__(".symver myoiLibInit1,myoiLibInit@@MYO_1.0"); + __asm__(".symver myoiLibFini1,myoiLibFini@@MYO_1.0"); + __asm__(".symver myoiMicVarTableRegister1,myoiMicVarTableRegister@@MYO_1.0"); + __asm__(".symver myoiRemoteFuncRegister1,myoiRemoteFuncRegister@@MYO_1.0"); + __asm__(".symver myoiTargetFptrTableRegister1,myoiTargetFptrTableRegister@@MYO_1.0"); +#endif diff --git a/liboffloadmic/runtime/emulator/myo_version_linker_script.map b/liboffloadmic/runtime/emulator/myo_version_linker_script.map index 361b289d1b6..8f065bbb4ac 100644 --- a/liboffloadmic/runtime/emulator/myo_version_linker_script.map +++ b/liboffloadmic/runtime/emulator/myo_version_linker_script.map @@ -1,5 +1,5 @@ /* - * Copyright 2010-2013 Intel Corporation. + * Copyright 2010-2015 Intel Corporation. * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -38,9 +38,17 @@ * intellectual property rights is granted herein. */ +/*** +* See http://sourceware.org/binutils/docs/ld/VERSION.html#VERSION for more info. +***/ + MYO_1.0 { global: + myoArenaAlignedMalloc; + myoArenaAlignedFree; + myoArenaAcquire; + myoArenaRelease; myoAcquire; myoRelease; myoSharedAlignedFree; diff --git a/liboffloadmic/runtime/liboffload_error.c b/liboffloadmic/runtime/liboffload_error.c index eb5699d3c5c..29dcb6c8507 100644 --- a/liboffloadmic/runtime/liboffload_error.c +++ b/liboffloadmic/runtime/liboffload_error.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -144,6 +144,9 @@ void __liboffload_error_support(error_types input_tag, ...) case c_process_create: write_message(stderr, msg_c_process_create, args); break; + case c_process_set_cache_size: + write_message(stderr, msg_c_process_set_cache_size, args); + break; case c_process_wait_shutdown: write_message(stderr, msg_c_process_wait_shutdown, args); break; @@ -216,6 +219,9 @@ void __liboffload_error_support(error_types input_tag, ...) case c_zero_or_neg_transfer_size: write_message(stderr, msg_c_zero_or_neg_transfer_size, args); break; + case c_bad_ptr_mem_alloc: + write_message(stderr, msg_c_bad_ptr_mem_alloc, args); + break; case c_bad_ptr_mem_range: write_message(stderr, msg_c_bad_ptr_mem_range, args); break; @@ -258,6 +264,39 @@ void __liboffload_error_support(error_types input_tag, ...) case c_report_unknown_trace_node: write_message(stderr, msg_c_report_unknown_trace_node, args); break; + case c_incorrect_affinity: + write_message(stderr, msg_c_incorrect_affinity, args); + break; + case c_cannot_set_affinity: + write_message(stderr, msg_c_cannot_set_affinity, args); + break; + case c_in_with_preallocated: + write_message(stderr, msg_c_in_with_preallocated, args); + break; + case c_report_no_host_exe: + write_message(stderr, msg_c_report_no_host_exe, args); + break; + case c_report_path_buff_overflow: + write_message(stderr, msg_c_report_path_buff_overflow, args); + break; + case c_create_pipeline_for_stream: + write_message(stderr, msg_c_create_pipeline_for_stream, args); + break; + case c_offload_no_stream: + write_message(stderr, msg_c_offload_no_stream, args); + break; + case c_get_engine_info: + write_message(stderr, msg_c_get_engine_info, args); + break; + case c_clear_cpu_mask: + write_message(stderr, msg_c_clear_cpu_mask, args); + break; + case c_set_cpu_mask: + write_message(stderr, msg_c_set_cpu_mask, args); + break; + case c_unload_library: + write_message(stderr, msg_c_unload_library, args); + break; } va_end(args); } @@ -374,6 +413,10 @@ char const * report_get_message_str(error_types input_tag) return (offload_get_message_str(msg_c_report_unregister)); case c_report_var: return (offload_get_message_str(msg_c_report_var)); + case c_report_stream: + return (offload_get_message_str(msg_c_report_stream)); + case c_report_state_stream: + return (offload_get_message_str(msg_c_report_state_stream)); default: LIBOFFLOAD_ERROR(c_report_unknown_trace_node); diff --git a/liboffloadmic/runtime/liboffload_error_codes.h b/liboffloadmic/runtime/liboffload_error_codes.h index c33bef56236..d580851271a 100644 --- a/liboffloadmic/runtime/liboffload_error_codes.h +++ b/liboffloadmic/runtime/liboffload_error_codes.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -68,6 +68,7 @@ typedef enum c_get_engine_handle, c_get_engine_index, c_process_create, + c_process_set_cache_size, c_process_get_func_handles, c_process_wait_shutdown, c_process_proxy_flush, @@ -91,6 +92,7 @@ typedef enum c_event_wait, c_zero_or_neg_ptr_len, c_zero_or_neg_transfer_size, + c_bad_ptr_mem_alloc, c_bad_ptr_mem_range, c_different_src_and_dstn_sizes, c_ranges_dont_match, @@ -103,6 +105,8 @@ typedef enum c_unknown_binary_type, c_multiple_target_exes, c_no_target_exe, + c_incorrect_affinity, + c_cannot_set_affinity, c_report_host, c_report_target, c_report_title, @@ -159,7 +163,24 @@ typedef enum c_report_myosharedalignedfree, c_report_myoacquire, c_report_myorelease, - c_coipipe_max_number + c_report_myosupportsfeature, + c_report_myosharedarenacreate, + c_report_myosharedalignedarenamalloc, + c_report_myosharedalignedarenafree, + c_report_myoarenaacquire, + c_report_myoarenarelease, + c_coipipe_max_number, + c_in_with_preallocated, + c_report_no_host_exe, + c_report_path_buff_overflow, + c_create_pipeline_for_stream, + c_offload_no_stream, + c_get_engine_info, + c_clear_cpu_mask, + c_set_cpu_mask, + c_report_state_stream, + c_report_stream, + c_unload_library } error_types; enum OffloadHostPhase { @@ -260,15 +281,21 @@ enum OffloadTargetPhase { c_offload_target_max_phase }; +#ifdef TARGET_WINNT + #define DLL_LOCAL +#else + #define DLL_LOCAL __attribute__((visibility("hidden"))) +#endif + #ifdef __cplusplus extern "C" { #endif -void __liboffload_error_support(error_types input_tag, ...); -void __liboffload_report_support(error_types input_tag, ...); -char const *offload_get_message_str(int msgCode); -char const * report_get_message_str(error_types input_tag); -char const * report_get_host_stage_str(int i); -char const * report_get_target_stage_str(int i); +DLL_LOCAL void __liboffload_error_support(error_types input_tag, ...); +DLL_LOCAL void __liboffload_report_support(error_types input_tag, ...); +DLL_LOCAL char const *offload_get_message_str(int msgCode); +DLL_LOCAL char const * report_get_message_str(error_types input_tag); +DLL_LOCAL char const * report_get_host_stage_str(int i); +DLL_LOCAL char const * report_get_target_stage_str(int i); #ifdef __cplusplus } #endif @@ -281,7 +308,7 @@ char const * report_get_target_stage_str(int i); fprintf(stderr, "\t TEST for %s \n \t", nm); \ __liboffload_error_support(msg, __VA_ARGS__); -void write_message(FILE * file, int msgCode, va_list args_p); +DLL_LOCAL void write_message(FILE * file, int msgCode, va_list args_p); #define LIBOFFLOAD_ERROR __liboffload_error_support diff --git a/liboffloadmic/runtime/liboffload_msg.c b/liboffloadmic/runtime/liboffload_msg.c index c6d9fa7db1e..3d3784c5eda 100644 --- a/liboffloadmic/runtime/liboffload_msg.c +++ b/liboffloadmic/runtime/liboffload_msg.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,7 +28,6 @@ */ - #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -55,7 +54,7 @@ va_copy(args, args_p); buf[0] = '\n'; vsnprintf(buf + 1, sizeof(buf) - 2, - MESSAGE_TABLE_NAME[ msgCode ], args); + MESSAGE_TABLE_NAME[ msgCode ], args); strcat(buf, "\n"); va_end(args); fputs(buf, file); diff --git a/liboffloadmic/runtime/liboffload_msg.h b/liboffloadmic/runtime/liboffload_msg.h index e43b6b63551..f1bae7712e3 100644 --- a/liboffloadmic/runtime/liboffload_msg.h +++ b/liboffloadmic/runtime/liboffload_msg.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -62,6 +62,7 @@ enum { msg_c_get_engine_handle, msg_c_get_engine_index, msg_c_process_create, + msg_c_process_set_cache_size, msg_c_process_get_func_handles, msg_c_process_wait_shutdown, msg_c_process_proxy_flush, @@ -85,6 +86,7 @@ enum { msg_c_event_wait, msg_c_zero_or_neg_ptr_len, msg_c_zero_or_neg_transfer_size, + msg_c_bad_ptr_mem_alloc, msg_c_bad_ptr_mem_range, msg_c_different_src_and_dstn_sizes, msg_c_non_contiguous_dope_vector, @@ -95,6 +97,8 @@ enum { msg_c_no_target_exe, msg_c_report_unknown_timer_node, msg_c_report_unknown_trace_node, + msg_c_incorrect_affinity, + msg_c_cannot_set_affinity, msg_c_report_host, msg_c_report_mic, msg_c_report_title, @@ -148,6 +152,12 @@ enum { msg_c_report_myosharedalignedfree, msg_c_report_myoacquire, msg_c_report_myorelease, + msg_c_report_myosupportsfeature, + msg_c_report_myosharedarenacreate, + msg_c_report_myosharedalignedarenamalloc, + msg_c_report_myosharedalignedarenafree, + msg_c_report_myoarenaacquire, + msg_c_report_myoarenarelease, msg_c_report_host_total_offload_time, msg_c_report_host_initialize, msg_c_report_host_target_acquire, @@ -182,7 +192,18 @@ enum { msg_c_destination_is_over, msg_c_slice_of_noncont_array, msg_c_pointer_array_mismatch, - lastMsg = 153, + msg_c_in_with_preallocated, + msg_c_report_no_host_exe, + msg_c_report_path_buff_overflow, + msg_c_create_pipeline_for_stream, + msg_c_offload_no_stream, + msg_c_get_engine_info, + msg_c_clear_cpu_mask, + msg_c_set_cpu_mask, + msg_c_report_state_stream, + msg_c_report_stream, + msg_c_unload_library, + lastMsg = 174, firstMsg = 1 }; @@ -192,157 +213,178 @@ enum { #endif static char const * MESSAGE_TABLE_NAME[] = { - /* 0 __dummy__ */ "Un-used message", - /* 1 msg_c_device_is_not_available */ "offload error: cannot offload to MIC - device is not available", - /* 2 msg_c_invalid_device_number */ "offload error: expected a number greater than or equal to -1", - /* 3 msg_c_send_func_ptr */ "offload error: cannot find function name for address %p", - /* 4 msg_c_receive_func_ptr */ "offload error: cannot find address of function %s", - /* 5 msg_c_malloc */ "offload error: memory allocation failed", - /* 6 msg_c_offload_malloc */ "offload error: memory allocation failed (requested=%lld bytes, align %lld)", - /* 7 msg_c_offload1 */ "offload error: device %d does not have a pending signal for wait(%p)", - /* 8 msg_c_unknown_var_type */ "offload error: unknown variable type %d", - /* 9 msg_c_invalid_env_var_value */ "offload warning: ignoring invalid value specified for %s", - /* 10 msg_c_invalid_env_var_int_value */ "offload warning: specify an integer value for %s", - /* 11 msg_c_invalid_env_report_value */ "offload warning: ignoring %s setting; use a value in range 1-3", - /* 12 msg_c_offload_signaled1 */ "offload error: invalid device number %d specified in _Offload_signaled", - /* 13 msg_c_offload_signaled2 */ "offload error: invalid signal %p specified for _Offload_signaled", - /* 14 msg_c_myowrapper_checkresult */ "offload error: %s failed with error %d", - /* 15 msg_c_myotarget_checkresult */ "offload error: %s failed with error %d", - /* 16 msg_c_offload_descriptor_offload */ "offload error: cannot find offload entry %s", - /* 17 msg_c_merge_var_descs1 */ "offload error: unexpected number of variable descriptors", - /* 18 msg_c_merge_var_descs2 */ "offload error: unexpected variable type", - /* 19 msg_c_mic_parse_env_var_list1 */ "offload_error: MIC environment variable must begin with an alpabetic character", - /* 20 msg_c_mic_parse_env_var_list2 */ "offload_error: MIC environment variable value must be specified with \'=\'", - /* 21 msg_c_mic_process_exit_ret */ "offload error: process on the device %d unexpectedly exited with code %d", - /* 22 msg_c_mic_process_exit_sig */ "offload error: process on the device %d was terminated by signal %d (%s)", - /* 23 msg_c_mic_process_exit */ "offload error: process on the device %d was unexpectedly terminated", - /* 24 msg_c_mic_init3 */ "offload warning: ignoring MIC_STACKSIZE setting; use a value >= 16K and a multiple of 4K", - /* 25 msg_c_mic_init4 */ "offload error: thread key create failed with error %d", - /* 26 msg_c_mic_init5 */ "offload warning: specify OFFLOAD_DEVICES as comma-separated physical device numbers or 'none'", - /* 27 msg_c_mic_init6 */ "offload warning: OFFLOAD_DEVICES device number %d does not correspond to a physical device", - /* 28 msg_c_no_static_var_data */ "offload error: cannot find data associated with statically allocated variable %p", - /* 29 msg_c_no_ptr_data */ "offload error: cannot find data associated with pointer variable %p", - /* 30 msg_c_get_engine_handle */ "offload error: cannot get device %d handle (error code %d)", - /* 31 msg_c_get_engine_index */ "offload error: cannot get physical index for logical device %d (error code %d)", - /* 32 msg_c_process_create */ "offload error: cannot start process on the device %d (error code %d)", - /* 33 msg_c_process_get_func_handles */ "offload error: cannot get function handles on the device %d (error code %d)", - /* 34 msg_c_process_wait_shutdown */ "offload error: wait for process shutdown failed on device %d (error code %d)", - /* 35 msg_c_process_proxy_flush */ "offload error: cannot flush process output on device %d (error code %d)", - /* 36 msg_c_load_library */ "offload error: cannot load library to the device %d (error code %d)", - /* 37 msg_c_pipeline_create */ "offload error: cannot create pipeline on the device %d (error code %d)", - /* 38 msg_c_pipeline_run_func */ "offload error: cannot execute function on the device %d (error code %d)", - /* 39 msg_c_pipeline_start_run_funcs */ "offload error: cannot start executing pipeline function on the device %d (error code %d)", - /* 40 msg_c_buf_create */ "offload error: cannot create buffer on device %d (error code %d)", - /* 41 msg_c_buf_create_out_of_mem */ "offload error: cannot create buffer on device %d, out of memory", - /* 42 msg_c_buf_create_from_mem */ "offload error: cannot create buffer from memory on device %d (error code %d)", - /* 43 msg_c_buf_destroy */ "offload error: buffer destroy failed (error code %d)", - /* 44 msg_c_buf_map */ "offload error: buffer map failed (error code %d)", - /* 45 msg_c_buf_unmap */ "offload error: buffer unmap failed (error code %d)", - /* 46 msg_c_buf_read */ "offload error: buffer read failed (error code %d)", - /* 47 msg_c_buf_write */ "offload error: buffer write failed (error code %d)", - /* 48 msg_c_buf_copy */ "offload error: buffer copy failed (error code %d)", - /* 49 msg_c_buf_get_address */ "offload error: cannot get buffer address on device %d (error code %d)", - /* 50 msg_c_buf_add_ref */ "offload error: cannot reuse buffer memory on device %d (error code %d)", - /* 51 msg_c_buf_release_ref */ "offload error: cannot release buffer memory on device %d (error code %d)", - /* 52 msg_c_buf_set_state */ "offload error: buffer set state failed (error code %d)", - /* 53 msg_c_event_wait */ "offload error: wait for event to become signaled failed (error code %d)", - /* 54 msg_c_zero_or_neg_ptr_len */ "offload error: memory allocation of negative length is not supported", - /* 55 msg_c_zero_or_neg_transfer_size */ "offload error: data transfer of zero or negative size is not supported", - /* 56 msg_c_bad_ptr_mem_range */ "offload error: address range partially overlaps with existing allocation", - /* 57 msg_c_different_src_and_dstn_sizes */ "offload error: size of the source %d differs from size of the destination %d", - /* 58 msg_c_non_contiguous_dope_vector */ "offload error: offload data transfer supports only a single contiguous memory range per variable", - /* 59 msg_c_omp_invalid_device_num_env */ "offload warning: ignoring %s setting; use a non-negative integer value", - /* 60 msg_c_omp_invalid_device_num */ "offload error: device number should be a non-negative integer value", - /* 61 msg_c_unknown_binary_type */ "offload error: unexpected embedded target binary type, expected either an executable or shared library", - /* 62 msg_c_multiple_target_exes */ "offload error: more that one target executable found", - /* 63 msg_c_no_target_exe */ "offload error: target executable is not available", - /* 64 msg_c_report_unknown_timer_node */ "offload error: unknown timer node", - /* 65 msg_c_report_unknown_trace_node */ "offload error: unknown trace node", - /* 66 msg_c_report_host */ "HOST", - /* 67 msg_c_report_mic */ "MIC", - /* 68 msg_c_report_title */ "timer data (sec)", - /* 69 msg_c_report_seconds */ "(seconds)", - /* 70 msg_c_report_bytes */ "(bytes)", - /* 71 msg_c_report_cpu_time */ "CPU Time", - /* 72 msg_c_report_mic_time */ "MIC Time", - /* 73 msg_c_report_tag */ "Tag", - /* 74 msg_c_report_from_file */ "Offload from file", - /* 75 msg_c_report_file */ "File", - /* 76 msg_c_report_line */ "Line", - /* 77 msg_c_report_cpu_to_mic_data */ "CPU->MIC Data", - /* 78 msg_c_report_mic_to_cpu_data */ "MIC->CPU Data", - /* 79 msg_c_report_offload */ "Offload", - /* 80 msg_c_report_w_tag */ "Tag %d", - /* 81 msg_c_report_state */ "State", - /* 82 msg_c_report_start */ "Start target", - /* 83 msg_c_report_init */ "Initialize", - /* 84 msg_c_report_logical_card */ "logical card", - /* 85 msg_c_report_physical_card */ "physical card", - /* 86 msg_c_report_register */ "Register static data tables", - /* 87 msg_c_report_init_func */ "Setup target entry", - /* 88 msg_c_report_create_buf_host */ "Create host buffer", - /* 89 msg_c_report_create_buf_mic */ "Create target buffer", - /* 90 msg_c_report_send_pointer_data */ "Send pointer data", - /* 91 msg_c_report_sent_pointer_data */ "Host->target pointer data", - /* 92 msg_c_report_gather_copyin_data */ "Gather copyin data", - /* 93 msg_c_report_copyin_data */ "Host->target copyin data", - /* 94 msg_c_report_state_signal */ "Signal", - /* 95 msg_c_report_signal */ "signal :", - /* 96 msg_c_report_wait */ "waits :", - /* 97 msg_c_report_compute */ "Execute task on target", - /* 98 msg_c_report_receive_pointer_data */ "Receive pointer data", - /* 99 msg_c_report_received_pointer_data */ "Target->host pointer data", - /* 100 msg_c_report_start_target_func */ "Start target entry", - /* 101 msg_c_report_var */ "Var", - /* 102 msg_c_report_scatter_copyin_data */ "Scatter copyin data", - /* 103 msg_c_report_gather_copyout_data */ "Gather copyout data", - /* 104 msg_c_report_scatter_copyout_data */ "Scatter copyout data", - /* 105 msg_c_report_copyout_data */ "Target->host copyout data", - /* 106 msg_c_report_unregister */ "Unregister data tables", - /* 107 msg_c_report_destroy */ "Destroy", - /* 108 msg_c_report_myoinit */ "Initialize MYO", - /* 109 msg_c_report_myoregister */ "Register MYO tables", - /* 110 msg_c_report_myofini */ "Finalize MYO", - /* 111 msg_c_report_mic_myo_shared */ "MIC MYO shared table register", - /* 112 msg_c_report_mic_myo_fptr */ "MIC MYO fptr table register", - /* 113 msg_c_report_myosharedmalloc */ "MYO shared malloc", - /* 114 msg_c_report_myosharedfree */ "MYO shared free", - /* 115 msg_c_report_myosharedalignedmalloc */ "MYO shared aligned malloc", - /* 116 msg_c_report_myosharedalignedfree */ "MYO shared aligned free", - /* 117 msg_c_report_myoacquire */ "MYO acquire", - /* 118 msg_c_report_myorelease */ "MYO release", - /* 119 msg_c_report_host_total_offload_time */ "host: total offload time", - /* 120 msg_c_report_host_initialize */ "host: initialize target", - /* 121 msg_c_report_host_target_acquire */ "host: acquire target", - /* 122 msg_c_report_host_wait_deps */ "host: wait dependencies", - /* 123 msg_c_report_host_setup_buffers */ "host: setup buffers", - /* 124 msg_c_report_host_alloc_buffers */ "host: allocate buffers", - /* 125 msg_c_report_host_setup_misc_data */ "host: setup misc_data", - /* 126 msg_c_report_host_alloc_data_buffer */ "host: allocate buffer", - /* 127 msg_c_report_host_send_pointers */ "host: send pointers", - /* 128 msg_c_report_host_gather_inputs */ "host: gather inputs", - /* 129 msg_c_report_host_map_in_data_buffer */ "host: map IN data buffer", - /* 130 msg_c_report_host_unmap_in_data_buffer */ "host: unmap IN data buffer", - /* 131 msg_c_report_host_start_compute */ "host: initiate compute", - /* 132 msg_c_report_host_wait_compute */ "host: wait compute", - /* 133 msg_c_report_host_start_buffers_reads */ "host: initiate pointer reads", - /* 134 msg_c_report_host_scatter_outputs */ "host: scatter outputs", - /* 135 msg_c_report_host_map_out_data_buffer */ "host: map OUT data buffer", - /* 136 msg_c_report_host_unmap_out_data_buffer */ "host: unmap OUT data buffer", - /* 137 msg_c_report_host_wait_buffers_reads */ "host: wait pointer reads", - /* 138 msg_c_report_host_destroy_buffers */ "host: destroy buffers", - /* 139 msg_c_report_target_total_time */ "target: total time", - /* 140 msg_c_report_target_descriptor_setup */ "target: setup offload descriptor", - /* 141 msg_c_report_target_func_lookup */ "target: entry lookup", - /* 142 msg_c_report_target_func_time */ "target: entry time", - /* 143 msg_c_report_target_scatter_inputs */ "target: scatter inputs", - /* 144 msg_c_report_target_add_buffer_refs */ "target: add buffer reference", - /* 145 msg_c_report_target_compute */ "target: compute", - /* 146 msg_c_report_target_gather_outputs */ "target: gather outputs", - /* 147 msg_c_report_target_release_buffer_refs */ "target: remove buffer reference", - /* 148 msg_c_coi_pipeline_max_number */ "number of host threads doing offload exceeds maximum of %d", - /* 149 msg_c_ranges_dont_match */ "ranges of source and destination don't match together", - /* 150 msg_c_destination_is_over */ "insufficient destination memory to transfer source", - /* 151 msg_c_slice_of_noncont_array */ "a non-contiguous slice may be taken of contiguous arrays only", - /* 152 msg_c_pointer_array_mismatch */ "number of %s elements is less than described by the source", + /* 0 __dummy__ */ "Un-used message", + /* 1 msg_c_device_is_not_available */ "offload error: cannot offload to MIC - device is not available", + /* 2 msg_c_invalid_device_number */ "offload error: expected a number greater than or equal to -1", + /* 3 msg_c_send_func_ptr */ "offload error: cannot find function name for address %p", + /* 4 msg_c_receive_func_ptr */ "offload error: cannot find address of function %s", + /* 5 msg_c_malloc */ "offload error: memory allocation failed", + /* 6 msg_c_offload_malloc */ "offload error: memory allocation failed (requested=%lld bytes, align %lld)", + /* 7 msg_c_offload1 */ "offload error: device %d does not have a pending signal for wait(%p)", + /* 8 msg_c_unknown_var_type */ "offload error: unknown variable type %d", + /* 9 msg_c_invalid_env_var_value */ "offload warning: ignoring invalid value specified for %s", + /* 10 msg_c_invalid_env_var_int_value */ "offload warning: specify an integer value for %s", + /* 11 msg_c_invalid_env_report_value */ "offload warning: ignoring %s setting; use a value in range 1-3", + /* 12 msg_c_offload_signaled1 */ "offload error: invalid device number %d specified in _Offload_signaled", + /* 13 msg_c_offload_signaled2 */ "offload error: invalid signal %p specified for _Offload_signaled", + /* 14 msg_c_myowrapper_checkresult */ "offload error: %s failed with error %d", + /* 15 msg_c_myotarget_checkresult */ "offload error: %s failed with error %d", + /* 16 msg_c_offload_descriptor_offload */ "offload error: cannot find offload entry %s", + /* 17 msg_c_merge_var_descs1 */ "offload error: unexpected number of variable descriptors", + /* 18 msg_c_merge_var_descs2 */ "offload error: unexpected variable type", + /* 19 msg_c_mic_parse_env_var_list1 */ "offload_error: MIC environment variable must begin with an alpabetic character", + /* 20 msg_c_mic_parse_env_var_list2 */ "offload_error: MIC environment variable value must be specified with '='", + /* 21 msg_c_mic_process_exit_ret */ "offload error: process on the device %d unexpectedly exited with code %d", + /* 22 msg_c_mic_process_exit_sig */ "offload error: process on the device %d was terminated by signal %d (%s)", + /* 23 msg_c_mic_process_exit */ "offload error: process on the device %d was unexpectedly terminated", + /* 24 msg_c_mic_init3 */ "offload warning: ignoring MIC_STACKSIZE setting; use a value >= 16K and a multiple of 4K", + /* 25 msg_c_mic_init4 */ "offload error: thread key create failed with error %d", + /* 26 msg_c_mic_init5 */ "offload warning: specify OFFLOAD_DEVICES as comma-separated physical device numbers or 'none'", + /* 27 msg_c_mic_init6 */ "offload warning: OFFLOAD_DEVICES device number %d does not correspond to a physical device", + /* 28 msg_c_no_static_var_data */ "offload error: cannot find data associated with statically allocated variable %p", + /* 29 msg_c_no_ptr_data */ "offload error: cannot find data associated with pointer variable %p", + /* 30 msg_c_get_engine_handle */ "offload error: cannot get device %d handle (error code %d)", + /* 31 msg_c_get_engine_index */ "offload error: cannot get physical index for logical device %d (error code %d)", + /* 32 msg_c_process_create */ "offload error: cannot start process on the device %d (error code %d)", + /* 33 msg_c_process_set_cache_size */ "offload error: cannot reserve buffer on the device %d (error code %d)", + /* 34 msg_c_process_get_func_handles */ "offload error: cannot get function handles on the device %d (error code %d)", + /* 35 msg_c_process_wait_shutdown */ "offload error: wait for process shutdown failed on device %d (error code %d)", + /* 36 msg_c_process_proxy_flush */ "offload error: cannot flush process output on device %d (error code %d)", + /* 37 msg_c_load_library */ "offload error: cannot load library to the device %d (error code %d)", + /* 38 msg_c_pipeline_create */ "offload error: cannot create pipeline on the device %d (error code %d)", + /* 39 msg_c_pipeline_run_func */ "offload error: cannot execute function on the device %d (error code %d)", + /* 40 msg_c_pipeline_start_run_funcs */ "offload error: cannot start executing pipeline function on the device %d (error code %d)", + /* 41 msg_c_buf_create */ "offload error: cannot create buffer on device %d (error code %d)", + /* 42 msg_c_buf_create_out_of_mem */ "offload error: cannot create buffer on device %d, out of memory", + /* 43 msg_c_buf_create_from_mem */ "offload error: cannot create buffer from memory on device %d (error code %d)", + /* 44 msg_c_buf_destroy */ "offload error: buffer destroy failed (error code %d)", + /* 45 msg_c_buf_map */ "offload error: buffer map failed (error code %d)", + /* 46 msg_c_buf_unmap */ "offload error: buffer unmap failed (error code %d)", + /* 47 msg_c_buf_read */ "offload error: buffer read failed (error code %d)", + /* 48 msg_c_buf_write */ "offload error: buffer write failed (error code %d)", + /* 49 msg_c_buf_copy */ "offload error: buffer copy failed (error code %d)", + /* 50 msg_c_buf_get_address */ "offload error: cannot get buffer address on device %d (error code %d)", + /* 51 msg_c_buf_add_ref */ "offload error: cannot reuse buffer memory on device %d (error code %d)", + /* 52 msg_c_buf_release_ref */ "offload error: cannot release buffer memory on device %d (error code %d)", + /* 53 msg_c_buf_set_state */ "offload error: buffer set state failed (error code %d)", + /* 54 msg_c_event_wait */ "offload error: wait for event to become signaled failed (error code %d)", + /* 55 msg_c_zero_or_neg_ptr_len */ "offload error: memory allocation of zero or negative length is not supported", + /* 56 msg_c_zero_or_neg_transfer_size */ "offload error: data transfer of zero or negative size is not supported", + /* 57 msg_c_bad_ptr_mem_alloc */ "offload error: allocation (base=%p, size=%d) overlaps with existing allocation (base=%p, size=%d)", + /* 58 msg_c_bad_ptr_mem_range */ "offload error: data transfer (base=%p, size=%d) not subset of existing allocation (base=%p, size=%d)", + /* 59 msg_c_different_src_and_dstn_sizes */ "offload error: size of the source %d differs from size of the destination %d", + /* 60 msg_c_non_contiguous_dope_vector */ "offload error: offload data transfer supports only a single contiguous memory range per variable", + /* 61 msg_c_omp_invalid_device_num_env */ "offload warning: ignoring %s setting; use a non-negative integer value", + /* 62 msg_c_omp_invalid_device_num */ "offload error: device number should be a non-negative integer value", + /* 63 msg_c_unknown_binary_type */ "offload error: unexpected embedded target binary type, expected either an executable or shared library", + /* 64 msg_c_multiple_target_exes */ "offload error: more that one target executable found", + /* 65 msg_c_no_target_exe */ "offload error: target executable is not available", + /* 66 msg_c_report_unknown_timer_node */ "offload error: unknown timer node", + /* 67 msg_c_report_unknown_trace_node */ "offload error: unknown trace node", + /* 68 msg_c_incorrect_affinity */ "offload error: unknow affinity type %s, specify compact, scatter or balanced", + /* 69 msg_c_cannot_set_affinity */ "offload_error: unable to set affinity", + /* 70 msg_c_report_host */ "HOST", + /* 71 msg_c_report_mic */ "MIC", + /* 72 msg_c_report_title */ "timer data (sec)", + /* 73 msg_c_report_seconds */ "(seconds)", + /* 74 msg_c_report_bytes */ "(bytes)", + /* 75 msg_c_report_cpu_time */ "CPU Time", + /* 76 msg_c_report_mic_time */ "MIC Time", + /* 77 msg_c_report_tag */ "Tag", + /* 78 msg_c_report_from_file */ "Offload from file", + /* 79 msg_c_report_file */ "File", + /* 80 msg_c_report_line */ "Line", + /* 81 msg_c_report_cpu_to_mic_data */ "CPU->MIC Data", + /* 82 msg_c_report_mic_to_cpu_data */ "MIC->CPU Data", + /* 83 msg_c_report_offload */ "Offload", + /* 84 msg_c_report_w_tag */ "Tag %d", + /* 85 msg_c_report_state */ "State", + /* 86 msg_c_report_start */ "Start target", + /* 87 msg_c_report_init */ "Initialize", + /* 88 msg_c_report_logical_card */ "logical card", + /* 89 msg_c_report_physical_card */ "physical card", + /* 90 msg_c_report_register */ "Register static data tables", + /* 91 msg_c_report_init_func */ "Setup target entry", + /* 92 msg_c_report_create_buf_host */ "Create host buffer", + /* 93 msg_c_report_create_buf_mic */ "Create target buffer", + /* 94 msg_c_report_send_pointer_data */ "Send pointer data", + /* 95 msg_c_report_sent_pointer_data */ "Host->target pointer data", + /* 96 msg_c_report_gather_copyin_data */ "Gather copyin data", + /* 97 msg_c_report_copyin_data */ "Host->target copyin data", + /* 98 msg_c_report_state_signal */ "Signal", + /* 99 msg_c_report_signal */ "signal :", + /* 100 msg_c_report_wait */ "waits :", + /* 101 msg_c_report_compute */ "Execute task on target", + /* 102 msg_c_report_receive_pointer_data */ "Receive pointer data", + /* 103 msg_c_report_received_pointer_data */ "Target->host pointer data", + /* 104 msg_c_report_start_target_func */ "Start target entry", + /* 105 msg_c_report_var */ "Var", + /* 106 msg_c_report_scatter_copyin_data */ "Scatter copyin data", + /* 107 msg_c_report_gather_copyout_data */ "Gather copyout data", + /* 108 msg_c_report_scatter_copyout_data */ "Scatter copyout data", + /* 109 msg_c_report_copyout_data */ "Target->host copyout data", + /* 110 msg_c_report_unregister */ "Unregister data tables", + /* 111 msg_c_report_destroy */ "Destroy", + /* 112 msg_c_report_myoinit */ "Initialize MYO", + /* 113 msg_c_report_myoregister */ "Register MYO tables", + /* 114 msg_c_report_myofini */ "Finalize MYO", + /* 115 msg_c_report_mic_myo_shared */ "MIC MYO shared table register", + /* 116 msg_c_report_mic_myo_fptr */ "MIC MYO fptr table register", + /* 117 msg_c_report_myosharedmalloc */ "MYO shared malloc", + /* 118 msg_c_report_myosharedfree */ "MYO shared free", + /* 119 msg_c_report_myosharedalignedmalloc */ "MYO shared aligned malloc", + /* 120 msg_c_report_myosharedalignedfree */ "MYO shared aligned free", + /* 121 msg_c_report_myoacquire */ "MYO acquire", + /* 122 msg_c_report_myorelease */ "MYO release", + /* 123 msg_c_report_myosupportsfeature */ "MYO supports feature", + /* 124 msg_c_report_myosharedarenacreate */ "MYO shared arena create", + /* 125 msg_c_report_myosharedalignedarenamalloc */ "MYO shared aligned arena malloc", + /* 126 msg_c_report_myosharedalignedarenafree */ "MYO shared aligned arena free", + /* 127 msg_c_report_myoarenaacquire */ "MYO arena acquire", + /* 128 msg_c_report_myoarenarelease */ "MYO arena release", + /* 129 msg_c_report_host_total_offload_time */ "host: total offload time", + /* 130 msg_c_report_host_initialize */ "host: initialize target", + /* 131 msg_c_report_host_target_acquire */ "host: acquire target", + /* 132 msg_c_report_host_wait_deps */ "host: wait dependencies", + /* 133 msg_c_report_host_setup_buffers */ "host: setup buffers", + /* 134 msg_c_report_host_alloc_buffers */ "host: allocate buffers", + /* 135 msg_c_report_host_setup_misc_data */ "host: setup misc_data", + /* 136 msg_c_report_host_alloc_data_buffer */ "host: allocate buffer", + /* 137 msg_c_report_host_send_pointers */ "host: send pointers", + /* 138 msg_c_report_host_gather_inputs */ "host: gather inputs", + /* 139 msg_c_report_host_map_in_data_buffer */ "host: map IN data buffer", + /* 140 msg_c_report_host_unmap_in_data_buffer */ "host: unmap IN data buffer", + /* 141 msg_c_report_host_start_compute */ "host: initiate compute", + /* 142 msg_c_report_host_wait_compute */ "host: wait compute", + /* 143 msg_c_report_host_start_buffers_reads */ "host: initiate pointer reads", + /* 144 msg_c_report_host_scatter_outputs */ "host: scatter outputs", + /* 145 msg_c_report_host_map_out_data_buffer */ "host: map OUT data buffer", + /* 146 msg_c_report_host_unmap_out_data_buffer */ "host: unmap OUT data buffer", + /* 147 msg_c_report_host_wait_buffers_reads */ "host: wait pointer reads", + /* 148 msg_c_report_host_destroy_buffers */ "host: destroy buffers", + /* 149 msg_c_report_target_total_time */ "target: total time", + /* 150 msg_c_report_target_descriptor_setup */ "target: setup offload descriptor", + /* 151 msg_c_report_target_func_lookup */ "target: entry lookup", + /* 152 msg_c_report_target_func_time */ "target: entry time", + /* 153 msg_c_report_target_scatter_inputs */ "target: scatter inputs", + /* 154 msg_c_report_target_add_buffer_refs */ "target: add buffer reference", + /* 155 msg_c_report_target_compute */ "target: compute", + /* 156 msg_c_report_target_gather_outputs */ "target: gather outputs", + /* 157 msg_c_report_target_release_buffer_refs */ "target: remove buffer reference", + /* 158 msg_c_coi_pipeline_max_number */ "number of host threads doing offload exceeds maximum of %d", + /* 159 msg_c_ranges_dont_match */ "ranges of source and destination don't match together", + /* 160 msg_c_destination_is_over */ "insufficient destination memory to transfer source", + /* 161 msg_c_slice_of_noncont_array */ "a non-contiguous slice may be taken of contiguous arrays only", + /* 162 msg_c_pointer_array_mismatch */ "number of %s elements is less than described by the source", + /* 163 msg_c_in_with_preallocated */ "offload error: preallocated targetptr alloc_if(1) may not be used with an in clause", + /* 164 msg_c_report_no_host_exe */ "offload error: Cannot find host executable", + /* 165 msg_c_report_path_buff_overflow */ "offload error: Size of host executable path exceeded 4KB", + /* 166 msg_c_create_pipeline_for_stream */ "offload error: number of cpus exceeds maximum of %d", + /* 167 msg_c_offload_no_stream */ "offload error: the stream isn't found on device %d", + /* 168 msg_c_get_engine_info */ "offload error: cannot get device %d info (error code %d)", + /* 169 msg_c_clear_cpu_mask */ "offload error: cannot clear cpu mask (error code %d)", + /* 170 msg_c_set_cpu_mask */ "offload error: cannot set cpu mask (error code %d)", + /* 171 msg_c_report_state_stream */ "Stream", + /* 172 msg_c_report_stream */ "stream :", + /* 173 msg_c_unload_library */ "offload error: cannot unload library from the device %d (error code %d)", }; diff --git a/liboffloadmic/runtime/mic_lib.f90 b/liboffloadmic/runtime/mic_lib.f90 index c68e059aa19..1431716777e 100644 --- a/liboffloadmic/runtime/mic_lib.f90 +++ b/liboffloadmic/runtime/mic_lib.f90 @@ -1,5 +1,5 @@ ! -! Copyright (c) 2014 Intel Corporation. All Rights Reserved. +! Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. ! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload.h b/liboffloadmic/runtime/offload.h index 9234b0011f9..5ee06fe24c0 100644 --- a/liboffloadmic/runtime/offload.h +++ b/liboffloadmic/runtime/offload.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -42,6 +42,13 @@ #include <stddef.h> #include <omp.h> +#ifdef TARGET_WINNT +// <stdint.h> is not compatible with Windows +typedef unsigned long long int uint64_t; +#else +#include <stdint.h> +#endif // TARGET_WINNT + #ifdef __cplusplus extern "C" { #endif @@ -86,6 +93,8 @@ typedef struct { size_t data_received; /* number of bytes received by host */ } _Offload_status; +typedef uint64_t _Offload_stream; + #define OFFLOAD_STATUS_INIT(x) \ ((x).result = OFFLOAD_DISABLED) @@ -98,14 +107,57 @@ extern int _Offload_number_of_devices(void); extern int _Offload_get_device_number(void); extern int _Offload_get_physical_device_number(void); +/* Offload stream runtime interfaces */ + +extern _Offload_stream _Offload_stream_create( + int device, // MIC device number + int number_of_cpus // Cores allocated to the stream +); + +extern int _Offload_stream_destroy( + int device, // MIC device number + _Offload_stream stream // stream handle +); + +extern int _Offload_stream_completed( + int device, // MIC device number + _Offload_stream handle // stream handle +); + +/* + * _Offload_shared_malloc/free are only supported when offload is enabled + * else they are defined to malloc and free +*/ +#ifdef __INTEL_OFFLOAD extern void* _Offload_shared_malloc(size_t size); extern void _Offload_shared_free(void *ptr); - extern void* _Offload_shared_aligned_malloc(size_t size, size_t align); extern void _Offload_shared_aligned_free(void *ptr); +#else +#include <malloc.h> +#define _Offload_shared_malloc(size) malloc(size) +#define _Offload_shared_free(ptr) free(ptr); +#if defined(_WIN32) +#define _Offload_shared_aligned_malloc(size, align) _aligned_malloc(size, align) +#define _Offload_shared_aligned_free(ptr) _aligned_free(ptr); +#else +#define _Offload_shared_aligned_malloc(size, align) memalign(align, size) +#define _Offload_shared_aligned_free(ptr) free(ptr); +#endif +#endif + extern int _Offload_signaled(int index, void *signal); extern void _Offload_report(int val); +extern int _Offload_find_associated_mic_memory( + int target, + const void* cpu_addr, + void** cpu_base_addr, + uint64_t* buf_length, + void** mic_addr, + uint64_t* mic_buf_start_offset, + int* is_static +); /* OpenMP API */ @@ -343,7 +395,11 @@ namespace __offload { shared_allocator<void>::const_pointer) { /* Allocate from shared memory. */ void *ptr = _Offload_shared_malloc(s*sizeof(T)); - if (ptr == 0) std::__throw_bad_alloc(); +#if (defined(_WIN32) || defined(_WIN64)) /* Windows */ + if (ptr == 0) throw std::bad_alloc(); +#else + if (ptr == 0) std::__throw_bad_alloc(); +#endif return static_cast<pointer>(ptr); } /* allocate */ @@ -355,13 +411,13 @@ namespace __offload { } /* deallocate */ template <typename _T1, typename _T2> - inline bool operator==(const shared_allocator<_T1> &, + inline bool operator==(const shared_allocator<_T1> &, const shared_allocator<_T2> &) throw() { return true; } /* operator== */ template <typename _T1, typename _T2> - inline bool operator!=(const shared_allocator<_T1> &, + inline bool operator!=(const shared_allocator<_T1> &, const shared_allocator<_T2> &) throw() { return false; } /* operator!= */ diff --git a/liboffloadmic/runtime/offload_common.cpp b/liboffloadmic/runtime/offload_common.cpp index 72c355f6f18..200def566c5 100644 --- a/liboffloadmic/runtime/offload_common.cpp +++ b/liboffloadmic/runtime/offload_common.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_common.h b/liboffloadmic/runtime/offload_common.h index 60b5045b9b5..0fb66b553b7 100644 --- a/liboffloadmic/runtime/offload_common.h +++ b/liboffloadmic/runtime/offload_common.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -40,10 +40,6 @@ #include <string.h> #include <memory.h> -#if (defined(LINUX) || defined(FREEBSD)) && !defined(__INTEL_COMPILER) -#include <mm_malloc.h> -#endif - #include "offload.h" #include "offload_table.h" #include "offload_trace.h" @@ -65,22 +61,24 @@ // The debug routines // Host console and file logging -extern int console_enabled; -extern int offload_report_level; +DLL_LOCAL extern int console_enabled; +DLL_LOCAL extern int offload_report_level; -#define OFFLOAD_DO_TRACE (offload_report_level == 3) -extern const char *prefix; -extern int offload_number; +DLL_LOCAL extern const char *prefix; +DLL_LOCAL extern int offload_number; #if !HOST_LIBRARY -extern int mic_index; +DLL_LOCAL extern int mic_index; +#define OFFLOAD_DO_TRACE (offload_report_level == 3) +#else +#define OFFLOAD_DO_TRACE (offload_report_enabled && (offload_report_level == 3)) #endif #if HOST_LIBRARY -void Offload_Report_Prolog(OffloadHostTimerData* timer_data); -void Offload_Report_Epilog(OffloadHostTimerData* timer_data); -void offload_report_free_data(OffloadHostTimerData * timer_data); -void Offload_Timer_Print(void); +DLL_LOCAL void Offload_Report_Prolog(OffloadHostTimerData* timer_data); +DLL_LOCAL void Offload_Report_Epilog(OffloadHostTimerData* timer_data); +DLL_LOCAL void offload_report_free_data(OffloadHostTimerData * timer_data); +DLL_LOCAL void Offload_Timer_Print(void); #ifndef TARGET_WINNT #define OFFLOAD_DEBUG_INCR_OFLD_NUM() \ @@ -130,7 +128,7 @@ void Offload_Timer_Print(void); #define OFFLOAD_DEBUG_DUMP_BYTES(level, a, b) \ __dump_bytes(level, a, b) -extern void __dump_bytes( +DLL_LOCAL extern void __dump_bytes( int level, const void *data, int len @@ -156,6 +154,17 @@ extern void *OFFLOAD_MALLOC(size_t size, size_t align); // The Marshaller +// Flags describing an offload + +//! Flags describing an offload +union OffloadFlags{ + uint32_t flags; + struct { + uint32_t fortran_traceback : 1; //!< Fortran traceback requested + uint32_t omp_async : 1; //!< OpenMP asynchronous offload + } bits; +}; + //! \enum Indicator for the type of entry on an offload item list. enum OffloadItemType { c_data = 1, //!< Plain data @@ -203,6 +212,44 @@ enum OffloadParameterType { c_parameter_inout //!< Variable listed in "inout" clause }; + +//! Flags describing an offloaded variable +union varDescFlags { + struct { + //! source variable has persistent storage + uint32_t is_static : 1; + //! destination variable has persistent storage + uint32_t is_static_dstn : 1; + //! has length for c_dv && c_dv_ptr + uint32_t has_length : 1; + //! persisted local scalar is in stack buffer + uint32_t is_stack_buf : 1; + //! "targetptr" modifier used + uint32_t targetptr : 1; + //! "preallocated" modifier used + uint32_t preallocated : 1; + //! Needs documentation + uint32_t is_pointer : 1; + + //! buffer address is sent in data + uint32_t sink_addr : 1; + //! alloc displacement is sent in data + uint32_t alloc_disp : 1; + //! source data is noncontiguous + uint32_t is_noncont_src : 1; + //! destination data is noncontiguous + uint32_t is_noncont_dst : 1; + + //! "OpenMP always" modifier used + uint32_t always_copy : 1; + //! "OpenMP delete" modifier used + uint32_t always_delete : 1; + //! CPU memory pinning/unpinning operation + uint32_t pin : 1; + }; + uint32_t bits; +}; + //! An Offload Variable descriptor struct VarDesc { //! OffloadItemTypes of source and destination @@ -230,27 +277,7 @@ struct VarDesc { /*! Used by runtime as offset to data from start of MIC buffer */ uint32_t mic_offset; //! Flags describing this variable - union { - struct { - //! source variable has persistent storage - uint32_t is_static : 1; - //! destination variable has persistent storage - uint32_t is_static_dstn : 1; - //! has length for c_dv && c_dv_ptr - uint32_t has_length : 1; - //! persisted local scalar is in stack buffer - uint32_t is_stack_buf : 1; - //! buffer address is sent in data - uint32_t sink_addr : 1; - //! alloc displacement is sent in data - uint32_t alloc_disp : 1; - //! source data is noncontiguous - uint32_t is_noncont_src : 1; - //! destination data is noncontiguous - uint32_t is_noncont_dst : 1; - }; - uint32_t bits; - } flags; + varDescFlags flags; //! Not used by compiler; set to 0 /*! Used by runtime as offset to base from data stored in a buffer */ int64_t offset; @@ -472,4 +499,16 @@ struct FunctionDescriptor // Pointer to OffloadDescriptor. typedef struct OffloadDescriptor *OFFLOAD; +// Use for setting affinity of a stream +enum affinity_type { + affinity_compact, + affinity_scatter +}; +struct affinity_spec { + uint64_t sink_mask[16]; + int affinity_type; + int num_cores; + int num_threads; +}; + #endif // OFFLOAD_COMMON_H_INCLUDED diff --git a/liboffloadmic/runtime/offload_engine.cpp b/liboffloadmic/runtime/offload_engine.cpp index 2fe0d24430c..16b440d7ab6 100644 --- a/liboffloadmic/runtime/offload_engine.cpp +++ b/liboffloadmic/runtime/offload_engine.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -37,6 +37,14 @@ #include "offload_host.h" #include "offload_table.h" +#include "offload_iterator.h" + +// Static members of Stream class must be described somewhere. +// This members describe the list of all streams defined in programm +// via call to _Offload_stream_create. +uint64_t Stream::m_streams_count = 0; +StreamMap Stream::all_streams; +mutex_t Stream::m_stream_lock; const char* Engine::m_func_names[Engine::c_funcs_total] = { @@ -47,7 +55,8 @@ const char* Engine::m_func_names[Engine::c_funcs_total] = #endif // MYO_SUPPORT "server_init", "server_var_table_size", - "server_var_table_copy" + "server_var_table_copy", + "server_set_stream_affinity" }; // Symbolic representation of system signals. Fix for CQ233593 @@ -115,6 +124,7 @@ void Engine::init_process(void) COIENGINE engine; COIRESULT res; const char **environ; + char buf[4096]; // For exe path name // create environment for the target process environ = (const char**) mic_env_vars.create_environ_for_card(m_index); @@ -127,39 +137,147 @@ void Engine::init_process(void) // Create execution context in the specified device OFFLOAD_DEBUG_TRACE(2, "Getting device %d (engine %d) handle\n", m_index, m_physical_index); - res = COI::EngineGetHandle(COI_ISA_KNC, m_physical_index, &engine); + res = COI::EngineGetHandle(COI_ISA_MIC, m_physical_index, &engine); check_result(res, c_get_engine_handle, m_index, res); - // Target executable should be available by the time when we - // attempt to initialize the device + // Get engine info on threads and cores. + // The values of core number and thread number will be used later at stream + // creation by call to _Offload_stream_create(device,number_of_cpus). + + COI_ENGINE_INFO engine_info; + + res = COI::EngineGetInfo(engine, sizeof(COI_ENGINE_INFO), &engine_info); + check_result(res, c_get_engine_info, m_index, res); + + // m_cpus bitset has 1 for available thread. At the begining all threads + // are available and m_cpus(i) is set to + // 1 for i = [0...engine_info.NumThreads]. + m_cpus.reset(); + for (int i = 0; i < engine_info.NumThreads; i++) { + m_cpus.set(i); + } + + // The following values will be used at pipeline creation for streams + m_num_cores = engine_info.NumCores; + m_num_threads = engine_info.NumThreads; + + // Check if OFFLOAD_DMA_CHANNEL_COUNT is set to 2 + // Only the value 2 is supported in 16.0 + if (mic_dma_channel_count == 2) { + if (COI::ProcessConfigureDMA) { + // Set DMA channels using COI API + COI::ProcessConfigureDMA(2, COI::DMA_MODE_READ_WRITE); + } + else { + // Set environment variable COI_DMA_CHANNEL_COUNT + // use putenv instead of setenv as Windows has no setenv. + // Note: putenv requires its argument can't be freed or modified. + // So no free after call to putenv or elsewhere. + char * env_var = (char*) malloc(sizeof("COI_DMA_CHANNEL_COUNT=2" + 1)); + sprintf(env_var, "COI_DMA_CHANNEL_COUNT=2"); + putenv(env_var); + } + } + + // Target executable is not available then use compiler provided offload_main if (__target_exe == 0) { - LIBOFFLOAD_ERROR(c_no_target_exe); - exit(1); + if (mic_device_main == 0) + LIBOFFLOAD_ERROR(c_report_no_host_exe); + + OFFLOAD_DEBUG_TRACE(2, + "Loading target executable %s\n",mic_device_main); + + res = COI::ProcessCreateFromFile( + engine, // in_Engine + mic_device_main, // in_pBinaryName + 0, // in_Argc + 0, // in_ppArgv + environ == 0, // in_DupEnv + environ, // in_ppAdditionalEnv + mic_proxy_io, // in_ProxyActive + mic_proxy_fs_root, // in_ProxyfsRoot + mic_buffer_size, // in_BufferSpace + mic_library_path, // in_LibrarySearchPath + &m_process // out_pProcess + ); } + else { + // Target executable should be available by the time when we + // attempt to initialize the device - OFFLOAD_DEBUG_TRACE(2, - "Loading target executable \"%s\" from %p, size %lld\n", - __target_exe->name, __target_exe->data, __target_exe->size); - - res = COI::ProcessCreateFromMemory( - engine, // in_Engine - __target_exe->name, // in_pBinaryName - __target_exe->data, // in_pBinaryBuffer - __target_exe->size, // in_BinaryBufferLength, - 0, // in_Argc - 0, // in_ppArgv - environ == 0, // in_DupEnv - environ, // in_ppAdditionalEnv - mic_proxy_io, // in_ProxyActive - mic_proxy_fs_root, // in_ProxyfsRoot - mic_buffer_size, // in_BufferSpace - mic_library_path, // in_LibrarySearchPath - __target_exe->origin, // in_FileOfOrigin - __target_exe->offset, // in_FileOfOriginOffset - &m_process // out_pProcess - ); + // Need the full path of the FAT exe for VTUNE + { +#ifndef TARGET_WINNT + ssize_t len = readlink("/proc/self/exe", buf,1000); +#else + int len = GetModuleFileName(NULL, buf,1000); +#endif // TARGET_WINNT + if (len == -1) { + LIBOFFLOAD_ERROR(c_report_no_host_exe); + exit(1); + } + else if (len > 999) { + LIBOFFLOAD_ERROR(c_report_path_buff_overflow); + exit(1); + } + buf[len] = '\0'; + } + + OFFLOAD_DEBUG_TRACE(2, + "Loading target executable \"%s\" from %p, size %lld, host file %s\n", + __target_exe->name, __target_exe->data, __target_exe->size, + buf); + + res = COI::ProcessCreateFromMemory( + engine, // in_Engine + __target_exe->name, // in_pBinaryName + __target_exe->data, // in_pBinaryBuffer + __target_exe->size, // in_BinaryBufferLength, + 0, // in_Argc + 0, // in_ppArgv + environ == 0, // in_DupEnv + environ, // in_ppAdditionalEnv + mic_proxy_io, // in_ProxyActive + mic_proxy_fs_root, // in_ProxyfsRoot + mic_buffer_size, // in_BufferSpace + mic_library_path, // in_LibrarySearchPath + buf, // in_FileOfOrigin + -1, // in_FileOfOriginOffset use -1 to indicate to + // COI that is is a FAT binary + &m_process // out_pProcess + ); + } check_result(res, c_process_create, m_index, res); + if ((mic_4k_buffer_size != 0) || (mic_2m_buffer_size !=0)) { + // available only in MPSS 4.2 and greater + if (COI::ProcessSetCacheSize != 0 ) { + int flags; + // Need compiler to use MPSS 3.2 or greater to get these + // definition so currently hardcoding it + // COI_CACHE_ACTION_GROW_NOW && COI_CACHE_MODE_ONDEMAND_SYNC; + flags = 0x00020002; + res = COI::ProcessSetCacheSize( + m_process, // in_Process + mic_2m_buffer_size, // in_HugePagePoolSize + flags, // inHugeFlags + mic_4k_buffer_size, // in_SmallPagePoolSize + flags, // inSmallFlags + 0, // in_NumDependencies + 0, // in_pDependencies + 0 // out_PCompletion + ); + OFFLOAD_DEBUG_TRACE(2, + "Reserve target buffers 4K pages = %d 2M pages = %d\n", + mic_4k_buffer_size, mic_2m_buffer_size); + check_result(res, c_process_set_cache_size, m_index, res); + } + else { + OFFLOAD_DEBUG_TRACE(2, + "Reserve target buffers not supported in current MPSS\n"); + } + } + // get function handles res = COI::ProcessGetFunctionHandles(m_process, c_funcs_total, m_func_names, m_funcs); @@ -226,8 +344,9 @@ void Engine::load_libraries() // load libraries collected so far for (TargetImageList::iterator it = m_images.begin(); it != m_images.end(); it++) { - OFFLOAD_DEBUG_TRACE(2, "Loading library \"%s\" from %p, size %llu\n", - it->name, it->data, it->size); + OFFLOAD_DEBUG_TRACE(2, + "Loading library \"%s\" from %p, size %llu, host file %s\n", + it->name, it->data, it->size, it->origin); // load library to the device COILIBRARY lib; @@ -238,9 +357,10 @@ void Engine::load_libraries() it->name, mic_library_path, it->origin, - it->offset, + (it->origin) ? -1 : 0, COI_LOADLIBRARY_V1_FLAGS, &lib); + m_dyn_libs.push_front(DynLib(it->name, it->data, lib)); if (res != COI_SUCCESS && res != COI_ALREADY_EXISTS) { check_result(res, c_load_library, m_index, res); @@ -249,6 +369,27 @@ void Engine::load_libraries() m_images.clear(); } +void Engine::unload_library(const void *data, const char *name) +{ + if (m_process == 0) { + return; + } + for (DynLibList::iterator it = m_dyn_libs.begin(); + it != m_dyn_libs.end(); it++) { + if (it->data == data) { + COIRESULT res; + OFFLOAD_DEBUG_TRACE(2, + "Unloading library \"%s\"\n",name); + res = COI::ProcessUnloadLibrary(m_process,it->lib); + m_dyn_libs.erase(it); + if (res != COI_SUCCESS) { + check_result(res, c_unload_library, m_index, res); + } + return; + } + } +} + static bool target_entry_cmp( const VarList::BufEntry &l, const VarList::BufEntry &r @@ -273,8 +414,9 @@ void Engine::init_ptr_data(void) COIEVENT event; // Prepare table of host entries - std::vector<const VarTable::Entry*> host_table(__offload_vars.begin(), - __offload_vars.end()); + std::vector<const VarTable::Entry*> host_table( + Iterator(__offload_vars.get_head()), + Iterator()); // no need to do anything further is host table is empty if (host_table.size() <= 0) { @@ -348,17 +490,16 @@ void Engine::init_ptr_data(void) while (hi != he && ti != te) { int res = strcmp((*hi)->name, reinterpret_cast<const char*>(ti->name)); if (res == 0) { + bool is_new; // add matching entry to var map - std::pair<PtrSet::iterator, bool> res = - m_ptr_set.insert(PtrData((*hi)->addr, (*hi)->size)); + PtrData *ptr = insert_ptr_data((*hi)->addr, (*hi)->size, is_new); // store address for new entries - if (res.second) { - PtrData *ptr = const_cast<PtrData*>(res.first.operator->()); + if (is_new) { ptr->mic_addr = ti->addr; ptr->is_static = true; } - + ptr->alloc_ptr_data_lock.unlock(); hi++; ti++; } @@ -379,6 +520,7 @@ void Engine::init_ptr_data(void) } COIRESULT Engine::compute( + _Offload_stream stream, const std::list<COIBUFFER> &buffers, const void* data, uint16_t data_size, @@ -413,9 +555,11 @@ COIRESULT Engine::compute( bufs = 0; flags = 0; } - + COIPIPELINE pipeline = (stream == no_stream) ? + get_pipeline() : + get_pipeline(stream); // start computation - res = COI::PipelineRunFunction(get_pipeline(), + res = COI::PipelineRunFunction(pipeline, m_funcs[c_func_compute], num_bufs, bufs, flags, num_deps, deps, @@ -528,12 +672,214 @@ COIPIPELINE Engine::get_pipeline(void) // create pipeline for this thread res = COI::PipelineCreate(m_process, 0, mic_stack_size, &pipeline); check_result(res, c_pipeline_create, m_index, res); - thread->set_pipeline(m_index, pipeline); } return pipeline; } +Stream* Stream::find_stream(uint64_t handle, bool remove) +{ + Stream *stream = 0; + + m_stream_lock.lock(); + { + StreamMap::iterator it = all_streams.find(handle); + if (it != all_streams.end()) { + stream = it->second; + if (remove) { + all_streams.erase(it); + } + } + } + m_stream_lock.unlock(); + return stream; +} + +COIPIPELINE Engine::get_pipeline(_Offload_stream handle) +{ + Stream * stream = Stream::find_stream(handle, false); + + if (!stream) { + LIBOFFLOAD_ERROR(c_offload_no_stream, m_index); + LIBOFFLOAD_ABORT; + } + + COIPIPELINE pipeline = stream->get_pipeline(); + + if (pipeline == 0) { + COIRESULT res; + int proc_num; + COI_CPU_MASK in_Mask ; + +#ifndef TARGET_WINNT + proc_num = __sync_fetch_and_add(&m_proc_number, 1); +#else // TARGET_WINNT + proc_num = _InterlockedIncrement(&m_proc_number); +#endif // TARGET_WINNT + + if (proc_num > COI_PIPELINE_MAX_PIPELINES) { + LIBOFFLOAD_ERROR(c_coipipe_max_number, COI_PIPELINE_MAX_PIPELINES); + LIBOFFLOAD_ABORT; + } + + m_stream_lock.lock(); + + // start process if not done yet + if (m_process == 0) { + init_process(); + } + + // create CPUmask + res = COI::PipelineClearCPUMask(in_Mask); + check_result(res, c_clear_cpu_mask, m_index, res); + + int stream_cpu_num = stream->get_cpu_number(); + + stream->m_stream_cpus.reset(); + + int threads_per_core = m_num_threads / m_num_cores; + + // The "stream_cpu_num" available threads is set in mask. + // Available threads are defined by examining of m_cpus bitset. + // We skip thread 0 . + for (int i = 1; i < m_num_threads; i++) { + // for available thread i m_cpus[i] is equal to 1 + if (m_cpus[i]) { + res = COI::PipelineSetCPUMask(m_process, + i / threads_per_core, + i % threads_per_core, + in_Mask); + + check_result(res, c_set_cpu_mask, res); + // mark thread i as nonavailable + m_cpus.set(i,0); + // Mark thread i as given for the stream. + // In case of stream destroying by call to + // _Offload_stream_destroy we can mark the thread i as + // available. + stream->m_stream_cpus.set(i); + if (--stream_cpu_num <= 0) { + break; + } + } + } + + // if stream_cpu_num is greater than 0 there are not enough + // available threads + if (stream_cpu_num > 0) { + LIBOFFLOAD_ERROR(c_create_pipeline_for_stream, m_num_threads); + LIBOFFLOAD_ABORT; + } + // create pipeline for this thread + OFFLOAD_DEBUG_TRACE(2, "COIPipelineCreate Mask\n" + "%016lx %016lx %016lx %016lx\n%016lx %016lx %016lx %016lx\n" + "%016lx %016lx %016lx %016lx\n%016lx %016lx %016lx %016lx\n", + in_Mask[0], in_Mask[1], in_Mask[2], in_Mask[3], + in_Mask[4], in_Mask[5], in_Mask[6], in_Mask[7], + in_Mask[8], in_Mask[9], in_Mask[10], in_Mask[11], + in_Mask[12], in_Mask[13], in_Mask[14], in_Mask[15]); + res = COI::PipelineCreate(m_process, in_Mask, + mic_stack_size, &pipeline); + check_result(res, c_pipeline_create, m_index, res); + + // Set stream's affinities + { + struct affinity_spec affinity_spec; + char* affinity_type; + int i; + + // "compact" by default + affinity_spec.affinity_type = affinity_compact; + + // Check if user has specified type of affinity + if ((affinity_type = getenv("OFFLOAD_STREAM_AFFINITY")) != + NULL) + { + char affinity_str[16]; + int affinity_str_len; + + OFFLOAD_DEBUG_TRACE(2, + "User has specified OFFLOAD_STREAM_AFFINITY=%s\n", + affinity_type); + + // Set type of affinity requested + affinity_str_len = strlen(affinity_type); + for (i=0; i<affinity_str_len && i<15; i++) + { + affinity_str[i] = tolower(affinity_type[i]); + } + affinity_str[i] = '\0'; + if (strcmp(affinity_str, "compact") == 0) { + affinity_spec.affinity_type = affinity_compact; + OFFLOAD_DEBUG_TRACE(2, "Setting affinity=compact\n"); + } else if (strcmp(affinity_str, "scatter") == 0) { + affinity_spec.affinity_type = affinity_scatter; + OFFLOAD_DEBUG_TRACE(2, "Setting affinity=scatter\n"); + } else { + LIBOFFLOAD_ERROR(c_incorrect_affinity, affinity_str); + affinity_spec.affinity_type = affinity_compact; + OFFLOAD_DEBUG_TRACE(2, "Setting affinity=compact\n"); + } + } + // Make flat copy of sink mask because COI's mask is opaque + for (i=0; i<16; i++) { + affinity_spec.sink_mask[i] = in_Mask[i]; + } + // Set number of cores and threads + affinity_spec.num_cores = m_num_cores; + affinity_spec.num_threads = m_num_threads; + + COIEVENT event; + res = COI::PipelineRunFunction(pipeline, + m_funcs[c_func_set_stream_affinity], + 0, 0, 0, + 0, 0, + &affinity_spec, sizeof(affinity_spec), + 0, 0, + &event); + check_result(res, c_pipeline_run_func, m_index, res); + + res = COI::EventWait(1, &event, -1, 1, 0, 0); + check_result(res, c_event_wait, res); + } + + m_stream_lock.unlock(); + stream->set_pipeline(pipeline); + } + return pipeline; +} + +void Engine::stream_destroy(_Offload_stream handle) +{ + // get stream + Stream * stream = Stream::find_stream(handle, true); + + if (stream) { + // return cpus for future use + for (int i = 0; i < m_num_threads; i++) { + if (stream->m_stream_cpus.test(i)) { + m_cpus.set(i); + } + } + delete stream; + } + else { + LIBOFFLOAD_ERROR(c_offload_no_stream, m_index); + LIBOFFLOAD_ABORT; + } +} + +uint64_t Engine::get_thread_id(void) +{ + Thread* thread = (Thread*) thread_getspecific(mic_thread_key); + if (thread == 0) { + thread = new Thread(&m_proc_number); + thread_setspecific(mic_thread_key, thread); + } + + return reinterpret_cast<uint64_t>(thread); +} + AutoSet& Engine::get_auto_vars(void) { Thread* thread = (Thread*) thread_getspecific(mic_thread_key); diff --git a/liboffloadmic/runtime/offload_engine.h b/liboffloadmic/runtime/offload_engine.h index 501890c5834..abd5cc82f30 100644 --- a/liboffloadmic/runtime/offload_engine.h +++ b/liboffloadmic/runtime/offload_engine.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -32,13 +32,16 @@ #define OFFLOAD_ENGINE_H_INCLUDED #include <limits.h> - +#include <bitset> #include <list> #include <set> #include <map> #include "offload_common.h" #include "coi/coi_client.h" +#define SIGNAL_IS_REMOVED ((OffloadDescriptor *)-1) +const int64_t no_stream = -1; + // Address range class MemRange { public: @@ -157,6 +160,50 @@ private: typedef std::list<PtrData*> PtrDataList; +class PtrDataTable { +public: + typedef std::set<PtrData> PtrSet; + + PtrData* find_ptr_data(const void *ptr) { + m_ptr_lock.lock(); + PtrSet::iterator res = list.find(PtrData(ptr, 0)); + + m_ptr_lock.unlock(); + if (res == list.end()) { + return 0; + } + return const_cast<PtrData*>(res.operator->()); + } + + PtrData* insert_ptr_data(const void *ptr, uint64_t len, bool &is_new) { + m_ptr_lock.lock(); + std::pair<PtrSet::iterator, bool> res = + list.insert(PtrData(ptr, len)); + + PtrData* ptr_data = const_cast<PtrData*>(res.first.operator->()); + m_ptr_lock.unlock(); + + is_new = res.second; + if (is_new) { + // It's necessary to lock as soon as possible. + // unlock must be done at call site of insert_ptr_data at + // branch for is_new + ptr_data->alloc_ptr_data_lock.lock(); + } + return ptr_data; + } + + void remove_ptr_data(const void *ptr) { + m_ptr_lock.lock(); + list.erase(PtrData(ptr, 0)); + m_ptr_lock.unlock(); + } +private: + + PtrSet list; + mutex_t m_ptr_lock; +}; + // Data associated with automatic variable class AutoData { public: @@ -186,7 +233,15 @@ public: return _InterlockedDecrement(&ref_count); #endif // TARGET_WINNT } - + + long nullify_reference() { +#ifndef TARGET_WINNT + return __sync_lock_test_and_set(&ref_count, 0); +#else // TARGET_WINNT + return _InterlockedExchange(&ref_count,0); +#endif // TARGET_WINNT + } + long get_reference() const { return ref_count; } @@ -226,18 +281,39 @@ struct TargetImage typedef std::list<TargetImage> TargetImageList; +// dynamic library and Image associated with lib +struct DynLib +{ + DynLib(const char *_name, const void *_data, + COILIBRARY _lib) : + name(_name), data(_data), lib(_lib) + {} + // library name + const char* name; + + // contents + const void* data; + + COILIBRARY lib; +}; +typedef std::list<DynLib> DynLibList; + // Data associated with persistent auto objects struct PersistData { - PersistData(const void *addr, uint64_t routine_num, uint64_t size) : - stack_cpu_addr(addr), routine_id(routine_num) + PersistData(const void *addr, uint64_t routine_num, + uint64_t size, uint64_t thread) : + stack_cpu_addr(addr), routine_id(routine_num), thread_id(thread) { stack_ptr_data = new PtrData(0, size); } - // 1-st key value - begining of the stack at CPU + // 1-st key value - beginning of the stack at CPU const void * stack_cpu_addr; // 2-nd key value - identifier of routine invocation at CPU uint64_t routine_id; + // 3-rd key value - thread identifier + uint64_t thread_id; + // corresponded PtrData; only stack_ptr_data->mic_buf is used PtrData * stack_ptr_data; // used to get offset of the variable in stack buffer @@ -246,6 +322,75 @@ struct PersistData typedef std::list<PersistData> PersistDataList; +// Data associated with stream +struct Stream +{ + Stream(int device, int num_of_cpus) : + m_number_of_cpus(num_of_cpus), m_pipeline(0), m_last_offload(0), + m_device(device) + {} + ~Stream() { + if (m_pipeline) { + COI::PipelineDestroy(m_pipeline); + } + } + + COIPIPELINE get_pipeline(void) { + return(m_pipeline); + } + + int get_device(void) { + return(m_device); + } + + int get_cpu_number(void) { + return(m_number_of_cpus); + } + + void set_pipeline(COIPIPELINE pipeline) { + m_pipeline = pipeline; + } + + OffloadDescriptor* get_last_offload(void) { + return(m_last_offload); + } + + void set_last_offload(OffloadDescriptor* last_offload) { + m_last_offload = last_offload; + } + + static Stream* find_stream(uint64_t handle, bool remove); + + static _Offload_stream add_stream(int device, int number_of_cpus) { + m_stream_lock.lock(); + all_streams[++m_streams_count] = new Stream(device, number_of_cpus); + m_stream_lock.unlock(); + return(m_streams_count); + } + + typedef std::map<uint64_t, Stream*> StreamMap; + + static uint64_t m_streams_count; + static StreamMap all_streams; + static mutex_t m_stream_lock; + + int m_device; + + // number of cpus + int m_number_of_cpus; + + // The pipeline associated with the stream + COIPIPELINE m_pipeline; + + // The last offload occured via the stream + OffloadDescriptor* m_last_offload; + + // Cpus used by the stream + std::bitset<COI_MAX_HW_THREADS> m_stream_cpus; +}; + +typedef std::map<uint64_t, Stream*> StreamMap; + // class representing a single engine struct Engine { friend void __offload_init_library_once(void); @@ -275,9 +420,14 @@ struct Engine { return m_process; } + uint64_t get_thread_id(void); + // initialize device void init(void); + // unload library + void unload_library(const void *data, const char *name); + // add new library void add_lib(const TargetImage &lib) { @@ -288,6 +438,7 @@ struct Engine { } COIRESULT compute( + _Offload_stream stream, const std::list<COIBUFFER> &buffers, const void* data, uint16_t data_size, @@ -323,36 +474,28 @@ struct Engine { // Memory association table // PtrData* find_ptr_data(const void *ptr) { - m_ptr_lock.lock(); - PtrSet::iterator res = m_ptr_set.find(PtrData(ptr, 0)); - m_ptr_lock.unlock(); - if (res == m_ptr_set.end()) { - return 0; - } - return const_cast<PtrData*>(res.operator->()); + return m_ptr_set.find_ptr_data(ptr); + } + + PtrData* find_targetptr_data(const void *ptr) { + return m_targetptr_set.find_ptr_data(ptr); } PtrData* insert_ptr_data(const void *ptr, uint64_t len, bool &is_new) { - m_ptr_lock.lock(); - std::pair<PtrSet::iterator, bool> res = - m_ptr_set.insert(PtrData(ptr, len)); - PtrData* ptr_data = const_cast<PtrData*>(res.first.operator->()); - m_ptr_lock.unlock(); + return m_ptr_set.insert_ptr_data(ptr, len, is_new); + } - is_new = res.second; - if (is_new) { - // It's necessary to lock as soon as possible. - // unlock must be done at call site of insert_ptr_data at - // branch for is_new - ptr_data->alloc_ptr_data_lock.lock(); - } - return ptr_data; + PtrData* insert_targetptr_data(const void *ptr, uint64_t len, + bool &is_new) { + return m_targetptr_set.insert_ptr_data(ptr, len, is_new); } void remove_ptr_data(const void *ptr) { - m_ptr_lock.lock(); - m_ptr_set.erase(PtrData(ptr, 0)); - m_ptr_lock.unlock(); + m_ptr_set.remove_ptr_data(ptr); + } + + void remove_targetptr_data(const void *ptr) { + m_targetptr_set.remove_ptr_data(ptr); } // @@ -396,7 +539,7 @@ struct Engine { if (it != m_signal_map.end()) { desc = it->second; if (remove) { - m_signal_map.erase(it); + it->second = SIGNAL_IS_REMOVED; } } } @@ -405,6 +548,14 @@ struct Engine { return desc; } + void stream_destroy(_Offload_stream handle); + + COIPIPELINE get_pipeline(_Offload_stream stream); + + StreamMap get_stream_map() { + return m_stream_map; + } + // stop device process void fini_process(bool verbose); @@ -417,6 +568,11 @@ private: {} ~Engine() { + for (StreamMap::iterator it = m_stream_map.begin(); + it != m_stream_map.end(); it++) { + Stream * stream = it->second; + delete stream; + } if (m_process != 0) { fini_process(false); } @@ -469,14 +625,24 @@ private: // List of libraries to be loaded TargetImageList m_images; - // var table - PtrSet m_ptr_set; - mutex_t m_ptr_lock; + // var tables + PtrDataTable m_ptr_set; + PtrDataTable m_targetptr_set; // signals SignalMap m_signal_map; mutex_t m_signal_lock; + // streams + StreamMap m_stream_map; + mutex_t m_stream_lock; + int m_num_cores; + int m_num_threads; + std::bitset<COI_MAX_HW_THREADS> m_cpus; + + // List of dynamic libraries to be registred + DynLibList m_dyn_libs; + // constants for accessing device function handles enum { c_func_compute = 0, @@ -487,6 +653,7 @@ private: c_func_init, c_func_var_table_size, c_func_var_table_copy, + c_func_set_stream_affinity, c_funcs_total }; static const char* m_func_names[c_funcs_total]; diff --git a/liboffloadmic/runtime/offload_env.cpp b/liboffloadmic/runtime/offload_env.cpp index 447c6edf74e..79f5f366754 100644 --- a/liboffloadmic/runtime/offload_env.cpp +++ b/liboffloadmic/runtime/offload_env.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -146,7 +146,7 @@ void MicEnvVar::add_env_var( else { card = get_card(card_number); if (!card) { - // definition for new card occured + // definition for new card occurred card = new CardEnvVars(card_number); card_spec_list.push_back(card); } @@ -321,7 +321,7 @@ void MicEnvVar::mic_parse_env_var_list( // Collect all definitions for the card with number "card_num". // The returned result is vector of string pointers defining one // environment variable. The vector is terminated by NULL pointer. -// In the begining of the vector there are env vars defined as +// In the beginning of the vector there are env vars defined as // <mic-prefix>_<card-number>_<var>=<value> // or // <mic-prefix>_<card-number>_ENV=<env-vars> diff --git a/liboffloadmic/runtime/offload_env.h b/liboffloadmic/runtime/offload_env.h index e60e8601e9c..01138c2d4c3 100644 --- a/liboffloadmic/runtime/offload_env.h +++ b/liboffloadmic/runtime/offload_env.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #define OFFLOAD_ENV_H_INCLUDED #include <list> +#include "offload_util.h" // data structure and routines to parse MIC user environment and pass to MIC @@ -43,7 +44,7 @@ enum MicEnvVarKind c_mic_card_env // for <mic-prefix>_<card-number>_ENV }; -struct MicEnvVar { +struct DLL_LOCAL MicEnvVar { public: MicEnvVar() : prefix(0) {} ~MicEnvVar(); diff --git a/liboffloadmic/runtime/offload_host.cpp b/liboffloadmic/runtime/offload_host.cpp index 23a873f3886..08f626f457e 100644 --- a/liboffloadmic/runtime/offload_host.cpp +++ b/liboffloadmic/runtime/offload_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,7 +28,8 @@ */ -// Forward declaration as the following 2 functions are declared as friend in offload_engine.h +// Forward declaration as the following 2 functions are declared as friend +// in offload_engine.h. // CLANG does not like static to been after friend declaration. static void __offload_init_library_once(void); static void __offload_fini_library(void); @@ -63,6 +64,55 @@ static void __offload_fini_library(void); #define GET_OFFLOAD_NUMBER(timer_data) \ timer_data? timer_data->offload_number : 0 +extern "C" { +#ifdef TARGET_WINNT +// Windows does not support imports from libraries without actually +// including them as dependence. We don't want to include in the +// dependence since is it used only for Fortran when traceback is enabled. +// Chose to implement it with GetProcAddress. +#define FORTRAN_TRACE_BACK win_for__continue_traceback +int win_for__continue_traceback( _Offload_result coi_offload_result ) +{ + HINSTANCE hDLL; + int (* TraceBackRoutine)(_Offload_result value); + + hDLL = LoadLibrary("libifcoremd.dll"); + if (hDLL != 0) { + TraceBackRoutine = (int (*)(_Offload_result)) GetProcAddress(hDLL, + "for__continue_traceback"); + if (TraceBackRoutine != 0) { + return TraceBackRoutine(coi_offload_result); + } + else { + OFFLOAD_TRACE(3, + "Cannot find for__continue_traceback routine in libifcorert.dll\n"); + exit(1); + } + } + else { + OFFLOAD_TRACE(3, "Cannot load libifcorert.dll\n"); + exit(1); + } + return 0; +} + +#else // TARGET_WINNT + +#define FORTRAN_TRACE_BACK for__continue_traceback + +// for__continue_traceback is provided as a dummy to resolve link time symbols +// for C/C++ programs. For Fortran the actual fortran library function in +// libifcore.so is used. +#pragma weak for__continue_traceback +int for__continue_traceback( _Offload_result coi_offload_result ) +{ + OFFLOAD_TRACE(3, + "liboffload function for_continue_traceback should not be called.\n"); + exit(1); +} +#endif //TARGET_WINNT +} // extern "C" + #ifdef TARGET_WINNT // Small subset of ELF declarations for Windows which is needed to compile // this file. ELF header is used to understand what binary type is contained @@ -104,7 +154,16 @@ int offload_number = 0; static const char *htrace_envname = "H_TRACE"; static const char *offload_report_envname = "OFFLOAD_REPORT"; -static char *timer_envname = "H_TIME"; +static const char *timer_envname = "H_TIME"; + +// location of offload_main executable +// To be used if the main application has no offload and is not built +// with -offload but dynamic library linked in has offload pragma +char* mic_device_main = 0; + +// DMA channel count used by COI and set via +// OFFLOAD_DMA_CHANNEL_COUNT environment variable +uint32_t mic_dma_channel_count; // Trace information static const char* vardesc_direction_as_string[] = { @@ -146,6 +205,13 @@ uint32_t mic_stack_size = 12 * 1024 * 1024; // MIC_BUFFERSIZE uint64_t mic_buffer_size = 0; +// Preallocated 4K page memory size for buffers on MIC +uint64_t mic_4k_buffer_size = 0; + +// Preallocated 2M page memory size for buffers on MIC +uint64_t mic_2m_buffer_size = 0; + + // MIC_LD_LIBRARY_PATH char* mic_library_path = 0; @@ -183,6 +249,15 @@ static const char *offload_active_wait_envname = "OFFLOAD_ACTIVE_WAIT"; int __omp_device_num = 0; static const char *omp_device_num_envname = "OMP_DEFAULT_DEVICE"; +//OFFLOAD_PARALLEL_COPY +static bool __offload_parallel_copy = false; +static const char *parallel_copy_envname = "OFFLOAD_PARALLEL_COPY"; + +//Use COI interface for noncontiguous transfer if it exists. +static bool __offload_use_coi_noncontiguous_transfer = false; +static const char *use_coi_noncontiguous_transfer_envname = + "MIC_USE_COI_MULTI_D"; + // The list of pending target libraries static bool __target_libs; static TargetImageList __target_libs_list; @@ -192,6 +267,112 @@ static mutex_t stack_alloc_lock; // Target executable TargetImage* __target_exe; +// Print readable offload flags +static void trace_offload_flags( + OffloadHostTimerData* timer_data, + OffloadFlags offload_flags +) +{ + // Sized big enough for all flag names + char fbuffer[256]; + bool first = true; + if (!OFFLOAD_DO_TRACE && (console_enabled >= 1)) { + sprintf(fbuffer, " OffloadFlags=("); + if (offload_flags.bits.fortran_traceback) { + sprintf(fbuffer+strlen(fbuffer), "fortran_traceback"); + first = false; + } + if (offload_flags.bits.omp_async) { + sprintf(fbuffer+strlen(fbuffer), first ? "omp_async" : ",omp_async"); + first = false; + } + OFFLOAD_DEBUG_TRACE_1(1, + GET_OFFLOAD_NUMBER(timer_data), c_offload_init_func, + "%s)\n", fbuffer); + } +} + +// Print readable varDesc flags +static void trace_varDesc_flags( + OffloadHostTimerData* timer_data, + varDescFlags offload_flags +) +{ + // SIzed big enough for all flag names + char fbuffer[256]; + bool first = true; + if (!OFFLOAD_DO_TRACE && (console_enabled >= 1)) { + sprintf(fbuffer, " varDescFlags=("); + if (offload_flags.is_static) { + sprintf(fbuffer+strlen(fbuffer), "is_static"); + first = false; + } + if (offload_flags.is_static_dstn) { + sprintf(fbuffer+strlen(fbuffer), + first ? "is_static_dstn" : ",is_static_dstn"); + first = false; + } + if (offload_flags.has_length) { + sprintf(fbuffer+strlen(fbuffer), + first ? "has_length" : ",has_length"); + first = false; + } + if (offload_flags.is_stack_buf) { + sprintf(fbuffer+strlen(fbuffer), + first ? "is_stack_buf" : ",is_stack_buf"); + first = false; + } + if (offload_flags.targetptr) { + sprintf(fbuffer+strlen(fbuffer), + first ? "targetptr" : ",targetptr"); + first = false; + } + if (offload_flags.preallocated) { + sprintf(fbuffer+strlen(fbuffer), + first ? "preallocated" : ",preallocated"); + first = false; + } + if (offload_flags.is_pointer) { + sprintf(fbuffer+strlen(fbuffer), + first ? "is_pointer" : ",is_pointer"); + first = false; + } + if (offload_flags.sink_addr) { + sprintf(fbuffer+strlen(fbuffer), + first ? "sink_addr" : ",sink_addr"); + first = false; + } + if (offload_flags.alloc_disp) { + sprintf(fbuffer+strlen(fbuffer), + first ? "alloc_disp" : ",alloc_disp"); + first = false; + } + if (offload_flags.is_noncont_src) { + sprintf(fbuffer+strlen(fbuffer), + first ? "is_noncont_src" : ",is_noncont_src"); + first = false; + } + if (offload_flags.is_noncont_dst) { + sprintf(fbuffer+strlen(fbuffer), + first ? "is_noncont_dst" : ",is_noncont_dst"); + first = false; + } + if (offload_flags.always_copy) { + sprintf(fbuffer+strlen(fbuffer), + first ? "always_copy" : ",always_copy"); + first = false; + } + if (offload_flags.always_delete) { + sprintf(fbuffer+strlen(fbuffer), + first ? "always_delete" : ",always_delete"); + first = false; + } + OFFLOAD_DEBUG_TRACE_1(1, + GET_OFFLOAD_NUMBER(timer_data), c_offload_init_func, + "%s)\n", fbuffer); + } +} + static char * offload_get_src_base(void * ptr, uint8_t type) { char *base; @@ -204,7 +385,7 @@ static char * offload_get_src_base(void * ptr, uint8_t type) else if (VAR_TYPE_IS_DV_DATA_SLICE(type) || VAR_TYPE_IS_DV_DATA(type)) { ArrDesc *dvp; if (VAR_TYPE_IS_DV_DATA_SLICE(type)) { - const arr_desc *ap = static_cast<const arr_desc*>(ptr); + const Arr_Desc *ap = static_cast<const Arr_Desc*>(ptr); dvp = (type == c_dv_data_slice) ? reinterpret_cast<ArrDesc*>(ap->base) : *reinterpret_cast<ArrDesc**>(ap->base); @@ -278,130 +459,228 @@ _Offload_result OffloadDescriptor::translate_coi_error(COIRESULT res) const } } +// is_targetptr == 0 && is_prealloc == 0 - allocation of pointer data; +// is_targetptr == 1 && is_prealloc == 0 - allocation of target memory: +// allocate memory at target; use its value as base in target table. +// is_targetptr == 1 && is_prealloc == 1 - use preallocated target memory: +// base - is address at target of preallocated memory; use its value as +// base in target table. + bool OffloadDescriptor::alloc_ptr_data( PtrData* &ptr_data, void *base, int64_t disp, int64_t size, int64_t alloc_disp, - int align + int align, + bool is_targptr, + bool is_prealloc, + bool pin ) { // total length of base - int64_t length = disp + size; + int64_t length = size; bool is_new; + COIBUFFER targptr_buf; + COIRESULT res; + uint32_t buffer_flags = 0; + char * base_disp = reinterpret_cast<char *>(base) + disp; - OFFLOAD_TRACE(3, "Creating association for data: addr %p, length %lld\n", - base, length); + // create buffer with large pages if data length exceeds + // large page threshold + if (length >= __offload_use_2mb_buffers) { + buffer_flags = COI_OPTIMIZE_HUGE_PAGE_SIZE; + } + // Allocate memory at target for targetptr without preallocated as we need + // its address as base argument in call to m_device.insert_ptr_data + if (is_targptr && !is_prealloc) { + length = alloc_disp ? length : size + disp; + res = COI::BufferCreate( + length, + COI_BUFFER_NORMAL, + buffer_flags, + 0, + 1, + &m_device.get_process(), + &targptr_buf); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_create, res); + } + return false; + } + + res = COI::BufferGetSinkAddress( + targptr_buf, reinterpret_cast<uint64_t *>(&base)); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_get_address, res); + } + return false; + } + } + OFFLOAD_TRACE(3, "Creating association for data: addr %p, length %lld\n", + alloc_disp ? base : base_disp, + alloc_disp ? length : size + disp); + // add new entry - ptr_data = m_device.insert_ptr_data(base, length, is_new); + + ptr_data = is_targptr ? + m_device.find_targetptr_data(base_disp) : + m_device.find_ptr_data(base_disp); + // if ptr_data is found just need to check it for overlapping + if (ptr_data) { + is_new = false; + base = base_disp; + } + else { + // If association is not found we must create it. + length = alloc_disp ? length : size + disp; + ptr_data = is_targptr ? + m_device.insert_targetptr_data(base, length, is_new) : + m_device.insert_ptr_data(base, length, is_new); + } if (is_new) { OFFLOAD_TRACE(3, "Added new association\n"); if (length > 0) { OffloadTimer timer(get_timer_data(), c_offload_host_alloc_buffers); - COIRESULT res; // align should be a power of 2 - if (align > 0 && (align & (align - 1)) == 0) { + if (!pin && !is_targptr && + align > 0 && (align & (align - 1)) == 0) { // offset within mic_buffer. Can do offset optimization // only when source address alignment satisfies requested // alignment on the target (cq172736). if ((reinterpret_cast<intptr_t>(base) & (align - 1)) == 0) { - ptr_data->mic_offset = reinterpret_cast<intptr_t>(base) & 4095; + ptr_data->mic_offset = + reinterpret_cast<intptr_t>(base) & 4095; } } // buffer size and flags uint64_t buffer_size = length + ptr_data->mic_offset; - uint32_t buffer_flags = 0; - // create buffer with large pages if data length exceeds - // large page threshold - if (length >= __offload_use_2mb_buffers) { - buffer_flags = COI_OPTIMIZE_HUGE_PAGE_SIZE; - } - - // create CPU buffer - OFFLOAD_DEBUG_TRACE_1(3, + // For targetptr there is no CPU buffer + if (pin || !is_targptr) { + // create CPU buffer + OFFLOAD_DEBUG_TRACE_1(3, GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_create_buf_host, "Creating buffer from source memory %p, " "length %lld\n", base, length); - // result is not checked because we can continue without cpu - // buffer. In this case we will use COIBufferRead/Write instead - // of COIBufferCopy. - COI::BufferCreateFromMemory(length, + // result is not checked because we can continue without cpu + // buffer. In this case we will use COIBufferRead/Write + // instead of COIBufferCopy. + + COI::BufferCreateFromMemory(length, COI_BUFFER_NORMAL, 0, base, 1, &m_device.get_process(), &ptr_data->cpu_buf); + } - OFFLOAD_DEBUG_TRACE_1(3, + // create MIC buffer + if (is_prealloc) { + OFFLOAD_DEBUG_TRACE_1(3, GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_create_buf_mic, - "Creating buffer for sink: size %lld, offset %d, " - "flags =0x%x\n", buffer_size - alloc_disp, + "Creating buffer from sink memory: size %lld, offset %d, " + "flags =0x%x\n", buffer_size, ptr_data->mic_offset, buffer_flags); - - // create MIC buffer - res = COI::BufferCreate(buffer_size - alloc_disp, - COI_BUFFER_NORMAL, - buffer_flags, - 0, - 1, - &m_device.get_process(), - &ptr_data->mic_buf); - if (res != COI_SUCCESS) { - if (m_status != 0) { - m_status->result = translate_coi_error(res); - } - else if (m_is_mandatory) { - report_coi_error(c_buf_create, res); + res = COI::BufferCreateFromMemory(ptr_data->cpu_addr.length(), + COI_BUFFER_NORMAL, + COI_SINK_MEMORY, + base, + 1, + &m_device.get_process(), + &ptr_data->mic_buf); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_create, res); + } + ptr_data->alloc_ptr_data_lock.unlock(); + return false; } - ptr_data->alloc_ptr_data_lock.unlock(); - return false; } - - // make buffer valid on the device. - res = COI::BufferSetState(ptr_data->mic_buf, - m_device.get_process(), - COI_BUFFER_VALID, - COI_BUFFER_NO_MOVE, - 0, 0, 0); - if (res != COI_SUCCESS) { - if (m_status != 0) { - m_status->result = translate_coi_error(res); - } - else if (m_is_mandatory) { - report_coi_error(c_buf_set_state, res); + else if (is_targptr) { + ptr_data->mic_buf = targptr_buf; + } + else if (!pin) { + OFFLOAD_DEBUG_TRACE_1(3, + GET_OFFLOAD_NUMBER(get_timer_data()), + c_offload_create_buf_mic, + "Creating buffer for sink: size %lld, offset %d, " + "flags =0x%x\n", buffer_size, + ptr_data->mic_offset, buffer_flags); + res = COI::BufferCreate(buffer_size, + COI_BUFFER_NORMAL, + buffer_flags, + 0, + 1, + &m_device.get_process(), + &ptr_data->mic_buf); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_create, res); + } + ptr_data->alloc_ptr_data_lock.unlock(); + return false; } - ptr_data->alloc_ptr_data_lock.unlock(); - return false; } - res = COI::BufferSetState(ptr_data->mic_buf, - COI_PROCESS_SOURCE, - COI_BUFFER_INVALID, - COI_BUFFER_NO_MOVE, - 0, 0, 0); - if (res != COI_SUCCESS) { - if (m_status != 0) { - m_status->result = translate_coi_error(res); + if (!pin) { + // make buffer valid on the device. + res = COI::BufferSetState(ptr_data->mic_buf, + m_device.get_process(), + COI_BUFFER_VALID, + COI_BUFFER_NO_MOVE, + 0, 0, 0); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_set_state, res); + } + ptr_data->alloc_ptr_data_lock.unlock(); + return false; } - else if (m_is_mandatory) { - report_coi_error(c_buf_set_state, res); + + res = COI::BufferSetState(ptr_data->mic_buf, + COI_PROCESS_SOURCE, + COI_BUFFER_INVALID, + COI_BUFFER_NO_MOVE, + 0, 0, 0); + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + } + else if (m_is_mandatory) { + report_coi_error(c_buf_set_state, res); + } + ptr_data->alloc_ptr_data_lock.unlock(); + return false; } - ptr_data->alloc_ptr_data_lock.unlock(); - return false; } } - ptr_data->alloc_disp = alloc_disp; ptr_data->alloc_ptr_data_lock.unlock(); } @@ -415,9 +694,11 @@ bool OffloadDescriptor::alloc_ptr_data( // This is not a new entry. Make sure that provided address range fits // into existing one. - MemRange addr_range(base, length - ptr_data->alloc_disp); + MemRange addr_range(base, length); if (!ptr_data->cpu_addr.contains(addr_range)) { - LIBOFFLOAD_ERROR(c_bad_ptr_mem_range); + LIBOFFLOAD_ERROR(c_bad_ptr_mem_alloc, base, length, + const_cast<void *>(ptr_data->cpu_addr.start()), + ptr_data->cpu_addr.length()); exit(1); } @@ -433,20 +714,24 @@ bool OffloadDescriptor::alloc_ptr_data( bool OffloadDescriptor::find_ptr_data( PtrData* &ptr_data, - void *base, + void *in_base, int64_t disp, int64_t size, + bool is_targetptr, bool report_error ) { // total length of base - int64_t length = disp + size; - + int64_t length = size; + char *base = reinterpret_cast<char *>(in_base) + disp; + OFFLOAD_TRACE(3, "Looking for association for data: addr %p, " "length %lld\n", base, length); // find existing association in pointer table - ptr_data = m_device.find_ptr_data(base); + ptr_data = is_targetptr ? + m_device.find_targetptr_data(base) : + m_device.find_ptr_data(base); if (ptr_data == 0) { if (report_error) { LIBOFFLOAD_ERROR(c_no_ptr_data, base); @@ -464,7 +749,9 @@ bool OffloadDescriptor::find_ptr_data( MemRange addr_range(base, length); if (!ptr_data->cpu_addr.contains(addr_range)) { if (report_error) { - LIBOFFLOAD_ERROR(c_bad_ptr_mem_range); + LIBOFFLOAD_ERROR(c_bad_ptr_mem_range, base, length, + const_cast<void *>(ptr_data->cpu_addr.start()), + ptr_data->cpu_addr.length()); exit(1); } OFFLOAD_TRACE(3, "Existing association partially overlaps with " @@ -591,6 +878,7 @@ bool OffloadDescriptor::offload_stack_memory_manager( PersistDataList::iterator it_begin = m_device.m_persist_list.begin(); PersistDataList::iterator it_end; int erase = 0; + uint64_t cur_thread_id = m_device.get_thread_id(); *is_new = false; @@ -600,9 +888,11 @@ bool OffloadDescriptor::offload_stack_memory_manager( if (stack_begin > it->stack_cpu_addr) { // this stack data must be destroyed - m_destroy_stack.push_front(cur_el.stack_ptr_data); - it_end = it; - erase++; + if (cur_thread_id == cur_el.thread_id) { + m_destroy_stack.push_front(cur_el.stack_ptr_data); + it_end = it; + erase++; + } } else if (stack_begin == it->stack_cpu_addr) { if (routine_id != it-> routine_id) { @@ -627,7 +917,8 @@ bool OffloadDescriptor::offload_stack_memory_manager( return true; } } - else if (stack_begin < it->stack_cpu_addr) { + else if (stack_begin < it->stack_cpu_addr && + cur_thread_id == cur_el.thread_id) { break; } } @@ -638,7 +929,7 @@ bool OffloadDescriptor::offload_stack_memory_manager( m_in_datalen += erase * sizeof(new_el->stack_ptr_data->mic_addr); } // new stack table is created - new_el = new PersistData(stack_begin, routine_id, buf_size); + new_el = new PersistData(stack_begin, routine_id, buf_size, cur_thread_id); // create MIC buffer COIRESULT res; uint32_t buffer_flags = 0; @@ -733,11 +1024,13 @@ bool OffloadDescriptor::setup_descriptors( } // dependencies - m_in_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * (m_vars_total + 1)); + m_in_deps_allocated = m_vars_total + 1; + m_in_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * m_in_deps_allocated); if (m_in_deps == NULL) LIBOFFLOAD_ERROR(c_malloc); if (m_vars_total > 0) { - m_out_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * m_vars_total); + m_out_deps_allocated = m_vars_total; + m_out_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * m_out_deps_allocated); if (m_out_deps == NULL) LIBOFFLOAD_ERROR(c_malloc); } @@ -752,7 +1045,7 @@ bool OffloadDescriptor::setup_descriptors( for (int i = 0; i < m_vars_total; i++) { void* alloc_base = NULL; int64_t alloc_disp = 0; - int64_t alloc_size; + int64_t alloc_size = 0; bool src_is_for_mic = (m_vars[i].direction.out || m_vars[i].into == NULL); @@ -787,25 +1080,41 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].count, m_vars[i].ptr, m_vars[i].into); + // If any varDesc flags bits set, show them + if (console_enabled >= 1 && m_vars[i].flags.bits != 0) { + trace_varDesc_flags(get_timer_data(), m_vars[i].flags); + } + // preallocated implies targetptr + if (m_vars[i].flags.preallocated) { + // targetptr preallocated alloc_if(1) may not be used with + // an in clause + if (m_vars[i].direction.in && m_vars[i].alloc_if) { + LIBOFFLOAD_ERROR(c_in_with_preallocated); + exit(1); + } + m_vars[i].flags.targetptr = 1; + } if (m_vars[i].alloc != NULL) { // array descriptor - const arr_desc *ap = - static_cast<const arr_desc*>(m_vars[i].alloc); + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars[i].alloc); // debug dump - __arr_desc_dump(" ", "ALLOC", ap, 0); + ARRAY_DESC_DUMP(" ", "ALLOC", ap, 0, 1); __arr_data_offset_and_length(ap, alloc_disp, alloc_size); alloc_base = reinterpret_cast<void*>(ap->base); } + m_vars_extra[i].alloc = m_vars[i].alloc; m_vars_extra[i].cpu_disp = 0; m_vars_extra[i].cpu_offset = 0; m_vars_extra[i].src_data = 0; m_vars_extra[i].read_rng_src = 0; m_vars_extra[i].read_rng_dst = 0; + m_vars_extra[i].omp_last_event_type = c_last_not; // flag is_arr_ptr_el is 1 only for var_descs generated // for c_data_ptr_array type if (i < vars_total) { @@ -815,7 +1124,7 @@ bool OffloadDescriptor::setup_descriptors( switch (m_vars[i].type.src) { case c_data_ptr_array: { - const arr_desc *ap; + const Arr_Desc *ap; const VarDesc3 *vd3 = static_cast<const VarDesc3*>(m_vars[i].ptr); int flags = vd3->array_fields; @@ -824,32 +1133,33 @@ bool OffloadDescriptor::setup_descriptors( OFFLOAD_TRACE(2, " pointer array type is %s\n", vardesc_type_as_string[flags & 0x3f]); - ap = static_cast<const arr_desc*>(vd3->ptr_array); - __arr_desc_dump(" ", "ptr array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->ptr_array); + ARRAY_DESC_DUMP(" ", "ptr array", ap, + m_vars[i].flags.is_pointer, 1); if (m_vars[i].into) { - ap = static_cast<const arr_desc*>(m_vars[i].into); - __arr_desc_dump( - " ", "into array", ap, 0); + ap = static_cast<const Arr_Desc*>(m_vars[i].into); + ARRAY_DESC_DUMP( + " ", "into array", ap, 0, 1); } if ((flags & (1<<flag_align_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->align_array); - __arr_desc_dump( - " ", "align array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->align_array); + ARRAY_DESC_DUMP( + " ", "align array", ap, 0, 1); } if ((flags & (1<<flag_alloc_if_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_if_array); - __arr_desc_dump( - " ", "alloc_if array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->alloc_if_array); + ARRAY_DESC_DUMP( + " ", "alloc_if array", ap, 0, 1); } if ((flags & (1<<flag_free_if_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->free_if_array); - __arr_desc_dump( - " ", "free_if array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->free_if_array); + ARRAY_DESC_DUMP( + " ", "free_if array", ap, 0, 1); } if ((flags & (1<<flag_extent_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->extent_start); - __arr_desc_dump( - " ", "extent_start array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->extent_start); + ARRAY_DESC_DUMP( + " ", "extent_start array", ap, 0, 1); } else if ((flags & (1<<flag_extent_start_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -857,10 +1167,10 @@ bool OffloadDescriptor::setup_descriptors( (int64_t)vd3->extent_start); } if ((flags & (1<<flag_extent_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*> + ap = static_cast<const Arr_Desc*> (vd3->extent_elements); - __arr_desc_dump( - " ", "extent_elements array", ap, 0); + ARRAY_DESC_DUMP(" ", + "extent_elements array", ap, 0, 1); } else if ((flags & (1<<flag_extent_elements_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -868,9 +1178,9 @@ bool OffloadDescriptor::setup_descriptors( (int64_t)vd3->extent_elements); } if ((flags & (1<<flag_into_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->into_start); - __arr_desc_dump( - " ", "into_start array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->into_start); + ARRAY_DESC_DUMP( + " ", "into_start array", ap, 0, 1); } else if ((flags & (1<<flag_into_start_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -878,9 +1188,9 @@ bool OffloadDescriptor::setup_descriptors( (int64_t)vd3->into_start); } if ((flags & (1<<flag_into_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->into_elements); - __arr_desc_dump( - " ", "into_elements array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->into_elements); + ARRAY_DESC_DUMP( + " ", "into_elements array", ap, 0, 1); } else if ((flags & (1<<flag_into_elements_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -888,9 +1198,9 @@ bool OffloadDescriptor::setup_descriptors( (int64_t)vd3->into_elements); } if ((flags & (1<<flag_alloc_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_start); - __arr_desc_dump( - " ", "alloc_start array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->alloc_start); + ARRAY_DESC_DUMP( + " ", "alloc_start array", ap, 0, 1); } else if ((flags & (1<<flag_alloc_start_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -898,9 +1208,9 @@ bool OffloadDescriptor::setup_descriptors( (int64_t)vd3->alloc_start); } if ((flags & (1<<flag_alloc_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_elements); - __arr_desc_dump( - " ", "alloc_elements array", ap, 0); + ap = static_cast<const Arr_Desc*>(vd3->alloc_elements); + ARRAY_DESC_DUMP(" ", + "alloc_elements array", ap, 0, 1); } else if ((flags & (1<<flag_alloc_elements_is_scalar)) != 0) { OFFLOAD_TRACE(2, @@ -922,11 +1232,11 @@ bool OffloadDescriptor::setup_descriptors( // VarDesc.disp will have an offset from base if (m_vars[i].type.src == c_cean_var) { // array descriptor - const arr_desc *ap = - static_cast<const arr_desc*>(m_vars[i].ptr); + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars[i].ptr); // debug dump - __arr_desc_dump("", "IN/OUT", ap, 0); + ARRAY_DESC_DUMP("", "IN/OUT", ap, 0, !src_is_for_mic); // offset and length are derived from the array descriptor __arr_data_offset_and_length(ap, m_vars[i].disp, @@ -961,7 +1271,7 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].ptr, m_vars[i].disp, m_vars[i].size, - false)) { + false, false)) { return false; } @@ -983,10 +1293,11 @@ bool OffloadDescriptor::setup_descriptors( if (m_is_openmp) { if (m_vars[i].flags.is_static) { - // Static data is transferred only by omp target + // Static data is transferred either by omp target // update construct which passes zeros for - // alloc_if and free_if. - if (m_vars[i].alloc_if || m_vars[i].free_if) { + // alloc_if and free_if or by always modifier. + if (!m_vars[i].flags.always_copy && + (m_vars[i].alloc_if || m_vars[i].free_if)) { m_vars[i].direction.bits = c_parameter_nocopy; } } @@ -1004,10 +1315,12 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].ptr); } - // For automatic variables data is transferred - // only if alloc_if == 0 && free_if == 0 - // or reference count is 1 - if ((m_vars[i].alloc_if || m_vars[i].free_if) && + // For automatic variables data is transferred: + // - if always modifier is used OR + // - if alloc_if == 0 && free_if == 0 OR + // - if reference count is 1 + if (!m_vars[i].flags.always_copy && + (m_vars[i].alloc_if || m_vars[i].free_if) && auto_data != 0 && auto_data->get_reference() != 1) { m_vars[i].direction.bits = c_parameter_nocopy; @@ -1088,8 +1401,12 @@ bool OffloadDescriptor::setup_descriptors( } m_vars[i].size = m_destroy_stack.size(); m_vars_extra[i].src_data = m_stack_ptr_data; - // need to add reference for buffer - m_need_runfunction = true; + + // need to add or remove references for stack buffer at target + if (is_new || m_destroy_stack.size()) { + m_need_runfunction = true; + } + break; } /* fallthru */ @@ -1098,11 +1415,11 @@ bool OffloadDescriptor::setup_descriptors( case c_dv_ptr: if (m_vars[i].type.src == c_cean_var_ptr) { // array descriptor - const arr_desc *ap = - static_cast<const arr_desc*>(m_vars[i].ptr); + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars[i].ptr); // debug dump - __arr_desc_dump("", "IN/OUT", ap, 1); + ARRAY_DESC_DUMP("", "IN/OUT", ap, 1, !src_is_for_mic); // offset and length are derived from the array descriptor __arr_data_offset_and_length(ap, m_vars[i].disp, @@ -1145,9 +1462,10 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].free_if) { PtrData *ptr_data; - // check that buffer length >= 0 + // check that buffer length > 0 if (m_vars[i].alloc_if && - m_vars[i].disp + m_vars[i].size < 0) { + m_vars[i].disp + m_vars[i].size < + (m_is_openmp ? 0 : 1)) { LIBOFFLOAD_ERROR(c_zero_or_neg_ptr_len); exit(1); } @@ -1166,20 +1484,34 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].flags.sink_addr = 1; } else if (m_vars[i].alloc_if) { + if (m_vars[i].flags.preallocated) { + m_out_datalen += sizeof(void*); + m_need_runfunction = true; + break; + } // add new entry if (!alloc_ptr_data( ptr_data, - base, + reinterpret_cast<char *>(base) + alloc_disp, (alloc_base != NULL) ? alloc_disp : m_vars[i].disp, (alloc_base != NULL) ? alloc_size : m_vars[i].size, alloc_disp, (alloc_base != NULL) ? - 0 : m_vars[i].align)) { + 0 : m_vars[i].align, + m_vars[i].flags.targetptr, + 0, + m_vars[i].flags.pin)) { return false; } - + if (m_vars[i].flags.targetptr) { + if (!init_mic_address(ptr_data)) { + return false; + } + *static_cast<void**>(m_vars[i].ptr) = base = + reinterpret_cast<void*>(ptr_data->mic_addr); + } if (ptr_data->add_reference() == 0 && ptr_data->mic_buf != 0) { // add buffer to the list of buffers that @@ -1187,12 +1519,14 @@ bool OffloadDescriptor::setup_descriptors( m_compute_buffers.push_back( ptr_data->mic_buf); } - else { + else if (!m_vars[i].flags.pin && + !m_vars[i].flags.preallocated) { // will send buffer address to device m_vars[i].flags.sink_addr = 1; } - if (!ptr_data->is_static) { + if (!m_vars[i].flags.pin && + !ptr_data->is_static) { // need to add reference for buffer m_need_runfunction = true; } @@ -1202,8 +1536,9 @@ bool OffloadDescriptor::setup_descriptors( if (m_is_openmp) { // For omp target update variable is ignored // if it does not exist. - if (!m_vars[i].alloc_if && - !m_vars[i].free_if) { + if (m_vars[i].flags.always_copy || + (!m_vars[i].alloc_if && + !m_vars[i].free_if)) { error_if_not_found = false; } } @@ -1213,6 +1548,7 @@ bool OffloadDescriptor::setup_descriptors( base, m_vars[i].disp, m_vars[i].size, + m_vars[i].flags.targetptr, error_if_not_found)) { return false; } @@ -1235,9 +1571,10 @@ bool OffloadDescriptor::setup_descriptors( // data is transferred only if // alloc_if == 0 && free_if == 0 // or reference count is 1 - if ((m_vars[i].alloc_if || - m_vars[i].free_if) && - ptr_data->get_reference() != 1) { + if (!m_vars[i].flags.always_copy && + ((m_vars[i].alloc_if || + m_vars[i].free_if) && + ptr_data->get_reference() != 1)) { m_vars[i].direction.bits = c_parameter_nocopy; } @@ -1257,7 +1594,8 @@ bool OffloadDescriptor::setup_descriptors( m_in_datalen += sizeof(ptr_data->mic_addr); } - if (!ptr_data->is_static && m_vars[i].free_if) { + if (!m_vars[i].flags.pin && + !ptr_data->is_static && m_vars[i].free_if) { // need to decrement buffer reference on target m_need_runfunction = true; } @@ -1277,7 +1615,7 @@ bool OffloadDescriptor::setup_descriptors( base, m_vars[i].disp, m_vars[i].size, - false)) { + false, false)) { return false; } if (ptr_data) { @@ -1308,8 +1646,8 @@ bool OffloadDescriptor::setup_descriptors( case c_dv_ptr_data_slice: ArrDesc *dvp; if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src)) { - const arr_desc *ap; - ap = static_cast<const arr_desc*>(m_vars[i].ptr); + const Arr_Desc *ap; + ap = static_cast<const Arr_Desc*>(m_vars[i].ptr); dvp = (m_vars[i].type.src == c_dv_data_slice) ? reinterpret_cast<ArrDesc*>(ap->base) : @@ -1331,13 +1669,13 @@ bool OffloadDescriptor::setup_descriptors( if (m_vars[i].direction.bits || m_vars[i].alloc_if || m_vars[i].free_if) { - const arr_desc *ap; + const Arr_Desc *ap; if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.src)) { - ap = static_cast<const arr_desc*>(m_vars[i].ptr); + ap = static_cast<const Arr_Desc*>(m_vars[i].ptr); // debug dump - __arr_desc_dump("", "IN/OUT", ap, 0); + ARRAY_DESC_DUMP("", "IN/OUT", ap, 0, !src_is_for_mic); } if (!__dv_is_contiguous(dvp)) { m_vars[i].flags.is_noncont_src = 1; @@ -1393,14 +1731,17 @@ bool OffloadDescriptor::setup_descriptors( // add new entry if (!alloc_ptr_data( ptr_data, - base, + reinterpret_cast<char *>(base) + alloc_disp, (alloc_base != NULL) ? alloc_disp : m_vars[i].disp, (alloc_base != NULL) ? alloc_size : m_vars[i].size, alloc_disp, (alloc_base != NULL) ? - 0 : m_vars[i].align)) { + 0 : m_vars[i].align, + m_vars[i].flags.targetptr, + m_vars[i].flags.preallocated, + m_vars[i].flags.pin)) { return false; } @@ -1426,8 +1767,9 @@ bool OffloadDescriptor::setup_descriptors( if (m_is_openmp) { // For omp target update variable is ignored // if it does not exist. - if (!m_vars[i].alloc_if && - !m_vars[i].free_if) { + if (m_vars[i].flags.always_copy || + (!m_vars[i].alloc_if && + !m_vars[i].free_if)) { error_if_not_found = false; } } @@ -1437,6 +1779,7 @@ bool OffloadDescriptor::setup_descriptors( base, m_vars[i].disp, m_vars[i].size, + m_vars[i].flags.targetptr, error_if_not_found)) { return false; } @@ -1457,10 +1800,12 @@ bool OffloadDescriptor::setup_descriptors( if (ptr_data != 0) { if (m_is_openmp) { - // data is transferred only if - // alloc_if == 0 && free_if == 0 - // or reference count is 1 - if ((m_vars[i].alloc_if || + // data is transferred if + // - if always modifier is used OR + // - if alloc_if == 0 && free_if == 0 OR + // - if reference count is 1 + if (!m_vars[i].flags.always_copy && + (m_vars[i].alloc_if || m_vars[i].free_if) && ptr_data->get_reference() != 1) { m_vars[i].direction.bits = @@ -1503,7 +1848,7 @@ bool OffloadDescriptor::setup_descriptors( base, m_vars[i].disp, m_vars[i].size, - false)) { + false, false)) { return false; } m_vars[i].offset = !ptr_data ? 0 : @@ -1551,11 +1896,11 @@ bool OffloadDescriptor::setup_descriptors( if (m_vars[i].type.dst == c_cean_var) { // array descriptor - const arr_desc *ap = - static_cast<const arr_desc*>(m_vars[i].into); + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars[i].into); // debug dump - __arr_desc_dump(" ", "INTO", ap, 0); + ARRAY_DESC_DUMP(" ", "INTO", ap, 0, src_is_for_mic); // offset and length are derived from the array descriptor __arr_data_offset_and_length(ap, into_disp, size); @@ -1594,7 +1939,7 @@ bool OffloadDescriptor::setup_descriptors( // find data associated with variable if (!find_ptr_data(ptr_data, m_vars[i].into, - into_disp, size, false)) { + into_disp, size, false, false)) { return false; } if (ptr_data != 0) { @@ -1648,11 +1993,11 @@ bool OffloadDescriptor::setup_descriptors( if (m_vars[i].type.dst == c_cean_var_ptr) { // array descriptor - const arr_desc *ap = - static_cast<const arr_desc*>(m_vars[i].into); + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars[i].into); // debug dump - __arr_desc_dump(" ", "INTO", ap, 1); + ARRAY_DESC_DUMP(" ", "INTO", ap, 1, src_is_for_mic); // offset and length are derived from the array descriptor __arr_data_offset_and_length(ap, into_disp, size); @@ -1713,20 +2058,34 @@ bool OffloadDescriptor::setup_descriptors( m_vars[i].flags.sink_addr = 1; } else if (m_vars[i].alloc_if) { + if (m_vars[i].flags.preallocated) { + m_out_datalen += sizeof(void*); + m_need_runfunction = true; + break; + } // add new entry if (!alloc_ptr_data( ptr_data, - base, + reinterpret_cast<char *>(base) + alloc_disp, (alloc_base != NULL) ? alloc_disp : into_disp, (alloc_base != NULL) ? alloc_size : size, alloc_disp, (alloc_base != NULL) ? - 0 : m_vars[i].align)) { + 0 : m_vars[i].align, + m_vars[i].flags.targetptr, + m_vars[i].flags.preallocated, + m_vars[i].flags.pin)) { return false; } - + if (m_vars[i].flags.targetptr) { + if (!init_mic_address(ptr_data)) { + return false; + } + *static_cast<void**>(m_vars[i].into) = base = + reinterpret_cast<void*>(ptr_data->mic_addr); + } if (ptr_data->add_reference() == 0 && ptr_data->mic_buf != 0) { // add buffer to the list of buffers that @@ -1746,7 +2105,8 @@ bool OffloadDescriptor::setup_descriptors( } else { // use existing association from pointer table - if (!find_ptr_data(ptr_data, base, into_disp, size)) { + if (!find_ptr_data(ptr_data, base, into_disp, + size, m_vars[i].flags.targetptr, true)) { return false; } m_vars[i].flags.sink_addr = 1; @@ -1780,7 +2140,7 @@ bool OffloadDescriptor::setup_descriptors( base, into_disp, m_vars[i].size, - false)) { + false, false)) { return false; } } @@ -1806,17 +2166,17 @@ bool OffloadDescriptor::setup_descriptors( if (m_vars[i].direction.bits || m_vars[i].alloc_if || m_vars[i].free_if) { - const arr_desc *ap; + const Arr_Desc *ap; ArrDesc *dvp; PtrData *ptr_data; int64_t disp; int64_t size; if (VAR_TYPE_IS_DV_DATA_SLICE(m_vars[i].type.dst)) { - ap = static_cast<const arr_desc*>(m_vars[i].into); + ap = static_cast<const Arr_Desc*>(m_vars[i].into); // debug dump - __arr_desc_dump(" ", "INTO", ap, 0); + ARRAY_DESC_DUMP(" ", "INTO", ap, 0, src_is_for_mic); dvp = (m_vars[i].type.dst == c_dv_data_slice) ? reinterpret_cast<ArrDesc*>(ap->base) : @@ -1889,14 +2249,17 @@ bool OffloadDescriptor::setup_descriptors( // add new entry if (!alloc_ptr_data( ptr_data, - base, + reinterpret_cast<char *>(base) + alloc_disp, (alloc_base != NULL) ? alloc_disp : into_disp, (alloc_base != NULL) ? alloc_size : size, alloc_disp, (alloc_base != NULL) ? - 0 : m_vars[i].align)) { + 0 : m_vars[i].align, + m_vars[i].flags.targetptr, + m_vars[i].flags.preallocated, + m_vars[i].flags.pin)) { return false; } if (ptr_data->add_reference() == 0 && @@ -1918,7 +2281,8 @@ bool OffloadDescriptor::setup_descriptors( } else { // use existing association from pointer table - if (!find_ptr_data(ptr_data, base, into_disp, size)) { + if (!find_ptr_data(ptr_data, base, into_disp, + size, m_vars[i].flags.targetptr, true)) { return false; } @@ -1958,7 +2322,7 @@ bool OffloadDescriptor::setup_descriptors( base, into_disp, size, - false)) { + false, false)) { return false; } into_offset = !ptr_data ? @@ -2062,9 +2426,10 @@ bool OffloadDescriptor::setup_misc_data(const char *name) if (m_func_desc == NULL) LIBOFFLOAD_ERROR(c_malloc); m_func_desc->console_enabled = console_enabled; - m_func_desc->timer_enabled = - timer_enabled || (offload_report_level && offload_report_enabled); - m_func_desc->offload_report_level = offload_report_level; + m_func_desc->timer_enabled = offload_report_enabled && + (timer_enabled || offload_report_level); + m_func_desc->offload_report_level = offload_report_enabled ? + offload_report_level : 0; m_func_desc->offload_number = GET_OFFLOAD_NUMBER(get_timer_data()); m_func_desc->in_datalen = m_in_datalen; m_func_desc->out_datalen = m_out_datalen; @@ -2078,35 +2443,193 @@ bool OffloadDescriptor::setup_misc_data(const char *name) return true; } +void OffloadDescriptor::setup_omp_async_info() +{ + OFFLOAD_TRACE(2, "setup_omp_async_info\n"); + OmpAsyncLastEventType event_type = m_need_runfunction ? + c_last_runfunc : c_last_write; + int last_in = m_need_runfunction ? 0 : -1; + int i; + + for (i = m_vars_total - 1; i >=0; i--) { + switch (m_vars[i].type.dst) { + case c_data: + case c_void_ptr: + case c_cean_var: + if (m_vars[i].direction.out && + m_vars[i].flags.is_static_dstn) { + event_type = c_last_read; + } + else if (last_in < 0 && m_vars[i].direction.in && + m_vars[i].flags.is_static_dstn) { + last_in = i; + } + break; + case c_string_ptr: + case c_data_ptr: + case c_cean_var_ptr: + case c_dv_ptr: + case c_dv_data: + case c_dv_ptr_data: + case c_dv_data_slice: + case c_dv_ptr_data_slice: + + if (m_vars[i].direction.out) { + event_type = c_last_read; + } + else if (last_in < 0 && m_vars[i].direction.in) { + last_in = i; + } + break; + default: + break; + } + if (event_type == c_last_read) { + break; + } + } + + if (event_type == c_last_read) { + m_vars_extra[i].omp_last_event_type = c_last_read; + } + else if (event_type == c_last_write) { + m_vars_extra[last_in].omp_last_event_type = c_last_write; + } + m_omp_async_last_event_type = event_type; + OFFLOAD_TRACE(2, "setup_omp_async_info: event_type=%d\n", + m_omp_async_last_event_type); +} + +extern "C" { + void offload_proxy_task_completed_ooo( + COIEVENT e, + const COIRESULT r, + const void *info + ) + { + /* TODO: Call callback function, pass info. */ + } +} + +void OffloadDescriptor::register_omp_event_call_back( + const COIEVENT *event, + const void *info) +{ + OFFLOAD_TRACE(2, "register_omp_event_call_back(event=%p, info=%p)\n", + event, info); + if (COI::EventRegisterCallback) { + COI::EventRegisterCallback( + *event, + &offload_proxy_task_completed_ooo, + info, 0); + OFFLOAD_TRACE(2, + "COI::EventRegisterCallback found; callback registered\n"); + } +} + bool OffloadDescriptor::wait_dependencies( - const void **waits, - int num_waits + const void **waits, + int num_waits, + _Offload_stream handle ) { OffloadTimer timer(get_timer_data(), c_offload_host_wait_deps); bool ret = true; + OffloadDescriptor *task; + if (num_waits == 0) { + return true; + } - for (int i = 0; i < num_waits; i++) { + // wait for streams + if (num_waits == -1) { + Stream * stream; + // some specific stream of the device + if (handle != 0) { + stream = Stream::find_stream(handle, false); - OffloadDescriptor *task = m_device.find_signal(waits[i], true); - if (task == 0) { - LIBOFFLOAD_ERROR(c_offload1, m_device.get_logical_index(), - waits[i]); - LIBOFFLOAD_ABORT; - } + // the stream was not created or was destroyed + if (!stream) { + LIBOFFLOAD_ERROR(c_offload_no_stream, m_device.get_logical_index()); + LIBOFFLOAD_ABORT; + } + task = stream->get_last_offload(); - if (!task->offload_finish()) { - ret = false; + // offload was completed by previous offload_wait pragma + // or wait clause + if (task == 0) { + return true; + } + if (!task->offload_finish(0)) { //arg is 0 for is_traceback + ret = false; + } + task->cleanup(); + stream->set_last_offload(NULL); + delete task; } + // all streams of the device or over all devices + else { + StreamMap stream_map = Stream::all_streams; + for (StreamMap::iterator it = stream_map.begin(); + it != stream_map.end(); it++) { + Stream * stream = it->second; - task->cleanup(); - delete task; - } + if (!m_wait_all_devices && + stream->get_device() != m_device.get_logical_index()) { + continue; + } + // get associated async task + OffloadDescriptor *task = stream->get_last_offload(); + // offload was completed by offload_wait pragma or wait clause + if (task == 0) { + continue; + } + if (!task->offload_finish(0)) { //arg is 0 for is_traceback + ret = false; + } + task->cleanup(); + stream->set_last_offload(NULL); + delete task; + } + // no uncompleted streams + return true; + } + } + else { + // if handle is equal to no_stream it's wait for signals + for (int i = 0; i < num_waits; i++) { + _Offload_stream stream_handle; + Stream *stream; + task = m_device.find_signal(waits[i], true); + if (task == 0) { + LIBOFFLOAD_ERROR(c_offload1, m_device.get_logical_index(), + waits[i]); + LIBOFFLOAD_ABORT; + } + else if (task == SIGNAL_IS_REMOVED) { + continue; + } + if (!task->offload_finish(0)) { //arg is 0 for is_traceback + ret = false; + } + task->cleanup(); + // if the offload both has signal and is last offload of its + // stream, we must wipe out the "last_offload" reference as + // the offload already is finished. + stream_handle = task->m_stream; + if (stream_handle != -1) { + stream = Stream::find_stream(stream_handle, false); + if (stream && stream->get_last_offload() == task) { + stream->set_last_offload(NULL); + } + } + delete task; + } + } return ret; } -bool OffloadDescriptor::offload( +bool OffloadDescriptor::offload_wrap( const char *name, bool is_empty, VarDesc *vars, @@ -2116,19 +2639,73 @@ bool OffloadDescriptor::offload( int num_waits, const void **signal, int entry_id, - const void *stack_addr + const void *stack_addr, + OffloadFlags offload_flags ) { + OffloadWaitKind wait_kind = c_offload_wait_signal; + bool is_traceback = offload_flags.bits.fortran_traceback; + + // define kind of wait if any; + // there can be one off the following kind: + // 1. c_offload_wait_signal for "offload_wait wait(signal)" + // 2. c_offload_wait_stream for "offload_wait stream(stream)" + // 3. c_offload_wait_all_streams for "offload_wait stream(0)" + if (num_waits == -1) { + wait_kind = (m_stream == 0) ? + c_offload_wait_all_streams : + c_offload_wait_stream; + } + char buf[35]; + const char *stream_str; + + if (m_stream == no_stream || num_waits >= 0) { + stream_str = "none"; + } + else if (m_stream == 0) { + stream_str = "all"; + } + else { + sprintf(buf, "%#llx", m_stream); + stream_str = buf; + } + if (signal == 0) { OFFLOAD_DEBUG_TRACE_1(1, GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_init_func, "Offload function %s, is_empty=%d, #varDescs=%d, " - "#waits=%d, signal=none\n", - name, is_empty, vars_total, num_waits); - OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), - c_offload_sent_pointer_data, - "#Wait : %d \n", num_waits); + "signal=none, stream=%s, #waits=%d%c", + name, is_empty, vars_total, stream_str, num_waits, + num_waits == 0 ? '\n' : ' '); + // Breaks the norm of using OFFLOAD_DEBUG_TRACE to print the waits + // since the number of waits is not fixed. + if (!OFFLOAD_DO_TRACE && (console_enabled >= 1)) { + if (num_waits) { + printf("("); + if (m_stream == no_stream) { + printf("%p", waits[0]); + for (int i = 1; i < num_waits; i++) { + printf(", %p", waits[i]); + } + } + else if (m_stream != 0) { + printf("%#x", m_stream); + } + else { + printf(" all streams"); + } + printf(")"); + } + printf("\n"); + fflush(NULL); + } + // stream in wait is reported further in OFFLOAD_REPORT for waits + if (m_stream != no_stream && num_waits == 0) { + OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), + c_offload_stream, + "%d\n", m_stream); + } OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_signal, "none %d\n", 0); @@ -2138,27 +2715,62 @@ bool OffloadDescriptor::offload( GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_init_func, "Offload function %s, is_empty=%d, #varDescs=%d, " - "#waits=%d, signal=%p\n", - name, is_empty, vars_total, num_waits, - *signal); - + "signal=%p, stream=%s, #waits=%d%c", + name, is_empty, vars_total, *signal, stream_str, num_waits, + num_waits == 0 ? '\n' : ' '); + // Breaks the norm of using OFFLOAD_DEBUG_TRACE to print the waits + // since the number of waits is not fixed. + if (!OFFLOAD_DO_TRACE && (console_enabled >= 1)) { + if (num_waits) { + printf("("); + if (m_stream == no_stream) { + printf("%p", waits[0]); + for (int i = 1; i < num_waits; i++) { + printf(", %p", waits[i]); + } + printf(")"); + } + else if (m_stream != 0) { + printf("%#x", m_stream); + } + else { + printf(" all streams"); + } + printf(")"); + } + printf("\n"); + fflush(NULL); + } + // stream in wait is reported further in OFFLOAD_REPORT for waits + if (m_stream != no_stream && num_waits == 0) { + OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), + c_offload_stream, + "%d\n", m_stream); + } OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), c_offload_signal, "%d\n", signal); } + if (console_enabled >= 1 && offload_flags.flags != 0) { + trace_offload_flags(get_timer_data(), offload_flags); + } + OFFLOAD_REPORT(3, GET_OFFLOAD_NUMBER(get_timer_data()), - c_offload_wait, - "#Wait : %d %p\n", num_waits, waits); + c_offload_wait, "%d\n", + wait_kind, num_waits, + (wait_kind == c_offload_wait_signal) ? + waits : + reinterpret_cast<const void **>(m_stream)); if (m_status != 0) { m_status->result = OFFLOAD_SUCCESS; m_status->device_number = m_device.get_logical_index(); } - m_need_runfunction = !is_empty; + m_initial_need_runfunction = m_need_runfunction = !is_empty; // wait for dependencies to finish - if (!wait_dependencies(waits, num_waits)) { + if (!wait_dependencies(waits, num_waits, m_stream)) { cleanup(); return false; } @@ -2169,8 +2781,13 @@ bool OffloadDescriptor::offload( return false; } + if (offload_flags.bits.omp_async) { + setup_omp_async_info(); + } + // initiate send for pointers. Want to do it as early as possible. - if (!send_pointer_data(signal != 0)) { + if (!send_pointer_data(signal != 0 || offload_flags.bits.omp_async, + signal)) { cleanup(); return false; } @@ -2188,25 +2805,46 @@ bool OffloadDescriptor::offload( } // Start the computation - if (!compute()) { + if (!compute(signal)) { cleanup(); return false; } // initiate receive for pointers - if (!receive_pointer_data(signal != 0)) { + if (!receive_pointer_data(signal != 0 || offload_flags.bits.omp_async, + true, signal)) { cleanup(); return false; } - - // if there is a signal save descriptor for the later use. - if (signal != 0) { - m_device.add_signal(*signal, this); + if (offload_flags.bits.omp_async) { return true; } + // if there is a signal or stream save descriptor for the later use. + // num_waits == -1 is for offload_wait and there is nothing to save + if (num_waits != -1 && (signal != 0 || m_stream != no_stream)) { + if (signal != 0) { + m_device.add_signal(*signal, this); + } + + if (m_stream != no_stream && m_stream != 0) { + Stream* stream = Stream::find_stream(m_stream, false); + if (stream) { + stream->set_last_offload(this); + } + else { + LIBOFFLOAD_ERROR(c_offload_no_stream, m_device.get_logical_index()); + LIBOFFLOAD_ABORT; + } + } + // if there is a clause with alloc_if(1) and preallocated need to call + // offload_finish after runfunction + if (!m_preallocated_alloc) { + return true; + } + } // wait for the offload to finish. - if (!offload_finish()) { + if (!offload_finish(is_traceback)) { cleanup(); return false; } @@ -2215,7 +2853,38 @@ bool OffloadDescriptor::offload( return true; } -bool OffloadDescriptor::offload_finish() +bool OffloadDescriptor::offload( + const char *name, + bool is_empty, + VarDesc *vars, + VarDesc2 *vars2, + int vars_total, + const void **waits, + int num_waits, + const void **signal, + int entry_id, + const void *stack_addr, + OffloadFlags offload_flags +) +{ + bool res; + res = offload_wrap(name, is_empty, vars, vars2, vars_total, + waits, num_waits, signal, entry_id, + stack_addr, offload_flags); + if (res == false && !m_traceback_called) { + if (offload_flags.bits.fortran_traceback) { + OFFLOAD_TRACE(3, + "Calling Fortran library to continue traceback from MIC\n"); + FORTRAN_TRACE_BACK(m_status->result); + m_traceback_called = true; + } + } + return res; +} + +bool OffloadDescriptor::offload_finish( + bool is_traceback +) { COIRESULT res; @@ -2235,10 +2904,24 @@ bool OffloadDescriptor::offload_finish() } if (res != COI_SUCCESS) { - if (m_status != 0) { + if (m_status != 0 && !m_traceback_called) { m_status->result = translate_coi_error(res); + if (is_traceback) { + OFFLOAD_TRACE(3, + "Calling Fortran library to continue traceback from MIC\n"); + FORTRAN_TRACE_BACK(m_status->result); + m_traceback_called = true; + } return false; } + + if (is_traceback && !m_traceback_called) { + OFFLOAD_TRACE(3, + "Calling Fortran library to continue traceback from MIC\n"); + FORTRAN_TRACE_BACK(OFFLOAD_ERROR); + m_traceback_called = true; + } + report_coi_error(c_event_wait, res); } } @@ -2247,6 +2930,13 @@ bool OffloadDescriptor::offload_finish() if (!scatter_copyout_data()) { return false; } + + if (m_out_with_preallocated && + !receive_pointer_data(m_out_deps_total > 0, false, NULL)) { + cleanup(); + return false; + } + // wait for receive dependencies to become signaled if (m_out_deps_total > 0) { OffloadTimer timer(get_timer_data(), c_offload_host_wait_buffers_reads); @@ -2320,24 +3010,50 @@ bool OffloadDescriptor::is_signaled() return signaled; } +static Arr_Desc * make_arr_desc( + void* ptr_val, + int64_t extent_start_val, + int64_t extent_elements_val, + int64_t size +) +{ + Arr_Desc *res; + res = (Arr_Desc *)malloc(sizeof(Arr_Desc)); + if (res == NULL) + LIBOFFLOAD_ERROR(c_malloc); + res->base = reinterpret_cast<int64_t>(ptr_val); + res->rank = 1; + res->dim[0].size = size; + res->dim[0].lindex = 0; + res->dim[0].lower = extent_start_val; + res->dim[0].upper = extent_elements_val + extent_start_val - 1; + res->dim[0].stride = 1; + return res; +} + // Send pointer data if source or destination or both of them are // noncontiguous. There is guarantee that length of destination enough for -// transfered data. +// transferred data. bool OffloadDescriptor::send_noncontiguous_pointer_data( int i, PtrData* src_data, PtrData* dst_data, - COIEVENT *event + COIEVENT *event, + uint64_t &data_sent, + uint32_t in_deps_amount, + COIEVENT *in_deps ) { int64_t offset_src, offset_dst; int64_t length_src, length_dst; int64_t length_src_cur, length_dst_cur; - int64_t send_size, data_sent = 0; + int64_t send_size; COIRESULT res; bool dst_is_empty = true; bool src_is_empty = true; + data_sent = 0; + // Set length_src and length_dst length_src = (m_vars_extra[i].read_rng_src) ? m_vars_extra[i].read_rng_src->range_size : m_vars[i].size; @@ -2346,6 +3062,90 @@ bool OffloadDescriptor::send_noncontiguous_pointer_data( m_vars_extra[i].read_rng_dst->range_size : m_vars[i].size; send_size = (length_src < length_dst) ? length_src : length_dst; + // If BufferWriteMultiD is defined we can set values of required arguments + // and transfer noncontiguous data via call to the COI routine. + if (__offload_use_coi_noncontiguous_transfer && COI::BufferWriteMultiD) { + struct Arr_Desc* arr_desc_dst; + struct Arr_Desc* arr_desc_src; + int64_t size_src, size_dst; + char *base = offload_get_src_base(static_cast<char*>(m_vars[i].ptr), + m_vars[i].type.src); + COIBUFFER dst_buf = m_vars[i].into ? + m_vars_extra[i].dst_data->mic_buf : + m_vars_extra[i].src_data->mic_buf; + + offset_src = (m_vars_extra[i].read_rng_src)? + m_vars_extra[i].read_rng_src->init_offset : m_vars_extra[i].cpu_disp; + size_src = m_vars_extra[i].read_rng_src ? + cean_get_transf_size(m_vars_extra[i].read_rng_src) : + m_vars[i].size; + + offset_dst = (m_vars_extra[i].read_rng_dst)? + m_vars_extra[i].read_rng_dst->init_offset : m_vars[i].disp; + size_dst = m_vars_extra[i].read_rng_dst ? + cean_get_transf_size(m_vars_extra[i].read_rng_dst) : m_vars[i].size; + + int64_t el_size = (!m_vars[i].into || + (m_vars_extra[i].read_rng_src && m_vars_extra[i].read_rng_dst)) ? + 1 : + m_vars_extra[i].read_rng_src ? + m_vars_extra[i].read_rng_src->arr_desc->dim[ + m_vars_extra[i].read_rng_src->arr_desc->rank - 1].size : + m_vars_extra[i].read_rng_dst->arr_desc->dim[ + m_vars_extra[i].read_rng_dst->arr_desc->rank - 1].size; + + arr_desc_src = (m_vars_extra[i].read_rng_src) ? + m_vars_extra[i].read_rng_src->arr_desc : + make_arr_desc(NULL, // don't required for source + offset_src/el_size, size_src/el_size, el_size); + + arr_desc_dst = !m_vars[i].into ? + arr_desc_src : + (m_vars_extra[i].read_rng_dst) ? + m_vars_extra[i].read_rng_dst->arr_desc : + make_arr_desc(NULL, + offset_dst/el_size, size_src/el_size, el_size); + + int64_t alloc_disp = m_vars[i].into ? + m_vars_extra[i].dst_data->alloc_disp : + m_vars_extra[i].src_data->alloc_disp; + + arr_desc_src->base = reinterpret_cast<int64_t>(base); + arr_desc_dst->base = 0; + + res = COI::BufferWriteMultiD( + dst_buf, // in_DestBuffer, + m_device.get_process(), // DestProcess, + m_vars[i].offset + m_vars[i].mic_offset - + alloc_disp, // Offset + (void*)arr_desc_dst, // descriptor of DestArray + (void*)arr_desc_src, // descriptor of SrcArray + COI_COPY_UNSPECIFIED, // Type + in_deps_amount, // Number of in Dependencies + in_deps, // array of in Dependencies + event); // out Dependency + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + return false; + } + report_coi_error(c_buf_copy, res); + } + return(true); + } + + // if event is defined we must multiplate it for all contiguous intervals + // that will be Copied/Write. + // Take in account that we already have 1 event. + if (event) { + m_in_deps_allocated += (length_src / send_size) * + ((m_vars_extra[i].read_rng_src) ? + m_vars_extra[i].read_rng_src->range_max_number : 1) ; + m_in_deps = + (COIEVENT*)realloc(m_in_deps, sizeof(COIEVENT) * m_in_deps_allocated); + m_in_deps_total--; + } + // consequently get contiguous ranges, // define corresponded destination offset and send data do { @@ -2402,17 +3202,20 @@ bool OffloadDescriptor::send_noncontiguous_pointer_data( } length_dst_cur -= send_size; dst_is_empty = length_dst_cur == 0; - + + if (event) { + event = &m_in_deps[m_in_deps_total++]; + } if (src_data != 0 && src_data->cpu_buf != 0) { res = COI::BufferCopy( dst_data->mic_buf, src_data->cpu_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + offset_dst, m_vars_extra[i].cpu_offset + offset_src, send_size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2428,12 +3231,12 @@ bool OffloadDescriptor::send_noncontiguous_pointer_data( res = COI::BufferWrite( dst_data->mic_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + offset_dst, base + offset_src, send_size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2443,21 +3246,87 @@ bool OffloadDescriptor::send_noncontiguous_pointer_data( report_coi_error(c_buf_write, res); } } - data_sent += length_src; + data_sent += send_size; } while (true); return true; } -bool OffloadDescriptor::send_pointer_data(bool is_async) +bool OffloadDescriptor::send_pointer_data(bool is_async, void* info) { OffloadTimer timer(get_timer_data(), c_offload_host_send_pointers); + bool should_use_async_buffer_write = m_initial_need_runfunction; uint64_t ptr_sent = 0; COIRESULT res; + uint32_t in_deps_amount = 0; + COIEVENT *in_deps = NULL; + + // For offload_transfer and offload with empty body without signal: + // - if there is only one buffer copy - send data synchronously + // - if there are multiple buffer copy and + // __offload_parallel_copy is false - send data synchronously + // - if there are multiple buffer copy and + // __offload_parallel_copy is true - send data asynchronously + // It concerns only big size data - greater than __offload_use_async_buffer_write. + // Data of size less than __offload_use_async_buffer_write are sent synchronously. + // Synchronous transfer results in better performance in COI. + // __offload_parallel_copy is false by default but can be changed + // via environment variable OFFLOAD_PARALLEL_COPY + if (!m_initial_need_runfunction && __offload_parallel_copy) { + int big_size_count = 0; + for (int i = 0; i < m_vars_total; i++) { + if (m_vars[i].direction.in && + m_vars[i].size >= __offload_use_async_buffer_write) { + switch (m_vars[i].type.dst) { + case c_data: + case c_void_ptr: + case c_cean_var: + if (m_vars[i].flags.is_static_dstn) { + big_size_count++; + } + break; + case c_string_ptr: + case c_data_ptr: + case c_cean_var_ptr: + case c_dv_ptr: + case c_dv_data: + case c_dv_ptr_data: + case c_dv_data_slice: + case c_dv_ptr_data_slice: + big_size_count++; + break; + default: + break; + } + } + } + if (big_size_count > 1) { + should_use_async_buffer_write = true; + } + } + + if (m_stream != no_stream && m_vars_total != 0) { + get_stream_in_dependencies(in_deps_amount, in_deps); + } // Initiate send for pointer data for (int i = 0; i < m_vars_total; i++) { + uint64_t sent_data = m_vars[i].size; + uint32_t in_deps_amount_save; + COIEVENT *in_deps_save; + + if (m_vars_extra[i].omp_last_event_type == c_last_write) { + in_deps_amount_save = in_deps_amount; + in_deps_save = in_deps; + in_deps_amount = m_in_deps_total; + if (in_deps_amount > 0) { + in_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * in_deps_amount); + if (in_deps == NULL) + LIBOFFLOAD_ERROR(c_malloc); + memcpy(in_deps, m_in_deps,in_deps_amount * sizeof(COIEVENT)); + } + } switch (m_vars[i].type.dst) { case c_data_ptr_array: break; @@ -2468,7 +3337,8 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars[i].flags.is_static_dstn) { COIEVENT *event = (is_async || - m_vars[i].size >= __offload_use_async_buffer_write) ? + (should_use_async_buffer_write && + m_vars[i].size >= __offload_use_async_buffer_write)) ? &m_in_deps[m_in_deps_total++] : 0; PtrData* dst_data = m_vars[i].into ? m_vars_extra[i].dst_data : @@ -2482,7 +3352,8 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { if (!send_noncontiguous_pointer_data( - i, src_data, dst_data, event)) { + i, src_data, dst_data, event, sent_data, + in_deps_amount, in_deps)) { return false; } } @@ -2490,13 +3361,13 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) res = COI::BufferCopy( dst_data->mic_buf, src_data->cpu_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + m_vars[i].disp, m_vars_extra[i].cpu_offset + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2511,12 +3382,12 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars[i].type.src); res = COI::BufferWrite( dst_data->mic_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + m_vars[i].disp, base + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2526,7 +3397,7 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) report_coi_error(c_buf_write, res); } } - ptr_sent += m_vars[i].size; + ptr_sent += sent_data; } break; @@ -2537,7 +3408,8 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) if (m_vars[i].direction.in && m_vars[i].size > 0) { COIEVENT *event = (is_async || - m_vars[i].size >= __offload_use_async_buffer_write) ? + (should_use_async_buffer_write && + m_vars[i].size >= __offload_use_async_buffer_write)) ? &m_in_deps[m_in_deps_total++] : 0; PtrData* dst_data = m_vars[i].into ? m_vars_extra[i].dst_data : @@ -2551,19 +3423,20 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { send_noncontiguous_pointer_data( - i, src_data, dst_data, event); + i, src_data, dst_data, event, sent_data, + in_deps_amount, in_deps); } else if (src_data != 0 && src_data->cpu_buf != 0) { res = COI::BufferCopy( dst_data->mic_buf, src_data->cpu_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + m_vars[i].disp, m_vars_extra[i].cpu_offset + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2578,12 +3451,12 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars[i].type.src); res = COI::BufferWrite( dst_data->mic_buf, - m_vars[i].mic_offset - dst_data->alloc_disp + + m_vars[i].mic_offset + m_vars[i].offset + m_vars[i].disp, base + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2594,7 +3467,7 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) } } - ptr_sent += m_vars[i].size; + ptr_sent += sent_data; } break; @@ -2609,26 +3482,27 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) COIEVENT *event = (is_async || - m_vars[i].size >= __offload_use_async_buffer_write) ? + (should_use_async_buffer_write && + m_vars[i].size >= __offload_use_async_buffer_write)) ? &m_in_deps[m_in_deps_total++] : 0; if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { send_noncontiguous_pointer_data( - i, src_data, ptr_data, event); + i, src_data, ptr_data, event, sent_data, + in_deps_amount, in_deps); } else if (src_data && src_data->cpu_buf != 0) { res = COI::BufferCopy( ptr_data->mic_buf, src_data->cpu_buf, - m_vars[i].offset + ptr_data->mic_offset - - ptr_data->alloc_disp + + m_vars[i].offset + ptr_data->mic_offset + m_vars[i].disp, m_vars_extra[i].cpu_offset + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2643,12 +3517,12 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars[i].type.src); res = COI::BufferWrite( ptr_data->mic_buf, - ptr_data->mic_offset - ptr_data->alloc_disp + + ptr_data->mic_offset + m_vars[i].offset + m_vars[i].disp, base + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2658,7 +3532,7 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) report_coi_error(c_buf_write, res); } } - ptr_sent += m_vars[i].size; + ptr_sent += sent_data; } break; @@ -2678,25 +3552,27 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars_extra[i].src_data : 0; COIEVENT *event = (is_async || - m_vars[i].size >= __offload_use_async_buffer_write) ? + (should_use_async_buffer_write && + m_vars[i].size >= __offload_use_async_buffer_write)) ? &m_in_deps[m_in_deps_total++] : 0; if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { send_noncontiguous_pointer_data( - i, src_data, dst_data, event); + i, src_data, dst_data, event, sent_data, + in_deps_amount, in_deps); } else if (src_data && src_data->cpu_buf != 0) { res = COI::BufferCopy( dst_data->mic_buf, src_data->cpu_buf, - m_vars[i].offset - dst_data->alloc_disp + + m_vars[i].offset + dst_data->mic_offset + m_vars[i].disp, m_vars_extra[i].cpu_offset + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2711,12 +3587,12 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) m_vars[i].type.src); res = COI::BufferWrite( dst_data->mic_buf, - dst_data->mic_offset - dst_data->alloc_disp + + dst_data->mic_offset + m_vars[i].offset + m_vars[i].disp, base + m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - 0, 0, + in_deps_amount, in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -2727,14 +3603,18 @@ bool OffloadDescriptor::send_pointer_data(bool is_async) } } - ptr_sent += m_vars[i].size; + ptr_sent += sent_data; } break; default: break; } - + if (m_vars_extra[i].omp_last_event_type == c_last_write) { + in_deps_amount = in_deps_amount_save; + in_deps = in_deps_save; + register_omp_event_call_back(&m_in_deps[m_in_deps_total - 1], info); + } // alloc field isn't used at target. // We can reuse it for offset of array pointers. if (m_vars_extra[i].is_arr_ptr_el) { @@ -2901,7 +3781,7 @@ bool OffloadDescriptor::gather_copyin_data() return true; } -bool OffloadDescriptor::compute() +bool OffloadDescriptor::compute(void *info) { OffloadTimer timer(get_timer_data(), c_offload_host_start_compute); @@ -2926,12 +3806,21 @@ bool OffloadDescriptor::compute() // dispatch task COIRESULT res; COIEVENT event; - res = m_device.compute(m_compute_buffers, + uint32_t in_deps_amount = m_in_deps_total; + COIEVENT *in_deps = m_in_deps_total > 0 ? m_in_deps : 0; + + if (0 == m_in_deps_total && m_stream != no_stream) { + get_stream_in_dependencies(in_deps_amount, in_deps); + } + + res = m_device.compute(m_stream, + m_compute_buffers, misc, misc_len, ret, ret_len, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, &event); + if (res != COI_SUCCESS) { if (m_status != 0) { m_status->result = translate_coi_error(res); @@ -2940,6 +3829,10 @@ bool OffloadDescriptor::compute() report_coi_error(c_pipeline_run_func, res); } + if (m_omp_async_last_event_type == c_last_runfunc) { + register_omp_event_call_back(&event, info); + } + m_in_deps_total = 1; m_in_deps[0] = event; } @@ -2947,34 +3840,114 @@ bool OffloadDescriptor::compute() return true; } -// recieve pointer data if source or destination or both of them are +// receive pointer data if source or destination or both of them are // noncontiguous. There is guarantee that length of destination enough for -// transfered data. -bool OffloadDescriptor::recieve_noncontiguous_pointer_data( +// transferred data. +bool OffloadDescriptor::receive_noncontiguous_pointer_data( int i, - char* base, COIBUFFER dst_buf, - COIEVENT *event + COIEVENT *event, + uint64_t &received_data, + uint32_t in_deps_amount, + COIEVENT *in_deps ) { int64_t offset_src, offset_dst; int64_t length_src, length_dst; int64_t length_src_cur, length_dst_cur; - int64_t recieve_size, data_recieved = 0; + int64_t receive_size; COIRESULT res; bool dst_is_empty = true; bool src_is_empty = true; + char *base = offload_get_src_base( + m_vars[i].into ? + static_cast<char*>(m_vars[i].into) : + static_cast<char*>(m_vars[i].ptr), + m_vars[i].type.dst); + received_data = 0; + // Set length_src and length_dst length_src = (m_vars_extra[i].read_rng_src) ? m_vars_extra[i].read_rng_src->range_size : m_vars[i].size; length_dst = !m_vars[i].into ? length_src : (m_vars_extra[i].read_rng_dst) ? m_vars_extra[i].read_rng_dst->range_size : m_vars[i].size; - recieve_size = (length_src < length_dst) ? length_src : length_dst; - + receive_size = (length_src < length_dst) ? length_src : length_dst; + + // If BufferReadMultiD is defined we can set values of required arguments + // and transfer noncontiguous data via call to the COI routine. + if (__offload_use_coi_noncontiguous_transfer && COI::BufferReadMultiD) { + struct Arr_Desc* arr_desc_dst; + struct Arr_Desc* arr_desc_src; + int64_t size_src, size_dst; + + offset_src = (m_vars_extra[i].read_rng_src)? + m_vars_extra[i].read_rng_src->init_offset : m_vars[i].disp; + size_src = m_vars_extra[i].read_rng_src ? + cean_get_transf_size(m_vars_extra[i].read_rng_src) : + m_vars[i].size; + + offset_dst = (m_vars_extra[i].read_rng_dst)? + m_vars_extra[i].read_rng_dst->init_offset : m_vars_extra[i].cpu_disp; + size_dst = m_vars_extra[i].read_rng_dst ? + cean_get_transf_size(m_vars_extra[i].read_rng_dst) : m_vars[i].size; + + int64_t el_size = (!m_vars[i].into || + (m_vars_extra[i].read_rng_src && + m_vars_extra[i].read_rng_dst)) ? + 1 : + m_vars_extra[i].read_rng_src ? + m_vars_extra[i].read_rng_src->arr_desc->dim[ + m_vars_extra[i].read_rng_src->arr_desc->rank - 1].size : + m_vars_extra[i].read_rng_dst->arr_desc->dim[ + m_vars_extra[i].read_rng_dst->arr_desc->rank - 1].size; + arr_desc_src = (m_vars_extra[i].read_rng_src) ? + m_vars_extra[i].read_rng_src->arr_desc : + make_arr_desc(NULL, // don't required for source + offset_src/el_size, size_src/el_size, + el_size); + arr_desc_dst = !m_vars[i].into ? arr_desc_src : + (m_vars_extra[i].read_rng_dst) ? + m_vars_extra[i].read_rng_dst->arr_desc : + make_arr_desc(NULL, + offset_dst/el_size, size_src/el_size, el_size); + + arr_desc_dst->base = reinterpret_cast<int64_t>(base); + + res = COI::BufferReadMultiD( + m_vars_extra[i].src_data->mic_buf, // SourceBuffer + m_vars[i].offset + m_vars[i].mic_offset - + m_vars_extra[i].src_data->alloc_disp, // Offset + (void*)arr_desc_dst, // descriptor of DestArray + (void*)arr_desc_src, // descriptor of SrcArray + COI_COPY_UNSPECIFIED, // Type + in_deps_amount, // Number of in Dependencies + in_deps, // array of in Dependencies + event); // out Dependency + if (res != COI_SUCCESS) { + if (m_status != 0) { + m_status->result = translate_coi_error(res); + return false; + } + report_coi_error(c_buf_copy, res); + } + return(true); + } + // if event is defined we must multiplate for all contiguous intervals + // that will be Copied/Read. + // Take in account that we already have 1 event. + if (event) { + m_out_deps_allocated += (length_src / receive_size) * + ((m_vars_extra[i].read_rng_src) ? + m_vars_extra[i].read_rng_src->range_max_number : 1) ; + m_out_deps = + (COIEVENT*)realloc(m_out_deps, sizeof(COIEVENT) * m_out_deps_allocated); + m_out_deps_total--; + } + // consequently get contiguous ranges, - // define corresponded destination offset and recieve data + // define corresponded destination offset and receive data do { // get sorce offset if (src_is_empty) { @@ -2985,8 +3958,8 @@ bool OffloadDescriptor::recieve_noncontiguous_pointer_data( break; } } - else if (data_recieved == 0) { - offset_src = 0; + else if (received_data == 0) { + offset_src = m_vars[i].disp; } else { break; @@ -2996,9 +3969,9 @@ bool OffloadDescriptor::recieve_noncontiguous_pointer_data( else { // if source is contiguous or its contiguous range is greater // than destination one - offset_src += recieve_size; + offset_src += receive_size; } - length_src_cur -= recieve_size; + length_src_cur -= receive_size; src_is_empty = length_src_cur == 0; // get destination offset @@ -3027,23 +4000,24 @@ bool OffloadDescriptor::recieve_noncontiguous_pointer_data( else { // if destination is contiguous or its contiguous range is greater // than source one - offset_dst += recieve_size; + offset_dst += receive_size; } - length_dst_cur -= recieve_size; + length_dst_cur -= receive_size; dst_is_empty = length_dst_cur == 0; - + if (event) { + event = &m_out_deps[m_out_deps_total++]; + } if (dst_buf != 0) { res = COI::BufferCopy( dst_buf, m_vars_extra[i].src_data->mic_buf, m_vars_extra[i].cpu_offset + offset_dst, m_vars[i].offset + offset_src + - m_vars[i].mic_offset - - m_vars_extra[i].src_data->alloc_disp, - recieve_size, + m_vars[i].mic_offset, + receive_size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3057,13 +4031,12 @@ bool OffloadDescriptor::recieve_noncontiguous_pointer_data( res = COI::BufferRead( m_vars_extra[i].src_data->mic_buf, m_vars[i].offset + offset_src + - m_vars[i].mic_offset - - m_vars_extra[i].src_data->alloc_disp, + m_vars[i].mic_offset, base + offset_dst, - recieve_size, + receive_size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3073,20 +4046,109 @@ bool OffloadDescriptor::recieve_noncontiguous_pointer_data( report_coi_error(c_buf_read, res); } } - data_recieved += recieve_size; + received_data += receive_size; } while (true); return true; } -bool OffloadDescriptor::receive_pointer_data(bool is_async) +bool OffloadDescriptor::receive_pointer_data(bool is_async, + bool first_run, void *info) { OffloadTimer timer(get_timer_data(), c_offload_host_start_buffers_reads); + bool should_use_async_buffer_read = m_initial_need_runfunction; uint64_t ptr_received = 0; COIRESULT res; + // For offload_transfer and offload with empty body without signal: + // - if there is only one buffer copy - get data synchronously + // - if there are multiple buffer copy and + // __offload_parallel_copy is false - get data synchronously + // - if there are multiple buffer copy + // and __offload_parallel_copy is true - get data asynchronously + // It concerns only data with size greater than __offload_use_async_buffer_read. + // Data of size less than __offload_use_async_buffer_read are received synchronously. + // Synchronous transfer results in better performance in COI. + // __offload_parallel_copy is false by default but can be changed + // via environment variable OFFLOAD_PARALLEL_COPY + if (!m_initial_need_runfunction && __offload_parallel_copy) { + int big_size_count = 0; + + for (int i = 0; i < m_vars_total; i++) { + if (m_vars[i].direction.out && + m_vars[i].size >= __offload_use_async_buffer_read) { + // preallocated OUT only at second run + if (first_run == m_vars[i].flags.preallocated) { + continue; + } + switch (m_vars[i].type.src) { + case c_data: + case c_void_ptr: + case c_cean_var: + if (m_vars[i].flags.is_static) { + big_size_count++; + } + break; + case c_string_ptr: + case c_data_ptr: + case c_cean_var_ptr: + case c_dv_data: + case c_dv_ptr_data: + case c_dv_data_slice: + case c_dv_ptr_data_slice: + case c_dv_ptr: + big_size_count++; + break; + default: + break; + } + } + } + if (big_size_count > 1) { + should_use_async_buffer_read = true; + } + } + uint32_t in_deps_amount = m_in_deps_total; + COIEVENT *in_deps = m_in_deps_total > 0 ? m_in_deps : 0; + + if (0 == m_in_deps_total && + m_stream != no_stream && + m_vars_total != 0) { + get_stream_in_dependencies(in_deps_amount, in_deps); + } + for (int i = 0; i < m_vars_total; i++) { + uint64_t received_data = m_vars[i].size; + uint32_t in_deps_amount_save; + COIEVENT *in_deps_save; + + if (m_vars_extra[i].omp_last_event_type == c_last_read) { + in_deps_amount_save = in_deps_amount; + in_deps_save = in_deps; + + in_deps_amount += m_out_deps_total; + if (in_deps_amount > 0) { + in_deps = (COIEVENT*) malloc(sizeof(COIEVENT) * in_deps_amount); + if (in_deps == NULL) + LIBOFFLOAD_ERROR(c_malloc); + memcpy(in_deps, in_deps_save, + in_deps_amount_save * sizeof(COIEVENT)); + memcpy(in_deps + in_deps_amount_save * sizeof(COIEVENT), + m_out_deps, + m_out_deps_total * sizeof(COIEVENT)); + } + } + // At first run don't receive by preallocated target pointer as the + //pointer value will be ready later after call to scatter_copyout_data + if (first_run && m_vars[i].alloc_if && m_vars[i].flags.preallocated) { + m_preallocated_alloc = true; + // need one more call to OffloadDescriptor::receive_pointer_data + if (m_vars[i].direction.out) { + m_out_with_preallocated = true; + } + continue; + } switch (m_vars[i].type.src) { case c_data_ptr_array: break; @@ -3098,7 +4160,8 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) COIEVENT *event = (is_async || m_in_deps_total > 0 || - m_vars[i].size >= __offload_use_async_buffer_read) ? + (should_use_async_buffer_read && + m_vars[i].size >= __offload_use_async_buffer_read)) ? &m_out_deps[m_out_deps_total++] : 0; PtrData *ptr_data = NULL; COIBUFFER dst_buf = NULL; // buffer at host @@ -3127,8 +4190,9 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { - recieve_noncontiguous_pointer_data( - i, base, dst_buf, event); + receive_noncontiguous_pointer_data( + i, dst_buf, event, received_data, + in_deps_amount, in_deps); } else if (dst_buf != 0) { res = COI::BufferCopy( @@ -3139,8 +4203,8 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) m_vars[i].offset + m_vars[i].disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3158,8 +4222,8 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) m_vars_extra[i].cpu_disp, m_vars[i].size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3169,7 +4233,7 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) report_coi_error(c_buf_read, res); } } - ptr_received += m_vars[i].size; + ptr_received += received_data; } break; @@ -3186,7 +4250,8 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) COIEVENT *event = (is_async || m_in_deps_total > 0 || - m_vars[i].size >= __offload_use_async_buffer_read) ? + (should_use_async_buffer_read && + m_vars[i].size >= __offload_use_async_buffer_read)) ? &m_out_deps[m_out_deps_total++] : 0; uint64_t dst_offset = 0; @@ -3241,8 +4306,10 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) if (m_vars[i].flags.is_noncont_src || m_vars[i].flags.is_noncont_dst) { - recieve_noncontiguous_pointer_data( - i, base, dst_buf, event); + receive_noncontiguous_pointer_data( + i, dst_buf, event, received_data, + in_deps_amount, + in_deps); } else if (dst_buf != 0) { res = COI::BufferCopy( @@ -3250,12 +4317,11 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) m_vars_extra[i].src_data->mic_buf, dst_offset, m_vars[i].offset + m_vars[i].disp + - m_vars[i].mic_offset - - m_vars_extra[i].src_data->alloc_disp, + m_vars[i].mic_offset, m_vars[i].size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3269,13 +4335,12 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) res = COI::BufferRead( m_vars_extra[i].src_data->mic_buf, m_vars[i].offset + m_vars[i].disp + - m_vars[i].mic_offset - - m_vars_extra[i].src_data->alloc_disp, + m_vars[i].mic_offset, base + dst_offset, m_vars[i].size, COI_COPY_UNSPECIFIED, - m_in_deps_total, - m_in_deps_total > 0 ? m_in_deps : 0, + in_deps_amount, + in_deps, event); if (res != COI_SUCCESS) { if (m_status != 0) { @@ -3285,7 +4350,7 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) report_coi_error(c_buf_read, res); } } - ptr_received += m_vars[i].size; + ptr_received += received_data; } break; } @@ -3294,6 +4359,11 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) break; } + if (m_vars_extra[i].omp_last_event_type == c_last_read) { + in_deps_amount = in_deps_amount_save; + in_deps = in_deps_save; + register_omp_event_call_back(&m_out_deps[m_out_deps_total - 1], info); + } // destroy buffers for obsolete stacks if (m_destroy_stack.size() != 0) { for (PtrDataList::iterator it = m_destroy_stack.begin(); @@ -3312,8 +4382,13 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) m_vars[i].type.src == c_void_ptr || m_vars[i].type.src == c_cean_var)) { AutoData *auto_data = m_vars_extra[i].auto_data; - if (auto_data != 0 && auto_data->remove_reference() == 0) { - m_device.remove_auto_data(auto_data->cpu_addr.start()); + if (auto_data != 0) { + if (m_vars[i].flags.always_delete) { + auto_data->nullify_reference(); + } + else if(auto_data->remove_reference() == 0) { + m_device.remove_auto_data(auto_data->cpu_addr.start()); + } } } @@ -3338,7 +4413,12 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) ptr_data->cpu_addr.start()); // remove association from map - m_device.remove_ptr_data(ptr_data->cpu_addr.start()); + if (m_vars[i].flags.targetptr) { + m_device.remove_targetptr_data(ptr_data->cpu_addr.start()); + } + else { + m_device.remove_ptr_data(ptr_data->cpu_addr.start()); + } } } else if (VAR_TYPE_IS_PTR(m_vars[i].type.dst) || @@ -3357,7 +4437,12 @@ bool OffloadDescriptor::receive_pointer_data(bool is_async) ptr_data->cpu_addr.start()); // remove association from map - m_device.remove_ptr_data(ptr_data->cpu_addr.start()); + if (m_vars[i].flags.targetptr) { + m_device.remove_targetptr_data(ptr_data->cpu_addr.start()); + } + else { + m_device.remove_ptr_data(ptr_data->cpu_addr.start()); + } } } } @@ -3416,6 +4501,60 @@ bool OffloadDescriptor::scatter_copyout_data() m_out.init_buffer(data, m_out_datalen); for (int i = 0; i < m_vars_total; i++) { + bool src_is_for_mic = (m_vars[i].direction.out || + m_vars[i].into == NULL); + + if (m_vars[i].type.src != c_data_ptr_array && + m_vars[i].flags.preallocated && m_vars[i].alloc_if) { + PtrData *ptr_data; + void *ptr_value; + void ** cpu_ptr = src_is_for_mic ? + reinterpret_cast<void**>(m_vars[i].ptr) : + reinterpret_cast<void**>(m_vars[i].into); + void* alloc_base = NULL; + int64_t alloc_disp = 0; + int64_t alloc_size; + if (m_vars_extra[i].alloc != NULL) { + // array descriptor + const Arr_Desc *ap = + static_cast<const Arr_Desc*>(m_vars_extra[i].alloc); + + __arr_data_offset_and_length(ap, alloc_disp, alloc_size); + + alloc_base = reinterpret_cast<void*>(ap->base); + } + + // get pointer to target memory + m_out.receive_data(&ptr_value, sizeof(void*)); + + // add new entry + if (!alloc_ptr_data( + ptr_data, + ptr_value, + (alloc_base != NULL) ? + alloc_disp : m_vars[i].disp, + (alloc_base != NULL) ? + alloc_size : m_vars[i].size, + alloc_disp, + 0, + m_vars[i].flags.targetptr, + m_vars[i].flags.preallocated, + m_vars[i].flags.pin)) { + return false; + } + + ptr_data->add_reference(); + *cpu_ptr = ptr_value; + if (src_is_for_mic) { + m_vars_extra[i].src_data = ptr_data; + } + else { + m_vars_extra[i].dst_data = ptr_data; + } + m_vars[i].offset = (char*) ptr_value - + (char*) ptr_data->cpu_addr.start(); + } + switch (m_vars[i].type.src) { case c_data_ptr_array: break; @@ -3478,8 +4617,8 @@ bool OffloadDescriptor::scatter_copyout_data() return true; } -void get_arr_desc_numbers( - const arr_desc *ap, +static void get_arr_desc_numbers( + const Arr_Desc *ap, int64_t el_size, int64_t &offset, int64_t &size, @@ -3500,33 +4639,12 @@ void get_arr_desc_numbers( } } -arr_desc * make_arr_desc( - void* ptr_val, - int64_t extent_start_val, - int64_t extent_elements_val, - int64_t size -) -{ - arr_desc *res; - res = (arr_desc *)malloc(sizeof(arr_desc)); - if (res == NULL) - LIBOFFLOAD_ERROR(c_malloc); - res->base = reinterpret_cast<int64_t>(ptr_val); - res->rank = 1; - res->dim[0].size = size; - res->dim[0].lindex = 0; - res->dim[0].lower = extent_start_val; - res->dim[0].upper = extent_elements_val + extent_start_val - 1; - res->dim[0].stride = 1; - return res; -} - bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) { int pointers_number; int tmp_val; int new_index = m_vars_total; - const arr_desc *ap; + const Arr_Desc *ap; const VarDesc3 *vd3 = static_cast<const VarDesc3*>(m_vars[i].ptr); int flags = vd3->array_fields; bool src_is_for_mic = (m_vars[i].direction.out || @@ -3545,14 +4663,16 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) ReadArrElements<int64_t> alloc_elem; - ap = static_cast<const arr_desc*>(vd3->ptr_array); + ap = static_cast<const Arr_Desc*>(vd3->ptr_array); - // "pointers_number" for total number of transfered pointers. + // "pointers_number" for total number of transferred pointers. // For each of them we create new var_desc and put it at the bottom // of the var_desc's array get_arr_desc_numbers(ap, sizeof(void *), ptr.offset, ptr.size, pointers_number, ptr.ranges); - ptr.base = reinterpret_cast<char*>(ap->base); + ptr.base = (m_vars[i].flags.is_pointer) ? + *(reinterpret_cast<char**>(ap->base)) : + reinterpret_cast<char*>(ap->base); // 2. prepare memory for new var_descs m_vars_total += pointers_number; @@ -3575,7 +4695,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // 3. Prepare for reading new var_desc's fields // EXTENT START if ((flags & (1<<flag_extent_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->extent_start); + ap = static_cast<const Arr_Desc*>(vd3->extent_start); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, ext_start.offset, ext_start.size, tmp_val, ext_start.ranges); ext_start.base = reinterpret_cast<char*>(ap->base); @@ -3595,7 +4715,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // EXTENT ELEMENTS NUMBER if ((flags & (1<<flag_extent_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->extent_elements); + ap = static_cast<const Arr_Desc*>(vd3->extent_elements); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, ext_elements.offset, ext_elements.size, tmp_val, ext_elements.ranges); @@ -3616,7 +4736,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // ALLOC_IF if ((flags & (1<<flag_alloc_if_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_if_array); + ap = static_cast<const Arr_Desc*>(vd3->alloc_if_array); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, alloc_if.offset, alloc_if.size, tmp_val, alloc_if.ranges); alloc_if.base = reinterpret_cast<char*>(ap->base); @@ -3628,12 +4748,12 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) } } else { - alloc_if.val = m_vars[i].count; + alloc_if.val = m_vars[i].alloc_if; } // FREE_IF if ((flags & (1<<flag_free_if_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->free_if_array); + ap = static_cast<const Arr_Desc*>(vd3->free_if_array); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, free_if.offset, free_if.size, tmp_val, free_if.ranges); free_if.base = reinterpret_cast<char*>(ap->base); @@ -3645,13 +4765,13 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) } } else { - free_if.val = m_vars[i].count; + free_if.val = m_vars[i].free_if; } // ALIGN if ((flags & (1<<flag_align_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->align_array); + ap = static_cast<const Arr_Desc*>(vd3->align_array); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, align.offset, align.size, tmp_val, align.ranges); align.base = reinterpret_cast<char*>(ap->base); @@ -3669,7 +4789,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // 3.1 INTO if (m_vars[i].into) { - ap = static_cast<const arr_desc*>(m_vars[i].into); + ap = static_cast<const Arr_Desc*>(m_vars[i].into); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into.offset, into.size, tmp_val, into.ranges); into.base = reinterpret_cast<char*>(ap->base); @@ -3683,7 +4803,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // 3.2 INTO_START if ((flags & (1<<flag_into_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->into_start); + ap = static_cast<const Arr_Desc*>(vd3->into_start); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into_start.offset, into_start.size, tmp_val, into_start.ranges); into_start.base = reinterpret_cast<char*>(ap->base); @@ -3704,7 +4824,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // 3.3 INTO_ELEMENTS if ((flags & (1<<flag_into_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->into_elements); + ap = static_cast<const Arr_Desc*>(vd3->into_elements); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, into_elem.offset, into_elem.size, tmp_val, into_elem.ranges); into_elem.base = reinterpret_cast<char*>(ap->base); @@ -3725,7 +4845,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // alloc_start if ((flags & (1<<flag_alloc_start_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_start); + ap = static_cast<const Arr_Desc*>(vd3->alloc_start); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, alloc_start.offset, alloc_start.size, tmp_val, alloc_start.ranges); @@ -3747,7 +4867,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) // alloc_elem if ((flags & (1<<flag_alloc_elements_is_array)) != 0) { - ap = static_cast<const arr_desc*>(vd3->alloc_elements); + ap = static_cast<const Arr_Desc*>(vd3->alloc_elements); get_arr_desc_numbers(ap, ap->dim[ap->rank - 1].size, alloc_elem.offset, alloc_elem.size, tmp_val, alloc_elem.ranges); alloc_elem.base = reinterpret_cast<char*>(ap->base); @@ -3846,6 +4966,9 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) m_vars[new_index + k].flags.bits = m_vars[i].flags.bits; m_vars[new_index + k].offset = 0; m_vars[new_index + k].size = m_vars[i].size; + m_vars[new_index + k].flags.targetptr = m_vars[i].flags.targetptr; + m_vars[new_index + k].flags.preallocated = + m_vars[i].flags.preallocated; if (ext_start.val == 0) { m_vars[new_index + k].count = ext_elements.val; @@ -3901,6 +5024,7 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) m_vars[new_index + k].type.src = type_src; m_vars[new_index + k].type.dst = type_dst; + m_vars_extra[new_index + k].alloc = m_vars[new_index + k].alloc; m_vars_extra[new_index + k].is_arr_ptr_el = 1; m_vars_extra[new_index + k].ptr_arr_offset = src_is_for_mic ? ptr.offset : into.offset; @@ -3912,6 +5036,52 @@ bool OffloadDescriptor::gen_var_descs_for_pointer_array(int i) return true; } +// Gets in dependencies of the previous offload via the stream "m_stream". +// Out argument in_deps_amount - address of amount of the dependencies +// Out argument in_deps - array of dependencies. +// Description of the dependencies scheme for streams : +// ---------------------------------------------------- +// Every offload forms DAG consisted of 3 nodes: +// for in-transfers, runfunction and out-transfers. +// Every node has in-dependencies and out-dependencies +// Out-dependencies of previous node forms in-dependencies of current node. +// In-dependencies of 1-st node (of in-transfers) without streams is equal +// to NULL. For streams in-dependencies of 1-st node is equal to list of out +// dependencies of last node of previous offload via this stream. +// So we can say that DAGs of 2 consequent offloads via the same stream are +// connected by the way described above. +void OffloadDescriptor::get_stream_in_dependencies( + uint32_t &in_deps_amount, + COIEVENT* &in_deps +) +{ + if (m_stream != no_stream && m_stream != 0) { + Stream * stream = Stream::find_stream(m_stream, false); + if (!stream) { + LIBOFFLOAD_ERROR(c_offload_no_stream, + m_device.get_logical_index()); + LIBOFFLOAD_ABORT; + } + OffloadDescriptor* offload = stream->get_last_offload(); + + // if it's the first offload in the stream + if (!offload) { + return; + } + // if last offload has out-tranfers + if (offload->m_out_deps_total) { + in_deps_amount = offload->m_out_deps_total; + in_deps = offload->m_out_deps; + } + // last offload only sends pointer data or run function or both of them + // and has no out-transfers + else if (offload->m_in_deps_total) { + in_deps_amount = offload->m_in_deps_total; + in_deps = offload->m_in_deps; + } + } +} + static void __offload_fini_library(void) { OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ...\n"); @@ -3945,7 +5115,6 @@ static void __offload_init_library_once(void) COIRESULT res; uint32_t num_devices; std::bitset<MIC_ENGINES_MAX> devices; - prefix = report_get_message_str(c_report_host); // initialize trace @@ -3989,7 +5158,7 @@ static void __offload_init_library_once(void) } // get number of devices installed in the system - res = COI::EngineGetCount(COI_ISA_KNC, &num_devices); + res = COI::EngineGetCount(COI_ISA_MIC, &num_devices); if (res != COI_SUCCESS) { return; } @@ -4032,7 +5201,7 @@ static void __offload_init_library_once(void) // use all available devices for (int i = 0; i < num_devices; i++) { COIENGINE engine; - res = COI::EngineGetHandle(COI_ISA_KNC, i, &engine); + res = COI::EngineGetHandle(COI_ISA_MIC, i, &engine); if (res == COI_SUCCESS) { devices.set(i); } @@ -4055,12 +5224,64 @@ static void __offload_init_library_once(void) } } + // Get DMA channel count to pass it to COI + env_var = getenv("OFFLOAD_DMA_CHANNEL_COUNT"); + if (env_var != 0) { + int64_t new_val; + if (__offload_parse_int_string(env_var, new_val)) { + mic_dma_channel_count = new_val; + } + else { + LIBOFFLOAD_ERROR(c_invalid_env_var_value, + "OFFLOAD_DMA_CHANNEL_COUNT"); + } + } + + // Set COI_HOST_THREAD_AFFINITY if OFFLOAD_HOST_THREAD_AFFINITY is set. + // Use putenv instead of setenv as Windows has no setenv. + // Note: putenv requires its argument can't be freed or modified. + // So no free after call to putenv or elsewhere. + env_var = getenv("OFFLOAD_HOST_THREAD_AFFINITY"); + if (env_var != 0) { + char * new_env_var = + (char*) malloc(sizeof("COI_HOST_THREAD_AFFINITY=") + + sizeof(env_var) + 1); + sprintf(new_env_var, "COI_HOST_THREAD_AFFINITY=%s", env_var); + putenv(new_env_var); + } + // library search path for device binaries env_var = getenv("MIC_LD_LIBRARY_PATH"); if (env_var != 0) { mic_library_path = strdup(env_var); } + + // find target executable to be used if main application is not an + // offload build application. + const char *base_name = "offload_main"; + if (mic_library_path != 0) { + char *buf = strdup(mic_library_path); + char *try_name = (char*) alloca(strlen(mic_library_path) + + strlen(base_name) + 2); + char *dir, *ptr; + + for (dir = strtok_r(buf, PATH_SEPARATOR, &ptr); dir != 0; + dir = strtok_r(0, PATH_SEPARATOR, &ptr)) { + // compose a full path + sprintf(try_name, "%s/%s", dir, base_name); + + // check if such file exists + struct stat st; + if (stat(try_name, &st) == 0 && S_ISREG(st.st_mode)) { + mic_device_main = strdup(try_name); + break; + } + } + + free(buf); + } + // memory size reserved for COI buffers env_var = getenv("MIC_BUFFERSIZE"); if (env_var != 0) { @@ -4073,6 +5294,30 @@ static void __offload_init_library_once(void) } } + // memory size reserved for 4K pages for COI buffers + env_var = getenv("MIC_4K_BUFFER_RESERVE_SIZE"); + if (env_var != 0) { + uint64_t new_size; + if (__offload_parse_size_string(env_var, new_size)) { + mic_4k_buffer_size = new_size; + } + else { + LIBOFFLOAD_ERROR(c_invalid_env_var_value, "MIC_4K_BUFFER_RESERVE_SIZE"); + } + } + + // memory size reserved for 2M pages for COI buffers + env_var = getenv("MIC_2M_BUFFER_RESERVE_SIZE"); + if (env_var != 0) { + uint64_t new_size; + if (__offload_parse_size_string(env_var, new_size)) { + mic_2m_buffer_size = new_size; + } + else { + LIBOFFLOAD_ERROR(c_invalid_env_var_value, "MIC_2M_BUFFER_RESERVE_SIZE"); + } + } + // determine stacksize for the pipeline on the device env_var = getenv("MIC_STACKSIZE"); if (env_var != 0 && *env_var != '\0') { @@ -4170,11 +5415,9 @@ static void __offload_init_library_once(void) else if (strcmp(env_var, "on_offload_all") == 0) { __offload_init_type = c_init_on_offload_all; } -#ifndef TARGET_WINNT else if (strcmp(env_var, "on_start") == 0) { __offload_init_type = c_init_on_start; } -#endif // TARGET_WINNT else { LIBOFFLOAD_ERROR(c_invalid_env_var_value, offload_init_envname); } @@ -4206,6 +5449,32 @@ static void __offload_init_library_once(void) } } + // parallel copy of offload_transfer + env_var = getenv(parallel_copy_envname); + if (env_var != 0 && *env_var != '\0') { + int64_t new_val; + if (__offload_parse_int_string(env_var, new_val) && new_val >= 0) { + __offload_parallel_copy = new_val; + } + else { + LIBOFFLOAD_ERROR(c_invalid_env_var_value, + parallel_copy_envname); + } + } + + // use COI interface for noncontiguous arrays transfer + env_var = getenv(use_coi_noncontiguous_transfer_envname); + if (env_var != 0 && *env_var != '\0') { + uint64_t new_size; + if (__offload_parse_size_string(env_var, new_size)) { + __offload_use_coi_noncontiguous_transfer = new_size; + } + else { + LIBOFFLOAD_ERROR(c_invalid_env_var_value, + use_coi_noncontiguous_transfer_envname); + } + } + // init ORSL ORSL::init(); } @@ -4242,7 +5511,20 @@ extern int __offload_init_library(void) return is_available; } -extern "C" void __offload_register_image(const void *target_image) +extern "C" bool __offload_target_image_is_executable(const void *target_image) +{ + const struct Image *image = static_cast<const struct Image*>(target_image); + + // decode image + const char *name = image->data; + const void *data = image->data + strlen(image->data) + 1; + + // determine image type + const Elf64_Ehdr *hdr = static_cast<const Elf64_Ehdr*>(data); + return (hdr->e_type == ET_EXEC); +} + +extern "C" bool __offload_register_image(const void *target_image) { const struct Image *image = static_cast<const struct Image*>(target_image); @@ -4250,8 +5532,32 @@ extern "C" void __offload_register_image(const void *target_image) const char *name = image->data; const void *data = image->data + strlen(image->data) + 1; uint64_t size = image->size; - const char *origin = 0; + char *origin = (char *) malloc(strlen(image->data) + 1); uint64_t offset = 0; + const char *host_name = image->data; + int i; + + if (origin == NULL) + LIBOFFLOAD_ERROR(c_malloc); + + // The origin name is the name of the file on the host + // this is used by Vtune, since it is a fat binary we + // use the host file name of the fat binary. + // Driver prepends the host file name ending with "?" + // to the image->data name so need to extract the string + i = 0; + while (*host_name != '\0' && *host_name != '?') { + origin[i] = *host_name; + host_name++; + i++; + } + origin[i] = '\0'; + // Implies the host name does not exist which really should + // not occur. Allow this since only consumer is Vtune. + if ((i == 0) || (*host_name != '?')) { + free(origin); + origin = 0; + } // our actions depend on the image type const Elf64_Ehdr *hdr = static_cast<const Elf64_Ehdr*>(data); @@ -4279,19 +5585,31 @@ extern "C" void __offload_register_image(const void *target_image) } } } - break; + return mic_engines_total > 0; case ET_DYN: - // Registration code for libraries is called from the DllMain - // context (on windows) and thus we cannot do anything usefull - // here. So we just add it to the list of pending libraries for - // the later use. - __target_libs_lock.lock(); - __target_libs = true; - __target_libs_list.push_back(TargetImage(name, data, size, - origin, offset)); - __target_libs_lock.unlock(); - break; + { + char *fullname = origin; + // We add the library to a list of pending libraries + __target_libs_lock.lock(); + __target_libs = true; + __target_libs_list.push_back( + TargetImage(name, data, size, fullname, offset)); + __target_libs_lock.unlock(); + // If __target_exe is set, then main has started running + // If not main, then we can't do anything useful here + // because this registration code is called from DllMain + // context (on windows). + if (__target_exe != 0) { + // There is no need to delay loading the library + if (!__offload_init_library()) { + // Couldn't validate library as a fat offload library + LIBOFFLOAD_ERROR(c_unknown_binary_type); + exit(1); + } + } + return true; + } default: // something is definitely wrong, issue an error and exit @@ -4330,6 +5648,12 @@ extern "C" void __offload_unregister_image(const void *target_image) __offload_fini_library(); } + else if (hdr->e_type == ET_DYN) { + for (int i = 0; i < mic_engines_total; i++) { + mic_engines[i].unload_library(data, name); + } + + } } // Runtime trace interface for user programs @@ -4362,19 +5686,24 @@ int _Offload_signaled(int index, void *signal) __offload_init_library(); // check index value - if (index < 0 || mic_engines_total <= 0) { + if (index < 0) { LIBOFFLOAD_ERROR(c_offload_signaled1, index); LIBOFFLOAD_ABORT; } + index %= mic_engines_total; + // find associated async task OffloadDescriptor *task = - mic_engines[index % mic_engines_total].find_signal(signal, false); + mic_engines[index].find_signal(signal, false); if (task == 0) { LIBOFFLOAD_ERROR(c_offload_signaled2, signal); LIBOFFLOAD_ABORT; } - + // if signal is removed by wait completing + else if (task == SIGNAL_IS_REMOVED) { + return (true); + } return task->is_signaled(); } @@ -4386,6 +5715,153 @@ void _Offload_report(int val) } } +int _Offload_find_associated_mic_memory( + int target, + const void* cpu_addr, + void** cpu_base_addr, + uint64_t* buf_length, + void** mic_addr, + uint64_t* mic_buf_start_offset, + int* is_static +) +{ + __offload_init_library(); + + // check target value + if (target < 0) { + LIBOFFLOAD_ERROR(c_offload_signaled1, target); + LIBOFFLOAD_ABORT; + } + target %= mic_engines_total; + + // find existing association in pointer table + PtrData* ptr_data = mic_engines[target].find_ptr_data(cpu_addr); + if (ptr_data == 0) { + OFFLOAD_TRACE(3, "Association does not exist\n"); + return 0; + } + + OFFLOAD_TRACE(3, "Found association: base %p, length %lld, is_static %d\n", + ptr_data->cpu_addr.start(), ptr_data->cpu_addr.length(), + ptr_data->is_static); + + if (ptr_data->mic_buf != 0 && ptr_data->mic_addr == 0) { + COIRESULT res = COI::BufferGetSinkAddress(ptr_data->mic_buf, + &ptr_data->mic_addr); + if (res != COI_SUCCESS) { + return 0; + } + } + *cpu_base_addr = const_cast<void *>(ptr_data->cpu_addr.start()); + *buf_length = ptr_data->cpu_addr.length() - ptr_data->alloc_disp; + *mic_addr = (void *)(ptr_data->mic_addr + ptr_data->mic_offset); + *mic_buf_start_offset = ptr_data->alloc_disp; + *is_static = ptr_data->is_static; + return ptr_data->is_static ? 1 : ptr_data->get_reference(); +} + +_Offload_stream _Offload_stream_create( + int device, // MIC device number + int number_of_cpus // Cores allocated to the stream + ) +{ + __offload_init_library(); + + // check target value + if (device < 0) { + LIBOFFLOAD_ERROR(c_offload_signaled1, device); + LIBOFFLOAD_ABORT; + } + device %= mic_engines_total; + + // Create new stream and get its handle + _Offload_stream handle = Stream::add_stream(device, number_of_cpus); + if (handle == 0) { + OFFLOAD_TRACE(3, "Can't create stream\n"); + return 0; + } + + // create pipeline associated with the new stream + mic_engines[device].get_pipeline(handle); + + return(handle); +} + +int _Offload_stream_destroy( + int device, // MIC device number + _Offload_stream handle // stream to destroy + ) +{ + __offload_init_library(); + + // check target value + if (device < 0) { + LIBOFFLOAD_ERROR(c_offload_signaled1, device); + LIBOFFLOAD_ABORT; + } + device %= mic_engines_total; + + mic_engines[device].stream_destroy(handle); + + return(true); +} + +int _Offload_stream_completed(int device, _Offload_stream handler) +{ + __offload_init_library(); + + // check index value + if (device < 0) { + LIBOFFLOAD_ERROR(c_offload_signaled1, device); + LIBOFFLOAD_ABORT; + } + + device %= mic_engines_total; + + // get stream + Stream * stream; + + if (handler != 0) { + stream = Stream::find_stream(handler, false); + + // the stream was not created or was destroyed + if (!stream) { + LIBOFFLOAD_ERROR(c_offload_no_stream, device); + LIBOFFLOAD_ABORT; + } + + // find associated async task + OffloadDescriptor *task = stream->get_last_offload(); + + // offload was completed by offload_wait pragma or wait clause + if (task == 0) { + return(true); + } + return task->is_signaled(); + } + // zero handler is for all streams at the device + else { + StreamMap stream_map = Stream::all_streams; + for (StreamMap::iterator it = stream_map.begin(); + it != stream_map.end(); it++) { + Stream * stream = it->second; + // find associated async task + OffloadDescriptor *task = stream->get_last_offload(); + + // offload was completed by offload_wait pragma or wait clause + if (task == 0) { + return(true); + } + // if even one stream is not completed result is false + if (!task->is_signaled()) { + return false; + } + } + // no uncompleted streams + return true; + } +} + // IDB support int __dbg_is_attached = 0; int __dbg_target_id = -1; diff --git a/liboffloadmic/runtime/offload_host.h b/liboffloadmic/runtime/offload_host.h index 2212dec5149..afd5c9936ca 100644 --- a/liboffloadmic/runtime/offload_host.h +++ b/liboffloadmic/runtime/offload_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -46,8 +46,12 @@ #include "coi/coi_client.h" // MIC engines. -extern Engine* mic_engines; -extern uint32_t mic_engines_total; +DLL_LOCAL extern Engine* mic_engines; +DLL_LOCAL extern uint32_t mic_engines_total; + +// DMA channel count used by COI and set via +// OFFLOAD_DMA_CHANNEL_COUNT environment variable +DLL_LOCAL extern uint32_t mic_dma_channel_count; //! The target image is packed as follows. /*! 1. 8 bytes containing the size of the target binary */ @@ -64,6 +68,13 @@ struct Image { class OffloadDescriptor { public: + enum OmpAsyncLastEventType { + c_last_not, // not last event + c_last_write, // the last event that is write + c_last_read, // the last event that is read + c_last_runfunc // the last event that is runfunction + }; + OffloadDescriptor( int index, _Offload_status *status, @@ -71,7 +82,7 @@ public: bool is_openmp, OffloadHostTimerData * timer_data ) : - m_device(mic_engines[index % mic_engines_total]), + m_device(mic_engines[index == -1 ? 0 : index % mic_engines_total]), m_is_mandatory(is_mandatory), m_is_openmp(is_openmp), m_inout_buf(0), @@ -79,13 +90,22 @@ public: m_func_desc_size(0), m_in_deps(0), m_in_deps_total(0), + m_in_deps_allocated(0), m_out_deps(0), m_out_deps_total(0), + m_out_deps_allocated(0), m_vars(0), m_vars_extra(0), m_status(status), - m_timer_data(timer_data) - {} + m_timer_data(timer_data), + m_out_with_preallocated(false), + m_preallocated_alloc(false), + m_traceback_called(false), + m_stream(-1), + m_omp_async_last_event_type(c_last_not) + { + m_wait_all_devices = index == -1; + } ~OffloadDescriptor() { @@ -107,8 +127,10 @@ public: bool offload(const char *name, bool is_empty, VarDesc *vars, VarDesc2 *vars2, int vars_total, const void **waits, int num_waits, const void **signal, - int entry_id, const void *stack_addr); - bool offload_finish(); + int entry_id, const void *stack_addr, + OffloadFlags offload_flags); + + bool offload_finish(bool is_traceback); bool is_signaled(); @@ -116,36 +138,60 @@ public: return m_timer_data; } + void set_stream(_Offload_stream stream) { + m_stream = stream; + } + + _Offload_stream get_stream() { + return(m_stream); + } + private: - bool wait_dependencies(const void **waits, int num_waits); + bool offload_wrap(const char *name, bool is_empty, + VarDesc *vars, VarDesc2 *vars2, int vars_total, + const void **waits, int num_waits, const void **signal, + int entry_id, const void *stack_addr, + OffloadFlags offload_flags); + bool wait_dependencies(const void **waits, int num_waits, + _Offload_stream stream); bool setup_descriptors(VarDesc *vars, VarDesc2 *vars2, int vars_total, int entry_id, const void *stack_addr); bool setup_misc_data(const char *name); - bool send_pointer_data(bool is_async); + bool send_pointer_data(bool is_async, void* info); bool send_noncontiguous_pointer_data( int i, PtrData* src_buf, PtrData* dst_buf, - COIEVENT *event); - bool recieve_noncontiguous_pointer_data( + COIEVENT *event, + uint64_t &sent_data, + uint32_t in_deps_amount, + COIEVENT *in_deps + ); + bool receive_noncontiguous_pointer_data( int i, - char* src_data, COIBUFFER dst_buf, - COIEVENT *event); + COIEVENT *event, + uint64_t &received_data, + uint32_t in_deps_amount, + COIEVENT *in_deps + ); bool gather_copyin_data(); - bool compute(); + bool compute(void *); - bool receive_pointer_data(bool is_async); + bool receive_pointer_data(bool is_async, bool first_run, void * info); bool scatter_copyout_data(); void cleanup(); bool find_ptr_data(PtrData* &ptr_data, void *base, int64_t disp, - int64_t length, bool error_does_not_exist = true); + int64_t length, bool is_targptr, + bool error_does_not_exist = true); bool alloc_ptr_data(PtrData* &ptr_data, void *base, int64_t disp, - int64_t length, int64_t alloc_disp, int align); + int64_t length, int64_t alloc_disp, int align, + bool is_targptr, bool is_prealloc, bool pin); + bool create_preallocated_buffer(PtrData* ptr_data, void *base); bool init_static_ptr_data(PtrData *ptr_data); bool init_mic_address(PtrData *ptr_data); bool offload_stack_memory_manager(const void * stack_begin, int routine_id, @@ -154,9 +200,15 @@ private: bool gen_var_descs_for_pointer_array(int i); + void get_stream_in_dependencies(uint32_t &in_deps_amount, + COIEVENT* &in_deps); + void report_coi_error(error_types msg, COIRESULT res); _Offload_result translate_coi_error(COIRESULT res) const; - + + void setup_omp_async_info(); + void register_omp_event_call_back(const COIEVENT *event, const void *info); + private: typedef std::list<COIBUFFER> BufferList; @@ -167,10 +219,12 @@ private: AutoData* auto_data; int64_t cpu_disp; int64_t cpu_offset; + void *alloc; CeanReadRanges *read_rng_src; CeanReadRanges *read_rng_dst; int64_t ptr_arr_offset; bool is_arr_ptr_el; + OmpAsyncLastEventType omp_last_event_type; }; template<typename T> class ReadArrElements { @@ -230,6 +284,9 @@ private: // Engine Engine& m_device; + // true for offload_wait target(mic) stream(0) + bool m_wait_all_devices; + // if true offload is mandatory bool m_is_mandatory; @@ -266,8 +323,13 @@ private: // Dependencies COIEVENT *m_in_deps; uint32_t m_in_deps_total; + uint32_t m_in_deps_allocated; COIEVENT *m_out_deps; uint32_t m_out_deps_total; + uint32_t m_out_deps_allocated; + + // Stream + _Offload_stream m_stream; // Timer data OffloadHostTimerData *m_timer_data; @@ -279,6 +341,25 @@ private: // a boolean value calculated in setup_descriptors. If true we need to do // a run function on the target. Otherwise it may be optimized away. bool m_need_runfunction; + + // initialized value of m_need_runfunction; + // is used to recognize offload_transfer + bool m_initial_need_runfunction; + + // a Boolean value set to true when OUT clauses with preallocated targetptr + // is encountered to indicate that call receive_pointer_data needs to be + // invoked again after call to scatter_copyout_data. + bool m_out_with_preallocated; + + // a Boolean value set to true if an alloc_if(1) is used with preallocated + // targetptr to indicate the need to scatter_copyout_data even for + // async offload + bool m_preallocated_alloc; + + // a Boolean value set to true if traceback routine is called + bool m_traceback_called; + + OmpAsyncLastEventType m_omp_async_last_event_type; }; // Initialization types for MIC @@ -288,46 +369,60 @@ enum OffloadInitType { c_init_on_offload_all // all devices before starting the first offload }; +// Determines if MIC code is an executable or a shared library +extern "C" bool __offload_target_image_is_executable(const void *target_image); + // Initializes library and registers specified offload image. -extern "C" void __offload_register_image(const void* image); +extern "C" bool __offload_register_image(const void* image); extern "C" void __offload_unregister_image(const void* image); // Initializes offload runtime library. -extern int __offload_init_library(void); +DLL_LOCAL extern int __offload_init_library(void); // thread data for associating pipelines with threads -extern pthread_key_t mic_thread_key; +DLL_LOCAL extern pthread_key_t mic_thread_key; + +// location of offload_main executable +// To be used if the main application has no offload and is not built +// with -offload but dynamic library linked in has offload pragma +DLL_LOCAL extern char* mic_device_main; // Environment variables for devices -extern MicEnvVar mic_env_vars; +DLL_LOCAL extern MicEnvVar mic_env_vars; // CPU frequency -extern uint64_t cpu_frequency; +DLL_LOCAL extern uint64_t cpu_frequency; // LD_LIBRARY_PATH for MIC libraries -extern char* mic_library_path; +DLL_LOCAL extern char* mic_library_path; // stack size for target -extern uint32_t mic_stack_size; +DLL_LOCAL extern uint32_t mic_stack_size; // Preallocated memory size for buffers on MIC -extern uint64_t mic_buffer_size; +DLL_LOCAL extern uint64_t mic_buffer_size; + +// Preallocated 4K page memory size for buffers on MIC +DLL_LOCAL extern uint64_t mic_4k_buffer_size; + +// Preallocated 2M page memory size for buffers on MIC +DLL_LOCAL extern uint64_t mic_2m_buffer_size; // Setting controlling inout proxy -extern bool mic_proxy_io; -extern char* mic_proxy_fs_root; +DLL_LOCAL extern bool mic_proxy_io; +DLL_LOCAL extern char* mic_proxy_fs_root; // Threshold for creating buffers with large pages -extern uint64_t __offload_use_2mb_buffers; +DLL_LOCAL extern uint64_t __offload_use_2mb_buffers; // offload initialization type -extern OffloadInitType __offload_init_type; +DLL_LOCAL extern OffloadInitType __offload_init_type; // Device number to offload to when device is not explicitly specified. -extern int __omp_device_num; +DLL_LOCAL extern int __omp_device_num; // target executable -extern TargetImage* __target_exe; +DLL_LOCAL extern TargetImage* __target_exe; // IDB support diff --git a/liboffloadmic/runtime/offload_iterator.h b/liboffloadmic/runtime/offload_iterator.h new file mode 100644 index 00000000000..f5922b4e808 --- /dev/null +++ b/liboffloadmic/runtime/offload_iterator.h @@ -0,0 +1,103 @@ +/* + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + + +/*! \file + \brief Iterator of Variable tables list used by the runtime library +*/ + +#ifndef OFFLOAD_ITERATOR_H_INCLUDED +#define OFFLOAD_ITERATOR_H_INCLUDED + +#include <iterator> +#include "offload_table.h" + +// The following class is for iteration over var table. +// It was extracted and moved to this offload_iterator.h file from offload_table.h +// to solve the problem with compiling with VS 2010. The problem was in incompatibility +// of STL objects in VS 2010 with ones in later VS versions. + +// var table list iterator +class Iterator : public std::iterator<std::input_iterator_tag, + VarTable::Entry> { + public: + Iterator() : m_node(0), m_entry(0) {} + + explicit Iterator(TableList<VarTable>::Node *node) { + new_node(node); + } + + Iterator& operator++() { + if (m_entry != 0) { + m_entry++; + while (m_entry->name == 0) { + m_entry++; + } + if (m_entry->name == reinterpret_cast<const char*>(-1)) { + new_node(m_node->next); + } + } + return *this; + } + + bool operator==(const Iterator &other) const { + return m_entry == other.m_entry; + } + + bool operator!=(const Iterator &other) const { + return m_entry != other.m_entry; + } + + const VarTable::Entry* operator*() const { + return m_entry; + } + + private: + void new_node(TableList<VarTable>::Node *node) { + m_node = node; + m_entry = 0; + while (m_node != 0) { + m_entry = m_node->table.entries; + while (m_entry->name == 0) { + m_entry++; + } + if (m_entry->name != reinterpret_cast<const char*>(-1)) { + break; + } + m_node = m_node->next; + m_entry = 0; + } + } + + private: + TableList<VarTable>::Node *m_node; + const VarTable::Entry *m_entry; +}; + +#endif // OFFLOAD_ITERATOR_H_INCLUDED diff --git a/liboffloadmic/runtime/offload_myo_host.cpp b/liboffloadmic/runtime/offload_myo_host.cpp index 987d077957a..62149490641 100644 --- a/liboffloadmic/runtime/offload_myo_host.cpp +++ b/liboffloadmic/runtime/offload_myo_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,14 +28,15 @@ */ +#if defined(LINUX) || defined(FREEBSD) +#include <mm_malloc.h> +#endif + #include "offload_myo_host.h" #include <errno.h> #include <malloc.h> #include "offload_host.h" - -#if defined(LINUX) || defined(FREEBSD) -#include <mm_malloc.h> -#endif +//#include "offload_util.h" #define MYO_VERSION1 "MYO_1.0" @@ -47,11 +48,7 @@ extern "C" void __cilkrts_cilk_for_64(void*, void*, uint64_t, int32_t); #pragma weak __cilkrts_cilk_for_64 #endif // TARGET_WINNT -#ifdef TARGET_WINNT -#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(-1) -#else // TARGET_WINNT -#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(0) -#endif // TARGET_WINNT +static void __offload_myoProcessDeferredTables(); class MyoWrapper { public: @@ -140,7 +137,7 @@ public: CheckResult(__func__, m_remote_thunk_call(thunk, args, device)); } - MyoiRFuncCallHandle RemoteCall(char *func, void *args, int device) const { + MyoiRFuncCallHandle RemoteCall(const char *func, void *args, int device) const { OFFLOAD_DEBUG_TRACE(4, "%s(%s, %p, %d)\n", __func__, func, args, device); return m_remote_call(func, args, device); @@ -151,6 +148,73 @@ public: CheckResult(__func__, m_get_result(handle)); } + bool PostInitFuncSupported() const { + OFFLOAD_DEBUG_TRACE(4, "%s()\n", __func__); + if (m_feature_available) { + return m_feature_available(MYO_FEATURE_POST_LIB_INIT) == + MYO_SUCCESS; + } else { + return false; + } + } + + void CreateVtableArena(); + + MyoArena GetVtableArena()const { + return m_vtable_arena; + } + + void ArenaCreate( + MyoOwnershipType ownership, + int consistency, + MyoArena* arena + ) const + { + OFFLOAD_DEBUG_TRACE(4, "%s(%d, %d, %p)\n", + __func__, ownership, consistency, arena); + CheckResult(__func__, m_arena_create(ownership, consistency, arena)); + } + + void* SharedAlignedArenaMalloc( + MyoArena arena, + size_t size, + size_t align + ) const + { + OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedalignedarenamalloc, + "%s(%u, %lld, %lld)\n", + __func__, arena, size, align); + return m_arena_aligned_malloc(arena, size, align); + } + + void* SharedAlignedArenaFree( + MyoArena arena, + void* ptr + ) const + { + OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myosharedalignedarenafree, + "%s(%u, %p)\n", __func__, arena, ptr); + return m_arena_aligned_free(arena, ptr); + } + + void ArenaAcquire( + MyoArena arena + ) const + { + OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myoarenaacquire, + "%s()\n", __func__); + CheckResult(__func__, m_arena_acquire(arena)); + } + + void ArenaRelease( + MyoArena arena + ) const + { + OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_myoarenarelease, + "%s()\n", __func__); + CheckResult(__func__, m_arena_release(arena)); + } + private: void CheckResult(const char *func, MyoError error) const { if (error != MYO_SUCCESS) { @@ -160,8 +224,10 @@ private: } private: - void* m_lib_handle; - bool m_is_available; + void* m_lib_handle; + bool m_is_available; + int m_post_init_func; + MyoArena m_vtable_arena; // pointers to functions from myo library MyoError (*m_lib_init)(void*, void*); @@ -175,11 +241,18 @@ private: MyoError (*m_host_var_table_propagate)(void*, int); MyoError (*m_host_fptr_table_register)(void*, int, int); MyoError (*m_remote_thunk_call)(void*, void*, int); - MyoiRFuncCallHandle (*m_remote_call)(char*, void*, int); + MyoiRFuncCallHandle (*m_remote_call)(const char*, void*, int); MyoError (*m_get_result)(MyoiRFuncCallHandle); + MyoError (*m_arena_create)(MyoOwnershipType, int, MyoArena*); + void* (*m_arena_aligned_malloc)(MyoArena, size_t, size_t); + void* (*m_arena_aligned_free)(MyoArena, void*); + MyoError (*m_arena_acquire)(MyoArena); + MyoError (*m_arena_release)(MyoArena); + // Placeholder until MYO headers support enum type for feature + MyoError (*m_feature_available)(int feature); }; -bool MyoWrapper::LoadLibrary(void) +DLL_LOCAL bool MyoWrapper::LoadLibrary(void) { #ifndef TARGET_WINNT const char *lib_name = "libmyo-client.so"; @@ -295,7 +368,7 @@ bool MyoWrapper::LoadLibrary(void) return false; } - m_remote_call = (MyoiRFuncCallHandle (*)(char*, void*, int)) + m_remote_call = (MyoiRFuncCallHandle (*)(const char*, void*, int)) DL_sym(m_lib_handle, "myoiRemoteCall", MYO_VERSION1); if (m_remote_call == 0) { OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", @@ -313,8 +386,66 @@ bool MyoWrapper::LoadLibrary(void) return false; } + m_arena_create = (MyoError (*)(MyoOwnershipType, int, MyoArena*)) + DL_sym(m_lib_handle, "myoArenaCreate", MYO_VERSION1); + if (m_arena_create == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoArenaCreate"); + UnloadLibrary(); + return false; + } + + m_arena_aligned_malloc = (void* (*)(MyoArena, size_t, size_t)) + DL_sym(m_lib_handle, "myoArenaAlignedMalloc", MYO_VERSION1); + if (m_arena_aligned_malloc == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoArenaAlignedMalloc"); + UnloadLibrary(); + return false; + } + + m_arena_aligned_free = (void* (*)(MyoArena, void*)) + DL_sym(m_lib_handle, "myoArenaAlignedFree", MYO_VERSION1); + if (m_arena_aligned_free == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoArenaAlignedFree"); + UnloadLibrary(); + return false; + } + + m_arena_acquire = (MyoError (*)(MyoArena)) + DL_sym(m_lib_handle, "myoArenaAcquire", MYO_VERSION1); + if (m_acquire == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoArenaAcquire"); + UnloadLibrary(); + return false; + } + + m_arena_release = (MyoError (*)(MyoArena)) + DL_sym(m_lib_handle, "myoArenaRelease", MYO_VERSION1); + if (m_release == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoArenaRelease"); + UnloadLibrary(); + return false; + } + + // Check for "feature-available" API added in MPSS 3.3. + // Not finding it is not an error. + m_feature_available = (MyoError (*)(int)) + DL_sym(m_lib_handle, "myoiSupportsFeature", MYO_VERSION1); + if (m_feature_available == 0) { + OFFLOAD_DEBUG_TRACE(2, "Failed to find %s in MYO library\n", + "myoiSupportsFeature"); + } + OFFLOAD_DEBUG_TRACE(2, "The library was successfully loaded\n"); + // Create arena if supported + CreateVtableArena(); + OFFLOAD_DEBUG_TRACE(3, "Vtable arena created\n"); + m_is_available = true; return true; @@ -323,6 +454,23 @@ bool MyoWrapper::LoadLibrary(void) static bool myo_is_available; static MyoWrapper myo_wrapper; +void MyoWrapper::CreateVtableArena() +{ + MyoArena* vtable_arena; + + // Check if this MYO supports arenas for vtables + if (myo_wrapper.PostInitFuncSupported()) { + // Create arena for vtables + vtable_arena = (MyoArena *)myo_wrapper.SharedMalloc(sizeof(MyoArena)); + myo_wrapper.ArenaCreate( + MYO_ARENA_OURS, MYO_NO_CONSISTENCY, vtable_arena); + m_vtable_arena = *vtable_arena; + OFFLOAD_DEBUG_TRACE(4, "created arena = %d\n", m_vtable_arena); + } else { + m_vtable_arena = 0; + } +} + struct MyoTable { MyoTable(SharedTableEntry *tab, int len) : var_tab(tab), var_tab_len(len) @@ -337,9 +485,11 @@ static MyoTableList __myo_table_list; static mutex_t __myo_table_lock; static bool __myo_tables = false; -static void __offload_myo_shared_table_register(SharedTableEntry *entry); -static void __offload_myo_shared_init_table_register(InitTableEntry* entry); -static void __offload_myo_fptr_table_register(FptrTableEntry *entry); +static void __offload_myo_shared_vtable_process(SharedTableEntry *entry); +static void __offload_myo_shared_table_process(SharedTableEntry *entry); +static void __offload_myo_shared_init_table_process(InitTableEntry* entry); +static void __offload_myo_fptr_table_process(FptrTableEntry *entry); +static void __offload_propagate_shared_vars(); static void __offload_myoLoadLibrary_once(void) { @@ -350,6 +500,7 @@ static void __offload_myoLoadLibrary_once(void) static bool __offload_myoLoadLibrary(void) { + OFFLOAD_DEBUG_TRACE(4, "__offload_myoLoadLibrary\n"); static OffloadOnceControl ctrl = OFFLOAD_ONCE_CONTROL_INIT; __offload_run_once(&ctrl, __offload_myoLoadLibrary_once); @@ -371,17 +522,71 @@ static void __offload_myoInit_once(void) OFFLOAD_DEBUG_TRACE(2, "Initializing MYO library ...\n"); COIEVENT events[MIC_ENGINES_MAX]; - MyoiUserParams params[MIC_ENGINES_MAX+1]; - // load target library to all devices + // One entry per device + + // A pair of entries for the Host postInit func + + // A pair of entries for the MIC postInit func + + // end marker + MyoiUserParams params[MIC_ENGINES_MAX+5]; + + // Load target library to all devices and + // create libinit parameters for all devices for (int i = 0; i < mic_engines_total; i++) { mic_engines[i].init_myo(&events[i]); params[i].type = MYOI_USERPARAMS_DEVID; params[i].nodeid = mic_engines[i].get_physical_index() + 1; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %d, %d }\n", + i, params[i].type, params[i].nodeid); } - params[mic_engines_total].type = MYOI_USERPARAMS_LAST_MSG; + // Check if V2 myoLibInit is available + if (myo_wrapper.PostInitFuncSupported()) { + // Set the host post libInit function indicator + params[mic_engines_total].type = + MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC; + params[mic_engines_total].nodeid = + MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_HOST_NODE; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %d, %d }\n", + mic_engines_total, + params[mic_engines_total].type, params[mic_engines_total].nodeid); + + // Set the host post libInit host function address + ((MyoiUserParamsPostLibInit*)(¶ms[mic_engines_total+1]))-> + postLibInitHostFuncAddress = + (void (*)())&__offload_propagate_shared_vars; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %p }\n", + mic_engines_total+1, + ((MyoiUserParamsPostLibInit*)(¶ms[mic_engines_total+1]))-> + postLibInitHostFuncAddress); + + // Set the target post libInit function indicator + params[mic_engines_total+2].type = + MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC; + params[mic_engines_total+2].nodeid = + MYOI_USERPARAMS_POST_MYO_LIB_INIT_FUNC_ALL_NODES; + + // Set the target post libInit target function name + ((MyoiUserParamsPostLibInit*)(¶ms[mic_engines_total+3]))-> + postLibInitRemoveFuncName = "--vtable_initializer--"; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %s }\n", + mic_engines_total+3, + ((MyoiUserParamsPostLibInit*)(¶ms[mic_engines_total+1]))-> + postLibInitRemoveFuncName); + + params[mic_engines_total+4].type = MYOI_USERPARAMS_LAST_MSG; + params[mic_engines_total+4].nodeid = 0; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %d, %d }\n", + mic_engines_total+4, + params[mic_engines_total+4].type, + params[mic_engines_total+4].nodeid); + } else { + params[mic_engines_total].type = MYOI_USERPARAMS_LAST_MSG; + params[mic_engines_total].nodeid = 0; + OFFLOAD_DEBUG_TRACE(2, "params[%d] = { %d, %d }\n", + mic_engines_total, + params[mic_engines_total].type, params[mic_engines_total].nodeid); + } // initialize myo runtime on host myo_wrapper.LibInit(params, 0); @@ -395,6 +600,7 @@ static void __offload_myoInit_once(void) } myo_is_available = true; + OFFLOAD_DEBUG_TRACE(2, "setting myo_is_available=%d\n", myo_is_available); OFFLOAD_DEBUG_TRACE(2, "Initializing MYO library ... done\n"); } @@ -404,12 +610,22 @@ static bool __offload_myoInit(void) static OffloadOnceControl ctrl = OFFLOAD_ONCE_CONTROL_INIT; __offload_run_once(&ctrl, __offload_myoInit_once); - // register pending shared var tables - if (myo_is_available && __myo_tables) { + // Check if using V1 myoLibInit + if (!myo_wrapper.PostInitFuncSupported()) { + __offload_propagate_shared_vars(); + } + + return myo_is_available; +} + +static void __offload_propagate_shared_vars() +{ + // Propagate pending shared var tables + if (__myo_tables) { mutex_locker_t locker(__myo_table_lock); if (__myo_tables) { - // Register tables with MYO so it can propagate to target. + // Give tables with MYO so it can propagate to target for(MyoTableList::const_iterator it = __myo_table_list.begin(); it != __myo_table_list.end(); ++it) { #ifdef TARGET_WINNT @@ -419,6 +635,8 @@ static bool __offload_myoInit(void) continue; } myo_wrapper.HostVarTablePropagate(entry, 1); + OFFLOAD_DEBUG_TRACE(2, "HostVarTablePropagate(%s, 1)\n", + entry->varName); } #else // TARGET_WINNT myo_wrapper.HostVarTablePropagate(it->var_tab, @@ -430,8 +648,6 @@ static bool __offload_myoInit(void) __myo_tables = false; } } - - return myo_is_available; } static bool shared_table_entries( @@ -485,13 +701,164 @@ extern "C" void __offload_myoRegisterTables( __offload_myoLoadLibrary(); // register tables - __offload_myo_shared_table_register(shared_table); - __offload_myo_fptr_table_register(fptr_table); - __offload_myo_shared_init_table_register(init_table); + __offload_myo_shared_table_process(shared_table); + __offload_myo_fptr_table_process(fptr_table); + __offload_myo_shared_init_table_process(init_table); } } -void __offload_myoFini(void) +extern "C" bool __offload_myoProcessTables( + const void* image, + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); + + // Collect the tables in this .dll/.so + __offload_myoRegisterTables1( + init_table, shared_table, shared_vtable, fptr_table); + + // Now check what type of module we are dealing with + if (__offload_target_image_is_executable(image)) { + OFFLOAD_DEBUG_TRACE(2, "Main encountered\n"); + OFFLOAD_DEBUG_TRACE(2, "MYO initialization not deferred\n"); + // MYO tables across dlls have been collected + // Now init MYO and process the tables + __offload_myoProcessDeferredTables(); + // Return true to indicate that atexit needs to be calld by ofldbegin + return true; + } else { + // This is a shared library, either auto-loaded or dynamically loaded + // If __target_exe is set, then main has started running + if (__target_exe != 0) { + // Main is running: this is a dynamic load of a shared library + // Finish processing the tables in this library + OFFLOAD_DEBUG_TRACE(2, + "Dynamically loaded shared library encountered\n"); + OFFLOAD_DEBUG_TRACE(2, + "MYO initialization not deferred\n"); + __offload_myoProcessDeferredTables(); + } else { + // Main is not running: this is an auto-loaded shared library + // Tables have been collected, nothing else to do + OFFLOAD_DEBUG_TRACE(2, + "Auto-loaded shared library encountered\n"); + OFFLOAD_DEBUG_TRACE(2, "Deferring initialization of MYO\n"); + } + return false; + } +} + +// Process contents of all Var tables +void MYOVarTableList::process() +{ + OFFLOAD_DEBUG_TRACE(2, "Process MYO Var tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + __offload_myo_shared_table_process( + (SharedTableEntry*)n->table.entries); + } + for (Node *n = m_head; n != 0; n = n->next) { + remove_table(n); + } + + m_lock.unlock(); +} + +// Process contents of all Var tables +void MYOVarTableList::process_vtable() +{ + OFFLOAD_DEBUG_TRACE(2, "Process MYO Vtable tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + __offload_myo_shared_vtable_process( + (SharedTableEntry*)n->table.entries); + } + for (Node *n = m_head; n != 0; n = n->next) { + remove_table(n); + } + + m_lock.unlock(); +} + +// Process contents of all Func tables +void MYOFuncTableList::process() +{ + OFFLOAD_DEBUG_TRACE(2, "Process MYO Func tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + __offload_myo_fptr_table_process( + (FptrTableEntry*)n->table.entries); + } + for (Node *n = m_head; n != 0; n = n->next) { + remove_table(n); + } + + m_lock.unlock(); +} + +// Process contents of all Init tables +void MYOInitTableList::process() +{ + OFFLOAD_DEBUG_TRACE(2, "Process MYO Init tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + __offload_myo_shared_init_table_process( + (InitTableEntry*)n->table.entries); + } + for (Node *n = m_head; n != 0; n = n->next) { + remove_table(n); + } + + m_lock.unlock(); +} + +static void __offload_myoProcessDeferredTables() +{ + OFFLOAD_DEBUG_TRACE(3, "%s()\n", __func__); + + // Debug dumps of MYO tables + if (console_enabled >= 2) { + __offload_myo_var_tables.dump(); + __offload_myo_vtable_tables.dump(); + __offload_myo_func_tables.dump(); + __offload_myo_init_tables.dump(); + } + + if (!__offload_myo_var_tables.is_empty() || + !__offload_myo_vtable_tables.is_empty() || + !__offload_myo_func_tables.is_empty() || + !__offload_myo_init_tables.is_empty()) + { + OFFLOAD_DEBUG_TRACE(3, "MYO usage detected in program\n"); + + // Make sure myo library is loaded + __offload_myoLoadLibrary(); + OFFLOAD_DEBUG_TRACE(3, "Initialized MYO\n"); + + __offload_myo_var_tables.process(); + __offload_myo_vtable_tables.process_vtable(); + __offload_myo_func_tables.process(); + __offload_myo_init_tables.process(); + OFFLOAD_DEBUG_TRACE(3, "Finished processing MYO tables\n"); + } else { + OFFLOAD_DEBUG_TRACE(3, + "MYO tables are empty; Will not initialize MYO\n"); + } +} + +DLL_LOCAL void __offload_myoFini(void) { if (myo_is_available) { OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); @@ -516,7 +883,7 @@ void __offload_myoFini(void) } } -static void __offload_myo_shared_table_register( +static void __offload_myo_shared_table_process( SharedTableEntry *entry ) { @@ -529,7 +896,8 @@ static void __offload_myo_shared_table_register( for (; entry->varName != MYO_TABLE_END_MARKER(); entry++) { #ifdef TARGET_WINNT if (entry->varName == 0) { - OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoSharedTable entry\n"); + OFFLOAD_DEBUG_TRACE(4, + "skip registering a NULL MyoSharedTable entry\n"); continue; } #endif // TARGET_WINNT @@ -550,29 +918,69 @@ static void __offload_myo_shared_table_register( } } -static void __offload_myo_shared_init_table_register(InitTableEntry* entry) +static void __offload_myo_shared_vtable_process( + SharedTableEntry *entry +) +{ + SharedTableEntry *start = entry; + int entries = 0; + + OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry); + + // allocate shared memory for vtables + for (; entry->varName != MYO_TABLE_END_MARKER(); entry++) { +#ifdef TARGET_WINNT + if (entry->varName == 0) { + OFFLOAD_DEBUG_TRACE(4, + "skip registering a NULL MyoSharedVTable entry\n"); + continue; + } +#endif // TARGET_WINNT + + OFFLOAD_DEBUG_TRACE(4, + "registering MyoSharedVTable entry for %s @%p\n", + entry->varName, entry); + + // Invoke the function to create shared memory + reinterpret_cast<void(*)(MyoArena)>(entry->sharedAddr)( + myo_wrapper.GetVtableArena()); + entries++; + } + + // add table to the list if it is not empty + if (entries > 0) { + mutex_locker_t locker(__myo_table_lock); + __myo_table_list.push_back(MyoTable(start, entries)); + __myo_tables = true; + } +} + +void __offload_myo_shared_init_table_process(InitTableEntry* entry) { OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry); #ifdef TARGET_WINNT for (; entry->funcName != MYO_TABLE_END_MARKER(); entry++) { if (entry->funcName == 0) { - OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoSharedInit entry\n"); + OFFLOAD_DEBUG_TRACE(4, + "skip registering a NULL MyoSharedInit entry\n"); continue; } // Invoke the function to init the shared memory - entry->func(); + OFFLOAD_DEBUG_TRACE(4, "execute MyoSharedInit routine for %s\n", + entry->funcName); + entry->func(myo_wrapper.GetVtableArena()); } #else // TARGET_WINNT for (; entry->func != 0; entry++) { // Invoke the function to init the shared memory - entry->func(); + entry->func(myo_wrapper.GetVtableArena()); } #endif // TARGET_WINNT } -static void __offload_myo_fptr_table_register( +static void __offload_myo_fptr_table_process( FptrTableEntry *entry ) { @@ -584,7 +992,8 @@ static void __offload_myo_fptr_table_register( for (; entry->funcName != MYO_TABLE_END_MARKER(); entry++) { #ifdef TARGET_WINNT if (entry->funcName == 0) { - OFFLOAD_DEBUG_TRACE(4, "skip registering a NULL MyoFptrTable entry\n"); + OFFLOAD_DEBUG_TRACE(4, + "skip registering a NULL MyoFptrTable entry\n"); continue; } #endif // TARGET_WINNT @@ -722,6 +1131,80 @@ extern "C" void _Offload_shared_aligned_free(void *ptr) } } +extern "C" void _Offload_shared_arena_create( + MyoOwnershipType ownership, + int consistency, + MyoArena* arena +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%d, %d, %p)\n", + __func__, ownership, consistency, arena); + + if (__offload_myoLoadLibrary()) { + myo_wrapper.ArenaCreate(ownership, consistency, arena); + } +} + +extern "C" void* _Offload_shared_aligned_arena_malloc( + MyoArena arena, + size_t size, + size_t align +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u, %lld, %lld)\n", + __func__, arena, size, align); + + if (__offload_myoLoadLibrary()) { + void *p = myo_wrapper.SharedAlignedArenaMalloc(arena, size, align); + OFFLOAD_DEBUG_TRACE(3, "%s(%u, %lld, %lld)->%p\n", + __func__, arena, size, align, p); + return p; + } + else { + if (align < sizeof(void*)) { + align = sizeof(void*); + } + return _mm_malloc(size, align); + } +} + +extern "C" void _Offload_shared_aligned_arena_free( + MyoArena arena, + void *ptr +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u, %p)\n", __func__, arena, ptr); + + if (__offload_myoLoadLibrary()) { + myo_wrapper.SharedAlignedArenaFree(arena, ptr); + } + else { + _mm_free(ptr); + } +} + +extern "C" void _Offload_shared_arena_acquire( + MyoArena arena +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u)\n", __func__, arena); + + if (__offload_myoLoadLibrary()) { + myo_wrapper.ArenaAcquire(arena); + } +} + +extern "C" void _Offload_shared_arena_release( + MyoArena arena +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u)\n", __func__, arena); + + if (__offload_myoLoadLibrary()) { + myo_wrapper.ArenaRelease(arena); + } +} + extern "C" void __intel_cilk_for_32_offload( int size, void (*copy_constructor)(void*, void*), diff --git a/liboffloadmic/runtime/offload_myo_host.h b/liboffloadmic/runtime/offload_myo_host.h index 1116ee3601e..5b9f160f1be 100644 --- a/liboffloadmic/runtime/offload_myo_host.h +++ b/liboffloadmic/runtime/offload_myo_host.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -34,67 +34,35 @@ #include <myotypes.h> #include <myoimpl.h> #include <myo.h> -#include "offload.h" - -typedef MyoiSharedVarEntry SharedTableEntry; -//typedef MyoiHostSharedFptrEntry FptrTableEntry; -typedef struct { - //! Function Name - const char *funcName; - //! Function Address - void *funcAddr; - //! Local Thunk Address - void *localThunkAddr; -#ifdef TARGET_WINNT - // Dummy to pad up to 32 bytes - void *dummy; -#endif // TARGET_WINNT -} FptrTableEntry; - -struct InitTableEntry { -#ifdef TARGET_WINNT - // Dummy to pad up to 16 bytes - // Function Name - const char *funcName; -#endif // TARGET_WINNT - void (*func)(void); -}; - -#ifdef TARGET_WINNT -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a" -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z" - -#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable$a" -#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable$z" - -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a" -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z" -#else // TARGET_WINNT -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable." -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable." - -#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable." -#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable." - -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable." -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable." -#endif // TARGET_WINNT - -#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write) -#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write) - -#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START, read, write) -#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END, read, write) - -#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write) -#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write) +#include "offload.h" +// undefine the following since offload.h defines them to malloc and free if __INTEL_OFFLOAD +// is not defined which is the case when building the offload library +#undef _Offload_shared_malloc +#undef _Offload_shared_free +#undef _Offload_shared_aligned_malloc +#undef _Offload_shared_aligned_free +#include "offload_table.h" + +// This function retained for compatibility with 15.0 extern "C" void __offload_myoRegisterTables( InitTableEntry *init_table, SharedTableEntry *shared_table, FptrTableEntry *fptr_table ); +// Process shared variable, shared vtable and function and init routine tables. +// In .dlls/.sos these will be collected together. +// In the main program, all collected tables will be processed. +extern "C" bool __offload_myoProcessTables( + const void* image, + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +); + extern void __offload_myoFini(void); +extern bool __offload_myo_init_is_deferred(const void *image); #endif // OFFLOAD_MYO_HOST_H_INCLUDED diff --git a/liboffloadmic/runtime/offload_myo_target.cpp b/liboffloadmic/runtime/offload_myo_target.cpp index bd5ad17adbc..5160ca951ac 100644 --- a/liboffloadmic/runtime/offload_myo_target.cpp +++ b/liboffloadmic/runtime/offload_myo_target.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -44,7 +44,7 @@ static void CheckResult(const char *func, MyoError error) { } } -static void __offload_myo_shared_table_register(SharedTableEntry *entry) +static void __offload_myo_shared_table_process(SharedTableEntry *entry) { int entries = 0; SharedTableEntry *t_start; @@ -68,7 +68,32 @@ static void __offload_myo_shared_table_register(SharedTableEntry *entry) } } -static void __offload_myo_fptr_table_register( +static void __offload_myo_shared_vtable_process(SharedTableEntry *entry) +{ + int entries = 0; + SharedTableEntry *t_start; + + OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry); + + t_start = entry; + while (t_start->varName != 0) { + OFFLOAD_DEBUG_TRACE_1(4, 0, c_offload_mic_myo_shared, + "myo shared vtable entry name" + " = \"%s\" addr = %p\n", + t_start->varName, t_start->sharedAddr); + t_start++; + entries++; + } + + if (entries > 0) { + OFFLOAD_DEBUG_TRACE(3, "myoiMicVarTableRegister(%p, %d)\n", entry, + entries); + CheckResult("myoiMicVarTableRegister", + myoiMicVarTableRegister(entry, entries)); + } +} + +static void __offload_myo_fptr_table_process( FptrTableEntry *entry ) { @@ -94,9 +119,22 @@ static void __offload_myo_fptr_table_register( } } +void __offload_myo_shared_init_table_process(InitTableEntry* entry) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, entry); + + for (; entry->func != 0; entry++) { + // Invoke the function to init the shared memory + OFFLOAD_DEBUG_TRACE(3, "Invoked a shared init function @%p\n", + (void *)(entry->func)); + entry->func(); + } +} + extern "C" void __offload_myoAcquire(void) { OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); + CheckResult("myoAcquire", myoAcquire()); } @@ -162,8 +200,35 @@ extern "C" void __offload_myoRegisterTables( return; } - __offload_myo_shared_table_register(shared_table); - __offload_myo_fptr_table_register(fptr_table); + __offload_myo_shared_table_process(shared_table); + __offload_myo_fptr_table_process(fptr_table); +} + +extern "C" void __offload_myoProcessTables( + InitTableEntry* init_table, + SharedTableEntry *shared_table, + SharedTableEntry *shared_vtable, + FptrTableEntry *fptr_table +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); + + // one time registration of Intel(R) Cilk(TM) language entries + static pthread_once_t once_control = PTHREAD_ONCE_INIT; + pthread_once(&once_control, __offload_myo_once_init); + + // register module's tables + // check slot-1 of the function table because + // slot-0 is predefined with --vtable_initializer-- + if (shared_table->varName == 0 && + shared_vtable->varName == 0 && + fptr_table[1].funcName == 0) { + return; + } + + __offload_myo_shared_table_process(shared_table); + __offload_myo_shared_vtable_process(shared_vtable); + __offload_myo_fptr_table_process(fptr_table); } extern "C" void* _Offload_shared_malloc(size_t size) @@ -190,6 +255,46 @@ extern "C" void _Offload_shared_aligned_free(void *ptr) myoSharedAlignedFree(ptr); } +extern "C" void* _Offload_shared_aligned_arena_malloc( + MyoArena arena, + size_t size, + size_t align +) +{ + OFFLOAD_DEBUG_TRACE( + 3, "%s(%u, %lld, %lld)\n", __func__, arena, size, align); + + return myoArenaAlignedMalloc(arena, size, align); +} + +extern "C" void _Offload_shared_aligned_arena_free( + MyoArena arena, + void *ptr +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u, %p)\n", __func__, arena, ptr); + + myoArenaAlignedFree(arena, ptr); +} + +extern "C" void _Offload_shared_arena_acquire( + MyoArena arena +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u)\n", __func__, arena); + + myoArenaAcquire(arena); +} + +extern "C" void _Offload_shared_arena_release( + MyoArena arena +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s(%u)\n", __func__, arena); + + myoArenaRelease(arena); +} + // temporary workaround for blocking behavior of myoiLibInit/Fini calls extern "C" void __offload_myoLibInit() { diff --git a/liboffloadmic/runtime/offload_myo_target.h b/liboffloadmic/runtime/offload_myo_target.h index 777a3da1aca..4383aae0b5e 100644 --- a/liboffloadmic/runtime/offload_myo_target.h +++ b/liboffloadmic/runtime/offload_myo_target.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -31,42 +31,38 @@ #ifndef OFFLOAD_MYO_TARGET_H_INCLUDED #define OFFLOAD_MYO_TARGET_H_INCLUDED -#include <myotypes.h> -#include <myoimpl.h> -#include <myo.h> -#include "offload.h" - -typedef MyoiSharedVarEntry SharedTableEntry; -typedef MyoiTargetSharedFptrEntry FptrTableEntry; - -#ifdef TARGET_WINNT -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a" -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z" - -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a" -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z" -#else // TARGET_WINNT -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable." -#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable." - -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable." -#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable." -#endif // TARGET_WINNT - -#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write) -#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write) - -#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write) -#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write) +#include "offload.h" +// undefine the following since offload.h defines them to malloc and free if __INTEL_OFFLOAD +// is not defined which is the case when building the offload library +#undef _Offload_shared_malloc +#undef _Offload_shared_free +#undef _Offload_shared_aligned_malloc +#undef _Offload_shared_aligned_free +#include "offload_table.h" + +// This function retained for compatibility with 15.0 extern "C" void __offload_myoRegisterTables( SharedTableEntry *shared_table, FptrTableEntry *fptr_table ); +// Process shared variable, shared vtable and function and init routine tables. +// On the target side the contents of the tables are registered with MYO. +extern "C" void __offload_myoProcessTables( + InitTableEntry* init_table, + SharedTableEntry *shared_table, + SharedTableEntry *shared_vtable, + FptrTableEntry *fptr_table +); + extern "C" void __offload_myoAcquire(void); extern "C" void __offload_myoRelease(void); +// Call the compiler-generated routines for initializing shared variables. +// This can only be done after shared memory allocation has been done. +extern void __offload_myo_shared_init_table_process(InitTableEntry* entry); + // temporary workaround for blocking behavior for myoiLibInit/Fini calls extern "C" void __offload_myoLibInit(); extern "C" void __offload_myoLibFini(); diff --git a/liboffloadmic/runtime/offload_omp_host.cpp b/liboffloadmic/runtime/offload_omp_host.cpp index ceba612ac3b..14498470e3a 100644 --- a/liboffloadmic/runtime/offload_omp_host.cpp +++ b/liboffloadmic/runtime/offload_omp_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_omp_target.cpp b/liboffloadmic/runtime/offload_omp_target.cpp index 2ccce7c7687..91baef5da87 100644 --- a/liboffloadmic/runtime/offload_omp_target.cpp +++ b/liboffloadmic/runtime/offload_omp_target.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -86,7 +86,7 @@ static int omp_get_int_from_host( return setting; } -void omp_set_num_threads_lrb( +DLL_LOCAL void omp_set_num_threads_lrb( void *ofld ) { @@ -96,7 +96,7 @@ void omp_set_num_threads_lrb( omp_set_num_threads(num_threads); } -void omp_get_max_threads_lrb( +DLL_LOCAL void omp_get_max_threads_lrb( void *ofld ) { @@ -106,7 +106,7 @@ void omp_get_max_threads_lrb( omp_send_int_to_host(ofld, num_threads); } -void omp_get_num_procs_lrb( +DLL_LOCAL void omp_get_num_procs_lrb( void *ofld ) { @@ -116,7 +116,7 @@ void omp_get_num_procs_lrb( omp_send_int_to_host(ofld, num_procs); } -void omp_set_dynamic_lrb( +DLL_LOCAL void omp_set_dynamic_lrb( void *ofld ) { @@ -126,7 +126,7 @@ void omp_set_dynamic_lrb( omp_set_dynamic(dynamic); } -void omp_get_dynamic_lrb( +DLL_LOCAL void omp_get_dynamic_lrb( void *ofld ) { @@ -136,7 +136,7 @@ void omp_get_dynamic_lrb( omp_send_int_to_host(ofld, dynamic); } -void omp_set_nested_lrb( +DLL_LOCAL void omp_set_nested_lrb( void *ofld ) { @@ -146,7 +146,7 @@ void omp_set_nested_lrb( omp_set_nested(nested); } -void omp_get_nested_lrb( +DLL_LOCAL void omp_get_nested_lrb( void *ofld ) { @@ -156,7 +156,7 @@ void omp_get_nested_lrb( omp_send_int_to_host(ofld, nested); } -void omp_set_schedule_lrb( +DLL_LOCAL void omp_set_schedule_lrb( void *ofld_ ) { @@ -180,7 +180,7 @@ void omp_set_schedule_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_get_schedule_lrb( +DLL_LOCAL void omp_get_schedule_lrb( void *ofld_ ) { @@ -206,7 +206,7 @@ void omp_get_schedule_lrb( // lock API functions -void omp_init_lock_lrb( +DLL_LOCAL void omp_init_lock_lrb( void *ofld_ ) { @@ -224,7 +224,7 @@ void omp_init_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_destroy_lock_lrb( +DLL_LOCAL void omp_destroy_lock_lrb( void *ofld_ ) { @@ -242,7 +242,7 @@ void omp_destroy_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_set_lock_lrb( +DLL_LOCAL void omp_set_lock_lrb( void *ofld_ ) { @@ -260,7 +260,7 @@ void omp_set_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_unset_lock_lrb( +DLL_LOCAL void omp_unset_lock_lrb( void *ofld_ ) { @@ -278,7 +278,7 @@ void omp_unset_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_test_lock_lrb( +DLL_LOCAL void omp_test_lock_lrb( void *ofld_ ) { @@ -304,7 +304,7 @@ void omp_test_lock_lrb( // nested lock API functions -void omp_init_nest_lock_lrb( +DLL_LOCAL void omp_init_nest_lock_lrb( void *ofld_ ) { @@ -322,7 +322,7 @@ void omp_init_nest_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_destroy_nest_lock_lrb( +DLL_LOCAL void omp_destroy_nest_lock_lrb( void *ofld_ ) { @@ -340,7 +340,7 @@ void omp_destroy_nest_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_set_nest_lock_lrb( +DLL_LOCAL void omp_set_nest_lock_lrb( void *ofld_ ) { @@ -358,7 +358,7 @@ void omp_set_nest_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_unset_nest_lock_lrb( +DLL_LOCAL void omp_unset_nest_lock_lrb( void *ofld_ ) { @@ -376,7 +376,7 @@ void omp_unset_nest_lock_lrb( OFFLOAD_TARGET_LEAVE(ofld); } -void omp_test_nest_lock_lrb( +DLL_LOCAL void omp_test_nest_lock_lrb( void *ofld_ ) { diff --git a/liboffloadmic/runtime/offload_orsl.cpp b/liboffloadmic/runtime/offload_orsl.cpp index aa3edc36e03..9a7ac3b6f63 100644 --- a/liboffloadmic/runtime/offload_orsl.cpp +++ b/liboffloadmic/runtime/offload_orsl.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -36,7 +36,7 @@ namespace ORSL { static bool is_enabled = false; -static const ORSLTag my_tag = "Offload"; +static const ORSLTag my_tag = (const ORSLTag) "Offload"; void init() { diff --git a/liboffloadmic/runtime/offload_orsl.h b/liboffloadmic/runtime/offload_orsl.h index 8bdbf1abb50..df3f5fc36ea 100644 --- a/liboffloadmic/runtime/offload_orsl.h +++ b/liboffloadmic/runtime/offload_orsl.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -28,17 +28,19 @@ */ +#include "offload_util.h" + #ifndef OFFLOAD_ORSL_H_INCLUDED #define OFFLOAD_ORSL_H_INCLUDED // ORSL interface namespace ORSL { -extern void init(); +DLL_LOCAL extern void init(); -extern bool reserve(int device); -extern bool try_reserve(int device); -extern void release(int device); +DLL_LOCAL extern bool reserve(int device); +DLL_LOCAL extern bool try_reserve(int device); +DLL_LOCAL extern void release(int device); } // namespace ORSL diff --git a/liboffloadmic/runtime/offload_table.cpp b/liboffloadmic/runtime/offload_table.cpp index d73def16e70..f3c5100cacd 100644 --- a/liboffloadmic/runtime/offload_table.cpp +++ b/liboffloadmic/runtime/offload_table.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -321,6 +321,8 @@ extern "C" void __offload_unregister_tables( VarList::Node *var_table ) { + OFFLOAD_DEBUG_TRACE(2, "Unregistering offload function entry table %p\n", + entry_table); __offload_entries.remove_table(entry_table); OFFLOAD_DEBUG_TRACE(2, "Unregistering function table %p\n", func_table); @@ -329,3 +331,219 @@ extern "C" void __offload_unregister_tables( OFFLOAD_DEBUG_TRACE(2, "Unregistering var table %p\n", var_table); __offload_vars.remove_table(var_table); } + +#ifdef MYO_SUPPORT + +MYOVarTableList __offload_myo_var_tables; +MYOVarTableList __offload_myo_vtable_tables; +MYOFuncTableList __offload_myo_func_tables; +MYOInitTableList __offload_myo_init_tables; + +// Debugging dump +void MYOVarTableList::dump(void) +{ + OFFLOAD_DEBUG_TRACE(2, "MYO Var tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + OFFLOAD_DEBUG_TRACE(2, " MYO Var table:\n"); + for (const Table::Entry *e = n->table.entries; + e->varName != MYO_TABLE_END_MARKER(); e++) { +#ifdef TARGET_WINNT + if (e->varName == 0) { + continue; + } +#endif // TARGET_WINNT + OFFLOAD_DEBUG_TRACE(2, " %s %p\n", + e->varName, e->sharedAddr); + } + } + + m_lock.unlock(); +} + +// check if any shared variables +bool MYOVarTableList::is_empty() +{ + OFFLOAD_DEBUG_TRACE(3, "Are MYO Var tables empty?\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + for (const Table::Entry *e = n->table.entries; + e->varName != MYO_TABLE_END_MARKER(); e++) { +#ifdef TARGET_WINNT + if (e->varName == 0) { + continue; + } +#endif // TARGET_WINNT + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "No\n"); + return false; + } + } + + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "Yes\n"); + return true; +} + +void MYOFuncTableList::dump(void) +{ + OFFLOAD_DEBUG_TRACE(2, "MYO Func tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + OFFLOAD_DEBUG_TRACE(2, " MYO Func table:\n"); + for (const Table::Entry *e = n->table.entries; + e->funcName != MYO_TABLE_END_MARKER(); e++) { +#ifdef TARGET_WINNT + if (e->funcName == 0) { + continue; + } +#endif // TARGET_WINNT +#if HOST_LIBRARY + OFFLOAD_DEBUG_TRACE(2, " %s %p %p\n", + e->funcName, e->funcAddr, e->localThunkAddr); +#else // HOST_LIBRARY + OFFLOAD_DEBUG_TRACE(2, " %s %p %p %p\n", + e->funcName, e->funcAddr, e->wrapFuncAddr, e->localThunkAddr); +#endif // HOST_LIBRARY + } + } + + m_lock.unlock(); +} + +// check if any shared functions +bool MYOFuncTableList::is_empty() +{ + OFFLOAD_DEBUG_TRACE(3, "Are MYO Func tables empty?\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + int count = 0; + for (const Table::Entry *e = n->table.entries; + e->funcName != MYO_TABLE_END_MARKER(); e++) { +#ifdef TARGET_WINNT + if (e->funcName == 0) { + continue; + } +#endif // TARGET_WINNT + count++; + if (count > 1) { + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "No\n"); + return false; + } + } + } + + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "Yes\n"); + return true; +} + +void MYOInitTableList::dump(void) +{ + OFFLOAD_DEBUG_TRACE(2, "MYO Init tables:\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + OFFLOAD_DEBUG_TRACE(2, " MYO Init table:\n"); + for (const Table::Entry *e = n->table.entries; +#ifdef TARGET_WINNT + e->funcName != MYO_TABLE_END_MARKER(); e++) { + if (e->funcName == 0) { + continue; + } + OFFLOAD_DEBUG_TRACE(2, " %s %p\n", e->funcName, e->func); +#else // TARGET_WINNT + e->func != 0; e++) { + OFFLOAD_DEBUG_TRACE(2, " %p\n", e->func); +#endif // TARGET_WINNT + } + } + + m_lock.unlock(); +} + +// check if any shared functions +bool MYOInitTableList::is_empty() +{ + OFFLOAD_DEBUG_TRACE(3, "Are MYO Init tables empty?\n"); + + m_lock.lock(); + + for (Node *n = m_head; n != 0; n = n->next) { + for (const Table::Entry *e = n->table.entries; +#ifdef TARGET_WINNT + e->funcName != MYO_TABLE_END_MARKER(); e++) { + if (e->funcName == 0) { + continue; + } + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "No\n"); + return false; +#else // TARGET_WINNT + e->func != 0; e++) { +#endif // TARGET_WINNT + } + } + + m_lock.unlock(); + OFFLOAD_DEBUG_TRACE(3, "Yes\n"); + return true; +} + +extern "C" void __offload_myoRegisterTables1( + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +) +{ + OFFLOAD_DEBUG_TRACE(2, "Registering MYO shared var table %p\n", + shared_table); + __offload_myo_var_tables.add_table(shared_table); + + OFFLOAD_DEBUG_TRACE(2, "Registering MYO shared vtable table %p\n", + shared_vtable); + __offload_myo_vtable_tables.add_table(shared_vtable); + + OFFLOAD_DEBUG_TRACE(2, "Registering MYO function table %p\n", fptr_table); + __offload_myo_func_tables.add_table(fptr_table); + + OFFLOAD_DEBUG_TRACE(2, "Registering MYO init table %p\n", init_table); + __offload_myo_init_tables.add_table(init_table); +} + +extern "C" void __offload_myoRemoveTables( + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +) +{ + OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); + + OFFLOAD_DEBUG_TRACE(2, "Removing MYO shared var table %p\n", + shared_table); + __offload_myo_var_tables.remove_table(shared_table); + + OFFLOAD_DEBUG_TRACE(2, "Removing MYO shared vtable table %p\n", + shared_vtable); + __offload_myo_vtable_tables.remove_table(shared_vtable); + + OFFLOAD_DEBUG_TRACE(2, "Removing MYO function table %p\n", fptr_table); + __offload_myo_func_tables.remove_table(fptr_table); + + OFFLOAD_DEBUG_TRACE(2, "Removing MYO init table %p\n", init_table); + __offload_myo_init_tables.remove_table(init_table); +} + +#endif // MYO_SUPPORT diff --git a/liboffloadmic/runtime/offload_table.h b/liboffloadmic/runtime/offload_table.h index cc4caad47a1..5602f2bfc42 100644 --- a/liboffloadmic/runtime/offload_table.h +++ b/liboffloadmic/runtime/offload_table.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -35,7 +35,6 @@ #ifndef OFFLOAD_TABLE_H_INCLUDED #define OFFLOAD_TABLE_H_INCLUDED -#include <iterator> #include "offload_util.h" // Template representing double linked list of tables @@ -56,7 +55,6 @@ public: void add_table(Node *node) { m_lock.lock(); - if (m_head != 0) { node->next = m_head; m_head->prev = node; @@ -67,8 +65,6 @@ public: } void remove_table(Node *node) { - m_lock.lock(); - if (node->next != 0) { node->next->prev = node->prev; } @@ -78,8 +74,6 @@ public: if (m_head == node) { m_head = node->next; } - - m_lock.unlock(); } protected: @@ -109,7 +103,7 @@ struct FuncTable { }; // Function table -class FuncList : public TableList<FuncTable> { +class DLL_LOCAL FuncList : public TableList<FuncTable> { public: explicit FuncList(Node *node = 0) : TableList<Table>(node), m_max_name_len(-1) @@ -172,7 +166,7 @@ struct VarTable { }; // List of var tables -class VarList : public TableList<VarTable> { +class DLL_LOCAL VarList : public TableList<VarTable> { public: VarList() : TableList<Table>() {} @@ -181,69 +175,9 @@ public: void dump(); public: - // var table list iterator - class Iterator : public std::iterator<std::input_iterator_tag, - Table::Entry> { - public: - Iterator() : m_node(0), m_entry(0) {} - - explicit Iterator(Node *node) { - new_node(node); - } - - Iterator& operator++() { - if (m_entry != 0) { - m_entry++; - while (m_entry->name == 0) { - m_entry++; - } - if (m_entry->name == reinterpret_cast<const char*>(-1)) { - new_node(m_node->next); - } - } - return *this; - } - - bool operator==(const Iterator &other) const { - return m_entry == other.m_entry; - } - - bool operator!=(const Iterator &other) const { - return m_entry != other.m_entry; - } - - const Table::Entry* operator*() const { - return m_entry; - } - - private: - void new_node(Node *node) { - m_node = node; - m_entry = 0; - while (m_node != 0) { - m_entry = m_node->table.entries; - while (m_entry->name == 0) { - m_entry++; - } - if (m_entry->name != reinterpret_cast<const char*>(-1)) { - break; - } - m_node = m_node->next; - m_entry = 0; - } - } - - private: - Node *m_node; - const Table::Entry *m_entry; - }; - - Iterator begin() const { - return Iterator(m_head); - } - Iterator end() const { - return Iterator(); + Node * get_head() { + return m_head; } public: @@ -265,9 +199,9 @@ public: static void table_patch_names(void *buf, int64_t nelems); }; -extern FuncList __offload_entries; -extern FuncList __offload_funcs; -extern VarList __offload_vars; +DLL_LOCAL extern FuncList __offload_entries; +DLL_LOCAL extern FuncList __offload_funcs; +DLL_LOCAL extern VarList __offload_vars; // Section names where the lookup tables are stored #ifdef TARGET_WINNT @@ -318,4 +252,206 @@ extern "C" void __offload_unregister_tables( FuncList::Node *func_table, VarList::Node *var_table ); + + +#ifdef MYO_SUPPORT + +#include <myotypes.h> +#include <myoimpl.h> +#include <myo.h> + +#ifdef TARGET_WINNT +#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(-1) +#else // TARGET_WINNT +#define MYO_TABLE_END_MARKER() reinterpret_cast<const char*>(0) +#endif // TARGET_WINNT + +// Host and Target-side MYO shared variable table entry layout +typedef MyoiSharedVarEntry SharedTableEntry; + +#if HOST_LIBRARY + +// Host-side MYO function table entry layout +typedef struct { + //! Function Name + const char *funcName; + //! Function Address + void *funcAddr; + //! Local Thunk Address + void *localThunkAddr; +#ifdef TARGET_WINNT + // Dummy to pad up to 32 bytes + void *dummy; +#endif // TARGET_WINNT +} FptrTableEntry; + +// Host-side MYO init routine table entry layout +typedef struct { +#ifdef TARGET_WINNT + // Dummy to pad up to 16 bytes + // Function Name + const char *funcName; +#endif // TARGET_WINNT + void (*func)(MyoArena); +} InitTableEntry; + +#else // HOST_LIBRARY + +// Target-side MYO function table entry layout +typedef MyoiTargetSharedFptrEntry FptrTableEntry; + +// Target-side MYO init routine table entry layout +struct InitTableEntry { + void (*func)(void); +}; + +#endif // HOST_LIBRARY + +#ifdef TARGET_WINNT + +#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable$a" +#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable$z" + +#define OFFLOAD_MYO_SHARED_VTABLE_SECTION_START ".MyoSharedVTable$a" +#define OFFLOAD_MYO_SHARED_VTABLE_SECTION_END ".MyoSharedVTable$z" + +#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable$a" +#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable$z" + +#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable$a" +#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable$z" + +#else // TARGET_WINNT + +#define OFFLOAD_MYO_SHARED_TABLE_SECTION_START ".MyoSharedTable." +#define OFFLOAD_MYO_SHARED_TABLE_SECTION_END ".MyoSharedTable." + +#define OFFLOAD_MYO_SHARED_VTABLE_SECTION_START ".MyoSharedVTable." +#define OFFLOAD_MYO_SHARED_VTABLE_SECTION_END ".MyoSharedVTable." + +#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START ".MyoSharedInitTable." +#define OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END ".MyoSharedInitTable." + +#define OFFLOAD_MYO_FPTR_TABLE_SECTION_START ".MyoFptrTable." +#define OFFLOAD_MYO_FPTR_TABLE_SECTION_END ".MyoFptrTable." + +#endif // TARGET_WINNT + +#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_START, read, write) +#pragma section(OFFLOAD_MYO_SHARED_TABLE_SECTION_END, read, write) + +#pragma section(OFFLOAD_MYO_SHARED_VTABLE_SECTION_START, read, write) +#pragma section(OFFLOAD_MYO_SHARED_VTABLE_SECTION_END, read, write) + +#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START, read, write) +#pragma section(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END, read, write) + +#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_START, read, write) +#pragma section(OFFLOAD_MYO_FPTR_TABLE_SECTION_END, read, write) + +// List of MYO shared variable tables +struct MYOVarTable { + typedef SharedTableEntry Entry; + const Entry *entries; +}; + +class MYOVarTableList : public TableList<MYOVarTable> { +public: + MYOVarTableList() : TableList<Table>() + {} + + // add table to the list + void add_table(Node *node) { + // add table + TableList<Table>::add_table(node); + } + + // debug dump + void dump(void); + + // check if any shared variables + bool is_empty(); + + // process the table contents for ordinary variables + void process(); + + // process the table contents for vtable objects + void process_vtable(); +}; + +// List of MYO shared function tables +struct MYOFuncTable { + typedef FptrTableEntry Entry; + const Entry *entries; +}; + +class MYOFuncTableList : public TableList<MYOFuncTable> { +public: + MYOFuncTableList() : TableList<Table>() + {} + + // add table to the list + void add_table(Node *node) { + // add table + TableList<Table>::add_table(node); + } + + // debug dump + void dump(void); + + // check if any shared functions + bool is_empty(); + + // process the table contents + void process(); +}; + +// List of MYO shared variable initialization routine tables +struct MYOInitTable { + typedef InitTableEntry Entry; + const Entry *entries; +}; + +class MYOInitTableList : public TableList<MYOInitTable> { +public: + MYOInitTableList() : TableList<Table>() + {} + + // add table to the list + void add_table(Node *node) { + // add table + TableList<Table>::add_table(node); + } + + // debug dump + void dump(void); + + // check if any init routines + bool is_empty(); + + // process the table contents + void process(); +}; + +extern MYOVarTableList __offload_myo_var_tables; +extern MYOVarTableList __offload_myo_vtable_tables; +extern MYOFuncTableList __offload_myo_func_tables; +extern MYOInitTableList __offload_myo_init_tables; + +extern "C" void __offload_myoRegisterTables1( + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +); + +extern "C" void __offload_myoRemoveTables( + MYOInitTableList::Node *init_table, + MYOVarTableList::Node *shared_table, + MYOVarTableList::Node *shared_vtable, + MYOFuncTableList::Node *fptr_table +); + +#endif // MYO_SUPPORT + #endif // OFFLOAD_TABLE_H_INCLUDED diff --git a/liboffloadmic/runtime/offload_target.cpp b/liboffloadmic/runtime/offload_target.cpp index 2e5f91e8c0b..e3c13746cef 100644 --- a/liboffloadmic/runtime/offload_target.cpp +++ b/liboffloadmic/runtime/offload_target.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -114,6 +114,8 @@ static void BufReleaseRef(void * buf) if (info) { --info->count; if (info->count == 0 && info->is_added) { + OFFLOAD_TRACE(1, "Calling COIBufferReleaseRef AddRef count = %d\n", + ((RefInfo *) ref_data[buf])->count); BufferReleaseRef(buf); info->is_added = 0; } @@ -360,7 +362,6 @@ void OffloadDescriptor::scatter_copyin_data() if (m_vars[i].flags.alloc_disp) { int64_t offset = 0; m_in.receive_data(&offset, sizeof(offset)); - m_vars[i].offset = -offset; } if (VAR_TYPE_IS_DV_DATA_SLICE(type) || VAR_TYPE_IS_DV_DATA(type)) { @@ -369,7 +370,6 @@ void OffloadDescriptor::scatter_copyin_data() *reinterpret_cast<ArrDesc**>(ptr_addr); ptr_addr = reinterpret_cast<void**>(&dvp->Base); } - // Set pointer values switch (type) { case c_data_ptr_array: @@ -380,6 +380,9 @@ void OffloadDescriptor::scatter_copyin_data() *(reinterpret_cast<char**>(m_vars[i].ptr)) : reinterpret_cast<char*>(m_vars[i].into); + if (m_vars[i].flags.is_pointer) { + dst_arr_ptr = *((char**)dst_arr_ptr); + } for (; j < max_el; j++) { if (src_is_for_mic) { m_vars[j].ptr = @@ -402,8 +405,8 @@ void OffloadDescriptor::scatter_copyin_data() case c_data_ptr: case c_cean_var_ptr: case c_dv_ptr: - if (m_vars[i].alloc_if) { - void *buf; + if (m_vars[i].alloc_if && !m_vars[i].flags.preallocated) { + void *buf = NULL; if (m_vars[i].flags.sink_addr) { m_in.receive_data(&buf, sizeof(buf)); } @@ -417,9 +420,12 @@ void OffloadDescriptor::scatter_copyin_data() // increment buffer reference OFFLOAD_TIMER_START(c_offload_target_add_buffer_refs); BufferAddRef(buf); + OFFLOAD_TRACE(1, "Calling COIBufferAddRef %p\n", buf); OFFLOAD_TIMER_STOP(c_offload_target_add_buffer_refs); } add_ref_count(buf, 0 == m_vars[i].flags.sink_addr); + OFFLOAD_TRACE(1, " AddRef count = %d\n", + ((RefInfo *) ref_data[buf])->count); } ptr = static_cast<char*>(buf) + m_vars[i].mic_offset + @@ -597,6 +603,7 @@ void OffloadDescriptor::gather_copyout_data() case c_dv_ptr: if (m_vars[i].free_if && src_is_for_mic && + !m_vars[i].flags.preallocated && !m_vars[i].flags.is_static) { void *buf = *static_cast<char**>(m_vars[i].ptr) - m_vars[i].mic_offset - @@ -610,6 +617,9 @@ void OffloadDescriptor::gather_copyout_data() BufReleaseRef(buf); OFFLOAD_TIMER_STOP(c_offload_target_release_buffer_refs); } + if (m_vars[i].flags.preallocated && m_vars[i].alloc_if) { + m_out.send_data((void*) m_vars[i].ptr, sizeof(void*)); + } break; case c_func_ptr: diff --git a/liboffloadmic/runtime/offload_target.h b/liboffloadmic/runtime/offload_target.h index f3a42f982c8..5638796f2d1 100644 --- a/liboffloadmic/runtime/offload_target.h +++ b/liboffloadmic/runtime/offload_target.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -99,16 +99,16 @@ private: }; // one time target initialization in main -extern void __offload_target_init(void); +DLL_LOCAL extern void __offload_target_init(void); // logical device index -extern int mic_index; +DLL_LOCAL extern int mic_index; // total number of available logical devices -extern int mic_engines_total; +DLL_LOCAL extern int mic_engines_total; // device frequency (from COI) -extern uint64_t mic_frequency; +DLL_LOCAL extern uint64_t mic_frequency; struct RefInfo { RefInfo(bool is_add, long amount):is_added(is_add),count(amount) diff --git a/liboffloadmic/runtime/offload_target_main.cpp b/liboffloadmic/runtime/offload_target_main.cpp index 90aca8f0812..b95271c10d5 100644 --- a/liboffloadmic/runtime/offload_target_main.cpp +++ b/liboffloadmic/runtime/offload_target_main.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_timer.h b/liboffloadmic/runtime/offload_timer.h index 847f9d15eda..8da1391c24c 100644 --- a/liboffloadmic/runtime/offload_timer.h +++ b/liboffloadmic/runtime/offload_timer.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -36,7 +36,7 @@ #include <stdint.h> #include "liboffload_error_codes.h" -extern int timer_enabled; +DLL_LOCAL extern int timer_enabled; #ifdef TIMING_SUPPORT @@ -73,8 +73,8 @@ struct OffloadHostTimerData { #if HOST_LIBRARY -extern int offload_report_level; -extern int offload_report_enabled; +DLL_LOCAL extern int offload_report_level; +DLL_LOCAL extern int offload_report_enabled; #define OFFLOAD_REPORT_1 1 #define OFFLOAD_REPORT_2 2 #define OFFLOAD_REPORT_3 3 @@ -121,18 +121,18 @@ extern int offload_report_enabled; offload_timer_fill_host_mic_num(timer_data, data); \ } -extern void offload_timer_start(OffloadHostTimerData *, +extern DLL_LOCAL void offload_timer_start(OffloadHostTimerData *, OffloadHostPhase t_node); -extern void offload_timer_stop(OffloadHostTimerData *, +extern DLL_LOCAL void offload_timer_stop(OffloadHostTimerData *, OffloadHostPhase t_node); -extern OffloadHostTimerData * offload_timer_init(const char *file, int line); -extern void offload_timer_fill_target_data(OffloadHostTimerData *, +extern DLL_LOCAL OffloadHostTimerData * offload_timer_init(const char *file, int line); +extern DLL_LOCAL void offload_timer_fill_target_data(OffloadHostTimerData *, void *data); -extern void offload_timer_fill_host_sdata(OffloadHostTimerData *, +extern DLL_LOCAL void offload_timer_fill_host_sdata(OffloadHostTimerData *, uint64_t sent_bytes); -extern void offload_timer_fill_host_rdata(OffloadHostTimerData *, +extern DLL_LOCAL void offload_timer_fill_host_rdata(OffloadHostTimerData *, uint64_t sent_bytes); -extern void offload_timer_fill_host_mic_num(OffloadHostTimerData *, +extern DLL_LOCAL void offload_timer_fill_host_mic_num(OffloadHostTimerData *, int card_number); // Utility structure for starting/stopping timer @@ -172,10 +172,10 @@ private: #define OFFLOAD_TIMER_TARGET_DATA(data) \ if (timer_enabled) offload_timer_fill_target_data(data); -extern void offload_timer_start(OffloadTargetPhase t_node); -extern void offload_timer_stop(OffloadTargetPhase t_node); -extern void offload_timer_init(void); -extern void offload_timer_fill_target_data(void *data); +extern DLL_LOCAL void offload_timer_start(OffloadTargetPhase t_node); +extern DLL_LOCAL void offload_timer_stop(OffloadTargetPhase t_node); +extern DLL_LOCAL void offload_timer_init(void); +extern DLL_LOCAL void offload_timer_fill_target_data(void *data); #endif // HOST_LIBRARY diff --git a/liboffloadmic/runtime/offload_timer_host.cpp b/liboffloadmic/runtime/offload_timer_host.cpp index 719af887abc..2152e1e8f20 100644 --- a/liboffloadmic/runtime/offload_timer_host.cpp +++ b/liboffloadmic/runtime/offload_timer_host.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_timer_target.cpp b/liboffloadmic/runtime/offload_timer_target.cpp index 8dc4bbcc81d..9e2b6d1f156 100644 --- a/liboffloadmic/runtime/offload_timer_target.cpp +++ b/liboffloadmic/runtime/offload_timer_target.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_trace.cpp b/liboffloadmic/runtime/offload_trace.cpp index 4ba678cee37..2609360d5f3 100644 --- a/liboffloadmic/runtime/offload_trace.cpp +++ b/liboffloadmic/runtime/offload_trace.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -73,7 +73,7 @@ static const char * offload_stage(std::stringstream &ss, return 0; } -static const char * offload_signal(std::stringstream &ss, +static const char * offload_message_2str(std::stringstream &ss, int offload_number, const char *tag, const char *text) @@ -216,27 +216,57 @@ void offload_stage_print(int stage, int offload_number, ...) uint64_t *signal; str1 = report_get_message_str(c_report_state_signal); str2 = report_get_message_str(c_report_signal); - offload_signal(ss, offload_number, str1, str2); - signal = va_arg(va_args, uint64_t*); - if (signal) - ss << " 0x" << std::hex << *signal; + offload_message_2str(ss, offload_number, str1, str2); + signal = va_arg(va_args, uint64_t*); + if (signal) + ss << " 0x" << std::hex << *signal; else - ss << " none"; + ss << " none"; + } + break; + case c_offload_stream: + { + int64_t stream; + str1 = report_get_message_str(c_report_state_stream); + str2 = report_get_message_str(c_report_stream); + offload_message_2str(ss, offload_number, str1, str2); + stream = va_arg(va_args, int64_t); + if (stream) + ss << " 0x" << std::hex << stream; + else + ss << " none"; } break; case c_offload_wait: { int count; + OffloadWaitKind kind; uint64_t **signal; - str1 = report_get_message_str(c_report_state_signal); + kind = (enum OffloadWaitKind) va_arg(va_args, int); + // kind == c_offload_wait_signal for signal; + // other kinds are for stream + if (kind == c_offload_wait_signal) { + str1 = report_get_message_str(c_report_state_signal); + } + else { + str1 = report_get_message_str(c_report_state_stream); + } str2 = report_get_message_str(c_report_wait); - offload_signal(ss, offload_number, str1, str2); + offload_message_2str(ss, offload_number, str1, str2); count = va_arg(va_args, int); signal = va_arg(va_args, uint64_t**); if (count) { - while (count) { - ss << " " << std::hex << signal[count-1]; - count--; + if (kind == c_offload_wait_signal) { + while (count) { + ss << " " << std::hex << signal[count-1]; + count--; + } + } + else if (kind == c_offload_wait_stream) { + ss << signal; + } + else { + ss << " all"; } } else @@ -304,6 +334,7 @@ void offload_stage_print(int stage, int offload_number, ...) str1 = report_get_message_str(c_report_state); str2 = report_get_message_str(c_report_myosharedalignedfree); offload_stage(ss, offload_number, str1, str2, false); + ss << " " << va_arg(va_args, size_t); break; case c_offload_myoacquire: str1 = report_get_message_str(c_report_state); @@ -315,6 +346,55 @@ void offload_stage_print(int stage, int offload_number, ...) str2 = report_get_message_str(c_report_myorelease); offload_stage(ss, offload_number, str1, str2, false); break; + case c_offload_myosupportsfeature: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myosupportsfeature); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, int); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, int); + break; + case c_offload_myosharedarenacreate: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myosharedarenacreate); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, char*); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, unsigned int); + break; + case c_offload_myosharedalignedarenamalloc: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myosharedalignedarenamalloc); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, char*); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, size_t); + ss << " " << va_arg(va_args, size_t); + break; + case c_offload_myosharedalignedarenafree: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myosharedalignedarenafree); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, char*); + ss << " " << va_arg(va_args, int); + ss << " " << va_arg(va_args, size_t); + break; + case c_offload_myoarenaacquire: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myoarenaacquire); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, char*); + ss << " " << va_arg(va_args, int); + break; + case c_offload_myoarenarelease: + str1 = report_get_message_str(c_report_state); + str2 = report_get_message_str(c_report_myoarenarelease); + offload_stage(ss, offload_number, str1, str2, false); + va_arg(va_args, char*); + ss << " " << va_arg(va_args, int); + break; default: LIBOFFLOAD_ERROR(c_report_unknown_trace_node); abort(); diff --git a/liboffloadmic/runtime/offload_trace.h b/liboffloadmic/runtime/offload_trace.h index 02a0c8794db..1c2a6f4c050 100644 --- a/liboffloadmic/runtime/offload_trace.h +++ b/liboffloadmic/runtime/offload_trace.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -29,8 +29,9 @@ // The parts of the offload library common to host and target +#include "offload_util.h" -void offload_stage_print(int stage, int offload_number, ...); +DLL_LOCAL void offload_stage_print(int stage, int offload_number, ...); enum OffloadTraceStage { // Total time spent on the target @@ -68,5 +69,18 @@ enum OffloadTraceStage { c_offload_myosharedalignedfree, c_offload_myoacquire, c_offload_myorelease, - c_offload_myofini + c_offload_myofini, + c_offload_myosupportsfeature, + c_offload_myosharedarenacreate, + c_offload_myosharedalignedarenamalloc, + c_offload_myosharedalignedarenafree, + c_offload_myoarenaacquire, + c_offload_myoarenarelease, + c_offload_stream +}; + +enum OffloadWaitKind { + c_offload_wait_signal = 0, + c_offload_wait_stream, + c_offload_wait_all_streams }; diff --git a/liboffloadmic/runtime/offload_util.cpp b/liboffloadmic/runtime/offload_util.cpp index ae6a75916d4..5217e91c205 100644 --- a/liboffloadmic/runtime/offload_util.cpp +++ b/liboffloadmic/runtime/offload_util.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/offload_util.h b/liboffloadmic/runtime/offload_util.h index 2cffd82f70a..894355aca7a 100644 --- a/liboffloadmic/runtime/offload_util.h +++ b/liboffloadmic/runtime/offload_util.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -31,14 +31,23 @@ #ifndef OFFLOAD_UTIL_H_INCLUDED #define OFFLOAD_UTIL_H_INCLUDED -#include <stdio.h> #include <stdlib.h> -#include <stdint.h> #ifdef TARGET_WINNT + #define DLL_LOCAL +#else + #define DLL_LOCAL __attribute__((visibility("hidden"))) +#endif + +#ifdef TARGET_WINNT +// Don't use <stdint.h> as compiling with VS2010 makes ofldbegin.obj +// incompatible with STL library of versions older than VS2010. +typedef unsigned long long int uint64_t; +typedef signed long long int int64_t; #include <windows.h> #include <process.h> #else // TARGET_WINNT +#include <stdint.h> #include <dlfcn.h> #include <pthread.h> #endif // TARGET_WINNT @@ -143,7 +152,7 @@ int DL_addr(const void *addr, Dl_info *info); #define DL_addr(addr, info) dladdr((addr), (info)) #endif // TARGET_WINNT -extern void* DL_sym(void *handle, const char *name, const char *version); +DLL_LOCAL extern void* DL_sym(void *handle, const char *name, const char *version); // One-time initialization API #ifdef TARGET_WINNT @@ -159,13 +168,13 @@ typedef pthread_once_t OffloadOnceControl; #endif // TARGET_WINNT // Parses size specification string. -extern bool __offload_parse_size_string(const char *str, uint64_t &new_size); +DLL_LOCAL extern bool __offload_parse_size_string(const char *str, uint64_t &new_size); // Parses string with integer value -extern bool __offload_parse_int_string(const char *str, int64_t &value); +DLL_LOCAL extern bool __offload_parse_int_string(const char *str, int64_t &value); // get value by its base, offset and size -int64_t get_el_value( +DLL_LOCAL int64_t get_el_value( char *base, int64_t offset, int64_t size diff --git a/liboffloadmic/runtime/ofldbegin.cpp b/liboffloadmic/runtime/ofldbegin.cpp index 6f4b536f5b7..236500d011a 100644 --- a/liboffloadmic/runtime/ofldbegin.cpp +++ b/liboffloadmic/runtime/ofldbegin.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ #if HOST_LIBRARY -#include "offload_host.h" +#include "offload_table.h" #include "offload_myo_host.h" #else #include "compiler_if_target.h" @@ -37,6 +37,14 @@ #include "offload_myo_target.h" #endif +// Initializes library and registers specified offload image. +// Don't use this declarations from offload_host.h as offload_table.h +// is used instead of it. Using offload_host.h contradicts with +// STL library compiled with VS2010. +extern "C" bool __offload_register_image(const void* image); +extern "C" void __offload_unregister_image(const void* image); +extern "C" bool __offload_target_image_is_executable(const void *image); + #ifdef TARGET_WINNT #define ALLOCATE(name) __declspec(allocate(name)) #define DLL_LOCAL @@ -110,33 +118,127 @@ static VarList::Node __offload_var_node = { #ifdef MYO_SUPPORT // offload myo shared var section prolog +// first element is empty ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_START) #ifdef TARGET_WINNT __declspec(align(sizeof(SharedTableEntry))) #endif // TARGET_WINNT -static SharedTableEntry __offload_myo_shared_table_start = { 0 }; +static MYOVarTable::Entry __offload_myo_shared_var_start = { 0 }; + +// list element for the current module +// table entry pointer skips the empty first entry +static MYOVarTableList::Node __offload_myo_shared_var_node = { + { &__offload_myo_shared_var_start + 1 }, + 0, 0 +}; + +// offload myo shared vtable section prolog +// first element is empty +ALLOCATE(OFFLOAD_MYO_SHARED_VTABLE_SECTION_START) +#ifdef TARGET_WINNT +__declspec(align(sizeof(SharedTableEntry))) +#endif // TARGET_WINNT +static MYOVarTable::Entry __offload_myo_shared_vtable_start = { 0 }; + +// list element for the current module +// table entry pointer skips the empty first entry +static MYOVarTableList::Node __offload_myo_shared_vtable_node = { + { &__offload_myo_shared_vtable_start + 1 }, + 0, 0 +}; -#if HOST_LIBRARY // offload myo shared var init section prolog +// first element is empty ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_START) #ifdef TARGET_WINNT __declspec(align(sizeof(InitTableEntry))) #endif // TARGET_WINNT -static InitTableEntry __offload_myo_shared_init_table_start = { 0 }; +static MYOInitTable::Entry __offload_myo_init_table_start = { 0 }; + +// list element for the current module +// table entry pointer skips the empty first entry +static MYOInitTableList::Node __offload_myo_init_table_node = { + { &__offload_myo_init_table_start + 1 }, + 0, 0 +}; + +// The functions and variables needed for a built-in +// remote function entry for vtable initialization on MIC + +#if !HOST_LIBRARY +MyoError __offload_init_vtables(void) +{ + SharedTableEntry *t_start; + + //OFFLOAD_DEBUG_TRACE(3, "%s\n", __func__); + t_start = &__offload_myo_shared_vtable_start + 1; + //OFFLOAD_DEBUG_TRACE(3, "%s(%p)\n", __func__, t_start); + while (t_start->varName != 0) { + //OFFLOAD_DEBUG_TRACE(4, + // "myo shared vtable \"%s\" &myo_ptr = %p myo_ptr = %p\n", + // t_start->varName, + // (void *)(t_start->sharedAddr), + // ((void **)(t_start->sharedAddr))[0]); + t_start++; + } + + __offload_myo_shared_init_table_process( + &__offload_myo_init_table_start + 1); + return MYO_SUCCESS; +} +#endif // !HOST_LIBRARY + +static void vtable_initializer() +{ +} + +#if !HOST_LIBRARY +static MyoError vtable_initializer_wrapper() +{ + __offload_myoAcquire(); + __offload_init_vtables(); + __offload_myoRelease(); + return MYO_SUCCESS; +} #endif +static void* __offload_vtable_initializer_thunk_ptr = 0; + // offload myo fptr section prolog +// first element is pre-initialized to the MIC vtable initializer ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_START) #ifdef TARGET_WINNT __declspec(align(sizeof(FptrTableEntry))) #endif // TARGET_WINNT -static FptrTableEntry __offload_myo_fptr_table_start = { 0 }; +static MYOFuncTable::Entry __offload_myo_fptr_table_start = { +#if HOST_LIBRARY + "--vtable_initializer--", + (void*)&vtable_initializer, + (void*)&__offload_vtable_initializer_thunk_ptr, +#ifdef TARGET_WINNT + // Dummy to pad up to 32 bytes + 0 +#endif // TARGET_WINNT +#else // HOST_LIBRARY + "--vtable_initializer--", + (void*)&vtable_initializer, + (void*)&vtable_initializer_wrapper, + &__offload_vtable_initializer_thunk_ptr, +#endif // HOST_LIBRARY +}; + +// list element for the current module +static MYOFuncTableList::Node __offload_myo_fptr_table_node = { + { &__offload_myo_fptr_table_start }, + 0, 0 +}; #endif // MYO_SUPPORT // init/fini code which adds/removes local lookup data to/from the global list static void offload_fini(); +static void offload_fini_so(); #ifndef TARGET_WINNT static void offload_init() __attribute__((constructor(101))); @@ -150,35 +252,81 @@ static void (*addressof_offload_init)() = offload_init; static void offload_init() { + bool success; + // register offload tables __offload_register_tables(&__offload_entry_node, &__offload_func_node, &__offload_var_node); #if HOST_LIBRARY - __offload_register_image(&__offload_target_image); - atexit(offload_fini); + success = __offload_register_image(&__offload_target_image); + if (!success) + { + return; + } #endif // HOST_LIBRARY - #ifdef MYO_SUPPORT - __offload_myoRegisterTables( #if HOST_LIBRARY - &__offload_myo_shared_init_table_start + 1, -#endif // HOST_LIBRARY - &__offload_myo_shared_table_start + 1, - &__offload_myo_fptr_table_start + 1 + // If this was the main program register main atexit routine + if (__offload_myoProcessTables( + &__offload_target_image, + &__offload_myo_init_table_node, + &__offload_myo_shared_var_node, + &__offload_myo_shared_vtable_node, + &__offload_myo_fptr_table_node)) + { + atexit(offload_fini); +#ifdef TARGET_WINNT + } else { + atexit(offload_fini_so); +#endif + } +#else // HOST_LIBRARY + __offload_myoProcessTables( + &__offload_myo_init_table_start + 1, + &__offload_myo_shared_var_start + 1, + &__offload_myo_shared_vtable_start + 1, + &__offload_myo_fptr_table_start ); +#endif // HOST_LIBRARY #endif // MYO_SUPPORT } +#ifndef TARGET_WINNT +static void offload_fini_so() __attribute__((destructor(101))); +#else // TARGET_WINNT +static void offload_init_so(); +#endif // TARGET_WINNT + static void offload_fini() { #if HOST_LIBRARY __offload_unregister_image(&__offload_target_image); #endif // HOST_LIBRARY +} - // unregister offload tables +static void offload_fini_so() +{ + // Offload and MYO tables need to be removed from list + // to prevent invalid accesses after dlclose + // Remove offload tables __offload_unregister_tables(&__offload_entry_node, &__offload_func_node, &__offload_var_node); +#if HOST_LIBRARY + if(!__offload_target_image_is_executable(&__offload_target_image)) { + __offload_unregister_image(&__offload_target_image); + } +#endif +#ifdef MYO_SUPPORT +#if HOST_LIBRARY + // Remove MYO tables + __offload_myoRemoveTables( + &__offload_myo_init_table_node, + &__offload_myo_shared_var_node, + &__offload_myo_shared_vtable_node, + &__offload_myo_fptr_table_node); +#endif // HOST_LIBRARY +#endif // MYO_SUPPORT } diff --git a/liboffloadmic/runtime/ofldend.cpp b/liboffloadmic/runtime/ofldend.cpp index 0256c5a0f20..1e522b7f2fa 100644 --- a/liboffloadmic/runtime/ofldend.cpp +++ b/liboffloadmic/runtime/ofldend.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -29,7 +29,7 @@ #if HOST_LIBRARY -#include "offload_host.h" +#include "offload_table.h" #include "offload_myo_host.h" #else #include "offload_target.h" @@ -69,29 +69,42 @@ static VarTable::Entry __offload_var_table_end = { (const char*)-1 }; ALLOCATE(OFFLOAD_MYO_SHARED_TABLE_SECTION_END) #ifdef TARGET_WINNT __declspec(align(sizeof(SharedTableEntry))) -static SharedTableEntry __offload_myo_shared_table_end = { (const char*)-1, 0 }; +static MYOVarTable::Entry __offload_myo_shared_var_end = + { (const char*)-1, 0 }; #else // TARGET_WINNT -static SharedTableEntry __offload_myo_shared_table_end = { 0 }; +static MYOVarTable::Entry __offload_myo_shared_var_end = { 0 }; #endif // TARGET_WINNT -#if HOST_LIBRARY +// offload myo shared vtable section epilog +ALLOCATE(OFFLOAD_MYO_SHARED_VTABLE_SECTION_END) +#ifdef TARGET_WINNT +__declspec(align(sizeof(SharedTableEntry))) +static MYOVarTable::Entry __offload_myo_shared_vtable_end = + { (const char*)-1, 0 }; +#else // TARGET_WINNT +static MYOVarTable::Entry __offload_myo_shared_vtable_end = { 0 }; +#endif // TARGET_WINNT + +//#if HOST_LIBRARY // offload myo shared var init section epilog ALLOCATE(OFFLOAD_MYO_SHARED_INIT_TABLE_SECTION_END) #ifdef TARGET_WINNT __declspec(align(sizeof(InitTableEntry))) -static InitTableEntry __offload_myo_shared_init_table_end = { (const char*)-1, 0 }; +static MYOInitTable::Entry __offload_myo_init_table_end = + { (const char*)-1, 0 }; #else // TARGET_WINNT -static InitTableEntry __offload_myo_shared_init_table_end = { 0 }; +static MYOInitTable::Entry __offload_myo_init_table_end = { 0 }; #endif // TARGET_WINNT -#endif // HOST_LIBRARY +//#endif // HOST_LIBRARY // offload myo fptr section epilog ALLOCATE(OFFLOAD_MYO_FPTR_TABLE_SECTION_END) #ifdef TARGET_WINNT __declspec(align(sizeof(FptrTableEntry))) -static FptrTableEntry __offload_myo_fptr_table_end = { (const char*)-1, 0, 0 }; +static MYOFuncTable::Entry __offload_myo_fptr_table_end = + { (const char*)-1, 0, 0 }; #else // TARGET_WINNT -static FptrTableEntry __offload_myo_fptr_table_end = { 0 }; +static MYOFuncTable::Entry __offload_myo_fptr_table_end = { 0 }; #endif // TARGET_WINNT #endif // MYO_SUPPORT diff --git a/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h b/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h index b629a1a91b5..53acea154de 100644 --- a/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h +++ b/liboffloadmic/runtime/orsl-lite/include/orsl-lite.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c b/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c index af01c119c35..add67a0b0ca 100644 --- a/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c +++ b/liboffloadmic/runtime/orsl-lite/lib/orsl-lite.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2014 Intel Corporation. All Rights Reserved. + Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/liboffloadmic/runtime/use_mpss2.txt b/liboffloadmic/runtime/use_mpss2.txt index 948f4838fbf..47b322c971c 100644 --- a/liboffloadmic/runtime/use_mpss2.txt +++ b/liboffloadmic/runtime/use_mpss2.txt @@ -1 +1 @@ -2.1.6720-13 +3.4.1 diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog index 4995299d058..ba4c4239509 100644 --- a/libsanitizer/ChangeLog +++ b/libsanitizer/ChangeLog @@ -1,3 +1,8 @@ +2015-09-09 Markus Trippelsdorf <markus@trippelsdorf.de> + + PR sanitizer/67258 + * ubsan/ubsan_type_hash.cc: Cherry pick upstream r244101. + 2015-07-29 Markus Trippelsdorf <markus@trippelsdorf.de> PR sanitizer/63927 diff --git a/libsanitizer/ubsan/ubsan_type_hash.cc b/libsanitizer/ubsan/ubsan_type_hash.cc index d01009426db..5eab1f561f2 100644 --- a/libsanitizer/ubsan/ubsan_type_hash.cc +++ b/libsanitizer/ubsan/ubsan_type_hash.cc @@ -186,8 +186,8 @@ namespace { struct VtablePrefix { /// The offset from the vptr to the start of the most-derived object. - /// This should never be greater than zero, and will usually be exactly - /// zero. + /// This will only be greater than zero in some virtual base class vtables + /// used during object con-/destruction, and will usually be exactly zero. sptr Offset; /// The type_info object describing the most-derived class type. std::type_info *TypeInfo; @@ -197,7 +197,7 @@ VtablePrefix *getVtablePrefix(void *Object) { if (!*VptrPtr) return 0; VtablePrefix *Prefix = *VptrPtr - 1; - if (Prefix->Offset > 0 || !Prefix->TypeInfo) + if (!Prefix->TypeInfo) // This can't possibly be a valid vtable. return 0; return Prefix; diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d9c9d49353f..d425f495196 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,546 @@ +2015-09-11 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/67173 + * src/filesystem/ops.cc (filesystem::canonical): Allocate buffer for + realpath on Solaris 10. + + PR libstdc++/65142 + * src/c++11/random.cc (random_device::_M_getval()): Check read result. + +2015-09-11 John Marino <gnugcc@marino.st> + Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/67096 + * testsuite/22_locale/codecvt/in/wchar_t/4.cc: Do not test code points + above U+10FFFF. + * testsuite/22_locale/codecvt/in/wchar_t/8.cc: Likewise. + * testsuite/22_locale/codecvt/in/wchar_t/9.cc: Likewise. + * testsuite/22_locale/codecvt/length/wchar_t/4.cc: Likewise. + * testsuite/22_locale/codecvt/out/wchar_t/4.cc: Likewise. + * testsuite/22_locale/codecvt/unshift/wchar_t/4.cc: Likewise. + * testsuite/27_io/basic_filebuf/seekoff/wchar_t/1.cc: Likewise. + * testsuite/27_io/basic_filebuf/seekpos/wchar_t/9874.cc: Likewise. + * testsuite/27_io/basic_filebuf/underflow/wchar_t/1.cc: Likewise. + * testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc: Likewise. + * testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc: Likewise. + * testsuite/27_io/objects/wchar_t/10.cc: Likewise. + * testsuite/27_io/objects/wchar_t/11.cc: Likewise. + * testsuite/27_io/objects/wchar_t/12.cc: Likewise. + * testsuite/27_io/objects/wchar_t/13.cc: Likewise. + +2015-09-11 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/64857 + * doc/xml/manual/using.xml: Improve aggregate header documentation. + * doc/html/manual/*: Regenerate. + * include/precompiled/extc++.h: Include <bits/stdc++.h> for C++11 + and later and include more extension headers. + * testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove + redundant header. + * testsuite/17_intro/headers/c++200x/: Rename to c++2011. + * testsuite/17_intro/headers/c++2014/all_attributes.cc: Remove + redundant headers. + * testsuite/17_intro/headers/c++2014/all_no_exceptions.cc: New. + * testsuite/17_intro/headers/c++2014/all_no_rtti.cc: New. + * testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc: New. + * testsuite/17_intro/headers/c++2014/operator_names.cc: New. + * testsuite/17_intro/headers/c++2014/stdc++.cc: New. + * testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc: + New. + + PR libstdc++/58265 + * doc/xml/manual/intro.xml: Document LWG 2063 and 2064 resolutions. + * doc/html/manual/bugs.html: Regenerate. + * include/bits/basic_string.h (basic_string): Implement N4258. Add + correct exception-specifications and propagate allocators correctly. + * include/bits/basic_string.tcc (basic_string::swap): Propagate + allocators correctly. + * include/debug/string (__gnu_debug::basic_string): Add correct + exceptions-specifications and allcoator-extended constructors. + * testsuite/21_strings/basic_string/allocator/char/copy.cc: New. + * testsuite/21_strings/basic_string/allocator/char/copy_assign.cc: + New. + * testsuite/21_strings/basic_string/allocator/char/minimal.cc: New. + * testsuite/21_strings/basic_string/allocator/char/move.cc: New. + * testsuite/21_strings/basic_string/allocator/char/move_assign.cc: + New. + * testsuite/21_strings/basic_string/allocator/char/noexcept.cc: New. + * testsuite/21_strings/basic_string/allocator/char/swap.cc: New. + * testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc: New. + * testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc: + New. + * testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc: New. + * testsuite/21_strings/basic_string/allocator/wchar_t/move.cc: New. + * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc: + New. + * testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc: New. + * testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc: New. + * testsuite/util/testsuite_allocator.h (tracker_allocator): Define + defaulted assignment operators. + + PR libstdc++/65092 + * include/bits/stl_queue.h (queue, priority_queue): Add + allocator-extended constructors. + * include/bits/stl_stack.h (stack): Likewise. + * testsuite/23_containers/priority_queue/requirements/ + uses_allocator.cc: Test allocator-extended constructors. + * testsuite/23_containers/queue/requirements/uses_allocator.cc: + Likewise. + * testsuite/23_containers/stack/requirements/uses_allocator.cc: + Likewise. + +2015-09-10 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/util/testsuite_allocator.h (PointerBase::operator[]): Add. + + * testsuite/21_strings/basic_string/operators/char/1.cc: Verify the + string contents. + +2015-09-09 Jonathan Wakely <jwakely@redhat.com> + + * doc/xml/manual/using.xml (_GLIBCXX_ASSERTIONS): Document. + * doc/html/manual/using_macros.html: Regenerate. + * include/bits/c++config: Define _GLIBCXX_ASSERTIONS when + _GLIBCXX_DEBUG is defined. Disable std::string extern templates when + (_GLIBCXX_EXTERN_TEMPLATE, __glibcxx_assert): Depend on + _GLIBCXX_ASSERTIONS instead of _GLIBCXX_DEBUG. + * include/debug/debug.h [!_GLIBCXX_DEBUG]: Define + __glibcxx_requires_non_empty_range and __glibcxx_requires_nonempty. + * include/backward/auto_ptr.h (auto_ptr::operator*, + auto_ptr::operator->): Replace _GLIBCXX_DEBUG_ASSERT with + __glibcxx_assert. + * include/bits/basic_string.h (basic_string::operator[], + basic_string::front, basic_string::back, basic_string::pop_back): + Likewise. + * include/bits/random.h + (uniform_int_distribution::param_type::param_type, + uniform_real_distribution::param_type::param_type, + normal_distribution::param_type::param_type, + gamma_distribution::param_type::param_type, + bernoulli_distribution::param_type::param_type, + binomial_distribution::param_type::param_type, + geometric_distribution::param_type::param_type, + negative_binomial_distribution::param_type::param_type, + poisson_distribution::param_type::param_type, + exponential_distribution::param_type::param_type): Likewise. + * include/bits/regex.h (match_results::operator[], + match_results::prefix, match_results::suffix): Likewise. + * include/bits/regex.tcc (format, regex_iterator::operator++): + Likewise. + * include/bits/regex_automaton.tcc (_StateSeq::_M_clone): Likewise. + * include/bits/regex_compiler.tcc (_Compiler::_Compiler, + _Compiler::_M_insert_character_class_matcher): Likewise. + * include/bits/regex_executor.tcc (_Executor::_M_dfs): Likewise. + * include/bits/regex_scanner.tcc (_Scanner::_M_advance, + _Scanner::_M_scan_normal): Likewise. + * include/bits/shared_ptr_base.h (__shared_ptr::_M_reset, + __shared_ptr::operator*): Likewise. + * include/bits/stl_iterator_base_funcs.h (__advance): Likewise. + * include/bits/unique_ptr.h (unique_ptr::operator*, + unique_ptr::operator[]): Likewise. + * include/experimental/fs_path.h (path::path(string_type, _Type), + path::iterator::operator++, path::iterator::operator--, + path::iterator::operator*): Likewise. + * include/experimental/string_view (basic_string_view::operator[], + basic_string_view::front, basic_string_view::back, + basic_string_view::remove_prefix): Likewise. + * include/ext/random (beta_distribution::param_type::param_type, + normal_mv_distribution::param_type::param_type, + rice_distribution::param_type::param_type, + pareto_distribution::param_type::param_type, + k_distribution::param_type::param_type, + arcsine_distribution::param_type::param_type, + hoyt_distribution::param_type::param_type, + triangular_distribution::param_type::param_type, + von_mises_distribution::param_type::param_type, + hypergeometric_distribution::param_type::param_type, + logistic_distribution::param_type::param_type): Likewise. + * include/ext/vstring.h (__versa_string::operator[]): Likewise. + * include/std/complex (polar): Likewise. + * include/std/mutex [!_GTHREAD_USE_MUTEX_TIMEDLOCK] + (timed_mutex::~timed_mutex, timed_mutex::unlock, + (recursive_timed_mutex::~timed_mutex, recursive_timed_mutex::unlock): + Likewise. + * include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER] + (__shared_mutex_pthread::__shared_mutex_pthread, + __shared_mutex_pthread::~__shared_mutex_pthread): Likewise. + (__shared_mutex_pthread::lock, __shared_mutex_pthread::try_lock, + __shared_mutex_pthread::unlock, __shared_mutex_pthread::lock_shared, + __shared_mutex_pthread::try_lock_shared): Likewise. + (__shared_mutex_cv::~__shared_mutex_cv, __shared_mutex_cv::unlock, + __shared_mutex_cv::unlock_shared): Likewise. + (shared_timed_mutex::try_lock_until, + shared_timed_mutex::try_lock_shared_until): Likewise. + * include/std/valarray (valarray::valarray(const _Tp*, size_t), + valarray::operator=, valarray::sum, valarray::min, valarray::max, + _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT, _DEFINE_BINARY_OPERATOR): + Likewise. + +2015-09-07 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/shared_ptr_base.h (__shared_ptr::operator->): Change + _GLIBCXX_DEBUG_ASSERT to _GLIBCXX_DEBUG_PEDASSERT. + * include/bits/unique_ptr.h (unique_ptr::operator->): Likewise. + * testsuite/20_util/shared_ptr/observers/get.cc: Test operator-> on + empty shared_ptr. + + * include/bits/regex_compiler.h (_BracketMatcher::_M_is_ready): + Initialize using NSDMI and set using _GLIBCXX_DEBUG_ONLY. + + * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Rename + shadowed variable. + + * testsuite/30_threads/recursive_timed_mutex/unlock/2.cc: Run on + darwin. + * testsuite/30_threads/timed_mutex/unlock/2.cc: Run on darwin. + +2015-09-04 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/65704 + * include/std/mutex (recursive_timed_mutex): Fix uses of _Can_lock. + + PR libstdc++/65704 + * include/Makefile.am: Add <bits/mutex.h>. + * include/Makefile.in: Regenerate. + * include/bits/mutex.h (__mutex_base, mutex, lock_guard, unique_lock): + New file containing types moved from <mutex>. + * include/std/condition_variable: Include <bits/mutex.h> instead of + <mutex>. + * include/std/mutex (__mutex_base, mutex, lock_guard, unique_lock): + Move to <bits/mutex.h>. + * testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Remove + dg-require-gthreads-timed. + * testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/dest/ + destructor_locked.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/cons/assign_neg.cc: Likewise. + * testsuite/30_threads/timed_mutex/cons/copy_neg.cc: Likewise. + * testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: + Likewise. + * testsuite/30_threads/timed_mutex/lock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/requirements/standard_layout.cc: + Likewise. + * testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise. + * testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/5.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/6.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/3.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/4.cc: Likewise. + +2015-09-04 Edward Smith-Rowland <3dw4rd@verizon.net> + Jonathan Wakely <jwakely@redhat.com> + + Add C++11 header <cuchar>. + * acinclude.m4 (GLIBCXX_CHECK_UCHAR_H): Define. + * config.h.in: Regenerate. + * configure: Regenerate. + * configure.ac: Check for <uchar.h>. + * include/Makefile.am: Add new headers. + * include/Makefile.in: Regenerate. + * include/c/cuchar: New. + * include/c_compatibility/uchar.h: New. + * include/c_global/cuchar: New. + * include/c_std/cuchar: New. + * include/precompiled/stdc++.h: Include <cuchar>. + * testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>. + * testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc: + Include <uchar.h>. + +2015-09-04 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/65473 + * include/c/cassert: Include <bits/c++config.h>. + * include/c/cerrno: Likewise. + * include/c/cfloat: Likewise. + * include/c/ciso646: Likewise. + * include/c/climits: Likewise. + * include/c_global/cassert: Likewise. + * include/c_global/cerrno: Likewise. + * include/c_global/cfloat: Likewise. + * include/c_global/ciso646: Likewise. + * include/c_global/climits: Likewise. + * include/c_std/cassert: Likewise. + * include/c_std/cerrno: Likewise. + * include/c_std/cfloat: Likewise. + * include/c_std/ciso646: Likewise. + * include/c_std/climits: Likewise. + +2015-09-03 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/shared_ptr_base.h: Add required header. + * include/std/condition_variable: Likewise. + * include/std/mutex: Remove unused header. + * include/std/shared_mutex: Remove redundant header. + (shared_mutex::shared_mutex()): Replace throw with __throw_bad_alloc. + + PR libstdc++/66902 + * src/c++11/debug.cc (_S_debug_messages): Make array const. + + PR libstdc++/66998 + * include/experimental/functional (_Not_fn): Add exception + specifications and non-deduced return types. + (not_fn): Add exception specification and wrap pointer-to-member. + * testsuite/experimental/functional/not_fn.cc: Test in SFINAE context + and test pointer-to-member. + + PR libstdc++/62039 + * include/bits/stl_iterator_base_funcs.h (next, prev): Add concept + checks. + * testsuite/24_iterators/operations/prev_neg.cc: New. + * testsuite/24_iterators/operations/next_neg.cc: New. + +2015-09-03 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * testsuite/18_support/pthread_guard.cc: Add *-*-rtems* target + selector to all lines which contain a *-*-cygwin target selector. + * testsuite/20_util/shared_ptr/atomic/3.cc: Likewise. + * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Likewise. + * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise. + * testsuite/21_strings/basic_string/pthread18185.cc: Likewise. + * testsuite/21_strings/basic_string/pthread33394.cc: Likewise. + * testsuite/21_strings/basic_string/pthread4.cc: Likewise. + * testsuite/22_locale/locale/cons/12658_thread-1.cc: Likewise. + * testsuite/22_locale/locale/cons/12658_thread-2.cc: Likewise. + * testsuite/23_containers/list/pthread1.cc: Likewise. + * testsuite/23_containers/list/pthread5.cc: Likewise. + * testsuite/23_containers/map/pthread6.cc: Likewise. + * testsuite/23_containers/vector/debug/multithreaded_swap.cc: Likewise. + * testsuite/27_io/basic_ofstream/pthread2.cc: Likewise. + * testsuite/27_io/basic_ostringstream/pthread3.cc: Likewise. + * testsuite/30_threads/async/42819.cc: Likewise. + * testsuite/30_threads/async/49668.cc: Likewise. + * testsuite/30_threads/async/54297.cc: Likewise. + * testsuite/30_threads/async/any.cc: Likewise. + * testsuite/30_threads/async/async.cc: Likewise. + * testsuite/30_threads/async/launch.cc: Likewise. + * testsuite/30_threads/async/lwg2021.cc: Likewise. + * testsuite/30_threads/async/sync.cc: Likewise. + * testsuite/30_threads/call_once/39909.cc: Likewise. + * testsuite/30_threads/call_once/49668.cc: Likewise. + * testsuite/30_threads/call_once/60497.cc: Likewise. + * testsuite/30_threads/call_once/call_once1.cc: Likewise. + * testsuite/30_threads/condition_variable/54185.cc: Likewise. + * testsuite/30_threads/condition_variable/cons/1.cc: Likewise. + * testsuite/30_threads/condition_variable/members/1.cc: Likewise. + * testsuite/30_threads/condition_variable/members/2.cc: Likewise. + * testsuite/30_threads/condition_variable/members/3.cc: Likewise. + * testsuite/30_threads/condition_variable/members/53841.cc: Likewise. + * testsuite/30_threads/condition_variable/native_handle/typesizes.cc: + Likewise. + * testsuite/30_threads/condition_variable_any/50862.cc: Likewise. + * testsuite/30_threads/condition_variable_any/53830.cc: Likewise. + * testsuite/30_threads/condition_variable_any/cons/1.cc: Likewise. + * testsuite/30_threads/condition_variable_any/members/1.cc: Likewise. + * testsuite/30_threads/condition_variable_any/members/2.cc: Likewise. + * testsuite/30_threads/future/cons/move.cc: Likewise. + * testsuite/30_threads/future/members/45133.cc: Likewise. + * testsuite/30_threads/future/members/get.cc: Likewise. + * testsuite/30_threads/future/members/get2.cc: Likewise. + * testsuite/30_threads/future/members/share.cc: Likewise. + * testsuite/30_threads/future/members/valid.cc: Likewise. + * testsuite/30_threads/future/members/wait.cc: Likewise. + * testsuite/30_threads/future/members/wait_for.cc: Likewise. + * testsuite/30_threads/future/members/wait_until.cc: Likewise. + * testsuite/30_threads/lock/1.cc: Likewise. + * testsuite/30_threads/lock/2.cc: Likewise. + * testsuite/30_threads/lock/3.cc: Likewise. + * testsuite/30_threads/lock/4.cc: Likewise. + * testsuite/30_threads/mutex/cons/1.cc: Likewise. + * testsuite/30_threads/mutex/dest/destructor_locked.cc: Likewise. + * testsuite/30_threads/mutex/lock/1.cc: Likewise. + * testsuite/30_threads/mutex/native_handle/1.cc: Likewise. + * testsuite/30_threads/mutex/native_handle/typesizes.cc: Likewise. + * testsuite/30_threads/mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/mutex/unlock/2.cc: Likewise. + * testsuite/30_threads/packaged_task/49668.cc: Likewise. + * testsuite/30_threads/packaged_task/60564.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/1.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/2.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/3.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/56492.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/alloc.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/move.cc: Likewise. + * testsuite/30_threads/packaged_task/cons/move_assign.cc: Likewise. + * testsuite/30_threads/packaged_task/members/at_thread_exit.cc: + Likewise. + * testsuite/30_threads/packaged_task/members/get_future.cc: Likewise. + * testsuite/30_threads/packaged_task/members/get_future2.cc: Likewise. + * testsuite/30_threads/packaged_task/members/invoke.cc: Likewise. + * testsuite/30_threads/packaged_task/members/invoke2.cc: Likewise. + * testsuite/30_threads/packaged_task/members/invoke3.cc: Likewise. + * testsuite/30_threads/packaged_task/members/invoke4.cc: Likewise. + * testsuite/30_threads/packaged_task/members/invoke5.cc: Likewise. + * testsuite/30_threads/packaged_task/members/reset.cc: Likewise. + * testsuite/30_threads/packaged_task/members/reset2.cc: Likewise. + * testsuite/30_threads/packaged_task/members/swap.cc: Likewise. + * testsuite/30_threads/packaged_task/members/valid.cc: Likewise. + * testsuite/30_threads/promise/60966.cc: Likewise. + * testsuite/30_threads/promise/cons/1.cc: Likewise. + * testsuite/30_threads/promise/cons/alloc.cc: Likewise. + * testsuite/30_threads/promise/cons/move.cc: Likewise. + * testsuite/30_threads/promise/cons/move_assign.cc: Likewise. + * testsuite/30_threads/promise/members/at_thread_exit.cc: Likewise. + * testsuite/30_threads/promise/members/get_future.cc: Likewise. + * testsuite/30_threads/promise/members/get_future2.cc: Likewise. + * testsuite/30_threads/promise/members/set_exception.cc: Likewise. + * testsuite/30_threads/promise/members/set_exception2.cc: Likewise. + * testsuite/30_threads/promise/members/set_value.cc: Likewise. + * testsuite/30_threads/promise/members/set_value2.cc: Likewise. + * testsuite/30_threads/promise/members/set_value3.cc: Likewise. + * testsuite/30_threads/promise/members/swap.cc: Likewise. + * testsuite/30_threads/recursive_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc: + Likewise. + * testsuite/30_threads/recursive_mutex/lock/1.cc: Likewise. + * testsuite/30_threads/recursive_mutex/native_handle/1.cc: Likewise. + * testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc: + Likewise. + * testsuite/30_threads/recursive_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/recursive_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/recursive_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/recursive_mutex/unlock/2.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/lock/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/lock/2.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc: + Likewise. + * testsuite/30_threads/recursive_timed_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/recursive_timed_mutex/unlock/2.cc: Likewise. + * testsuite/30_threads/shared_future/cons/move.cc: Likewise. + * testsuite/30_threads/shared_future/members/45133.cc: Likewise. + * testsuite/30_threads/shared_future/members/get.cc: Likewise. + * testsuite/30_threads/shared_future/members/get2.cc: Likewise. + * testsuite/30_threads/shared_future/members/valid.cc: Likewise. + * testsuite/30_threads/shared_future/members/wait.cc: Likewise. + * testsuite/30_threads/shared_future/members/wait_for.cc: Likewise. + * testsuite/30_threads/shared_future/members/wait_until.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/1.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/2.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/3.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/4.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/5.cc: Likewise. + * testsuite/30_threads/shared_lock/cons/6.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/1.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/2.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/3.cc: Likewise. + * testsuite/30_threads/shared_lock/locking/4.cc: Likewise. + * testsuite/30_threads/shared_lock/modifiers/1.cc: Likewise. + * testsuite/30_threads/shared_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/shared_timed_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/shared_timed_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/shared_timed_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/shared_timed_mutex/try_lock/3.cc: Likewise. + * testsuite/30_threads/shared_timed_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/this_thread/1.cc: Likewise. + * testsuite/30_threads/this_thread/2.cc: Likewise. + * testsuite/30_threads/this_thread/3.cc: Likewise. + * testsuite/30_threads/this_thread/4.cc: Likewise. + * testsuite/30_threads/thread/cons/1.cc: Likewise. + * testsuite/30_threads/thread/cons/2.cc: Likewise. + * testsuite/30_threads/thread/cons/3.cc: Likewise. + * testsuite/30_threads/thread/cons/4.cc: Likewise. + * testsuite/30_threads/thread/cons/49668.cc: Likewise. + * testsuite/30_threads/thread/cons/5.cc: Likewise. + * testsuite/30_threads/thread/cons/6.cc: Likewise. + * testsuite/30_threads/thread/cons/7.cc: Likewise. + * testsuite/30_threads/thread/cons/8.cc: Likewise. + * testsuite/30_threads/thread/cons/9.cc: Likewise. + * testsuite/30_threads/thread/cons/moveable.cc: Likewise. + * testsuite/30_threads/thread/members/1.cc: Likewise. + * testsuite/30_threads/thread/members/2.cc: Likewise. + * testsuite/30_threads/thread/members/3.cc: Likewise. + * testsuite/30_threads/thread/members/4.cc: Likewise. + * testsuite/30_threads/thread/members/5.cc: Likewise. + * testsuite/30_threads/thread/members/hardware_concurrency.cc: Likewise. + * testsuite/30_threads/thread/native_handle/cancel.cc: Likewise. + * testsuite/30_threads/thread/swap/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/cons/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/dest/destructor_locked.cc: Likewise. + * testsuite/30_threads/timed_mutex/lock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/native_handle/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/native_handle/typesizes.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_for/3.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/2.cc: Likewise. + * testsuite/30_threads/timed_mutex/try_lock_until/57641.cc: Likewise. + * testsuite/30_threads/timed_mutex/unlock/1.cc: Likewise. + * testsuite/30_threads/timed_mutex/unlock/2.cc: Likewise. + * testsuite/30_threads/try_lock/1.cc: Likewise. + * testsuite/30_threads/try_lock/2.cc: Likewise. + * testsuite/30_threads/try_lock/3.cc: Likewise. + * testsuite/30_threads/try_lock/4.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/1.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/2.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/3.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/4.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/5.cc: Likewise. + * testsuite/30_threads/unique_lock/cons/6.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/1.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/2.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/3.cc: Likewise. + * testsuite/30_threads/unique_lock/locking/4.cc: Likewise. + * testsuite/30_threads/unique_lock/modifiers/1.cc: Likewise. + * testsuite/ext/rope/pthread7-rope.cc: Likewise. + * testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc: + Likewise. + * testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc: + Likewise. + +2015-09-02 Dmitry Vyukov <dvyukov@google.com> + + * include/bits/basic_string.h: Fix data races on _M_refcount. + 2015-09-02 Sebastian Huber <sebastian.huber@embedded-brains.de> PR libstdc++/67408 diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 789bc5894a0..64c9b7e32cf 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1809,6 +1809,52 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ ]) dnl +dnl Check for uchar.h and usability. +dnl +AC_DEFUN([GLIBCXX_CHECK_UCHAR_H], [ + + # Test uchar.h. + AC_CHECK_HEADERS(uchar.h, ac_has_uchar_h=yes, ac_has_uchar_h=no) + + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++11" + + if test x"$ac_has_uchar_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C11 support for <uchar.h>]) + AC_TRY_COMPILE([#include <uchar.h> + #ifdef __STDC_UTF_16__ + long i = __STDC_UTF_16__; + #endif + #ifdef __STDC_UTF_32__ + long j = __STDC_UTF_32__; + #endif + namespace test + { + using ::c16rtomb; + using ::c32rtomb; + using ::mbrtoc16; + using ::mbrtoc32; + } + ], + [], [ac_c11_uchar_cxx11=yes], [ac_c11_uchar_cxx11=no]) + else + ac_c11_uchar_cxx11=no + fi + AC_MSG_RESULT($ac_c11_uchar_cxx11) + if test x"$ac_c11_uchar_cxx11" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C11_UCHAR_CXX11, 1, + [Define if C11 functions in <uchar.h> should be imported into + namespace std in <cuchar>.]) + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + + +dnl dnl Check whether "/dev/random" and "/dev/urandom" are available for the dnl random_device of "TR1" (Chapter 5.1, "Random number generation"). dnl diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index 337f61440a9..cc7a21e820c 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -454,6 +454,9 @@ /* Define to 1 if the target supports thread-local storage. */ #undef HAVE_TLS +/* Define to 1 if you have the <uchar.h> header file. */ +#undef HAVE_UCHAR_H + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H @@ -780,6 +783,10 @@ /* Define to use Sun versioning in the shared library. */ #undef _GLIBCXX_SYMVER_SUN +/* Define if C11 functions in <uchar.h> should be imported into namespace std + in <cuchar>. */ +#undef _GLIBCXX_USE_C11_UCHAR_CXX11 + /* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed. */ #undef _GLIBCXX_USE_C99 diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 8646465fbbe..6d35f30a18a 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -18149,6 +18149,87 @@ fi + + # Test uchar.h. + for ac_header in uchar.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "uchar.h" "ac_cv_header_uchar_h" "$ac_includes_default" +if test "x$ac_cv_header_uchar_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_UCHAR_H 1 +_ACEOF + ac_has_uchar_h=yes +else + ac_has_uchar_h=no +fi + +done + + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -std=c++11" + + if test x"$ac_has_uchar_h" = x"yes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C11 support for <uchar.h>" >&5 +$as_echo_n "checking for ISO C11 support for <uchar.h>... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <uchar.h> + #ifdef __STDC_UTF_16__ + long i = __STDC_UTF_16__; + #endif + #ifdef __STDC_UTF_32__ + long j = __STDC_UTF_32__; + #endif + namespace test + { + using ::c16rtomb; + using ::c32rtomb; + using ::mbrtoc16; + using ::mbrtoc32; + } + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_c11_uchar_cxx11=yes +else + ac_c11_uchar_cxx11=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + else + ac_c11_uchar_cxx11=no + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_c11_uchar_cxx11" >&5 +$as_echo "$ac_c11_uchar_cxx11" >&6; } + if test x"$ac_c11_uchar_cxx11" = x"yes"; then + +$as_echo "#define _GLIBCXX_USE_C11_UCHAR_CXX11 1" >>confdefs.h + + fi + + CXXFLAGS="$ac_save_CXXFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # For the streamoff typedef. diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 96ff16f3f3e..34563480634 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -181,6 +181,7 @@ GLIBCXX_ENABLE_VTABLE_VERIFY([no]) # Checks for operating systems support that doesn't require linking. GLIBCXX_CHECK_STDIO_PROTO GLIBCXX_CHECK_SYSTEM_ERROR +GLIBCXX_CHECK_UCHAR_H # For the streamoff typedef. GLIBCXX_CHECK_INT64_T diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html index 1ea5fffab6c..65ffc01a45b 100644 --- a/libstdc++-v3/doc/html/manual/bugs.html +++ b/libstdc++-v3/doc/html/manual/bugs.html @@ -366,6 +366,12 @@ </p></dd><dt><span class="term"><a class="link" href="../ext/lwg-defects.html#2059" target="_top">2059</a>: <span class="emphasis"><em>C++0x ambiguity problem with map::erase</em></span> </span></dt><dd><p>Add additional overloads. + </p></dd><dt><span class="term"><a class="link" href="../ext/lwg-defects.html#2063" target="_top">2063</a>: + <span class="emphasis"><em>Contradictory requirements for string move assignment</em></span> + </span></dt><dd><p>Respect propagation trait for move assignment. + </p></dd><dt><span class="term"><a class="link" href="../ext/lwg-defects.html#2064" target="_top">2064</a>: + <span class="emphasis"><em>More noexcept issues in basic_string</em></span> + </span></dt><dd><p>Add noexcept to the comparison operators. </p></dd><dt><span class="term"><a class="link" href="../ext/lwg-defects.html#2067" target="_top">2067</a>: <span class="emphasis"><em>packaged_task should have deleted copy c'tor with const parameter</em></span> </span></dt><dd><p>Fix signatures. diff --git a/libstdc++-v3/doc/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html index cc5c65079b0..5888002028a 100644 --- a/libstdc++-v3/doc/html/manual/using.html +++ b/libstdc++-v3/doc/html/manual/using.html @@ -11,7 +11,8 @@ The standard library conforms to the dialect of C++ specified by the <code class="option">-std</code> option passed to the compiler. By default, <span class="command"><strong>g++</strong></span> is equivalent to - <span class="command"><strong>g++ -std=gnu++98</strong></span>. + <span class="command"><strong>g++ -std=gnu++14</strong></span> since GCC 6, and + <span class="command"><strong>g++ -std=gnu++98</strong></span> for older releases. </p><div class="table"><a id="table.cmd_options"></a><p class="title"><strong>Table 3.1. C++ Command Options</strong></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code> or <code class="literal">-std=c++03</code> </td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code> or <code class="literal">-std=gnu++03</code> </td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++11</code></td><td align="left">Use the 2011 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++11</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++14</code></td><td align="left">Use the 2014 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++14</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++11 diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html index 7e4d5be9136..bb147944ad9 100644 --- a/libstdc++-v3/doc/html/manual/using_headers.html +++ b/libstdc++-v3/doc/html/manual/using_headers.html @@ -74,12 +74,15 @@ of <code class="code">std::sinf</code>, <code class="code">std::sin</code>, and <code class="code">std::sinl</code>. </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.pre"></a>Precompiled Headers</h3></div></div></div><p>There are three base header files that are provided. They can be used to precompile the standard headers and extensions into binary -files that may the be used to speed compiles that use these headers. +files that may then be used to speed up compilations that use these headers. </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>stdc++.h</p><p>Includes all standard headers. Actual content varies depending on -language dialect. +<a class="link" href="using.html#manual.intro.using.flags" title="Command Options">language dialect</a>. </p></li><li class="listitem"><p>stdtr1c++.h</p><p>Includes all of <stdc++.h>, and adds all the TR1 headers. -</p></li><li class="listitem"><p>extc++.h</p><p>Includes all of <stdtr1c++.h>, and adds all the Extension headers. -</p></li></ul></div><p>How to construct a .gch file from one of these base header files.</p><p>First, find the include directory for the compiler. One way to do +</p></li><li class="listitem"><p>extc++.h</p><p>Includes all of <stdc++.h>, and adds all the Extension headers +(and in C++98 mode also adds all the TR1 headers by including all of +<stdtr1c++.h>). +</p></li></ul></div><p>To construct a .gch file from one of these base header files, +first find the include directory for the compiler. One way to do this is:</p><pre class="programlisting"> g++ -v hello.cc diff --git a/libstdc++-v3/doc/html/manual/using_macros.html b/libstdc++-v3/doc/html/manual/using_macros.html index 4bb99b1f5d2..6b1fc1e6565 100644 --- a/libstdc++-v3/doc/html/manual/using_macros.html +++ b/libstdc++-v3/doc/html/manual/using_macros.html @@ -68,9 +68,16 @@ detect violations of the requirements of the standard. This is described in more detail in <a class="link" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks">Compile Time Checks</a>. + </p></dd><dt><span class="term"><code class="code">_GLIBCXX_ASSERTIONS</code></span></dt><dd><p> + Undefined by default. When defined, enables extra error checking in + the form of precondition assertions, such as bounds checking in + strings and null pointer checks when dereferencing smart pointers. </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG</code></span></dt><dd><p> Undefined by default. When defined, compiles user code using the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>. + When defined, <code class="code">_GLIBCXX_ASSERTIONS</code> is defined + automatically, so all the assertions enabled by that macro are also + enabled in debug mode. </p></dd><dt><span class="term"><code class="code">_GLIBCXX_DEBUG_PEDANTIC</code></span></dt><dd><p> Undefined by default. When defined while compiling with the <a class="link" href="debug_mode.html" title="Chapter 17. Debug Mode">debug mode</a>, makes diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 1cc183e2dc3..2aa9ba7a896 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -850,6 +850,18 @@ requirements of the license of GCC. <listitem><para>Add additional overloads. </para></listitem></varlistentry> + <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2063">2063</link>: + <emphasis>Contradictory requirements for string move assignment</emphasis> + </term> + <listitem><para>Respect propagation trait for move assignment. + </para></listitem></varlistentry> + + <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2064">2064</link>: + <emphasis>More noexcept issues in basic_string</emphasis> + </term> + <listitem><para>Add noexcept to the comparison operators. + </para></listitem></varlistentry> + <varlistentry><term><link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="../ext/lwg-defects.html#2067">2067</link>: <emphasis>packaged_task should have deleted copy c'tor with const parameter</emphasis> </term> diff --git a/libstdc++-v3/doc/xml/manual/using.xml b/libstdc++-v3/doc/xml/manual/using.xml index 34b4883cfec..2c8d179b489 100644 --- a/libstdc++-v3/doc/xml/manual/using.xml +++ b/libstdc++-v3/doc/xml/manual/using.xml @@ -16,7 +16,8 @@ The standard library conforms to the dialect of C++ specified by the <option>-std</option> option passed to the compiler. By default, <command>g++</command> is equivalent to - <command>g++ -std=gnu++98</command>. + <command>g++ -std=gnu++14</command> since GCC 6, and + <command>g++ -std=gnu++98</command> for older releases. </para> <table frame="all" xml:id="table.cmd_options"> @@ -718,7 +719,7 @@ and <code>std::sinl</code>. <para>There are three base header files that are provided. They can be used to precompile the standard headers and extensions into binary -files that may the be used to speed compiles that use these headers. +files that may then be used to speed up compilations that use these headers. </para> @@ -726,7 +727,7 @@ files that may the be used to speed compiles that use these headers. <listitem> <para>stdc++.h</para> <para>Includes all standard headers. Actual content varies depending on -language dialect. +<link linkend="manual.intro.using.flags">language dialect</link>. </para> </listitem> @@ -737,13 +738,14 @@ language dialect. </listitem> <listitem><para>extc++.h</para> -<para>Includes all of <stdtr1c++.h>, and adds all the Extension headers. +<para>Includes all of <stdc++.h>, and adds all the Extension headers +(and in C++98 mode also adds all the TR1 headers by including all of +<stdtr1c++.h>). </para></listitem> </itemizedlist> -<para>How to construct a .gch file from one of these base header files.</para> - -<para>First, find the include directory for the compiler. One way to do +<para>To construct a .gch file from one of these base header files, +first find the include directory for the compiler. One way to do this is:</para> <programlisting> @@ -903,11 +905,22 @@ g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe </para> </listitem></varlistentry> + <varlistentry><term><code>_GLIBCXX_ASSERTIONS</code></term> + <listitem> + <para> + Undefined by default. When defined, enables extra error checking in + the form of precondition assertions, such as bounds checking in + strings and null pointer checks when dereferencing smart pointers. + </para> + </listitem></varlistentry> <varlistentry><term><code>_GLIBCXX_DEBUG</code></term> <listitem> <para> Undefined by default. When defined, compiles user code using the <link linkend="manual.ext.debug_mode">debug mode</link>. + When defined, <code>_GLIBCXX_ASSERTIONS</code> is defined + automatically, so all the assertions enabled by that macro are also + enabled in debug mode. </para> </listitem></varlistentry> <varlistentry><term><code>_GLIBCXX_DEBUG_PEDANTIC</code></term> diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 41fc4af6d30..74100f29925 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -122,6 +122,7 @@ bits_headers = \ ${bits_srcdir}/mask_array.h \ ${bits_srcdir}/memoryfwd.h \ ${bits_srcdir}/move.h \ + ${bits_srcdir}/mutex.h \ ${bits_srcdir}/ostream.tcc \ ${bits_srcdir}/ostream_insert.h \ ${bits_srcdir}/parse_numbers.h \ @@ -710,6 +711,7 @@ c_base_headers = \ ${c_base_srcdir}/cstring \ ${c_base_srcdir}/ctgmath \ ${c_base_srcdir}/ctime \ + ${c_base_srcdir}/cuchar \ ${c_base_srcdir}/cwchar \ ${c_base_srcdir}/cwctype @@ -752,6 +754,7 @@ c_compatibility_headers = \ ${c_compatibility_srcdir}/string.h \ ${c_compatibility_srcdir}/tgmath.h \ ${c_compatibility_srcdir}/time.h \ + ${c_compatibility_srcdir}/uchar.h \ ${c_compatibility_srcdir}/wchar.h \ ${c_compatibility_srcdir}/wctype.h endif diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 6470d0173d5..b72df264531 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -412,6 +412,7 @@ bits_headers = \ ${bits_srcdir}/mask_array.h \ ${bits_srcdir}/memoryfwd.h \ ${bits_srcdir}/move.h \ + ${bits_srcdir}/mutex.h \ ${bits_srcdir}/ostream.tcc \ ${bits_srcdir}/ostream_insert.h \ ${bits_srcdir}/parse_numbers.h \ @@ -997,6 +998,7 @@ c_base_headers = \ ${c_base_srcdir}/cstring \ ${c_base_srcdir}/ctgmath \ ${c_base_srcdir}/ctime \ + ${c_base_srcdir}/cuchar \ ${c_base_srcdir}/cwchar \ ${c_base_srcdir}/cwctype @@ -1033,6 +1035,7 @@ c_compatibility_builddir = . @GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/string.h \ @GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/tgmath.h \ @GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/time.h \ +@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/uchar.h \ @GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wchar.h \ @GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wctype.h diff --git a/libstdc++-v3/include/backward/auto_ptr.h b/libstdc++-v3/include/backward/auto_ptr.h index a6aa2ebc233..c2bd1aa37ba 100644 --- a/libstdc++-v3/include/backward/auto_ptr.h +++ b/libstdc++-v3/include/backward/auto_ptr.h @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION element_type& operator*() const throw() { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + __glibcxx_assert(_M_ptr != 0); return *_M_ptr; } @@ -193,7 +193,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION element_type* operator->() const throw() { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + __glibcxx_assert(_M_ptr != 0); return _M_ptr; } diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 923fb83937c..e6e7bb525ba 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -379,9 +379,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @brief Default constructor creates an empty string. */ basic_string() -#if __cplusplus >= 201103L - noexcept(is_nothrow_default_constructible<_Alloc>::value) -#endif + _GLIBCXX_NOEXCEPT_IF(is_nothrow_default_constructible<_Alloc>::value) : _M_dataplus(_M_local_data()) { _M_set_length(0); } @@ -389,7 +387,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @brief Construct an empty string using allocator @a a. */ explicit - basic_string(const _Alloc& __a) + basic_string(const _Alloc& __a) _GLIBCXX_NOEXCEPT : _M_dataplus(_M_local_data(), __a) { _M_set_length(0); } @@ -398,7 +396,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @param __str Source string. */ basic_string(const basic_string& __str) - : _M_dataplus(_M_local_data(), __str._M_get_allocator()) // TODO A traits + : _M_dataplus(_M_local_data(), + _Alloc_traits::_S_select_on_copy(__str._M_get_allocator())) { _M_construct(__str._M_data(), __str._M_data() + __str.length()); } /** @@ -511,10 +510,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { _M_construct(__str.begin(), __str.end()); } basic_string(basic_string&& __str, const _Alloc& __a) + noexcept(_Alloc_traits::_S_always_equal()) : _M_dataplus(_M_local_data(), __a) { - if (__str.get_allocator() == __a) - *this = std::move(__str); + if (__str._M_is_local()) + { + traits_type::copy(_M_local_buf, __str._M_local_buf, + _S_local_capacity + 1); + _M_length(__str.length()); + __str._M_set_length(0); + } + else if (_Alloc_traits::_S_always_equal() + || __str.get_allocator() == __a) + { + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + __str._M_data(__str._M_local_buf); + __str._M_set_length(0); + } else _M_construct(__str.begin(), __str.end()); } @@ -550,7 +564,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ basic_string& operator=(const basic_string& __str) - { return this->assign(__str); } + { +#if __cplusplus >= 201103L + if (_Alloc_traits::_S_propagate_on_copy_assign()) + { + if (!_Alloc_traits::_S_always_equal() && !_M_is_local() + && _M_get_allocator() != __str._M_get_allocator()) + { + // replacement allocator cannot free existing storage + _M_destroy(_M_allocated_capacity); + _M_data(_M_local_data()); + _M_set_length(0); + } + std::__alloc_on_copy(_M_get_allocator(), __str._M_get_allocator()); + } +#endif + return this->assign(__str); + } /** * @brief Copy contents of @a s into this string. @@ -587,8 +617,51 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // 2063. Contradictory requirements for string move assignment basic_string& operator=(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) { - this->swap(__str); + if (!_M_is_local() && _Alloc_traits::_S_propagate_on_move_assign() + && !_Alloc_traits::_S_always_equal() + && _M_get_allocator() != __str._M_get_allocator()) + { + // Destroy existing storage before replacing allocator. + _M_destroy(_M_allocated_capacity); + _M_data(_M_local_data()); + _M_set_length(0); + } + // Replace allocator if POCMA is true. + std::__alloc_on_move(_M_get_allocator(), __str._M_get_allocator()); + + if (!__str._M_is_local() + && (_Alloc_traits::_S_propagate_on_move_assign() + || _Alloc_traits::_S_always_equal())) + { + pointer __data = nullptr; + size_type __capacity; + if (!_M_is_local()) + { + if (_Alloc_traits::_S_always_equal()) + { + __data = _M_data(); + __capacity = _M_allocated_capacity; + } + else + _M_destroy(_M_allocated_capacity); + } + + _M_data(__str._M_data()); + _M_length(__str.length()); + _M_capacity(__str._M_allocated_capacity); + if (__data) + { + __str._M_data(__data); + __str._M_capacity(__capacity); + } + else + __str._M_data(__str._M_local_buf); + } + else + assign(__str); + __str.clear(); return *this; } @@ -830,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT { - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); + __glibcxx_assert(__pos <= size()); return _M_data()[__pos]; } @@ -849,7 +922,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { // Allow pos == size() both in C++98 mode, as v3 extension, // and in C++11 mode. - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); + __glibcxx_assert(__pos <= size()); // In pedantic mode be strict in C++98 mode. _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); return _M_data()[__pos]; @@ -905,7 +978,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 reference front() noexcept { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](0); } @@ -916,7 +989,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference front() const noexcept { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](0); } @@ -927,7 +1000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 reference back() noexcept { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](this->size() - 1); } @@ -938,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference back() const noexcept { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](this->size() - 1); } #endif @@ -1119,6 +1192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ basic_string& assign(basic_string&& __str) + noexcept(_Alloc_traits::_S_nothrow_move()) { // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2063. Contradictory requirements for string move assignment @@ -1520,7 +1594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 void pop_back() noexcept { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); _M_erase(size() - 1, 1); } #endif // C++11 @@ -2601,11 +2675,32 @@ _GLIBCXX_END_NAMESPACE_CXX11 bool _M_is_leaked() const _GLIBCXX_NOEXCEPT - { return this->_M_refcount < 0; } + { +#if defined(__GTHREADS) + // _M_refcount is mutated concurrently by _M_refcopy/_M_dispose, + // so we need to use an atomic load. However, _M_is_leaked + // predicate does not change concurrently (i.e. the string is either + // leaked or not), so a relaxed load is enough. + return __atomic_load_n(&this->_M_refcount, __ATOMIC_RELAXED) < 0; +#else + return this->_M_refcount < 0; +#endif + } bool _M_is_shared() const _GLIBCXX_NOEXCEPT - { return this->_M_refcount > 0; } + { +#if defined(__GTHREADS) + // _M_refcount is mutated concurrently by _M_refcopy/_M_dispose, + // so we need to use an atomic load. Another thread can drop last + // but one reference concurrently with this check, so we need this + // load to be acquire to synchronize with release fetch_and_add in + // _M_dispose. + return __atomic_load_n(&this->_M_refcount, __ATOMIC_ACQUIRE) > 0; +#else + return this->_M_refcount > 0; +#endif + } void _M_set_leaked() _GLIBCXX_NOEXCEPT @@ -2654,6 +2749,14 @@ _GLIBCXX_END_NAMESPACE_CXX11 { // Be race-detector-friendly. For more info see bits/c++config. _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount); + // Decrement of _M_refcount is acq_rel, because: + // - all but last decrements need to release to synchronize with + // the last decrement that will delete the object. + // - the last decrement needs to acquire to synchronize with + // all the previous decrements. + // - last but one decrement needs to release to synchronize with + // the acquire load in _M_is_shared that will conclude that + // the object is not shared anymore. if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) { @@ -3247,7 +3350,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 const_reference operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT { - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); + __glibcxx_assert(__pos <= size()); return _M_data()[__pos]; } @@ -3266,7 +3369,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 { // Allow pos == size() both in C++98 mode, as v3 extension, // and in C++11 mode. - _GLIBCXX_DEBUG_ASSERT(__pos <= size()); + __glibcxx_assert(__pos <= size()); // In pedantic mode be strict in C++98 mode. _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < size()); _M_leak(); @@ -3325,7 +3428,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 reference front() { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](0); } @@ -3336,7 +3439,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 const_reference front() const _GLIBCXX_NOEXCEPT { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](0); } @@ -3347,7 +3450,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 reference back() { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](this->size() - 1); } @@ -3358,7 +3461,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 const_reference back() const _GLIBCXX_NOEXCEPT { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); return operator[](this->size() - 1); } #endif @@ -3848,7 +3951,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 void pop_back() // FIXME C++11: should be noexcept. { - _GLIBCXX_DEBUG_ASSERT(!empty()); + __glibcxx_assert(!empty()); erase(size() - 1, 1); } #endif // C++11 @@ -4932,13 +5035,14 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return __lhs.compare(__rhs) == 0; } template<typename _CharT> inline typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, bool>::__type operator==(const basic_string<_CharT>& __lhs, - const basic_string<_CharT>& __rhs) + const basic_string<_CharT>& __rhs) _GLIBCXX_NOEXCEPT { return (__lhs.size() == __rhs.size() && !std::char_traits<_CharT>::compare(__lhs.data(), __rhs.data(), __lhs.size())); } @@ -4978,6 +5082,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return !(__lhs == __rhs); } /** @@ -5015,6 +5120,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return __lhs.compare(__rhs) < 0; } /** @@ -5052,6 +5158,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return __lhs.compare(__rhs) > 0; } /** @@ -5089,6 +5196,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return __lhs.compare(__rhs) <= 0; } /** @@ -5126,6 +5234,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline bool operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT { return __lhs.compare(__rhs) >= 0; } /** @@ -5163,6 +5272,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 inline void swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, basic_string<_CharT, _Traits, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) { __lhs.swap(__rhs); } diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc index b9da93bf174..56af86471e5 100644 --- a/libstdc++-v3/include/bits/basic_string.tcc +++ b/libstdc++-v3/include/bits/basic_string.tcc @@ -61,11 +61,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (this == &__s) return; - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 431. Swapping containers with unequal allocators. - // TODO propagation traits - std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(), - __s._M_get_allocator()); + _Alloc_traits::_S_on_swap(_M_get_allocator(), __s._M_get_allocator()); if (_M_is_local()) if (__s._M_is_local()) @@ -404,7 +400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__new_size <= this->capacity()) { - _CharT* __p = this->_M_data() + __pos1; + pointer __p = this->_M_data() + __pos1; const size_type __how_much = __old_size - __pos1 - __n1; if (__how_much && __n1 != __n2) @@ -433,7 +429,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__new_size <= this->capacity()) { - _CharT* __p = this->_M_data() + __pos; + pointer __p = this->_M_data() + __pos; const size_type __how_much = __old_size - __pos - __len1; if (_M_disjunct(__s)) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index d450f61bc8c..924f13e384c 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -138,7 +138,7 @@ # endif #endif -// Macro for extern template, ie controling template linkage via use +// Macro for extern template, ie controlling template linkage via use // of extern keyword on template declaration. As documented in the g++ // manual, it inhibits all implicit instantiations and is used // throughout the library to avoid multiple weak definitions for @@ -350,8 +350,6 @@ namespace std namespace _GLIBCXX_STD_C { _GLIBCXX_BEGIN_NAMESPACE_VERSION # define _GLIBCXX_END_NAMESPACE_CONTAINER \ _GLIBCXX_END_NAMESPACE_VERSION } -# undef _GLIBCXX_EXTERN_TEMPLATE -# define _GLIBCXX_EXTERN_TEMPLATE -1 #endif #ifdef _GLIBCXX_PARALLEL @@ -414,8 +412,19 @@ namespace std # define _GLIBCXX_END_NAMESPACE_LDBL_OR_CXX11 _GLIBCXX_END_NAMESPACE_LDBL #endif +// Debug Mode implies checking assertions. +#ifdef _GLIBCXX_DEBUG +# define _GLIBCXX_ASSERTIONS +#endif + +// Disable std::string explicit instantiation declarations in order to assert. +#ifdef _GLIBCXX_ASSERTIONS +# undef _GLIBCXX_EXTERN_TEMPLATE +# define _GLIBCXX_EXTERN_TEMPLATE -1 +#endif + // Assert. -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PARALLEL) +#if !defined(_GLIBCXX_ASSERTIONS) && !defined(_GLIBCXX_PARALLEL) # define __glibcxx_assert(_Condition) #else namespace std diff --git a/libstdc++-v3/include/bits/mutex.h b/libstdc++-v3/include/bits/mutex.h new file mode 100644 index 00000000000..43f5b0b2d60 --- /dev/null +++ b/libstdc++-v3/include/bits/mutex.h @@ -0,0 +1,360 @@ +// std::mutex implementation -*- C++ -*- + +// Copyright (C) 2003-2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// 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/>. + +/** @file bits/mutex.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{mutex} + */ + +#ifndef _GLIBCXX_MUTEX_H +#define _GLIBCXX_MUTEX_H 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include <bits/c++0x_warning.h> +#else + +#include <system_error> +#include <bits/functexcept.h> +#include <bits/gthr.h> +#include <bits/move.h> // for std::swap + +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /** + * @defgroup mutexes Mutexes + * @ingroup concurrency + * + * Classes for mutex support. + * @{ + */ + +#ifdef _GLIBCXX_HAS_GTHREADS + // Common base class for std::mutex and std::timed_mutex + class __mutex_base + { + protected: + typedef __gthread_mutex_t __native_type; + +#ifdef __GTHREAD_MUTEX_INIT + __native_type _M_mutex = __GTHREAD_MUTEX_INIT; + + constexpr __mutex_base() noexcept = default; +#else + __native_type _M_mutex; + + __mutex_base() noexcept + { + // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) + __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); + } + + ~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); } +#endif + + __mutex_base(const __mutex_base&) = delete; + __mutex_base& operator=(const __mutex_base&) = delete; + }; + + /// mutex + class mutex : private __mutex_base + { + public: + typedef __native_type* native_handle_type; + +#ifdef __GTHREAD_MUTEX_INIT + constexpr +#endif + mutex() noexcept = default; + ~mutex() = default; + + mutex(const mutex&) = delete; + mutex& operator=(const mutex&) = delete; + + void + lock() + { + int __e = __gthread_mutex_lock(&_M_mutex); + + // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) + if (__e) + __throw_system_error(__e); + } + + bool + try_lock() noexcept + { + // XXX EINVAL, EAGAIN, EBUSY + return !__gthread_mutex_trylock(&_M_mutex); + } + + void + unlock() + { + // XXX EINVAL, EAGAIN, EPERM + __gthread_mutex_unlock(&_M_mutex); + } + + native_handle_type + native_handle() + { return &_M_mutex; } + }; + +#endif // _GLIBCXX_HAS_GTHREADS + + /// Do not acquire ownership of the mutex. + struct defer_lock_t { }; + + /// Try to acquire ownership of the mutex without blocking. + struct try_to_lock_t { }; + + /// Assume the calling thread has already obtained mutex ownership + /// and manage it. + struct adopt_lock_t { }; + + constexpr defer_lock_t defer_lock { }; + constexpr try_to_lock_t try_to_lock { }; + constexpr adopt_lock_t adopt_lock { }; + + /// @brief Scoped lock idiom. + // Acquire the mutex here with a constructor call, then release with + // the destructor call in accordance with RAII style. + template<typename _Mutex> + class lock_guard + { + public: + typedef _Mutex mutex_type; + + explicit lock_guard(mutex_type& __m) : _M_device(__m) + { _M_device.lock(); } + + lock_guard(mutex_type& __m, adopt_lock_t) : _M_device(__m) + { } // calling thread owns mutex + + ~lock_guard() + { _M_device.unlock(); } + + lock_guard(const lock_guard&) = delete; + lock_guard& operator=(const lock_guard&) = delete; + + private: + mutex_type& _M_device; + }; + + /// unique_lock + template<typename _Mutex> + class unique_lock + { + public: + typedef _Mutex mutex_type; + + unique_lock() noexcept + : _M_device(0), _M_owns(false) + { } + + explicit unique_lock(mutex_type& __m) + : _M_device(std::__addressof(__m)), _M_owns(false) + { + lock(); + _M_owns = true; + } + + unique_lock(mutex_type& __m, defer_lock_t) noexcept + : _M_device(std::__addressof(__m)), _M_owns(false) + { } + + unique_lock(mutex_type& __m, try_to_lock_t) + : _M_device(std::__addressof(__m)), _M_owns(_M_device->try_lock()) + { } + + unique_lock(mutex_type& __m, adopt_lock_t) + : _M_device(std::__addressof(__m)), _M_owns(true) + { + // XXX calling thread owns mutex + } + + template<typename _Clock, typename _Duration> + unique_lock(mutex_type& __m, + const chrono::time_point<_Clock, _Duration>& __atime) + : _M_device(std::__addressof(__m)), + _M_owns(_M_device->try_lock_until(__atime)) + { } + + template<typename _Rep, typename _Period> + unique_lock(mutex_type& __m, + const chrono::duration<_Rep, _Period>& __rtime) + : _M_device(std::__addressof(__m)), + _M_owns(_M_device->try_lock_for(__rtime)) + { } + + ~unique_lock() + { + if (_M_owns) + unlock(); + } + + unique_lock(const unique_lock&) = delete; + unique_lock& operator=(const unique_lock&) = delete; + + unique_lock(unique_lock&& __u) noexcept + : _M_device(__u._M_device), _M_owns(__u._M_owns) + { + __u._M_device = 0; + __u._M_owns = false; + } + + unique_lock& operator=(unique_lock&& __u) noexcept + { + if(_M_owns) + unlock(); + + unique_lock(std::move(__u)).swap(*this); + + __u._M_device = 0; + __u._M_owns = false; + + return *this; + } + + void + lock() + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_device->lock(); + _M_owns = true; + } + } + + bool + try_lock() + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock(); + return _M_owns; + } + } + + template<typename _Clock, typename _Duration> + bool + try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock_until(__atime); + return _M_owns; + } + } + + template<typename _Rep, typename _Period> + bool + try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) + { + if (!_M_device) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_owns) + __throw_system_error(int(errc::resource_deadlock_would_occur)); + else + { + _M_owns = _M_device->try_lock_for(__rtime); + return _M_owns; + } + } + + void + unlock() + { + if (!_M_owns) + __throw_system_error(int(errc::operation_not_permitted)); + else if (_M_device) + { + _M_device->unlock(); + _M_owns = false; + } + } + + void + swap(unique_lock& __u) noexcept + { + std::swap(_M_device, __u._M_device); + std::swap(_M_owns, __u._M_owns); + } + + mutex_type* + release() noexcept + { + mutex_type* __ret = _M_device; + _M_device = 0; + _M_owns = false; + return __ret; + } + + bool + owns_lock() const noexcept + { return _M_owns; } + + explicit operator bool() const noexcept + { return owns_lock(); } + + mutex_type* + mutex() const noexcept + { return _M_device; } + + private: + mutex_type* _M_device; + bool _M_owns; // XXX use atomic_bool + }; + + /// Swap overload for unique_lock objects. + template<typename _Mutex> + inline void + swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept + { __x.swap(__y); } + + // @} group mutexes +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace +#endif // _GLIBCXX_USE_C99_STDINT_TR1 + +#endif // C++11 + +#endif // _GLIBCXX_MUTEX_H diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 5905e60a33e..b29df30bebb 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -1680,7 +1680,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _IntType __b = std::numeric_limits<_IntType>::max()) : _M_a(__a), _M_b(__b) { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); + __glibcxx_assert(_M_a <= _M_b); } result_type @@ -1881,7 +1881,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType __b = _RealType(1)) : _M_a(__a), _M_b(__b) { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); + __glibcxx_assert(_M_a <= _M_b); } result_type @@ -2099,7 +2099,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType __stddev = _RealType(1)) : _M_mean(__mean), _M_stddev(__stddev) { - _GLIBCXX_DEBUG_ASSERT(_M_stddev > _RealType(0)); + __glibcxx_assert(_M_stddev > _RealType(0)); } _RealType @@ -2517,7 +2517,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType __beta_val = _RealType(1)) : _M_alpha(__alpha_val), _M_beta(__beta_val) { - _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); + __glibcxx_assert(_M_alpha > _RealType(0)); _M_initialize(); } @@ -3582,7 +3582,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(double __p = 0.5) : _M_p(__p) { - _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0)); + __glibcxx_assert((_M_p >= 0.0) && (_M_p <= 1.0)); } double @@ -3791,7 +3791,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(_IntType __t = _IntType(1), double __p = 0.5) : _M_t(__t), _M_p(__p) { - _GLIBCXX_DEBUG_ASSERT((_M_t >= _IntType(0)) + __glibcxx_assert((_M_t >= _IntType(0)) && (_M_p >= 0.0) && (_M_p <= 1.0)); _M_initialize(); @@ -4022,7 +4022,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(double __p = 0.5) : _M_p(__p) { - _GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0)); + __glibcxx_assert((_M_p > 0.0) && (_M_p < 1.0)); _M_initialize(); } @@ -4221,7 +4221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(_IntType __k = 1, double __p = 0.5) : _M_k(__k), _M_p(__p) { - _GLIBCXX_DEBUG_ASSERT((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0)); + __glibcxx_assert((_M_k > 0) && (_M_p > 0.0) && (_M_p <= 1.0)); } _IntType @@ -4444,7 +4444,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(double __mean = 1.0) : _M_mean(__mean) { - _GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0); + __glibcxx_assert(_M_mean > 0.0); _M_initialize(); } @@ -4659,7 +4659,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type(_RealType __lambda = _RealType(1)) : _M_lambda(__lambda) { - _GLIBCXX_DEBUG_ASSERT(_M_lambda > _RealType(0)); + __glibcxx_assert(_M_lambda > _RealType(0)); } _RealType diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index a23c2c9b3ce..07fed5644c9 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -1693,7 +1693,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference operator[](size_type __sub) const { - _GLIBCXX_DEBUG_ASSERT( ready() ); + __glibcxx_assert( ready() ); return __sub < size() ? _Base_type::operator[](__sub) : _M_unmatched_sub(); @@ -1710,7 +1710,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference prefix() const { - _GLIBCXX_DEBUG_ASSERT( ready() ); + __glibcxx_assert( ready() ); return !empty() ? _M_prefix() : _M_unmatched_sub(); } @@ -1725,7 +1725,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const_reference suffix() const { - _GLIBCXX_DEBUG_ASSERT( ready() ); + __glibcxx_assert( ready() ); return !empty() ? _M_suffix() : _M_unmatched_sub(); } diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index fedc2b9edff..ec220fd960b 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -362,7 +362,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const match_results<_Bi_iter, _Alloc>::char_type* __fmt_last, match_flag_type __flags) const { - _GLIBCXX_DEBUG_ASSERT( ready() ); + __glibcxx_assert( ready() ); regex_traits<char_type> __traits; typedef std::ctype<char_type> __ctype_type; const __ctype_type& @@ -535,7 +535,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION | regex_constants::match_not_null | regex_constants::match_continuous)) { - _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); + __glibcxx_assert(_M_match[0].matched); auto& __prefix = _M_match._M_prefix(); __prefix.first = __prefix_first; __prefix.matched = __prefix.first != __prefix.second; @@ -550,7 +550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_flags |= regex_constants::match_prev_avail; if (regex_search(__start, _M_end, _M_match, *_M_pregex, _M_flags)) { - _GLIBCXX_DEBUG_ASSERT(_M_match[0].matched); + __glibcxx_assert(_M_match[0].matched); auto& __prefix = _M_match._M_prefix(); __prefix.first = __prefix_first; __prefix.matched = __prefix.first != __prefix.second; diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc index cecc4074f18..f6f63a10d45 100644 --- a/libstdc++-v3/include/bits/regex_automaton.tcc +++ b/libstdc++-v3/include/bits/regex_automaton.tcc @@ -216,13 +216,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto& __ref = _M_nfa[__v]; if (__ref._M_next != _S_invalid_state_id) { - _GLIBCXX_DEBUG_ASSERT(__m.count(__ref._M_next) > 0); + __glibcxx_assert(__m.count(__ref._M_next) > 0); __ref._M_next = __m[__ref._M_next]; } if (__ref._M_has_alt()) if (__ref._M_alt != _S_invalid_state_id) { - _GLIBCXX_DEBUG_ASSERT(__m.count(__ref._M_alt) > 0); + __glibcxx_assert(__m.count(__ref._M_alt) > 0); __ref._M_alt = __m[__ref._M_alt]; } } diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 0cb0c04b1eb..07a9ed3555a 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -370,9 +370,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const _TraitsT& __traits) : _M_class_set(0), _M_translator(__traits), _M_traits(__traits), _M_is_non_matching(__is_non_matching) -#ifdef _GLIBCXX_DEBUG - , _M_is_ready(false) -#endif { } bool @@ -386,9 +383,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_add_char(_CharT __c) { _M_char_set.push_back(_M_translator._M_translate(__c)); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); } _StringT @@ -399,9 +394,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__st.empty()) __throw_regex_error(regex_constants::error_collate); _M_char_set.push_back(_M_translator._M_translate(__st[0])); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); return __st; } @@ -415,9 +408,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __st = _M_traits.transform_primary(__st.data(), __st.data() + __st.size()); _M_equiv_set.push_back(__st); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); } // __neg should be true for \D, \S and \W only. @@ -433,9 +424,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_class_set |= __mask; else _M_neg_class_set.push_back(__mask); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); } void @@ -445,9 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __throw_regex_error(regex_constants::error_range); _M_range_set.push_back(make_pair(_M_translator._M_transform(__l), _M_translator._M_transform(__r))); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = false; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = false); } void @@ -457,9 +444,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto __end = std::unique(_M_char_set.begin(), _M_char_set.end()); _M_char_set.erase(__end, _M_char_set.end()); _M_make_cache(_UseCache()); -#ifdef _GLIBCXX_DEBUG - _M_is_ready = true; -#endif + _GLIBCXX_DEBUG_ONLY(_M_is_ready = true); } private: @@ -507,7 +492,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_is_non_matching; _CacheT _M_cache; #ifdef _GLIBCXX_DEBUG - bool _M_is_ready; + bool _M_is_ready = false; #endif }; diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc index 9a623111555..336a2e8133b 100644 --- a/libstdc++-v3/include/bits/regex_compiler.tcc +++ b/libstdc++-v3/include/bits/regex_compiler.tcc @@ -83,7 +83,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (!_M_match_token(_ScannerT::_S_token_eof)) __throw_regex_error(regex_constants::error_paren); __r._M_append(_M_pop()); - _GLIBCXX_DEBUG_ASSERT(_M_stack.empty()); + __glibcxx_assert(_M_stack.empty()); __r._M_append(_M_nfa->_M_insert_subexpr_end()); __r._M_append(_M_nfa->_M_insert_accept()); _M_nfa->_M_eliminate_dummy(); @@ -399,7 +399,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Compiler<_TraitsT>:: _M_insert_character_class_matcher() { - _GLIBCXX_DEBUG_ASSERT(_M_value.size() == 1); + __glibcxx_assert(_M_value.size() == 1); _BracketMatcher<_TraitsT, __icase, __collate> __matcher (_M_ctype.is(_CtypeT::upper, _M_value[0]), _M_traits); __matcher._M_add_character_class(_M_value, false); diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc index 3fd17f69e2c..a13f0d54249 100644 --- a/libstdc++-v3/include/bits/regex_executor.tcc +++ b/libstdc++-v3/include/bits/regex_executor.tcc @@ -305,7 +305,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // If matched, keep going; else just return and try another state. case _S_opcode_backref: { - _GLIBCXX_DEBUG_ASSERT(__dfs_mode); + __glibcxx_assert(__dfs_mode); auto& __submatch = _M_cur_results[__state._M_backref_index]; if (!__submatch.matched) break; @@ -333,7 +333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION case _S_opcode_accept: if (__dfs_mode) { - _GLIBCXX_DEBUG_ASSERT(!_M_has_sol); + __glibcxx_assert(!_M_has_sol); if (__match_mode == _Match_mode::_Exact) _M_has_sol = _M_current == _M_end; else @@ -347,7 +347,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_results = _M_cur_results; else // POSIX { - _GLIBCXX_DEBUG_ASSERT(_M_states._M_get_sol_pos()); + __glibcxx_assert(_M_states._M_get_sol_pos()); // Here's POSIX's logic: match the longest one. However // we never know which one (lhs or rhs of "|") is longer // unless we try both of them and compare the results. @@ -400,7 +400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } break; default: - _GLIBCXX_DEBUG_ASSERT(false); + __glibcxx_assert(false); } } diff --git a/libstdc++-v3/include/bits/regex_scanner.tcc b/libstdc++-v3/include/bits/regex_scanner.tcc index 15556693931..c158c65924a 100644 --- a/libstdc++-v3/include/bits/regex_scanner.tcc +++ b/libstdc++-v3/include/bits/regex_scanner.tcc @@ -84,7 +84,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_scan_in_brace(); else { - _GLIBCXX_DEBUG_ASSERT(false); + __glibcxx_assert(false); } } @@ -186,7 +186,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_token = __it->second; return; } - _GLIBCXX_DEBUG_ASSERT(false); + __glibcxx_assert(false); } else { diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 820edcb5d4b..1a96b4cd36d 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -49,6 +49,7 @@ #ifndef _SHARED_PTR_BASE_H #define _SHARED_PTR_BASE_H 1 +#include <typeinfo> #include <bits/allocated_ptr.h> #include <ext/aligned_buffer.h> @@ -67,8 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class bad_weak_ptr : public std::exception { public: - virtual char const* - what() const noexcept; + virtual char const* what() const noexcept; virtual ~bad_weak_ptr() noexcept; }; @@ -1029,7 +1029,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION reset(_Tp1* __p) // _Tp1 must be complete. { // Catch self-reset errors. - _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); + __glibcxx_assert(__p == 0 || __p != _M_ptr); __shared_ptr(__p).swap(*this); } @@ -1047,14 +1047,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename std::add_lvalue_reference<_Tp>::type operator*() const noexcept { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + __glibcxx_assert(_M_ptr != 0); return *_M_ptr; } _Tp* operator->() const noexcept { - _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0); + _GLIBCXX_DEBUG_PEDASSERT(_M_ptr != 0); return _M_ptr; } diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h index 516f8fcc047..5d6d0284d76 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h @@ -145,7 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) - _GLIBCXX_DEBUG_ASSERT(__n >= 0); + __glibcxx_assert(__n >= 0); while (__n--) ++__i; } @@ -205,6 +205,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION next(_ForwardIterator __x, typename iterator_traits<_ForwardIterator>::difference_type __n = 1) { + // concept requirements + __glibcxx_function_requires(_ForwardIteratorConcept< + _ForwardIterator>) std::advance(__x, __n); return __x; } @@ -214,6 +217,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION prev(_BidirectionalIterator __x, typename iterator_traits<_BidirectionalIterator>::difference_type __n = 1) { + // concept requirements + __glibcxx_function_requires(_BidirectionalIteratorConcept< + _BidirectionalIterator>) std::advance(__x, -__n); return __x; } diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 5f8e6fb9ab1..f7e5e300d7b 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -110,6 +110,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&); +#if __cplusplus >= 201103L + template<typename _Alloc> + using _Uses = typename + enable_if<uses_allocator<_Sequence, _Alloc>::value>::type; +#endif + public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; @@ -144,6 +150,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit queue(_Sequence&& __c = _Sequence()) : c(std::move(__c)) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + explicit + queue(const _Alloc& __a) + : c(__a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + queue(const _Sequence& __c, const _Alloc& __a) + : c(__c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + queue(_Sequence&& __c, const _Alloc& __a) + : c(std::move(__c), __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + queue(const queue& __q, const _Alloc& __a) + : c(__q.c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + queue(queue&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a) { } #endif /** @@ -378,6 +405,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp, _BinaryFunctionConcept) +#if __cplusplus >= 201103L + template<typename _Alloc> + using _Uses = typename + enable_if<uses_allocator<_Sequence, _Alloc>::value>::type; +#endif + public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; @@ -412,6 +445,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Sequence&& __s = _Sequence()) : c(std::move(__s)), comp(__x) { std::make_heap(c.begin(), c.end(), comp); } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + explicit + priority_queue(const _Alloc& __a) + : c(__a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + priority_queue(const _Compare& __x, const _Alloc& __a) + : c(__x, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + priority_queue(const _Compare& __x, const _Sequence& __c, + const _Alloc& __a) + : c(__x, __c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + priority_queue(const _Compare& __x, _Sequence&& __c, const _Alloc& __a) + : c(__x, std::move(__c), __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + priority_queue(const priority_queue& __q, const _Alloc& __a) + : c(__q.c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + priority_queue(priority_queue&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a) { } #endif /** diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index 09dd6118a7a..0b54d1a6376 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -114,6 +114,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&); +#if __cplusplus >= 201103L + template<typename _Alloc> + using _Uses = typename + enable_if<uses_allocator<_Sequence, _Alloc>::value>::type; +#endif + public: typedef typename _Sequence::value_type value_type; typedef typename _Sequence::reference reference; @@ -142,6 +148,27 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION explicit stack(_Sequence&& __c = _Sequence()) : c(std::move(__c)) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + explicit + stack(const _Alloc& __a) + : c(__a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + stack(const _Sequence& __c, const _Alloc& __a) + : c(__c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + stack(_Sequence&& __c, const _Alloc& __a) + : c(std::move(__c), __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + stack(const stack& __q, const _Alloc& __a) + : c(__q.c, __a) { } + + template<typename _Alloc, typename _Requires = _Uses<_Alloc>> + stack(stack&& __q, const _Alloc& __a) + : c(std::move(__q.c), __a) { } #endif /** diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 8ab55da75d3..6344923036a 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -287,7 +287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename add_lvalue_reference<element_type>::type operator*() const { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); + __glibcxx_assert(get() != pointer()); return *get(); } @@ -295,7 +295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION pointer operator->() const noexcept { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); + _GLIBCXX_DEBUG_PEDASSERT(get() != pointer()); return get(); } @@ -555,7 +555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename std::add_lvalue_reference<element_type>::type operator[](size_t __i) const { - _GLIBCXX_DEBUG_ASSERT(get() != pointer()); + __glibcxx_assert(get() != pointer()); return get()[__i]; } diff --git a/libstdc++-v3/include/c/cassert b/libstdc++-v3/include/c/cassert index 46e4172fc2a..3965d168417 100644 --- a/libstdc++-v3/include/c/cassert +++ b/libstdc++-v3/include/c/cassert @@ -30,4 +30,5 @@ #pragma GCC system_header +#include <bits/c++config.h> #include_next <assert.h> diff --git a/libstdc++-v3/include/c/cerrno b/libstdc++-v3/include/c/cerrno index 1d56cb409df..6ea1d4c1119 100644 --- a/libstdc++-v3/include/c/cerrno +++ b/libstdc++-v3/include/c/cerrno @@ -40,6 +40,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include_next <errno.h> // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 diff --git a/libstdc++-v3/include/c/cfloat b/libstdc++-v3/include/c/cfloat index 25cfa6454e4..282eb31e57b 100644 --- a/libstdc++-v3/include/c/cfloat +++ b/libstdc++-v3/include/c/cfloat @@ -31,6 +31,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include_next <float.h> #endif diff --git a/libstdc++-v3/include/c/ciso646 b/libstdc++-v3/include/c/ciso646 index 125f16690f3..6eca2742f45 100644 --- a/libstdc++-v3/include/c/ciso646 +++ b/libstdc++-v3/include/c/ciso646 @@ -27,6 +27,12 @@ * in your programs, rather than any of the "*.h" implementation files. * * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std. + * which is empty in C++. */ +#ifndef _GLIBCXX_CISO646 +#define _GLIBCXX_CISO646 + +#pragma GCC system_header + +#include <bits/c++config.h> +#endif diff --git a/libstdc++-v3/include/c/climits b/libstdc++-v3/include/c/climits index f8b19d5b4ed..5333af970bf 100644 --- a/libstdc++-v3/include/c/climits +++ b/libstdc++-v3/include/c/climits @@ -31,6 +31,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include_next <limits.h> #endif diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar new file mode 100644 index 00000000000..dd50c47bbe0 --- /dev/null +++ b/libstdc++-v3/include/c/cuchar @@ -0,0 +1,47 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// 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/>. + +// +// ISO C++ 14882:2011 21.8 +// + +#ifndef _GLIBCXX_CUCHAR +#define _GLIBCXX_CUCHAR 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include <bits/c++0x_warning.h> +#else + +#include <bits/c++config.h> +#include <cwchar> + +#if _GLIBCXX_USE_C11_UCHAR_CXX11 +# include_next <uchar.h> +#endif + +#endif // C++11 + +#endif // _GLIBCXX_CUCHAR diff --git a/libstdc++-v3/include/c_compatibility/uchar.h b/libstdc++-v3/include/c_compatibility/uchar.h new file mode 100644 index 00000000000..746f4afb339 --- /dev/null +++ b/libstdc++-v3/include/c_compatibility/uchar.h @@ -0,0 +1,45 @@ +// -*- C++ -*- compatibility header. + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// 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/>. + +/** @file uchar.h + * This is a Standard C++ Library header. + */ + +#include <cuchar> + +#ifndef _GLIBCXX_UCHAR_H +#define _GLIBCXX_UCHAR_H 1 + +#ifdef _GLIBCXX_NAMESPACE_C + +#if _GLIBCXX_USE_C11_UCHAR_CXX11 +using std::mbrtoc16; +using std::c16rtomb; +using std::mbrtoc32; +using std::c32rtomb; +#endif // _GLIBCXX_USE_C11_UCHAR_CXX11 + +#endif // _GLIBCXX_NAMESPACE_C + +#endif // _GLIBCXX_UCHAR_H diff --git a/libstdc++-v3/include/c_global/cassert b/libstdc++-v3/include/c_global/cassert index e555a3857f0..f404560d876 100644 --- a/libstdc++-v3/include/c_global/cassert +++ b/libstdc++-v3/include/c_global/cassert @@ -40,4 +40,5 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <assert.h> diff --git a/libstdc++-v3/include/c_global/cerrno b/libstdc++-v3/include/c_global/cerrno index 7060b1e1e98..9f173c50a58 100644 --- a/libstdc++-v3/include/c_global/cerrno +++ b/libstdc++-v3/include/c_global/cerrno @@ -38,6 +38,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <errno.h> #ifndef _GLIBCXX_CERRNO diff --git a/libstdc++-v3/include/c_global/cfloat b/libstdc++-v3/include/c_global/cfloat index 2c4ae284c16..50f7d3d5442 100644 --- a/libstdc++-v3/include/c_global/cfloat +++ b/libstdc++-v3/include/c_global/cfloat @@ -38,6 +38,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <float.h> #ifndef _GLIBCXX_CFLOAT diff --git a/libstdc++-v3/include/c_global/ciso646 b/libstdc++-v3/include/c_global/ciso646 index 818db67db0a..93fded401cd 100644 --- a/libstdc++-v3/include/c_global/ciso646 +++ b/libstdc++-v3/include/c_global/ciso646 @@ -27,7 +27,12 @@ * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). + * which is empty in C++. */ +#ifndef _GLIBCXX_CISO646 +#define _GLIBCXX_CISO646 + +#pragma GCC system_header + +#include <bits/c++config.h> +#endif diff --git a/libstdc++-v3/include/c_global/climits b/libstdc++-v3/include/c_global/climits index e3da66ce13e..d6e7994a894 100644 --- a/libstdc++-v3/include/c_global/climits +++ b/libstdc++-v3/include/c_global/climits @@ -38,6 +38,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <limits.h> #ifndef _GLIBCXX_CLIMITS diff --git a/libstdc++-v3/include/c_global/cuchar b/libstdc++-v3/include/c_global/cuchar new file mode 100644 index 00000000000..3b30c6a9b4b --- /dev/null +++ b/libstdc++-v3/include/c_global/cuchar @@ -0,0 +1,77 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// 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/>. + +/** @file include/cuchar + * This is a Standard C++ Library file. You should @c \#include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c uchar.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882:2011 21.8 +// + +#ifndef _GLIBCXX_CUCHAR +#define _GLIBCXX_CUCHAR 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include <bits/c++0x_warning.h> +#else + +#include <bits/c++config.h> +#include <cwchar> + +#if _GLIBCXX_USE_C11_UCHAR_CXX11 + +#include <uchar.h> + +// Get rid of those macros defined in <uchar.h> in lieu of real functions. +#undef mbrtoc16 +#undef c16rtomb +#undef mbrtoc32 +#undef c32rtomb + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using ::mbrtoc16; + using ::c16rtomb; + using ::mbrtoc32; + using ::c32rtomb; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _GLIBCXX_USE_C11_UCHAR_CXX11 + +#endif // C++11 + +#endif // _GLIBCXX_CUCHAR diff --git a/libstdc++-v3/include/c_std/cassert b/libstdc++-v3/include/c_std/cassert index ea6daea0f4a..641b03a88bd 100644 --- a/libstdc++-v3/include/c_std/cassert +++ b/libstdc++-v3/include/c_std/cassert @@ -40,4 +40,5 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <assert.h> diff --git a/libstdc++-v3/include/c_std/cerrno b/libstdc++-v3/include/c_std/cerrno index 06618b9f8e0..ef298fa03a8 100644 --- a/libstdc++-v3/include/c_std/cerrno +++ b/libstdc++-v3/include/c_std/cerrno @@ -41,6 +41,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <errno.h> // Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998 diff --git a/libstdc++-v3/include/c_std/cfloat b/libstdc++-v3/include/c_std/cfloat index d730af95c59..01f1724cf8e 100644 --- a/libstdc++-v3/include/c_std/cfloat +++ b/libstdc++-v3/include/c_std/cfloat @@ -41,6 +41,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <float.h> #endif diff --git a/libstdc++-v3/include/c_std/ciso646 b/libstdc++-v3/include/c_std/ciso646 index 08cdf248c83..7829d72ebce 100644 --- a/libstdc++-v3/include/c_std/ciso646 +++ b/libstdc++-v3/include/c_std/ciso646 @@ -27,7 +27,12 @@ * in your programs, rather than any of the @a *.h implementation files. * * This is the C++ version of the Standard C Library header @c iso646.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). + * which is empty in C++. */ +#ifndef _GLIBCXX_CISO646 +#define _GLIBCXX_CISO646 + +#pragma GCC system_header + +#include <bits/c++config.h> +#endif diff --git a/libstdc++-v3/include/c_std/climits b/libstdc++-v3/include/c_std/climits index 348d4c348f8..bffa892686c 100644 --- a/libstdc++-v3/include/c_std/climits +++ b/libstdc++-v3/include/c_std/climits @@ -41,6 +41,7 @@ #pragma GCC system_header +#include <bits/c++config.h> #include <limits.h> #endif diff --git a/libstdc++-v3/include/c_std/cuchar b/libstdc++-v3/include/c_std/cuchar new file mode 100644 index 00000000000..7d5eedbc63b --- /dev/null +++ b/libstdc++-v3/include/c_std/cuchar @@ -0,0 +1,77 @@ +// -*- C++ -*- forwarding header. + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// 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/>. + +/** @file include/cuchar + * This is a Standard C++ Library file. You should @c #include this file + * in your programs, rather than any of the @a *.h implementation files. + * + * This is the C++ version of the Standard C Library header @c uchar.h, + * and its contents are (mostly) the same as that header, but are all + * contained in the namespace @c std (except for names which are defined + * as macros in C). + */ + +// +// ISO C++ 14882:2011 21.8 +// + +#ifndef _GLIBCXX_CUCHAR +#define _GLIBCXX_CUCHAR 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include <bits/c++0x_warning.h> +#else + +#include <bits/c++config.h> +#include <cwchar> + +#if _GLIBCXX_USE_C11_UCHAR_CXX11 + +#include <uchar.h> + +// Get rid of those macros defined in <uchar.h> in lieu of real functions. +#undef mbrtoc16 +#undef c16rtomb +#undef mbrtoc32 +#undef c32rtomb + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + using ::mbrtoc16; + using ::c16rtomb; + using ::mbrtoc32; + using ::c32rtomb; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif // _GLIBCXX_USE_C11_UCHAR_CXX11 + +#endif // C++11 + +#endif // _GLIBCXX_CUCHAR diff --git a/libstdc++-v3/include/debug/debug.h b/libstdc++-v3/include/debug/debug.h index 6b52b0ab312..b5935fed36f 100644 --- a/libstdc++-v3/include/debug/debug.h +++ b/libstdc++-v3/include/debug/debug.h @@ -62,7 +62,6 @@ namespace __gnu_debug # define __glibcxx_requires_cond(_Cond,_Msg) # define __glibcxx_requires_valid_range(_First,_Last) -# define __glibcxx_requires_non_empty_range(_First,_Last) # define __glibcxx_requires_sorted(_First,_Last) # define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) # define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) @@ -73,7 +72,6 @@ namespace __gnu_debug # define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) # define __glibcxx_requires_heap(_First,_Last) # define __glibcxx_requires_heap_pred(_First,_Last,_Pred) -# define __glibcxx_requires_nonempty() # define __glibcxx_requires_string(_String) # define __glibcxx_requires_string_len(_String,_Len) # define __glibcxx_requires_subscript(_N) @@ -82,6 +80,18 @@ namespace __gnu_debug # define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) # define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) +#ifdef _GLIBCXX_ASSERTIONS +// Verify that [_First, _Last) forms a non-empty iterator range. +# define __glibcxx_requires_non_empty_range(_First,_Last) \ + __glibcxx_assert(_First != _Last) +// Verify that the container is nonempty +# define __glibcxx_requires_nonempty() \ + __glibcxx_assert(! this->empty()) +#else +# define __glibcxx_requires_non_empty_range(_First,_Last) +# define __glibcxx_requires_nonempty() +#endif + #else # include <debug/macros.h> diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string index 72ae88e5495..d1f4a565aa2 100644 --- a/libstdc++-v3/include/debug/string +++ b/libstdc++-v3/include/debug/string @@ -36,19 +36,19 @@ namespace __gnu_debug { - /// Class std::basic_string with safety/checking/debug instrumentation. - template<typename _CharT, typename _Traits = std::char_traits<_CharT>, - typename _Allocator = std::allocator<_CharT> > - class basic_string - : public __gnu_debug::_Safe_container< - basic_string<_CharT, _Traits, _Allocator>, - _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>, - public std::basic_string<_CharT, _Traits, _Allocator> - { - typedef std::basic_string<_CharT, _Traits, _Allocator> _Base; - typedef __gnu_debug::_Safe_container< - basic_string, _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)> - _Safe; +/// Class std::basic_string with safety/checking/debug instrumentation. +template<typename _CharT, typename _Traits = std::char_traits<_CharT>, + typename _Allocator = std::allocator<_CharT> > + class basic_string + : public __gnu_debug::_Safe_container< + basic_string<_CharT, _Traits, _Allocator>, + _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>, + public std::basic_string<_CharT, _Traits, _Allocator> + { + typedef std::basic_string<_CharT, _Traits, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + basic_string, _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)> + _Safe; public: // types: @@ -72,9 +72,13 @@ namespace __gnu_debug using _Base::npos; + basic_string() + _GLIBCXX_NOEXCEPT_IF(std::is_nothrow_default_constructible<_Base>::value) + : _Base() { } + // 21.3.1 construct/copy/destroy: - explicit basic_string(const _Allocator& __a = _Allocator()) - // _GLIBCXX_NOEXCEPT + explicit + basic_string(const _Allocator& __a) _GLIBCXX_NOEXCEPT : _Base(__a) { } #if __cplusplus < 201103L @@ -91,7 +95,19 @@ namespace __gnu_debug : _Base(__l, __a) { } +#if _GLIBCXX_USE_CXX11_ABI + basic_string(const basic_string& __s, const _Allocator& __a) + : _Base(__s, __a) { } + + basic_string(basic_string&& __s, const _Allocator& __a) + : _Base(std::move(__s), __a) { } +#endif + ~basic_string() = default; + + // Provides conversion from a normal-mode string to a debug-mode string + basic_string(_Base&& __base) noexcept + : _Base(std::move(__base)) { } #endif // C++11 // Provides conversion from a normal-mode string to a debug-mode string @@ -278,7 +294,7 @@ namespace __gnu_debug reference operator[](size_type __pos) // _GLIBCXX_NOEXCEPT { -#ifdef _GLIBCXX_DEBUG_PEDANTIC +#if __cplusplus < 201103L && defined(_GLIBCXX_DEBUG_PEDANTIC) __glibcxx_check_subscript(__pos); #else // as an extension v3 allows s[s.size()] when s is non-const. @@ -413,6 +429,7 @@ namespace __gnu_debug #if __cplusplus >= 201103L basic_string& assign(basic_string&& __x) + noexcept(noexcept(std::declval<_Base&>().assign(std::move(__x)))) { _Base::assign(std::move(__x)); this->_M_invalidate_all(); @@ -729,6 +746,7 @@ namespace __gnu_debug void swap(basic_string& __x) + _GLIBCXX_NOEXCEPT_IF(std::__is_nothrow_swappable<_Base>::value) { _Safe::_M_swap(__x); _Base::swap(__x); diff --git a/libstdc++-v3/include/experimental/fs_path.h b/libstdc++-v3/include/experimental/fs_path.h index d103312c172..5daef12191d 100644 --- a/libstdc++-v3/include/experimental/fs_path.h +++ b/libstdc++-v3/include/experimental/fs_path.h @@ -341,8 +341,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type) { - _GLIBCXX_DEBUG_ASSERT(!empty()); - _GLIBCXX_DEBUG_ASSERT(_M_type != _Type::_Multi); + __glibcxx_assert(!empty()); + __glibcxx_assert(_M_type != _Type::_Multi); } enum class _Split { _Stem, _Extension }; @@ -948,15 +948,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline path::iterator& path::iterator::operator++() { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + __glibcxx_assert(_M_path != nullptr); if (_M_path->_M_type == _Type::_Multi) { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); ++_M_cur; } else { - _GLIBCXX_DEBUG_ASSERT(!_M_at_end); + __glibcxx_assert(!_M_at_end); _M_at_end = true; } return *this; @@ -965,15 +965,15 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline path::iterator& path::iterator::operator--() { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + __glibcxx_assert(_M_path != nullptr); if (_M_path->_M_type == _Type::_Multi) { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.begin()); + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.begin()); --_M_cur; } else { - _GLIBCXX_DEBUG_ASSERT(_M_at_end); + __glibcxx_assert(_M_at_end); _M_at_end = false; } return *this; @@ -982,10 +982,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline path::iterator::reference path::iterator::operator*() const { - _GLIBCXX_DEBUG_ASSERT(_M_path != nullptr); + __glibcxx_assert(_M_path != nullptr); if (_M_path->_M_type == _Type::_Multi) { - _GLIBCXX_DEBUG_ASSERT(_M_cur != _M_path->_M_cmpts.end()); + __glibcxx_assert(_M_cur != _M_path->_M_cmpts.end()); return *_M_cur; } return *_M_path; diff --git a/libstdc++-v3/include/experimental/functional b/libstdc++-v3/include/experimental/functional index c6b9800f7a6..9db5fefcbcc 100644 --- a/libstdc++-v3/include/experimental/functional +++ b/libstdc++-v3/include/experimental/functional @@ -376,8 +376,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Generalized negator. template<typename _Fn> - struct _Not_fn + class _Not_fn { + _Fn _M_fn; + + public: template<typename _Fn2> explicit _Not_fn(_Fn2&& __fn) : _M_fn(std::forward<_Fn2>(__fn)) { } @@ -389,34 +392,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~_Not_fn() = default; template<typename... _Args> - decltype(auto) + auto operator()(_Args&&... __args) + noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) + -> decltype(!_M_fn(std::forward<_Args>(__args)...)) { return !_M_fn(std::forward<_Args>(__args)...); } template<typename... _Args> - decltype(auto) + auto operator()(_Args&&... __args) const + noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) + -> decltype(!_M_fn(std::forward<_Args>(__args)...)) { return !_M_fn(std::forward<_Args>(__args)...); } template<typename... _Args> - decltype(auto) + auto operator()(_Args&&... __args) volatile + noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) + -> decltype(!_M_fn(std::forward<_Args>(__args)...)) { return !_M_fn(std::forward<_Args>(__args)...); } template<typename... _Args> - decltype(auto) + auto operator()(_Args&&... __args) const volatile + noexcept(noexcept(!_M_fn(std::forward<_Args>(__args)...))) + -> decltype(!_M_fn(std::forward<_Args>(__args)...)) { return !_M_fn(std::forward<_Args>(__args)...); } - - private: - _Fn _M_fn; }; /// [func.not_fn] Function template not_fn - template <class _Fn> + template<typename _Fn> inline auto not_fn(_Fn&& __fn) - { return _Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn)}; } + noexcept(std::is_nothrow_constructible<std::decay_t<_Fn>, _Fn&&>::value) + { + using __maybe_type = _Maybe_wrap_member_pointer<std::decay_t<_Fn>>; + return _Not_fn<typename __maybe_type::type>{std::forward<_Fn>(__fn)}; + } _GLIBCXX_END_NAMESPACE_VERSION } // namespace fundamentals_v2 diff --git a/libstdc++-v3/include/experimental/string_view b/libstdc++-v3/include/experimental/string_view index 9c2b773573f..9dca400d75e 100644 --- a/libstdc++-v3/include/experimental/string_view +++ b/libstdc++-v3/include/experimental/string_view @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator[](size_type __pos) const { // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(__pos < this->_M_len); + // __glibcxx_assert(__pos < this->_M_len); return *(this->_M_str + __pos); } @@ -200,7 +200,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION front() const { // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0); + // __glibcxx_assert(this->_M_len > 0); return *this->_M_str; } @@ -208,7 +208,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION back() const { // TODO: Assert to restore in a way compatible with the constexpr. - // _GLIBCXX_DEBUG_ASSERT(this->_M_len > 0); + // __glibcxx_assert(this->_M_len > 0); return *(this->_M_str + this->_M_len - 1); } @@ -221,7 +221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void remove_prefix(size_type __n) { - _GLIBCXX_DEBUG_ASSERT(this->_M_len >= __n); + __glibcxx_assert(this->_M_len >= __n); this->_M_str += __n; this->_M_len -= __n; } diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 37bc732a7e8..be6db5d4f65 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -415,8 +415,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType __beta_val = _RealType(1)) : _M_alpha(__alpha_val), _M_beta(__beta_val) { - _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0)); - _GLIBCXX_DEBUG_ASSERT(_M_beta > _RealType(0)); + __glibcxx_assert(_M_alpha > _RealType(0)); + __glibcxx_assert(_M_beta > _RealType(0)); } _RealType @@ -669,8 +669,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION else if (__dist == _Dimen * (_Dimen + 1) / 2) _M_init_lower(__meanbegin, __meanend, __varcovbegin, __varcovend); else - _M_init_diagonal(__meanbegin, __meanend, - __varcovbegin, __varcovend); + { + __glibcxx_assert(__dist == _Dimen); + _M_init_diagonal(__meanbegin, __meanend, + __varcovbegin, __varcovend); + } } param_type(std::initializer_list<_RealType> __mean, @@ -688,8 +691,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_init_lower(__mean.begin(), __mean.end(), __varcov.begin(), __varcov.end()); else - _M_init_diagonal(__mean.begin(), __mean.end(), - __varcov.begin(), __varcov.end()); + { + __glibcxx_assert(__varcov.size() == _Dimen); + _M_init_diagonal(__mean.begin(), __mean.end(), + __varcov.begin(), __varcov.end()); + } } std::array<_RealType, _Dimen> @@ -945,8 +951,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __sigma_val = result_type(1)) : _M_nu(__nu_val), _M_sigma(__sigma_val) { - _GLIBCXX_DEBUG_ASSERT(_M_nu >= result_type(0)); - _GLIBCXX_DEBUG_ASSERT(_M_sigma > result_type(0)); + __glibcxx_assert(_M_nu >= result_type(0)); + __glibcxx_assert(_M_sigma > result_type(0)); } result_type @@ -1187,8 +1193,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __omega_val = result_type(1)) : _M_mu(__mu_val), _M_omega(__omega_val) { - _GLIBCXX_DEBUG_ASSERT(_M_mu >= result_type(0.5L)); - _GLIBCXX_DEBUG_ASSERT(_M_omega > result_type(0)); + __glibcxx_assert(_M_mu >= result_type(0.5L)); + __glibcxx_assert(_M_omega > result_type(0)); } result_type @@ -1420,8 +1426,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __mu_val = result_type(1)) : _M_alpha(__alpha_val), _M_mu(__mu_val) { - _GLIBCXX_DEBUG_ASSERT(_M_alpha > result_type(0)); - _GLIBCXX_DEBUG_ASSERT(_M_mu > result_type(0)); + __glibcxx_assert(_M_alpha > result_type(0)); + __glibcxx_assert(_M_mu > result_type(0)); } result_type @@ -1655,9 +1661,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __nu_val = result_type(1)) : _M_lambda(__lambda_val), _M_mu(__mu_val), _M_nu(__nu_val) { - _GLIBCXX_DEBUG_ASSERT(_M_lambda > result_type(0)); - _GLIBCXX_DEBUG_ASSERT(_M_mu > result_type(0)); - _GLIBCXX_DEBUG_ASSERT(_M_nu > result_type(0)); + __glibcxx_assert(_M_lambda > result_type(0)); + __glibcxx_assert(_M_mu > result_type(0)); + __glibcxx_assert(_M_nu > result_type(0)); } result_type @@ -1893,7 +1899,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __b = result_type(1)) : _M_a(__a), _M_b(__b) { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); + __glibcxx_assert(_M_a <= _M_b); } result_type @@ -2129,8 +2135,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __omega = result_type(1)) : _M_q(__q), _M_omega(__omega) { - _GLIBCXX_DEBUG_ASSERT(_M_q > result_type(0)); - _GLIBCXX_DEBUG_ASSERT(_M_q < result_type(1)); + __glibcxx_assert(_M_q > result_type(0)); + __glibcxx_assert(_M_q < result_type(1)); } result_type @@ -2364,9 +2370,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _RealType __c = _RealType(1)) : _M_a(__a), _M_b(__b), _M_c(__c) { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); - _GLIBCXX_DEBUG_ASSERT(_M_b <= _M_c); - _GLIBCXX_DEBUG_ASSERT(_M_a < _M_c); + __glibcxx_assert(_M_a <= _M_b); + __glibcxx_assert(_M_b <= _M_c); + __glibcxx_assert(_M_a < _M_c); _M_r_ab = (_M_b - _M_a) / (_M_c - _M_a); _M_f_ab_ac = (_M_b - _M_a) * (_M_c - _M_a); @@ -2620,8 +2626,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_mu(__mu), _M_kappa(__kappa) { const _RealType __pi = __gnu_cxx::__math_constants<_RealType>::__pi; - _GLIBCXX_DEBUG_ASSERT(_M_mu >= -__pi && _M_mu <= __pi); - _GLIBCXX_DEBUG_ASSERT(_M_kappa >= _RealType(0)); + __glibcxx_assert(_M_mu >= -__pi && _M_mu <= __pi); + __glibcxx_assert(_M_kappa >= _RealType(0)); auto __tau = std::sqrt(_RealType(4) * _M_kappa * _M_kappa + _RealType(1)) + _RealType(1); @@ -2857,8 +2863,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __n = 1) : _M_N{__N}, _M_K{__K}, _M_n{__n} { - _GLIBCXX_DEBUG_ASSERT(_M_N >= _M_K); - _GLIBCXX_DEBUG_ASSERT(_M_N >= _M_n); + __glibcxx_assert(_M_N >= _M_K); + __glibcxx_assert(_M_N >= _M_n); } result_type @@ -3114,7 +3120,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION result_type __b = result_type(1)) : _M_a(__a), _M_b(__b) { - _GLIBCXX_DEBUG_ASSERT(_M_b > result_type(0)); + __glibcxx_assert(_M_b > result_type(0)); } result_type diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index 63349dde7e6..94af25eb597 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -536,7 +536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const_reference operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT { - _GLIBCXX_DEBUG_ASSERT(__pos <= this->size()); + __glibcxx_assert(__pos <= this->size()); return this->_M_data()[__pos]; } @@ -555,7 +555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { // Allow pos == size() both in C++98 mode, as v3 extension, // and in C++11 mode. - _GLIBCXX_DEBUG_ASSERT(__pos <= this->size()); + __glibcxx_assert(__pos <= this->size()); // In pedantic mode be strict in C++98 mode. _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos < this->size()); diff --git a/libstdc++-v3/include/precompiled/extc++.h b/libstdc++-v3/include/precompiled/extc++.h index de3775b36f5..8883e47fb0c 100644 --- a/libstdc++-v3/include/precompiled/extc++.h +++ b/libstdc++-v3/include/precompiled/extc++.h @@ -28,15 +28,25 @@ #if __cplusplus < 201103L #include <bits/stdtr1c++.h> +#else +#include <bits/stdc++.h> #endif #include <ext/algorithm> +#if __cplusplus >= 201103L +# include <ext/aligned_buffer.h> +#endif +#include <ext/alloc_traits.h> #include <ext/array_allocator.h> #include <ext/atomicity.h> #include <ext/bitmap_allocator.h> #include <ext/cast.h> +#if __cplusplus >= 201103L +# include <ext/cmath> +#endif #include <ext/concurrence.h> #include <ext/debug_allocator.h> +#include <ext/enc_filebuf.h> #include <ext/extptr_allocator.h> #include <ext/functional> #include <ext/iterator> @@ -45,9 +55,13 @@ #include <ext/mt_allocator.h> #include <ext/new_allocator.h> #include <ext/numeric> +#include <ext/numeric_traits.h> #include <ext/pod_char_traits.h> #include <ext/pointer.h> #include <ext/pool_allocator.h> +#if __cplusplus >= 201103L +# include <ext/random> +#endif #include <ext/rb_tree> #include <ext/rope> #include <ext/slist> diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h index 693391adffb..ab119fecd2f 100644 --- a/libstdc++-v3/include/precompiled/stdc++.h +++ b/libstdc++-v3/include/precompiled/stdc++.h @@ -56,6 +56,7 @@ #include <cstdbool> #include <cstdint> #include <ctgmath> +#include <cuchar> #include <cwchar> #include <cwctype> #endif diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index f2a6cf93487..5ed4fd571f1 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -668,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline complex<_Tp> polar(const _Tp& __rho, const _Tp& __theta) { - _GLIBCXX_DEBUG_ASSERT( __rho >= 0 ); + __glibcxx_assert( __rho >= 0 ); return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); } diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index f7da017aa63..4714774f1c3 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -36,12 +36,13 @@ #else #include <chrono> -#include <mutex> +#include <bits/mutex.h> #include <ext/concurrence.h> #include <bits/alloc_traits.h> #include <bits/allocator.h> #include <bits/unique_ptr.h> #include <bits/shared_ptr.h> +#include <bits/cxxabi_forced.h> #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 790508c65c2..5e5ced11efe 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -41,10 +41,11 @@ #include <type_traits> #include <functional> #include <system_error> -#include <bits/functexcept.h> -#include <bits/gthr.h> -#include <bits/move.h> // for std::swap -#include <bits/cxxabi_forced.h> +#include <bits/mutex.h> +#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK +# include <condition_variable> +# include <thread> +#endif #ifdef _GLIBCXX_USE_C99_STDINT_TR1 @@ -52,32 +53,12 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#ifdef _GLIBCXX_HAS_GTHREADS - // Common base class for std::mutex and std::timed_mutex - class __mutex_base - { - protected: - typedef __gthread_mutex_t __native_type; - -#ifdef __GTHREAD_MUTEX_INIT - __native_type _M_mutex = __GTHREAD_MUTEX_INIT; - - constexpr __mutex_base() noexcept = default; -#else - __native_type _M_mutex; - - __mutex_base() noexcept - { - // XXX EAGAIN, ENOMEM, EPERM, EBUSY(may), EINVAL(may) - __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); - } - - ~__mutex_base() noexcept { __gthread_mutex_destroy(&_M_mutex); } -#endif + /** + * @ingroup mutexes + * @{ + */ - __mutex_base(const __mutex_base&) = delete; - __mutex_base& operator=(const __mutex_base&) = delete; - }; +#ifdef _GLIBCXX_HAS_GTHREADS // Common base class for std::recursive_mutex and std::recursive_timed_mutex class __recursive_mutex_base @@ -106,58 +87,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; - /** - * @defgroup mutexes Mutexes - * @ingroup concurrency - * - * Classes for mutex support. - * @{ - */ - - /// mutex - class mutex : private __mutex_base - { - public: - typedef __native_type* native_handle_type; - -#ifdef __GTHREAD_MUTEX_INIT - constexpr -#endif - mutex() noexcept = default; - ~mutex() = default; - - mutex(const mutex&) = delete; - mutex& operator=(const mutex&) = delete; - - void - lock() - { - int __e = __gthread_mutex_lock(&_M_mutex); - - // EINVAL, EAGAIN, EBUSY, EINVAL, EDEADLK(may) - if (__e) - __throw_system_error(__e); - } - - bool - try_lock() noexcept - { - // XXX EINVAL, EAGAIN, EBUSY - return !__gthread_mutex_trylock(&_M_mutex); - } - - void - unlock() - { - // XXX EINVAL, EAGAIN, EPERM - __gthread_mutex_unlock(&_M_mutex); - } - - native_handle_type - native_handle() - { return &_M_mutex; } - }; - /// recursive_mutex class recursive_mutex : private __recursive_mutex_base { @@ -360,230 +289,178 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_timedlock(const __gthread_time_t& __ts) { return !__gthread_recursive_mutex_timedlock(&_M_mutex, &__ts); } }; -#endif -#endif // _GLIBCXX_HAS_GTHREADS - - /// Do not acquire ownership of the mutex. - struct defer_lock_t { }; - - /// Try to acquire ownership of the mutex without blocking. - struct try_to_lock_t { }; - - /// Assume the calling thread has already obtained mutex ownership - /// and manage it. - struct adopt_lock_t { }; - - constexpr defer_lock_t defer_lock { }; - constexpr try_to_lock_t try_to_lock { }; - constexpr adopt_lock_t adopt_lock { }; - - /// @brief Scoped lock idiom. - // Acquire the mutex here with a constructor call, then release with - // the destructor call in accordance with RAII style. - template<typename _Mutex> - class lock_guard - { - public: - typedef _Mutex mutex_type; - explicit lock_guard(mutex_type& __m) : _M_device(__m) - { _M_device.lock(); } +#else // !_GTHREAD_USE_MUTEX_TIMEDLOCK - lock_guard(mutex_type& __m, adopt_lock_t) : _M_device(__m) - { } // calling thread owns mutex + /// timed_mutex + class timed_mutex + { + mutex _M_mut; + condition_variable _M_cv; + bool _M_locked = false; - ~lock_guard() - { _M_device.unlock(); } + public: - lock_guard(const lock_guard&) = delete; - lock_guard& operator=(const lock_guard&) = delete; + timed_mutex() = default; + ~timed_mutex() { __glibcxx_assert( !_M_locked ); } - private: - mutex_type& _M_device; - }; + timed_mutex(const timed_mutex&) = delete; + timed_mutex& operator=(const timed_mutex&) = delete; - /// unique_lock - template<typename _Mutex> - class unique_lock + void + lock() { - public: - typedef _Mutex mutex_type; + unique_lock<mutex> __lk(_M_mut); + _M_cv.wait(__lk, [&]{ return !_M_locked; }); + _M_locked = true; + } - unique_lock() noexcept - : _M_device(0), _M_owns(false) - { } + bool + try_lock() + { + lock_guard<mutex> __lk(_M_mut); + if (_M_locked) + return false; + _M_locked = true; + return true; + } - explicit unique_lock(mutex_type& __m) - : _M_device(std::__addressof(__m)), _M_owns(false) + template<typename _Rep, typename _Period> + bool + try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { - lock(); - _M_owns = true; + unique_lock<mutex> __lk(_M_mut); + if (!_M_cv.wait_for(__lk, __rtime, [&]{ return !_M_locked; })) + return false; + _M_locked = true; + return true; } - unique_lock(mutex_type& __m, defer_lock_t) noexcept - : _M_device(std::__addressof(__m)), _M_owns(false) - { } - - unique_lock(mutex_type& __m, try_to_lock_t) - : _M_device(std::__addressof(__m)), _M_owns(_M_device->try_lock()) - { } - - unique_lock(mutex_type& __m, adopt_lock_t) - : _M_device(std::__addressof(__m)), _M_owns(true) + template<typename _Clock, typename _Duration> + bool + try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { - // XXX calling thread owns mutex + unique_lock<mutex> __lk(_M_mut); + if (!_M_cv.wait_until(__lk, __atime, [&]{ return !_M_locked; })) + return false; + _M_locked = true; + return true; } - template<typename _Clock, typename _Duration> - unique_lock(mutex_type& __m, - const chrono::time_point<_Clock, _Duration>& __atime) - : _M_device(std::__addressof(__m)), - _M_owns(_M_device->try_lock_until(__atime)) - { } + void + unlock() + { + lock_guard<mutex> __lk(_M_mut); + __glibcxx_assert( _M_locked ); + _M_locked = false; + _M_cv.notify_one(); + } + }; - template<typename _Rep, typename _Period> - unique_lock(mutex_type& __m, - const chrono::duration<_Rep, _Period>& __rtime) - : _M_device(std::__addressof(__m)), - _M_owns(_M_device->try_lock_for(__rtime)) - { } + /// recursive_timed_mutex + class recursive_timed_mutex + { + mutex _M_mut; + condition_variable _M_cv; + thread::id _M_owner; + unsigned _M_count = 0; - ~unique_lock() - { - if (_M_owns) - unlock(); - } + // Predicate type that tests whether the current thread can lock a mutex. + struct _Can_lock + { + // Returns true if the mutex is unlocked or is locked by _M_caller. + bool + operator()() const noexcept + { return _M_mx->_M_count == 0 || _M_mx->_M_owner == _M_caller; } - unique_lock(const unique_lock&) = delete; - unique_lock& operator=(const unique_lock&) = delete; + const recursive_timed_mutex* _M_mx; + thread::id _M_caller; + }; - unique_lock(unique_lock&& __u) noexcept - : _M_device(__u._M_device), _M_owns(__u._M_owns) - { - __u._M_device = 0; - __u._M_owns = false; - } + public: - unique_lock& operator=(unique_lock&& __u) noexcept - { - if(_M_owns) - unlock(); + recursive_timed_mutex() = default; + ~recursive_timed_mutex() { __glibcxx_assert( _M_count == 0 ); } - unique_lock(std::move(__u)).swap(*this); + recursive_timed_mutex(const recursive_timed_mutex&) = delete; + recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; - __u._M_device = 0; - __u._M_owns = false; + void + lock() + { + auto __id = this_thread::get_id(); + _Can_lock __can_lock{this, __id}; + unique_lock<mutex> __lk(_M_mut); + _M_cv.wait(__lk, __can_lock); + if (_M_count == -1u) + __throw_system_error(EAGAIN); // [thread.timedmutex.recursive]/3 + _M_owner = __id; + ++_M_count; + } - return *this; - } + bool + try_lock() + { + auto __id = this_thread::get_id(); + _Can_lock __can_lock{this, __id}; + lock_guard<mutex> __lk(_M_mut); + if (!__can_lock()) + return false; + if (_M_count == -1u) + return false; + _M_owner = __id; + ++_M_count; + return true; + } - void - lock() + template<typename _Rep, typename _Period> + bool + try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) { - if (!_M_device) - __throw_system_error(int(errc::operation_not_permitted)); - else if (_M_owns) - __throw_system_error(int(errc::resource_deadlock_would_occur)); - else - { - _M_device->lock(); - _M_owns = true; - } + auto __id = this_thread::get_id(); + _Can_lock __can_lock{this, __id}; + unique_lock<mutex> __lk(_M_mut); + if (!_M_cv.wait_for(__lk, __rtime, __can_lock)) + return false; + if (_M_count == -1u) + return false; + _M_owner = __id; + ++_M_count; + return true; } + template<typename _Clock, typename _Duration> bool - try_lock() + try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) { - if (!_M_device) - __throw_system_error(int(errc::operation_not_permitted)); - else if (_M_owns) - __throw_system_error(int(errc::resource_deadlock_would_occur)); - else - { - _M_owns = _M_device->try_lock(); - return _M_owns; - } + auto __id = this_thread::get_id(); + _Can_lock __can_lock{this, __id}; + unique_lock<mutex> __lk(_M_mut); + if (!_M_cv.wait_until(__lk, __atime, __can_lock)) + return false; + if (_M_count == -1u) + return false; + _M_owner = __id; + ++_M_count; + return true; } - template<typename _Clock, typename _Duration> - bool - try_lock_until(const chrono::time_point<_Clock, _Duration>& __atime) + void + unlock() + { + lock_guard<mutex> __lk(_M_mut); + __glibcxx_assert( _M_owner == this_thread::get_id() ); + __glibcxx_assert( _M_count > 0 ); + if (--_M_count == 0) { - if (!_M_device) - __throw_system_error(int(errc::operation_not_permitted)); - else if (_M_owns) - __throw_system_error(int(errc::resource_deadlock_would_occur)); - else - { - _M_owns = _M_device->try_lock_until(__atime); - return _M_owns; - } + _M_owner = {}; + _M_cv.notify_one(); } + } + }; - template<typename _Rep, typename _Period> - bool - try_lock_for(const chrono::duration<_Rep, _Period>& __rtime) - { - if (!_M_device) - __throw_system_error(int(errc::operation_not_permitted)); - else if (_M_owns) - __throw_system_error(int(errc::resource_deadlock_would_occur)); - else - { - _M_owns = _M_device->try_lock_for(__rtime); - return _M_owns; - } - } - - void - unlock() - { - if (!_M_owns) - __throw_system_error(int(errc::operation_not_permitted)); - else if (_M_device) - { - _M_device->unlock(); - _M_owns = false; - } - } - - void - swap(unique_lock& __u) noexcept - { - std::swap(_M_device, __u._M_device); - std::swap(_M_owns, __u._M_owns); - } - - mutex_type* - release() noexcept - { - mutex_type* __ret = _M_device; - _M_device = 0; - _M_owns = false; - return __ret; - } - - bool - owns_lock() const noexcept - { return _M_owns; } - - explicit operator bool() const noexcept - { return owns_lock(); } - - mutex_type* - mutex() const noexcept - { return _M_device; } - - private: - mutex_type* _M_device; - bool _M_owns; // XXX use atomic_bool - }; - - /// Swap overload for unique_lock objects. - template<typename _Mutex> - inline void - swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) noexcept - { __x.swap(__y); } +#endif +#endif // _GLIBCXX_HAS_GTHREADS template<typename _Lock> inline unique_lock<_Lock> diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index ae5f199cdde..5ae492d42c7 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -36,7 +36,6 @@ #else #include <bits/c++config.h> -#include <mutex> #include <condition_variable> #include <bits/functexcept.h> @@ -80,20 +79,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { int __ret = pthread_rwlock_init(&_M_rwlock, NULL); if (__ret == ENOMEM) - throw bad_alloc(); + __throw_bad_alloc(); else if (__ret == EAGAIN) __throw_system_error(int(errc::resource_unavailable_try_again)); else if (__ret == EPERM) __throw_system_error(int(errc::operation_not_permitted)); // Errors not handled: EBUSY, EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); } ~__shared_mutex_pthread() { int __ret __attribute((__unused__)) = pthread_rwlock_destroy(&_M_rwlock); // Errors not handled: EBUSY, EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); } #endif @@ -107,7 +106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ret == EDEADLK) __throw_system_error(int(errc::resource_deadlock_would_occur)); // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); } bool @@ -116,7 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION int __ret = pthread_rwlock_trywrlock(&_M_rwlock); if (__ret == EBUSY) return false; // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); return true; } @@ -125,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { int __ret __attribute((__unused__)) = pthread_rwlock_unlock(&_M_rwlock); // Errors not handled: EPERM, EBUSY, EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); } // Shared ownership @@ -144,7 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ret == EDEADLK) __throw_system_error(int(errc::resource_deadlock_would_occur)); // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); } bool @@ -156,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // an exception. if (__ret == EBUSY || __ret == EAGAIN) return false; // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); return true; } @@ -225,7 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~__shared_mutex_cv() { - _GLIBCXX_DEBUG_ASSERT( _M_state == 0 ); + __glibcxx_assert( _M_state == 0 ); } __shared_mutex_cv(const __shared_mutex_cv&) = delete; @@ -260,7 +259,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION unlock() { lock_guard<mutex> __lk(_M_mut); - _GLIBCXX_DEBUG_ASSERT( _M_write_entered() ); + __glibcxx_assert( _M_write_entered() ); _M_state = 0; // call notify_all() while mutex is held so that another thread can't // lock and unlock the mutex then destroy *this before we make the call. @@ -295,7 +294,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION unlock_shared() { lock_guard<mutex> __lk(_M_mut); - _GLIBCXX_DEBUG_ASSERT( _M_readers() > 0 ); + __glibcxx_assert( _M_readers() > 0 ); auto __prev = _M_state--; if (_M_write_entered()) { @@ -423,7 +422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ret == ETIMEDOUT || __ret == EDEADLK) return false; // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); return true; } @@ -475,7 +474,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ret == ETIMEDOUT) return false; // Errors not handled: EINVAL - _GLIBCXX_DEBUG_ASSERT(__ret == 0); + __glibcxx_assert(__ret == 0); return true; } diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray index 827524915f1..c3d00475cef 100644 --- a/libstdc++-v3/include/std/valarray +++ b/libstdc++-v3/include/std/valarray @@ -621,7 +621,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n) : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n)) { - _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0); + __glibcxx_assert(__p != 0 || __n == 0); std::__valarray_copy_construct(__p, __p + __n, _M_data); } @@ -779,7 +779,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const slice_array<_Tp>& __sa) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz); + __glibcxx_assert(_M_size == __sa._M_sz); std::__valarray_copy(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data)); return *this; @@ -789,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size()); + __glibcxx_assert(_M_size == __ga._M_index.size()); std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index), _Array<_Tp>(_M_data), _M_size); return *this; @@ -799,7 +799,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const mask_array<_Tp>& __ma) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz); + __glibcxx_assert(_M_size == __ma._M_sz); std::__valarray_copy(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size); return *this; @@ -809,7 +809,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz); + __glibcxx_assert(_M_size == __ia._M_sz); std::__valarray_copy(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size); return *this; @@ -925,7 +925,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::sum() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return std::__valarray_sum(_M_data, _M_data + _M_size); } @@ -1032,7 +1032,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::min() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return *std::min_element(_M_data, _M_data + _M_size); } @@ -1040,7 +1040,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _Tp valarray<_Tp>::max() const { - _GLIBCXX_DEBUG_ASSERT(_M_size > 0); + __glibcxx_assert(_M_size > 0); return *std::max_element(_M_data, _M_data + _M_size); } @@ -1090,7 +1090,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& \ valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \ { \ - _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \ + __glibcxx_assert(_M_size == __v._M_size); \ _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \ _Array<_Tp>(__v._M_data)); \ return *this; \ @@ -1138,7 +1138,7 @@ _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right) typename __fun<_Name, _Tp>::result_type> \ operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \ { \ - _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \ + __glibcxx_assert(__v.size() == __w.size()); \ typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \ typedef typename __fun<_Name, _Tp>::result_type _Rt; \ return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \ diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc index c435de70b51..ac3ac67b49e 100644 --- a/libstdc++-v3/src/c++11/debug.cc +++ b/libstdc++-v3/src/c++11/debug.cc @@ -103,7 +103,7 @@ namespace namespace __gnu_debug { - static const char* _S_debug_messages[] = + const char* const _S_debug_messages[] = { // General Checks "function requires a valid iterator range [%1.name;, %2.name;)", diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc index edf900f6bb7..1d102c755b2 100644 --- a/libstdc++-v3/src/c++11/random.cc +++ b/libstdc++-v3/src/c++11/random.cc @@ -130,13 +130,17 @@ namespace std _GLIBCXX_VISIBILITY(default) #endif result_type __ret; + #ifdef _GLIBCXX_HAVE_UNISTD_H - read(fileno(static_cast<FILE*>(_M_file)), - static_cast<void*>(&__ret), sizeof(result_type)); + auto e = read(fileno(static_cast<FILE*>(_M_file)), + static_cast<void*>(&__ret), sizeof(result_type)); #else - std::fread(static_cast<void*>(&__ret), sizeof(result_type), - 1, static_cast<FILE*>(_M_file)); + auto e = std::fread(static_cast<void*>(&__ret), sizeof(result_type), + 1, static_cast<FILE*>(_M_file)); #endif + if (e != sizeof(result_type)) + __throw_runtime_error(__N("random_device could not read enough bytes")); + return __ret; } diff --git a/libstdc++-v3/src/filesystem/ops.cc b/libstdc++-v3/src/filesystem/ops.cc index 661685aa04a..cefb927c6a5 100644 --- a/libstdc++-v3/src/filesystem/ops.cc +++ b/libstdc++-v3/src/filesystem/ops.cc @@ -28,6 +28,7 @@ #include <stdlib.h> #include <stdio.h> #include <errno.h> +#include <limits.h> // PATH_MAX #ifdef _GLIBCXX_HAVE_UNISTD_H # include <unistd.h> # if defined(_GLIBCXX_HAVE_SYS_STAT_H) && defined(_GLIBCXX_HAVE_SYS_TYPES_H) @@ -97,7 +98,11 @@ fs::canonical(const path& p, const path& base, error_code& ec) { path can; #ifdef _GLIBCXX_USE_REALPATH - if (char_ptr rp = char_ptr{::realpath(absolute(p, base).c_str(), nullptr)}) + char* buffer = nullptr; +#if defined(__SunOS_5_10) && defined(PATH_MAX) + buffer = (char*)::malloc(PATH_MAX); +#endif + if (char_ptr rp = char_ptr{::realpath(absolute(p, base).c_str(), buffer)}) { can.assign(rp.get()); ec.clear(); diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc index 7bc7ffe868c..20107d2cccf 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_attributes.cc @@ -35,7 +35,6 @@ #define unused 1 #endif -#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h> #include <bits/extc++.h> int diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/42319.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc index 65afb572148..65afb572148 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/42319.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/42319.cc diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/67309.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/67309.cc index 97df10f649f..409b38da59f 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/67309.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/67309.cc @@ -19,5 +19,4 @@ // { dg-do compile } // libstdc++/67309 -#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h> #include <bits/extc++.h> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc index ae15f31b11c..8c3d0078576 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_attributes.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_attributes.cc @@ -34,7 +34,6 @@ #define unused 1 #endif -#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h> #include <bits/extc++.h> int diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_no_exceptions.cc index 13158d121bd..13158d121bd 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_exceptions.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_no_exceptions.cc diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_rtti.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_no_rtti.cc index 7bbc25f0435..7bbc25f0435 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_no_rtti.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_no_rtti.cc diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_pedantic_errors.cc index ad5847eb7df..ad5847eb7df 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_pedantic_errors.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/all_pedantic_errors.cc diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/operator_names.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/operator_names.cc index 028c2efbcf7..028c2efbcf7 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/operator_names.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/operator_names.cc diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/stdc++.cc index 50c32744732..d1c64b190a8 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/stdc++.cc @@ -59,6 +59,9 @@ #include <tgmath.h> #endif #include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif #ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> #endif diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2011/stdc++_multiple_inclusion.cc index 9fa919f21c5..e51bdee70f6 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2011/stdc++_multiple_inclusion.cc @@ -59,6 +59,9 @@ #include <tgmath.h> #endif #include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif #ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> #endif @@ -103,6 +106,9 @@ #include <tgmath.h> #endif #include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif #ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> #endif diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc index c482fbd9c4d..c395e1dab75 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_attributes.cc @@ -34,8 +34,6 @@ #define unused 1 #endif -#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h> -#include <shared_mutex> // TODO: this is missing from <bits/stdc++.h> #include <bits/extc++.h> int diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_exceptions.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_exceptions.cc new file mode 100644 index 00000000000..b5157c8af0b --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_exceptions.cc @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=gnu++14 -fno-exceptions" } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <bits/extc++.h> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_rtti.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_rtti.cc new file mode 100644 index 00000000000..8b9fec7b3cf --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_no_rtti.cc @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=gnu++14 -fno-rtti" } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <bits/extc++.h> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc new file mode 100644 index 00000000000..742315d82df --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc @@ -0,0 +1,21 @@ +// { dg-do compile } +// { dg-options "-std=gnu++14 -pedantic-errors" } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <bits/extc++.h> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/operator_names.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/operator_names.cc new file mode 100644 index 00000000000..c347368954c --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/operator_names.cc @@ -0,0 +1,30 @@ +// { dg-do compile } +// { dg-options "-std=gnu++14 -fno-operator-names" } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// libstdc++/47662 + +// Avoid using PCH +#include <cerrno> +#include <bits/stdc++.h> +#include <bits/stdtr1c++.h> +#include <bits/extc++.h> + +int or, xor, and; + diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++.cc new file mode 100644 index 00000000000..0528b33a64d --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++.cc @@ -0,0 +1,70 @@ +// FreeBSD wants warning clean system headers: +// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* *-*-dragonfly* } } +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 17.4.1.2 Headers + +#include <bits/stdc++.h> + +// "C" compatibility headers +#include <assert.h> +#ifdef _GLIBCXX_HAVE_COMPLEX_H +#include <complex.h> +#endif +#include <ctype.h> +#include <errno.h> +#ifdef _GLIBCXX_HAVE_FENV_H +#include <fenv.h> +#endif +#include <float.h> +#ifdef _GLIBCXX_HAVE_INTTYPES_H +#include <inttypes.h> +#endif +#include <iso646.h> +#include <limits.h> +#include <locale.h> +#include <math.h> +#include <setjmp.h> +#include <signal.h> +#include <stdarg.h> +#ifdef _GLIBCXX_HAVE_STDBOOL_H +#include <stdbool.h> +#endif +#include <stddef.h> +#ifdef _GLIBCXX_HAVE_STDINT_H +#include <stdint.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef _GLIBCXX_HAVE_TGMATH_H +#include <tgmath.h> +#endif +#include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCHAR_H +#include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H +#include <wctype.h> +#endif diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc new file mode 100644 index 00000000000..67b51cee95c --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc @@ -0,0 +1,117 @@ +// FreeBSD wants warning clean system headers: +// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* *-*-dragonfly* } } +// { dg-options "-std=gnu++14" } +// { dg-do compile } + +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 17.4.1.2 Headers + +#include <bits/stdc++.h> + +// "C" compatibility headers +#include <assert.h> +#ifdef _GLIBCXX_HAVE_COMPLEX_H +#include <complex.h> +#endif +#include <ctype.h> +#include <errno.h> +#ifdef _GLIBCXX_HAVE_FENV_H +#include <fenv.h> +#endif +#include <float.h> +#ifdef _GLIBCXX_HAVE_INTTYPES_H +#include <inttypes.h> +#endif +#include <iso646.h> +#include <limits.h> +#include <locale.h> +#include <math.h> +#include <setjmp.h> +#include <signal.h> +#include <stdarg.h> +#ifdef _GLIBCXX_HAVE_STDBOOL_H +#include <stdbool.h> +#endif +#include <stddef.h> +#ifdef _GLIBCXX_HAVE_STDINT_H +#include <stdint.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef _GLIBCXX_HAVE_TGMATH_H +#include <tgmath.h> +#endif +#include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCHAR_H +#include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H +#include <wctype.h> +#endif + +#include <bits/stdc++.h> + +// "C" compatibility headers +#include <assert.h> +#ifdef _GLIBCXX_HAVE_COMPLEX_H +#include <complex.h> +#endif +#include <ctype.h> +#include <errno.h> +#ifdef _GLIBCXX_HAVE_FENV_H +#include <fenv.h> +#endif +#include <float.h> +#ifdef _GLIBCXX_HAVE_INTTYPES_H +#include <inttypes.h> +#endif +#include <iso646.h> +#include <limits.h> +#include <locale.h> +#include <math.h> +#include <setjmp.h> +#include <signal.h> +#include <stdarg.h> +#ifdef _GLIBCXX_HAVE_STDBOOL_H +#include <stdbool.h> +#endif +#include <stddef.h> +#ifdef _GLIBCXX_HAVE_STDINT_H +#include <stdint.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#ifdef _GLIBCXX_HAVE_TGMATH_H +#include <tgmath.h> +#endif +#include <time.h> +#if __has_include(<uchar.h>) +#include <uchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCHAR_H +#include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H +#include <wctype.h> +#endif diff --git a/libstdc++-v3/testsuite/18_support/pthread_guard.cc b/libstdc++-v3/testsuite/18_support/pthread_guard.cc index ca89d31f862..0618b49569f 100644 --- a/libstdc++-v3/testsuite/18_support/pthread_guard.cc +++ b/libstdc++-v3/testsuite/18_support/pthread_guard.cc @@ -16,7 +16,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-darwin* } } #include <cstdlib> diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc index 3eb68939ea0..fce5068beb0 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/atomic/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc index 85fc71dfd39..867f07a679f 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc @@ -63,11 +63,24 @@ test03() VERIFY( &p->i == &a->i ); } +void +test04() +{ + bool test __attribute__((unused)) = true; + +#if !(defined _GLIBCXX_DEBUG && defined _GLIBCXX_DEBUG_PEDANTIC) + std::shared_ptr<int> p; + auto np = p.operator->(); + VERIFY( np == nullptr ); +#endif +} + int main() { test01(); test02(); test03(); + test04(); return 0; } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc index 3c3b3453ba0..5dfc55b68cc 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc @@ -17,10 +17,10 @@ // 20.6.6.2 Template class shared_ptr [util.smartptr.shared] -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread -std=gnu++11" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads -std=gnu++11" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } #include <memory> #include <random> diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc index 1744ef5a32e..7e013785d75 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc @@ -17,10 +17,10 @@ // 20.6.6.2 Template class shared_ptr [util.smartptr.shared] -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } #include <memory> #include <random> diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy.cc new file mode 100644 index 00000000000..d02e9b93eca --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy.cc @@ -0,0 +1,97 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(0 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(0 == v3.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v3.get_allocator().get_personality()); +} + +void test03() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1, alloc_type(2)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1, alloc_type(3)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(3 == v3.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + test03(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc new file mode 100644 index 00000000000..94e07961168 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/copy_assign.cc @@ -0,0 +1,114 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + v1.assign(1, c); + test_type v3(alloc_type(3)); + v3.assign(100, c); + v3 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(3 == v3.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v4(alloc_type(4)); + v4.assign(1, c); + v4 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(4 == v4.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v5(alloc_type(5)); + v5.assign(100, c); + v5 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(5 == v5.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + v1.assign(1, c); + test_type v3(alloc_type(3)); + v3.assign(100, c); + v3 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v3.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v4(alloc_type(4)); + v4.assign(1, c); + v4 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v4.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v5(alloc_type(5)); + v5.assign(100, c); + v5 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v5.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc new file mode 100644 index 00000000000..4bfd4cabe42 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/minimal.cc @@ -0,0 +1,49 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::SimpleAllocator; + +template class std::basic_string<C,traits, SimpleAllocator<C>>; + +void test01() +{ +#if _GLIBCXX_USE_CXX11_ABI + typedef SimpleAllocator<C> alloc_type; + typedef std::allocator_traits<alloc_type> traits_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v(alloc_type{}); + v.assign(1, c); + v.assign(100, c); +#endif +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move.cc new file mode 100644 index 00000000000..113df8fe9e5 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move.cc @@ -0,0 +1,66 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::uneq_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef uneq_allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(std::move(v1)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef uneq_allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(std::move(v1), alloc_type(2)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move_assign.cc new file mode 100644 index 00000000000..153ffd2810d --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/move_assign.cc @@ -0,0 +1,160 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(4)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(3 == v3.get_allocator().get_personality()); + VERIFY(4 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(6)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(5 == v5.get_allocator().get_personality()); + VERIFY(6 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(8)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(7 == v7.get_allocator().get_personality()); + VERIFY(8 == v8.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(0 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(4)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(0 == v3.get_allocator().get_personality()); + VERIFY(3 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(6)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(0 == v5.get_allocator().get_personality()); + VERIFY(5 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(8)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(0 == v7.get_allocator().get_personality()); + VERIFY(7 == v8.get_allocator().get_personality()); +} + +void test03() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(1)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(3)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(3 == v3.get_allocator().get_personality()); + VERIFY(3 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(5)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(5 == v5.get_allocator().get_personality()); + VERIFY(5 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(7)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(7 == v7.get_allocator().get_personality()); + VERIFY(7 == v8.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + test03(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/noexcept.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/noexcept.cc new file mode 100644 index 00000000000..8733ea186cf --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/noexcept.cc @@ -0,0 +1,61 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + typedef std::allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1; + test_type v2; + // this is a GNU extension for std::allocator + static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} + +void test02() +{ + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + test_type v2(alloc_type(2)); + static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} + +void test03() +{ + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + test_type v2(alloc_type(2)); + static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/swap.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/swap.cc new file mode 100644 index 00000000000..21003eb392d --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/char/swap.cc @@ -0,0 +1,89 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +// It is undefined behaviour to swap() containers wth unequal allocators +// if the allocator doesn't propagate, so ensure the allocators compare +// equal, while still being able to test propagation via get_personality(). +bool +operator==(const propagating_allocator<C, false>&, + const propagating_allocator<C, false>&) +{ + return true; +} + +bool +operator!=(const propagating_allocator<C, false>&, + const propagating_allocator<C, false>&) +{ + return false; +} + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.push_back(C()); + test_type v2(alloc_type(2)); + v2.push_back(C()); + std::swap(v1, v2); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + // swap back so assertions in uneq_allocator::deallocate don't fail + std::swap(v1, v2); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.push_back(C()); + test_type v2(alloc_type(2)); + v2.push_back(C()); + std::swap(v1, v2); + VERIFY(2 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc new file mode 100644 index 00000000000..c95e2eff599 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy.cc @@ -0,0 +1,97 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(0 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(0 == v3.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v3.get_allocator().get_personality()); +} + +void test03() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(v1, alloc_type(2)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v3(v1, alloc_type(3)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(3 == v3.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + test03(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc new file mode 100644 index 00000000000..f69dff74eff --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc @@ -0,0 +1,114 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + v1.assign(1, c); + test_type v3(alloc_type(3)); + v3.assign(100, c); + v3 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(3 == v3.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v4(alloc_type(4)); + v4.assign(1, c); + v4 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(4 == v4.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v5(alloc_type(5)); + v5.assign(100, c); + v5 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(5 == v5.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + v1.assign(1, c); + test_type v3(alloc_type(3)); + v3.assign(100, c); + v3 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v3.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v4(alloc_type(4)); + v4.assign(1, c); + v4 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v4.get_allocator().get_personality()); + + v1.assign(100, c); + test_type v5(alloc_type(5)); + v5.assign(100, c); + v5 = v1; + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v5.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc new file mode 100644 index 00000000000..bfba87cc76b --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc @@ -0,0 +1,49 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::SimpleAllocator; + +template class std::basic_string<C,traits, SimpleAllocator<C>>; + +void test01() +{ +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) + typedef SimpleAllocator<C> alloc_type; + typedef std::allocator_traits<alloc_type> traits_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v(alloc_type{}); + v.assign(1, c); + v.assign(100, c); +#endif +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move.cc new file mode 100644 index 00000000000..88927a63124 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move.cc @@ -0,0 +1,66 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::uneq_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef uneq_allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(std::move(v1)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef uneq_allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(std::move(v1), alloc_type(2)); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc new file mode 100644 index 00000000000..45283a71c70 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc @@ -0,0 +1,160 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(4)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(3 == v3.get_allocator().get_personality()); + VERIFY(4 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(6)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(5 == v5.get_allocator().get_personality()); + VERIFY(6 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(8)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(7 == v7.get_allocator().get_personality()); + VERIFY(8 == v8.get_allocator().get_personality()); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(2)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(0 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(4)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(0 == v3.get_allocator().get_personality()); + VERIFY(3 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(6)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(0 == v5.get_allocator().get_personality()); + VERIFY(5 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(8)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(0 == v7.get_allocator().get_personality()); + VERIFY(7 == v8.get_allocator().get_personality()); +} + +void test03() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + + test_type v1(alloc_type(1)); + v1.assign(1, c); + test_type v2(alloc_type(1)); + v2.assign(1, c); + v2 = std::move(v1); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); + + test_type v3(alloc_type(3)); + v3.assign(1, c); + test_type v4(alloc_type(3)); + v4.assign(100, c); + v4 = std::move(v3); + VERIFY(3 == v3.get_allocator().get_personality()); + VERIFY(3 == v4.get_allocator().get_personality()); + + test_type v5(alloc_type(5)); + v5.assign(100, c); + test_type v6(alloc_type(5)); + v6.assign(1, c); + v6 = std::move(v5); + VERIFY(5 == v5.get_allocator().get_personality()); + VERIFY(5 == v6.get_allocator().get_personality()); + + test_type v7(alloc_type(7)); + v7.assign(100, c); + test_type v8(alloc_type(7)); + v8.assign(100, c); + v8 = std::move(v7); + VERIFY(7 == v7.get_allocator().get_personality()); + VERIFY(7 == v8.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + test03(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc new file mode 100644 index 00000000000..5fb3c1bd8a5 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/noexcept.cc @@ -0,0 +1,61 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +void test01() +{ + typedef std::allocator<C> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1; + test_type v2; + // this is a GNU extension for std::allocator + static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} + +void test02() +{ + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + test_type v2(alloc_type(2)); + static_assert( !noexcept( v1 = std::move(v2) ), "Move assign can throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} + +void test03() +{ + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + test_type v2(alloc_type(2)); + static_assert( noexcept( v1 = std::move(v2) ), "Move assign cannot throw" ); + static_assert( noexcept( v1.swap(v2) ), "Swap cannot throw" ); +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc new file mode 100644 index 00000000000..5490f9e7d03 --- /dev/null +++ b/libstdc++-v3/testsuite/21_strings/basic_string/allocator/wchar_t/swap.cc @@ -0,0 +1,89 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11" } + +#include <string> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +#if _GLIBCXX_USE_CXX11_ABI && defined(_GLIBCXX_USE_WCHAR_T) +using C = char; +const C c = 'a'; +using traits = std::char_traits<C>; + +using __gnu_test::propagating_allocator; + +// It is undefined behaviour to swap() containers wth unequal allocators +// if the allocator doesn't propagate, so ensure the allocators compare +// equal, while still being able to test propagation via get_personality(). +bool +operator==(const propagating_allocator<C, false>&, + const propagating_allocator<C, false>&) +{ + return true; +} + +bool +operator!=(const propagating_allocator<C, false>&, + const propagating_allocator<C, false>&) +{ + return false; +} + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, false> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.push_back(C()); + test_type v2(alloc_type(2)); + v2.push_back(C()); + std::swap(v1, v2); + VERIFY(1 == v1.get_allocator().get_personality()); + VERIFY(2 == v2.get_allocator().get_personality()); + // swap back so assertions in uneq_allocator::deallocate don't fail + std::swap(v1, v2); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + typedef propagating_allocator<C, true> alloc_type; + typedef std::basic_string<C, traits, alloc_type> test_type; + test_type v1(alloc_type(1)); + v1.push_back(C()); + test_type v2(alloc_type(2)); + v2.push_back(C()); + std::swap(v1, v2); + VERIFY(2 == v1.get_allocator().get_personality()); + VERIFY(1 == v2.get_allocator().get_personality()); +} + +int main() +{ + test01(); + test02(); + return 0; +} +#else +int main() +{ + // COW strings don't support C++11 allocators +} +#endif diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc index e52ab5496db..a43d7f851d6 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/operators/char/1.cc @@ -36,9 +36,11 @@ int test01(void) str1 = std::string("8-chars_") + "8-chars_"; str1.c_str(); // printf("1:%s\n", str1.c_str()); + VERIFY( str1 == "8-chars_8-chars_" ); str2 = str1 + "7-chars"; // printf("2:%s\n", str1.c_str()); //str1 is gone str1.c_str(); + VERIFY( str1 == "8-chars_8-chars_" ); return 0; } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/pthread18185.cc b/libstdc++-v3/testsuite/21_strings/basic_string/pthread18185.cc index a118c4a47a8..528aab2ead4 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/pthread18185.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/pthread18185.cc @@ -16,7 +16,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/pthread33394.cc b/libstdc++-v3/testsuite/21_strings/basic_string/pthread33394.cc index 4674974f4e3..9423253d767 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/pthread33394.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/pthread33394.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* } } // { dg-additional-options "-DITERATIONS=1000" { target simulator } } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc b/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc index 603dfcc9e86..80358e16fb9 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/pthread4.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc index 0789717fdbd..ce9cc9bdfd2 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/4.cc @@ -73,11 +73,7 @@ void test04() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const ext_type* efrom_next; const int_type i_lit[] = { @@ -99,9 +95,7 @@ void test04() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; int esize = strlen(e_lit); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc index 675b2edbbcc..852bf1b62eb 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/8.cc @@ -72,11 +72,7 @@ void test08() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const ext_type* efrom_next; const int_type i_lit[] = { @@ -98,9 +94,7 @@ void test08() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; int esize = strlen(e_lit); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc index 3974f9b6532..fa411372378 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc @@ -72,11 +72,7 @@ void test09() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const ext_type* efrom = e_lit; const ext_type* efrom_next; @@ -99,9 +95,7 @@ void test09() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; int esize = strlen(e_lit); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc index ba35a379f73..d2f29733de6 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/wchar_t/4.cc @@ -68,11 +68,7 @@ void test04() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const int_type i_lit[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -93,9 +89,7 @@ void test04() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; int esize = strlen(e_lit); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc index 0111401d939..db3068e2327 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/wchar_t/4.cc @@ -70,11 +70,7 @@ void test04() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const int_type i_lit[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -95,9 +91,7 @@ void test04() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const int_type* ifrom_next; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc index bc020ddd248..d61c05f51e8 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/wchar_t/4.cc @@ -69,9 +69,7 @@ void test04() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const int_type* ifrom_next; diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc index e8102e44bf4..e42678661b9 100644 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc +++ b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-1.cc @@ -1,4 +1,4 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } // { dg-require-namedlocale "en_US" } diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc index d01925b0941..279c9833450 100644 --- a/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc +++ b/libstdc++-v3/testsuite/22_locale/locale/cons/12658_thread-2.cc @@ -1,4 +1,4 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } // { dg-require-namedlocale "en_US" } diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc index 89a26077bbe..af17327e793 100644 --- a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc +++ b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc @@ -17,7 +17,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc index 45dbd3cdf42..8cf8e63588d 100644 --- a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc +++ b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc index 01e74cdf92b..91bd9a17d35 100644 --- a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc +++ b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc index 75729ffab1a..9419ac8d023 100644 --- a/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/requirements/uses_allocator.cc @@ -20,10 +20,51 @@ #include <queue> +using test_type = std::priority_queue<int>; +using container = test_type::container_type; +using comp = std::less<container::value_type>; + template<typename A> - using uses_allocator = std::uses_allocator<std::priority_queue<int>, A>; + using uses_allocator = std::uses_allocator<test_type, A>; + +template<typename... Args> + using is_constructible = std::is_constructible<test_type, Args...>; + +// test with invalid allocator +using alloc_type = container::allocator_type; -static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); +static_assert( uses_allocator<alloc_type>::value, "valid allocator" ); +static_assert( is_constructible<const alloc_type&>::value, + "priority_queue(const Alloc&)" ); +static_assert( is_constructible<const comp&, const alloc_type&>::value, + "priority_queue(const Cmp&, const Alloc&)" ); +static_assert( is_constructible<const comp&, const container&, + const alloc_type&>::value, + "priority_queue(const Cmp&, const Container&, const Alloc&)" ); +static_assert( is_constructible<const comp&, container&&, + const alloc_type&>::value, + "priority_queue(const Cmp&, const Container&, const Alloc&)" ); +static_assert( is_constructible<const test_type&, const alloc_type&>::value, + "priority_queue(const priority_queue&, const Alloc&)" ); +static_assert( is_constructible<test_type&&, const alloc_type&>::value, + "priority_queue(const priority_queue&, const Alloc&)" ); + +// test with invalid allocator struct X { }; + static_assert( !uses_allocator<X>::value, "invalid allocator" ); + +static_assert( !is_constructible<const X&>::value, + "priority_queue(const NonAlloc&)" ); +static_assert( !is_constructible<const comp&, const X&>::value, + "priority_queue(const Cmp&, const NonAlloc&)" ); +static_assert( !is_constructible<const comp&, const container&, + const X&>::value, + "priority_queue(const Cmp&, const Cont&, const NonAlloc&)" ); +static_assert( !is_constructible<const comp&, container&&, const X&>::value, + "priority_queue(const Cmp&, const Cont&, const NonAlloc&)" ); +static_assert( !is_constructible<const test_type&, const X&>::value, + "priority_queue(const priority_queue&, const NonAlloc&)" ); +static_assert( !is_constructible<test_type&&, const X&>::value, + "priority_queue(const priority_queue&, const NonAlloc&)" ); diff --git a/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc index 714cb9ee090..6eb107e0ce8 100644 --- a/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc +++ b/libstdc++-v3/testsuite/23_containers/queue/requirements/uses_allocator.cc @@ -20,10 +20,43 @@ #include <queue> +using test_type = std::queue<int>; +using container = test_type::container_type; + template<typename A> - using uses_allocator = std::uses_allocator<std::queue<int>, A>; + using uses_allocator = std::uses_allocator<test_type, A>; + +template<typename... Args> + using is_constructible = std::is_constructible<test_type, Args...>; + +// test with valid allocator +using alloc_type = container::allocator_type; -static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); +static_assert( uses_allocator<alloc_type>::value, "valid allocator" ); +static_assert( is_constructible<const alloc_type&>::value, + "queue(const Alloc&)" ); +static_assert( is_constructible<const container&, const alloc_type&>::value, + "queue(const container_type&, const Alloc&)" ); +static_assert( is_constructible<container&&, const alloc_type&>::value, + "queue(const container_type&, const Alloc&)" ); +static_assert( is_constructible<const test_type&, const alloc_type&>::value, + "queue(const queue&, const Alloc&)" ); +static_assert( is_constructible<test_type&&, const alloc_type&>::value, + "queue(const queue&, const Alloc&)" ); + +// test with invalid allocator struct X { }; + static_assert( !uses_allocator<X>::value, "invalid allocator" ); + +static_assert( !is_constructible<const X&>::value, + "queue(const NonAlloc&)" ); +static_assert( !is_constructible<const container&, const X&>::value, + "queue(const container_type&, const NonAlloc&)" ); +static_assert( !is_constructible<container&&, const X&>::value, + "queue(const container_type&, const NonAlloc&)" ); +static_assert( !is_constructible<const test_type&, const X&>::value, + "queue(const queue&, const NonAlloc&)" ); +static_assert( !is_constructible<test_type&&, const X&>::value, + "queue(const queue&, const NonAlloc&)" ); diff --git a/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc b/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc index ab8990f088b..91416083fc5 100644 --- a/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc +++ b/libstdc++-v3/testsuite/23_containers/stack/requirements/uses_allocator.cc @@ -20,10 +20,43 @@ #include <stack> +using test_type = std::stack<int>; +using container = test_type::container_type; + template<typename A> - using uses_allocator = std::uses_allocator<std::stack<int>, A>; + using uses_allocator = std::uses_allocator<test_type, A>; + +template<typename... Args> + using is_constructible = std::is_constructible<test_type, Args...>; + +// test with valid allocator +using alloc_type = container::allocator_type; -static_assert( uses_allocator<std::allocator<int>>::value, "valid allocator" ); +static_assert( uses_allocator<alloc_type>::value, "valid allocator" ); +static_assert( is_constructible<const alloc_type&>::value, + "stack(const Alloc&)" ); +static_assert( is_constructible<const container&, const alloc_type&>::value, + "stack(const container_type&, const Alloc&)" ); +static_assert( is_constructible<container&&, const alloc_type&>::value, + "stack(const container_type&, const Alloc&)" ); +static_assert( is_constructible<const test_type&, const alloc_type&>::value, + "stack(const stack&, const Alloc&)" ); +static_assert( is_constructible<test_type&&, const alloc_type&>::value, + "stack(const stack&, const Alloc&)" ); + +// test with invalid allocator struct X { }; + static_assert( !uses_allocator<X>::value, "invalid allocator" ); + +static_assert( !is_constructible<const X&>::value, + "stack(const NonAlloc&)" ); +static_assert( !is_constructible<const container&, const X&>::value, + "stack(const container_type&, const NonAlloc&)" ); +static_assert( !is_constructible<container&&, const X&>::value, + "stack(const container_type&, const NonAlloc&)" ); +static_assert( !is_constructible<const test_type&, const X&>::value, + "stack(const stack&, const NonAlloc&)" ); +static_assert( !is_constructible<test_type&&, const X&>::value, + "stack(const stack&, const NonAlloc&)" ); diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc index a67ac5a42a6..cef686f9751 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/debug/multithreaded_swap.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-debug-mode "" } diff --git a/libstdc++-v3/testsuite/24_iterators/operations/next_neg.cc b/libstdc++-v3/testsuite/24_iterators/operations/next_neg.cc new file mode 100644 index 00000000000..881307eb05b --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/operations/next_neg.cc @@ -0,0 +1,42 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11 -D_GLIBCXX_CONCEPT_CHECKS" } +// { dg-do compile } + +#include <iterator> + +struct X {}; + +namespace std +{ + template<> + struct iterator_traits<const X*> : iterator_traits<X*> + { + using iterator_category = input_iterator_tag; + using reference = const X&; + using pointer = const X*; + }; +} + +void +test01() +{ + const X array[1] = { }; + std::next(array); + // { dg-error "input_iterator" "" { target *-*-* } 220 } +} diff --git a/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc new file mode 100644 index 00000000000..513e0e80b0b --- /dev/null +++ b/libstdc++-v3/testsuite/24_iterators/operations/prev_neg.cc @@ -0,0 +1,42 @@ +// Copyright (C) 2015 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++11 -D_GLIBCXX_CONCEPT_CHECKS" } +// { dg-do compile } + +#include <iterator> + +struct Y {}; + +namespace std +{ + template<> + struct iterator_traits<const Y*> : iterator_traits<Y*> + { + using iterator_category = forward_iterator_tag; + using reference = const Y&; + using pointer = const Y*; + }; +} + +void +test02() +{ + const Y array[1] = { }; + std::prev(array + 1); + // { dg-error "forward_iterator" "" { target *-*-* } 220 } +} diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/1.cc index 165aecd2033..f452a744a87 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekoff/wchar_t/1.cc @@ -57,11 +57,7 @@ void test01() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -82,9 +78,7 @@ void test01() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/wchar_t/9874.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/wchar_t/9874.cc index 67de261f208..a2f30e6884d 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/wchar_t/9874.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/seekpos/wchar_t/9874.cc @@ -59,11 +59,7 @@ void test01() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -84,9 +80,7 @@ void test01() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/1.cc index 554592aa768..3b586aa727c 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/1.cc @@ -53,11 +53,7 @@ void test01() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -78,9 +74,7 @@ void test01() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc index 143c67fe4d0..3c5cf1957ef 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/2.cc @@ -53,11 +53,7 @@ void test02() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -78,9 +74,7 @@ void test02() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc index 5db52ad2853..95ff911a789 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/underflow/wchar_t/3.cc @@ -53,11 +53,7 @@ void test03() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -78,9 +74,7 @@ void test03() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc b/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc index 40cfcbac69b..a170896eacb 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ofstream/pthread2.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc index 54da008825e..8b5e30f72e4 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostringstream/pthread3.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc index ad267765d0d..4532584cc50 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/10.cc @@ -57,11 +57,7 @@ void test10() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; size_t e_size = strlen(e_lit); const wchar_t i_lit[] = { @@ -83,9 +79,7 @@ void test10() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; size_t i_size = wcslen(i_lit); diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc index ee2bf9aff70..916100a8ef9 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/11.cc @@ -57,11 +57,7 @@ void test11() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; size_t e_size = strlen(e_lit); const wchar_t i_lit[] = { @@ -83,9 +79,7 @@ void test11() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; size_t i_size = wcslen(i_lit); diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc index 99181fc8098..6b432de7a69 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/12.cc @@ -62,11 +62,7 @@ void test12() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -87,9 +83,7 @@ void test12() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc index 1487cd87409..1fe9c4176ea 100644 --- a/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc +++ b/libstdc++-v3/testsuite/27_io/objects/wchar_t/13.cc @@ -61,11 +61,7 @@ void test13() "\xa0\x95\xe0\xa0\x96\xe0\xa0\x97\x1\x2\x4\x8\x10\x20@\xc2\x80" "\xc4\x80\xc8\x80\xd0\x80\xe0\xa0\x80\xe1\x80\x80\xe2\x80\x80" "\xe4\x80\x80\xe8\x80\x80\xf0\x90\x80\x80\xf0\xa0\x80\x80\xf1" - "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80\xf8\x88\x80\x80" - "\x80\xf8\x90\x80\x80\x80\xf8\xa0\x80\x80\x80\xf9\x80\x80\x80" - "\x80\xfa\x80\x80\x80\x80\xfc\x84\x80\x80\x80\x80\xfc\x88\x80" - "\x80\x80\x80\xfc\x90\x80\x80\x80\x80\xfc\xa0\x80\x80\x80\x80" - "\xfd\x80\x80\x80\x80\x80"; + "\x80\x80\x80\xf2\x80\x80\x80\xf4\x80\x80\x80"; const wchar_t wstr[] = { 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, @@ -86,9 +82,7 @@ void test13() 0x80c, 0x80d, 0x80e, 0x80f, 0x810, 0x811, 0x812, 0x813, 0x814, 0x815, 0x816, 0x817, 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, L'@', 0x80, 0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, - 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x200000, 0x400000, - 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, - 0x20000000, 0x40000000, 0x0 + 0x10000, 0x20000, 0x40000, 0x80000, 0x100000, 0x0 }; const size_t clen = sizeof(cstr) / sizeof(cstr[0]); diff --git a/libstdc++-v3/testsuite/30_threads/async/42819.cc b/libstdc++-v3/testsuite/30_threads/async/42819.cc index e4cdfdbe21f..edac62011ea 100644 --- a/libstdc++-v3/testsuite/30_threads/async/42819.cc +++ b/libstdc++-v3/testsuite/30_threads/async/42819.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/49668.cc b/libstdc++-v3/testsuite/30_threads/async/49668.cc index 29c83354913..b7cc137eac8 100644 --- a/libstdc++-v3/testsuite/30_threads/async/49668.cc +++ b/libstdc++-v3/testsuite/30_threads/async/49668.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/54297.cc b/libstdc++-v3/testsuite/30_threads/async/54297.cc index c12954923e8..861a0c097c5 100644 --- a/libstdc++-v3/testsuite/30_threads/async/54297.cc +++ b/libstdc++-v3/testsuite/30_threads/async/54297.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/any.cc b/libstdc++-v3/testsuite/30_threads/async/any.cc index 665d3b8d7a4..d110d733620 100644 --- a/libstdc++-v3/testsuite/30_threads/async/any.cc +++ b/libstdc++-v3/testsuite/30_threads/async/any.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/async.cc b/libstdc++-v3/testsuite/30_threads/async/async.cc index 2dda723f2e2..909b29c0cdb 100644 --- a/libstdc++-v3/testsuite/30_threads/async/async.cc +++ b/libstdc++-v3/testsuite/30_threads/async/async.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/launch.cc b/libstdc++-v3/testsuite/30_threads/async/launch.cc index 90b35e9d015..735df268266 100644 --- a/libstdc++-v3/testsuite/30_threads/async/launch.cc +++ b/libstdc++-v3/testsuite/30_threads/async/launch.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc b/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc index 0c0ac3b9e56..db1b9f50605 100644 --- a/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc +++ b/libstdc++-v3/testsuite/30_threads/async/lwg2021.cc @@ -15,10 +15,10 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/async/sync.cc b/libstdc++-v3/testsuite/30_threads/async/sync.cc index 9e14071657a..627fa4d74fe 100644 --- a/libstdc++-v3/testsuite/30_threads/async/sync.cc +++ b/libstdc++-v3/testsuite/30_threads/async/sync.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/call_once/39909.cc b/libstdc++-v3/testsuite/30_threads/call_once/39909.cc index 3da6bfe92f5..dcab37dd067 100644 --- a/libstdc++-v3/testsuite/30_threads/call_once/39909.cc +++ b/libstdc++-v3/testsuite/30_threads/call_once/39909.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/call_once/49668.cc b/libstdc++-v3/testsuite/30_threads/call_once/49668.cc index 33d43b3a43a..f790aef7d59 100644 --- a/libstdc++-v3/testsuite/30_threads/call_once/49668.cc +++ b/libstdc++-v3/testsuite/30_threads/call_once/49668.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/call_once/60497.cc b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc index 222feb4299d..8d9c97d9f0a 100644 --- a/libstdc++-v3/testsuite/30_threads/call_once/60497.cc +++ b/libstdc++-v3/testsuite/30_threads/call_once/60497.cc @@ -1,7 +1,7 @@ -// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc b/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc index 39da25ec847..1504483cd7c 100644 --- a/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc +++ b/libstdc++-v3/testsuite/30_threads/call_once/call_once1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc index 7ad87143214..6072d3f7f25 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/54185.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin1[1-9]* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin1[1-9]* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc index b8c557d8674..26c2c92b7ac 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc index 8ded3318e1f..f491204027a 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc index 04945f1cace..88b6ca410d3 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc index 535278b9dcd..152f8c6d050 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc index 2eee7d6e1ce..83b987360c4 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/members/53841.cc @@ -1,7 +1,7 @@ -// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* hppa*-hp-hpux11* } } +// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* hppa*-hp-hpux11* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* hppa*-hp-hpux11* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc index b565bc575b9..767128afd7e 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable/native_handle/typesizes.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc index 1cede5df0f6..beb9583b920 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/50862.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-sched-yield "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/53830.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/53830.cc index 85ffd2e4790..0cbfbf0ad7a 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/53830.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/53830.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-sched-yield "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc index 1da54f409ab..cfc833553bd 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc index 485756f2c63..6d1d079354d 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc b/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc index 75d8ac39eab..b9a29e79540 100644 --- a/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc +++ b/libstdc++-v3/testsuite/30_threads/condition_variable_any/members/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/cons/move.cc b/libstdc++-v3/testsuite/30_threads/future/cons/move.cc index 39f7cbb68b4..e4ed0cbd7a5 100644 --- a/libstdc++-v3/testsuite/30_threads/future/cons/move.cc +++ b/libstdc++-v3/testsuite/30_threads/future/cons/move.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/45133.cc b/libstdc++-v3/testsuite/30_threads/future/members/45133.cc index 73775812a04..e3c47b2c7b2 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/45133.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/45133.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/get.cc b/libstdc++-v3/testsuite/30_threads/future/members/get.cc index 902d041b193..4f4e23c96d0 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/get.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/get.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/get2.cc b/libstdc++-v3/testsuite/30_threads/future/members/get2.cc index ad7e28224b5..b5eae1fe343 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/get2.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/get2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/share.cc b/libstdc++-v3/testsuite/30_threads/future/members/share.cc index 94102b8a07a..4af10c66147 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/share.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/share.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/valid.cc b/libstdc++-v3/testsuite/30_threads/future/members/valid.cc index 2fa179479e9..1322c78ffb1 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/valid.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/valid.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/wait.cc b/libstdc++-v3/testsuite/30_threads/future/members/wait.cc index 8278ab8cc88..3b4e06cee06 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/wait.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/wait.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc b/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc index 0d34c71598a..3960d0560e3 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/wait_for.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc b/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc index fb1f4098ddf..48e3caf7277 100644 --- a/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc +++ b/libstdc++-v3/testsuite/30_threads/future/members/wait_until.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/lock/1.cc b/libstdc++-v3/testsuite/30_threads/lock/1.cc index c731ce97cc5..d55d45e19ac 100644 --- a/libstdc++-v3/testsuite/30_threads/lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/lock/2.cc b/libstdc++-v3/testsuite/30_threads/lock/2.cc index 54d1d2f9909..080e8c71f77 100644 --- a/libstdc++-v3/testsuite/30_threads/lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/lock/3.cc b/libstdc++-v3/testsuite/30_threads/lock/3.cc index 7a9b9da621b..f9406fc7130 100644 --- a/libstdc++-v3/testsuite/30_threads/lock/3.cc +++ b/libstdc++-v3/testsuite/30_threads/lock/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/lock/4.cc b/libstdc++-v3/testsuite/30_threads/lock/4.cc index 89a81069a19..15542dde6cf 100644 --- a/libstdc++-v3/testsuite/30_threads/lock/4.cc +++ b/libstdc++-v3/testsuite/30_threads/lock/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc index e972da37737..54d017cccda 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc index 51d743d5fcb..49e904807f9 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/dest/destructor_locked.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc index 01546982337..ba2c68940a1 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc index e4bb36bd71f..9d98bea40a9 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc index d64d0574997..e3d554a2655 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/native_handle/typesizes.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc index 97c0ebb1433..5a3d919f50c 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc index b80c0efdbec..675b9c0c451 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/try_lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc index 74ed90906f6..8e275e9792e 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/unlock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/mutex/unlock/2.cc b/libstdc++-v3/testsuite/30_threads/mutex/unlock/2.cc index 02464cda677..c9280a2b8cd 100644 --- a/libstdc++-v3/testsuite/30_threads/mutex/unlock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/mutex/unlock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc index beac56e6577..6f630b8feed 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc index bda0d6d9fcd..c8d55ff1d18 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/60564.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/1.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/1.cc index 58e5a168738..658dea44767 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/2.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/2.cc index 56d2d1e52a6..b986319ea17 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/2.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc index 95a1a615813..df94f721fc6 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc index e36fd3829e6..7b384efe8de 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc @@ -1,7 +1,7 @@ -// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do compile { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc index ae721c38430..5a4770349a1 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/alloc.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move.cc index 07419669426..9e5629e1485 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move_assign.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move_assign.cc index a700af3a566..61cc0e2bcb3 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move_assign.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/move_assign.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/at_thread_exit.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/at_thread_exit.cc index c093fdd3707..564bc9d417b 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/at_thread_exit.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/at_thread_exit.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc index d319e96f82b..acec52e64d3 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future2.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future2.cc index f31bdec4415..e3a4f93acb4 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future2.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/get_future2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc index 2d3863cfdc9..cc583672167 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc index 4fcbfce1e76..1bf60a26c3e 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc index e9afe34fbb2..74728fcda18 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc index 72a70d26fd0..b0ee20f4dda 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc index 44941526493..1e2020ec532 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/invoke5.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset.cc index 872e314c01e..c5d0907b85d 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc index 428cb0ed9cb..662d97b90e3 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/reset2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/swap.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/swap.cc index 049dfb789d5..dc9bafec9ae 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/swap.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/swap.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/members/valid.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/members/valid.cc index dc311a33c72..034266cdb76 100644 --- a/libstdc++-v3/testsuite/30_threads/packaged_task/members/valid.cc +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/members/valid.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/60966.cc b/libstdc++-v3/testsuite/30_threads/promise/60966.cc index 517d1d970a7..99be20466da 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/60966.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/60966.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/1.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/1.cc index b39fa28ab8b..e839a82a506 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc index d01dd4e8cd5..516b3a245a9 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/cons/alloc.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc index 8b07b8adda9..7278eb569a1 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/cons/move.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc b/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc index bdf33e2b90e..fbaa820b52b 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/at_thread_exit.cc b/libstdc++-v3/testsuite/30_threads/promise/members/at_thread_exit.cc index af8b78e8587..40b55271332 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/at_thread_exit.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/at_thread_exit.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc b/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc index f25ae09c2f0..0ff85fe8d85 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/get_future.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/get_future2.cc b/libstdc++-v3/testsuite/30_threads/promise/members/get_future2.cc index f06787c49f8..7287f6fc84a 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/get_future2.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/get_future2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc b/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc index 2313a8a5bfe..280afb249d5 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/set_exception.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc b/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc index 8fdcfa30db3..b380c710dbb 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/set_exception2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc b/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc index 5e8de7a27ed..27893e4e6ac 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/set_value.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc b/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc index 6f2e08ec2f7..0fe2220a18f 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/set_value2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc b/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc index c54a12317d4..031306b0ee1 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/set_value3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc b/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc index 9aa2d37b585..ab7abdb4a85 100644 --- a/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc +++ b/libstdc++-v3/testsuite/30_threads/promise/members/swap.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc index ea58a817480..2a0e5a852f0 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc index be3b0a51902..016ca105ad6 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/dest/destructor_locked.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/lock/1.cc index 39ea60c6962..0bd71e70e2c 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc index 0ce566edc20..fe5f78e8b73 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc index aeba54de7cd..de1d74cfd58 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/native_handle/typesizes.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/1.cc index aaceed16851..719778ef277 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/2.cc index ae80eba2356..a7c37490b80 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/try_lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/1.cc index b85bd1d7a6c..ccbc08939b2 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/2.cc index 68bd5d0ed39..a330a0b212d 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_mutex/unlock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc index 047c92256a7..6e4c7f508e7 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc index 6e50632dfcc..62264feb147 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/assign_neg.cc @@ -1,7 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++11" } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc index 480c1cc1d9e..4f2c3cc3f01 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/cons/copy_neg.cc @@ -1,7 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++11" } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc index ac50bcd31e0..e06caecf51b 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/dest/destructor_locked.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc index f3846c8af3b..104f0a96a3e 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc index 63716a2834c..d4528b58a59 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/lock/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc index 4c7be9f1546..5e61750a3e2 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads-timed "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc index 67ae754c11f..0370c26fdf7 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/native_handle/typesizes.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads-timed "" } diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc index 72dcf302da6..f56afc81f0a 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc index c56e9b41c39..5ec212bdf78 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options "-std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options "-std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options "-std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options "-std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc index a1def602832..c17525f8589 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc index bedd1d2940e..e9bc37135f9 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc index f9636903e05..33ec4f2ff40 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_for/3.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc index 72dcf302da6..f56afc81f0a 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc index aae64ee19e2..367134a3957 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/try_lock_until/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc index 997af99453e..44e0b15d084 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/2.cc b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/2.cc index de5592a6e4c..26ca5c5618a 100644 --- a/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/recursive_timed_mutex/unlock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/cons/move.cc b/libstdc++-v3/testsuite/30_threads/shared_future/cons/move.cc index cbc829981bf..d36d6364d66 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/cons/move.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/cons/move.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/45133.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/45133.cc index bd4391b0e5d..54b3575b78d 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/45133.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/45133.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc index 0ef44b4e3e4..84492473ef2 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/get.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc index 05ff4e1d4e1..36c77c5b1b2 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/get2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc index 3306927ff9b..2d8598b5873 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/valid.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc index 327f26de3a3..1ef8767733c 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc index 0faf34dcf77..acce9f9f685 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_for.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc index 0056e370b96..7d5e04a34e0 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_future/members/wait_until.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-atomic-builtins "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/1.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/1.cc index 55eaafc9d26..7a495db9333 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/2.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/2.cc index 9cbb054d5b6..0dc267083f9 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/2.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/3.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/3.cc index 25154bd5a43..415095f36d7 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/3.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/4.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/4.cc index 4886e114dad..5783cde39b3 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/4.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc index 9ec0498620a..7f82937ea7c 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/5.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc index 2074bbefd48..cafdc8b6277 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/cons/6.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/1.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/1.cc index 39160cdbc1e..95dcd895088 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/2.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/2.cc index e4a345bc65c..70da4988af0 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/2.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc index 4b653eafe43..6de704ca322 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc index afeefa2aca0..5c80c2d2376 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/locking/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/30_threads/shared_lock/modifiers/1.cc b/libstdc++-v3/testsuite/30_threads/shared_lock/modifiers/1.cc index 9f200395537..6e768733787 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_lock/modifiers/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_lock/modifiers/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/shared_mutex/cons/1.cc index f54406dc93a..abf2107c516 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_mutex/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/1.cc index d5ab9620e48..c6b9b993315 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/2.cc index be9e3ae42f2..97c95771dcd 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_mutex/try_lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/shared_mutex/unlock/1.cc index e0915919907..0fffa995823 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_mutex/unlock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++17 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++17 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc index bf92b73fc88..9d80adf0f9a 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc index e0d961606bb..fc07fda73fc 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc index 1cf7a30c4d0..39ffd4e7548 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/3.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/3.cc index e9f728e0955..34f9644500a 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/3.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/unlock/1.cc index b6ca4bf248b..f158d5f0639 100644 --- a/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/unlock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/this_thread/1.cc b/libstdc++-v3/testsuite/30_threads/this_thread/1.cc index 642a0a123d6..38e2b1e2ce4 100644 --- a/libstdc++-v3/testsuite/30_threads/this_thread/1.cc +++ b/libstdc++-v3/testsuite/30_threads/this_thread/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/this_thread/2.cc b/libstdc++-v3/testsuite/30_threads/this_thread/2.cc index 4c0d5fa5a5b..655b9dcaa1b 100644 --- a/libstdc++-v3/testsuite/30_threads/this_thread/2.cc +++ b/libstdc++-v3/testsuite/30_threads/this_thread/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/this_thread/3.cc b/libstdc++-v3/testsuite/30_threads/this_thread/3.cc index 9bdaf2f16db..27b5f297aa8 100644 --- a/libstdc++-v3/testsuite/30_threads/this_thread/3.cc +++ b/libstdc++-v3/testsuite/30_threads/this_thread/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-sleep "" } diff --git a/libstdc++-v3/testsuite/30_threads/this_thread/4.cc b/libstdc++-v3/testsuite/30_threads/this_thread/4.cc index 095720681fc..be3ddde4e3c 100644 --- a/libstdc++-v3/testsuite/30_threads/this_thread/4.cc +++ b/libstdc++-v3/testsuite/30_threads/this_thread/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-sleep "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/1.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/1.cc index b20eb50bfb3..b1d87be839c 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc index 116097f490f..c28b5681b2c 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc index 01affd47937..9787f88989e 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc index 8eb9f5e17d1..ae70da00171 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc index 803c4d11f79..0c4e87cdb5a 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/49668.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc index 610e324abe1..f45afeb0e5e 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/5.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc index f72088a560a..b1049e54f5c 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/6.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc index 5808b1f805f..d2de9404278 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/7.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc index 65bd5d3a6cd..7c0e931d3f7 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/8.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc index c13f9bb3598..4f4d5cc74c1 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/9.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc b/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc index 90914a1a8e9..4612f15b695 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/cons/moveable.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/1.cc b/libstdc++-v3/testsuite/30_threads/thread/members/1.cc index 6898771bf53..a53cbcc46a5 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/1.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/2.cc b/libstdc++-v3/testsuite/30_threads/thread/members/2.cc index 361581ff2c9..752f7bc5ba5 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/2.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/3.cc b/libstdc++-v3/testsuite/30_threads/thread/members/3.cc index 6cc650da52d..144d6787cf5 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/3.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/4.cc b/libstdc++-v3/testsuite/30_threads/thread/members/4.cc index a26e7483479..941db0c3c1c 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/4.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/5.cc b/libstdc++-v3/testsuite/30_threads/thread/members/5.cc index 9b469944148..43b8a4ac3e7 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/5.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/5.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc b/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc index eb3dd68c486..e01c09d8c84 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/members/hardware_concurrency.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } // { dg-require-nprocs "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc b/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc index b8c709c6785..79b9708ffe0 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/native_handle/cancel.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc index 9eba07246ba..8938b4f8f37 100644 --- a/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc +++ b/libstdc++-v3/testsuite/30_threads/thread/swap/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc index 1e283d7c650..d6664fb9db3 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc index d953a4cfb3a..c6ba4028641 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/assign_neg.cc @@ -1,7 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++11" } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc index 1acb2318bb5..1874b042deb 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/cons/copy_neg.cc @@ -1,7 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++11" } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc index 35d7d06dda8..5e7d2731846 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/dest/destructor_locked.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc index 4304f0b951d..26d4c784c82 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/lock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc index 30f076b9f84..bdd62612686 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads-timed "" } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc index 18e4c723554..1860cc007d1 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/native_handle/typesizes.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads-timed "" } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/standard_layout.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/standard_layout.cc index f94228e8a76..e053aeb0c4f 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/standard_layout.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/requirements/standard_layout.cc @@ -1,7 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++11" } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2009-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc index b2d2b975a1c..029f779d0cf 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc index 4a08fcd18ac..5dc33165877 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc index 63e93c152cc..5791aa1b6f2 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc index 156060accbb..8bfe85b6776 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc index b06e928ce74..082e4ef65c0 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_for/3.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc index b2d2b975a1c..029f779d0cf 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc index 4a08fcd18ac..5dc33165877 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/2.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc index f2c960c49b2..25093f8d1bd 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/try_lock_until/57641.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2013-2015 Free Software Foundation, Inc. // @@ -49,21 +48,21 @@ struct clock }; std::timed_mutex mx; -bool test = false; +bool locked = false; void f() { - test = mx.try_lock_until(clock::now() + C::milliseconds(1)); + locked = mx.try_lock_until(clock::now() + C::milliseconds(1)); } int main() { - bool test = false; + bool test __attribute__((unused)) = true; std::lock_guard<std::timed_mutex> l(mx); auto start = C::system_clock::now(); std::thread t(f); t.join(); auto stop = C::system_clock::now(); VERIFY( (stop - start) < C::seconds(9) ); - VERIFY( !test ); + VERIFY( !locked ); } diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc index 04aec91492a..812e2d833e5 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/1.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/2.cc b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/2.cc index 14e39dee625..94a542fb24b 100644 --- a/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/timed_mutex/unlock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/1.cc b/libstdc++-v3/testsuite/30_threads/try_lock/1.cc index ae7f316a61a..ede67993f46 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/1.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/2.cc b/libstdc++-v3/testsuite/30_threads/try_lock/2.cc index 4e485ae72ea..68dee154fea 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/2.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/3.cc b/libstdc++-v3/testsuite/30_threads/try_lock/3.cc index a03036d51de..791bd4a8ec1 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/3.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc index 64c7489fcd0..91449491c54 100644 --- a/libstdc++-v3/testsuite/30_threads/try_lock/4.cc +++ b/libstdc++-v3/testsuite/30_threads/try_lock/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/1.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/1.cc index 7a0e2ad2528..8867e1cba60 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/1.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/2.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/2.cc index 07c05eedf2f..a7192a743eb 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/2.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/3.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/3.cc index 274d55d889a..5d067ebf7d1 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/3.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/3.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/4.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/4.cc index 0764462f9f0..9ee9f5b1fc5 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/4.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/4.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/5.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/5.cc index c21049e6956..b62af9b8d05 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/5.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/5.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/6.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/6.cc index 5965eda87ca..36b1cd6beba 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/cons/6.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/cons/6.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/1.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/1.cc index 31f6c2565c1..df25dce175d 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/1.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc index ec56c4327aa..73d467864bb 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/2.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc index 071effb9333..11b4fb632ac 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/3.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/4.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/4.cc index eca9a2d42d4..2be15bfd31a 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/locking/4.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/locking/4.cc @@ -1,9 +1,8 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } -// { dg-require-gthreads-timed "" } // Copyright (C) 2008-2015 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/30_threads/unique_lock/modifiers/1.cc b/libstdc++-v3/testsuite/30_threads/unique_lock/modifiers/1.cc index ffb9fe4326d..2af65d2240c 100644 --- a/libstdc++-v3/testsuite/30_threads/unique_lock/modifiers/1.cc +++ b/libstdc++-v3/testsuite/30_threads/unique_lock/modifiers/1.cc @@ -1,7 +1,7 @@ -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* powerpc-ibm-aix* } } // { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } } -// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } } +// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-require-cstdint "" } // { dg-require-gthreads "" } diff --git a/libstdc++-v3/testsuite/experimental/functional/not_fn.cc b/libstdc++-v3/testsuite/experimental/functional/not_fn.cc index 8285ec4fbf5..4c137e85bea 100644 --- a/libstdc++-v3/testsuite/experimental/functional/not_fn.cc +++ b/libstdc++-v3/testsuite/experimental/functional/not_fn.cc @@ -20,6 +20,8 @@ #include <experimental/functional> #include <testsuite_hooks.h> +using std::experimental::not_fn; + int func(int, char) { return 0; } struct F @@ -33,8 +35,6 @@ struct F void test01() { - using std::experimental::not_fn; - auto f1 = not_fn(func); VERIFY( f1(1, '2') == true ); @@ -50,8 +50,36 @@ test01() VERIFY( f5(1) == false ); } +template<typename F, typename Arg> +auto foo(F f, Arg arg) -> decltype(not_fn(f)(arg)) { return not_fn(f)(arg); } + +template<typename F, typename Arg> +auto foo(F f, Arg arg) -> decltype(not_fn(f)()) { return not_fn(f)(); } + +struct negator +{ + bool operator()(int) const { return false; } + void operator()() const {} +}; + +void +test02() +{ + foo(negator{}, 1); // PR libstdc++/66998 +} + +void +test03() +{ + struct X { bool b; }; + X x{ false }; + VERIFY( not_fn(&X::b)(x) ); +} + int main() { test01(); + test02(); + test03(); } diff --git a/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc b/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc index 796bbdcfcde..a3748a413a9 100644 --- a/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc +++ b/libstdc++-v3/testsuite/ext/rope/pthread7-rope.cc @@ -17,7 +17,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc index 8da0c231cbb..79ef4511f0d 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc @@ -17,7 +17,7 @@ // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared] -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc index af68ca6a2b1..6bbdb9e0058 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc @@ -17,7 +17,7 @@ // TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared] -// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-darwin* } } +// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* *-*-solaris* *-*-cygwin *-*-rtems* *-*-darwin* } } // { dg-options "-pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-gnu* } } // { dg-options "-pthreads" { target *-*-solaris* } } diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 090e5919fb9..2fa6a963037 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -119,6 +119,8 @@ namespace __gnu_test tracker_allocator() = default; tracker_allocator(const tracker_allocator&) = default; tracker_allocator(tracker_allocator&&) = default; + tracker_allocator& operator=(const tracker_allocator&) = default; + tracker_allocator& operator=(tracker_allocator&&) = default; // Perfect forwarding constructor. template<typename... _Args> @@ -575,6 +577,7 @@ namespace __gnu_test T& operator*() const { return *value; } T* operator->() const { return value; } + T& operator[](difference_type n) const { return value[n]; } Derived& operator++() { ++value; return derived(); } Derived operator++(int) { Derived tmp(derived()); ++value; return tmp; } |