summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-04-04 13:57:02 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-04-05 15:16:17 +0200
commit177b0c18c9206e6849b6b4406268bafc6d107e57 (patch)
tree3df18612f2b1cdf626848cf55de7beeef8830c5a
parentdfbab64bf930bea9e26a6c43ae58e1635776804d (diff)
downloadgcc-177b0c18c9206e6849b6b4406268bafc6d107e57.tar.gz
Merge branches/gcc-5-branch rev 246667.
Change-Id: I1bc55b2def7c8a455bc8b8cb91e3456d15a36219
-rw-r--r--gcc/ChangeLog474
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in21
-rw-r--r--gcc/ada/ChangeLog9
-rw-r--r--gcc/ada/gcc-interface/trans.c8
-rw-r--r--gcc/c-family/ChangeLog13
-rw-r--r--gcc/c-family/c-ada-spec.c2
-rw-r--r--gcc/c-family/c-common.c7
-rw-r--r--gcc/calls.c4
-rw-r--r--gcc/config/aarch64/aarch64-simd.md6
-rw-r--r--gcc/config/i386/avx512fintrin.h128
-rw-r--r--gcc/config/i386/avx512pfintrin.h72
-rw-r--r--gcc/config/i386/avx512vlintrin.h192
-rw-r--r--gcc/config/i386/cpuid.h4
-rw-r--r--gcc/config/i386/i386-builtin-types.def85
-rw-r--r--gcc/config/i386/i386.c152
-rw-r--r--gcc/config/i386/i386.md30
-rw-r--r--gcc/config/i386/x86-64.h2
-rw-r--r--gcc/config/pa/pa-64.h5
-rw-r--r--gcc/config/rs6000/dfp.md8
-rw-r--r--gcc/config/rs6000/predicates.md3
-rw-r--r--gcc/config/rs6000/rs6000-c.c17
-rw-r--r--gcc/config/rs6000/rs6000.c8
-rw-r--r--gcc/config/rs6000/rs6000.md4
-rw-r--r--gcc/config/rs6000/rs6000.opt4
-rw-r--r--gcc/config/rs6000/vsx.md42
-rw-r--r--gcc/config/sparc/sparc.c5
-rw-r--r--gcc/data-streamer-in.c1
-rw-r--r--gcc/data-streamer-out.c1
-rw-r--r--gcc/doc/extend.texi8
-rw-r--r--gcc/doc/gcc.texi3
-rw-r--r--gcc/doc/gcov-dump.texi93
-rw-r--r--gcc/doc/invoke.texi7
-rw-r--r--gcc/fold-const.c23
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-types.c29
-rw-r--r--gcc/gcov-dump.c2
-rw-r--r--gcc/gcse.c34
-rw-r--r--gcc/ipa-prop.c2
-rw-r--r--gcc/ipa-pure-const.c8
-rw-r--r--gcc/params.def2
-rw-r--r--gcc/testsuite/ChangeLog198
-rw-r--r--gcc/testsuite/g++.dg/ext/mv8.C2
-rw-r--r--gcc/testsuite/g++.dg/pr79761.C34
-rw-r--r--gcc/testsuite/g++.dg/pr79769.C4
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-var-26.C147
-rw-r--r--gcc/testsuite/gcc.dg/pr79574-2.c33
-rw-r--r--gcc/testsuite/gcc.dg/pr79574.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr79587.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr79803.c60
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr78339.c5
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr79631.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr79753.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/mpx/pr79770.c19
-rw-r--r--gcc/testsuite/gcc.target/i386/pr65044.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/pr71458.c7
-rw-r--r--gcc/testsuite/gcc.target/i386/pr79514.c12
-rw-r--r--gcc/testsuite/gcc.target/i386/pr80019.c13
-rw-r--r--gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c26
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c18
-rw-r--r--gcc/testsuite/gcc.target/powerpc/dfp-builtin-2.c4
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79439.c29
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79544.c21
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr79951.c10
-rw-r--r--gcc/testsuite/gcc.target/powerpc/pr80246.c37
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c68
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c23
-rw-r--r--gcc/testsuite/gcc.target/sparc/20170228-1.c20
-rw-r--r--gcc/testsuite/gnat.dg/opt63.adb19
-rw-r--r--gcc/toplev.c21
-rw-r--r--gcc/tree-chkp-opt.c4
-rw-r--r--gcc/tree-chkp.c19
-rw-r--r--gcc/tree-ssa-loop-prefetch.c19
-rw-r--r--gcc/value-prof.c12
-rw-r--r--libatomic/ChangeLog8
-rw-r--r--libatomic/config/arm/exch_n.c4
-rw-r--r--libsanitizer/ChangeLog9
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc7
-rw-r--r--libstdc++-v3/ChangeLog159
-rw-r--r--libstdc++-v3/include/bits/ios_base.h8
-rw-r--r--libstdc++-v3/include/bits/list.tcc8
-rw-r--r--libstdc++-v3/include/bits/locale_classes.h5
-rw-r--r--libstdc++-v3/include/bits/locale_conv.h5
-rw-r--r--libstdc++-v3/include/bits/mask_array.h4
-rw-r--r--libstdc++-v3/include/bits/regex.h4
-rw-r--r--libstdc++-v3/include/bits/slice_array.h4
-rw-r--r--libstdc++-v3/include/bits/stl_map.h30
-rw-r--r--libstdc++-v3/include/bits/stl_multimap.h28
-rw-r--r--libstdc++-v3/include/bits/stl_multiset.h24
-rw-r--r--libstdc++-v3/include/bits/stl_set.h26
-rw-r--r--libstdc++-v3/include/experimental/any22
-rw-r--r--libstdc++-v3/include/ext/pointer.h8
-rw-r--r--libstdc++-v3/include/std/atomic36
-rw-r--r--libstdc++-v3/src/c++11/codecvt.cc606
-rw-r--r--libstdc++-v3/src/c++11/cxx11-shim_facets.cc20
-rw-r--r--libstdc++-v3/testsuite/17_intro/names.cc110
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/char16_t.cc2
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc142
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/80041.cc87
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/members.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc289
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc94
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/members.cc81
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc60
-rw-r--r--libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc76
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/80034.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/map/operations/2.cc49
-rw-r--r--libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/set/operations/2.cc50
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/69301.cc57
-rw-r--r--libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc13
-rw-r--r--libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc2
113 files changed, 4030 insertions, 751 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ca551782f28..d93c79c28f2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,477 @@
+2017-03-30 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-03-30 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80246
+ * config/rs6000/dfp.md (dfp_dxex_<mode>): Update mode of operand 0.
+ (dfp_diex_<mode>): Update mode of operand 1.
+ * doc/extend.texi (dxex, dxexq): Document change to return type.
+ (diex, diexq): Document change to argument type.
+
+2017-03-25 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/80180
+ * config/i386/i386.c (ix86_expand_builtin)
+ <IX86_BUILTIN_RDSEED{16,32,64}_STEP>: Do not expand arg0 between
+ flags reg setting and flags reg using instructions.
+ <IX86_BUILTIN_RDRAND{16,32,64}_STEP>: Ditto. Use non-flags reg
+ clobbering instructions to zero extend op2.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-22 Martin Liska <mliska@suse.cz>
+
+ PR lto/79587
+ * data-streamer-in.c (streamer_read_gcov_count): Remove assert.
+ * data-streamer-out.c (streamer_write_gcov_count_stream):
+ Likewise.
+ * value-prof.c (stream_out_histogram_value): Make assert more
+ precise based on type of counter.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-22 Martin Liska <mliska@suse.cz>
+
+ PR target/79906
+ * config/rs6000/rs6000.c (rs6000_inner_target_options): Show
+ error message instead of an ICE.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-21 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/80081
+ * Makefile.in: Add gcov-dump and fix installation of gcov-tool.
+ * doc/gcc.texi: Include gcov-dump stuff.
+ * doc/gcov-dump.texi: New file.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-20 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/79753
+ * tree-chkp.c (chkp_build_returned_bound): Do not build
+ returned bounds for a LHS that's not a BOUNDED_P type.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-20 Martin Liska <mliska@suse.cz>
+
+ PR target/79769
+ PR target/79770
+ * tree-chkp.c (chkp_find_bounds_1): Handle REAL_CST,
+ COMPLEX_CST and VECTOR_CST.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-14 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/79831
+ * doc/invoke.texi (-Wchkp): Document the option.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-13 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/78339
+ * ipa-pure-const.c (warn_function_noreturn): If the declarations
+ is a CHKP clone, use original declaration.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2016-06-13 Martin Liska <mliska@suse.cz>
+
+ PR target/65705
+ PR target/69804
+ PR sanitizer/71458
+
+ * toplev.c (process_options): Enable MPX with LSAN and UBSAN.
+ * tree-chkp.c (chkp_walk_pointer_assignments): Verify that
+ FIELD != NULL.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-09 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/79631
+ * tree-chkp-opt.c (chkp_is_constant_addr): Call
+ tree_int_cst_sign_bit just for INTEGER constants.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-09 Martin Liska <mliska@suse.cz>
+
+ PR ipa/79761
+ * tree-chkp.c (chkp_get_bound_for_parm): Get bounds for a param.
+ (chkp_find_bounds_1): Remove gcc_unreachable.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-03 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/79803
+ * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Remove
+ assert.
+ (pass_loop_prefetch::execute): Disabled optimization if an
+ assumption about L1 cache size is not met.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-03 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/79574
+ * gcse.c (struct gcse_expr): Use HOST_WIDE_INT instead of int.
+ (hash_scan_set): Likewise.
+ (dump_hash_table): Likewise.
+ (hoist_code): Likewise.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-17 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/79574
+ * gcse.c (want_to_gcse_p): Prevent integer overflow.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-17 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/79577
+ * params.def (selsched-max-sched-times): Increase minimum to 1.
+
+2017-03-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline:
+ 2017-03-17 Pat Haugen <pthaugen@us.ibm.com>
+
+ PR target/79951
+ * config/rs6000/rs6000.md (copysign<mode>3_fcpsgn): Test
+ for VECTOR_UNIT_VSX_P (<MODE>mode) too.
+
+2017-03-21 Tamar Christina <tamar.christina@arm.com>
+
+ * config/aarch64/aarch64-simd.md (*aarch64_simd_mov<mode>)
+ Change ins into fmov.
+
+2017-03-19 Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ PR target/71017
+ * config/i386/cpuid.h: Fix another undefined behavior.
+
+2017-03-17 Tom de Vries <tom@codesourcery.com>
+
+ backport from trunk:
+ 2017-03-17 Tom de Vries <tom@codesourcery.com>
+
+ * gcov-dump.c (print_usage): Print bug_report_url.
+
+2017-03-15 Matthias Klose <doko@ubuntu.com>
+
+ Backport from mainline
+ 2017-03-14 Martin Liska <mliska@suse.cz>
+
+ * Makefile.in: Install gcov-dump.
+
+2017-03-15 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/80019
+ * config/i386/i386.c (ix86_vector_duplicate_value): Create
+ subreg of inner mode for values already in registers.
+
+2017-03-10 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/79439
+ * config/rs6000/predicates.md (current_file_function_operand): Do
+ not allow self calls to be local if the function is replaceable.
+
+2017-03-07 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2017-03-07 Segher Boessenkool <segher@kernel.crashing.org>
+
+ * config/i386/i386.c (ix86_local_alignment): Align most aggregates
+ of 16 bytes and more to 16 bytes, not those of 16 bits and more.
+
+2017-03-06 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/77850
+ * config/pa/pa-64.h (PAD_VARARGS_DOWN): Don't pad down complex and
+ vector types.
+
+2017-03-02 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/79514
+ * config/i386/i386.md (*pushxf_rounded): New insn_and_split pattern.
+
+2017-03-01 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline:
+ 2017-02-27 Pat Haugen <pthaugen@us.ibm.com>
+
+ PR target/79544
+ * rs6000/rs6000-c.c (struct altivec_builtin_types): Use VSRAD for
+ arithmetic shift of unsigned V2DI.
+
+2017-03-01 Martin Jambor <mjambor@suse.cz>
+
+ Backport from mainline
+ 2017-02-21 Martin Jambor <mjambor@suse.cz>
+
+ PR lto/79579
+ * ipa-prop.c (ipa_prop_write_jump_functions): Bail out if no edges
+ have been analyzed.
+
+2017-02-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/79749
+ * config/sparc/sparc.c (sparc_frame_pointer_required): Add missing
+ condition on optimize for the leaf function test.
+
+2017-02-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-02-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79261
+ * config/rs6000/rs6000.c (rs6000_expand_ternop_builtin): Add
+ support for CODE_FOR_vsx_xxpermdi_v2d[fi]_be.
+ * config/rs6000/rs6000.md (reload_gpr_from_vsx<mode>): Call
+ generator for vsx_xxpermdi_<mode>_be.
+ * config/rs6000/vsx.md (vsx_xxpermdi_<mode>): Remove logic to
+ force big-endian semantics.
+ (vsx_xxpermdi_<mode>_be): New define_expand with same
+ implementation as previous version of vsx_xxpermdi_<mode>.
+
+2017-02-19 Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ PR target/71017
+ * config/i386/cpuid.h: Fix undefined behavior.
+
+2017-02-18 Gerald Pfeifer <gerald@pfeifer.com>
+
+ Backport from mainline
+ 2016-12-11 Roger Pau Monné <roger.pau@citrix.com>
+
+ * config/i386/x86-64.h: Append --32 to the assembler options when
+ -m16 is used on non-glibc systems as well.
+
+2017-02-17 Julia Koval <julia.koval@intel.com>
+
+ PR target/76731
+ * config/i386/avx512fintrin.h
+ (_mm512_i32gather_ps): Change __addr type to void const*.
+ (_mm512_mask_i32gather_ps): Ditto.
+ (_mm512_i32gather_pd): Ditto.
+ (_mm512_mask_i32gather_pd): Ditto.
+ (_mm512_i64gather_ps): Ditto.
+ (_mm512_mask_i64gather_ps): Ditto.
+ (_mm512_i64gather_pd): Ditto.
+ (_mm512_mask_i64gather_pd): Ditto.
+ (_mm512_i32gather_epi32): Ditto.
+ (_mm512_mask_i32gather_epi32): Ditto.
+ (_mm512_i32gather_epi64): Ditto.
+ (_mm512_mask_i32gather_epi64): Ditto.
+ (_mm512_i64gather_epi32): Ditto.
+ (_mm512_mask_i64gather_epi32): Ditto.
+ (_mm512_i64gather_epi64): Ditto.
+ (_mm512_mask_i64gather_epi64): Ditto.
+ (_mm512_i32scatter_ps): Change __addr type to void*.
+ (_mm512_mask_i32scatter_ps): Ditto.
+ (_mm512_i32scatter_pd): Ditto.
+ (_mm512_mask_i32scatter_pd): Ditto.
+ (_mm512_i64scatter_ps): Ditto.
+ (_mm512_mask_i64scatter_ps): Ditto.
+ (_mm512_i64scatter_pd): Ditto.
+ (_mm512_mask_i64scatter_pd): Ditto.
+ (_mm512_i32scatter_epi32): Ditto.
+ (_mm512_mask_i32scatter_epi32): Ditto.
+ (_mm512_i32scatter_epi64): Ditto.
+ (_mm512_mask_i32scatter_epi64): Ditto.
+ (_mm512_i64scatter_epi32): Ditto.
+ (_mm512_mask_i64scatter_epi32): Ditto.
+ (_mm512_i64scatter_epi64): Ditto.
+ (_mm512_mask_i64scatter_epi64): Ditto.
+ * config/i386/avx512pfintrin.h
+ (_mm512_mask_prefetch_i32gather_pd): Change addr type to void const*.
+ (_mm512_mask_prefetch_i32gather_ps): Ditto.
+ (_mm512_mask_prefetch_i64gather_pd): Ditto.
+ (_mm512_mask_prefetch_i64gather_ps): Ditto.
+ (_mm512_prefetch_i32scatter_pd): Change addr type to void*.
+ (_mm512_prefetch_i32scatter_ps): Ditto.
+ (_mm512_mask_prefetch_i32scatter_pd): Ditto.
+ (_mm512_mask_prefetch_i32scatter_ps): Ditto.
+ (_mm512_prefetch_i64scatter_pd): Ditto.
+ (_mm512_prefetch_i64scatter_ps): Ditto.
+ (_mm512_mask_prefetch_i64scatter_pd): Ditto.
+ (_mm512_mask_prefetch_i64scatter_ps): Ditto.
+ * config/i386/avx512vlintrin.h
+ (_mm256_mmask_i32gather_ps): Change __addr type to void const*.
+ (_mm_mmask_i32gather_ps): Ditto.
+ (_mm256_mmask_i32gather_pd): Ditto.
+ (_mm_mmask_i32gather_pd): Ditto.
+ (_mm256_mmask_i64gather_ps): Ditto.
+ (_mm_mmask_i64gather_ps): Ditto.
+ (_mm256_mmask_i64gather_pd): Ditto.
+ (_mm_mmask_i64gather_pd): Ditto.
+ (_mm256_mmask_i32gather_epi32): Ditto.
+ (_mm_mmask_i32gather_epi32): Ditto.
+ (_mm256_mmask_i32gather_epi64): Ditto.
+ (_mm_mmask_i32gather_epi64): Ditto.
+ (_mm256_mmask_i64gather_epi32): Ditto.
+ (_mm_mmask_i64gather_epi32): Ditto.
+ (_mm256_mmask_i64gather_epi64): Ditto.
+ (_mm_mmask_i64gather_epi64): Ditto.
+ (_mm256_i32scatter_ps): Change __addr type to void*.
+ (_mm256_mask_i32scatter_ps): Ditto.
+ (_mm_i32scatter_ps): Ditto.
+ (_mm_mask_i32scatter_ps): Ditto.
+ (_mm256_i32scatter_pd): Ditto.
+ (_mm256_mask_i32scatter_pd): Ditto.
+ (_mm_i32scatter_pd): Ditto.
+ (_mm_mask_i32scatter_pd): Ditto.
+ (_mm256_i64scatter_ps): Ditto.
+ (_mm256_mask_i64scatter_ps): Ditto.
+ (_mm_i64scatter_ps): Ditto.
+ (_mm_mask_i64scatter_ps): Ditto.
+ (_mm256_i64scatter_pd): Ditto.
+ (_mm256_mask_i64scatter_pd): Ditto.
+ (_mm_i64scatter_pd): Ditto.
+ (_mm_mask_i64scatter_pd): Ditto.
+ (_mm256_i32scatter_epi32): Ditto.
+ (_mm256_mask_i32scatter_epi32): Ditto.
+ (_mm_i32scatter_epi32): Ditto.
+ (_mm_mask_i32scatter_epi32): Ditto.
+ (_mm256_i32scatter_epi64): Ditto.
+ (_mm256_mask_i32scatter_epi64): Ditto.
+ (_mm_i32scatter_epi64): Ditto.
+ (_mm_mask_i32scatter_epi64): Ditto.
+ (_mm256_i64scatter_epi32): Ditto.
+ (_mm256_mask_i64scatter_epi32): Ditto.
+ (_mm_i64scatter_epi32): Ditto.
+ (_mm_mask_i64scatter_epi32): Ditto.
+ (_mm256_i64scatter_epi64): Ditto.
+ (_mm256_mask_i64scatter_epi64): Ditto.
+ (_mm_i64scatter_epi64): Ditto.
+ (_mm_mask_i64scatter_epi64): Ditto.
+ * config/i386/i386-builtin-types.def (V16SF_V16SF_PCFLOAT_V16SI_HI_INT)
+ (V8DF_V8DF_PCDOUBLE_V8SI_QI_INT, V8SF_V8SF_PCFLOAT_V8DI_QI_INT)
+ (V8DF_V8DF_PCDOUBLE_V8DI_QI_INT, V16SI_V16SI_PCINT_V16SI_HI_INT)
+ (V8DI_V8DI_PCINT64_V8SI_QI_INT, V8SI_V8SI_PCINT_V8DI_QI_INT)
+ (V8DI_V8DI_PCINT64_V8DI_QI_INT, V2DF_V2DF_PCDOUBLE_V4SI_QI_INT)
+ (V4DF_V4DF_PCDOUBLE_V4SI_QI_INT, V2DF_V2DF_PCDOUBLE_V2DI_QI_INT)
+ (V4DF_V4DF_PCDOUBLE_V4DI_QI_INT, V4SF_V4SF_PCFLOAT_V4SI_QI_INT)
+ (V8SF_V8SF_PCFLOAT_V8SI_QI_INT, V4SF_V4SF_PCFLOAT_V2DI_QI_INT)
+ (V4SF_V4SF_PCFLOAT_V4DI_QI_INT, V2DI_V2DI_PCINT64_V4SI_QI_INT)
+ (V4DI_V4DI_PCINT64_V4SI_QI_INT, V2DI_V2DI_PCINT64_V2DI_QI_INT)
+ (V4DI_V4DI_PCINT64_V4DI_QI_INT, V4SI_V4SI_PCINT_V4SI_QI_INT)
+ (V8SI_V8SI_PCINT_V8SI_QI_INT, V4SI_V4SI_PCINT_V2DI_QI_INT)
+ (V4SI_V4SI_PCINT_V4DI_QI_INT, VOID_PFLOAT_HI_V16SI_V16SF_INT)
+ (VOID_PFLOAT_QI_V8SI_V8SF_INT, VOID_PFLOAT_QI_V4SI_V4SF_INT)
+ (VOID_PDOUBLE_QI_V8SI_V8DF_INT, VOID_PDOUBLE_QI_V4SI_V4DF_INT)
+ (VOID_PDOUBLE_QI_V4SI_V2DF_INT, VOID_PFLOAT_QI_V8DI_V8SF_INT)
+ (VOID_PFLOAT_QI_V4DI_V4SF_INT, VOID_PFLOAT_QI_V2DI_V4SF_INT)
+ (VOID_PDOUBLE_QI_V8DI_V8DF_INT, VOID_PDOUBLE_QI_V4DI_V4DF_INT)
+ (VOID_PDOUBLE_QI_V2DI_V2DF_INT, VOID_PINT_HI_V16SI_V16SI_INT)
+ (VOID_PINT_QI_V8SI_V8SI_INT, VOID_PINT_QI_V4SI_V4SI_INT)
+ (VOID_PLONGLONG_QI_V8SI_V8DI_INT, VOID_PLONGLONG_QI_V4SI_V4DI_INT)
+ (VOID_PLONGLONG_QI_V4SI_V2DI_INT, VOID_PINT_QI_V8DI_V8SI_INT)
+ (VOID_PINT_QI_V4DI_V4SI_INT, VOID_PINT_QI_V2DI_V4SI_INT)
+ (VOID_PLONGLONG_QI_V8DI_V8DI_INT, VOID_QI_V8SI_PCINT64_INT_INT)
+ (VOID_PLONGLONG_QI_V4DI_V4DI_INT, VOID_PLONGLONG_QI_V2DI_V2DI_INT)
+ (VOID_HI_V16SI_PCINT_INT_INT, VOID_QI_V8DI_PCINT64_INT_INT)
+ (VOID_QI_V8DI_PCINT_INT_INT): Remove.
+ (V16SF_V16SF_PCVOID_V16SI_HI_INT, V8DF_V8DF_PCVOID_V8SI_QI_INT)
+ (V8SF_V8SF_PCVOID_V8DI_QI_INT, V8DF_V8DF_PCVOID_V8DI_QI_INT)
+ (V16SI_V16SI_PCVOID_V16SI_HI_INT, V8DI_V8DI_PCVOID_V8SI_QI_INT)
+ (V8SI_V8SI_PCVOID_V8DI_QI_INT, V8DI_V8DI_PCVOID_V8DI_QI_INT)
+ (VOID_PVOID_HI_V16SI_V16SF_INT, VOID_PVOID_QI_V8SI_V8DF_INT)
+ (VOID_PVOID_QI_V8DI_V8SF_INT, VOID_PVOID_QI_V8DI_V8DF_INT)
+ (VOID_PVOID_HI_V16SI_V16SI_INT, VOID_PVOID_QI_V8SI_V8DI_INT)
+ (VOID_PVOID_QI_V8DI_V8SI_INT, VOID_PVOID_QI_V8DI_V8DI_INT)
+ (V2DF_V2DF_PCVOID_V4SI_QI_INT, V4DF_V4DF_PCVOID_V4SI_QI_INT)
+ (V2DF_V2DF_PCVOID_V2DI_QI_INT, V4DF_V4DF_PCVOID_V4DI_QI_INT
+ (V4SF_V4SF_PCVOID_V4SI_QI_INT, V8SF_V8SF_PCVOID_V8SI_QI_INT)
+ (V4SF_V4SF_PCVOID_V2DI_QI_INT, V4SF_V4SF_PCVOID_V4DI_QI_INT)
+ (V2DI_V2DI_PCVOID_V4SI_QI_INT, V4DI_V4DI_PCVOID_V4SI_QI_INT)
+ (V2DI_V2DI_PCVOID_V2DI_QI_INT, V4DI_V4DI_PCVOID_V4DI_QI_INT)
+ (V4SI_V4SI_PCVOID_V4SI_QI_INT, V8SI_V8SI_PCVOID_V8SI_QI_INT)
+ (V4SI_V4SI_PCVOID_V2DI_QI_INT, V4SI_V4SI_PCVOID_V4DI_QI_INT)
+ (VOID_PVOID_QI_V8SI_V8SF_INT, VOID_PVOID_QI_V4SI_V4SF_INT)
+ (VOID_PVOID_QI_V4SI_V4DF_INT, VOID_PVOID_QI_V4SI_V2DF_INT)
+ (VOID_PVOID_QI_V4DI_V4SF_INT, VOID_PVOID_QI_V2DI_V4SF_INT)
+ (VOID_PVOID_QI_V4DI_V4DF_INT, VOID_PVOID_QI_V2DI_V2DF_INT)
+ (VOID_PVOID_QI_V8SI_V8SI_INT, VOID_PVOID_QI_V4SI_V4SI_INT)
+ (VOID_PVOID_QI_V4SI_V4DI_INT, VOID_PVOID_QI_V4SI_V2DI_INT)
+ (VOID_PVOID_QI_V4DI_V4SI_INT, VOID_PVOID_QI_V2DI_V4SI_INT)
+ (VOID_PVOID_QI_V4DI_V4DI_INT, VOID_PVOID_QI_V2DI_V2DI_INT)
+ (VOID_QI_V8SI_PCVOID_INT_INT, VOID_HI_V16SI_PCVOID_INT_INT)
+ (VOID_QI_V8DI_PCVOID_INT_INT): Add.
+ * config/i386/i386.c (ix86_init_mmx_sse_builtins): Adjust builtin
+ definitions accordingly.
+
+2017-02-16 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline commit r245460 on 2017-02-14
+
+ PR 79545
+ * config/rs6000/rs6000.c: Add case statement entry to make the xvcvuxdsp
+ built-in argument unsigned.
+ * config/rs6000/vsx.md: Fix the source and return operand types so they
+ match the instruction definitions from the ISA document. Fix typo
+ in the instruction generation for the (define_insn "vsx_xvcvuxdsp"
+ statement.
+
+2017-02-14 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2016-03-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/70022
+ PR target/79498
+ * fold-const.c (fold_indirect_ref_1): Fix range checking for
+ vector BIT_FIELD_REF extract.
+
+2017-02-14 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-13 Martin Liska <mliska@suse.cz>
+
+ PR c/79471
+ * calls.c (expand_call): Replace XALLOCAVEC with XCNEWVEC.
+
+2017-02-08 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR translation/79397
+ * config/rs6000/rs6000.opt (maltivec=le, maltivec=be): Fix spelling
+ of AltiVec.
+
+2017-02-06 Carl Love <cel@us.ibm.com>
+
+ Backport of two commits from mainline, r244943 and r244904,
+ dated 2017-01-26 and 2017-01-25 respectively
+
+ * config/rs6000/rs6000-c (altivec_overloaded_builtins): Fix order
+ of entries for ALTIVEC_BUILTIN_VEC_PACKS. Remove bogus entries
+ for P8V_BUILTIN_VEC_VGBBD.
+
2017-02-03 Maxim Ostapenko <m.ostapenko@samsung.com>
PR lto/79061
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ee1e9c32829..7c3b057f980 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20170206
+20170404
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7a575a66fb5..851567da6cc 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -765,6 +765,7 @@ GCC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcc|sed '$(progra
CPP_INSTALL_NAME := $(shell echo cpp|sed '$(program_transform_name)')
GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)')
GCOV_TOOL_INSTALL_NAME := $(shell echo gcov-tool|sed '$(program_transform_name)')
+GCOV_DUMP_INSTALL_NAME := $(shell echo gcov-dump|sed '$(program_transform_name)')
# Setup the testing framework, if you have one
EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
@@ -2896,7 +2897,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi frontends.texi \
gcov.texi trouble.texi bugreport.texi service.texi \
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
- implement-c.texi implement-cxx.texi gcov-tool.texi
+ implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
@@ -3019,7 +3020,7 @@ $(build_htmldir)/gccinstall/index.html: $(TEXI_GCCINSTALL_FILES)
$(SHELL) $(srcdir)/doc/install.texi2html
MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 \
- doc/fsf-funding.7 doc/gcov-tool.1
+ doc/fsf-funding.7 doc/gcov-tool.1 doc/gcov-dump.1
generated-manpages: man
@@ -3321,6 +3322,15 @@ install-common: native lang.install-common installdirs
gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
fi; \
fi
+# Install gcov-dump if it was compiled.
+ -if test "$(enable_as_accelerator)" != "yes" ; then \
+ if [ -f gcov-dump$(exeext) ]; \
+ then \
+ rm -f $(DESTDIR)$(bindir)/$(GCOV_DUMP_INSTALL_NAME)$(exeext); \
+ $(INSTALL_PROGRAM) \
+ gcov-dump$(exeext) $(DESTDIR)$(bindir)/$(GCOV_DUMP_INSTALL_NAME)$(exeext); \
+ fi; \
+ fi
# Install the driver program as $(target_noncanonical)-gcc,
# $(target_noncanonical)-gcc-$(version), and also as gcc if native.
@@ -3404,6 +3414,8 @@ install-man: lang.install-man \
$(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \
$(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \
$(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \
+ $(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext) \
+ $(DESTDIR)$(man1dir)/$(GCOV_DUMP_INSTALL_NAME)$(man1ext) \
$(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \
$(DESTDIR)$(man7dir)/gfdl$(man7ext) \
$(DESTDIR)$(man7dir)/gpl$(man7ext)
@@ -3433,6 +3445,11 @@ $(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext): doc/gcov-tool.1 instal
-$(INSTALL_DATA) $< $@
-chmod a-x $@
+$(DESTDIR)$(man1dir)/$(GCOV_DUMP_INSTALL_NAME)$(man1ext): doc/gcov-dump.1 installdirs
+ -rm -f $@
+ -$(INSTALL_DATA) $< $@
+ -chmod a-x $@
+
# Install all the header files built in the include subdirectory.
install-headers: $(INSTALL_HEADERS_DIR)
# Fix symlinks to absolute paths in the installed include directory to
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8f904d3b261..a77d28783ea 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,12 @@
+2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (gnat_to_gnu): Do not apply special handling
+ of boolean rvalues to function calls.
+
+2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/trans.c (return_value_ok_for_nrv_p): Add sanity check.
+
2016-11-22 Uros Bizjak <ubizjak@gmail.com>
* gcc-interface/Make-lang.in (check-acats): Fix detection
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index d1429894484..85d3198eb91 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -3499,9 +3499,16 @@ return_value_ok_for_nrv_p (tree ret_obj, tree ret_val)
if (TREE_ADDRESSABLE (ret_val))
return false;
+ /* For the constrained case, test for overalignment. */
if (ret_obj && DECL_ALIGN (ret_val) > DECL_ALIGN (ret_obj))
return false;
+ /* For the unconstrained case, test for bogus initialization. */
+ if (!ret_obj
+ && DECL_INITIAL (ret_val)
+ && TREE_CODE (DECL_INITIAL (ret_val)) == NULL_EXPR)
+ return false;
+
return true;
}
@@ -7315,7 +7322,6 @@ gnat_to_gnu (Node_Id gnat_node)
&& (kind == N_Identifier
|| kind == N_Expanded_Name
|| kind == N_Explicit_Dereference
- || kind == N_Function_Call
|| kind == N_Indexed_Component
|| kind == N_Selected_Component)
&& TREE_CODE (get_base_type (gnu_result_type)) == BOOLEAN_TYPE
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 5052e572a72..5251b684d06 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,16 @@
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-09 Martin Liska <mliska@suse.cz>
+
+ * c-ada-spec.c (macro_length): Increment value instead of a pointer.
+
+2017-03-21 Martin Sebor <msebor@redhat.com>
+
+ PR c++/79548
+ * c-common.c (set_underlying_type): Mark type used only when
+ original del is declared unused.
+
2017-01-24 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index 8d6e01421cd..2814be426db 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -85,7 +85,7 @@ macro_length (const cpp_macro *macro, int *supported, int *buffer_len,
if (macro->fun_like)
{
- param_len++;
+ (*param_len)++;
for (i = 0; i < macro->paramc; i++)
{
cpp_hashnode *param = macro->params[i];
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 7426f788374..d8c038ccf6c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -11793,7 +11793,12 @@ set_underlying_type (tree x)
tt = build_variant_type_copy (tt);
TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x));
TYPE_NAME (tt) = x;
- TREE_USED (tt) = TREE_USED (x);
+
+ /* Mark the type as used only when its type decl is decorated
+ with attribute unused. */
+ if (lookup_attribute ("unused", DECL_ATTRIBUTES (x)))
+ TREE_USED (tt) = 1;
+
TREE_TYPE (x) = tt;
}
}
diff --git a/gcc/calls.c b/gcc/calls.c
index 120365bef4d..54df250a477 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2717,8 +2717,7 @@ expand_call (tree exp, rtx target, int ignore)
n_named_args = num_actuals;
/* Make a vector to hold all the information about each arg. */
- args = XALLOCAVEC (struct arg_data, num_actuals);
- memset (args, 0, num_actuals * sizeof (struct arg_data));
+ args = XCNEWVEC (struct arg_data, num_actuals);
/* Build up entries in the ARGS array, compute the size of the
arguments into ARGS_SIZE, etc. */
@@ -3731,6 +3730,7 @@ expand_call (tree exp, rtx target, int ignore)
currently_expanding_call--;
free (stack_usage_map_buf);
+ free (args);
/* Join result with returned bounds so caller may use them if needed. */
target = chkp_join_splitted_slot (target, valbnd);
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index eda2f308fc9..9c5f63fbdd2 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -107,7 +107,7 @@
case 1: return "str\\t%d1, %0";
case 2: return "orr\t%0.<Vbtype>, %1.<Vbtype>, %1.<Vbtype>";
case 3: return "umov\t%0, %1.d[0]";
- case 4: return "ins\t%0.d[0], %1";
+ case 4: return "fmov\t%d0, %1";
case 5: return "mov\t%0, %1";
case 6:
return aarch64_output_simd_mov_immediate (operands[1],
@@ -116,8 +116,8 @@
}
}
[(set_attr "type" "neon_load1_1reg<q>, neon_store1_1reg<q>,\
- neon_logic<q>, neon_to_gp<q>, neon_from_gp<q>,\
- mov_reg, neon_move<q>")]
+ neon_logic<q>, neon_to_gp<q>, f_mcr,\
+ mov_reg, neon_move<q>")]
)
(define_insn "*aarch64_simd_mov<mode>"
diff --git a/gcc/config/i386/avx512fintrin.h b/gcc/config/i386/avx512fintrin.h
index 184e9e88d64..c7a91c1db24 100644
--- a/gcc/config/i386/avx512fintrin.h
+++ b/gcc/config/i386/avx512fintrin.h
@@ -9209,7 +9209,7 @@ _mm_mask_cmp_round_ss_mask (__mmask8 __M, __m128 __X, __m128 __Y,
#ifdef __OPTIMIZE__
extern __inline __m512
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32gather_ps (__m512i __index, float const *__addr, int __scale)
+_mm512_i32gather_ps (__m512i __index, void const *__addr, int __scale)
{
__m512 v1_old = _mm512_undefined_ps ();
__mmask16 mask = 0xFFFF;
@@ -9223,7 +9223,7 @@ _mm512_i32gather_ps (__m512i __index, float const *__addr, int __scale)
extern __inline __m512
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i32gather_ps (__m512 v1_old, __mmask16 __mask,
- __m512i __index, float const *__addr, int __scale)
+ __m512i __index, void const *__addr, int __scale)
{
return (__m512) __builtin_ia32_gathersiv16sf ((__v16sf) v1_old,
__addr,
@@ -9233,7 +9233,7 @@ _mm512_mask_i32gather_ps (__m512 v1_old, __mmask16 __mask,
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32gather_pd (__m256i __index, double const *__addr, int __scale)
+_mm512_i32gather_pd (__m256i __index, void const *__addr, int __scale)
{
__m512d v1_old = _mm512_undefined_pd ();
__mmask8 mask = 0xFF;
@@ -9247,7 +9247,7 @@ _mm512_i32gather_pd (__m256i __index, double const *__addr, int __scale)
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i32gather_pd (__m512d __v1_old, __mmask8 __mask,
- __m256i __index, double const *__addr, int __scale)
+ __m256i __index, void const *__addr, int __scale)
{
return (__m512d) __builtin_ia32_gathersiv8df ((__v8df) __v1_old,
__addr,
@@ -9257,7 +9257,7 @@ _mm512_mask_i32gather_pd (__m512d __v1_old, __mmask8 __mask,
extern __inline __m256
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64gather_ps (__m512i __index, float const *__addr, int __scale)
+_mm512_i64gather_ps (__m512i __index, void const *__addr, int __scale)
{
__m256 v1_old = _mm256_undefined_ps ();
__mmask8 mask = 0xFF;
@@ -9271,7 +9271,7 @@ _mm512_i64gather_ps (__m512i __index, float const *__addr, int __scale)
extern __inline __m256
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i64gather_ps (__m256 __v1_old, __mmask8 __mask,
- __m512i __index, float const *__addr, int __scale)
+ __m512i __index, void const *__addr, int __scale)
{
return (__m256) __builtin_ia32_gatherdiv16sf ((__v8sf) __v1_old,
__addr,
@@ -9281,7 +9281,7 @@ _mm512_mask_i64gather_ps (__m256 __v1_old, __mmask8 __mask,
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64gather_pd (__m512i __index, double const *__addr, int __scale)
+_mm512_i64gather_pd (__m512i __index, void const *__addr, int __scale)
{
__m512d v1_old = _mm512_undefined_pd ();
__mmask8 mask = 0xFF;
@@ -9295,7 +9295,7 @@ _mm512_i64gather_pd (__m512i __index, double const *__addr, int __scale)
extern __inline __m512d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i64gather_pd (__m512d __v1_old, __mmask8 __mask,
- __m512i __index, double const *__addr, int __scale)
+ __m512i __index, void const *__addr, int __scale)
{
return (__m512d) __builtin_ia32_gatherdiv8df ((__v8df) __v1_old,
__addr,
@@ -9305,7 +9305,7 @@ _mm512_mask_i64gather_pd (__m512d __v1_old, __mmask8 __mask,
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32gather_epi32 (__m512i __index, int const *__addr, int __scale)
+_mm512_i32gather_epi32 (__m512i __index, void const *__addr, int __scale)
{
__m512i v1_old = _mm512_undefined_epi32 ();
__mmask16 mask = 0xFFFF;
@@ -9319,7 +9319,7 @@ _mm512_i32gather_epi32 (__m512i __index, int const *__addr, int __scale)
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i32gather_epi32 (__m512i __v1_old, __mmask16 __mask,
- __m512i __index, int const *__addr, int __scale)
+ __m512i __index, void const *__addr, int __scale)
{
return (__m512i) __builtin_ia32_gathersiv16si ((__v16si) __v1_old,
__addr,
@@ -9329,7 +9329,7 @@ _mm512_mask_i32gather_epi32 (__m512i __v1_old, __mmask16 __mask,
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32gather_epi64 (__m256i __index, long long const *__addr, int __scale)
+_mm512_i32gather_epi64 (__m256i __index, void const *__addr, int __scale)
{
__m512i v1_old = _mm512_undefined_epi32 ();
__mmask8 mask = 0xFF;
@@ -9343,7 +9343,7 @@ _mm512_i32gather_epi64 (__m256i __index, long long const *__addr, int __scale)
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i32gather_epi64 (__m512i __v1_old, __mmask8 __mask,
- __m256i __index, long long const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m512i) __builtin_ia32_gathersiv8di ((__v8di) __v1_old,
@@ -9354,7 +9354,7 @@ _mm512_mask_i32gather_epi64 (__m512i __v1_old, __mmask8 __mask,
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64gather_epi32 (__m512i __index, int const *__addr, int __scale)
+_mm512_i64gather_epi32 (__m512i __index, void const *__addr, int __scale)
{
__m256i v1_old = _mm256_undefined_si256 ();
__mmask8 mask = 0xFF;
@@ -9368,7 +9368,7 @@ _mm512_i64gather_epi32 (__m512i __index, int const *__addr, int __scale)
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i64gather_epi32 (__m256i __v1_old, __mmask8 __mask,
- __m512i __index, int const *__addr, int __scale)
+ __m512i __index, void const *__addr, int __scale)
{
return (__m256i) __builtin_ia32_gatherdiv16si ((__v8si) __v1_old,
__addr,
@@ -9378,7 +9378,7 @@ _mm512_mask_i64gather_epi32 (__m256i __v1_old, __mmask8 __mask,
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64gather_epi64 (__m512i __index, long long const *__addr, int __scale)
+_mm512_i64gather_epi64 (__m512i __index, void const *__addr, int __scale)
{
__m512i v1_old = _mm512_undefined_epi32 ();
__mmask8 mask = 0xFF;
@@ -9392,7 +9392,7 @@ _mm512_i64gather_epi64 (__m512i __index, long long const *__addr, int __scale)
extern __inline __m512i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_i64gather_epi64 (__m512i __v1_old, __mmask8 __mask,
- __m512i __index, long long const *__addr,
+ __m512i __index, void const *__addr,
int __scale)
{
return (__m512i) __builtin_ia32_gatherdiv8di ((__v8di) __v1_old,
@@ -9403,7 +9403,7 @@ _mm512_mask_i64gather_epi64 (__m512i __v1_old, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32scatter_ps (float *__addr, __m512i __index, __m512 __v1, int __scale)
+_mm512_i32scatter_ps (void *__addr, __m512i __index, __m512 __v1, int __scale)
{
__builtin_ia32_scattersiv16sf (__addr, (__mmask16) 0xFFFF,
(__v16si) __index, (__v16sf) __v1, __scale);
@@ -9411,7 +9411,7 @@ _mm512_i32scatter_ps (float *__addr, __m512i __index, __m512 __v1, int __scale)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i32scatter_ps (float *__addr, __mmask16 __mask,
+_mm512_mask_i32scatter_ps (void *__addr, __mmask16 __mask,
__m512i __index, __m512 __v1, int __scale)
{
__builtin_ia32_scattersiv16sf (__addr, __mask, (__v16si) __index,
@@ -9420,7 +9420,7 @@ _mm512_mask_i32scatter_ps (float *__addr, __mmask16 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32scatter_pd (double *__addr, __m256i __index, __m512d __v1,
+_mm512_i32scatter_pd (void *__addr, __m256i __index, __m512d __v1,
int __scale)
{
__builtin_ia32_scattersiv8df (__addr, (__mmask8) 0xFF,
@@ -9429,7 +9429,7 @@ _mm512_i32scatter_pd (double *__addr, __m256i __index, __m512d __v1,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
+_mm512_mask_i32scatter_pd (void *__addr, __mmask8 __mask,
__m256i __index, __m512d __v1, int __scale)
{
__builtin_ia32_scattersiv8df (__addr, __mask, (__v8si) __index,
@@ -9438,7 +9438,7 @@ _mm512_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64scatter_ps (float *__addr, __m512i __index, __m256 __v1, int __scale)
+_mm512_i64scatter_ps (void *__addr, __m512i __index, __m256 __v1, int __scale)
{
__builtin_ia32_scatterdiv16sf (__addr, (__mmask8) 0xFF,
(__v8di) __index, (__v8sf) __v1, __scale);
@@ -9446,7 +9446,7 @@ _mm512_i64scatter_ps (float *__addr, __m512i __index, __m256 __v1, int __scale)
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
+_mm512_mask_i64scatter_ps (void *__addr, __mmask8 __mask,
__m512i __index, __m256 __v1, int __scale)
{
__builtin_ia32_scatterdiv16sf (__addr, __mask, (__v8di) __index,
@@ -9455,7 +9455,7 @@ _mm512_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64scatter_pd (double *__addr, __m512i __index, __m512d __v1,
+_mm512_i64scatter_pd (void *__addr, __m512i __index, __m512d __v1,
int __scale)
{
__builtin_ia32_scatterdiv8df (__addr, (__mmask8) 0xFF,
@@ -9464,7 +9464,7 @@ _mm512_i64scatter_pd (double *__addr, __m512i __index, __m512d __v1,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
+_mm512_mask_i64scatter_pd (void *__addr, __mmask8 __mask,
__m512i __index, __m512d __v1, int __scale)
{
__builtin_ia32_scatterdiv8df (__addr, __mask, (__v8di) __index,
@@ -9473,7 +9473,7 @@ _mm512_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32scatter_epi32 (int *__addr, __m512i __index,
+_mm512_i32scatter_epi32 (void *__addr, __m512i __index,
__m512i __v1, int __scale)
{
__builtin_ia32_scattersiv16si (__addr, (__mmask16) 0xFFFF,
@@ -9482,7 +9482,7 @@ _mm512_i32scatter_epi32 (int *__addr, __m512i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i32scatter_epi32 (int *__addr, __mmask16 __mask,
+_mm512_mask_i32scatter_epi32 (void *__addr, __mmask16 __mask,
__m512i __index, __m512i __v1, int __scale)
{
__builtin_ia32_scattersiv16si (__addr, __mask, (__v16si) __index,
@@ -9491,7 +9491,7 @@ _mm512_mask_i32scatter_epi32 (int *__addr, __mmask16 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i32scatter_epi64 (long long *__addr, __m256i __index,
+_mm512_i32scatter_epi64 (void *__addr, __m256i __index,
__m512i __v1, int __scale)
{
__builtin_ia32_scattersiv8di (__addr, (__mmask8) 0xFF,
@@ -9500,7 +9500,7 @@ _mm512_i32scatter_epi64 (long long *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm512_mask_i32scatter_epi64 (void *__addr, __mmask8 __mask,
__m256i __index, __m512i __v1, int __scale)
{
__builtin_ia32_scattersiv8di (__addr, __mask, (__v8si) __index,
@@ -9509,7 +9509,7 @@ _mm512_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64scatter_epi32 (int *__addr, __m512i __index,
+_mm512_i64scatter_epi32 (void *__addr, __m512i __index,
__m256i __v1, int __scale)
{
__builtin_ia32_scatterdiv16si (__addr, (__mmask8) 0xFF,
@@ -9518,7 +9518,7 @@ _mm512_i64scatter_epi32 (int *__addr, __m512i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
+_mm512_mask_i64scatter_epi32 (void *__addr, __mmask8 __mask,
__m512i __index, __m256i __v1, int __scale)
{
__builtin_ia32_scatterdiv16si (__addr, __mask, (__v8di) __index,
@@ -9527,7 +9527,7 @@ _mm512_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_i64scatter_epi64 (long long *__addr, __m512i __index,
+_mm512_i64scatter_epi64 (void *__addr, __m512i __index,
__m512i __v1, int __scale)
{
__builtin_ia32_scatterdiv8di (__addr, (__mmask8) 0xFF,
@@ -9536,7 +9536,7 @@ _mm512_i64scatter_epi64 (long long *__addr, __m512i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm512_mask_i64scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm512_mask_i64scatter_epi64 (void *__addr, __mmask8 __mask,
__m512i __index, __m512i __v1, int __scale)
{
__builtin_ia32_scatterdiv8di (__addr, __mask, (__v8di) __index,
@@ -9545,177 +9545,177 @@ _mm512_mask_i64scatter_epi64 (long long *__addr, __mmask8 __mask,
#else
#define _mm512_i32gather_ps(INDEX, ADDR, SCALE) \
(__m512) __builtin_ia32_gathersiv16sf ((__v16sf)_mm512_undefined_ps(),\
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v16si)(__m512i)INDEX, \
(__mmask16)0xFFFF, (int)SCALE)
#define _mm512_mask_i32gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512) __builtin_ia32_gathersiv16sf ((__v16sf)(__m512)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v16si)(__m512i)INDEX, \
(__mmask16)MASK, (int)SCALE)
#define _mm512_i32gather_pd(INDEX, ADDR, SCALE) \
(__m512d) __builtin_ia32_gathersiv8df ((__v8df)_mm512_undefined_pd(), \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i32gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512d) __builtin_ia32_gathersiv8df ((__v8df)(__m512d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i64gather_ps(INDEX, ADDR, SCALE) \
(__m256) __builtin_ia32_gatherdiv16sf ((__v8sf)_mm256_undefined_ps(), \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i64gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256) __builtin_ia32_gatherdiv16sf ((__v8sf)(__m256)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i64gather_pd(INDEX, ADDR, SCALE) \
(__m512d) __builtin_ia32_gatherdiv8df ((__v8df)_mm512_undefined_pd(), \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i64gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512d) __builtin_ia32_gatherdiv8df ((__v8df)(__m512d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i32gather_epi32(INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gathersiv16si ((__v16si)_mm512_undefined_epi32 (), \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v16si)(__m512i)INDEX, \
(__mmask16)0xFFFF, (int)SCALE)
#define _mm512_mask_i32gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gathersiv16si ((__v16si)(__m512i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v16si)(__m512i)INDEX, \
(__mmask16)MASK, (int)SCALE)
#define _mm512_i32gather_epi64(INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gathersiv8di ((__v8di)_mm512_undefined_epi32 (), \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i32gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gathersiv8di ((__v8di)(__m512i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i64gather_epi32(INDEX, ADDR, SCALE) \
(__m256i) __builtin_ia32_gatherdiv16si ((__v8si)_mm256_undefined_si256(), \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i64gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256i) __builtin_ia32_gatherdiv16si ((__v8si)(__m256i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i64gather_epi64(INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gatherdiv8di ((__v8di)_mm512_undefined_epi32 (), \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)0xFF, (int)SCALE)
#define _mm512_mask_i64gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m512i) __builtin_ia32_gatherdiv8di ((__v8di)(__m512i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v8di)(__m512i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm512_i32scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv16sf ((float *)ADDR, (__mmask16)0xFFFF, \
+ __builtin_ia32_scattersiv16sf ((void *)ADDR, (__mmask16)0xFFFF, \
(__v16si)(__m512i)INDEX, \
(__v16sf)(__m512)V1, (int)SCALE)
#define _mm512_mask_i32scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv16sf ((float *)ADDR, (__mmask16)MASK, \
+ __builtin_ia32_scattersiv16sf ((void *)ADDR, (__mmask16)MASK, \
(__v16si)(__m512i)INDEX, \
(__v16sf)(__m512)V1, (int)SCALE)
#define _mm512_i32scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv8df ((void *)ADDR, (__mmask8)0xFF, \
(__v8si)(__m256i)INDEX, \
(__v8df)(__m512d)V1, (int)SCALE)
#define _mm512_mask_i32scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv8df ((void *)ADDR, (__mmask8)MASK, \
(__v8si)(__m256i)INDEX, \
(__v8df)(__m512d)V1, (int)SCALE)
#define _mm512_i64scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv16sf ((float *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv16sf ((void *)ADDR, (__mmask8)0xFF, \
(__v8di)(__m512i)INDEX, \
(__v8sf)(__m256)V1, (int)SCALE)
#define _mm512_mask_i64scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv16sf ((float *)ADDR, (__mmask16)MASK, \
+ __builtin_ia32_scatterdiv16sf ((void *)ADDR, (__mmask16)MASK, \
(__v8di)(__m512i)INDEX, \
(__v8sf)(__m256)V1, (int)SCALE)
#define _mm512_i64scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv8df ((void *)ADDR, (__mmask8)0xFF, \
(__v8di)(__m512i)INDEX, \
(__v8df)(__m512d)V1, (int)SCALE)
#define _mm512_mask_i64scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv8df ((void *)ADDR, (__mmask8)MASK, \
(__v8di)(__m512i)INDEX, \
(__v8df)(__m512d)V1, (int)SCALE)
#define _mm512_i32scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv16si ((int *)ADDR, (__mmask16)0xFFFF, \
+ __builtin_ia32_scattersiv16si ((void *)ADDR, (__mmask16)0xFFFF, \
(__v16si)(__m512i)INDEX, \
(__v16si)(__m512i)V1, (int)SCALE)
#define _mm512_mask_i32scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv16si ((int *)ADDR, (__mmask16)MASK, \
+ __builtin_ia32_scattersiv16si ((void *)ADDR, (__mmask16)MASK, \
(__v16si)(__m512i)INDEX, \
(__v16si)(__m512i)V1, (int)SCALE)
#define _mm512_i32scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv8di ((void *)ADDR, (__mmask8)0xFF, \
(__v8si)(__m256i)INDEX, \
(__v8di)(__m512i)V1, (int)SCALE)
#define _mm512_mask_i32scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv8di ((void *)ADDR, (__mmask8)MASK, \
(__v8si)(__m256i)INDEX, \
(__v8di)(__m512i)V1, (int)SCALE)
#define _mm512_i64scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv16si ((int *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv16si ((void *)ADDR, (__mmask8)0xFF, \
(__v8di)(__m512i)INDEX, \
(__v8si)(__m256i)V1, (int)SCALE)
#define _mm512_mask_i64scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv16si ((int *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv16si ((void *)ADDR, (__mmask8)MASK, \
(__v8di)(__m512i)INDEX, \
(__v8si)(__m256i)V1, (int)SCALE)
#define _mm512_i64scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv8di ((void *)ADDR, (__mmask8)0xFF, \
(__v8di)(__m512i)INDEX, \
(__v8di)(__m512i)V1, (int)SCALE)
#define _mm512_mask_i64scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv8di ((void *)ADDR, (__mmask8)MASK, \
(__v8di)(__m512i)INDEX, \
(__v8di)(__m512i)V1, (int)SCALE)
#endif
diff --git a/gcc/config/i386/avx512pfintrin.h b/gcc/config/i386/avx512pfintrin.h
index 433e182344b..b6781e7deed 100644
--- a/gcc/config/i386/avx512pfintrin.h
+++ b/gcc/config/i386/avx512pfintrin.h
@@ -49,37 +49,33 @@ typedef unsigned short __mmask16;
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i32gather_pd (__m256i index, __mmask8 mask,
- void *addr, int scale, int hint)
+ void const *addr, int scale, int hint)
{
- __builtin_ia32_gatherpfdpd (mask, (__v8si) index, (long long const *) addr,
- scale, hint);
+ __builtin_ia32_gatherpfdpd (mask, (__v8si) index, addr, scale, hint);
}
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i32gather_ps (__m512i index, __mmask16 mask,
- void *addr, int scale, int hint)
+ void const *addr, int scale, int hint)
{
- __builtin_ia32_gatherpfdps (mask, (__v16si) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_gatherpfdps (mask, (__v16si) index, addr, scale, hint);
}
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i64gather_pd (__m512i index, __mmask8 mask,
- void *addr, int scale, int hint)
+ void const *addr, int scale, int hint)
{
- __builtin_ia32_gatherpfqpd (mask, (__v8di) index, (long long const *) addr,
- scale, hint);
+ __builtin_ia32_gatherpfqpd (mask, (__v8di) index, addr, scale, hint);
}
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i64gather_ps (__m512i index, __mmask8 mask,
- void *addr, int scale, int hint)
+ void const *addr, int scale, int hint)
{
- __builtin_ia32_gatherpfqps (mask, (__v8di) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_gatherpfqps (mask, (__v8di) index, addr, scale, hint);
}
extern __inline void
@@ -87,8 +83,8 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_prefetch_i32scatter_pd (void *addr, __m256i index, int scale,
int hint)
{
- __builtin_ia32_scatterpfdpd ((__mmask8) 0xFF, (__v8si) index,
- (long long const *)addr, scale, hint);
+ __builtin_ia32_scatterpfdpd ((__mmask8) 0xFF, (__v8si) index, addr, scale,
+ hint);
}
extern __inline void
@@ -96,8 +92,8 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_prefetch_i32scatter_ps (void *addr, __m512i index, int scale,
int hint)
{
- __builtin_ia32_scatterpfdps ((__mmask16) 0xFFFF, (__v16si) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfdps ((__mmask16) 0xFFFF, (__v16si) index, addr, scale,
+ hint);
}
extern __inline void
@@ -105,8 +101,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i32scatter_pd (void *addr, __mmask8 mask,
__m256i index, int scale, int hint)
{
- __builtin_ia32_scatterpfdpd (mask, (__v8si) index, (long long const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfdpd (mask, (__v8si) index, addr, scale, hint);
}
extern __inline void
@@ -114,8 +109,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i32scatter_ps (void *addr, __mmask16 mask,
__m512i index, int scale, int hint)
{
- __builtin_ia32_scatterpfdps (mask, (__v16si) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfdps (mask, (__v16si) index, addr, scale, hint);
}
extern __inline void
@@ -123,8 +117,8 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_prefetch_i64scatter_pd (void *addr, __m512i index, int scale,
int hint)
{
- __builtin_ia32_scatterpfqpd ((__mmask8) 0xFF, (__v8di) index, (long long const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfqpd ((__mmask8) 0xFF, (__v8di) index, addr, scale,
+ hint);
}
extern __inline void
@@ -132,8 +126,8 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_prefetch_i64scatter_ps (void *addr, __m512i index, int scale,
int hint)
{
- __builtin_ia32_scatterpfqps ((__mmask8) 0xFF, (__v8di) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfqps ((__mmask8) 0xFF, (__v8di) index, addr, scale,
+ hint);
}
extern __inline void
@@ -141,8 +135,7 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i64scatter_pd (void *addr, __mmask16 mask,
__m512i index, int scale, int hint)
{
- __builtin_ia32_scatterpfqpd (mask, (__v8di) index, (long long const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfqpd (mask, (__v8di) index, addr, scale, hint);
}
extern __inline void
@@ -150,58 +143,57 @@ __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_mask_prefetch_i64scatter_ps (void *addr, __mmask16 mask,
__m512i index, int scale, int hint)
{
- __builtin_ia32_scatterpfqps (mask, (__v8di) index, (int const *) addr,
- scale, hint);
+ __builtin_ia32_scatterpfqps (mask, (__v8di) index, addr, scale, hint);
}
#else
#define _mm512_mask_prefetch_i32gather_pd(INDEX, MASK, ADDR, SCALE, HINT) \
__builtin_ia32_gatherpfdpd ((__mmask8)MASK, (__v8si)(__m256i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void const *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i32gather_ps(INDEX, MASK, ADDR, SCALE, HINT) \
__builtin_ia32_gatherpfdps ((__mmask16)MASK, (__v16si)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void const *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i64gather_pd(INDEX, MASK, ADDR, SCALE, HINT) \
__builtin_ia32_gatherpfqpd ((__mmask8)MASK, (__v8di)(__m512i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i64gather_ps(INDEX, MASK, ADDR, SCALE, HINT) \
__builtin_ia32_gatherpfqps ((__mmask8)MASK, (__v8di)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_prefetch_i32scatter_pd(ADDR, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfdpd ((__mmask8)0xFF, (__v8si)(__m256i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_prefetch_i32scatter_ps(ADDR, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfdps ((__mmask16)0xFFFF, (__v16si)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i32scatter_pd(ADDR, MASK, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfdpd ((__mmask8)MASK, (__v8si)(__m256i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i32scatter_ps(ADDR, MASK, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfdps ((__mmask16)MASK, (__v16si)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_prefetch_i64scatter_pd(ADDR, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfqpd ((__mmask8)0xFF, (__v8di)(__m512i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_prefetch_i64scatter_ps(ADDR, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfqps ((__mmask8)0xFF, (__v8di)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i64scatter_pd(ADDR, MASK, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfqpd ((__mmask8)MASK, (__v8di)(__m512i)INDEX, \
- (long long const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#define _mm512_mask_prefetch_i64scatter_ps(ADDR, MASK, INDEX, SCALE, HINT) \
__builtin_ia32_scatterpfqps ((__mmask8)MASK, (__v8di)(__m512i)INDEX, \
- (int const *)ADDR, (int)SCALE, (int)HINT)
+ (void *)ADDR, (int)SCALE, (int)HINT)
#endif
#ifdef __DISABLE_AVX512PF__
diff --git a/gcc/config/i386/avx512vlintrin.h b/gcc/config/i386/avx512vlintrin.h
index 36771f6ffe2..4ae0c5442fc 100644
--- a/gcc/config/i386/avx512vlintrin.h
+++ b/gcc/config/i386/avx512vlintrin.h
@@ -10216,7 +10216,7 @@ _mm_maskz_getmant_pd (__mmask8 __U, __m128d __A,
extern __inline __m256
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i32gather_ps (__m256 __v1_old, __mmask8 __mask,
- __m256i __index, float const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m256) __builtin_ia32_gather3siv8sf ((__v8sf) __v1_old,
@@ -10228,7 +10228,7 @@ _mm256_mmask_i32gather_ps (__m256 __v1_old, __mmask8 __mask,
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i32gather_ps (__m128 __v1_old, __mmask8 __mask,
- __m128i __index, float const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128) __builtin_ia32_gather3siv4sf ((__v4sf) __v1_old,
@@ -10240,7 +10240,7 @@ _mm_mmask_i32gather_ps (__m128 __v1_old, __mmask8 __mask,
extern __inline __m256d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i32gather_pd (__m256d __v1_old, __mmask8 __mask,
- __m128i __index, double const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m256d) __builtin_ia32_gather3siv4df ((__v4df) __v1_old,
@@ -10252,7 +10252,7 @@ _mm256_mmask_i32gather_pd (__m256d __v1_old, __mmask8 __mask,
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i32gather_pd (__m128d __v1_old, __mmask8 __mask,
- __m128i __index, double const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128d) __builtin_ia32_gather3siv2df ((__v2df) __v1_old,
@@ -10264,7 +10264,7 @@ _mm_mmask_i32gather_pd (__m128d __v1_old, __mmask8 __mask,
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i64gather_ps (__m128 __v1_old, __mmask8 __mask,
- __m256i __index, float const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m128) __builtin_ia32_gather3div8sf ((__v4sf) __v1_old,
@@ -10276,7 +10276,7 @@ _mm256_mmask_i64gather_ps (__m128 __v1_old, __mmask8 __mask,
extern __inline __m128
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i64gather_ps (__m128 __v1_old, __mmask8 __mask,
- __m128i __index, float const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128) __builtin_ia32_gather3div4sf ((__v4sf) __v1_old,
@@ -10288,7 +10288,7 @@ _mm_mmask_i64gather_ps (__m128 __v1_old, __mmask8 __mask,
extern __inline __m256d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i64gather_pd (__m256d __v1_old, __mmask8 __mask,
- __m256i __index, double const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m256d) __builtin_ia32_gather3div4df ((__v4df) __v1_old,
@@ -10300,7 +10300,7 @@ _mm256_mmask_i64gather_pd (__m256d __v1_old, __mmask8 __mask,
extern __inline __m128d
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i64gather_pd (__m128d __v1_old, __mmask8 __mask,
- __m128i __index, double const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128d) __builtin_ia32_gather3div2df ((__v2df) __v1_old,
@@ -10312,7 +10312,7 @@ _mm_mmask_i64gather_pd (__m128d __v1_old, __mmask8 __mask,
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i32gather_epi32 (__m256i __v1_old, __mmask8 __mask,
- __m256i __index, int const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m256i) __builtin_ia32_gather3siv8si ((__v8si) __v1_old,
@@ -10324,7 +10324,7 @@ _mm256_mmask_i32gather_epi32 (__m256i __v1_old, __mmask8 __mask,
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i32gather_epi32 (__m128i __v1_old, __mmask8 __mask,
- __m128i __index, int const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128i) __builtin_ia32_gather3siv4si ((__v4si) __v1_old,
@@ -10336,7 +10336,7 @@ _mm_mmask_i32gather_epi32 (__m128i __v1_old, __mmask8 __mask,
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i32gather_epi64 (__m256i __v1_old, __mmask8 __mask,
- __m128i __index, long long const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m256i) __builtin_ia32_gather3siv4di ((__v4di) __v1_old,
@@ -10348,7 +10348,7 @@ _mm256_mmask_i32gather_epi64 (__m256i __v1_old, __mmask8 __mask,
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i32gather_epi64 (__m128i __v1_old, __mmask8 __mask,
- __m128i __index, long long const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128i) __builtin_ia32_gather3siv2di ((__v2di) __v1_old,
@@ -10360,7 +10360,7 @@ _mm_mmask_i32gather_epi64 (__m128i __v1_old, __mmask8 __mask,
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i64gather_epi32 (__m128i __v1_old, __mmask8 __mask,
- __m256i __index, int const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m128i) __builtin_ia32_gather3div8si ((__v4si) __v1_old,
@@ -10372,7 +10372,7 @@ _mm256_mmask_i64gather_epi32 (__m128i __v1_old, __mmask8 __mask,
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i64gather_epi32 (__m128i __v1_old, __mmask8 __mask,
- __m128i __index, int const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128i) __builtin_ia32_gather3div4si ((__v4si) __v1_old,
@@ -10384,7 +10384,7 @@ _mm_mmask_i64gather_epi32 (__m128i __v1_old, __mmask8 __mask,
extern __inline __m256i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm256_mmask_i64gather_epi64 (__m256i __v1_old, __mmask8 __mask,
- __m256i __index, long long const *__addr,
+ __m256i __index, void const *__addr,
int __scale)
{
return (__m256i) __builtin_ia32_gather3div4di ((__v4di) __v1_old,
@@ -10396,7 +10396,7 @@ _mm256_mmask_i64gather_epi64 (__m256i __v1_old, __mmask8 __mask,
extern __inline __m128i
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm_mmask_i64gather_epi64 (__m128i __v1_old, __mmask8 __mask,
- __m128i __index, long long const *__addr,
+ __m128i __index, void const *__addr,
int __scale)
{
return (__m128i) __builtin_ia32_gather3div2di ((__v2di) __v1_old,
@@ -10407,7 +10407,7 @@ _mm_mmask_i64gather_epi64 (__m128i __v1_old, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i32scatter_ps (float *__addr, __m256i __index,
+_mm256_i32scatter_ps (void *__addr, __m256i __index,
__m256 __v1, const int __scale)
{
__builtin_ia32_scattersiv8sf (__addr, (__mmask8) 0xFF,
@@ -10417,7 +10417,7 @@ _mm256_i32scatter_ps (float *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i32scatter_ps (float *__addr, __mmask8 __mask,
+_mm256_mask_i32scatter_ps (void *__addr, __mmask8 __mask,
__m256i __index, __m256 __v1,
const int __scale)
{
@@ -10427,7 +10427,7 @@ _mm256_mask_i32scatter_ps (float *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i32scatter_ps (float *__addr, __m128i __index, __m128 __v1,
+_mm_i32scatter_ps (void *__addr, __m128i __index, __m128 __v1,
const int __scale)
{
__builtin_ia32_scattersiv4sf (__addr, (__mmask8) 0xFF,
@@ -10437,7 +10437,7 @@ _mm_i32scatter_ps (float *__addr, __m128i __index, __m128 __v1,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i32scatter_ps (float *__addr, __mmask8 __mask,
+_mm_mask_i32scatter_ps (void *__addr, __mmask8 __mask,
__m128i __index, __m128 __v1,
const int __scale)
{
@@ -10447,7 +10447,7 @@ _mm_mask_i32scatter_ps (float *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i32scatter_pd (double *__addr, __m128i __index,
+_mm256_i32scatter_pd (void *__addr, __m128i __index,
__m256d __v1, const int __scale)
{
__builtin_ia32_scattersiv4df (__addr, (__mmask8) 0xFF,
@@ -10457,7 +10457,7 @@ _mm256_i32scatter_pd (double *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
+_mm256_mask_i32scatter_pd (void *__addr, __mmask8 __mask,
__m128i __index, __m256d __v1,
const int __scale)
{
@@ -10467,7 +10467,7 @@ _mm256_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i32scatter_pd (double *__addr, __m128i __index,
+_mm_i32scatter_pd (void *__addr, __m128i __index,
__m128d __v1, const int __scale)
{
__builtin_ia32_scattersiv2df (__addr, (__mmask8) 0xFF,
@@ -10477,7 +10477,7 @@ _mm_i32scatter_pd (double *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
+_mm_mask_i32scatter_pd (void *__addr, __mmask8 __mask,
__m128i __index, __m128d __v1,
const int __scale)
{
@@ -10487,7 +10487,7 @@ _mm_mask_i32scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i64scatter_ps (float *__addr, __m256i __index,
+_mm256_i64scatter_ps (void *__addr, __m256i __index,
__m128 __v1, const int __scale)
{
__builtin_ia32_scatterdiv8sf (__addr, (__mmask8) 0xFF,
@@ -10497,7 +10497,7 @@ _mm256_i64scatter_ps (float *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
+_mm256_mask_i64scatter_ps (void *__addr, __mmask8 __mask,
__m256i __index, __m128 __v1,
const int __scale)
{
@@ -10507,7 +10507,7 @@ _mm256_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i64scatter_ps (float *__addr, __m128i __index, __m128 __v1,
+_mm_i64scatter_ps (void *__addr, __m128i __index, __m128 __v1,
const int __scale)
{
__builtin_ia32_scatterdiv4sf (__addr, (__mmask8) 0xFF,
@@ -10517,7 +10517,7 @@ _mm_i64scatter_ps (float *__addr, __m128i __index, __m128 __v1,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
+_mm_mask_i64scatter_ps (void *__addr, __mmask8 __mask,
__m128i __index, __m128 __v1,
const int __scale)
{
@@ -10527,7 +10527,7 @@ _mm_mask_i64scatter_ps (float *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i64scatter_pd (double *__addr, __m256i __index,
+_mm256_i64scatter_pd (void *__addr, __m256i __index,
__m256d __v1, const int __scale)
{
__builtin_ia32_scatterdiv4df (__addr, (__mmask8) 0xFF,
@@ -10537,7 +10537,7 @@ _mm256_i64scatter_pd (double *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
+_mm256_mask_i64scatter_pd (void *__addr, __mmask8 __mask,
__m256i __index, __m256d __v1,
const int __scale)
{
@@ -10547,7 +10547,7 @@ _mm256_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i64scatter_pd (double *__addr, __m128i __index,
+_mm_i64scatter_pd (void *__addr, __m128i __index,
__m128d __v1, const int __scale)
{
__builtin_ia32_scatterdiv2df (__addr, (__mmask8) 0xFF,
@@ -10557,7 +10557,7 @@ _mm_i64scatter_pd (double *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
+_mm_mask_i64scatter_pd (void *__addr, __mmask8 __mask,
__m128i __index, __m128d __v1,
const int __scale)
{
@@ -10567,7 +10567,7 @@ _mm_mask_i64scatter_pd (double *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i32scatter_epi32 (int *__addr, __m256i __index,
+_mm256_i32scatter_epi32 (void *__addr, __m256i __index,
__m256i __v1, const int __scale)
{
__builtin_ia32_scattersiv8si (__addr, (__mmask8) 0xFF,
@@ -10577,7 +10577,7 @@ _mm256_i32scatter_epi32 (int *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i32scatter_epi32 (int *__addr, __mmask8 __mask,
+_mm256_mask_i32scatter_epi32 (void *__addr, __mmask8 __mask,
__m256i __index, __m256i __v1,
const int __scale)
{
@@ -10587,7 +10587,7 @@ _mm256_mask_i32scatter_epi32 (int *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i32scatter_epi32 (int *__addr, __m128i __index,
+_mm_i32scatter_epi32 (void *__addr, __m128i __index,
__m128i __v1, const int __scale)
{
__builtin_ia32_scattersiv4si (__addr, (__mmask8) 0xFF,
@@ -10597,7 +10597,7 @@ _mm_i32scatter_epi32 (int *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i32scatter_epi32 (int *__addr, __mmask8 __mask,
+_mm_mask_i32scatter_epi32 (void *__addr, __mmask8 __mask,
__m128i __index, __m128i __v1,
const int __scale)
{
@@ -10607,7 +10607,7 @@ _mm_mask_i32scatter_epi32 (int *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i32scatter_epi64 (long long *__addr, __m128i __index,
+_mm256_i32scatter_epi64 (void *__addr, __m128i __index,
__m256i __v1, const int __scale)
{
__builtin_ia32_scattersiv4di (__addr, (__mmask8) 0xFF,
@@ -10617,7 +10617,7 @@ _mm256_i32scatter_epi64 (long long *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm256_mask_i32scatter_epi64 (void *__addr, __mmask8 __mask,
__m128i __index, __m256i __v1,
const int __scale)
{
@@ -10627,7 +10627,7 @@ _mm256_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i32scatter_epi64 (long long *__addr, __m128i __index,
+_mm_i32scatter_epi64 (void *__addr, __m128i __index,
__m128i __v1, const int __scale)
{
__builtin_ia32_scattersiv2di (__addr, (__mmask8) 0xFF,
@@ -10637,7 +10637,7 @@ _mm_i32scatter_epi64 (long long *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm_mask_i32scatter_epi64 (void *__addr, __mmask8 __mask,
__m128i __index, __m128i __v1,
const int __scale)
{
@@ -10647,7 +10647,7 @@ _mm_mask_i32scatter_epi64 (long long *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i64scatter_epi32 (int *__addr, __m256i __index,
+_mm256_i64scatter_epi32 (void *__addr, __m256i __index,
__m128i __v1, const int __scale)
{
__builtin_ia32_scatterdiv8si (__addr, (__mmask8) 0xFF,
@@ -10657,7 +10657,7 @@ _mm256_i64scatter_epi32 (int *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
+_mm256_mask_i64scatter_epi32 (void *__addr, __mmask8 __mask,
__m256i __index, __m128i __v1,
const int __scale)
{
@@ -10667,7 +10667,7 @@ _mm256_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i64scatter_epi32 (int *__addr, __m128i __index,
+_mm_i64scatter_epi32 (void *__addr, __m128i __index,
__m128i __v1, const int __scale)
{
__builtin_ia32_scatterdiv4si (__addr, (__mmask8) 0xFF,
@@ -10677,7 +10677,7 @@ _mm_i64scatter_epi32 (int *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
+_mm_mask_i64scatter_epi32 (void *__addr, __mmask8 __mask,
__m128i __index, __m128i __v1,
const int __scale)
{
@@ -10687,7 +10687,7 @@ _mm_mask_i64scatter_epi32 (int *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_i64scatter_epi64 (long long *__addr, __m256i __index,
+_mm256_i64scatter_epi64 (void *__addr, __m256i __index,
__m256i __v1, const int __scale)
{
__builtin_ia32_scatterdiv4di (__addr, (__mmask8) 0xFF,
@@ -10697,7 +10697,7 @@ _mm256_i64scatter_epi64 (long long *__addr, __m256i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm256_mask_i64scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm256_mask_i64scatter_epi64 (void *__addr, __mmask8 __mask,
__m256i __index, __m256i __v1,
const int __scale)
{
@@ -10707,7 +10707,7 @@ _mm256_mask_i64scatter_epi64 (long long *__addr, __mmask8 __mask,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_i64scatter_epi64 (long long *__addr, __m128i __index,
+_mm_i64scatter_epi64 (void *__addr, __m128i __index,
__m128i __v1, const int __scale)
{
__builtin_ia32_scatterdiv2di (__addr, (__mmask8) 0xFF,
@@ -10717,7 +10717,7 @@ _mm_i64scatter_epi64 (long long *__addr, __m128i __index,
extern __inline void
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
-_mm_mask_i64scatter_epi64 (long long *__addr, __mmask8 __mask,
+_mm_mask_i64scatter_epi64 (void *__addr, __mmask8 __mask,
__m128i __index, __m128i __v1,
const int __scale)
{
@@ -12868,257 +12868,257 @@ _mm_cmple_epi64_mask (__m128i __X, __m128i __Y)
#define _mm256_mmask_i32gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256) __builtin_ia32_gather3siv8sf ((__v8sf)(__m256)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i32gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128) __builtin_ia32_gather3siv4sf ((__v4sf)(__m128)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i32gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256d) __builtin_ia32_gather3siv4df ((__v4df)(__m256d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i32gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128d) __builtin_ia32_gather3siv2df ((__v2df)(__m128d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i64gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128) __builtin_ia32_gather3div8sf ((__v4sf)(__m128)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v4di)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i64gather_ps(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128) __builtin_ia32_gather3div4sf ((__v4sf)(__m128)V1OLD, \
- (float const *)ADDR, \
+ (void const *)ADDR, \
(__v2di)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i64gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256d) __builtin_ia32_gather3div4df ((__v4df)(__m256d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v4di)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i64gather_pd(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128d) __builtin_ia32_gather3div2df ((__v2df)(__m128d)V1OLD, \
- (double const *)ADDR, \
+ (void const *)ADDR, \
(__v2di)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i32gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256i) __builtin_ia32_gather3siv8si ((__v8si)(__m256i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v8si)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i32gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128i) __builtin_ia32_gather3siv4si ((__v4si)(__m128i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i32gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256i) __builtin_ia32_gather3siv4di ((__v4di)(__m256i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i32gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128i) __builtin_ia32_gather3siv2di ((__v2di)(__m128i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v4si)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i64gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128i) __builtin_ia32_gather3div8si ((__v4si)(__m128i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v4di)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i64gather_epi32(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128i) __builtin_ia32_gather3div4si ((__v4si)(__m128i)V1OLD, \
- (int const *)ADDR, \
+ (void const *)ADDR, \
(__v2di)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_mmask_i64gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m256i) __builtin_ia32_gather3div4di ((__v4di)(__m256i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v4di)(__m256i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm_mmask_i64gather_epi64(V1OLD, MASK, INDEX, ADDR, SCALE) \
(__m128i) __builtin_ia32_gather3div2di ((__v2di)(__m128i)V1OLD, \
- (long long const *)ADDR, \
+ (void const *)ADDR, \
(__v2di)(__m128i)INDEX, \
(__mmask8)MASK, (int)SCALE)
#define _mm256_i32scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8sf ((float *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv8sf ((void *)ADDR, (__mmask8)0xFF, \
(__v8si)(__m256i)INDEX, \
(__v8sf)(__m256)V1, (int)SCALE)
#define _mm256_mask_i32scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8sf ((float *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv8sf ((void *)ADDR, (__mmask8)MASK, \
(__v8si)(__m256i)INDEX, \
(__v8sf)(__m256)V1, (int)SCALE)
#define _mm_i32scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4sf ((float *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv4sf ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm_mask_i32scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4sf ((float *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv4sf ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm256_i32scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv4df ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v4df)(__m256d)V1, (int)SCALE)
#define _mm256_mask_i32scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv4df ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v4df)(__m256d)V1, (int)SCALE)
#define _mm_i32scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv2df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv2df ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v2df)(__m128d)V1, (int)SCALE)
#define _mm_mask_i32scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv2df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv2df ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v2df)(__m128d)V1, (int)SCALE)
#define _mm256_i64scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8sf ((float *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv8sf ((void *)ADDR, (__mmask8)0xFF, \
(__v4di)(__m256i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm256_mask_i64scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8sf ((float *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv8sf ((void *)ADDR, (__mmask8)MASK, \
(__v4di)(__m256i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm_i64scatter_ps(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4sf ((float *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv4sf ((void *)ADDR, (__mmask8)0xFF, \
(__v2di)(__m128i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm_mask_i64scatter_ps(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4sf ((float *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv4sf ((void *)ADDR, (__mmask8)MASK, \
(__v2di)(__m128i)INDEX, \
(__v4sf)(__m128)V1, (int)SCALE)
#define _mm256_i64scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv4df ((void *)ADDR, (__mmask8)0xFF, \
(__v4di)(__m256i)INDEX, \
(__v4df)(__m256d)V1, (int)SCALE)
#define _mm256_mask_i64scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv4df ((void *)ADDR, (__mmask8)MASK, \
(__v4di)(__m256i)INDEX, \
(__v4df)(__m256d)V1, (int)SCALE)
#define _mm_i64scatter_pd(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv2df ((double *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv2df ((void *)ADDR, (__mmask8)0xFF, \
(__v2di)(__m128i)INDEX, \
(__v2df)(__m128d)V1, (int)SCALE)
#define _mm_mask_i64scatter_pd(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv2df ((double *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv2df ((void *)ADDR, (__mmask8)MASK, \
(__v2di)(__m128i)INDEX, \
(__v2df)(__m128d)V1, (int)SCALE)
#define _mm256_i32scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8si ((int *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv8si ((void *)ADDR, (__mmask8)0xFF, \
(__v8si)(__m256i)INDEX, \
(__v8si)(__m256i)V1, (int)SCALE)
#define _mm256_mask_i32scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv8si ((int *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv8si ((void *)ADDR, (__mmask8)MASK, \
(__v8si)(__m256i)INDEX, \
(__v8si)(__m256i)V1, (int)SCALE)
#define _mm_i32scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4si ((int *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv4si ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm_mask_i32scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4si ((int *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv4si ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm256_i32scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv4di ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v4di)(__m256i)V1, (int)SCALE)
#define _mm256_mask_i32scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv4di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv4di ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v4di)(__m256i)V1, (int)SCALE)
#define _mm_i32scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv2di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scattersiv2di ((void *)ADDR, (__mmask8)0xFF, \
(__v4si)(__m128i)INDEX, \
(__v2di)(__m128i)V1, (int)SCALE)
#define _mm_mask_i32scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scattersiv2di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scattersiv2di ((void *)ADDR, (__mmask8)MASK, \
(__v4si)(__m128i)INDEX, \
(__v2di)(__m128i)V1, (int)SCALE)
#define _mm256_i64scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8si ((int *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv8si ((void *)ADDR, (__mmask8)0xFF, \
(__v4di)(__m256i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm256_mask_i64scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv8si ((int *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv8si ((void *)ADDR, (__mmask8)MASK, \
(__v4di)(__m256i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm_i64scatter_epi32(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4si ((int *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv4si ((void *)ADDR, (__mmask8)0xFF, \
(__v2di)(__m128i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm_mask_i64scatter_epi32(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4si ((int *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv4si ((void *)ADDR, (__mmask8)MASK, \
(__v2di)(__m128i)INDEX, \
(__v4si)(__m128i)V1, (int)SCALE)
#define _mm256_i64scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv4di ((void *)ADDR, (__mmask8)0xFF, \
(__v4di)(__m256i)INDEX, \
(__v4di)(__m256i)V1, (int)SCALE)
#define _mm256_mask_i64scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv4di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv4di ((void *)ADDR, (__mmask8)MASK, \
(__v4di)(__m256i)INDEX, \
(__v4di)(__m256i)V1, (int)SCALE)
#define _mm_i64scatter_epi64(ADDR, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv2di ((long long *)ADDR, (__mmask8)0xFF, \
+ __builtin_ia32_scatterdiv2di ((void *)ADDR, (__mmask8)0xFF, \
(__v2di)(__m128i)INDEX, \
(__v2di)(__m128i)V1, (int)SCALE)
#define _mm_mask_i64scatter_epi64(ADDR, MASK, INDEX, V1, SCALE) \
- __builtin_ia32_scatterdiv2di ((long long *)ADDR, (__mmask8)MASK, \
+ __builtin_ia32_scatterdiv2di ((void *)ADDR, (__mmask8)MASK, \
(__v2di)(__m128i)INDEX, \
(__v2di)(__m128i)V1, (int)SCALE)
diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h
index 8e4bbdc6747..1ddc6e2e6a8 100644
--- a/gcc/config/i386/cpuid.h
+++ b/gcc/config/i386/cpuid.h
@@ -63,7 +63,7 @@
#define bit_MMXEXT (1 << 22)
#define bit_LM (1 << 29)
#define bit_3DNOWP (1 << 30)
-#define bit_3DNOW (1 << 31)
+#define bit_3DNOW (1u << 31)
/* Extended Features (%eax == 7) */
/* %ebx */
@@ -86,7 +86,7 @@
#define bit_AVX512CD (1 << 28)
#define bit_SHA (1 << 29)
#define bit_AVX512BW (1 << 30)
-#define bit_AVX512VL (1 << 31)
+#define bit_AVX512VL (1u << 31)
/* %ecx */
#define bit_PREFETCHWT1 (1 << 0)
diff --git a/gcc/config/i386/i386-builtin-types.def b/gcc/config/i386/i386-builtin-types.def
index 2459c440ba5..bca9727692d 100644
--- a/gcc/config/i386/i386-builtin-types.def
+++ b/gcc/config/i386/i386-builtin-types.def
@@ -1117,37 +1117,13 @@ DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V2DI, V4SI, INT)
DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V4DI, V4SI, INT)
DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V4DI, V8SI, INT)
-DEF_FUNCTION_TYPE (V16SF, V16SF, PCFLOAT, V16SI, HI, INT)
DEF_FUNCTION_TYPE (V16SF, V16SF, PCFLOAT, V8DI, HI, INT)
-DEF_FUNCTION_TYPE (V8DF, V8DF, PCDOUBLE, V8SI, QI, INT)
DEF_FUNCTION_TYPE (V8DF, V8DF, PCDOUBLE, V16SI, QI, INT)
-DEF_FUNCTION_TYPE (V8SF, V8SF, PCFLOAT, V8DI, QI, INT)
-DEF_FUNCTION_TYPE (V8DF, V8DF, PCDOUBLE, V8DI, QI, INT)
-DEF_FUNCTION_TYPE (V16SI, V16SI, PCINT, V16SI, HI, INT)
DEF_FUNCTION_TYPE (V16SI, V16SI, PCINT, V8DI, HI, INT)
-DEF_FUNCTION_TYPE (V8DI, V8DI, PCINT64, V8SI, QI, INT)
DEF_FUNCTION_TYPE (V8DI, V8DI, PCINT64, V16SI, QI, INT)
-DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V8DI, QI, INT)
-DEF_FUNCTION_TYPE (V8DI, V8DI, PCINT64, V8DI, QI, INT)
-DEF_FUNCTION_TYPE (V2DF, V2DF, PCDOUBLE, V4SI, QI, INT)
-DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V4SI, QI, INT)
DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V8SI, QI, INT)
-DEF_FUNCTION_TYPE (V2DF, V2DF, PCDOUBLE, V2DI, QI, INT)
-DEF_FUNCTION_TYPE (V4DF, V4DF, PCDOUBLE, V4DI, QI, INT)
-DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V4SI, QI, INT)
-DEF_FUNCTION_TYPE (V8SF, V8SF, PCFLOAT, V8SI, QI, INT)
-DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V2DI, QI, INT)
-DEF_FUNCTION_TYPE (V4SF, V4SF, PCFLOAT, V4DI, QI, INT)
DEF_FUNCTION_TYPE (V8SF, V8SF, PCFLOAT, V4DI, QI, INT)
-DEF_FUNCTION_TYPE (V2DI, V2DI, PCINT64, V4SI, QI, INT)
-DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V4SI, QI, INT)
DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V8SI, QI, INT)
-DEF_FUNCTION_TYPE (V2DI, V2DI, PCINT64, V2DI, QI, INT)
-DEF_FUNCTION_TYPE (V4DI, V4DI, PCINT64, V4DI, QI, INT)
-DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V4SI, QI, INT)
-DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V8SI, QI, INT)
-DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V2DI, QI, INT)
-DEF_FUNCTION_TYPE (V4SI, V4SI, PCINT, V4DI, QI, INT)
DEF_FUNCTION_TYPE (V8SI, V8SI, PCINT, V4DI, QI, INT)
DEF_FUNCTION_TYPE (VOID, PFLOAT, HI, V16SI, V16SF, INT)
@@ -1172,13 +1148,62 @@ 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)
-DEF_FUNCTION_TYPE (VOID, PLONGLONG, QI, V2DI, V2DI, INT)
-DEF_FUNCTION_TYPE (VOID, HI, V16SI, PCINT, INT, INT)
-DEF_FUNCTION_TYPE (VOID, QI, V8DI, PCINT64, INT, INT)
-DEF_FUNCTION_TYPE (VOID, QI, V8DI, PCINT, INT, INT)
+DEF_FUNCTION_TYPE (V16SF, V16SF, PCVOID, V16SI, HI, INT)
+DEF_FUNCTION_TYPE (V8DF, V8DF, PCVOID, V8SI, QI, INT)
+DEF_FUNCTION_TYPE (V8SF, V8SF, PCVOID, V8DI, QI, INT)
+DEF_FUNCTION_TYPE (V8DF, V8DF, PCVOID, V8DI, QI, INT)
+DEF_FUNCTION_TYPE (V16SI, V16SI, PCVOID, V16SI, HI, INT)
+DEF_FUNCTION_TYPE (V8DI, V8DI, PCVOID, V8SI, QI, INT)
+DEF_FUNCTION_TYPE (V8SI, V8SI, PCVOID, V8DI, QI, INT)
+DEF_FUNCTION_TYPE (V8DI, V8DI, PCVOID, V8DI, QI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, HI, V16SI, V16SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8SI, V8DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8DI, V8SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8DI, V8DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, HI, V16SI, V16SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8SI, V8DI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8DI, V8SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8DI, V8DI, INT)
+DEF_FUNCTION_TYPE (V2DF, V2DF, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V4DF, V4DF, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V2DF, V2DF, PCVOID, V2DI, QI, INT)
+DEF_FUNCTION_TYPE (V4DF, V4DF, PCVOID, V4DI, QI, INT)
+DEF_FUNCTION_TYPE (V4SF, V4SF, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V8SF, V8SF, PCVOID, V8SI, QI, INT)
+DEF_FUNCTION_TYPE (V4SF, V4SF, PCVOID, V2DI, QI, INT)
+DEF_FUNCTION_TYPE (V4SF, V4SF, PCVOID, V4DI, QI, INT)
+DEF_FUNCTION_TYPE (V2DI, V2DI, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V4DI, V4DI, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V2DI, V2DI, PCVOID, V2DI, QI, INT)
+DEF_FUNCTION_TYPE (V4DI, V4DI, PCVOID, V4DI, QI, INT)
+DEF_FUNCTION_TYPE (V4SI, V4SI, PCVOID, V4SI, QI, INT)
+DEF_FUNCTION_TYPE (V8SI, V8SI, PCVOID, V8SI, QI, INT)
+DEF_FUNCTION_TYPE (V4SI, V4SI, PCVOID, V2DI, QI, INT)
+DEF_FUNCTION_TYPE (V4SI, V4SI, PCVOID, V4DI, QI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8SI, V8SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V4SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V4DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V2DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4DI, V4SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V2DI, V4SF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4DI, V4DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V2DI, V2DF, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V8SI, V8SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V4SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V4DI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4SI, V2DI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4DI, V4SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V2DI, V4SI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V4DI, V4DI, INT)
+DEF_FUNCTION_TYPE (VOID, PVOID, QI, V2DI, V2DI, INT)
+DEF_FUNCTION_TYPE (VOID, QI, V8SI, PCVOID, INT, INT)
+DEF_FUNCTION_TYPE (VOID, HI, V16SI, PCVOID, INT, INT)
+DEF_FUNCTION_TYPE (VOID, QI, V8DI, PCVOID, INT, INT)
DEF_FUNCTION_TYPE_ALIAS (V2DF_FTYPE_V2DF, ROUND)
DEF_FUNCTION_TYPE_ALIAS (V4DF_FTYPE_V4DF, ROUND)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2276ff25ba6..18b136a5366 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -27671,7 +27671,7 @@ ix86_local_alignment (tree exp, machine_mode mode,
!= TYPE_MAIN_VARIANT (va_list_type_node)))
&& TYPE_SIZE (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
- && wi::geu_p (TYPE_SIZE (type), 16)
+ && wi::geu_p (TYPE_SIZE (type), 128)
&& align < 128)
return 128;
}
@@ -34005,35 +34005,35 @@ ix86_init_mmx_sse_builtins (void)
/* AVX512F */
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16sf",
- V16SF_FTYPE_V16SF_PCFLOAT_V16SI_HI_INT,
+ V16SF_FTYPE_V16SF_PCVOID_V16SI_HI_INT,
IX86_BUILTIN_GATHER3SIV16SF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8df",
- V8DF_FTYPE_V8DF_PCDOUBLE_V8SI_QI_INT,
+ V8DF_FTYPE_V8DF_PCVOID_V8SI_QI_INT,
IX86_BUILTIN_GATHER3SIV8DF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16sf",
- V8SF_FTYPE_V8SF_PCFLOAT_V8DI_QI_INT,
+ V8SF_FTYPE_V8SF_PCVOID_V8DI_QI_INT,
IX86_BUILTIN_GATHER3DIV16SF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8df",
- V8DF_FTYPE_V8DF_PCDOUBLE_V8DI_QI_INT,
+ V8DF_FTYPE_V8DF_PCVOID_V8DI_QI_INT,
IX86_BUILTIN_GATHER3DIV8DF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv16si",
- V16SI_FTYPE_V16SI_PCINT_V16SI_HI_INT,
+ V16SI_FTYPE_V16SI_PCVOID_V16SI_HI_INT,
IX86_BUILTIN_GATHER3SIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gathersiv8di",
- V8DI_FTYPE_V8DI_PCINT64_V8SI_QI_INT,
+ V8DI_FTYPE_V8DI_PCVOID_V8SI_QI_INT,
IX86_BUILTIN_GATHER3SIV8DI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv16si",
- V8SI_FTYPE_V8SI_PCINT_V8DI_QI_INT,
+ V8SI_FTYPE_V8SI_PCVOID_V8DI_QI_INT,
IX86_BUILTIN_GATHER3DIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatherdiv8di",
- V8DI_FTYPE_V8DI_PCINT64_V8DI_QI_INT,
+ V8DI_FTYPE_V8DI_PCVOID_V8DI_QI_INT,
IX86_BUILTIN_GATHER3DIV8DI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_gatheraltsiv8df ",
@@ -34053,100 +34053,100 @@ ix86_init_mmx_sse_builtins (void)
IX86_BUILTIN_GATHER3ALTDIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scattersiv16sf",
- VOID_FTYPE_PFLOAT_HI_V16SI_V16SF_INT,
+ VOID_FTYPE_PVOID_HI_V16SI_V16SF_INT,
IX86_BUILTIN_SCATTERSIV16SF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scattersiv8df",
- VOID_FTYPE_PDOUBLE_QI_V8SI_V8DF_INT,
+ VOID_FTYPE_PVOID_QI_V8SI_V8DF_INT,
IX86_BUILTIN_SCATTERSIV8DF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatterdiv16sf",
- VOID_FTYPE_PFLOAT_QI_V8DI_V8SF_INT,
+ VOID_FTYPE_PVOID_QI_V8DI_V8SF_INT,
IX86_BUILTIN_SCATTERDIV16SF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatterdiv8df",
- VOID_FTYPE_PDOUBLE_QI_V8DI_V8DF_INT,
+ VOID_FTYPE_PVOID_QI_V8DI_V8DF_INT,
IX86_BUILTIN_SCATTERDIV8DF);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scattersiv16si",
- VOID_FTYPE_PINT_HI_V16SI_V16SI_INT,
+ VOID_FTYPE_PVOID_HI_V16SI_V16SI_INT,
IX86_BUILTIN_SCATTERSIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scattersiv8di",
- VOID_FTYPE_PLONGLONG_QI_V8SI_V8DI_INT,
+ VOID_FTYPE_PVOID_QI_V8SI_V8DI_INT,
IX86_BUILTIN_SCATTERSIV8DI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatterdiv16si",
- VOID_FTYPE_PINT_QI_V8DI_V8SI_INT,
+ VOID_FTYPE_PVOID_QI_V8DI_V8SI_INT,
IX86_BUILTIN_SCATTERDIV16SI);
def_builtin (OPTION_MASK_ISA_AVX512F, "__builtin_ia32_scatterdiv8di",
- VOID_FTYPE_PLONGLONG_QI_V8DI_V8DI_INT,
+ VOID_FTYPE_PVOID_QI_V8DI_V8DI_INT,
IX86_BUILTIN_SCATTERDIV8DI);
/* AVX512VL */
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2df",
- V2DF_FTYPE_V2DF_PCDOUBLE_V4SI_QI_INT,
+ V2DF_FTYPE_V2DF_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV2DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4df",
- V4DF_FTYPE_V4DF_PCDOUBLE_V4SI_QI_INT,
+ V4DF_FTYPE_V4DF_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV4DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2df",
- V2DF_FTYPE_V2DF_PCDOUBLE_V2DI_QI_INT,
+ V2DF_FTYPE_V2DF_PCVOID_V2DI_QI_INT,
IX86_BUILTIN_GATHER3DIV2DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4df",
- V4DF_FTYPE_V4DF_PCDOUBLE_V4DI_QI_INT,
+ V4DF_FTYPE_V4DF_PCVOID_V4DI_QI_INT,
IX86_BUILTIN_GATHER3DIV4DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4sf",
- V4SF_FTYPE_V4SF_PCFLOAT_V4SI_QI_INT,
+ V4SF_FTYPE_V4SF_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV4SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8sf",
- V8SF_FTYPE_V8SF_PCFLOAT_V8SI_QI_INT,
+ V8SF_FTYPE_V8SF_PCVOID_V8SI_QI_INT,
IX86_BUILTIN_GATHER3SIV8SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4sf",
- V4SF_FTYPE_V4SF_PCFLOAT_V2DI_QI_INT,
+ V4SF_FTYPE_V4SF_PCVOID_V2DI_QI_INT,
IX86_BUILTIN_GATHER3DIV4SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8sf",
- V4SF_FTYPE_V4SF_PCFLOAT_V4DI_QI_INT,
+ V4SF_FTYPE_V4SF_PCVOID_V4DI_QI_INT,
IX86_BUILTIN_GATHER3DIV8SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv2di",
- V2DI_FTYPE_V2DI_PCINT64_V4SI_QI_INT,
+ V2DI_FTYPE_V2DI_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV2DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4di",
- V4DI_FTYPE_V4DI_PCINT64_V4SI_QI_INT,
+ V4DI_FTYPE_V4DI_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV4DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div2di",
- V2DI_FTYPE_V2DI_PCINT64_V2DI_QI_INT,
+ V2DI_FTYPE_V2DI_PCVOID_V2DI_QI_INT,
IX86_BUILTIN_GATHER3DIV2DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4di",
- V4DI_FTYPE_V4DI_PCINT64_V4DI_QI_INT,
+ V4DI_FTYPE_V4DI_PCVOID_V4DI_QI_INT,
IX86_BUILTIN_GATHER3DIV4DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv4si",
- V4SI_FTYPE_V4SI_PCINT_V4SI_QI_INT,
+ V4SI_FTYPE_V4SI_PCVOID_V4SI_QI_INT,
IX86_BUILTIN_GATHER3SIV4SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3siv8si",
- V8SI_FTYPE_V8SI_PCINT_V8SI_QI_INT,
+ V8SI_FTYPE_V8SI_PCVOID_V8SI_QI_INT,
IX86_BUILTIN_GATHER3SIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div4si",
- V4SI_FTYPE_V4SI_PCINT_V2DI_QI_INT,
+ V4SI_FTYPE_V4SI_PCVOID_V2DI_QI_INT,
IX86_BUILTIN_GATHER3DIV4SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3div8si",
- V4SI_FTYPE_V4SI_PCINT_V4DI_QI_INT,
+ V4SI_FTYPE_V4SI_PCVOID_V4DI_QI_INT,
IX86_BUILTIN_GATHER3DIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_gather3altsiv4df ",
@@ -34166,93 +34166,93 @@ ix86_init_mmx_sse_builtins (void)
IX86_BUILTIN_GATHER3ALTDIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv8sf",
- VOID_FTYPE_PFLOAT_QI_V8SI_V8SF_INT,
+ VOID_FTYPE_PVOID_QI_V8SI_V8SF_INT,
IX86_BUILTIN_SCATTERSIV8SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv4sf",
- VOID_FTYPE_PFLOAT_QI_V4SI_V4SF_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V4SF_INT,
IX86_BUILTIN_SCATTERSIV4SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv4df",
- VOID_FTYPE_PDOUBLE_QI_V4SI_V4DF_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V4DF_INT,
IX86_BUILTIN_SCATTERSIV4DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv2df",
- VOID_FTYPE_PDOUBLE_QI_V4SI_V2DF_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V2DF_INT,
IX86_BUILTIN_SCATTERSIV2DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv8sf",
- VOID_FTYPE_PFLOAT_QI_V4DI_V4SF_INT,
+ VOID_FTYPE_PVOID_QI_V4DI_V4SF_INT,
IX86_BUILTIN_SCATTERDIV8SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv4sf",
- VOID_FTYPE_PFLOAT_QI_V2DI_V4SF_INT,
+ VOID_FTYPE_PVOID_QI_V2DI_V4SF_INT,
IX86_BUILTIN_SCATTERDIV4SF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv4df",
- VOID_FTYPE_PDOUBLE_QI_V4DI_V4DF_INT,
+ VOID_FTYPE_PVOID_QI_V4DI_V4DF_INT,
IX86_BUILTIN_SCATTERDIV4DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv2df",
- VOID_FTYPE_PDOUBLE_QI_V2DI_V2DF_INT,
+ VOID_FTYPE_PVOID_QI_V2DI_V2DF_INT,
IX86_BUILTIN_SCATTERDIV2DF);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv8si",
- VOID_FTYPE_PINT_QI_V8SI_V8SI_INT,
+ VOID_FTYPE_PVOID_QI_V8SI_V8SI_INT,
IX86_BUILTIN_SCATTERSIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv4si",
- VOID_FTYPE_PINT_QI_V4SI_V4SI_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V4SI_INT,
IX86_BUILTIN_SCATTERSIV4SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv4di",
- VOID_FTYPE_PLONGLONG_QI_V4SI_V4DI_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V4DI_INT,
IX86_BUILTIN_SCATTERSIV4DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scattersiv2di",
- VOID_FTYPE_PLONGLONG_QI_V4SI_V2DI_INT,
+ VOID_FTYPE_PVOID_QI_V4SI_V2DI_INT,
IX86_BUILTIN_SCATTERSIV2DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv8si",
- VOID_FTYPE_PINT_QI_V4DI_V4SI_INT,
+ VOID_FTYPE_PVOID_QI_V4DI_V4SI_INT,
IX86_BUILTIN_SCATTERDIV8SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv4si",
- VOID_FTYPE_PINT_QI_V2DI_V4SI_INT,
+ VOID_FTYPE_PVOID_QI_V2DI_V4SI_INT,
IX86_BUILTIN_SCATTERDIV4SI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv4di",
- VOID_FTYPE_PLONGLONG_QI_V4DI_V4DI_INT,
+ VOID_FTYPE_PVOID_QI_V4DI_V4DI_INT,
IX86_BUILTIN_SCATTERDIV4DI);
def_builtin (OPTION_MASK_ISA_AVX512VL, "__builtin_ia32_scatterdiv2di",
- VOID_FTYPE_PLONGLONG_QI_V2DI_V2DI_INT,
+ VOID_FTYPE_PVOID_QI_V2DI_V2DI_INT,
IX86_BUILTIN_SCATTERDIV2DI);
/* AVX512PF */
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdpd",
- VOID_FTYPE_QI_V8SI_PCINT64_INT_INT,
+ VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
IX86_BUILTIN_GATHERPFDPD);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfdps",
- VOID_FTYPE_HI_V16SI_PCINT_INT_INT,
+ VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
IX86_BUILTIN_GATHERPFDPS);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqpd",
- VOID_FTYPE_QI_V8DI_PCINT64_INT_INT,
+ VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
IX86_BUILTIN_GATHERPFQPD);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_gatherpfqps",
- VOID_FTYPE_QI_V8DI_PCINT_INT_INT,
+ VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
IX86_BUILTIN_GATHERPFQPS);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfdpd",
- VOID_FTYPE_QI_V8SI_PCINT64_INT_INT,
+ VOID_FTYPE_QI_V8SI_PCVOID_INT_INT,
IX86_BUILTIN_SCATTERPFDPD);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfdps",
- VOID_FTYPE_HI_V16SI_PCINT_INT_INT,
+ VOID_FTYPE_HI_V16SI_PCVOID_INT_INT,
IX86_BUILTIN_SCATTERPFDPS);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfqpd",
- VOID_FTYPE_QI_V8DI_PCINT64_INT_INT,
+ VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
IX86_BUILTIN_SCATTERPFQPD);
def_builtin (OPTION_MASK_ISA_AVX512PF, "__builtin_ia32_scatterpfqps",
- VOID_FTYPE_QI_V8DI_PCINT_INT_INT,
+ VOID_FTYPE_QI_V8DI_PCVOID_INT_INT,
IX86_BUILTIN_SCATTERPFQPS);
/* SHA */
@@ -39518,9 +39518,6 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
mode0 = DImode;
rdrand_step:
- op0 = gen_reg_rtx (mode0);
- emit_insn (GEN_FCN (icode) (op0));
-
arg0 = CALL_EXPR_ARG (exp, 0);
op1 = expand_normal (arg0);
if (!address_operand (op1, VOIDmode))
@@ -39528,6 +39525,10 @@ rdrand_step:
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
+
+ op0 = gen_reg_rtx (mode0);
+ emit_insn (GEN_FCN (icode) (op0));
+
emit_move_insn (gen_rtx_MEM (mode0, op1), op0);
op1 = gen_reg_rtx (SImode);
@@ -39536,8 +39537,20 @@ rdrand_step:
/* Emit SImode conditional move. */
if (mode0 == HImode)
{
- op2 = gen_reg_rtx (SImode);
- emit_insn (gen_zero_extendhisi2 (op2, op0));
+ if (TARGET_ZERO_EXTEND_WITH_AND
+ && optimize_function_for_speed_p (cfun))
+ {
+ op2 = force_reg (SImode, const0_rtx);
+
+ emit_insn (gen_movstricthi
+ (gen_lowpart (HImode, op2), op0));
+ }
+ else
+ {
+ op2 = gen_reg_rtx (SImode);
+
+ emit_insn (gen_zero_extendhisi2 (op2, op0));
+ }
}
else if (mode0 == SImode)
op2 = op0;
@@ -39569,9 +39582,6 @@ rdrand_step:
mode0 = DImode;
rdseed_step:
- op0 = gen_reg_rtx (mode0);
- emit_insn (GEN_FCN (icode) (op0));
-
arg0 = CALL_EXPR_ARG (exp, 0);
op1 = expand_normal (arg0);
if (!address_operand (op1, VOIDmode))
@@ -39579,6 +39589,10 @@ rdseed_step:
op1 = convert_memory_address (Pmode, op1);
op1 = copy_addr_to_reg (op1);
}
+
+ op0 = gen_reg_rtx (mode0);
+ emit_insn (GEN_FCN (icode) (op0));
+
emit_move_insn (gen_rtx_MEM (mode0, op1), op0);
op2 = gen_reg_rtx (QImode);
@@ -43973,10 +43987,16 @@ ix86_vector_duplicate_value (machine_mode mode, rtx target, rtx val)
if (recog_memoized (insn) < 0)
{
rtx_insn *seq;
+ machine_mode innermode = GET_MODE_INNER (mode);
+ rtx reg;
+
/* If that fails, force VAL into a register. */
start_sequence ();
- XEXP (dup, 0) = force_reg (GET_MODE_INNER (mode), val);
+ reg = force_reg (innermode, val);
+ if (GET_MODE (reg) != innermode)
+ reg = gen_lowpart (innermode, reg);
+ XEXP (dup, 0) = reg;
seq = get_insns ();
end_sequence ();
if (seq)
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 6c99b0e3987..90fa70e0dde 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -2816,6 +2816,36 @@
operands[0] = replace_equiv_address (operands[0], stack_pointer_rtx);
})
+(define_insn_and_split "*pushxf_rounded"
+ [(set (mem:XF
+ (pre_modify:P
+ (reg:P SP_REG)
+ (plus:P (reg:P SP_REG) (const_int -16))))
+ (match_operand:XF 0 "nonmemory_no_elim_operand" "f,r,*r,C"))]
+ "TARGET_64BIT"
+ "#"
+ "&& 1"
+ [(set (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -16)))
+ (set (match_dup 1) (match_dup 0))]
+{
+ rtx pat = PATTERN (curr_insn);
+ operands[1] = SET_DEST (pat);
+
+ /* Preserve memory attributes. */
+ operands[1] = replace_equiv_address (operands[1], stack_pointer_rtx);
+}
+ [(set_attr "type" "multi")
+ (set_attr "unit" "i387,*,*,*")
+ (set (attr "mode")
+ (cond [(eq_attr "alternative" "1,2,3")
+ (const_string "DI")
+ ]
+ (const_string "XF")))
+ (set (attr "preferred_for_size")
+ (cond [(eq_attr "alternative" "1")
+ (symbol_ref "false")]
+ (symbol_ref "true")))])
+
(define_insn "*pushxf"
[(set (match_operand:XF 0 "push_operand" "=<,<,<,<")
(match_operand:XF 1 "general_no_elim_operand" "f,r,*r,oF"))]
diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
index a1e145ff29d..7aca2e163a0 100644
--- a/gcc/config/i386/x86-64.h
+++ b/gcc/config/i386/x86-64.h
@@ -49,7 +49,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define WCHAR_TYPE_SIZE 32
#undef ASM_SPEC
-#define ASM_SPEC "%{m32:--32} %{m64:--64} %{mx32:--x32}"
+#define ASM_SPEC "%{m16|m32:--32} %{m64:--64} %{mx32:--x32}"
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
diff --git a/gcc/config/pa/pa-64.h b/gcc/config/pa/pa-64.h
index dec8688afa6..13771f6b461 100644
--- a/gcc/config/pa/pa-64.h
+++ b/gcc/config/pa/pa-64.h
@@ -83,7 +83,10 @@ along with GCC; see the file COPYING3. If not see
arguments are padded down when BYTES_BIG_ENDIAN is true. We don't
want aggregates padded down. */
-#define PAD_VARARGS_DOWN (!AGGREGATE_TYPE_P (type))
+#define PAD_VARARGS_DOWN \
+ (!AGGREGATE_TYPE_P (type) \
+ && TREE_CODE (type) != COMPLEX_TYPE \
+ && TREE_CODE (type) != VECTOR_TYPE)
/* In the PA architecture, it is not possible to directly move data
between GENERAL_REGS and FP_REGS. On the 32-bit port, we use the
diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md
index cce0c3b2ead..7a6dc7f7acc 100644
--- a/gcc/config/rs6000/dfp.md
+++ b/gcc/config/rs6000/dfp.md
@@ -344,16 +344,16 @@
[(set_attr "type" "fp")])
(define_insn "dfp_dxex_<mode>"
- [(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d")
- (unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d")]
- UNSPEC_DXEX))]
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
+ (unspec:DI [(match_operand:D64_D128 1 "gpc_reg_operand" "d")]
+ UNSPEC_DXEX))]
"TARGET_DFP"
"dxex<dfp_suffix> %0,%1"
[(set_attr "type" "fp")])
(define_insn "dfp_diex_<mode>"
[(set (match_operand:D64_D128 0 "gpc_reg_operand" "=d")
- (unspec:D64_D128 [(match_operand:D64_D128 1 "gpc_reg_operand" "d")
+ (unspec:D64_D128 [(match_operand:DI 1 "gpc_reg_operand" "d")
(match_operand:D64_D128 2 "gpc_reg_operand" "d")]
UNSPEC_DXEX))]
"TARGET_DFP"
diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 978ed9ba1eb..33fbd46984b 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -1049,7 +1049,8 @@
(and (match_code "symbol_ref")
(match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))
&& (SYMBOL_REF_LOCAL_P (op)
- || op == XEXP (DECL_RTL (current_function_decl), 0))
+ || (op == XEXP (DECL_RTL (current_function_decl), 0)
+ && !decl_replaceable_p (current_function_decl)))
&& !((DEFAULT_ABI == ABI_AIX
|| DEFAULT_ABI == ABI_ELFv2)
&& (SYMBOL_REF_EXTERNAL_P (op)
diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index fbb8e2d4eb8..4b5433be576 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2065,14 +2065,14 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, ALTIVEC_BUILTIN_VPKSWSS,
RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
- { ALTIVEC_BUILTIN_VEC_VPKSWSS, ALTIVEC_BUILTIN_VPKSWSS,
- RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
- { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
- RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKUDUS,
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_PACKS, P8V_BUILTIN_VPKSDSS,
RS6000_BTI_V4SI, RS6000_BTI_V2DI, RS6000_BTI_V2DI, 0 },
+ { ALTIVEC_BUILTIN_VEC_VPKSWSS, ALTIVEC_BUILTIN_VPKSWSS,
+ RS6000_BTI_V8HI, RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0 },
+ { ALTIVEC_BUILTIN_VEC_VPKUWUS, ALTIVEC_BUILTIN_VPKUWUS,
+ RS6000_BTI_unsigned_V8HI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKSHSS, ALTIVEC_BUILTIN_VPKSHSS,
RS6000_BTI_V16QI, RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0 },
{ ALTIVEC_BUILTIN_VEC_VPKUHUS, ALTIVEC_BUILTIN_VPKUHUS,
@@ -2343,7 +2343,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
{ ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRAD,
RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
- { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRD,
+ { ALTIVEC_BUILTIN_VEC_SRA, P8V_BUILTIN_VSRAD,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
{ ALTIVEC_BUILTIN_VEC_VSRAW, ALTIVEC_BUILTIN_VSRAW,
RS6000_BTI_V4SI, RS6000_BTI_V4SI, RS6000_BTI_unsigned_V4SI, 0 },
@@ -4158,7 +4158,7 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRAD,
RS6000_BTI_V2DI, RS6000_BTI_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
- { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRD,
+ { P8V_BUILTIN_VEC_VSRAD, P8V_BUILTIN_VSRAD,
RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, RS6000_BTI_unsigned_V2DI, 0 },
{ P8V_BUILTIN_VEC_VSUBCUQ, P8V_BUILTIN_VSUBCUQ,
@@ -4196,11 +4196,6 @@ const struct altivec_builtin_types altivec_overloaded_builtins[] = {
{ P8V_BUILTIN_VEC_VUPKLSW, P8V_BUILTIN_VUPKLSW,
RS6000_BTI_bool_V2DI, RS6000_BTI_bool_V4SI, 0, 0 },
- { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
- RS6000_BTI_V16QI, 0, 0, 0 },
- { P8V_BUILTIN_VEC_VGBBD, P8V_BUILTIN_VGBBD,
- RS6000_BTI_unsigned_V16QI, 0, 0, 0 },
-
/* Crypto builtins. */
{ CRYPTO_BUILTIN_VPERMXOR, CRYPTO_BUILTIN_VPERMXOR_V16QI,
RS6000_BTI_unsigned_V16QI, RS6000_BTI_unsigned_V16QI,
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9f3da8abded..e10f7edd32f 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -12962,6 +12962,8 @@ rs6000_expand_ternop_builtin (enum insn_code icode, tree exp, rtx target)
}
else if (icode == CODE_FOR_vsx_xxpermdi_v2df
|| icode == CODE_FOR_vsx_xxpermdi_v2di
+ || icode == CODE_FOR_vsx_xxpermdi_v2df_be
+ || icode == CODE_FOR_vsx_xxpermdi_v2di_be
|| icode == CODE_FOR_vsx_xxsldwi_v16qi
|| icode == CODE_FOR_vsx_xxsldwi_v8hi
|| icode == CODE_FOR_vsx_xxsldwi_v4si
@@ -15628,6 +15630,7 @@ builtin_function_type (machine_mode mode_ret, machine_mode mode_arg0,
break;
/* unsigned args, signed return. */
+ case VSX_BUILTIN_XVCVUXDSP:
case VSX_BUILTIN_XVCVUXDDP_UNS:
case ALTIVEC_BUILTIN_UNSFLOAT_V4SI_V4SF:
h.uns_p[1] = 1;
@@ -32624,7 +32627,10 @@ rs6000_inner_target_options (tree args, bool attr_p)
}
else
- gcc_unreachable ();
+ {
+ error ("attribute %<target%> argument not a string");
+ return false;
+ }
return ret;
}
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 20580591a68..7a8f6b5775f 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -5335,7 +5335,7 @@
(unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
(match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
UNSPEC_COPYSIGN))]
- "TARGET_<MODE>_FPR && TARGET_CMPB"
+ "TARGET_<MODE>_FPR && (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))"
"@
fcpsgn %0,%2,%1
xscpsgndp %x0,%x2,%x1"
@@ -8905,7 +8905,7 @@
rtx gpr_lo_reg = gen_lowpart (DFmode, dest);
emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_hi_reg, src));
- emit_insn (gen_vsx_xxpermdi_<mode> (tmp, src, src, GEN_INT (3)));
+ emit_insn (gen_vsx_xxpermdi_<mode>_be (tmp, src, src, GEN_INT (3)));
emit_insn (gen_p8_mfvsrd_3_<mode> (gpr_lo_reg, tmp));
}
[(set_attr "length" "12")
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 9e89eb7641e..3f317ee3ecb 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -142,11 +142,11 @@ Use AltiVec instructions
maltivec=le
Target Report RejectNegative Var(rs6000_altivec_element_order, 1) Save
-Generate Altivec instructions using little-endian element order
+Generate AltiVec instructions using little-endian element order
maltivec=be
Target Report RejectNegative Var(rs6000_altivec_element_order, 2)
-Generate Altivec instructions using big-endian element order
+Generate AltiVec instructions using big-endian element order
mhard-dfp
Target Report Mask(DFP) Var(rs6000_isa_flags)
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index a689c2b71e7..9fa3b6718b3 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -1501,19 +1501,19 @@
[(set_attr "type" "vecdouble")])
(define_insn "vsx_xvcvsxdsp"
- [(set (match_operand:V4SI 0 "vsx_register_operand" "=wd,?wa")
- (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wf,wa")]
+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V4SF [(match_operand:V2DI 1 "vsx_register_operand" "wf,wa")]
UNSPEC_VSX_CVSXDSP))]
"VECTOR_UNIT_VSX_P (V2DFmode)"
"xvcvsxdsp %x0,%x1"
[(set_attr "type" "vecfloat")])
(define_insn "vsx_xvcvuxdsp"
- [(set (match_operand:V4SI 0 "vsx_register_operand" "=wd,?wa")
- (unspec:V4SI [(match_operand:V2DF 1 "vsx_register_operand" "wf,wa")]
+ [(set (match_operand:V4SF 0 "vsx_register_operand" "=wd,?wa")
+ (unspec:V4SF [(match_operand:V2DI 1 "vsx_register_operand" "wf,wa")]
UNSPEC_VSX_CVUXDSP))]
"VECTOR_UNIT_VSX_P (V2DFmode)"
- "xvcvuxwdp %x0,%x1"
+ "xvcvuxdsp %x0,%x1"
[(set_attr "type" "vecdouble")])
;; Convert from 32-bit to 64-bit types
@@ -1948,6 +1948,38 @@
op1 = gen_lowpart (V2DImode, op1);
}
}
+ emit_insn (gen (target, op0, op1, perm0, perm1));
+ DONE;
+})
+
+;; Special version of xxpermdi that retains big-endian semantics.
+(define_expand "vsx_xxpermdi_<mode>_be"
+ [(match_operand:VSX_L 0 "vsx_register_operand" "")
+ (match_operand:VSX_L 1 "vsx_register_operand" "")
+ (match_operand:VSX_L 2 "vsx_register_operand" "")
+ (match_operand:QI 3 "u5bit_cint_operand" "")]
+ "VECTOR_MEM_VSX_P (<MODE>mode)"
+{
+ rtx target = operands[0];
+ rtx op0 = operands[1];
+ rtx op1 = operands[2];
+ int mask = INTVAL (operands[3]);
+ rtx perm0 = GEN_INT ((mask >> 1) & 1);
+ rtx perm1 = GEN_INT ((mask & 1) + 2);
+ rtx (*gen) (rtx, rtx, rtx, rtx, rtx);
+
+ if (<MODE>mode == V2DFmode)
+ gen = gen_vsx_xxpermdi2_v2df_1;
+ else
+ {
+ gen = gen_vsx_xxpermdi2_v2di_1;
+ if (<MODE>mode != V2DImode)
+ {
+ target = gen_lowpart (V2DImode, target);
+ op0 = gen_lowpart (V2DImode, op0);
+ op1 = gen_lowpart (V2DImode, op1);
+ }
+ }
/* In little endian mode, vsx_xxpermdi2_<mode>_1 will perform a
transformation we don't want; it is necessary for
rs6000_expand_vec_perm_const_1 but not for this use. So we
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 5e440545618..18bacf27df7 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -11989,8 +11989,9 @@ sparc_frame_pointer_required (void)
if (TARGET_FLAT)
return false;
- /* Otherwise, the frame pointer is required if the function isn't leaf. */
- return !(crtl->is_leaf && only_leaf_regs_used ());
+ /* Otherwise, the frame pointer is required if the function isn't leaf, but
+ we cannot use sparc_leaf_function_p since it hasn't been computed yet. */
+ return !(optimize > 0 && crtl->is_leaf && only_leaf_regs_used ());
}
/* The way this is structured, we can't eliminate SFP in favor of SP
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c
index 424d52295fa..fec20ea59c4 100644
--- a/gcc/data-streamer-in.c
+++ b/gcc/data-streamer-in.c
@@ -206,6 +206,5 @@ gcov_type
streamer_read_gcov_count (struct lto_input_block *ib)
{
gcov_type ret = streamer_read_hwi (ib);
- gcc_assert (ret >= 0);
return ret;
}
diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c
index caee0c6a464..ac2c1d64bcd 100644
--- a/gcc/data-streamer-out.c
+++ b/gcc/data-streamer-out.c
@@ -363,7 +363,6 @@ streamer_write_hwi_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
void
streamer_write_gcov_count_stream (struct lto_output_stream *obs, gcov_type work)
{
- gcc_assert (work >= 0);
gcc_assert ((HOST_WIDE_INT) work == work);
streamer_write_hwi_stream (obs, work);
}
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 749d6cbf7f1..b306bb7fd1c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -13169,14 +13169,14 @@ The following built-in functions are available for the PowerPC family
of processors when hardware decimal floating point
(@option{-mhard-dfp}) is available:
@smallexample
-_Decimal64 __builtin_dxex (_Decimal64);
-_Decimal128 __builtin_dxexq (_Decimal128);
+long long __builtin_dxex (_Decimal64);
+long long __builtin_dxexq (_Decimal128);
_Decimal64 __builtin_ddedpd (int, _Decimal64);
_Decimal128 __builtin_ddedpdq (int, _Decimal128);
_Decimal64 __builtin_denbcd (int, _Decimal64);
_Decimal128 __builtin_denbcdq (int, _Decimal128);
-_Decimal64 __builtin_diex (_Decimal64, _Decimal64);
-_Decimal128 _builtin_diexq (_Decimal128, _Decimal128);
+_Decimal64 __builtin_diex (long long, _Decimal64);
+_Decimal128 _builtin_diexq (long long, _Decimal128);
_Decimal64 __builtin_dscli (_Decimal64, int);
_Decimal128 __builtin_dscliq (_Decimal128, int);
_Decimal64 __builtin_dscri (_Decimal64, int);
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index ba6b60807d8..429a8138616 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -67,6 +67,7 @@ Texts being (a) (see below), and with the Back-Cover Texts being (b)
* g++: (gcc). The GNU C++ compiler.
* gcov: (gcc) Gcov. @command{gcov}---a test coverage program.
* gcov-tool: (gcc) Gcov-tool. @command{gcov-tool}---an offline gcda profile processing program.
+* gcov-dump: (gcc) Gcov-dump. @command{gcov-dump}---an offline gcda and gcno profile dump tool.
@end direntry
This file documents the use of the GNU compilers.
@sp 1
@@ -140,6 +141,7 @@ Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
* Compatibility:: Binary Compatibility
* Gcov:: @command{gcov}---a test coverage program.
* Gcov-tool:: @command{gcov-tool}---an offline gcda profile processing program.
+* Gcov-dump:: @command{gcov-dump}---an offline gcda and gcno profile dump tool.
* Trouble:: If you have trouble using GCC.
* Bugs:: How, why and where to report bugs.
* Service:: How To Get Help with GCC
@@ -167,6 +169,7 @@ Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
@include compat.texi
@include gcov.texi
@include gcov-tool.texi
+@include gcov-dump.texi
@include trouble.texi
@include bugreport.texi
@include service.texi
diff --git a/gcc/doc/gcov-dump.texi b/gcc/doc/gcov-dump.texi
new file mode 100644
index 00000000000..d7931fd3a19
--- /dev/null
+++ b/gcc/doc/gcov-dump.texi
@@ -0,0 +1,93 @@
+@c Copyright (C) 2017 Free Software Foundation, Inc.
+@c This is part of the GCC manual.
+@c For copying conditions, see the file gcc.texi.
+
+@ignore
+@c man begin COPYRIGHT
+Copyright @copyright{} 2017 Free Software Foundation, Inc.
+
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with the
+Invariant Sections being ``GNU General Public License'' and ``Funding
+Free Software'', the Front-Cover texts being (a) (see below), and with
+the Back-Cover Texts being (b) (see below). A copy of the license is
+included in the gfdl(7) man page.
+
+(a) The FSF's Front-Cover Text is:
+
+ A GNU Manual
+
+(b) The FSF's Back-Cover Text is:
+
+ You have freedom to copy and modify this GNU Manual, like GNU
+ software. Copies published by the Free Software Foundation raise
+ funds for GNU development.
+@c man end
+@c Set file name and title for the man page.
+@setfilename gcov-dump
+@settitle offline gcda and gcno profile dump tool
+@end ignore
+
+@node Gcov-dump
+@chapter @command{gcov-dump}---an Offline Gcda and Gcno Profile Dump Tool
+
+@menu
+* Gcov-dump Intro:: Introduction to gcov-dump.
+* Invoking Gcov-dump:: How to use gcov-dump.
+@end menu
+
+@node Gcov-dump Intro
+@section Introduction to @command{gcov-dump}
+@c man begin DESCRIPTION
+
+@command{gcov-dump} is a tool you can use in conjunction with GCC to
+dump content of gcda and gcno profile files offline.
+
+@c man end
+
+@node Invoking Gcov-dump
+@section Invoking @command{gcov-dump}
+
+@smallexample
+Usage: gcov-dump @r{[}@var{OPTION}@r{]} ... @var{gcovfiles}
+@end smallexample
+
+@command{gcov-dump} accepts the following options:
+
+@ignore
+@c man begin SYNOPSIS
+gcov-dump [@option{-v}|@option{--version}]
+ [@option{-h}|@option{--help}]
+ [@option{-l}|@option{--long}]
+ [@option{-p}|@option{--positions}]
+ [@option{-w}|@option{--working-sets}] @var{gcovfiles}
+@c man end
+@end ignore
+
+@c man begin OPTIONS
+@table @gcctabopt
+@item -h
+@itemx --help
+Display help about using @command{gcov-dump} (on the standard output), and
+exit without doing any further processing.
+
+@item -v
+@itemx --version
+Display the @command{gcov-dump} version number (on the standard output),
+and exit without doing any further processing.
+
+@item -l
+@itemx --long
+Dump content of records.
+
+@item -p
+@itemx --positions
+Dump positions of records.
+
+@item -w
+@itemx --working-sets
+Dump working set computed from summary.
+@end table
+
+@c man end
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 55d6dba938f..6ed72f4b15d 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -245,7 +245,7 @@ Objective-C and Objective-C++ Dialects}.
-Wno-attributes -Wno-builtin-macro-redefined @gol
-Wc90-c99-compat -Wc99-c11-compat @gol
-Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
--Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
+-Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wconditionally-supported @gol
-Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
-Wdisabled-optimization @gol
@@ -3539,6 +3539,11 @@ Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
This warning is enabled by @option{-Wall}.
+@item -Wchkp
+@opindex Wchkp
+Warn about an invalid memory access that is found by Pointer Bounds Checker
+(@option{-fcheck-pointer-bounds}).
+
@item -Wno-coverage-mismatch
@opindex Wno-coverage-mismatch
Warn if feedback profiles do not match when using the
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ab4ded78d7a..7a14633ba3d 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -15952,17 +15952,20 @@ fold_indirect_ref_1 (location_t loc, tree type, tree op0)
if (TREE_CODE (op00type) == VECTOR_TYPE
&& type == TREE_TYPE (op00type))
{
- HOST_WIDE_INT offset = tree_to_shwi (op01);
tree part_width = TYPE_SIZE (type);
- unsigned HOST_WIDE_INT part_widthi = tree_to_shwi (part_width)/BITS_PER_UNIT;
- unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
- tree index = bitsize_int (indexi);
-
- if (offset / part_widthi < TYPE_VECTOR_SUBPARTS (op00type))
- return fold_build3_loc (loc,
- BIT_FIELD_REF, type, op00,
- part_width, index);
-
+ unsigned HOST_WIDE_INT max_offset
+ = (tree_to_uhwi (part_width) / BITS_PER_UNIT
+ * TYPE_VECTOR_SUBPARTS (op00type));
+ if (tree_int_cst_sign_bit (op01) == 0
+ && compare_tree_int (op01, max_offset) == -1)
+ {
+ unsigned HOST_WIDE_INT offset = tree_to_uhwi (op01);
+ unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT;
+ tree index = bitsize_int (indexi);
+ return fold_build3_loc (loc,
+ BIT_FIELD_REF, type, op00,
+ part_width, index);
+ }
}
/* ((foo*)&complexfoo)[1] => __imag__ complexfoo */
else if (TREE_CODE (op00type) == COMPLEX_TYPE
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d4ea0e901cc..9dc753b567c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ * trans-types.c (gfc_get_int_kind_from_width_isofortranen): Choose
+ REAL type with the widest precision if two (or more) have the same
+ storage size.
+
2016-12-22 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from trunk
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index fa553f4ff1f..5d59ef52f78 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -256,27 +256,42 @@ gfc_get_int_kind_from_width_isofortranenv (int size)
return -1;
}
-/* Get the kind number corresponding to a real of given storage size,
- following the required return values for ISO_FORTRAN_ENV REAL* constants:
- -2 is returned if we support a kind of larger size, -1 otherwise. */
+
+/* Get the kind number corresponding to a real of a given storage size.
+ If two real's have the same storage size, then choose the real with
+ the largest precision. If a kind type is unavailable and a real
+ exists with wider storage, then return -2; otherwise, return -1. */
+
int
gfc_get_real_kind_from_width_isofortranenv (int size)
{
- int i;
+ int digits, i, kind;
size /= 8;
+ kind = -1;
+ digits = 0;
+
/* Look for a kind with matching storage size. */
for (i = 0; gfc_real_kinds[i].kind != 0; i++)
if (int_size_in_bytes (gfc_get_real_type (gfc_real_kinds[i].kind)) == size)
- return gfc_real_kinds[i].kind;
+ {
+ if (gfc_real_kinds[i].digits > digits)
+ {
+ digits = gfc_real_kinds[i].digits;
+ kind = gfc_real_kinds[i].kind;
+ }
+ }
+
+ if (kind != -1)
+ return kind;
/* Look for a kind with larger storage size. */
for (i = 0; gfc_real_kinds[i].kind != 0; i++)
if (int_size_in_bytes (gfc_get_real_type (gfc_real_kinds[i].kind)) > size)
- return -2;
+ kind = -2;
- return -1;
+ return kind;
}
diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c
index ec4b28afe68..809ca63e5e4 100644
--- a/gcc/gcov-dump.c
+++ b/gcc/gcov-dump.c
@@ -136,6 +136,8 @@ print_usage (void)
printf (" -l, --long Dump record contents too\n");
printf (" -p, --positions Dump record positions\n");
printf (" -w, --working-sets Dump working set computed from summary\n");
+ printf ("\nFor bug reporting instructions, please see:\n%s.\n",
+ bug_report_url);
}
static void
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 0f6d456ab39..394620d64f6 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -311,7 +311,7 @@ struct gcse_expr
to keep register pressure under control.
A value of "0" removes restrictions on how far the expression can
travel. */
- int max_distance;
+ HOST_WIDE_INT max_distance;
};
/* Occurrence of an expression.
@@ -486,12 +486,12 @@ static void hash_scan_insn (rtx_insn *, struct gcse_hash_table_d *);
static void hash_scan_set (rtx, rtx_insn *, struct gcse_hash_table_d *);
static void hash_scan_clobber (rtx, rtx_insn *, struct gcse_hash_table_d *);
static void hash_scan_call (rtx, rtx_insn *, struct gcse_hash_table_d *);
-static int want_to_gcse_p (rtx, int *);
+static int want_to_gcse_p (rtx, HOST_WIDE_INT *);
static int oprs_unchanged_p (const_rtx, const rtx_insn *, int);
static int oprs_anticipatable_p (const_rtx, const rtx_insn *);
static int oprs_available_p (const_rtx, const rtx_insn *);
static void insert_expr_in_table (rtx, machine_mode, rtx_insn *, int, int,
- int, struct gcse_hash_table_d *);
+ HOST_WIDE_INT, struct gcse_hash_table_d *);
static unsigned int hash_expr (const_rtx, machine_mode, int *, int);
static void record_last_reg_set_info (rtx, int);
static void record_last_mem_set_info (rtx_insn *);
@@ -521,8 +521,10 @@ static void alloc_code_hoist_mem (int, int);
static void free_code_hoist_mem (void);
static void compute_code_hoist_vbeinout (void);
static void compute_code_hoist_data (void);
-static int should_hoist_expr_to_dom (basic_block, struct gcse_expr *, basic_block,
- sbitmap, int, int *, enum reg_class,
+static int should_hoist_expr_to_dom (basic_block, struct gcse_expr *,
+ basic_block,
+ sbitmap, HOST_WIDE_INT, int *,
+ enum reg_class,
int *, bitmap, rtx_insn *);
static int hoist_code (void);
static enum reg_class get_regno_pressure_class (int regno, int *nregs);
@@ -777,7 +779,7 @@ static basic_block current_bb;
GCSE. */
static int
-want_to_gcse_p (rtx x, int *max_distance_ptr)
+want_to_gcse_p (rtx x, HOST_WIDE_INT *max_distance_ptr)
{
#ifdef STACK_REGS
/* On register stack architectures, don't GCSE constants from the
@@ -824,7 +826,7 @@ want_to_gcse_p (rtx x, int *max_distance_ptr)
/* PRE doesn't implement max_distance restriction. */
{
int cost;
- int max_distance;
+ HOST_WIDE_INT max_distance;
gcc_assert (!optimize_function_for_speed_p (cfun)
&& optimize_function_for_size_p (cfun));
@@ -832,7 +834,8 @@ want_to_gcse_p (rtx x, int *max_distance_ptr)
if (cost < COSTS_N_INSNS (GCSE_UNRESTRICTED_COST))
{
- max_distance = (GCSE_COST_DISTANCE_RATIO * cost) / 10;
+ max_distance
+ = ((HOST_WIDE_INT)GCSE_COST_DISTANCE_RATIO * cost) / 10;
if (max_distance == 0)
return 0;
@@ -1149,7 +1152,8 @@ expr_equiv_p (const_rtx x, const_rtx y)
static void
insert_expr_in_table (rtx x, machine_mode mode, rtx_insn *insn,
int antic_p,
- int avail_p, int max_distance, struct gcse_hash_table_d *table)
+ int avail_p, HOST_WIDE_INT max_distance,
+ struct gcse_hash_table_d *table)
{
int found, do_not_record_p;
unsigned int hash;
@@ -1265,7 +1269,7 @@ hash_scan_set (rtx set, rtx_insn *insn, struct gcse_hash_table_d *table)
else if (REG_P (dest))
{
unsigned int regno = REGNO (dest);
- int max_distance = 0;
+ HOST_WIDE_INT max_distance = 0;
/* See if a REG_EQUAL note shows this equivalent to a simpler expression.
@@ -1334,7 +1338,7 @@ hash_scan_set (rtx set, rtx_insn *insn, struct gcse_hash_table_d *table)
else if (flag_gcse_las && REG_P (src) && MEM_P (dest))
{
unsigned int regno = REGNO (src);
- int max_distance = 0;
+ HOST_WIDE_INT max_distance = 0;
/* Only record sets of pseudo-regs in the hash table. */
if (regno >= FIRST_PSEUDO_REGISTER
@@ -1447,7 +1451,8 @@ dump_hash_table (FILE *file, const char *name, struct gcse_hash_table_d *table)
if (flat_table[i] != 0)
{
expr = flat_table[i];
- fprintf (file, "Index %d (hash value %d; max distance %d)\n ",
+ fprintf (file, "Index %d (hash value %d; max distance "
+ HOST_WIDE_INT_PRINT_DEC ")\n ",
expr->bitmap_index, hash_val[i], expr->max_distance);
print_rtl (file, expr->expr);
fprintf (file, "\n");
@@ -2908,7 +2913,8 @@ update_bb_reg_pressure (basic_block bb, rtx_insn *from)
static int
should_hoist_expr_to_dom (basic_block expr_bb, struct gcse_expr *expr,
- basic_block bb, sbitmap visited, int distance,
+ basic_block bb, sbitmap visited,
+ HOST_WIDE_INT distance,
int *bb_size, enum reg_class pressure_class,
int *nregs, bitmap hoisted_bbs, rtx_insn *from)
{
@@ -3185,7 +3191,7 @@ hoist_code (void)
computes the expression. */
FOR_EACH_VEC_ELT (domby, j, dominated)
{
- int max_distance;
+ HOST_WIDE_INT max_distance;
/* Ignore self dominance. */
if (bb == dominated)
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index a7515f1791f..de44c22bdb0 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -4777,7 +4777,7 @@ ipa_prop_write_jump_functions (void)
lto_symtab_encoder_iterator lsei;
lto_symtab_encoder_t encoder;
- if (!ipa_node_params_sum)
+ if (!ipa_node_params_sum || !ipa_edge_args_vector)
return;
ob = create_output_block (LTO_section_jump_functions);
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 8bfc649e148..f86d6fbbc40 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -249,11 +249,17 @@ warn_function_const (tree decl, bool known_finite)
static void
warn_function_noreturn (tree decl)
{
+ tree original_decl = decl;
+
+ cgraph_node *node = cgraph_node::get (decl);
+ if (node->instrumentation_clone)
+ decl = node->instrumented_version->decl;
+
static hash_set<tree> *warned_about;
if (!lang_hooks.missing_noreturn_ok_p (decl)
&& targetm.warn_func_return (decl))
warned_about
- = suggest_attribute (OPT_Wsuggest_attribute_noreturn, decl,
+ = suggest_attribute (OPT_Wsuggest_attribute_noreturn, original_decl,
true, warned_about, "noreturn");
}
diff --git a/gcc/params.def b/gcc/params.def
index 3e4ba3ad6ce..36772da428e 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -664,7 +664,7 @@ DEFPARAM(PARAM_SELSCHED_MAX_LOOKAHEAD,
DEFPARAM(PARAM_SELSCHED_MAX_SCHED_TIMES,
"selsched-max-sched-times",
"Maximum number of times that an insn could be scheduled",
- 2, 0, 0)
+ 2, 1, 0)
DEFPARAM(PARAM_SELSCHED_INSNS_TO_RENAME,
"selsched-insns-to-rename",
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9d154524ce9..14932534994 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,201 @@
+2017-04-03 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-04-03 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80246
+ * gcc.target/powerpc/dfp-builtin-1.c: Require hard_dfp, not
+ powerpc_vsx_ok.
+ (std, ld): Limit scan-assembler-times check to lp64.
+ (stwu, stw, lwz): Add scan-assembler-times check for ilp32.
+ * gcc.target/powerpc/dfp-builtin-2.c: Require hard_dfp, not
+ powerpc_vsx_ok.
+
+ PR target/80246
+ * gcc.target/powerpc/pr80246.c: Require hard_dfp.
+
+2017-03-30 Peter Bergner <bergner@vnet.ibm.com>
+
+ Backport from mainline
+ 2017-03-30 Peter Bergner <bergner@vnet.ibm.com>
+
+ PR target/80246
+ * gcc.target/powerpc/dfp-builtin-1.c: Remove unneeded dg-skip-if for
+ Darwin and SPE.
+ (dxex, dxexq): Update return type.
+ (diex, diexq): Update argument type.
+ * gcc.target/powerpc/pr80246.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-22 Martin Liska <mliska@suse.cz>
+
+ PR lto/79587
+ * gcc.dg/tree-prof/pr79587.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-22 Martin Liska <mliska@suse.cz>
+
+ PR target/79906
+ * g++.dg/ext/mv8.C: Add power* targets.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-21 Martin Liska <mliska@suse.cz>
+
+ * gcc.target/i386/pr65044.c: Add '.' in order to catch
+ apostrophes.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-20 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/79753
+ * gcc.target/i386/mpx/pr79753.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-20 Martin Liska <mliska@suse.cz>
+
+ PR target/79769
+ PR target/79770
+ * g++.dg/pr79769.C: New test.
+ * gcc.target/i386/mpx/pr79770.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-13 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/78339
+ * gcc.target/i386/mpx/pr78339.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2016-06-13 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/71458
+ * gcc.target/i386/pr71458.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-09 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/79631
+ * gcc.target/i386/mpx/pr79631.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-09 Martin Liska <mliska@suse.cz>
+
+ PR ipa/79761
+ * g++.dg/pr79761.C: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-03 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/79803
+ * gcc.dg/tree-ssa/pr79803.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-03-03 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/79574
+ * gcc.dg/pr79574-2.c: New test.
+
+2017-03-22 Martin Liska <mliska@suse.cz>
+
+ Backport from mainline
+ 2017-02-17 Martin Liska <mliska@suse.cz>
+
+ PR rtl-optimization/79574
+ * gcc.dg/pr79574.c: New test.
+
+2017-03-21 Martin Sebor <msebor@redhat.com>
+
+ PR c++/79548
+ * g++.dg/warn/Wunused-var-26.C: New test.
+
+2017-03-21 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline:
+ 2017-03-17 Pat Haugen <pthaugen@us.ibm.com>
+
+ * gcc.target/powerpc/pr79951.c: New.
+
+2017-03-15 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/80019
+ * gcc.target/i386/pr80019.c: New test.
+
+2017-03-10 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ Back port from trunk
+ 2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/79439
+ * gcc.target/powerpc/pr79439.c: New test.
+
+2017-03-02 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/79514
+ * gcc.target/i386/pr79514.c: New test.
+
+2017-03-01 Pat Haugen <pthaugen@us.ibm.com>
+
+ Backport from mainline:
+ 2017-03-01 Pat Haugen <pthaugen@us.ibm.com>
+
+ * gcc.target/powerpc/pr79544.c: Add test for vec_vsrad and fix up
+ scan string.
+
+ 2017-02-27 Pat Haugen <pthaugen@us.ibm.com>
+
+ PR target/79544
+ * gcc.target/powerpc/pr79544.c: New.
+
+2017-02-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.target/sparc/20170228-1.c: New test.
+
+2017-02-24 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt63.adb: New test.
+
+2017-02-22 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline
+ 2017-02-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR target/79261
+ * gcc.target/powerpc/vec-xxpermdi.c: New file.
+
+2017-01-16 Carl Love <cel@us.ibm.com>
+
+ Backport from mainline commit r245460 on 2017-02-14
+
+ PR 79545
+ * gcc.target/powerpc/vsx-builtin-3.c: Add missing test case for the
+ xvcvsxdsp and xvcvuxdsp instructions.
+
+2017-02-06 Carl Love <cel@us.ibm.com>
+
+ * gcc.target/powerpc/builtins-3-p8.c: Add new testfile for missing
+ vec_packs built-in tests.
+
2017-02-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline
diff --git a/gcc/testsuite/g++.dg/ext/mv8.C b/gcc/testsuite/g++.dg/ext/mv8.C
index 2e98dd7ad85..bbf90b5a328 100644
--- a/gcc/testsuite/g++.dg/ext/mv8.C
+++ b/gcc/testsuite/g++.dg/ext/mv8.C
@@ -1,4 +1,4 @@
-// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-do compile { target i?86-*-* x86_64-*-* powerpc*-*-* } }
// { dg-options "" }
__attribute__((target (11,12)))
diff --git a/gcc/testsuite/g++.dg/pr79761.C b/gcc/testsuite/g++.dg/pr79761.C
new file mode 100644
index 00000000000..a97325a1fc4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr79761.C
@@ -0,0 +1,34 @@
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && { ! x32 } } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */
+
+struct Foo
+{
+ Foo() : a(1), b(1), c('a') {}
+ int a;
+ int b;
+ char c;
+};
+
+static Foo copy_foo(Foo) __attribute__((noinline, noclone));
+
+static Foo copy_foo(Foo A)
+{
+ return A;
+}
+
+struct Bar : Foo
+{
+ Bar(Foo t) : Foo(copy_foo(t)) {}
+};
+
+Foo F;
+
+int main (void)
+{
+ Bar B (F);
+
+ if (B.a != 1 || B.b != 1 || B.c != 'a')
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/pr79769.C b/gcc/testsuite/g++.dg/pr79769.C
new file mode 100644
index 00000000000..c3186877f60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr79769.C
@@ -0,0 +1,4 @@
+/* { dg-do compile { target { { i?86-*-* x86_64-*-* } && { ! x32 } } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms" } */
+
+void a (_Complex) { a (3); }
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-var-26.C b/gcc/testsuite/g++.dg/warn/Wunused-var-26.C
new file mode 100644
index 00000000000..b3e020b6007
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-var-26.C
@@ -0,0 +1,147 @@
+// PR c++/79548 - missing -Wunused-variable on a typedef'd variable
+// in a function template
+// { dg-do compile }
+// { dg-options "-Wunused" }
+
+
+#define UNUSED __attribute__ ((unused))
+
+template <class T>
+void f_int ()
+{
+ T t; // { dg-warning "unused variable" }
+
+ typedef T U;
+ U u; // { dg-warning "unused variable" }
+}
+
+template void f_int<int>();
+
+
+template <class T>
+void f_intptr ()
+{
+ T *t = 0; // { dg-warning "unused variable" }
+
+ typedef T U;
+ U *u = 0; // { dg-warning "unused variable" }
+}
+
+template void f_intptr<int>();
+
+
+template <class T>
+void f_var_unused ()
+{
+ // The variable is marked unused.
+ T t UNUSED;
+
+ typedef T U;
+ U u UNUSED;
+}
+
+template void f_var_unused<int>();
+
+
+template <class T>
+void f_var_type_unused ()
+{
+ // The variable's type is marked unused.
+ T* UNUSED t = new T; // { dg-bogus "unused variable" "bug 79585" { xfail *-*-* } }
+
+ typedef T U;
+ U* UNUSED u = new U; // { dg-bogus "unused variable" "bug 79585" { xfail *-*-* } }
+
+ typedef T UNUSED U;
+ U v = U (); // { dg-bogus "unused variable" "bug 79585" }
+}
+
+template void f_var_type_unused<int>();
+
+
+struct A { int i; };
+
+template <class T>
+void f_A ()
+{
+ T t; // { dg-warning "unused variable" }
+
+ typedef T U;
+ U u; // { dg-warning "unused variable" }
+}
+
+template void f_A<A>();
+
+
+template <class T>
+void f_A_unused ()
+{
+ T t UNUSED;
+
+ typedef T U;
+ U u UNUSED;
+}
+
+template void f_A_unused<A>();
+
+
+struct B { B (); };
+
+template <class T>
+void f_B ()
+{
+ T t;
+
+ typedef T U;
+ U u;
+}
+
+template void f_B<B>();
+
+
+struct NonTrivialDtor { ~NonTrivialDtor (); };
+
+template <class T>
+void f_with_NonTrivialDtor ()
+{
+ // Expect no warnings when instantiated on a type with a non-trivial
+ // destructor.
+ T t;
+
+ typedef T U;
+ U u;
+}
+
+template void f_with_NonTrivialDtor<NonTrivialDtor>();
+
+
+struct D { NonTrivialDtor b; };
+
+template <class T>
+void f_D ()
+{
+ // Same as f_with_NonTrivialDtor but with a class that has a member
+ // with a non-trivial dtor.
+ T t;
+
+ typedef T U;
+ U u;
+}
+
+template void f_D<D>();
+
+
+struct UNUSED DeclaredUnused { };
+
+template <class T>
+void f_with_unused ()
+{
+ // Expect no warnings when instantiatiated on a type declared
+ // with attribute unused.
+ T t;
+
+ typedef T U;
+ U u;
+}
+
+template void f_with_unused<DeclaredUnused>();
diff --git a/gcc/testsuite/gcc.dg/pr79574-2.c b/gcc/testsuite/gcc.dg/pr79574-2.c
new file mode 100644
index 00000000000..995dff40174
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr79574-2.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/79574 */
+/* { dg-do compile } */
+/* { dg-options "-Os --param gcse-cost-distance-ratio=2147483647" } */
+
+#include "stdarg.h"
+
+int buf[100];
+int buf1[10];
+
+int rd (int *pppp, int n, ...)
+{
+ va_list argp;
+ int *p;
+ int i;
+ int res;
+
+ va_start (argp, n);
+ for (; n > 0; n--)
+ va_arg (argp, double);
+ p = va_arg (argp, int *);
+ i = va_arg (argp, int);
+
+ res = p[i];
+ __builtin_printf ("%d\n", res);
+
+ return res;
+}
+
+int mpx_test (int argc, const char **argv)
+{
+ rd (buf1, 2, 10.0d, 10.0d, buf, 100, buf1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr79574.c b/gcc/testsuite/gcc.dg/pr79574.c
new file mode 100644
index 00000000000..1b666e20d21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr79574.c
@@ -0,0 +1,10 @@
+/* PR rtl-optimization/79574 */
+/* { dg-do compile } */
+/* { dg-options "-Os --param gcse-cost-distance-ratio=2147483647" } */
+
+void a (void)
+{
+ volatile int b;
+ for (;; b)
+ ;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr79587.c b/gcc/testsuite/gcc.dg/tree-prof/pr79587.c
new file mode 100644
index 00000000000..517e0819919
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-prof/pr79587.c
@@ -0,0 +1,26 @@
+/* { dg-require-effective-target lto } */
+/* { dg-options "-O2 -flto" } */
+
+unsigned long global = -12345;
+
+unsigned long
+__attribute__((noinline))
+test(unsigned long v, unsigned long v2)
+{
+ unsigned long x = v % v2;
+
+ return x;
+}
+
+int main(int argc, char **argv)
+{
+ unsigned long r = 0;
+
+ for (int i = 0; i < 100; i++)
+ r += test(argc, global);
+
+ if (r != 100)
+ __builtin_abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr79803.c b/gcc/testsuite/gcc.dg/tree-ssa/pr79803.c
new file mode 100644
index 00000000000..51b245d4d5b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr79803.c
@@ -0,0 +1,60 @@
+/* { dg-do compile { target { x86_64-*-* } } } */
+/* { dg-options "-march=opteron-sse3 -Ofast --param l1-cache-line-size=3 -Wdisabled-optimization" } */
+/* { dg-require-effective-target indirect_jumps } */
+
+#include <setjmp.h>
+
+extern void abort (void);
+
+jmp_buf buf;
+
+void raise0(void)
+{
+ __builtin_longjmp (buf, 1);
+}
+
+int execute(int cmd) /* { dg-warning "'l1-cache-size' parameter is not a power of two 3" } */
+{
+ int last = 0;
+
+ if (__builtin_setjmp (buf) == 0)
+ while (1)
+ {
+ last = 1;
+ raise0 ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+int execute2(int cmd, int cmd2)
+{
+ int last = 0;
+
+ if (__builtin_setjmp (buf) == 0)
+ while (1)
+ {
+ last = 1;
+ raise0 ();
+ }
+
+ if (last == 0)
+ return 0;
+ else
+ return cmd;
+}
+
+
+int main(void)
+{
+ if (execute (1) == 0)
+ abort ();
+
+ if (execute2 (1, 2) == 0)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr78339.c b/gcc/testsuite/gcc.target/i386/mpx/pr78339.c
new file mode 100644
index 00000000000..3dd04240e8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr78339.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -Wsuggest-attribute=noreturn" } */
+
+extern _Noreturn void exit (int);
+int main (void) { exit (1); }
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79631.c b/gcc/testsuite/gcc.target/i386/mpx/pr79631.c
new file mode 100644
index 00000000000..075d46b835f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr79631.c
@@ -0,0 +1,15 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */
+
+typedef struct { int _mp_size; } mpz_t[1];
+int a, b;
+void fn1()
+{
+ mpz_t c[1][b];
+ for (;;) {
+ int d = 0 >= 0 ? 0 == 0 ? c[0][0]->_mp_size ? -1 : 0 : 0 : 0,
+ e = 0 >= 0 ? 0 == 0 ? c[1][1]->_mp_size ? -1 : 0 : 0 : 0;
+ if (d != e)
+ a++;
+ }
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79753.c b/gcc/testsuite/gcc.target/i386/mpx/pr79753.c
new file mode 100644
index 00000000000..9b7bc52e1ed
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr79753.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */
+
+int
+foo (void)
+{
+ return 0;
+}
+
+void
+bar (int **p)
+{
+ *p = (int *) (__UINTPTR_TYPE__) foo ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/mpx/pr79770.c b/gcc/testsuite/gcc.target/i386/mpx/pr79770.c
new file mode 100644
index 00000000000..0890fcc7bf1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/mpx/pr79770.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -mabi=ms -Wno-psabi" } */
+
+typedef unsigned U __attribute__ ((vector_size (64)));
+typedef unsigned __int128 V __attribute__ ((vector_size (64)));
+
+static inline V
+bar (U u, U x, V v)
+{
+ v = (V)(U) { 0, ~0 };
+ v[x[0]] <<= u[-63];
+ return v;
+}
+
+V
+foo (U u)
+{
+ return bar (u, (U) {}, (V) {});
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr65044.c b/gcc/testsuite/gcc.target/i386/pr65044.c
index 3b129862aa9..24b038e56a9 100644
--- a/gcc/testsuite/gcc.target/i386/pr65044.c
+++ b/gcc/testsuite/gcc.target/i386/pr65044.c
@@ -1,4 +1,4 @@
-/* { dg-error "-fcheck-pointer-bounds is not supported with Address Sanitizer" } */
+/* { dg-error ".-fcheck-pointer-bounds. is not supported with Address Sanitizer" } */
/* { dg-do compile { target { ! x32 } } } */
/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=address" } */
diff --git a/gcc/testsuite/gcc.target/i386/pr71458.c b/gcc/testsuite/gcc.target/i386/pr71458.c
new file mode 100644
index 00000000000..d36b61cbe02
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr71458.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { ! x32 } } } */
+/* { dg-options "-fcheck-pointer-bounds -mmpx -fsanitize=bounds" } */
+/* { dg-error "'-fcheck-pointer-bounds' is not supported with '-fsanitize=bounds'" "" { target *-*-* } 0 } */
+
+enum {} a[0];
+void fn1(int);
+void fn2() { fn1(a[-1]); }
diff --git a/gcc/testsuite/gcc.target/i386/pr79514.c b/gcc/testsuite/gcc.target/i386/pr79514.c
new file mode 100644
index 00000000000..c5b7bf8ef67
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr79514.c
@@ -0,0 +1,12 @@
+/* PR target/79514 */
+/* { dg-do compile } */
+/* { dg-options "-m96bit-long-double" } */
+
+extern void bar (long double);
+
+extern long double x;
+
+void foo (void)
+{
+ bar (x);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr80019.c b/gcc/testsuite/gcc.target/i386/pr80019.c
new file mode 100644
index 00000000000..35ec9608a80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr80019.c
@@ -0,0 +1,13 @@
+/* PR target/80019 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mxop -mavx2" } */
+
+typedef char v16qi __attribute__ ((vector_size (16)));
+
+extern v16qi b, c;
+
+void
+foo (int e)
+{
+ b = c << e;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
new file mode 100644
index 00000000000..2c06ea7106a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-p8.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-options "-mcpu=power8" } */
+
+#include <altivec.h>
+
+vector signed int
+test_vsi_packs_vsll_vsll (vector signed long long x,
+ vector signed long long y)
+{
+ return vec_packs (x, y);
+}
+
+vector unsigned int
+test_vui_packs_vull_vull (vector unsigned long long x,
+ vector unsigned long long y)
+{
+ return vec_packs (x, y);
+}
+
+/* Expected test results:
+ test_vsi_packs_vsll_vsll 1 vpksdss
+ test_vui_packs_vull_vull 1 vpkudus */
+
+/* { dg-final { scan-assembler-times "vpksdss" 1 } } */
+/* { dg-final { scan-assembler-times "vpkudus" 1 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c
index c776d139dc5..e4addedd59c 100644
--- a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-1.c
@@ -1,7 +1,5 @@
/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
-/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target hard_dfp } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */
/* { dg-final { scan-assembler-times "ddedpd " 4 } } */
@@ -10,11 +8,17 @@
/* { dg-final { scan-assembler-times "diex " 1 } } */
/* { dg-final { scan-assembler-times "dscli " 2 } } */
/* { dg-final { scan-assembler-times "dscri " 2 } } */
+/* { dg-final { scan-assembler-times "std " 1 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "ld " 1 { target lp64 } } } */
+/* 32-bit needs a stack frame, and needs two GPR mem insns per _Decimal64. */
+/* { dg-final { scan-assembler-times "stwu " 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "stw " 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "lwz " 2 { target ilp32 } } } */
+/* { dg-final { scan-assembler-times "stfd " 1 } } */
+/* { dg-final { scan-assembler-times "lfd " 1 } } */
/* { dg-final { scan-assembler-not "bl __builtin" } } */
/* { dg-final { scan-assembler-not "dctqpq" } } */
/* { dg-final { scan-assembler-not "drdpq" } } */
-/* { dg-final { scan-assembler-not "stfd" } } */
-/* { dg-final { scan-assembler-not "lfd" } } */
_Decimal64
do_dedpd_0 (_Decimal64 a)
@@ -52,14 +56,14 @@ do_enbcd_1 (_Decimal64 a)
return __builtin_denbcd (1, a);
}
-_Decimal64
+long long
do_xex (_Decimal64 a)
{
return __builtin_dxex (a);
}
_Decimal64
-do_iex (_Decimal64 a, _Decimal64 b)
+do_iex (long long a, _Decimal64 b)
{
return __builtin_diex (a, b);
}
diff --git a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-2.c b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-2.c
index 1c1a4b34be7..b3b7c990f83 100644
--- a/gcc/testsuite/gcc.target/powerpc/dfp-builtin-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/dfp-builtin-2.c
@@ -1,7 +1,5 @@
/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
-/* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
+/* { dg-require-effective-target hard_dfp } */
/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power7" } } */
/* { dg-options "-mcpu=power7 -O2" } */
/* { dg-final { scan-assembler-times "ddedpdq " 4 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79439.c b/gcc/testsuite/gcc.target/powerpc/pr79439.c
new file mode 100644
index 00000000000..c9b99871a5e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79439.c
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
+/* { dg-options "-O2 -fpic" } */
+
+/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
+ -fpic is used because rec can be interposed at link time (since it is
+ external), and the recursive call should call the interposed function. The
+ Linux 32-bit ABIs do not require NOPs after the BL instruction. */
+
+int f (void);
+
+void
+g (void)
+{
+}
+
+int
+rec (int a)
+{
+ int ret = 0;
+ if (a > 10 && f ())
+ ret += rec (a - 1);
+ g ();
+ return a + ret;
+}
+
+/* { dg-final { scan-assembler-times {\mbl f\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mbl g\M} 2 } } */
+/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mnop\M} 4 } } */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79544.c b/gcc/testsuite/gcc.target/powerpc/pr79544.c
new file mode 100644
index 00000000000..1016fbdb482
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79544.c
@@ -0,0 +1,21 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -O2" } */
+
+#include <altivec.h>
+
+vector unsigned long long
+test_sra (vector unsigned long long x, vector unsigned long long y)
+{
+ return vec_sra (x, y);
+}
+
+vector unsigned long long
+test_vsrad (vector unsigned long long x, vector unsigned long long y)
+{
+ return vec_vsrad (x, y);
+}
+
+/* { dg-final { scan-assembler-times {\mvsrad\M} 2 } } */
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79951.c b/gcc/testsuite/gcc.target/powerpc/pr79951.c
new file mode 100644
index 00000000000..67837444b20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr79951.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -S -mno-cmpb" } */
+
+float testf (float x, float y)
+{
+ return __builtin_copysignf (x, y);
+}
+
diff --git a/gcc/testsuite/gcc.target/powerpc/pr80246.c b/gcc/testsuite/gcc.target/powerpc/pr80246.c
new file mode 100644
index 00000000000..b43d8314b8b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr80246.c
@@ -0,0 +1,37 @@
+/* { dg-do compile { target { powerpc*-*-linux* } } } */
+/* { dg-require-effective-target hard_dfp } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "dxex " 1 } } */
+/* { dg-final { scan-assembler-times "dxexq " 1 } } */
+/* { dg-final { scan-assembler-times "diex " 1 } } */
+/* { dg-final { scan-assembler-times "diexq " 1 } } */
+/* { dg-final { scan-assembler-not "bl __builtin" } } */
+/* Verify we don't generate any drintn., drintnq., dctfix, dctfixq, dcffix
+ or dcffixq instructions, as they imply we are getting unwanted casting. */
+/* { dg-final { scan-assembler-not "drintn\[q\]\." } } */
+/* { dg-final { scan-assembler-not "dctfix\[q\]" } } */
+/* { dg-final { scan-assembler-not "dcffix\[q\]" } } */
+
+long long
+do_xex (_Decimal64 arg)
+{
+ return __builtin_dxex (arg);
+}
+
+long long
+do_xexq (_Decimal128 arg)
+{
+ return __builtin_dxexq (arg);
+}
+
+_Decimal64
+do_iex (long long exp, _Decimal64 arg)
+{
+ return __builtin_diex (exp, arg);
+}
+
+_Decimal128
+do_iexq (long long exp, _Decimal128 arg)
+{
+ return __builtin_diexq (exp, arg);
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c b/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
new file mode 100644
index 00000000000..d56276a3dd9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vec-xxpermdi.c
@@ -0,0 +1,68 @@
+/* { dg-do run { target { powerpc64*-*-* && vsx_hw } } } */
+/* { dg-options "-O2 -mvsx" } */
+
+/* Added for PR79261 to test that vec_xxpermdi works correctly for
+ both BE and LE targets. */
+
+#include <altivec.h>
+void abort (void);
+
+vector double vdx = { 0.0, 1.0 };
+vector double vdy = { 2.0, 3.0 };
+vector double vdz;
+
+vector signed long long vsllx = { 0, 1 };
+vector signed long long vslly = { 2, 3 };
+vector signed long long vsllz;
+
+vector float vfx = { 0.0, 1.0, 2.0, 3.0 };
+vector float vfy = { 4.0, 5.0, 6.0, 7.0 };
+vector float vfz;
+
+vector signed int vsix = { 0, 1, 2, 3 };
+vector signed int vsiy = { 4, 5, 6, 7 };
+vector signed int vsiz;
+
+vector signed short vssx = { 0, 1, 2, 3, 4, 5, 6, 7 };
+vector signed short vssy = { 8, 9, 10, 11, 12, 13, 14, 15 };
+vector signed short vssz;
+
+vector signed char vscx = { 0, 1, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15 };
+vector signed char vscy = { 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31 };
+vector signed char vscz;
+
+int
+main ()
+{
+ vdz = vec_xxpermdi (vdx, vdy, 0b01);
+ if (vdz[0] != 0.0 || vdz[1] != 3.0)
+ abort ();
+
+ vsllz = vec_xxpermdi (vsllx, vslly, 0b10);
+ if (vsllz[0] != 1 || vsllz[1] != 2)
+ abort ();
+
+ vfz = vec_xxpermdi (vfx, vfy, 0b01);
+ if (vfz[0] != 0.0 || vfz[1] != 1.0 || vfz[2] != 6.0 || vfz[3] != 7.0)
+ abort ();
+
+ vsiz = vec_xxpermdi (vsix, vsiy, 0b10);
+ if (vsiz[0] != 2 || vsiz[1] != 3 || vsiz[2] != 4 || vsiz[3] != 5)
+ abort ();
+
+ vssz = vec_xxpermdi (vssx, vssy, 0b00);
+ if (vssz[0] != 0 || vssz[1] != 1 || vssz[2] != 2 || vssz[3] != 3
+ || vssz[4] != 8 || vssz[5] != 9 || vssz[6] != 10 || vssz[7] != 11)
+ abort ();
+
+ vscz = vec_xxpermdi (vscx, vscy, 0b11);
+ if (vscz[0] != 8 || vscz[1] != 9 || vscz[2] != 10 || vscz[3] != 11
+ || vscz[4] != 12 || vscz[5] != 13 || vscz[6] != 14 || vscz[7] != 15
+ || vscz[8] != 24 || vscz[9] != 25 || vscz[10] != 26 || vscz[11] != 27
+ || vscz[12] != 28 || vscz[13] != 29 || vscz[14] != 30 || vscz[15] != 31)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
index f337c1c745b..ff5296c87e2 100644
--- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c
@@ -35,6 +35,8 @@
/* { dg-final { scan-assembler "xvcmpgesp" } } */
/* { dg-final { scan-assembler "xxsldwi" } } */
/* { dg-final { scan-assembler-not "call" } } */
+/* { dg-final { scan-assembler "xvcvsxdsp" } } */
+/* { dg-final { scan-assembler "xvcvuxdsp" } } */
extern __vector int si[][4];
extern __vector short ss[][4];
@@ -50,7 +52,9 @@ extern __vector __pixel p[][4];
#ifdef __VSX__
extern __vector double d[][4];
extern __vector long sl[][4];
+extern __vector long long sll[][4];
extern __vector unsigned long ul[][4];
+extern __vector unsigned long long ull[][4];
extern __vector __bool long bl[][4];
#endif
@@ -211,3 +215,22 @@ int do_xxsldwi (void)
d[i][0] = __builtin_vsx_xxsldwi (d[i][1], d[i][2], 3); i++;
return i;
}
+
+int do_xvcvsxdsp (void)
+{
+ int i = 0;
+
+ f[i][0] = __builtin_vsx_xvcvsxdsp (sll[i][1]); i++;
+
+ return i;
+}
+
+int do_xvcvuxdsp (void)
+{
+ int i = 0;
+
+ f[i][0] = __builtin_vsx_xvcvuxdsp (ull[i][1]); i++;
+
+ return i;
+}
+
diff --git a/gcc/testsuite/gcc.target/sparc/20170228-1.c b/gcc/testsuite/gcc.target/sparc/20170228-1.c
new file mode 100644
index 00000000000..575fbce528d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sparc/20170228-1.c
@@ -0,0 +1,20 @@
+/* PR target/79749 */
+/* Reported by Rainer Orth <ro@gcc.gnu.org> */
+
+/* { dg-do run } */
+/* { dg-options "-fomit-frame-pointer" } */
+
+extern void abort (void);
+
+int foo (int x1, int x2, int x3, int x4, int x5, int x6, int x7)
+{
+ return x7;
+}
+
+int main (void)
+{
+ if (foo (100, 200, 300, 400, 500, 600, 700) != 700)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gnat.dg/opt63.adb b/gcc/testsuite/gnat.dg/opt63.adb
new file mode 100644
index 00000000000..6471be40bbd
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt63.adb
@@ -0,0 +1,19 @@
+-- { dg-do compile }
+-- { dg-options "-O -gnatws" }
+
+procedure Opt63 is
+
+ type T_MOD is mod 2**32;
+ subtype T_INDEX is T_MOD range 3_000_000_000 .. 4_000_000_000;
+ type T_ARRAY is array(T_INDEX range <>) of INTEGER;
+
+ function Build_Crash(First : T_INDEX; Length : NATURAL) return T_ARRAY is
+ R : T_ARRAY(First .. T_Index'Val (T_Index'Pos (First) + Length))
+ := (others => -1); -- Crash here
+ begin
+ return R;
+ end;
+
+begin
+ null;
+end;
diff --git a/gcc/toplev.c b/gcc/toplev.c
index cb6c51739ff..c565ea4797e 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1367,16 +1367,33 @@ process_options (void)
{
if (targetm.chkp_bound_mode () == VOIDmode)
{
- error ("-fcheck-pointer-bounds is not supported for this target");
+ error ("%<-fcheck-pointer-bounds%> is not supported for this "
+ "target");
flag_check_pointer_bounds = 0;
}
+ if (flag_sanitize & SANITIZE_BOUNDS)
+ {
+ error ("%<-fcheck-pointer-bounds%> is not supported with "
+ "%<-fsanitize=bounds%>");
+ flag_check_pointer_bounds = 0;
+ }
+
if (flag_sanitize & SANITIZE_ADDRESS)
{
- error ("-fcheck-pointer-bounds is not supported with "
+ error ("%<-fcheck-pointer-bounds%> is not supported with "
"Address Sanitizer");
flag_check_pointer_bounds = 0;
}
+
+ if (flag_sanitize & SANITIZE_THREAD)
+ {
+ error (UNKNOWN_LOCATION,
+ "%<-fcheck-pointer-bounds%> is not supported with "
+ "Thread Sanitizer");
+
+ flag_check_pointer_bounds = 0;
+ }
}
/* One region RA really helps to decrease the code size. */
diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c
index 3fa2380d4bf..e594b332d76 100644
--- a/gcc/tree-chkp-opt.c
+++ b/gcc/tree-chkp-opt.c
@@ -282,9 +282,11 @@ chkp_is_constant_addr (const address_t &addr, int *sign)
return false;
else if (addr.pol[0].var)
return false;
+ else if (TREE_CODE (addr.pol[0].cst) != INTEGER_CST)
+ return false;
else if (integer_zerop (addr.pol[0].cst))
*sign = 0;
- else if (tree_int_cst_sign_bit (addr.pol[0].cst))
+ else if (tree_int_cst_sign_bit (addr.pol[0].cst))
*sign = -1;
else
*sign = 1;
diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
index 218c7eb40ab..824827768f4 100644
--- a/gcc/tree-chkp.c
+++ b/gcc/tree-chkp.c
@@ -2236,6 +2236,7 @@ chkp_build_returned_bound (gcall *call)
tree bounds;
gimple stmt;
tree fndecl = gimple_call_fndecl (call);
+ tree lhs = gimple_call_lhs (call);
unsigned int retflags;
/* To avoid fixing alloca expands in targets we handle
@@ -2246,9 +2247,8 @@ chkp_build_returned_bound (gcall *call)
|| DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA_WITH_ALIGN))
{
tree size = gimple_call_arg (call, 0);
- tree lb = gimple_call_lhs (call);
gimple_stmt_iterator iter = gsi_for_stmt (call);
- bounds = chkp_make_bounds (lb, size, &iter, true);
+ bounds = chkp_make_bounds (lhs, size, &iter, true);
}
/* We know bounds returned by set_bounds builtin call. */
else if (fndecl
@@ -2301,9 +2301,10 @@ chkp_build_returned_bound (gcall *call)
bounds = chkp_find_bounds (gimple_call_arg (call, argno), &iter);
}
- else if (chkp_call_returns_bounds_p (call))
+ else if (chkp_call_returns_bounds_p (call)
+ && BOUNDED_P (lhs))
{
- gcc_assert (TREE_CODE (gimple_call_lhs (call)) == SSA_NAME);
+ gcc_assert (TREE_CODE (lhs) == SSA_NAME);
/* In general case build checker builtin call to
obtain returned bounds. */
@@ -2330,7 +2331,7 @@ chkp_build_returned_bound (gcall *call)
print_gimple_stmt (dump_file, call, 0, TDF_VOPS|TDF_MEMSYMS);
}
- bounds = chkp_maybe_copy_and_register_bounds (gimple_call_lhs (call), bounds);
+ bounds = chkp_maybe_copy_and_register_bounds (lhs, bounds);
return bounds;
}
@@ -3556,8 +3557,8 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter)
break;
case PARM_DECL:
- gcc_unreachable ();
- bounds = chkp_get_bound_for_parm (ptr_src);
+ /* Handled above but failed. */
+ bounds = chkp_get_invalid_op_bounds ();
break;
case TARGET_MEM_REF:
@@ -3618,6 +3619,8 @@ chkp_find_bounds_1 (tree ptr, tree ptr_src, gimple_stmt_iterator *iter)
break;
case INTEGER_CST:
+ case COMPLEX_CST:
+ case VECTOR_CST:
if (integer_zerop (ptr_src))
bounds = chkp_get_none_bounds ();
else
@@ -3690,7 +3693,7 @@ chkp_walk_pointer_assignments (tree lhs, tree rhs, void *arg,
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (rhs), cnt, field, val)
{
- if (chkp_type_has_pointer (TREE_TYPE (field)))
+ if (field && chkp_type_has_pointer (TREE_TYPE (field)))
{
tree lhs_field = chkp_build_component_ref (lhs, field);
chkp_walk_pointer_assignments (lhs_field, val, arg, handler);
diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c
index 10e156e997f..a007f726cbc 100644
--- a/gcc/tree-ssa-loop-prefetch.c
+++ b/gcc/tree-ssa-loop-prefetch.c
@@ -65,6 +65,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "tree-inline.h"
#include "tree-data-ref.h"
+#include "diagnostic-core.h"
/* FIXME: Needed for optabs, but this should all be moved to a TBD interface
@@ -2005,10 +2006,6 @@ tree_ssa_prefetch_arrays (void)
set_builtin_decl (BUILT_IN_PREFETCH, decl, false);
}
- /* We assume that size of cache line is a power of two, so verify this
- here. */
- gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0);
-
FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
{
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2066,6 +2063,20 @@ pass_loop_prefetch::execute (function *fun)
if (number_of_loops (fun) <= 1)
return 0;
+ if ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) != 0)
+ {
+ static bool warned = false;
+
+ if (!warned)
+ {
+ warning (OPT_Wdisabled_optimization,
+ "%<l1-cache-size%> parameter is not a power of two %d",
+ PREFETCH_BLOCK);
+ warned = true;
+ }
+ return 0;
+ }
+
return tree_ssa_prefetch_arrays ();
}
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index b16bce8746a..9d04ee2d6bd 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -431,7 +431,17 @@ stream_out_histogram_value (struct output_block *ob, histogram_value hist)
break;
}
for (i = 0; i < hist->n_counters; i++)
- streamer_write_gcov_count (ob, hist->hvalue.counters[i]);
+ {
+ /* When user uses an unsigned type with a big value, constant converted
+ to gcov_type (a signed type) can be negative. */
+ gcov_type value = hist->hvalue.counters[i];
+ if (hist->type == HIST_TYPE_SINGLE_VALUE && i == 0)
+ ;
+ else
+ gcc_assert (value >= 0);
+
+ streamer_write_gcov_count (ob, value);
+ }
if (hist->hvalue.next)
stream_out_histogram_value (ob, hist->hvalue.next);
}
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index 488ec85588f..916db3cf95c 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,11 @@
+2017-02-07 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ Backport from mainline:
+ 2017-01-30 Szabolcs Nagy <szabolcs.nagy@arm.com>
+
+ PR target/78945
+ * config/arm/exch_n.c (libat_exchange): Check __ARM_FEATURE_SIMD32.
+
2016-06-03 Release Manager
* GCC 5.4.0 released.
diff --git a/libatomic/config/arm/exch_n.c b/libatomic/config/arm/exch_n.c
index 7ad73b73577..bc88ac9f9ac 100644
--- a/libatomic/config/arm/exch_n.c
+++ b/libatomic/config/arm/exch_n.c
@@ -29,7 +29,7 @@
/* When using STREX to implement sub-word exchange, we can do much better
than the compiler by using the APSR.GE and APSR.C flags. */
-#if !DONE && HAVE_STREX && !HAVE_STREXBH && N == 2
+#if !DONE && __ARM_FEATURE_SIMD32 && HAVE_STREX && !HAVE_STREXBH && N == 2
UTYPE
SIZE(libat_exchange) (UTYPE *mptr, UTYPE newval, int smodel)
{
@@ -79,7 +79,7 @@ SIZE(libat_exchange) (UTYPE *mptr, UTYPE newval, int smodel)
#endif /* !HAVE_STREXBH && N == 2 */
-#if !DONE && HAVE_STREX && !HAVE_STREXBH && N == 1
+#if !DONE && __ARM_FEATURE_SIMD32 && HAVE_STREX && !HAVE_STREXBH && N == 1
UTYPE
SIZE(libat_exchange) (UTYPE *mptr, UTYPE newval, int smodel)
{
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 13d19493495..00af6a47885 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,12 @@
+2017-02-17 Andreas Tobler <andreast@gcc.gnu.org>
+
+ Backported from mainline
+ 2017-02-16 Andreas Tobler <andreast@gcc.gnu.org>
+
+ PR sanitizer/79562
+ * sanitizer_common/sanitizer_platform_limits_posix.cc: Cherry-pick
+ upstream r294806.
+
2016-11-16 Markus Trippelsdorf <markus@trippelsdorf.de>
PR sanitizer/78294
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 2ef4ca22276..0d5b11f6e15 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -21,11 +21,6 @@
#ifdef _FILE_OFFSET_BITS
#undef _FILE_OFFSET_BITS
#endif
-#if SANITIZER_FREEBSD
-#define _WANT_RTENTRY
-#include <sys/param.h>
-#include <sys/socketvar.h>
-#endif
#include <arpa/inet.h>
#include <dirent.h>
#include <errno.h>
@@ -353,6 +348,7 @@ namespace __sanitizer {
unsigned struct_input_absinfo_sz = sizeof(struct input_absinfo);
unsigned struct_input_id_sz = sizeof(struct input_id);
unsigned struct_mtpos_sz = sizeof(struct mtpos);
+ unsigned struct_rtentry_sz = sizeof(struct rtentry);
unsigned struct_termio_sz = sizeof(struct termio);
unsigned struct_vt_consize_sz = sizeof(struct vt_consize);
unsigned struct_vt_sizes_sz = sizeof(struct vt_sizes);
@@ -372,7 +368,6 @@ namespace __sanitizer {
unsigned struct_midi_info_sz = sizeof(struct midi_info);
unsigned struct_mtget_sz = sizeof(struct mtget);
unsigned struct_mtop_sz = sizeof(struct mtop);
- unsigned struct_rtentry_sz = sizeof(struct rtentry);
unsigned struct_sbi_instrument_sz = sizeof(struct sbi_instrument);
unsigned struct_seq_event_rec_sz = sizeof(struct seq_event_rec);
unsigned struct_synth_info_sz = sizeof(struct synth_info);
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 0734d215691..537100e59f9 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,162 @@
+2017-03-17 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-03-17 Jonathan Wakely <jwakely@redhat.com>
+
+ * src/c++11/codecvt.cc (range): Add non-type template parameter and
+ define oerloaded operators for reading and writing code units.
+ (range<Elem, false>): Define partial specialization for accessing
+ wide characters in potentially unaligned byte ranges.
+ (ucs2_span(const char16_t*, const char16_t*, ...))
+ (ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
+ to range<const char16_t, false> in order to avoid unaligned reads.
+ (__codecvt_utf16_base<char16_t>::do_out)
+ (__codecvt_utf16_base<char32_t>::do_out)
+ (__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
+ unaligned data to avoid unaligned writes.
+ (__codecvt_utf16_base<char16_t>::do_in)
+ (__codecvt_utf16_base<char32_t>::do_in)
+ (__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
+ error if there are unprocessable trailing bytes.
+ (__codecvt_utf16_base<char16_t>::do_length)
+ (__codecvt_utf16_base<char32_t>::do_length)
+ (__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
+ range<const char16_t, false> to span functions.
+ * testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.
+
+ Backport from mainline
+ 2017-03-16 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/79980
+ * src/c++11/codecvt.cc (to_integer(codecvt_mode)): Fix target type.
+
+ PR libstdc++/80041
+ * src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
+ (__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
+ char16_t to work with UTF-16 instead of UTF-8.
+ * testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.
+
+ * src/c++11/codecvt.cc (codecvt<char16_t, char, mbstate_t>)
+ (codecvt<char32_t, char, mbstate_t>, __codecvt_utf8_base<char16_t>)
+ (__codecvt_utf8_base<char32_t>, __codecvt_utf8_base<wchar_t>)
+ (__codecvt_utf16_base<char16_t>, __codecvt_utf16_base<char32_t>)
+ (__codecvt_utf16_base<wchar_t>, __codecvt_utf8_utf16_base<char16_t>)
+ (__codecvt_utf8_utf16_base<char32_t>)
+ (__codecvt_utf8_utf16_base<wchar_t>): Fix do_encoding() and
+ do_max_length() return values.
+ * testsuite/22_locale/codecvt/codecvt_utf16/members.cc: New test.
+ * testsuite/22_locale/codecvt/codecvt_utf8/members.cc: New test.
+ * testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc: New test.
+
+ PR libstdc++/79980
+ * include/bits/locale_conv.h (__do_str_codecvt): Set __count on
+ error path.
+ * src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
+ for manipulating codecvt_mode values.
+ (read_utf16_bom): Compare input to BOM constants instead of integral
+ constants that depend on endianness. Take mode parameter by
+ reference and adjust it, to distinguish between no BOM present and
+ UTF-16BE BOM present.
+ (ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
+ (surrogates): New enumeration type.
+ (utf16_in, utf16_out): Add surrogates parameter to choose between
+ UTF-16 and UCS2 behaviour.
+ (utf16_span, ucs2_span): Use std::min not std::max.
+ (ucs2_out): Use std::min not std::max. Disallow surrogate pairs.
+ (ucs2_in): Likewise. Adjust calls to read_utf16_bom.
+ * testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
+ * testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.
+
+ PR libstdc++/79511
+ * src/c++11/codecvt.cc (write_utf16_code_point): Don't write 0xffff
+ as a surrogate pair.
+ (__codecvt_utf8_utf16_base<char32_t>::do_in): Use native endianness
+ for internal representation.
+ (__codecvt_utf8_utf16_base<wchar_t>::do_in): Likewise.
+ * testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: New test.
+
+2017-03-14 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/17_intro/names.cc: Undefine macros that clash with
+ identifiers in AIX system headers.
+
+2017-03-13 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ PR libstdc++/80034
+ * include/bits/list.tcc (merge(list&&)): Use const for the size_t
+ in the function and in the catch-block, qualify uses of std::distance.
+ (merge(list&&, _StrictWeakOrdering)): Likewise.
+ * testsuite/23_containers/list/operations/80034.cc: New.
+
+2017-03-02 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/79789
+ * include/bits/ios_base.h (make_error_code, make_error_condition):
+ Likewise.
+ * include/bits/mask_array.h (mask_array): Likewise.
+ * include/bits/regex.h (regex_token_iterator): Likewise.
+ * include/bits/slice_array.h (slice_array): Likewise.
+ * include/std/memory (undeclare_no_pointers): Likewise.
+ * testsuite/17_intro/names.cc: New test.
+
+2017-02-14 Jonathan Wakely <jwakely@redhat.com>
+
+ Backport from mainline
+ 2017-01-20 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/69321
+ * include/experimental/any (__any_caster): Avoid instantiating
+ manager function for types that can't be stored in any.
+ * testsuite/experimental/any/misc/any_cast.cc: Test non-copyable type.
+ * testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.
+
+ Backport from mainline
+ 2017-01-18 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/69301
+ * include/std/atomic (atomic<T>::load, atomic<T>::exchange): Use
+ aligned buffer instead of default-initialized variable.
+ * testsuite/29_atomics/atomic/69301.cc: New test.
+ * include/ext/pointer.h (_Pointer_adapter::operator++(int))
+ (_Pointer_adapter::operator--(int)): Likewise.
+
+ Backport from mainline
+ 2017-01-16 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/78702
+ * include/bits/locale_classes.h (locale::facet::__shim): Change from
+ private to protected.
+ * src/c++11/cxx11-shim_facets.cc (__shim_accessor): Define helper to
+ make locale::facet::__shim accessible.
+
+ Backport from mainline
+ 2017-01-11 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/78134
+ * include/bits/stl_map.h (map::lower_bound, map::upper_bound)
+ (map::equal_range): Fix return type of heterogeneous overloads.
+ * include/bits/stl_multimap.h (multimap::lower_bound)
+ (multimap::upper_bound, multimap::equal_range): Likewise.
+ * include/bits/stl_multiset.h (multiset::lower_bound)
+ (multiset::upper_bound, multiset::equal_range): Likewise.
+ * include/bits/stl_set.h (set::lower_bound, set::upper_bound)
+ (set::equal_range): Likewise.
+ * testsuite/23_containers/map/operations/2.cc: Check return types.
+ * testsuite/23_containers/multimap/operations/2.cc: Likewise.
+ * testsuite/23_containers/multiset/operations/2.cc: Likewise.
+ * testsuite/23_containers/set/operations/2.cc: Likewise.
+
+ Backport from mainline
+ 2017-01-11 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/78273
+ * include/bits/stl_map.h (map::count<_Kt>(const _Kt&)): Don't assume
+ the heterogeneous comparison can only find one match.
+ * include/bits/stl_set.h (set::count<_Kt>(const _Kt&)): Likewise.
+ * testsuite/23_containers/map/operations/2.cc: Test count works with
+ comparison function that just partitions rather than sorting.
+ * testsuite/23_containers/set/operations/2.cc: Likewise.
+
2017-02-01 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/78346
diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h
index 908ba7c7e4e..7e91c0bbbb0 100644
--- a/libstdc++-v3/include/bits/ios_base.h
+++ b/libstdc++-v3/include/bits/ios_base.h
@@ -207,12 +207,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const error_category& iostream_category() noexcept;
inline error_code
- make_error_code(io_errc e) noexcept
- { return error_code(static_cast<int>(e), iostream_category()); }
+ make_error_code(io_errc __e) noexcept
+ { return error_code(static_cast<int>(__e), iostream_category()); }
inline error_condition
- make_error_condition(io_errc e) noexcept
- { return error_condition(static_cast<int>(e), iostream_category()); }
+ make_error_condition(io_errc __e) noexcept
+ { return error_condition(static_cast<int>(__e), iostream_category()); }
#endif
// 27.4.2 Class ios_base
diff --git a/libstdc++-v3/include/bits/list.tcc b/libstdc++-v3/include/bits/list.tcc
index b812b19d6d4..1a0bb489151 100644
--- a/libstdc++-v3/include/bits/list.tcc
+++ b/libstdc++-v3/include/bits/list.tcc
@@ -344,7 +344,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
- size_t __orig_size = __x.size();
+ const size_t __orig_size = __x.size();
__try {
while (__first1 != __last1 && __first2 != __last2)
if (*__first2 < *__first1)
@@ -363,7 +363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
__catch(...)
{
- size_t __dist = distance(__first2, __last2);
+ const size_t __dist = std::distance(__first2, __last2);
this->_M_inc_size(__orig_size - __dist);
__x._M_set_size(__dist);
__throw_exception_again;
@@ -391,7 +391,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
iterator __last1 = end();
iterator __first2 = __x.begin();
iterator __last2 = __x.end();
- size_t __orig_size = __x.size();
+ const size_t __orig_size = __x.size();
__try
{
while (__first1 != __last1 && __first2 != __last2)
@@ -411,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
__catch(...)
{
- size_t __dist = distance(__first2, __last2);
+ const size_t __dist = std::distance(__first2, __last2);
this->_M_inc_size(__orig_size - __dist);
__x._M_set_size(__dist);
__throw_exception_again;
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index f3898ebf7b2..49fbe178b94 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -453,10 +453,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
facet&
operator=(const facet&); // Not defined.
- class __shim;
-
const facet* _M_sso_shim(const id*) const;
const facet* _M_cow_shim(const id*) const;
+
+ protected:
+ class __shim; // For internal use only.
};
diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index 16b48758e77..2b3f2dcbf41 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -81,7 +81,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& (__outstr.size() - __outchars) < __maxlen);
if (__result == codecvt_base::error)
- return false;
+ {
+ __count = __next - __first;
+ return false;
+ }
if (__result == codecvt_base::noconv)
{
diff --git a/libstdc++-v3/include/bits/mask_array.h b/libstdc++-v3/include/bits/mask_array.h
index 5078f1736cf..850ad8d4b2e 100644
--- a/libstdc++-v3/include/bits/mask_array.h
+++ b/libstdc++-v3/include/bits/mask_array.h
@@ -136,8 +136,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _Tp>
- inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a)
- : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}
+ inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& __a)
+ : _M_sz(__a._M_sz), _M_mask(__a._M_mask), _M_array(__a._M_array) {}
template<typename _Tp>
inline
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 9b26c8f465d..90723e6e255 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -2672,9 +2672,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
initializer_list<int>,
regex_constants::match_flag_type =
regex_constants::match_default) = delete;
- template <std::size_t N>
+ template <std::size_t _Nm>
regex_token_iterator(_Bi_iter, _Bi_iter, const regex_type&&,
- const int (&)[N],
+ const int (&)[_Nm],
regex_constants::match_flag_type =
regex_constants::match_default) = delete;
diff --git a/libstdc++-v3/include/bits/slice_array.h b/libstdc++-v3/include/bits/slice_array.h
index ee1c546a7c3..199998a3f54 100644
--- a/libstdc++-v3/include/bits/slice_array.h
+++ b/libstdc++-v3/include/bits/slice_array.h
@@ -204,8 +204,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
inline
- slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)
- : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}
+ slice_array<_Tp>::slice_array(const slice_array<_Tp>& __a)
+ : _M_sz(__a._M_sz), _M_stride(__a._M_stride), _M_array(__a._M_array) {}
// template<typename _Tp>
// inline slice_array<_Tp>::~slice_array () {}
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 04345c58101..1402607a13e 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -896,7 +896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x))
- { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
+ { return _M_t._M_count_tr(__x); }
#endif
//@}
@@ -920,8 +920,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -945,8 +945,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -965,8 +965,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -985,8 +985,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -1014,8 +1014,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
@@ -1043,8 +1043,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x)))
+ {
+ return pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x));
+ }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 20076a1fd04..c6fd14262d8 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -825,8 +825,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -850,8 +850,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -870,8 +870,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -890,8 +890,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -917,8 +917,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
@@ -944,8 +944,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x)))
+ {
+ return pair<const_iterator, const_iterator>(
+ _M_t._M_equal_range_tr(__x));
+ }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 3a947d53fba..28d80f0cbc4 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -719,14 +719,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -749,14 +749,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -788,14 +788,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index 805fd0788f7..c4cd597fca2 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -673,7 +673,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
auto
count(const _Kt& __x) const
-> decltype(_M_t._M_count_tr(__x))
- { return _M_t._M_find_tr(__x) == _M_t.end() ? 0 : 1; }
+ { return _M_t._M_count_tr(__x); }
#endif
//@}
@@ -738,14 +738,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
lower_bound(const _Kt& __x)
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))
+ { return iterator(_M_t._M_lower_bound_tr(__x)); }
template<typename _Kt>
auto
lower_bound(const _Kt& __x) const
- -> decltype(_M_t._M_lower_bound_tr(__x))
- { return _M_t._M_lower_bound_tr(__x); }
+ -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
+ { return const_iterator(_M_t._M_lower_bound_tr(__x)); }
#endif
//@}
@@ -768,14 +768,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
upper_bound(const _Kt& __x)
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return iterator(_M_t._M_upper_bound_tr(__x)); }
template<typename _Kt>
auto
upper_bound(const _Kt& __x) const
- -> decltype(_M_t._M_upper_bound_tr(__x))
- { return _M_t._M_upper_bound_tr(__x); }
+ -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
+ { return const_iterator(_M_t._M_upper_bound_tr(__x)); }
#endif
//@}
@@ -807,14 +807,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Kt>
auto
equal_range(const _Kt& __x)
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
template<typename _Kt>
auto
equal_range(const _Kt& __x) const
- -> decltype(_M_t._M_equal_range_tr(__x))
- { return _M_t._M_equal_range_tr(__x); }
+ -> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
+ { return pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)); }
#endif
//@}
diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any
index 30cdf54c192..78fe39f2536 100644
--- a/libstdc++-v3/include/experimental/any
+++ b/libstdc++-v3/include/experimental/any
@@ -236,14 +236,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Storage _M_storage;
template<typename _Tp>
- friend void* __any_caster(const any* __any)
- {
- if (__any->_M_manager != &_Manager<decay_t<_Tp>>::_S_manage)
- return nullptr;
- _Arg __arg;
- __any->_M_manager(_Op_access, __any, &__arg);
- return __arg._M_obj;
- }
+ friend void* __any_caster(const any* __any);
// Manage in-place contained object.
template<typename _Tp>
@@ -347,6 +340,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
// @}
+ template<typename _Tp>
+ void* __any_caster(const any* __any)
+ {
+ struct _None { };
+ using _Up = decay_t<_Tp>;
+ using _Vp = conditional_t<is_copy_constructible<_Up>::value, _Up, _None>;
+ if (__any->_M_manager != &any::_Manager<_Vp>::_S_manage)
+ return nullptr;
+ any::_Arg __arg;
+ __any->_M_manager(any::_Op_access, __any, &__arg);
+ return __arg._M_obj;
+ }
+
/**
* @brief Access the contained object.
*
diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h
index fdd07685541..30f59d4f55e 100644
--- a/libstdc++-v3/include/ext/pointer.h
+++ b/libstdc++-v3/include/ext/pointer.h
@@ -449,9 +449,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _Pointer_adapter
operator++(int)
{
- _Pointer_adapter tmp(*this);
+ _Pointer_adapter __tmp(*this);
_Storage_policy::set(_Storage_policy::get() + 1);
- return tmp;
+ return __tmp;
}
inline _Pointer_adapter&
@@ -464,9 +464,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline _Pointer_adapter
operator--(int)
{
- _Pointer_adapter tmp(*this);
+ _Pointer_adapter __tmp(*this);
_Storage_policy::set(_Storage_policy::get() - 1);
- return tmp;
+ return __tmp;
}
}; // class _Pointer_adapter
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index cdd1f0b992d..8d848297fd9 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -230,35 +230,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Tp
load(memory_order __m = memory_order_seq_cst) const noexcept
- {
- _Tp tmp;
- __atomic_load(&_M_i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_load(&_M_i, __ptr, __m);
+ return *__ptr;
}
_Tp
load(memory_order __m = memory_order_seq_cst) const volatile noexcept
- {
- _Tp tmp;
- __atomic_load(&_M_i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_load(&_M_i, __ptr, __m);
+ return *__ptr;
}
_Tp
exchange(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept
- {
- _Tp tmp;
- __atomic_exchange(&_M_i, &__i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_exchange(&_M_i, &__i, __ptr, __m);
+ return *__ptr;
}
_Tp
exchange(_Tp __i,
memory_order __m = memory_order_seq_cst) volatile noexcept
- {
- _Tp tmp;
- __atomic_exchange(&_M_i, &__i, &tmp, __m);
- return tmp;
+ {
+ alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
+ _Tp* __ptr = reinterpret_cast<_Tp*>(__buf);
+ __atomic_exchange(&_M_i, &__i, __ptr, __m);
+ return *__ptr;
}
bool
diff --git a/libstdc++-v3/src/c++11/codecvt.cc b/libstdc++-v3/src/c++11/codecvt.cc
index 8cd8eb46a96..11873397341 100644
--- a/libstdc++-v3/src/c++11/codecvt.cc
+++ b/libstdc++-v3/src/c++11/codecvt.cc
@@ -1,6 +1,6 @@
// Locale support (codecvt) -*- C++ -*-
-// Copyright (C) 2015 Free Software Foundation, Inc.
+// Copyright (C) 2015-2017 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
@@ -24,13 +24,27 @@
#include <codecvt>
#include <cstring> // std::memcpy, std::memcmp
-#include <bits/stl_algobase.h> // std::max
+#include <bits/stl_algobase.h> // std::min
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // The standard doesn't define these operators, which is annoying.
+ static underlying_type<codecvt_mode>::type
+ to_integer(codecvt_mode m)
+ { return static_cast<underlying_type<codecvt_mode>::type>(m); }
+
+ static codecvt_mode& operator&=(codecvt_mode& m, codecvt_mode n)
+ { return m = codecvt_mode(to_integer(m) & to_integer(n)); }
+
+ static codecvt_mode& operator|=(codecvt_mode& m, codecvt_mode n)
+ { return m = codecvt_mode(to_integer(m) | to_integer(n)); }
+
+ static codecvt_mode operator~(codecvt_mode m)
+ { return codecvt_mode(~to_integer(m)); }
+
namespace
{
// Largest code point that fits in a single UTF-16 code unit.
@@ -43,35 +57,142 @@ namespace
const char32_t incomplete_mb_character = char32_t(-2);
const char32_t invalid_mb_sequence = char32_t(-1);
- template<typename Elem>
+ // Utility type for reading and writing code units of type Elem from
+ // a range defined by a pair of pointers.
+ template<typename Elem, bool Aligned = true>
struct range
{
Elem* next;
Elem* end;
+ // Write a code unit.
+ range& operator=(Elem e)
+ {
+ *next++ = e;
+ return *this;
+ }
+
+ // Read the next code unit.
Elem operator*() const { return *next; }
- range& operator++() { ++next; return *this; }
+ // Read the Nth code unit.
+ Elem operator[](size_t n) const { return next[n]; }
+ // Move to the next code unit.
+ range& operator++()
+ {
+ ++next;
+ return *this;
+ }
+
+ // Move to the Nth code unit.
+ range& operator+=(size_t n)
+ {
+ next += n;
+ return *this;
+ }
+
+ // The number of code units remaining.
size_t size() const { return end - next; }
+
+ // The number of bytes remaining.
+ size_t nbytes() const { return (const char*)end - (const char*)next; }
+ };
+
+ // This specialization is used when accessing char16_t values through
+ // pointers to char, which might not be correctly aligned for char16_t.
+ template<typename Elem>
+ struct range<Elem, false>
+ {
+ using value_type = typename remove_const<Elem>::type;
+
+ using char_pointer = typename
+ conditional<is_const<Elem>::value, const char*, char*>::type;
+
+ char_pointer next;
+ char_pointer end;
+
+ // Write a code unit.
+ range& operator=(Elem e)
+ {
+ memcpy(next, &e, sizeof(Elem));
+ ++*this;
+ return *this;
+ }
+
+ // Read the next code unit.
+ Elem operator*() const
+ {
+ value_type e;
+ memcpy(&e, next, sizeof(Elem));
+ return e;
+ }
+
+ // Read the Nth code unit.
+ Elem operator[](size_t n) const
+ {
+ value_type e;
+ memcpy(&e, next + n * sizeof(Elem), sizeof(Elem));
+ return e;
+ }
+
+ // Move to the next code unit.
+ range& operator++()
+ {
+ next += sizeof(Elem);
+ return *this;
+ }
+
+ // Move to the Nth code unit.
+ range& operator+=(size_t n)
+ {
+ next += n * sizeof(Elem);
+ return *this;
+ }
+
+ // The number of code units remaining.
+ size_t size() const { return nbytes() / sizeof(Elem); }
+
+ // The number of bytes remaining.
+ size_t nbytes() const { return end - next; }
};
// Multibyte sequences can have "header" consisting of Byte Order Mark
const unsigned char utf8_bom[3] = { 0xEF, 0xBB, 0xBF };
- const unsigned char utf16_bom[4] = { 0xFE, 0xFF };
- const unsigned char utf16le_bom[4] = { 0xFF, 0xFE };
+ const unsigned char utf16_bom[2] = { 0xFE, 0xFF };
+ const unsigned char utf16le_bom[2] = { 0xFF, 0xFE };
- template<size_t N>
- inline bool
- write_bom(range<char>& to, const unsigned char (&bom)[N])
+ // Write a BOM (space permitting).
+ template<typename C, bool A, size_t N>
+ bool
+ write_bom(range<C, A>& to, const unsigned char (&bom)[N])
{
- if (to.size() < N)
+ static_assert( (N / sizeof(C)) != 0, "" );
+ static_assert( (N % sizeof(C)) == 0, "" );
+
+ if (to.nbytes() < N)
return false;
memcpy(to.next, bom, N);
- to.next += N;
+ to += (N / sizeof(C));
return true;
}
+ // Try to read a BOM.
+ template<typename C, bool A, size_t N>
+ bool
+ read_bom(range<C, A>& from, const unsigned char (&bom)[N])
+ {
+ static_assert( (N / sizeof(C)) != 0, "" );
+ static_assert( (N % sizeof(C)) == 0, "" );
+
+ if (from.nbytes() >= N && !memcmp(from.next, bom, N))
+ {
+ from += (N / sizeof(C));
+ return true;
+ }
+ return false;
+ }
+
// If generate_header is set in mode write out UTF-8 BOM.
bool
write_utf8_bom(range<char>& to, codecvt_mode mode)
@@ -83,32 +204,20 @@ namespace
// If generate_header is set in mode write out the UTF-16 BOM indicated
// by whether little_endian is set in mode.
+ template<bool Aligned>
bool
- write_utf16_bom(range<char16_t>& to, codecvt_mode mode)
+ write_utf16_bom(range<char16_t, Aligned>& to, codecvt_mode mode)
{
if (mode & generate_header)
{
- if (!to.size())
- return false;
- auto* bom = (mode & little_endian) ? utf16le_bom : utf16_bom;
- std::memcpy(to.next, bom, 2);
- ++to.next;
+ if (mode & little_endian)
+ return write_bom(to, utf16le_bom);
+ else
+ return write_bom(to, utf16_bom);
}
return true;
}
- template<size_t N>
- inline bool
- read_bom(range<const char>& from, const unsigned char (&bom)[N])
- {
- if (from.size() >= N && !memcmp(from.next, bom, N))
- {
- from.next += N;
- return true;
- }
- return false;
- }
-
// If consume_header is set in mode update from.next to after any BOM.
void
read_utf8_bom(range<const char>& from, codecvt_mode mode)
@@ -117,22 +226,21 @@ namespace
read_bom(from, utf8_bom);
}
- // If consume_header is set in mode update from.next to after any BOM.
- // Return little_endian iff the UTF-16LE BOM was present.
- codecvt_mode
- read_utf16_bom(range<const char16_t>& from, codecvt_mode mode)
+ // If consume_header is not set in mode, no effects.
+ // Otherwise, if *from.next is a UTF-16 BOM increment from.next and then:
+ // - if the UTF-16BE BOM was found unset little_endian in mode, or
+ // - if the UTF-16LE BOM was found set little_endian in mode.
+ template<bool Aligned>
+ void
+ read_utf16_bom(range<const char16_t, Aligned>& from, codecvt_mode& mode)
{
- if (mode & consume_header && from.size())
+ if (mode & consume_header)
{
- if (*from.next == 0xFEFF)
- ++from.next;
- else if (*from.next == 0xFFFE)
- {
- ++from.next;
- return little_endian;
- }
+ if (read_bom(from, utf16_bom))
+ mode &= ~little_endian;
+ else if (read_bom(from, utf16le_bom))
+ mode |= little_endian;
}
- return {};
}
// Read a codepoint from a UTF-8 multibyte sequence.
@@ -144,11 +252,11 @@ namespace
const size_t avail = from.size();
if (avail == 0)
return incomplete_mb_character;
- unsigned char c1 = from.next[0];
+ unsigned char c1 = from[0];
// https://en.wikipedia.org/wiki/UTF-8#Sample_code
if (c1 < 0x80)
{
- ++from.next;
+ ++from;
return c1;
}
else if (c1 < 0xC2) // continuation or overlong 2-byte sequence
@@ -157,51 +265,51 @@ namespace
{
if (avail < 2)
return incomplete_mb_character;
- unsigned char c2 = from.next[1];
+ unsigned char c2 = from[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 6) + c2 - 0x3080;
if (c <= maxcode)
- from.next += 2;
+ from += 2;
return c;
}
else if (c1 < 0xF0) // 3-byte sequence
{
if (avail < 3)
return incomplete_mb_character;
- unsigned char c2 = from.next[1];
+ unsigned char c2 = from[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
if (c1 == 0xE0 && c2 < 0xA0) // overlong
return invalid_mb_sequence;
- unsigned char c3 = from.next[2];
+ unsigned char c3 = from[2];
if ((c3 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 12) + (c2 << 6) + c3 - 0xE2080;
if (c <= maxcode)
- from.next += 3;
+ from += 3;
return c;
}
else if (c1 < 0xF5) // 4-byte sequence
{
if (avail < 4)
return incomplete_mb_character;
- unsigned char c2 = from.next[1];
+ unsigned char c2 = from[1];
if ((c2 & 0xC0) != 0x80)
return invalid_mb_sequence;
if (c1 == 0xF0 && c2 < 0x90) // overlong
return invalid_mb_sequence;
if (c1 == 0xF4 && c2 >= 0x90) // > U+10FFFF
return invalid_mb_sequence;
- unsigned char c3 = from.next[2];
+ unsigned char c3 = from[2];
if ((c3 & 0xC0) != 0x80)
return invalid_mb_sequence;
- unsigned char c4 = from.next[3];
+ unsigned char c4 = from[3];
if ((c4 & 0xC0) != 0x80)
return invalid_mb_sequence;
char32_t c = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4 - 0x3C82080;
if (c <= maxcode)
- from.next += 4;
+ from += 4;
return c;
}
else // > U+10FFFF
@@ -215,31 +323,31 @@ namespace
{
if (to.size() < 1)
return false;
- *to.next++ = code_point;
+ to = code_point;
}
else if (code_point <= 0x7FF)
{
if (to.size() < 2)
return false;
- *to.next++ = (code_point >> 6) + 0xC0;
- *to.next++ = (code_point & 0x3F) + 0x80;
+ to = (code_point >> 6) + 0xC0;
+ to = (code_point & 0x3F) + 0x80;
}
else if (code_point <= 0xFFFF)
{
if (to.size() < 3)
return false;
- *to.next++ = (code_point >> 12) + 0xE0;
- *to.next++ = ((code_point >> 6) & 0x3F) + 0x80;
- *to.next++ = (code_point & 0x3F) + 0x80;
+ to = (code_point >> 12) + 0xE0;
+ to = ((code_point >> 6) & 0x3F) + 0x80;
+ to = (code_point & 0x3F) + 0x80;
}
else if (code_point <= 0x10FFFF)
{
if (to.size() < 4)
return false;
- *to.next++ = (code_point >> 18) + 0xF0;
- *to.next++ = ((code_point >> 12) & 0x3F) + 0x80;
- *to.next++ = ((code_point >> 6) & 0x3F) + 0x80;
- *to.next++ = (code_point & 0x3F) + 0x80;
+ to = (code_point >> 18) + 0xF0;
+ to = ((code_point >> 12) & 0x3F) + 0x80;
+ to = ((code_point >> 6) & 0x3F) + 0x80;
+ to = (code_point & 0x3F) + 0x80;
}
else
return false;
@@ -280,47 +388,47 @@ namespace
// The sequence's endianness is indicated by (mode & little_endian).
// Updates from.next if the codepoint is not greater than maxcode.
// Returns invalid_mb_sequence, incomplete_mb_character or the code point.
- char32_t
- read_utf16_code_point(range<const char16_t>& from, unsigned long maxcode,
- codecvt_mode mode)
- {
- const size_t avail = from.size();
- if (avail == 0)
- return incomplete_mb_character;
- int inc = 1;
- char32_t c = adjust_byte_order(from.next[0], mode);
- if (is_high_surrogate(c))
- {
- if (avail < 2)
- return incomplete_mb_character;
- const char16_t c2 = adjust_byte_order(from.next[1], mode);
- if (is_low_surrogate(c2))
- {
- c = surrogate_pair_to_code_point(c, c2);
- inc = 2;
- }
- else
- return invalid_mb_sequence;
- }
- else if (is_low_surrogate(c))
- return invalid_mb_sequence;
- if (c <= maxcode)
- from.next += inc;
- return c;
- }
+ template<bool Aligned>
+ char32_t
+ read_utf16_code_point(range<const char16_t, Aligned>& from,
+ unsigned long maxcode, codecvt_mode mode)
+ {
+ const size_t avail = from.size();
+ if (avail == 0)
+ return incomplete_mb_character;
+ int inc = 1;
+ char32_t c = adjust_byte_order(from[0], mode);
+ if (is_high_surrogate(c))
+ {
+ if (avail < 2)
+ return incomplete_mb_character;
+ const char16_t c2 = adjust_byte_order(from[1], mode);
+ if (is_low_surrogate(c2))
+ {
+ c = surrogate_pair_to_code_point(c, c2);
+ inc = 2;
+ }
+ else
+ return invalid_mb_sequence;
+ }
+ else if (is_low_surrogate(c))
+ return invalid_mb_sequence;
+ if (c <= maxcode)
+ from += inc;
+ return c;
+ }
- template<typename C>
+ template<typename C, bool A>
bool
- write_utf16_code_point(range<C>& to, char32_t codepoint, codecvt_mode mode)
+ write_utf16_code_point(range<C, A>& to, char32_t codepoint, codecvt_mode mode)
{
static_assert(sizeof(C) >= 2, "a code unit must be at least 16-bit");
- if (codepoint < max_single_utf16_unit)
+ if (codepoint <= max_single_utf16_unit)
{
if (to.size() > 0)
{
- *to.next = adjust_byte_order(codepoint, mode);
- ++to.next;
+ to = adjust_byte_order(codepoint, mode);
return true;
}
}
@@ -330,9 +438,8 @@ namespace
const char32_t LEAD_OFFSET = 0xD800 - (0x10000 >> 10);
char16_t lead = LEAD_OFFSET + (codepoint >> 10);
char16_t trail = 0xDC00 + (codepoint & 0x3FF);
- to.next[0] = adjust_byte_order(lead, mode);
- to.next[1] = adjust_byte_order(trail, mode);
- to.next += 2;
+ to = adjust_byte_order(lead, mode);
+ to = adjust_byte_order(trail, mode);
return true;
}
return false;
@@ -351,7 +458,7 @@ namespace
return codecvt_base::partial;
if (codepoint > maxcode)
return codecvt_base::error;
- *to.next++ = codepoint;
+ to = codepoint;
}
return from.size() ? codecvt_base::partial : codecvt_base::ok;
}
@@ -365,23 +472,22 @@ namespace
return codecvt_base::partial;
while (from.size())
{
- const char32_t c = from.next[0];
+ const char32_t c = from[0];
if (c > maxcode)
return codecvt_base::error;
if (!write_utf8_code_point(to, c))
return codecvt_base::partial;
- ++from.next;
+ ++from;
}
return codecvt_base::ok;
}
// utf16 -> ucs4
codecvt_base::result
- ucs4_in(range<const char16_t>& from, range<char32_t>& to,
+ ucs4_in(range<const char16_t, false>& from, range<char32_t>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
- if (read_utf16_bom(from, mode) == little_endian)
- mode = codecvt_mode(mode & little_endian);
+ read_utf16_bom(from, mode);
while (from.size() && to.size())
{
const char32_t codepoint = read_utf16_code_point(from, maxcode, mode);
@@ -389,72 +495,85 @@ namespace
return codecvt_base::partial;
if (codepoint > maxcode)
return codecvt_base::error;
- *to.next++ = codepoint;
+ to = codepoint;
}
return from.size() ? codecvt_base::partial : codecvt_base::ok;
}
// ucs4 -> utf16
codecvt_base::result
- ucs4_out(range<const char32_t>& from, range<char16_t>& to,
+ ucs4_out(range<const char32_t>& from, range<char16_t, false>& to,
unsigned long maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf16_bom(to, mode))
return codecvt_base::partial;
while (from.size())
{
- const char32_t c = from.next[0];
+ const char32_t c = from[0];
if (c > maxcode)
return codecvt_base::error;
if (!write_utf16_code_point(to, c, mode))
return codecvt_base::partial;
- ++from.next;
+ ++from;
}
return codecvt_base::ok;
}
- // utf8 -> utf16
+ // Flag indicating whether to process UTF-16 or UCS2
+ enum class surrogates { allowed, disallowed };
+
+ // utf8 -> utf16 (or utf8 -> ucs2 if s == surrogates::disallowed)
template<typename C>
codecvt_base::result
utf16_in(range<const char>& from, range<C>& to,
- unsigned long maxcode = max_code_point, codecvt_mode mode = {})
+ unsigned long maxcode = max_code_point, codecvt_mode mode = {},
+ surrogates s = surrogates::allowed)
{
read_utf8_bom(from, mode);
while (from.size() && to.size())
{
- const char* const first = from.next;
+ auto orig = from;
const char32_t codepoint = read_utf8_code_point(from, maxcode);
if (codepoint == incomplete_mb_character)
- return codecvt_base::partial;
+ {
+ if (s == surrogates::allowed)
+ return codecvt_base::partial;
+ else
+ return codecvt_base::error; // No surrogates in UCS2
+ }
if (codepoint > maxcode)
return codecvt_base::error;
if (!write_utf16_code_point(to, codepoint, mode))
{
- from.next = first;
+ from = orig; // rewind to previous position
return codecvt_base::partial;
}
}
return codecvt_base::ok;
}
- // utf16 -> utf8
+ // utf16 -> utf8 (or ucs2 -> utf8 if s == surrogates::disallowed)
template<typename C>
codecvt_base::result
utf16_out(range<const C>& from, range<char>& to,
- unsigned long maxcode = max_code_point, codecvt_mode mode = {})
+ unsigned long maxcode = max_code_point, codecvt_mode mode = {},
+ surrogates s = surrogates::allowed)
{
if (!write_utf8_bom(to, mode))
return codecvt_base::partial;
while (from.size())
{
- char32_t c = from.next[0];
+ char32_t c = from[0];
int inc = 1;
if (is_high_surrogate(c))
{
+ if (s == surrogates::disallowed)
+ return codecvt_base::error; // No surrogates in UCS-2
+
if (from.size() < 2)
return codecvt_base::ok; // stop converting at this point
- const char32_t c2 = from.next[1];
+ const char32_t c2 = from[1];
if (is_low_surrogate(c2))
{
c = surrogate_pair_to_code_point(c, c2);
@@ -469,7 +588,7 @@ namespace
return codecvt_base::error;
if (!write_utf8_code_point(to, c))
return codecvt_base::partial;
- from.next += inc;
+ from += inc;
}
return codecvt_base::ok;
}
@@ -492,7 +611,7 @@ namespace
++count;
}
if (count+1 == max) // take one more character if it fits in a single unit
- read_utf8_code_point(from, std::max(max_single_utf16_unit, maxcode));
+ read_utf8_code_point(from, std::min(max_single_utf16_unit, maxcode));
return from.next;
}
@@ -501,7 +620,9 @@ namespace
ucs2_in(range<const char>& from, range<char16_t>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
- return utf16_in(from, to, std::max(max_single_utf16_unit, maxcode), mode);
+ // UCS-2 only supports characters in the BMP, i.e. one UTF-16 code unit:
+ maxcode = std::min(max_single_utf16_unit, maxcode);
+ return utf16_in(from, to, maxcode, mode, surrogates::disallowed);
}
// ucs2 -> utf8
@@ -509,61 +630,62 @@ namespace
ucs2_out(range<const char16_t>& from, range<char>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
- return utf16_out(from, to, std::max(max_single_utf16_unit, maxcode), mode);
+ // UCS-2 only supports characters in the BMP, i.e. one UTF-16 code unit:
+ maxcode = std::min(max_single_utf16_unit, maxcode);
+ return utf16_out(from, to, maxcode, mode, surrogates::disallowed);
}
// ucs2 -> utf16
codecvt_base::result
- ucs2_out(range<const char16_t>& from, range<char16_t>& to,
+ ucs2_out(range<const char16_t>& from, range<char16_t, false>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
if (!write_utf16_bom(to, mode))
return codecvt_base::partial;
while (from.size() && to.size())
{
- char16_t c = from.next[0];
+ char16_t c = from[0];
if (is_high_surrogate(c))
return codecvt_base::error;
if (c > maxcode)
return codecvt_base::error;
- *to.next++ = adjust_byte_order(c, mode);
- ++from.next;
+ to = adjust_byte_order(c, mode);
+ ++from;
}
return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
}
// utf16 -> ucs2
codecvt_base::result
- ucs2_in(range<const char16_t>& from, range<char16_t>& to,
+ ucs2_in(range<const char16_t, false>& from, range<char16_t>& to,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
- if (read_utf16_bom(from, mode) == little_endian)
- mode = codecvt_mode(mode & little_endian);
- maxcode = std::max(max_single_utf16_unit, maxcode);
+ read_utf16_bom(from, mode);
+ // UCS-2 only supports characters in the BMP, i.e. one UTF-16 code unit:
+ maxcode = std::min(max_single_utf16_unit, maxcode);
while (from.size() && to.size())
{
const char32_t c = read_utf16_code_point(from, maxcode, mode);
if (c == incomplete_mb_character)
- return codecvt_base::partial;
+ return codecvt_base::error; // UCS-2 only supports single units.
if (c > maxcode)
return codecvt_base::error;
- *to.next++ = c;
+ to = c;
}
return from.size() == 0 ? codecvt_base::ok : codecvt_base::partial;
}
const char16_t*
- ucs2_span(const char16_t* begin, const char16_t* end, size_t max,
+ ucs2_span(range<const char16_t, false>& from, size_t max,
char32_t maxcode, codecvt_mode mode)
{
- range<const char16_t> from{ begin, end };
- if (read_utf16_bom(from, mode) == little_endian)
- mode = codecvt_mode(mode & little_endian);
- maxcode = std::max(max_single_utf16_unit, maxcode);
+ read_utf16_bom(from, mode);
+ // UCS-2 only supports characters in the BMP, i.e. one UTF-16 code unit:
+ maxcode = std::min(max_single_utf16_unit, maxcode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf16_code_point(from, maxcode, mode);
- return from.next;
+ return reinterpret_cast<const char16_t*>(from.next);
}
const char*
@@ -572,7 +694,8 @@ namespace
{
range<const char> from{ begin, end };
read_utf8_bom(from, mode);
- maxcode = std::max(max_single_utf16_unit, maxcode);
+ // UCS-2 only supports characters in the BMP, i.e. one UTF-16 code unit:
+ maxcode = std::min(max_single_utf16_unit, maxcode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf8_code_point(from, maxcode);
@@ -594,16 +717,14 @@ namespace
// return pos such that [begin,pos) is valid UCS-4 string no longer than max
const char16_t*
- ucs4_span(const char16_t* begin, const char16_t* end, size_t max,
+ ucs4_span(range<const char16_t, false>& from, size_t max,
char32_t maxcode = max_code_point, codecvt_mode mode = {})
{
- range<const char16_t> from{ begin, end };
- if (read_utf16_bom(from, mode) == little_endian)
- mode = codecvt_mode(mode & little_endian);
+ read_utf16_bom(from, mode);
char32_t c = 0;
while (max-- && c <= maxcode)
c = read_utf16_code_point(from, maxcode, mode);
- return from.next;
+ return reinterpret_cast<const char16_t*>(from.next);
}
}
@@ -661,7 +782,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
codecvt<char16_t, char, mbstate_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
codecvt<char16_t, char, mbstate_t>::do_always_noconv() const throw()
@@ -679,9 +800,9 @@ do_length(state_type&, const extern_type* __from,
int
codecvt<char16_t, char, mbstate_t>::do_max_length() const throw()
{
- // Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
- // whereas 4 byte sequences require two 16-bit code units.
- return 3;
+ // A single character (one or two UTF-16 code units) requires
+ // up to four UTF-8 code units.
+ return 4;
}
// Define members of codecvt<char32_t, char, mbstate_t> specialization.
@@ -732,7 +853,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
codecvt<char32_t, char, mbstate_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
codecvt<char32_t, char, mbstate_t>::do_always_noconv() const throw()
@@ -749,7 +870,11 @@ do_length(state_type&, const extern_type* __from,
int
codecvt<char32_t, char, mbstate_t>::do_max_length() const throw()
-{ return 4; }
+{
+ // A single character (one UTF-32 code unit) requires
+ // up to 4 UTF-8 code units.
+ return 4;
+}
// Define members of codecvt_utf8<char16_t> base class implementation.
// Converts from UTF-8 to UCS-2.
@@ -801,7 +926,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_base<char16_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_base<char16_t>::do_always_noconv() const throw()
@@ -818,7 +943,14 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_base<char16_t>::do_max_length() const throw()
-{ return 3; }
+{
+ // A single UCS-2 character requires up to three UTF-8 code units.
+ // (UCS-2 cannot represent characters that use four UTF-8 code units).
+ int max = 3;
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
+}
// Define members of codecvt_utf8<char32_t> base class implementation.
// Converts from UTF-8 to UTF-32 (aka UCS-4).
@@ -866,7 +998,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_base<char32_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_base<char32_t>::do_always_noconv() const throw()
@@ -883,9 +1015,22 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_base<char32_t>::do_max_length() const throw()
-{ return 4; }
+{
+ // A single UCS-4 character requires up to four UTF-8 code units.
+ int max = 4;
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
+}
#ifdef _GLIBCXX_USE_WCHAR_T
+
+#if __SIZEOF_WCHAR_T__ == 2
+static_assert(sizeof(wchar_t) == sizeof(char16_t), "");
+#elif __SIZEOF_WCHAR_T__ == 4
+static_assert(sizeof(wchar_t) == sizeof(char32_t), "");
+#endif
+
// Define members of codecvt_utf8<wchar_t> base class implementation.
// Converts from UTF-8 to UCS-2 or UCS-4 depending on sizeof(wchar_t).
@@ -958,7 +1103,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_base<wchar_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_base<wchar_t>::do_always_noconv() const throw()
@@ -981,7 +1126,16 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_base<wchar_t>::do_max_length() const throw()
-{ return 4; }
+{
+#if __SIZEOF_WCHAR_T__ == 2
+ int max = 3; // See __codecvt_utf8_base<char16_t>::do_max_length()
+#else
+ int max = 4; // See __codecvt_utf8_base<char32_t>::do_max_length()
+#endif
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
+}
#endif
// Define members of codecvt_utf16<char16_t> base class implementation.
@@ -997,10 +1151,7 @@ do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
extern_type*& __to_next) const
{
range<const char16_t> from{ __from, __from_end };
- range<char16_t> to{
- reinterpret_cast<char16_t*>(__to),
- reinterpret_cast<char16_t*>(__to_end)
- };
+ range<char16_t, false> to{ __to, __to_end };
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = reinterpret_cast<char*>(to.next);
@@ -1023,20 +1174,19 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
- range<const char16_t> from{
- reinterpret_cast<const char16_t*>(__from),
- reinterpret_cast<const char16_t*>(__from_end)
- };
+ range<const char16_t, false> from{ __from, __from_end };
range<char16_t> to{ __to, __to_end };
auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
__from_next = reinterpret_cast<const char*>(from.next);
__to_next = to.next;
+ if (res == codecvt_base::ok && __from_next != __from_end)
+ res = codecvt_base::error;
return res;
}
int
__codecvt_utf16_base<char16_t>::do_encoding() const throw()
-{ return 1; }
+{ return 0; } // UTF-16 is not a fixed-width encoding
bool
__codecvt_utf16_base<char16_t>::do_always_noconv() const throw()
@@ -1047,15 +1197,21 @@ __codecvt_utf16_base<char16_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
- auto next = reinterpret_cast<const char16_t*>(__from);
- next = ucs2_span(next, reinterpret_cast<const char16_t*>(__end), __max,
- _M_maxcode, _M_mode);
+ range<const char16_t, false> from{ __from, __end };
+ const char16_t* next = ucs2_span(from, __max, _M_maxcode, _M_mode);
return reinterpret_cast<const char*>(next) - __from;
}
int
__codecvt_utf16_base<char16_t>::do_max_length() const throw()
-{ return 3; }
+{
+ // A single UCS-2 character requires one UTF-16 code unit (so two chars).
+ // (UCS-2 cannot represent characters that use multiple UTF-16 code units).
+ int max = 2;
+ if (_M_mode & consume_header)
+ max += sizeof(utf16_bom);
+ return max;
+}
// Define members of codecvt_utf16<char32_t> base class implementation.
// Converts from UTF-16 to UTF-32 (aka UCS-4).
@@ -1070,10 +1226,7 @@ do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
extern_type*& __to_next) const
{
range<const char32_t> from{ __from, __from_end };
- range<char16_t> to{
- reinterpret_cast<char16_t*>(__to),
- reinterpret_cast<char16_t*>(__to_end)
- };
+ range<char16_t, false> to{ __to, __to_end };
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
__from_next = from.next;
__to_next = reinterpret_cast<char*>(to.next);
@@ -1096,20 +1249,19 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
- range<const char16_t> from{
- reinterpret_cast<const char16_t*>(__from),
- reinterpret_cast<const char16_t*>(__from_end)
- };
+ range<const char16_t, false> from{ __from, __from_end };
range<char32_t> to{ __to, __to_end };
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
__from_next = reinterpret_cast<const char*>(from.next);
__to_next = to.next;
+ if (res == codecvt_base::ok && __from_next != __from_end)
+ res = codecvt_base::error;
return res;
}
int
__codecvt_utf16_base<char32_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-16 is not a fixed-width encoding
bool
__codecvt_utf16_base<char32_t>::do_always_noconv() const throw()
@@ -1120,15 +1272,21 @@ __codecvt_utf16_base<char32_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
- auto next = reinterpret_cast<const char16_t*>(__from);
- next = ucs4_span(next, reinterpret_cast<const char16_t*>(__end), __max,
- _M_maxcode, _M_mode);
+ range<const char16_t, false> from{ __from, __end };
+ const char16_t* next = ucs4_span(from, __max, _M_maxcode, _M_mode);
return reinterpret_cast<const char*>(next) - __from;
}
int
__codecvt_utf16_base<char32_t>::do_max_length() const throw()
-{ return 4; }
+{
+ // A single UCS-4 character requires one or two UTF-16 code units
+ // (so up to four chars).
+ int max = 4;
+ if (_M_mode & consume_header)
+ max += sizeof(utf16_bom);
+ return max;
+}
#ifdef _GLIBCXX_USE_WCHAR_T
// Define members of codecvt_utf16<wchar_t> base class implementation.
@@ -1143,24 +1301,24 @@ do_out(state_type&, const intern_type* __from, const intern_type* __from_end,
extern_type* __to, extern_type* __to_end,
extern_type*& __to_next) const
{
- range<char> to{ __to, __to_end };
+ range<char16_t, false> to{ __to, __to_end };
#if __SIZEOF_WCHAR_T__ == 2
range<const char16_t> from{
reinterpret_cast<const char16_t*>(__from),
- reinterpret_cast<const char16_t*>(__from_end)
+ reinterpret_cast<const char16_t*>(__from_end),
};
auto res = ucs2_out(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<const char32_t> from{
reinterpret_cast<const char32_t*>(__from),
- reinterpret_cast<const char32_t*>(__from_end)
+ reinterpret_cast<const char32_t*>(__from_end),
};
auto res = ucs4_out(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
__from_next = reinterpret_cast<const wchar_t*>(from.next);
- __to_next = to.next;
+ __to_next = reinterpret_cast<char*>(to.next);
return res;
}
@@ -1180,30 +1338,32 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
intern_type* __to, intern_type* __to_end,
intern_type*& __to_next) const
{
- range<const char> from{ __from, __from_end };
+ range<const char16_t, false> from{ __from, __from_end };
#if __SIZEOF_WCHAR_T__ == 2
range<char16_t> to{
reinterpret_cast<char16_t*>(__to),
- reinterpret_cast<char16_t*>(__to_end)
+ reinterpret_cast<char16_t*>(__to_end),
};
auto res = ucs2_in(from, to, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
range<char32_t> to{
reinterpret_cast<char32_t*>(__to),
- reinterpret_cast<char32_t*>(__to_end)
+ reinterpret_cast<char32_t*>(__to_end),
};
auto res = ucs4_in(from, to, _M_maxcode, _M_mode);
#else
return codecvt_base::error;
#endif
- __from_next = from.next;
+ __from_next = reinterpret_cast<const char*>(from.next);
__to_next = reinterpret_cast<wchar_t*>(to.next);
+ if (res == codecvt_base::ok && __from_next != __from_end)
+ res = codecvt_base::error;
return res;
}
int
__codecvt_utf16_base<wchar_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-16 is not a fixed-width encoding
bool
__codecvt_utf16_base<wchar_t>::do_always_noconv() const throw()
@@ -1214,20 +1374,27 @@ __codecvt_utf16_base<wchar_t>::
do_length(state_type&, const extern_type* __from,
const extern_type* __end, size_t __max) const
{
- auto next = reinterpret_cast<const char16_t*>(__from);
+ range<const char16_t, false> from{ __from, __end };
#if __SIZEOF_WCHAR_T__ == 2
- next = ucs2_span(next, reinterpret_cast<const char16_t*>(__end), __max,
- _M_maxcode, _M_mode);
+ const char16_t* next = ucs2_span(from, __max, _M_maxcode, _M_mode);
#elif __SIZEOF_WCHAR_T__ == 4
- next = ucs4_span(next, reinterpret_cast<const char16_t*>(__end), __max,
- _M_maxcode, _M_mode);
+ const char16_t* next = ucs4_span(from, __max, _M_maxcode, _M_mode);
#endif
return reinterpret_cast<const char*>(next) - __from;
}
int
__codecvt_utf16_base<wchar_t>::do_max_length() const throw()
-{ return 4; }
+{
+#if __SIZEOF_WCHAR_T__ == 2
+ int max = 2; // See __codecvt_utf16_base<char16_t>::do_max_length()
+#else
+ int max = 4; // See __codecvt_utf16_base<char32_t>::do_max_length()
+#endif
+ if (_M_mode & consume_header)
+ max += sizeof(utf16_bom);
+ return max;
+}
#endif
// Define members of codecvt_utf8_utf16<char16_t> base class implementation.
@@ -1280,7 +1447,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_utf16_base<char16_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_utf16_base<char16_t>::do_always_noconv() const throw()
@@ -1298,9 +1465,12 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_utf16_base<char16_t>::do_max_length() const throw()
{
- // Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
- // whereas 4 byte sequences require two 16-bit code units.
- return 3;
+ // A single character can be 1 or 2 UTF-16 code units,
+ // requiring up to 4 UTF-8 code units.
+ int max = 4;
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
}
// Define members of codecvt_utf8_utf16<char32_t> base class implementation.
@@ -1341,7 +1511,11 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
{
range<const char> from{ __from, __from_end };
range<char32_t> to{ __to, __to_end };
- auto res = utf16_in(from, to, _M_maxcode, _M_mode);
+ codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
+#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
+ mode = codecvt_mode(mode | little_endian);
+#endif
+ auto res = utf16_in(from, to, _M_maxcode, mode);
__from_next = from.next;
__to_next = to.next;
return res;
@@ -1349,7 +1523,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_utf16_base<char32_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_utf16_base<char32_t>::do_always_noconv() const throw()
@@ -1367,9 +1541,12 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_utf16_base<char32_t>::do_max_length() const throw()
{
- // Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
- // whereas 4 byte sequences require two 16-bit code units.
- return 3;
+ // A single character can be 1 or 2 UTF-16 code units,
+ // requiring up to 4 UTF-8 code units.
+ int max = 4;
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
}
#ifdef _GLIBCXX_USE_WCHAR_T
@@ -1411,7 +1588,11 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
{
range<const char> from{ __from, __from_end };
range<wchar_t> to{ __to, __to_end };
- auto res = utf16_in(from, to, _M_maxcode, _M_mode);
+ codecvt_mode mode = codecvt_mode(_M_mode & (consume_header|generate_header));
+#if __BYTE_ORDER__ != __ORDER_BIG_ENDIAN__
+ mode = codecvt_mode(mode | little_endian);
+#endif
+ auto res = utf16_in(from, to, _M_maxcode, mode);
__from_next = from.next;
__to_next = to.next;
return res;
@@ -1419,7 +1600,7 @@ do_in(state_type&, const extern_type* __from, const extern_type* __from_end,
int
__codecvt_utf8_utf16_base<wchar_t>::do_encoding() const throw()
-{ return 0; }
+{ return 0; } // UTF-8 is not a fixed-width encoding
bool
__codecvt_utf8_utf16_base<wchar_t>::do_always_noconv() const throw()
@@ -1437,9 +1618,12 @@ do_length(state_type&, const extern_type* __from,
int
__codecvt_utf8_utf16_base<wchar_t>::do_max_length() const throw()
{
- // Any valid UTF-8 sequence of 3 bytes fits in a single 16-bit code unit,
- // whereas 4 byte sequences require two 16-bit code units.
- return 3;
+ // A single character can be 1 or 2 UTF-16 code units,
+ // requiring up to 4 UTF-8 code units.
+ int max = 4;
+ if (_M_mode & consume_header)
+ max += sizeof(utf8_bom);
+ return max;
}
#endif
diff --git a/libstdc++-v3/src/c++11/cxx11-shim_facets.cc b/libstdc++-v3/src/c++11/cxx11-shim_facets.cc
index 4e30088bac3..f703688e9dc 100644
--- a/libstdc++-v3/src/c++11/cxx11-shim_facets.cc
+++ b/libstdc++-v3/src/c++11/cxx11-shim_facets.cc
@@ -226,8 +226,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace // unnamed
{
+ struct __shim_accessor : facet
+ {
+ using facet::__shim; // Redeclare protected member as public.
+ };
+ using __shim = __shim_accessor::__shim;
+
template<typename _CharT>
- struct numpunct_shim : std::numpunct<_CharT>, facet::__shim
+ struct numpunct_shim : std::numpunct<_CharT>, __shim
{
typedef typename numpunct<_CharT>::__cache_type __cache_type;
@@ -251,7 +257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT>
- struct collate_shim : std::collate<_CharT>, facet::__shim
+ struct collate_shim : std::collate<_CharT>, __shim
{
typedef basic_string<_CharT> string_type;
@@ -276,7 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT>
- struct time_get_shim : std::time_get<_CharT>, facet::__shim
+ struct time_get_shim : std::time_get<_CharT>, __shim
{
typedef typename std::time_get<_CharT>::iter_type iter_type;
typedef typename std::time_get<_CharT>::char_type char_type;
@@ -330,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT, bool _Intl>
- struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, facet::__shim
+ struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, __shim
{
typedef typename moneypunct<_CharT, _Intl>::__cache_type __cache_type;
@@ -357,7 +363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT>
- struct money_get_shim : std::money_get<_CharT>, facet::__shim
+ struct money_get_shim : std::money_get<_CharT>, __shim
{
typedef typename std::money_get<_CharT>::iter_type iter_type;
typedef typename std::money_get<_CharT>::char_type char_type;
@@ -398,7 +404,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT>
- struct money_put_shim : std::money_put<_CharT>, facet::__shim
+ struct money_put_shim : std::money_put<_CharT>, __shim
{
typedef typename std::money_put<_CharT>::iter_type iter_type;
typedef typename std::money_put<_CharT>::char_type char_type;
@@ -427,7 +433,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
template<typename _CharT>
- struct messages_shim : std::messages<_CharT>, facet::__shim
+ struct messages_shim : std::messages<_CharT>, __shim
{
typedef messages_base::catalog catalog;
typedef basic_string<_CharT> string_type;
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
new file mode 100644
index 00000000000..c5258615663
--- /dev/null
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -0,0 +1,110 @@
+// Copyright (C) 2017 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 }
+
+// Define macros for some common variables names that we must not use for
+// naming variables, parameters etc. in the library.
+#define tmp (
+#define A (
+#define B (
+#define C (
+#define D (
+#define E (
+#define F (
+#define G (
+#define H (
+#define I (
+#define J (
+#define K (
+#define L (
+#define M (
+#define N (
+#define O (
+#define P (
+#define Q (
+#define R (
+#define S (
+#define T (
+#define U (
+#define V (
+#define W (
+#define X (
+#define Y (
+#define Z (
+#if __cplusplus >= 201103L
+// <random> defines member functions called a() and b()
+#else
+#define a (
+#define b (
+#endif
+// <queue> and <stack> defined data members called c
+#define d (
+#define e (
+#define f (
+#define g (
+#if __cplusplus >= 201402L
+// <chrono> defines operator ""h in C++14
+// <complex> defines operator ""i in C++14
+#else
+#define h (
+#define i (
+#endif
+#define j (
+#if __cplusplus >= 201103L
+// <random> defines member functions called k()
+#else
+#define k (
+#endif
+#define l (
+#if __cplusplus >= 201103L
+// <random> defines member functions called m() and n()
+#else
+#define m (
+#define n (
+#endif
+#define o (
+#if __cplusplus >= 201103L
+// <random> defines member functions called p()
+#else
+#define p (
+#endif
+#define q (
+#define r (
+#if __cplusplus >= 201103L
+// <random> defines member functions called s() and t()
+// <chrono> and <string> define operator ""s in C++14
+#else
+#define s (
+#define t (
+#endif
+#define u (
+#define v (
+#define w (
+#define x (
+#define y (
+#define z (
+
+#ifdef _AIX
+// See https://gcc.gnu.org/ml/libstdc++/2017-03/msg00015.html
+#undef f
+#undef r
+#undef x
+#undef y
+#endif
+
+#include <bits/stdc++.h>
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/char16_t.cc b/libstdc++-v3/testsuite/22_locale/codecvt/char16_t.cc
index a21a8385629..a66a35a5964 100644
--- a/libstdc++-v3/testsuite/22_locale/codecvt/char16_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/char16_t.cc
@@ -34,7 +34,7 @@ test01()
const codecvt_c16* const cvt = &use_facet<codecvt_c16>(loc_c);
VERIFY(!cvt->always_noconv());
- VERIFY(cvt->max_length() == 3);
+ VERIFY(cvt->max_length() == 4);
VERIFY(cvt->encoding() == 0);
const char u8dat[] = u8"H\U000000E4ll\U000000F6 \U0001F63F \U000056FD "
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
new file mode 100644
index 00000000000..d8b9729ed5b
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc
@@ -0,0 +1,142 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <locale>
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/79980
+
+constexpr std::codecvt_mode mode(std::codecvt_mode m)
+{ return static_cast<std::codecvt_mode>(m | std::consume_header); }
+
+template<typename WCh, unsigned long Max = 0x10FFFF,
+ std::codecvt_mode Mode = std::consume_header>
+ using Conv
+ = std::wstring_convert<std::codecvt_utf16<WCh, Max, mode(Mode)>, WCh>;
+
+void
+test01()
+{
+ const char src[] = "\xFE\xFF\xAB\xCD";
+ Conv<char16_t> conv;
+ auto dst = conv.from_bytes(src, src+4);
+ VERIFY( dst[0] == 0xabcd );
+}
+
+void
+test02()
+{
+ const char src[] = "\xFF\xFE\xAB\xCD";
+ Conv<char16_t> conv;
+ auto dst = conv.from_bytes(src, src+4);
+ VERIFY( dst[0] == 0xcdab );
+}
+
+void
+test03()
+{
+ const char src[] = "\xFE\xFF\xAB\xCD";
+ Conv<char16_t, 0x10FFFF, std::little_endian> conv;
+ auto dst = conv.from_bytes(src, src+4);
+ VERIFY( dst[0] == 0xabcd );
+}
+
+void
+test04()
+{
+ const char src[] = "\xFF\xFE\xAB\xCD";
+ Conv<char16_t, 0x10FFFF, std::little_endian> conv;
+ auto dst = conv.from_bytes(src, src+4);
+ VERIFY( dst[0] == 0xcdab );
+}
+
+void
+test05()
+{
+ const char src[] = "\0\x61\xAB\xCD"; // character greater than 0x00FF
+ Conv<char16_t, 0xFF> conv("to_bytes failed", u"from_bytes failed");
+ std::u16string result = conv.from_bytes(src, src+4);
+ VERIFY( result == u"from_bytes failed" );
+ VERIFY( conv.converted() == 2 );
+}
+
+void
+test06()
+{
+ const char src[] = "\0\x61\xAB\xCD";
+ Conv<char16_t> conv("to_bytes failed", u"from_bytes failed");
+ std::u16string result = conv.from_bytes(src, src+3); // incomplete character
+ VERIFY( result == u"from_bytes failed" );
+ VERIFY( conv.converted() == 2 );
+}
+
+void
+test07()
+{
+ Conv<char16_t> conv("to_bytes failed", u"from_bytes failed");
+ // ucs2 to utf-16 conversion should fail on invalid ucs2 input:
+ std::u16string utf16 = u"1234\U00001111\U0001ffff";
+ auto out = conv.to_bytes(utf16);
+ VERIFY( out == "to_bytes failed" );
+ VERIFY( conv.converted() == 5 );
+
+ // And should also fail on incomplete surrogate pair (not return partial):
+ out = conv.to_bytes(utf16.substr(0, utf16.size()-1));
+ VERIFY( out == "to_bytes failed" );
+ VERIFY( conv.converted() == 5 );
+}
+
+void
+test08()
+{
+ // Read/write UTF-16 code units from data not correctly aligned for char16_t
+ Conv<char16_t, 0x10FFFF, std::generate_header> conv;
+ const char src[] = "-\xFE\xFF\0\x61\xAB\xCD";
+ auto out = conv.from_bytes(src + 1, src + 7);
+ VERIFY( out[0] == 0x0061 );
+ VERIFY( out[1] == 0xabcd );
+ auto bytes = conv.to_bytes(out);
+ VERIFY( bytes == std::string(src + 1, 6) );
+}
+
+void
+test09()
+{
+ // Read/write UTF-16 code units from data not correctly aligned for char16_t
+ Conv<char32_t, 0x10FFFF, std::generate_header> conv;
+ const char src[] = "-\xFE\xFF\xD8\x08\xDF\x45";
+ auto out = conv.from_bytes(src + 1, src + 7);
+ VERIFY( out == U"\U00012345" );
+ auto bytes = conv.to_bytes(out);
+ VERIFY( bytes == std::string(src + 1, 6) );
+}
+
+int main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+ test05();
+ test06();
+ test07();
+ test08();
+ test09();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/80041.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/80041.cc
new file mode 100644
index 00000000000..a78b194212d
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/80041.cc
@@ -0,0 +1,87 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::codecvt_utf16<wchar_t> conv;
+ const wchar_t wc = 0x6557;
+ char bytes[2] = {0};
+ const wchar_t* wcnext;
+ std::mbstate_t st{};
+ char* next = nullptr;
+ auto res = conv.out(st, &wc, &wc+ 1, wcnext, bytes, std::end(bytes), next);
+ VERIFY( res == std::codecvt_base::ok );
+ VERIFY( wcnext == &wc + 1 );
+ VERIFY( next == std::end(bytes) );
+ VERIFY( bytes[0] == 0x65 );
+ VERIFY( bytes[1] == 0x57 );
+ VERIFY( conv.length(st, bytes, next, 1) == (next - bytes) );
+
+ wchar_t w;
+ wchar_t* wnext;
+ const char* cnext;
+ st = {};
+ res = conv.in(st, bytes, next, cnext, &w, &w + 1, wnext);
+ VERIFY( res == std::codecvt_base::ok );
+ VERIFY( wnext == &w + 1 );
+ VERIFY( cnext == next );
+ VERIFY( w == wc );
+#endif
+}
+
+void
+test02()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::codecvt_utf16<wchar_t, 0x10FFFF, std::little_endian> conv;
+ wchar_t wc = 0x6557;
+ char bytes[2] = {0};
+ const wchar_t* wcnext;
+ std::mbstate_t st{};
+ char* next = nullptr;
+ auto res = conv.out(st, &wc, &wc+ 1, wcnext, bytes, std::end(bytes), next);
+ VERIFY( res == std::codecvt_base::ok );
+ VERIFY( wcnext == &wc + 1 );
+ VERIFY( next == std::end(bytes) );
+ VERIFY( bytes[0] == 0x57 );
+ VERIFY( bytes[1] == 0x65 );
+ VERIFY( conv.length(st, bytes, next, 1) == (next - bytes) );
+
+ wchar_t w;
+ wchar_t* wnext;
+ const char* cnext;
+ st = {};
+ res = conv.in(st, bytes, next, cnext, &w, &w + 1, wnext);
+ VERIFY( res == std::codecvt_base::ok );
+ VERIFY( wnext == &w + 1 );
+ VERIFY( cnext == next );
+ VERIFY( w == wc );
+#endif
+}
+
+int main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/members.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/members.cc
new file mode 100644
index 00000000000..993c86082c1
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/members.cc
@@ -0,0 +1,81 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+const int bomlen = 2; // UTF-16 BOM is 16 bits
+
+void
+test01()
+{
+ const int maxlen = 2;
+
+ std::codecvt_utf16<char16_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf16<char16_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test02()
+{
+ const int maxlen = 4;
+
+ std::codecvt_utf16<char32_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf16<char32_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ const int maxlen = sizeof(wchar_t) == 4 ? 4 : 2;
+
+ std::codecvt_utf16<wchar_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
new file mode 100644
index 00000000000..0179c184c20
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc
@@ -0,0 +1,289 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <locale>
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+using std::codecvt_base;
+using std::codecvt_mode;
+using std::codecvt_utf16;
+using std::wstring_convert;
+using std::mbstate_t;
+
+constexpr codecvt_mode
+operator|(codecvt_mode m1, codecvt_mode m2)
+{
+ using underlying = std::underlying_type<codecvt_mode>::type;
+ return static_cast<codecvt_mode>(static_cast<underlying>(m1) | m2);
+}
+
+// Read/write UTF-16 code units from data not correctly aligned for char16_t
+
+void
+test01()
+{
+ mbstate_t st;
+ constexpr codecvt_mode m = std::consume_header|std::generate_header;
+ codecvt_utf16<char16_t, 0x10FFFF, m> conv;
+ const char src[] = "-\xFE\xFF\0\x61\xAB\xCD";
+ const char* const src_end = src + 7;
+
+ int len = conv.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+
+ char16_t dst[2];
+ char16_t* const dst_end = dst + 2;
+ char16_t* dst_next;
+ const char* src_cnext;
+ auto res = conv.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ char out[sizeof(src)] = { src[0] };
+ char* const out_end = out + 7;
+ char* out_next;
+ const char16_t* dst_cnext;
+ res = conv.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[1] );
+ VERIFY( out[2] == src[2] );
+ VERIFY( out[3] == src[3] );
+ VERIFY( out[4] == src[4] );
+ VERIFY( out[5] == src[5] );
+ VERIFY( out[6] == src[6] );
+
+ codecvt_utf16<char16_t, 0x10FFFF, m|std::little_endian> conv_le;
+
+ len = conv_le.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv_le.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+
+ res = conv_le.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ res = conv_le.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[2] );
+ VERIFY( out[2] == src[1] );
+ VERIFY( out[3] == src[4] );
+ VERIFY( out[4] == src[3] );
+ VERIFY( out[5] == src[6] );
+ VERIFY( out[6] == src[5] );
+}
+
+void
+test02()
+{
+ mbstate_t st;
+ constexpr codecvt_mode m = std::consume_header|std::generate_header;
+ codecvt_utf16<char32_t, 0x10FFFF, m> conv;
+ const char src[] = "-\xFE\xFF\0\x61\xAB\xCD\xD8\x08\xDF\x45";
+ const char* const src_end = src + 11;
+
+ int len = conv.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+ len = conv.length(st, src + 1, src_end, -1ul);
+ VERIFY( len == 10 );
+
+ char32_t dst[3];
+ char32_t* const dst_end = dst + 3;
+ char32_t* dst_next;
+ const char* src_cnext;
+ auto res = conv.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ VERIFY( dst[2] == 0x012345 );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ char out[sizeof(src)] = { src[0] };
+ char* const out_end = out + 11;
+ char* out_next;
+ const char32_t* dst_cnext;
+ res = conv.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[1] );
+ VERIFY( out[2] == src[2] );
+ VERIFY( out[3] == src[3] );
+ VERIFY( out[4] == src[4] );
+ VERIFY( out[5] == src[5] );
+ VERIFY( out[6] == src[6] );
+ VERIFY( out[7] == src[7] );
+ VERIFY( out[8] == src[8] );
+ VERIFY( out[9] == src[9] );
+ VERIFY( out[10] == src[10] );
+
+ codecvt_utf16<char32_t, 0x10FFFF, m|std::little_endian> conv_le;
+
+ len = conv_le.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv_le.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+ len = conv.length(st, src + 1, src_end, -1ul);
+ VERIFY( len == 10 );
+
+ res = conv_le.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ VERIFY( dst[2] == 0x012345 );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ res = conv_le.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[2] );
+ VERIFY( out[2] == src[1] );
+ VERIFY( out[3] == src[4] );
+ VERIFY( out[4] == src[3] );
+ VERIFY( out[5] == src[6] );
+ VERIFY( out[6] == src[5] );
+ VERIFY( out[7] == src[8] );
+ VERIFY( out[8] == src[7] );
+ VERIFY( out[9] == src[10] );
+ VERIFY( out[10] == src[9] );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ mbstate_t st;
+ constexpr codecvt_mode m = std::consume_header|std::generate_header;
+ codecvt_utf16<wchar_t, 0x10FFFF, m> conv;
+ const char src[] = "-\xFE\xFF\0\x61\xAB\xCD\xD8\x08\xDF\x45";
+ const size_t in_len = sizeof(wchar_t) == 4 ? 11 : 7;
+ const size_t out_len = sizeof(wchar_t) == 4 ? 3 : 2;
+ const char* const src_end = src + in_len;
+
+ int len = conv.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+ if (sizeof(wchar_t) == 4)
+ {
+ len = conv.length(st, src + 1, src_end, -1ul);
+ VERIFY( len == 10 );
+ }
+
+ wchar_t dst[out_len];
+ wchar_t* const dst_end = dst + out_len;
+ wchar_t* dst_next;
+ const char* src_cnext;
+ auto res = conv.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ if (sizeof(wchar_t) == 4)
+ VERIFY( dst[2] == 0x012345 );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ char out[sizeof(src)] = { src[0] };
+ char* const out_end = out + in_len;
+ char* out_next;
+ const wchar_t* dst_cnext;
+ res = conv.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[1] );
+ VERIFY( out[2] == src[2] );
+ VERIFY( out[3] == src[3] );
+ VERIFY( out[4] == src[4] );
+ VERIFY( out[5] == src[5] );
+ VERIFY( out[6] == src[6] );
+ if (sizeof(wchar_t) == 4)
+ {
+ VERIFY( out[7] == src[7] );
+ VERIFY( out[8] == src[8] );
+ VERIFY( out[9] == src[9] );
+ VERIFY( out[10] == src[10] );
+ }
+
+ codecvt_utf16<wchar_t, 0x10FFFF, m|std::little_endian> conv_le;
+
+ len = conv_le.length(st, src + 1, src_end, 1);
+ VERIFY( len == 4 );
+ len = conv_le.length(st, src + 1, src_end, 2);
+ VERIFY( len == 6 );
+ if (sizeof(wchar_t) == 4)
+ {
+ len = conv.length(st, src + 1, src_end, -1ul);
+ VERIFY( len == 10 );
+ }
+
+ res = conv_le.in(st, src + 1, src_end, src_cnext, dst, dst_end, dst_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( dst[0] == 0x0061 );
+ VERIFY( dst[1] == 0xabcd );
+ if (sizeof(wchar_t) == 4)
+ VERIFY( dst[2] == 0x012345 );
+ VERIFY( src_cnext == src_end );
+ VERIFY( dst_next == dst_end );
+
+ res = conv_le.out(st, dst, dst_end, dst_cnext, out + 1, out_end, out_next);
+ VERIFY( res == codecvt_base::ok );
+ VERIFY( out_next == out_end );
+ VERIFY( dst_cnext == dst_end );
+ VERIFY( out[1] == src[2] );
+ VERIFY( out[2] == src[1] );
+ VERIFY( out[3] == src[4] );
+ VERIFY( out[4] == src[3] );
+ VERIFY( out[5] == src[6] );
+ VERIFY( out[6] == src[5] );
+ if (sizeof(wchar_t) == 4)
+ {
+ VERIFY( out[7] == src[8] );
+ VERIFY( out[8] == src[7] );
+ VERIFY( out[9] == src[10] );
+ VERIFY( out[10] == src[9] );
+ }
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
new file mode 100644
index 00000000000..1251acb85be
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc
@@ -0,0 +1,94 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <codecvt>
+#include <locale>
+#include <string>
+#include <testsuite_hooks.h>
+
+using std::wstring_convert;
+using std::codecvt_utf8;
+
+void
+test01()
+{
+ std::string src = u8"1234\U00001111\U0001ffff";
+ wstring_convert<codecvt_utf8<char16_t>, char16_t> c("bad", u"BAD");
+
+ // utf-8 to ucs2 conversion should fail on character outside BMP
+ auto ucs2 = c.from_bytes(src);
+ VERIFY( ucs2 == u"BAD" );
+ VERIFY( c.converted() == 7 );
+
+ // ucs2 to utf-8 conversion should fail on invalid ucs2 input:
+ std::u16string utf16 = u"1234\U00001111\U0001ffff";
+ auto out = c.to_bytes(utf16);
+ VERIFY( out == "bad" );
+ VERIFY( c.converted() == 5 );
+
+ // And should also fail on incomplete surrogate pair (not return partial):
+ out = c.to_bytes(utf16.substr(0, utf16.size()-1));
+ VERIFY( out == "bad" );
+ VERIFY( c.converted() == 5 );
+}
+
+void
+test02()
+{
+ std::string src = u8"1234\U00001111\U0001ffff";
+ wstring_convert<codecvt_utf8<char16_t, 0x1000>, char16_t> c("bad", u"BAD");
+
+ // utf-8 to ucs2 conversion should fail on character above Maxcode=0x1000
+ auto ucs2 = c.from_bytes(src);
+ VERIFY( ucs2 == u"BAD" );
+ VERIFY( c.converted() == 4 );
+}
+
+void
+test03()
+{
+ std::string src = u8"1234\U00001111\U0001ffff";
+ wstring_convert<codecvt_utf8<char32_t, 0x10000>, char32_t> c("bad", U"BAD");
+
+ // utf-8 to ucs4 conversion should fail on character above Maxcode=0x10000
+ auto ucs4 = c.from_bytes(src);
+ VERIFY( ucs4 == U"BAD" );
+ VERIFY( c.converted() == 7 );
+}
+
+void
+test04()
+{
+ std::string src = u8"1234\U00001111\U0001ffff";
+ wstring_convert<codecvt_utf8<char32_t, 0x1000>, char32_t> c("bad", U"BAD");
+
+ // utf-8 to ucs4 conversion should fail on character above Maxcode=0x1000
+ auto ucs4 = c.from_bytes(src);
+ VERIFY( ucs4 == U"BAD" );
+ VERIFY( c.converted() == 4 );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+ test04();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/members.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/members.cc
new file mode 100644
index 00000000000..baeb049861a
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/members.cc
@@ -0,0 +1,81 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+const int bomlen = 3; // UTF-8 BOM is 24 bits
+
+void
+test01()
+{
+ const int maxlen = 3;
+
+ std::codecvt_utf8<char16_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8<char16_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test02()
+{
+ const int maxlen = 4;
+
+ std::codecvt_utf8<char32_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8<char32_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ const int maxlen = sizeof(wchar_t) == 4 ? 4 : 3;
+
+ std::codecvt_utf8<wchar_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8<wchar_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
new file mode 100644
index 00000000000..5555bcba6fe
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc
@@ -0,0 +1,60 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <locale>
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+// PR libstdc++/79511
+
+template<typename ElemT>
+ std::basic_string<ElemT> conv(const char* src)
+ {
+ std::wstring_convert<std::codecvt_utf8_utf16<ElemT>, ElemT> conv;
+ return conv.from_bytes(src);
+ }
+
+void
+test01()
+{
+ static char const src[] = "\xEF\xBF\xBF";
+ VERIFY( conv<char16_t>(src) == u"\xffff" );
+ VERIFY( conv<char32_t>(src) == U"\xffff" );
+#ifdef _GLIBCXX_USE_WCHAR_T
+ VERIFY( conv<wchar_t>(src) == L"\xffff" );
+#endif
+}
+
+void
+test02()
+{
+ static char const src[] = "\xE2\x82\xAC";
+ VERIFY( conv<char16_t>(src) == u"\x20ac" );
+ VERIFY( conv<char32_t>(src) == U"\x20ac" );
+#ifdef _GLIBCXX_USE_WCHAR_T
+ VERIFY( conv<wchar_t>(src) == L"\x20ac" );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc
new file mode 100644
index 00000000000..8fcdfff2cc1
--- /dev/null
+++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2017 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 run { target c++11 } }
+
+#include <codecvt>
+#include <testsuite_hooks.h>
+
+const int bomlen = 3; // UTF-8 BOM is 24 bits
+const int maxlen = 4;
+
+void
+test01()
+{
+ std::codecvt_utf8_utf16<char16_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8_utf16<char16_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test02()
+{
+ std::codecvt_utf8_utf16<char32_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8_utf16<char32_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+}
+
+void
+test03()
+{
+#ifdef _GLIBCXX_USE_WCHAR_T
+ std::codecvt_utf8_utf16<wchar_t> c;
+ VERIFY( c.always_noconv() == false );
+ VERIFY( c.encoding() == 0 );
+ VERIFY( c.max_length() == maxlen );
+
+ std::codecvt_utf8_utf16<wchar_t, 0x10ffff, std::consume_header> c_bom;
+ VERIFY( c_bom.always_noconv() == false );
+ VERIFY( c_bom.encoding() == 0 );
+ VERIFY( c_bom.max_length() == (maxlen + bomlen) );
+#endif
+}
+
+int
+main()
+{
+ test01();
+ test02();
+ test03();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/80034.cc b/libstdc++-v3/testsuite/23_containers/list/operations/80034.cc
new file mode 100644
index 00000000000..5c3decd9dff
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/80034.cc
@@ -0,0 +1,32 @@
+// { dg-do compile }
+// Copyright (C) 2017 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 <list>
+
+namespace X {
+ struct Y { };
+ bool operator<(Y, Y) { return false; }
+ template<typename T>
+ void distance(T, T) { }
+}
+
+int main()
+{
+ std::list<X::Y> l;
+ l.sort();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/map/operations/2.cc b/libstdc++-v3/testsuite/23_containers/map/operations/2.cc
index ef301ef136c..0613aa2105a 100644
--- a/libstdc++-v3/testsuite/23_containers/map/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/map/operations/2.cc
@@ -53,7 +53,7 @@ test01()
cit = cx.find(2L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
@@ -76,7 +76,7 @@ test02()
cn = cx.count(2L);
VERIFY( cn == 0 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
}
void
@@ -94,7 +94,12 @@ test03()
cit = cx.lower_bound(2L);
VERIFY( cit != cx.end() && cit->second == '4' );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "lower_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const lower_bound returns const_iterator");
}
void
@@ -112,7 +117,12 @@ test04()
cit = cx.upper_bound(3L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "upper_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const upper_bound returns const_iterator");
}
void
@@ -130,9 +140,37 @@ test05()
cit = cx.equal_range(2L);
VERIFY( cit.first == cit.second && cit.first != cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ using pair = std::pair<test_type::iterator, test_type::iterator>;
+ static_assert(std::is_same<decltype(it), pair>::value,
+ "equal_range returns pair<iterator, iterator>");
+ using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+ static_assert(std::is_same<decltype(cit), cpair>::value,
+ "const equal_range returns pair<const_iterator, const_iterator>");
}
+void
+test06()
+{
+ // PR libstdc++/78273
+
+ struct C {
+ bool operator()(int l, int r) const { return l < r; }
+
+ struct Partition { };
+
+ bool operator()(int l, Partition) const { return l < 2; }
+ bool operator()(Partition, int r) const { return 4 < r; }
+
+ using is_transparent = void;
+ };
+
+ std::map<int, int, C> m{ {1,0}, {2,0}, {3,0}, {4, 0}, {5, 0} };
+
+ auto n = m.count(C::Partition{});
+ VERIFY( n == 3 );
+}
int
main()
@@ -142,4 +180,5 @@ main()
test03();
test04();
test05();
+ test06();
}
diff --git a/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc b/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
index eef6ee4515d..99099c39e2c 100644
--- a/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/multimap/operations/2.cc
@@ -53,7 +53,7 @@ test01()
cit = cx.find(2L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
@@ -76,7 +76,7 @@ test02()
cn = cx.count(2L);
VERIFY( cn == 0 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
}
void
@@ -94,7 +94,12 @@ test03()
cit = cx.lower_bound(2L);
VERIFY( cit != cx.end() && cit->second == '4' );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "lower_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const lower_bound returns const_iterator");
}
void
@@ -112,7 +117,12 @@ test04()
cit = cx.upper_bound(3L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "upper_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const upper_bound returns const_iterator");
}
void
@@ -131,7 +141,14 @@ test05()
cit = cx.equal_range(2L);
VERIFY( cit.first == cit.second && cit.first != cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ using pair = std::pair<test_type::iterator, test_type::iterator>;
+ static_assert(std::is_same<decltype(it), pair>::value,
+ "equal_range returns pair<iterator, iterator>");
+ using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+ static_assert(std::is_same<decltype(cit), cpair>::value,
+ "const equal_range returns pair<const_iterator, const_iterator>");
}
diff --git a/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
index 4bea719160f..3123169d035 100644
--- a/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/multiset/operations/2.cc
@@ -53,7 +53,7 @@ test01()
cit = cx.find(2L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
@@ -76,7 +76,7 @@ test02()
cn = cx.count(2L);
VERIFY( cn == 0 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
}
void
@@ -94,7 +94,12 @@ test03()
cit = cx.lower_bound(2L);
VERIFY( cit != cx.end() && *cit == 3 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "lower_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const lower_bound returns const_iterator");
}
void
@@ -112,7 +117,12 @@ test04()
cit = cx.upper_bound(5L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "upper_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const upper_bound returns const_iterator");
}
void
@@ -131,7 +141,14 @@ test05()
cit = cx.equal_range(2L);
VERIFY( cit.first == cit.second && cit.first != cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ using pair = std::pair<test_type::iterator, test_type::iterator>;
+ static_assert(std::is_same<decltype(it), pair>::value,
+ "equal_range returns pair<iterator, iterator>");
+ using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+ static_assert(std::is_same<decltype(cit), cpair>::value,
+ "const equal_range returns pair<const_iterator, const_iterator>");
}
diff --git a/libstdc++-v3/testsuite/23_containers/set/operations/2.cc b/libstdc++-v3/testsuite/23_containers/set/operations/2.cc
index 6a68453ec7b..507aa955b29 100644
--- a/libstdc++-v3/testsuite/23_containers/set/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/set/operations/2.cc
@@ -53,7 +53,7 @@ test01()
cit = cx.find(2L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
static_assert(std::is_same<decltype(it), test_type::iterator>::value,
"find returns iterator");
@@ -76,7 +76,7 @@ test02()
cn = cx.count(2L);
VERIFY( cn == 0 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
}
void
@@ -94,7 +94,12 @@ test03()
cit = cx.lower_bound(2L);
VERIFY( cit != cx.end() && *cit == 3 );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "lower_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const lower_bound returns const_iterator");
}
void
@@ -112,7 +117,12 @@ test04()
cit = cx.upper_bound(5L);
VERIFY( cit == cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ static_assert(std::is_same<decltype(it), test_type::iterator>::value,
+ "upper_bound returns iterator");
+ static_assert(std::is_same<decltype(cit), test_type::const_iterator>::value,
+ "const upper_bound returns const_iterator");
}
void
@@ -130,7 +140,14 @@ test05()
cit = cx.equal_range(2L);
VERIFY( cit.first == cit.second && cit.first != cx.end() );
- VERIFY( Cmp::count == 0);
+ VERIFY( Cmp::count == 0 );
+
+ using pair = std::pair<test_type::iterator, test_type::iterator>;
+ static_assert(std::is_same<decltype(it), pair>::value,
+ "equal_range returns pair<iterator, iterator>");
+ using cpair = std::pair<test_type::const_iterator, test_type::const_iterator>;
+ static_assert(std::is_same<decltype(cit), cpair>::value,
+ "const equal_range returns pair<const_iterator, const_iterator>");
}
void
@@ -150,6 +167,28 @@ test06()
s.find(i);
}
+void
+test07()
+{
+ // PR libstdc++/78273
+
+ struct C {
+ bool operator()(int l, int r) const { return l < r; }
+
+ struct Partition { };
+
+ bool operator()(int l, Partition) const { return l < 2; }
+ bool operator()(Partition, int r) const { return 4 < r; }
+
+ using is_transparent = void;
+ };
+
+ std::set<int, C> s{ 1, 2, 3, 4, 5 };
+
+ auto n = s.count(C::Partition{});
+ VERIFY( n == 3 );
+}
+
int
main()
{
@@ -159,4 +198,5 @@ main()
test04();
test05();
test06();
+ test07();
}
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/69301.cc b/libstdc++-v3/testsuite/29_atomics/atomic/69301.cc
new file mode 100644
index 00000000000..fb31a19af71
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/69301.cc
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 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" }
+// { dg-require-atomic-builtins "" }
+
+#include <atomic>
+#include <testsuite_hooks.h>
+
+struct NonDefaultConstructible
+{
+ NonDefaultConstructible(int i) : val(i) { }
+ int val;
+};
+
+template class std::atomic<NonDefaultConstructible>;
+
+void
+test01()
+{
+ std::atomic<NonDefaultConstructible> a(1);
+ const auto n1 = a.exchange(2);
+ VERIFY( n1.val == 1 );
+ const auto n2 = a.load();
+ VERIFY( n2.val == 2 );
+}
+
+void
+test02()
+{
+ volatile std::atomic<NonDefaultConstructible> a(1);
+ const auto n1 = a.exchange(2);
+ VERIFY( n1.val == 1 );
+ const auto n2 = a.load();
+ VERIFY( n2.val == 2 );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}
diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc
index f5d1d7723b1..ce4424ee0c3 100644
--- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc
+++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast.cc
@@ -77,8 +77,21 @@ void test02()
}
}
+void test04()
+{
+ // PR libstdc++/69321
+ struct noncopyable {
+ noncopyable(noncopyable const&) = delete;
+ };
+
+ any a;
+ auto p = any_cast<noncopyable>(&a);
+ VERIFY( p == nullptr );
+}
+
int main()
{
test01();
test02();
+ test04();
}
diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
index 28388f68b0f..7bc818a36b5 100644
--- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
+++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc
@@ -26,5 +26,5 @@ void test01()
using std::experimental::any_cast;
const any y(1);
- any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 311 }
+ any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 304 }
}