aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2008-06-15 17:51:51 +0000
committerH.J. Lu <hongjiu.lu@intel.com>2008-06-15 17:51:51 +0000
commite284175799eb4a9587af2777f70d247a148da54d (patch)
tree041e2fbbc53524681c9f8385a15f46f889d5b3bd
parent77d97e6bc6b206f27dd06c79b7295d699b52a723 (diff)
Merged with trunk at revision 136811.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ix86/avx@136815 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog6
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--gcc/ChangeLog305
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/ada/ChangeLog29
-rw-r--r--gcc/ada/decl.c134
-rw-r--r--gcc/ada/gnat_rm.texi21
-rw-r--r--gcc/ada/gnat_ugn.texi150
-rw-r--r--gcc/ada/utils.c10
-rw-r--r--gcc/alias.c20
-rw-r--r--gcc/builtins.c24
-rw-r--r--gcc/c-common.c3
-rw-r--r--gcc/c-decl.c10
-rw-r--r--gcc/c.opt2
-rw-r--r--gcc/config.gcc92
-rw-r--r--gcc/config/arm/bpabi-v6m.S12
-rw-r--r--gcc/config/arm/bpabi.S12
-rw-r--r--gcc/config/arm/lib1funcs.asm126
-rw-r--r--gcc/config/arm/t-arm-coff2
-rw-r--r--gcc/config/arm/t-arm-elf3
-rw-r--r--gcc/config/arm/t-linux2
-rw-r--r--gcc/config/arm/t-pe4
-rw-r--r--gcc/config/arm/t-strongarm-elf2
-rw-r--r--gcc/config/arm/t-symbian2
-rw-r--r--gcc/config/arm/t-vxworks2
-rw-r--r--gcc/config/arm/t-wince-pe2
-rw-r--r--gcc/config/i386/i386.c12
-rw-r--r--gcc/config/i386/i386.h16
-rw-r--r--gcc/config/m68k/m68k.c28
-rw-r--r--gcc/config/m68k/m68k.h4
-rw-r--r--gcc/config/mips/loongson.h693
-rw-r--r--gcc/config/mips/loongson.md475
-rw-r--r--gcc/config/mips/loongson2ef.md240
-rw-r--r--gcc/config/mips/mips-ftypes.def33
-rw-r--r--gcc/config/mips/mips-modes.def1
-rw-r--r--gcc/config/mips/mips-protos.h2
-rw-r--r--gcc/config/mips/mips.c1074
-rw-r--r--gcc/config/mips/mips.h24
-rw-r--r--gcc/config/mips/mips.md59
-rw-r--r--gcc/config/rs6000/eabispe.h2
-rw-r--r--gcc/config/rs6000/linuxspe.h2
-rw-r--r--gcc/config/rs6000/rs6000.c2
-rwxr-xr-xgcc/configure36
-rw-r--r--gcc/configure.ac8
-rw-r--r--gcc/cp/ChangeLog21
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl2.c9
-rw-r--r--gcc/cp/parser.c14
-rw-r--r--gcc/doc/cpp.texi2
-rw-r--r--gcc/doc/cppopts.texi2
-rw-r--r--gcc/doc/extend.texi177
-rw-r--r--gcc/doc/gcc.texi4
-rw-r--r--gcc/doc/gccint.texi2
-rw-r--r--gcc/doc/gcov.texi4
-rw-r--r--gcc/doc/gty.texi8
-rw-r--r--gcc/doc/hostconfig.texi4
-rw-r--r--gcc/doc/install.texi13
-rw-r--r--gcc/doc/invoke.texi12
-rw-r--r--gcc/doc/loop.texi20
-rw-r--r--gcc/doc/makefile.texi6
-rw-r--r--gcc/doc/md.texi86
-rw-r--r--gcc/doc/options.texi12
-rw-r--r--gcc/doc/passes.texi2
-rw-r--r--gcc/doc/sourcebuild.texi4
-rw-r--r--gcc/doc/tm.texi26
-rw-r--r--gcc/doc/tree-ssa.texi172
-rw-r--r--gcc/doc/trouble.texi16
-rw-r--r--gcc/expr.c54
-rw-r--r--gcc/fortran/ChangeLog27
-rw-r--r--gcc/fortran/decl.c21
-rw-r--r--gcc/fortran/gfc-internals.texi2
-rw-r--r--gcc/fortran/gfortran.texi12
-rw-r--r--gcc/fortran/intrinsic.texi260
-rw-r--r--gcc/fortran/invoke.texi4
-rw-r--r--gcc/fortran/trans-intrinsic.c12
-rw-r--r--gcc/fortran/trans-io.c31
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/class.c8
-rw-r--r--gcc/java/gcj.texi34
-rw-r--r--gcc/longlong.h6
-rw-r--r--gcc/omp-low.c37
-rw-r--r--gcc/testsuite/ChangeLog87
-rw-r--r--gcc/testsuite/g++.dg/compat/struct-layout-1.exp12
-rw-r--r--gcc/testsuite/g++.dg/other/dtor2.C7
-rw-r--r--gcc/testsuite/g++.dg/parse/bitfield3.C9
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20080613-1.c40
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20020619-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-layout-1.exp12
-rw-r--r--gcc/testsuite/gcc.dg/inline-28.c28
-rw-r--r--gcc/testsuite/gcc.dg/inline-29.c28
-rw-r--r--gcc/testsuite/gcc.dg/inline-30.c28
-rw-r--r--gcc/testsuite/gcc.target/mips/loongson-simd.c1963
-rw-r--r--gcc/testsuite/gcc.target/powerpc/e500-1.c14
-rw-r--r--gcc/testsuite/gfortran.dg/index_2.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/namelist_48.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/parameter_array_init_4.f9055
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_1.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_2.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_3.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_4.f9018
-rw-r--r--gcc/testsuite/gnat.dg/discr9.adb10
-rw-r--r--gcc/testsuite/gnat.dg/discr9.ads22
-rw-r--r--gcc/testsuite/gnat.dg/task_stack_align.adb31
-rw-r--r--gcc/testsuite/gnat.dg/varsize_copy.adb24
-rw-r--r--gcc/testsuite/gnat.dg/varsize_copy.ads30
-rw-r--r--gcc/testsuite/lib/target-supports.exp11
-rw-r--r--gcc/tree-flow.h13
-rw-r--r--gcc/tree-inline.c1
-rw-r--r--gcc/tree-ssa-alias-warnings.c10
-rw-r--r--gcc/tree-ssa-alias.c14
-rw-r--r--gcc/tree-ssa-structalias.c40
-rw-r--r--gcc/tree-ssa.c2
-rw-r--r--libcpp/ChangeLog6
-rw-r--r--libcpp/charset.c1
-rw-r--r--libgfortran/ChangeLog74
-rwxr-xr-xlibgfortran/configure2
-rw-r--r--libgfortran/configure.ac2
-rw-r--r--libgfortran/generated/all_l1.c2
-rw-r--r--libgfortran/generated/all_l16.c2
-rw-r--r--libgfortran/generated/all_l2.c2
-rw-r--r--libgfortran/generated/all_l4.c2
-rw-r--r--libgfortran/generated/all_l8.c2
-rw-r--r--libgfortran/generated/any_l1.c2
-rw-r--r--libgfortran/generated/any_l16.c2
-rw-r--r--libgfortran/generated/any_l2.c2
-rw-r--r--libgfortran/generated/any_l4.c2
-rw-r--r--libgfortran/generated/any_l8.c2
-rw-r--r--libgfortran/generated/count_16_l.c2
-rw-r--r--libgfortran/generated/count_1_l.c2
-rw-r--r--libgfortran/generated/count_2_l.c2
-rw-r--r--libgfortran/generated/count_4_l.c2
-rw-r--r--libgfortran/generated/count_8_l.c2
-rw-r--r--libgfortran/gfortran.map1
-rw-r--r--libgfortran/intrinsics/dprod_r8.f901
-rw-r--r--libgfortran/io/fbuf.c2
-rw-r--r--libgfortran/io/inquire.c9
-rw-r--r--libgfortran/io/io.h6
-rw-r--r--libgfortran/io/list_read.c33
-rw-r--r--libgfortran/io/open.c8
-rw-r--r--libgfortran/io/read.c37
-rw-r--r--libgfortran/io/transfer.c182
-rw-r--r--libgfortran/io/write.c222
-rw-r--r--libgfortran/libgfortran.h7
-rw-r--r--libgfortran/m4/ifunction_logical.m42
-rw-r--r--libgfortran/runtime/main.c11
-rw-r--r--libgomp/ChangeLog20
-rw-r--r--libgomp/libgomp.h1
-rw-r--r--libgomp/libgomp.texi2
-rw-r--r--libgomp/omp_lib.f90.in2
-rw-r--r--libgomp/task.c12
-rw-r--r--libgomp/testsuite/libgomp.c/reduction-5.c78
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/libiberty.texi2
-rw-r--r--libiberty/obstacks.texi16
-rw-r--r--libobjc/ChangeLog5
-rw-r--r--libobjc/exception.c2
-rw-r--r--libstdc++-v3/ChangeLog123
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml22
-rw-r--r--libstdc++-v3/include/Makefile.am39
-rw-r--r--libstdc++-v3/include/Makefile.in37
-rw-r--r--libstdc++-v3/include/bits/deque.tcc37
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h41
-rw-r--r--libstdc++-v3/include/bits/stl_list.h24
-rw-r--r--libstdc++-v3/include/bits/stl_queue.h33
-rw-r--r--libstdc++-v3/include/bits/stl_stack.h15
-rw-r--r--libstdc++-v3/include/bits/stl_vector.h20
-rw-r--r--libstdc++-v3/include/bits/vector.tcc18
-rw-r--r--libstdc++-v3/include/debug/deque22
-rw-r--r--libstdc++-v3/include/debug/list8
-rw-r--r--libstdc++-v3/include/debug/vector12
-rw-r--r--libstdc++-v3/include/std/complex9
-rw-r--r--libstdc++-v3/include/tr1/complex5
-rw-r--r--libstdc++-v3/include/tr1_impl/array11
-rw-r--r--libstdc++-v3/include/tr1_impl/hashtable19
-rw-r--r--libstdc++-v3/src/condition_variable.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc47
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc4
-rw-r--r--libstdc++-v3/testsuite/26_numerics/complex/dr844.cc52
-rw-r--r--libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc13
197 files changed, 7692 insertions, 1425 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f8d407867f..7cb5a09a18f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-12 David S. Miller <davem@davemloft.net>
+ David Edelsohn <edelsohn@gnu.org>
+
+ * configure.ac: Add powerpc*-*-* to gold supported targets.
+ * configure: Regenerate.
+
2008-06-08 Joseph Myers <joseph@codesourcery.com>
PR tree-optimization/36218
diff --git a/configure b/configure
index 213befb5751..5f635461135 100755
--- a/configure
+++ b/configure
@@ -2057,7 +2057,7 @@ if test "${ENABLE_GOLD}" = "yes"; then
if test "$is_elf" = "yes"; then
# Check for target supported by gold.
case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-*)
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-*)
configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
;;
esac
diff --git a/configure.ac b/configure.ac
index 3b443e5a509..175de11b607 100644
--- a/configure.ac
+++ b/configure.ac
@@ -317,7 +317,7 @@ if test "${ENABLE_GOLD}" = "yes"; then
if test "$is_elf" = "yes"; then
# Check for target supported by gold.
case "${target}" in
- i?86-*-* | x86_64-*-* | sparc*-*-*)
+ i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-*)
configdirs="`echo " ${configdirs} " | sed -e 's/ ld / gold /'`"
;;
esac
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8a8f88990e0..196c1aef134 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,308 @@
+2008-06-15 Maxim Kuvyrkov <maxim@codesourcery.com>
+
+ * config/mips/loongson2ef.md: New file.
+ * config/mips/mips.md (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN)
+ (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN): New constants.
+ (define_attr "cpu"): Rename loongson2e and loongson2f to loongson_2e
+ and loongson_2f.
+ (loongson2ef.md): New include.
+ * config/mips/loongson.md (vec_pack_ssat_<mode>, vec_pack_usat_<mode>)
+ (add<mode>3, paddd, ssadd<mode>3, usadd<mode>3)
+ (loongson_and_not_<mode>, loongson_average_<mode>, loongson_eq_<mode>)
+ (loongson_gt_<mode>, loongson_extract_halfword)
+ (loongson_insert_halfword_0, loongson_insert_halfword_2)
+ (loongson_insert_halfword_3, loongson_mult_add, smax<mode>3)
+ (umax<mode>3, smin<mode>3, umin<mode>3, loongson_move_byte_mask)
+ (umul<mode>3_highpart, smul<mode>3_highpart, loongson_smul_lowpart)
+ (loongson_umul_word, loongson_pasubub, reduc_uplus_<mode>)
+ (loongson_psadbh, loongson_pshufh, loongson_psll<mode>)
+ (loongson_psra<mode>, loongson_psrl<mode>, sub<mode>3, psubd)
+ (sssub<mode>3, ussub<mode>3, vec_interleave_high<mode>)
+ (vec_interleave_low<mode>): Define type attribute.
+ * config/mips/mips.c (mips_ls2): New static variable.
+ (mips_issue_rate): Update to handle tuning for Loongson 2E/2F.
+ (mips_ls2_init_dfa_post_cycle_insn, mips_init_dfa_post_cycle_insn)
+ (sched_ls2_dfa_post_advance_cycle, mips_dfa_post_advance_cycle):
+ Implement target scheduling hooks.
+ (mips_multipass_dfa_lookahead): Update to handle tuning for
+ Loongson 2E/2F.
+ (mips_sched_init): Initialize data for Loongson scheduling.
+ (mips_ls2_variable_issue): New static function.
+ (mips_variable_issue): Update to handle tuning for Loongson 2E/2F.
+ Add sanity check.
+ (TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN)
+ (TARGET_SCHED_DFA_POST_ADVANCE_CYCLE): Override target hooks.
+ * config/mips/mips.h (TUNE_LOONGSON_2EF): New macros.
+ (ISA_HAS_XFER_DELAY, ISA_HAS_FCMP_DELAY, ISA_HAS_HILO_INTERLOCKS):
+ Handle ST Loongson 2E/2F cores.
+ (CPU_UNITS_QUERY): Define macro to enable querying of DFA units.
+
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * omp-low.c (extract_omp_for_data): Fix comment typo.
+ * c.opt: Fix typo.
+
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * doc/sourcebuild.texi (Config Fragments): Remove obsolete
+ FIXME note about gcc/config.guess.
+ * doc/options.texi (Option file format): Remove non-ASCII bytes.
+ * doc/cpp.texi: Expand TABs, drop indentation outside examples.
+ * doc/cppopts.texi: Likewise.
+ * doc/extend.texi: Likewise.
+ * doc/gcc.texi: Likewise.
+ * doc/gccint.texi: Likewise.
+ * doc/gcov.texi: Likewise.
+ * doc/gty.texi: Likewise.
+ * doc/hostconfig.texi: Likewise.
+ * doc/install.texi: Likewise.
+ * doc/invoke.texi: Likewise.
+ * doc/loop.texi: Likewise.
+ * doc/makefile.texi: Likewise.
+ * doc/md.texi: Likewise.
+ * doc/passes.texi: Likewise.
+ * doc/tm.texi: Likewise.
+ * doc/tree-ssa.texi: Likewise.
+ * doc/trouble.texi: Likewise.
+
+2008-06-15 Mark Shinwell <shinwell@codesourcery.com>
+ Nathan Sidwell <nathan@codesourcery.com>
+ Maxim Kuvyrkov <maxim@codesourcery.com>
+ Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips-modes.def: Add V8QI, V4HI and V2SI modes.
+ * config/mips/mips-protos.h (mips_expand_vector_init): New.
+ * config/mips/mips-ftypes.def: Add function types for Loongson-2E/2F
+ builtins.
+ * config/mips/mips.c (mips_split_doubleword_move): Handle new modes.
+ (mips_hard_regno_mode_ok_p): Allow 64-bit vector modes for Loongson.
+ (mips_vector_mode_supported_p): Add V2SImode, V4HImode and
+ V8QImode cases.
+ (LOONGSON_BUILTIN, LOONGSON_BUILTIN_ALIAS): New.
+ (CODE_FOR_loongson_packsswh, CODE_FOR_loongson_packsshb,
+ (CODE_FOR_loongson_packushb, CODE_FOR_loongson_paddw,
+ (CODE_FOR_loongson_paddh, CODE_FOR_loongson_paddb,
+ (CODE_FOR_loongson_paddsh, CODE_FOR_loongson_paddsb)
+ (CODE_FOR_loongson_paddush, CODE_FOR_loongson_paddusb)
+ (CODE_FOR_loongson_pmaxsh, CODE_FOR_loongson_pmaxub)
+ (CODE_FOR_loongson_pminsh, CODE_FOR_loongson_pminub)
+ (CODE_FOR_loongson_pmulhuh, CODE_FOR_loongson_pmulhh)
+ (CODE_FOR_loongson_biadd, CODE_FOR_loongson_psubw)
+ (CODE_FOR_loongson_psubh, CODE_FOR_loongson_psubb)
+ (CODE_FOR_loongson_psubsh, CODE_FOR_loongson_psubsb)
+ (CODE_FOR_loongson_psubush, CODE_FOR_loongson_psubusb)
+ (CODE_FOR_loongson_punpckhbh, CODE_FOR_loongson_punpckhhw)
+ (CODE_FOR_loongson_punpckhwd, CODE_FOR_loongson_punpcklbh)
+ (CODE_FOR_loongson_punpcklhw, CODE_FOR_loongson_punpcklwd): New.
+ (mips_builtins): Add Loongson builtins.
+ (mips_loongson_2ef_bdesc): New.
+ (mips_bdesc_arrays): Add mips_loongson_2ef_bdesc.
+ (mips_builtin_vector_type): Handle unsigned versions of vector modes.
+ (MIPS_ATYPE_UQI, MIPS_ATYPE_UDI, MIPS_ATYPE_V2SI, MIPS_ATYPE_UV2SI)
+ (MIPS_ATYPE_V4HI, MIPS_ATYPE_UV4HI, MIPS_ATYPE_V8QI, MIPS_ATYPE_UV8QI):
+ New.
+ (mips_expand_vector_init): New.
+ * config/mips/mips.h (HAVE_LOONGSON_VECTOR_MODES): New.
+ (TARGET_CPU_CPP_BUILTINS): Define __mips_loongson_vector_rev
+ if appropriate.
+ * config/mips/mips.md: Add unspec numbers for Loongson
+ builtins. Include loongson.md.
+ (MOVE64): Include Loongson vector modes.
+ (SPLITF): Include Loongson vector modes.
+ (HALFMODE): Handle Loongson vector modes.
+ * config/mips/loongson.md: New.
+ * config/mips/loongson.h: New.
+ * config.gcc: Add loongson.h header for mips*-*-* targets.
+ * doc/extend.texi (MIPS Loongson Built-in Functions): New.
+
+2008-06-14 Joseph Myers <joseph@codesourcery.com>
+
+ * config.gcc (arc-*-elf*, avr-*-*, fr30-*-elf, frv-*-elf,
+ h8300-*-elf*, h8300-*-*, i[34567]86-*-elf*, x86_64-*-elf*,
+ i[34567]86-*-aout*, i[34567]86-*-coff*, ia64*-*-elf*,
+ iq2000*-*-elf*, m32r-*-elf*, m32rle-*-elf*, m32r-*-linux*,
+ m32rle-*-linux*, m68hc11-*-*|m6811-*-*, m68hc12-*-*|m6812-*-*,
+ m68k-*-coff*, mcore-*-elf, mcore-*-pe*, mipsisa64sr71k-*-elf*,
+ mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*, mips-*-elf* |
+ mipsel-*-elf*, mips64-*-elf* | mips64el-*-elf*, mips64vr-*-elf* |
+ mips64vrel-*-elf*, mips64orion-*-elf* | mips64orionel-*-elf*,
+ mipstx39-*-elf* | mipstx39el-*-elf*, mn10300-*-*, pdp11-*-,
+ powerpc-*-elf*, powerpcle-*-elf*, sh-*-elf* | sh[12346l]*-*-elf* |
+ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | sh-*-linux* |
+ sh[2346lbe]*-*-linux* | sh-*-netbsdelf* | shl*-*-netbsdelf* |
+ sh5-*-netbsd* | sh5l*-*-netbsd* | sh64-*-netbsd* |
+ sh64l*-*-netbsd*, sh-*-*, sparc-*-elf*, sparc64-*-elf*,
+ v850e1-*-*, v850e-*-*, v850-*-*, xstormy16-*-elf, m32c-*-elf*):
+ Remove use_fixproto=yes.
+ (ia64*-*-hpux*): Remove comment about using fixproto.
+ (m68k-*-uclinuxoldabi*, m68k-*-uclinux*): Remove use_fixproto=no.
+
+2008-06-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * configure.ac: Update gthr-default.h lazily, to avoid unneeded
+ library rebuilds.
+ * configure: Regenerate.
+
+2008-06-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR middle-end/36520
+ * builtins.c (get_memory_rtx): Test for the presence of DECL_SIZE_UNIT
+ before evaluating it.
+
+2008-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36507
+ * c-decl.c (merge_decls): Don't clear DECL_EXTERNAL for
+ nested inline functions.
+ (start_decl, start_function): Don't invert DECL_EXTERNAL
+ for nested inline functions.
+
+2008-06-13 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.md: Remove TARGET_DEBUG_D_MODE conditions from
+ splits that must be made for correctness.
+
+2008-06-13 Richard Sandiford <rdsandiford@googlemail.com>
+
+ * config/mips/mips.c (BUILTIN_AVAIL_NON_MIPS16): New macro.
+ (AVAIL_NON_MIPS16): Likewise.
+ (mips_builtin_description): Replace target_flags with a predicate.
+ (paired_single, sb1_paired_single, mips3d, dsp, dspr2, dsp_32)
+ (dspr2_32): New availability predicates.
+ (MIPS_BUILTIN): New macro.
+ (DIRECT_BUILTIN, CMP_SCALAR_BUILTINS, CMP_PS_BUILTINS)
+ (CMP_4S_BUILTINS, MOVTF_BUILTINS, CMP_BUILTINS)
+ (DIRECT_NO_TARGET_BUILTIN, BPOSGE_BUILTIN): Use it.
+ Replace the TARGET_FLAGS parameters with AVAIL parameters.
+ (mips_ps_bdesc, mips_sb1_bdesc, mips_dsp_bdesc)
+ (mips_dsp_32only_bdesc): Merge into...
+ (mips_builtins): ...this new array.
+ (mips_bdesc_map, mips_bdesc_arrays): Delete.
+ (mips_init_builtins): Update after above changes.
+ (mips_expand_builtin_1): Merge into...
+ (mips_expand_builtin): ...here and update after above changes.
+
+2008-06-12 Paul Brook <paul@codesourcery.com>
+
+ * longlong.h (__arm__): Define count_leading_zeros.
+ * config/arm/lib1funcs.asm (xxh, xxl, yyh, yyl): Define.
+ (clzsi2, clzdi2): New functions.
+ * config/arm/bpabi-v6m.S (xxh, xxl, yyh, yyl): Remove.
+ * config/arm/bpabi.S (xxh, xxl, yyh, yyl): Remove.
+ * config/arm/t-strongarm-elf (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-vxworks (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-pe (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-arm-elf (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-arm-coff (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-linux (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-symbian (LIB1ASMFUNCS): Ditto.
+ * config/arm/t-wince-pe (LIB1ASMFUNCS): Ditto.
+
+2008-06-12 Kazu Hirata <kazu@codesourcery.com>
+
+ * config/m68k/m68k.c (m68k_tune_flags): New.
+ (override_options): Compute m68k_tune_flags.
+ (MULL_COST, MULW_COST): Update for various variants of CFV2.
+ * config/m68k/m68k.h (TUNE_MAC, TUNE_EMAC): New.
+
+2008-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36506
+ * omp-low.c (expand_omp_sections): Initialize l2 to avoid bogus
+ warning.
+
+2008-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-inline.c (copy_body_r): Copy TREE_SIDE_EFFECTS along with
+ TREE_THIS_VOLATILE on INDIRECT_REF nodes.
+
+2008-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * expr.c (store_field): Do a block copy from BLKmode to BLKmode-like.
+ (get_inner_reference): Use BLKmode for byte-aligned BLKmode bitfields.
+
+2008-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36506
+ * omp-low.c (expand_omp_sections): Handle #pragma omp sections with
+ reductions.
+
+2008-06-12 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36345
+ * tree-flow.h (struct ptr_info_def): Align escape_mask,
+ add memory_tag_needed flag.
+ (may_alias_p): Declare.
+ * tree-ssa-alias.c (may_alias_p): Export.
+ (set_initial_properties): Use memory_tag_needed flag.
+ (update_reference_counts): Likewise.
+ (reset_alias_info): Reset memory_tag_needed flag.
+ (create_name_tags): Check memory_tag_needed flag.
+ (dump_points_to_info_for): Dump it.
+ * tree-ssa-structalias.c (struct variable_info): Remove
+ directly_dereferenced flag.
+ (new_var_info): Do not initialize it.
+ (process_constraint_1): Do not set it.
+ (update_alias_info): Set is_dereferenced flag.
+ (set_uids_in_ptset): Use may_alias_p.
+ (set_used_smts): Check memory_tag_needed flag.
+ (find_what_p_points_to): Likewise. Pass is_dereferenced flag.
+ * tree-ssa-alias.c (verify_flow_sensitive_alias_info): Check
+ memory_tag_needed flag.
+ * tree-ssa-alias-warnings.c (dsa_named_for): Try to recover
+ from broken design.
+
+2008-06-12 Kai Tietz <kai.tietz@onevision.com>
+
+ * config/i386/i386.c (ix86_compute_frame_layout): Disable red zone for
+ w64 abi.
+ (ix86_expand_prologue): Likewise.
+ (ix86_force_to_memory): Likewise.
+ (ix86_free_from_memory): Likewise.
+
+2008-06-11 Edmar Wienskoski <edmar@freescale.com>
+
+ PR target/36425
+ * config/rs6000/rs6000.c (rs6000_override_options): Set
+ rs6000_isel conditionally to the absence of comand line
+ override.
+ * config/rs6000/linuxspe.h (SUBSUBTARGET_OVERRIDE_OPTIONS):
+ Remove duplicate rs6000_isel setting.
+ * config/rs6000/eabispe.h: Ditto.
+
+2008-06-11 Richard Guenther <rguenther@suse.de>
+
+ * alias.c (get_alias_set): Use the element alias-set for arrays.
+ (record_component_aliases): For arrays and vectors do nothing.
+ * c-common.c (strict_aliasing_warning): Handle the cases
+ of alias set zero explicitly.
+ * Makefile.in (dfp.o-warn): Add -Wno-error.
+
+2008-06-11 Joseph Myers <joseph@codesourcery.com>
+
+ * config.gcc (all_defaults): Add arch_32 arch_64 cpu_32 cpu_64
+ tune_32 tune_64.
+ (i[34567]86-*-* | x86_64-*-*): Add arch_32 arch_64 cpu_32 cpu_64
+ tune_32 tune_64 to supported_defaults. Allow values not
+ supporting 64-bit mode for arch_32, cpu_32 and tune_32 for
+ x86_64. Do not override cpu_32 or cpu_64 values from target name.
+ (i[34567]86-*-linux*, i[34567]86-*-solaris2.1[0-9]*): Only default
+ with_cpu_64 to generic for 64-bit-supporting configurations, not
+ with_cpu. Remove FIXMEs.
+ * doc/install.texi (--with-cpu-32, --with-cpu-64, --with-arch-32,
+ --with-arch-64, --with-tune-32, --with-tune-64): Document.
+ * config/i386/i386.h (OPT_ARCH32, OPT_ARCH64): Define.
+ (OPTION_DEFAULT_SPECS): Add tune_32, tune_64, cpu_32, cpu_64,
+ arch_32 and arch_64.
+
+2008-06-11 Eric Botcazou <ebotcazou@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ * builtins.c (get_memory_rtx): Accept byte-addressable bitfields.
+ Use DECL_SIZE_UNIT to retrieve the size of the field.
+
2008-06-11 Joseph Myers <joseph@codesourcery.com>
* config/arm/arm.c (arm_init_neon_builtins): Move initialization
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index a4b03e33583..aa60d008a30 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20080611
+20080615
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 7069728a128..47a45a1f4a2 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -187,6 +187,8 @@ GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
build/gengtype-lex.o-warn = -Wno-error
# SYSCALLS.c misses prototypes
SYSCALLS.c.X-warn = -Wno-strict-prototypes -Wno-error
+# dfp.c contains alias violations
+dfp.o-warn = -Wno-error
# All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index e41daae22e7..9282491a1df 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,32 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gnat_rm.texi (Implementation Defined Characteristics)
+ (Standard Library Routines): Use @smallexample for indented
+ text. Drop Indentation outside examples.
+ * gnat_ugn.texi: Likewise.
+
+2008-06-13 Olivier Hainque <hainque@adacore.com>
+
+ * decl.c (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN): Define to 0
+ if undefined.
+ (gnat_to_gnu_entity) <case E_Function/Procedure>: Request stack
+ realignment with force_align_arg_pointer attribute on foreign
+ convention subprograms if FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN.
+
+2008-06-13 Olivier Hainque <hainque@adacore.com>
+
+ * utils.c (rest_of_record_type_compilation): When computing
+ encodings for the components of a variable size type, early
+ strip conversions on the current position expression to make
+ sure it's shape is visible. Use remove_conversions for this
+ purpose.
+
+2008-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: In the case of a
+ constrained subtype of a discriminated type, discard the fields that
+ are beyond its limits according to its size.
+
2008-06-10 Olivier Hainque <hainque@adacore.com>
* utils.c (create_subprog_decl): If this is for the 'main' entry
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index b8bcb4bc85d..ff2927fe642 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -67,6 +67,29 @@
#define Has_Stdcall_Convention(E) (0)
#endif
+/* Stack realignment for functions with foreign conventions is provided on a
+ per back-end basis now, as it is handled by the prologue expanders and not
+ as part of the function's body any more. It might be requested by way of a
+ dedicated function type attribute on the targets that support it.
+
+ We need a way to avoid setting the attribute on the targets that don't
+ support it and use FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN for this purpose.
+
+ It is defined on targets where the circuitry is available, and indicates
+ whether the realignment is needed for 'main'. We use this to decide for
+ foreign subprograms as well.
+
+ It is not defined on targets where the circuitry is not implemented, and
+ we just never set the attribute in these cases.
+
+ Whether it is defined on all targets that would need it in theory is
+ not entirely clear. We currently trust the base GCC settings for this
+ purpose. */
+
+#ifndef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
+#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN 0
+#endif
+
struct incomplete
{
struct incomplete *next;
@@ -2922,9 +2945,42 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_type) = gnu_entity_id;
- TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_base_type);
TYPE_VOLATILE (gnu_type) = Treat_As_Volatile (gnat_entity);
+ /* Set the size, alignment and alias set of the new type to
+ match that of the old one, doing required substitutions.
+ We do it this early because we need the size of the new
+ type below to discard old fields if necessary. */
+ TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_base_type);
+ TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_base_type);
+ SET_TYPE_ADA_SIZE (gnu_type, TYPE_ADA_SIZE (gnu_base_type));
+ TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_base_type);
+ copy_alias_set (gnu_type, gnu_base_type);
+
+ if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)))
+ for (gnu_temp = gnu_subst_list;
+ gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
+ TYPE_SIZE (gnu_type)
+ = substitute_in_expr (TYPE_SIZE (gnu_type),
+ TREE_PURPOSE (gnu_temp),
+ TREE_VALUE (gnu_temp));
+
+ if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE_UNIT (gnu_type)))
+ for (gnu_temp = gnu_subst_list;
+ gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
+ TYPE_SIZE_UNIT (gnu_type)
+ = substitute_in_expr (TYPE_SIZE_UNIT (gnu_type),
+ TREE_PURPOSE (gnu_temp),
+ TREE_VALUE (gnu_temp));
+
+ if (CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (gnu_type)))
+ for (gnu_temp = gnu_subst_list;
+ gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
+ SET_TYPE_ADA_SIZE
+ (gnu_type, substitute_in_expr (TYPE_ADA_SIZE (gnu_type),
+ TREE_PURPOSE (gnu_temp),
+ TREE_VALUE (gnu_temp)));
+
for (gnat_field = First_Entity (gnat_entity);
Present (gnat_field); gnat_field = Next_Entity (gnat_field))
if ((Ekind (gnat_field) == E_Component
@@ -2946,7 +3002,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
tree gnu_field_type
= gnat_to_gnu_type (Etype (gnat_field));
tree gnu_size = TYPE_SIZE (gnu_field_type);
- tree gnu_new_pos = 0;
+ tree gnu_new_pos = NULL_TREE;
unsigned int offset_align
= tree_low_cst (TREE_PURPOSE (TREE_VALUE (gnu_offset)),
1);
@@ -2992,11 +3048,23 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TREE_PURPOSE (gnu_temp),
TREE_VALUE (gnu_temp));
- /* If the size is now a constant, we can set it as the
- size of the field when we make it. Otherwise, we need
- to deal with it specially. */
+ /* If the position is now a constant, we can set it as the
+ position of the field when we make it. Otherwise, we need
+ to deal with it specially below. */
if (TREE_CONSTANT (gnu_pos))
- gnu_new_pos = bit_from_pos (gnu_pos, gnu_bitpos);
+ {
+ gnu_new_pos = bit_from_pos (gnu_pos, gnu_bitpos);
+
+ /* Discard old fields that are outside the new type.
+ This avoids confusing code scanning it to decide
+ how to pass it to functions on some platforms. */
+ if (TREE_CODE (gnu_new_pos) == INTEGER_CST
+ && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST
+ && !integer_zerop (gnu_size)
+ && !tree_int_cst_lt (gnu_new_pos,
+ TYPE_SIZE (gnu_type)))
+ continue;
+ }
gnu_field
= create_field_decl
@@ -3044,49 +3112,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnat_to_gnu_entity (Etype (gnat_field), NULL_TREE, 0);
/* Do not finalize it since we're going to modify it below. */
- finish_record_type (gnu_type, nreverse (gnu_field_list),
- 2, true);
-
- /* Now set the size, alignment and alias set of the new type to
- match that of the old one, doing any substitutions, as
- above. */
- TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_base_type);
- TYPE_SIZE (gnu_type) = TYPE_SIZE (gnu_base_type);
- TYPE_SIZE_UNIT (gnu_type) = TYPE_SIZE_UNIT (gnu_base_type);
- SET_TYPE_ADA_SIZE (gnu_type, TYPE_ADA_SIZE (gnu_base_type));
- copy_alias_set (gnu_type, gnu_base_type);
+ gnu_field_list = nreverse (gnu_field_list);
+ finish_record_type (gnu_type, gnu_field_list, 2, true);
- if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)))
- for (gnu_temp = gnu_subst_list;
- gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
- TYPE_SIZE (gnu_type)
- = substitute_in_expr (TYPE_SIZE (gnu_type),
- TREE_PURPOSE (gnu_temp),
- TREE_VALUE (gnu_temp));
-
- if (CONTAINS_PLACEHOLDER_P (TYPE_SIZE_UNIT (gnu_type)))
- for (gnu_temp = gnu_subst_list;
- gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
- TYPE_SIZE_UNIT (gnu_type)
- = substitute_in_expr (TYPE_SIZE_UNIT (gnu_type),
- TREE_PURPOSE (gnu_temp),
- TREE_VALUE (gnu_temp));
-
- if (CONTAINS_PLACEHOLDER_P (TYPE_ADA_SIZE (gnu_type)))
- for (gnu_temp = gnu_subst_list;
- gnu_temp; gnu_temp = TREE_CHAIN (gnu_temp))
- SET_TYPE_ADA_SIZE
- (gnu_type, substitute_in_expr (TYPE_ADA_SIZE (gnu_type),
- TREE_PURPOSE (gnu_temp),
- TREE_VALUE (gnu_temp)));
-
- /* Reapply variable_size since we have changed the sizes. */
+ /* Finalize size and mode. */
TYPE_SIZE (gnu_type) = variable_size (TYPE_SIZE (gnu_type));
TYPE_SIZE_UNIT (gnu_type)
= variable_size (TYPE_SIZE_UNIT (gnu_type));
- /* Recompute the mode of this record type now that we know its
- actual size. */
compute_record_mode (gnu_type);
/* Fill in locations of fields. */
@@ -3941,6 +3974,19 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
get_identifier ("stdcall"), NULL_TREE,
gnat_entity);
+ /* If we are on a target where stack realignment is needed for 'main'
+ to honor GCC's implicit expectations (stack alignment greater than
+ what the base ABI guarantees), ensure we do the same for foreign
+ convention subprograms as they might be used as callbacks from code
+ breaking such expectations. Note that this applies to task entry
+ points in particular. */
+ if (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
+ && Has_Foreign_Convention (gnat_entity))
+ prepend_one_attribute_to
+ (&attr_list, ATTR_MACHINE_ATTRIBUTE,
+ get_identifier ("force_align_arg_pointer"), NULL_TREE,
+ gnat_entity);
+
/* The lists have been built in reverse. */
gnu_param_list = nreverse (gnu_param_list);
if (has_stub)
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 5046cc56c73..47152e4bfbe 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -8345,15 +8345,17 @@ be provided. In this mode, exceptions may be raised but will result in
an immediate call to the last chance handler, a routine that the user
must define with the following profile:
- procedure Last_Chance_Handler
- (Source_Location : System.Address; Line : Integer);
- pragma Export (C, Last_Chance_Handler,
- "__gnat_last_chance_handler");
+@smallexample @c ada
+procedure Last_Chance_Handler
+ (Source_Location : System.Address; Line : Integer);
+pragma Export (C, Last_Chance_Handler,
+ "__gnat_last_chance_handler");
+@end smallexample
- The parameter is a C null-terminated string representing a message to be
- associated with the exception (typically the source location of the raise
- statement generated by the compiler). The Line parameter when nonzero
- represents the line number in the source program where the raise occurs.
+The parameter is a C null-terminated string representing a message to be
+associated with the exception (typically the source location of the raise
+statement generated by the compiler). The Line parameter when nonzero
+represents the line number in the source program where the raise occurs.
@item No_Exception_Propagation
@findex No_Exception_Propagation
@@ -11663,8 +11665,7 @@ The following predefined instantiations of this package are provided:
@item Float
@code{Ada.Numerics.Complex_Elementary_Functions}
@item Long_Float
-@code{Ada.Numerics.
- Long_Complex_Elementary_Functions}
+@code{Ada.Numerics.Long_Complex_Elementary_Functions}
@end table
@item Ada.Numerics.Generic_Complex_Types
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 2aac8e8297b..3256c1c7f32 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -8862,7 +8862,7 @@ Project File is specified, with the ALI file extension.
Compile only. Do not perform binding, except when @option{^-b^/ACTIONS=BIND^}
is also specified. Do not perform linking, except if both
@option{^-b^/ACTIONS=BIND^} and
- @option{^-l^/ACTIONS=LINK^} are also specified.
+@option{^-l^/ACTIONS=LINK^} are also specified.
If the root unit specified by @var{file_name} is not a main unit, this is the
default. Otherwise @command{gnatmake} will attempt binding and linking
unless all objects are up to date and the executable is more recent than
@@ -8894,7 +8894,9 @@ This switch is not compatible with a project file
@cindex @option{^-d^/DISPLAY_PROGRESS^} (@command{gnatmake})
Display progress for each source, up to date or not, as a single line
- completed x out of y (zz%)
+@smallexample
+completed x out of y (zz%)
+@end smallexample
If the file needs to be compiled this is displayed after the invocation of
the compiler. These lines are displayed even in quiet output mode.
@@ -9419,8 +9421,8 @@ and @file{^main3^MAIN3.EXE^}.
@ifset vms
@item gnatmake Main_Unit /QUIET
- /COMPILER_QUALIFIERS /OPTIMIZE=ALL
- /BINDER_QUALIFIERS /ORDER_OF_ELABORATION
+/COMPILER_QUALIFIERS /OPTIMIZE=ALL
+/BINDER_QUALIFIERS /ORDER_OF_ELABORATION
@end ifset
Compile all files necessary to bind and link the main program unit
@code{Main_Unit} (from file @file{main_unit.adb}). All compilations will
@@ -12640,7 +12642,7 @@ The prefix of an attribute may be:
@item The name of an imported project
@item The name of a parent project that is extended by the current project
@item An expanded name whose prefix is imported/parent project name,
- and whose selector is a package name
+and whose selector is a package name
@end itemize
@noindent
@@ -15287,8 +15289,8 @@ specifies the command used to compile a single file in the application.
@ifclear vms
@item make_cmd=COMMAND
[default: @code{"gnatmake $@{main@} -aI$@{src_dir@}
- -aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@}
- -bargs $@{bind_opt@} -largs $@{link_opt@}"}]
+-aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@}
+-bargs $@{bind_opt@} -largs $@{link_opt@}"}]
@end ifclear
specifies the command used to recompile the whole application.
@@ -17961,25 +17963,23 @@ $ GNAT LIBRARY /[CREATE | SET | DELETE]=directory [/CONFIG=file]
@c !sort!
@item /CREATE=directory
@cindex @code{/CREATE} (@code{gnatlbr})
- Create the new run-time library in the specified directory.
+Create the new run-time library in the specified directory.
@item /SET=directory
@cindex @code{/SET} (@code{gnatlbr})
- Make the library in the specified directory the current run-time
- library.
+Make the library in the specified directory the current run-time library.
@item /DELETE=directory
@cindex @code{/DELETE} (@code{gnatlbr})
- Delete the run-time library in the specified directory.
+Delete the run-time library in the specified directory.
@item /CONFIG=file
@cindex @code{/CONFIG} (@code{gnatlbr})
- With /CREATE:
- Use the configuration pragmas in the specified file when building
- the library.
+With /CREATE: Use the configuration pragmas in the specified file when
+building the library.
- With /SET:
- Use the configuration pragmas in the specified file when compiling.
+With /SET: Use the configuration pragmas in the specified file when
+compiling.
@end table
@@ -21102,14 +21102,14 @@ The following declarations are checked:
@itemize @bullet
@item
- type declarations
+type declarations
@item
- constant declarations (but not number declarations)
+constant declarations (but not number declarations)
@item
- package renaming declarations (but not generic package renaming
- declarations)
+package renaming declarations (but not generic package renaming
+declarations)
@end itemize
@noindent
@@ -21118,12 +21118,12 @@ the following checks:
@itemize @bullet
@item
- type-defining names end with @code{_T}, unless the type is an access type,
- in which case the suffix must be @code{_A}
+type-defining names end with @code{_T}, unless the type is an access type,
+in which case the suffix must be @code{_A}
@item
- constant names end with @code{_C}
+constant names end with @code{_C}
@item
- names defining package renamings end with @code{_R}
+names defining package renamings end with @code{_R}
@end itemize
@noindent
@@ -21132,19 +21132,19 @@ made for the defining name suffix:
@itemize @bullet
@item
- For an incomplete type declaration: if the corresponding full type
- declaration is available, the defining identifier from the full type
- declaration is checked, but the defining identifier from the incomplete type
- declaration is not; otherwise the defining identifier from the incomplete
- type declaration is checked against the suffix specified for type
- declarations.
+For an incomplete type declaration: if the corresponding full type
+declaration is available, the defining identifier from the full type
+declaration is checked, but the defining identifier from the incomplete type
+declaration is not; otherwise the defining identifier from the incomplete
+type declaration is checked against the suffix specified for type
+declarations.
@item
- For a private type declaration (including private extensions), the defining
- identifier from the private type declaration is checked against the type
- suffix (even if the corresponding full declaration is an access type
- declaration), and the defining identifier from the corresponding full type
- declaration is not checked.
+For a private type declaration (including private extensions), the defining
+identifier from the private type declaration is checked against the type
+suffix (even if the corresponding full declaration is an access type
+declaration), and the defining identifier from the corresponding full type
+declaration is not checked.
@end itemize
@noindent
@@ -24217,7 +24217,7 @@ functions:
@item @code{TO_UNSIGNED_LONGWORD(ADDRESS)}
@item Function @code{IMPORT_VALUE return UNSIGNED_LONGWORD} and the
- functions @code{IMPORT_ADDRESS} and @code{IMPORT_LARGEST_VALUE}
+functions @code{IMPORT_ADDRESS} and @code{IMPORT_LARGEST_VALUE}
@end itemize
@noindent
@@ -24410,16 +24410,15 @@ GNAT supplies the following task-related pragmas:
@itemize @bullet
@item @code{TASK_INFO}
- This pragma appears within a task definition and
- applies to the task in which it appears. The argument
- must be of type @code{SYSTEM.TASK_INFO.TASK_INFO_TYPE}.
+This pragma appears within a task definition and
+applies to the task in which it appears. The argument
+must be of type @code{SYSTEM.TASK_INFO.TASK_INFO_TYPE}.
@item @code{TASK_STORAGE}
- GNAT implements pragma @code{TASK_STORAGE} in the same way as
- HP Ada.
- Both HP Ada and GNAT supply the pragmas @code{PASSIVE},
- @code{SUPPRESS}, and @code{VOLATILE}.
+GNAT implements pragma @code{TASK_STORAGE} in the same way as HP Ada.
+Both HP Ada and GNAT supply the pragmas @code{PASSIVE},
+@code{SUPPRESS}, and @code{VOLATILE}.
@end itemize
@node Scheduling and Task Priority
@subsection Scheduling and Task Priority
@@ -24875,17 +24874,16 @@ On HP Ada, main programs are defined to meet the
following conditions:
@itemize @bullet
@item Procedure with no formal parameters (returns @code{0} upon
- normal completion)
+normal completion)
@item Procedure with no formal parameters (returns @code{42} when
- an unhandled exception is raised)
+an unhandled exception is raised)
@item Function with no formal parameters whose returned value
- is of a discrete type
+is of a discrete type
@item Procedure with one @code{out} formal of a discrete type for
- which a specification of pragma @code{EXPORT_VALUED_PROCEDURE}
- is given.
+which a specification of pragma @code{EXPORT_VALUED_PROCEDURE} is given.
@end itemize
@@ -25270,7 +25268,7 @@ and GNAT systems.
@sp 1
@item In a subprogram or entry declaration, maximum number of
- formal parameters that are of an unconstrained record type
+formal parameters that are of an unconstrained record type
@tab 32
@tab No set limit
@sp 1
@@ -25296,7 +25294,7 @@ and GNAT systems.
@sp 1
@item Maximum number of formal parameters in an entry or
- subprogram declaration
+subprogram declaration
@tab 246
@tab No set limit
@sp 1
@@ -25317,13 +25315,13 @@ and GNAT systems.
@sp 1
@item Maximum number of objects declared with the pragma @code{COMMON_OBJECT}
- or @code{PSECT_OBJECT}
+or @code{PSECT_OBJECT}
@tab 32757
@tab No set limit
@sp 1
@item Maximum number of enumeration literals in an enumeration type
- definition
+definition
@tab 65535
@tab No set limit
@sp 1
@@ -25422,35 +25420,35 @@ of the DECset package.
@c @multitable @columnfractions .3 .4 .4
@multitable {Source Code Analyzer /}{Tool with HP Ada}{Tool with GNAT Pro}
@item @i{Tool}
- @tab @i{Tool with HP Ada}
- @tab @i{Tool with @value{EDITION}}
+@tab @i{Tool with HP Ada}
+@tab @i{Tool with @value{EDITION}}
@item Code Management@*System
- @tab HP CMS
- @tab HP CMS
+@tab HP CMS
+@tab HP CMS
@item Language-Sensitive@*Editor
- @tab HP LSE
- @tab emacs or HP LSE (Alpha)
+@tab HP LSE
+@tab emacs or HP LSE (Alpha)
@item
- @tab
- @tab HP LSE (I64)
+@tab
+@tab HP LSE (I64)
@item Debugger
- @tab OpenVMS Debug
- @tab gdb (Alpha),
+@tab OpenVMS Debug
+@tab gdb (Alpha),
@item
- @tab
- @tab OpenVMS Debug (I64)
+@tab
+@tab OpenVMS Debug (I64)
@item Source Code Analyzer /@*Cross Referencer
- @tab HP SCA
- @tab GNAT XREF
+@tab HP SCA
+@tab GNAT XREF
@item Test Manager
- @tab HP Digital Test@*Manager (DTM)
- @tab HP DTM
+@tab HP Digital Test@*Manager (DTM)
+@tab HP DTM
@item Performance and@*Coverage Analyzer
- @tab HP PCA
- @tab HP PCA
+@tab HP PCA
+@tab HP PCA
@item Module Management@*System
- @tab HP MMS
- @tab Not applicable
+@tab HP MMS
+@tab Not applicable
@end multitable
@end flushleft
@end ifnottex
@@ -25787,16 +25785,16 @@ to one of the following:
@table @code
@item -2
Use the default configuration (run the program on all
- available processors) - this is the same as having
- @code{GNAT_PROCESSOR} unset
+available processors) - this is the same as having @code{GNAT_PROCESSOR}
+unset
@item -1
Let the run-time implementation choose one processor and run the program on
- that processor
+that processor
@item 0 .. Last_Proc
Run the program on the specified processor.
- @code{Last_Proc} is equal to @code{_SC_NPROCESSORS_CONF - 1}
+@code{Last_Proc} is equal to @code{_SC_NPROCESSORS_CONF - 1}
(where @code{_SC_NPROCESSORS_CONF} is a system variable).
@end table
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index d9a0e3aa618..f255d37d6ef 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -1085,6 +1085,10 @@ rest_of_record_type_compilation (tree record_type)
If this is a union, the position can be taken as zero. */
+ /* Some computations depend on the shape of the position expression,
+ so strip conversions to make sure it's exposed. */
+ curpos = remove_conversions (curpos, true);
+
if (TREE_CODE (new_record_type) == UNION_TYPE)
pos = bitsize_zero_node, align = 0;
else
@@ -1096,13 +1100,9 @@ rest_of_record_type_compilation (tree record_type)
tree offset = TREE_OPERAND (curpos, 0);
align = tree_low_cst (TREE_OPERAND (curpos, 1), 1);
- /* Strip off any conversions. */
- while (TREE_CODE (offset) == NON_LVALUE_EXPR
- || CONVERT_EXPR_P (offset))
- offset = TREE_OPERAND (offset, 0);
-
/* An offset which is a bitwise AND with a negative power of 2
means an alignment corresponding to this power of 2. */
+ offset = remove_conversions (offset, true);
if (TREE_CODE (offset) == BIT_AND_EXPR
&& host_integerp (TREE_OPERAND (offset, 1), 0)
&& tree_int_cst_sgn (TREE_OPERAND (offset, 1)) < 0)
diff --git a/gcc/alias.c b/gcc/alias.c
index 06ad867d303..ec2d053362c 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -640,6 +640,18 @@ get_alias_set (tree t)
else if (TREE_CODE (t) == VECTOR_TYPE)
set = get_alias_set (TREE_TYPE (t));
+ /* Unless the language specifies otherwise, treat array types the
+ same as their components. This avoids the asymmetry we get
+ through recording the components. Consider accessing a
+ character(kind=1) through a reference to a character(kind=1)[1:1].
+ Or consider if we want to assign integer(kind=4)[0:D.1387] and
+ integer(kind=4)[4] the same alias set or not.
+ Just be pragmatic here and make sure the array and its element
+ type get the same alias set assigned. */
+ else if (TREE_CODE (t) == ARRAY_TYPE
+ && !TYPE_NONALIASED_COMPONENT (t))
+ set = get_alias_set (TREE_TYPE (t));
+
else
/* Otherwise make a new alias set for this type. */
set = new_alias_set ();
@@ -747,11 +759,6 @@ record_component_aliases (tree type)
switch (TREE_CODE (type))
{
- case ARRAY_TYPE:
- if (!TYPE_NONALIASED_COMPONENT (type))
- record_alias_subset (superset, get_alias_set (TREE_TYPE (type)));
- break;
-
case RECORD_TYPE:
case UNION_TYPE:
case QUAL_UNION_TYPE:
@@ -775,6 +782,9 @@ record_component_aliases (tree type)
record_alias_subset (superset, get_alias_set (TREE_TYPE (type)));
break;
+ /* VECTOR_TYPE and ARRAY_TYPE share the alias set with their
+ element type. */
+
default:
break;
}
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8abcc114647..b3fc3041377 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1114,19 +1114,27 @@ get_memory_rtx (tree exp, tree len)
while (TREE_CODE (inner) == COMPONENT_REF)
{
tree field = TREE_OPERAND (inner, 1);
- gcc_assert (! DECL_BIT_FIELD (field));
gcc_assert (TREE_CODE (mem_expr) == COMPONENT_REF);
gcc_assert (field == TREE_OPERAND (mem_expr, 1));
+ /* Bitfields are generally not byte-addressable. */
+ gcc_assert (!DECL_BIT_FIELD (field)
+ || ((tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
+ % BITS_PER_UNIT) == 0
+ && host_integerp (DECL_SIZE (field), 0)
+ && (TREE_INT_CST_LOW (DECL_SIZE (field))
+ % BITS_PER_UNIT) == 0));
+
+ /* If we can prove that the memory starting at XEXP (mem, 0) and
+ ending at XEXP (mem, 0) + LENGTH will fit into this field, we
+ can keep the COMPONENT_REF in MEM_EXPR. But be careful with
+ fields without DECL_SIZE_UNIT like flexible array members. */
if (length >= 0
- && TYPE_SIZE_UNIT (TREE_TYPE (inner))
- && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (inner)), 0))
+ && DECL_SIZE_UNIT (field)
+ && host_integerp (DECL_SIZE_UNIT (field), 0))
{
HOST_WIDE_INT size
- = tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (inner)), 0);
- /* If we can prove the memory starting at XEXP (mem, 0)
- and ending at XEXP (mem, 0) + LENGTH will fit into
- this field, we can keep that COMPONENT_REF in MEM_EXPR. */
+ = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field));
if (offset <= size
&& length <= size
&& offset + length <= size)
@@ -1135,7 +1143,7 @@ get_memory_rtx (tree exp, tree len)
if (offset >= 0
&& host_integerp (DECL_FIELD_OFFSET (field), 0))
- offset += tree_low_cst (DECL_FIELD_OFFSET (field), 0)
+ offset += TREE_INT_CST_LOW (DECL_FIELD_OFFSET (field))
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
/ BITS_PER_UNIT;
else
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 377db5708d0..b783c534012 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1093,7 +1093,8 @@ strict_aliasing_warning (tree otype, tree type, tree expr)
get_alias_set (TREE_TYPE (TREE_OPERAND (expr, 0)));
alias_set_type set2 = get_alias_set (TREE_TYPE (type));
- if (!alias_sets_conflict_p (set1, set2))
+ if (set1 != set2 && set2 != 0
+ && (set1 == 0 || !alias_sets_conflict_p (set1, set2)))
{
warning (OPT_Wstrict_aliasing, "dereferencing type-punned "
"pointer will break strict-aliasing rules");
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 9abb4dfc65f..89fdf3d1b45 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1763,7 +1763,9 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
|| !DECL_DECLARED_INLINE_P (olddecl)
|| !DECL_EXTERNAL (olddecl))
&& DECL_EXTERNAL (newdecl)
- && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)))
+ && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl))
+ && (DECL_CONTEXT (newdecl) == NULL_TREE
+ || TREE_CODE (DECL_CONTEXT (newdecl)) != FUNCTION_DECL))
DECL_EXTERNAL (newdecl) = 0;
if (DECL_EXTERNAL (newdecl))
@@ -3264,7 +3266,8 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
if (declspecs->inline_p
&& !flag_gnu89_inline
&& TREE_CODE (decl) == FUNCTION_DECL
- && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl)))
+ && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl))
+ || current_function_decl))
{
if (declspecs->storage_class == csc_auto && current_scope != file_scope)
;
@@ -6094,7 +6097,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
if (declspecs->inline_p
&& !flag_gnu89_inline
&& TREE_CODE (decl1) == FUNCTION_DECL
- && lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1)))
+ && (lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (decl1))
+ || current_function_decl))
{
if (declspecs->storage_class != csc_static)
DECL_EXTERNAL (decl1) = !DECL_EXTERNAL (decl1);
diff --git a/gcc/c.opt b/gcc/c.opt
index 9669f2ca6ba..30782d4f3a7 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -679,7 +679,7 @@ Enable OpenMP
foperator-names
C++ ObjC++
-Recognize C++ kewords like \"compl\" and \"xor\"
+Recognize C++ keywords like \"compl\" and \"xor\"
foptional-diags
C++ ObjC++
diff --git a/gcc/config.gcc b/gcc/config.gcc
index fb85eebd59d..e4aa3a57495 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -307,6 +307,7 @@ m68k-*-*)
mips*-*-*)
cpu_type=mips
need_64bit_hwint=yes
+ extra_headers="loongson.h"
;;
powerpc*-*-*)
cpu_type=rs6000
@@ -665,7 +666,6 @@ alpha*-dec-*vms*)
arc-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
extra_parts="crtinit.o crtfini.o"
- use_fixproto=yes
;;
arm-*-coff* | armel-*-coff*)
tm_file="arm/semi.h arm/aout.h arm/arm.h arm/coff.h dbxcoff.h"
@@ -787,7 +787,6 @@ avr-*-rtems*)
;;
avr-*-*)
tm_file="avr/avr.h dbxelf.h"
- use_fixproto=yes
;;
bfin*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h"
@@ -852,12 +851,10 @@ fr30-*-elf)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
tmake_file=fr30/t-fr30
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
- use_fixproto=yes
;;
frv-*-elf)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file} frv/frv-abi.h"
tmake_file=frv/t-frv
- use_fixproto=yes
;;
frv-*-*linux*)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file} \
@@ -871,11 +868,9 @@ h8300-*-rtems*)
h8300-*-elf*)
tmake_file="h8300/t-h8300 h8300/t-elf"
tm_file="h8300/h8300.h dbxelf.h elfos.h h8300/elf.h"
- use_fixproto=yes
;;
h8300-*-*)
tm_file="h8300/h8300.h dbxcoff.h h8300/coff.h"
- use_fixproto=yes
;;
hppa*64*-*-linux*)
target_cpu_default="MASK_PA_11|MASK_PA_20"
@@ -1022,16 +1017,13 @@ x86_64-*-darwin*)
i[34567]86-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h"
tmake_file="i386/t-i386elf t-svr4"
- use_fixproto=yes
;;
x86_64-*-elf*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h"
tmake_file="i386/t-i386elf t-svr4"
- use_fixproto=yes
;;
i[34567]86-*-aout*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h i386/i386-aout.h"
- use_fixproto=yes
;;
i[34567]86-*-freebsd*)
tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h"
@@ -1068,7 +1060,6 @@ i[34567]86-*-openbsd*)
;;
i[34567]86-*-coff*)
tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h dbxcoff.h i386/i386-coff.h"
- use_fixproto=yes
;;
i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
# Intel 80386's running GNU/*
@@ -1081,13 +1072,13 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu)
tm_defines="${tm_defines} TARGET_BI_ARCH=1"
tmake_file="${tmake_file} i386/t-linux64 i386/t-fprules-softfp64 soft-fp/t-softfp"
need_64bit_hwint=yes
- # FIXME: -m64 for i[34567]86-*-* should be allowed just
- # like -m32 for x86_64-*-*.
case X"${with_cpu}" in
Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
;;
X)
- with_cpu=generic
+ if test x$with_cpu_64 = x; then
+ with_cpu_64=generic
+ fi
;;
*)
echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
@@ -1192,13 +1183,13 @@ i[34567]86-*-solaris2*)
tm_defines="${tm_defines} TARGET_BI_ARCH=1"
tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10"
need_64bit_hwint=yes
- # FIXME: -m64 for i[34567]86-*-* should be allowed just
- # like -m32 for x86_64-*-*.
case X"${with_cpu}" in
Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
;;
X)
- with_cpu=generic
+ if test x$with_cpu_64 = x; then
+ with_cpu_64=generic
+ fi
;;
*)
echo "Unsupported CPU used in --with-cpu=$with_cpu, supported values:" 1>&2
@@ -1306,7 +1297,6 @@ ia64*-*-elf*)
target_cpu_default="${target_cpu_default}|MASK_GNU_LD"
fi
extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o"
- use_fixproto=yes
;;
ia64*-*-freebsd*)
tm_file="${tm_file} dbxelf.h elfos.h ${fbsd_tm_file} ia64/sysv4.h ia64/freebsd.h"
@@ -1336,33 +1326,26 @@ ia64*-*-hpux*)
c_target_objs="ia64-c.o"
cxx_target_objs="ia64-c.o"
extra_options="${extra_options} ia64/ilp32.opt"
- # If we decide to run fixproto we should define FIXPROTO_DEFINES
- # in ia64/t-hpux, and also fix the definition of putenv in
- # sys-protos.h (const char not char).
;;
iq2000*-*-elf*)
tm_file="svr4.h elfos.h iq2000/iq2000.h"
tmake_file=iq2000/t-iq2000
out_file=iq2000/iq2000.c
md_file=iq2000/iq2000.md
- use_fixproto=yes
;;
m32r-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
extra_parts="crtinit.o crtfini.o"
- use_fixproto=yes
;;
m32rle-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h m32r/little.h ${tm_file}"
extra_parts="crtinit.o crtfini.o m32rx/crtinit.o m32rx/crtfini.o"
- use_fixproto=yes
;;
m32r-*-linux*)
tm_file="dbxelf.h elfos.h svr4.h linux.h ${tm_file} m32r/linux.h"
# We override the tmake_file for linux -- why?
tmake_file="t-slibgcc-elf-ver m32r/t-linux"
gnu_ld=yes
- use_fixproto=yes
if test x$enable_threads = xyes; then
thread_file='posix'
fi
@@ -1372,7 +1355,6 @@ m32rle-*-linux*)
# We override the tmake_file for linux -- why?
tmake_file="t-slibgcc-elf-ver m32r/t-linux"
gnu_ld=yes
- use_fixproto=yes
if test x$enable_threads = xyes; then
thread_file='posix'
fi
@@ -1384,7 +1366,6 @@ m68hc11-*-*|m6811-*-*)
md_file="m68hc11/m68hc11.md"
out_file="m68hc11/m68hc11.c"
tmake_file="m68hc11/t-m68hc11"
- use_fixproto=yes
;;
m68hc12-*-*|m6812-*-*)
tm_file="m68hc11/m68hc12.h dbxelf.h elfos.h usegas.h m68hc11/m68hc11.h"
@@ -1393,7 +1374,6 @@ m68hc12-*-*|m6812-*-*)
out_file="m68hc11/m68hc11.c"
tmake_file="m68hc11/t-m68hc11"
extra_options="${extra_options} m68hc11/m68hc11.opt"
- use_fixproto=yes
;;
m68k-*-aout*)
default_m68k_cpu=68020
@@ -1407,7 +1387,6 @@ m68k-*-coff*)
tmake_file="m68k/t-floatlib m68k/t-m68kbare m68k/t-mlibs"
tm_defines="${tm_defines} MOTOROLA=1"
tm_file="${tm_file} m68k/m68k-none.h m68k/m68kemb.h dbxcoff.h m68k/coff.h dbx.h"
- use_fixproto=yes
;;
m68k-*-elf* | fido-*-elf*)
case ${target} in
@@ -1465,7 +1444,6 @@ m68k-*-uclinuxoldabi*) # Motorola m68k/ColdFire running uClinux
tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/uclinux-oldabi.h"
tm_defines="${tm_defines} MOTOROLA=1"
tmake_file="m68k/t-floatlib m68k/t-uclinux"
- use_fixproto=no
;;
m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux
# with uClibc, using the new GNU/Linux-style
@@ -1476,7 +1454,6 @@ m68k-*-uclinux*) # Motorola m68k/ColdFire running uClinux
tm_defines="${tm_defines} MOTOROLA=1 UCLIBC_DEFAULT=1"
extra_options="${extra_options} linux.opt"
tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs"
- use_fixproto=no
;;
m68k-*-linux*) # Motorola m68k's running GNU/Linux
# with ELF format using glibc 2
@@ -1503,13 +1480,11 @@ m68k-*-rtems*)
mcore-*-elf)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file} mcore/mcore-elf.h"
tmake_file=mcore/t-mcore
- use_fixproto=yes
inhibit_libc=true
;;
mcore-*-pe*)
tm_file="svr3.h dbxcoff.h ${tm_file} mcore/mcore-pe.h"
tmake_file=mcore/t-mcore-pe
- use_fixproto=yes
inhibit_libc=true
;;
mips-sgi-irix[56]*)
@@ -1639,38 +1614,32 @@ mipsisa64sr71k-*-elf*)
tmake_file=mips/t-sr71k
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sr71000\\\" MIPS_ABI_DEFAULT=ABI_EABI"
- use_fixproto=yes
;;
mipsisa64sb1-*-elf* | mipsisa64sb1el-*-elf*)
tm_file="elfos.h ${tm_file} mips/elf.h"
tmake_file="mips/t-elf mips/t-libgcc-mips16 mips/t-sb1"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=64 MIPS_CPU_STRING_DEFAULT=\\\"sb1\\\" MIPS_ABI_DEFAULT=ABI_O64"
- use_fixproto=yes
;;
mips-*-elf* | mipsel-*-elf*)
tm_file="elfos.h ${tm_file} mips/elf.h"
tmake_file="mips/t-elf mips/t-libgcc-mips16"
- use_fixproto=yes
;;
mips64-*-elf* | mips64el-*-elf*)
tm_file="elfos.h ${tm_file} mips/elf.h"
tmake_file="mips/t-elf mips/t-libgcc-mips16"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
- use_fixproto=yes
;;
mips64vr-*-elf* | mips64vrel-*-elf*)
tm_file="mips/vr.h elfos.h ${tm_file} mips/elf.h"
tmake_file=mips/t-vr
- use_fixproto=yes
;;
mips64orion-*-elf* | mips64orionel-*-elf*)
tm_file="elfos.h ${tm_file} mips/elforion.h mips/elf.h"
tmake_file="mips/t-elf mips/t-libgcc-mips16"
target_cpu_default="MASK_64BIT|MASK_FLOAT64"
tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_O64"
- use_fixproto=yes
;;
mips*-*-rtems*)
tm_file="elfos.h ${tm_file} mips/elf.h mips/rtems.h rtems.h"
@@ -1683,7 +1652,6 @@ mips-wrs-vxworks)
mipstx39-*-elf* | mipstx39el-*-elf*)
tm_file="elfos.h ${tm_file} mips/r3900.h mips/elf.h"
tmake_file="mips/t-r3900 mips/t-libgcc-mips16"
- use_fixproto=yes
;;
mmix-knuth-mmixware)
need_64bit_hwint=yes
@@ -1695,14 +1663,12 @@ mn10300-*-*)
tm_file="${tm_file} dbx.h"
fi
use_collect2=no
- use_fixproto=yes
;;
pdp11-*-bsd)
tm_file="${tm_file} pdp11/2bsd.h"
use_fixproto=yes
;;
pdp11-*-*)
- use_fixproto=yes
;;
# port not yet contributed
#powerpc-*-openbsd*)
@@ -1776,7 +1742,6 @@ powerpc-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
- use_fixproto=yes
;;
powerpc-*-eabialtivec*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.h rs6000/eabialtivec.h"
@@ -1875,7 +1840,6 @@ powerpcle-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h"
tmake_file="rs6000/t-fprules rs6000/t-fprules-fpbit rs6000/t-ppcgas rs6000/t-ppccomm"
extra_options="${extra_options} rs6000/sysv4.opt"
- use_fixproto=yes
;;
powerpcle-*-eabisim*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/sysv4le.h rs6000/eabi.h rs6000/e500.h rs6000/eabisim.h"
@@ -2127,7 +2091,6 @@ sh-*-symbianelf* | sh[12346l]*-*-symbianelf* | \
if test x${enable_incomplete_targets} = xyes ; then
tm_defines="$tm_defines SUPPORT_SH1=1 SUPPORT_SH2E=1 SUPPORT_SH4=1 SUPPORT_SH4_SINGLE=1 SUPPORT_SH2A=1 SUPPORT_SH2A_SINGLE=1 SUPPORT_SH5_32MEDIA=1 SUPPORT_SH5_32MEDIA_NOFPU=1 SUPPORT_SH5_64MEDIA=1 SUPPORT_SH5_64MEDIA_NOFPU=1"
fi
- use_fixproto=yes
;;
sh-*-rtems*)
tmake_file="sh/t-sh sh/t-elf t-rtems sh/t-rtems"
@@ -2139,7 +2102,6 @@ sh-wrs-vxworks)
;;
sh-*-*)
tm_file="${tm_file} dbxcoff.h sh/coff.h"
- use_fixproto=yes
;;
sparc-*-netbsdelf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h netbsd.h netbsd-elf.h sparc/netbsd-elf.h"
@@ -2155,7 +2117,6 @@ sparc-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/sp-elf.h"
tmake_file="sparc/t-elf sparc/t-crtfm"
extra_parts="crti.o crtn.o crtbegin.o crtend.o"
- use_fixproto=yes
;;
sparc-*-linux*) # SPARC's running GNU/Linux, libc6
tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h linux.h"
@@ -2258,7 +2219,6 @@ sparc64-*-elf*)
extra_options="${extra_options} sparc/little-endian.opt"
tmake_file="${tmake_file} sparc/t-crtfm"
extra_parts="crtbegin.o crtend.o"
- use_fixproto=yes
;;
sparc64-*-freebsd*|ultrasparc-*-freebsd*)
tm_file="${tm_file} ${fbsd_tm_file} dbxelf.h elfos.h sparc/sysv4.h sparc/freebsd.h"
@@ -2304,7 +2264,6 @@ v850e1-*-*)
use_collect2=no
c_target_objs="v850-c.o"
cxx_target_objs="v850-c.o"
- use_fixproto=yes
;;
v850e-*-*)
target_cpu_default="TARGET_CPU_v850e"
@@ -2321,7 +2280,6 @@ v850e-*-*)
use_collect2=no
c_target_objs="v850-c.o"
cxx_target_objs="v850-c.o"
- use_fixproto=yes
;;
v850-*-*)
target_cpu_default="TARGET_CPU_generic"
@@ -2334,7 +2292,6 @@ v850-*-*)
use_collect2=no
c_target_objs="v850-c.o"
cxx_target_objs="v850-c.o"
- use_fixproto=yes
;;
vax-*-netbsdelf*)
tm_file="${tm_file} elfos.h netbsd.h netbsd-elf.h vax/elf.h vax/netbsd-elf.h"
@@ -2358,7 +2315,6 @@ xstormy16-*-elf)
extra_options=stormy16/stormy16.opt
tmake_file="stormy16/t-stormy16"
extra_parts="crtbegin.o crtend.o"
- use_fixproto=yes
;;
xtensa-*-elf*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h xtensa/elf.h"
@@ -2379,7 +2335,6 @@ m32c-*-elf*)
tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
c_target_objs="m32c-pragma.o"
cxx_target_objs="m32c-pragma.o"
- use_fixproto=yes
;;
*)
echo "*** Configuration ${target} not supported" 1>&2
@@ -2537,6 +2492,23 @@ if test x$with_cpu = x ; then
with_cpu="`echo ${target} | sed 's/-.*$//'`"
;;
esac
+
+ # Avoid overriding --with-cpu-32 and --with-cpu-64 values.
+ case ${target} in
+ i[34567]86-*-*|x86_64-*-*)
+ if test x$with_cpu != x; then
+ if test x$with_cpu_32 != x || test x$with_cpu_64 != x; then
+ if test x$with_cpu_32 = x; then
+ with_cpu_32=$with_cpu
+ fi
+ if test x$with_cpu_64 = x; then
+ with_cpu_64=$with_cpu
+ fi
+ with_cpu=
+ fi
+ fi
+ ;;
+ esac
fi
# Similarly for --with-schedule.
@@ -2738,8 +2710,8 @@ case "${target}" in
;;
i[34567]86-*-* | x86_64-*-*)
- supported_defaults="arch cpu tune"
- for which in arch cpu tune; do
+ supported_defaults="arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
+ for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
eval "val=\$with_$which"
case ${val} in
i386 | i486 \
@@ -2750,8 +2722,14 @@ case "${target}" in
| prescott | pentium-m | pentium4m | pentium3m)
case "${target}" in
x86_64-*-*)
- echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2
- exit 1
+ case "x$which" in
+ *_32)
+ ;;
+ *)
+ echo "CPU given in --with-$which=$val doesn't support 64bit mode." 1>&2
+ exit 1
+ ;;
+ esac
;;
esac
# OK
@@ -3059,7 +3037,7 @@ case ${target} in
esac
t=
-all_defaults="abi cpu arch tune schedule float mode fpu divide llsc"
+all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc"
for option in $all_defaults
do
eval "val=\$with_$option"
diff --git a/gcc/config/arm/bpabi-v6m.S b/gcc/config/arm/bpabi-v6m.S
index fa3b9c41478..3a20227499b 100644
--- a/gcc/config/arm/bpabi-v6m.S
+++ b/gcc/config/arm/bpabi-v6m.S
@@ -27,18 +27,6 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-#ifdef __ARMEB__
-#define xxh r0
-#define xxl r1
-#define yyh r2
-#define yyl r3
-#else
-#define xxh r1
-#define xxl r0
-#define yyh r3
-#define yyl r2
-#endif
-
#ifdef L_aeabi_lcmp
FUNC_START aeabi_lcmp
diff --git a/gcc/config/arm/bpabi.S b/gcc/config/arm/bpabi.S
index 1f083465980..82ca140a6bc 100644
--- a/gcc/config/arm/bpabi.S
+++ b/gcc/config/arm/bpabi.S
@@ -27,18 +27,6 @@
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
-#ifdef __ARMEB__
-#define xxh r0
-#define xxl r1
-#define yyh r2
-#define yyl r3
-#else
-#define xxh r1
-#define xxl r0
-#define yyh r3
-#define yyl r2
-#endif
-
#ifdef L_aeabi_lcmp
ARM_FUNC_START aeabi_lcmp
diff --git a/gcc/config/arm/lib1funcs.asm b/gcc/config/arm/lib1funcs.asm
index 2fc66be80d5..fe315bcb69b 100644
--- a/gcc/config/arm/lib1funcs.asm
+++ b/gcc/config/arm/lib1funcs.asm
@@ -406,6 +406,18 @@ SYM (__\name):
.endm
#endif
+#ifdef __ARMEB__
+#define xxh r0
+#define xxl r1
+#define yyh r2
+#define yyl r3
+#else
+#define xxh r1
+#define xxl r0
+#define yyh r3
+#define yyl r2
+#endif
+
#ifdef __thumb__
/* Register aliases. */
@@ -1212,6 +1224,120 @@ LSYM(Lover12):
#endif /* __symbian__ */
+#if ((__ARM_ARCH__ > 5) && !defined(__ARM_ARCH_6M__)) \
+ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
+ || defined(__ARM_ARCH_5TEJ__)
+#define HAVE_ARM_CLZ 1
+#endif
+
+#ifdef L_clzsi2
+#if defined(__ARM_ARCH_6M__)
+FUNC_START clzsi2
+ mov r1, #28
+ mov r3, #1
+ lsl r3, r3, #16
+ cmp r0, r3 /* 0x10000 */
+ bcc 2f
+ lsr r0, r0, #16
+ sub r1, r1, #16
+2: lsr r3, r3, #8
+ cmp r0, r3 /* #0x100 */
+ bcc 2f
+ lsr r0, r0, #8
+ sub r1, r1, #8
+2: lsr r3, r3, #4
+ cmp r0, r3 /* #0x10 */
+ bcc 2f
+ lsr r0, r0, #4
+ sub r1, r1, #4
+2: adr r2, 1f
+ ldrb r0, [r2, r0]
+ add r0, r0, r1
+ bx lr
+.align 2
+1:
+.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
+ FUNC_END clzsi2
+#else
+ARM_FUNC_START clzsi2
+# if defined(HAVE_ARM_CLZ)
+ clz r0, r0
+ RET
+# else
+ mov r1, #28
+ cmp r0, #0x10000
+ do_it cs, t
+ movcs r0, r0, lsr #16
+ subcs r1, r1, #16
+ cmp r0, #0x100
+ do_it cs, t
+ movcs r0, r0, lsr #8
+ subcs r1, r1, #8
+ cmp r0, #0x10
+ do_it cs, t
+ movcs r0, r0, lsr #4
+ subcs r1, r1, #4
+ adr r2, 1f
+ ldrb r0, [r2, r0]
+ add r0, r0, r1
+ bx lr
+.align 2
+1:
+.byte 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0
+# endif /* !HAVE_ARM_CLZ */
+ FUNC_END clzsi2
+#endif
+#endif /* L_clzsi2 */
+
+#ifdef L_clzdi2
+#if !defined(HAVE_ARM_CLZ)
+
+# if defined(__ARM_ARCH_6M__)
+FUNC_START clzdi2
+ push {r4, lr}
+# else
+ARM_FUNC_START clzdi2
+ do_push {r4, lr}
+# endif
+ cmp xxh, #0
+ bne 1f
+# ifdef __ARMEB__
+ mov r0, xxl
+ bl __clzsi2
+ add r0, r0, #32
+ b 2f
+1:
+ bl __clzsi2
+# else
+ bl __clzsi2
+ add r0, r0, #32
+ b 2f
+1:
+ mov r0, xxh
+ bl __clzsi2
+# endif
+2:
+# if defined(__ARM_ARCH_6M__)
+ pop {r4, pc}
+# else
+ RETLDM r4
+# endif
+ FUNC_END clzdi2
+
+#else /* HAVE_ARM_CLZ */
+
+ARM_FUNC_START clzdi2
+ cmp xxh, #0
+ do_it eq, et
+ clzeq r0, xxl
+ clzne r0, xxh
+ addeq r0, r0, #32
+ RET
+ FUNC_END clzdi2
+
+#endif
+#endif /* L_clzdi2 */
+
/* ------------------------------------------------------------------------ */
/* These next two sections are here despite the fact that they contain Thumb
assembler because their presence allows interworked code to be linked even
diff --git a/gcc/config/arm/t-arm-coff b/gcc/config/arm/t-arm-coff
index 763add31dac..4fa1929bb4b 100644
--- a/gcc/config/arm/t-arm-coff
+++ b/gcc/config/arm/t-arm-coff
@@ -1,5 +1,5 @@
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
diff --git a/gcc/config/arm/t-arm-elf b/gcc/config/arm/t-arm-elf
index 31ba396b433..33462939994 100644
--- a/gcc/config/arm/t-arm-elf
+++ b/gcc/config/arm/t-arm-elf
@@ -10,7 +10,8 @@ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func \
_arm_fixdfsi _arm_fixunsdfsi \
_arm_truncdfsf2 _arm_negsf2 _arm_addsubsf3 _arm_muldivsf3 \
_arm_cmpsf2 _arm_unordsf2 _arm_fixsfsi _arm_fixunssfsi \
- _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf
+ _arm_floatdidf _arm_floatdisf _arm_floatundidf _arm_floatundisf \
+ _clzsi2 _clzdi2
MULTILIB_OPTIONS = marm/mthumb
MULTILIB_DIRNAMES = arm thumb
diff --git a/gcc/config/arm/t-linux b/gcc/config/arm/t-linux
index 75da2dd29cd..0e5c0b2501b 100644
--- a/gcc/config/arm/t-linux
+++ b/gcc/config/arm/t-linux
@@ -3,7 +3,7 @@
TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx clzsi2 _clzdi2
# MULTILIB_OPTIONS = mhard-float/msoft-float
# MULTILIB_DIRNAMES = hard-float soft-float
diff --git a/gcc/config/arm/t-pe b/gcc/config/arm/t-pe
index 741e2b85ab7..83c096ced70 100644
--- a/gcc/config/arm/t-pe
+++ b/gcc/config/arm/t-pe
@@ -1,5 +1,5 @@
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
@@ -29,4 +29,4 @@ MULTILIB_DIRNAMES = fpu thumb
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib
-TARGET_LIBGCC2_CFLAGS = \ No newline at end of file
+TARGET_LIBGCC2_CFLAGS =
diff --git a/gcc/config/arm/t-strongarm-elf b/gcc/config/arm/t-strongarm-elf
index c8193548a76..bc076e88a04 100644
--- a/gcc/config/arm/t-strongarm-elf
+++ b/gcc/config/arm/t-strongarm-elf
@@ -1,5 +1,5 @@
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
diff --git a/gcc/config/arm/t-symbian b/gcc/config/arm/t-symbian
index db891381828..cadbd2236b3 100644
--- a/gcc/config/arm/t-symbian
+++ b/gcc/config/arm/t-symbian
@@ -1,4 +1,4 @@
-LIB1ASMFUNCS = _bb_init_func _call_via_rX _interwork_call_via_rX
+LIB1ASMFUNCS = _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# These functions have __aeabi equivalents and will never be called by GCC.
# By putting them in LIB1ASMFUNCS, we avoid the standard libgcc2.c code being
diff --git a/gcc/config/arm/t-vxworks b/gcc/config/arm/t-vxworks
index 978aa5ef2f5..565b33d6ce9 100644
--- a/gcc/config/arm/t-vxworks
+++ b/gcc/config/arm/t-vxworks
@@ -1,5 +1,5 @@
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _bb_init_func _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
diff --git a/gcc/config/arm/t-wince-pe b/gcc/config/arm/t-wince-pe
index fca9853e75c..84b8170ecdf 100644
--- a/gcc/config/arm/t-wince-pe
+++ b/gcc/config/arm/t-wince-pe
@@ -1,5 +1,5 @@
LIB1ASMSRC = arm/lib1funcs.asm
-LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX
+LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX _interwork_call_via_rX _clzsi2 _clzdi2
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d380065d920..d36b52982be 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6537,7 +6537,7 @@ ix86_compute_frame_layout (struct ix86_frame *frame)
|| (TARGET_64BIT && frame->to_allocate >= (HOST_WIDE_INT) 0x80000000))
frame->save_regs_using_mov = false;
- if (TARGET_RED_ZONE && current_function_sp_is_unchanging
+ if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE && current_function_sp_is_unchanging
&& current_function_is_leaf
&& !ix86_current_function_calls_tls_descriptor)
{
@@ -6780,7 +6780,7 @@ ix86_expand_prologue (void)
avoid doing this if I am going to have to probe the stack since
at least on x86_64 the stack probe can turn into a call that clobbers
a red zone location */
- if (TARGET_RED_ZONE && frame.save_regs_using_mov
+ if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE && frame.save_regs_using_mov
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT))
ix86_emit_save_regs_using_mov (frame_pointer_needed ? hard_frame_pointer_rtx
: stack_pointer_rtx,
@@ -6838,7 +6838,7 @@ ix86_expand_prologue (void)
}
if (frame.save_regs_using_mov
- && !(TARGET_RED_ZONE
+ && !(!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE
&& (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)))
{
if (!frame_pointer_needed || !frame.to_allocate)
@@ -23146,7 +23146,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand)
rtx result;
gcc_assert (reload_completed);
- if (TARGET_RED_ZONE)
+ if (!TARGET_64BIT_MS_ABI && TARGET_RED_ZONE)
{
result = gen_rtx_MEM (mode,
gen_rtx_PLUS (Pmode,
@@ -23154,7 +23154,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand)
GEN_INT (-RED_ZONE_SIZE)));
emit_move_insn (result, operand);
}
- else if (!TARGET_RED_ZONE && TARGET_64BIT)
+ else if ((TARGET_64BIT_MS_ABI || !TARGET_RED_ZONE) && TARGET_64BIT)
{
switch (mode)
{
@@ -23221,7 +23221,7 @@ ix86_force_to_memory (enum machine_mode mode, rtx operand)
void
ix86_free_from_memory (enum machine_mode mode)
{
- if (!TARGET_RED_ZONE)
+ if (!TARGET_RED_ZONE || TARGET_64BIT_MS_ABI)
{
int size;
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index 7e5ec353a19..2f0c957cdd5 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -490,13 +490,27 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define HAVE_LOCAL_CPU_DETECT
#endif
+#if TARGET_64BIT_DEFAULT
+#define OPT_ARCH64 "!m32"
+#define OPT_ARCH32 "m32"
+#else
+#define OPT_ARCH64 "m64"
+#define OPT_ARCH32 "!m64"
+#endif
+
/* Support for configure-time defaults of some command line options.
The order here is important so that -march doesn't squash the
tune or cpu values. */
#define OPTION_DEFAULT_SPECS \
{"tune", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \
+ {"tune_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
+ {"tune_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
{"cpu", "%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}" }, \
- {"arch", "%{!march=*:-march=%(VALUE)}"}
+ {"cpu_32", "%{" OPT_ARCH32 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
+ {"cpu_64", "%{" OPT_ARCH64 ":%{!mtune=*:%{!mcpu=*:%{!march=*:-mtune=%(VALUE)}}}}" }, \
+ {"arch", "%{!march=*:-march=%(VALUE)}"}, \
+ {"arch_32", "%{" OPT_ARCH32 ":%{!march=*:-march=%(VALUE)}}"}, \
+ {"arch_64", "%{" OPT_ARCH64 ":%{!march=*:-march=%(VALUE)}}"},
/* Specs for the compiler proper */
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index a1437d29c36..f95e37e9479 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -391,6 +391,9 @@ enum fpu_type m68k_fpu;
/* The set of FL_* flags that apply to the target processor. */
unsigned int m68k_cpu_flags;
+/* The set of FL_* flags that apply to the processor to be tuned for. */
+unsigned int m68k_tune_flags;
+
/* Asm templates for calling or jumping to an arbitrary symbolic address,
or NULL if such calls or jumps are not supported. The address is held
in operand 0. */
@@ -571,13 +574,23 @@ override_options (void)
/* Set the directly-usable versions of the -mcpu and -mtune settings. */
m68k_cpu = entry->device;
if (m68k_tune_entry)
- m68k_tune = m68k_tune_entry->microarch;
+ {
+ m68k_tune = m68k_tune_entry->microarch;
+ m68k_tune_flags = m68k_tune_entry->flags;
+ }
#ifdef M68K_DEFAULT_TUNE
else if (!m68k_cpu_entry && !m68k_arch_entry)
- m68k_tune = M68K_DEFAULT_TUNE;
+ {
+ enum target_device dev;
+ dev = all_microarchs[M68K_DEFAULT_TUNE].device;
+ m68k_tune_flags = all_devices[dev]->flags;
+ }
#endif
else
- m68k_tune = entry->microarch;
+ {
+ m68k_tune = entry->microarch;
+ m68k_tune_flags = entry->flags;
+ }
/* Set the type of FPU. */
m68k_fpu = (!TARGET_HARD_FLOAT ? FPUTYPE_NONE
@@ -2226,13 +2239,18 @@ m68k_rtx_costs (rtx x, int code, int outer_code, int *total)
#define MULL_COST \
(TUNE_68060 ? 2 \
: TUNE_68040 ? 5 \
- : TUNE_CFV2 ? 10 \
+ : (TUNE_CFV2 && TUNE_EMAC) ? 3 \
+ : (TUNE_CFV2 && TUNE_MAC) ? 4 \
+ : TUNE_CFV2 ? 8 \
: TARGET_COLDFIRE ? 3 : 13)
#define MULW_COST \
(TUNE_68060 ? 2 \
: TUNE_68040 ? 3 \
- : TUNE_68000_10 || TUNE_CFV2 ? 5 \
+ : TUNE_68000_10 ? 5 \
+ : (TUNE_CFV2 && TUNE_EMAC) ? 3 \
+ : (TUNE_CFV2 && TUNE_MAC) ? 2 \
+ : TUNE_CFV2 ? 8 \
: TARGET_COLDFIRE ? 2 : 8)
#define DIVW_COST \
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 7a68595a334..2bb725f0423 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -269,6 +269,9 @@ along with GCC; see the file COPYING3. If not see
#define TUNE_CFV3 (m68k_tune == ucfv3)
#define TUNE_CFV4 (m68k_tune == ucfv4 || m68k_tune == ucfv4e)
+#define TUNE_MAC ((m68k_tune_flags & FL_CF_MAC) != 0)
+#define TUNE_EMAC ((m68k_tune_flags & FL_CF_EMAC) != 0)
+
#define OVERRIDE_OPTIONS override_options()
/* These are meant to be redefined in the host dependent files */
@@ -1137,6 +1140,7 @@ extern enum target_device m68k_cpu;
extern enum uarch_type m68k_tune;
extern enum fpu_type m68k_fpu;
extern unsigned int m68k_cpu_flags;
+extern unsigned int m68k_tune_flags;
extern const char *m68k_symbolic_call;
extern const char *m68k_symbolic_jump;
diff --git a/gcc/config/mips/loongson.h b/gcc/config/mips/loongson.h
new file mode 100644
index 00000000000..c742edeeb3f
--- /dev/null
+++ b/gcc/config/mips/loongson.h
@@ -0,0 +1,693 @@
+/* Intrinsics for ST Microelectronics Loongson-2E/2F SIMD operations.
+
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by CodeSourcery.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING. If not, write to the
+ Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* As a special exception, if you include this header file into source
+ files compiled by GCC, this header file does not by itself cause
+ the resulting executable to be covered by the GNU General Public
+ License. This exception does not however invalidate any other
+ reasons why the executable file might be covered by the GNU General
+ Public License. */
+
+#ifndef _GCC_LOONGSON_H
+#define _GCC_LOONGSON_H
+
+#if !defined(__mips_loongson_vector_rev)
+# error "You must select -march=loongson2e or -march=loongson2f to use loongson.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/* Vectors of unsigned bytes, halfwords and words. */
+typedef uint8_t uint8x8_t __attribute__((vector_size (8)));
+typedef uint16_t uint16x4_t __attribute__((vector_size (8)));
+typedef uint32_t uint32x2_t __attribute__((vector_size (8)));
+
+/* Vectors of signed bytes, halfwords and words. */
+typedef int8_t int8x8_t __attribute__((vector_size (8)));
+typedef int16_t int16x4_t __attribute__((vector_size (8)));
+typedef int32_t int32x2_t __attribute__((vector_size (8)));
+
+/* SIMD intrinsics.
+ Unless otherwise noted, calls to the functions below will expand into
+ precisely one machine instruction, modulo any moves required to
+ satisfy register allocation constraints. */
+
+/* Pack with signed saturation. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+packsswh (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_packsswh (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+packsshb (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_packsshb (s, t);
+}
+
+/* Pack with unsigned saturation. */
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+packushb (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_packushb (s, t);
+}
+
+/* Vector addition, treating overflow by wraparound. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+paddw_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_paddw_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+paddh_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_paddh_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+paddb_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_paddb_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+paddw_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_paddw_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+paddh_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_paddh_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+paddb_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_paddb_s (s, t);
+}
+
+/* Addition of doubleword integers, treating overflow by wraparound. */
+__extension__ static __inline uint64_t __attribute__ ((__always_inline__))
+paddd_u (uint64_t s, uint64_t t)
+{
+ return __builtin_loongson_paddd_u (s, t);
+}
+
+__extension__ static __inline int64_t __attribute__ ((__always_inline__))
+paddd_s (int64_t s, int64_t t)
+{
+ return __builtin_loongson_paddd_s (s, t);
+}
+
+/* Vector addition, treating overflow by signed saturation. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+paddsh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_paddsh (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+paddsb (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_paddsb (s, t);
+}
+
+/* Vector addition, treating overflow by unsigned saturation. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+paddush (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_paddush (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+paddusb (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_paddusb (s, t);
+}
+
+/* Logical AND NOT. */
+__extension__ static __inline uint64_t __attribute__ ((__always_inline__))
+pandn_ud (uint64_t s, uint64_t t)
+{
+ return __builtin_loongson_pandn_ud (s, t);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+pandn_uw (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_pandn_uw (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pandn_uh (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pandn_uh (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pandn_ub (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pandn_ub (s, t);
+}
+
+__extension__ static __inline int64_t __attribute__ ((__always_inline__))
+pandn_sd (int64_t s, int64_t t)
+{
+ return __builtin_loongson_pandn_sd (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+pandn_sw (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_pandn_sw (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pandn_sh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pandn_sh (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+pandn_sb (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_pandn_sb (s, t);
+}
+
+/* Average. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pavgh (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pavgh (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pavgb (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pavgb (s, t);
+}
+
+/* Equality test. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+pcmpeqw_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_pcmpeqw_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pcmpeqh_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pcmpeqh_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pcmpeqb_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pcmpeqb_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+pcmpeqw_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_pcmpeqw_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pcmpeqh_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pcmpeqh_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+pcmpeqb_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_pcmpeqb_s (s, t);
+}
+
+/* Greater-than test. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+pcmpgtw_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_pcmpgtw_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pcmpgth_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pcmpgth_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pcmpgtb_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pcmpgtb_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+pcmpgtw_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_pcmpgtw_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pcmpgth_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pcmpgth_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+pcmpgtb_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_pcmpgtb_s (s, t);
+}
+
+/* Extract halfword. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pextrh_u (uint16x4_t s, int field /* 0--3 */)
+{
+ return __builtin_loongson_pextrh_u (s, field);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pextrh_s (int16x4_t s, int field /* 0--3 */)
+{
+ return __builtin_loongson_pextrh_s (s, field);
+}
+
+/* Insert halfword. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pinsrh_0_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pinsrh_0_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pinsrh_1_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pinsrh_1_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pinsrh_2_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pinsrh_2_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pinsrh_3_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pinsrh_3_u (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pinsrh_0_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pinsrh_0_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pinsrh_1_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pinsrh_1_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pinsrh_2_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pinsrh_2_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pinsrh_3_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pinsrh_3_s (s, t);
+}
+
+/* Multiply and add. */
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+pmaddhw (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pmaddhw (s, t);
+}
+
+/* Maximum of signed halfwords. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pmaxsh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pmaxsh (s, t);
+}
+
+/* Maximum of unsigned bytes. */
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pmaxub (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pmaxub (s, t);
+}
+
+/* Minimum of signed halfwords. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pminsh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pminsh (s, t);
+}
+
+/* Minimum of unsigned bytes. */
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pminub (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pminub (s, t);
+}
+
+/* Move byte mask. */
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pmovmskb_u (uint8x8_t s)
+{
+ return __builtin_loongson_pmovmskb_u (s);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+pmovmskb_s (int8x8_t s)
+{
+ return __builtin_loongson_pmovmskb_s (s);
+}
+
+/* Multiply unsigned integers and store high result. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pmulhuh (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_pmulhuh (s, t);
+}
+
+/* Multiply signed integers and store high result. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pmulhh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pmulhh (s, t);
+}
+
+/* Multiply signed integers and store low result. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pmullh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_pmullh (s, t);
+}
+
+/* Multiply unsigned word integers. */
+__extension__ static __inline int64_t __attribute__ ((__always_inline__))
+pmuluw (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_pmuluw (s, t);
+}
+
+/* Absolute difference. */
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+pasubub (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_pasubub (s, t);
+}
+
+/* Sum of unsigned byte integers. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+biadd (uint8x8_t s)
+{
+ return __builtin_loongson_biadd (s);
+}
+
+/* Sum of absolute differences.
+ Note that this intrinsic expands into two machine instructions:
+ PASUBUB followed by BIADD. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psadbh (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_psadbh (s, t);
+}
+
+/* Shuffle halfwords. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order)
+{
+ return __builtin_loongson_pshufh_u (dest, s, order);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order)
+{
+ return __builtin_loongson_pshufh_s (dest, s, order);
+}
+
+/* Shift left logical. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psllh_u (uint16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psllh_u (s, amount);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+psllh_s (int16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psllh_s (s, amount);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+psllw_u (uint32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psllw_u (s, amount);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+psllw_s (int32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psllw_s (s, amount);
+}
+
+/* Shift right logical. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psrlh_u (uint16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrlh_u (s, amount);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+psrlh_s (int16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrlh_s (s, amount);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+psrlw_u (uint32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrlw_u (s, amount);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+psrlw_s (int32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrlw_s (s, amount);
+}
+
+/* Shift right arithmetic. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psrah_u (uint16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrah_u (s, amount);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+psrah_s (int16x4_t s, uint8_t amount)
+{
+ return __builtin_loongson_psrah_s (s, amount);
+}
+
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+psraw_u (uint32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psraw_u (s, amount);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+psraw_s (int32x2_t s, uint8_t amount)
+{
+ return __builtin_loongson_psraw_s (s, amount);
+}
+
+/* Vector subtraction, treating overflow by wraparound. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+psubw_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_psubw_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psubh_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_psubh_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+psubb_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_psubb_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+psubw_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_psubw_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+psubh_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_psubh_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+psubb_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_psubb_s (s, t);
+}
+
+/* Subtraction of doubleword integers, treating overflow by wraparound. */
+__extension__ static __inline uint64_t __attribute__ ((__always_inline__))
+psubd_u (uint64_t s, uint64_t t)
+{
+ return __builtin_loongson_psubd_u (s, t);
+}
+
+__extension__ static __inline int64_t __attribute__ ((__always_inline__))
+psubd_s (int64_t s, int64_t t)
+{
+ return __builtin_loongson_psubd_s (s, t);
+}
+
+/* Vector subtraction, treating overflow by signed saturation. */
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+psubsh (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_psubsh (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+psubsb (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_psubsb (s, t);
+}
+
+/* Vector subtraction, treating overflow by unsigned saturation. */
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+psubush (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_psubush (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+psubusb (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_psubusb (s, t);
+}
+
+/* Unpack high data. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+punpckhwd_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_punpckhwd_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+punpckhhw_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_punpckhhw_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+punpckhbh_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_punpckhbh_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+punpckhwd_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_punpckhwd_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+punpckhhw_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_punpckhhw_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+punpckhbh_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_punpckhbh_s (s, t);
+}
+
+/* Unpack low data. */
+__extension__ static __inline uint32x2_t __attribute__ ((__always_inline__))
+punpcklwd_u (uint32x2_t s, uint32x2_t t)
+{
+ return __builtin_loongson_punpcklwd_u (s, t);
+}
+
+__extension__ static __inline uint16x4_t __attribute__ ((__always_inline__))
+punpcklhw_u (uint16x4_t s, uint16x4_t t)
+{
+ return __builtin_loongson_punpcklhw_u (s, t);
+}
+
+__extension__ static __inline uint8x8_t __attribute__ ((__always_inline__))
+punpcklbh_u (uint8x8_t s, uint8x8_t t)
+{
+ return __builtin_loongson_punpcklbh_u (s, t);
+}
+
+__extension__ static __inline int32x2_t __attribute__ ((__always_inline__))
+punpcklwd_s (int32x2_t s, int32x2_t t)
+{
+ return __builtin_loongson_punpcklwd_s (s, t);
+}
+
+__extension__ static __inline int16x4_t __attribute__ ((__always_inline__))
+punpcklhw_s (int16x4_t s, int16x4_t t)
+{
+ return __builtin_loongson_punpcklhw_s (s, t);
+}
+
+__extension__ static __inline int8x8_t __attribute__ ((__always_inline__))
+punpcklbh_s (int8x8_t s, int8x8_t t)
+{
+ return __builtin_loongson_punpcklbh_s (s, t);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gcc/config/mips/loongson.md b/gcc/config/mips/loongson.md
new file mode 100644
index 00000000000..73d183ac95c
--- /dev/null
+++ b/gcc/config/mips/loongson.md
@@ -0,0 +1,475 @@
+;; Machine description for ST Microelectronics Loongson-2E/2F.
+;; Copyright (C) 2008 Free Software Foundation, Inc.
+;; Contributed by CodeSourcery.
+;;
+;; This file is part of GCC.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Mode iterators and attributes.
+
+;; 64-bit vectors of bytes.
+(define_mode_iterator VB [V8QI])
+
+;; 64-bit vectors of halfwords.
+(define_mode_iterator VH [V4HI])
+
+;; 64-bit vectors of words.
+(define_mode_iterator VW [V2SI])
+
+;; 64-bit vectors of halfwords and bytes.
+(define_mode_iterator VHB [V4HI V8QI])
+
+;; 64-bit vectors of words and halfwords.
+(define_mode_iterator VWH [V2SI V4HI])
+
+;; 64-bit vectors of words, halfwords and bytes.
+(define_mode_iterator VWHB [V2SI V4HI V8QI])
+
+;; 64-bit vectors of words, halfwords and bytes; and DImode.
+(define_mode_iterator VWHBDI [V2SI V4HI V8QI DI])
+
+;; The Loongson instruction suffixes corresponding to the modes in the
+;; VWHBDI iterator.
+(define_mode_attr V_suffix [(V2SI "w") (V4HI "h") (V8QI "b") (DI "d")])
+
+;; Given a vector type T, the mode of a vector half the size of T
+;; and with the same number of elements.
+(define_mode_attr V_squash [(V2SI "V2HI") (V4HI "V4QI")])
+
+;; Given a vector type T, the mode of a vector the same size as T
+;; but with half as many elements.
+(define_mode_attr V_stretch_half [(V2SI "DI") (V4HI "V2SI") (V8QI "V4HI")])
+
+;; The Loongson instruction suffixes corresponding to the transformation
+;; expressed by V_stretch_half.
+(define_mode_attr V_stretch_half_suffix [(V2SI "wd") (V4HI "hw") (V8QI "bh")])
+
+;; Given a vector type T, the mode of a vector the same size as T
+;; but with twice as many elements.
+(define_mode_attr V_squash_double [(V2SI "V4HI") (V4HI "V8QI")])
+
+;; The Loongson instruction suffixes corresponding to the conversions
+;; specified by V_half_width.
+(define_mode_attr V_squash_double_suffix [(V2SI "wh") (V4HI "hb")])
+
+;; Move patterns.
+
+;; Expander to legitimize moves involving values of vector modes.
+(define_expand "mov<mode>"
+ [(set (match_operand:VWHB 0)
+ (match_operand:VWHB 1))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+{
+ if (mips_legitimize_move (<MODE>mode, operands[0], operands[1]))
+ DONE;
+})
+
+;; Handle legitimized moves between values of vector modes.
+(define_insn "mov<mode>_internal"
+ [(set (match_operand:VWHB 0 "nonimmediate_operand" "=m,f,d,f, d, m, d")
+ (match_operand:VWHB 1 "move_operand" "f,m,f,dYG,dYG,dYG,m"))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ { return mips_output_move (operands[0], operands[1]); }
+ [(set_attr "type" "fpstore,fpload,mfc,mtc,move,store,load")
+ (set_attr "mode" "DI")])
+
+;; Initialization of a vector.
+
+(define_expand "vec_init<mode>"
+ [(set (match_operand:VWHB 0 "register_operand")
+ (match_operand 1 ""))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+{
+ mips_expand_vector_init (operands[0], operands[1]);
+ DONE;
+})
+
+;; Instruction patterns for SIMD instructions.
+
+;; Pack with signed saturation.
+(define_insn "vec_pack_ssat_<mode>"
+ [(set (match_operand:<V_squash_double> 0 "register_operand" "=f")
+ (vec_concat:<V_squash_double>
+ (ss_truncate:<V_squash>
+ (match_operand:VWH 1 "register_operand" "f"))
+ (ss_truncate:<V_squash>
+ (match_operand:VWH 2 "register_operand" "f"))))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "packss<V_squash_double_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Pack with unsigned saturation.
+(define_insn "vec_pack_usat_<mode>"
+ [(set (match_operand:<V_squash_double> 0 "register_operand" "=f")
+ (vec_concat:<V_squash_double>
+ (us_truncate:<V_squash>
+ (match_operand:VH 1 "register_operand" "f"))
+ (us_truncate:<V_squash>
+ (match_operand:VH 2 "register_operand" "f"))))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "packus<V_squash_double_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Addition, treating overflow by wraparound.
+(define_insn "add<mode>3"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (plus:VWHB (match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "padd<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Addition of doubleword integers stored in FP registers.
+;; Overflow is treated by wraparound.
+;; We use 'unspec' instead of 'plus' here to avoid clash with
+;; mips.md::add<mode>3. If 'plus' was used, then such instruction
+;; would be recognized as adddi3 and reload would make it use
+;; GPRs instead of FPRs.
+(define_insn "loongson_paddd"
+ [(set (match_operand:DI 0 "register_operand" "=f")
+ (unspec:DI [(match_operand:DI 1 "register_operand" "f")
+ (match_operand:DI 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PADDD))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "paddd\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Addition, treating overflow by signed saturation.
+(define_insn "ssadd<mode>3"
+ [(set (match_operand:VHB 0 "register_operand" "=f")
+ (ss_plus:VHB (match_operand:VHB 1 "register_operand" "f")
+ (match_operand:VHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "padds<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Addition, treating overflow by unsigned saturation.
+(define_insn "usadd<mode>3"
+ [(set (match_operand:VHB 0 "register_operand" "=f")
+ (us_plus:VHB (match_operand:VHB 1 "register_operand" "f")
+ (match_operand:VHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "paddus<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Logical AND NOT.
+(define_insn "loongson_pandn_<V_suffix>"
+ [(set (match_operand:VWHBDI 0 "register_operand" "=f")
+ (and:VWHBDI
+ (not:VWHBDI (match_operand:VWHBDI 1 "register_operand" "f"))
+ (match_operand:VWHBDI 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pandn\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Average.
+(define_insn "loongson_pavg<V_suffix>"
+ [(set (match_operand:VHB 0 "register_operand" "=f")
+ (unspec:VHB [(match_operand:VHB 1 "register_operand" "f")
+ (match_operand:VHB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PAVG))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pavg<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Equality test.
+(define_insn "loongson_pcmpeq<V_suffix>"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PCMPEQ))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pcmpeq<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Greater-than test.
+(define_insn "loongson_pcmpgt<V_suffix>"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PCMPGT))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pcmpgt<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Extract halfword.
+(define_insn "loongson_pextr<V_suffix>"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:SI 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PEXTR))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pextr<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Insert halfword.
+(define_insn "loongson_pinsr<V_suffix>_0"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PINSR_0))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pinsr<V_suffix>_0\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+(define_insn "loongson_pinsr<V_suffix>_1"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PINSR_1))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pinsr<V_suffix>_1\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+(define_insn "loongson_pinsr<V_suffix>_2"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PINSR_2))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pinsr<V_suffix>_2\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+(define_insn "loongson_pinsr<V_suffix>_3"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PINSR_3))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pinsr<V_suffix>_3\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+;; Multiply and add packed integers.
+(define_insn "loongson_pmadd<V_stretch_half_suffix>"
+ [(set (match_operand:<V_stretch_half> 0 "register_operand" "=f")
+ (unspec:<V_stretch_half> [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMADD))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmadd<V_stretch_half_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Maximum of signed halfwords.
+(define_insn "smax<mode>3"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (smax:VH (match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmaxs<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Maximum of unsigned bytes.
+(define_insn "umax<mode>3"
+ [(set (match_operand:VB 0 "register_operand" "=f")
+ (umax:VB (match_operand:VB 1 "register_operand" "f")
+ (match_operand:VB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmaxu<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Minimum of signed halfwords.
+(define_insn "smin<mode>3"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (smin:VH (match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmins<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Minimum of unsigned bytes.
+(define_insn "umin<mode>3"
+ [(set (match_operand:VB 0 "register_operand" "=f")
+ (umin:VB (match_operand:VB 1 "register_operand" "f")
+ (match_operand:VB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pminu<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Move byte mask.
+(define_insn "loongson_pmovmsk<V_suffix>"
+ [(set (match_operand:VB 0 "register_operand" "=f")
+ (unspec:VB [(match_operand:VB 1 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMOVMSK))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmovmsk<V_suffix>\t%0,%1"
+ [(set_attr "type" "fabs")])
+
+;; Multiply unsigned integers and store high result.
+(define_insn "umul<mode>3_highpart"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMULHU))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmulhu<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Multiply signed integers and store high result.
+(define_insn "smul<mode>3_highpart"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMULH))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmulh<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Multiply signed integers and store low result.
+(define_insn "loongson_pmull<V_suffix>"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "f")
+ (match_operand:VH 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMULL))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmull<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Multiply unsigned word integers.
+(define_insn "loongson_pmulu<V_suffix>"
+ [(set (match_operand:DI 0 "register_operand" "=f")
+ (unspec:DI [(match_operand:VW 1 "register_operand" "f")
+ (match_operand:VW 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PMULU))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pmulu<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Absolute difference.
+(define_insn "loongson_pasubub"
+ [(set (match_operand:VB 0 "register_operand" "=f")
+ (unspec:VB [(match_operand:VB 1 "register_operand" "f")
+ (match_operand:VB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PASUBUB))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pasubub\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Sum of unsigned byte integers.
+(define_insn "reduc_uplus_<mode>"
+ [(set (match_operand:<V_stretch_half> 0 "register_operand" "=f")
+ (unspec:<V_stretch_half> [(match_operand:VB 1 "register_operand" "f")]
+ UNSPEC_LOONGSON_BIADD))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "biadd\t%0,%1"
+ [(set_attr "type" "fabs")])
+
+;; Sum of absolute differences.
+(define_insn "loongson_psadbh"
+ [(set (match_operand:<V_stretch_half> 0 "register_operand" "=f")
+ (unspec:<V_stretch_half> [(match_operand:VB 1 "register_operand" "f")
+ (match_operand:VB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PSADBH))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pasubub\t%0,%1,%2;biadd\t%0,%0"
+ [(set_attr "type" "fadd")])
+
+;; Shuffle halfwords.
+(define_insn "loongson_pshufh"
+ [(set (match_operand:VH 0 "register_operand" "=f")
+ (unspec:VH [(match_operand:VH 1 "register_operand" "0")
+ (match_operand:VH 2 "register_operand" "f")
+ (match_operand:SI 3 "register_operand" "f")]
+ UNSPEC_LOONGSON_PSHUFH))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "pshufh\t%0,%2,%3"
+ [(set_attr "type" "fmul")])
+
+;; Shift left logical.
+(define_insn "loongson_psll<V_suffix>"
+ [(set (match_operand:VWH 0 "register_operand" "=f")
+ (ashift:VWH (match_operand:VWH 1 "register_operand" "f")
+ (match_operand:SI 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psll<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fmul")])
+
+;; Shift right arithmetic.
+(define_insn "loongson_psra<V_suffix>"
+ [(set (match_operand:VWH 0 "register_operand" "=f")
+ (ashiftrt:VWH (match_operand:VWH 1 "register_operand" "f")
+ (match_operand:SI 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psra<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+;; Shift right logical.
+(define_insn "loongson_psrl<V_suffix>"
+ [(set (match_operand:VWH 0 "register_operand" "=f")
+ (lshiftrt:VWH (match_operand:VWH 1 "register_operand" "f")
+ (match_operand:SI 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psrl<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+;; Subtraction, treating overflow by wraparound.
+(define_insn "sub<mode>3"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (minus:VWHB (match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psub<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Subtraction of doubleword integers stored in FP registers.
+;; Overflow is treated by wraparound.
+;; See loongson_paddd for the reason we use 'unspec' rather than
+;; 'minus' here.
+(define_insn "loongson_psubd"
+ [(set (match_operand:DI 0 "register_operand" "=f")
+ (unspec:DI [(match_operand:DI 1 "register_operand" "f")
+ (match_operand:DI 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PSUBD))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psubd\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Subtraction, treating overflow by signed saturation.
+(define_insn "sssub<mode>3"
+ [(set (match_operand:VHB 0 "register_operand" "=f")
+ (ss_minus:VHB (match_operand:VHB 1 "register_operand" "f")
+ (match_operand:VHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psubs<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Subtraction, treating overflow by unsigned saturation.
+(define_insn "ussub<mode>3"
+ [(set (match_operand:VHB 0 "register_operand" "=f")
+ (us_minus:VHB (match_operand:VHB 1 "register_operand" "f")
+ (match_operand:VHB 2 "register_operand" "f")))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "psubus<V_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fadd")])
+
+;; Unpack high data.
+(define_insn "vec_interleave_high<mode>"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PUNPCKH))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "punpckh<V_stretch_half_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
+
+;; Unpack low data.
+(define_insn "vec_interleave_low<mode>"
+ [(set (match_operand:VWHB 0 "register_operand" "=f")
+ (unspec:VWHB [(match_operand:VWHB 1 "register_operand" "f")
+ (match_operand:VWHB 2 "register_operand" "f")]
+ UNSPEC_LOONGSON_PUNPCKL))]
+ "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS"
+ "punpckl<V_stretch_half_suffix>\t%0,%1,%2"
+ [(set_attr "type" "fdiv")])
diff --git a/gcc/config/mips/loongson2ef.md b/gcc/config/mips/loongson2ef.md
new file mode 100644
index 00000000000..8d294822102
--- /dev/null
+++ b/gcc/config/mips/loongson2ef.md
@@ -0,0 +1,240 @@
+;; Pipeline model for ST Microelectronics Loongson-2E/2F cores.
+
+;; Copyright (C) 2008 Free Software Foundation, Inc.
+;; Contributed by CodeSourcery.
+;;
+;; GCC is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+;;
+;; GCC is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GCC; see the file COPYING3. If not see
+;; <http://www.gnu.org/licenses/>.
+
+;; Automaton for integer instructions.
+(define_automaton "ls2_alu")
+
+;; ALU1 and ALU2.
+;; We need to query these units to adjust round-robin counter.
+(define_query_cpu_unit "ls2_alu1_core,ls2_alu2_core" "ls2_alu")
+
+;; Pseudo units to help modeling of ALU1/2 round-robin dispatch strategy.
+(define_cpu_unit "ls2_alu1_turn,ls2_alu2_turn" "ls2_alu")
+
+;; Pseudo units to enable/disable ls2_alu[12]_turn units.
+;; ls2_alu[12]_turn unit can be subscribed only after ls2_alu[12]_turn_enabled
+;; unit is subscribed.
+(define_cpu_unit "ls2_alu1_turn_enabled,ls2_alu2_turn_enabled" "ls2_alu")
+(presence_set "ls2_alu1_turn" "ls2_alu1_turn_enabled")
+(presence_set "ls2_alu2_turn" "ls2_alu2_turn_enabled")
+
+;; Reservations for ALU1 (ALU2) instructions.
+;; Instruction goes to ALU1 (ALU2) and makes next ALU1/2 instruction to
+;; be dispatched to ALU2 (ALU1).
+(define_reservation "ls2_alu1"
+ "(ls2_alu1_core+ls2_alu2_turn_enabled)|ls2_alu1_core")
+(define_reservation "ls2_alu2"
+ "(ls2_alu2_core+ls2_alu1_turn_enabled)|ls2_alu2_core")
+
+;; Reservation for ALU1/2 instructions.
+;; Instruction will go to ALU1 iff ls2_alu1_turn_enabled is subscribed and
+;; switch the turn to ALU2 by subscribing ls2_alu2_turn_enabled.
+;; Or to ALU2 otherwise.
+(define_reservation "ls2_alu"
+ "(ls2_alu1_core+ls2_alu1_turn+ls2_alu2_turn_enabled)
+ |(ls2_alu1_core+ls2_alu1_turn)
+ |(ls2_alu2_core+ls2_alu2_turn+ls2_alu1_turn_enabled)
+ |(ls2_alu2_core+ls2_alu2_turn)")
+
+;; Automaton for floating-point instructions.
+(define_automaton "ls2_falu")
+
+;; FALU1 and FALU2.
+;; We need to query these units to adjust round-robin counter.
+(define_query_cpu_unit "ls2_falu1_core,ls2_falu2_core" "ls2_falu")
+
+;; Pseudo units to help modeling of FALU1/2 round-robin dispatch strategy.
+(define_cpu_unit "ls2_falu1_turn,ls2_falu2_turn" "ls2_falu")
+
+;; Pseudo units to enable/disable ls2_falu[12]_turn units.
+;; ls2_falu[12]_turn unit can be subscribed only after
+;; ls2_falu[12]_turn_enabled unit is subscribed.
+(define_cpu_unit "ls2_falu1_turn_enabled,ls2_falu2_turn_enabled" "ls2_falu")
+(presence_set "ls2_falu1_turn" "ls2_falu1_turn_enabled")
+(presence_set "ls2_falu2_turn" "ls2_falu2_turn_enabled")
+
+;; Reservations for FALU1 (FALU2) instructions.
+;; Instruction goes to FALU1 (FALU2) and makes next FALU1/2 instruction to
+;; be dispatched to FALU2 (FALU1).
+(define_reservation "ls2_falu1"
+ "(ls2_falu1_core+ls2_falu2_turn_enabled)|ls2_falu1_core")
+(define_reservation "ls2_falu2"
+ "(ls2_falu2_core+ls2_falu1_turn_enabled)|ls2_falu2_core")
+
+;; Reservation for FALU1/2 instructions.
+;; Instruction will go to FALU1 iff ls2_falu1_turn_enabled is subscribed and
+;; switch the turn to FALU2 by subscribing ls2_falu2_turn_enabled.
+;; Or to FALU2 otherwise.
+(define_reservation "ls2_falu"
+ "(ls2_falu1+ls2_falu1_turn+ls2_falu2_turn_enabled)
+ |(ls2_falu1+ls2_falu1_turn)
+ |(ls2_falu2+ls2_falu2_turn+ls2_falu1_turn_enabled)
+ |(ls2_falu2+ls2_falu2_turn)")
+
+;; The following 4 instructions each subscribe one of
+;; ls2_[f]alu{1,2}_turn_enabled units according to this attribute.
+;; These instructions are used in mips.c: sched_ls2_dfa_post_advance_cycle.
+
+(define_attr "ls2_turn_type" "alu1,alu2,falu1,falu2,unknown"
+ (const_string "unknown"))
+
+;; Subscribe ls2_alu1_turn_enabled.
+(define_insn "ls2_alu1_turn_enabled_insn"
+ [(unspec [(const_int 0)] UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN)]
+ "TUNE_LOONGSON_2EF"
+ { gcc_unreachable (); }
+ [(set_attr "ls2_turn_type" "alu1")])
+
+(define_insn_reservation "ls2_alu1_turn_enabled" 0
+ (eq_attr "ls2_turn_type" "alu1")
+ "ls2_alu1_turn_enabled")
+
+;; Subscribe ls2_alu2_turn_enabled.
+(define_insn "ls2_alu2_turn_enabled_insn"
+ [(unspec [(const_int 0)] UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN)]
+ "TUNE_LOONGSON_2EF"
+ { gcc_unreachable (); }
+ [(set_attr "ls2_turn_type" "alu2")])
+
+(define_insn_reservation "ls2_alu2_turn_enabled" 0
+ (eq_attr "ls2_turn_type" "alu2")
+ "ls2_alu2_turn_enabled")
+
+;; Subscribe ls2_falu1_turn_enabled.
+(define_insn "ls2_falu1_turn_enabled_insn"
+ [(unspec [(const_int 0)] UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN)]
+ "TUNE_LOONGSON_2EF"
+ { gcc_unreachable (); }
+ [(set_attr "ls2_turn_type" "falu1")])
+
+(define_insn_reservation "ls2_falu1_turn_enabled" 0
+ (eq_attr "ls2_turn_type" "falu1")
+ "ls2_falu1_turn_enabled")
+
+;; Subscribe ls2_falu2_turn_enabled.
+(define_insn "ls2_falu2_turn_enabled_insn"
+ [(unspec [(const_int 0)] UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN)]
+ "TUNE_LOONGSON_2EF"
+ { gcc_unreachable (); }
+ [(set_attr "ls2_turn_type" "falu2")])
+
+(define_insn_reservation "ls2_falu2_turn_enabled" 0
+ (eq_attr "ls2_turn_type" "falu2")
+ "ls2_falu2_turn_enabled")
+
+;; Automaton for memory operations.
+(define_automaton "ls2_mem")
+
+;; Memory unit.
+(define_query_cpu_unit "ls2_mem" "ls2_mem")
+
+;; Reservation for integer instructions.
+(define_insn_reservation "ls2_alu" 2
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "arith,condmove,const,logical,mfhilo,move,
+ mthilo,nop,shift,signext,slt"))
+ "ls2_alu")
+
+;; Reservation for branch instructions.
+(define_insn_reservation "ls2_branch" 2
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "branch,jump,call,trap"))
+ "ls2_alu1")
+
+;; Reservation for integer multiplication instructions.
+(define_insn_reservation "ls2_imult" 5
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "imul,imul3"))
+ "ls2_alu2,ls2_alu2_core")
+
+;; Reservation for integer division / remainder instructions.
+;; These instructions use the SRT algorithm and hence take 2-38 cycles.
+(define_insn_reservation "ls2_idiv" 20
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "idiv"))
+ "ls2_alu2,ls2_alu2_core*18")
+
+;; Reservation for memory load instructions.
+(define_insn_reservation "ls2_load" 5
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "load,fpload,mfc,mtc"))
+ "ls2_mem")
+
+;; Reservation for memory store instructions.
+;; With stores we assume they don't alias with dependent loads.
+;; Therefore we set the latency to zero.
+(define_insn_reservation "ls2_store" 0
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "store,fpstore"))
+ "ls2_mem")
+
+;; Reservation for floating-point instructions of latency 3.
+(define_insn_reservation "ls2_fp3" 3
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "fabs,fneg,fcmp,fmove"))
+ "ls2_falu1")
+
+;; Reservation for floating-point instructions of latency 5.
+(define_insn_reservation "ls2_fp5" 5
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "fcvt"))
+ "ls2_falu1")
+
+;; Reservation for floating-point instructions that can go
+;; to either of FALU1/2 units.
+(define_insn_reservation "ls2_falu" 7
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "fadd,fmul,fmadd"))
+ "ls2_falu")
+
+;; Reservation for floating-point division / remainder instructions.
+;; These instructions use the SRT algorithm and hence take a variable amount
+;; of cycles:
+;; div.s takes 5-11 cycles
+;; div.d takes 5-18 cycles
+(define_insn_reservation "ls2_fdiv" 9
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "fdiv"))
+ "ls2_falu2,ls2_falu2_core*7")
+
+;; Reservation for floating-point sqrt instructions.
+;; These instructions use the SRT algorithm and hence take a variable amount
+;; of cycles:
+;; sqrt.s takes 5-17 cycles
+;; sqrt.d takes 5-32 cycles
+(define_insn_reservation "ls2_fsqrt" 15
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "fsqrt"))
+ "ls2_falu2,ls2_falu2_core*13")
+
+;; Two consecutive ALU instructions.
+(define_insn_reservation "ls2_multi" 4
+ (and (eq_attr "cpu" "loongson_2e,loongson_2f")
+ (eq_attr "type" "multi"))
+ "(ls2_alu1,ls2_alu2_core)|(ls2_alu2,ls2_alu1_core)")
+
+;; Reservation for everything else. Normally, this reservation
+;; will only be used to handle cases like compiling for non-loongson
+;; CPUs with -mtune=loongson2?.
+;;
+;; This reservation depends upon the fact that DFA will check
+;; reservations in the same order as they appear in the file.
+(define_insn_reservation "ls2_unknown" 1
+ (eq_attr "cpu" "loongson_2e,loongson_2f")
+ "ls2_alu1_core+ls2_alu2_core+ls2_falu1_core+ls2_falu2_core+ls2_mem")
diff --git a/gcc/config/mips/mips-ftypes.def b/gcc/config/mips/mips-ftypes.def
index 9d46f8c242e..8ae54ebe263 100644
--- a/gcc/config/mips/mips-ftypes.def
+++ b/gcc/config/mips/mips-ftypes.def
@@ -66,6 +66,24 @@ DEF_MIPS_FTYPE (1, (SF, SF))
DEF_MIPS_FTYPE (2, (SF, SF, SF))
DEF_MIPS_FTYPE (1, (SF, V2SF))
+DEF_MIPS_FTYPE (2, (UDI, UDI, UDI))
+DEF_MIPS_FTYPE (2, (UDI, UV2SI, UV2SI))
+
+DEF_MIPS_FTYPE (2, (UV2SI, UV2SI, UQI))
+DEF_MIPS_FTYPE (2, (UV2SI, UV2SI, UV2SI))
+
+DEF_MIPS_FTYPE (2, (UV4HI, UV4HI, UQI))
+DEF_MIPS_FTYPE (2, (UV4HI, UV4HI, USI))
+DEF_MIPS_FTYPE (3, (UV4HI, UV4HI, UV4HI, UQI))
+DEF_MIPS_FTYPE (3, (UV4HI, UV4HI, UV4HI, USI))
+DEF_MIPS_FTYPE (2, (UV4HI, UV4HI, UV4HI))
+DEF_MIPS_FTYPE (1, (UV4HI, UV8QI))
+DEF_MIPS_FTYPE (2, (UV4HI, UV8QI, UV8QI))
+
+DEF_MIPS_FTYPE (2, (UV8QI, UV4HI, UV4HI))
+DEF_MIPS_FTYPE (1, (UV8QI, UV8QI))
+DEF_MIPS_FTYPE (2, (UV8QI, UV8QI, UV8QI))
+
DEF_MIPS_FTYPE (1, (V2HI, SI))
DEF_MIPS_FTYPE (2, (V2HI, SI, SI))
DEF_MIPS_FTYPE (3, (V2HI, SI, SI, SI))
@@ -81,12 +99,27 @@ DEF_MIPS_FTYPE (2, (V2SF, V2SF, V2SF))
DEF_MIPS_FTYPE (3, (V2SF, V2SF, V2SF, INT))
DEF_MIPS_FTYPE (4, (V2SF, V2SF, V2SF, V2SF, V2SF))
+DEF_MIPS_FTYPE (2, (V2SI, V2SI, UQI))
+DEF_MIPS_FTYPE (2, (V2SI, V2SI, V2SI))
+DEF_MIPS_FTYPE (2, (V2SI, V4HI, V4HI))
+
+DEF_MIPS_FTYPE (2, (V4HI, V2SI, V2SI))
+DEF_MIPS_FTYPE (2, (V4HI, V4HI, UQI))
+DEF_MIPS_FTYPE (2, (V4HI, V4HI, USI))
+DEF_MIPS_FTYPE (2, (V4HI, V4HI, V4HI))
+DEF_MIPS_FTYPE (3, (V4HI, V4HI, V4HI, UQI))
+DEF_MIPS_FTYPE (3, (V4HI, V4HI, V4HI, USI))
+
DEF_MIPS_FTYPE (1, (V4QI, SI))
DEF_MIPS_FTYPE (2, (V4QI, V2HI, V2HI))
DEF_MIPS_FTYPE (1, (V4QI, V4QI))
DEF_MIPS_FTYPE (2, (V4QI, V4QI, SI))
DEF_MIPS_FTYPE (2, (V4QI, V4QI, V4QI))
+DEF_MIPS_FTYPE (2, (V8QI, V4HI, V4HI))
+DEF_MIPS_FTYPE (1, (V8QI, V8QI))
+DEF_MIPS_FTYPE (2, (V8QI, V8QI, V8QI))
+
DEF_MIPS_FTYPE (2, (VOID, SI, SI))
DEF_MIPS_FTYPE (2, (VOID, V2HI, V2HI))
DEF_MIPS_FTYPE (2, (VOID, V4QI, V4QI))
diff --git a/gcc/config/mips/mips-modes.def b/gcc/config/mips/mips-modes.def
index 207f6da060b..d1617aed83f 100644
--- a/gcc/config/mips/mips-modes.def
+++ b/gcc/config/mips/mips-modes.def
@@ -26,6 +26,7 @@ RESET_FLOAT_FORMAT (DF, mips_double_format);
FLOAT_MODE (TF, 16, mips_quad_format);
/* Vector modes. */
+VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI */
VECTOR_MODES (FLOAT, 8); /* V4HF V2SF */
VECTOR_MODES (INT, 4); /* V4QI V2HI */
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index 1bf0ee9865d..b79b83a0bcb 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -303,4 +303,6 @@ union mips_gen_fn_ptrs
extern void mips_expand_atomic_qihi (union mips_gen_fn_ptrs,
rtx, rtx, rtx, rtx);
+extern void mips_expand_vector_init (rtx, rtx);
+
#endif /* ! GCC_MIPS_PROTOS_H */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index eddb5a85389..3ef0b331373 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3532,6 +3532,12 @@ mips_split_doubleword_move (rtx dest, rtx src)
emit_insn (gen_move_doubleword_fprdf (dest, src));
else if (!TARGET_64BIT && GET_MODE (dest) == V2SFmode)
emit_insn (gen_move_doubleword_fprv2sf (dest, src));
+ else if (!TARGET_64BIT && GET_MODE (dest) == V2SImode)
+ emit_insn (gen_move_doubleword_fprv2si (dest, src));
+ else if (!TARGET_64BIT && GET_MODE (dest) == V4HImode)
+ emit_insn (gen_move_doubleword_fprv4hi (dest, src));
+ else if (!TARGET_64BIT && GET_MODE (dest) == V8QImode)
+ emit_insn (gen_move_doubleword_fprv8qi (dest, src));
else if (TARGET_64BIT && GET_MODE (dest) == TFmode)
emit_insn (gen_move_doubleword_fprtf (dest, src));
else
@@ -8960,6 +8966,14 @@ mips_hard_regno_mode_ok_p (unsigned int regno, enum machine_mode mode)
if (mode == TFmode && ISA_HAS_8CC)
return true;
+ /* Allow 64-bit vector modes for Loongson-2E/2F. */
+ if (TARGET_LOONGSON_VECTORS
+ && (mode == V2SImode
+ || mode == V4HImode
+ || mode == V8QImode
+ || mode == DImode))
+ return true;
+
if (class == MODE_FLOAT
|| class == MODE_COMPLEX_FLOAT
|| class == MODE_VECTOR_FLOAT)
@@ -9323,6 +9337,11 @@ mips_vector_mode_supported_p (enum machine_mode mode)
case V4UQQmode:
return TARGET_DSP;
+ case V2SImode:
+ case V4HImode:
+ case V8QImode:
+ return TARGET_LOONGSON_VECTORS;
+
default:
return false;
}
@@ -9759,6 +9778,41 @@ mips_store_data_bypass_p (rtx out_insn, rtx in_insn)
return !store_data_bypass_p (out_insn, in_insn);
}
+
+/* Variables and flags used in scheduler hooks when tuning for
+ Loongson 2E/2F. */
+static struct
+{
+ /* Variables to support Loongson 2E/2F round-robin [F]ALU1/2 dispatch
+ strategy. */
+
+ /* If true, then next ALU1/2 instruction will go to ALU1. */
+ bool alu1_turn_p;
+
+ /* If true, then next FALU1/2 unstruction will go to FALU1. */
+ bool falu1_turn_p;
+
+ /* Codes to query if [f]alu{1,2}_core units are subscribed or not. */
+ int alu1_core_unit_code;
+ int alu2_core_unit_code;
+ int falu1_core_unit_code;
+ int falu2_core_unit_code;
+
+ /* True if current cycle has a multi instruction.
+ This flag is used in mips_ls2_dfa_post_advance_cycle. */
+ bool cycle_has_multi_p;
+
+ /* Instructions to subscribe ls2_[f]alu{1,2}_turn_enabled units.
+ These are used in mips_ls2_dfa_post_advance_cycle to initialize
+ DFA state.
+ E.g., when alu1_turn_enabled_insn is issued it makes next ALU1/2
+ instruction to go ALU1. */
+ rtx alu1_turn_enabled_insn;
+ rtx alu2_turn_enabled_insn;
+ rtx falu1_turn_enabled_insn;
+ rtx falu2_turn_enabled_insn;
+} mips_ls2;
+
/* Implement TARGET_SCHED_ADJUST_COST. We assume that anti and output
dependencies have no cost, except on the 20Kc where output-dependence
is treated like input-dependence. */
@@ -9809,11 +9863,124 @@ mips_issue_rate (void)
reach the theoretical max of 4. */
return 3;
+ case PROCESSOR_LOONGSON_2E:
+ case PROCESSOR_LOONGSON_2F:
+ return 4;
+
default:
return 1;
}
}
+/* Implement TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN hook for Loongson2. */
+
+static void
+mips_ls2_init_dfa_post_cycle_insn (void)
+{
+ start_sequence ();
+ emit_insn (gen_ls2_alu1_turn_enabled_insn ());
+ mips_ls2.alu1_turn_enabled_insn = get_insns ();
+ end_sequence ();
+
+ start_sequence ();
+ emit_insn (gen_ls2_alu2_turn_enabled_insn ());
+ mips_ls2.alu2_turn_enabled_insn = get_insns ();
+ end_sequence ();
+
+ start_sequence ();
+ emit_insn (gen_ls2_falu1_turn_enabled_insn ());
+ mips_ls2.falu1_turn_enabled_insn = get_insns ();
+ end_sequence ();
+
+ start_sequence ();
+ emit_insn (gen_ls2_falu2_turn_enabled_insn ());
+ mips_ls2.falu2_turn_enabled_insn = get_insns ();
+ end_sequence ();
+
+ mips_ls2.alu1_core_unit_code = get_cpu_unit_code ("ls2_alu1_core");
+ mips_ls2.alu2_core_unit_code = get_cpu_unit_code ("ls2_alu2_core");
+ mips_ls2.falu1_core_unit_code = get_cpu_unit_code ("ls2_falu1_core");
+ mips_ls2.falu2_core_unit_code = get_cpu_unit_code ("ls2_falu2_core");
+}
+
+/* Implement TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN hook.
+ Init data used in mips_dfa_post_advance_cycle. */
+
+static void
+mips_init_dfa_post_cycle_insn (void)
+{
+ if (TUNE_LOONGSON_2EF)
+ mips_ls2_init_dfa_post_cycle_insn ();
+}
+
+/* Initialize STATE when scheduling for Loongson 2E/2F.
+ Support round-robin dispatch scheme by enabling only one of
+ ALU1/ALU2 and one of FALU1/FALU2 units for ALU1/2 and FALU1/2 instructions
+ respectively. */
+
+static void
+mips_ls2_dfa_post_advance_cycle (state_t state)
+{
+ if (cpu_unit_reservation_p (state, mips_ls2.alu1_core_unit_code))
+ {
+ /* Though there are no non-pipelined ALU1 insns,
+ we can get an instruction of type 'multi' before reload. */
+ gcc_assert (mips_ls2.cycle_has_multi_p);
+ mips_ls2.alu1_turn_p = false;
+ }
+
+ mips_ls2.cycle_has_multi_p = false;
+
+ if (cpu_unit_reservation_p (state, mips_ls2.alu2_core_unit_code))
+ /* We have a non-pipelined alu instruction in the core,
+ adjust round-robin counter. */
+ mips_ls2.alu1_turn_p = true;
+
+ if (mips_ls2.alu1_turn_p)
+ {
+ if (state_transition (state, mips_ls2.alu1_turn_enabled_insn) >= 0)
+ gcc_unreachable ();
+ }
+ else
+ {
+ if (state_transition (state, mips_ls2.alu2_turn_enabled_insn) >= 0)
+ gcc_unreachable ();
+ }
+
+ if (cpu_unit_reservation_p (state, mips_ls2.falu1_core_unit_code))
+ {
+ /* There are no non-pipelined FALU1 insns. */
+ gcc_unreachable ();
+ mips_ls2.falu1_turn_p = false;
+ }
+
+ if (cpu_unit_reservation_p (state, mips_ls2.falu2_core_unit_code))
+ /* We have a non-pipelined falu instruction in the core,
+ adjust round-robin counter. */
+ mips_ls2.falu1_turn_p = true;
+
+ if (mips_ls2.falu1_turn_p)
+ {
+ if (state_transition (state, mips_ls2.falu1_turn_enabled_insn) >= 0)
+ gcc_unreachable ();
+ }
+ else
+ {
+ if (state_transition (state, mips_ls2.falu2_turn_enabled_insn) >= 0)
+ gcc_unreachable ();
+ }
+}
+
+/* Implement TARGET_SCHED_DFA_POST_ADVANCE_CYCLE.
+ This hook is being called at the start of each cycle. */
+
+static void
+mips_dfa_post_advance_cycle (void)
+{
+ if (TUNE_LOONGSON_2EF)
+ mips_ls2_dfa_post_advance_cycle (curr_state);
+}
+
/* Implement TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD. This should
be as wide as the scheduling freedom in the DFA. */
@@ -9824,6 +9991,9 @@ mips_multipass_dfa_lookahead (void)
if (TUNE_SB1)
return 4;
+ if (TUNE_LOONGSON_2EF)
+ return 4;
+
return 0;
}
@@ -10084,6 +10254,12 @@ mips_sched_init (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
mips_macc_chains_last_hilo = 0;
vr4130_last_insn = 0;
mips_74k_agen_init (NULL_RTX);
+
+ /* When scheduling for Loongson2, branch instructions go to ALU1,
+ therefore basic block is most likely to start with round-robin counter
+ pointed to ALU2. */
+ mips_ls2.alu1_turn_p = false;
+ mips_ls2.falu1_turn_p = true;
}
/* Implement TARGET_SCHED_REORDER and TARGET_SCHED_REORDER2. */
@@ -10109,6 +10285,37 @@ mips_sched_reorder (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
return mips_issue_rate ();
}
+/* Update round-robin counters for ALU1/2 and FALU1/2. */
+
+static void
+mips_ls2_variable_issue (rtx insn)
+{
+ if (mips_ls2.alu1_turn_p)
+ {
+ if (cpu_unit_reservation_p (curr_state, mips_ls2.alu1_core_unit_code))
+ mips_ls2.alu1_turn_p = false;
+ }
+ else
+ {
+ if (cpu_unit_reservation_p (curr_state, mips_ls2.alu2_core_unit_code))
+ mips_ls2.alu1_turn_p = true;
+ }
+
+ if (mips_ls2.falu1_turn_p)
+ {
+ if (cpu_unit_reservation_p (curr_state, mips_ls2.falu1_core_unit_code))
+ mips_ls2.falu1_turn_p = false;
+ }
+ else
+ {
+ if (cpu_unit_reservation_p (curr_state, mips_ls2.falu2_core_unit_code))
+ mips_ls2.falu1_turn_p = true;
+ }
+
+ if (recog_memoized (insn) >= 0)
+ mips_ls2.cycle_has_multi_p |= (get_attr_type (insn) == TYPE_MULTI);
+}
+
/* Implement TARGET_SCHED_VARIABLE_ISSUE. */
static int
@@ -10124,7 +10331,16 @@ mips_variable_issue (FILE *file ATTRIBUTE_UNUSED, int verbose ATTRIBUTE_UNUSED,
vr4130_last_insn = insn;
if (TUNE_74K)
mips_74k_agen_init (insn);
+ else if (TUNE_LOONGSON_2EF)
+ mips_ls2_variable_issue (insn);
}
+
+ /* Instructions of type 'multi' should all be split before
+ the second scheduling pass. */
+ gcc_assert (!reload_completed
+ || recog_memoized (insn) < 0
+ || get_attr_type (insn) != TYPE_MULTI);
+
return more;
}
@@ -10146,6 +10362,23 @@ mips_prefetch_cookie (rtx write, rtx locality)
return GEN_INT (INTVAL (write) + 6);
}
+/* Flags that indicate when a built-in function is available.
+
+ BUILTIN_AVAIL_NON_MIPS16
+ The function is available on the current target, but only
+ in non-MIPS16 mode. */
+#define BUILTIN_AVAIL_NON_MIPS16 1
+
+/* Declare an availability predicate for built-in functions that
+ require non-MIPS16 mode and also require COND to be true.
+ NAME is the main part of the predicate's name. */
+#define AVAIL_NON_MIPS16(NAME, COND) \
+ static unsigned int \
+ mips_builtin_avail_##NAME (void) \
+ { \
+ return (COND) ? BUILTIN_AVAIL_NON_MIPS16 : 0; \
+ }
+
/* This structure describes a single built-in function. */
struct mips_builtin_description {
/* The code of the main .md file instruction. See mips_builtin_type
@@ -10164,309 +10397,449 @@ struct mips_builtin_description {
/* The function's prototype. */
enum mips_function_type function_type;
- /* The target flags required for this function. */
- int target_flags;
+ /* Whether the function is available. */
+ unsigned int (*avail) (void);
};
-/* Define a MIPS_BUILTIN_DIRECT function for instruction CODE_FOR_mips_<INSN>.
- FUNCTION_TYPE and TARGET_FLAGS are mips_builtin_description fields. */
-#define DIRECT_BUILTIN(INSN, FUNCTION_TYPE, TARGET_FLAGS) \
- { CODE_FOR_mips_ ## INSN, 0, "__builtin_mips_" #INSN, \
- MIPS_BUILTIN_DIRECT, FUNCTION_TYPE, TARGET_FLAGS }
+AVAIL_NON_MIPS16 (paired_single, TARGET_PAIRED_SINGLE_FLOAT)
+AVAIL_NON_MIPS16 (sb1_paired_single, TARGET_SB1 && TARGET_PAIRED_SINGLE_FLOAT)
+AVAIL_NON_MIPS16 (mips3d, TARGET_MIPS3D)
+AVAIL_NON_MIPS16 (dsp, TARGET_DSP)
+AVAIL_NON_MIPS16 (dspr2, TARGET_DSPR2)
+AVAIL_NON_MIPS16 (dsp_32, !TARGET_64BIT && TARGET_DSP)
+AVAIL_NON_MIPS16 (dspr2_32, !TARGET_64BIT && TARGET_DSPR2)
+AVAIL_NON_MIPS16 (loongson, TARGET_LOONGSON_VECTORS)
+
+/* Construct a mips_builtin_description from the given arguments.
+
+ INSN is the name of the associated instruction pattern, without the
+ leading CODE_FOR_mips_.
+
+ CODE is the floating-point condition code associated with the
+ function. It can be 'f' if the field is not applicable.
+
+ NAME is the name of the function itself, without the leading
+ "__builtin_mips_".
+
+ BUILTIN_TYPE and FUNCTION_TYPE are mips_builtin_description fields.
+
+ AVAIL is the name of the availability predicate, without the leading
+ mips_builtin_avail_. */
+#define MIPS_BUILTIN(INSN, COND, NAME, BUILTIN_TYPE, \
+ FUNCTION_TYPE, AVAIL) \
+ { CODE_FOR_mips_ ## INSN, MIPS_FP_COND_ ## COND, \
+ "__builtin_mips_" NAME, BUILTIN_TYPE, FUNCTION_TYPE, \
+ mips_builtin_avail_ ## AVAIL }
+
+/* Define __builtin_mips_<INSN>, which is a MIPS_BUILTIN_DIRECT function
+ mapped to instruction CODE_FOR_mips_<INSN>, FUNCTION_TYPE and AVAIL
+ are as for MIPS_BUILTIN. */
+#define DIRECT_BUILTIN(INSN, FUNCTION_TYPE, AVAIL) \
+ MIPS_BUILTIN (INSN, f, #INSN, MIPS_BUILTIN_DIRECT, FUNCTION_TYPE, AVAIL)
/* Define __builtin_mips_<INSN>_<COND>_{s,d} functions, both of which
- require TARGET_FLAGS. */
-#define CMP_SCALAR_BUILTINS(INSN, COND, TARGET_FLAGS) \
- { CODE_FOR_mips_ ## INSN ## _cond_s, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_" #INSN "_" #COND "_s", \
- MIPS_BUILTIN_CMP_SINGLE, MIPS_INT_FTYPE_SF_SF, TARGET_FLAGS }, \
- { CODE_FOR_mips_ ## INSN ## _cond_d, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_" #INSN "_" #COND "_d", \
- MIPS_BUILTIN_CMP_SINGLE, MIPS_INT_FTYPE_DF_DF, TARGET_FLAGS }
+ are subject to mips_builtin_avail_<AVAIL>. */
+#define CMP_SCALAR_BUILTINS(INSN, COND, AVAIL) \
+ MIPS_BUILTIN (INSN ## _cond_s, COND, #INSN "_" #COND "_s", \
+ MIPS_BUILTIN_CMP_SINGLE, MIPS_INT_FTYPE_SF_SF, AVAIL), \
+ MIPS_BUILTIN (INSN ## _cond_d, COND, #INSN "_" #COND "_d", \
+ MIPS_BUILTIN_CMP_SINGLE, MIPS_INT_FTYPE_DF_DF, AVAIL)
/* Define __builtin_mips_{any,all,upper,lower}_<INSN>_<COND>_ps.
- The lower and upper forms require TARGET_FLAGS while the any and all
- forms require MASK_MIPS3D. */
-#define CMP_PS_BUILTINS(INSN, COND, TARGET_FLAGS) \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_any_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_CMP_ANY, MIPS_INT_FTYPE_V2SF_V2SF, MASK_MIPS3D }, \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_all_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_CMP_ALL, MIPS_INT_FTYPE_V2SF_V2SF, MASK_MIPS3D }, \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_lower_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_CMP_LOWER, MIPS_INT_FTYPE_V2SF_V2SF, TARGET_FLAGS }, \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_upper_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_CMP_UPPER, MIPS_INT_FTYPE_V2SF_V2SF, TARGET_FLAGS }
+ The lower and upper forms are subject to mips_builtin_avail_<AVAIL>
+ while the any and all forms are subject to mips_builtin_avail_mips3d. */
+#define CMP_PS_BUILTINS(INSN, COND, AVAIL) \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "any_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_CMP_ANY, MIPS_INT_FTYPE_V2SF_V2SF, \
+ mips3d), \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "all_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_CMP_ALL, MIPS_INT_FTYPE_V2SF_V2SF, \
+ mips3d), \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "lower_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_CMP_LOWER, MIPS_INT_FTYPE_V2SF_V2SF, \
+ AVAIL), \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "upper_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_CMP_UPPER, MIPS_INT_FTYPE_V2SF_V2SF, \
+ AVAIL)
/* Define __builtin_mips_{any,all}_<INSN>_<COND>_4s. The functions
- require MASK_MIPS3D. */
+ are subject to mips_builtin_avail_mips3d. */
#define CMP_4S_BUILTINS(INSN, COND) \
- { CODE_FOR_mips_ ## INSN ## _cond_4s, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_any_" #INSN "_" #COND "_4s", \
- MIPS_BUILTIN_CMP_ANY, MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF, \
- MASK_MIPS3D }, \
- { CODE_FOR_mips_ ## INSN ## _cond_4s, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_all_" #INSN "_" #COND "_4s", \
- MIPS_BUILTIN_CMP_ALL, MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF, \
- MASK_MIPS3D }
+ MIPS_BUILTIN (INSN ## _cond_4s, COND, "any_" #INSN "_" #COND "_4s", \
+ MIPS_BUILTIN_CMP_ANY, \
+ MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF, mips3d), \
+ MIPS_BUILTIN (INSN ## _cond_4s, COND, "all_" #INSN "_" #COND "_4s", \
+ MIPS_BUILTIN_CMP_ALL, \
+ MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF, mips3d)
/* Define __builtin_mips_mov{t,f}_<INSN>_<COND>_ps. The comparison
- instruction requires TARGET_FLAGS. */
-#define MOVTF_BUILTINS(INSN, COND, TARGET_FLAGS) \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_movt_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_MOVT, MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF, \
- TARGET_FLAGS }, \
- { CODE_FOR_mips_ ## INSN ## _cond_ps, MIPS_FP_COND_ ## COND, \
- "__builtin_mips_movf_" #INSN "_" #COND "_ps", \
- MIPS_BUILTIN_MOVF, MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF, \
- TARGET_FLAGS }
+ instruction requires mips_builtin_avail_<AVAIL>. */
+#define MOVTF_BUILTINS(INSN, COND, AVAIL) \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "movt_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_MOVT, MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF, \
+ AVAIL), \
+ MIPS_BUILTIN (INSN ## _cond_ps, COND, "movf_" #INSN "_" #COND "_ps", \
+ MIPS_BUILTIN_MOVF, MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF, \
+ AVAIL)
/* Define all the built-in functions related to C.cond.fmt condition COND. */
#define CMP_BUILTINS(COND) \
- MOVTF_BUILTINS (c, COND, MASK_PAIRED_SINGLE_FLOAT), \
- MOVTF_BUILTINS (cabs, COND, MASK_MIPS3D), \
- CMP_SCALAR_BUILTINS (cabs, COND, MASK_MIPS3D), \
- CMP_PS_BUILTINS (c, COND, MASK_PAIRED_SINGLE_FLOAT), \
- CMP_PS_BUILTINS (cabs, COND, MASK_MIPS3D), \
+ MOVTF_BUILTINS (c, COND, paired_single), \
+ MOVTF_BUILTINS (cabs, COND, mips3d), \
+ CMP_SCALAR_BUILTINS (cabs, COND, mips3d), \
+ CMP_PS_BUILTINS (c, COND, paired_single), \
+ CMP_PS_BUILTINS (cabs, COND, mips3d), \
CMP_4S_BUILTINS (c, COND), \
CMP_4S_BUILTINS (cabs, COND)
-static const struct mips_builtin_description mips_ps_bdesc[] = {
- DIRECT_BUILTIN (pll_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (pul_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (plu_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (puu_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (cvt_ps_s, MIPS_V2SF_FTYPE_SF_SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (cvt_s_pl, MIPS_SF_FTYPE_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (cvt_s_pu, MIPS_SF_FTYPE_V2SF, MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (abs_ps, MIPS_V2SF_FTYPE_V2SF, MASK_PAIRED_SINGLE_FLOAT),
-
- DIRECT_BUILTIN (alnv_ps, MIPS_V2SF_FTYPE_V2SF_V2SF_INT,
- MASK_PAIRED_SINGLE_FLOAT),
- DIRECT_BUILTIN (addr_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_MIPS3D),
- DIRECT_BUILTIN (mulr_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_MIPS3D),
- DIRECT_BUILTIN (cvt_pw_ps, MIPS_V2SF_FTYPE_V2SF, MASK_MIPS3D),
- DIRECT_BUILTIN (cvt_ps_pw, MIPS_V2SF_FTYPE_V2SF, MASK_MIPS3D),
-
- DIRECT_BUILTIN (recip1_s, MIPS_SF_FTYPE_SF, MASK_MIPS3D),
- DIRECT_BUILTIN (recip1_d, MIPS_DF_FTYPE_DF, MASK_MIPS3D),
- DIRECT_BUILTIN (recip1_ps, MIPS_V2SF_FTYPE_V2SF, MASK_MIPS3D),
- DIRECT_BUILTIN (recip2_s, MIPS_SF_FTYPE_SF_SF, MASK_MIPS3D),
- DIRECT_BUILTIN (recip2_d, MIPS_DF_FTYPE_DF_DF, MASK_MIPS3D),
- DIRECT_BUILTIN (recip2_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_MIPS3D),
-
- DIRECT_BUILTIN (rsqrt1_s, MIPS_SF_FTYPE_SF, MASK_MIPS3D),
- DIRECT_BUILTIN (rsqrt1_d, MIPS_DF_FTYPE_DF, MASK_MIPS3D),
- DIRECT_BUILTIN (rsqrt1_ps, MIPS_V2SF_FTYPE_V2SF, MASK_MIPS3D),
- DIRECT_BUILTIN (rsqrt2_s, MIPS_SF_FTYPE_SF_SF, MASK_MIPS3D),
- DIRECT_BUILTIN (rsqrt2_d, MIPS_DF_FTYPE_DF_DF, MASK_MIPS3D),
- DIRECT_BUILTIN (rsqrt2_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, MASK_MIPS3D),
-
- MIPS_FP_CONDITIONS (CMP_BUILTINS)
-};
+/* Define __builtin_mips_<INSN>, which is a MIPS_BUILTIN_DIRECT_NO_TARGET
+ function mapped to instruction CODE_FOR_mips_<INSN>, FUNCTION_TYPE
+ and AVAIL are as for MIPS_BUILTIN. */
+#define DIRECT_NO_TARGET_BUILTIN(INSN, FUNCTION_TYPE, AVAIL) \
+ MIPS_BUILTIN (INSN, f, #INSN, MIPS_BUILTIN_DIRECT_NO_TARGET, \
+ FUNCTION_TYPE, AVAIL)
-/* Built-in functions for the SB-1 processor. */
+/* Define __builtin_mips_bposge<VALUE>. <VALUE> is 32 for the MIPS32 DSP
+ branch instruction. AVAIL is as for MIPS_BUILTIN. */
+#define BPOSGE_BUILTIN(VALUE, AVAIL) \
+ MIPS_BUILTIN (bposge, f, "bposge" #VALUE, \
+ MIPS_BUILTIN_BPOSGE ## VALUE, MIPS_SI_FTYPE_VOID, AVAIL)
+
+/* Define a Loongson MIPS_BUILTIN_DIRECT function __builtin_loongson_<FN_NAME>
+ for instruction CODE_FOR_loongson_<INSN>. FUNCTION_TYPE is a
+ builtin_description field. */
+#define LOONGSON_BUILTIN_ALIAS(INSN, FN_NAME, FUNCTION_TYPE) \
+ { CODE_FOR_loongson_ ## INSN, 0, "__builtin_loongson_" #FN_NAME, \
+ MIPS_BUILTIN_DIRECT, FUNCTION_TYPE, mips_builtin_avail_loongson }
+
+/* Define a Loongson MIPS_BUILTIN_DIRECT function __builtin_loongson_<INSN>
+ for instruction CODE_FOR_loongson_<INSN>. FUNCTION_TYPE is a
+ builtin_description field. */
+#define LOONGSON_BUILTIN(INSN, FUNCTION_TYPE) \
+ LOONGSON_BUILTIN_ALIAS (INSN, INSN, FUNCTION_TYPE)
+
+/* Like LOONGSON_BUILTIN, but add _<SUFFIX> to the end of the function name.
+ We use functions of this form when the same insn can be usefully applied
+ to more than one datatype. */
+#define LOONGSON_BUILTIN_SUFFIX(INSN, SUFFIX, FUNCTION_TYPE) \
+ LOONGSON_BUILTIN_ALIAS (INSN, INSN ## _ ## SUFFIX, FUNCTION_TYPE)
#define CODE_FOR_mips_sqrt_ps CODE_FOR_sqrtv2sf2
-
-static const struct mips_builtin_description mips_sb1_bdesc[] = {
- DIRECT_BUILTIN (sqrt_ps, MIPS_V2SF_FTYPE_V2SF, MASK_PAIRED_SINGLE_FLOAT)
-};
-
-/* Built-in functions for the DSP ASE. */
-
#define CODE_FOR_mips_addq_ph CODE_FOR_addv2hi3
#define CODE_FOR_mips_addu_qb CODE_FOR_addv4qi3
#define CODE_FOR_mips_subq_ph CODE_FOR_subv2hi3
#define CODE_FOR_mips_subu_qb CODE_FOR_subv4qi3
#define CODE_FOR_mips_mul_ph CODE_FOR_mulv2hi3
-/* Define a MIPS_BUILTIN_DIRECT_NO_TARGET function for instruction
- CODE_FOR_mips_<INSN>. FUNCTION_TYPE and TARGET_FLAGS are
- mips_builtin_description fields. */
-#define DIRECT_NO_TARGET_BUILTIN(INSN, FUNCTION_TYPE, TARGET_FLAGS) \
- { CODE_FOR_mips_ ## INSN, 0, "__builtin_mips_" #INSN, \
- MIPS_BUILTIN_DIRECT_NO_TARGET, FUNCTION_TYPE, TARGET_FLAGS }
-
-/* Define __builtin_mips_bposge<VALUE>. <VALUE> is 32 for the MIPS32 DSP
- branch instruction. TARGET_FLAGS is a mips_builtin_description field. */
-#define BPOSGE_BUILTIN(VALUE, TARGET_FLAGS) \
- { CODE_FOR_mips_bposge, 0, "__builtin_mips_bposge" #VALUE, \
- MIPS_BUILTIN_BPOSGE ## VALUE, MIPS_SI_FTYPE_VOID, TARGET_FLAGS }
-
-static const struct mips_builtin_description mips_dsp_bdesc[] = {
- DIRECT_BUILTIN (addq_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (addq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (addq_s_w, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (addu_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (addu_s_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (subq_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (subq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (subq_s_w, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (subu_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (subu_s_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (addsc, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (addwc, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (modsub, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (raddu_w_qb, MIPS_SI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (absq_s_ph, MIPS_V2HI_FTYPE_V2HI, MASK_DSP),
- DIRECT_BUILTIN (absq_s_w, MIPS_SI_FTYPE_SI, MASK_DSP),
- DIRECT_BUILTIN (precrq_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (precrq_ph_w, MIPS_V2HI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (precrq_rs_ph_w, MIPS_V2HI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (precrqu_s_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (preceq_w_phl, MIPS_SI_FTYPE_V2HI, MASK_DSP),
- DIRECT_BUILTIN (preceq_w_phr, MIPS_SI_FTYPE_V2HI, MASK_DSP),
- DIRECT_BUILTIN (precequ_ph_qbl, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (precequ_ph_qbr, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (precequ_ph_qbla, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (precequ_ph_qbra, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (preceu_ph_qbl, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (preceu_ph_qbr, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (preceu_ph_qbla, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (preceu_ph_qbra, MIPS_V2HI_FTYPE_V4QI, MASK_DSP),
- DIRECT_BUILTIN (shll_qb, MIPS_V4QI_FTYPE_V4QI_SI, MASK_DSP),
- DIRECT_BUILTIN (shll_ph, MIPS_V2HI_FTYPE_V2HI_SI, MASK_DSP),
- DIRECT_BUILTIN (shll_s_ph, MIPS_V2HI_FTYPE_V2HI_SI, MASK_DSP),
- DIRECT_BUILTIN (shll_s_w, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (shrl_qb, MIPS_V4QI_FTYPE_V4QI_SI, MASK_DSP),
- DIRECT_BUILTIN (shra_ph, MIPS_V2HI_FTYPE_V2HI_SI, MASK_DSP),
- DIRECT_BUILTIN (shra_r_ph, MIPS_V2HI_FTYPE_V2HI_SI, MASK_DSP),
- DIRECT_BUILTIN (shra_r_w, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (muleu_s_ph_qbl, MIPS_V2HI_FTYPE_V4QI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (muleu_s_ph_qbr, MIPS_V2HI_FTYPE_V4QI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (mulq_rs_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (muleq_s_w_phl, MIPS_SI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (muleq_s_w_phr, MIPS_SI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (bitrev, MIPS_SI_FTYPE_SI, MASK_DSP),
- DIRECT_BUILTIN (insv, MIPS_SI_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (repl_qb, MIPS_V4QI_FTYPE_SI, MASK_DSP),
- DIRECT_BUILTIN (repl_ph, MIPS_V2HI_FTYPE_SI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmpu_eq_qb, MIPS_VOID_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmpu_lt_qb, MIPS_VOID_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmpu_le_qb, MIPS_VOID_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (cmpgu_eq_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (cmpgu_lt_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (cmpgu_le_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmp_eq_ph, MIPS_VOID_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmp_lt_ph, MIPS_VOID_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (cmp_le_ph, MIPS_VOID_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (pick_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (pick_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (packrl_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSP),
- DIRECT_NO_TARGET_BUILTIN (wrdsp, MIPS_VOID_FTYPE_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (rddsp, MIPS_SI_FTYPE_SI, MASK_DSP),
- DIRECT_BUILTIN (lbux, MIPS_SI_FTYPE_POINTER_SI, MASK_DSP),
- DIRECT_BUILTIN (lhx, MIPS_SI_FTYPE_POINTER_SI, MASK_DSP),
- DIRECT_BUILTIN (lwx, MIPS_SI_FTYPE_POINTER_SI, MASK_DSP),
- BPOSGE_BUILTIN (32, MASK_DSP),
-
- /* The following are for the MIPS DSP ASE REV 2. */
- DIRECT_BUILTIN (absq_s_qb, MIPS_V4QI_FTYPE_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (addu_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (addu_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (adduh_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (adduh_r_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (append, MIPS_SI_FTYPE_SI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (balign, MIPS_SI_FTYPE_SI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (cmpgdu_eq_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (cmpgdu_lt_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (cmpgdu_le_qb, MIPS_SI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (mul_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (mul_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (mulq_rs_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (mulq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (mulq_s_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (precr_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (precr_sra_ph_w, MIPS_V2HI_FTYPE_SI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (precr_sra_r_ph_w, MIPS_V2HI_FTYPE_SI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (prepend, MIPS_SI_FTYPE_SI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (shra_qb, MIPS_V4QI_FTYPE_V4QI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (shra_r_qb, MIPS_V4QI_FTYPE_V4QI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (shrl_ph, MIPS_V2HI_FTYPE_V2HI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (subu_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (subu_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (subuh_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (subuh_r_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, MASK_DSPR2),
- DIRECT_BUILTIN (addqh_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (addqh_r_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (addqh_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (addqh_r_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (subqh_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (subqh_r_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (subqh_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (subqh_r_w, MIPS_SI_FTYPE_SI_SI, MASK_DSPR2)
-};
-
-static const struct mips_builtin_description mips_dsp_32only_bdesc[] = {
- DIRECT_BUILTIN (dpau_h_qbl, MIPS_DI_FTYPE_DI_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (dpau_h_qbr, MIPS_DI_FTYPE_DI_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (dpsu_h_qbl, MIPS_DI_FTYPE_DI_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (dpsu_h_qbr, MIPS_DI_FTYPE_DI_V4QI_V4QI, MASK_DSP),
- DIRECT_BUILTIN (dpaq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (dpsq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (mulsaq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (dpaq_sa_l_w, MIPS_DI_FTYPE_DI_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (dpsq_sa_l_w, MIPS_DI_FTYPE_DI_SI_SI, MASK_DSP),
- DIRECT_BUILTIN (maq_s_w_phl, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (maq_s_w_phr, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (maq_sa_w_phl, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (maq_sa_w_phr, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSP),
- DIRECT_BUILTIN (extr_w, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (extr_r_w, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (extr_rs_w, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (extr_s_h, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (extp, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (extpdp, MIPS_SI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (shilo, MIPS_DI_FTYPE_DI_SI, MASK_DSP),
- DIRECT_BUILTIN (mthlip, MIPS_DI_FTYPE_DI_SI, MASK_DSP),
-
- /* The following are for the MIPS DSP ASE REV 2. */
- DIRECT_BUILTIN (dpa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dps_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (madd, MIPS_DI_FTYPE_DI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (maddu, MIPS_DI_FTYPE_DI_USI_USI, MASK_DSPR2),
- DIRECT_BUILTIN (msub, MIPS_DI_FTYPE_DI_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (msubu, MIPS_DI_FTYPE_DI_USI_USI, MASK_DSPR2),
- DIRECT_BUILTIN (mulsa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (mult, MIPS_DI_FTYPE_SI_SI, MASK_DSPR2),
- DIRECT_BUILTIN (multu, MIPS_DI_FTYPE_USI_USI, MASK_DSPR2),
- DIRECT_BUILTIN (dpax_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dpsx_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dpaqx_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dpaqx_sa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dpsqx_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2),
- DIRECT_BUILTIN (dpsqx_sa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, MASK_DSPR2)
-};
-
-/* This structure describes an array of mips_builtin_description entries. */
-struct mips_bdesc_map {
- /* The array that this entry describes. */
- const struct mips_builtin_description *bdesc;
-
- /* The number of entries in BDESC. */
- unsigned int size;
-
- /* The target processor that supports the functions in BDESC.
- PROCESSOR_MAX means we enable them for all processors. */
- enum processor_type proc;
-
- /* The functions in BDESC are not supported if any of these
- target flags are set. */
- int unsupported_target_flags;
-};
-
-/* All MIPS-specific built-in functions. */
-static const struct mips_bdesc_map mips_bdesc_arrays[] = {
- { mips_ps_bdesc, ARRAY_SIZE (mips_ps_bdesc), PROCESSOR_MAX, 0 },
- { mips_sb1_bdesc, ARRAY_SIZE (mips_sb1_bdesc), PROCESSOR_SB1, 0 },
- { mips_dsp_bdesc, ARRAY_SIZE (mips_dsp_bdesc), PROCESSOR_MAX, 0 },
- { mips_dsp_32only_bdesc, ARRAY_SIZE (mips_dsp_32only_bdesc),
- PROCESSOR_MAX, MASK_64BIT }
+#define CODE_FOR_loongson_packsswh CODE_FOR_vec_pack_ssat_v2si
+#define CODE_FOR_loongson_packsshb CODE_FOR_vec_pack_ssat_v4hi
+#define CODE_FOR_loongson_packushb CODE_FOR_vec_pack_usat_v4hi
+#define CODE_FOR_loongson_paddw CODE_FOR_addv2si3
+#define CODE_FOR_loongson_paddh CODE_FOR_addv4hi3
+#define CODE_FOR_loongson_paddb CODE_FOR_addv8qi3
+#define CODE_FOR_loongson_paddsh CODE_FOR_ssaddv4hi3
+#define CODE_FOR_loongson_paddsb CODE_FOR_ssaddv8qi3
+#define CODE_FOR_loongson_paddush CODE_FOR_usaddv4hi3
+#define CODE_FOR_loongson_paddusb CODE_FOR_usaddv8qi3
+#define CODE_FOR_loongson_pmaxsh CODE_FOR_smaxv4hi3
+#define CODE_FOR_loongson_pmaxub CODE_FOR_umaxv8qi3
+#define CODE_FOR_loongson_pminsh CODE_FOR_sminv4hi3
+#define CODE_FOR_loongson_pminub CODE_FOR_uminv8qi3
+#define CODE_FOR_loongson_pmulhuh CODE_FOR_umulv4hi3_highpart
+#define CODE_FOR_loongson_pmulhh CODE_FOR_smulv4hi3_highpart
+#define CODE_FOR_loongson_biadd CODE_FOR_reduc_uplus_v8qi
+#define CODE_FOR_loongson_psubw CODE_FOR_subv2si3
+#define CODE_FOR_loongson_psubh CODE_FOR_subv4hi3
+#define CODE_FOR_loongson_psubb CODE_FOR_subv8qi3
+#define CODE_FOR_loongson_psubsh CODE_FOR_sssubv4hi3
+#define CODE_FOR_loongson_psubsb CODE_FOR_sssubv8qi3
+#define CODE_FOR_loongson_psubush CODE_FOR_ussubv4hi3
+#define CODE_FOR_loongson_psubusb CODE_FOR_ussubv8qi3
+#define CODE_FOR_loongson_punpckhbh CODE_FOR_vec_interleave_highv8qi
+#define CODE_FOR_loongson_punpckhhw CODE_FOR_vec_interleave_highv4hi
+#define CODE_FOR_loongson_punpckhwd CODE_FOR_vec_interleave_highv2si
+#define CODE_FOR_loongson_punpcklbh CODE_FOR_vec_interleave_lowv8qi
+#define CODE_FOR_loongson_punpcklhw CODE_FOR_vec_interleave_lowv4hi
+#define CODE_FOR_loongson_punpcklwd CODE_FOR_vec_interleave_lowv2si
+
+static const struct mips_builtin_description mips_builtins[] = {
+ DIRECT_BUILTIN (pll_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, paired_single),
+ DIRECT_BUILTIN (pul_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, paired_single),
+ DIRECT_BUILTIN (plu_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, paired_single),
+ DIRECT_BUILTIN (puu_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, paired_single),
+ DIRECT_BUILTIN (cvt_ps_s, MIPS_V2SF_FTYPE_SF_SF, paired_single),
+ DIRECT_BUILTIN (cvt_s_pl, MIPS_SF_FTYPE_V2SF, paired_single),
+ DIRECT_BUILTIN (cvt_s_pu, MIPS_SF_FTYPE_V2SF, paired_single),
+ DIRECT_BUILTIN (abs_ps, MIPS_V2SF_FTYPE_V2SF, paired_single),
+
+ DIRECT_BUILTIN (alnv_ps, MIPS_V2SF_FTYPE_V2SF_V2SF_INT, paired_single),
+ DIRECT_BUILTIN (addr_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, mips3d),
+ DIRECT_BUILTIN (mulr_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, mips3d),
+ DIRECT_BUILTIN (cvt_pw_ps, MIPS_V2SF_FTYPE_V2SF, mips3d),
+ DIRECT_BUILTIN (cvt_ps_pw, MIPS_V2SF_FTYPE_V2SF, mips3d),
+
+ DIRECT_BUILTIN (recip1_s, MIPS_SF_FTYPE_SF, mips3d),
+ DIRECT_BUILTIN (recip1_d, MIPS_DF_FTYPE_DF, mips3d),
+ DIRECT_BUILTIN (recip1_ps, MIPS_V2SF_FTYPE_V2SF, mips3d),
+ DIRECT_BUILTIN (recip2_s, MIPS_SF_FTYPE_SF_SF, mips3d),
+ DIRECT_BUILTIN (recip2_d, MIPS_DF_FTYPE_DF_DF, mips3d),
+ DIRECT_BUILTIN (recip2_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, mips3d),
+
+ DIRECT_BUILTIN (rsqrt1_s, MIPS_SF_FTYPE_SF, mips3d),
+ DIRECT_BUILTIN (rsqrt1_d, MIPS_DF_FTYPE_DF, mips3d),
+ DIRECT_BUILTIN (rsqrt1_ps, MIPS_V2SF_FTYPE_V2SF, mips3d),
+ DIRECT_BUILTIN (rsqrt2_s, MIPS_SF_FTYPE_SF_SF, mips3d),
+ DIRECT_BUILTIN (rsqrt2_d, MIPS_DF_FTYPE_DF_DF, mips3d),
+ DIRECT_BUILTIN (rsqrt2_ps, MIPS_V2SF_FTYPE_V2SF_V2SF, mips3d),
+
+ MIPS_FP_CONDITIONS (CMP_BUILTINS),
+
+ /* Built-in functions for the SB-1 processor. */
+ DIRECT_BUILTIN (sqrt_ps, MIPS_V2SF_FTYPE_V2SF, sb1_paired_single),
+
+ /* Built-in functions for the DSP ASE (32-bit and 64-bit). */
+ DIRECT_BUILTIN (addq_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (addq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (addq_s_w, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (addu_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (addu_s_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (subq_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (subq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (subq_s_w, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (subu_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (subu_s_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (addsc, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (addwc, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (modsub, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (raddu_w_qb, MIPS_SI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (absq_s_ph, MIPS_V2HI_FTYPE_V2HI, dsp),
+ DIRECT_BUILTIN (absq_s_w, MIPS_SI_FTYPE_SI, dsp),
+ DIRECT_BUILTIN (precrq_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (precrq_ph_w, MIPS_V2HI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (precrq_rs_ph_w, MIPS_V2HI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (precrqu_s_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (preceq_w_phl, MIPS_SI_FTYPE_V2HI, dsp),
+ DIRECT_BUILTIN (preceq_w_phr, MIPS_SI_FTYPE_V2HI, dsp),
+ DIRECT_BUILTIN (precequ_ph_qbl, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (precequ_ph_qbr, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (precequ_ph_qbla, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (precequ_ph_qbra, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (preceu_ph_qbl, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (preceu_ph_qbr, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (preceu_ph_qbla, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (preceu_ph_qbra, MIPS_V2HI_FTYPE_V4QI, dsp),
+ DIRECT_BUILTIN (shll_qb, MIPS_V4QI_FTYPE_V4QI_SI, dsp),
+ DIRECT_BUILTIN (shll_ph, MIPS_V2HI_FTYPE_V2HI_SI, dsp),
+ DIRECT_BUILTIN (shll_s_ph, MIPS_V2HI_FTYPE_V2HI_SI, dsp),
+ DIRECT_BUILTIN (shll_s_w, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (shrl_qb, MIPS_V4QI_FTYPE_V4QI_SI, dsp),
+ DIRECT_BUILTIN (shra_ph, MIPS_V2HI_FTYPE_V2HI_SI, dsp),
+ DIRECT_BUILTIN (shra_r_ph, MIPS_V2HI_FTYPE_V2HI_SI, dsp),
+ DIRECT_BUILTIN (shra_r_w, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (muleu_s_ph_qbl, MIPS_V2HI_FTYPE_V4QI_V2HI, dsp),
+ DIRECT_BUILTIN (muleu_s_ph_qbr, MIPS_V2HI_FTYPE_V4QI_V2HI, dsp),
+ DIRECT_BUILTIN (mulq_rs_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (muleq_s_w_phl, MIPS_SI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (muleq_s_w_phr, MIPS_SI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (bitrev, MIPS_SI_FTYPE_SI, dsp),
+ DIRECT_BUILTIN (insv, MIPS_SI_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (repl_qb, MIPS_V4QI_FTYPE_SI, dsp),
+ DIRECT_BUILTIN (repl_ph, MIPS_V2HI_FTYPE_SI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmpu_eq_qb, MIPS_VOID_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmpu_lt_qb, MIPS_VOID_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmpu_le_qb, MIPS_VOID_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (cmpgu_eq_qb, MIPS_SI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (cmpgu_lt_qb, MIPS_SI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (cmpgu_le_qb, MIPS_SI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmp_eq_ph, MIPS_VOID_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmp_lt_ph, MIPS_VOID_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (cmp_le_ph, MIPS_VOID_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (pick_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dsp),
+ DIRECT_BUILTIN (pick_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_BUILTIN (packrl_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dsp),
+ DIRECT_NO_TARGET_BUILTIN (wrdsp, MIPS_VOID_FTYPE_SI_SI, dsp),
+ DIRECT_BUILTIN (rddsp, MIPS_SI_FTYPE_SI, dsp),
+ DIRECT_BUILTIN (lbux, MIPS_SI_FTYPE_POINTER_SI, dsp),
+ DIRECT_BUILTIN (lhx, MIPS_SI_FTYPE_POINTER_SI, dsp),
+ DIRECT_BUILTIN (lwx, MIPS_SI_FTYPE_POINTER_SI, dsp),
+ BPOSGE_BUILTIN (32, dsp),
+
+ /* The following are for the MIPS DSP ASE REV 2 (32-bit and 64-bit). */
+ DIRECT_BUILTIN (absq_s_qb, MIPS_V4QI_FTYPE_V4QI, dspr2),
+ DIRECT_BUILTIN (addu_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (addu_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (adduh_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (adduh_r_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (append, MIPS_SI_FTYPE_SI_SI_SI, dspr2),
+ DIRECT_BUILTIN (balign, MIPS_SI_FTYPE_SI_SI_SI, dspr2),
+ DIRECT_BUILTIN (cmpgdu_eq_qb, MIPS_SI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (cmpgdu_lt_qb, MIPS_SI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (cmpgdu_le_qb, MIPS_SI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (mul_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (mul_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (mulq_rs_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+ DIRECT_BUILTIN (mulq_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (mulq_s_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+ DIRECT_BUILTIN (precr_qb_ph, MIPS_V4QI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (precr_sra_ph_w, MIPS_V2HI_FTYPE_SI_SI_SI, dspr2),
+ DIRECT_BUILTIN (precr_sra_r_ph_w, MIPS_V2HI_FTYPE_SI_SI_SI, dspr2),
+ DIRECT_BUILTIN (prepend, MIPS_SI_FTYPE_SI_SI_SI, dspr2),
+ DIRECT_BUILTIN (shra_qb, MIPS_V4QI_FTYPE_V4QI_SI, dspr2),
+ DIRECT_BUILTIN (shra_r_qb, MIPS_V4QI_FTYPE_V4QI_SI, dspr2),
+ DIRECT_BUILTIN (shrl_ph, MIPS_V2HI_FTYPE_V2HI_SI, dspr2),
+ DIRECT_BUILTIN (subu_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (subu_s_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (subuh_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (subuh_r_qb, MIPS_V4QI_FTYPE_V4QI_V4QI, dspr2),
+ DIRECT_BUILTIN (addqh_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (addqh_r_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (addqh_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+ DIRECT_BUILTIN (addqh_r_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+ DIRECT_BUILTIN (subqh_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (subqh_r_ph, MIPS_V2HI_FTYPE_V2HI_V2HI, dspr2),
+ DIRECT_BUILTIN (subqh_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+ DIRECT_BUILTIN (subqh_r_w, MIPS_SI_FTYPE_SI_SI, dspr2),
+
+ /* Built-in functions for the DSP ASE (32-bit only). */
+ DIRECT_BUILTIN (dpau_h_qbl, MIPS_DI_FTYPE_DI_V4QI_V4QI, dsp_32),
+ DIRECT_BUILTIN (dpau_h_qbr, MIPS_DI_FTYPE_DI_V4QI_V4QI, dsp_32),
+ DIRECT_BUILTIN (dpsu_h_qbl, MIPS_DI_FTYPE_DI_V4QI_V4QI, dsp_32),
+ DIRECT_BUILTIN (dpsu_h_qbr, MIPS_DI_FTYPE_DI_V4QI_V4QI, dsp_32),
+ DIRECT_BUILTIN (dpaq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (dpsq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (mulsaq_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (dpaq_sa_l_w, MIPS_DI_FTYPE_DI_SI_SI, dsp_32),
+ DIRECT_BUILTIN (dpsq_sa_l_w, MIPS_DI_FTYPE_DI_SI_SI, dsp_32),
+ DIRECT_BUILTIN (maq_s_w_phl, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (maq_s_w_phr, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (maq_sa_w_phl, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (maq_sa_w_phr, MIPS_DI_FTYPE_DI_V2HI_V2HI, dsp_32),
+ DIRECT_BUILTIN (extr_w, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (extr_r_w, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (extr_rs_w, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (extr_s_h, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (extp, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (extpdp, MIPS_SI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (shilo, MIPS_DI_FTYPE_DI_SI, dsp_32),
+ DIRECT_BUILTIN (mthlip, MIPS_DI_FTYPE_DI_SI, dsp_32),
+
+ /* The following are for the MIPS DSP ASE REV 2 (32-bit only). */
+ DIRECT_BUILTIN (dpa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dps_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (madd, MIPS_DI_FTYPE_DI_SI_SI, dspr2_32),
+ DIRECT_BUILTIN (maddu, MIPS_DI_FTYPE_DI_USI_USI, dspr2_32),
+ DIRECT_BUILTIN (msub, MIPS_DI_FTYPE_DI_SI_SI, dspr2_32),
+ DIRECT_BUILTIN (msubu, MIPS_DI_FTYPE_DI_USI_USI, dspr2_32),
+ DIRECT_BUILTIN (mulsa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (mult, MIPS_DI_FTYPE_SI_SI, dspr2_32),
+ DIRECT_BUILTIN (multu, MIPS_DI_FTYPE_USI_USI, dspr2_32),
+ DIRECT_BUILTIN (dpax_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dpsx_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dpaqx_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dpaqx_sa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dpsqx_s_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+ DIRECT_BUILTIN (dpsqx_sa_w_ph, MIPS_DI_FTYPE_DI_V2HI_V2HI, dspr2_32),
+
+ /* Builtin functions for ST Microelectronics Loongson-2E/2F cores. */
+ LOONGSON_BUILTIN (packsswh, MIPS_V4HI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN (packsshb, MIPS_V8QI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (packushb, MIPS_UV8QI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (paddw, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (paddh, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (paddb, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (paddw, s, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_SUFFIX (paddh, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (paddb, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (paddd, u, MIPS_UDI_FTYPE_UDI_UDI),
+ LOONGSON_BUILTIN_SUFFIX (paddd, s, MIPS_DI_FTYPE_DI_DI),
+ LOONGSON_BUILTIN (paddsh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (paddsb, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN (paddush, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN (paddusb, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_ALIAS (pandn_d, pandn_ud, MIPS_UDI_FTYPE_UDI_UDI),
+ LOONGSON_BUILTIN_ALIAS (pandn_w, pandn_uw, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_ALIAS (pandn_h, pandn_uh, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_ALIAS (pandn_b, pandn_ub, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_ALIAS (pandn_d, pandn_sd, MIPS_DI_FTYPE_DI_DI),
+ LOONGSON_BUILTIN_ALIAS (pandn_w, pandn_sw, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_ALIAS (pandn_h, pandn_sh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_ALIAS (pandn_b, pandn_sb, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN (pavgh, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN (pavgb, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqw, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqh, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqb, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqw, s, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqh, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpeqb, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgtw, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgth, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgtb, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgtw, s, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgth, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (pcmpgtb, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (pextrh, u, MIPS_UV4HI_FTYPE_UV4HI_USI),
+ LOONGSON_BUILTIN_SUFFIX (pextrh, s, MIPS_V4HI_FTYPE_V4HI_USI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_0, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_1, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_2, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_3, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_0, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_1, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_2, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (pinsrh_3, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pmaddhw, MIPS_V2SI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pmaxsh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pmaxub, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN (pminsh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pminub, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pmovmskb, u, MIPS_UV8QI_FTYPE_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pmovmskb, s, MIPS_V8QI_FTYPE_V8QI),
+ LOONGSON_BUILTIN (pmulhuh, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN (pmulhh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pmullh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (pmuluw, MIPS_UDI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN (pasubub, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN (biadd, MIPS_UV4HI_FTYPE_UV8QI),
+ LOONGSON_BUILTIN (psadbh, MIPS_UV4HI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (pshufh, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (pshufh, s, MIPS_V4HI_FTYPE_V4HI_V4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psllh, u, MIPS_UV4HI_FTYPE_UV4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psllh, s, MIPS_V4HI_FTYPE_V4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psllw, u, MIPS_UV2SI_FTYPE_UV2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psllw, s, MIPS_V2SI_FTYPE_V2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrah, u, MIPS_UV4HI_FTYPE_UV4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrah, s, MIPS_V4HI_FTYPE_V4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psraw, u, MIPS_UV2SI_FTYPE_UV2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psraw, s, MIPS_V2SI_FTYPE_V2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrlh, u, MIPS_UV4HI_FTYPE_UV4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrlh, s, MIPS_V4HI_FTYPE_V4HI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrlw, u, MIPS_UV2SI_FTYPE_UV2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psrlw, s, MIPS_V2SI_FTYPE_V2SI_UQI),
+ LOONGSON_BUILTIN_SUFFIX (psubw, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (psubh, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (psubb, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (psubw, s, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_SUFFIX (psubh, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (psubb, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (psubd, u, MIPS_UDI_FTYPE_UDI_UDI),
+ LOONGSON_BUILTIN_SUFFIX (psubd, s, MIPS_DI_FTYPE_DI_DI),
+ LOONGSON_BUILTIN (psubsh, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN (psubsb, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN (psubush, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN (psubusb, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhbh, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhhw, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhwd, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhbh, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhhw, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (punpckhwd, s, MIPS_V2SI_FTYPE_V2SI_V2SI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklbh, u, MIPS_UV8QI_FTYPE_UV8QI_UV8QI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklhw, u, MIPS_UV4HI_FTYPE_UV4HI_UV4HI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklwd, u, MIPS_UV2SI_FTYPE_UV2SI_UV2SI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklbh, s, MIPS_V8QI_FTYPE_V8QI_V8QI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklhw, s, MIPS_V4HI_FTYPE_V4HI_V4HI),
+ LOONGSON_BUILTIN_SUFFIX (punpcklwd, s, MIPS_V2SI_FTYPE_V2SI_V2SI)
};
/* MODE is a vector mode whose elements have type TYPE. Return the type
@@ -10475,11 +10848,17 @@ static const struct mips_bdesc_map mips_bdesc_arrays[] = {
static tree
mips_builtin_vector_type (tree type, enum machine_mode mode)
{
- static tree types[(int) MAX_MACHINE_MODE];
+ static tree types[2 * (int) MAX_MACHINE_MODE];
+ int mode_index;
- if (types[(int) mode] == NULL_TREE)
- types[(int) mode] = build_vector_type_for_mode (type, mode);
- return types[(int) mode];
+ mode_index = (int) mode;
+
+ if (TREE_CODE (type) == INTEGER_TYPE && TYPE_UNSIGNED (type))
+ mode_index += MAX_MACHINE_MODE;
+
+ if (types[mode_index] == NULL_TREE)
+ types[mode_index] = build_vector_type_for_mode (type, mode);
+ return types[mode_index];
}
/* Source-level argument types. */
@@ -10488,16 +10867,27 @@ mips_builtin_vector_type (tree type, enum machine_mode mode)
#define MIPS_ATYPE_POINTER ptr_type_node
/* Standard mode-based argument types. */
+#define MIPS_ATYPE_UQI unsigned_intQI_type_node
#define MIPS_ATYPE_SI intSI_type_node
#define MIPS_ATYPE_USI unsigned_intSI_type_node
#define MIPS_ATYPE_DI intDI_type_node
+#define MIPS_ATYPE_UDI unsigned_intDI_type_node
#define MIPS_ATYPE_SF float_type_node
#define MIPS_ATYPE_DF double_type_node
/* Vector argument types. */
#define MIPS_ATYPE_V2SF mips_builtin_vector_type (float_type_node, V2SFmode)
#define MIPS_ATYPE_V2HI mips_builtin_vector_type (intHI_type_node, V2HImode)
+#define MIPS_ATYPE_V2SI mips_builtin_vector_type (intSI_type_node, V2SImode)
#define MIPS_ATYPE_V4QI mips_builtin_vector_type (intQI_type_node, V4QImode)
+#define MIPS_ATYPE_V4HI mips_builtin_vector_type (intHI_type_node, V4HImode)
+#define MIPS_ATYPE_V8QI mips_builtin_vector_type (intQI_type_node, V8QImode)
+#define MIPS_ATYPE_UV2SI \
+ mips_builtin_vector_type (unsigned_intSI_type_node, V2SImode)
+#define MIPS_ATYPE_UV4HI \
+ mips_builtin_vector_type (unsigned_intHI_type_node, V4HImode)
+#define MIPS_ATYPE_UV8QI \
+ mips_builtin_vector_type (unsigned_intQI_type_node, V8QImode)
/* MIPS_FTYPE_ATYPESN takes N MIPS_FTYPES-like type codes and lists
their associated MIPS_ATYPEs. */
@@ -10545,25 +10935,17 @@ static void
mips_init_builtins (void)
{
const struct mips_builtin_description *d;
- const struct mips_bdesc_map *m;
- unsigned int offset;
+ unsigned int i;
/* Iterate through all of the bdesc arrays, initializing all of the
builtin functions. */
- offset = 0;
- for (m = mips_bdesc_arrays;
- m < &mips_bdesc_arrays[ARRAY_SIZE (mips_bdesc_arrays)];
- m++)
+ for (i = 0; i < ARRAY_SIZE (mips_builtins); i++)
{
- if ((m->proc == PROCESSOR_MAX || m->proc == mips_arch)
- && (m->unsupported_target_flags & target_flags) == 0)
- for (d = m->bdesc; d < &m->bdesc[m->size]; d++)
- if ((d->target_flags & target_flags) == d->target_flags)
- add_builtin_function (d->name,
- mips_build_function_type (d->function_type),
- d - m->bdesc + offset,
- BUILT_IN_MD, NULL, NULL);
- offset += m->size;
+ d = &mips_builtins[i];
+ if (d->avail ())
+ add_builtin_function (d->name,
+ mips_build_function_type (d->function_type),
+ i, BUILT_IN_MD, NULL, NULL);
}
}
@@ -10808,41 +11190,6 @@ mips_expand_builtin_bposge (enum mips_builtin_type builtin_type, rtx target)
const1_rtx, const0_rtx);
}
-/* EXP is a CALL_EXPR that calls the function described by BDESC.
- Expand the call and return an rtx for its return value.
- TARGET, if nonnull, suggests a good place to put this value. */
-
-static rtx
-mips_expand_builtin_1 (const struct mips_builtin_description *bdesc,
- tree exp, rtx target)
-{
- switch (bdesc->builtin_type)
- {
- case MIPS_BUILTIN_DIRECT:
- return mips_expand_builtin_direct (bdesc->icode, target, exp, true);
-
- case MIPS_BUILTIN_DIRECT_NO_TARGET:
- return mips_expand_builtin_direct (bdesc->icode, target, exp, false);
-
- case MIPS_BUILTIN_MOVT:
- case MIPS_BUILTIN_MOVF:
- return mips_expand_builtin_movtf (bdesc->builtin_type, bdesc->icode,
- bdesc->cond, target, exp);
-
- case MIPS_BUILTIN_CMP_ANY:
- case MIPS_BUILTIN_CMP_ALL:
- case MIPS_BUILTIN_CMP_UPPER:
- case MIPS_BUILTIN_CMP_LOWER:
- case MIPS_BUILTIN_CMP_SINGLE:
- return mips_expand_builtin_compare (bdesc->builtin_type, bdesc->icode,
- bdesc->cond, target, exp);
-
- case MIPS_BUILTIN_BPOSGE32:
- return mips_expand_builtin_bposge (bdesc->builtin_type, target);
- }
- gcc_unreachable ();
-}
-
/* Implement TARGET_EXPAND_BUILTIN. */
static rtx
@@ -10851,25 +11198,44 @@ mips_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
int ignore ATTRIBUTE_UNUSED)
{
tree fndecl;
- unsigned int fcode;
- const struct mips_bdesc_map *m;
+ unsigned int fcode, avail;
+ const struct mips_builtin_description *d;
fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
fcode = DECL_FUNCTION_CODE (fndecl);
+ gcc_assert (fcode < ARRAY_SIZE (mips_builtins));
+ d = &mips_builtins[fcode];
+ avail = d->avail ();
+ gcc_assert (avail != 0);
if (TARGET_MIPS16)
{
error ("built-in function %qs not supported for MIPS16",
IDENTIFIER_POINTER (DECL_NAME (fndecl)));
return const0_rtx;
}
-
- for (m = mips_bdesc_arrays;
- m < &mips_bdesc_arrays[ARRAY_SIZE (mips_bdesc_arrays)];
- m++)
+ switch (d->builtin_type)
{
- if (fcode < m->size)
- return mips_expand_builtin_1 (m->bdesc + fcode, exp, target);
- fcode -= m->size;
+ case MIPS_BUILTIN_DIRECT:
+ return mips_expand_builtin_direct (d->icode, target, exp, true);
+
+ case MIPS_BUILTIN_DIRECT_NO_TARGET:
+ return mips_expand_builtin_direct (d->icode, target, exp, false);
+
+ case MIPS_BUILTIN_MOVT:
+ case MIPS_BUILTIN_MOVF:
+ return mips_expand_builtin_movtf (d->builtin_type, d->icode,
+ d->cond, target, exp);
+
+ case MIPS_BUILTIN_CMP_ANY:
+ case MIPS_BUILTIN_CMP_ALL:
+ case MIPS_BUILTIN_CMP_UPPER:
+ case MIPS_BUILTIN_CMP_LOWER:
+ case MIPS_BUILTIN_CMP_SINGLE:
+ return mips_expand_builtin_compare (d->builtin_type, d->icode,
+ d->cond, target, exp);
+
+ case MIPS_BUILTIN_BPOSGE32:
+ return mips_expand_builtin_bposge (d->builtin_type, target);
}
gcc_unreachable ();
}
@@ -12637,6 +13003,30 @@ mips_conditional_register_usage (void)
}
}
+/* Initialize vector TARGET to VALS. */
+
+void
+mips_expand_vector_init (rtx target, rtx vals)
+{
+ enum machine_mode mode;
+ enum machine_mode inner;
+ unsigned int i, n_elts;
+ rtx mem;
+
+ mode = GET_MODE (target);
+ inner = GET_MODE_INNER (mode);
+ n_elts = GET_MODE_NUNITS (mode);
+
+ gcc_assert (VECTOR_MODE_P (mode));
+
+ mem = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
+ for (i = 0; i < n_elts; i++)
+ emit_move_insn (adjust_address_nv (mem, inner, i * GET_MODE_SIZE (inner)),
+ XVECEXP (vals, 0, i));
+
+ emit_move_insn (target, mem);
+}
+
/* When generating MIPS16 code, we want to allocate $24 (T_REG) before
other registers for instructions for which it is possible. This
encourages the compiler to use CMP in cases where an XOR would
@@ -12688,6 +13078,10 @@ mips_order_regs_for_local_alloc (void)
#define TARGET_SCHED_ADJUST_COST mips_adjust_cost
#undef TARGET_SCHED_ISSUE_RATE
#define TARGET_SCHED_ISSUE_RATE mips_issue_rate
+#undef TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN
+#define TARGET_SCHED_INIT_DFA_POST_CYCLE_INSN mips_init_dfa_post_cycle_insn
+#undef TARGET_SCHED_DFA_POST_ADVANCE_CYCLE
+#define TARGET_SCHED_DFA_POST_ADVANCE_CYCLE mips_dfa_post_advance_cycle
#undef TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD
#define TARGET_SCHED_FIRST_CYCLE_MULTIPASS_DFA_LOOKAHEAD \
mips_multipass_dfa_lookahead
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index e2129a0fcd5..5bcebd845e0 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -266,6 +266,14 @@ enum mips_code_readable_setting {
|| mips_tune == PROCESSOR_74KF1_1 \
|| mips_tune == PROCESSOR_74KF3_2)
#define TUNE_20KC (mips_tune == PROCESSOR_20KC)
+#define TUNE_LOONGSON_2EF (mips_tune == PROCESSOR_LOONGSON_2E \
+ || mips_tune == PROCESSOR_LOONGSON_2F)
+
+/* Whether vector modes and intrinsics for ST Microelectronics
+ Loongson-2E/2F processors should be enabled. In o32 pairs of
+ floating-point registers provide 64-bit values. */
+#define TARGET_LOONGSON_VECTORS (TARGET_HARD_FLOAT_ABI \
+ && TARGET_LOONGSON_2EF)
/* True if the pre-reload scheduler should try to create chains of
multiply-add or multiply-subtract instructions. For example,
@@ -497,6 +505,10 @@ enum mips_code_readable_setting {
builtin_define_std ("MIPSEL"); \
builtin_define ("_MIPSEL"); \
} \
+ \
+ /* Whether Loongson vector modes are enabled. */ \
+ if (TARGET_LOONGSON_VECTORS) \
+ builtin_define ("__mips_loongson_vector_rev"); \
\
/* Macros dependent on the C dialect. */ \
if (preprocessing_asm_p ()) \
@@ -881,10 +893,12 @@ enum mips_code_readable_setting {
&& !TARGET_MIPS16)
/* Likewise mtc1 and mfc1. */
-#define ISA_HAS_XFER_DELAY (mips_isa <= 3)
+#define ISA_HAS_XFER_DELAY (mips_isa <= 3 \
+ && !TARGET_LOONGSON_2EF)
/* Likewise floating-point comparisons. */
-#define ISA_HAS_FCMP_DELAY (mips_isa <= 3)
+#define ISA_HAS_FCMP_DELAY (mips_isa <= 3 \
+ && !TARGET_LOONGSON_2EF)
/* True if mflo and mfhi can be immediately followed by instructions
which write to the HI and LO registers.
@@ -901,7 +915,8 @@ enum mips_code_readable_setting {
#define ISA_HAS_HILO_INTERLOCKS (ISA_MIPS32 \
|| ISA_MIPS32R2 \
|| ISA_MIPS64 \
- || TARGET_MIPS5500)
+ || TARGET_MIPS5500 \
+ || TARGET_LOONGSON_2EF)
/* ISA includes synci, jr.hb and jalr.hb. */
#define ISA_HAS_SYNCI (ISA_MIPS32R2 && !TARGET_MIPS16)
@@ -3202,3 +3217,6 @@ extern const struct mips_cpu_info *mips_tune_info;
extern const struct mips_rtx_cost_data *mips_cost;
extern enum mips_code_readable_setting mips_code_readable;
#endif
+
+/* Enable querying of DFA units. */
+#define CPU_UNITS_QUERY 1
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 47441cd1c1e..d75ea8cd3b0 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -215,6 +215,36 @@
(UNSPEC_DPAQX_SA_W_PH 446)
(UNSPEC_DPSQX_S_W_PH 447)
(UNSPEC_DPSQX_SA_W_PH 448)
+
+ ;; ST Microelectronics Loongson-2E/2F.
+ (UNSPEC_LOONGSON_PAVG 500)
+ (UNSPEC_LOONGSON_PCMPEQ 501)
+ (UNSPEC_LOONGSON_PCMPGT 502)
+ (UNSPEC_LOONGSON_PEXTR 503)
+ (UNSPEC_LOONGSON_PINSR_0 504)
+ (UNSPEC_LOONGSON_PINSR_1 505)
+ (UNSPEC_LOONGSON_PINSR_2 506)
+ (UNSPEC_LOONGSON_PINSR_3 507)
+ (UNSPEC_LOONGSON_PMADD 508)
+ (UNSPEC_LOONGSON_PMOVMSK 509)
+ (UNSPEC_LOONGSON_PMULHU 510)
+ (UNSPEC_LOONGSON_PMULH 511)
+ (UNSPEC_LOONGSON_PMULL 512)
+ (UNSPEC_LOONGSON_PMULU 513)
+ (UNSPEC_LOONGSON_PASUBUB 514)
+ (UNSPEC_LOONGSON_BIADD 515)
+ (UNSPEC_LOONGSON_PSADBH 516)
+ (UNSPEC_LOONGSON_PSHUFH 517)
+ (UNSPEC_LOONGSON_PUNPCKH 518)
+ (UNSPEC_LOONGSON_PUNPCKL 519)
+ (UNSPEC_LOONGSON_PADDD 520)
+ (UNSPEC_LOONGSON_PSUBD 521)
+
+ ;; Used in loongson2ef.md
+ (UNSPEC_LOONGSON_ALU1_TURN_ENABLED_INSN 530)
+ (UNSPEC_LOONGSON_ALU2_TURN_ENABLED_INSN 531)
+ (UNSPEC_LOONGSON_FALU1_TURN_ENABLED_INSN 532)
+ (UNSPEC_LOONGSON_FALU2_TURN_ENABLED_INSN 533)
]
)
@@ -417,7 +447,7 @@
;; Attribute describing the processor. This attribute must match exactly
;; with the processor_type enumeration in mips.h.
(define_attr "cpu"
- "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson2e,loongson2f,m4k,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sb1a,sr71000,xlr"
+ "r3000,4kc,4kp,5kc,5kf,20kc,24kc,24kf2_1,24kf1_1,74kc,74kf2_1,74kf1_1,74kf3_2,loongson_2e,loongson_2f,m4k,r3900,r6000,r4000,r4100,r4111,r4120,r4130,r4300,r4600,r4650,r5000,r5400,r5500,r7000,r8000,r9000,sb1,sb1a,sr71000,xlr"
(const (symbol_ref "mips_tune")))
;; The type of hardware hazard associated with this instruction.
@@ -500,7 +530,11 @@
;; 64-bit modes for which we provide move patterns.
(define_mode_iterator MOVE64
- [DI DF (V2SF "TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT")])
+ [DI DF
+ (V2SF "TARGET_HARD_FLOAT && TARGET_PAIRED_SINGLE_FLOAT")
+ (V2SI "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS")
+ (V4HI "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS")
+ (V8QI "TARGET_HARD_FLOAT && TARGET_LOONGSON_VECTORS")])
;; 128-bit modes for which we provide move patterns on 64-bit targets.
(define_mode_iterator MOVE128 [TI TF])
@@ -527,6 +561,9 @@
[(DF "!TARGET_64BIT && TARGET_DOUBLE_FLOAT")
(DI "!TARGET_64BIT && TARGET_DOUBLE_FLOAT")
(V2SF "!TARGET_64BIT && TARGET_PAIRED_SINGLE_FLOAT")
+ (V2SI "!TARGET_64BIT && TARGET_LOONGSON_VECTORS")
+ (V4HI "!TARGET_64BIT && TARGET_LOONGSON_VECTORS")
+ (V8QI "!TARGET_64BIT && TARGET_LOONGSON_VECTORS")
(TF "TARGET_64BIT && TARGET_FLOAT64")])
;; In GPR templates, a string like "<d>subu" will expand to "subu" in the
@@ -579,7 +616,9 @@
;; This attribute gives the integer mode that has half the size of
;; the controlling mode.
-(define_mode_attr HALFMODE [(DF "SI") (DI "SI") (V2SF "SI") (TF "DI")])
+(define_mode_attr HALFMODE [(DF "SI") (DI "SI") (V2SF "SI")
+ (V2SI "SI") (V4HI "SI") (V8QI "SI")
+ (TF "DI")])
;; This attribute works around the early SB-1 rev2 core "F2" erratum:
;;
@@ -760,6 +799,7 @@
(include "sb1.md")
(include "sr71k.md")
(include "xlr.md")
+(include "loongson2ef.md")
(include "generic.md")
;;
@@ -1295,7 +1335,7 @@
(match_operand:SI 3 "d_operand")))
(clobber (match_operand:SI 4 "lo_operand"))
(clobber (match_operand:SI 5 "d_operand"))]
- "reload_completed && !TARGET_DEBUG_D_MODE"
+ "reload_completed"
[(parallel [(set (match_dup 5)
(mult:SI (match_dup 1) (match_dup 2)))
(clobber (match_dup 4))])
@@ -1311,7 +1351,7 @@
(match_operand:SI 3 "lo_operand")))
(clobber (match_dup 3))
(clobber (scratch:SI))]
- "reload_completed && !TARGET_DEBUG_D_MODE"
+ "reload_completed"
[(parallel [(set (match_dup 3)
(plus:SI (mult:SI (match_dup 1) (match_dup 2))
(match_dup 3)))
@@ -1523,7 +1563,7 @@
(match_operand:SI 3 "d_operand"))))
(clobber (match_operand:SI 4 "lo_operand"))
(clobber (match_operand:SI 5 "d_operand"))]
- "reload_completed && !TARGET_DEBUG_D_MODE"
+ "reload_completed"
[(parallel [(set (match_dup 5)
(mult:SI (match_dup 2) (match_dup 3)))
(clobber (match_dup 4))])
@@ -1539,7 +1579,7 @@
(match_operand:SI 3 "d_operand"))))
(clobber (match_dup 1))
(clobber (scratch:SI))]
- "reload_completed && !TARGET_DEBUG_D_MODE"
+ "reload_completed"
[(parallel [(set (match_dup 1)
(minus:SI (match_dup 1)
(mult:SI (match_dup 2) (match_dup 3))))
@@ -5842,7 +5882,7 @@
(define_split
[(unspec [(match_operand 0 "register_operand")] UNSPEC_EH_RETURN)
(clobber (match_scratch 1))]
- "reload_completed && !TARGET_DEBUG_D_MODE"
+ "reload_completed"
[(const_int 0)]
{
mips_set_return_address (operands[0], operands[1]);
@@ -6435,3 +6475,6 @@
; MIPS fixed-point instructions.
(include "mips-fixed.md")
+
+; ST-Microelectronics Loongson-2E/2F-specific patterns.
+(include "loongson.md")
diff --git a/gcc/config/rs6000/eabispe.h b/gcc/config/rs6000/eabispe.h
index c3a3f2b4e53..ae14651deba 100644
--- a/gcc/config/rs6000/eabispe.h
+++ b/gcc/config/rs6000/eabispe.h
@@ -37,8 +37,6 @@
rs6000_float_gprs = 1; \
if (!rs6000_explicit_options.spe) \
rs6000_spe = 1; \
- if (!rs6000_explicit_options.isel) \
- rs6000_isel = 1; \
if (target_flags & MASK_64BIT) \
error ("-m64 not supported in this configuration")
diff --git a/gcc/config/rs6000/linuxspe.h b/gcc/config/rs6000/linuxspe.h
index c526cf8dce4..bcc403e2a3c 100644
--- a/gcc/config/rs6000/linuxspe.h
+++ b/gcc/config/rs6000/linuxspe.h
@@ -36,8 +36,6 @@
rs6000_float_gprs = 1; \
if (!rs6000_explicit_options.spe) \
rs6000_spe = 1; \
- if (!rs6000_explicit_options.isel) \
- rs6000_isel = 1; \
if (target_flags & MASK_64BIT) \
error ("-m64 not supported in this configuration")
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index dcbccbca38e..66e4b51773d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -1553,7 +1553,7 @@ rs6000_override_options (const char *default_cpu)
}
}
- if (TARGET_E500)
+ if (TARGET_E500 && !rs6000_explicit_options.isel)
rs6000_isel = 1;
if (rs6000_cpu == PROCESSOR_PPCE300C2 || rs6000_cpu == PROCESSOR_PPCE300C3)
diff --git a/gcc/configure b/gcc/configure
index 1d16aa0f689..4a58626d2a7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13253,8 +13253,12 @@ fi
# Make gthr-default.h if we have a thread file.
gthread_flags=
if test $thread_file != single; then
- rm -f gthr-default.h
- echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
+ echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h-t
+ if diff gthr-default.h-t gthr-default.h 2>/dev/null; then
+ rm -f gthr-default.h-t
+ else
+ mv -f gthr-default.h-t gthr-default.h
+ fi
gthread_flags=-DHAVE_GTHR_DEFAULT
fi
@@ -14666,13 +14670,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:14669: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:14673: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:14672: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:14676: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:14675: output\"" >&5)
+ (eval echo "\"\$as_me:14679: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -15727,7 +15731,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 15730 "configure"' > conftest.$ac_ext
+ echo '#line 15734 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -16347,11 +16351,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16350: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16354: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16354: \$? = $ac_status" >&5
+ echo "$as_me:16358: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16669,11 +16673,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16672: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16676: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:16676: \$? = $ac_status" >&5
+ echo "$as_me:16680: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -16774,11 +16778,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16777: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16781: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16781: \$? = $ac_status" >&5
+ echo "$as_me:16785: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16829,11 +16833,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16832: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:16836: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:16836: \$? = $ac_status" >&5
+ echo "$as_me:16840: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -19626,7 +19630,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19629 "configure"
+#line 19633 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19726,7 +19730,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 19729 "configure"
+#line 19733 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 49dcf34a6dd..6bca2954e38 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1368,8 +1368,12 @@ fi
# Make gthr-default.h if we have a thread file.
gthread_flags=
if test $thread_file != single; then
- rm -f gthr-default.h
- echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h
+ echo "#include \"gthr-${thread_file}.h\"" > gthr-default.h-t
+ if diff gthr-default.h-t gthr-default.h 2>/dev/null; then
+ rm -f gthr-default.h-t
+ else
+ mv -f gthr-default.h-t gthr-default.h
+ fi
gthread_flags=-DHAVE_GTHR_DEFAULT
fi
AC_SUBST(gthread_flags)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 897a54edb4e..bd2c0dec2fe 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,24 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * parser.c: Fix comment typo.
+
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/35320
+ * decl2.c (grokbitfield): Receive the list of attributes, pass it to
+ grokdeclarator and apply it to the created declaration.
+ * cp-tree.h (grokbitfield): Update prototype.
+ * parser.c (cp_parser_member_declaration): Don't apply the attributes
+ since they are now applied in grokbitfield. Adjusted the call to
+ grokbitfield.
+ (cp_parser_objc_class_ivars): Likewise.
+
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/35317
+ * class.c (type_requires_array_cookie): Do not consider delete[]
+ operators with an ellipsis as second argument.
+
2008-06-09 Jakub Jelinek <jakub@redhat.com>
PR c++/36408
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 4d786a288c1..12b17f3751c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4127,6 +4127,10 @@ type_requires_array_cookie (tree type)
second_parm = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn)));
if (second_parm == void_list_node)
return false;
+ /* Do not consider this function if its second argument is an
+ ellipsis. */
+ if (!second_parm)
+ continue;
/* Otherwise, if we have a two-argument function and the second
argument is `size_t', it will be the usual deallocation
function -- unless there is one-argument function, too. */
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 952020ad045..8ad4fe34b9e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4283,7 +4283,7 @@ extern void check_member_template (tree);
extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
tree, bool, tree, tree);
extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
- tree);
+ tree, tree);
extern tree cp_reconstruct_complex_type (tree, tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern void finish_anon_union (tree);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 41af32faec4..ca9440f4230 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -914,9 +914,10 @@ grokfield (const cp_declarator *declarator,
tree
grokbitfield (const cp_declarator *declarator,
- cp_decl_specifier_seq *declspecs, tree width)
+ cp_decl_specifier_seq *declspecs, tree width,
+ tree attrlist)
{
- tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, NULL);
+ tree value = grokdeclarator (declarator, declspecs, BITFIELD, 0, &attrlist);
if (value == error_mark_node)
return NULL_TREE; /* friends went bad. */
@@ -972,6 +973,10 @@ grokbitfield (const cp_declarator *declarator,
}
DECL_IN_AGGR_P (value) = 1;
+
+ if (attrlist)
+ cplus_decl_attributes (&value, attrlist, /*flags=*/0);
+
return value;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 12d1a2d8ad9..a53c0293b7a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15238,9 +15238,8 @@ cp_parser_member_declaration (cp_parser* parser)
sfk_none)
: NULL,
&decl_specifiers,
- width);
- /* Apply the attributes. */
- cplus_decl_attributes (&decl, attributes, /*flags=*/0);
+ width,
+ attributes);
}
else
{
@@ -19150,11 +19149,10 @@ cp_parser_objc_class_ivars (cp_parser* parser)
attributes = chainon (prefix_attributes, attributes);
if (width)
- {
/* Create the bitfield declaration. */
- decl = grokbitfield (declarator, &declspecs, width);
- cplus_decl_attributes (&decl, attributes, /*flags=*/0);
- }
+ decl = grokbitfield (declarator, &declspecs,
+ width,
+ attributes);
else
decl = grokfield (declarator, &declspecs,
NULL_TREE, /*init_const_expr_p=*/false,
@@ -20425,7 +20423,7 @@ cp_parser_omp_for_incr (cp_parser *parser, tree decl)
return build2 (MODIFY_EXPR, TREE_TYPE (decl), decl, rhs);
}
-/* Parse the restricted form of the for statment allowed by OpenMP. */
+/* Parse the restricted form of the for statement allowed by OpenMP. */
static tree
cp_parser_omp_for_loop (cp_parser *parser, tree clauses, tree *par_clauses)
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index 2ef8b54d535..7b5eb7f2835 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -52,7 +52,7 @@ This manual contains no Invariant Sections. The Front-Cover Texts are
@ifinfo
@dircategory Software development
@direntry
-* Cpp: (cpp). The GNU C preprocessor.
+* Cpp: (cpp). The GNU C preprocessor.
@end direntry
@end ifinfo
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index f1b6ebeef94..2fca3664d8f 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -541,7 +541,7 @@ files previously preprocessed with @code{-E -fdirectives-only}.
@anchor{fdollars-in-identifiers}
Accept @samp{$} in identifiers.
@ifset cppmanual
- @xref{Identifier characters}.
+@xref{Identifier characters}.
@end ifset
@item -fextended-identifiers
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 516ecc2af4e..8ead5a8cf29 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -28,10 +28,10 @@ extensions, accepted by GCC in C89 mode and in C++.
* Local Labels:: Labels local to a block.
* Labels as Values:: Getting pointers to labels, and computed gotos.
* Nested Functions:: As in Algol and Pascal, lexical scoping of functions.
-* Constructing Calls:: Dispatching a call to another function.
+* Constructing Calls:: Dispatching a call to another function.
* Typeof:: @code{typeof}: referring to the type of an expression.
* Conditionals:: Omitting the middle operand of a @samp{?:} expression.
-* Long Long:: Double-word integers---@code{long long int}.
+* Long Long:: Double-word integers---@code{long long int}.
* Complex:: Data types for complex numbers.
* Floating Types:: Additional Floating Types.
* Decimal Float:: Decimal Floating Types.
@@ -40,41 +40,41 @@ extensions, accepted by GCC in C89 mode and in C++.
* Zero Length:: Zero-length arrays.
* Variable Length:: Arrays whose length is computed at run time.
* Empty Structures:: Structures with no members.
-* Variadic Macros:: Macros with a variable number of arguments.
+* Variadic Macros:: Macros with a variable number of arguments.
* Escaped Newlines:: Slightly looser rules for escaped newlines.
* Subscripting:: Any array can be subscripted, even if not an lvalue.
* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers.
* Initializers:: Non-constant initializers.
* Compound Literals:: Compound literals give structures, unions
- or arrays as values.
-* Designated Inits:: Labeling elements of initializers.
+ or arrays as values.
+* Designated Inits:: Labeling elements of initializers.
* Cast to Union:: Casting to union type from any member of the union.
-* Case Ranges:: `case 1 ... 9' and such.
-* Mixed Declarations:: Mixing declarations and code.
+* Case Ranges:: `case 1 ... 9' and such.
+* Mixed Declarations:: Mixing declarations and code.
* Function Attributes:: Declaring that functions have no side effects,
- or that they can never return.
+ or that they can never return.
* Attribute Syntax:: Formal syntax for attributes.
* Function Prototypes:: Prototype declarations and old-style definitions.
* C++ Comments:: C++ comments are recognized.
* Dollar Signs:: Dollar sign is allowed in identifiers.
* Character Escapes:: @samp{\e} stands for the character @key{ESC}.
-* Variable Attributes:: Specifying attributes of variables.
-* Type Attributes:: Specifying attributes of types.
+* Variable Attributes:: Specifying attributes of variables.
+* Type Attributes:: Specifying attributes of types.
* Alignment:: Inquiring about the alignment of a type or variable.
* Inline:: Defining inline functions (as fast as macros).
* Extended Asm:: Assembler instructions with C expressions as operands.
- (With them you can define ``built-in'' functions.)
+ (With them you can define ``built-in'' functions.)
* Constraints:: Constraints for asm operands
* Asm Labels:: Specifying the assembler name to use for a C symbol.
* Explicit Reg Vars:: Defining variables residing in specified registers.
* Alternate Keywords:: @code{__const__}, @code{__asm__}, etc., for header files.
* Incomplete Enums:: @code{enum foo;}, with details to follow.
-* Function Names:: Printable strings which are the name of the current
- function.
+* Function Names:: Printable strings which are the name of the current
+ function.
* Return Address:: Getting the return or frame address of a function.
* Vector Extensions:: Using vector instructions through built-in functions.
* Offsetof:: Special syntax for implementing @code{offsetof}.
-* Atomic Builtins:: Built-in functions for atomic memory access.
+* Atomic Builtins:: Built-in functions for atomic memory access.
* Object Size Checking:: Built-in functions for limited buffer overflow
checking.
* Other Builtins:: Other built-in functions.
@@ -2584,7 +2584,7 @@ be non-null pointers. For instance, the declaration:
@smallexample
extern void *
my_memcpy (void *dest, const void *src, size_t len)
- __attribute__((nonnull (1, 2)));
+ __attribute__((nonnull (1, 2)));
@end smallexample
@noindent
@@ -2602,7 +2602,7 @@ following declaration is equivalent to the previous example:
@smallexample
extern void *
my_memcpy (void *dest, const void *src, size_t len)
- __attribute__((nonnull));
+ __attribute__((nonnull));
@end smallexample
@item noreturn
@@ -5503,12 +5503,12 @@ the @code{offsetof} macro.
@smallexample
primary:
- "__builtin_offsetof" "(" @code{typename} "," offsetof_member_designator ")"
+ "__builtin_offsetof" "(" @code{typename} "," offsetof_member_designator ")"
offsetof_member_designator:
- @code{identifier}
- | offsetof_member_designator "." @code{identifier}
- | offsetof_member_designator "[" @code{expr} "]"
+ @code{identifier}
+ | offsetof_member_designator "." @code{identifier}
+ | offsetof_member_designator "[" @code{expr} "]"
@end smallexample
This extension is sufficient such that
@@ -5701,7 +5701,7 @@ assert (__builtin_object_size (p, 0) == sizeof (var) - 1);
assert (__builtin_object_size (p, 1) == sizeof (var.buf1) - 1);
/* The object q points to is var. */
assert (__builtin_object_size (q, 0)
- == (char *) (&var + 1) - (char *) &var.b);
+ == (char *) (&var + 1) - (char *) &var.b);
/* The subobject q points to is var.b. */
assert (__builtin_object_size (q, 1) == sizeof (var.b));
@end smallexample
@@ -5753,11 +5753,11 @@ There are also checking built-in functions for formatted output functions.
@smallexample
int __builtin___sprintf_chk (char *s, int flag, size_t os, const char *fmt, ...);
int __builtin___snprintf_chk (char *s, size_t maxlen, int flag, size_t os,
- const char *fmt, ...);
+ const char *fmt, ...);
int __builtin___vsprintf_chk (char *s, int flag, size_t os, const char *fmt,
- va_list ap);
+ va_list ap);
int __builtin___vsnprintf_chk (char *s, size_t maxlen, int flag, size_t os,
- const char *fmt, va_list ap);
+ const char *fmt, va_list ap);
@end smallexample
The added @var{flag} argument is passed unchanged to @code{__sprintf_chk}
@@ -6788,6 +6788,7 @@ instructions, but allow the compiler to schedule those calls.
* X86 Built-in Functions::
* MIPS DSP Built-in Functions::
* MIPS Paired-Single Support::
+* MIPS Loongson Built-in Functions::
* PowerPC AltiVec Built-in Functions::
* SPARC VIS Built-in Functions::
* SPU Built-in Functions::
@@ -8667,6 +8668,132 @@ value is the upper one. The opposite order applies to big-endian targets.
For example, the code above will set the lower half of @code{a} to
@code{1.5} on little-endian targets and @code{9.1} on big-endian targets.
+@node MIPS Loongson Built-in Functions
+@subsection MIPS Loongson Built-in Functions
+
+GCC provides intrinsics to access the SIMD instructions provided by the
+ST Microelectronics Loongson-2E and -2F processors. These intrinsics,
+available after inclusion of the @code{loongson.h} header file,
+operate on the following 64-bit vector types:
+
+@itemize
+@item @code{uint8x8_t}, a vector of eight unsigned 8-bit integers;
+@item @code{uint16x4_t}, a vector of four unsigned 16-bit integers;
+@item @code{uint32x2_t}, a vector of two unsigned 32-bit integers;
+@item @code{int8x8_t}, a vector of eight signed 8-bit integers;
+@item @code{int16x4_t}, a vector of four signed 16-bit integers;
+@item @code{int32x2_t}, a vector of two signed 32-bit integers.
+@end itemize
+
+The intrinsics provided are listed below; each is named after the
+machine instruction to which it corresponds, with suffixes added as
+appropriate to distinguish intrinsics that expand to the same machine
+instruction yet have different argument types. Refer to the architecture
+documentation for a description of the functionality of each
+instruction.
+
+@smallexample
+int16x4_t packsswh (int32x2_t s, int32x2_t t);
+int8x8_t packsshb (int16x4_t s, int16x4_t t);
+uint8x8_t packushb (uint16x4_t s, uint16x4_t t);
+uint32x2_t paddw_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t paddh_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t paddb_u (uint8x8_t s, uint8x8_t t);
+int32x2_t paddw_s (int32x2_t s, int32x2_t t);
+int16x4_t paddh_s (int16x4_t s, int16x4_t t);
+int8x8_t paddb_s (int8x8_t s, int8x8_t t);
+uint64_t paddd_u (uint64_t s, uint64_t t);
+int64_t paddd_s (int64_t s, int64_t t);
+int16x4_t paddsh (int16x4_t s, int16x4_t t);
+int8x8_t paddsb (int8x8_t s, int8x8_t t);
+uint16x4_t paddush (uint16x4_t s, uint16x4_t t);
+uint8x8_t paddusb (uint8x8_t s, uint8x8_t t);
+uint64_t pandn_ud (uint64_t s, uint64_t t);
+uint32x2_t pandn_uw (uint32x2_t s, uint32x2_t t);
+uint16x4_t pandn_uh (uint16x4_t s, uint16x4_t t);
+uint8x8_t pandn_ub (uint8x8_t s, uint8x8_t t);
+int64_t pandn_sd (int64_t s, int64_t t);
+int32x2_t pandn_sw (int32x2_t s, int32x2_t t);
+int16x4_t pandn_sh (int16x4_t s, int16x4_t t);
+int8x8_t pandn_sb (int8x8_t s, int8x8_t t);
+uint16x4_t pavgh (uint16x4_t s, uint16x4_t t);
+uint8x8_t pavgb (uint8x8_t s, uint8x8_t t);
+uint32x2_t pcmpeqw_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t pcmpeqh_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t pcmpeqb_u (uint8x8_t s, uint8x8_t t);
+int32x2_t pcmpeqw_s (int32x2_t s, int32x2_t t);
+int16x4_t pcmpeqh_s (int16x4_t s, int16x4_t t);
+int8x8_t pcmpeqb_s (int8x8_t s, int8x8_t t);
+uint32x2_t pcmpgtw_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t pcmpgth_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t pcmpgtb_u (uint8x8_t s, uint8x8_t t);
+int32x2_t pcmpgtw_s (int32x2_t s, int32x2_t t);
+int16x4_t pcmpgth_s (int16x4_t s, int16x4_t t);
+int8x8_t pcmpgtb_s (int8x8_t s, int8x8_t t);
+uint16x4_t pextrh_u (uint16x4_t s, int field);
+int16x4_t pextrh_s (int16x4_t s, int field);
+uint16x4_t pinsrh_0_u (uint16x4_t s, uint16x4_t t);
+uint16x4_t pinsrh_1_u (uint16x4_t s, uint16x4_t t);
+uint16x4_t pinsrh_2_u (uint16x4_t s, uint16x4_t t);
+uint16x4_t pinsrh_3_u (uint16x4_t s, uint16x4_t t);
+int16x4_t pinsrh_0_s (int16x4_t s, int16x4_t t);
+int16x4_t pinsrh_1_s (int16x4_t s, int16x4_t t);
+int16x4_t pinsrh_2_s (int16x4_t s, int16x4_t t);
+int16x4_t pinsrh_3_s (int16x4_t s, int16x4_t t);
+int32x2_t pmaddhw (int16x4_t s, int16x4_t t);
+int16x4_t pmaxsh (int16x4_t s, int16x4_t t);
+uint8x8_t pmaxub (uint8x8_t s, uint8x8_t t);
+int16x4_t pminsh (int16x4_t s, int16x4_t t);
+uint8x8_t pminub (uint8x8_t s, uint8x8_t t);
+uint8x8_t pmovmskb_u (uint8x8_t s);
+int8x8_t pmovmskb_s (int8x8_t s);
+uint16x4_t pmulhuh (uint16x4_t s, uint16x4_t t);
+int16x4_t pmulhh (int16x4_t s, int16x4_t t);
+int16x4_t pmullh (int16x4_t s, int16x4_t t);
+int64_t pmuluw (uint32x2_t s, uint32x2_t t);
+uint8x8_t pasubub (uint8x8_t s, uint8x8_t t);
+uint16x4_t biadd (uint8x8_t s);
+uint16x4_t psadbh (uint8x8_t s, uint8x8_t t);
+uint16x4_t pshufh_u (uint16x4_t dest, uint16x4_t s, uint8_t order);
+int16x4_t pshufh_s (int16x4_t dest, int16x4_t s, uint8_t order);
+uint16x4_t psllh_u (uint16x4_t s, uint8_t amount);
+int16x4_t psllh_s (int16x4_t s, uint8_t amount);
+uint32x2_t psllw_u (uint32x2_t s, uint8_t amount);
+int32x2_t psllw_s (int32x2_t s, uint8_t amount);
+uint16x4_t psrlh_u (uint16x4_t s, uint8_t amount);
+int16x4_t psrlh_s (int16x4_t s, uint8_t amount);
+uint32x2_t psrlw_u (uint32x2_t s, uint8_t amount);
+int32x2_t psrlw_s (int32x2_t s, uint8_t amount);
+uint16x4_t psrah_u (uint16x4_t s, uint8_t amount);
+int16x4_t psrah_s (int16x4_t s, uint8_t amount);
+uint32x2_t psraw_u (uint32x2_t s, uint8_t amount);
+int32x2_t psraw_s (int32x2_t s, uint8_t amount);
+uint32x2_t psubw_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t psubh_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t psubb_u (uint8x8_t s, uint8x8_t t);
+int32x2_t psubw_s (int32x2_t s, int32x2_t t);
+int16x4_t psubh_s (int16x4_t s, int16x4_t t);
+int8x8_t psubb_s (int8x8_t s, int8x8_t t);
+uint64_t psubd_u (uint64_t s, uint64_t t);
+int64_t psubd_s (int64_t s, int64_t t);
+int16x4_t psubsh (int16x4_t s, int16x4_t t);
+int8x8_t psubsb (int8x8_t s, int8x8_t t);
+uint16x4_t psubush (uint16x4_t s, uint16x4_t t);
+uint8x8_t psubusb (uint8x8_t s, uint8x8_t t);
+uint32x2_t punpckhwd_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t punpckhhw_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t punpckhbh_u (uint8x8_t s, uint8x8_t t);
+int32x2_t punpckhwd_s (int32x2_t s, int32x2_t t);
+int16x4_t punpckhhw_s (int16x4_t s, int16x4_t t);
+int8x8_t punpckhbh_s (int8x8_t s, int8x8_t t);
+uint32x2_t punpcklwd_u (uint32x2_t s, uint32x2_t t);
+uint16x4_t punpcklhw_u (uint16x4_t s, uint16x4_t t);
+uint8x8_t punpcklbh_u (uint8x8_t s, uint8x8_t t);
+int32x2_t punpcklwd_s (int32x2_t s, int32x2_t t);
+int16x4_t punpcklhw_s (int16x4_t s, int16x4_t t);
+int8x8_t punpcklbh_s (int8x8_t s, int8x8_t t);
+@end smallexample
+
@menu
* Paired-Single Arithmetic::
* Paired-Single Built-in Functions::
@@ -11668,7 +11795,7 @@ test specifically for GNU C++ (@pxref{Common Predefined Macros,,
Predefined Macros,cpp,The GNU C Preprocessor}).
@menu
-* Volatiles:: What constitutes an access to a volatile object.
+* Volatiles:: What constitutes an access to a volatile object.
* Restricted Pointers:: C99 restricted pointers and references.
* Vague Linkage:: Where G++ puts inlines, vtables and such.
* C++ Interface:: You can use a single C++ header file for both
diff --git a/gcc/doc/gcc.texi b/gcc/doc/gcc.texi
index baf4173c787..b97943916f1 100644
--- a/gcc/doc/gcc.texi
+++ b/gcc/doc/gcc.texi
@@ -147,12 +147,12 @@ Introduction, gccint, GNU Compiler Collection (GCC) Internals}.
* GNU Project:: The GNU Project and GNU/Linux.
* Copying:: GNU General Public License says
- how you can copy and share GCC.
+ how you can copy and share GCC.
* GNU Free Documentation License:: How you can copy and share this manual.
* Contributors:: People who have contributed to GCC.
* Option Index:: Index to command line options.
-* Keyword Index:: Index of concepts and symbol names.
+* Keyword Index:: Index of concepts and symbol names.
@end menu
@include frontends.texi
diff --git a/gcc/doc/gccint.texi b/gcc/doc/gccint.texi
index 47e02214f09..b285ec9b3dd 100644
--- a/gcc/doc/gccint.texi
+++ b/gcc/doc/gccint.texi
@@ -125,7 +125,7 @@ Additional tutorial information is linked to from
* GNU Project:: The GNU Project and GNU/Linux.
* Copying:: GNU General Public License says
- how you can copy and share GCC.
+ how you can copy and share GCC.
* GNU Free Documentation License:: How you can copy and share this manual.
* Contributors:: People who have contributed to GCC.
diff --git a/gcc/doc/gcov.texi b/gcc/doc/gcov.texi
index 1f9f5e80122..f48bc51b626 100644
--- a/gcc/doc/gcov.texi
+++ b/gcc/doc/gcov.texi
@@ -38,8 +38,8 @@ included in the gfdl(7) man page.
test code coverage in your programs.
@menu
-* Gcov Intro:: Introduction to gcov.
-* Invoking Gcov:: How to use gcov.
+* Gcov Intro:: Introduction to gcov.
+* Invoking Gcov:: How to use gcov.
* Gcov and Optimization:: Using gcov with GCC optimization.
* Gcov Data Files:: The files used by gcov.
* Cross-profiling:: Data file relocation.
diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
index 624408fc556..17936146a2e 100644
--- a/gcc/doc/gty.texi
+++ b/gcc/doc/gty.texi
@@ -66,9 +66,9 @@ The parser understands simple typedefs such as
These don't need to be marked.
@menu
-* GTY Options:: What goes inside a @code{GTY(())}.
-* GGC Roots:: Making global variables GGC roots.
-* Files:: How the generated files work.
+* GTY Options:: What goes inside a @code{GTY(())}.
+* GGC Roots:: Making global variables GGC roots.
+* Files:: How the generated files work.
@end menu
@node GTY Options
@@ -136,7 +136,7 @@ the length of an array. The first case is when a structure ends in a
variable-length array, like this:
@smallexample
struct rtvec_def GTY(()) @{
- int num_elem; /* @r{number of elements} */
+ int num_elem; /* @r{number of elements} */
rtx GTY ((length ("%h.num_elem"))) elem[1];
@};
@end smallexample
diff --git a/gcc/doc/hostconfig.texi b/gcc/doc/hostconfig.texi
index 4c95c0c346c..96d1fea98b5 100644
--- a/gcc/doc/hostconfig.texi
+++ b/gcc/doc/hostconfig.texi
@@ -22,9 +22,9 @@ definitions, consider using the @code{xm_defines} variable in your
header. @xref{System Config}.
@menu
-* Host Common:: Things every host probably needs implemented.
+* Host Common:: Things every host probably needs implemented.
* Filesystem:: Your host can't have the letter `a' in filenames?
-* Host Misc:: Rare configuration options for hosts.
+* Host Misc:: Rare configuration options for hosts.
@end menu
@node Host Common
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index fdb8dc95957..d21becf76c0 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -655,7 +655,7 @@ internal data files of GCC@. The default is @file{@var{exec-prefix}/lib}.
@item --libexecdir=@var{dirname}
Specify the installation directory for internal executables of GCC@.
- The default is @file{@var{exec-prefix}/libexec}.
+The default is @file{@var{exec-prefix}/libexec}.
@item --with-slibdir=@var{dirname}
Specify the installation directory for the shared libgcc library. The
@@ -1014,14 +1014,23 @@ Specify that the target does not support TLS.
This is an alias for @option{--enable-tls=no}.
@item --with-cpu=@var{cpu}
+@itemx --with-cpu-32=@var{cpu}
+@itemx --with-cpu-64=@var{cpu}
Specify which cpu variant the compiler should generate code for by default.
@var{cpu} will be used as the default value of the @option{-mcpu=} switch.
This option is only supported on some targets, including ARM, i386, M68k,
-PowerPC, and SPARC@.
+PowerPC, and SPARC@. The @option{--with-cpu-32} and
+@option{--with-cpu-64} options specify separate default CPUs for
+32-bit and 64-bit modes; these options are only supported for i386 and
+x86-64.
@item --with-schedule=@var{cpu}
@itemx --with-arch=@var{cpu}
+@itemx --with-arch-32=@var{cpu}
+@itemx --with-arch-64=@var{cpu}
@itemx --with-tune=@var{cpu}
+@itemx --with-tune-32=@var{cpu}
+@itemx --with-tune-64=@var{cpu}
@itemx --with-abi=@var{abi}
@itemx --with-fpu=@var{type}
@itemx --with-float=@var{type}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9be3d679f6b..f1bffe471ad 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -120,11 +120,11 @@ only one of these two forms, whichever one is not the default.
@xref{Option Index}, for an index to GCC's options.
@menu
-* Option Summary:: Brief list of all options, without explanations.
+* Option Summary:: Brief list of all options, without explanations.
* Overall Options:: Controlling the kind of output:
an executable, object files, assembler files,
or preprocessed source.
-* Invoking G++:: Compiling C++ programs.
+* Invoking G++:: Compiling C++ programs.
* C Dialect Options:: Controlling the variant of C language compiled.
* C++ Dialect Options:: Variations on C++.
* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
@@ -748,7 +748,7 @@ See RS/6000 and PowerPC Options.
-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
- -minvalid-symbols}
+-minvalid-symbols}
@emph{SPARC Options}
@gccoptlist{-mcpu=@var{cpu-type} @gol
@@ -5349,9 +5349,9 @@ as follows:
@table @gcctabopt
@item max-inline-insns-single
- is set to @var{n}/2.
+is set to @var{n}/2.
@item max-inline-insns-auto
- is set to @var{n}/2.
+is set to @var{n}/2.
@end table
See below for a documentation of the individual
@@ -9028,7 +9028,7 @@ link scripts will be used to put the application into SDRAM.
Loader should initialize SDRAM before loading the application
into SDRAM. This option defines @code{__BFIN_SDRAM}.
@end table
-
+
@node CRIS Options
@subsection CRIS Options
@cindex CRIS Options
diff --git a/gcc/doc/loop.texi b/gcc/doc/loop.texi
index 52e14fa8d3e..567d7117af4 100644
--- a/gcc/doc/loop.texi
+++ b/gcc/doc/loop.texi
@@ -17,16 +17,16 @@ RTL, as well as the interfaces to loop-related analyses (induction
variable analysis and number of iterations analysis).
@menu
-* Loop representation:: Representation and analysis of loops.
-* Loop querying:: Getting information about loops.
-* Loop manipulation:: Loop manipulation functions.
-* LCSSA:: Loop-closed SSA form.
-* Scalar evolutions:: Induction variables on GIMPLE.
-* loop-iv:: Induction variables on RTL.
-* Number of iterations:: Number of iterations analysis.
-* Dependency analysis:: Data dependency analysis.
-* Lambda:: Linear loop transformations framework.
-* Omega:: A solver for linear programming problems.
+* Loop representation:: Representation and analysis of loops.
+* Loop querying:: Getting information about loops.
+* Loop manipulation:: Loop manipulation functions.
+* LCSSA:: Loop-closed SSA form.
+* Scalar evolutions:: Induction variables on GIMPLE.
+* loop-iv:: Induction variables on RTL.
+* Number of iterations:: Number of iterations analysis.
+* Dependency analysis:: Data dependency analysis.
+* Lambda:: Linear loop transformations framework.
+* Omega:: A solver for linear programming problems.
@end menu
@node Loop representation
diff --git a/gcc/doc/makefile.texi b/gcc/doc/makefile.texi
index 434f79697b5..b10643c32e7 100644
--- a/gcc/doc/makefile.texi
+++ b/gcc/doc/makefile.texi
@@ -103,8 +103,8 @@ compiler as bootstrapping from scratch, but it ensures that the new
code is syntactically correct (e.g., that you did not use GCC extensions
by mistake), and avoids spurious bootstrap comparison
failures@footnote{Except if the compiler was buggy and miscompiled
- some of the files that were not modified. In this case, it's best
- to use @command{make restrap}.}.
+some of the files that were not modified. In this case, it's best
+to use @command{make restrap}.}.
Other targets available from the top level include:
@@ -149,7 +149,7 @@ the system compiler is rebuilt.
For each package that is bootstrapped, rename directories so that,
for example, @file{gcc} points to the stage@var{N} GCC, compiled
with the stage@var{N-1} GCC@footnote{Customarily, the system compiler
- is also termed the @file{stage0} GCC.}.
+is also termed the @file{stage0} GCC.}.
You will invoke this target if you need to test or debug the
stage@var{N} GCC@. If you only need to execute GCC (but you need
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 8884d71a291..c0018a77d12 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -25,11 +25,11 @@ See the next chapter for information on the C header file.
* Example:: An explained example of a @code{define_insn} pattern.
* RTL Template:: The RTL template defines what insns match a pattern.
* Output Template:: The output template says how to make assembler code
- from such an insn.
+ from such an insn.
* Output Statement:: For more generality, write C code to output
- the assembler code.
+ the assembler code.
* Predicates:: Controlling what kinds of operands can be used
- for an insn.
+ for an insn.
* Constraints:: Fine-tuning operand selection.
* Standard Names:: Names mark patterns to use for code generation.
* Pattern Ordering:: When the order of patterns makes a difference.
@@ -38,13 +38,13 @@ See the next chapter for information on the C header file.
* Looping Patterns:: How to define patterns for special looping insns.
* Insn Canonicalizations::Canonicalization of Instructions
* Expander Definitions::Generating a sequence of several RTL insns
- for a standard operation.
+ for a standard operation.
* Insn Splitting:: Splitting Instructions into Multiple Instructions.
-* Including Patterns:: Including Patterns in Machine Descriptions.
+* Including Patterns:: Including Patterns in Machine Descriptions.
* Peephole Definitions::Defining machine-specific peephole optimizations.
* Insn Attributes:: Specifying the value of attributes for generated insns.
* Conditional Execution::Generating @code{define_insn} patterns for
- predication.
+ predication.
* Constant Definitions::Defining symbolic constants that can be used in the
md file.
* Iterators:: Using iterators to generate patterns from a template.
@@ -1629,7 +1629,7 @@ it includes both constraints that are useful for @code{asm} and
constraints that aren't. The compiler source file mentioned in the
table heading for each architecture is the definitive reference for
the meanings of that architecture's constraints.
-
+
@table @emph
@item ARM family---@file{config/arm/arm.h}
@table @code
@@ -2849,10 +2849,10 @@ Signed 16-bit constant (@minus{}32768--32767)
@item L
Value appropriate as displacement.
@table @code
- @item (0..4095)
- for short displacement
- @item (-524288..524287)
- for long displacement
+@item (0..4095)
+for short displacement
+@item (-524288..524287)
+for long displacement
@end table
@item M
@@ -2861,14 +2861,14 @@ Constant integer with a value of 0x7fffffff.
@item N
Multiple letter constraint followed by 4 parameter letters.
@table @code
- @item 0..9:
- number of the part counting from most to least significant
- @item H,Q:
- mode of the part
- @item D,S,H:
- mode of the containing operand
- @item 0,F:
- value of the other parts (F---all bits set)
+@item 0..9:
+number of the part counting from most to least significant
+@item H,Q:
+mode of the part
+@item D,S,H:
+mode of the containing operand
+@item 0,F:
+value of the other parts (F---all bits set)
@end table
The constraint matches if the specified part of a constant
has a value different from its other parts.
@@ -3398,8 +3398,8 @@ definition from the i386 machine description.)
(define_peephole2
[(match_scratch:SI 3 "r")
(set (match_operand:SI 0 "register_operand" "")
- (mult:SI (match_operand:SI 1 "memory_operand" "")
- (match_operand:SI 2 "immediate_operand" "")))]
+ (mult:SI (match_operand:SI 1 "memory_operand" "")
+ (match_operand:SI 2 "immediate_operand" "")))]
"!satisfies_constraint_K (operands[2])"
@@ -5440,15 +5440,15 @@ following for its @code{dbra} instruction:
@group
(define_insn "decrement_and_branch_until_zero"
[(set (pc)
- (if_then_else
- (ge (plus:SI (match_operand:SI 0 "general_operand" "+d*am")
- (const_int -1))
- (const_int 0))
- (label_ref (match_operand 1 "" ""))
- (pc)))
+ (if_then_else
+ (ge (plus:SI (match_operand:SI 0 "general_operand" "+d*am")
+ (const_int -1))
+ (const_int 0))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))
(set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
+ (plus:SI (match_dup 0)
+ (const_int -1)))]
"find_reg_note (insn, REG_NONNEG, 0)"
"@dots{}")
@end group
@@ -5466,14 +5466,14 @@ pattern will not be matched by the combiner.
@group
(define_insn "decrement_and_branch_until_zero"
[(set (pc)
- (if_then_else
- (ge (match_operand:SI 0 "general_operand" "+d*am")
- (const_int 1))
- (label_ref (match_operand 1 "" ""))
- (pc)))
+ (if_then_else
+ (ge (match_operand:SI 0 "general_operand" "+d*am")
+ (const_int 1))
+ (label_ref (match_operand 1 "" ""))
+ (pc)))
(set (match_dup 0)
- (plus:SI (match_dup 0)
- (const_int -1)))]
+ (plus:SI (match_dup 0)
+ (const_int -1)))]
"find_reg_note (insn, REG_NONNEG, 0)"
"@dots{}")
@end group
@@ -6095,7 +6095,7 @@ from i386.md:
"&& reload_completed"
[(parallel [(set (match_dup 0)
(and:SI (match_dup 0) (const_int 65535)))
- (clobber (reg:CC 17))])]
+ (clobber (reg:CC 17))])]
""
[(set_attr "type" "alu1")])
@@ -7236,10 +7236,10 @@ the instruction issue is possible if there is a transition from one
automaton state to another one. This algorithm is very fast, and
furthermore, its speed is not dependent on processor
complexity@footnote{However, the size of the automaton depends on
- processor complexity. To limit this effect, machine descriptions
- can split orthogonal parts of the machine description among several
- automata: but then, since each of these must be stepped independently,
- this does cause a small decrease in the algorithm's performance.}.
+processor complexity. To limit this effect, machine descriptions
+can split orthogonal parts of the machine description among several
+automata: but then, since each of these must be stepped independently,
+this does cause a small decrease in the algorithm's performance.}.
@cindex automaton based pipeline description
The rest of this section describes the directives that constitute
@@ -7839,8 +7839,8 @@ rtx-based construct, such as a @code{define_insn},
@menu
* Defining Mode Iterators:: Defining a new mode iterator.
-* Substitutions:: Combining mode iterators with substitutions
-* Examples:: Examples
+* Substitutions:: Combining mode iterators with substitutions
+* Examples:: Examples
@end menu
@node Defining Mode Iterators
diff --git a/gcc/doc/options.texi b/gcc/doc/options.texi
index 6b5fead3e1d..e13279b962b 100644
--- a/gcc/doc/options.texi
+++ b/gcc/doc/options.texi
@@ -29,13 +29,13 @@ The files can contain the following types of record:
@itemize @bullet
@item
-A language definition record.  These records have two fields: the
-string @samp{Language} and the name of the language.  Once a language
+A language definition record. These records have two fields: the
+string @samp{Language} and the name of the language. Once a language
has been declared in this way, it can be used as an option property.
@xref{Option properties}.
@item
-An option definition record.  These records have the following fields:
+An option definition record. These records have the following fields:
@enumerate
@item
@@ -62,11 +62,11 @@ tab forms the help text. This allows you to elaborate on what type
of argument the option takes.
@item
-A target mask record.  These records have one field of the form
-@samp{Mask(@var{x})}.  The options-processing script will automatically
+A target mask record. These records have one field of the form
+@samp{Mask(@var{x})}. The options-processing script will automatically
allocate a bit in @code{target_flags} (@pxref{Run-time Target}) for
each mask name @var{x} and set the macro @code{MASK_@var{x}} to the
-appropriate bitmask.  It will also declare a @code{TARGET_@var{x}}
+appropriate bitmask. It will also declare a @code{TARGET_@var{x}}
macro that has the value 1 when bit @code{MASK_@var{x}} is set and
0 otherwise.
diff --git a/gcc/doc/passes.texi b/gcc/doc/passes.texi
index 526eb7674f5..4b0c0b6fb7c 100644
--- a/gcc/doc/passes.texi
+++ b/gcc/doc/passes.texi
@@ -20,7 +20,7 @@ where near complete.
@menu
* Parsing pass:: The language front end turns text into bits.
* Gimplification pass:: The bits are turned into something we can optimize.
-* Pass manager:: Sequencing the optimization passes.
+* Pass manager:: Sequencing the optimization passes.
* Tree-SSA passes:: Optimizations on a high-level representation.
* RTL passes:: Optimizations on a low-level representation.
@end menu
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index 635c716769a..85febd20038 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -198,9 +198,7 @@ timestamp.
@itemize @bullet
@item The standard GNU @file{config.sub} and @file{config.guess}
-files, kept in the top level directory, are used. FIXME: when is the
-@file{config.guess} file in the @file{gcc} directory (that just calls
-the top level one) used?
+files, kept in the top level directory, are used.
@item The file @file{config.gcc} is used to handle configuration
specific to the particular target machine. The file
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index d18bf2e00e9..d4ba0e20814 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -35,7 +35,7 @@ through the macros defined in the @file{.h} file.
* Register Classes:: Defining the classes of hardware registers.
* Old Constraints:: The old way to define machine-specific constraints.
* Stack and Calling:: Defining which way the stack grows and by how much.
-* Varargs:: Defining the varargs macros.
+* Varargs:: Defining the varargs macros.
* Trampolines:: Code set up at run time to enter a nested function.
* Library Calls:: Controlling how library routines are implicitly called.
* Addressing Modes:: Defining addressing modes valid for memory operands.
@@ -44,7 +44,7 @@ through the macros defined in the @file{.h} file.
* Costs:: Defining relative costs of different operations.
* Scheduling:: Adjusting the behavior of the instruction scheduler.
* Sections:: Dividing storage into text, data, and other sections.
-* PIC:: Macros for position independent code.
+* PIC:: Macros for position independent code.
* Assembler Format:: Defining how to write insns and pseudo-ops to output.
* Debugging Info:: Defining the format of debugging output.
* Floating Point:: Handling floating point for cross-compilers.
@@ -1911,11 +1911,11 @@ For passing values in registers, see @ref{Register Arguments}.
For returning values in registers, see @ref{Scalar Return}.
@menu
-* Register Basics:: Number and kinds of registers.
-* Allocation Order:: Order in which registers are allocated.
-* Values in Registers:: What kinds of values each reg can hold.
-* Leaf Functions:: Renumbering registers for leaf functions.
-* Stack Registers:: Handling a register stack such as 80387.
+* Register Basics:: Number and kinds of registers.
+* Allocation Order:: Order in which registers are allocated.
+* Values in Registers:: What kinds of values each reg can hold.
+* Leaf Functions:: Renumbering registers for leaf functions.
+* Stack Registers:: Handling a register stack such as 80387.
@end menu
@node Register Basics
@@ -2985,7 +2985,7 @@ be treated like memory constraints by the reload pass.
It should return 1 if the operand type represented by the constraint
at the start of @var{str}, the first letter of which is the letter @var{c},
- comprises a subset of all memory references including
+comprises a subset of all memory references including
all those whose address is simply a base register. This allows the reload
pass to reload an operand, if it does not directly correspond to the operand
type of @var{c}, by copying its address into a base register.
@@ -6779,10 +6779,10 @@ instructions do.
* Uninitialized Data:: Output of uninitialized variables.
* Label Output:: Output and generation of labels.
* Initialization:: General principles of initialization
- and termination routines.
+ and termination routines.
* Macros for Initialization::
- Specific macros that control the handling of
- initialization and termination routines.
+ Specific macros that control the handling of
+ initialization and termination routines.
* Instruction Output:: Output of actual instructions.
* Dispatch Tables:: Output of jump tables.
* Exception Region Output:: Output of exception region code.
@@ -6911,7 +6911,7 @@ This is true on most ELF targets.
Choose a set of section attributes for use by @code{TARGET_ASM_NAMED_SECTION}
based on a variable or function decl, a section name, and whether or not the
declaration's initializer may contain runtime relocations. @var{decl} may be
- null, in which case read-write data should be assumed.
+null, in which case read-write data should be assumed.
The default version of this function handles choosing code vs data,
read-only vs read-write data, and @code{flag_pic}. You should only
@@ -7115,7 +7115,7 @@ assembler for grouping arithmetic expressions. If not overridden, they
default to normal parentheses, which is correct for most assemblers.
@end deftypevr
- These macros are provided by @file{real.h} for writing the definitions
+These macros are provided by @file{real.h} for writing the definitions
of @code{ASM_OUTPUT_DOUBLE} and the like:
@defmac REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
diff --git a/gcc/doc/tree-ssa.texi b/gcc/doc/tree-ssa.texi
index b6ba4938053..0bf89b22be4 100644
--- a/gcc/doc/tree-ssa.texi
+++ b/gcc/doc/tree-ssa.texi
@@ -37,12 +37,12 @@ functions and programming constructs needed to implement optimization
passes for GIMPLE@.
@menu
-* GENERIC:: A high-level language-independent representation.
+* GENERIC:: A high-level language-independent representation.
* GIMPLE:: A lower-level factored tree representation.
-* Annotations:: Attributes for statements and variables.
-* Statement Operands:: Variables referenced by GIMPLE statements.
-* SSA:: Static Single Assignment representation.
-* Alias analysis:: Representing aliased loads and stores.
+* Annotations:: Attributes for statements and variables.
+* Statement Operands:: Variables referenced by GIMPLE statements.
+* SSA:: Static Single Assignment representation.
+* Alias analysis:: Representing aliased loads and stores.
@end menu
@node GENERIC
@@ -735,10 +735,10 @@ void f()
| RELOP
op0 -> val
op1 -> val
- | COND_EXPR
- op0 -> condition
- op1 -> val
- op2 -> val
+ | COND_EXPR
+ op0 -> condition
+ op1 -> val
+ op2 -> val
@end smallexample
@node Annotations
@@ -943,7 +943,7 @@ How to choose the appropriate iterator:
@enumerate
@item Determine whether you are need to see the operand pointers, or just the
- trees, and choose the appropriate macro:
+trees, and choose the appropriate macro:
@smallexample
Need Macro:
@@ -954,12 +954,12 @@ tree FOR_EACH_SSA_TREE_OPERAND
@end smallexample
@item You need to declare a variable of the type you are interested
- in, and an ssa_op_iter structure which serves as the loop
- controlling variable.
+in, and an ssa_op_iter structure which serves as the loop controlling
+variable.
@item Determine which operands you wish to use, and specify the flags of
- those you are interested in. They are documented in
- @file{tree-ssa-operands.h}:
+those you are interested in. They are documented in
+@file{tree-ssa-operands.h}:
@smallexample
#define SSA_OP_USE 0x01 /* @r{Real USE operands.} */
@@ -1228,27 +1228,27 @@ which''.
The following macros can be used to examine PHI nodes
-@defmac PHI_RESULT (@var{phi})
+@defmac PHI_RESULT (@var{phi})
Returns the @code{SSA_NAME} created by PHI node @var{phi} (i.e.,
@var{phi}'s LHS)@.
@end defmac
-@defmac PHI_NUM_ARGS (@var{phi})
+@defmac PHI_NUM_ARGS (@var{phi})
Returns the number of arguments in @var{phi}. This number is exactly
the number of incoming edges to the basic block holding @var{phi}@.
@end defmac
-@defmac PHI_ARG_ELT (@var{phi}, @var{i})
+@defmac PHI_ARG_ELT (@var{phi}, @var{i})
Returns a tuple representing the @var{i}th argument of @var{phi}@.
Each element of this tuple contains an @code{SSA_NAME} @var{var} and
the incoming edge through which @var{var} flows.
@end defmac
-@defmac PHI_ARG_EDGE (@var{phi}, @var{i})
+@defmac PHI_ARG_EDGE (@var{phi}, @var{i})
Returns the incoming edge for the @var{i}th argument of @var{phi}.
@end defmac
-@defmac PHI_ARG_DEF (@var{phi}, @var{i})
+@defmac PHI_ARG_DEF (@var{phi}, @var{i})
Returns the @code{SSA_NAME} for the @var{i}th argument of @var{phi}.
@end defmac
@@ -1274,36 +1274,36 @@ the program@.
For instance, given the following code:
@smallexample
- 1 L0:
- 2 x_1 = PHI (0, x_5)
- 3 if (x_1 < 10)
- 4 if (x_1 > 7)
- 5 y_2 = 0
- 6 else
- 7 y_3 = x_1 + x_7
- 8 endif
- 9 x_5 = x_1 + 1
+ 1 L0:
+ 2 x_1 = PHI (0, x_5)
+ 3 if (x_1 < 10)
+ 4 if (x_1 > 7)
+ 5 y_2 = 0
+ 6 else
+ 7 y_3 = x_1 + x_7
+ 8 endif
+ 9 x_5 = x_1 + 1
10 goto L0;
- 11 endif
+ 11 endif
@end smallexample
Suppose that we insert new names @code{x_10} and @code{x_11} (lines
@code{4} and @code{8})@.
@smallexample
- 1 L0:
- 2 x_1 = PHI (0, x_5)
- 3 if (x_1 < 10)
- 4 x_10 = @dots{}
- 5 if (x_1 > 7)
- 6 y_2 = 0
- 7 else
- 8 x_11 = @dots{}
- 9 y_3 = x_1 + x_7
- 10 endif
- 11 x_5 = x_1 + 1
- 12 goto L0;
- 13 endif
+ 1 L0:
+ 2 x_1 = PHI (0, x_5)
+ 3 if (x_1 < 10)
+ 4 x_10 = @dots{}
+ 5 if (x_1 > 7)
+ 6 y_2 = 0
+ 7 else
+ 8 x_11 = @dots{}
+ 9 y_3 = x_1 + x_7
+ 10 endif
+ 11 x_5 = x_1 + 1
+ 12 goto L0;
+ 13 endif
@end smallexample
We want to replace all the uses of @code{x_1} with the new definitions
@@ -1341,40 +1341,40 @@ There are several @code{TODO} flags that control the behavior of
@itemize @bullet
@item @code{TODO_update_ssa}. Update the SSA form inserting PHI nodes
- for newly exposed symbols and virtual names marked for updating.
- When updating real names, only insert PHI nodes for a real name
- @code{O_j} in blocks reached by all the new and old definitions for
- @code{O_j}. If the iterated dominance frontier for @code{O_j}
- is not pruned, we may end up inserting PHI nodes in blocks that
- have one or more edges with no incoming definition for
- @code{O_j}. This would lead to uninitialized warnings for
- @code{O_j}'s symbol@.
+for newly exposed symbols and virtual names marked for updating.
+When updating real names, only insert PHI nodes for a real name
+@code{O_j} in blocks reached by all the new and old definitions for
+@code{O_j}. If the iterated dominance frontier for @code{O_j}
+is not pruned, we may end up inserting PHI nodes in blocks that
+have one or more edges with no incoming definition for
+@code{O_j}. This would lead to uninitialized warnings for
+@code{O_j}'s symbol@.
@item @code{TODO_update_ssa_no_phi}. Update the SSA form without
- inserting any new PHI nodes at all. This is used by passes that
- have either inserted all the PHI nodes themselves or passes that
- need only to patch use-def and def-def chains for virtuals
- (e.g., DCE)@.
+inserting any new PHI nodes at all. This is used by passes that
+have either inserted all the PHI nodes themselves or passes that
+need only to patch use-def and def-def chains for virtuals
+(e.g., DCE)@.
@item @code{TODO_update_ssa_full_phi}. Insert PHI nodes everywhere
- they are needed. No pruning of the IDF is done. This is used
- by passes that need the PHI nodes for @code{O_j} even if it
- means that some arguments will come from the default definition
- of @code{O_j}'s symbol (e.g., @code{pass_linear_transform})@.
+they are needed. No pruning of the IDF is done. This is used
+by passes that need the PHI nodes for @code{O_j} even if it
+means that some arguments will come from the default definition
+of @code{O_j}'s symbol (e.g., @code{pass_linear_transform})@.
- WARNING: If you need to use this flag, chances are that your
- pass may be doing something wrong. Inserting PHI nodes for an
- old name where not all edges carry a new replacement may lead to
- silent codegen errors or spurious uninitialized warnings@.
+WARNING: If you need to use this flag, chances are that your
+pass may be doing something wrong. Inserting PHI nodes for an
+old name where not all edges carry a new replacement may lead to
+silent codegen errors or spurious uninitialized warnings@.
@item @code{TODO_update_ssa_only_virtuals}. Passes that update the
- SSA form on their own may want to delegate the updating of
- virtual names to the generic updater. Since FUD chains are
- easier to maintain, this simplifies the work they need to do.
- NOTE: If this flag is used, any OLD->NEW mappings for real names
- are explicitly destroyed and only the symbols marked for
- renaming are processed@.
+SSA form on their own may want to delegate the updating of
+virtual names to the generic updater. Since FUD chains are
+easier to maintain, this simplifies the work they need to do.
+NOTE: If this flag is used, any OLD->NEW mappings for real names
+are explicitly destroyed and only the symbols marked for
+renaming are processed@.
@end itemize
@subsection Preserving the virtual SSA form
@@ -1445,8 +1445,8 @@ slightly different. For each argument @var{arg} of the PHI node, this
function will:
@enumerate
-@item Walk the use-def chains for @var{arg}.
-@item Call @code{FN (@var{arg}, @var{phi}, @var{data})}.
+@item Walk the use-def chains for @var{arg}.
+@item Call @code{FN (@var{arg}, @var{phi}, @var{data})}.
@end enumerate
Note how the first argument to @var{fn} is no longer the original
@@ -1466,26 +1466,26 @@ hooks to execute custom code at various points during traversal:
@enumerate
@item Once to initialize any local data needed while processing
- @var{bb} and its children. This local data is pushed into an
- internal stack which is automatically pushed and popped as the
- walker traverses the dominator tree.
+@var{bb} and its children. This local data is pushed into an
+internal stack which is automatically pushed and popped as the
+walker traverses the dominator tree.
@item Once before traversing all the statements in the @var{bb}.
@item Once for every statement inside @var{bb}.
@item Once after traversing all the statements and before recursing
- into @var{bb}'s dominator children.
+into @var{bb}'s dominator children.
@item It then recurses into all the dominator children of @var{bb}.
@item After recursing into all the dominator children of @var{bb} it
- can, optionally, traverse every statement in @var{bb} again
- (i.e., repeating steps 2 and 3).
+can, optionally, traverse every statement in @var{bb} again
+(i.e., repeating steps 2 and 3).
@item Once after walking the statements in @var{bb} and @var{bb}'s
- dominator children. At this stage, the block local data stack
- is popped.
+dominator children. At this stage, the block local data stack
+is popped.
@end enumerate
@end deftypefn
@@ -1535,16 +1535,16 @@ int bar (void)
If you copy the symbol tag for a variable for some reason, you probably
also want to copy the subvariables for that variable.
-@item Points-to and escape analysis.
+@item Points-to and escape analysis.
This phase walks the use-def chains in the SSA web looking for
three things:
- @itemize @bullet
- @item Assignments of the form @code{P_i = &VAR}
- @item Assignments of the form P_i = malloc()
- @item Pointers and ADDR_EXPR that escape the current function.
- @end itemize
+@itemize @bullet
+@item Assignments of the form @code{P_i = &VAR}
+@item Assignments of the form P_i = malloc()
+@item Pointers and ADDR_EXPR that escape the current function.
+@end itemize
The concept of `escaping' is the same one used in the Java world.
When a pointer or an ADDR_EXPR escapes, it means that it has been
@@ -1562,7 +1562,7 @@ call-clobbered. Simply put, if an ADDR_EXPR escapes, then the
variable is call-clobbered. If a pointer P_i escapes, then all
the variables pointed-to by P_i (and its memory tag) also escape.
-@item Compute flow-sensitive aliases
+@item Compute flow-sensitive aliases
We have two classes of memory tags. Memory tags associated with
the pointed-to data type of the pointers in the program. These
@@ -1579,7 +1579,7 @@ associated with each pointer P_i. If P_i escapes, we mark
call-clobbered the variables it points to and its tag.
-@item Compute flow-insensitive aliases
+@item Compute flow-insensitive aliases
This pass will compare the alias set of every symbol memory tag and
every addressable variable found in the program. Given a symbol
diff --git a/gcc/doc/trouble.texi b/gcc/doc/trouble.texi
index 8a31a74ccee..6ea3273ed59 100644
--- a/gcc/doc/trouble.texi
+++ b/gcc/doc/trouble.texi
@@ -19,21 +19,21 @@ missing features that are too much work to add, and some are places
where people's opinions differ as to what is best.
@menu
-* Actual Bugs:: Bugs we will fix later.
-* Cross-Compiler Problems:: Common problems of cross compiling with GCC.
+* Actual Bugs:: Bugs we will fix later.
+* Cross-Compiler Problems:: Common problems of cross compiling with GCC.
* Interoperation:: Problems using GCC with other compilers,
- and with certain linkers, assemblers and debuggers.
+ and with certain linkers, assemblers and debuggers.
* Incompatibilities:: GCC is incompatible with traditional C.
* Fixed Headers:: GCC uses corrected versions of system header files.
- This is necessary, but doesn't always work smoothly.
+ This is necessary, but doesn't always work smoothly.
* Standard Libraries:: GCC uses the system C library, which might not be
- compliant with the ISO C standard.
+ compliant with the ISO C standard.
* Disappointments:: Regrettable things we can't change, but not quite bugs.
-* C++ Misunderstandings:: Common misunderstandings with GNU C++.
+* C++ Misunderstandings:: Common misunderstandings with GNU C++.
* Protoize Caveats:: Things to watch out for when using @code{protoize}.
-* Non-bugs:: Things we think are right, but some others disagree.
+* Non-bugs:: Things we think are right, but some others disagree.
* Warnings and Errors:: Which problems in your code get warnings,
- and which get errors.
+ and which get errors.
@end menu
@node Actual Bugs
diff --git a/gcc/expr.c b/gcc/expr.c
index d55a2797fb5..2357170dd16 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5795,13 +5795,19 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
&& mode != TYPE_MODE (TREE_TYPE (exp)))
temp = convert_modes (mode, TYPE_MODE (TREE_TYPE (exp)), temp, 1);
- /* If the modes of TARGET and TEMP are both BLKmode, both
+ /* If the modes of TEMP and TARGET are both BLKmode, both
must be in memory and BITPOS must be aligned on a byte
- boundary. If so, we simply do a block copy. */
- if (GET_MODE (target) == BLKmode && GET_MODE (temp) == BLKmode)
+ boundary. If so, we simply do a block copy. Likewise
+ for a BLKmode-like TARGET. */
+ if (GET_MODE (temp) == BLKmode
+ && (GET_MODE (target) == BLKmode
+ || (MEM_P (target)
+ && GET_MODE_CLASS (GET_MODE (target)) == MODE_INT
+ && (bitpos % BITS_PER_UNIT) == 0
+ && (bitsize % BITS_PER_UNIT) == 0)))
{
gcc_assert (MEM_P (target) && MEM_P (temp)
- && !(bitpos % BITS_PER_UNIT));
+ && (bitpos % BITS_PER_UNIT) == 0);
target = adjust_address (target, VOIDmode, bitpos / BITS_PER_UNIT);
emit_block_move (target, temp,
@@ -5847,12 +5853,11 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
If any of the extraction expressions is volatile,
we store 1 in *PVOLATILEP. Otherwise we don't change that.
- If the field is a bit-field, *PMODE is set to VOIDmode. Otherwise, it
- is a mode that can be used to access the field. In that case, *PBITSIZE
- is redundant.
+ If the field is a non-BLKmode bit-field, *PMODE is set to VOIDmode.
+ Otherwise, it is a mode that can be used to access the field.
If the field describes a variable-sized object, *PMODE is set to
- VOIDmode and *PBITSIZE is set to -1. An access cannot be made in
+ BLKmode and *PBITSIZE is set to -1. An access cannot be made in
this case, but the address of the object can be found.
If KEEP_ALIGNING is true and the target is STRICT_ALIGNMENT, we don't
@@ -5877,6 +5882,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
{
tree size_tree = 0;
enum machine_mode mode = VOIDmode;
+ bool blkmode_bitfield = false;
tree offset = size_zero_node;
tree bit_offset = bitsize_zero_node;
@@ -5884,11 +5890,14 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
outermost expression. */
if (TREE_CODE (exp) == COMPONENT_REF)
{
- size_tree = DECL_SIZE (TREE_OPERAND (exp, 1));
- if (! DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
- mode = DECL_MODE (TREE_OPERAND (exp, 1));
+ tree field = TREE_OPERAND (exp, 1);
+ size_tree = DECL_SIZE (field);
+ if (!DECL_BIT_FIELD (field))
+ mode = DECL_MODE (field);
+ else if (DECL_MODE (field) == BLKmode)
+ blkmode_bitfield = true;
- *punsignedp = DECL_UNSIGNED (TREE_OPERAND (exp, 1));
+ *punsignedp = DECL_UNSIGNED (field);
}
else if (TREE_CODE (exp) == BIT_FIELD_REF)
{
@@ -5922,8 +5931,6 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
*pbitsize = tree_low_cst (size_tree, 1);
}
- *pmode = mode;
-
/* Compute cumulative bit-offset for nested component-refs and array-refs,
and find the ultimate containing object. */
while (1)
@@ -6018,14 +6025,25 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
if (double_int_fits_in_shwi_p (tem))
{
*pbitpos = double_int_to_shwi (tem);
- *poffset = NULL_TREE;
- return exp;
+ *poffset = offset = NULL_TREE;
}
}
/* Otherwise, split it up. */
- *pbitpos = tree_low_cst (bit_offset, 0);
- *poffset = offset;
+ if (offset)
+ {
+ *pbitpos = tree_low_cst (bit_offset, 0);
+ *poffset = offset;
+ }
+
+ /* We can use BLKmode for a byte-aligned BLKmode bitfield. */
+ if (mode == VOIDmode
+ && blkmode_bitfield
+ && (*pbitpos % BITS_PER_UNIT) == 0
+ && (*pbitsize % BITS_PER_UNIT) == 0)
+ *pmode = BLKmode;
+ else
+ *pmode = mode;
return exp;
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 317fbe26231..82ca881e7bb 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,30 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gfc-internals.texi: Expand TABs, drop indentation outside examples.
+ * gfortran.texi: Likewise.
+ * intrinsic.texi: Likewise.
+ * invoke.texi: Likewise.
+
+2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/35863
+ * trans-io.c (gfc_build_io_library_fndecls): Build declaration for
+ transfer_character_wide which includes passing in the character kind to
+ support wide character IO. (transfer_expr): If the kind == 4, create the
+ argument and build the call.
+ * gfortran.texi: Fix typo.
+
+2008-06-13 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36476
+ * decl.c (do_parm): Handle init expression for len=*.
+
+2008-06-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36462
+ * trans-intrinsic.c (gfc_conv_intrinsic_index_scan_verify):
+ Fix passing of the BACK= argument.
+
2008-06-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* cpp.c: Add copyright notice.
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index c4ef7e7004d..a1c7d5aa44e 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5820,10 +5820,27 @@ do_parm (void)
&& sym->ts.cl->length != NULL
&& sym->ts.cl->length->expr_type == EXPR_CONSTANT
&& init->expr_type == EXPR_CONSTANT
- && init->ts.type == BT_CHARACTER
- && init->ts.kind == 1)
+ && init->ts.type == BT_CHARACTER)
gfc_set_constant_character_len (
mpz_get_si (sym->ts.cl->length->value.integer), init, false);
+ else if (sym->ts.type == BT_CHARACTER && sym->ts.cl != NULL
+ && sym->ts.cl->length == NULL)
+ {
+ int clen;
+ if (init->expr_type == EXPR_CONSTANT)
+ {
+ clen = init->value.character.length;
+ sym->ts.cl->length = gfc_int_expr (clen);
+ }
+ else if (init->expr_type == EXPR_ARRAY)
+ {
+ gfc_expr *p = init->value.constructor->expr;
+ clen = p->value.character.length;
+ sym->ts.cl->length = gfc_int_expr (clen);
+ }
+ else if (init->ts.cl && init->ts.cl->length)
+ sym->ts.cl->length = gfc_copy_expr (sym->value->ts.cl->length);
+ }
sym->value = init;
return MATCH_YES;
diff --git a/gcc/fortran/gfc-internals.texi b/gcc/fortran/gfc-internals.texi
index f693aa9a72d..0a91310fe7d 100644
--- a/gcc/fortran/gfc-internals.texi
+++ b/gcc/fortran/gfc-internals.texi
@@ -121,7 +121,7 @@ not accurately reflect the status of the most recent GNU Fortran compiler.
Data structures used by the frontend
* LibGFortran:: The LibGFortran Runtime Library.
* GNU Free Documentation License::
- How you can copy and share this manual.
+ How you can copy and share this manual.
* Index:: Index of this documentation.
@end menu
@end ifnottex
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index c47f22fcfa0..cf90ceda833 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -190,7 +190,7 @@ Part II: Language Reference
* Copying:: GNU General Public License says
how you can copy and share GNU Fortran.
* GNU Free Documentation License::
- How you can copy and share this manual.
+ How you can copy and share this manual.
* Funding:: How to help assure continued work for free software.
* Option Index:: Index of command line options
* Keyword Index:: Index of concepts
@@ -229,7 +229,7 @@ or alternative to, the unix @command{f95} command;
* Preprocessing and conditional compilation:: The Fortran preprocessor
* GNU Fortran and G77:: Why we chose to start from scratch.
* Project Status:: Status of GNU Fortran, roadmap, proposed extensions.
-* Standards:: Standards supported by GNU Fortran.
+* Standards:: Standards supported by GNU Fortran.
@end menu
@@ -525,7 +525,7 @@ support is reported in the @ref{Fortran 2003 status} section of the
documentation.
The next version of the Fortran standard after Fortran 2003 is currently
-being developped and the GNU Fortran compiler supports some of its new
+being developed and the GNU Fortran compiler supports some of its new
features. This support is based on the latest draft of the standard
(available from @url{http://www.nag.co.uk/sc22wg5/}) and no guarantee of
future compatibility is made, as the final standard might differ from the
@@ -693,7 +693,7 @@ the modes are the same as for the @code{CONVERT} specifier:
@item @code{NATIVE} Use the native format. This is the default.
@item @code{SWAP} Swap between little- and big-endian.
@item @code{LITTLE_ENDIAN} Use the little-endian format
- for unformatted files.
+for unformatted files.
@item @code{BIG_ENDIAN} Use the big-endian format for unformatted files.
@end itemize
A missing mode for an exception is taken to mean @code{BIG_ENDIAN}.
@@ -1415,9 +1415,9 @@ Valid values for @code{CONVERT} are:
@item @code{CONVERT='NATIVE'} Use the native format. This is the default.
@item @code{CONVERT='SWAP'} Swap between little- and big-endian.
@item @code{CONVERT='LITTLE_ENDIAN'} Use the little-endian representation
- for unformatted files.
+for unformatted files.
@item @code{CONVERT='BIG_ENDIAN'} Use the big-endian representation for
- unformatted files.
+unformatted files.
@end itemize
Using the option could look like this:
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index ee358501bed..db336bfcd92 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -489,8 +489,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{I} @tab The type shall be @code{INTEGER}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -789,8 +788,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{A} @tab The type of the argument shall be @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -1059,8 +1057,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{A} @tab The type of the argument shall be @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -2004,9 +2001,9 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{CPTR} @tab scalar of the type @code{C_FUNPTR}. It is
- @code{INTENT(IN)}.
+@code{INTENT(IN)}.
@item @var{FPTR} @tab procedure pointer interoperable with @var{cptr}. It is
- @code{INTENT(OUT)}.
+@code{INTENT(OUT)}.
@end multitable
@item @emph{Example}:
@@ -2062,13 +2059,13 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{CPTR} @tab scalar of the type @code{C_PTR}. It is
- @code{INTENT(IN)}.
+@code{INTENT(IN)}.
@item @var{FPTR} @tab pointer interoperable with @var{cptr}. It is
- @code{INTENT(OUT)}.
+@code{INTENT(OUT)}.
@item @var{SHAPE} @tab (Optional) Rank-one array of type @code{INTEGER}
- with @code{INTENT(IN)}. It shall be present
- if and only if @var{fptr} is an array. The size
- must be equal to the rank of @var{fptr}.
+with @code{INTENT(IN)}. It shall be present
+if and only if @var{fptr} is an array. The size
+must be equal to the rank of @var{fptr}.
@end multitable
@item @emph{Example}:
@@ -2115,8 +2112,7 @@ Inquiry function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{X} @tab Associated scalar pointer or interoperable scalar
- or allocated allocatable variable with @code{TARGET}
- attribute.
+or allocated allocatable variable with @code{TARGET} attribute.
@end multitable
@item @emph{Return value}:
@@ -2213,8 +2209,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{A} @tab The type shall be @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -2260,8 +2255,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{I} @tab The type shall be @code{INTEGER}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -2315,11 +2309,10 @@ Subroutine, function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{NAME} @tab The type shall be @code{CHARACTER} of default
- kind and shall specify a valid path within the
- file system.
+kind and shall specify a valid path within the file system.
@item @var{STATUS} @tab (Optional) @code{INTEGER} status flag of the default
- kind. Returns 0 on success, and a system specific
- and nonzero error code otherwise.
+kind. Returns 0 on success, and a system specific and nonzero error code
+otherwise.
@end multitable
@item @emph{Example}:
@@ -2434,13 +2427,11 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{X} @tab The type may be @code{INTEGER}, @code{REAL},
- or @code{COMPLEX}.
+or @code{COMPLEX}.
@item @var{Y} @tab (Optional; only allowed if @var{X} is not
- @code{COMPLEX}.) May be @code{INTEGER}
- or @code{REAL}.
+@code{COMPLEX}.) May be @code{INTEGER} or @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -2750,8 +2741,7 @@ Transformational function
@item @var{MASK} @tab The type shall be @code{LOGICAL}.
@item @var{DIM} @tab (Optional) The type shall be @code{INTEGER}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -2928,7 +2918,7 @@ Subroutine, function
@multitable @columnfractions .15 .70
@item @var{TIME} @tab The type shall be of type @code{INTEGER(KIND=8)}.
@item @var{RESULT} @tab The type shall be of type @code{CHARACTER} and
- of default kind.
+of default kind.
@end multitable
@item @emph{Return value}:
@@ -2982,7 +2972,7 @@ Unavailable time and date parameters return blanks.
@item @tab @code{VALUE(6)}: @tab The minutes of the hour
@item @tab @code{VALUE(7)}: @tab The seconds of the minute
@item @tab @code{VALUE(8)}: @tab The milliseconds of the second
-@end multitable
+@end multitable
@item @emph{Standard}:
Fortran 95 and later
@@ -2996,11 +2986,11 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{DATE} @tab (Optional) The type shall be @code{CHARACTER(LEN=8)}
- or larger, and of default kind.
+or larger, and of default kind.
@item @var{TIME} @tab (Optional) The type shall be @code{CHARACTER(LEN=10)}
- or larger, and of default kind.
+or larger, and of default kind.
@item @var{ZONE} @tab (Optional) The type shall be @code{CHARACTER(LEN=5)}
- or larger, and of default kind.
+or larger, and of default kind.
@item @var{VALUES}@tab (Optional) The type shall be @code{INTEGER(8)}.
@end multitable
@@ -3051,7 +3041,7 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A} @tab The type shall be @code{INTEGER}, @code{REAL},
- or @code{COMPLEX}.
+or @code{COMPLEX}.
@end multitable
@item @emph{Return value}:
@@ -3098,9 +3088,9 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{X} @tab The type may be @code{INTEGER}, @code{REAL},
- or @code{COMPLEX}.
+or @code{COMPLEX}.
@item @var{Y} @tab (Optional if @var{X} is not @code{COMPLEX}.) May be
- @code{INTEGER} or @code{REAL}.
+@code{INTEGER} or @code{REAL}.
@end multitable
@item @emph{Return value}:
@@ -4060,10 +4050,10 @@ Subroutine, function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
- kind.
+kind.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
- Returns 0 on success, -1 on end-of-file, and a
- system specific positive error code otherwise.
+Returns 0 on success, -1 on end-of-file, and a system specific positive
+error code otherwise.
@end multitable
@item @emph{Example}:
@@ -4123,10 +4113,10 @@ Subroutine, function
@multitable @columnfractions .15 .70
@item @var{UNIT} @tab The type shall be @code{INTEGER}.
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
- kind.
+kind.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
- Returns 0 on success, -1 on end-of-file and a
- system specific positive error code otherwise.
+Returns 0 on success, -1 on end-of-file and a system specific positive
+error code otherwise.
@end multitable
@item @emph{Example}:
@@ -4174,8 +4164,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{A} @tab The type shall be @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -4305,10 +4294,10 @@ Subroutine, function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
- kind.
+kind.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
- Returns 0 on success, -1 on end-of-file and a
- system specific positive error code otherwise.
+Returns 0 on success, -1 on end-of-file and a system specific positive
+error code otherwise.
@end multitable
@item @emph{Example}:
@@ -4362,10 +4351,10 @@ Subroutine, function
@multitable @columnfractions .15 .70
@item @var{UNIT} @tab The type shall be @code{INTEGER}.
@item @var{C} @tab The type shall be @code{CHARACTER} and of default
- kind.
+kind.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
- Returns 0 on success, -1 on end-of-file and a
- system specific positive error code otherwise.
+Returns 0 on success, -1 on end-of-file and a system specific positive
+error code otherwise.
@end multitable
@item @emph{Example}:
@@ -4581,7 +4570,7 @@ Subroutine, function
@item @var{UNIT} @tab An open I/O unit number of type @code{INTEGER}.
@item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
- on success and a system specific error code otherwise.
+on success and a system specific error code otherwise.
@end multitable
@item @emph{Example}:
@@ -4873,9 +4862,9 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{NUMBER} @tab Shall be a scalar of type @code{INTEGER(4)},
- @math{@var{NUMBER} \geq 0}
+@math{@var{NUMBER} \geq 0}
@item @var{VALUE} @tab Shall be a scalar of type @code{CHARACTER}
- and of default kind.
+and of default kind.
@item @var{LENGTH} @tab (Option) Shall be a scalar of type @code{INTEGER(4)}.
@item @var{STATUS} @tab (Option) Shall be a scalar of type @code{INTEGER(4)}.
@end multitable
@@ -4939,7 +4928,7 @@ Subroutine, function
@multitable @columnfractions .15 .70
@item @var{C} @tab The type shall be @code{CHARACTER} and of default kind.
@item @var{STATUS} @tab (Optional) status flag. Returns 0 on success,
- a system specific and nonzero error code otherwise.
+a system specific and nonzero error code otherwise.
@end multitable
@item @emph{Example}:
@@ -5231,17 +5220,16 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{TIME} @tab An @code{INTEGER} scalar expression
- corresponding to a system time, with
- @code{INTENT(IN)}.
+corresponding to a system time, with @code{INTENT(IN)}.
@item @var{VALUES} @tab A default @code{INTEGER} array with 9 elements,
- with @code{INTENT(OUT)}.
+with @code{INTENT(OUT)}.
@end multitable
@item @emph{Return value}:
The elements of @var{VALUES} are assigned as follows:
@enumerate
@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
- seconds
+seconds
@item Minutes after the hour, range 0--59
@item Hours past midnight, range 0--23
@item Day of month, range 0--31
@@ -5250,8 +5238,7 @@ The elements of @var{VALUES} are assigned as follows:
@item Number of days since Sunday, range 0--6
@item Days since January 1
@item Daylight savings indicator: positive if daylight savings is in
- effect, zero if not, and negative if the information is not
- available.
+effect, zero if not, and negative if the information is not available.
@end enumerate
@item @emph{See also}:
@@ -5289,8 +5276,7 @@ Subroutine, function
@multitable @columnfractions .15 .70
@item @var{C} @tab Shall of type @code{CHARACTER} and of default kind.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER}.
- Returns 0 on success, or a system specific error
- code otherwise.
+Returns 0 on success, or a system specific error code otherwise.
@end multitable
@item @emph{Return value}:
@@ -5405,8 +5391,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -5662,8 +5647,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{C} @tab Shall be a scalar @code{CHARACTER}, with @code{INTENT(IN)}
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -5856,8 +5840,7 @@ Elemental function
@item @var{BACK} @tab (Optional) Shall be a scalar @code{LOGICAL}, with
@code{INTENT(IN)}
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -5893,10 +5876,9 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A} @tab Shall be of type @code{INTEGER},
- @code{REAL}, or @code{COMPLEX}.
+@code{REAL}, or @code{COMPLEX}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -5961,7 +5943,7 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A} @tab Shall be of type @code{INTEGER},
- @code{REAL}, or @code{COMPLEX}.
+@code{REAL}, or @code{COMPLEX}.
@end multitable
@item @emph{Return value}:
@@ -5996,7 +5978,7 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A} @tab Shall be of type @code{INTEGER},
- @code{REAL}, or @code{COMPLEX}.
+@code{REAL}, or @code{COMPLEX}.
@end multitable
@item @emph{Return value}:
@@ -6428,8 +6410,8 @@ Subroutine, function
@item @var{VALUE} @tab Shall be a scalar @code{INTEGER}, with
@code{INTENT(IN)}
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)} or
- @code{INTEGER(8)}. Returns 0 on success, or a
- system-specific error code otherwise.
+@code{INTEGER(8)}. Returns 0 on success, or a system-specific error code
+otherwise.
@end multitable
@item @emph{See also}:
@@ -6504,8 +6486,7 @@ Inquiry function
@item @var{ARRAY} @tab Shall be an array, of any type.
@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -6550,8 +6531,7 @@ Inquiry function
@item @var{STRING} @tab Shall be a scalar or array of type
@code{CHARACTER}, with @code{INTENT(IN)}
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -6587,8 +6567,7 @@ Elemental function
@item @var{STRING} @tab Shall be a scalar of type @code{CHARACTER},
with @code{INTENT(IN)}
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -7085,8 +7064,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{L} @tab The type shall be @code{LOGICAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -7124,7 +7102,7 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A} @tab Shall be of type @code{INTEGER},
- @code{REAL}, or @code{COMPLEX}.
+@code{REAL}, or @code{COMPLEX}.
@end multitable
@item @emph{Return value}:
@@ -7243,17 +7221,16 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{STIME} @tab An @code{INTEGER} scalar expression
- corresponding to a system time, with
- @code{INTENT(IN)}.
+corresponding to a system time, with @code{INTENT(IN)}.
@item @var{TARRAY} @tab A default @code{INTEGER} array with 9 elements,
- with @code{INTENT(OUT)}.
+with @code{INTENT(OUT)}.
@end multitable
@item @emph{Return value}:
The elements of @var{TARRAY} are assigned as follows:
@enumerate
@item Seconds after the minute, range 0--59 or 0--61 to allow for leap
- seconds
+seconds
@item Minutes after the hour, range 0--59
@item Hours past midnight, range 0--23
@item Day of month, range 0--31
@@ -7262,8 +7239,7 @@ The elements of @var{TARRAY} are assigned as follows:
@item Number of days since Sunday, range 0--6
@item Days since January 1
@item Daylight savings indicator: positive if daylight savings is in
- effect, zero if not, and negative if the information is not
- available.
+effect, zero if not, and negative if the information is not available.
@end enumerate
@item @emph{See also}:
@@ -7361,17 +7337,13 @@ Transformational function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{MATRIX_A} @tab An array of @code{INTEGER},
- @code{REAL}, @code{COMPLEX}, or
- @code{LOGICAL} type, with a rank of
- one or two.
+@code{REAL}, @code{COMPLEX}, or @code{LOGICAL} type, with a rank of
+one or two.
@item @var{MATRIX_B} @tab An array of @code{INTEGER},
- @code{REAL}, or @code{COMPLEX} type if
- @var{MATRIX_A} is of a numeric type;
- otherwise, an array of @code{LOGICAL}
- type. The rank shall be one or two, and the
- first (or only) dimension of @var{MATRIX_B}
- shall be equal to the last (or only)
- dimension of @var{MATRIX_A}.
+@code{REAL}, or @code{COMPLEX} type if @var{MATRIX_A} is of a numeric
+type; otherwise, an array of @code{LOGICAL} type. The rank shall be one
+or two, and the first (or only) dimension of @var{MATRIX_B} shall be
+equal to the last (or only) dimension of @var{MATRIX_A}.
@end multitable
@item @emph{Return value}:
@@ -7410,11 +7382,10 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A1} @tab The type shall be @code{INTEGER} or
- @code{REAL}.
+@code{REAL}.
@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
- as @var{A1}. (As a GNU extension,
- arguments of different kinds are
- permitted.)
+as @var{A1}. (As a GNU extension, arguments of different kinds are
+permitted.)
@end multitable
@item @emph{Return value}:
@@ -7514,13 +7485,12 @@ Transformational function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
- @code{REAL}, or @code{CHARACTER}.
+@code{REAL}, or @code{CHARACTER}.
@item @var{DIM} @tab (Optional) Shall be a scalar of type
- @code{INTEGER}, with a value between one
- and the rank of @var{ARRAY}, inclusive. It
- may not be an optional dummy argument.
+@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
+inclusive. It may not be an optional dummy argument.
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
- and conformable with @var{ARRAY}.
+and conformable with @var{ARRAY}.
@end multitable
@item @emph{Return value}:
@@ -7571,13 +7541,12 @@ Transformational function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
- @code{REAL}, or @code{CHARACTER}.
+@code{REAL}, or @code{CHARACTER}.
@item @var{DIM} @tab (Optional) Shall be a scalar of type
- @code{INTEGER}, with a value between one
- and the rank of @var{ARRAY}, inclusive. It
- may not be an optional dummy argument.
+@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
+inclusive. It may not be an optional dummy argument.
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
- and conformable with @var{ARRAY}.
+and conformable with @var{ARRAY}.
@end multitable
@item @emph{Return value}:
@@ -7696,7 +7665,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{TSOURCE} @tab May be of any type.
@item @var{FSOURCE} @tab Shall be of the same type and type parameters
- as @var{TSOURCE}.
+as @var{TSOURCE}.
@item @var{MASK} @tab Shall be of type @code{LOGICAL}.
@end multitable
@@ -7733,11 +7702,10 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{A1} @tab The type shall be @code{INTEGER} or
- @code{REAL}.
+@code{REAL}.
@item @var{A2}, @var{A3}, ... @tab An expression of the same type and kind
- as @var{A1}. (As a GNU extension,
- arguments of different kinds are
- permitted.)
+as @var{A1}. (As a GNU extension, arguments of different kinds are
+permitted.)
@end multitable
@item @emph{Return value}:
@@ -7828,13 +7796,12 @@ Transformational function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
- @code{REAL}, or @code{CHARACTER}.
+@code{REAL}, or @code{CHARACTER}.
@item @var{DIM} @tab (Optional) Shall be a scalar of type
- @code{INTEGER}, with a value between one
- and the rank of @var{ARRAY}, inclusive. It
- may not be an optional dummy argument.
+@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
+inclusive. It may not be an optional dummy argument.
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
- and conformable with @var{ARRAY}.
+and conformable with @var{ARRAY}.
@end multitable
@item @emph{Return value}:
@@ -7885,13 +7852,12 @@ Transformational function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{ARRAY} @tab Shall be an array of type @code{INTEGER},
- @code{REAL}, or @code{CHARACTER}.
+@code{REAL}, or @code{CHARACTER}.
@item @var{DIM} @tab (Optional) Shall be a scalar of type
- @code{INTEGER}, with a value between one
- and the rank of @var{ARRAY}, inclusive. It
- may not be an optional dummy argument.
+@code{INTEGER}, with a value between one and the rank of @var{ARRAY},
+inclusive. It may not be an optional dummy argument.
@item @var{MASK} @tab Shall be an array of type @code{LOGICAL},
- and conformable with @var{ARRAY}.
+and conformable with @var{ARRAY}.
@end multitable
@item @emph{Return value}:
@@ -8049,9 +8015,9 @@ Subroutine
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{SRC} @tab @code{ALLOCATABLE}, @code{INTENT(INOUT)}, may be
- of any type and kind.
+of any type and kind.
@item @var{DEST} @tab @code{ALLOCATABLE}, @code{INTENT(OUT)}, shall be
- of the same type, kind and rank as @var{SRC}
+of the same type, kind and rank as @var{SRC}.
@end multitable
@item @emph{Return value}:
@@ -8102,7 +8068,7 @@ Elemental subroutine
@item @var{FROMPOS} @tab The type shall be @code{INTEGER}.
@item @var{LEN} @tab The type shall be @code{INTEGER}.
@item @var{TO} @tab The type shall be @code{INTEGER}, of the
- same kind as @var{FROM}.
+same kind as @var{FROM}.
@item @var{TOPOS} @tab The type shall be @code{INTEGER}.
@end multitable
@@ -8181,7 +8147,7 @@ Inquiry function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{C} @tab The argument shall be a scalar or array of the
- type @code{CHARACTER}.
+type @code{CHARACTER}.
@end multitable
@item @emph{Return value}:
@@ -8222,8 +8188,7 @@ Elemental function
@multitable @columnfractions .15 .70
@item @var{X} @tab The type of the argument shall be @code{REAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -8931,10 +8896,9 @@ Elemental function
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{X} @tab Shall be @code{INTEGER}, @code{REAL}, or
- @code{COMPLEX}.
+@code{COMPLEX}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -9257,8 +9221,7 @@ Elemental function
@item @var{SET} @tab Shall be of type @code{CHARACTER}.
@item @var{BACK} @tab (Optional) shall be of type @code{LOGICAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -9858,8 +9821,7 @@ a pointer it must be associated and allocatable arrays must be allocated.
and its value shall be in the range from 1 to n, where n equals the rank
of @var{ARRAY}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -10240,7 +10202,7 @@ Subroutine, function
default kind and a valid path within the file system.
@item @var{BUFF} @tab The type shall be @code{INTEGER(4), DIMENSION(13)}.
@item @var{STATUS} @tab (Optional) status flag of type @code{INTEGER(4)}. Returns 0
- on success and a system specific error code otherwise.
+on success and a system specific error code otherwise.
@end multitable
@item @emph{Example}:
@@ -10888,8 +10850,7 @@ Inquiry function
@item @var{ARRAY} @tab Shall be an array, of any type.
@item @var{DIM} @tab (Optional) Shall be a scalar @code{INTEGER}.
@item @var{KIND}@tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
@@ -10932,7 +10893,7 @@ Subroutine
@multitable @columnfractions .15 .70
@item @var{MASK} @tab Shall be a scalar of type @code{INTEGER}.
@item @var{MASK} @tab (Optional) Shall be a scalar of type
- @code{INTEGER}.
+@code{INTEGER}.
@end multitable
@end table
@@ -11060,8 +11021,7 @@ Elemental function
@item @var{SET} @tab Shall be of type @code{CHARACTER}.
@item @var{BACK} @tab (Optional) shall be of type @code{LOGICAL}.
@item @var{KIND} @tab (Optional) An @code{INTEGER} initialization
- expression indicating the kind parameter of
- the result.
+expression indicating the kind parameter of the result.
@end multitable
@item @emph{Return value}:
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index 1494c04013e..0879f52d7df 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -15,7 +15,7 @@ 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
@@ -36,7 +36,7 @@ gfortran [@option{-c}|@option{-S}|@option{-E}]
[@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
[@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
[@option{-f}@var{option}@dots{}]
- [@option{-m}@var{machine-option}@dots{}]
+ [@option{-m}@var{machine-option}@dots{}]
[@option{-o} @var{outfile}] @var{infile}@dots{}
Only the most useful options are listed here; see below for the
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index f1223933080..c032675cfcb 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -2751,11 +2751,17 @@ gfc_conv_intrinsic_index_scan_verify (gfc_se * se, gfc_expr * expr,
tree *args;
unsigned int num_args;
- num_args = gfc_intrinsic_argument_list_length (expr);
args = alloca (sizeof (tree) * 5);
- gfc_conv_intrinsic_function_args (se, expr, args,
- num_args >= 5 ? 5 : num_args);
+ /* Get number of arguments; characters count double due to the
+ string length argument. Kind= is not passed to the libary
+ and thus ignored. */
+ if (expr->value.function.actual->next->next->expr == NULL)
+ num_args = 4;
+ else
+ num_args = 5;
+
+ gfc_conv_intrinsic_function_args (se, expr, args, num_args);
type = gfc_typenode_for_spec (&expr->ts);
if (num_args == 4)
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 2f35002a5ac..f210169abe0 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -121,6 +121,7 @@ enum iocall
IOCALL_X_INTEGER,
IOCALL_X_LOGICAL,
IOCALL_X_CHARACTER,
+ IOCALL_X_CHARACTER_WIDE,
IOCALL_X_REAL,
IOCALL_X_COMPLEX,
IOCALL_X_ARRAY,
@@ -327,6 +328,13 @@ gfc_build_io_library_fndecls (void)
void_type_node, 3, dt_parm_type,
pvoid_type_node, gfc_int4_type_node);
+ iocall[IOCALL_X_CHARACTER_WIDE] =
+ gfc_build_library_function_decl (get_identifier
+ (PREFIX("transfer_character_wide")),
+ void_type_node, 4, dt_parm_type,
+ pvoid_type_node, gfc_charlen_type_node,
+ gfc_int4_type_node);
+
iocall[IOCALL_X_REAL] =
gfc_build_library_function_decl (get_identifier (PREFIX("transfer_real")),
void_type_node, 3, dt_parm_type,
@@ -1977,7 +1985,7 @@ transfer_array_component (tree expr, gfc_component * cm)
static void
transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
{
- tree tmp, function, arg2, field, expr;
+ tree tmp, function, arg2, arg3, field, expr;
gfc_component *c;
int kind;
@@ -2009,6 +2017,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
kind = ts->kind;
function = NULL;
arg2 = NULL;
+ arg3 = NULL;
switch (ts->type)
{
@@ -2033,6 +2042,26 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
break;
case BT_CHARACTER:
+ if (kind == 4)
+ {
+ if (se->string_length)
+ arg2 = se->string_length;
+ else
+ {
+ tmp = build_fold_indirect_ref (addr_expr);
+ gcc_assert (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE);
+ arg2 = TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (tmp)));
+ arg2 = fold_convert (gfc_charlen_type_node, arg2);
+ }
+ arg3 = build_int_cst (NULL_TREE, kind);
+ function = iocall[IOCALL_X_CHARACTER_WIDE];
+ tmp = build_fold_addr_expr (dt_parm);
+ tmp = build_call_expr (function, 4, tmp, addr_expr, arg2, arg3);
+ gfc_add_expr_to_block (&se->pre, tmp);
+ gfc_add_block_to_block (&se->pre, &se->post);
+ return;
+ }
+ /* Fall through. */
case BT_HOLLERITH:
if (se->string_length)
arg2 = se->string_length;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 144e25d4c37..1941c9642ae 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,13 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * gcj.texi: Expand TABs, remove whitespace from blank lines.
+
+2008-06-14 Tom Tromey <tromey@redhat.com>
+
+ PR java/36247:
+ * class.c (build_class_ref): Initialize this_classdollar when
+ needed.
+
2008-05-23 Andrew Haley <aph@redhat.com>
* jcf-parse.c (give_name_to_class): Call find_sourcefile to find full
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 85e37bc468b..dff75ac9e43 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1142,7 +1142,13 @@ build_class_ref (tree type)
return build_indirect_class_ref (type);
if (type == output_class && flag_indirect_classes)
- return this_classdollar;
+ {
+ /* This can be NULL if we see a JNI stub before we see any
+ other method. */
+ if (! this_classdollar)
+ this_classdollar = build_classdollar_field (output_class);
+ return this_classdollar;
+ }
if (TREE_CODE (type) == RECORD_TYPE)
return build_static_class_ref (type);
diff --git a/gcc/java/gcj.texi b/gcc/java/gcj.texi
index 40e1cd6c10b..94172d80b20 100644
--- a/gcc/java/gcj.texi
+++ b/gcc/java/gcj.texi
@@ -104,20 +104,20 @@ files and object files, and it can read both Java source code and
@file{.class} files.
@menu
-* Copying:: The GNU General Public License
+* Copying:: The GNU General Public License
* GNU Free Documentation License::
- How you can share and copy this manual
-* Invoking gcj:: Compiler options supported by @command{gcj}
-* Compatibility:: Compatibility between gcj and other tools for Java
+ How you can share and copy this manual
+* Invoking gcj:: Compiler options supported by @command{gcj}
+* Compatibility:: Compatibility between gcj and other tools for Java
* Invoking jcf-dump:: Print information about class files
-* Invoking gij:: Interpreting Java bytecodes
+* Invoking gij:: Interpreting Java bytecodes
* Invoking gcj-dbtool:: Tool for manipulating class file databases.
* Invoking jv-convert:: Converting from one encoding to another
* Invoking grmic:: Generate stubs for Remote Method Invocation.
* Invoking gc-analyze:: Analyze Garbage Collector (GC) memory dumps.
* About CNI:: Description of the Compiled Native Interface
* System properties:: Modifying runtime behavior of the libgcj library
-* Resources:: Where to look for more information
+* Resources:: Where to look for more information
* Index:: Index.
@end menu
@@ -159,12 +159,12 @@ options specific to @command{gcj}.
@menu
* Input and output files::
-* Input Options:: How gcj finds files
+* Input Options:: How gcj finds files
* Encodings:: Options controlling source file encoding
-* Warnings:: Options controlling warnings specific to gcj
-* Linking:: Options for making an executable
-* Code Generation:: Options controlling the output of gcj
-* Configure-time Options:: Options you won't use
+* Warnings:: Options controlling warnings specific to gcj
+* Linking:: Options for making an executable
+* Code Generation:: Options controlling the output of gcj
+* Configure-time Options:: Options you won't use
@end menu
@c man begin OPTIONS gcj
@@ -1176,7 +1176,7 @@ public class GCDumpTest
static public void main(String args[])
@{
ArrayList<String> l = new ArrayList<String>(1000);
-
+
for (int i = 1; i < 1500; i++) @{
l.add("This is string #" + i);
@}
@@ -1243,7 +1243,7 @@ alternative to the standard JNI (Java Native Interface).
* Mixing with C++:: How CNI can interoperate with C++.
* Exception Handling:: How exceptions are handled.
* Synchronization:: Synchronizing between Java and C++.
-* Invocation:: Starting the Java runtime from C++.
+* Invocation:: Starting the Java runtime from C++.
* Reflection:: Using reflection from C++.
@end menu
@@ -1493,7 +1493,7 @@ you can only call an interface method when the declared type of the
field being called matches the interface which declares that
method. The workaround is to cast the interface reference to the right
superinterface.
-
+
For example if you have:
@example
@@ -1501,13 +1501,13 @@ interface A
@{
void a();
@}
-
+
interface B extends A
@{
void b();
@}
@end example
-
+
and declare a variable of type @code{B} in C++, you can't call
@code{a()} unless you cast it to an @code{A} first.
@@ -2269,7 +2269,7 @@ The example can be compiled with @command{c++ -c test.cc; gcj test.o}.
int main(int argc, char *argv[])
@{
using namespace java::lang;
-
+
try
@{
JvCreateJavaVM(NULL);
diff --git a/gcc/longlong.h b/gcc/longlong.h
index 38b4c6fb221..45a95c40eb5 100644
--- a/gcc/longlong.h
+++ b/gcc/longlong.h
@@ -226,6 +226,12 @@ UDItype __umulsidi3 (USItype, USItype);
#define UDIV_TIME 100
#endif /* __arm__ */
+#if defined(__arm__)
+/* Let gcc decide how best to implement count_leading_zeros. */
+#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif
+
#if defined (__CRIS__) && __CRIS_arch_version >= 3
#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
#if __CRIS_arch_version >= 8
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index e9223b2afb2..09b7260a66e 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -235,7 +235,7 @@ extract_omp_for_data (tree for_stmt, struct omp_for_data *fd,
/* FIXME: for now map schedule(auto) to schedule(static).
There should be analysis to determine whether all iterations
are approximately the same amount of work (then schedule(static)
- is best) or if it varries (then schedule(dynamic,N) is better). */
+ is best) or if it varies (then schedule(dynamic,N) is better). */
if (fd->sched_kind == OMP_CLAUSE_SCHEDULE_AUTO)
{
fd->sched_kind = OMP_CLAUSE_SCHEDULE_STATIC;
@@ -4389,6 +4389,8 @@ expand_omp_sections (struct omp_region *region)
unsigned i, casei, len;
basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb;
block_stmt_iterator si;
+ edge_iterator ei;
+ edge e;
struct omp_region *inner;
bool exit_reachable = region->cont != NULL;
@@ -4399,10 +4401,31 @@ expand_omp_sections (struct omp_region *region)
l2_bb = region->exit;
if (exit_reachable)
{
- gcc_assert (single_pred (l2_bb) == l0_bb);
+ if (single_pred (l2_bb) == l0_bb)
+ l2 = tree_block_label (l2_bb);
+ else
+ {
+ /* This can happen if there are reductions. */
+ len = EDGE_COUNT (l0_bb->succs);
+ gcc_assert (len > 0);
+ e = EDGE_SUCC (l0_bb, len - 1);
+ si = bsi_last (e->dest);
+ l2 = NULL_TREE;
+ if (bsi_end_p (si) || TREE_CODE (bsi_stmt (si)) != OMP_SECTION)
+ l2 = tree_block_label (e->dest);
+ else
+ FOR_EACH_EDGE (e, ei, l0_bb->succs)
+ {
+ si = bsi_last (e->dest);
+ if (bsi_end_p (si) || TREE_CODE (bsi_stmt (si)) != OMP_SECTION)
+ {
+ l2 = tree_block_label (e->dest);
+ break;
+ }
+ }
+ }
default_bb = create_empty_bb (l1_bb->prev_bb);
l1 = tree_block_label (l1_bb);
- l2 = tree_block_label (l2_bb);
}
else
{
@@ -4480,6 +4503,14 @@ expand_omp_sections (struct omp_region *region)
{
basic_block s_entry_bb, s_exit_bb;
+ /* Skip optional reduction region. */
+ if (inner->type == OMP_ATOMIC_LOAD)
+ {
+ --i;
+ --casei;
+ continue;
+ }
+
s_entry_bb = inner->entry;
s_exit_bb = inner->exit;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 072a5cb948f..95a49dc246d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,90 @@
+2008-06-15 Mark Shinwell <shinwell@codesourcery.com>
+
+ * lib/target-supports.exp (check_effective_target_mips_loongson): New.
+ * gcc.target/mips/loongson-simd.c: New.
+
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/35320
+ * g++.dg/parse/bitfield3.C: New test.
+
+2008-06-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36538
+ * gfortran.dg: namelist_48.f90: New test.
+
+2008-06-14 Simon Martin <simartin@users.sourceforge.net>
+
+ PR c++/35317
+ * g++.dg/other/dtor2.C: New test.
+
+2008-06-13 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/task_stack_align.adb: New test.
+
+2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/35863
+ * gfortran.dg/widechar_IO_1.f90: New test.
+ * gfortran.dg/widechar_IO_2.f90: New test.
+ * gfortran.dg/widechar_IO_3.f90: New test.
+ * gfortran.dg/widechar_IO_4.f90: New test.
+
+2008-06-13 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36476
+ * gfortran.dg/parameter_array_init_4.f90: New.
+
+2008-06-13 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/compile/20080613-1.c: New test.
+
+2008-06-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/36507
+ * gcc.dg/inline-28.c: New test.
+ * gcc.dg/inline-29.c: New test.
+ * gcc.dg/inline-30.c: New test.
+
+2008-06-12 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36462
+ * gfortran.dg/index_2.f90: New.
+
+2008-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr9.ad[sb]: New test.
+
+2008-06-12 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/compat/struct-layout-1.exp (orig_gcc_exec_prefix_saved):
+ Always initialize.
+ * g++.dg/compat/struct-layout-1.exp (orig_gcc_exec_prefix_saved):
+ Always initialize.
+
+2008-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR testsuite/36443
+ * gcc.dg/compat/struct-layout-1.exp: Temporarily unset
+ GCC_EXEC_PREFIX from environment when running $HOSTCC.
+ * g++.dg/compat/struct-layout-1.exp: Likewise.
+
+2008-06-12 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/36345
+ * gcc.c-torture/execute/20020619-1.c: Remove broken part of
+ the testcase.
+
+2008-06-11 Edmar Wienskoski <edmar@freescale.com>
+
+ PR target/36425
+ * gcc.target/powerpc/e500-1.c: New test case to verify
+ mno-isel option.
+
+2008-06-11 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/varsize_copy.ad[sb]: New test.
+
2008-06-10 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/bt-mask-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
index 8aaa79eeaa3..14473486aeb 100644
--- a/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
+++ b/gcc/testsuite/g++.dg/compat/struct-layout-1.exp
@@ -128,8 +128,20 @@ set generator_src "$generator_src $srcdir/$subdir/../../gcc.dg/compat/generate-r
set generator_src "$generator_src $srcdir/$subdir/../../gcc.dg/compat/generate-random_r.c"
set generator_cmd "-o $generator $generator_src"
+# Temporarily unset GCC_EXEC_PREFIX from environment, as that might
+# confuse the $HOSTCC.
+set orig_gcc_exec_prefix_saved 0
+if [info exists env(GCC_EXEC_PREFIX)] {
+ set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
+ set orig_gcc_exec_prefix_saved 1
+ unsetenv GCC_EXEC_PREFIX
+}
set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"]
set status [lindex $status 0]
+if { $orig_gcc_exec_prefix_saved } {
+ set orig_gcc_exec_prefix_saved 0
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+}
if { $status == 0 } then {
file delete -force $tstobjdir
file mkdir $tstobjdir
diff --git a/gcc/testsuite/g++.dg/other/dtor2.C b/gcc/testsuite/g++.dg/other/dtor2.C
new file mode 100644
index 00000000000..459339126eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/dtor2.C
@@ -0,0 +1,7 @@
+/* PR c++/35317 */
+/* { dg-do "compile" } */
+
+struct A
+{
+ void operator delete[] (void*, ...);
+};
diff --git a/gcc/testsuite/g++.dg/parse/bitfield3.C b/gcc/testsuite/g++.dg/parse/bitfield3.C
new file mode 100644
index 00000000000..d907dcdd19b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/bitfield3.C
@@ -0,0 +1,9 @@
+/* PR c++/35320 */
+/* { dg-do "compile" } */
+
+typedef void (func_type)();
+
+struct A
+{
+ friend func_type f : 2; /* { dg-error "with non-integral type" } */
+};
diff --git a/gcc/testsuite/gcc.c-torture/compile/20080613-1.c b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c
new file mode 100644
index 00000000000..f64964e7740
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20080613-1.c
@@ -0,0 +1,40 @@
+/* PR middle-end/36520 */
+/* Testcase by Richard Guenther <rguenth@gcc.gnu.org> */
+
+typedef long unsigned int size_t;
+typedef unsigned short int sa_family_t;
+struct cmsghdr {
+ size_t cmsg_len;
+ __extension__ unsigned char __cmsg_data [];
+};
+typedef unsigned int uint32_t;
+struct in6_addr {
+ union {
+ uint32_t u6_addr32[4];
+ } in6_u;
+};
+struct sockaddr_in {
+ sa_family_t sin_family;
+};
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr;
+};
+typedef union {
+ struct sockaddr_in sin;
+} sockaddr_any;
+static sockaddr_any src_addr;
+
+inline struct cmsghdr * cmsg_put(struct cmsghdr *cm, int type, void *data, size_t len)
+{
+ memcpy(((cm)->__cmsg_data), data, len);
+}
+
+int hop_sendmsg(int fd) {
+ struct cmsghdr *cm;
+ if (src_addr.sin.sin_family) {
+ if (src_addr.sin.sin_family == 2) {
+ struct in6_pktinfo info;
+ cm = cmsg_put(cm, 50, &info, sizeof(info));
+ }
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20020619-1.c b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c
index 5ed4d00b01d..6db1546e867 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20020619-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20020619-1.c
@@ -14,19 +14,11 @@ static int ref(void)
return u.i;
}
-#define MAX(a,b) (a < b ? b : a)
-
-static int test(void)
-{
- char c[MAX(5, sizeof(int))] __attribute__((aligned)) = { 1, 2, 3, 4 };
- return *(int *)c;
-}
-
int main()
{
- int a = test();
int b = ref();
- if (a != b)
+ if (b != 0x01020304
+ && b != 0x04030201)
abort ();
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp
index f26abc5de0a..5de2c1e2618 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp
+++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1.exp
@@ -90,8 +90,20 @@ set generator_src "$generator_src $srcdir/$subdir/generate-random.c"
set generator_src "$generator_src $srcdir/$subdir/generate-random_r.c"
set generator_cmd "-o $generator $skip_dfp $generator_src"
+# Temporarily unset GCC_EXEC_PREFIX from environment, as that might
+# confuse the $HOSTCC.
+set orig_gcc_exec_prefix_saved 0
+if [info exists env(GCC_EXEC_PREFIX)] {
+ set orig_gcc_exec_prefix "$env(GCC_EXEC_PREFIX)"
+ set orig_gcc_exec_prefix_saved 1
+ unsetenv GCC_EXEC_PREFIX
+}
set status [remote_exec host "$HOSTCC $HOSTCFLAGS $generator_cmd"]
set status [lindex $status 0]
+if { $orig_gcc_exec_prefix_saved } {
+ set orig_gcc_exec_prefix_saved 0
+ setenv GCC_EXEC_PREFIX "$orig_gcc_exec_prefix"
+}
if { $status == 0 } then {
file delete -force $tstobjdir
file mkdir $tstobjdir
diff --git a/gcc/testsuite/gcc.dg/inline-28.c b/gcc/testsuite/gcc.dg/inline-28.c
new file mode 100644
index 00000000000..20916aef992
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-28.c
@@ -0,0 +1,28 @@
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu89" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}
diff --git a/gcc/testsuite/gcc.dg/inline-29.c b/gcc/testsuite/gcc.dg/inline-29.c
new file mode 100644
index 00000000000..77672f34295
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-29.c
@@ -0,0 +1,28 @@
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu99" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}
diff --git a/gcc/testsuite/gcc.dg/inline-30.c b/gcc/testsuite/gcc.dg/inline-30.c
new file mode 100644
index 00000000000..bb9b2b4776b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/inline-30.c
@@ -0,0 +1,28 @@
+/* PR c/36507 */
+/* { dg-do run } */
+/* { dg-options "-O0 -std=gnu99 -fgnu89-inline" } */
+
+int
+main (void)
+{
+ int i = 2;
+ auto inline int f1 (void)
+ {
+ return i;
+ }
+ inline int f2 (void)
+ {
+ return i;
+ }
+ auto inline int f3 (void);
+ auto inline int f3 (void)
+ {
+ return i;
+ }
+ auto inline int f4 (void);
+ inline int f4 (void)
+ {
+ return i;
+ }
+ return f1 () + f2 () + f3 () + f4 () - 8;
+}
diff --git a/gcc/testsuite/gcc.target/mips/loongson-simd.c b/gcc/testsuite/gcc.target/mips/loongson-simd.c
new file mode 100644
index 00000000000..e4cae5ea61d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/loongson-simd.c
@@ -0,0 +1,1963 @@
+/* Test cases for ST Microelectronics Loongson-2E/2F SIMD intrinsics.
+ Copyright (C) 2008 Free Software Foundation, Inc.
+ Contributed by CodeSourcery.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* { dg-do run } */
+/* { dg-require-effective-target mips_loongson } */
+
+#include "loongson.h"
+#include <stdio.h>
+#include <stdint.h>
+#include <assert.h>
+#include <limits.h>
+
+typedef union { int32x2_t v; int32_t a[2]; } int32x2_encap_t;
+typedef union { int16x4_t v; int16_t a[4]; } int16x4_encap_t;
+typedef union { int8x8_t v; int8_t a[8]; } int8x8_encap_t;
+typedef union { uint32x2_t v; uint32_t a[2]; } uint32x2_encap_t;
+typedef union { uint16x4_t v; uint16_t a[4]; } uint16x4_encap_t;
+typedef union { uint8x8_t v; uint8_t a[8]; } uint8x8_encap_t;
+
+#define UINT16x4_MAX USHRT_MAX
+#define UINT8x8_MAX UCHAR_MAX
+#define INT8x8_MAX SCHAR_MAX
+#define INT16x4_MAX SHRT_MAX
+#define INT32x2_MAX INT_MAX
+
+static void test_packsswh (void)
+{
+ int32x2_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = INT16x4_MAX - 2;
+ s.a[1] = INT16x4_MAX - 1;
+ t.a[0] = INT16x4_MAX;
+ t.a[1] = INT16x4_MAX + 1;
+ r.v = packsswh (s.v, t.v);
+ assert (r.a[0] == INT16x4_MAX - 2);
+ assert (r.a[1] == INT16x4_MAX - 1);
+ assert (r.a[2] == INT16x4_MAX);
+ assert (r.a[3] == INT16x4_MAX);
+}
+
+static void test_packsshb (void)
+{
+ int16x4_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = INT8x8_MAX - 6;
+ s.a[1] = INT8x8_MAX - 5;
+ s.a[2] = INT8x8_MAX - 4;
+ s.a[3] = INT8x8_MAX - 3;
+ t.a[0] = INT8x8_MAX - 2;
+ t.a[1] = INT8x8_MAX - 1;
+ t.a[2] = INT8x8_MAX;
+ t.a[3] = INT8x8_MAX + 1;
+ r.v = packsshb (s.v, t.v);
+ assert (r.a[0] == INT8x8_MAX - 6);
+ assert (r.a[1] == INT8x8_MAX - 5);
+ assert (r.a[2] == INT8x8_MAX - 4);
+ assert (r.a[3] == INT8x8_MAX - 3);
+ assert (r.a[4] == INT8x8_MAX - 2);
+ assert (r.a[5] == INT8x8_MAX - 1);
+ assert (r.a[6] == INT8x8_MAX);
+ assert (r.a[7] == INT8x8_MAX);
+}
+
+static void test_packushb (void)
+{
+ uint16x4_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = UINT8x8_MAX - 6;
+ s.a[1] = UINT8x8_MAX - 5;
+ s.a[2] = UINT8x8_MAX - 4;
+ s.a[3] = UINT8x8_MAX - 3;
+ t.a[0] = UINT8x8_MAX - 2;
+ t.a[1] = UINT8x8_MAX - 1;
+ t.a[2] = UINT8x8_MAX;
+ t.a[3] = UINT8x8_MAX + 1;
+ r.v = packushb (s.v, t.v);
+ assert (r.a[0] == UINT8x8_MAX - 6);
+ assert (r.a[1] == UINT8x8_MAX - 5);
+ assert (r.a[2] == UINT8x8_MAX - 4);
+ assert (r.a[3] == UINT8x8_MAX - 3);
+ assert (r.a[4] == UINT8x8_MAX - 2);
+ assert (r.a[5] == UINT8x8_MAX - 1);
+ assert (r.a[6] == UINT8x8_MAX);
+ assert (r.a[7] == UINT8x8_MAX);
+}
+
+static void test_paddw_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ t.a[0] = 3;
+ t.a[1] = 4;
+ r.v = paddw_u (s.v, t.v);
+ assert (r.a[0] == 4);
+ assert (r.a[1] == 6);
+}
+
+static void test_paddw_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = -2;
+ s.a[1] = -1;
+ t.a[0] = 3;
+ t.a[1] = 4;
+ r.v = paddw_s (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == 3);
+}
+
+static void test_paddh_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ s.a[2] = 3;
+ s.a[3] = 4;
+ t.a[0] = 5;
+ t.a[1] = 6;
+ t.a[2] = 7;
+ t.a[3] = 8;
+ r.v = paddh_u (s.v, t.v);
+ assert (r.a[0] == 6);
+ assert (r.a[1] == 8);
+ assert (r.a[2] == 10);
+ assert (r.a[3] == 12);
+}
+
+static void test_paddh_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -10;
+ s.a[1] = -20;
+ s.a[2] = -30;
+ s.a[3] = -40;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ r.v = paddh_s (s.v, t.v);
+ assert (r.a[0] == -9);
+ assert (r.a[1] == -18);
+ assert (r.a[2] == -27);
+ assert (r.a[3] == -36);
+}
+
+static void test_paddb_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ s.a[2] = 3;
+ s.a[3] = 4;
+ s.a[4] = 5;
+ s.a[5] = 6;
+ s.a[6] = 7;
+ s.a[7] = 8;
+ t.a[0] = 9;
+ t.a[1] = 10;
+ t.a[2] = 11;
+ t.a[3] = 12;
+ t.a[4] = 13;
+ t.a[5] = 14;
+ t.a[6] = 15;
+ t.a[7] = 16;
+ r.v = paddb_u (s.v, t.v);
+ assert (r.a[0] == 10);
+ assert (r.a[1] == 12);
+ assert (r.a[2] == 14);
+ assert (r.a[3] == 16);
+ assert (r.a[4] == 18);
+ assert (r.a[5] == 20);
+ assert (r.a[6] == 22);
+ assert (r.a[7] == 24);
+}
+
+static void test_paddb_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -10;
+ s.a[1] = -20;
+ s.a[2] = -30;
+ s.a[3] = -40;
+ s.a[4] = -50;
+ s.a[5] = -60;
+ s.a[6] = -70;
+ s.a[7] = -80;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ t.a[4] = 5;
+ t.a[5] = 6;
+ t.a[6] = 7;
+ t.a[7] = 8;
+ r.v = paddb_s (s.v, t.v);
+ assert (r.a[0] == -9);
+ assert (r.a[1] == -18);
+ assert (r.a[2] == -27);
+ assert (r.a[3] == -36);
+ assert (r.a[4] == -45);
+ assert (r.a[5] == -54);
+ assert (r.a[6] == -63);
+ assert (r.a[7] == -72);
+}
+
+static void test_paddd_u (void)
+{
+ uint64_t d = 123456;
+ uint64_t e = 789012;
+ uint64_t r;
+ r = paddd_u (d, e);
+ assert (r == 912468);
+}
+
+static void test_paddd_s (void)
+{
+ int64_t d = 123456;
+ int64_t e = -789012;
+ int64_t r;
+ r = paddd_s (d, e);
+ assert (r == -665556);
+}
+
+static void test_paddsh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 0;
+ s.a[2] = 1;
+ s.a[3] = 2;
+ t.a[0] = INT16x4_MAX;
+ t.a[1] = INT16x4_MAX;
+ t.a[2] = INT16x4_MAX;
+ t.a[3] = INT16x4_MAX;
+ r.v = paddsh (s.v, t.v);
+ assert (r.a[0] == INT16x4_MAX - 1);
+ assert (r.a[1] == INT16x4_MAX);
+ assert (r.a[2] == INT16x4_MAX);
+ assert (r.a[3] == INT16x4_MAX);
+}
+
+static void test_paddsb (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -6;
+ s.a[1] = -5;
+ s.a[2] = -4;
+ s.a[3] = -3;
+ s.a[4] = -2;
+ s.a[5] = -1;
+ s.a[6] = 0;
+ s.a[7] = 1;
+ t.a[0] = INT8x8_MAX;
+ t.a[1] = INT8x8_MAX;
+ t.a[2] = INT8x8_MAX;
+ t.a[3] = INT8x8_MAX;
+ t.a[4] = INT8x8_MAX;
+ t.a[5] = INT8x8_MAX;
+ t.a[6] = INT8x8_MAX;
+ t.a[7] = INT8x8_MAX;
+ r.v = paddsb (s.v, t.v);
+ assert (r.a[0] == INT8x8_MAX - 6);
+ assert (r.a[1] == INT8x8_MAX - 5);
+ assert (r.a[2] == INT8x8_MAX - 4);
+ assert (r.a[3] == INT8x8_MAX - 3);
+ assert (r.a[4] == INT8x8_MAX - 2);
+ assert (r.a[5] == INT8x8_MAX - 1);
+ assert (r.a[6] == INT8x8_MAX);
+ assert (r.a[7] == INT8x8_MAX);
+}
+
+static void test_paddush (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 0;
+ s.a[1] = 1;
+ s.a[2] = 0;
+ s.a[3] = 1;
+ t.a[0] = UINT16x4_MAX;
+ t.a[1] = UINT16x4_MAX;
+ t.a[2] = UINT16x4_MAX;
+ t.a[3] = UINT16x4_MAX;
+ r.v = paddush (s.v, t.v);
+ assert (r.a[0] == UINT16x4_MAX);
+ assert (r.a[1] == UINT16x4_MAX);
+ assert (r.a[2] == UINT16x4_MAX);
+ assert (r.a[3] == UINT16x4_MAX);
+}
+
+static void test_paddusb (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 0;
+ s.a[1] = 1;
+ s.a[2] = 0;
+ s.a[3] = 1;
+ s.a[4] = 0;
+ s.a[5] = 1;
+ s.a[6] = 0;
+ s.a[7] = 1;
+ t.a[0] = UINT8x8_MAX;
+ t.a[1] = UINT8x8_MAX;
+ t.a[2] = UINT8x8_MAX;
+ t.a[3] = UINT8x8_MAX;
+ t.a[4] = UINT8x8_MAX;
+ t.a[5] = UINT8x8_MAX;
+ t.a[6] = UINT8x8_MAX;
+ t.a[7] = UINT8x8_MAX;
+ r.v = paddusb (s.v, t.v);
+ assert (r.a[0] == UINT8x8_MAX);
+ assert (r.a[1] == UINT8x8_MAX);
+ assert (r.a[2] == UINT8x8_MAX);
+ assert (r.a[3] == UINT8x8_MAX);
+ assert (r.a[4] == UINT8x8_MAX);
+ assert (r.a[5] == UINT8x8_MAX);
+ assert (r.a[6] == UINT8x8_MAX);
+ assert (r.a[7] == UINT8x8_MAX);
+}
+
+static void test_pandn_ud (void)
+{
+ uint64_t d1 = 0x0000ffff0000ffffull;
+ uint64_t d2 = 0x0000ffff0000ffffull;
+ uint64_t r;
+ r = pandn_ud (d1, d2);
+ assert (r == 0);
+}
+
+static void test_pandn_sd (void)
+{
+ int64_t d1 = (int64_t) 0x0000000000000000ull;
+ int64_t d2 = (int64_t) 0xfffffffffffffffeull;
+ int64_t r;
+ r = pandn_sd (d1, d2);
+ assert (r == -2);
+}
+
+static void test_pandn_uw (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 0xffffffff;
+ s.a[1] = 0x00000000;
+ t.a[0] = 0x00000000;
+ t.a[1] = 0xffffffff;
+ r.v = pandn_uw (s.v, t.v);
+ assert (r.a[0] == 0x00000000);
+ assert (r.a[1] == 0xffffffff);
+}
+
+static void test_pandn_sw (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = 0xffffffff;
+ s.a[1] = 0x00000000;
+ t.a[0] = 0xffffffff;
+ t.a[1] = 0xfffffffe;
+ r.v = pandn_sw (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -2);
+}
+
+static void test_pandn_uh (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 0xffff;
+ s.a[1] = 0x0000;
+ s.a[2] = 0xffff;
+ s.a[3] = 0x0000;
+ t.a[0] = 0x0000;
+ t.a[1] = 0xffff;
+ t.a[2] = 0x0000;
+ t.a[3] = 0xffff;
+ r.v = pandn_uh (s.v, t.v);
+ assert (r.a[0] == 0x0000);
+ assert (r.a[1] == 0xffff);
+ assert (r.a[2] == 0x0000);
+ assert (r.a[3] == 0xffff);
+}
+
+static void test_pandn_sh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = 0xffff;
+ s.a[1] = 0x0000;
+ s.a[2] = 0xffff;
+ s.a[3] = 0x0000;
+ t.a[0] = 0xffff;
+ t.a[1] = 0xfffe;
+ t.a[2] = 0xffff;
+ t.a[3] = 0xfffe;
+ r.v = pandn_sh (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -2);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == -2);
+}
+
+static void test_pandn_ub (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 0xff;
+ s.a[1] = 0x00;
+ s.a[2] = 0xff;
+ s.a[3] = 0x00;
+ s.a[4] = 0xff;
+ s.a[5] = 0x00;
+ s.a[6] = 0xff;
+ s.a[7] = 0x00;
+ t.a[0] = 0x00;
+ t.a[1] = 0xff;
+ t.a[2] = 0x00;
+ t.a[3] = 0xff;
+ t.a[4] = 0x00;
+ t.a[5] = 0xff;
+ t.a[6] = 0x00;
+ t.a[7] = 0xff;
+ r.v = pandn_ub (s.v, t.v);
+ assert (r.a[0] == 0x00);
+ assert (r.a[1] == 0xff);
+ assert (r.a[2] == 0x00);
+ assert (r.a[3] == 0xff);
+ assert (r.a[4] == 0x00);
+ assert (r.a[5] == 0xff);
+ assert (r.a[6] == 0x00);
+ assert (r.a[7] == 0xff);
+}
+
+static void test_pandn_sb (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = 0xff;
+ s.a[1] = 0x00;
+ s.a[2] = 0xff;
+ s.a[3] = 0x00;
+ s.a[4] = 0xff;
+ s.a[5] = 0x00;
+ s.a[6] = 0xff;
+ s.a[7] = 0x00;
+ t.a[0] = 0xff;
+ t.a[1] = 0xfe;
+ t.a[2] = 0xff;
+ t.a[3] = 0xfe;
+ t.a[4] = 0xff;
+ t.a[5] = 0xfe;
+ t.a[6] = 0xff;
+ t.a[7] = 0xfe;
+ r.v = pandn_sb (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -2);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == -2);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == -2);
+ assert (r.a[6] == 0);
+ assert (r.a[7] == -2);
+}
+
+static void test_pavgh (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ s.a[2] = 3;
+ s.a[3] = 4;
+ t.a[0] = 5;
+ t.a[1] = 6;
+ t.a[2] = 7;
+ t.a[3] = 8;
+ r.v = pavgh (s.v, t.v);
+ assert (r.a[0] == 3);
+ assert (r.a[1] == 4);
+ assert (r.a[2] == 5);
+ assert (r.a[3] == 6);
+}
+
+static void test_pavgb (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ s.a[2] = 3;
+ s.a[3] = 4;
+ s.a[4] = 1;
+ s.a[5] = 2;
+ s.a[6] = 3;
+ s.a[7] = 4;
+ t.a[0] = 5;
+ t.a[1] = 6;
+ t.a[2] = 7;
+ t.a[3] = 8;
+ t.a[4] = 5;
+ t.a[5] = 6;
+ t.a[6] = 7;
+ t.a[7] = 8;
+ r.v = pavgb (s.v, t.v);
+ assert (r.a[0] == 3);
+ assert (r.a[1] == 4);
+ assert (r.a[2] == 5);
+ assert (r.a[3] == 6);
+ assert (r.a[4] == 3);
+ assert (r.a[5] == 4);
+ assert (r.a[6] == 5);
+ assert (r.a[7] == 6);
+}
+
+static void test_pcmpeqw_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = 43;
+ t.a[0] = 43;
+ t.a[1] = 43;
+ r.v = pcmpeqw_u (s.v, t.v);
+ assert (r.a[0] == 0x00000000);
+ assert (r.a[1] == 0xffffffff);
+}
+
+static void test_pcmpeqh_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = 43;
+ s.a[2] = 42;
+ s.a[3] = 43;
+ t.a[0] = 43;
+ t.a[1] = 43;
+ t.a[2] = 43;
+ t.a[3] = 43;
+ r.v = pcmpeqh_u (s.v, t.v);
+ assert (r.a[0] == 0x0000);
+ assert (r.a[1] == 0xffff);
+ assert (r.a[2] == 0x0000);
+ assert (r.a[3] == 0xffff);
+}
+
+static void test_pcmpeqb_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = 43;
+ s.a[2] = 42;
+ s.a[3] = 43;
+ s.a[4] = 42;
+ s.a[5] = 43;
+ s.a[6] = 42;
+ s.a[7] = 43;
+ t.a[0] = 43;
+ t.a[1] = 43;
+ t.a[2] = 43;
+ t.a[3] = 43;
+ t.a[4] = 43;
+ t.a[5] = 43;
+ t.a[6] = 43;
+ t.a[7] = 43;
+ r.v = pcmpeqb_u (s.v, t.v);
+ assert (r.a[0] == 0x00);
+ assert (r.a[1] == 0xff);
+ assert (r.a[2] == 0x00);
+ assert (r.a[3] == 0xff);
+ assert (r.a[4] == 0x00);
+ assert (r.a[5] == 0xff);
+ assert (r.a[6] == 0x00);
+ assert (r.a[7] == 0xff);
+}
+
+static void test_pcmpeqw_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = -42;
+ t.a[0] = 42;
+ t.a[1] = -42;
+ r.v = pcmpeqw_s (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -1);
+}
+
+static void test_pcmpeqh_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = -42;
+ s.a[2] = -42;
+ s.a[3] = -42;
+ t.a[0] = 42;
+ t.a[1] = -42;
+ t.a[2] = 42;
+ t.a[3] = -42;
+ r.v = pcmpeqh_s (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -1);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == -1);
+}
+
+static void test_pcmpeqb_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = -42;
+ s.a[2] = -42;
+ s.a[3] = -42;
+ s.a[4] = -42;
+ s.a[5] = -42;
+ s.a[6] = -42;
+ s.a[7] = -42;
+ t.a[0] = 42;
+ t.a[1] = -42;
+ t.a[2] = 42;
+ t.a[3] = -42;
+ t.a[4] = 42;
+ t.a[5] = -42;
+ t.a[6] = 42;
+ t.a[7] = -42;
+ r.v = pcmpeqb_s (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == -1);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == -1);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == -1);
+ assert (r.a[6] == 0);
+ assert (r.a[7] == -1);
+}
+
+static void test_pcmpgtw_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = 43;
+ t.a[0] = 43;
+ t.a[1] = 42;
+ r.v = pcmpgtw_u (s.v, t.v);
+ assert (r.a[0] == 0x00000000);
+ assert (r.a[1] == 0xffffffff);
+}
+
+static void test_pcmpgth_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 40;
+ s.a[1] = 41;
+ s.a[2] = 42;
+ s.a[3] = 43;
+ t.a[0] = 40;
+ t.a[1] = 41;
+ t.a[2] = 43;
+ t.a[3] = 42;
+ r.v = pcmpgth_u (s.v, t.v);
+ assert (r.a[0] == 0x0000);
+ assert (r.a[1] == 0x0000);
+ assert (r.a[2] == 0x0000);
+ assert (r.a[3] == 0xffff);
+}
+
+static void test_pcmpgtb_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 40;
+ s.a[1] = 41;
+ s.a[2] = 42;
+ s.a[3] = 43;
+ s.a[4] = 44;
+ s.a[5] = 45;
+ s.a[6] = 46;
+ s.a[7] = 47;
+ t.a[0] = 48;
+ t.a[1] = 47;
+ t.a[2] = 46;
+ t.a[3] = 45;
+ t.a[4] = 44;
+ t.a[5] = 43;
+ t.a[6] = 42;
+ t.a[7] = 41;
+ r.v = pcmpgtb_u (s.v, t.v);
+ assert (r.a[0] == 0x00);
+ assert (r.a[1] == 0x00);
+ assert (r.a[2] == 0x00);
+ assert (r.a[3] == 0x00);
+ assert (r.a[4] == 0x00);
+ assert (r.a[5] == 0xff);
+ assert (r.a[6] == 0xff);
+ assert (r.a[7] == 0xff);
+}
+
+static void test_pcmpgtw_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = -42;
+ t.a[0] = -42;
+ t.a[1] = -42;
+ r.v = pcmpgtw_s (s.v, t.v);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == 0);
+}
+
+static void test_pcmpgth_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = -42;
+ s.a[2] = -42;
+ s.a[3] = -42;
+ t.a[0] = 42;
+ t.a[1] = 43;
+ t.a[2] = 44;
+ t.a[3] = -43;
+ r.v = pcmpgth_s (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == -1);
+}
+
+static void test_pcmpgtb_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = -42;
+ s.a[2] = -42;
+ s.a[3] = -42;
+ s.a[4] = 42;
+ s.a[5] = 42;
+ s.a[6] = 42;
+ s.a[7] = 42;
+ t.a[0] = -45;
+ t.a[1] = -44;
+ t.a[2] = -43;
+ t.a[3] = -42;
+ t.a[4] = 42;
+ t.a[5] = 43;
+ t.a[6] = 41;
+ t.a[7] = 40;
+ r.v = pcmpgtb_s (s.v, t.v);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == -1);
+ assert (r.a[2] == -1);
+ assert (r.a[3] == 0);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == 0);
+ assert (r.a[6] == -1);
+ assert (r.a[7] == -1);
+}
+
+static void test_pextrh_u (void)
+{
+ uint16x4_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 40;
+ s.a[1] = 41;
+ s.a[2] = 42;
+ s.a[3] = 43;
+ r.v = pextrh_u (s.v, 1);
+ assert (r.a[0] == 41);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+}
+
+static void test_pextrh_s (void)
+{
+ int16x4_encap_t s;
+ int16x4_encap_t r;
+ s.a[0] = -40;
+ s.a[1] = -41;
+ s.a[2] = -42;
+ s.a[3] = -43;
+ r.v = pextrh_s (s.v, 2);
+ assert (r.a[0] == -42);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+}
+
+static void test_pinsrh_0123_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 42;
+ s.a[1] = 0;
+ s.a[2] = 0;
+ s.a[3] = 0;
+ t.a[0] = 0;
+ t.a[1] = 0;
+ t.a[2] = 0;
+ t.a[3] = 0;
+ r.v = pinsrh_0_u (t.v, s.v);
+ r.v = pinsrh_1_u (r.v, s.v);
+ r.v = pinsrh_2_u (r.v, s.v);
+ r.v = pinsrh_3_u (r.v, s.v);
+ assert (r.a[0] == 42);
+ assert (r.a[1] == 42);
+ assert (r.a[2] == 42);
+ assert (r.a[3] == 42);
+}
+
+static void test_pinsrh_0123_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -42;
+ s.a[1] = 0;
+ s.a[2] = 0;
+ s.a[3] = 0;
+ t.a[0] = 0;
+ t.a[1] = 0;
+ t.a[2] = 0;
+ t.a[3] = 0;
+ r.v = pinsrh_0_s (t.v, s.v);
+ r.v = pinsrh_1_s (r.v, s.v);
+ r.v = pinsrh_2_s (r.v, s.v);
+ r.v = pinsrh_3_s (r.v, s.v);
+ assert (r.a[0] == -42);
+ assert (r.a[1] == -42);
+ assert (r.a[2] == -42);
+ assert (r.a[3] == -42);
+}
+
+static void test_pmaddhw (void)
+{
+ int16x4_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = -5;
+ s.a[1] = -4;
+ s.a[2] = -3;
+ s.a[3] = -2;
+ t.a[0] = 10;
+ t.a[1] = 11;
+ t.a[2] = 12;
+ t.a[3] = 13;
+ r.v = pmaddhw (s.v, t.v);
+ assert (r.a[0] == (-5*10 + -4*11));
+ assert (r.a[1] == (-3*12 + -2*13));
+}
+
+static void test_pmaxsh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -20;
+ s.a[1] = 40;
+ s.a[2] = -10;
+ s.a[3] = 50;
+ t.a[0] = 20;
+ t.a[1] = -40;
+ t.a[2] = 10;
+ t.a[3] = -50;
+ r.v = pmaxsh (s.v, t.v);
+ assert (r.a[0] == 20);
+ assert (r.a[1] == 40);
+ assert (r.a[2] == 10);
+ assert (r.a[3] == 50);
+}
+
+static void test_pmaxub (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 20;
+ s.a[2] = 30;
+ s.a[3] = 40;
+ s.a[4] = 50;
+ s.a[5] = 60;
+ s.a[6] = 70;
+ s.a[7] = 80;
+ t.a[0] = 80;
+ t.a[1] = 70;
+ t.a[2] = 60;
+ t.a[3] = 50;
+ t.a[4] = 40;
+ t.a[5] = 30;
+ t.a[6] = 20;
+ t.a[7] = 10;
+ r.v = pmaxub (s.v, t.v);
+ assert (r.a[0] == 80);
+ assert (r.a[1] == 70);
+ assert (r.a[2] == 60);
+ assert (r.a[3] == 50);
+ assert (r.a[4] == 50);
+ assert (r.a[5] == 60);
+ assert (r.a[6] == 70);
+ assert (r.a[7] == 80);
+}
+
+static void test_pminsh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -20;
+ s.a[1] = 40;
+ s.a[2] = -10;
+ s.a[3] = 50;
+ t.a[0] = 20;
+ t.a[1] = -40;
+ t.a[2] = 10;
+ t.a[3] = -50;
+ r.v = pminsh (s.v, t.v);
+ assert (r.a[0] == -20);
+ assert (r.a[1] == -40);
+ assert (r.a[2] == -10);
+ assert (r.a[3] == -50);
+}
+
+static void test_pminub (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 20;
+ s.a[2] = 30;
+ s.a[3] = 40;
+ s.a[4] = 50;
+ s.a[5] = 60;
+ s.a[6] = 70;
+ s.a[7] = 80;
+ t.a[0] = 80;
+ t.a[1] = 70;
+ t.a[2] = 60;
+ t.a[3] = 50;
+ t.a[4] = 40;
+ t.a[5] = 30;
+ t.a[6] = 20;
+ t.a[7] = 10;
+ r.v = pminub (s.v, t.v);
+ assert (r.a[0] == 10);
+ assert (r.a[1] == 20);
+ assert (r.a[2] == 30);
+ assert (r.a[3] == 40);
+ assert (r.a[4] == 40);
+ assert (r.a[5] == 30);
+ assert (r.a[6] == 20);
+ assert (r.a[7] == 10);
+}
+
+static void test_pmovmskb_u (void)
+{
+ uint8x8_encap_t s;
+ uint8x8_encap_t r;
+ s.a[0] = 0xf0;
+ s.a[1] = 0x40;
+ s.a[2] = 0xf0;
+ s.a[3] = 0x40;
+ s.a[4] = 0xf0;
+ s.a[5] = 0x40;
+ s.a[6] = 0xf0;
+ s.a[7] = 0x40;
+ r.v = pmovmskb_u (s.v);
+ assert (r.a[0] == 0x55);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == 0);
+ assert (r.a[6] == 0);
+ assert (r.a[7] == 0);
+}
+
+static void test_pmovmskb_s (void)
+{
+ int8x8_encap_t s;
+ int8x8_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 1;
+ s.a[2] = -1;
+ s.a[3] = 1;
+ s.a[4] = -1;
+ s.a[5] = 1;
+ s.a[6] = -1;
+ s.a[7] = 1;
+ r.v = pmovmskb_s (s.v);
+ assert (r.a[0] == 0x55);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == 0);
+ assert (r.a[6] == 0);
+ assert (r.a[7] == 0);
+}
+
+static void test_pmulhuh (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 0xff00;
+ s.a[1] = 0xff00;
+ s.a[2] = 0xff00;
+ s.a[3] = 0xff00;
+ t.a[0] = 16;
+ t.a[1] = 16;
+ t.a[2] = 16;
+ t.a[3] = 16;
+ r.v = pmulhuh (s.v, t.v);
+ assert (r.a[0] == 0x000f);
+ assert (r.a[1] == 0x000f);
+ assert (r.a[2] == 0x000f);
+ assert (r.a[3] == 0x000f);
+}
+
+static void test_pmulhh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = 0x0ff0;
+ s.a[1] = 0x0ff0;
+ s.a[2] = 0x0ff0;
+ s.a[3] = 0x0ff0;
+ t.a[0] = -16*16;
+ t.a[1] = -16*16;
+ t.a[2] = -16*16;
+ t.a[3] = -16*16;
+ r.v = pmulhh (s.v, t.v);
+ assert (r.a[0] == -16);
+ assert (r.a[1] == -16);
+ assert (r.a[2] == -16);
+ assert (r.a[3] == -16);
+}
+
+static void test_pmullh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = 0x0ff0;
+ s.a[1] = 0x0ff0;
+ s.a[2] = 0x0ff0;
+ s.a[3] = 0x0ff0;
+ t.a[0] = -16*16;
+ t.a[1] = -16*16;
+ t.a[2] = -16*16;
+ t.a[3] = -16*16;
+ r.v = pmullh (s.v, t.v);
+ assert (r.a[0] == 4096);
+ assert (r.a[1] == 4096);
+ assert (r.a[2] == 4096);
+ assert (r.a[3] == 4096);
+}
+
+static void test_pmuluw (void)
+{
+ uint32x2_encap_t s, t;
+ uint64_t r;
+ s.a[0] = 0xdeadbeef;
+ s.a[1] = 0;
+ t.a[0] = 0x0f00baaa;
+ t.a[1] = 0;
+ r = pmuluw (s.v, t.v);
+ assert (r == 0xd0cd08e1d1a70b6ull);
+}
+
+static void test_pasubub (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 20;
+ s.a[2] = 30;
+ s.a[3] = 40;
+ s.a[4] = 50;
+ s.a[5] = 60;
+ s.a[6] = 70;
+ s.a[7] = 80;
+ t.a[0] = 80;
+ t.a[1] = 70;
+ t.a[2] = 60;
+ t.a[3] = 50;
+ t.a[4] = 40;
+ t.a[5] = 30;
+ t.a[6] = 20;
+ t.a[7] = 10;
+ r.v = pasubub (s.v, t.v);
+ assert (r.a[0] == 70);
+ assert (r.a[1] == 50);
+ assert (r.a[2] == 30);
+ assert (r.a[3] == 10);
+ assert (r.a[4] == 10);
+ assert (r.a[5] == 30);
+ assert (r.a[6] == 50);
+ assert (r.a[7] == 70);
+}
+
+static void test_biadd (void)
+{
+ uint8x8_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 20;
+ s.a[2] = 30;
+ s.a[3] = 40;
+ s.a[4] = 50;
+ s.a[5] = 60;
+ s.a[6] = 70;
+ s.a[7] = 80;
+ r.v = biadd (s.v);
+ assert (r.a[0] == 360);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+}
+
+static void test_psadbh (void)
+{
+ uint8x8_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 20;
+ s.a[2] = 30;
+ s.a[3] = 40;
+ s.a[4] = 50;
+ s.a[5] = 60;
+ s.a[6] = 70;
+ s.a[7] = 80;
+ t.a[0] = 80;
+ t.a[1] = 70;
+ t.a[2] = 60;
+ t.a[3] = 50;
+ t.a[4] = 40;
+ t.a[5] = 30;
+ t.a[6] = 20;
+ t.a[7] = 10;
+ r.v = psadbh (s.v, t.v);
+ assert (r.a[0] == 0x0140);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+}
+
+static void test_pshufh_u (void)
+{
+ uint16x4_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 2;
+ s.a[2] = 3;
+ s.a[3] = 4;
+ r.a[0] = 0;
+ r.a[1] = 0;
+ r.a[2] = 0;
+ r.a[3] = 0;
+ r.v = pshufh_u (r.v, s.v, 0xe5);
+ assert (r.a[0] == 2);
+ assert (r.a[1] == 2);
+ assert (r.a[2] == 3);
+ assert (r.a[3] == 4);
+}
+
+static void test_pshufh_s (void)
+{
+ int16x4_encap_t s;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 2;
+ s.a[2] = -3;
+ s.a[3] = 4;
+ r.a[0] = 0;
+ r.a[1] = 0;
+ r.a[2] = 0;
+ r.a[3] = 0;
+ r.v = pshufh_s (r.v, s.v, 0xe5);
+ assert (r.a[0] == 2);
+ assert (r.a[1] == 2);
+ assert (r.a[2] == -3);
+ assert (r.a[3] == 4);
+}
+
+static void test_psllh_u (void)
+{
+ uint16x4_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 0xffff;
+ s.a[1] = 0xffff;
+ s.a[2] = 0xffff;
+ s.a[3] = 0xffff;
+ r.v = psllh_u (s.v, 1);
+ assert (r.a[0] == 0xfffe);
+ assert (r.a[1] == 0xfffe);
+ assert (r.a[2] == 0xfffe);
+ assert (r.a[3] == 0xfffe);
+}
+
+static void test_psllw_u (void)
+{
+ uint32x2_encap_t s;
+ uint32x2_encap_t r;
+ s.a[0] = 0xffffffff;
+ s.a[1] = 0xffffffff;
+ r.v = psllw_u (s.v, 2);
+ assert (r.a[0] == 0xfffffffc);
+ assert (r.a[1] == 0xfffffffc);
+}
+
+static void test_psllh_s (void)
+{
+ int16x4_encap_t s;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -1;
+ s.a[2] = -1;
+ s.a[3] = -1;
+ r.v = psllh_s (s.v, 1);
+ assert (r.a[0] == -2);
+ assert (r.a[1] == -2);
+ assert (r.a[2] == -2);
+ assert (r.a[3] == -2);
+}
+
+static void test_psllw_s (void)
+{
+ int32x2_encap_t s;
+ int32x2_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -1;
+ r.v = psllw_s (s.v, 2);
+ assert (r.a[0] == -4);
+ assert (r.a[1] == -4);
+}
+
+static void test_psrah_u (void)
+{
+ uint16x4_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 0xffef;
+ s.a[1] = 0xffef;
+ s.a[2] = 0xffef;
+ s.a[3] = 0xffef;
+ r.v = psrah_u (s.v, 1);
+ assert (r.a[0] == 0xfff7);
+ assert (r.a[1] == 0xfff7);
+ assert (r.a[2] == 0xfff7);
+ assert (r.a[3] == 0xfff7);
+}
+
+static void test_psraw_u (void)
+{
+ uint32x2_encap_t s;
+ uint32x2_encap_t r;
+ s.a[0] = 0xffffffef;
+ s.a[1] = 0xffffffef;
+ r.v = psraw_u (s.v, 1);
+ assert (r.a[0] == 0xfffffff7);
+ assert (r.a[1] == 0xfffffff7);
+}
+
+static void test_psrah_s (void)
+{
+ int16x4_encap_t s;
+ int16x4_encap_t r;
+ s.a[0] = -2;
+ s.a[1] = -2;
+ s.a[2] = -2;
+ s.a[3] = -2;
+ r.v = psrah_s (s.v, 1);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == -1);
+ assert (r.a[2] == -1);
+ assert (r.a[3] == -1);
+}
+
+static void test_psraw_s (void)
+{
+ int32x2_encap_t s;
+ int32x2_encap_t r;
+ s.a[0] = -2;
+ s.a[1] = -2;
+ r.v = psraw_s (s.v, 1);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == -1);
+}
+
+static void test_psrlh_u (void)
+{
+ uint16x4_encap_t s;
+ uint16x4_encap_t r;
+ s.a[0] = 0xffef;
+ s.a[1] = 0xffef;
+ s.a[2] = 0xffef;
+ s.a[3] = 0xffef;
+ r.v = psrlh_u (s.v, 1);
+ assert (r.a[0] == 0x7ff7);
+ assert (r.a[1] == 0x7ff7);
+ assert (r.a[2] == 0x7ff7);
+ assert (r.a[3] == 0x7ff7);
+}
+
+static void test_psrlw_u (void)
+{
+ uint32x2_encap_t s;
+ uint32x2_encap_t r;
+ s.a[0] = 0xffffffef;
+ s.a[1] = 0xffffffef;
+ r.v = psrlw_u (s.v, 1);
+ assert (r.a[0] == 0x7ffffff7);
+ assert (r.a[1] == 0x7ffffff7);
+}
+
+static void test_psrlh_s (void)
+{
+ int16x4_encap_t s;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -1;
+ s.a[2] = -1;
+ s.a[3] = -1;
+ r.v = psrlh_s (s.v, 1);
+ assert (r.a[0] == INT16x4_MAX);
+ assert (r.a[1] == INT16x4_MAX);
+ assert (r.a[2] == INT16x4_MAX);
+ assert (r.a[3] == INT16x4_MAX);
+}
+
+static void test_psrlw_s (void)
+{
+ int32x2_encap_t s;
+ int32x2_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -1;
+ r.v = psrlw_s (s.v, 1);
+ assert (r.a[0] == INT32x2_MAX);
+ assert (r.a[1] == INT32x2_MAX);
+}
+
+static void test_psubw_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 3;
+ s.a[1] = 4;
+ t.a[0] = 2;
+ t.a[1] = 1;
+ r.v = psubw_u (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == 3);
+}
+
+static void test_psubw_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = -2;
+ s.a[1] = -1;
+ t.a[0] = 3;
+ t.a[1] = -4;
+ r.v = psubw_s (s.v, t.v);
+ assert (r.a[0] == -5);
+ assert (r.a[1] == 3);
+}
+
+static void test_psubh_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 5;
+ s.a[1] = 6;
+ s.a[2] = 7;
+ s.a[3] = 8;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ r.v = psubh_u (s.v, t.v);
+ assert (r.a[0] == 4);
+ assert (r.a[1] == 4);
+ assert (r.a[2] == 4);
+ assert (r.a[3] == 4);
+}
+
+static void test_psubh_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -10;
+ s.a[1] = -20;
+ s.a[2] = -30;
+ s.a[3] = -40;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ r.v = psubh_s (s.v, t.v);
+ assert (r.a[0] == -11);
+ assert (r.a[1] == -22);
+ assert (r.a[2] == -33);
+ assert (r.a[3] == -44);
+}
+
+static void test_psubb_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 10;
+ s.a[1] = 11;
+ s.a[2] = 12;
+ s.a[3] = 13;
+ s.a[4] = 14;
+ s.a[5] = 15;
+ s.a[6] = 16;
+ s.a[7] = 17;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ t.a[4] = 5;
+ t.a[5] = 6;
+ t.a[6] = 7;
+ t.a[7] = 8;
+ r.v = psubb_u (s.v, t.v);
+ assert (r.a[0] == 9);
+ assert (r.a[1] == 9);
+ assert (r.a[2] == 9);
+ assert (r.a[3] == 9);
+ assert (r.a[4] == 9);
+ assert (r.a[5] == 9);
+ assert (r.a[6] == 9);
+ assert (r.a[7] == 9);
+}
+
+static void test_psubb_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -10;
+ s.a[1] = -20;
+ s.a[2] = -30;
+ s.a[3] = -40;
+ s.a[4] = -50;
+ s.a[5] = -60;
+ s.a[6] = -70;
+ s.a[7] = -80;
+ t.a[0] = 1;
+ t.a[1] = 2;
+ t.a[2] = 3;
+ t.a[3] = 4;
+ t.a[4] = 5;
+ t.a[5] = 6;
+ t.a[6] = 7;
+ t.a[7] = 8;
+ r.v = psubb_s (s.v, t.v);
+ assert (r.a[0] == -11);
+ assert (r.a[1] == -22);
+ assert (r.a[2] == -33);
+ assert (r.a[3] == -44);
+ assert (r.a[4] == -55);
+ assert (r.a[5] == -66);
+ assert (r.a[6] == -77);
+ assert (r.a[7] == -88);
+}
+
+static void test_psubd_u (void)
+{
+ uint64_t d = 789012;
+ uint64_t e = 123456;
+ uint64_t r;
+ r = psubd_u (d, e);
+ assert (r == 665556);
+}
+
+static void test_psubd_s (void)
+{
+ int64_t d = 123456;
+ int64_t e = -789012;
+ int64_t r;
+ r = psubd_s (d, e);
+ assert (r == 912468);
+}
+
+static void test_psubsh (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 0;
+ s.a[2] = 1;
+ s.a[3] = 2;
+ t.a[0] = -INT16x4_MAX;
+ t.a[1] = -INT16x4_MAX;
+ t.a[2] = -INT16x4_MAX;
+ t.a[3] = -INT16x4_MAX;
+ r.v = psubsh (s.v, t.v);
+ assert (r.a[0] == INT16x4_MAX - 1);
+ assert (r.a[1] == INT16x4_MAX);
+ assert (r.a[2] == INT16x4_MAX);
+ assert (r.a[3] == INT16x4_MAX);
+}
+
+static void test_psubsb (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -6;
+ s.a[1] = -5;
+ s.a[2] = -4;
+ s.a[3] = -3;
+ s.a[4] = -2;
+ s.a[5] = -1;
+ s.a[6] = 0;
+ s.a[7] = 1;
+ t.a[0] = -INT8x8_MAX;
+ t.a[1] = -INT8x8_MAX;
+ t.a[2] = -INT8x8_MAX;
+ t.a[3] = -INT8x8_MAX;
+ t.a[4] = -INT8x8_MAX;
+ t.a[5] = -INT8x8_MAX;
+ t.a[6] = -INT8x8_MAX;
+ t.a[7] = -INT8x8_MAX;
+ r.v = psubsb (s.v, t.v);
+ assert (r.a[0] == INT8x8_MAX - 6);
+ assert (r.a[1] == INT8x8_MAX - 5);
+ assert (r.a[2] == INT8x8_MAX - 4);
+ assert (r.a[3] == INT8x8_MAX - 3);
+ assert (r.a[4] == INT8x8_MAX - 2);
+ assert (r.a[5] == INT8x8_MAX - 1);
+ assert (r.a[6] == INT8x8_MAX);
+ assert (r.a[7] == INT8x8_MAX);
+}
+
+static void test_psubush (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 0;
+ s.a[1] = 1;
+ s.a[2] = 2;
+ s.a[3] = 3;
+ t.a[0] = 1;
+ t.a[1] = 1;
+ t.a[2] = 3;
+ t.a[3] = 3;
+ r.v = psubush (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+}
+
+static void test_psubusb (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 0;
+ s.a[1] = 1;
+ s.a[2] = 2;
+ s.a[3] = 3;
+ s.a[4] = 4;
+ s.a[5] = 5;
+ s.a[6] = 6;
+ s.a[7] = 7;
+ t.a[0] = 1;
+ t.a[1] = 1;
+ t.a[2] = 3;
+ t.a[3] = 3;
+ t.a[4] = 5;
+ t.a[5] = 5;
+ t.a[6] = 7;
+ t.a[7] = 7;
+ r.v = psubusb (s.v, t.v);
+ assert (r.a[0] == 0);
+ assert (r.a[1] == 0);
+ assert (r.a[2] == 0);
+ assert (r.a[3] == 0);
+ assert (r.a[4] == 0);
+ assert (r.a[5] == 0);
+ assert (r.a[6] == 0);
+ assert (r.a[7] == 0);
+}
+
+static void test_punpckhbh_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -3;
+ s.a[2] = -5;
+ s.a[3] = -7;
+ s.a[4] = -9;
+ s.a[5] = -11;
+ s.a[6] = -13;
+ s.a[7] = -15;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ t.a[4] = 10;
+ t.a[5] = 12;
+ t.a[6] = 14;
+ t.a[7] = 16;
+ r.v = punpckhbh_s (s.v, t.v);
+ assert (r.a[0] == -9);
+ assert (r.a[1] == 10);
+ assert (r.a[2] == -11);
+ assert (r.a[3] == 12);
+ assert (r.a[4] == -13);
+ assert (r.a[5] == 14);
+ assert (r.a[6] == -15);
+ assert (r.a[7] == 16);
+}
+
+static void test_punpckhbh_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ s.a[2] = 5;
+ s.a[3] = 7;
+ s.a[4] = 9;
+ s.a[5] = 11;
+ s.a[6] = 13;
+ s.a[7] = 15;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ t.a[4] = 10;
+ t.a[5] = 12;
+ t.a[6] = 14;
+ t.a[7] = 16;
+ r.v = punpckhbh_u (s.v, t.v);
+ assert (r.a[0] == 9);
+ assert (r.a[1] == 10);
+ assert (r.a[2] == 11);
+ assert (r.a[3] == 12);
+ assert (r.a[4] == 13);
+ assert (r.a[5] == 14);
+ assert (r.a[6] == 15);
+ assert (r.a[7] == 16);
+}
+
+static void test_punpckhhw_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 3;
+ s.a[2] = -5;
+ s.a[3] = 7;
+ t.a[0] = -2;
+ t.a[1] = 4;
+ t.a[2] = -6;
+ t.a[3] = 8;
+ r.v = punpckhhw_s (s.v, t.v);
+ assert (r.a[0] == -5);
+ assert (r.a[1] == -6);
+ assert (r.a[2] == 7);
+ assert (r.a[3] == 8);
+}
+
+static void test_punpckhhw_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ s.a[2] = 5;
+ s.a[3] = 7;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ r.v = punpckhhw_u (s.v, t.v);
+ assert (r.a[0] == 5);
+ assert (r.a[1] == 6);
+ assert (r.a[2] == 7);
+ assert (r.a[3] == 8);
+}
+
+static void test_punpckhwd_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ t.a[0] = 2;
+ t.a[1] = -4;
+ r.v = punpckhwd_s (s.v, t.v);
+ assert (r.a[0] == 3);
+ assert (r.a[1] == -4);
+}
+
+static void test_punpckhwd_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ r.v = punpckhwd_u (s.v, t.v);
+ assert (r.a[0] == 3);
+ assert (r.a[1] == 4);
+}
+
+static void test_punpcklbh_s (void)
+{
+ int8x8_encap_t s, t;
+ int8x8_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = -3;
+ s.a[2] = -5;
+ s.a[3] = -7;
+ s.a[4] = -9;
+ s.a[5] = -11;
+ s.a[6] = -13;
+ s.a[7] = -15;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ t.a[4] = 10;
+ t.a[5] = 12;
+ t.a[6] = 14;
+ t.a[7] = 16;
+ r.v = punpcklbh_s (s.v, t.v);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == 2);
+ assert (r.a[2] == -3);
+ assert (r.a[3] == 4);
+ assert (r.a[4] == -5);
+ assert (r.a[5] == 6);
+ assert (r.a[6] == -7);
+ assert (r.a[7] == 8);
+}
+
+static void test_punpcklbh_u (void)
+{
+ uint8x8_encap_t s, t;
+ uint8x8_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ s.a[2] = 5;
+ s.a[3] = 7;
+ s.a[4] = 9;
+ s.a[5] = 11;
+ s.a[6] = 13;
+ s.a[7] = 15;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ t.a[4] = 10;
+ t.a[5] = 12;
+ t.a[6] = 14;
+ t.a[7] = 16;
+ r.v = punpcklbh_u (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == 2);
+ assert (r.a[2] == 3);
+ assert (r.a[3] == 4);
+ assert (r.a[4] == 5);
+ assert (r.a[5] == 6);
+ assert (r.a[6] == 7);
+ assert (r.a[7] == 8);
+}
+
+static void test_punpcklhw_s (void)
+{
+ int16x4_encap_t s, t;
+ int16x4_encap_t r;
+ s.a[0] = -1;
+ s.a[1] = 3;
+ s.a[2] = -5;
+ s.a[3] = 7;
+ t.a[0] = -2;
+ t.a[1] = 4;
+ t.a[2] = -6;
+ t.a[3] = 8;
+ r.v = punpcklhw_s (s.v, t.v);
+ assert (r.a[0] == -1);
+ assert (r.a[1] == -2);
+ assert (r.a[2] == 3);
+ assert (r.a[3] == 4);
+}
+
+static void test_punpcklhw_u (void)
+{
+ uint16x4_encap_t s, t;
+ uint16x4_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ s.a[2] = 5;
+ s.a[3] = 7;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ t.a[2] = 6;
+ t.a[3] = 8;
+ r.v = punpcklhw_u (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == 2);
+ assert (r.a[2] == 3);
+ assert (r.a[3] == 4);
+}
+
+static void test_punpcklwd_s (void)
+{
+ int32x2_encap_t s, t;
+ int32x2_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ t.a[0] = -2;
+ t.a[1] = 4;
+ r.v = punpcklwd_s (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == -2);
+}
+
+static void test_punpcklwd_u (void)
+{
+ uint32x2_encap_t s, t;
+ uint32x2_encap_t r;
+ s.a[0] = 1;
+ s.a[1] = 3;
+ t.a[0] = 2;
+ t.a[1] = 4;
+ r.v = punpcklwd_u (s.v, t.v);
+ assert (r.a[0] == 1);
+ assert (r.a[1] == 2);
+}
+
+int main (void)
+{
+ test_packsswh ();
+ test_packsshb ();
+ test_packushb ();
+ test_paddw_u ();
+ test_paddw_s ();
+ test_paddh_u ();
+ test_paddh_s ();
+ test_paddb_u ();
+ test_paddb_s ();
+ test_paddd_u ();
+ test_paddd_s ();
+ test_paddsh ();
+ test_paddsb ();
+ test_paddush ();
+ test_paddusb ();
+ test_pandn_ud ();
+ test_pandn_sd ();
+ test_pandn_uw ();
+ test_pandn_sw ();
+ test_pandn_uh ();
+ test_pandn_sh ();
+ test_pandn_ub ();
+ test_pandn_sb ();
+ test_pavgh ();
+ test_pavgb ();
+ test_pcmpeqw_u ();
+ test_pcmpeqh_u ();
+ test_pcmpeqb_u ();
+ test_pcmpeqw_s ();
+ test_pcmpeqh_s ();
+ test_pcmpeqb_s ();
+ test_pcmpgtw_u ();
+ test_pcmpgth_u ();
+ test_pcmpgtb_u ();
+ test_pcmpgtw_s ();
+ test_pcmpgth_s ();
+ test_pcmpgtb_s ();
+ test_pextrh_u ();
+ test_pextrh_s ();
+ test_pinsrh_0123_u ();
+ test_pinsrh_0123_s ();
+ test_pmaddhw ();
+ test_pmaxsh ();
+ test_pmaxub ();
+ test_pminsh ();
+ test_pminub ();
+ test_pmovmskb_u ();
+ test_pmovmskb_s ();
+ test_pmulhuh ();
+ test_pmulhh ();
+ test_pmullh ();
+ test_pmuluw ();
+ test_pasubub ();
+ test_biadd ();
+ test_psadbh ();
+ test_pshufh_u ();
+ test_pshufh_s ();
+ test_psllh_u ();
+ test_psllw_u ();
+ test_psllh_s ();
+ test_psllw_s ();
+ test_psrah_u ();
+ test_psraw_u ();
+ test_psrah_s ();
+ test_psraw_s ();
+ test_psrlh_u ();
+ test_psrlw_u ();
+ test_psrlh_s ();
+ test_psrlw_s ();
+ test_psubw_u ();
+ test_psubw_s ();
+ test_psubh_u ();
+ test_psubh_s ();
+ test_psubb_u ();
+ test_psubb_s ();
+ test_psubd_u ();
+ test_psubd_s ();
+ test_psubsh ();
+ test_psubsb ();
+ test_psubush ();
+ test_psubusb ();
+ test_punpckhbh_s ();
+ test_punpckhbh_u ();
+ test_punpckhhw_s ();
+ test_punpckhhw_u ();
+ test_punpckhwd_s ();
+ test_punpckhwd_u ();
+ test_punpcklbh_s ();
+ test_punpcklbh_u ();
+ test_punpcklhw_s ();
+ test_punpcklhw_u ();
+ test_punpcklwd_s ();
+ test_punpcklwd_u ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/e500-1.c b/gcc/testsuite/gcc.target/powerpc/e500-1.c
new file mode 100644
index 00000000000..76a0e4a2205
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/e500-1.c
@@ -0,0 +1,14 @@
+/* Test functioning of command option -mno-isel */
+/* { dg-do compile { target powerpc*-*-linux* } } */
+/* { dg-options "-O2 -mno-isel" } */
+
+/* { dg-final { scan-assembler-not "isel" } } */
+
+int
+foo (int x, int y)
+{
+ if (x < y)
+ return x;
+ else
+ return y;
+}
diff --git a/gcc/testsuite/gfortran.dg/index_2.f90 b/gcc/testsuite/gfortran.dg/index_2.f90
new file mode 100644
index 00000000000..9b92f0acee7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/index_2.f90
@@ -0,0 +1,55 @@
+! { dg-do run }
+! { dg-options "-fdump-tree-original" }
+! PR fortran/36462
+!
+ implicit none
+ character(len=10,kind=1) string1
+ character(len=10,kind=4) string4
+ string1 = 'ABCDEEDCBA'
+ string4 = 'ABCDEEDCBA'
+
+ if(index(string1,1_'A') /= 1) call abort()
+ if(index(string4,4_'A') /= 1) call abort()
+ if(index(string1,1_'A',kind=4) /= 1_4) call abort()
+ if(index(string4,4_'A',kind=4) /= 1_4) call abort()
+ if(index(string1,1_'A',kind=1) /= 1_1) call abort()
+ if(index(string4,4_'A',kind=1) /= 1_1) call abort()
+
+ if(index(string1,1_'A',back=.true.) /= 10) call abort()
+ if(index(string4,4_'A',back=.true.) /= 10) call abort()
+ if(index(string1,1_'A',kind=4,back=.true.) /= 10_4) call abort()
+ if(index(string4,4_'A',kind=4,back=.true.) /= 10_4) call abort()
+ if(index(string1,1_'A',kind=1,back=.true.) /= 10_1) call abort()
+ if(index(string4,4_'A',kind=1,back=.true.) /= 10_1) call abort()
+
+ if(index(string1,1_'A',back=.false.) /= 1) call abort()
+ if(index(string4,4_'A',back=.false.) /= 1) call abort()
+ if(index(string1,1_'A',kind=4,back=.false.) /= 1_4) call abort()
+ if(index(string4,4_'A',kind=4,back=.false.) /= 1_4) call abort()
+ if(index(string1,1_'A',kind=1,back=.false.) /= 1_1) call abort()
+ if(index(string4,4_'A',kind=1,back=.false.) /= 1_1) call abort()
+
+ if(scan(string1,1_'A') /= 1) call abort()
+ if(scan(string4,4_'A') /= 1) call abort()
+ if(scan(string1,1_'A',kind=4) /= 1_4) call abort()
+ if(scan(string4,4_'A',kind=4) /= 1_4) call abort()
+ if(scan(string1,1_'A',kind=1) /= 1_1) call abort()
+ if(scan(string4,4_'A',kind=1) /= 1_1) call abort()
+
+ if(scan(string1,1_'A',back=.true.) /= 10) call abort()
+ if(scan(string4,4_'A',back=.true.) /= 10) call abort()
+ if(scan(string1,1_'A',kind=4,back=.true.) /= 10_4) call abort()
+ if(scan(string4,4_'A',kind=4,back=.true.) /= 10_4) call abort()
+ if(scan(string1,1_'A',kind=1,back=.true.) /= 10_1) call abort()
+ if(scan(string4,4_'A',kind=1,back=.true.) /= 10_1) call abort()
+
+ if(scan(string1,1_'A',back=.false.) /= 1) call abort()
+ if(scan(string4,4_'A',back=.false.) /= 1) call abort()
+ if(scan(string1,1_'A',kind=4,back=.false.) /= 1_4) call abort()
+ if(scan(string4,4_'A',kind=4,back=.false.) /= 1_4) call abort()
+ if(scan(string1,1_'A',kind=1,back=.false.) /= 1_1) call abort()
+ if(scan(string4,4_'A',kind=1,back=.false.) /= 1_1) call abort()
+ end
+
+! { dg-final { scan-tree-dump-times "if ..integer.kind=1.. _gfortran_string_index" 6 "original" } }
+! { dg-final { scan-tree-dump-times "if ..integer.kind=1.. _gfortran_string_scan" 6 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/namelist_48.f90 b/gcc/testsuite/gfortran.dg/namelist_48.f90
new file mode 100644
index 00000000000..e9a29285b17
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/namelist_48.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-options "-fbackslash" }
+! PR36538 namelist failure with tabs preceding object name
+ program check1
+ integer x
+ namelist/casein/x
+ open(1, status="scratch")
+ write(1,'(a)') "&CASEIN"
+ write(1,'(a)') "\t\tx = 1"
+ write(1,'(a)') "/"
+ rewind(1)
+ x = 0
+ read(1,casein)
+ if (x.ne.1) call abort
+ end
diff --git a/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90 b/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90
new file mode 100644
index 00000000000..5bdcb3723b1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/parameter_array_init_4.f90
@@ -0,0 +1,55 @@
+! { dg-do run }
+! PR fortran/36476
+!
+IMPLICIT NONE
+CHARACTER (len=*) MY_STRING(1:3), my_string_s
+PARAMETER ( MY_STRING = (/ "A" , "B", "C" /) )
+PARAMETER ( MY_STRING_S = "AB C" )
+character(len=*), parameter :: str(2) = [ 'Ac','cc']
+character(len=*), parameter :: str_s = 'Acc'
+
+CHARACTER (kind=1,len=*) MY_STRING1(1:3), my_string_s1
+PARAMETER ( MY_STRING1 = (/ "A" , "B", "C" /) )
+PARAMETER ( MY_STRING_S1 = "AB C" )
+character(kind=1,len=*), parameter :: str1(2) = [ 1_'Ac',1_'cc']
+character(kind=1,len=*), parameter :: str_s1 = 'Acc'
+
+CHARACTER (kind=4,len=*) MY_STRING4(1:3), my_string_s4
+PARAMETER ( MY_STRING4 = (/ "A" , "B", "C" /) )
+PARAMETER ( MY_STRING_S4 = "AB C" )
+character(kind=4,len=*), parameter :: str4(2) = [ 1_'Ac',1_'cc']
+character(kind=4,len=*), parameter :: str_s4 = 'Acc'
+
+if(len(MY_STRING) /= 1) call abort()
+if( MY_STRING(1) /= "A" &
+ .or.MY_STRING(2) /= "B" &
+ .or.MY_STRING(3) /= "C") call abort()
+if(len(MY_STRING_s) /= 4) call abort()
+if(MY_STRING_S /= "AB C") call abort()
+if(len(str) /= 2) call abort()
+if(str(1) /= "Ac" .or. str(2) /= "cc") call abort()
+if(len(str_s) /= 3) call abort()
+if(str_s /= 'Acc') call abort()
+
+if(len(MY_STRING1) /= 1) call abort()
+if( MY_STRING1(1) /= 1_"A" &
+ .or.MY_STRING1(2) /= 1_"B" &
+ .or.MY_STRING1(3) /= 1_"C") call abort()
+if(len(MY_STRING_s1) /= 4) call abort()
+if(MY_STRING_S1 /= 1_"AB C") call abort()
+if(len(str1) /= 2) call abort()
+if(str1(1) /= 1_"Ac" .or. str1(2) /= 1_"cc") call abort()
+if(len(str_s1) /= 3) call abort()
+if(str_s1 /= 1_'Acc') call abort()
+
+if(len(MY_STRING4) /= 1) call abort()
+if( MY_STRING4(1) /= 4_"A" &
+ .or.MY_STRING4(2) /= 4_"B" &
+ .or.MY_STRING4(3) /= 4_"C") call abort()
+if(len(MY_STRING_s4) /= 4) call abort()
+if(MY_STRING_S4 /= 4_"AB C") call abort()
+if(len(str4) /= 2) call abort()
+if(str4(1) /= 4_"Ac" .or. str4(2) /= 4_"cc") call abort()
+if(len(str_s4) /= 3) call abort()
+if(str_s4 /= 4_'Acc') call abort()
+end
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
new file mode 100644
index 00000000000..0fe479cda64
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! Wide chracter I/O test 1, formatted and mixed kind
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program test1
+ integer, parameter :: k4 = 4
+ character(len=10,kind=4) :: wide
+ character(len=10,kind=1) :: thin
+ character(kind=1,len=25) :: buffer
+ wide=k4_"Goodbye!"
+ thin="Hello!"
+ write(buffer, '(a)') wide
+ if (buffer /= "Goodbye!") call abort
+ open(10, form="formatted", access="stream", status="scratch")
+ write(10, '(a)') thin
+ rewind(10)
+ read(10, '(a)') wide
+ if (wide /= k4_"Hello!") call abort
+ write(buffer,*) thin, ">",wide,"<"
+ if (buffer /= " Hello! >Hello! <") call abort
+end program test1
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_2.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_2.f90
new file mode 100644
index 00000000000..6b13e4f93f1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_2.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! Wide chracter I/O test 2, formatted array write and read
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program chkdata
+ integer, parameter :: k4=4
+ character(len=7, kind=k4), dimension(3) :: mychar
+ character(50) :: buffer
+ mychar(1) = k4_"abc1234"
+ mychar(2) = k4_"def5678"
+ mychar(3) = k4_"ghi9012"
+ buffer = ""
+ write(buffer,'(3(a))') mychar(2:3), mychar(1)
+ if (buffer /= "def5678ghi9012abc1234") call abort
+ write(buffer,'(3(a))') mychar
+ if (buffer /= "abc1234def5678ghi9012") call abort
+ mychar = ""
+ read(buffer,'(3(a))') mychar
+ if (any(mychar.ne.[ k4_"abc1234",k4_"def5678",k4_"ghi9012" ])) call abort
+end program chkdata
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90
new file mode 100644
index 00000000000..6f4a10c857e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! Wide chracter I/O test 3, unformatted arrays
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program test1
+ integer, parameter :: k4 = 4
+ character(len=10,kind=4) :: wide
+ character(len=10,kind=4), dimension(5,7) :: widearray
+ wide = k4_"abcdefg"
+ widearray = k4_"1234abcd"
+ open(10, form="unformatted", status="scratch")
+ write(10) wide
+ rewind(10)
+ wide = "wrong"
+ read(10) wide
+ if (wide /= k4_"abcdefg") call abort
+ rewind(10)
+ write(10) widearray(2:4,3:7)
+ widearray(2:4,3:7)=""
+ rewind(10)
+ read(10) widearray(2:4,3:7)
+ close(10)
+ if (any(widearray.ne.k4_"1234abcd")) call abort
+end program test1
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_4.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_4.f90
new file mode 100644
index 00000000000..e108b15c4f5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_4.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! { dg-options -fbackslash }
+! Wide chracter I/O test 4, formatted ISO-8859-1 characters in string
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+! Compile with -fbackslash
+integer, parameter :: k4 = 4
+character(kind=1,len=15) :: buffer
+character(kind=1, len=1) :: c1, c2
+character(kind=4,len=20) :: str = k4_'X\xF8öABC' ! ISO-8859-1 encoded string
+buffer = ""
+write(buffer,'(3a)')':',trim(str),':'
+if (buffer.ne.':X\xF8öABC: ') call abort
+str = ""
+read(buffer,'(3a)') c1,str(1:6),c2
+if (c1.ne.':') call abort
+if (str.ne.k4_'X\xF8öAB') call abort
+if (c2.ne.'C') call abort
+end
diff --git a/gcc/testsuite/gnat.dg/discr9.adb b/gcc/testsuite/gnat.dg/discr9.adb
new file mode 100644
index 00000000000..199855f57fc
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr9.adb
@@ -0,0 +1,10 @@
+-- { dg-do compile }
+
+package body Discr9 is
+
+ procedure Proc (From : in R; To : out R) is
+ begin
+ To := R'(D1 => False, D2 => From.D2, Field => From.Field);
+ end;
+
+end Discr9;
diff --git a/gcc/testsuite/gnat.dg/discr9.ads b/gcc/testsuite/gnat.dg/discr9.ads
new file mode 100644
index 00000000000..5edde81bff8
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/discr9.ads
@@ -0,0 +1,22 @@
+package Discr9 is
+
+ type IArr is Array (Natural range <>) of Integer;
+ type CArr is Array (Natural range <>) of Character;
+
+ type Var_R (D1 : Boolean; D2 : Boolean) is record
+ case D1 is
+ when True =>
+ L : IArr (1..4);
+ M1, M2 : CArr (1..16);
+ when False =>
+ null;
+ end case;
+ end record;
+
+ type R (D1 : Boolean; D2 : Boolean) is record
+ Field : Var_R (D1, D2);
+ end record;
+
+ procedure Proc (From : in R; To : out R);
+
+end Discr9;
diff --git a/gcc/testsuite/gnat.dg/task_stack_align.adb b/gcc/testsuite/gnat.dg/task_stack_align.adb
new file mode 100644
index 00000000000..1151a913beb
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/task_stack_align.adb
@@ -0,0 +1,31 @@
+-- { dg-do run }
+
+with Ada.Text_IO; use Ada.Text_IO;
+with System.Storage_Elements; use System.Storage_Elements;
+
+procedure Task_Stack_Align is
+
+ type Align_Me is record
+ Value : Integer;
+ end record;
+ for Align_Me'Alignment use Standard'Maximum_Alignment;
+
+ procedure Check_Local_Alignment_From (Context : String) is
+ Object : Align_Me;
+ begin
+ if To_Integer (Object'Address) mod Object'Alignment /= 0 then
+ Put_Line ("alignment check failed in " & Context);
+ end if;
+ end;
+
+ task type T;
+
+ task body T is
+ begin
+ Check_Local_Alignment_From ("task T");
+ end;
+
+ Tasks : array (1 .. 50) of T;
+begin
+ Check_Local_Alignment_From ("environment");
+end;
diff --git a/gcc/testsuite/gnat.dg/varsize_copy.adb b/gcc/testsuite/gnat.dg/varsize_copy.adb
new file mode 100644
index 00000000000..4fa0ff8622e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/varsize_copy.adb
@@ -0,0 +1,24 @@
+-- { dg-do compile }
+-- { dg-options "-O -gnatws" }
+
+package body Varsize_Copy is
+
+ type Key_Mapping_Type is record
+ Page : Page_Type;
+ B : Boolean;
+ end record;
+
+ type Key_Mapping_Array is array (Key_Type) of Key_Mapping_Type;
+
+ type Set is record
+ Key_Mappings : Key_Mapping_Array;
+ end record;
+
+ S : Set;
+
+ function F (Key : Key_Type) return Page_Type is
+ begin
+ return S.Key_Mappings (Key).Page;
+ end;
+
+end Varsize_Copy;
diff --git a/gcc/testsuite/gnat.dg/varsize_copy.ads b/gcc/testsuite/gnat.dg/varsize_copy.ads
new file mode 100644
index 00000000000..9a088a9ffdf
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/varsize_copy.ads
@@ -0,0 +1,30 @@
+package Varsize_Copy is
+
+ type Key_Type is
+ (Nul, Cntrl, Stx, Etx, Eot, Enq, Ack, Spad, Clr, Dc_1, Dc_2, Dc_3, Dc_4);
+
+ for Key_Type use
+ (Nul => 0,
+ Cntrl => 1,
+ Stx => 2,
+ Etx => 3,
+ Eot => 4,
+ Enq => 5,
+ Ack => 6,
+ Spad => 7,
+ Clr => 8,
+ Dc_1 => 17,
+ Dc_2 => 18,
+ Dc_3 => 19,
+ Dc_4 => 20);
+
+ type Page_Type(D : Boolean := False) is record
+ case D is
+ when True => I : Integer;
+ when False => null;
+ end case;
+ end record;
+
+ function F (Key : Key_Type) return Page_Type;
+
+end Varsize_Copy;
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 04717c6f099..30804858a42 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1249,6 +1249,17 @@ proc check_effective_target_arm_neon_hw { } {
} "-mfpu=neon -mfloat-abi=softfp"]
}
+# Return 1 if this a Loongson-2E or -2F target using an ABI that supports
+# the Loongson vector modes.
+
+proc check_effective_target_mips_loongson { } {
+ return [check_no_compiler_messages loongson assembly {
+ #if !defined(__mips_loongson_vector_rev)
+ #error FOO
+ #endif
+ }]
+}
+
# Return 1 if this is a PowerPC target with floating-point registers.
proc check_effective_target_powerpc_fprs { } {
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 45711ae3f12..855f0807951 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -227,6 +227,9 @@ typedef struct
/* Aliasing information for SSA_NAMEs representing pointer variables. */
struct ptr_info_def GTY(())
{
+ /* Mask of reasons this pointer's value escapes the function. */
+ ENUM_BITFIELD (escape_type) escape_mask : 9;
+
/* Nonzero if points-to analysis couldn't determine where this pointer
is pointing to. */
unsigned int pt_anything : 1;
@@ -234,7 +237,11 @@ struct ptr_info_def GTY(())
/* Nonzero if the value of this pointer escapes the current function. */
unsigned int value_escapes_p : 1;
- /* Nonzero if this pointer is dereferenced. */
+ /* Nonzero if a memory tag is needed for this pointer. This is
+ true if this pointer is eventually dereferenced. */
+ unsigned int memory_tag_needed : 1;
+
+ /* Nonzero if this pointer is really dereferenced. */
unsigned int is_dereferenced : 1;
/* Nonzero if this pointer points to a global variable. */
@@ -243,9 +250,6 @@ struct ptr_info_def GTY(())
/* Nonzero if this pointer points to NULL. */
unsigned int pt_null : 1;
- /* Mask of reasons this pointer's value escapes the function */
- ENUM_BITFIELD (escape_type) escape_mask : 9;
-
/* Set of variables that this pointer may point to. */
bitmap pt_vars;
@@ -852,6 +856,7 @@ extern void debug_points_to_info (void);
extern void dump_points_to_info_for (FILE *, tree);
extern void debug_points_to_info_for (tree);
extern bool may_be_aliased (tree);
+extern bool may_alias_p (tree, alias_set_type, tree, alias_set_type, bool);
extern struct ptr_info_def *get_ptr_info (tree);
extern bool may_point_to_global_var (tree);
extern void new_type_alias (tree, tree, tree);
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index cb97db1326b..e255424f548 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -715,6 +715,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data)
{
*tp = build1 (INDIRECT_REF, type, new);
TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old);
+ TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old);
}
}
*walk_subtrees = 0;
diff --git a/gcc/tree-ssa-alias-warnings.c b/gcc/tree-ssa-alias-warnings.c
index bf95258ed28..be26cb37d49 100644
--- a/gcc/tree-ssa-alias-warnings.c
+++ b/gcc/tree-ssa-alias-warnings.c
@@ -914,6 +914,7 @@ dsa_named_for (tree ptr)
{
unsigned ix;
bitmap_iterator bi;
+ bool any = false;
EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, ix, bi)
{
@@ -922,7 +923,16 @@ dsa_named_for (tree ptr)
if (nonstandard_alias_p (ptr, alias, false))
strict_aliasing_warn (SSA_NAME_DEF_STMT (ptr),
ptr, true, alias, false, true);
+ else
+ any = true;
}
+
+ /* If there was no object in the points-to set that the pointer
+ may alias, unconditionally warn. */
+ if (!any)
+ warning (OPT_Wstrict_aliasing,
+ "dereferencing type-punned pointer %D will "
+ "break strict-aliasing rules", SSA_NAME_VAR (ptr));
}
}
}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index e89e73b9f59..0e5071994de 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -197,7 +197,6 @@ static bitmap_obstack alias_bitmap_obstack;
/* Local functions. */
static void compute_flow_insensitive_aliasing (struct alias_info *);
static void dump_alias_stats (FILE *);
-static bool may_alias_p (tree, alias_set_type, tree, alias_set_type, bool);
static tree create_memory_tag (tree type, bool is_type_tag);
static tree get_smt_for (tree, struct alias_info *);
static tree get_nmt_for (tree);
@@ -588,14 +587,14 @@ set_initial_properties (struct alias_info *ai)
So removing this code and fixing all the bugs would be nice.
It is the cause of a bunch of clobbering. */
if ((pi->pt_global_mem || pi->pt_anything)
- && pi->is_dereferenced && pi->name_mem_tag)
+ && pi->memory_tag_needed && pi->name_mem_tag)
{
mark_call_clobbered (pi->name_mem_tag, ESCAPE_IS_GLOBAL);
MTAG_GLOBAL (pi->name_mem_tag) = true;
}
if ((pi->pt_global_mem || pi->pt_anything)
- && pi->is_dereferenced
+ && pi->memory_tag_needed
&& tag)
{
mark_call_clobbered (tag, ESCAPE_IS_GLOBAL);
@@ -1278,7 +1277,7 @@ update_reference_counts (struct mem_ref_stats_d *mem_ref_stats)
if (ptr
&& POINTER_TYPE_P (TREE_TYPE (ptr))
&& (pi = SSA_NAME_PTR_INFO (ptr)) != NULL
- && pi->is_dereferenced)
+ && pi->memory_tag_needed)
{
unsigned j;
bitmap_iterator bj;
@@ -2027,6 +2026,7 @@ reset_alias_info (void)
pi->pt_anything = 0;
pi->pt_null = 0;
pi->value_escapes_p = 0;
+ pi->memory_tag_needed = 0;
pi->is_dereferenced = 0;
if (pi->pt_vars)
bitmap_clear (pi->pt_vars);
@@ -2170,7 +2170,7 @@ create_name_tags (void)
pi = SSA_NAME_PTR_INFO (ptr);
- if (pi->pt_anything || !pi->is_dereferenced)
+ if (pi->pt_anything || !pi->memory_tag_needed)
{
/* No name tags for pointers that have not been
dereferenced or point to an arbitrary location. */
@@ -2649,7 +2649,7 @@ maybe_create_global_var (void)
VAR_ALIAS_SET is the alias set for VAR. */
-static bool
+bool
may_alias_p (tree ptr, alias_set_type mem_alias_set,
tree var, alias_set_type var_alias_set,
bool alias_set_only)
@@ -3231,6 +3231,8 @@ dump_points_to_info_for (FILE *file, tree ptr)
if (pi->is_dereferenced)
fprintf (file, ", is dereferenced");
+ else if (pi->memory_tag_needed)
+ fprintf (file, ", is dereferenced in call");
if (pi->value_escapes_p)
fprintf (file, ", its value escapes");
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index d66a4a82239..338e190d4c8 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -227,11 +227,6 @@ struct variable_info
/* A link to the variable for the next field in this structure. */
struct variable_info *next;
- /* True if the variable is directly the target of a dereference.
- This is used to track which variables are *actually* dereferenced
- so we can prune their points to listed. */
- unsigned int directly_dereferenced:1;
-
/* True if this is a variable created by the constraint analysis, such as
heap variables and constraints we had to break up. */
unsigned int is_artificial_var:1;
@@ -364,7 +359,6 @@ new_var_info (tree t, unsigned int id, const char *name)
ret->id = id;
ret->name = name;
ret->decl = t;
- ret->directly_dereferenced = false;
ret->is_artificial_var = false;
ret->is_heap_var = false;
ret->is_special_var = false;
@@ -2520,14 +2514,6 @@ process_constraint_1 (constraint_t t, bool from_call)
gcc_assert (rhs.var < VEC_length (varinfo_t, varmap));
gcc_assert (lhs.var < VEC_length (varinfo_t, varmap));
- if (!from_call)
- {
- if (lhs.type == DEREF)
- get_varinfo (lhs.var)->directly_dereferenced = true;
- if (rhs.type == DEREF)
- get_varinfo (rhs.var)->directly_dereferenced = true;
- }
-
if (!use_field_sensitive)
{
t->rhs.offset = 0;
@@ -3369,6 +3355,12 @@ update_alias_info (tree stmt, struct alias_info *ai)
is an escape point, whether OP escapes. */
count_uses_and_derefs (op, stmt, &num_uses, &num_loads, &num_stores);
+ /* For directly dereferenced pointers we can apply
+ TBAA-pruning to their points-to set. We may not count the
+ implicit dereferences &PTR->FLD here. */
+ if (num_loads + num_stores > 0)
+ pi->is_dereferenced = 1;
+
/* Handle a corner case involving address expressions of the
form '&PTR->FLD'. The problem with these expressions is that
they do not represent a dereference of PTR. However, if some
@@ -3409,7 +3401,10 @@ update_alias_info (tree stmt, struct alias_info *ai)
dereferenced pointers that point to a set of
variables will be assigned a name tag to alias
all the variables OP points to. */
- pi->is_dereferenced = 1;
+ pi->memory_tag_needed = 1;
+
+ /* ??? For always executed direct dereferences we can
+ apply TBAA-pruning to their escape set. */
/* If this is a store operation, mark OP as being
dereferenced to store, otherwise mark it as being
@@ -3443,7 +3438,7 @@ update_alias_info (tree stmt, struct alias_info *ai)
|| stmt_escape_type == ESCAPE_STORED_IN_GLOBAL)
{
pointer_set_insert (ai->dereferenced_ptrs_store, var);
- pi->is_dereferenced = 1;
+ pi->memory_tag_needed = 1;
}
}
}
@@ -4653,10 +4648,11 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
bitmap_set_bit (into, DECL_UID (vi->decl));
else
{
- alias_set_type var_alias_set, ptr_alias_set;
+ alias_set_type var_alias_set, mem_alias_set;
var_alias_set = get_alias_set (vi->decl);
- ptr_alias_set = get_alias_set (TREE_TYPE (TREE_TYPE (ptr)));
- if (alias_sets_conflict_p (ptr_alias_set, var_alias_set))
+ mem_alias_set = get_alias_set (TREE_TYPE (TREE_TYPE (ptr)));
+ if (may_alias_p (SSA_NAME_VAR (ptr), mem_alias_set,
+ vi->decl, var_alias_set, true))
bitmap_set_bit (into, DECL_UID (vi->decl));
}
}
@@ -4703,7 +4699,7 @@ set_used_smts (void)
/* Skip the special variables and those that can't be aliased. */
if (vi->is_special_var
|| !SSA_VAR_P (var)
- || (pi && !pi->is_dereferenced)
+ || (pi && !pi->memory_tag_needed)
|| (TREE_CODE (var) == VAR_DECL && !may_be_aliased (var))
|| !POINTER_TYPE_P (TREE_TYPE (var)))
continue;
@@ -4771,7 +4767,7 @@ find_what_p_points_to (tree p)
bitmap finished_solution;
bitmap result;
- if (!pi->is_dereferenced)
+ if (!pi->memory_tag_needed)
return false;
/* This variable may have been collapsed, let's get the real
@@ -4815,7 +4811,7 @@ find_what_p_points_to (tree p)
stats.points_to_sets_created++;
set_uids_in_ptset (p, finished_solution, vi->solution,
- vi->directly_dereferenced,
+ pi->is_dereferenced,
vi->no_tbaa_pruning);
result = shared_bitmap_lookup (finished_solution);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 8e6ea4cff7a..52b17d4f972 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -559,7 +559,7 @@ verify_flow_sensitive_alias_info (void)
continue;
ann = var_ann (var);
- if (pi->is_dereferenced && !pi->name_mem_tag && !ann->symbol_mem_tag)
+ if (pi->memory_tag_needed && !pi->name_mem_tag && !ann->symbol_mem_tag)
{
error ("dereferenced pointers should have a name or a symbol tag");
goto err;
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 09d39629f41..3cb4e807919 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR preprocessor/36479
+ * charset.c (cpp_interpret_string_notranslate): Also set
+ narrow_cset_desc.width.
+
2008-06-07 Joseph Myers <joseph@codesourcery.com>
* configure.ac (parisc*64*-*-*): Remove.
diff --git a/libcpp/charset.c b/libcpp/charset.c
index d70d05cc020..73e55eef039 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1412,6 +1412,7 @@ cpp_interpret_string_notranslate (cpp_reader *pfile, const cpp_string *from,
pfile->narrow_cset_desc.func = convert_no_conversion;
pfile->narrow_cset_desc.cd = (iconv_t) -1;
+ pfile->narrow_cset_desc.width = CPP_OPTION (pfile, char_precision);
retval = cpp_interpret_string (pfile, from, count, to, CPP_STRING);
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index dff8dc8a783..0966d487457 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,77 @@
+2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/36538
+ * io/list_read.c (namelist_read): Add eat_separator to eliminate leading
+ tabs.
+
+2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/35863
+ * libgfortran.h: Change l8_to_l4_offset to big_endian and add endian_off.
+ * runtime/main.c: Fix error in comment. Change l8_to_l4_offset to
+ big_endian. (determine_endianness): Add endian_off and set its value
+ according to big_endian.
+ * gfortran.map: Add symbol for new _gfortran_transfer_character_wide.
+ * io/io.h: Add prototype declarations for new functions.
+ * io/list_read.c (list_formatted_read_scalar): Modify to handle kind=4.
+ (list_formatted_read): Calculate stride based on kind for character type
+ and use it when calling list_formatted_read_scalar.
+ * io/inquire.c (inquire_via_unit): Change l8_to_l4_offset to big_endian.
+ * io/open.c (st_open): Change l8_to_l4_offset to big_endian.
+ * io/read.c (read_a_char4): New function to handle formatted read.
+ * io/write.c: Define GFC_CHAR4(x) to improve readability of code.
+ (write_a_char4): New function to handle formatted write.
+ (write_character): Modify to accept the kind parameter and adjust for
+ endianess of the machine. (list_formatted_write): Calculate the stride
+ resulting from the kind and adjust the list_formatted_write_scalar call
+ accordingly. (nml_write_obj): Adjust calls to write_character.
+ (namelist_write): Likewise.
+ * io/transfer.c (formatted_transfer_scaler): Rename 'len' argument to
+ 'kind' argument to better describe what it is. Add calls to new
+ functions for kind == 4. (formatted_transfer): Modify to handle the case
+ of type character and kind equals 4 to pass in the kind to the transfer
+ routines. (transfer_character_wide): Add this new function.
+ (transfer_array): Don't set kind to the character string length. Adjust
+ strides bases on character kind.
+ (unformatted_read): Adjust size based on kind for character types.
+ (unformatted_write): Likewise. (data_transfer_init): Change
+ l8_to_l4_offset to big_endian.
+ io/fbuf.c (fbuf_seek): Add cast to eliminate warning.
+
+2008-06-13 Tobias Burnus <burnus@net-b.de>
+
+ * configure.ac (AM_CFLAGS): Remove -Werror again.
+ * configure: Regenerate.
+
+2008-06-13 Tobias Burnus <burnus@net-b.de>
+
+ PR libgfortran/36518
+ * configure.ac (AM_CFLAGS): Add -Werror.
+ * configure: Regenerate.
+ * m4/ifunction_logical.m4: Cast "n" to "(int)".
+ * generated/any_l16.c: Regenerate.
+ * generated/any_l2.c: Regenerate.
+ * generated/all_l1.c: Regenerate.
+ * generated/all_l2.c: Regenerate.
+ * generated/all_l16.c: Regenerate.
+ * generated/any_l4.c: Regenerate.
+ * generated/count_4_l.c: Regenerate.
+ * generated/count_8_l.c: Regenerate.
+ * generated/all_l4.c: Regenerate.
+ * generated/count_1_l.c: Regenerate.
+ * generated/count_16_l.c: Regenerate.
+ * generated/any_l8.c: Regenerate.
+ * generated/count_2_l.c: Regenerate.
+ * generated/any_l1.c: Regenerate.
+ * generated/all_l8.c: Regenerate.
+
+2008-06-13 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/36495
+ * configure.ac (AM_FCFLAGS): Add "-Werror -fimplicit-none".
+ * configure: (generated) ditto.
+ * intrinsics/dprod_r8.f90: Add "implicit none".
+
2008-06-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/36420
diff --git a/libgfortran/configure b/libgfortran/configure
index ec119602412..a973ea28b4f 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -3396,7 +3396,7 @@ fi
# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
if test "x$GCC" = "xyes"; then
- AM_FCFLAGS="-I . -Wall -fno-repack-arrays -fno-underscoring"
+ AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available.
AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index 657ca4f6d9e..47d453aaf57 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -123,7 +123,7 @@ m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
# Add -Wall -fno-repack-arrays -fno-underscoring if we are using GCC.
if test "x$GCC" = "xyes"; then
- AM_FCFLAGS="-I . -Wall -fno-repack-arrays -fno-underscoring"
+ AM_FCFLAGS="-I . -Wall -Werror -fimplicit-none -fno-repack-arrays -fno-underscoring"
## We like to use C99 routines when available. This makes sure that
## __STDC_VERSION__ is set such that libc includes make them available.
AM_CFLAGS="-std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings"
diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c
index 8345adc1f6e..e8577dcf339 100644
--- a/libgfortran/generated/all_l1.c
+++ b/libgfortran/generated/all_l1.c
@@ -138,7 +138,7 @@ all_l1 (gfc_array_l1 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ALL intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c
index ee6f8f93c9f..59b0cfa513a 100644
--- a/libgfortran/generated/all_l16.c
+++ b/libgfortran/generated/all_l16.c
@@ -138,7 +138,7 @@ all_l16 (gfc_array_l16 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ALL intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c
index dd069c57d61..82ab0ca2072 100644
--- a/libgfortran/generated/all_l2.c
+++ b/libgfortran/generated/all_l2.c
@@ -138,7 +138,7 @@ all_l2 (gfc_array_l2 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ALL intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c
index 00a0896f669..d65adcd9fc5 100644
--- a/libgfortran/generated/all_l4.c
+++ b/libgfortran/generated/all_l4.c
@@ -138,7 +138,7 @@ all_l4 (gfc_array_l4 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ALL intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c
index b08c19cdba5..fdf20a2f11b 100644
--- a/libgfortran/generated/all_l8.c
+++ b/libgfortran/generated/all_l8.c
@@ -138,7 +138,7 @@ all_l8 (gfc_array_l8 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ALL intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c
index 2d11eb1a3b4..cfefe47a268 100644
--- a/libgfortran/generated/any_l1.c
+++ b/libgfortran/generated/any_l1.c
@@ -138,7 +138,7 @@ any_l1 (gfc_array_l1 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ANY intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c
index 3d7cd1b1ef9..c3297ac5c7f 100644
--- a/libgfortran/generated/any_l16.c
+++ b/libgfortran/generated/any_l16.c
@@ -138,7 +138,7 @@ any_l16 (gfc_array_l16 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ANY intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c
index 1c874182b3e..daef183cb19 100644
--- a/libgfortran/generated/any_l2.c
+++ b/libgfortran/generated/any_l2.c
@@ -138,7 +138,7 @@ any_l2 (gfc_array_l2 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ANY intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c
index 71a8cb0e63f..d12c74f87c0 100644
--- a/libgfortran/generated/any_l4.c
+++ b/libgfortran/generated/any_l4.c
@@ -138,7 +138,7 @@ any_l4 (gfc_array_l4 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ANY intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c
index 55ff7a601b0..bb65480d67c 100644
--- a/libgfortran/generated/any_l8.c
+++ b/libgfortran/generated/any_l8.c
@@ -138,7 +138,7 @@ any_l8 (gfc_array_l8 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" ANY intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c
index 638fb179e25..7a86fafa99a 100644
--- a/libgfortran/generated/count_16_l.c
+++ b/libgfortran/generated/count_16_l.c
@@ -138,7 +138,7 @@ count_16_l (gfc_array_i16 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" COUNT intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c
index 52ae34baa5f..67c9dbcf5d0 100644
--- a/libgfortran/generated/count_1_l.c
+++ b/libgfortran/generated/count_1_l.c
@@ -138,7 +138,7 @@ count_1_l (gfc_array_i1 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" COUNT intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c
index ddede7160f5..d40d0dcea52 100644
--- a/libgfortran/generated/count_2_l.c
+++ b/libgfortran/generated/count_2_l.c
@@ -138,7 +138,7 @@ count_2_l (gfc_array_i2 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" COUNT intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c
index 6bdc9ca18bf..8bd1c8f16ea 100644
--- a/libgfortran/generated/count_4_l.c
+++ b/libgfortran/generated/count_4_l.c
@@ -138,7 +138,7 @@ count_4_l (gfc_array_i4 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" COUNT intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c
index 3c1c5653610..078a33fa5aa 100644
--- a/libgfortran/generated/count_8_l.c
+++ b/libgfortran/generated/count_8_l.c
@@ -138,7 +138,7 @@ count_8_l (gfc_array_i8 * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" COUNT intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/gfortran.map b/libgfortran/gfortran.map
index 60ef8532275..0671b60fb86 100644
--- a/libgfortran/gfortran.map
+++ b/libgfortran/gfortran.map
@@ -1083,6 +1083,7 @@ GFORTRAN_1.1 {
_gfortran_string_trim_char4;
_gfortran_string_verify_char4;
_gfortran_st_wait;
+ _gfortran_transfer_character_wide;
_gfortran_transpose_char4;
_gfortran_unpack0_char4;
_gfortran_unpack1_char4;
diff --git a/libgfortran/intrinsics/dprod_r8.f90 b/libgfortran/intrinsics/dprod_r8.f90
index 44c63c41d56..2feb72f2d5b 100644
--- a/libgfortran/intrinsics/dprod_r8.f90
+++ b/libgfortran/intrinsics/dprod_r8.f90
@@ -20,6 +20,7 @@
elemental function _gfortran_specific__dprod_r8 (p1, p2)
+ implicit none
real (kind=4), intent (in) :: p1, p2
real (kind=8) :: _gfortran_specific__dprod_r8
diff --git a/libgfortran/io/fbuf.c b/libgfortran/io/fbuf.c
index a0d033bf875..f2b1599ed87 100644
--- a/libgfortran/io/fbuf.c
+++ b/libgfortran/io/fbuf.c
@@ -157,7 +157,7 @@ fbuf_seek (gfc_unit * u, gfc_offset off)
/* Moving to the left past the flushed marked would imply moving past
the left tab limit, which is never allowed. So return error if
that is attempted. */
- if (pos < u->fbuf->flushed)
+ if (pos < (gfc_offset) u->fbuf->flushed)
return -1;
u->fbuf->pos = pos;
return 0;
diff --git a/libgfortran/io/inquire.c b/libgfortran/io/inquire.c
index 5e0cf3e646c..9eb63d7b4d7 100644
--- a/libgfortran/io/inquire.c
+++ b/libgfortran/io/inquire.c
@@ -268,10 +268,9 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
case ENCODING_DEFAULT:
p = "UNKNOWN";
break;
- /* TODO: Enable UTF-8 case here when implemented.
case ENCODING_UTF8:
p = "UTF-8";
- break; */
+ break;
default:
internal_error (&iqp->common, "inquire_via_unit(): Bad encoding");
}
@@ -497,13 +496,13 @@ inquire_via_unit (st_parameter_inquire *iqp, gfc_unit * u)
else
switch (u->flags.convert)
{
- /* l8_to_l4_offset is 0 for little-endian, 1 for big-endian. */
+ /* big_endian is 0 for little-endian, 1 for big-endian. */
case GFC_CONVERT_NATIVE:
- p = l8_to_l4_offset ? "BIG_ENDIAN" : "LITTLE_ENDIAN";
+ p = big_endian ? "BIG_ENDIAN" : "LITTLE_ENDIAN";
break;
case GFC_CONVERT_SWAP:
- p = l8_to_l4_offset ? "LITTLE_ENDIAN" : "BIG_ENDIAN";
+ p = big_endian ? "LITTLE_ENDIAN" : "BIG_ENDIAN";
break;
default:
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index ea75bdbc405..cb7147db398 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -869,6 +869,9 @@ internal_proto(convert_real);
extern void read_a (st_parameter_dt *, const fnode *, char *, int);
internal_proto(read_a);
+extern void read_a_char4 (st_parameter_dt *, const fnode *, char *, int);
+internal_proto(read_a);
+
extern void read_f (st_parameter_dt *, const fnode *, char *, int);
internal_proto(read_f);
@@ -904,6 +907,9 @@ internal_proto(namelist_write);
extern void write_a (st_parameter_dt *, const fnode *, const char *, int);
internal_proto(write_a);
+extern void write_a_char4 (st_parameter_dt *, const fnode *, const char *, int);
+internal_proto(write_a_char4);
+
extern void write_b (st_parameter_dt *, const fnode *, const char *, int);
internal_proto(write_b);
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 1aa84704d8a..01e118f5f48 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -1728,7 +1728,8 @@ list_formatted_read_scalar (st_parameter_dt *dtp, volatile bt type, void *p,
int kind, size_t size)
{
char c;
- int m;
+ gfc_char4_t *q;
+ int i, m;
jmp_buf eof_jump;
dtp->u.p.namelist_mode = 0;
@@ -1831,17 +1832,33 @@ list_formatted_read_scalar (st_parameter_dt *dtp, volatile bt type, void *p,
case BT_CHARACTER:
if (dtp->u.p.saved_string)
- {
+ {
m = ((int) size < dtp->u.p.saved_used)
? (int) size : dtp->u.p.saved_used;
- memcpy (p, dtp->u.p.saved_string, m);
- }
+ if (kind == 1)
+ memcpy (p, dtp->u.p.saved_string, m);
+ else
+ {
+ q = (gfc_char4_t *) p;
+ for (i = 0; i < m; i++)
+ q[i] = (unsigned char) dtp->u.p.saved_string[i];
+ }
+ }
else
/* Just delimiters encountered, nothing to copy but SPACE. */
m = 0;
if (m < (int) size)
- memset (((char *) p) + m, ' ', size - m);
+ {
+ if (kind == 1)
+ memset (((char *) p) + m, ' ', size - m);
+ else
+ {
+ q = (gfc_char4_t *) p;
+ for (i = m; i < (int) size; i++)
+ q[i] = (unsigned char) ' ';
+ }
+ }
break;
case BT_NULL:
@@ -1862,6 +1879,8 @@ list_formatted_read (st_parameter_dt *dtp, bt type, void *p, int kind,
{
size_t elem;
char *tmp;
+ size_t stride = type == BT_CHARACTER ?
+ size * GFC_SIZE_OF_CHAR_KIND(kind) : size;
tmp = (char *) p;
@@ -1869,7 +1888,7 @@ list_formatted_read (st_parameter_dt *dtp, bt type, void *p, int kind,
for (elem = 0; elem < nelems; elem++)
{
dtp->u.p.item_count++;
- list_formatted_read_scalar (dtp, type, tmp + size*elem, kind, size);
+ list_formatted_read_scalar (dtp, type, tmp + stride*elem, kind, size);
}
}
@@ -2903,6 +2922,8 @@ find_nml_name:
goto find_nml_name;
}
+ eat_separator (dtp);
+
/* Ready to read namelist objects. If there is an error in input
from stdin, output the error message and continue. */
diff --git a/libgfortran/io/open.c b/libgfortran/io/open.c
index 84575f7bb01..4a78efa01fc 100644
--- a/libgfortran/io/open.c
+++ b/libgfortran/io/open.c
@@ -107,7 +107,7 @@ static const st_option decimal_opt[] =
static const st_option encoding_opt[] =
{
- /* TODO { "utf-8", ENCODING_UTF8}, */
+ { "utf-8", ENCODING_UTF8},
{ "default", ENCODING_DEFAULT},
{ NULL, 0}
};
@@ -795,7 +795,7 @@ st_open (st_parameter_open *opp)
conv = compile_options.convert;
}
- /* We use l8_to_l4_offset, which is 0 on little-endian machines
+ /* We use big_endian, which is 0 on little-endian machines
and 1 on big-endian machines. */
switch (conv)
{
@@ -804,11 +804,11 @@ st_open (st_parameter_open *opp)
break;
case GFC_CONVERT_BIG:
- conv = l8_to_l4_offset ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
+ conv = big_endian ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
break;
case GFC_CONVERT_LITTLE:
- conv = l8_to_l4_offset ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
+ conv = big_endian ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
break;
default:
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index a09d663dc1c..11a1ac018f7 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -270,6 +270,43 @@ read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length)
memset (p + m, ' ', n);
}
+void
+read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length)
+{
+ char *s;
+ gfc_char4_t *dest;
+ int m, n, wi, status;
+ size_t w;
+
+ wi = f->u.w;
+ if (wi == -1) /* '(A)' edit descriptor */
+ wi = length;
+
+ w = wi;
+
+ s = gfc_alloca (w);
+
+ /* Read in w bytes, treating comma as not a separator. */
+ dtp->u.p.sf_read_comma = 0;
+ status = read_block_form (dtp, s, &w);
+ dtp->u.p.sf_read_comma =
+ dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1;
+
+ if (status == FAILURE)
+ return;
+ if (w > (size_t) length)
+ s += (w - length);
+
+ m = ((int) w > length) ? length : (int) w;
+
+ dest = (gfc_char4_t *) p;
+
+ for (n = 0; n < m; n++, dest++, s++)
+ *dest = (unsigned char ) *s;
+
+ for (n = 0; n < length - (int) w; n++, dest++)
+ *dest = (unsigned char) ' ';
+}
/* eat_leading_spaces()-- Given a character pointer and a width,
* ignore the leading spaces. */
diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c
index 36181f6fc05..fd63139146e 100644
--- a/libgfortran/io/transfer.c
+++ b/libgfortran/io/transfer.c
@@ -54,6 +54,7 @@ Boston, MA 02110-1301, USA. */
transfer_integer
transfer_logical
transfer_character
+ transfer_character_wide
transfer_real
transfer_complex
@@ -76,6 +77,9 @@ export_proto(transfer_logical);
extern void transfer_character (st_parameter_dt *, void *, int);
export_proto(transfer_character);
+extern void transfer_character_wide (st_parameter_dt *, void *, int, int);
+export_proto(transfer_character_wide);
+
extern void transfer_complex (st_parameter_dt *, void *, int);
export_proto(transfer_complex);
@@ -730,35 +734,43 @@ write_buf (st_parameter_dt *dtp, void *buf, size_t nbytes)
static void
unformatted_read (st_parameter_dt *dtp, bt type,
- void *dest, int kind __attribute__((unused)),
- size_t size, size_t nelems)
+ void *dest, int kind, size_t size, size_t nelems)
{
size_t i, sz;
- /* Currently, character implies size=1. */
if (dtp->u.p.current_unit->flags.convert == GFC_CONVERT_NATIVE
- || size == 1 || type == BT_CHARACTER)
+ || size == 1)
{
sz = size * nelems;
+ if (type == BT_CHARACTER)
+ sz *= GFC_SIZE_OF_CHAR_KIND(kind);
read_block_direct (dtp, dest, &sz);
}
else
{
char buffer[16];
char *p;
-
+
+ p = dest;
+
+ /* Handle wide chracters. */
+ if (type == BT_CHARACTER && kind != 1)
+ {
+ nelems *= size;
+ size = kind;
+ }
+
/* Break up complex into its constituent reals. */
if (type == BT_COMPLEX)
{
nelems *= 2;
size /= 2;
}
- p = dest;
/* By now, all complex variables have been split into their
constituent reals. */
- for (i=0; i<nelems; i++)
+ for (i = 0; i < nelems; i++)
{
read_block_direct (dtp, buffer, &size);
reverse_memcpy (p, buffer, size);
@@ -775,20 +787,30 @@ unformatted_read (st_parameter_dt *dtp, bt type,
static void
unformatted_write (st_parameter_dt *dtp, bt type,
- void *source, int kind __attribute__((unused)),
- size_t size, size_t nelems)
+ void *source, int kind, size_t size, size_t nelems)
{
if (dtp->u.p.current_unit->flags.convert == GFC_CONVERT_NATIVE ||
- size == 1 || type == BT_CHARACTER)
+ size == 1)
{
- size *= nelems;
- write_buf (dtp, source, size);
+ size_t stride = type == BT_CHARACTER ?
+ size * GFC_SIZE_OF_CHAR_KIND(kind) : size;
+
+ write_buf (dtp, source, stride * nelems);
}
else
{
char buffer[16];
char *p;
size_t i;
+
+ p = source;
+
+ /* Handle wide chracters. */
+ if (type == BT_CHARACTER && kind != 1)
+ {
+ nelems *= size;
+ size = kind;
+ }
/* Break up complex into its constituent reals. */
if (type == BT_COMPLEX)
@@ -797,16 +819,13 @@ unformatted_write (st_parameter_dt *dtp, bt type,
size /= 2;
}
- p = source;
-
/* By now, all complex variables have been split into their
constituent reals. */
-
- for (i=0; i<nelems; i++)
+ for (i = 0; i < nelems; i++)
{
reverse_memcpy(buffer, p, size);
- p+= size;
+ p += size;
write_buf (dtp, buffer, size);
}
}
@@ -904,7 +923,7 @@ require_type (st_parameter_dt *dtp, bt expected, bt actual, const fnode *f)
of the next element, then comes back here to process it. */
static void
-formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
+formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int kind,
size_t size)
{
char scratch[SCRATCH_SIZE];
@@ -1004,9 +1023,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_decimal (dtp, f, p, len);
+ read_decimal (dtp, f, p, kind);
else
- write_i (dtp, f, p, len);
+ write_i (dtp, f, p, kind);
break;
@@ -1019,9 +1038,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_radix (dtp, f, p, len, 2);
+ read_radix (dtp, f, p, kind, 2);
else
- write_b (dtp, f, p, len);
+ write_b (dtp, f, p, kind);
break;
@@ -1034,9 +1053,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_radix (dtp, f, p, len, 8);
+ read_radix (dtp, f, p, kind, 8);
else
- write_o (dtp, f, p, len);
+ write_o (dtp, f, p, kind);
break;
@@ -1049,9 +1068,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_radix (dtp, f, p, len, 16);
+ read_radix (dtp, f, p, kind, 16);
else
- write_z (dtp, f, p, len);
+ write_z (dtp, f, p, kind);
break;
@@ -1059,11 +1078,23 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
if (n == 0)
goto need_data;
+ /* It is possible to have FMT_A with something not BT_CHARACTER such
+ as when writing out hollerith strings, so check both type
+ and kind before calling wide character routines. */
if (dtp->u.p.mode == READING)
- read_a (dtp, f, p, len);
+ {
+ if (type == BT_CHARACTER && kind == 4)
+ read_a_char4 (dtp, f, p, size);
+ else
+ read_a (dtp, f, p, size);
+ }
else
- write_a (dtp, f, p, len);
-
+ {
+ if (type == BT_CHARACTER && kind == 4)
+ write_a_char4 (dtp, f, p, size);
+ else
+ write_a (dtp, f, p, size);
+ }
break;
case FMT_L:
@@ -1071,9 +1102,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
goto need_data;
if (dtp->u.p.mode == READING)
- read_l (dtp, f, p, len);
+ read_l (dtp, f, p, kind);
else
- write_l (dtp, f, p, len);
+ write_l (dtp, f, p, kind);
break;
@@ -1084,9 +1115,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
else
- write_d (dtp, f, p, len);
+ write_d (dtp, f, p, kind);
break;
@@ -1097,9 +1128,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
else
- write_e (dtp, f, p, len);
+ write_e (dtp, f, p, kind);
break;
case FMT_EN:
@@ -1109,9 +1140,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
else
- write_en (dtp, f, p, len);
+ write_en (dtp, f, p, kind);
break;
@@ -1122,9 +1153,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
else
- write_es (dtp, f, p, len);
+ write_es (dtp, f, p, kind);
break;
@@ -1135,9 +1166,9 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
return;
if (dtp->u.p.mode == READING)
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
else
- write_f (dtp, f, p, len);
+ write_f (dtp, f, p, kind);
break;
@@ -1148,16 +1179,19 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
switch (type)
{
case BT_INTEGER:
- read_decimal (dtp, f, p, len);
+ read_decimal (dtp, f, p, kind);
break;
case BT_LOGICAL:
- read_l (dtp, f, p, len);
+ read_l (dtp, f, p, kind);
break;
case BT_CHARACTER:
- read_a (dtp, f, p, len);
+ if (kind == 4)
+ read_a_char4 (dtp, f, p, size);
+ else
+ read_a (dtp, f, p, size);
break;
case BT_REAL:
- read_f (dtp, f, p, len);
+ read_f (dtp, f, p, kind);
break;
default:
goto bad_type;
@@ -1166,19 +1200,22 @@ formatted_transfer_scalar (st_parameter_dt *dtp, bt type, void *p, int len,
switch (type)
{
case BT_INTEGER:
- write_i (dtp, f, p, len);
+ write_i (dtp, f, p, kind);
break;
case BT_LOGICAL:
- write_l (dtp, f, p, len);
+ write_l (dtp, f, p, kind);
break;
case BT_CHARACTER:
- write_a (dtp, f, p, len);
+ if (kind == 4)
+ write_a_char4 (dtp, f, p, size);
+ else
+ write_a (dtp, f, p, size);
break;
case BT_REAL:
if (f->u.real.w == 0)
- write_real (dtp, p, len);
+ write_real (dtp, p, kind);
else
- write_d (dtp, f, p, len);
+ write_d (dtp, f, p, kind);
break;
default:
bad_type:
@@ -1407,12 +1444,13 @@ formatted_transfer (st_parameter_dt *dtp, bt type, void *p, int kind,
char *tmp;
tmp = (char *) p;
-
+ size_t stride = type == BT_CHARACTER ?
+ size * GFC_SIZE_OF_CHAR_KIND(kind) : size;
/* Big loop over all the elements. */
for (elem = 0; elem < nelems; elem++)
{
dtp->u.p.item_count++;
- formatted_transfer_scalar (dtp, type, tmp + size*elem, kind, size);
+ formatted_transfer_scalar (dtp, type, tmp + stride*elem, kind, size);
}
}
@@ -1465,10 +1503,26 @@ transfer_character (st_parameter_dt *dtp, void *p, int len)
if (len == 0 && p == NULL)
p = empty_string;
- /* Currently we support only 1 byte chars, and the library is a bit
- confused of character kind vs. length, so we kludge it by setting
- kind = length. */
- dtp->u.p.transfer (dtp, BT_CHARACTER, p, len, len, 1);
+ /* Set kind here to 1. */
+ dtp->u.p.transfer (dtp, BT_CHARACTER, p, 1, len, 1);
+}
+
+void
+transfer_character_wide (st_parameter_dt *dtp, void *p, int len, int kind)
+{
+ static char *empty_string[0];
+
+ if ((dtp->common.flags & IOPARM_LIBRETURN_MASK) != IOPARM_LIBRETURN_OK)
+ return;
+
+ /* Strings of zero length can have p == NULL, which confuses the
+ transfer routines into thinking we need more data elements. To avoid
+ this, we give them a nice pointer. */
+ if (len == 0 && p == NULL)
+ p = empty_string;
+
+ /* Here we pass the actual kind value. */
+ dtp->u.p.transfer (dtp, BT_CHARACTER, p, kind, len, 1);
}
@@ -1522,13 +1576,7 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
break;
case GFC_DTYPE_CHARACTER:
iotype = BT_CHARACTER;
- /* FIXME: Currently dtype contains the charlen, which is
- clobbered if charlen > 2**24. That's why we use a separate
- argument for the charlen. However, if we want to support
- non-8-bit charsets we need to fix dtype to contain
- sizeof(chartype) and fix the code below. */
size = charlen;
- kind = charlen;
break;
case GFC_DTYPE_DERIVED:
internal_error (&dtp->common,
@@ -1542,7 +1590,9 @@ transfer_array (st_parameter_dt *dtp, gfc_array_char *desc, int kind,
for (n = 0; n < rank; n++)
{
count[n] = 0;
- stride[n] = desc->dim[n].stride;
+ stride[n] = iotype == BT_CHARACTER ?
+ desc->dim[n].stride * GFC_SIZE_OF_CHAR_KIND(kind) :
+ desc->dim[n].stride;
extent[n] = desc->dim[n].ubound + 1 - desc->dim[n].lbound;
/* If the extent of even one dimension is zero, then the entire
@@ -1815,7 +1865,7 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
if (conv == GFC_CONVERT_NONE)
conv = compile_options.convert;
- /* We use l8_to_l4_offset, which is 0 on little-endian machines
+ /* We use big_endian, which is 0 on little-endian machines
and 1 on big-endian machines. */
switch (conv)
{
@@ -1824,11 +1874,11 @@ data_transfer_init (st_parameter_dt *dtp, int read_flag)
break;
case GFC_CONVERT_BIG:
- conv = l8_to_l4_offset ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
+ conv = big_endian ? GFC_CONVERT_NATIVE : GFC_CONVERT_SWAP;
break;
case GFC_CONVERT_LITTLE:
- conv = l8_to_l4_offset ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
+ conv = big_endian ? GFC_CONVERT_SWAP : GFC_CONVERT_NATIVE;
break;
default:
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 6135d60fe5d..ed50e0d5705 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -124,6 +124,108 @@ write_a (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
#endif
}
+
+/* The primary difference between write_a_char4 and write_a is that we have to
+ deal with writing from the first byte of the 4-byte character and take care
+ of endianess. This currently implements encoding="default" which means we
+ write the lowest significant byte. If the 3 most significant bytes are
+ not representable emit a '?'. TODO: Implement encoding="UTF-8"
+ which will process all 4 bytes and translate to the encoded output. */
+
+void
+write_a_char4 (st_parameter_dt *dtp, const fnode *f, const char *source, int len)
+{
+ int wlen;
+ char *p;
+ gfc_char4_t *q;
+
+ wlen = f->u.string.length < 0
+ || (f->format == FMT_G && f->u.string.length == 0)
+ ? len : f->u.string.length;
+
+ q = (gfc_char4_t *) source;
+#ifdef HAVE_CRLF
+ /* If this is formatted STREAM IO convert any embedded line feed characters
+ to CR_LF on systems that use that sequence for newlines. See F2003
+ Standard sections 10.6.3 and 9.9 for further information. */
+ if (is_stream_io (dtp))
+ {
+ const char crlf[] = "\r\n";
+ int i, j, bytes;
+ gfc_char4_t *qq;
+ bytes = 0;
+
+ /* Write out any padding if needed. */
+ if (len < wlen)
+ {
+ p = write_block (dtp, wlen - len);
+ if (p == NULL)
+ return;
+ memset (p, ' ', wlen - len);
+ }
+
+ /* Scan the source string looking for '\n' and convert it if found. */
+ qq = (gfc_char4_t *) source;
+ for (i = 0; i < wlen; i++)
+ {
+ if (qq[i] == '\n')
+ {
+ /* Write out the previously scanned characters in the string. */
+ if (bytes > 0)
+ {
+ p = write_block (dtp, bytes);
+ if (p == NULL)
+ return;
+ for (j = 0; j < bytes; j++)
+ p[j] = q[j] > 255 ? '?' : (unsigned char) q[j];
+ bytes = 0;
+ }
+
+ /* Write out the CR_LF sequence. */
+ p = write_block (dtp, 2);
+ if (p == NULL)
+ return;
+ memcpy (p, crlf, 2);
+ }
+ else
+ bytes++;
+ }
+
+ /* Write out any remaining bytes if no LF was found. */
+ if (bytes > 0)
+ {
+ p = write_block (dtp, bytes);
+ if (p == NULL)
+ return;
+ for (j = 0; j < bytes; j++)
+ p[j] = q[j] > 255 ? '?' : (unsigned char) q[j];
+ }
+ }
+ else
+ {
+#endif
+ int j;
+ p = write_block (dtp, wlen);
+ if (p == NULL)
+ return;
+
+ if (wlen < len)
+ {
+ for (j = 0; j < wlen; j++)
+ p[j] = q[j] > 255 ? '?' : (unsigned char) q[j];
+ }
+ else
+ {
+ memset (p, ' ', wlen - len);
+ for (j = wlen - len; j < wlen; j++)
+ p[j] = q[j] > 255 ? '?' : (unsigned char) q[j];
+ }
+#ifdef HAVE_CRLF
+ }
+#endif
+}
+
+
static GFC_INTEGER_LARGEST
extract_int (const void *p, int len)
{
@@ -639,10 +741,12 @@ write_integer (st_parameter_dt *dtp, const char *source, int length)
the strings if the file has been opened in that mode. */
static void
-write_character (st_parameter_dt *dtp, const char *source, int length)
+write_character (st_parameter_dt *dtp, const char *source, int kind, int length)
{
int i, extra;
char *p, d;
+ gfc_char4_t *q;
+
switch (dtp->u.p.delim_status)
{
@@ -657,35 +761,77 @@ write_character (st_parameter_dt *dtp, const char *source, int length)
break;
}
- if (d == ' ')
- extra = 0;
- else
+ if (kind == 1)
{
- extra = 2;
+ if (d == ' ')
+ extra = 0;
+ else
+ {
+ extra = 2;
- for (i = 0; i < length; i++)
- if (source[i] == d)
- extra++;
- }
+ for (i = 0; i < length; i++)
+ if (source[i] == d)
+ extra++;
+ }
- p = write_block (dtp, length + extra);
- if (p == NULL)
- return;
+ p = write_block (dtp, length + extra);
+ if (p == NULL)
+ return;
+
+ if (d == ' ')
+ memcpy (p, source, length);
+ else
+ {
+ *p++ = d;
- if (d == ' ')
- memcpy (p, source, length);
+ for (i = 0; i < length; i++)
+ {
+ *p++ = source[i];
+ if (source[i] == d)
+ *p++ = d;
+ }
+
+ *p = d;
+ }
+ }
else
{
- *p++ = d;
-
- for (i = 0; i < length; i++)
+ /* We have to scan the source string looking for delimiters to determine
+ how large the write block needs to be. */
+ if (d == ' ')
+ extra = 0;
+ else
{
- *p++ = source[i];
- if (source[i] == d)
- *p++ = d;
+ extra = 2;
+
+ q = (gfc_char4_t *) source;
+ for (i = 0; i < length; i++, q++)
+ if (*q == (gfc_char4_t) d)
+ extra++;
}
- *p = d;
+ p = write_block (dtp, length + extra);
+ if (p == NULL)
+ return;
+
+ if (d == ' ')
+ {
+ q = (gfc_char4_t *) source;
+ for (i = 0; i < length; i++, q++)
+ p[i] = *q > 255 ? '?' : (unsigned char) *q;
+ }
+ else
+ {
+ *p++ = d;
+ q = (gfc_char4_t *) source;
+ for (i = 0; i < length; i++, q++)
+ {
+ *p++ = *q > 255 ? '?' : (unsigned char) *q;
+ if (*q == (gfc_char4_t) d)
+ *p++ = d;
+ }
+ *p = d;
+ }
}
}
@@ -796,7 +942,7 @@ list_formatted_write_scalar (st_parameter_dt *dtp, bt type, void *p, int kind,
write_logical (dtp, p, kind);
break;
case BT_CHARACTER:
- write_character (dtp, p, kind);
+ write_character (dtp, p, kind, size);
break;
case BT_REAL:
write_real (dtp, p, kind);
@@ -818,6 +964,8 @@ list_formatted_write (st_parameter_dt *dtp, bt type, void *p, int kind,
{
size_t elem;
char *tmp;
+ size_t stride = type == BT_CHARACTER ?
+ size * GFC_SIZE_OF_CHAR_KIND(kind) : size;
tmp = (char *) p;
@@ -825,7 +973,7 @@ list_formatted_write (st_parameter_dt *dtp, bt type, void *p, int kind,
for (elem = 0; elem < nelems; elem++)
{
dtp->u.p.item_count++;
- list_formatted_write_scalar (dtp, type, tmp + size*elem, kind, size);
+ list_formatted_write_scalar (dtp, type, tmp + elem * stride, kind, size);
}
}
@@ -889,9 +1037,9 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
if (obj->type != GFC_DTYPE_DERIVED)
{
#ifdef HAVE_CRLF
- write_character (dtp, "\r\n ", 3);
+ write_character (dtp, "\r\n ", 1, 3);
#else
- write_character (dtp, "\n ", 2);
+ write_character (dtp, "\n ", 1, 2);
#endif
len = 0;
if (base)
@@ -900,15 +1048,15 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
for (dim_i = 0; dim_i < (index_type) strlen (base_name); dim_i++)
{
cup = toupper (base_name[dim_i]);
- write_character (dtp, &cup, 1);
+ write_character (dtp, &cup, 1, 1);
}
}
for (dim_i =len; dim_i < (index_type) strlen (obj->var_name); dim_i++)
{
cup = toupper (obj->var_name[dim_i]);
- write_character (dtp, &cup, 1);
+ write_character (dtp, &cup, 1, 1);
}
- write_character (dtp, "=", 1);
+ write_character (dtp, "=", 1, 1);
}
/* Counts the number of data output on a line, including names. */
@@ -978,7 +1126,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
if (rep_ctr > 1)
{
sprintf(rep_buff, " %d*", rep_ctr);
- write_character (dtp, rep_buff, strlen (rep_buff));
+ write_character (dtp, rep_buff, 1, strlen (rep_buff));
dtp->u.p.no_leading_blank = 1;
}
num++;
@@ -1003,7 +1151,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
dtp->u.p.delim_status = DELIM_QUOTE;
if (dtp->u.p.nml_delim == '\'')
dtp->u.p.delim_status = DELIM_APOSTROPHE;
- write_character (dtp, p, obj->string_length);
+ write_character (dtp, p, 1, obj->string_length);
dtp->u.p.delim_status = tmp_delim;
break;
@@ -1093,14 +1241,14 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
to column 2. Reset the repeat counter. */
dtp->u.p.no_leading_blank = 0;
- write_character (dtp, &semi_comma, 1);
+ write_character (dtp, &semi_comma, 1, 1);
if (num > 5)
{
num = 0;
#ifdef HAVE_CRLF
- write_character (dtp, "\r\n ", 3);
+ write_character (dtp, "\r\n ", 1, 3);
#else
- write_character (dtp, "\n ", 2);
+ write_character (dtp, "\n ", 1, 2);
#endif
}
rep_ctr = 1;
@@ -1164,13 +1312,13 @@ namelist_write (st_parameter_dt *dtp)
/* Temporarily disable namelist delimters. */
dtp->u.p.delim_status = DELIM_NONE;
- write_character (dtp, "&", 1);
+ write_character (dtp, "&", 1, 1);
/* Write namelist name in upper case - f95 std. */
for (i = 0 ;i < dtp->namelist_name_len ;i++ )
{
c = toupper (dtp->namelist_name[i]);
- write_character (dtp, &c ,1);
+ write_character (dtp, &c, 1 ,1);
}
if (dtp->u.p.ionml != NULL)
@@ -1184,9 +1332,9 @@ namelist_write (st_parameter_dt *dtp)
}
#ifdef HAVE_CRLF
- write_character (dtp, " /\r\n", 5);
+ write_character (dtp, " /\r\n", 1, 5);
#else
- write_character (dtp, " /\n", 4);
+ write_character (dtp, " /\n", 1, 4);
#endif
/* Restore the original delimiter. */
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 6ff9f4fd072..8c0f1b4a796 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -272,13 +272,12 @@ typedef GFC_UINTEGER_4 gfc_char4_t;
simply equal to the kind parameter itself. */
#define GFC_SIZE_OF_CHAR_KIND(kind) (kind)
-
/* This will be 0 on little-endian machines and one on big-endian machines. */
-extern int l8_to_l4_offset;
-internal_proto(l8_to_l4_offset);
+extern int big_endian;
+internal_proto(big_endian);
#define GFOR_POINTER_TO_L1(p, kind) \
- (l8_to_l4_offset * (kind - 1) + (GFC_LOGICAL_1 *)(p))
+ (big_endian * (kind - 1) + (GFC_LOGICAL_1 *)(p))
#define GFC_INTEGER_1_HUGE \
(GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)
diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4
index a31d73a17b9..214be04c2d8 100644
--- a/libgfortran/m4/ifunction_logical.m4
+++ b/libgfortran/m4/ifunction_logical.m4
@@ -121,7 +121,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
if (extent[n] != ret_extent)
runtime_error ("Incorrect extent in return value of"
" u_name intrinsic in dimension %d:"
- " is %ld, should be %ld", n + 1,
+ " is %ld, should be %ld", (int) n + 1,
(long int) ret_extent, (long int) extent[n]);
}
}
diff --git a/libgfortran/runtime/main.c b/libgfortran/runtime/main.c
index 8632f152c95..71b481a7deb 100644
--- a/libgfortran/runtime/main.c
+++ b/libgfortran/runtime/main.c
@@ -45,10 +45,9 @@ stupid_function_name_for_static_linking (void)
return;
}
-/* This is the offset (in bytes) required to cast from logical(8)* to
- logical(4)*. and still get the same result. Will be 0 for little-endian
- machines and 4 for big-endian machines. */
-int l8_to_l4_offset = 0;
+/* This will be 0 for little-endian
+ machines and 1 for big-endian machines. */
+int big_endian = 0;
/* Figure out endianness for this machine. */
@@ -64,9 +63,9 @@ determine_endianness (void)
u.l8 = 1;
if (u.l4[0])
- l8_to_l4_offset = 0;
+ big_endian = 0;
else if (u.l4[1])
- l8_to_l4_offset = 1;
+ big_endian = 1;
else
runtime_error ("Unable to determine machine endianness");
}
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 5a1cac157be..d0669244d91 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,25 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * libgomp.texi (omp_test_lock): Fix typo.
+
+2008-06-12 Tobias Burnus <burnus@net-b.de>
+
+ * omp_lib.f90.in: Add "implicit none".
+
+2008-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36506
+ * testsuite/libgomp.c/reduction-5.c: New test.
+
2008-06-11 Jakub Jelinek <jakub@redhat.com>
+ * libgomp.h (struct gomp_task): Add in_tied_task field.
+ * task.c (gomp_init_task): Initialize it.
+ (GOMP_task): Likewise. Call gomp_team_barrier_set_task_pending
+ unconditionally. Don't call gomp_team_barrier_wake if
+ current task is implicit or if(0) from implicit and number of
+ running tasks is equal to nthreads - 1.
+
PR libgomp/36471
* omp_lib.f90.in (omp_get_ancestor_thread_num_8,
omp_get_team_size_8): Fix pastos.
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 66180122c1e..7292358b9aa 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -253,6 +253,7 @@ struct gomp_task
void *fn_data;
enum gomp_task_kind kind;
bool in_taskwait;
+ bool in_tied_task;
gomp_sem_t taskwait_sem;
};
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi
index f92a5da77fd..6794ebe9335 100644
--- a/libgomp/libgomp.texi
+++ b/libgomp/libgomp.texi
@@ -512,7 +512,7 @@ a deadlock occurs.
Before setting a simple lock, the lock variable must be initialized by
@code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock}
does not block if the lock is not available. This function returns
-@code{true} upon success,@code{false} otherwise. Here, @code{true} and
+@code{true} upon success, @code{false} otherwise. Here, @code{true} and
@code{false} represent their language-specific counterparts.
@item @emph{C/C++}:
diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in
index c61b93f8145..07a57997b28 100644
--- a/libgomp/omp_lib.f90.in
+++ b/libgomp/omp_lib.f90.in
@@ -26,6 +26,7 @@
! General Public License.
module omp_lib_kinds
+ implicit none
integer, parameter :: omp_integer_kind = 4
integer, parameter :: omp_logical_kind = 4
integer, parameter :: omp_lock_kind = @OMP_LOCK_KIND@
@@ -35,6 +36,7 @@
module omp_lib
use omp_lib_kinds
+ implicit none
integer, parameter :: openmp_version = 200805
integer (omp_sched_kind), parameter :: omp_sched_static = 1
integer (omp_sched_kind), parameter :: omp_sched_dynamic = 2
diff --git a/libgomp/task.c b/libgomp/task.c
index 903948ceca3..ce991b8dca2 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -43,6 +43,7 @@ gomp_init_task (struct gomp_task *task, struct gomp_task *parent_task,
task->icv = *prev_icv;
task->kind = GOMP_TASK_IMPLICIT;
task->in_taskwait = false;
+ task->in_tied_task = false;
task->children = NULL;
gomp_sem_init (&task->taskwait_sem, 0);
}
@@ -103,6 +104,8 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
gomp_init_task (&task, thr->task, gomp_icv (false));
task.kind = GOMP_TASK_IFFALSE;
+ if (thr->task)
+ task.in_tied_task = thr->task->in_tied_task;
thr->task = &task;
if (__builtin_expect (cpyfn != NULL, 0))
{
@@ -134,6 +137,7 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
& ~(uintptr_t) (arg_align - 1));
gomp_init_task (task, parent, gomp_icv (false));
task->kind = GOMP_TASK_IFFALSE;
+ task->in_tied_task = parent->in_tied_task;
thr->task = task;
if (cpyfn)
cpyfn (arg, data);
@@ -143,6 +147,7 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
task->kind = GOMP_TASK_WAITING;
task->fn = fn;
task->fn_data = arg;
+ task->in_tied_task = true;
gomp_mutex_lock (&team->task_lock);
if (parent->children)
{
@@ -170,9 +175,10 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
task->prev_queue = task;
team->task_queue = task;
}
- if (team->task_count++ == 0)
- gomp_team_barrier_set_task_pending (&team->barrier);
- do_wake = team->task_running_count < team->nthreads;
+ ++team->task_count;
+ gomp_team_barrier_set_task_pending (&team->barrier);
+ do_wake = team->task_running_count + !parent->in_tied_task
+ < team->nthreads;
gomp_mutex_unlock (&team->task_lock);
if (do_wake)
gomp_team_barrier_wake (&team->barrier, 1);
diff --git a/libgomp/testsuite/libgomp.c/reduction-5.c b/libgomp/testsuite/libgomp.c/reduction-5.c
new file mode 100644
index 00000000000..de87d9f6dc8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/reduction-5.c
@@ -0,0 +1,78 @@
+/* PR middle-end/36506 */
+
+extern void abort (void);
+
+int
+main (void)
+{
+ int sum = 0, prod = 1;
+#pragma omp parallel
+ #pragma omp sections reduction (+:sum)
+ {
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ }
+ if (sum != 6)
+ abort ();
+ sum = 0;
+#pragma omp parallel sections reduction (+:sum)
+ {
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ }
+ if (sum != 6)
+ abort ();
+ sum = 0;
+#pragma omp parallel
+ #pragma omp sections reduction (+:sum) reduction (*:prod)
+ {
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ }
+ if (sum != 6 || prod != 8)
+ abort ();
+ sum = 0;
+ prod = 1;
+#pragma omp parallel sections reduction (+:sum) reduction (*:prod)
+ {
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ }
+ if (sum != 6 || prod != 8)
+ abort ();
+ return 0;
+}
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 18d77077aca..ede5da84b35 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * libiberty.texi: Expand TABs, drop indentation outside examples.
+ * obstacks.texi: Likewise.
+
2008-04-21 Aurelien Jarno <aurelien@aurel32.net>
* libiberty/configure.ac: use -fPIC on Linux/MIPS hosts.
diff --git a/libiberty/libiberty.texi b/libiberty/libiberty.texi
index d3701e69dfa..9fd6f786b48 100644
--- a/libiberty/libiberty.texi
+++ b/libiberty/libiberty.texi
@@ -10,7 +10,7 @@
@finalout
@c %**end of header
-
+
@dircategory GNU libraries
@direntry
* Libiberty: (libiberty). Library of utility functions which
diff --git a/libiberty/obstacks.texi b/libiberty/obstacks.texi
index 9bddf7caf30..a1b1b478c38 100644
--- a/libiberty/obstacks.texi
+++ b/libiberty/obstacks.texi
@@ -15,20 +15,20 @@ the objects are usually small. And the only space overhead per object is
the padding needed to start each object on a suitable boundary.
@menu
-* Creating Obstacks:: How to declare an obstack in your program.
-* Preparing for Obstacks:: Preparations needed before you can
- use obstacks.
+* Creating Obstacks:: How to declare an obstack in your program.
+* Preparing for Obstacks:: Preparations needed before you can
+ use obstacks.
* Allocation in an Obstack:: Allocating objects in an obstack.
* Freeing Obstack Objects:: Freeing objects in an obstack.
-* Obstack Functions:: The obstack functions are both
- functions and macros.
+* Obstack Functions:: The obstack functions are both
+ functions and macros.
* Growing Objects:: Making an object bigger by stages.
-* Extra Fast Growing:: Extra-high-efficiency (though more
- complicated) growing objects.
+* Extra Fast Growing:: Extra-high-efficiency (though more
+ complicated) growing objects.
* Status of an Obstack:: Inquiries about the status of an obstack.
* Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
* Obstack Chunks:: How obstacks obtain and release chunks;
- efficiency considerations.
+ efficiency considerations.
* Summary of Obstacks::
@end menu
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index b623679ca61..3ae74708729 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-14 Kai Tietz <kai.tietz@onevision.com>
+
+ * exception.c (PERSONALITY_FUNCTION): Remove extra decrement
+ if HAVE_GETIPINFO is not defined.
+
2008-06-10 Kai Tietz <kai.tietz@onevision.com>
* Object.m (compare): Add type id.
diff --git a/libobjc/exception.c b/libobjc/exception.c
index 1a6b9dab4d1..bc59aa743cb 100644
--- a/libobjc/exception.c
+++ b/libobjc/exception.c
@@ -295,7 +295,7 @@ PERSONALITY_FUNCTION (int version,
#ifdef HAVE_GETIPINFO
ip = _Unwind_GetIPInfo (context, &ip_before_insn);
#else
- ip = _Unwind_GetIP (context) - 1;
+ ip = _Unwind_GetIP (context);
#endif
if (!ip_before_insn)
--ip;
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index e4ecd3d853b..9380784bdf2 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,126 @@
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * include/Makefile.am: Remove trailing white space, fix typo.
+ (parallel_headers): Remove duplicate file, sort entries.
+ * include/Makefile.in: Regenerate.
+
+2008-06-15 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ * src/condition_variable.cc (~condition_variable): Drop unused
+ variable.
+
+2008-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/bits/stl_deque.h (deque<>::push_back(_Args&&...),
+ deque<>::push_front(_Args&&...)): Remove.
+ (deque<>::push_back(value_type&&),
+ deque<>::push_front(value_type&&)): Add.
+ (deque<>::push_back(const value_type&),
+ deque<>::push_front(const value_type&)): Add back.
+ (deque<>::emplace_back(_Args&&...),
+ deque<>::emplace_front(_Args&&...)): Declare...
+ * include/bits/deque.tcc: ... and define.
+ * include/bits/stl_list.h (list<>::push_back(_Args&&...),
+ list<>::push_front(_Args&&...)): Remove.
+ (list<>::push_back(value_type&&), list<>::push_front(value_type&&),
+ list<>::emplace_back(_Args&&...), list<>::emplace_front(_Args&&...)):
+ Add.
+ (list<>::push_back(const value_type&),
+ list<>::push_front(const value_type&)): Add back.
+ * include/bits/stl_vector.h (vector<>::push_back(_Args&&...)): Remove.
+ (vector<>::push_back(value_type&&)): Add.
+ (vector<>::push_back(const value_type&)): Add back.
+ (vector<>::emplace_back(_Args&&...)): Declare...
+ * include/bits/vector.tcc: ... and define.
+ * include/bits/stl_queue.h (queue<>::push(_Args&&...),
+ priority_queue<>::push(_Args&&...)): Remove.
+ (queue<>::push(value_type&&), queue<>::emplace(_Args&&...),
+ priority_queue<>::push(value_type&&),
+ priority_queue<>::emplace(_Args&&...)): Add.
+ (queue<>::push(const value_type&),
+ priority_queue<>::push(const value_type&)): Add back.
+ * include/bits/stl_stack.h (stack<>::push(_Args&&...)): Remove.
+ (stack<>::push(value_type&&), stack<>::emplace(_Args&&...)): Add.
+ (stack<>::push(const value_type&)): Add back.
+ * include/debug/deque (deque<>::push_back(_Args&&...),
+ deque<>::push_front(_Args&&...)): Remove.
+ (deque<>::push_back(value_type&&), deque<>::push_front(value_type&&),
+ deque<>::emplace_back(_Args&&...), deque<>::emplace_front(_Args&&...)):
+ Add.
+ (deque<>::push_back(const value_type&),
+ deque<>::push_front(const value_type&)): Add back.
+ * include/debug/list (list<>::push_back(_Args&&...),
+ list<>::push_front(_Args&&...)): Remove.
+ (list<>::push_back(value_type&&), list<>::push_front(value_type&&),
+ list<>::emplace_back(_Args&&...), list<>::emplace_front(_Args&&...)):
+ Add.
+ (list<>::push_back(const value_type&),
+ list<>::push_front(const value_type&)): Add back.
+ * include/debug/vector (vector<>::push_back(_Args&&...)): Remove.
+ (vector<>::push_back(value_type&&),
+ vector<>::emplace_back(_Args&&...)): Add.
+ (vector<>::push_back(const value_type&)): Add back.
+ * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/deque/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
+ Adjust dg-error line numbers.
+ * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
+ Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_1_neg.cc: Likewise.
+ * testsuite/23_containers/vector/requirements/dr438/
+ constructor_2_neg.cc: Likewise.
+
+2008-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/array (array<>::assign): Do not define in
+ C++0x mode, per DR 776...
+ (array<>::fill): ... define instead.
+ * doc/xml/manual/intro.xml: Add an entry for DR 776.
+ * testsuite/23_containers/array/requirements/fill.cc: New.
+
+2008-06-12 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/std/complex (pow(const complex<>&, int)): Do not define in
+ C++0x mode, per DR 844.
+ * include/tr1/complex (pow(const complex<>&, int)): Remove.
+ * doc/xml/manual/intro.xml: Add an entry for DR 844.
+ * testsuite/26_numerics/complex/dr844.cc: New.
+ * testsuite/tr1/8_c_compatibility/complex/overloads_int.cc: Adjust.
+
+2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/hashtable (_Hashtable<>::cbegin(size_type),
+ cend(size_type)): Add per DR 691.
+ * testsuite/23_containers/unordered_map/requirements/cliterators.cc:
+ New.
+ * testsuite/23_containers/unordered_multimap/requirements/
+ cliterators.cc: Likewise.
+ * testsuite/23_containers/unordered_set/requirements/cliterators.cc:
+ Likewise.
+ * testsuite/23_containers/unordered_multiset/requirements/
+ cliterators.cc: Likewise.
+ * doc/xml/manual/intro.xml: Add an entry for DR 691.
+
+2008-06-11 Matthias Klose <doko@ubuntu.com>
+
+ * testsuite/30_threads/lock_error, testsuite/30_threads/once_flag:
+ Remove empty directories.
+
2008-06-07 Joseph Myers <joseph@codesourcery.com>
* configure.host (xscale, ep9312, m680[246]0, solaris2.5,
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 1f6708dac9a..fb23f3dd603 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -635,6 +635,13 @@
<listitem><para>Add the missing operations.
</para></listitem></varlistentry>
+ <varlistentry><term><ulink url="../ext/lwg-active.html#691">691</ulink>:
+ <emphasis>const_local_iterator cbegin, cend missing from TR1</emphasis>
+ </term>
+ <listitem><para>In C++0x mode add cbegin(size_type) and cend(size_type)
+ to the unordered containers.
+ </para></listitem></varlistentry>
+
<varlistentry><term><ulink url="../ext/lwg-defects.html#693">693</ulink>:
<emphasis>std::bitset::all() missing</emphasis>
</term>
@@ -659,8 +666,15 @@
<listitem><para>Implement the int -> size_t replacements.
</para></listitem></varlistentry>
+ <varlistentry><term><ulink url="../ext/lwg-active.html#776">776</ulink>:
+ <emphasis>Undescribed assign function of std::array</emphasis>
+ </term>
+ <listitem><para>In C++0x mode, remove assign, add fill.
+ </para></listitem></varlistentry>
+
<varlistentry><term><ulink url="../ext/lwg-active.html#778">778</ulink>:
- <emphasis>std::bitset does not have any constructor taking a string literal</emphasis>
+ <emphasis>std::bitset does not have any constructor taking a string
+ literal</emphasis>
</term>
<listitem><para>Add it.
</para></listitem></varlistentry>
@@ -670,6 +684,12 @@
</term>
<listitem><para>In C++0x mode, add std::proj.
</para></listitem></varlistentry>
+
+ <varlistentry><term><ulink url="../ext/lwg-active.html#844">844</ulink>:
+ <emphasis>complex pow return type is ambiguous</emphasis>
+ </term>
+ <listitem><para>In C++0x mode, remove the pow(complex&lt;T&gt;, int) signature.
+ </para></listitem></varlistentry>
</variablelist>
</sect2>
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 9b950b58e28..7a8579dd679 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -155,7 +155,7 @@ backward_headers = \
${backward_srcdir}/hash_set \
${backward_srcdir}/hash_fun.h \
${backward_srcdir}/hashtable.h \
- ${backward_srcdir}/strstream
+ ${backward_srcdir}/strstream
pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
pb_builddir = ./ext/pb_ds
@@ -187,7 +187,7 @@ pb_subdirs = \
${pb_builddir}/detail/list_update_policy
# The ability for make and the underlying host to deal with this
-# unweildy list as one entire entity is not a sure thing, and may
+# unwieldy list as one entire entity is not a sure thing, and may
# cause build errors. Thus, split one list into many smaller
# mini-lists, with the maximum size per mini-list of no more than 42.
@@ -232,7 +232,7 @@ pb_headers1 = \
${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \
${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \
${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \
- ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
+ ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
pb_headers2 = \
${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \
@@ -274,7 +274,7 @@ pb_headers2 = \
${pb_srcdir}/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
${pb_srcdir}/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp \
${pb_srcdir}/detail/cc_hash_table_map_/size_fn_imps.hpp \
- ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
+ ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
pb_headers3 = \
${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
@@ -315,7 +315,7 @@ pb_headers3 = \
${pb_srcdir}/detail/hash_fn/probe_fn_base.hpp \
${pb_srcdir}/detail/hash_fn/quadratic_probe_fn_imp.hpp \
${pb_srcdir}/detail/hash_fn/ranged_hash_fn.hpp \
- ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
+ ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
pb_headers4 = \
${pb_srcdir}/detail/hash_fn/sample_probe_fn.hpp \
@@ -358,7 +358,7 @@ pb_headers4 = \
${pb_srcdir}/detail/ov_tree_map_/insert_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/iterators_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/node_iterators.hpp \
- ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
+ ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
pb_headers5 = \
${pb_srcdir}/detail/ov_tree_map_/policy_access_fn_imps.hpp \
@@ -400,7 +400,7 @@ pb_headers5 = \
${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \
${pb_srcdir}/detail/priority_queue_base_dispatch.hpp \
${pb_srcdir}/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp \
- ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
+ ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
pb_headers6 = \
${pb_srcdir}/detail/rb_tree_map_/erase_fn_imps.hpp \
@@ -442,7 +442,7 @@ pb_headers6 = \
${pb_srcdir}/detail/standard_policies.hpp \
${pb_srcdir}/detail/thin_heap_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/thin_heap_/debug_fn_imps.hpp \
- ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
+ ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
pb_headers7 = \
${pb_srcdir}/detail/thin_heap_/find_fn_imps.hpp \
@@ -468,11 +468,11 @@ pb_headers7 = \
${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \
${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \
${pb_srcdir}/detail/unordered_iterator/iterator.hpp \
- ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
+ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
ext_srcdir = ${glibcxx_srcdir}/include/ext
-ext_builddir = ./ext
+ext_builddir = ./ext
ext_headers = \
${ext_srcdir}/algorithm \
${ext_srcdir}/atomicity.h \
@@ -639,7 +639,7 @@ c_compatibility_srcdir = ${glibcxx_srcdir}/include/c_compatibility
c_compatibility_builddir = .
if GLIBCXX_C_HEADERS_C_STD
-c_compatibility_headers =
+c_compatibility_headers =
endif
if GLIBCXX_C_HEADERS_C_GLOBAL
@@ -647,7 +647,7 @@ c_compatibility_headers = \
${c_compatibility_srcdir}/complex.h \
${c_compatibility_srcdir}/fenv.h \
${c_compatibility_srcdir}/tgmath.h \
- ${c_compatibility_srcdir}/stdatomic.h
+ ${c_compatibility_srcdir}/stdatomic.h
endif
if GLIBCXX_C_HEADERS_C
@@ -710,9 +710,8 @@ parallel_srcdir = ${glibcxx_srcdir}/include/parallel
parallel_builddir = ./parallel
if ENABLE_PARALLEL
parallel_headers = \
- ${parallel_srcdir}/algorithm \
- ${parallel_srcdir}/algobase.h \
${parallel_srcdir}/algo.h \
+ ${parallel_srcdir}/algobase.h \
${parallel_srcdir}/algorithm \
${parallel_srcdir}/algorithmfwd.h \
${parallel_srcdir}/balanced_quicksort.h \
@@ -738,8 +737,8 @@ parallel_headers = \
${parallel_srcdir}/numericfwd.h \
${parallel_srcdir}/omp_loop.h \
${parallel_srcdir}/omp_loop_static.h \
- ${parallel_srcdir}/parallel.h \
${parallel_srcdir}/par_loop.h \
+ ${parallel_srcdir}/parallel.h \
${parallel_srcdir}/partial_sum.h \
${parallel_srcdir}/partition.h \
${parallel_srcdir}/queue.h \
@@ -753,7 +752,7 @@ parallel_headers = \
${parallel_srcdir}/tags.h \
${parallel_srcdir}/types.h \
${parallel_srcdir}/unique_copy.h \
- ${parallel_srcdir}/workstealing.h
+ ${parallel_srcdir}/workstealing.h
else
parallel_headers =
endif
@@ -788,7 +787,7 @@ host_headers = \
${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
${glibcxx_srcdir}/include/precompiled/stdc++.h \
${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
- ${glibcxx_srcdir}/include/precompiled/extc++.h
+ ${glibcxx_srcdir}/include/precompiled/extc++.h
# Non-installed host_header files.
COMPATIBILITY_H = config/abi/compatibility.h
@@ -804,7 +803,7 @@ host_headers_extra = \
${host_builddir}/c++io.h \
${host_builddir}/c++locale.h \
${host_builddir}/messages_members.h \
- ${host_builddir}/time_members.h
+ ${host_builddir}/time_members.h
thread_host_headers = \
${host_builddir}/gthr.h \
@@ -911,7 +910,7 @@ stamp-ext: ${ext_headers}
stamp-pb:
@if [ ! -d "${pb_builddir}" ]; then \
mkdir -p ${pb_subdirs} ;\
- fi
+ fi
@if [ ! -f stamp-pb ]; then \
cd ${pb_builddir} && for h in ${pb_headers1}; do \
build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
@@ -1113,7 +1112,7 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
# the rest are taken from the original source tree.
if GLIBCXX_HOSTED
-install-data-local: install-headers
+install-data-local: install-headers
else
install-data-local: install-freestanding-headers
endif
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index b94c0cd632e..366b7c97f5c 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -408,7 +408,7 @@ backward_headers = \
${backward_srcdir}/hash_set \
${backward_srcdir}/hash_fun.h \
${backward_srcdir}/hashtable.h \
- ${backward_srcdir}/strstream
+ ${backward_srcdir}/strstream
pb_srcdir = ${glibcxx_srcdir}/include/ext/pb_ds
pb_builddir = ./ext/pb_ds
@@ -440,7 +440,7 @@ pb_subdirs = \
# The ability for make and the underlying host to deal with this
-# unweildy list as one entire entity is not a sure thing, and may
+# unwieldy list as one entire entity is not a sure thing, and may
# cause build errors. Thus, split one list into many smaller
# mini-lists, with the maximum size per mini-list of no more than 42.
pb_headers1 = \
@@ -484,7 +484,7 @@ pb_headers1 = \
${pb_srcdir}/detail/binomial_heap_/debug_fn_imps.hpp \
${pb_srcdir}/detail/bin_search_tree_/bin_search_tree_.hpp \
${pb_srcdir}/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp \
- ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
+ ${pb_srcdir}/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
pb_headers2 = \
${pb_srcdir}/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp \
@@ -526,7 +526,7 @@ pb_headers2 = \
${pb_srcdir}/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp \
${pb_srcdir}/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp \
${pb_srcdir}/detail/cc_hash_table_map_/size_fn_imps.hpp \
- ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
+ ${pb_srcdir}/detail/cc_hash_table_map_/standard_policies.hpp
pb_headers3 = \
${pb_srcdir}/detail/cc_hash_table_map_/trace_fn_imps.hpp \
@@ -567,7 +567,7 @@ pb_headers3 = \
${pb_srcdir}/detail/hash_fn/probe_fn_base.hpp \
${pb_srcdir}/detail/hash_fn/quadratic_probe_fn_imp.hpp \
${pb_srcdir}/detail/hash_fn/ranged_hash_fn.hpp \
- ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
+ ${pb_srcdir}/detail/hash_fn/ranged_probe_fn.hpp
pb_headers4 = \
${pb_srcdir}/detail/hash_fn/sample_probe_fn.hpp \
@@ -610,7 +610,7 @@ pb_headers4 = \
${pb_srcdir}/detail/ov_tree_map_/insert_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/iterators_fn_imps.hpp \
${pb_srcdir}/detail/ov_tree_map_/node_iterators.hpp \
- ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
+ ${pb_srcdir}/detail/ov_tree_map_/ov_tree_map_.hpp
pb_headers5 = \
${pb_srcdir}/detail/ov_tree_map_/policy_access_fn_imps.hpp \
@@ -652,7 +652,7 @@ pb_headers5 = \
${pb_srcdir}/detail/pat_trie_/update_fn_imps.hpp \
${pb_srcdir}/detail/priority_queue_base_dispatch.hpp \
${pb_srcdir}/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp \
- ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
+ ${pb_srcdir}/detail/rb_tree_map_/debug_fn_imps.hpp
pb_headers6 = \
${pb_srcdir}/detail/rb_tree_map_/erase_fn_imps.hpp \
@@ -694,7 +694,7 @@ pb_headers6 = \
${pb_srcdir}/detail/standard_policies.hpp \
${pb_srcdir}/detail/thin_heap_/constructors_destructor_fn_imps.hpp \
${pb_srcdir}/detail/thin_heap_/debug_fn_imps.hpp \
- ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
+ ${pb_srcdir}/detail/thin_heap_/erase_fn_imps.hpp
pb_headers7 = \
${pb_srcdir}/detail/thin_heap_/find_fn_imps.hpp \
@@ -720,10 +720,10 @@ pb_headers7 = \
${pb_srcdir}/detail/unordered_iterator/const_iterator.hpp \
${pb_srcdir}/detail/unordered_iterator/const_point_iterator.hpp \
${pb_srcdir}/detail/unordered_iterator/iterator.hpp \
- ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
+ ${pb_srcdir}/detail/unordered_iterator/point_iterator.hpp
ext_srcdir = ${glibcxx_srcdir}/include/ext
-ext_builddir = ./ext
+ext_builddir = ./ext
ext_headers = \
${ext_srcdir}/algorithm \
${ext_srcdir}/atomicity.h \
@@ -892,7 +892,7 @@ c_compatibility_builddir = .
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/complex.h \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/fenv.h \
@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
-@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
+@GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@ ${c_compatibility_srcdir}/stdatomic.h
@GLIBCXX_C_HEADERS_C_STD_TRUE@c_compatibility_headers =
@GLIBCXX_C_HEADERS_C_TRUE@c_compatibility_headers = \
@@ -955,9 +955,8 @@ parallel_srcdir = ${glibcxx_srcdir}/include/parallel
parallel_builddir = ./parallel
@ENABLE_PARALLEL_FALSE@parallel_headers =
@ENABLE_PARALLEL_TRUE@parallel_headers = \
-@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithm \
-@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algobase.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algo.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algobase.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithm \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/algorithmfwd.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/balanced_quicksort.h \
@@ -983,8 +982,8 @@ parallel_builddir = ./parallel
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/numericfwd.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/omp_loop_static.h \
-@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/parallel.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/par_loop.h \
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/parallel.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partial_sum.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/partition.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/queue.h \
@@ -998,7 +997,7 @@ parallel_builddir = ./parallel
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/tags.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/types.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/unique_copy.h \
-@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/workstealing.h
+@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/workstealing.h
@GLIBCXX_C_HEADERS_EXTRA_FALSE@c_base_headers_extra =
@@ -1022,7 +1021,7 @@ host_headers = \
${glibcxx_srcdir}/$(ERROR_CONSTANTS_SRCDIR)/error_constants.h \
${glibcxx_srcdir}/include/precompiled/stdc++.h \
${glibcxx_srcdir}/include/precompiled/stdtr1c++.h \
- ${glibcxx_srcdir}/include/precompiled/extc++.h
+ ${glibcxx_srcdir}/include/precompiled/extc++.h
# Non-installed host_header files.
@@ -1040,7 +1039,7 @@ host_headers_extra = \
${host_builddir}/c++io.h \
${host_builddir}/c++locale.h \
${host_builddir}/messages_members.h \
- ${host_builddir}/time_members.h
+ ${host_builddir}/time_members.h
thread_host_headers = \
${host_builddir}/gthr.h \
@@ -1311,7 +1310,7 @@ stamp-ext: ${ext_headers}
stamp-pb:
@if [ ! -d "${pb_builddir}" ]; then \
mkdir -p ${pb_subdirs} ;\
- fi
+ fi
@if [ ! -f stamp-pb ]; then \
cd ${pb_builddir} && for h in ${pb_headers1}; do \
build_name=`echo $$h | sed -e "s|${pb_srcdir}|.|g"` ;\
@@ -1503,7 +1502,7 @@ ${pch3_output}: ${pch3_source} ${pch2_output}
# host_headers_extra are taken out of the build tree staging area;
# the rest are taken from the original source tree.
-@GLIBCXX_HOSTED_TRUE@install-data-local: install-headers
+@GLIBCXX_HOSTED_TRUE@install-data-local: install-headers
@GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers
# This is a subset of the full install-headers rule. We only need <cstddef>,
diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc
index 08b7adeeb65..9c1096f77ba 100644
--- a/libstdc++-v3/include/bits/deque.tcc
+++ b/libstdc++-v3/include/bits/deque.tcc
@@ -1,6 +1,6 @@
// Deque implementation (out of line) -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -85,6 +85,41 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ emplace_front(_Args&&... __args)
+ {
+ if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
+ {
+ this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
+ std::forward<_Args>(__args)...);
+ --this->_M_impl._M_start._M_cur;
+ }
+ else
+ _M_push_front_aux(std::forward<_Args>(__args)...);
+ }
+
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ deque<_Tp, _Alloc>::
+ emplace_back(_Args&&... __args)
+ {
+ if (this->_M_impl._M_finish._M_cur
+ != this->_M_impl._M_finish._M_last - 1)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
+ std::forward<_Args>(__args)...);
+ ++this->_M_impl._M_finish._M_cur;
+ }
+ else
+ _M_push_back_aux(std::forward<_Args>(__args)...);
+ }
+#endif
+
template <typename _Tp, typename _Alloc>
typename deque<_Tp, _Alloc>::iterator
deque<_Tp, _Alloc>::
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 6032765ed0c..b778f15a075 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -1117,7 +1117,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* data to it. Due to the nature of a %deque this operation
* can be done in constant time.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_front(const value_type& __x)
{
@@ -1129,20 +1128,15 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
else
_M_push_front_aux(__x);
}
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(value_type&& __x)
+ { emplace_front(std::move(__x)); }
+
template<typename... _Args>
void
- push_front(_Args&&... __args)
- {
- if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)
- {
- this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1,
- std::forward<_Args>(__args)...);
- --this->_M_impl._M_start._M_cur;
- }
- else
- _M_push_front_aux(std::forward<_Args>(__args)...);
- }
+ emplace_front(_Args&&... __args);
#endif
/**
@@ -1154,7 +1148,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* to it. Due to the nature of a %deque this operation can be
* done in constant time.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_back(const value_type& __x)
{
@@ -1167,21 +1160,15 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
else
_M_push_back_aux(__x);
}
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { emplace_back(std::move(__x)); }
+
template<typename... _Args>
void
- push_back(_Args&&... __args)
- {
- if (this->_M_impl._M_finish._M_cur
- != this->_M_impl._M_finish._M_last - 1)
- {
- this->_M_impl.construct(this->_M_impl._M_finish._M_cur,
- std::forward<_Args>(__args)...);
- ++this->_M_impl._M_finish._M_cur;
- }
- else
- _M_push_back_aux(std::forward<_Args>(__args)...);
- }
+ emplace_back(_Args&&... __args);
#endif
/**
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h
index a631b0ef1ef..08fb89ef117 100644
--- a/libstdc++-v3/include/bits/stl_list.h
+++ b/libstdc++-v3/include/bits/stl_list.h
@@ -833,15 +833,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* done in constant time, and does not invalidate iterators and
* references.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_front(const value_type& __x)
{ this->_M_insert(begin(), __x); }
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(value_type&& __x)
+ { this->_M_insert(begin(), std::move(__x)); }
+
template<typename... _Args>
void
- push_front(_Args&&... __args)
- { this->_M_insert(begin(), std::forward<_Args>(__args)...); }
+ emplace_front(_Args&&... __args)
+ { this->_M_insert(begin(), std::forward<_Args>(__args)...); }
#endif
/**
@@ -870,15 +874,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* in constant time, and does not invalidate iterators and
* references.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_back(const value_type& __x)
{ this->_M_insert(end(), __x); }
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { this->_M_insert(end(), std::move(__x)); }
+
template<typename... _Args>
void
- push_back(_Args&&... __args)
- { this->_M_insert(end(), std::forward<_Args>(__args)...); }
+ emplace_back(_Args&&... __args)
+ { this->_M_insert(end(), std::forward<_Args>(__args)...); }
#endif
/**
diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h
index 4ab3c46c0b8..053a59c1650 100644
--- a/libstdc++-v3/include/bits/stl_queue.h
+++ b/libstdc++-v3/include/bits/stl_queue.h
@@ -1,6 +1,6 @@
// Queue implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -220,16 +220,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* to it. The time complexity of the operation depends on the
* underlying sequence.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push(const value_type& __x)
{ c.push_back(__x); }
-#else
- // NB: DR 756.
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ { c.push_back(std::move(__x)); }
+
template<typename... _Args>
void
- push(_Args&&... __args)
- { c.push_back(std::forward<_Args>(__args)...); }
+ emplace(_Args&&... __args)
+ { c.emplace_back(std::forward<_Args>(__args)...); }
#endif
/**
@@ -509,20 +512,26 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* The time complexity of the operation depends on the underlying
* sequence.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push(const value_type& __x)
{
c.push_back(__x);
std::push_heap(c.begin(), c.end(), comp);
}
-#else
- // NB: DR 756.
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ {
+ c.push_back(std::move(__x));
+ std::push_heap(c.begin(), c.end(), comp);
+ }
+
template<typename... _Args>
void
- push(_Args&&... __args)
- {
- c.push_back(std::forward<_Args>(__args)...);
+ emplace(_Args&&... __args)
+ {
+ c.emplace_back(std::forward<_Args>(__args)...);
std::push_heap(c.begin(), c.end(), comp);
}
#endif
diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 932388a7a68..13e4b7a4615 100644
--- a/libstdc++-v3/include/bits/stl_stack.h
+++ b/libstdc++-v3/include/bits/stl_stack.h
@@ -1,6 +1,6 @@
// Stack implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -184,16 +184,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
* to it. The time complexity of the operation depends on the
* underlying sequence.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push(const value_type& __x)
{ c.push_back(__x); }
-#else
- // NB: DR 756.
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push(value_type&& __x)
+ { c.push_back(std::move(__x)); }
+
template<typename... _Args>
void
- push(_Args&&... __args)
- { c.push_back(std::forward<_Args>(__args)...); }
+ emplace(_Args&&... __args)
+ { c.emplace_back(std::forward<_Args>(__args)...); }
#endif
/**
diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h
index 34bb595d528..aa874089d52 100644
--- a/libstdc++-v3/include/bits/stl_vector.h
+++ b/libstdc++-v3/include/bits/stl_vector.h
@@ -681,7 +681,6 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* done in constant time if the %vector has preallocated space
* available.
*/
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_back(const value_type& __x)
{
@@ -693,20 +692,15 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
else
_M_insert_aux(end(), __x);
}
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(value_type&& __x)
+ { emplace_back(std::move(__x)); }
+
template<typename... _Args>
void
- push_back(_Args&&... __args)
- {
- if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
- {
- this->_M_impl.construct(this->_M_impl._M_finish,
- std::forward<_Args>(__args)...);
- ++this->_M_impl._M_finish;
- }
- else
- _M_insert_aux(end(), std::forward<_Args>(__args)...);
- }
+ emplace_back(_Args&&... __args);
#endif
/**
diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc
index 462d18f6cbb..04f76ca2c2c 100644
--- a/libstdc++-v3/include/bits/vector.tcc
+++ b/libstdc++-v3/include/bits/vector.tcc
@@ -88,6 +88,24 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
}
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ template<typename... _Args>
+ void
+ vector<_Tp, _Alloc>::
+ emplace_back(_Args&&... __args)
+ {
+ if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)
+ {
+ this->_M_impl.construct(this->_M_impl._M_finish,
+ std::forward<_Args>(__args)...);
+ ++this->_M_impl._M_finish;
+ }
+ else
+ _M_insert_aux(end(), std::forward<_Args>(__args)...);
+ }
+#endif
+
template<typename _Tp, typename _Alloc>
typename vector<_Tp, _Alloc>::iterator
vector<_Tp, _Alloc>::
diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 2f967b49f33..c37381f084f 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -1,6 +1,6 @@
// Debugging deque implementation -*- C++ -*-
-// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -254,7 +254,6 @@ namespace __debug
}
// 23.2.1.3 modifiers:
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_front(const _Tp& __x)
{
@@ -268,20 +267,29 @@ namespace __debug
_Base::push_back(__x);
this->_M_invalidate_all();
}
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_front(_Tp&& __x)
+ { emplace_front(std::move(__x)); }
+
+ void
+ push_back(_Tp&& __x)
+ { emplace_back(std::move(__x)); }
+
template<typename... _Args>
void
- push_front(_Args&&... __args)
+ emplace_front(_Args&&... __args)
{
- _Base::push_front(std::forward<_Args>(__args)...);
+ _Base::emplace_front(std::forward<_Args>(__args)...);
this->_M_invalidate_all();
}
template<typename... _Args>
void
- push_back(_Args&&... __args)
+ emplace_back(_Args&&... __args)
{
- _Base::push_back(std::forward<_Args>(__args)...);
+ _Base::emplace_back(std::forward<_Args>(__args)...);
this->_M_invalidate_all();
}
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index d0797e9bf46..7ab0bddff99 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -280,6 +280,10 @@ namespace __debug
// 23.2.2.3 modifiers:
using _Base::push_front;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using _Base::emplace_front;
+#endif
+
void
pop_front()
{
@@ -291,6 +295,10 @@ namespace __debug
using _Base::push_back;
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ using _Base::emplace_back;
+#endif
+
void
pop_back()
{
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index 7945b54591e..12bd52f0b2b 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -289,7 +289,6 @@ namespace __debug
using _Base::data;
// 23.2.4.3 modifiers:
-#ifndef __GXX_EXPERIMENTAL_CXX0X__
void
push_back(const _Tp& __x)
{
@@ -299,13 +298,18 @@ namespace __debug
this->_M_invalidate_all();
_M_update_guaranteed_capacity();
}
-#else
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(_Tp&& __x)
+ { emplace_back(std::move(__x)); }
+
template<typename... _Args>
void
- push_back(_Args&&... __args)
+ emplace_back(_Args&&... __args)
{
bool __realloc = _M_requires_reallocation(this->size() + 1);
- _Base::push_back(std::forward<_Args>(__args)...);
+ _Base::emplace_back(std::forward<_Args>(__args)...);
if (__realloc)
this->_M_invalidate_all();
_M_update_guaranteed_capacity();
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index 0fa381cbeac..c8845f6728c 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -82,8 +82,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);
/// Return complex base 10 logarithm of @a z.
template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);
- /// Return complex cosine of @a z.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // DR 844.
+ /// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);
+#endif
/// Return @a x to the @a y'th power.
template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);
/// Return @a x to the @a y'th power.
@@ -945,10 +948,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// 26.2.8/9 pow(__x, __y): Returns the complex power base of __x
// raised to the __y-th power. The branch
// cut is on the negative axis.
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 844. complex pow return type is ambiguous.
template<typename _Tp>
inline complex<_Tp>
pow(const complex<_Tp>& __z, int __n)
{ return std::__pow_helper(__z, __n); }
+#endif
template<typename _Tp>
complex<_Tp>
diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex
index b571a5982ed..88c37de75d2 100644
--- a/libstdc++-v3/include/tr1/complex
+++ b/libstdc++-v3/include/tr1/complex
@@ -78,11 +78,6 @@ namespace tr1
template<typename _Tp>
inline std::complex<_Tp>
- pow(const std::complex<_Tp>& __x, int __n)
- { return std::pow(__x, __n); }
-
- template<typename _Tp>
- inline std::complex<_Tp>
pow(const std::complex<_Tp>& __x, const _Tp& __y)
{ return std::pow(__x, __y); }
diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array
index a9047438843..66dc9a2c8ce 100644
--- a/libstdc++-v3/include/tr1_impl/array
+++ b/libstdc++-v3/include/tr1_impl/array
@@ -56,11 +56,16 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// No explicit construct/copy/destroy for aggregate type.
- void
+ void
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 776.
+ fill(const value_type& __u)
+#else
assign(const value_type& __u)
+#endif
{ std::fill_n(begin(), size(), __u); }
- void
+ void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
@@ -74,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
{ return const_iterator(&_M_instance[0]); }
iterator
- end()
+ end()
{ return iterator(&_M_instance[_Nm]); }
const_iterator
diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable
index 9a3ecbd094f..55056ef3da8 100644
--- a/libstdc++-v3/include/tr1_impl/hashtable
+++ b/libstdc++-v3/include/tr1_impl/hashtable
@@ -1,6 +1,6 @@
// Internal header for TR1 unordered_set and unordered_map -*- C++ -*-
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 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
@@ -326,19 +326,30 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
local_iterator
begin(size_type __n)
{ return local_iterator(_M_buckets[__n]); }
-
+
local_iterator
end(size_type)
{ return local_iterator(0); }
-
+
const_local_iterator
begin(size_type __n) const
{ return const_local_iterator(_M_buckets[__n]); }
-
+
const_local_iterator
end(size_type) const
{ return const_local_iterator(0); }
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 691.
+ const_local_iterator
+ cbegin(size_type __n) const
+ { return const_local_iterator(_M_buckets[__n]); }
+
+ const_local_iterator
+ cend(size_type) const
+ { return const_local_iterator(0); }
+#endif
+
float
load_factor() const
{
diff --git a/libstdc++-v3/src/condition_variable.cc b/libstdc++-v3/src/condition_variable.cc
index 74541e9f34b..c3caa593a0d 100644
--- a/libstdc++-v3/src/condition_variable.cc
+++ b/libstdc++-v3/src/condition_variable.cc
@@ -49,7 +49,7 @@ namespace std
{
#if __GTHREAD_HAS_COND
// XXX no thread blocked
- int __e = pthread_cond_destroy(&_M_cond);
+ /* int __e = */ pthread_cond_destroy(&_M_cond);
// if __e == EBUSY then blocked
#endif
}
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
new file mode 100644
index 00000000000..45b81b66d6c
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <array>
+#include <testsuite_hooks.h>
+
+// DR 776. Undescribed assign function of std::array.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 3;
+ typedef std::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2 } };
+ const int value = 5;
+
+ a.fill(value);
+ VERIFY( a[0] == value );
+ VERIFY( a[1] == value );
+ VERIFY( a[2] == value );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 3d40c00596b..2cb464cb86c 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -1,6 +1,6 @@
// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2007 Free Software Foundation
+// Copyright (C) 2007, 2008 Free Software Foundation
//
// 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
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1449 }
+// { dg-error "no matching" "" { target *-*-* } 1436 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index fb4c40ef8cc..57c865f34c0 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1388 }
+// { dg-error "no matching" "" { target *-*-* } 1375 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 1f24c98278f..a46674c52dc 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1388 }
+// { dg-error "no matching" "" { target *-*-* } 1375 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 522022a856d..3ae748ca316 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1533 }
+// { dg-error "no matching" "" { target *-*-* } 1520 }
// { dg-excess-errors "" }
#include <deque>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index 1478f3de947..8eeff630927 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1317 }
+// { dg-error "no matching" "" { target *-*-* } 1325 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index d5dc3908b7c..06b71622421 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1286 }
+// { dg-error "no matching" "" { target *-*-* } 1294 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index 10f726b9f73..bfe871077d7 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1286 }
+// { dg-error "no matching" "" { target *-*-* } 1294 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index 1a97c4b4436..d75ed067e24 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1286 }
+// { dg-error "no matching" "" { target *-*-* } 1294 }
// { dg-excess-errors "" }
#include <list>
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
new file mode 100644
index 00000000000..1699a2b40b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+// DR 691.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_map<int, int> um_type;
+ um_type um;
+ um[1] = 1;
+ VERIFY( um.cbegin(0) == um.begin(0) );
+ VERIFY( um.cend(0) == um.end(0) );
+ const um_type::size_type bn = um.bucket(1);
+ VERIFY( um.cbegin(bn) != um.cend(bn) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc
new file mode 100644
index 00000000000..947e2a7807a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <unordered_map>
+#include <testsuite_hooks.h>
+
+// DR 691.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_multimap<int, int> umm_type;
+ umm_type umm;
+ umm.insert(umm_type::value_type(1, 1));
+ VERIFY( umm.cbegin(0) == umm.begin(0) );
+ VERIFY( umm.cend(0) == umm.end(0) );
+ const umm_type::size_type bn = umm.bucket(1);
+ VERIFY( umm.cbegin(bn) != umm.cend(bn) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc
new file mode 100644
index 00000000000..51b32564444
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+// DR 691.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_multiset<int> ums_type;
+ ums_type ums;
+ ums.insert(1);
+ VERIFY( ums.cbegin(0) == ums.begin(0) );
+ VERIFY( ums.cend(0) == ums.end(0) );
+ const ums_type::size_type bn = ums.bucket(1);
+ VERIFY( ums.cbegin(bn) != ums.cend(bn) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc
new file mode 100644
index 00000000000..944514a653f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc
@@ -0,0 +1,53 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2007-06-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#include <unordered_set>
+#include <testsuite_hooks.h>
+
+// DR 691.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef std::unordered_set<int> us_type;
+ us_type us;
+ us.insert(1);
+ VERIFY( us.cbegin(0) == us.begin(0) );
+ VERIFY( us.cend(0) == us.end(0) );
+ const us_type::size_type bn = us.bucket(1);
+ VERIFY( us.cbegin(bn) != us.cend(bn) );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
index eb6aa1f0b6b..64c6a98dfb5 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 992 }
+// { dg-error "no matching" "" { target *-*-* } 986 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
index 6e65a5e8092..34e602da583 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 932 }
+// { dg-error "no matching" "" { target *-*-* } 926 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
index dce05ed2cf9..f1af46c43a2 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 932 }
+// { dg-error "no matching" "" { target *-*-* } 926 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
index 3df2fc8b745..a95f57857d8 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc
@@ -1,6 +1,6 @@
// 2007-04-27 Paolo Carlini <pcarlini@suse.de>
-// Copyright (C) 2007 Free Software Foundation
+// Copyright (C) 2007, 2008 Free Software Foundation
//
// 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
@@ -19,7 +19,7 @@
// USA.
// { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1033 }
+// { dg-error "no matching" "" { target *-*-* } 1027 }
// { dg-excess-errors "" }
#include <vector>
diff --git a/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc b/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc
new file mode 100644
index 00000000000..e9bb192d6e9
--- /dev/null
+++ b/libstdc++-v3/testsuite/26_numerics/complex/dr844.cc
@@ -0,0 +1,52 @@
+// { dg-options "-std=gnu++0x" }
+// 2008-06-12 Paolo Carlini <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <complex>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+// DR 844. complex pow return type is ambiguous.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using __gnu_test::check_ret_type;
+
+ typedef std::complex<float> cmplx_f_type;
+ typedef std::complex<double> cmplx_d_type;
+ typedef std::complex<long double> cmplx_ld_type;
+
+ const int i1 = 1;
+ const float f1 = 1.0f;
+ const double d1 = 1.0;
+ const long double ld1 = 1.0l;
+
+ check_ret_type<cmplx_d_type>(std::pow(cmplx_f_type(f1, f1), i1));
+ VERIFY( std::pow(cmplx_f_type(f1, f1), i1)
+ == std::pow(cmplx_d_type(f1, f1), double(i1)) );
+ check_ret_type<cmplx_d_type>(std::pow(cmplx_d_type(d1, d1), i1));
+ check_ret_type<cmplx_ld_type>(std::pow(cmplx_ld_type(ld1, ld1), i1));
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
index b0183514537..231581f9d5c 100644
--- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
+++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc
@@ -1,6 +1,6 @@
// 2006-01-12 Paolo Carlini <pcarlini@suse.de>
//
-// Copyright (C) 2006 Free Software Foundation, Inc.
+// Copyright (C) 2006, 2007, 2008 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
@@ -64,18 +64,13 @@ void test01()
typedef std::complex<int> cmplx_i_type;
check_ret_type<cmplx_i_type>(std::tr1::polar(i1, i1));
- // NB: According to the letter of 8.1.9/3 the return type should be a
- // cmplx_d_type, but the existing std::pow(const complex<>&, int) wins.
- // check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1));
- check_ret_type<cmplx_f_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1));
-
+ check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), i1));
check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), u1));
check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_f_type(f1, f1), l1));
check_ret_type<cmplx_d_type>(std::tr1::pow(cmplx_d_type(d1, d1), i1));
- // See last comment.
- // VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1)
- // == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) );
+ VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1)
+ == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) );
VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1)
== std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) );
VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1)