From ea875f6efe3bb8adfb0cd5c46481e92462efd788 Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Fri, 7 Nov 2003 02:43:04 +0000 Subject: Gcc 3.3.3 20031106. --- contrib/gcc/ChangeLog | 906 +++++++++++++++++- contrib/gcc/Makefile.in | 2 +- contrib/gcc/aclocal.m4 | 2 +- contrib/gcc/alias.c | 2 +- contrib/gcc/builtins.c | 241 +++-- contrib/gcc/c-decl.c | 97 +- contrib/gcc/c-lex.c | 7 +- contrib/gcc/c-objc-common.c | 2 + contrib/gcc/c-typeck.c | 27 +- contrib/gcc/calls.c | 35 +- contrib/gcc/cfgcleanup.c | 22 + contrib/gcc/cfgloop.c | 17 +- contrib/gcc/cfgrtl.c | 8 +- contrib/gcc/collect2.c | 14 +- contrib/gcc/combine.c | 59 +- contrib/gcc/config.gcc | 68 +- contrib/gcc/config.in | 17 +- contrib/gcc/config/alpha/alpha.c | 68 +- contrib/gcc/config/alpha/alpha.h | 1 + contrib/gcc/config/alpha/alpha.md | 2 +- contrib/gcc/config/alpha/linux.h | 11 +- contrib/gcc/config/arm/linux-elf.h | 3 + contrib/gcc/config/darwin.h | 13 + contrib/gcc/config/i386/emmintrin.h | 1499 +++++++++++++++++++++++++++++ contrib/gcc/config/i386/i386.c | 452 +++++---- contrib/gcc/config/i386/i386.h | 34 +- contrib/gcc/config/i386/i386.md | 135 +++ contrib/gcc/config/i386/mmintrin.h | 336 ++++++- contrib/gcc/config/i386/pmmintrin.h | 132 +++ contrib/gcc/config/i386/sco5.h | 738 +++----------- contrib/gcc/config/i386/sol2.h | 4 +- contrib/gcc/config/i386/t-sco5 | 24 +- contrib/gcc/config/i386/xmmintrin.h | 1586 +++---------------------------- contrib/gcc/config/ia64/hpux.h | 16 + contrib/gcc/config/ia64/ia64-protos.h | 3 + contrib/gcc/config/ia64/ia64.c | 194 ++-- contrib/gcc/config/ia64/ia64.h | 56 +- contrib/gcc/config/ia64/ia64.md | 20 + contrib/gcc/config/ia64/ia64intrin.h | 8 +- contrib/gcc/config/ia64/libgcc-ia64.ver | 3 + contrib/gcc/config/ia64/unwind-ia64.c | 18 + contrib/gcc/config/linux.h | 3 + contrib/gcc/config/rs6000/linux.h | 3 + contrib/gcc/config/rs6000/linux64.h | 3 + contrib/gcc/config/rs6000/rs6000.c | 4 +- contrib/gcc/config/rs6000/rs6000.md | 24 +- contrib/gcc/config/rs6000/sysv4.h | 15 + contrib/gcc/config/sparc/linux.h | 4 + contrib/gcc/config/sparc/linux64.h | 4 + contrib/gcc/config/sparc/sol2-c1.asm | 4 + contrib/gcc/config/sparc/sparc.c | 4 + contrib/gcc/config/sparc/sparc.md | 41 +- contrib/gcc/config/t-darwin | 2 +- contrib/gcc/config/t-libunwind | 1 + contrib/gcc/configure | 351 ++++--- contrib/gcc/configure.in | 68 +- contrib/gcc/cp/ChangeLog | 179 +++- contrib/gcc/cp/call.c | 105 +- contrib/gcc/cp/class.c | 47 +- contrib/gcc/cp/cp-tree.h | 12 +- contrib/gcc/cp/decl.c | 81 +- contrib/gcc/cp/decl2.c | 2 + contrib/gcc/cp/friend.c | 2 + contrib/gcc/cp/init.c | 4 + contrib/gcc/cp/pt.c | 51 +- contrib/gcc/cp/search.c | 23 +- contrib/gcc/cp/tree.c | 99 +- contrib/gcc/cp/typeck.c | 94 +- contrib/gcc/cp/typeck2.c | 3 +- contrib/gcc/cpplib.c | 24 +- contrib/gcc/cppmain.c | 2 +- contrib/gcc/cse.c | 10 +- contrib/gcc/dbxout.c | 2 +- contrib/gcc/doc/contrib.texi | 12 + contrib/gcc/doc/extend.texi | 35 +- contrib/gcc/doc/include/gcc-common.texi | 2 +- contrib/gcc/doc/invoke.texi | 11 +- contrib/gcc/doc/tm.texi | 16 + contrib/gcc/dwarf2out.c | 21 +- contrib/gcc/expr.c | 9 + contrib/gcc/f/ChangeLog | 4 + contrib/gcc/function.c | 12 +- contrib/gcc/gcc.c | 3 + contrib/gcc/libgcc-std.ver | 4 + contrib/gcc/loop.c | 33 +- contrib/gcc/loop.h | 9 +- contrib/gcc/mklibgcc.in | 10 +- contrib/gcc/mkmap-symver.awk | 16 +- contrib/gcc/real.c | 3 +- contrib/gcc/reg-stack.c | 71 +- contrib/gcc/reorg.c | 6 + contrib/gcc/scan-decls.c | 10 +- contrib/gcc/stmt.c | 4 +- contrib/gcc/stor-layout.c | 3 + contrib/gcc/tlink.c | 4 +- contrib/gcc/toplev.c | 20 +- contrib/gcc/tree.c | 2 +- contrib/gcc/tree.h | 2 +- contrib/gcc/unroll.c | 12 +- contrib/gcc/unwind-dw2.c | 7 +- contrib/gcc/unwind-libunwind.c | 172 ++++ contrib/gcc/unwind.h | 3 + contrib/gcc/varasm.c | 51 +- contrib/gcc/version.c | 2 +- 104 files changed, 5590 insertions(+), 3132 deletions(-) create mode 100644 contrib/gcc/config/i386/emmintrin.h create mode 100644 contrib/gcc/config/i386/pmmintrin.h create mode 100644 contrib/gcc/config/t-libunwind create mode 100644 contrib/gcc/unwind-libunwind.c diff --git a/contrib/gcc/ChangeLog b/contrib/gcc/ChangeLog index 0f83fad04aac..eb90643cbdec 100644 --- a/contrib/gcc/ChangeLog +++ b/contrib/gcc/ChangeLog @@ -1,3 +1,820 @@ +2003-11-05 Roger Sayle + + PR optimization/10339 + * builtins.c (expand_builtin_strcmp): Try to emit cmpstrsi insn + directly instead of unsafely transforming call into a memcmp. + (expand_builtin_strncmp): Likewise. + +2003-11-03 Alexander Kabaev + + * real.c (encode_ieee_single): Ensure proper promotion. + +2003-11-04 H.J. Lu + + Backport from 3.4-branch + + 2003-07-13 Andreas Jaeger + + * config.gcc: Add pmmintrin.h for x86_64-*-*. + + 2003-06-26 H.J. Lu + + * config.gcc (extra_headers): Add pmmintrin.h for i[34567]86-*-*. + + * config/i386/i386.c (override_options): Turn on MASK_SSE2 + for -mpni. + (bdesc_2arg): Add PNI builtins with 2 args. + (bdesc_1arg): Add PNI builtins with 1 arg. + (ix86_init_mmx_sse_builtins): Handle PNI builtins. + (ix86_expand_builtin): Likewise. + + * config/i386/i386.h (MASK_3DNOW, MASK_3DNOW_A, + MASK_128BIT_LONG_DOUBLE, MASK_64BIT, MASK_MS_BITFIELD_LAYOUT, + MASK_TLS_DIRECT_SEG_REFS): Renumbered. + (TARGET_PNI): New. + (TARGET_SWITCHES): Add -mpni and -mno-pni. + (TARGET_CPU_CPP_BUILTINS): Defined __PNI__ for PNI. + (ix86_builtins): Add PNI builtins. + (config/i386/i386.md): Add PNI patterns. + + * config/i386/pmmintrin.h: New file. + + * config/i386/i386.c (override_options): Turn on MASK_SSE for + -msse2. + (MASK_SSE1): Removed. + (MASK_SSE164): Removed. + (MASK_SSE264): Removed. + (bdesc_2arg): Replace MASK_SSE1 with MASK_SSE. Replace + MASK_SSE164 with MASK_SSE | MASK_64BIT. Replace MASK_SSE264 + with MASK_SSE2 | MASK_64BIT. + (bdesc_1arg): Likewise. + (ix86_init_mmx_sse_builtins): Likewise. + + * config/i386/i386.h (TARGET_SSE): Remove MASK_SSE2. + + 2003-06-20 H.J. Lu + + * doc/extend.texi: Document new builtin functions for Intel + Prescott New Intrunctions. + + * doc/invoke.texi: Document new command-line options, -mpni and + -mno-pni, for Intel Prescott New Intrunctions. + + 2003-06-05 H.J. Lu + + * config.gcc (extra_headers): Add emmintrin.h for i[34567]86-*-* + and x86_64-*-*. + + * config/i386/mmintrin.h: Update version and add alternate + intrinsic names. + * config/i386/xmmintrin.h: Likewise. + + * config/i386/xmmintrin.h: Include . Move SSE2 + intrinsics to ... + * config/i386/emmintrin.h: Here. New file. + +2003-11-04 H.J. Lu + + Backport from 3.4-branch + 2003-04-25 H.J. Lu + + * config/ia64/ia64.c (ia64_expand_compare_and_swap): Add rmode + for return mode. + (ia64_expand_builtin): Set rmode to SImode for + IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_SI, + IA64_BUILTIN_VAL_COMPARE_AND_SWAP_SI and + IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_DI. Set remode to DImode + for IA64_BUILTIN_VAL_COMPARE_AND_SWAP_DI. + + 2003-04-24 H.J. Lu + + * config/ia64/ia64.c (ia64_init_builtins): Add si_ftype_pdi_di_di + for __sync_bool_compare_and_swap_di for int return type. + + * config/ia64/ia64intrin.h (__sync_bool_compare_and_swap_di): + Change return type to int. + (__sync_bool_compare_and_swap): Likewise. + +2003-11-03 Volker Reichelt + + * doc/contrib.texi: Add Giovanni Bajo, Dara Hazeghi, Falk Hueffner, + and Andrew Pinski. + +2003-11-03 Rainer Orth + + * fixinc/inclhack.def (stdio_va_list): Allow tab before va_list. + Merge two substitutions. + * fixinc/fixincl.x: Regenerate. + Fixes PR bootstrap/12666. + +2003-10-28 Franz Sirl + + PR target/11598 + PR libgcj/10610 + * config/rs6000/sysv4.h (PREFERRED_STACK_BOUNDARY): New macro. + +2003-10-27 Falk Hueffner + + PR target/12654 + * config/alpha/alpha.c (alpha_emit_conditional_branch): Don't do + comparison against constant by adjusting the argument except for + EQ and NE. + +2003-10-26 Ottavio Campana + + PR target/12690 + * config/i386/mmintrin.h (_mm_set1_pi8): Fix comment. + +2003-10-25 Bruce Korb + + * gcc/fixinc/tests/base/ansi/string.h: + This fixes a result from a broken sed or a hand-edited output file. + The '__GNUC__' wrappers were misplaced. + +2003-10-25 Eric Botcazou + + PR target/12712 + * reg-stack.c (convert_regs_1): Create an arbitrary input stack + if the block has no predecessors. + (convert_regs_2): Document the problem with successors whose + only predecessor is the block to be processed. + (convert_regs): Don't create the arbitrary input stack here. + +2003-10-22 David Taylor + + PR debug/12500 + * dbxout.c (dbxout_typedefs): Use COMPLETE_OR_VOID_TYPE_P. + +2003-10-20 Zack Weinberg + + * fixinc/inclhack.def (hpux11_snprintf): New edit. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/stdio.h: Add test for hpux11_snprintf. + +2003-05-16 Jakub Jelinek + + * config/ia64/unwind-ia64.c (uw_update_reg_address): Handle + .save XX, r0. + +2003-10-19 Mark Mitchell + + * doc/include/gcc-common.texi: Bump version number. + * version.c (version_string): Reset to prerelease format. + +2003-10-18 Kazu Hirata + + * doc/extend.texi: Fix typos. + +2003-10-16 Release Manager + + * GCC 3.3.2 Released. + +2003-10-14 Jason Merrill + + PR c/11885 + * stor-layout.c (update_alignment_for_field): Packed non-bit-fields + get byte alignment. + +2003-10-14 Rainer Orth + + * fixinc/inclhack.def (alpha_pthread_gcc): New fix. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/pthread.h [ALPHA_PTHREAD_GCC_CHECK]: New + testcase. + Fixes PR bootstrap/9330. + +2003-10-14 Steven Bosscher + + PR target/11087 + Backport from gcc-3_3-rhl-branch and mainline. + + 2003-07-17 Jakub Jelinek + + * loop.c (basic_induction_var): Check if convert_modes + emitted any instructions. Remove them and return 0 if so. + +2003-10-13 Matt Kraai + + PR target/11949 + Backport from mainline: + + 2003-05-05 Aldy Hernandez + + * testsuite/gcc.c-torture/compile/simd-6.c: New. + * c-typeck.c (digest_init): Handle arrays of vector constants. + +2003-10-11 Eric Botcazou + + PR optimization/12544 + * function.c (put_var_into_stack): Don't generate ADDRESSOFs + for DECL_NONLOCAL decls. + +2003-10-09 Eric Botcazou + + PR optimization/12510 + Backport from mainline: + + 2003-09-08 Jakub Jelinek + + * toplev.c (rest_of_compilation): Call split_all_insns before + regstack if optimizing but not scheduling after reload. + +2003-10-09 Rainer Orth + + * fixinc/inclhack.def (stdio_va_list): Removed _ap fix. + (irix_stdio_va_list): Don't require leading printf, IRIX 6.5.21 + introduced some multi-line prototypes. + * fixinc/fixincl.x: Regenerate. + Fixes PR libf2c/12263. + +2003-10-08 Timo Kokkonen + Eric Botcazou + + PR bootstrap/12490 + * scan-decls.c (MAX_EXTERN_C_BRACES): New preprocessor constant + to define the size of the extern_C_braces array. Set it to 200. + (scan_decls): Abort when extern_C_braces_length is out-of-bounds. + +2003-10-06 Eric Botcazou + + PR optimization/12215 + * cse.c (cse_set_around_loop): Emit the move at the beginning + of the next basic block for trapping sets. + +2003-10-06 Eric Botcazou + + PR optimization/11637 + * combine.c (adjust_for_new_dest): New function to adjust the + notes and LOG_LINKS when the dest of an insn has changed. + (try_combine): Use it when deleting the first insn of a two-insn + parallel or splitting a two-load parallel. + +2003-10-04 Stephane Carrez + + * config/m68hc11/t-m68hc11-gas (MULTILIB_MATCHES): m68hcs12 is + identical to m68hc12 as far as libraries are concerned. + +2003-10-04 Eric Botcazou + + PR c/12446 + * c-typeck.c (convert_for_assignment): Issue an error for + array to pointer assignment after default conversion. + (digest_init): Likewise. + +2003-10-03 Gerald Pfeifer + + * doc/extend.texi (Function Attributes): Fix title of GNU C + Preprocessor manual. + (C++ Extensions): Fix reference to "Predefined Macros" in the + GNU C Preprocessor manual. + +2003-10-03 Zdenek Dvorak + + PR/11883 + * cfgloop.c (flow_loops_find): Fix handling of abnormal edges. + +2003-10-02 Mark Mitchell + + PR optimization/12180 + * c-objc-common.c (inline_forbidden_p): Do not permit inlining of + functions containing calls to __builtin_next_arg. + +2003-10-02 Josef Zlomek + + PR/12292 + * combine.c (make_field_assignment): Check whether rtx's code + is CONST_INT before using INTVAL. + +2003-10-02 Josef Zlomek + + Waldek Hebisch + PR/12072 + * varasm.c (compare_constant): Fix thinko. + +2003-10-01 John David Anglin + + * aclocal.m4: Add hpux10* and hpux11.00 to /dev/zero blacklist. + * configure: Rebuilt. + +2003-10-01 John David Anglin + + * aclocal.m4: Add ultrix* to /dev/zero blacklist. + * configure: Rebuilt. + +2003-10-01 Rainer Orth + + * config.gcc (sparc-*-solaris2*): Handle Solaris 10 and up like + Solaris 7-9. + + * fixinc/inclhack.def (solaris_widec): Replace solaris2.[0-5]* by + wildcards which explicitly match micro versions. + * fixinc/fixincl.x: Regenerate. + +2003-10-01 Richard Henderson + + * dwarf2out.c (expand_builtin_init_dwarf_reg_sizes): Honor + DWARF_ALT_FRAME_RETURN_COLUMN. + * unwind-dw2.c (dwarf_reg_size_table): Expand by one. + (_Unwind_GetGR, _Unwind_SetGR): Validate lookup column. + (uw_frame_state_for): Return end-of-stack for null return address. + + * config/alpha/alpha.c (alpha_sa_mask): Add r31 for eh_return. + (alpha_expand_prologue): Store a zero for it. + (alpha_expand_epilogue): Don't reload it. + * config/alpha/alpha.h (DWARF_ALT_FRAME_RETURN_COLUMN): New. + * config/alpha/linux.h (MD_FALLBACK_FRAME_STATE_FOR): Use column 64 + for the sigframe return address. + +2003-10-01 Nick Clifton + + * Import this patch from mainline: + + 2003-02-01 John David Anglin + + * collect2.c (pexecute_pid): Rename to pid. + (collect_wait, collect_execute, scan_prog_file, scan_libraries): Use + pid. + +2003-09-23 David S. Miller + + * config/sparc/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Undefine + before redefining. + * config/sparc/linux64.h (LINK_GCC_C_SEQUENCE_SPEC): Likewise. + +2003-10-01 Eric Botcazou + + PR optimization/11753 + * config/sparc/sparc.md (length attribute) [fcc branch]: Add 1 to + the length in the non-V9 case. + +2003-09-27 Eric Botcazou + + PR optimization/12340 + * loop.h (struct induction): Document the new semantics + of the 'same' field for bivs. + * unroll.c (biv_total_increment): Don't count the same + biv increment several times. + (loop_iterations) [GENERAL_INDUCT]: Likewise. + +2003-09-26 John David Anglin + + PR bootstrap/12358 + * pa.c (output_bvb): Fix typo. + +2003-09-24 Alexandre Oliva + + * cpplib.c (do_pragma): Reintroduce cb_line_change call in the + code path that calls a handler. + +2003-09-23 Geoffrey Keating + + * config/t-darwin (crt2.o): Add stmp-int-hdrs to dependencies. + + * config/rs6000/rs6000.c (function_arg_pass_by_reference): Don't + pass zero-size arrays by reference. + (rs6000_va_arg): Likewise. + +2003-09-22 Joel Sherrill + + * combine.c, config/mips/t-elf, config/c4x/rtems.h: Revert patches + which should not have been committed with other RTEMS changes. + +2003-09-22 Olivier Hainque + + PR target/9786 + * reg-stack.c (convert_regs_1): Purge possible dead eh edges + after potential deletion of trapping insn. Avoids later ICE + from call to fixup_abnormal_edges. + (convert_regs_2): Stack the current block successors before + processing this block, that is, before the potential deletion of + dead edges by convert_regs_1, because these edges have been used + to initialize the predecessors count. + +2003-09-21 Eric Botcazou + + PR target/12301 + * reorg.c (stop_search_p): Return 1 for insns that can + throw internally. + +2003-09-19 Joel Sherrill + + * config/m68k/t-m68kbare, config/m68k/t-rtems: Change 68681 to + 68881. + +2003-09-19 Ralf Corsepius + + * config/m68k/t-rtems (m68k-*-rtems*): New. + * config.gcc: Use config/m68k/t-rtems. + +2003-09-19 Ralf Corsepius + + * config/mips/t-rtems: New. + * config.gcc (mips*-*-rtems*): Use config/mips/t-rtems. + +2003-09-19 T. Papadopoulo + Eric Botcazou + + PR target/12166 + * config/sparc/sol2-c1.asm (start): Set __Argv if GCRT1. + +2003-09-18 Mark Mitchell + + PR target/11184 + * builtins.c (expand_builtin_apply): Use convert_memory_address + before returning the value. + +2003-09-17 Rainer Orth + + * configure.in (gcc_cv_as_hidden): Only disable if no GNU ld + detected. + * configure: Regenerate. + Fixes PR target/12248. + +2003-09-17 Richard Henderson + + * config/alpha/alpha.c (alpha_expand_mov): Do gen_movdi_er_maybe_g + always during initial code generation. + * config/alpha/alpha.md (movdi_er_maybe_g): Don't conditionalize + on flag_inline_functions. + +2003-09-17 Eric Botcazou + + PR optimization/11646 + * cfgrtl.c (purge_dead_edges) [JUMP_INSN]: Rematerialize the + EDGE_ABNORMAL flag for EH edges. + * toplev.c (rest_of_compilation): Delete unreachable blocks + if dead edges were purged after the first CSE pass. + +2003-09-16 Jakub Jelinek + + * config/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/alpha/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/arm/linux-elf.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/rs6000/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/rs6000/linux64.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/sh/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/sparc/linux.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + * config/sparc/linux64.h (LINK_GCC_C_SEQUENCE_SPEC): Define. + +2003-09-15 Alexandre Oliva + + * cpplib.c (do_pragma): Remove unnecessary cb_line_change. + +2003-09-14 Alexandre Oliva + + * cppmain.c (cb_line_change): Revert 2003-08-04's change. + * c-lex.c (cb_line_change): Skip line changing whenever + cppmain.c would. + +2003-09-11 Alexandre Oliva + + PR fortran/11522 + * dwarf2out.c (gen_inlined_subroutine_die): Emit abstract function + for ultimate origin even if block is abstract. + +2003-09-10 Martin Husemann + + PR target/11965 + * config/sparc/sparc.c (sparc_v8plus_shift): Protect against + constants greater than 63. + * config/sparc/sparc.md (ashlsi3, ashrsi3, lshrsi3): Protect + against constants greater than 31. + (*ashldi3_sp64, *ashrdi3_sp64, *lshrdi3_sp64): Protect against + constants greater than 63. + +2003-09-09 Richard Henderson + + PR target/12224: + * config/ia64/ia64.c (ia64_expand_move): Properly truncate + result when op0 is SImode. + +2003-09-09 Rainer Orth + + * configure.in (gcc_cv_as_ix86_cmov_sun_syntax): Check if + assembler supports Sun syntax for cmov. + * configure: Regenerate. + * config.in: Li{ewise. + * config/i386/i386.c: Rename CMOV_SUN_AS_SYNTAX to + HAVE_AS_IX86_CMOV_SUN_SYNTAX. + * config/i386/sol2.h (CMOV_SUN_AS_SYNTAX): Remove. + Fixes PR target/12101. + +2003-09-09 Rainer Orth + + * configure.in (gcc_cv_as_hidden): Disable unless using GNU ld. + * configure: Regenerate. + +2003-09-08 Mark Mitchell + + * mklibgcc.in (libcc.a): Depend on stmp-dirs. + (libgov.a): Likewise. + (libgcc_eh.a): Likewise. + +2003-09-07 Eric Botcazou + + PR target/11689 + * config/i386/i386.c (memory_address_length): Fix computation when + the base is esp or ebp. + +2003-09-07 Mark Mitchell + + PR c++/11852 + * varasm.c (initializer_constant_valid_p): Correct logic for + CONSTRUCTORs. + +Sun Sep 7 14:53:36 CEST 2003 Jan Hubicka + + * cfgcleanup.c (try_simplify_condjump): Fix again the preivous patch. + +2003-09-07 Christian Ehrhardt + + PR optimization/11662 + Backport from mainline: + + 2003-07-10 Denis Chertykov + Richard Kenner + + * combine.c (gen_binary): Handle the CLOBBER rtx and + don't build a binary operation with it. + +Sat Sep 6 23:16:35 CEST 2003 Jan Hubicka + + * cfgcleanup.c (try_simplify_condjump): Fix my previous patch. + + PR target/12070 + * calls.c (emit_library_call_value_1): Fix saving of BLKmode arguments. + + PR opt/12082 + * cfgcleanup.c (try_simplify_condjump): Avoid unreachable code warning. + +2003-09-06 Steven Bosscher + + PR c/9862 + * c-decl.c (c_expand_body): Move return warning from here... + (finish_function): ...to here. + +2003-09-05 Jan Hubicka + + PR target/8869 + * expr.c (convert_modes): Deal properly with integer to vector + constant conversion. + +2003-09-05 Andrew Pinski + + PR c/10962 + * c-decl.c (field_decl_cmp): Add back function. + (finish_struct): Sort fields if number greater than 15 + and no anymous structs/unions. + +2003-09-04 Jakub Jelinek + + * config/ia64/libgcc-ia64.ver: Export _Unwind_GetBSP@@GCC_3.3.2. + * config/ia64/unwind-ia64.c (_Unwind_GetBSP): New function. + * unwind.h (_Unwind_GetBSP): New prototype. + * libgcc-std.ver: Add empty GCC_3.3.2 version. + * mkmap-symver.awk: For symbol versions with no exported symbols, + don't put anything into version script, just change all symbol + versions which inherit from it to inherit from its ancestor. + +2003-09-02 Kazuhiro Inaoka + + This is a fix for PR 10988: + * m32r.c (m32r_print_operand): Correct comment. + (m32r_expand_block_move): Correct the handling of leftover/small + blocks. + (m32r_block_small_immediate_operand): New predicate. + * m32r.md (movstrsi_small_internal): New pattern. + * m32r.h (PREDICATE_CODES): Add m32r_block_small_immediate_operand. + * m32r-protos.h: Add prototype for m32r_block_small_immediate_operand. + +2003-08-25 Richard Henderson + + * config/i386.i386.c (ix86_return_in_memory): Reformat. Return true + for 16-byte vector modes if sse not enabled; warn for abi change. + (ix86_value_regno): Only return xmm0 for 16-byte vector types. + +2003-08-25 Zack Weinberg + + * config.gcc (hppa*-*-hpux11*, ia64*-*-hpux*): Remove + commented-out logic to use DCE threads (if present), add + support for POSIX threads. + * config/ia64/hpux.h: Define CPP_SPEC to set appropriate + #defines for -pthread. Add -lpthread to LIB_SPEC when + -pthread. In both cases take -mt as a synonym for -pthread + for acc compatibility. + Define GTHREAD_USE_WEAK to 0. + * config/pa/pa-hpux11.h: Likewise for CPP_SPEC and LIB_SPEC. + Remove old logic for DCE threads from LIB_SPEC. + * config/pa/pa64-hpux.h: Define GTHREAD_USE_WEAK to 0. + +2003-08-25 Ulrich Weigand + + * combine.c (distribute_notes): Handle REG_ALWAYS_RETURN. + +2003-08-23 Jakub Jelinek + + * c-decl.c (pushdecl): Only put decls which finish_struct will do + something about onto incomplete chain. + (finish_struct): If not removing type from incomplete + list, update prev. + +2003-08-23 Alexandre Oliva + + * cppmain.c (cb_line_change): Don't skip line changing while + parsing macro arguments in the top-level context. + +2003-08-22 Mark Mitchell + + * config/ia64/hpux.h (SUPPORTS_INIT_PRIORITY): Define to 0. + + * config/ia64/ia64.c (ia64_output_mi_thunk): Support ILP32 mode. + +2003-08-21 Kazu Hirata + + PR target/11805 + * config/h8300/h8300.md (two anonymous patterns): Remove. + +2003-08-20 Kaveh R. Ghazi + + * stmt.c (expand_asm_operands): Avoid string concatenation. + * tree.c (default_flag_random_seed): Avoid ISO C definition. + * varasm.c (output_constant_def): Delete unused variable. + +2003-08-18 Matt Kraai + + PR c/11207 + * c-typeck.c (set_init_index): Check for negative index. + +2003-08-14 Mark Mitchell + + * version.c (version_string): Use "prerelease" not "experimental". + +2003-08-11 James E Wilson + + PR optimization/11319 + PR target/10021 + * alias.c (find_base_value, case REG): Return 0 not src if no base + found. + +2003-08-11 Kean Johnston + + * fixinc/inclhack.def (sco_math): Updated test text and select trigger + according to bkorb's review. + * fixinc/inclhack.def (sco_regset): Ditto. + * fixinc/inclhack.def (AAB_svr4_replace_byteorder): Remove all mach + lines so that this file is unconditionally replaced. + * fixinc/inclhack.def (sco_string): Use ansi/string.h as the first file + to check so that the Ultrix string.h check doesnt overwrite the test + case with its replacement text. + * fixinc/fixincl.x: Regenerated + * fixinc/tests/base/math.h: Updated sco_math result text + * fixinc/tests/base/ansi/string.h: New file. + * fixinc/tests/base/sys/regset.h: Compacted result text to fewer lines. + +2003-08-11 Dale Johannesen + * config/rs6000/rs6000.md (ctrsi, ctrdi): Reenable handling of + decrement-and-branch farther away than 32 bits. + +2003-08-10 Zack Weinberg + + Backport the following changes from mainline: + + 2003-05-08 David Mosberger + + * unwind-libunwind.c (_Unwind_FindEnclosingFunction): New. + + 2003-04-03 Richard Henderson + + * unwind-libunwind.c (_Unwind_GetCFA): New. + + 2003-03-27 David Mosberger + + * unwind-libunwind.c (uw_frame_state_for): Adjust for libunwind + v0.9 API change: replace read of UNW_REG_HANDLER with + unw_get_proc_info(). + (_Unwind_GetLanguageSpecificData): Replace read of UNW_REG_LSDA + with unw_get_proc_info(). + (_Unwind_GetRegionStart): Replace UNW_REG_PROC_START with + unw_get_proc_info(). + + 2003-03-13 Nathanael Nerode + + * unwind-libunwind.c: Replace "GNU CC" with "GCC". + + 2002-10-02 David Mosberger-Tang + + * config/t-libunwind: Mention unwind-sjlj.c. + * unwind-libunwind.c: Change #ifdef __USING_LIBUNWIND_EXCEPTIONS__ + to #ifndef __USING_SJLJ_EXCEPTIONS__. + + * configure.in: Move sjlj-exceptions and --enable-libunwind-exceptions + before inclusion of config.gcc, but after configuring the compiler etc. + Determine default value for --enable-libunwind-exceptions based on + whether the host has a libunwind library (not guaranteed to be correct, + but it's a reasonable first guess and can always be overridden with an + explicit --enable/disable-libunwind-exceptions. + * config.gcc: For target ia64*-*-linux*, mention t-libunwind as a + tmake_file when $use_libunwind_exceptions is enabled. + * Makefile.in: Update comment: LIB2ADDEH is updated not just by + ia64 (e.g., config/t-linux also updates it). + * gcc.c (init_spec) [USE_LIBUNWIND_EXCEPTIONS]: Mention -lunwind + along with the shared version of libgcc since the latter requires + the former. + + * unwind-libunwind.c: New file. + * config/t-libunwind: Ditto. + +2003-08-10 Richard Henderson + + PR target/11693 + * config/ia64/ia64.c (ia64_emit_nops): Skip L slots when + padding before inline assembly. + +2003-08-10 John David Anglin + + PR c++/11712 + * pa-hpux.h, pa-hpux10.h, pa-hpux11.h (TARGET_OS_CPP_BUILTINS): Define + __STDC_EXT__ when using C++ dialect. + +2003-08-08 Kean Johnston + + PR target/9877 + PR target/8336 + * config.gcc (sco3.2v5*): Use elfos.h and dbxelf.h in tm_file; + Eliminate need for t-sco5gas target fragment. + No longer build crt{begin,end}S.o, that were used for COFF support. + * tlink.c (recompile_files): Add missing = in putenv() calls. + * unwind-dw2.c (_Unwind_GetCFA): Correct return cast. + * config/i386/sco5.h: Major overhaul to remove all COFF support + * config/i386/t-sco5: Multilib for PIC support + * config/i386/t-sco5gas: Remove + * config/i386/i386.c: Check value as well as presence of + SUPPORTS_ONE_ONLY + * doc/install.texi: Update for modern SCO instructions + * fixinc/check.tpl: Allow user to specify diff program for make check + * fixinc/inclhack.def: Fix several SCO header files, namely string.h, + math.h, sys/byteorder.h and sys/regset.h. + * fixinc/fixincl.x: Regenerate + * fixinc/tests/base/math.h: Update + * fixinc/tests/base/sys/byteorder.h: Update + * fixinc/tests/base/string.h: Added + * fixinc/tests/base/sys/regset.h: Added + * testsuite/gcc.dg/nest.c: Allow failure on SCO (-pg not supported) + +2003-08-08 Roger Sayle + + PR c/11370 + * calls.c (emit_call_1): Don't bother popping the arguments off of + the stack after a noreturn function call; The adjustment is dead. + (expand_call): Likewise. + +2003-08-08 SUGIOKA Toshinobu + + * config.gcc: Do not override sh/t-linux with sh/t-le. + +2003-08-08 Kaz Kojima + + * config/sh/linux.h (SUBTARGET_LINK_SPEC): Don't set rpath. + (LIB_SPEC): Set -lpthread always when -pthread set. Set -lieee + when -mieee-fp set and -shared not set. + +2003-08-08 Richard Henderson + + PR target/11535 + * config/ia64/ia64.c (ia64_initial_elimination_offset): Remove + RETURN_ADDRESS_POINTER_REGNUM. + (ia64_expand_prologue): Don't frob it. + (ia64_output_function_epilogue): Likewise. + (ia64_return_addr_rtx): New. + (ia64_split_return_addr_rtx): New. + * config/ia64/ia64-protos.h: Update. + * config/ia64/ia64.h (FIRST_PSEUDO_REGISTER): Decrement. + (RETURN_ADDRESS_POINTER_REGNUM): Remove. + (GENERAL_REGNO_P): Don't check it. + (AR_*_REGNUM): Renumber. + (FIXED_REGISTERS): Remove RETURN_ADDRESS_POINTER_REGNUM. + (CALL_USED_REGISTERS, CALL_REALLY_USED_REGISTERS): Likewise. + (REG_ALLOC_ORDER, REG_CLASS_CONTENTS): Likewise. + (ELIMINABLE_REGS, REGISTER_NAMES): Likewise. + (RETURN_ADDR_RTX): Use ia64_return_addr_rtx. + * config/ia64/ia64.md (UNSPEC_RET_ADDR): New. + (movdi_ret_addr): New. + +2003-08-03 Geoffrey Keating + + PR 11709 + * varasm.c (output_constant_def_contents): Use + ASM_DECLARE_CONSTANT_NAME if defined. + * doc/tm.texi (Label Output): Document ASM_DECLARE_CONSTANT_NAME. + * config/darwin.h (ASM_DECLARE_OBJECT_NAME): Ensure zero-sized + objects get at least one byte to prevent assembler problems. + (ASM_DECLARE_CONSTANT_NAME): New. + +2003-08-07 Mark Mitchell + + * version.c (version_string): Reset to prerelease. + * doc/include/gcc-common.texi: Update version. + 2003-08-04 Release Manager * GCC 3.3.1 Released. @@ -8,23 +825,23 @@ 2003-08-03 Neil Booth - PR preprocessor/11534 - * cppexp.c (parse_defined): Warn only if -pedantic. + PR preprocessor/11534 + * cppexp.c (parse_defined): Warn only if -pedantic. 2003-08-03 Mark Mitchell * Makefile.in (ORDINARY_FLAGS_TO_PASS): Pass AR. - + * Makefile.in (STAGE2_FLAGS_TO_PASS): Pass AR_FOR_TARGET and RANLIB_FOR_TARGET. (stage1_build): Likewise. 2003-08-03 Jan Hubicka - PR 10510 - * config/pa/pa.h (MAYBE_FP_REG_CLASS_P): New. - (SECONDARY_MEMORY_NEEDED): Use it. - + PR 10510 + * config/pa/pa.h (MAYBE_FP_REG_CLASS_P): New. + (SECONDARY_MEMORY_NEEDED): Use it. + 2003-08-01 Geoffrey Keating PR 11709 (partial fix) @@ -40,18 +857,18 @@ PR target/10681 2003-06-27 J"orn Rennecke - * flow.c (propagate_one_insn): Use proper test for a register - being part of the return value. + * flow.c (propagate_one_insn): Use proper test for a register + being part of the return value. 2003-06-26 Richard Henderson - * flow.c (propagate_one_insn): Preserve live-at-end registers - across tail calls. + * flow.c (propagate_one_insn): Preserve live-at-end registers + across tail calls. 2003-06-26 Richard Henderson - * config/ia64/ia64.c (ia64_expand_call): Don't add ar.pfs for sibcalls. - (ia64_split_call): Only load descriptor for GP register inputs. - (ia64_expand_epilogue): Check current_frame_info.mask not - current_function_is_leaf to restore ar.pfs. + * config/ia64/ia64.c (ia64_expand_call): Don't add ar.pfs for sibcalls. + (ia64_split_call): Only load descriptor for GP register inputs. + (ia64_expand_epilogue): Check current_frame_info.mask not + current_function_is_leaf to restore ar.pfs. 2003-07-26 Gerald Pfeifer @@ -62,15 +879,15 @@ Backport the folling patch. 2003-04-01 Aldy Hernandez - - PR/8878 - * expr.c (expand_expr): Handle VECTOR_CST. - (const_vector_from_tree): New. - - * varasm.c (output_constant): Handle VECTOR_CST. - - * c-typeck.c (digest_init): Build a vector constant from a - VECTOR_TYPE. + + PR/8878 + * expr.c (expand_expr): Handle VECTOR_CST. + (const_vector_from_tree): New. + + * varasm.c (output_constant): Handle VECTOR_CST. + + * c-typeck.c (digest_init): Build a vector constant from a + VECTOR_TYPE. 2003-07-23 John David Anglin @@ -81,11 +898,11 @@ PR optimization/10679 * tree-inline.c (inlinable_function_p): Honor MIN_INLINE_INSNS. - + 2003-07-22 Bob Wilson - + * unwind-c.c (PERSONALITY_FUNCTION): Delete duplicate define. - + 2003-07-23 Dave Fluri * doc/extend.texi: Fixes to spelling, grammar, and diction. @@ -97,15 +914,11 @@ 2003-07-17 Eric Botcazou - PR optimization/11536 + PR optimization/11536 * unroll.c (loop_iterations): Do not replace a register holding the final value by its equivalent before the loop if it is not invariant. -2003-07-17 Eric Botcazou - - * gcc.c-torture/execute/loop-16.c: New test. - 2003-07-21 Ben Elliston * doc/invoke.texi (V850 Options): Spelling fixes. @@ -152,7 +965,7 @@ if the predicate doesn't satisfy. (gen_cond_trap): Allow prepare_operand to fail. Pass correct opnum argument to prepare_operand. - + 2003-07-18 Eric Botcazou PR optimization/11083 @@ -168,7 +981,7 @@ 2003-07-17 Nathanael Nerode PR bootstrap/11043 - * config/arc/t-arc: Replace bogus references to "x-crtinit.o", + * config/arc/t-arc: Replace bogus references to "x-crtinit.o", "x-crtfini.o" with "crtinit.o", "crtfini.o". 2003-07-17 Eric Botcazou @@ -183,7 +996,7 @@ * doc/invoke.texi (SPARC Options): Document "-mimpure-text". 2003-07-17 Eric Botcazou - Phil Edwards + Phil Edwards * doc/install.texi (*-*-solaris2*): Document the step-by-step procedure to bootstrap and install. @@ -193,9 +1006,9 @@ 2003-07-16 Richard Henderson PR target/10907 - * config/ia64/ia64.c (ia64_epilogue_uses): GP is live at end - even with !TARGET_CONST_GP. - (ia64_function_ok_for_sibcall): Reject non-local functions. + * config/ia64/ia64.c (ia64_epilogue_uses): GP is live at end + even with !TARGET_CONST_GP. + (ia64_function_ok_for_sibcall): Reject non-local functions. 2003-07-15 Geoffrey Keating @@ -297,7 +1110,7 @@ * c-decl.c (duplicate_decls): Re-invoke make_decl_rtl if the old decl had instantiated DECL_RTL. - 2003-05-21 Danny Smith + 2003-05-21 Danny Smith PR c++/9738 * config/i386/winnt.c (i386_pe_encode_section_info): Enable @@ -329,7 +1142,7 @@ * loop.c (loop_iv_add_mult_emit_before): Call loop_regs_update before loop_insn_emit_before. (loop_iv_add_mult_sink, loop_iv_add_mult_hoist): Likewise. - + 2003-07-10 Dara Hazeghi PR bootstrap/10758 @@ -385,8 +1198,8 @@ 2003-07-07 Dale Johannesen - PR 10900 - * config/rs6000/darwin-tramp.asm: Fix trampolines. + PR 10900 + * config/rs6000/darwin-tramp.asm: Fix trampolines. 2003-07-07 Andrew Pinski @@ -400,7 +1213,7 @@ (-falign-jumps): Likewise. 2003-07-07 Richard Kenner - Eric Botcazou + Eric Botcazou PR optimization/11198 * alias.c (objects_must_conflict_p): Return 1 if the types have @@ -1567,7 +2380,7 @@ Sun Apr 20 18:23:18 CEST 2003 Richard Henderson 2003-04-21 Mark Mitchell - * config/i386/winnt.c (i386_pe_mark_dllimport): Make the new RTL + * config/i386/winnt.c (i386_pe_}ark_dllimport): Make the new RTL have the same form as the old RTL. 2003-04-18 Mark Mitchell @@ -4172,7 +4985,7 @@ Mon Apr 7 15:56:30 CEST 2003 Jan Hubicka * df.c (df_uses_record): Handle CC0. 2003-01-25 Jan Hubicka - Eric Botcazou + Eric Botcazou PR opt/8492 * gcse.c (one_cprop_pass): Delete unreachable blocks. @@ -4445,7 +5258,7 @@ Mon Apr 7 15:56:30 CEST 2003 Jan Hubicka 2003-01-16 Stephane Carrez - * config/m68hc11/m68hc11.c (expand_prologue): Use push/pop to + * config/m68hs11/m68hc11.c (expand_prologue): Use push/pop to allocate 4-bytes of locals on 68HC11. (expand_epilogue): Likewise. (m68hc11_memory_move_cost): Increase cost of HI/QI soft registers. @@ -16996,3 +17809,4 @@ cp: * mips.h (FUNCTION_ARG_REGNO_P): Fix parentheses. See ChangeLog.7 for earlier changes. + diff --git a/contrib/gcc/Makefile.in b/contrib/gcc/Makefile.in index 40e90c2e00d1..67076d30c76a 100644 --- a/contrib/gcc/Makefile.in +++ b/contrib/gcc/Makefile.in @@ -401,7 +401,7 @@ CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ -finhibit-size-directive -fno-inline-functions -fno-exceptions \ -fno-zero-initialized-in-bss -# Additional sources to handle exceptions; overridden on ia64. +# Additional sources to handle exceptions; overridden by targets as needed. LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h diff --git a/contrib/gcc/aclocal.m4 b/contrib/gcc/aclocal.m4 index b634e06d384e..93eed5c2495e 100644 --- a/contrib/gcc/aclocal.m4 +++ b/contrib/gcc/aclocal.m4 @@ -431,7 +431,7 @@ else # Systems known to be in this category are Windows (all variants), # VMS, and Darwin. case "$host_os" in - vms* | cygwin* | pe | mingw* | darwin*) + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) gcc_cv_func_mmap_dev_zero=no ;; *) gcc_cv_func_mmap_dev_zero=yes;; diff --git a/contrib/gcc/alias.c b/contrib/gcc/alias.c index 4fa4f5c46940..dd8426964026 100644 --- a/contrib/gcc/alias.c +++ b/contrib/gcc/alias.c @@ -796,7 +796,7 @@ find_base_value (src) return reg_base_value[regno]; } - return src; + return 0; case MEM: /* Check for an argument passed in memory. Only record in the diff --git a/contrib/gcc/builtins.c b/contrib/gcc/builtins.c index 4c5650a88f31..d0882740e385 100644 --- a/contrib/gcc/builtins.c +++ b/contrib/gcc/builtins.c @@ -1344,7 +1344,12 @@ expand_builtin_apply (function, arguments, argsize) OK_DEFER_POP; /* Return the address of the result block. */ - return copy_addr_to_reg (XEXP (result, 0)); + result = copy_addr_to_reg (XEXP (result, 0)); +#ifdef POINTERS_EXTEND_UNSIGNED + if (GET_MODE (result) != ptr_mode) + result = convert_memory_address (ptr_mode, result); +#endif + return result; } /* Perform an untyped return. */ @@ -2348,7 +2353,7 @@ expand_builtin_bzero (exp) return result; } -/* Expand expression EXP, which is a call to the memcmp or the strcmp builtin. +/* Expand expression EXP, which is a call to the memcmp built-in function. ARGLIST is the argument list for this call. Return 0 if we failed and the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE, if that's convenient). */ @@ -2485,7 +2490,7 @@ expand_builtin_strcmp (exp, target, mode) enum machine_mode mode; { tree arglist = TREE_OPERAND (exp, 1); - tree arg1, arg2, len, len2, fn; + tree arg1, arg2; const char *p1, *p2; if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) @@ -2521,51 +2526,89 @@ expand_builtin_strcmp (exp, target, mode) return expand_expr (result, target, mode, EXPAND_NORMAL); } - len = c_strlen (arg1); - len2 = c_strlen (arg2); - - if (len) - len = size_binop (PLUS_EXPR, ssize_int (1), len); +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) + { + tree len, len1, len2; + rtx arg1_rtx, arg2_rtx, arg3_rtx; + rtx result, insn; + + int arg1_align + = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + int arg2_align + = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + enum machine_mode insn_mode + = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + + len1 = c_strlen (arg1); + len2 = c_strlen (arg2); + + if (len1) + len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); + if (len2) + len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); + + /* If we don't have a constant length for the first, use the length + of the second, if we know it. We don't require a constant for + this case; some cost analysis could be done if both are available + but neither is constant. For now, assume they're equally cheap + unless one has side effects. If both strings have constant lengths, + use the smaller. */ + + if (!len1) + len = len2; + else if (!len2) + len = len1; + else if (TREE_SIDE_EFFECTS (len1)) + len = len2; + else if (TREE_SIDE_EFFECTS (len2)) + len = len1; + else if (TREE_CODE (len1) != INTEGER_CST) + len = len2; + else if (TREE_CODE (len2) != INTEGER_CST) + len = len1; + else if (tree_int_cst_lt (len1, len2)) + len = len1; + else + len = len2; - if (len2) - len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); + /* If both arguments have side effects, we cannot optimize. */ + if (!len || TREE_SIDE_EFFECTS (len)) + return 0; - /* If we don't have a constant length for the first, use the length - of the second, if we know it. We don't require a constant for - this case; some cost analysis could be done if both are available - but neither is constant. For now, assume they're equally cheap - unless one has side effects. + /* If we don't have POINTER_TYPE, call the function. */ + if (arg1_align == 0 || arg2_align == 0) + return 0; - If both strings have constant lengths, use the smaller. This - could arise if optimization results in strcpy being called with - two fixed strings, or if the code was machine-generated. We should - add some code to the `memcmp' handler below to deal with such - situations, someday. */ + /* Make a place to write the result of the instruction. */ + result = target; + if (! (result != 0 + && GET_CODE (result) == REG + && GET_MODE (result) == insn_mode + && REGNO (result) >= FIRST_PSEUDO_REGISTER)) + result = gen_reg_rtx (insn_mode); - if (!len || TREE_CODE (len) != INTEGER_CST) - { - if (len2 && !TREE_SIDE_EFFECTS (len2)) - len = len2; - else if (len == 0) + arg1_rtx = get_memory_rtx (arg1); + arg2_rtx = get_memory_rtx (arg2); + arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); + insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); + if (!insn) return 0; - } - else if (len2 && TREE_CODE (len2) == INTEGER_CST - && tree_int_cst_lt (len2, len)) - len = len2; - /* If both arguments have side effects, we cannot optimize. */ - if (TREE_SIDE_EFFECTS (len)) - return 0; - - fn = built_in_decls[BUILT_IN_MEMCMP]; - if (!fn) - return 0; + emit_insn (insn); - arglist = build_tree_list (NULL_TREE, len); - arglist = tree_cons (NULL_TREE, arg2, arglist); - arglist = tree_cons (NULL_TREE, arg1, arglist); - return expand_expr (build_function_call_expr (fn, arglist), - target, mode, EXPAND_NORMAL); + /* Return the value in the proper mode for this function. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + if (GET_MODE (result) == mode) + return result; + if (target == 0) + return convert_to_mode (mode, result, 0); + convert_move (target, result, 0); + return target; + } +#endif + return 0; } /* Expand expression EXP, which is a call to the strncmp builtin. Return 0 @@ -2579,7 +2622,6 @@ expand_builtin_strncmp (exp, target, mode) enum machine_mode mode; { tree arglist = TREE_OPERAND (exp, 1); - tree fn, newarglist, len = 0; tree arg1, arg2, arg3; const char *p1, *p2; @@ -2633,41 +2675,94 @@ expand_builtin_strncmp (exp, target, mode) } /* If c_strlen can determine an expression for one of the string - lengths, and it doesn't have side effects, then call - expand_builtin_memcmp() using length MIN(strlen(string)+1, arg3). */ - - /* Perhaps one of the strings is really constant, if so prefer - that constant length over the other string's length. */ - if (p1) - len = c_strlen (arg1); - else if (p2) - len = c_strlen (arg2); - - /* If we still don't have a len, try either string arg as long - as they don't have side effects. */ - if (!len && !TREE_SIDE_EFFECTS (arg1)) - len = c_strlen (arg1); - if (!len && !TREE_SIDE_EFFECTS (arg2)) - len = c_strlen (arg2); - /* If we still don't have a length, punt. */ - if (!len) - return 0; + lengths, and it doesn't have side effects, then emit cmpstrsi + using length MIN(strlen(string)+1, arg3). */ +#ifdef HAVE_cmpstrsi + if (HAVE_cmpstrsi) + { + tree len, len1, len2; + rtx arg1_rtx, arg2_rtx, arg3_rtx; + rtx result, insn; + + int arg1_align + = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + int arg2_align + = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; + enum machine_mode insn_mode + = insn_data[(int) CODE_FOR_cmpstrsi].operand[0].mode; + + len1 = c_strlen (arg1); + len2 = c_strlen (arg2); + + if (len1) + len1 = size_binop (PLUS_EXPR, ssize_int (1), len1); + if (len2) + len2 = size_binop (PLUS_EXPR, ssize_int (1), len2); + + /* If we don't have a constant length for the first, use the length + of the second, if we know it. We don't require a constant for + this case; some cost analysis could be done if both are available + but neither is constant. For now, assume they're equally cheap, + unless one has side effects. If both strings have constant lengths, + use the smaller. */ + + if (!len1) + len = len2; + else if (!len2) + len = len1; + else if (TREE_SIDE_EFFECTS (len1)) + len = len2; + else if (TREE_SIDE_EFFECTS (len2)) + len = len1; + else if (TREE_CODE (len1) != INTEGER_CST) + len = len2; + else if (TREE_CODE (len2) != INTEGER_CST) + len = len1; + else if (tree_int_cst_lt (len1, len2)) + len = len1; + else + len = len2; - fn = built_in_decls[BUILT_IN_MEMCMP]; - if (!fn) - return 0; + /* If both arguments have side effects, we cannot optimize. */ + if (!len || TREE_SIDE_EFFECTS (len)) + return 0; - /* Add one to the string length. */ - len = fold (size_binop (PLUS_EXPR, len, ssize_int (1))); + /* The actual new length parameter is MIN(len,arg3). */ + len = fold (build (MIN_EXPR, TREE_TYPE (len), len, arg3)); - /* The actual new length parameter is MIN(len,arg3). */ - len = fold (build (MIN_EXPR, TREE_TYPE (len), len, arg3)); + /* If we don't have POINTER_TYPE, call the function. */ + if (arg1_align == 0 || arg2_align == 0) + return 0; - newarglist = build_tree_list (NULL_TREE, len); - newarglist = tree_cons (NULL_TREE, arg2, newarglist); - newarglist = tree_cons (NULL_TREE, arg1, newarglist); - return expand_expr (build_function_call_expr (fn, newarglist), - target, mode, EXPAND_NORMAL); + /* Make a place to write the result of the instruction. */ + result = target; + if (! (result != 0 + && GET_CODE (result) == REG + && GET_MODE (result) == insn_mode + && REGNO (result) >= FIRST_PSEUDO_REGISTER)) + result = gen_reg_rtx (insn_mode); + + arg1_rtx = get_memory_rtx (arg1); + arg2_rtx = get_memory_rtx (arg2); + arg3_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0); + insn = gen_cmpstrsi (result, arg1_rtx, arg2_rtx, arg3_rtx, + GEN_INT (MIN (arg1_align, arg2_align))); + if (!insn) + return 0; + + emit_insn (insn); + + /* Return the value in the proper mode for this function. */ + mode = TYPE_MODE (TREE_TYPE (exp)); + if (GET_MODE (result) == mode) + return result; + if (target == 0) + return convert_to_mode (mode, result, 0); + convert_move (target, result, 0); + return target; + } +#endif + return 0; } /* Expand expression EXP, which is a call to the strcat builtin. diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c index 8896c6c48fae..5cb5270084df 100644 --- a/contrib/gcc/c-decl.c +++ b/contrib/gcc/c-decl.c @@ -285,6 +285,7 @@ static tree c_make_fname_decl PARAMS ((tree, int)); static void c_expand_body PARAMS ((tree, int, int)); static void warn_if_shadowing PARAMS ((tree, tree)); static bool flexible_array_type_p PARAMS ((tree)); +static int field_decl_cmp PARAMS ((const PTR, const PTR)); static tree set_save_expr_context PARAMS ((tree *, int *, void *)); /* States indicating how grokdeclarator() should handle declspecs marked @@ -2011,8 +2012,10 @@ pushdecl (x) while (TREE_CODE (element) == ARRAY_TYPE) element = TREE_TYPE (element); - if (TREE_CODE (element) == RECORD_TYPE - || TREE_CODE (element) == UNION_TYPE) + if ((TREE_CODE (element) == RECORD_TYPE + || TREE_CODE (element) == UNION_TYPE) + && (TREE_CODE (x) != TYPE_DECL + || TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE)) b->incomplete_list = tree_cons (NULL_TREE, x, b->incomplete_list); } } @@ -5113,6 +5116,28 @@ grokfield (filename, line, declarator, declspecs, width) objc_check_decl (value); return value; } + +/* Function to help qsort sort FIELD_DECLs by name order. */ + + +static int +field_decl_cmp (xp, yp) + const PTR xp; + const PTR yp; +{ + tree *x = (tree *)xp, *y = (tree *)yp; + + if (DECL_NAME (*x) == DECL_NAME (*y)) + return 0; + if (DECL_NAME (*x) == NULL) + return -1; + if (DECL_NAME (*y) == NULL) + return 1; + if (DECL_NAME (*x) < DECL_NAME (*y)) + return -1; + return 1; +} + /* Fill in the fields of a RECORD_TYPE or UNION_TYPE node, T. FIELDLIST is a chain of FIELD_DECL nodes for the fields. @@ -5358,6 +5383,53 @@ finish_struct (t, fieldlist, attributes) TYPE_FIELDS (t) = fieldlist; + /* If there are lots of fields, sort so we can look through them fast. + We arbitrarily consider 16 or more elts to be "a lot". */ + + { + int len = 0; + + for (x = fieldlist; x; x = TREE_CHAIN (x)) + { + if (len > 15 || DECL_NAME (x) == NULL) + break; + len += 1; + } + + if (len > 15) + { + tree *field_array; + char *space; + + len += list_length (x); + + /* Use the same allocation policy here that make_node uses, to + ensure that this lives as long as the rest of the struct decl. + All decls in an inline function need to be saved. */ + + space = ggc_alloc (sizeof (struct lang_type) + len * sizeof (tree)); + + len = 0; + field_array = &(((struct lang_type *) space)->elts[0]); + for (x = fieldlist; x; x = TREE_CHAIN (x)) + { + field_array[len++] = x; + + /* if there is anonymous struct or unoin break out of the loop */ + if (DECL_NAME (x) == NULL) + break; + } + /* found no anonymous struct/union add the TYPE_LANG_SPECIFIC. */ + if (x == NULL) + { + TYPE_LANG_SPECIFIC (t) = (struct lang_type *) space; + TYPE_LANG_SPECIFIC (t)->len = len; + field_array = &TYPE_LANG_SPECIFIC (t)->elts[0]; + qsort (field_array, len, sizeof (tree), field_decl_cmp); + } + } + } + for (x = TYPE_MAIN_VARIANT (t); x; x = TYPE_NEXT_VARIANT (x)) { TYPE_FIELDS (x) = TYPE_FIELDS (t); @@ -5391,7 +5463,8 @@ finish_struct (t, fieldlist, attributes) && TREE_CODE (decl) != TYPE_DECL) { layout_decl (decl, 0); - /* This is a no-op in c-lang.c or something real in objc-act.c. */ + /* This is a no-op in c-lang.c or something real in + objc-act.c. */ if (flag_objc) objc_check_decl (decl); rest_of_decl_compilation (decl, NULL, toplevel, 0); @@ -5427,7 +5500,11 @@ finish_struct (t, fieldlist, attributes) else current_binding_level->incomplete_list = TREE_CHAIN (x); } + else + prev = x; } + else + prev = x; } } @@ -6440,6 +6517,13 @@ finish_function (nested, can_defer_p) && DECL_INLINE (fndecl)) warning ("no return statement in function returning non-void"); + /* With just -W, complain only if function returns both with + and without a value. */ + if (extra_warnings + && current_function_returns_value + && current_function_returns_null) + warning ("this function may return with or without a value"); + /* Clear out memory we no longer need. */ free_after_parsing (cfun); /* Since we never call rest_of_compilation, we never clear @@ -6624,13 +6708,6 @@ c_expand_body (fndecl, nested_p, can_defer_p) if (nested_p) ggc_pop_context (); - /* With just -W, complain only if function returns both with - and without a value. */ - if (extra_warnings - && current_function_returns_value - && current_function_returns_null) - warning ("this function may return with or without a value"); - /* If requested, warn about function definitions where the function will return a value (usually of some struct or union type) which itself will take up a lot of stack space. */ diff --git a/contrib/gcc/c-lex.c b/contrib/gcc/c-lex.c index a4dcbafb601e..c852e311cb99 100644 --- a/contrib/gcc/c-lex.c +++ b/contrib/gcc/c-lex.c @@ -245,8 +245,11 @@ static void cb_line_change (pfile, token, parsing_args) cpp_reader *pfile ATTRIBUTE_UNUSED; const cpp_token *token; - int parsing_args ATTRIBUTE_UNUSED; + int parsing_args; { + if (token->type == CPP_EOF || parsing_args) + return; + src_lineno = SOURCE_LINE (map, token->line); } @@ -297,7 +300,7 @@ cb_file_change (pfile, new_map) } update_header_times (new_map->to_file); - in_system_header = (warn_system_headers && new_map->sysp != 0); + in_system_header = new_map->sysp != 0; input_filename = new_map->to_file; lineno = to_line; map = new_map; diff --git a/contrib/gcc/c-objc-common.c b/contrib/gcc/c-objc-common.c index 9f3847c3d69a..db3e7584a5fa 100644 --- a/contrib/gcc/c-objc-common.c +++ b/contrib/gcc/c-objc-common.c @@ -94,6 +94,8 @@ inline_forbidden_p (nodep, walk_subtrees, fn) arguments. */ case BUILT_IN_VA_START: case BUILT_IN_STDARG_START: + case BUILT_IN_NEXT_ARG: + case BUILT_IN_VA_END: #if 0 /* Functions that need information about the address of the caller can't (shouldn't?) be inlined. */ diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c index 5bf72feed02b..40dc44de5107 100644 --- a/contrib/gcc/c-typeck.c +++ b/contrib/gcc/c-typeck.c @@ -4247,6 +4247,11 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum) errtype, funname, parmnum); return convert (type, rhs); } + else if (codel == POINTER_TYPE && coder == ARRAY_TYPE) + { + error ("invalid use of non-lvalue array"); + return error_mark_node; + } else if (codel == POINTER_TYPE && coder == INTEGER_TYPE) { /* An explicit constant 0 can convert to a pointer, @@ -4765,8 +4770,14 @@ digest_init (type, init, require_constant) if (code == VECTOR_TYPE && comptypes (TREE_TYPE (inside_init), type) && TREE_CONSTANT (inside_init)) - return build_vector (type, TREE_OPERAND (inside_init, 1)); - + { + if (TREE_CODE (inside_init) == VECTOR_CST + && comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (inside_init)), + TYPE_MAIN_VARIANT (type))) + return inside_init; + else + return build_vector (type, CONSTRUCTOR_ELTS (inside_init)); + } /* Any type can be initialized from an expression of the same type, optionally with braces. */ @@ -4785,8 +4796,16 @@ digest_init (type, init, require_constant) TREE_TYPE (type))))) { if (code == POINTER_TYPE) - inside_init = default_function_array_conversion (inside_init); + { + inside_init = default_function_array_conversion (inside_init); + if (TREE_CODE (TREE_TYPE (inside_init)) == ARRAY_TYPE) + { + error_init ("invalid use of non-lvalue array"); + return error_mark_node; + } + } + if (require_constant && !flag_isoc99 && TREE_CODE (inside_init) == COMPOUND_LITERAL_EXPR) { @@ -5742,6 +5761,8 @@ set_init_index (first, last) error_init ("nonconstant array index in initializer"); else if (TREE_CODE (constructor_type) != ARRAY_TYPE) error_init ("array index in non-array initializer"); + else if (tree_int_cst_sgn (first) == -1) + error_init ("array index in initializer exceeds array bounds"); else if (constructor_max_index && tree_int_cst_lt (constructor_max_index, first)) error_init ("array index in initializer exceeds array bounds"); diff --git a/contrib/gcc/calls.c b/contrib/gcc/calls.c index 471f5bdf50d7..675674ec7f55 100644 --- a/contrib/gcc/calls.c +++ b/contrib/gcc/calls.c @@ -641,6 +641,10 @@ emit_call_1 (funexp, fndecl, funtype, stack_size, rounded_stack_size, if the context of the call as a whole permits. */ inhibit_defer_pop = old_inhibit_defer_pop; + /* Don't bother cleaning up after a noreturn function. */ + if (ecf_flags & (ECF_NORETURN | ECF_LONGJMP)) + return; + if (n_popped > 0) { if (!already_popped) @@ -3101,6 +3105,7 @@ expand_call (exp, target, ignore) /* Verify that we've deallocated all the stack we used. */ if (pass + && ! (flags & (ECF_NORETURN | ECF_LONGJMP)) && old_stack_allocated != stack_pointer_delta - pending_stack_adjust) abort (); @@ -3194,6 +3199,10 @@ expand_call (exp, target, ignore) } emit_barrier_after (last); + + /* Stack adjustments after a noreturn call are dead code. */ + stack_pointer_delta = old_stack_allocated; + pending_stack_adjust = 0; } if (flags & ECF_LONGJMP) @@ -4017,9 +4026,23 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) (save_mode, plus_constant (argblock, argvec[argnum].offset.constant))); - argvec[argnum].save_area = gen_reg_rtx (save_mode); + if (save_mode == BLKmode) + { + argvec[argnum].save_area + = assign_stack_temp (BLKmode, + argvec[argnum].size.constant, 0); + + emit_block_move (validize_mem (argvec[argnum].save_area), + stack_area, + GEN_INT (argvec[argnum].size.constant), + BLOCK_OP_CALL_PARM); + } + else + { + argvec[argnum].save_area = gen_reg_rtx (save_mode); - emit_move_insn (argvec[argnum].save_area, stack_area); + emit_move_insn (argvec[argnum].save_area, stack_area); + } } } @@ -4259,7 +4282,13 @@ emit_library_call_value_1 (retval, orgfun, value, fn_type, outmode, nargs, p) plus_constant (argblock, argvec[count].offset.constant))); - emit_move_insn (stack_area, argvec[count].save_area); + if (save_mode == BLKmode) + emit_block_move (stack_area, + validize_mem (argvec[count].save_area), + GEN_INT (argvec[count].size.constant), + BLOCK_OP_CALL_PARM); + else + emit_move_insn (stack_area, argvec[count].save_area); } highest_outgoing_arg_in_use = initial_highest_arg_in_use; diff --git a/contrib/gcc/cfgcleanup.c b/contrib/gcc/cfgcleanup.c index 008c8da9e577..df914ec0cf27 100644 --- a/contrib/gcc/cfgcleanup.c +++ b/contrib/gcc/cfgcleanup.c @@ -125,6 +125,8 @@ try_simplify_condjump (cbranch_block) basic_block jump_block, jump_dest_block, cbranch_dest_block; edge cbranch_jump_edge, cbranch_fallthru_edge; rtx cbranch_insn; + rtx insn, next; + rtx end; /* Verify that there are exactly two successors. */ if (!cbranch_block->succ @@ -177,6 +179,26 @@ try_simplify_condjump (cbranch_block) cbranch_fallthru_edge->flags &= ~EDGE_FALLTHRU; update_br_prob_note (cbranch_block); + end = jump_block->end; + /* Deleting a block may produce unreachable code warning even when we are + not deleting anything live. Supress it by moving all the line number + notes out of the block. */ + for (insn = jump_block->head; insn != NEXT_INSN (jump_block->end); + insn = next) + { + next = NEXT_INSN (insn); + if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0) + { + if (insn == jump_block->end) + { + jump_block->end = PREV_INSN (insn); + if (insn == end) + break; + } + reorder_insns_nobb (insn, insn, end); + end = insn; + } + } /* Delete the block with the unconditional jump, and clean up the mess. */ flow_delete_block (jump_block); tidy_fallthru_edge (cbranch_jump_edge, cbranch_block, cbranch_dest_block); diff --git a/contrib/gcc/cfgloop.c b/contrib/gcc/cfgloop.c index 0a2829f5c185..c8f7603535de 100644 --- a/contrib/gcc/cfgloop.c +++ b/contrib/gcc/cfgloop.c @@ -804,19 +804,20 @@ flow_loops_find (loops, flags) header->loop_depth = 0; + /* If we have an abnormal predecessor, do not consider the + loop (not worth the problems). */ + for (e = header->pred; e; e = e->pred_next) + if (e->flags & EDGE_ABNORMAL) + break; + if (e) + continue; + for (e = header->pred; e; e = e->pred_next) { basic_block latch = e->src; if (e->flags & EDGE_ABNORMAL) - { - if (more_latches) - { - RESET_BIT (headers, header->index); - num_loops--; - } - break; - } + abort (); /* Look for back edges where a predecessor is dominated by this block. A natural loop has a single entry diff --git a/contrib/gcc/cfgrtl.c b/contrib/gcc/cfgrtl.c index 7780ca5940c9..e01960668480 100644 --- a/contrib/gcc/cfgrtl.c +++ b/contrib/gcc/cfgrtl.c @@ -2261,8 +2261,12 @@ purge_dead_edges (bb) continue; else if ((e->flags & EDGE_EH) && can_throw_internal (insn)) /* Keep the edges that correspond to exceptions thrown by - this instruction. */ - continue; + this instruction and rematerialize the EDGE_ABNORMAL flag + we just cleared above. */ + { + e->flags |= EDGE_ABNORMAL; + continue; + } /* We do not need this edge. */ bb->flags |= BB_DIRTY; diff --git a/contrib/gcc/collect2.c b/contrib/gcc/collect2.c index 81a2bf32d64f..7b3dfaafa99a 100644 --- a/contrib/gcc/collect2.c +++ b/contrib/gcc/collect2.c @@ -234,7 +234,7 @@ struct obstack temporary_obstack; char * temporary_firstobj; /* Holds the return value of pexecute. */ -int pexecute_pid; +int pid; /* Structure to hold all the directories in which to search for files to execute. */ @@ -1499,7 +1499,7 @@ collect_wait (prog) { int status; - pwait (pexecute_pid, &status, 0); + pwait (pid, &status, 0); if (status) { if (WIFSIGNALED (status)) @@ -1588,9 +1588,9 @@ collect_execute (prog, argv, redir) dup2 (redir_handle, STDERR_FILENO); } - pexecute_pid = pexecute (argv[0], argv, argv[0], NULL, - &errmsg_fmt, &errmsg_arg, - (PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH)); + pid = pexecute (argv[0], argv, argv[0], NULL, + &errmsg_fmt, &errmsg_arg, + (PEXECUTE_FIRST | PEXECUTE_LAST | PEXECUTE_SEARCH)); if (redir) { @@ -1602,7 +1602,7 @@ collect_execute (prog, argv, redir) close (redir_handle); } - if (pexecute_pid == -1) + if (pid == -1) fatal_perror (errmsg_fmt, errmsg_arg); } @@ -2069,7 +2069,6 @@ scan_prog_file (prog_name, which_pass) void (*quit_handler) PARAMS ((int)); char *real_nm_argv[4]; const char **nm_argv = (const char **) real_nm_argv; - int pid; int argc = 0; int pipe_fd[2]; char *p, buf[1024]; @@ -2514,7 +2513,6 @@ scan_libraries (prog_name) void (*quit_handler) PARAMS ((int)); char *real_ldd_argv[4]; const char **ldd_argv = (const char **) real_ldd_argv; - int pid; int argc = 0; int pipe_fd[2]; char buf[1024]; diff --git a/contrib/gcc/combine.c b/contrib/gcc/combine.c index 03d0dffa6baf..cec5a29cf511 100644 --- a/contrib/gcc/combine.c +++ b/contrib/gcc/combine.c @@ -424,6 +424,7 @@ static int insn_cuid PARAMS ((rtx)); static void record_promoted_value PARAMS ((rtx, rtx)); static rtx reversed_comparison PARAMS ((rtx, enum machine_mode, rtx, rtx)); static enum rtx_code combine_reversed_comparison_code PARAMS ((rtx)); +static void adjust_for_new_dest PARAMS ((rtx)); /* Substitute NEWVAL, an rtx expression, into INTO, a place in some insn. The substitution can be undone by undo_all. If INTO is already @@ -1502,6 +1503,34 @@ cant_combine_insn_p (insn) return 0; } +/* Adjust INSN after we made a change to its destination. + + Changing the destination can invalidate notes that say something about + the results of the insn and a LOG_LINK pointing to the insn. */ + +static void +adjust_for_new_dest (insn) + rtx insn; +{ + rtx *loc; + + /* For notes, be conservative and simply remove them. */ + loc = ®_NOTES (insn); + while (*loc) + { + enum reg_note kind = REG_NOTE_KIND (*loc); + if (kind == REG_EQUAL || kind == REG_EQUIV) + *loc = XEXP (*loc, 1); + else + loc = &XEXP (*loc, 1); + } + + /* The new insn will have a destination that was previously the destination + of an insn just above it. Call distribute_links to make a LOG_LINK from + the next use of that destination. */ + distribute_links (gen_rtx_INSN_LIST (VOIDmode, insn, NULL_RTX)); +} + /* Try to combine the insns I1 and I2 into I3. Here I1 and I2 appear earlier than I3. I1 can be zero; then we combine just I2 into I3. @@ -2124,6 +2153,14 @@ try_combine (i3, i2, i1, new_direct_jump_p) { newpat = XVECEXP (newpat, 0, 1); insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); + + if (insn_code_number >= 0) + { + /* If we will be able to accept this, we have made a change to the + destination of I3. This requires us to do a few adjustments. */ + PATTERN (i3) = newpat; + adjust_for_new_dest (i3); + } } /* If we were combining three insns and the result is a simple SET @@ -2394,16 +2431,9 @@ try_combine (i3, i2, i1, new_direct_jump_p) rtx link; /* If we will be able to accept this, we have made a change to the - destination of I3. This can invalidate a LOG_LINKS pointing - to I3. No other part of combine.c makes such a transformation. - - The new I3 will have a destination that was previously the - destination of I1 or I2 and which was used in i2 or I3. Call - distribute_links to make a LOG_LINK from the next use of - that destination. */ - + destination of I3. This requires us to do a few adjustments. */ PATTERN (i3) = newpat; - distribute_links (gen_rtx_INSN_LIST (VOIDmode, i3, NULL_RTX)); + adjust_for_new_dest (i3); /* I3 now uses what used to be its destination and which is now I2's destination. That means we need a LOG_LINK from @@ -7812,6 +7842,7 @@ make_field_assignment (x) && (GET_MODE_SIZE (GET_MODE (XEXP (src, 0))) < GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (src, 0))))) && GET_CODE (SUBREG_REG (XEXP (src, 0))) == ROTATE + && GET_CODE (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == CONST_INT && INTVAL (XEXP (SUBREG_REG (XEXP (src, 0)), 0)) == -2 && rtx_equal_for_field_assignment_p (dest, XEXP (src, 1))) { @@ -10209,6 +10240,11 @@ gen_binary (code, mode, op0, op1) rtx result; rtx tem; + if (GET_CODE (op0) == CLOBBER) + return op0; + else if (GET_CODE (op1) == CLOBBER) + return op1; + if (GET_RTX_CLASS (code) == 'c' && swap_commutative_operands_p (op0, op1)) tem = op0, op0 = op1, op1 = tem; @@ -12569,6 +12605,7 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) abort (); break; + case REG_ALWAYS_RETURN: case REG_NORETURN: case REG_SETJMP: /* These notes must remain with the call. It should not be @@ -13070,8 +13107,8 @@ distribute_notes (notes, from_insn, i3, i2, elim_i2, elim_i1) } /* Similarly to above, distribute the LOG_LINKS that used to be present on - I3, I2, and I1 to new locations. This is also called in one case to - add a link pointing at I3 when I3's destination is changed. */ + I3, I2, and I1 to new locations. This is also called to add a link + pointing at I3 when I3's destination is changed. */ static void distribute_links (links) diff --git a/contrib/gcc/config.gcc b/contrib/gcc/config.gcc index 6493ccf5fe18..e00f913bb7f8 100644 --- a/contrib/gcc/config.gcc +++ b/contrib/gcc/config.gcc @@ -298,11 +298,11 @@ xscale-*-*) ;; i[34567]86-*-*) cpu_type=i386 - extra_headers="mmintrin.h xmmintrin.h" + extra_headers="mmintrin.h xmmintrin.h emmintrin.h pmmintrin.h" ;; x86_64-*-*) cpu_type=i386 - extra_headers="mmintrin.h xmmintrin.h" + extra_headers="mmintrin.h xmmintrin.h emmintrin.h pmmintrin.h" ;; ia64-*-*) extra_headers=ia64intrin.h @@ -961,13 +961,11 @@ hppa*64*-*-hpux11*) then target_cpu_default="${target_cpu_default}|MASK_GNU_LD" fi -# if [ x$enable_threads = x ]; then -# enable_threads=$have_pthread_h -# fi -# if [ x$enable_threads = xyes ]; then -# thread_file='dce' -# tmake_file="${tmake_file} pa/t-dce-thr" -# fi + case x${enable_threads} in + xyes | xposix ) + thread_file=posix + ;; + esac install_headers_dir=install-headers-cpio ;; hppa1.1-*-hpux11* | hppa2*-*-hpux11*) @@ -976,13 +974,11 @@ hppa1.1-*-hpux11* | hppa2*-*-hpux11*) xm_defines=POSIX tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" xmake_file="pa/x-ada" -# if test x$enable_threads = x; then -# enable_threads=$have_pthread_h -# fi -# if test x$enable_threads = xyes; then -# thread_file='dce' -# tmake_file="${tmake_file} pa/t-dce-thr" -# fi + case x${enable_threads} in + xyes | xposix ) + thread_file=posix + ;; + esac install_headers_dir=install-headers-cpio use_collect2=yes ;; @@ -991,13 +987,11 @@ hppa1.0-*-hpux11*) xm_defines=POSIX tmake_file="pa/t-pa pa/t-pa-hpux pa/t-hpux-shlib" xmake_file="pa/x-ada" -# if test x$enable_threads = x; then -# enable_threads=$have_pthread_h -# fi -# if test x$enable_threads = xyes; then -# thread_file='dce' -# tmake_file="${tmake_file} pa/t-dce-thr" -# fi + case x${enable_threads} in + xyes | xposix ) + thread_file=posix + ;; + esac install_headers_dir=install-headers-cpio use_collect2=yes ;; @@ -1244,15 +1238,13 @@ i[34567]86-*-rtems*) i[34567]86-*-sco3.2v5*) # 80386 running SCO Open Server 5 xm_defines=POSIX install_headers_dir=install-headers-cpio - tm_file="${tm_file} i386/unix.h i386/att.h i386/sco5.h" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/sco5.h" if test x$gas = xyes then tm_file="usegas.h ${tm_file}" - tmake_file=i386/t-sco5gas - else - tmake_file=i386/t-sco5 fi - extra_parts="crti.o crtbegin.o crtend.o crtbeginS.o crtendS.o" + tmake_file=i386/t-sco5 + extra_parts="crtbegin.o crtend.o" ;; i[34567]86-*-solaris2*) xm_defines="POSIX SMALL_ARG_MAX" @@ -1486,14 +1478,19 @@ ia64*-*-linux*) tmake_file="t-slibgcc-elf-ver t-linux ia64/t-ia64 ia64/t-glibc" target_cpu_default="MASK_GNU_AS|MASK_GNU_LD" extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtfastmath.o" + if test x"$use_libunwind_exceptions" = xyes; then + tmake_file="$tmake_file t-libunwind" + fi ;; ia64*-*-hpux*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h ia64/sysv4.h ia64/hpux.h ia64/hpux_longdouble.h" tmake_file="ia64/t-ia64 ia64/t-hpux" target_cpu_default="MASK_GNU_AS" - if test x$enable_threads = xyes; then - thread_file='posix' - fi + case x$enable_threads in + xyes | xposix ) + thread_file=posix + ;; + esac use_collect2=no c_target_objs="ia64-c.o" cxx_target_objs="ia64-c.o" @@ -1751,7 +1748,7 @@ m68k-*-rtemscoff*) # would otherwise be caught by m68k-*-rtems* ;; m68k-*-rtems*) xm_defines=POSIX - tmake_file="m68k/t-m68kbare t-rtems m68k/t-crtstuff" + tmake_file="m68k/t-m68kbare m68k/t-crtstuff t-rtems m68k/t-rtems" tm_file="m68k/m68k-none.h m68k/m68kelf.h dbxelf.h elfos.h m68k/m68kemb.h m68k/m68020-elf.h m68k/rtemself.h rtems.h" extra_parts="crtbegin.o crtend.o" if test x$enable_threads = xyes; then @@ -1968,7 +1965,7 @@ mips64orion-*-rtems*) mips*-*-rtems*) xm_defines=POSIX tm_file="${tm_file} mips/elf.h mips/rtems.h rtems.h" - tmake_file="mips/t-elf t-rtems" + tmake_file="mips/t-elf t-rtems mips/t-rtems" if test x$enable_threads = xyes; then thread_file='rtems' fi @@ -2308,7 +2305,7 @@ sh-*-rtems*) fi ;; sh-*-linux* | sh[2346lbe]*-*-linux*) - tmake_file="sh/t-sh sh/t-elf sh/t-linux" + tmake_file="sh/t-sh sh/t-elf" case $machine in sh*be-*-* | sh*eb-*-*) ;; *) @@ -2316,6 +2313,7 @@ sh-*-linux* | sh[2346lbe]*-*-linux*) tmake_file="${tmake_file} sh/t-le" ;; esac + tmake_file="${tmake_file} sh/t-linux" tm_file="${tm_file} dbxelf.h elfos.h svr4.h sh/elf.h sh/linux.h" gas=yes gnu_ld=yes case $machine in @@ -2525,7 +2523,7 @@ sparc-*-solaris2*) tm_file="${tm_file} sparc/sol26-sld.h" fi ;; - *-*-solaris2.[789]) + *-*-solaris2.[789] | *-*-solaris2.1[0-9]) tm_file="sparc/biarch64.h ${tm_file} sparc/sol2-bi.h" if test x$gnu_ld = xyes; then tm_file="${tm_file} sparc/sol2-gld-bi.h" diff --git a/contrib/gcc/config.in b/contrib/gcc/config.in index bc52d3634e3b..1e81188293b8 100644 --- a/contrib/gcc/config.in +++ b/contrib/gcc/config.in @@ -1,4 +1,4 @@ -/* config.in. Generated automatically from configure.in by autoheader 2.13. */ +/* config.in. Generated automatically from configure.in by autoheader. */ /* Define if using alloca.c. */ #undef C_ALLOCA @@ -501,6 +501,12 @@ /* Define if host mkdir takes a single argument. */ #undef MKDIR_TAKES_ONE_ARG +/* Define 0/1 to force the choice for exception handling model. */ +#undef CONFIG_SJLJ_EXCEPTIONS + +/* Define if gcc should use -lunwind. */ +#undef USE_LIBUNWIND_EXCEPTIONS + /* Define to the name of a file containing a list of extra machine modes for this architecture. */ #undef EXTRA_MODES_FILE @@ -582,6 +588,9 @@ /* Define if your assembler supports offsetable %lo(). */ #undef HAVE_AS_OFFSETABLE_LO10 +/* Define if your assembler supports the Sun syntax for cmov. */ +#undef HAVE_AS_IX86_CMOV_SUN_SYNTAX + /* Define true if the assembler supports '.long foo@GOTOFF'. */ #undef HAVE_AS_GOTOFF_IN_DATA @@ -608,12 +617,6 @@ /* Define if your MIPS libgloss linker scripts consistently include STARTUP directives. */ #undef HAVE_MIPS_LIBGLOSS_STARTUP_DIRECTIVES -/* Define 0/1 to force the choice for exception handling model. */ -#undef CONFIG_SJLJ_EXCEPTIONS - -/* Define if gcc should use -lunwind. */ -#undef USE_LIBUNWIND_EXCEPTIONS - /* Bison unconditionally undefines `const' if neither `__STDC__' nor __cplusplus are defined. That's a problem since we use `const' in diff --git a/contrib/gcc/config/alpha/alpha.c b/contrib/gcc/config/alpha/alpha.c index 9657e56bf430..42b57e18a21a 100644 --- a/contrib/gcc/config/alpha/alpha.c +++ b/contrib/gcc/config/alpha/alpha.c @@ -2949,12 +2949,8 @@ alpha_expand_mov (mode, operands) compiled at the end of compilation. In the meantime, someone can re-encode-section-info on some symbol changing it e.g. from global to local-not-small. If this happens, we'd have emitted a plain - load rather than a high+losum load and not recognize the insn. - - So if rtl inlining is in effect, we delay the global/not-global - decision until rest_of_compilation by wrapping it in an - UNSPEC_SYMBOL. */ - if (TARGET_EXPLICIT_RELOCS && flag_inline_functions + load rather than a high+losum load and not recognize the insn. */ + if (TARGET_EXPLICIT_RELOCS && rtx_equal_function_value_matters && global_symbolic_operand (operands[1], mode)) { @@ -3336,10 +3332,10 @@ alpha_emit_conditional_branch (code) if (op1 == const0_rtx) cmp_code = NIL, branch_code = code; - /* We want to use cmpcc/bcc when we can, since there is a zero delay - bypass between logicals and br/cmov on EV5. But we don't want to - force valid immediate constants into registers needlessly. */ - else if (GET_CODE (op1) == CONST_INT) + /* If the constants doesn't fit into an immediate, but can + be generated by lda/ldah, we adjust the argument and + compare against zero, so we can use beq/bne directly. */ + else if (GET_CODE (op1) == CONST_INT && (code == EQ || code == NE)) { HOST_WIDE_INT v = INTVAL (op1), n = -v; @@ -6748,14 +6744,21 @@ alpha_sa_mask (imaskP, fmaskP) /* We need to restore these for the handler. */ if (current_function_calls_eh_return) - for (i = 0; ; ++i) - { - unsigned regno = EH_RETURN_DATA_REGNO (i); - if (regno == INVALID_REGNUM) - break; - imask |= 1L << regno; - } - + { + for (i = 0; ; ++i) + { + unsigned regno = EH_RETURN_DATA_REGNO (i); + if (regno == INVALID_REGNUM) + break; + imask |= 1L << regno; + } + + /* Glibc likes to use $31 as an unwind stopper for crt0. To + avoid hackery in unwind-dw2.c, we need to actively store a + zero in the prologue of _Unwind_RaiseException et al. */ + imask |= 1UL << 31; + } + /* If any register spilled, then spill the return address also. */ /* ??? This is required by the Digital stack unwind specification and isn't needed if we're doing Dwarf2 unwinding. */ @@ -7210,7 +7213,7 @@ alpha_expand_prologue () } /* Now save any other registers required to be saved. */ - for (i = 0; i < 32; i++) + for (i = 0; i < 31; i++) if (imask & (1L << i)) { mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); @@ -7219,7 +7222,25 @@ alpha_expand_prologue () reg_offset += 8; } - for (i = 0; i < 32; i++) + /* Store a zero if requested for unwinding. */ + if (imask & (1UL << 31)) + { + rtx insn, t; + + mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); + set_mem_alias_set (mem, alpha_sr_alias_set); + insn = emit_move_insn (mem, const0_rtx); + + RTX_FRAME_RELATED_P (insn) = 1; + t = gen_rtx_REG (Pmode, 31); + t = gen_rtx_SET (VOIDmode, mem, t); + t = gen_rtx_EXPR_LIST (REG_FRAME_RELATED_EXPR, t, REG_NOTES (insn)); + REG_NOTES (insn) = t; + + reg_offset += 8; + } + + for (i = 0; i < 31; i++) if (fmask & (1L << i)) { mem = gen_rtx_MEM (DFmode, plus_constant (sa_reg, reg_offset)); @@ -7625,7 +7646,7 @@ alpha_expand_epilogue () reg_offset += 8; imask &= ~(1L << REG_RA); - for (i = 0; i < 32; ++i) + for (i = 0; i < 31; ++i) if (imask & (1L << i)) { if (i == HARD_FRAME_POINTER_REGNUM && fp_is_frame_pointer) @@ -7639,7 +7660,10 @@ alpha_expand_epilogue () reg_offset += 8; } - for (i = 0; i < 32; ++i) + if (imask & (1UL << 31)) + reg_offset += 8; + + for (i = 0; i < 31; ++i) if (fmask & (1L << i)) { mem = gen_rtx_MEM (DFmode, plus_constant(sa_reg, reg_offset)); diff --git a/contrib/gcc/config/alpha/alpha.h b/contrib/gcc/config/alpha/alpha.h index b933ea316252..6b52700e7e8f 100644 --- a/contrib/gcc/config/alpha/alpha.h +++ b/contrib/gcc/config/alpha/alpha.h @@ -1276,6 +1276,7 @@ do { \ /* Before the prologue, RA lives in $26. */ #define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 26) #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (26) +#define DWARF_ALT_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (64) /* Describe how we implement __builtin_eh_return. */ #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 16 : INVALID_REGNUM) diff --git a/contrib/gcc/config/alpha/alpha.md b/contrib/gcc/config/alpha/alpha.md index a4c0ae6904dc..f7e9fa404bc9 100644 --- a/contrib/gcc/config/alpha/alpha.md +++ b/contrib/gcc/config/alpha/alpha.md @@ -5399,7 +5399,7 @@ fadd,fmul,fcpys,fdiv,fsqrt,misc,mvi,ftoi,itof,multi,none" [(set (match_operand:DI 0 "register_operand" "=r") (unspec:DI [(match_operand:DI 1 "symbolic_operand" "")] UNSPEC_SYMBOL))] - "TARGET_EXPLICIT_RELOCS && flag_inline_functions" + "TARGET_EXPLICIT_RELOCS" "#" "" [(set (match_dup 0) (match_dup 1))] diff --git a/contrib/gcc/config/alpha/linux.h b/contrib/gcc/config/alpha/linux.h index 0c533449e8b2..3a2940cc3078 100644 --- a/contrib/gcc/config/alpha/linux.h +++ b/contrib/gcc/config/alpha/linux.h @@ -61,6 +61,9 @@ Boston, MA 02111-1307, USA. */ #define TARGET_HAS_F_SETLKW +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + /* Do code reading to identify a signal frame, and set the frame state data appropriately. See unwind-dw2.c for the structs. */ @@ -78,6 +81,8 @@ Boston, MA 02111-1307, USA. */ if (pc_[0] != 0x47fe0410 /* mov $30,$16 */ \ || pc_[2] != 0x00000083 /* callsys */) \ break; \ + if ((CONTEXT)->cfa == 0) \ + break; \ if (pc_[1] == 0x201f0067) /* lda $0,NR_sigreturn */ \ sc_ = (CONTEXT)->cfa; \ else if (pc_[1] == 0x201f015f) /* lda $0,NR_rt_sigreturn */ \ @@ -106,8 +111,8 @@ Boston, MA 02111-1307, USA. */ (FS)->regs.reg[i_+32].loc.offset \ = (long)&sc_->sc_fpregs[i_] - new_cfa_; \ } \ - (FS)->regs.reg[31].how = REG_SAVED_OFFSET; \ - (FS)->regs.reg[31].loc.offset = (long)&sc_->sc_pc - new_cfa_; \ - (FS)->retaddr_column = 31; \ + (FS)->regs.reg[64].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[64].loc.offset = (long)&sc_->sc_pc - new_cfa_; \ + (FS)->retaddr_column = 64; \ goto SUCCESS; \ } while (0) diff --git a/contrib/gcc/config/arm/linux-elf.h b/contrib/gcc/config/arm/linux-elf.h index c6d14e769f1a..8cc812f763f6 100644 --- a/contrib/gcc/config/arm/linux-elf.h +++ b/contrib/gcc/config/arm/linux-elf.h @@ -123,3 +123,6 @@ Boston, MA 02111-1307, USA. */ #undef CC1_SPEC #define CC1_SPEC "%{profile:-p}" + +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" diff --git a/contrib/gcc/config/darwin.h b/contrib/gcc/config/darwin.h index 90d959c0f7ef..c4b752696021 100644 --- a/contrib/gcc/config/darwin.h +++ b/contrib/gcc/config/darwin.h @@ -380,6 +380,10 @@ do { text_section (); \ || DECL_INITIAL (DECL)) \ (* targetm.encode_section_info) (DECL, false); \ ASM_OUTPUT_LABEL (FILE, xname); \ + /* Darwin doesn't support zero-size objects, so give them a \ + byte. */ \ + if (tree_low_cst (DECL_SIZE_UNIT (DECL), 1) == 0) \ + assemble_zeros (1); \ } while (0) #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ @@ -401,6 +405,15 @@ do { text_section (); \ machopic_output_possible_stub_label (FILE, xname); \ } while (0) +#define ASM_DECLARE_CONSTANT_NAME(FILE, NAME, EXP, SIZE) \ + do { \ + ASM_OUTPUT_LABEL (FILE, NAME); \ + /* Darwin doesn't support zero-size objects, so give them a \ + byte. */ \ + if ((SIZE) == 0) \ + assemble_zeros (1); \ + } while (0) + /* Wrap new method names in quotes so the assembler doesn't gag. Make Objective-C internal symbols local. */ diff --git a/contrib/gcc/config/i386/emmintrin.h b/contrib/gcc/config/i386/emmintrin.h new file mode 100644 index 000000000000..7007fc5864a2 --- /dev/null +++ b/contrib/gcc/config/i386/emmintrin.h @@ -0,0 +1,1499 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + + This file is part of GNU CC. + + GNU CC 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. + + GNU CC 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 GNU CC; 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, 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. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _EMMINTRIN_H_INCLUDED +#define _EMMINTRIN_H_INCLUDED + +#ifdef __SSE2__ +#include + +/* SSE2 */ +typedef int __v2df __attribute__ ((mode (V2DF))); +typedef int __v2di __attribute__ ((mode (V2DI))); +typedef int __v4si __attribute__ ((mode (V4SI))); +typedef int __v8hi __attribute__ ((mode (V8HI))); +typedef int __v16qi __attribute__ ((mode (V16QI))); + +/* Create a selector for use with the SHUFPD instruction. */ +#define _MM_SHUFFLE2(fp1,fp0) \ + (((fp1) << 1) | (fp0)) + +#define __m128i __v2di +#define __m128d __v2df + +/* Create a vector with element 0 as *P and the rest zero. */ +static __inline __m128d +_mm_load_sd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadsd (__P); +} + +/* Create a vector with all two elements equal to *P. */ +static __inline __m128d +_mm_load1_pd (double const *__P) +{ + __v2df __tmp = __builtin_ia32_loadsd (__P); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); +} + +static __inline __m128d +_mm_load_pd1 (double const *__P) +{ + return _mm_load1_pd (__P); +} + +/* Load two DPFP values from P. The address must be 16-byte aligned. */ +static __inline __m128d +_mm_load_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadapd (__P); +} + +/* Load two DPFP values from P. The address need not be 16-byte aligned. */ +static __inline __m128d +_mm_loadu_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadupd (__P); +} + +/* Load two DPFP values in reverse order. The address must be aligned. */ +static __inline __m128d +_mm_loadr_pd (double const *__P) +{ + __v2df __tmp = __builtin_ia32_loadapd (__P); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,1)); +} + +/* Create a vector with element 0 as F and the rest zero. */ +static __inline __m128d +_mm_set_sd (double __F) +{ + return (__m128d) __builtin_ia32_loadsd (&__F); +} + +/* Create a vector with all two elements equal to F. */ +static __inline __m128d +_mm_set1_pd (double __F) +{ + __v2df __tmp = __builtin_ia32_loadsd (&__F); + return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); +} + +static __inline __m128d +_mm_set_pd1 (double __F) +{ + return _mm_set1_pd (__F); +} + +/* Create the vector [Z Y]. */ +static __inline __m128d +_mm_set_pd (double __Z, double __Y) +{ + union { + double __a[2]; + __m128d __v; + } __u; + + __u.__a[0] = __Y; + __u.__a[1] = __Z; + + return __u.__v; +} + +/* Create the vector [Y Z]. */ +static __inline __m128d +_mm_setr_pd (double __Z, double __Y) +{ + return _mm_set_pd (__Y, __Z); +} + +/* Create a vector of zeros. */ +static __inline __m128d +_mm_setzero_pd (void) +{ + return (__m128d) __builtin_ia32_setzeropd (); +} + +/* Stores the lower DPFP value. */ +static __inline void +_mm_store_sd (double *__P, __m128d __A) +{ + __builtin_ia32_storesd (__P, (__v2df)__A); +} + +/* Store the lower DPFP value acrosd two words. */ +static __inline void +_mm_store1_pd (double *__P, __m128d __A) +{ + __v2df __va = (__v2df)__A; + __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,0)); + __builtin_ia32_storeapd (__P, __tmp); +} + +static __inline void +_mm_store_pd1 (double *__P, __m128d __A) +{ + _mm_store1_pd (__P, __A); +} + +/* Store two DPFP values. The address must be 16-byte aligned. */ +static __inline void +_mm_store_pd (double *__P, __m128d __A) +{ + __builtin_ia32_storeapd (__P, (__v2df)__A); +} + +/* Store two DPFP values. The address need not be 16-byte aligned. */ +static __inline void +_mm_storeu_pd (double *__P, __m128d __A) +{ + __builtin_ia32_storeupd (__P, (__v2df)__A); +} + +/* Store two DPFP values in reverse order. The address must be aligned. */ +static __inline void +_mm_storer_pd (double *__P, __m128d __A) +{ + __v2df __va = (__v2df)__A; + __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,1)); + __builtin_ia32_storeapd (__P, __tmp); +} + +/* Sets the low DPFP value of A from the low value of B. */ +static __inline __m128d +_mm_move_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); +} + + +static __inline __m128d +_mm_add_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_add_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sub_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sub_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_mul_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_mul_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_div_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_div_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_sqrt_pd (__m128d __A) +{ + return (__m128d)__builtin_ia32_sqrtpd ((__v2df)__A); +} + +/* Return pair {sqrt (A[0), B[1]}. */ +static __inline __m128d +_mm_sqrt_sd (__m128d __A, __m128d __B) +{ + __v2df __tmp = __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); + return (__m128d)__builtin_ia32_sqrtsd ((__v2df)__tmp); +} + +static __inline __m128d +_mm_min_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_minpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_min_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_minsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_max_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_maxpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_max_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_maxsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_and_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_andpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_andnot_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_andnpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_or_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_orpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_xor_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_xorpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpeq_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpeqpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmplt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpltpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmple_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmplepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpgt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpgtpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpge_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpgepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpneq_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpneqpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnlt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnltpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnle_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnlepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpngt_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpngtpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnge_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpngepd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpord_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpordpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpunord_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpunordpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpeq_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpeqsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmplt_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpltsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmple_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmplesd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpgt_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpltsd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpge_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmplesd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpneq_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpneqsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnlt_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnltsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpnle_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpnlesd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpngt_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpnltsd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpnge_sd (__m128d __A, __m128d __B) +{ + return (__m128d) __builtin_ia32_movsd ((__v2df) __A, + (__v2df) + __builtin_ia32_cmpnlesd ((__v2df) __B, + (__v2df) + __A)); +} + +static __inline __m128d +_mm_cmpord_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpordsd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_cmpunord_sd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_cmpunordsd ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comieq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdeq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comilt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdlt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comile_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdle ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comigt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdgt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comige_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdge ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_comineq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_comisdneq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomieq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdeq ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomilt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdlt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomile_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdle ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomigt_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdgt ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomige_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdge ((__v2df)__A, (__v2df)__B); +} + +static __inline int +_mm_ucomineq_sd (__m128d __A, __m128d __B) +{ + return __builtin_ia32_ucomisdneq ((__v2df)__A, (__v2df)__B); +} + +/* Create a vector with element 0 as *P and the rest zero. */ + +static __inline __m128i +_mm_load_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_loaddqa ((char const *)__P); +} + +static __inline __m128i +_mm_loadu_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_loaddqu ((char const *)__P); +} + +static __inline __m128i +_mm_loadl_epi64 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_movq2dq (*(unsigned long long *)__P); +} + +static __inline void +_mm_store_si128 (__m128i *__P, __m128i __B) +{ + __builtin_ia32_storedqa ((char *)__P, (__v16qi)__B); +} + +static __inline void +_mm_storeu_si128 (__m128i *__P, __m128i __B) +{ + __builtin_ia32_storedqu ((char *)__P, (__v16qi)__B); +} + +static __inline void +_mm_storel_epi64 (__m128i *__P, __m128i __B) +{ + *(long long *)__P = __builtin_ia32_movdq2q ((__v2di)__B); +} + +static __inline __m64 +_mm_movepi64_pi64 (__m128i __B) +{ + return (__m64) __builtin_ia32_movdq2q ((__v2di)__B); +} + +static __inline __m128i +_mm_move_epi64 (__m128i __A) +{ + return (__m128i) __builtin_ia32_movq ((__v2di)__A); +} + +/* Create a vector of zeros. */ +static __inline __m128i +_mm_setzero_si128 (void) +{ + return (__m128i) __builtin_ia32_setzero128 (); +} + +static __inline __m128i +_mm_set_epi64 (__m64 __A, __m64 __B) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp2, __tmp); +} + +/* Create the vector [Z Y X W]. */ +static __inline __m128i +_mm_set_epi32 (int __Z, int __Y, int __X, int __W) +{ + union { + int __a[4]; + __m128i __v; + } __u; + + __u.__a[0] = __W; + __u.__a[1] = __X; + __u.__a[2] = __Y; + __u.__a[3] = __Z; + + return __u.__v; +} + +#ifdef __x86_64__ +/* Create the vector [Z Y]. */ +static __inline __m128i +_mm_set_epi64x (long long __Z, long long __Y) +{ + union { + long __a[2]; + __m128i __v; + } __u; + + __u.__a[0] = __Y; + __u.__a[1] = __Z; + + return __u.__v; +} +#endif + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_set_epi16 (short __Z, short __Y, short __X, short __W, + short __V, short __U, short __T, short __S) +{ + union { + short __a[8]; + __m128i __v; + } __u; + + __u.__a[0] = __S; + __u.__a[1] = __T; + __u.__a[2] = __U; + __u.__a[3] = __V; + __u.__a[4] = __W; + __u.__a[5] = __X; + __u.__a[6] = __Y; + __u.__a[7] = __Z; + + return __u.__v; +} + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_set_epi8 (char __Z, char __Y, char __X, char __W, + char __V, char __U, char __T, char __S, + char __Z1, char __Y1, char __X1, char __W1, + char __V1, char __U1, char __T1, char __S1) +{ + union { + char __a[16]; + __m128i __v; + } __u; + + __u.__a[0] = __S1; + __u.__a[1] = __T1; + __u.__a[2] = __U1; + __u.__a[3] = __V1; + __u.__a[4] = __W1; + __u.__a[5] = __X1; + __u.__a[6] = __Y1; + __u.__a[7] = __Z1; + __u.__a[8] = __S; + __u.__a[9] = __T; + __u.__a[10] = __U; + __u.__a[11] = __V; + __u.__a[12] = __W; + __u.__a[13] = __X; + __u.__a[14] = __Y; + __u.__a[15] = __Z; + + return __u.__v; +} + +static __inline __m128i +_mm_set1_epi64 (__m64 __A) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp); +} + +static __inline __m128i +_mm_set1_epi32 (int __A) +{ + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__A); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +#ifdef __x86_64__ +static __inline __m128i +_mm_set1_epi64x (long long __A) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + return (__m128i) __builtin_ia32_shufpd ((__v2df)__tmp, (__v2df)__tmp, _MM_SHUFFLE2 (0,0)); +} +#endif + +static __inline __m128i +_mm_set1_epi16 (short __A) +{ + int __Acopy = (unsigned short)__A; + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); + __tmp = (__v4si)__builtin_ia32_punpcklwd128 ((__v8hi)__tmp, (__v8hi)__tmp); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128i +_mm_set1_epi8 (char __A) +{ + int __Acopy = (unsigned char)__A; + __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); + __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); + __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); + return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); +} + +static __inline __m128i +_mm_setr_epi64 (__m64 __A, __m64 __B) +{ + __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); + __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); + return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp2); +} + +/* Create the vector [Z Y X W]. */ +static __inline __m128i +_mm_setr_epi32 (int __W, int __X, int __Y, int __Z) +{ + union { + int __a[4]; + __m128i __v; + } __u; + + __u.__a[0] = __W; + __u.__a[1] = __X; + __u.__a[2] = __Y; + __u.__a[3] = __Z; + + return __u.__v; +} +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_setr_epi16 (short __S, short __T, short __U, short __V, + short __W, short __X, short __Y, short __Z) +{ + union { + short __a[8]; + __m128i __v; + } __u; + + __u.__a[0] = __S; + __u.__a[1] = __T; + __u.__a[2] = __U; + __u.__a[3] = __V; + __u.__a[4] = __W; + __u.__a[5] = __X; + __u.__a[6] = __Y; + __u.__a[7] = __Z; + + return __u.__v; +} + +/* Create the vector [S T U V Z Y X W]. */ +static __inline __m128i +_mm_setr_epi8 (char __S1, char __T1, char __U1, char __V1, + char __W1, char __X1, char __Y1, char __Z1, + char __S, char __T, char __U, char __V, + char __W, char __X, char __Y, char __Z) +{ + union { + char __a[16]; + __m128i __v; + } __u; + + __u.__a[0] = __S1; + __u.__a[1] = __T1; + __u.__a[2] = __U1; + __u.__a[3] = __V1; + __u.__a[4] = __W1; + __u.__a[5] = __X1; + __u.__a[6] = __Y1; + __u.__a[7] = __Z1; + __u.__a[8] = __S; + __u.__a[9] = __T; + __u.__a[10] = __U; + __u.__a[11] = __V; + __u.__a[12] = __W; + __u.__a[13] = __X; + __u.__a[14] = __Y; + __u.__a[15] = __Z; + + return __u.__v; +} + +static __inline __m128d +_mm_cvtepi32_pd (__m128i __A) +{ + return (__m128d)__builtin_ia32_cvtdq2pd ((__v4si) __A); +} + +static __inline __m128 +_mm_cvtepi32_ps (__m128i __A) +{ + return (__m128)__builtin_ia32_cvtdq2ps ((__v4si) __A); +} + +static __inline __m128i +_mm_cvtpd_epi32 (__m128d __A) +{ + return (__m128i)__builtin_ia32_cvtpd2dq ((__v2df) __A); +} + +static __inline __m64 +_mm_cvtpd_pi32 (__m128d __A) +{ + return (__m64)__builtin_ia32_cvtpd2pi ((__v2df) __A); +} + +static __inline __m128 +_mm_cvtpd_ps (__m128d __A) +{ + return (__m128)__builtin_ia32_cvtpd2ps ((__v2df) __A); +} + +static __inline __m128i +_mm_cvttpd_epi32 (__m128d __A) +{ + return (__m128i)__builtin_ia32_cvttpd2dq ((__v2df) __A); +} + +static __inline __m64 +_mm_cvttpd_pi32 (__m128d __A) +{ + return (__m64)__builtin_ia32_cvttpd2pi ((__v2df) __A); +} + +static __inline __m128d +_mm_cvtpi32_pd (__m64 __A) +{ + return (__m128d)__builtin_ia32_cvtpi2pd ((__v2si) __A); +} + +static __inline __m128i +_mm_cvtps_epi32 (__m128 __A) +{ + return (__m128i)__builtin_ia32_cvtps2dq ((__v4sf) __A); +} + +static __inline __m128i +_mm_cvttps_epi32 (__m128 __A) +{ + return (__m128i)__builtin_ia32_cvttps2dq ((__v4sf) __A); +} + +static __inline __m128d +_mm_cvtps_pd (__m128 __A) +{ + return (__m128d)__builtin_ia32_cvtps2pd ((__v4sf) __A); +} + +static __inline int +_mm_cvtsd_si32 (__m128d __A) +{ + return __builtin_ia32_cvtsd2si ((__v2df) __A); +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvtsd_si64x (__m128d __A) +{ + return __builtin_ia32_cvtsd2si64 ((__v2df) __A); +} +#endif + +static __inline int +_mm_cvttsd_si32 (__m128d __A) +{ + return __builtin_ia32_cvttsd2si ((__v2df) __A); +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvttsd_si64x (__m128d __A) +{ + return __builtin_ia32_cvttsd2si64 ((__v2df) __A); +} +#endif + +static __inline __m128 +_mm_cvtsd_ss (__m128 __A, __m128d __B) +{ + return (__m128)__builtin_ia32_cvtsd2ss ((__v4sf) __A, (__v2df) __B); +} + +static __inline __m128d +_mm_cvtsi32_sd (__m128d __A, int __B) +{ + return (__m128d)__builtin_ia32_cvtsi2sd ((__v2df) __A, __B); +} + +#ifdef __x86_64__ +static __inline __m128d +_mm_cvtsi64x_sd (__m128d __A, long long __B) +{ + return (__m128d)__builtin_ia32_cvtsi642sd ((__v2df) __A, __B); +} +#endif + +static __inline __m128d +_mm_cvtss_sd (__m128d __A, __m128 __B) +{ + return (__m128d)__builtin_ia32_cvtss2sd ((__v2df) __A, (__v4sf)__B); +} + +#define _mm_shuffle_pd(__A, __B, __C) ((__m128d)__builtin_ia32_shufpd ((__v2df)__A, (__v2df)__B, (__C))) + +static __inline __m128d +_mm_unpackhi_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_unpckhpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_unpacklo_pd (__m128d __A, __m128d __B) +{ + return (__m128d)__builtin_ia32_unpcklpd ((__v2df)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_loadh_pd (__m128d __A, double const *__B) +{ + return (__m128d)__builtin_ia32_loadhpd ((__v2df)__A, (__v2si *)__B); +} + +static __inline void +_mm_storeh_pd (double *__A, __m128d __B) +{ + __builtin_ia32_storehpd ((__v2si *)__A, (__v2df)__B); +} + +static __inline __m128d +_mm_loadl_pd (__m128d __A, double const *__B) +{ + return (__m128d)__builtin_ia32_loadlpd ((__v2df)__A, (__v2si *)__B); +} + +static __inline void +_mm_storel_pd (double *__A, __m128d __B) +{ + __builtin_ia32_storelpd ((__v2si *)__A, (__v2df)__B); +} + +static __inline int +_mm_movemask_pd (__m128d __A) +{ + return __builtin_ia32_movmskpd ((__v2df)__A); +} + +static __inline __m128i +_mm_packs_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packsswb128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_packs_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packssdw128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_packus_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_packuswb128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpackhi_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhdq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_unpackhi_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckhqdq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_unpacklo_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_unpacklo_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_unpacklo_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpckldq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_unpacklo_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_punpcklqdq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_add_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_add_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_add_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_add_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_adds_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddsb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_adds_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_adds_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddusb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_adds_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_paddusw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sub_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_sub_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sub_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_sub_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_subs_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubsb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_subs_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_subs_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubusb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_subs_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psubusw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_madd_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaddwd128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_mulhi_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmulhw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_mullo_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmullw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m64 +_mm_mul_su32 (__m64 __A, __m64 __B) +{ + return (__m64)__builtin_ia32_pmuludq ((__v2si)__A, (__v2si)__B); +} + +static __inline __m128i +_mm_mul_epu32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmuludq128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_sll_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psllw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sll_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pslld128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sll_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psllq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sra_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psraw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_sra_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrad128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrlw128 ((__v8hi)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrld128 ((__v4si)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_srl_epi64 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psrlq128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_slli_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psllwi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_slli_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_pslldi128 ((__v4si)__A, __B); +} + +static __inline __m128i +_mm_slli_epi64 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psllqi128 ((__v2di)__A, __B); +} + +static __inline __m128i +_mm_srai_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrawi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_srai_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psradi128 ((__v4si)__A, __B); +} + +#if 0 +static __m128i __attribute__((__always_inline__)) +_mm_srli_si128 (__m128i __A, const int __B) +{ + return ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) +} + +static __m128i __attribute__((__always_inline__)) +_mm_srli_si128 (__m128i __A, const int __B) +{ + return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) +} +#endif +#define _mm_srli_si128(__A, __B) ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) +#define _mm_slli_si128(__A, __B) ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) + +static __inline __m128i +_mm_srli_epi16 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrlwi128 ((__v8hi)__A, __B); +} + +static __inline __m128i +_mm_srli_epi32 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrldi128 ((__v4si)__A, __B); +} + +static __inline __m128i +_mm_srli_epi64 (__m128i __A, int __B) +{ + return (__m128i)__builtin_ia32_psrlqi128 ((__v2di)__A, __B); +} + +static __inline __m128i +_mm_and_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pand128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_andnot_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pandn128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_or_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_por128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_xor_si128 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pxor128 ((__v2di)__A, (__v2di)__B); +} + +static __inline __m128i +_mm_cmpeq_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_cmpeq_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_cmpeq_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B); +} + +static __inline __m128i +_mm_cmplt_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__B, (__v16qi)__A); +} + +static __inline __m128i +_mm_cmplt_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__B, (__v8hi)__A); +} + +static __inline __m128i +_mm_cmplt_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__B, (__v4si)__A); +} + +static __inline __m128i +_mm_cmpgt_epi8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_cmpgt_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_cmpgt_epi32 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__A, (__v4si)__B); +} + +#define _mm_extract_epi16(__A, __B) __builtin_ia32_pextrw128 ((__v8hi)__A, __B) + +#define _mm_insert_epi16(__A, __B, __C) ((__m128i)__builtin_ia32_pinsrw128 ((__v8hi)__A, __B, __C)) + +static __inline __m128i +_mm_max_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaxsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_max_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmaxub128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_min_epi16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pminsw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_min_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pminub128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline int +_mm_movemask_epi8 (__m128i __A) +{ + return __builtin_ia32_pmovmskb128 ((__v16qi)__A); +} + +static __inline __m128i +_mm_mulhi_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pmulhuw128 ((__v8hi)__A, (__v8hi)__B); +} + +#define _mm_shufflehi_epi16(__A, __B) ((__m128i)__builtin_ia32_pshufhw ((__v8hi)__A, __B)) +#define _mm_shufflelo_epi16(__A, __B) ((__m128i)__builtin_ia32_pshuflw ((__v8hi)__A, __B)) +#define _mm_shuffle_epi32(__A, __B) ((__m128i)__builtin_ia32_pshufd ((__v4si)__A, __B)) + +static __inline void +_mm_maskmoveu_si128 (__m128i __A, __m128i __B, char *__C) +{ + __builtin_ia32_maskmovdqu ((__v16qi)__A, (__v16qi)__B, __C); +} + +static __inline __m128i +_mm_avg_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pavgb128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline __m128i +_mm_avg_epu16 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_pavgw128 ((__v8hi)__A, (__v8hi)__B); +} + +static __inline __m128i +_mm_sad_epu8 (__m128i __A, __m128i __B) +{ + return (__m128i)__builtin_ia32_psadbw128 ((__v16qi)__A, (__v16qi)__B); +} + +static __inline void +_mm_stream_si32 (int *__A, int __B) +{ + __builtin_ia32_movnti (__A, __B); +} + +static __inline void +_mm_stream_si128 (__m128i *__A, __m128i __B) +{ + __builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B); +} + +static __inline void +_mm_stream_pd (double *__A, __m128d __B) +{ + __builtin_ia32_movntpd (__A, (__v2df)__B); +} + +static __inline __m128i +_mm_movpi64_epi64 (__m64 __A) +{ + return (__m128i)__builtin_ia32_movq2dq ((unsigned long long)__A); +} + +static __inline void +_mm_clflush (void const *__A) +{ + return __builtin_ia32_clflush (__A); +} + +static __inline void +_mm_lfence (void) +{ + __builtin_ia32_lfence (); +} + +static __inline void +_mm_mfence (void) +{ + __builtin_ia32_mfence (); +} + +static __inline __m128i +_mm_cvtsi32_si128 (int __A) +{ + return (__m128i) __builtin_ia32_loadd (&__A); +} + +#ifdef __x86_64__ +static __inline __m128i +_mm_cvtsi64x_si128 (long long __A) +{ + return (__m128i) __builtin_ia32_movq2dq (__A); +} +#endif + +static __inline int +_mm_cvtsi128_si32 (__m128i __A) +{ + int __tmp; + __builtin_ia32_stored (&__tmp, (__v4si)__A); + return __tmp; +} + +#ifdef __x86_64__ +static __inline long long +_mm_cvtsi128_si64x (__m128i __A) +{ + return __builtin_ia32_movdq2q ((__v2di)__A); +} +#endif + +#endif /* __SSE2__ */ + +#endif /* _EMMINTRIN_H_INCLUDED */ diff --git a/contrib/gcc/config/i386/i386.c b/contrib/gcc/config/i386/i386.c index 8d033b9d0f57..3abae59ec53f 100644 --- a/contrib/gcc/config/i386/i386.c +++ b/contrib/gcc/config/i386/i386.c @@ -1257,6 +1257,14 @@ override_options () if (x86_arch_always_fancy_math_387 & (1 << ix86_arch)) target_flags &= ~MASK_NO_FANCY_MATH_387; + /* Turn on SSE2 builtins for -mpni. */ + if (TARGET_PNI) + target_flags |= MASK_SSE2; + + /* Turn on SSE builtins for -msse2. */ + if (TARGET_SSE2) + target_flags |= MASK_SSE; + if (TARGET_64BIT) { if (TARGET_ALIGN_DOUBLE) @@ -2463,23 +2471,55 @@ int ix86_return_in_memory (type) tree type; { - int needed_intregs, needed_sseregs; + int needed_intregs, needed_sseregs, size; + enum machine_mode mode = TYPE_MODE (type); + if (TARGET_64BIT) + return !examine_argument (mode, type, 1, &needed_intregs, &needed_sseregs); + + if (mode == BLKmode) + return 1; + + size = int_size_in_bytes (type); + + if (VECTOR_MODE_P (mode) || mode == TImode) { - return !examine_argument (TYPE_MODE (type), type, 1, - &needed_intregs, &needed_sseregs); - } - else - { - if (TYPE_MODE (type) == BLKmode - || (VECTOR_MODE_P (TYPE_MODE (type)) - && int_size_in_bytes (type) == 8) - || (int_size_in_bytes (type) > 12 && TYPE_MODE (type) != TImode - && TYPE_MODE (type) != TFmode - && !VECTOR_MODE_P (TYPE_MODE (type)))) + /* User-created vectors small enough to fit in EAX. */ + if (size < 8) + return 0; + + /* MMX/3dNow values are returned on the stack, since we've + got to EMMS/FEMMS before returning. */ + if (size == 8) return 1; - return 0; + + /* SSE values are returned in XMM0. */ + /* ??? Except when it doesn't exist? We have a choice of + either (1) being abi incompatible with a -march switch, + or (2) generating an error here. Given no good solution, + I think the safest thing is one warning. The user won't + be able to use -Werror, but... */ + if (size == 16) + { + static bool warned; + + if (TARGET_SSE) + return 0; + + if (!warned) + { + warned = true; + warning ("SSE vector return without SSE enabled changes the ABI"); + } + return 1; + } } + + if (mode == TFmode) + return 0; + if (size > 12) + return 1; + return 0; } /* Define how to find the value returned by a library function @@ -2514,10 +2554,14 @@ static int ix86_value_regno (mode) enum machine_mode mode; { + /* Floating point return values in %st(0). */ if (GET_MODE_CLASS (mode) == MODE_FLOAT && TARGET_FLOAT_RETURNS_IN_80387) return FIRST_FLOAT_REG; - if (mode == TImode || VECTOR_MODE_P (mode)) + /* 16-byte vector modes in %xmm0. See ix86_return_in_memory for where + we prevent this case when sse is not available. */ + if (mode == TImode || (VECTOR_MODE_P (mode) && GET_MODE_SIZE (mode) == 16)) return FIRST_SSE_REG; + /* Everything else in %eax. */ return 0; } @@ -4230,7 +4274,7 @@ ix86_setup_frame_addresses () cfun->machine->accesses_prev_frame = 1; } -#if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY) +#if defined(HAVE_GAS_HIDDEN) && (defined(SUPPORTS_ONE_ONLY) && SUPPORTS_ONE_ONLY) # define USE_HIDDEN_LINKONCE 1 #else # define USE_HIDDEN_LINKONCE 0 @@ -6701,8 +6745,8 @@ get_some_local_dynamic_name_1 (px, data) C -- print opcode suffix for set/cmov insn. c -- like C, but print reversed condition F,f -- likewise, but for floating-point. - O -- if CMOV_SUN_AS_SYNTAX, expand to "w.", "l." or "q.", otherwise - nothing + O -- if HAVE_AS_IX86_CMOV_SUN_SYNTAX, expand to "w.", "l." or "q.", + otherwise nothing R -- print the prefix for register names. z -- print the opcode suffix for the size of the current operand. * -- print a star (in certain assembler syntax) @@ -6906,7 +6950,7 @@ print_operand (file, x, code) } return; case 'O': -#ifdef CMOV_SUN_AS_SYNTAX +#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX if (ASSEMBLER_DIALECT == ASM_ATT) { switch (GET_MODE (x)) @@ -6926,7 +6970,7 @@ print_operand (file, x, code) put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 0, 0, file); return; case 'F': -#ifdef CMOV_SUN_AS_SYNTAX +#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX if (ASSEMBLER_DIALECT == ASM_ATT) putc ('.', file); #endif @@ -6945,7 +6989,7 @@ print_operand (file, x, code) put_condition_code (GET_CODE (x), GET_MODE (XEXP (x, 0)), 1, 0, file); return; case 'f': -#ifdef CMOV_SUN_AS_SYNTAX +#ifdef HAVE_AS_IX86_CMOV_SUN_SYNTAX if (ASSEMBLER_DIALECT == ASM_ATT) putc ('.', file); #endif @@ -11147,10 +11191,15 @@ memory_address_length (addr) disp = parts.disp; len = 0; + /* Rule of thumb: + - esp as the base always wants an index, + - ebp as the base always wants a displacement. */ + /* Register Indirect. */ if (base && !index && !disp) { - /* Special cases: ebp and esp need the two-byte modrm form. */ + /* esp (for its index) and ebp (for its displacement) need + the two-byte modrm form. */ if (addr == stack_pointer_rtx || addr == arg_pointer_rtx || addr == frame_pointer_rtx @@ -11174,9 +11223,16 @@ memory_address_length (addr) else len = 4; } + /* ebp always wants a displacement. */ + else if (base == hard_frame_pointer_rtx) + len = 1; - /* An index requires the two-byte modrm form. */ - if (index) + /* An index requires the two-byte modrm form... */ + if (index + /* ...like esp, which always wants an index. */ + || base == stack_pointer_rtx + || base == arg_pointer_rtx + || base == frame_pointer_rtx) len += 1; } @@ -12066,25 +12122,20 @@ struct builtin_description const unsigned int flag; }; -/* Used for builtins that are enabled both by -msse and -msse2. */ -#define MASK_SSE1 (MASK_SSE | MASK_SSE2) -#define MASK_SSE164 (MASK_SSE | MASK_SSE2 | MASK_64BIT) -#define MASK_SSE264 (MASK_SSE2 | MASK_64BIT) - static const struct builtin_description bdesc_comi[] = { - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comieq", IX86_BUILTIN_COMIEQSS, UNEQ, 0 }, - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comilt", IX86_BUILTIN_COMILTSS, UNLT, 0 }, - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comile", IX86_BUILTIN_COMILESS, UNLE, 0 }, - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comigt", IX86_BUILTIN_COMIGTSS, GT, 0 }, - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comige", IX86_BUILTIN_COMIGESS, GE, 0 }, - { MASK_SSE1, CODE_FOR_sse_comi, "__builtin_ia32_comineq", IX86_BUILTIN_COMINEQSS, LTGT, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomieq", IX86_BUILTIN_UCOMIEQSS, UNEQ, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomilt", IX86_BUILTIN_UCOMILTSS, UNLT, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomile", IX86_BUILTIN_UCOMILESS, UNLE, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomigt", IX86_BUILTIN_UCOMIGTSS, GT, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomige", IX86_BUILTIN_UCOMIGESS, GE, 0 }, - { MASK_SSE1, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomineq", IX86_BUILTIN_UCOMINEQSS, LTGT, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comieq", IX86_BUILTIN_COMIEQSS, UNEQ, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comilt", IX86_BUILTIN_COMILTSS, UNLT, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comile", IX86_BUILTIN_COMILESS, UNLE, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comigt", IX86_BUILTIN_COMIGTSS, GT, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comige", IX86_BUILTIN_COMIGESS, GE, 0 }, + { MASK_SSE, CODE_FOR_sse_comi, "__builtin_ia32_comineq", IX86_BUILTIN_COMINEQSS, LTGT, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomieq", IX86_BUILTIN_UCOMIEQSS, UNEQ, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomilt", IX86_BUILTIN_UCOMILTSS, UNLT, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomile", IX86_BUILTIN_UCOMILESS, UNLE, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomigt", IX86_BUILTIN_UCOMIGTSS, GT, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomige", IX86_BUILTIN_UCOMIGESS, GE, 0 }, + { MASK_SSE, CODE_FOR_sse_ucomi, "__builtin_ia32_ucomineq", IX86_BUILTIN_UCOMINEQSS, LTGT, 0 }, { MASK_SSE2, CODE_FOR_sse2_comi, "__builtin_ia32_comisdeq", IX86_BUILTIN_COMIEQSD, UNEQ, 0 }, { MASK_SSE2, CODE_FOR_sse2_comi, "__builtin_ia32_comisdlt", IX86_BUILTIN_COMILTSD, UNLT, 0 }, { MASK_SSE2, CODE_FOR_sse2_comi, "__builtin_ia32_comisdle", IX86_BUILTIN_COMILESD, UNLE, 0 }, @@ -12102,51 +12153,51 @@ static const struct builtin_description bdesc_comi[] = static const struct builtin_description bdesc_2arg[] = { /* SSE */ - { MASK_SSE1, CODE_FOR_addv4sf3, "__builtin_ia32_addps", IX86_BUILTIN_ADDPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_subv4sf3, "__builtin_ia32_subps", IX86_BUILTIN_SUBPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_mulv4sf3, "__builtin_ia32_mulps", IX86_BUILTIN_MULPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_divv4sf3, "__builtin_ia32_divps", IX86_BUILTIN_DIVPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmaddv4sf3, "__builtin_ia32_addss", IX86_BUILTIN_ADDSS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmsubv4sf3, "__builtin_ia32_subss", IX86_BUILTIN_SUBSS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmmulv4sf3, "__builtin_ia32_mulss", IX86_BUILTIN_MULSS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmdivv4sf3, "__builtin_ia32_divss", IX86_BUILTIN_DIVSS, 0, 0 }, - - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpeqps", IX86_BUILTIN_CMPEQPS, EQ, 0 }, - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpltps", IX86_BUILTIN_CMPLTPS, LT, 0 }, - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpleps", IX86_BUILTIN_CMPLEPS, LE, 0 }, - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpgtps", IX86_BUILTIN_CMPGTPS, LT, 1 }, - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpgeps", IX86_BUILTIN_CMPGEPS, LE, 1 }, - { MASK_SSE1, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpunordps", IX86_BUILTIN_CMPUNORDPS, UNORDERED, 0 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpneqps", IX86_BUILTIN_CMPNEQPS, EQ, 0 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpnltps", IX86_BUILTIN_CMPNLTPS, LT, 0 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpnleps", IX86_BUILTIN_CMPNLEPS, LE, 0 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpngtps", IX86_BUILTIN_CMPNGTPS, LT, 1 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpngeps", IX86_BUILTIN_CMPNGEPS, LE, 1 }, - { MASK_SSE1, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpordps", IX86_BUILTIN_CMPORDPS, UNORDERED, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpeqss", IX86_BUILTIN_CMPEQSS, EQ, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpltss", IX86_BUILTIN_CMPLTSS, LT, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpless", IX86_BUILTIN_CMPLESS, LE, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpunordss", IX86_BUILTIN_CMPUNORDSS, UNORDERED, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpneqss", IX86_BUILTIN_CMPNEQSS, EQ, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpnltss", IX86_BUILTIN_CMPNLTSS, LT, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpnless", IX86_BUILTIN_CMPNLESS, LE, 0 }, - { MASK_SSE1, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpordss", IX86_BUILTIN_CMPORDSS, UNORDERED, 0 }, - - { MASK_SSE1, CODE_FOR_sminv4sf3, "__builtin_ia32_minps", IX86_BUILTIN_MINPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_smaxv4sf3, "__builtin_ia32_maxps", IX86_BUILTIN_MAXPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmsminv4sf3, "__builtin_ia32_minss", IX86_BUILTIN_MINSS, 0, 0 }, - { MASK_SSE1, CODE_FOR_vmsmaxv4sf3, "__builtin_ia32_maxss", IX86_BUILTIN_MAXSS, 0, 0 }, - - { MASK_SSE1, CODE_FOR_sse_andv4sf3, "__builtin_ia32_andps", IX86_BUILTIN_ANDPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_nandv4sf3, "__builtin_ia32_andnps", IX86_BUILTIN_ANDNPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_iorv4sf3, "__builtin_ia32_orps", IX86_BUILTIN_ORPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_xorv4sf3, "__builtin_ia32_xorps", IX86_BUILTIN_XORPS, 0, 0 }, - - { MASK_SSE1, CODE_FOR_sse_movss, "__builtin_ia32_movss", IX86_BUILTIN_MOVSS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_movhlps, "__builtin_ia32_movhlps", IX86_BUILTIN_MOVHLPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_movlhps, "__builtin_ia32_movlhps", IX86_BUILTIN_MOVLHPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_unpckhps, "__builtin_ia32_unpckhps", IX86_BUILTIN_UNPCKHPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_unpcklps, "__builtin_ia32_unpcklps", IX86_BUILTIN_UNPCKLPS, 0, 0 }, + { MASK_SSE, CODE_FOR_addv4sf3, "__builtin_ia32_addps", IX86_BUILTIN_ADDPS, 0, 0 }, + { MASK_SSE, CODE_FOR_subv4sf3, "__builtin_ia32_subps", IX86_BUILTIN_SUBPS, 0, 0 }, + { MASK_SSE, CODE_FOR_mulv4sf3, "__builtin_ia32_mulps", IX86_BUILTIN_MULPS, 0, 0 }, + { MASK_SSE, CODE_FOR_divv4sf3, "__builtin_ia32_divps", IX86_BUILTIN_DIVPS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmaddv4sf3, "__builtin_ia32_addss", IX86_BUILTIN_ADDSS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmsubv4sf3, "__builtin_ia32_subss", IX86_BUILTIN_SUBSS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmmulv4sf3, "__builtin_ia32_mulss", IX86_BUILTIN_MULSS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmdivv4sf3, "__builtin_ia32_divss", IX86_BUILTIN_DIVSS, 0, 0 }, + + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpeqps", IX86_BUILTIN_CMPEQPS, EQ, 0 }, + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpltps", IX86_BUILTIN_CMPLTPS, LT, 0 }, + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpleps", IX86_BUILTIN_CMPLEPS, LE, 0 }, + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpgtps", IX86_BUILTIN_CMPGTPS, LT, 1 }, + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpgeps", IX86_BUILTIN_CMPGEPS, LE, 1 }, + { MASK_SSE, CODE_FOR_maskcmpv4sf3, "__builtin_ia32_cmpunordps", IX86_BUILTIN_CMPUNORDPS, UNORDERED, 0 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpneqps", IX86_BUILTIN_CMPNEQPS, EQ, 0 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpnltps", IX86_BUILTIN_CMPNLTPS, LT, 0 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpnleps", IX86_BUILTIN_CMPNLEPS, LE, 0 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpngtps", IX86_BUILTIN_CMPNGTPS, LT, 1 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpngeps", IX86_BUILTIN_CMPNGEPS, LE, 1 }, + { MASK_SSE, CODE_FOR_maskncmpv4sf3, "__builtin_ia32_cmpordps", IX86_BUILTIN_CMPORDPS, UNORDERED, 0 }, + { MASK_SSE, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpeqss", IX86_BUILTIN_CMPEQSS, EQ, 0 }, + { MASK_SSE, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpltss", IX86_BUILTIN_CMPLTSS, LT, 0 }, + { MASK_SSE, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpless", IX86_BUILTIN_CMPLESS, LE, 0 }, + { MASK_SSE, CODE_FOR_vmmaskcmpv4sf3, "__builtin_ia32_cmpunordss", IX86_BUILTIN_CMPUNORDSS, UNORDERED, 0 }, + { MASK_SSE, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpneqss", IX86_BUILTIN_CMPNEQSS, EQ, 0 }, + { MASK_SSE, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpnltss", IX86_BUILTIN_CMPNLTSS, LT, 0 }, + { MASK_SSE, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpnless", IX86_BUILTIN_CMPNLESS, LE, 0 }, + { MASK_SSE, CODE_FOR_vmmaskncmpv4sf3, "__builtin_ia32_cmpordss", IX86_BUILTIN_CMPORDSS, UNORDERED, 0 }, + + { MASK_SSE, CODE_FOR_sminv4sf3, "__builtin_ia32_minps", IX86_BUILTIN_MINPS, 0, 0 }, + { MASK_SSE, CODE_FOR_smaxv4sf3, "__builtin_ia32_maxps", IX86_BUILTIN_MAXPS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmsminv4sf3, "__builtin_ia32_minss", IX86_BUILTIN_MINSS, 0, 0 }, + { MASK_SSE, CODE_FOR_vmsmaxv4sf3, "__builtin_ia32_maxss", IX86_BUILTIN_MAXSS, 0, 0 }, + + { MASK_SSE, CODE_FOR_sse_andv4sf3, "__builtin_ia32_andps", IX86_BUILTIN_ANDPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_nandv4sf3, "__builtin_ia32_andnps", IX86_BUILTIN_ANDNPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_iorv4sf3, "__builtin_ia32_orps", IX86_BUILTIN_ORPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_xorv4sf3, "__builtin_ia32_xorps", IX86_BUILTIN_XORPS, 0, 0 }, + + { MASK_SSE, CODE_FOR_sse_movss, "__builtin_ia32_movss", IX86_BUILTIN_MOVSS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_movhlps, "__builtin_ia32_movhlps", IX86_BUILTIN_MOVHLPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_movlhps, "__builtin_ia32_movlhps", IX86_BUILTIN_MOVLHPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_unpckhps, "__builtin_ia32_unpckhps", IX86_BUILTIN_UNPCKHPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_unpcklps, "__builtin_ia32_unpcklps", IX86_BUILTIN_UNPCKLPS, 0, 0 }, /* MMX */ { MASK_MMX, CODE_FOR_addv8qi3, "__builtin_ia32_paddb", IX86_BUILTIN_PADDB, 0, 0 }, @@ -12169,15 +12220,15 @@ static const struct builtin_description bdesc_2arg[] = { MASK_MMX, CODE_FOR_mulv4hi3, "__builtin_ia32_pmullw", IX86_BUILTIN_PMULLW, 0, 0 }, { MASK_MMX, CODE_FOR_smulv4hi3_highpart, "__builtin_ia32_pmulhw", IX86_BUILTIN_PMULHW, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_umulv4hi3_highpart, "__builtin_ia32_pmulhuw", IX86_BUILTIN_PMULHUW, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_umulv4hi3_highpart, "__builtin_ia32_pmulhuw", IX86_BUILTIN_PMULHUW, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_anddi3, "__builtin_ia32_pand", IX86_BUILTIN_PAND, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_nanddi3, "__builtin_ia32_pandn", IX86_BUILTIN_PANDN, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_iordi3, "__builtin_ia32_por", IX86_BUILTIN_POR, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_xordi3, "__builtin_ia32_pxor", IX86_BUILTIN_PXOR, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_mmx_uavgv8qi3, "__builtin_ia32_pavgb", IX86_BUILTIN_PAVGB, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_mmx_uavgv4hi3, "__builtin_ia32_pavgw", IX86_BUILTIN_PAVGW, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_uavgv8qi3, "__builtin_ia32_pavgb", IX86_BUILTIN_PAVGB, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_uavgv4hi3, "__builtin_ia32_pavgw", IX86_BUILTIN_PAVGW, 0, 0 }, { MASK_MMX, CODE_FOR_eqv8qi3, "__builtin_ia32_pcmpeqb", IX86_BUILTIN_PCMPEQB, 0, 0 }, { MASK_MMX, CODE_FOR_eqv4hi3, "__builtin_ia32_pcmpeqw", IX86_BUILTIN_PCMPEQW, 0, 0 }, @@ -12186,10 +12237,10 @@ static const struct builtin_description bdesc_2arg[] = { MASK_MMX, CODE_FOR_gtv4hi3, "__builtin_ia32_pcmpgtw", IX86_BUILTIN_PCMPGTW, 0, 0 }, { MASK_MMX, CODE_FOR_gtv2si3, "__builtin_ia32_pcmpgtd", IX86_BUILTIN_PCMPGTD, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_umaxv8qi3, "__builtin_ia32_pmaxub", IX86_BUILTIN_PMAXUB, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_smaxv4hi3, "__builtin_ia32_pmaxsw", IX86_BUILTIN_PMAXSW, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_uminv8qi3, "__builtin_ia32_pminub", IX86_BUILTIN_PMINUB, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_sminv4hi3, "__builtin_ia32_pminsw", IX86_BUILTIN_PMINSW, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_umaxv8qi3, "__builtin_ia32_pmaxub", IX86_BUILTIN_PMAXUB, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_smaxv4hi3, "__builtin_ia32_pmaxsw", IX86_BUILTIN_PMAXSW, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_uminv8qi3, "__builtin_ia32_pminub", IX86_BUILTIN_PMINUB, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_sminv4hi3, "__builtin_ia32_pminsw", IX86_BUILTIN_PMINSW, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_punpckhbw, "__builtin_ia32_punpckhbw", IX86_BUILTIN_PUNPCKHBW, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_punpckhwd, "__builtin_ia32_punpckhwd", IX86_BUILTIN_PUNPCKHWD, 0, 0 }, @@ -12203,9 +12254,9 @@ static const struct builtin_description bdesc_2arg[] = { MASK_MMX, CODE_FOR_mmx_packssdw, 0, IX86_BUILTIN_PACKSSDW, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_packuswb, 0, IX86_BUILTIN_PACKUSWB, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvtpi2ps, 0, IX86_BUILTIN_CVTPI2PS, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvtsi2ss, 0, IX86_BUILTIN_CVTSI2SS, 0, 0 }, - { MASK_SSE164, CODE_FOR_cvtsi2ssq, 0, IX86_BUILTIN_CVTSI642SS, 0, 0 }, + { MASK_SSE, CODE_FOR_cvtpi2ps, 0, IX86_BUILTIN_CVTPI2PS, 0, 0 }, + { MASK_SSE, CODE_FOR_cvtsi2ss, 0, IX86_BUILTIN_CVTSI2SS, 0, 0 }, + { MASK_SSE | MASK_64BIT, CODE_FOR_cvtsi2ssq, 0, IX86_BUILTIN_CVTSI642SS, 0, 0 }, { MASK_MMX, CODE_FOR_ashlv4hi3, 0, IX86_BUILTIN_PSLLW, 0, 0 }, { MASK_MMX, CODE_FOR_ashlv4hi3, 0, IX86_BUILTIN_PSLLWI, 0, 0 }, @@ -12226,7 +12277,7 @@ static const struct builtin_description bdesc_2arg[] = { MASK_MMX, CODE_FOR_ashrv2si3, 0, IX86_BUILTIN_PSRAD, 0, 0 }, { MASK_MMX, CODE_FOR_ashrv2si3, 0, IX86_BUILTIN_PSRADI, 0, 0 }, - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_mmx_psadbw, 0, IX86_BUILTIN_PSADBW, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_psadbw, 0, IX86_BUILTIN_PSADBW, 0, 0 }, { MASK_MMX, CODE_FOR_mmx_pmaddwd, 0, IX86_BUILTIN_PMADDWD, 0, 0 }, /* SSE2 */ @@ -12356,26 +12407,34 @@ static const struct builtin_description bdesc_2arg[] = { MASK_SSE2, CODE_FOR_sse2_pmaddwd, 0, IX86_BUILTIN_PMADDWD128, 0, 0 }, { MASK_SSE2, CODE_FOR_cvtsi2sd, 0, IX86_BUILTIN_CVTSI2SD, 0, 0 }, - { MASK_SSE264, CODE_FOR_cvtsi2sdq, 0, IX86_BUILTIN_CVTSI642SD, 0, 0 }, + { MASK_SSE2 | MASK_64BIT, CODE_FOR_cvtsi2sdq, 0, IX86_BUILTIN_CVTSI642SD, 0, 0 }, { MASK_SSE2, CODE_FOR_cvtsd2ss, 0, IX86_BUILTIN_CVTSD2SS, 0, 0 }, - { MASK_SSE2, CODE_FOR_cvtss2sd, 0, IX86_BUILTIN_CVTSS2SD, 0, 0 } + { MASK_SSE2, CODE_FOR_cvtss2sd, 0, IX86_BUILTIN_CVTSS2SD, 0, 0 }, + + /* PNI MMX */ + { MASK_PNI, CODE_FOR_addsubv4sf3, "__builtin_ia32_addsubps", IX86_BUILTIN_ADDSUBPS, 0, 0 }, + { MASK_PNI, CODE_FOR_addsubv2df3, "__builtin_ia32_addsubpd", IX86_BUILTIN_ADDSUBPD, 0, 0 }, + { MASK_PNI, CODE_FOR_haddv4sf3, "__builtin_ia32_haddps", IX86_BUILTIN_HADDPS, 0, 0 }, + { MASK_PNI, CODE_FOR_haddv2df3, "__builtin_ia32_haddpd", IX86_BUILTIN_HADDPD, 0, 0 }, + { MASK_PNI, CODE_FOR_hsubv4sf3, "__builtin_ia32_hsubps", IX86_BUILTIN_HSUBPS, 0, 0 }, + { MASK_PNI, CODE_FOR_hsubv2df3, "__builtin_ia32_hsubpd", IX86_BUILTIN_HSUBPD, 0, 0 } }; static const struct builtin_description bdesc_1arg[] = { - { MASK_SSE1 | MASK_3DNOW_A, CODE_FOR_mmx_pmovmskb, 0, IX86_BUILTIN_PMOVMSKB, 0, 0 }, - { MASK_SSE1, CODE_FOR_sse_movmskps, 0, IX86_BUILTIN_MOVMSKPS, 0, 0 }, + { MASK_SSE | MASK_3DNOW_A, CODE_FOR_mmx_pmovmskb, 0, IX86_BUILTIN_PMOVMSKB, 0, 0 }, + { MASK_SSE, CODE_FOR_sse_movmskps, 0, IX86_BUILTIN_MOVMSKPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_sqrtv4sf2, 0, IX86_BUILTIN_SQRTPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_rsqrtv4sf2, 0, IX86_BUILTIN_RSQRTPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_rcpv4sf2, 0, IX86_BUILTIN_RCPPS, 0, 0 }, + { MASK_SSE, CODE_FOR_sqrtv4sf2, 0, IX86_BUILTIN_SQRTPS, 0, 0 }, + { MASK_SSE, CODE_FOR_rsqrtv4sf2, 0, IX86_BUILTIN_RSQRTPS, 0, 0 }, + { MASK_SSE, CODE_FOR_rcpv4sf2, 0, IX86_BUILTIN_RCPPS, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvtps2pi, 0, IX86_BUILTIN_CVTPS2PI, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvtss2si, 0, IX86_BUILTIN_CVTSS2SI, 0, 0 }, - { MASK_SSE164, CODE_FOR_cvtss2siq, 0, IX86_BUILTIN_CVTSS2SI64, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvttps2pi, 0, IX86_BUILTIN_CVTTPS2PI, 0, 0 }, - { MASK_SSE1, CODE_FOR_cvttss2si, 0, IX86_BUILTIN_CVTTSS2SI, 0, 0 }, - { MASK_SSE164, CODE_FOR_cvttss2siq, 0, IX86_BUILTIN_CVTTSS2SI64, 0, 0 }, + { MASK_SSE, CODE_FOR_cvtps2pi, 0, IX86_BUILTIN_CVTPS2PI, 0, 0 }, + { MASK_SSE, CODE_FOR_cvtss2si, 0, IX86_BUILTIN_CVTSS2SI, 0, 0 }, + { MASK_SSE | MASK_64BIT, CODE_FOR_cvtss2siq, 0, IX86_BUILTIN_CVTSS2SI64, 0, 0 }, + { MASK_SSE, CODE_FOR_cvttps2pi, 0, IX86_BUILTIN_CVTTPS2PI, 0, 0 }, + { MASK_SSE, CODE_FOR_cvttss2si, 0, IX86_BUILTIN_CVTTSS2SI, 0, 0 }, + { MASK_SSE | MASK_64BIT, CODE_FOR_cvttss2siq, 0, IX86_BUILTIN_CVTTSS2SI64, 0, 0 }, { MASK_SSE2, CODE_FOR_sse2_pmovmskb, 0, IX86_BUILTIN_PMOVMSKB128, 0, 0 }, { MASK_SSE2, CODE_FOR_sse2_movmskpd, 0, IX86_BUILTIN_MOVMSKPD, 0, 0 }, @@ -12397,14 +12456,19 @@ static const struct builtin_description bdesc_1arg[] = { MASK_SSE2, CODE_FOR_cvtsd2si, 0, IX86_BUILTIN_CVTSD2SI, 0, 0 }, { MASK_SSE2, CODE_FOR_cvttsd2si, 0, IX86_BUILTIN_CVTTSD2SI, 0, 0 }, - { MASK_SSE264, CODE_FOR_cvtsd2siq, 0, IX86_BUILTIN_CVTSD2SI64, 0, 0 }, - { MASK_SSE264, CODE_FOR_cvttsd2siq, 0, IX86_BUILTIN_CVTTSD2SI64, 0, 0 }, + { MASK_SSE2 | MASK_64BIT, CODE_FOR_cvtsd2siq, 0, IX86_BUILTIN_CVTSD2SI64, 0, 0 }, + { MASK_SSE2 | MASK_64BIT, CODE_FOR_cvttsd2siq, 0, IX86_BUILTIN_CVTTSD2SI64, 0, 0 }, { MASK_SSE2, CODE_FOR_cvtps2dq, 0, IX86_BUILTIN_CVTPS2DQ, 0, 0 }, { MASK_SSE2, CODE_FOR_cvtps2pd, 0, IX86_BUILTIN_CVTPS2PD, 0, 0 }, { MASK_SSE2, CODE_FOR_cvttps2dq, 0, IX86_BUILTIN_CVTTPS2DQ, 0, 0 }, - { MASK_SSE2, CODE_FOR_sse2_movq, 0, IX86_BUILTIN_MOVQ, 0, 0 } + { MASK_SSE2, CODE_FOR_sse2_movq, 0, IX86_BUILTIN_MOVQ, 0, 0 }, + + /* PNI */ + { MASK_PNI, CODE_FOR_movshdup, 0, IX86_BUILTIN_MOVSHDUP, 0, 0 }, + { MASK_PNI, CODE_FOR_movsldup, 0, IX86_BUILTIN_MOVSLDUP, 0, 0 }, + { MASK_PNI, CODE_FOR_movddup, 0, IX86_BUILTIN_MOVDDUP, 0, 0 } }; void @@ -12495,6 +12559,13 @@ ix86_init_mmx_sse_builtins () = build_function_type (void_type_node, void_list_node); tree void_ftype_unsigned = build_function_type_list (void_type_node, unsigned_type_node, NULL_TREE); + tree void_ftype_unsigned_unsigned + = build_function_type_list (void_type_node, unsigned_type_node, + unsigned_type_node, NULL_TREE); + tree void_ftype_pcvoid_unsigned_unsigned + = build_function_type_list (void_type_node, const_ptr_type_node, + unsigned_type_node, unsigned_type_node, + NULL_TREE); tree unsigned_ftype_void = build_function_type (unsigned_type_node, void_list_node); tree di_ftype_void @@ -12813,52 +12884,52 @@ ix86_init_mmx_sse_builtins () def_builtin (MASK_MMX, "__builtin_ia32_packssdw", v4hi_ftype_v2si_v2si, IX86_BUILTIN_PACKSSDW); def_builtin (MASK_MMX, "__builtin_ia32_packuswb", v8qi_ftype_v4hi_v4hi, IX86_BUILTIN_PACKUSWB); - def_builtin (MASK_SSE1, "__builtin_ia32_ldmxcsr", void_ftype_unsigned, IX86_BUILTIN_LDMXCSR); - def_builtin (MASK_SSE1, "__builtin_ia32_stmxcsr", unsigned_ftype_void, IX86_BUILTIN_STMXCSR); - def_builtin (MASK_SSE1, "__builtin_ia32_cvtpi2ps", v4sf_ftype_v4sf_v2si, IX86_BUILTIN_CVTPI2PS); - def_builtin (MASK_SSE1, "__builtin_ia32_cvtps2pi", v2si_ftype_v4sf, IX86_BUILTIN_CVTPS2PI); - def_builtin (MASK_SSE1, "__builtin_ia32_cvtsi2ss", v4sf_ftype_v4sf_int, IX86_BUILTIN_CVTSI2SS); - def_builtin (MASK_SSE164, "__builtin_ia32_cvtsi642ss", v4sf_ftype_v4sf_int64, IX86_BUILTIN_CVTSI642SS); - def_builtin (MASK_SSE1, "__builtin_ia32_cvtss2si", int_ftype_v4sf, IX86_BUILTIN_CVTSS2SI); - def_builtin (MASK_SSE164, "__builtin_ia32_cvtss2si64", int64_ftype_v4sf, IX86_BUILTIN_CVTSS2SI64); - def_builtin (MASK_SSE1, "__builtin_ia32_cvttps2pi", v2si_ftype_v4sf, IX86_BUILTIN_CVTTPS2PI); - def_builtin (MASK_SSE1, "__builtin_ia32_cvttss2si", int_ftype_v4sf, IX86_BUILTIN_CVTTSS2SI); - def_builtin (MASK_SSE164, "__builtin_ia32_cvttss2si64", int64_ftype_v4sf, IX86_BUILTIN_CVTTSS2SI64); - - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_pextrw", int_ftype_v4hi_int, IX86_BUILTIN_PEXTRW); - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_pinsrw", v4hi_ftype_v4hi_int_int, IX86_BUILTIN_PINSRW); - - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_maskmovq", void_ftype_v8qi_v8qi_pchar, IX86_BUILTIN_MASKMOVQ); - - def_builtin (MASK_SSE1, "__builtin_ia32_loadaps", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADAPS); - def_builtin (MASK_SSE1, "__builtin_ia32_loadups", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADUPS); - def_builtin (MASK_SSE1, "__builtin_ia32_loadss", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADSS); - def_builtin (MASK_SSE1, "__builtin_ia32_storeaps", void_ftype_pfloat_v4sf, IX86_BUILTIN_STOREAPS); - def_builtin (MASK_SSE1, "__builtin_ia32_storeups", void_ftype_pfloat_v4sf, IX86_BUILTIN_STOREUPS); - def_builtin (MASK_SSE1, "__builtin_ia32_storess", void_ftype_pfloat_v4sf, IX86_BUILTIN_STORESS); - - def_builtin (MASK_SSE1, "__builtin_ia32_loadhps", v4sf_ftype_v4sf_pv2si, IX86_BUILTIN_LOADHPS); - def_builtin (MASK_SSE1, "__builtin_ia32_loadlps", v4sf_ftype_v4sf_pv2si, IX86_BUILTIN_LOADLPS); - def_builtin (MASK_SSE1, "__builtin_ia32_storehps", void_ftype_pv2si_v4sf, IX86_BUILTIN_STOREHPS); - def_builtin (MASK_SSE1, "__builtin_ia32_storelps", void_ftype_pv2si_v4sf, IX86_BUILTIN_STORELPS); - - def_builtin (MASK_SSE1, "__builtin_ia32_movmskps", int_ftype_v4sf, IX86_BUILTIN_MOVMSKPS); - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_pmovmskb", int_ftype_v8qi, IX86_BUILTIN_PMOVMSKB); - def_builtin (MASK_SSE1, "__builtin_ia32_movntps", void_ftype_pfloat_v4sf, IX86_BUILTIN_MOVNTPS); - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_movntq", void_ftype_pdi_di, IX86_BUILTIN_MOVNTQ); - - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_sfence", void_ftype_void, IX86_BUILTIN_SFENCE); - - def_builtin (MASK_SSE1 | MASK_3DNOW_A, "__builtin_ia32_psadbw", di_ftype_v8qi_v8qi, IX86_BUILTIN_PSADBW); - - def_builtin (MASK_SSE1, "__builtin_ia32_rcpps", v4sf_ftype_v4sf, IX86_BUILTIN_RCPPS); - def_builtin (MASK_SSE1, "__builtin_ia32_rcpss", v4sf_ftype_v4sf, IX86_BUILTIN_RCPSS); - def_builtin (MASK_SSE1, "__builtin_ia32_rsqrtps", v4sf_ftype_v4sf, IX86_BUILTIN_RSQRTPS); - def_builtin (MASK_SSE1, "__builtin_ia32_rsqrtss", v4sf_ftype_v4sf, IX86_BUILTIN_RSQRTSS); - def_builtin (MASK_SSE1, "__builtin_ia32_sqrtps", v4sf_ftype_v4sf, IX86_BUILTIN_SQRTPS); - def_builtin (MASK_SSE1, "__builtin_ia32_sqrtss", v4sf_ftype_v4sf, IX86_BUILTIN_SQRTSS); - - def_builtin (MASK_SSE1, "__builtin_ia32_shufps", v4sf_ftype_v4sf_v4sf_int, IX86_BUILTIN_SHUFPS); + def_builtin (MASK_SSE, "__builtin_ia32_ldmxcsr", void_ftype_unsigned, IX86_BUILTIN_LDMXCSR); + def_builtin (MASK_SSE, "__builtin_ia32_stmxcsr", unsigned_ftype_void, IX86_BUILTIN_STMXCSR); + def_builtin (MASK_SSE, "__builtin_ia32_cvtpi2ps", v4sf_ftype_v4sf_v2si, IX86_BUILTIN_CVTPI2PS); + def_builtin (MASK_SSE, "__builtin_ia32_cvtps2pi", v2si_ftype_v4sf, IX86_BUILTIN_CVTPS2PI); + def_builtin (MASK_SSE, "__builtin_ia32_cvtsi2ss", v4sf_ftype_v4sf_int, IX86_BUILTIN_CVTSI2SS); + def_builtin (MASK_SSE | MASK_64BIT, "__builtin_ia32_cvtsi642ss", v4sf_ftype_v4sf_int64, IX86_BUILTIN_CVTSI642SS); + def_builtin (MASK_SSE, "__builtin_ia32_cvtss2si", int_ftype_v4sf, IX86_BUILTIN_CVTSS2SI); + def_builtin (MASK_SSE | MASK_64BIT, "__builtin_ia32_cvtss2si64", int64_ftype_v4sf, IX86_BUILTIN_CVTSS2SI64); + def_builtin (MASK_SSE, "__builtin_ia32_cvttps2pi", v2si_ftype_v4sf, IX86_BUILTIN_CVTTPS2PI); + def_builtin (MASK_SSE, "__builtin_ia32_cvttss2si", int_ftype_v4sf, IX86_BUILTIN_CVTTSS2SI); + def_builtin (MASK_SSE | MASK_64BIT, "__builtin_ia32_cvttss2si64", int64_ftype_v4sf, IX86_BUILTIN_CVTTSS2SI64); + + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_pextrw", int_ftype_v4hi_int, IX86_BUILTIN_PEXTRW); + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_pinsrw", v4hi_ftype_v4hi_int_int, IX86_BUILTIN_PINSRW); + + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_maskmovq", void_ftype_v8qi_v8qi_pchar, IX86_BUILTIN_MASKMOVQ); + + def_builtin (MASK_SSE, "__builtin_ia32_loadaps", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADAPS); + def_builtin (MASK_SSE, "__builtin_ia32_loadups", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADUPS); + def_builtin (MASK_SSE, "__builtin_ia32_loadss", v4sf_ftype_pcfloat, IX86_BUILTIN_LOADSS); + def_builtin (MASK_SSE, "__builtin_ia32_storeaps", void_ftype_pfloat_v4sf, IX86_BUILTIN_STOREAPS); + def_builtin (MASK_SSE, "__builtin_ia32_storeups", void_ftype_pfloat_v4sf, IX86_BUILTIN_STOREUPS); + def_builtin (MASK_SSE, "__builtin_ia32_storess", void_ftype_pfloat_v4sf, IX86_BUILTIN_STORESS); + + def_builtin (MASK_SSE, "__builtin_ia32_loadhps", v4sf_ftype_v4sf_pv2si, IX86_BUILTIN_LOADHPS); + def_builtin (MASK_SSE, "__builtin_ia32_loadlps", v4sf_ftype_v4sf_pv2si, IX86_BUILTIN_LOADLPS); + def_builtin (MASK_SSE, "__builtin_ia32_storehps", void_ftype_pv2si_v4sf, IX86_BUILTIN_STOREHPS); + def_builtin (MASK_SSE, "__builtin_ia32_storelps", void_ftype_pv2si_v4sf, IX86_BUILTIN_STORELPS); + + def_builtin (MASK_SSE, "__builtin_ia32_movmskps", int_ftype_v4sf, IX86_BUILTIN_MOVMSKPS); + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_pmovmskb", int_ftype_v8qi, IX86_BUILTIN_PMOVMSKB); + def_builtin (MASK_SSE, "__builtin_ia32_movntps", void_ftype_pfloat_v4sf, IX86_BUILTIN_MOVNTPS); + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_movntq", void_ftype_pdi_di, IX86_BUILTIN_MOVNTQ); + + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_sfence", void_ftype_void, IX86_BUILTIN_SFENCE); + + def_builtin (MASK_SSE | MASK_3DNOW_A, "__builtin_ia32_psadbw", di_ftype_v8qi_v8qi, IX86_BUILTIN_PSADBW); + + def_builtin (MASK_SSE, "__builtin_ia32_rcpps", v4sf_ftype_v4sf, IX86_BUILTIN_RCPPS); + def_builtin (MASK_SSE, "__builtin_ia32_rcpss", v4sf_ftype_v4sf, IX86_BUILTIN_RCPSS); + def_builtin (MASK_SSE, "__builtin_ia32_rsqrtps", v4sf_ftype_v4sf, IX86_BUILTIN_RSQRTPS); + def_builtin (MASK_SSE, "__builtin_ia32_rsqrtss", v4sf_ftype_v4sf, IX86_BUILTIN_RSQRTSS); + def_builtin (MASK_SSE, "__builtin_ia32_sqrtps", v4sf_ftype_v4sf, IX86_BUILTIN_SQRTPS); + def_builtin (MASK_SSE, "__builtin_ia32_sqrtss", v4sf_ftype_v4sf, IX86_BUILTIN_SQRTSS); + + def_builtin (MASK_SSE, "__builtin_ia32_shufps", v4sf_ftype_v4sf_v4sf_int, IX86_BUILTIN_SHUFPS); /* Original 3DNow! */ def_builtin (MASK_3DNOW, "__builtin_ia32_femms", void_ftype_void, IX86_BUILTIN_FEMMS); @@ -12890,7 +12961,7 @@ ix86_init_mmx_sse_builtins () def_builtin (MASK_3DNOW_A, "__builtin_ia32_pswapdsf", v2sf_ftype_v2sf, IX86_BUILTIN_PSWAPDSF); def_builtin (MASK_3DNOW_A, "__builtin_ia32_pswapdsi", v2si_ftype_v2si, IX86_BUILTIN_PSWAPDSI); - def_builtin (MASK_SSE1, "__builtin_ia32_setzerops", v4sf_ftype_void, IX86_BUILTIN_SSE_ZERO); + def_builtin (MASK_SSE, "__builtin_ia32_setzerops", v4sf_ftype_void, IX86_BUILTIN_SSE_ZERO); /* SSE2 */ def_builtin (MASK_SSE2, "__builtin_ia32_pextrw128", int_ftype_v8hi_int, IX86_BUILTIN_PEXTRW128); @@ -12941,15 +13012,15 @@ ix86_init_mmx_sse_builtins () def_builtin (MASK_SSE2, "__builtin_ia32_cvtsd2si", int_ftype_v2df, IX86_BUILTIN_CVTSD2SI); def_builtin (MASK_SSE2, "__builtin_ia32_cvttsd2si", int_ftype_v2df, IX86_BUILTIN_CVTTSD2SI); - def_builtin (MASK_SSE264, "__builtin_ia32_cvtsd2si64", int64_ftype_v2df, IX86_BUILTIN_CVTSD2SI64); - def_builtin (MASK_SSE264, "__builtin_ia32_cvttsd2si64", int64_ftype_v2df, IX86_BUILTIN_CVTTSD2SI64); + def_builtin (MASK_SSE2 | MASK_64BIT, "__builtin_ia32_cvtsd2si64", int64_ftype_v2df, IX86_BUILTIN_CVTSD2SI64); + def_builtin (MASK_SSE2 | MASK_64BIT, "__builtin_ia32_cvttsd2si64", int64_ftype_v2df, IX86_BUILTIN_CVTTSD2SI64); def_builtin (MASK_SSE2, "__builtin_ia32_cvtps2dq", v4si_ftype_v4sf, IX86_BUILTIN_CVTPS2DQ); def_builtin (MASK_SSE2, "__builtin_ia32_cvtps2pd", v2df_ftype_v4sf, IX86_BUILTIN_CVTPS2PD); def_builtin (MASK_SSE2, "__builtin_ia32_cvttps2dq", v4si_ftype_v4sf, IX86_BUILTIN_CVTTPS2DQ); def_builtin (MASK_SSE2, "__builtin_ia32_cvtsi2sd", v2df_ftype_v2df_int, IX86_BUILTIN_CVTSI2SD); - def_builtin (MASK_SSE264, "__builtin_ia32_cvtsi642sd", v2df_ftype_v2df_int64, IX86_BUILTIN_CVTSI642SD); + def_builtin (MASK_SSE2 | MASK_64BIT, "__builtin_ia32_cvtsi642sd", v2df_ftype_v2df_int64, IX86_BUILTIN_CVTSI642SD); def_builtin (MASK_SSE2, "__builtin_ia32_cvtsd2ss", v4sf_ftype_v4sf_v2df, IX86_BUILTIN_CVTSD2SS); def_builtin (MASK_SSE2, "__builtin_ia32_cvtss2sd", v2df_ftype_v2df_v4sf, IX86_BUILTIN_CVTSS2SD); @@ -12973,7 +13044,7 @@ ix86_init_mmx_sse_builtins () def_builtin (MASK_SSE2, "__builtin_ia32_stored", void_ftype_pcint_v4si, IX86_BUILTIN_STORED); def_builtin (MASK_SSE2, "__builtin_ia32_movq", v2di_ftype_v2di, IX86_BUILTIN_MOVQ); - def_builtin (MASK_SSE1, "__builtin_ia32_setzero128", v2di_ftype_void, IX86_BUILTIN_CLRTI); + def_builtin (MASK_SSE, "__builtin_ia32_setzero128", v2di_ftype_void, IX86_BUILTIN_CLRTI); def_builtin (MASK_SSE2, "__builtin_ia32_psllw128", v8hi_ftype_v8hi_v2di, IX86_BUILTIN_PSLLW128); def_builtin (MASK_SSE2, "__builtin_ia32_pslld128", v4si_ftype_v4si_v2di, IX86_BUILTIN_PSLLD128); @@ -13000,6 +13071,26 @@ ix86_init_mmx_sse_builtins () def_builtin (MASK_SSE2, "__builtin_ia32_psradi128", v4si_ftype_v4si_int, IX86_BUILTIN_PSRADI128); def_builtin (MASK_SSE2, "__builtin_ia32_pmaddwd128", v4si_ftype_v8hi_v8hi, IX86_BUILTIN_PMADDWD128); + + /* Prescott New Instructions. */ + def_builtin (MASK_PNI, "__builtin_ia32_monitor", + void_ftype_pcvoid_unsigned_unsigned, + IX86_BUILTIN_MONITOR); + def_builtin (MASK_PNI, "__builtin_ia32_mwait", + void_ftype_unsigned_unsigned, + IX86_BUILTIN_MWAIT); + def_builtin (MASK_PNI, "__builtin_ia32_movshdup", + v4sf_ftype_v4sf, + IX86_BUILTIN_MOVSHDUP); + def_builtin (MASK_PNI, "__builtin_ia32_movsldup", + v4sf_ftype_v4sf, + IX86_BUILTIN_MOVSLDUP); + def_builtin (MASK_PNI, "__builtin_ia32_lddqu", + v16qi_ftype_pcchar, IX86_BUILTIN_LDDQU); + def_builtin (MASK_PNI, "__builtin_ia32_loadddup", + v2df_ftype_pcdouble, IX86_BUILTIN_LOADDDUP); + def_builtin (MASK_PNI, "__builtin_ia32_movddup", + v2df_ftype_v2df, IX86_BUILTIN_MOVDDUP); } /* Errors in the source file can cause expand_expr to return const0_rtx @@ -13808,6 +13899,41 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore) case IX86_BUILTIN_STORED: return ix86_expand_store_builtin (CODE_FOR_sse2_stored, arglist); + case IX86_BUILTIN_MONITOR: + arg0 = TREE_VALUE (arglist); + arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0); + op2 = expand_expr (arg2, NULL_RTX, VOIDmode, 0); + if (!REG_P (op0)) + op0 = copy_to_mode_reg (SImode, op0); + if (!REG_P (op1)) + op1 = copy_to_mode_reg (SImode, op1); + if (!REG_P (op2)) + op2 = copy_to_mode_reg (SImode, op2); + emit_insn (gen_monitor (op0, op1, op2)); + return 0; + + case IX86_BUILTIN_MWAIT: + arg0 = TREE_VALUE (arglist); + arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); + op1 = expand_expr (arg1, NULL_RTX, VOIDmode, 0); + if (!REG_P (op0)) + op0 = copy_to_mode_reg (SImode, op0); + if (!REG_P (op1)) + op1 = copy_to_mode_reg (SImode, op1); + emit_insn (gen_mwait (op0, op1)); + return 0; + + case IX86_BUILTIN_LOADDDUP: + return ix86_expand_unop_builtin (CODE_FOR_loadddup, arglist, target, 1); + + case IX86_BUILTIN_LDDQU: + return ix86_expand_unop_builtin (CODE_FOR_lddqu, arglist, target, + 1); + default: break; } diff --git a/contrib/gcc/config/i386/i386.h b/contrib/gcc/config/i386/i386.h index ead133bfb62a..32bc5d0252ee 100644 --- a/contrib/gcc/config/i386/i386.h +++ b/contrib/gcc/config/i386/i386.h @@ -114,10 +114,11 @@ extern int target_flags; #define MASK_MMX 0x00002000 /* Support MMX regs/builtins */ #define MASK_SSE 0x00004000 /* Support SSE regs/builtins */ #define MASK_SSE2 0x00008000 /* Support SSE2 regs/builtins */ -#define MASK_3DNOW 0x00010000 /* Support 3Dnow builtins */ -#define MASK_3DNOW_A 0x00020000 /* Support Athlon 3Dnow builtins */ -#define MASK_128BIT_LONG_DOUBLE 0x00040000 /* long double size is 128bit */ -#define MASK_64BIT 0x00080000 /* Produce 64bit code */ +#define MASK_PNI 0x00010000 /* Support PNI builtins */ +#define MASK_3DNOW 0x00020000 /* Support 3Dnow builtins */ +#define MASK_3DNOW_A 0x00040000 /* Support Athlon 3Dnow builtins */ +#define MASK_128BIT_LONG_DOUBLE 0x00080000 /* long double size is 128bit */ +#define MASK_64BIT 0x00100000 /* Produce 64bit code */ /* Unused: 0x03f0000 */ @@ -271,8 +272,9 @@ extern int x86_prefetch_sse; #define ASSEMBLER_DIALECT (ix86_asm_dialect) -#define TARGET_SSE ((target_flags & (MASK_SSE | MASK_SSE2)) != 0) +#define TARGET_SSE ((target_flags & MASK_SSE) != 0) #define TARGET_SSE2 ((target_flags & MASK_SSE2) != 0) +#define TARGET_PNI ((target_flags & MASK_PNI) != 0) #define TARGET_SSE_MATH ((ix86_fpmath & FPMATH_SSE) != 0) #define TARGET_MIX_SSE_I387 ((ix86_fpmath & FPMATH_SSE) \ && (ix86_fpmath & FPMATH_387)) @@ -366,6 +368,10 @@ extern int x86_prefetch_sse; N_("Support MMX, SSE and SSE2 built-in functions and code generation") }, \ { "no-sse2", -MASK_SSE2, \ N_("Do not support MMX, SSE and SSE2 built-in functions and code generation") }, \ + { "pni", MASK_PNI, \ + N_("Support MMX, SSE, SSE2 and PNI built-in functions and code generation") }, \ + { "no-pni", -MASK_PNI, \ + N_("Do not support MMX, SSE, SSE2 and PNI built-in functions and code generation") }, \ { "128bit-long-double", MASK_128BIT_LONG_DOUBLE, \ N_("sizeof(long double) is 16") }, \ { "96bit-long-double", -MASK_128BIT_LONG_DOUBLE, \ @@ -554,6 +560,8 @@ extern int x86_prefetch_sse; builtin_define ("__SSE__"); \ if (TARGET_SSE2) \ builtin_define ("__SSE2__"); \ + if (TARGET_PNI) \ + builtin_define ("__PNI__"); \ if (TARGET_SSE_MATH && TARGET_SSE) \ builtin_define ("__SSE_MATH__"); \ if (TARGET_SSE_MATH && TARGET_SSE2) \ @@ -2480,6 +2488,22 @@ enum ix86_builtins IX86_BUILTIN_MFENCE, IX86_BUILTIN_LFENCE, + /* Prescott New Instructions. */ + IX86_BUILTIN_ADDSUBPS, + IX86_BUILTIN_HADDPS, + IX86_BUILTIN_HSUBPS, + IX86_BUILTIN_MOVSHDUP, + IX86_BUILTIN_MOVSLDUP, + IX86_BUILTIN_ADDSUBPD, + IX86_BUILTIN_HADDPD, + IX86_BUILTIN_HSUBPD, + IX86_BUILTIN_LOADDDUP, + IX86_BUILTIN_MOVDDUP, + IX86_BUILTIN_LDDQU, + + IX86_BUILTIN_MONITOR, + IX86_BUILTIN_MWAIT, + IX86_BUILTIN_MAX }; diff --git a/contrib/gcc/config/i386/i386.md b/contrib/gcc/config/i386/i386.md index 1fa29985fb9a..e4377a5b0a57 100644 --- a/contrib/gcc/config/i386/i386.md +++ b/contrib/gcc/config/i386/i386.md @@ -110,6 +110,13 @@ (UNSPEC_MFENCE 59) (UNSPEC_LFENCE 60) (UNSPEC_PSADBW 61) + (UNSPEC_ADDSUB 71) + (UNSPEC_HADD 72) + (UNSPEC_HSUB 73) + (UNSPEC_MOVSHDUP 74) + (UNSPEC_MOVSLDUP 75) + (UNSPEC_LDQQU 76) + (UNSPEC_MOVDDUP 77) ]) (define_constants @@ -120,6 +127,8 @@ (UNSPECV_STMXCSR 40) (UNSPECV_FEMMS 46) (UNSPECV_CLFLUSH 57) + (UNSPECV_MONITOR 69) + (UNSPECV_MWAIT 70) ]) ;; Insns whose names begin with "x86_" are emitted by gen_FOO calls @@ -22072,3 +22081,129 @@ "lfence" [(set_attr "type" "sse") (set_attr "memory" "unknown")]) + +;; PNI + +(define_insn "mwait" + [(unspec_volatile [(match_operand:SI 0 "register_operand" "a") + (match_operand:SI 1 "register_operand" "c")] + UNSPECV_MWAIT)] + "TARGET_PNI" + "mwait\t%0, %1" + [(set_attr "length" "3")]) + +(define_insn "monitor" + [(unspec_volatile [(match_operand:SI 0 "register_operand" "a") + (match_operand:SI 1 "register_operand" "c") + (match_operand:SI 2 "register_operand" "d")] + UNSPECV_MONITOR)] + "TARGET_PNI" + "monitor\t%0, %1, %2" + [(set_attr "length" "3")]) + +;; PNI arithmetic + +(define_insn "addsubv4sf3" + [(set (match_operand:V4SF 0 "register_operand" "=x") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") + (match_operand:V4SF 2 "nonimmediate_operand" "xm")] + UNSPEC_ADDSUB))] + "TARGET_PNI" + "addsubps\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V4SF")]) + +(define_insn "addsubv2df3" + [(set (match_operand:V2DF 0 "register_operand" "=x") + (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") + (match_operand:V2DF 2 "nonimmediate_operand" "xm")] + UNSPEC_ADDSUB))] + "TARGET_PNI" + "addsubpd\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V2DF")]) + +(define_insn "haddv4sf3" + [(set (match_operand:V4SF 0 "register_operand" "=x") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") + (match_operand:V4SF 2 "nonimmediate_operand" "xm")] + UNSPEC_HADD))] + "TARGET_PNI" + "haddps\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V4SF")]) + +(define_insn "haddv2df3" + [(set (match_operand:V2DF 0 "register_operand" "=x") + (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") + (match_operand:V2DF 2 "nonimmediate_operand" "xm")] + UNSPEC_HADD))] + "TARGET_PNI" + "haddpd\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V2DF")]) + +(define_insn "hsubv4sf3" + [(set (match_operand:V4SF 0 "register_operand" "=x") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "0") + (match_operand:V4SF 2 "nonimmediate_operand" "xm")] + UNSPEC_HSUB))] + "TARGET_PNI" + "hsubps\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V4SF")]) + +(define_insn "hsubv2df3" + [(set (match_operand:V2DF 0 "register_operand" "=x") + (unspec:V2DF [(match_operand:V2DF 1 "register_operand" "0") + (match_operand:V2DF 2 "nonimmediate_operand" "xm")] + UNSPEC_HSUB))] + "TARGET_PNI" + "hsubpd\t{%2, %0|%0, %2}" + [(set_attr "type" "sseadd") + (set_attr "mode" "V2DF")]) + +(define_insn "movshdup" + [(set (match_operand:V4SF 0 "register_operand" "=x") + (unspec:V4SF + [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSHDUP))] + "TARGET_PNI" + "movshdup\t{%1, %0|%0, %1}" + [(set_attr "type" "sse") + (set_attr "mode" "V4SF")]) + +(define_insn "movsldup" + [(set (match_operand:V4SF 0 "register_operand" "=x") + (unspec:V4SF + [(match_operand:V4SF 1 "nonimmediate_operand" "xm")] UNSPEC_MOVSLDUP))] + "TARGET_PNI" + "movsldup\t{%1, %0|%0, %1}" + [(set_attr "type" "sse") + (set_attr "mode" "V4SF")]) + +(define_insn "lddqu" + [(set (match_operand:V16QI 0 "register_operand" "=x") + (unspec:V16QI [(match_operand:V16QI 1 "memory_operand" "m")] + UNSPEC_LDQQU))] + "TARGET_PNI" + "lddqu\t{%1, %0|%0, %1}" + [(set_attr "type" "ssecvt") + (set_attr "mode" "TI")]) + +(define_insn "loadddup" + [(set (match_operand:V2DF 0 "register_operand" "=x") + (vec_duplicate:V2DF (match_operand:DF 1 "memory_operand" "m")))] + "TARGET_PNI" + "movddup\t{%1, %0|%0, %1}" + [(set_attr "type" "ssecvt") + (set_attr "mode" "DF")]) + +(define_insn "movddup" + [(set (match_operand:V2DF 0 "register_operand" "=x") + (vec_duplicate:V2DF + (vec_select:DF (match_operand:V2DF 1 "register_operand" "x") + (parallel [(const_int 0)]))))] + "TARGET_PNI" + "movddup\t{%1, %0|%0, %1}" + [(set_attr "type" "ssecvt") + (set_attr "mode" "DF")]) diff --git a/contrib/gcc/config/i386/mmintrin.h b/contrib/gcc/config/i386/mmintrin.h index 7b4aa0146458..00e77e454a47 100644 --- a/contrib/gcc/config/i386/mmintrin.h +++ b/contrib/gcc/config/i386/mmintrin.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU CC. @@ -25,7 +25,7 @@ Public License. */ /* Implemented from the specification included in the Intel C++ Compiler - User Guide and Reference, version 5.0. */ + User Guide and Reference, version 8.0. */ #ifndef _MMINTRIN_H_INCLUDED #define _MMINTRIN_H_INCLUDED @@ -48,6 +48,12 @@ _mm_empty (void) __builtin_ia32_emms (); } +static __inline void +_m_empty (void) +{ + _mm_empty (); +} + /* Convert I to a __m64 object. The integer is zero-extended to 64-bits. */ static __inline __m64 _mm_cvtsi32_si64 (int __i) @@ -56,6 +62,12 @@ _mm_cvtsi32_si64 (int __i) return (__m64) __tmp; } +static __inline __m64 +_m_from_int (int __i) +{ + return _mm_cvtsi32_si64 (__i); +} + #ifdef __x86_64__ /* Convert I to a __m64 object. */ static __inline __m64 @@ -80,6 +92,12 @@ _mm_cvtsi64_si32 (__m64 __i) return __tmp; } +static __inline int +_m_to_int (__m64 __i) +{ + return _mm_cvtsi64_si32 (__i); +} + #ifdef __x86_64__ /* Convert the lower 32 bits of the __m64 object into an integer. */ static __inline long long @@ -98,6 +116,12 @@ _mm_packs_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_packsswb (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pi16 (__m1, __m2); +} + /* Pack the two 32-bit values from M1 in to the lower two 16-bit values of the result, and the two 32-bit values from M2 into the upper two 16-bit values of the result, all with signed saturation. */ @@ -107,6 +131,12 @@ _mm_packs_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_packssdw (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pi32 (__m1, __m2); +} + /* Pack the four 16-bit values from M1 into the lower four 8-bit values of the result, and the four 16-bit values from M2 into the upper four 8-bit values of the result, all with unsigned saturation. */ @@ -116,6 +146,12 @@ _mm_packs_pu16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_packuswb (__m64 __m1, __m64 __m2) +{ + return _mm_packs_pu16 (__m1, __m2); +} + /* Interleave the four 8-bit values from the high half of M1 with the four 8-bit values from the high half of M2. */ static __inline __m64 @@ -124,6 +160,12 @@ _mm_unpackhi_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpckhbw ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_punpckhbw (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi8 (__m1, __m2); +} + /* Interleave the two 16-bit values from the high half of M1 with the two 16-bit values from the high half of M2. */ static __inline __m64 @@ -132,6 +174,12 @@ _mm_unpackhi_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpckhwd ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_punpckhwd (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi16 (__m1, __m2); +} + /* Interleave the 32-bit value from the high half of M1 with the 32-bit value from the high half of M2. */ static __inline __m64 @@ -140,6 +188,12 @@ _mm_unpackhi_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpckhdq ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_punpckhdq (__m64 __m1, __m64 __m2) +{ + return _mm_unpackhi_pi32 (__m1, __m2); +} + /* Interleave the four 8-bit values from the low half of M1 with the four 8-bit values from the low half of M2. */ static __inline __m64 @@ -148,6 +202,12 @@ _mm_unpacklo_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpcklbw ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_punpcklbw (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi8 (__m1, __m2); +} + /* Interleave the two 16-bit values from the low half of M1 with the two 16-bit values from the low half of M2. */ static __inline __m64 @@ -156,6 +216,12 @@ _mm_unpacklo_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpcklwd ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_punpcklwd (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi16 (__m1, __m2); +} + /* Interleave the 32-bit value from the low half of M1 with the 32-bit value from the low half of M2. */ static __inline __m64 @@ -164,6 +230,12 @@ _mm_unpacklo_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_punpckldq ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_punpckldq (__m64 __m1, __m64 __m2) +{ + return _mm_unpacklo_pi32 (__m1, __m2); +} + /* Add the 8-bit values in M1 to the 8-bit values in M2. */ static __inline __m64 _mm_add_pi8 (__m64 __m1, __m64 __m2) @@ -171,6 +243,12 @@ _mm_add_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_paddb (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi8 (__m1, __m2); +} + /* Add the 16-bit values in M1 to the 16-bit values in M2. */ static __inline __m64 _mm_add_pi16 (__m64 __m1, __m64 __m2) @@ -178,6 +256,12 @@ _mm_add_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_paddw (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi16 (__m1, __m2); +} + /* Add the 32-bit values in M1 to the 32-bit values in M2. */ static __inline __m64 _mm_add_pi32 (__m64 __m1, __m64 __m2) @@ -185,6 +269,12 @@ _mm_add_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddd ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_paddd (__m64 __m1, __m64 __m2) +{ + return _mm_add_pi32 (__m1, __m2); +} + /* Add the 64-bit values in M1 to the 64-bit values in M2. */ static __inline __m64 _mm_add_si64 (__m64 __m1, __m64 __m2) @@ -200,6 +290,12 @@ _mm_adds_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddsb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_paddsb (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pi8 (__m1, __m2); +} + /* Add the 16-bit values in M1 to the 16-bit values in M2 using signed saturated arithmetic. */ static __inline __m64 @@ -208,6 +304,12 @@ _mm_adds_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddsw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_paddsw (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pi16 (__m1, __m2); +} + /* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned saturated arithmetic. */ static __inline __m64 @@ -216,6 +318,12 @@ _mm_adds_pu8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddusb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_paddusb (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pu8 (__m1, __m2); +} + /* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned saturated arithmetic. */ static __inline __m64 @@ -224,6 +332,12 @@ _mm_adds_pu16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_paddusw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_paddusw (__m64 __m1, __m64 __m2) +{ + return _mm_adds_pu16 (__m1, __m2); +} + /* Subtract the 8-bit values in M2 from the 8-bit values in M1. */ static __inline __m64 _mm_sub_pi8 (__m64 __m1, __m64 __m2) @@ -231,6 +345,12 @@ _mm_sub_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_psubb (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi8 (__m1, __m2); +} + /* Subtract the 16-bit values in M2 from the 16-bit values in M1. */ static __inline __m64 _mm_sub_pi16 (__m64 __m1, __m64 __m2) @@ -238,6 +358,12 @@ _mm_sub_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_psubw (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi16 (__m1, __m2); +} + /* Subtract the 32-bit values in M2 from the 32-bit values in M1. */ static __inline __m64 _mm_sub_pi32 (__m64 __m1, __m64 __m2) @@ -245,6 +371,12 @@ _mm_sub_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubd ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_psubd (__m64 __m1, __m64 __m2) +{ + return _mm_sub_pi32 (__m1, __m2); +} + /* Add the 64-bit values in M1 to the 64-bit values in M2. */ static __inline __m64 _mm_sub_si64 (__m64 __m1, __m64 __m2) @@ -260,6 +392,12 @@ _mm_subs_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubsb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_psubsb (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pi8 (__m1, __m2); +} + /* Subtract the 16-bit values in M2 from the 16-bit values in M1 using signed saturating arithmetic. */ static __inline __m64 @@ -268,6 +406,12 @@ _mm_subs_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubsw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_psubsw (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pi16 (__m1, __m2); +} + /* Subtract the 8-bit values in M2 from the 8-bit values in M1 using unsigned saturating arithmetic. */ static __inline __m64 @@ -276,6 +420,12 @@ _mm_subs_pu8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubusb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_psubusb (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pu8 (__m1, __m2); +} + /* Subtract the 16-bit values in M2 from the 16-bit values in M1 using unsigned saturating arithmetic. */ static __inline __m64 @@ -284,6 +434,12 @@ _mm_subs_pu16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_psubusw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_psubusw (__m64 __m1, __m64 __m2) +{ + return _mm_subs_pu16 (__m1, __m2); +} + /* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing four 32-bit intermediate results, which are then summed by pairs to produce two 32-bit results. */ @@ -293,6 +449,12 @@ _mm_madd_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pmaddwd ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_pmaddwd (__m64 __m1, __m64 __m2) +{ + return _mm_madd_pi16 (__m1, __m2); +} + /* Multiply four signed 16-bit values in M1 by four signed 16-bit values in M2 and produce the high 16 bits of the 32-bit results. */ static __inline __m64 @@ -301,6 +463,12 @@ _mm_mulhi_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pmulhw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_pmulhw (__m64 __m1, __m64 __m2) +{ + return _mm_mulhi_pi16 (__m1, __m2); +} + /* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce the low 16 bits of the results. */ static __inline __m64 @@ -309,6 +477,12 @@ _mm_mullo_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pmullw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_pmullw (__m64 __m1, __m64 __m2) +{ + return _mm_mullo_pi16 (__m1, __m2); +} + /* Shift four 16-bit values in M left by COUNT. */ static __inline __m64 _mm_sll_pi16 (__m64 __m, __m64 __count) @@ -316,12 +490,24 @@ _mm_sll_pi16 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psllw ((__v4hi)__m, (long long)__count); } +static __inline __m64 +_m_psllw (__m64 __m, __m64 __count) +{ + return _mm_sll_pi16 (__m, __count); +} + static __inline __m64 _mm_slli_pi16 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psllw ((__v4hi)__m, __count); } +static __inline __m64 +_m_psllwi (__m64 __m, int __count) +{ + return _mm_slli_pi16 (__m, __count); +} + /* Shift two 32-bit values in M left by COUNT. */ static __inline __m64 _mm_sll_pi32 (__m64 __m, __m64 __count) @@ -329,12 +515,24 @@ _mm_sll_pi32 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_pslld ((__v2si)__m, (long long)__count); } +static __inline __m64 +_m_pslld (__m64 __m, __m64 __count) +{ + return _mm_sll_pi32 (__m, __count); +} + static __inline __m64 _mm_slli_pi32 (__m64 __m, int __count) { return (__m64) __builtin_ia32_pslld ((__v2si)__m, __count); } +static __inline __m64 +_m_pslldi (__m64 __m, int __count) +{ + return _mm_slli_pi32 (__m, __count); +} + /* Shift the 64-bit value in M left by COUNT. */ static __inline __m64 _mm_sll_si64 (__m64 __m, __m64 __count) @@ -342,12 +540,24 @@ _mm_sll_si64 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count); } +static __inline __m64 +_m_psllq (__m64 __m, __m64 __count) +{ + return _mm_sll_si64 (__m, __count); +} + static __inline __m64 _mm_slli_si64 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count); } +static __inline __m64 +_m_psllqi (__m64 __m, int __count) +{ + return _mm_slli_si64 (__m, __count); +} + /* Shift four 16-bit values in M right by COUNT; shift in the sign bit. */ static __inline __m64 _mm_sra_pi16 (__m64 __m, __m64 __count) @@ -355,12 +565,24 @@ _mm_sra_pi16 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psraw ((__v4hi)__m, (long long)__count); } +static __inline __m64 +_m_psraw (__m64 __m, __m64 __count) +{ + return _mm_sra_pi16 (__m, __count); +} + static __inline __m64 _mm_srai_pi16 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psraw ((__v4hi)__m, __count); } +static __inline __m64 +_m_psrawi (__m64 __m, int __count) +{ + return _mm_srai_pi16 (__m, __count); +} + /* Shift two 32-bit values in M right by COUNT; shift in the sign bit. */ static __inline __m64 _mm_sra_pi32 (__m64 __m, __m64 __count) @@ -368,12 +590,24 @@ _mm_sra_pi32 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psrad ((__v2si)__m, (long long)__count); } +static __inline __m64 +_m_psrad (__m64 __m, __m64 __count) +{ + return _mm_sra_pi32 (__m, __count); +} + static __inline __m64 _mm_srai_pi32 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psrad ((__v2si)__m, __count); } +static __inline __m64 +_m_psradi (__m64 __m, int __count) +{ + return _mm_srai_pi32 (__m, __count); +} + /* Shift four 16-bit values in M right by COUNT; shift in zeros. */ static __inline __m64 _mm_srl_pi16 (__m64 __m, __m64 __count) @@ -381,12 +615,24 @@ _mm_srl_pi16 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, (long long)__count); } +static __inline __m64 +_m_psrlw (__m64 __m, __m64 __count) +{ + return _mm_srl_pi16 (__m, __count); +} + static __inline __m64 _mm_srli_pi16 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, __count); } +static __inline __m64 +_m_psrlwi (__m64 __m, int __count) +{ + return _mm_srli_pi16 (__m, __count); +} + /* Shift two 32-bit values in M right by COUNT; shift in zeros. */ static __inline __m64 _mm_srl_pi32 (__m64 __m, __m64 __count) @@ -394,12 +640,24 @@ _mm_srl_pi32 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psrld ((__v2si)__m, (long long)__count); } +static __inline __m64 +_m_psrld (__m64 __m, __m64 __count) +{ + return _mm_srl_pi32 (__m, __count); +} + static __inline __m64 _mm_srli_pi32 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psrld ((__v2si)__m, __count); } +static __inline __m64 +_m_psrldi (__m64 __m, int __count) +{ + return _mm_srli_pi32 (__m, __count); +} + /* Shift the 64-bit value in M left by COUNT; shift in zeros. */ static __inline __m64 _mm_srl_si64 (__m64 __m, __m64 __count) @@ -407,12 +665,24 @@ _mm_srl_si64 (__m64 __m, __m64 __count) return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count); } +static __inline __m64 +_m_psrlq (__m64 __m, __m64 __count) +{ + return _mm_srl_si64 (__m, __count); +} + static __inline __m64 _mm_srli_si64 (__m64 __m, int __count) { return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count); } +static __inline __m64 +_m_psrlqi (__m64 __m, int __count) +{ + return _mm_srli_si64 (__m, __count); +} + /* Bit-wise AND the 64-bit values in M1 and M2. */ static __inline __m64 _mm_and_si64 (__m64 __m1, __m64 __m2) @@ -420,6 +690,12 @@ _mm_and_si64 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pand ((long long)__m1, (long long)__m2); } +static __inline __m64 +_m_pand (__m64 __m1, __m64 __m2) +{ + return _mm_and_si64 (__m1, __m2); +} + /* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the 64-bit value in M2. */ static __inline __m64 @@ -428,6 +704,12 @@ _mm_andnot_si64 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pandn ((long long)__m1, (long long)__m2); } +static __inline __m64 +_m_pandn (__m64 __m1, __m64 __m2) +{ + return _mm_andnot_si64 (__m1, __m2); +} + /* Bit-wise inclusive OR the 64-bit values in M1 and M2. */ static __inline __m64 _mm_or_si64 (__m64 __m1, __m64 __m2) @@ -435,6 +717,12 @@ _mm_or_si64 (__m64 __m1, __m64 __m2) return (__m64)__builtin_ia32_por ((long long)__m1, (long long)__m2); } +static __inline __m64 +_m_por (__m64 __m1, __m64 __m2) +{ + return _mm_or_si64 (__m1, __m2); +} + /* Bit-wise exclusive OR the 64-bit values in M1 and M2. */ static __inline __m64 _mm_xor_si64 (__m64 __m1, __m64 __m2) @@ -442,6 +730,12 @@ _mm_xor_si64 (__m64 __m1, __m64 __m2) return (__m64)__builtin_ia32_pxor ((long long)__m1, (long long)__m2); } +static __inline __m64 +_m_pxor (__m64 __m1, __m64 __m2) +{ + return _mm_xor_si64 (__m1, __m2); +} + /* Compare eight 8-bit values. The result of the comparison is 0xFF if the test is true and zero if false. */ static __inline __m64 @@ -450,12 +744,24 @@ _mm_cmpeq_pi8 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pcmpeqb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_pcmpeqb (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi8 (__m1, __m2); +} + static __inline __m64 _mm_cmpgt_pi8 (__m64 __m1, __m64 __m2) { return (__m64) __builtin_ia32_pcmpgtb ((__v8qi)__m1, (__v8qi)__m2); } +static __inline __m64 +_m_pcmpgtb (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi8 (__m1, __m2); +} + /* Compare four 16-bit values. The result of the comparison is 0xFFFF if the test is true and zero if false. */ static __inline __m64 @@ -464,12 +770,24 @@ _mm_cmpeq_pi16 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pcmpeqw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_pcmpeqw (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi16 (__m1, __m2); +} + static __inline __m64 _mm_cmpgt_pi16 (__m64 __m1, __m64 __m2) { return (__m64) __builtin_ia32_pcmpgtw ((__v4hi)__m1, (__v4hi)__m2); } +static __inline __m64 +_m_pcmpgtw (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi16 (__m1, __m2); +} + /* Compare two 32-bit values. The result of the comparison is 0xFFFFFFFF if the test is true and zero if false. */ static __inline __m64 @@ -478,12 +796,24 @@ _mm_cmpeq_pi32 (__m64 __m1, __m64 __m2) return (__m64) __builtin_ia32_pcmpeqd ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_pcmpeqd (__m64 __m1, __m64 __m2) +{ + return _mm_cmpeq_pi32 (__m1, __m2); +} + static __inline __m64 _mm_cmpgt_pi32 (__m64 __m1, __m64 __m2) { return (__m64) __builtin_ia32_pcmpgtd ((__v2si)__m1, (__v2si)__m2); } +static __inline __m64 +_m_pcmpgtd (__m64 __m1, __m64 __m2) +{ + return _mm_cmpgt_pi32 (__m1, __m2); +} + /* Creates a 64-bit zero. */ static __inline __m64 _mm_setzero_si64 (void) @@ -574,7 +904,7 @@ _mm_set1_pi16 (short __w) return _mm_set1_pi32 (__i); } -/* Creates a vector of four 16-bit values, all elements containing B. */ +/* Creates a vector of eight 8-bit values, all elements containing B. */ static __inline __m64 _mm_set1_pi8 (char __b) { diff --git a/contrib/gcc/config/i386/pmmintrin.h b/contrib/gcc/config/i386/pmmintrin.h new file mode 100644 index 000000000000..5649c00d6730 --- /dev/null +++ b/contrib/gcc/config/i386/pmmintrin.h @@ -0,0 +1,132 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + + This file is part of GNU CC. + + GNU CC 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. + + GNU CC 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 GNU CC; 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, 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. */ + +/* Implemented from the specification included in the Intel C++ Compiler + User Guide and Reference, version 8.0. */ + +#ifndef _PMMINTRIN_H_INCLUDED +#define _PMMINTRIN_H_INCLUDED + +#ifdef __PNI__ +#include +#include + +/* Additional bits in the MXCSR. */ +#define _MM_DENORMALS_ZERO_MASK 0x0040 +#define _MM_DENORMALS_ZERO_ON 0x0040 +#define _MM_DENORMALS_ZERO_OFF 0x0000 + +#define _MM_SET_DENORMALS_ZERO_MODE(mode) \ + _mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode)) +#define _MM_GET_DENORMALS_ZERO_MODE() \ + (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK) + +static __inline __m128 +_mm_addsub_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_hadd_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_haddps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_hsub_ps (__m128 __X, __m128 __Y) +{ + return (__m128) __builtin_ia32_hsubps ((__v4sf)__X, (__v4sf)__Y); +} + +static __inline __m128 +_mm_movehdup_ps (__m128 __X) +{ + return (__m128) __builtin_ia32_movshdup ((__v4sf)__X); +} + +static __inline __m128 +_mm_moveldup_ps (__m128 __X) +{ + return (__m128) __builtin_ia32_movsldup ((__v4sf)__X); +} + +static __inline __m128d +_mm_addsub_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_addsubpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_hadd_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_haddpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_hsub_pd (__m128d __X, __m128d __Y) +{ + return (__m128d) __builtin_ia32_hsubpd ((__v2df)__X, (__v2df)__Y); +} + +static __inline __m128d +_mm_loaddup_pd (double const *__P) +{ + return (__m128d) __builtin_ia32_loadddup (__P); +} + +static __inline __m128d +_mm_movedup_pd (__m128d __X) +{ + return (__m128d) __builtin_ia32_movddup ((__v2df)__X); +} + +static __inline __m128i +_mm_lddqu_si128 (__m128i const *__P) +{ + return (__m128i) __builtin_ia32_lddqu ((char const *)__P); +} + +#if 0 +static __inline void +_mm_monitor (void const * __P, unsigned int __E, unsigned int __H) +{ + __builtin_ia32_monitor (__P, __E, __H); +} + +static __inline void +_mm_mwait (unsigned int __E, unsigned int __H) +{ + __builtin_ia32_mwait (__E, __H); +} +#else +#define _mm_monitor(P, E, H) __builtin_ia32_monitor ((P), (E), (H)) +#define _mm_mwait(E, H) __builtin_ia32_mwait ((E), (H)) +#endif + +#endif /* __PNI__ */ + +#endif /* _PMMINTRIN_H_INCLUDED */ diff --git a/contrib/gcc/config/i386/sco5.h b/contrib/gcc/config/i386/sco5.h index 815e45771d65..2a28e5459f38 100644 --- a/contrib/gcc/config/i386/sco5.h +++ b/contrib/gcc/config/i386/sco5.h @@ -1,7 +1,7 @@ /* Definitions for Intel 386 running SCO Unix System V 3.2 Version 5. - Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002 + Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software Foundation, Inc. - Contributed by Kean Johnston (hug@netcom.com) + Contributed by Kean Johnston (jkj@sco.com) This file is part of GNU CC. @@ -20,230 +20,36 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (i386, SCO OpenServer 5 Syntax)"); -#undef LPREFIX -#define LPREFIX ".L" - -#undef ALIGN_ASM_OP -#define ALIGN_ASM_OP "\t.align\t" - -#undef ASCII_DATA_ASM_OP -#define ASCII_DATA_ASM_OP "\t.ascii\t" - -#undef IDENT_ASM_OP -#define IDENT_ASM_OP "\t.ident\t" - -#undef COMMON_ASM_OP -#define COMMON_ASM_OP "\t.comm\t" - -#undef SET_ASM_OP -#define SET_ASM_OP "\t.set\t" - -#undef LOCAL_ASM_OP -#define LOCAL_ASM_OP "\t.local\t" - -#undef ASM_SHORT -#define ASM_SHORT "\t.value\t" - -#undef ASM_LONG -#define ASM_LONG "\t.long\t" +/* The native link editor does not support linkonce stuff */ +#define SUPPORTS_ONE_ONLY 0 #undef ASM_QUAD -#undef TYPE_ASM_OP -#define TYPE_ASM_OP "\t.type\t" - -#undef SIZE_ASM_OP -#define SIZE_ASM_OP "\t.size\t" - -#undef STRING_ASM_OP -#define STRING_ASM_OP "\t.string\t" - -#undef SKIP_ASM_OP -#define SKIP_ASM_OP "\t.zero\t" - #undef GLOBAL_ASM_OP #define GLOBAL_ASM_OP "\t.globl\t" -#undef EH_FRAME_SECTION_ASM_OP -#define EH_FRAME_SECTION_NAME_COFF ".ehfram" -#define EH_FRAME_SECTION_NAME_ELF ".eh_frame" -#define EH_FRAME_SECTION_NAME \ - ((TARGET_ELF) ? EH_FRAME_SECTION_NAME_ELF : EH_FRAME_SECTION_NAME_COFF) - -/* Avoid problems (long sectino names, forward assembler refs) with DWARF - exception unwinding when we're generating COFF */ -#define DWARF2_UNWIND_INFO \ - ((TARGET_ELF) ? 1 : 0 ) - -#undef READONLY_DATA_SECTION_ASM_OP -#define READONLY_DATA_SECTION_ASM_OP_COFF "\t.section\t.rodata, \"x\"" -#define READONLY_DATA_SECTION_ASM_OP_ELF "\t.section\t.rodata" -#define READONLY_DATA_SECTION_ASM_OP \ - ((TARGET_ELF) \ - ? READONLY_DATA_SECTION_ASM_OP_ELF \ - : READONLY_DATA_SECTION_ASM_OP_COFF) - -#undef INIT_SECTION_ASM_OP -#define INIT_SECTION_ASM_OP_ELF "\t.section\t.init" -/* Rename these for COFF because crt1.o will try to run them. */ -#define INIT_SECTION_ASM_OP_COFF "\t.section\t.ctor ,\"x\"" -#define INIT_SECTION_ASM_OP \ - ((TARGET_ELF) ? INIT_SECTION_ASM_OP_ELF : INIT_SECTION_ASM_OP_COFF) - -#undef CTORS_SECTION_ASM_OP -#define CTORS_SECTION_ASM_OP_ELF "\t.section\t.ctors,\"aw\"" -#define CTORS_SECTION_ASM_OP_COFF INIT_SECTION_ASM_OP_COFF -#define CTORS_SECTION_ASM_OP \ - ((TARGET_ELF) ? CTORS_SECTION_ASM_OP_ELF : CTORS_SECTION_ASM_OP_COFF) - -#undef DTORS_SECTION_ASM_OP -#define DTORS_SECTION_ASM_OP_ELF "\t.section\t.dtors, \"aw\"" -#define DTORS_SECTION_ASM_OP_COFF FINI_SECTION_ASM_OP_COFF -#define DTORS_SECTION_ASM_OP \ - ((TARGET_ELF) ? DTORS_SECTION_ASM_OP_ELF : DTORS_SECTION_ASM_OP_COFF) - -#undef FINI_SECTION_ASM_OP -#define FINI_SECTION_ASM_OP_ELF "\t.section\t.fini" -#define FINI_SECTION_ASM_OP_COFF "\t.section\t.dtor, \"x\"" -#define FINI_SECTION_ASM_OP \ - ((TARGET_ELF) ? FINI_SECTION_ASM_OP_ELF : FINI_SECTION_ASM_OP_COFF) - #undef BSS_SECTION_ASM_OP -#define BSS_SECTION_ASM_OP "\t.data" - -#undef TEXT_SECTION_ASM_OP -#define TEXT_SECTION_ASM_OP "\t.text" - -#undef DATA_SECTION_ASM_OP -#define DATA_SECTION_ASM_OP "\t.data" - -#undef TYPE_OPERAND_FMT -#define TYPE_OPERAND_FMT "@%s" - -#undef APPLY_RESULT_SIZE -#define APPLY_RESULT_SIZE \ -(TARGET_ELF) ? size : 116 - -#ifndef ASM_DECLARE_RESULT -#define ASM_DECLARE_RESULT(FILE, RESULT) -#endif - -#define SCO_DEFAULT_ASM_COFF(FILE,NAME) \ -do { \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } while (0) - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - if (TARGET_ELF) { \ - ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } else \ - SCO_DEFAULT_ASM_COFF(FILE, NAME); \ -} while (0) - -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (TARGET_ELF && !flag_inhibit_size_directive) \ - ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ - } while (0) - -#undef ASM_DECLARE_OBJECT_NAME -#define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ - do { \ - if (TARGET_ELF) { \ - HOST_WIDE_INT size; \ - \ - ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ - \ - size_directive_output = 0; \ - if (!flag_inhibit_size_directive \ - && (DECL) && DECL_SIZE (DECL)) \ - { \ - size_directive_output = 1; \ - size = int_size_in_bytes (TREE_TYPE (DECL)); \ - ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, size); \ - } \ - \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } else \ - SCO_DEFAULT_ASM_COFF(FILE, NAME); \ - } while (0) +#define BSS_SECTION_ASM_OP "\t.section\t.bss, \"aw\", @nobits" + +/* + * NOTE: We really do want CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP. + * Here's the reason why. If we dont define them, and we dont define them + * to always emit to the same section, the default is to emit to "named" + * ctors and dtors sections. This would be great if we could use GNU ld, + * but we can't. The native linker could possibly be trained to coalesce + * named ctors sections, but that hasn't been done either. So if we don't + * define these, many C++ ctors and dtors dont get run, because they never + * wind up in the ctors/dtors arrays. + */ +#define CTORS_SECTION_ASM_OP "\t.section\t.ctors, \"aw\"" +#define DTORS_SECTION_ASM_OP "\t.section\t.dtors, \"aw\"" -#undef ASM_FILE_START_1 -#define ASM_FILE_START_1(FILE) - -#undef ASM_FILE_START -#define ASM_FILE_START(FILE) \ -do { \ - output_file_directive((FILE),main_input_filename); \ - fprintf ((FILE), "\t.version\t\"01.01\"\n"); \ -} while (0) - -#undef ASM_FINISH_DECLARE_OBJECT -#define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ -do { \ - if (TARGET_ELF) { \ - const char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - HOST_WIDE_INT size; \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - size = int_size_in_bytes (TREE_TYPE (DECL)); \ - ASM_OUTPUT_SIZE_DIRECTIVE (FILE, name, size); \ - } \ - } \ -} while (0) - -#undef ASM_GENERATE_INTERNAL_LABEL -#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \ -do { \ - if (TARGET_ELF) \ - sprintf (LABEL, "*.%s%ld", (PREFIX), (long)(NUM)); \ - else \ - sprintf (LABEL, ".%s%ld", (PREFIX), (long)(NUM)); \ -} while (0) - -#undef ASM_OUTPUT_ALIGNED_COMMON -#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ -do { \ - fprintf ((FILE), "%s", COMMON_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - if (TARGET_ELF) \ - fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT); \ - else \ - fprintf ((FILE), ",%u\n", (SIZE)); \ -} while (0) - -#undef ASM_OUTPUT_ALIGNED_LOCAL -#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \ -do { \ - if (TARGET_ELF) { \ - fprintf ((FILE), "%s", LOCAL_ASM_OP); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), "\n"); \ - ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN); \ - } else { \ - int align = exact_log2 (ALIGN); \ - if (align > 2) align = 2; \ - if (TARGET_SVR3_SHLIB) \ - data_section (); \ - else \ - bss_section (); \ - ASM_OUTPUT_ALIGN ((FILE), align == -1 ? 2 : align); \ - fprintf ((FILE), "%s\t", "\t.lcomm"); \ - assemble_name ((FILE), (NAME)); \ - fprintf ((FILE), ",%u\n", (SIZE)); \ - } \ -} while (0) +#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true +#undef X86_FILE_START_VERSION_DIRECTIVE +#define X86_FILE_START_VERSION_DIRECTIVE true /* A C statement (sans semicolon) to output to the stdio stream FILE the assembler definition of uninitialized global DECL named @@ -251,248 +57,23 @@ do { \ Try to use asm_output_aligned_bss to implement this macro. */ #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ -asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -#undef ESCAPES -#define ESCAPES \ -"\1\1\1\1\1\1\1\1btn\1fr\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\0\0\"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\\\0\0\0\ -\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\ -\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1" - -#undef STRING_LIMIT -#define STRING_LIMIT ((unsigned) 256) - -#undef ASM_OUTPUT_LIMITED_STRING -#define ASM_OUTPUT_LIMITED_STRING(FILE, STR) \ - do \ - { \ - register const unsigned char *_limited_str = \ - (const unsigned char *) (STR); \ - register unsigned ch; \ - fprintf ((FILE), "%s\"", STRING_ASM_OP); \ - for (; (ch = *_limited_str); _limited_str++) \ - { \ - register int escape; \ - switch (escape = ESCAPES[ch]) \ - { \ - case 0: \ - putc (ch, (FILE)); \ - break; \ - case 1: \ - fprintf ((FILE), "\\%03o", ch); \ - break; \ - default: \ - putc ('\\', (FILE)); \ - putc (escape, (FILE)); \ - break; \ - } \ - } \ - fprintf ((FILE), "\"\n"); \ - } \ - while (0) - - -#undef ASM_OUTPUT_ASCII -#define ASM_OUTPUT_ASCII(FILE, STR, LENGTH) \ -do { \ - register const unsigned char *_ascii_bytes = \ - (const unsigned char *) (STR); \ - register const unsigned char *limit = _ascii_bytes + (LENGTH); \ - register unsigned bytes_in_chunk = 0; \ - for (; _ascii_bytes < limit; _ascii_bytes++) \ - { \ - register unsigned const char *p; \ - if (bytes_in_chunk >= 64) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - for (p = _ascii_bytes; p < limit && *p != '\0'; p++) \ - continue; \ - if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT) \ - { \ - if (bytes_in_chunk > 0) \ - { \ - fputc ('\n', (FILE)); \ - bytes_in_chunk = 0; \ - } \ - ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes); \ - _ascii_bytes = p; \ - } \ - else \ - { \ - if (bytes_in_chunk == 0) \ - fputs ("\t.byte\t", (FILE)); \ - else \ - fputc (',', (FILE)); \ - fprintf ((FILE), "0x%02x", *_ascii_bytes); \ - bytes_in_chunk += 5; \ - } \ - } \ - if (bytes_in_chunk > 0) \ - fprintf ((FILE), "\n"); \ -} while (0) - -#undef ASM_OUTPUT_CASE_LABEL -#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ -do { \ - if (TARGET_ELF) \ - ASM_OUTPUT_ALIGN ((FILE), 2); \ - ASM_OUTPUT_INTERNAL_LABEL((FILE),(PREFIX),(NUM)); \ -} while (0) - -#undef ASM_OUTPUT_IDENT -#define ASM_OUTPUT_IDENT(FILE, NAME) \ - fprintf (FILE, "%s\"%s\"\n", IDENT_ASM_OP, NAME); - -#undef ASM_OUTPUT_EXTERNAL_LIBCALL -#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \ - if (TARGET_ELF) (*targetm.asm_out.globalize_label) (FILE, XSTR (FUN, 0)) - -#undef ASM_OUTPUT_INTERNAL_LABEL -#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ - fprintf (FILE, ".%s%d:\n", PREFIX, NUM) - -/* The prefix to add to user-visible assembler symbols. */ - -#undef USER_LABEL_PREFIX -#define USER_LABEL_PREFIX "" - -/* - * We rename 'gcc_except_table' to the shorter name in preparation - * for the day when we're ready to do DWARF2 eh unwinding under COFF. - */ -/* #define EXCEPTION_SECTION() named_section (NULL, ".gccexc", 1) */ - -/* Switch into a generic section. */ -#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section - -#undef ASM_OUTPUT_SKIP -#define ASM_OUTPUT_SKIP(FILE,SIZE) \ -do { \ - if (TARGET_ELF) \ - fprintf (FILE, "%s%u\n", SKIP_ASM_OP, (SIZE)); \ - else \ - fprintf ((FILE), "%s.,.+%u\n", SET_ASM_OP, (SIZE)); \ -} while (0) - - -#undef CTOR_LIST_BEGIN -#define CTOR_LIST_BEGIN \ -do { \ - asm (CTORS_SECTION_ASM_OP); \ - if (TARGET_ELF) \ - STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (-1) }; \ - else \ - asm ("pushl $0"); \ -} while (0) - -#undef CTOR_LIST_END -#define CTOR_LIST_END \ -do { \ - if (TARGET_ELF) { \ - asm (CTORS_SECTION_ASM_OP); \ - STATIC func_ptr __CTOR_LIST__[1] = { (func_ptr) (0) }; \ - } else { \ - CTOR_LIST_BEGIN; \ - } \ -} while (0) - -#undef DBX_BLOCKS_FUNCTION_RELATIVE -#define DBX_BLOCKS_FUNCTION_RELATIVE 1 - -#undef DBX_FUNCTION_FIRST -#define DBX_FUNCTION_FIRST 1 + asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) #undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ - ((TARGET_ELF) ? svr4_dbx_register_map[n] : dbx_register_map[n]) +#define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n] -#define DWARF2_DEBUGGING_INFO 1 -#define DWARF_DEBUGGING_INFO 1 -#define SDB_DEBUGGING_INFO 1 -#define DBX_DEBUGGING_INFO 1 +#define DWARF2_DEBUGGING_INFO 1 +#define DWARF_DEBUGGING_INFO 1 +#define DBX_DEBUGGING_INFO 1 #undef PREFERRED_DEBUGGING_TYPE -#define PREFERRED_DEBUGGING_TYPE \ - ((TARGET_ELF) ? DWARF2_DEBUG: SDB_DEBUG) - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_init, in_fini - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - INIT_SECTION_FUNCTION \ - FINI_SECTION_FUNCTION - -#undef FINI_SECTION_FUNCTION -#define FINI_SECTION_FUNCTION \ -void \ -fini_section () \ -{ \ - if ((!TARGET_ELF) && in_section != in_fini) \ - { \ - fprintf (asm_out_file, "%s\n", FINI_SECTION_ASM_OP); \ - in_section = in_fini; \ - } \ -} - -#undef INIT_SECTION_FUNCTION -#define INIT_SECTION_FUNCTION \ -void \ -init_section () \ -{ \ - if ((!TARGET_ELF) && in_section != in_init) \ - { \ - fprintf (asm_out_file, "%s\n", INIT_SECTION_ASM_OP); \ - in_section = in_init; \ - } \ -} - -#undef SUBTARGET_FRAME_POINTER_REQUIRED -#define SUBTARGET_FRAME_POINTER_REQUIRED \ - ((TARGET_ELF) ? 0 : \ - (current_function_calls_setjmp || current_function_calls_longjmp)) - -#undef LOCAL_LABEL_PREFIX -#define LOCAL_LABEL_PREFIX \ - ((TARGET_ELF) ? "" : ".") - -#undef MD_EXEC_PREFIX -#undef MD_STARTFILE_PREFIX -#define MD_EXEC_PREFIX "/usr/ccs/bin/" -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/" - -#undef NON_SAVING_SETJMP -#define NON_SAVING_SETJMP \ - ((TARGET_ELF) ? 0 : \ - (current_function_calls_setjmp && current_function_calls_longjmp)) +#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG + +#undef DWARF2_UNWIND_INFO +#define DWARF2_UNWIND_INFO 1 #undef NO_IMPLICIT_EXTERN_C -#define NO_IMPLICIT_EXTERN_C 1 - -/* JKJ FIXME - examine the ramifications of RETURN_IN_MEMORY and - RETURN_POPS_ARGS */ - -#undef RETURN_POPS_ARGS -#define RETURN_POPS_ARGS(FUNDECL,FUNTYPE,SIZE) \ - ((TARGET_ELF) ? \ - (ix86_return_pops_args (FUNDECL, FUNTYPE, SIZE)) : \ - (((FUNDECL) && (TREE_CODE (FUNDECL) == IDENTIFIER_NODE)) ? 0 \ - : (TARGET_RTD \ - && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ - == void_type_node))) ? (SIZE) \ - : 0)) - -/* ??? Ignore coff. */ -#undef TARGET_ASM_SELECT_SECTION -#define TARGET_ASM_SELECT_SECTION default_elf_select_section +#define NO_IMPLICIT_EXTERN_C 1 #undef SWITCH_TAKES_ARG #define SWITCH_TAKES_ARG(CHAR) \ @@ -511,17 +92,6 @@ init_section () \ #undef TARGET_SUBTARGET_DEFAULT #define TARGET_SUBTARGET_DEFAULT (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS) -#define HANDLE_SYSV_PRAGMA 1 - -/* Though OpenServer supports .weak in COFF, we don't use it. - * G++ will frequently emit a symol as .weak and then (in the same .s - * file) declare it global. The COFF assembler finds this unamusing. - */ -#define SUPPORTS_WEAK (TARGET_ELF) -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) - /* * Define sizes and types */ @@ -529,12 +99,14 @@ init_section () \ #undef PTRDIFF_TYPE #undef WCHAR_TYPE #undef WCHAR_TYPE_SIZE +#undef WINT_TYPE #undef LONG_DOUBLE_TYPE_SIZE -#define LONG_DOUBLE_TYPE_SIZE 96 #define SIZE_TYPE "unsigned int" #define PTRDIFF_TYPE "int" #define WCHAR_TYPE "long int" #define WCHAR_TYPE_SIZE BITS_PER_WORD +#define WINT_TYPE "long int" +#define LONG_DOUBLE_TYPE_SIZE 96 /* * New for multilib support. Set the default switches for multilib, @@ -548,7 +120,7 @@ init_section () \ With SCO Open Server 5.0, you now get the linker and assembler free, so that is what these specs are targeted for. These utilities are very argument sensitive: a space in the wrong place breaks everything. - So RMS, please forgive this mess. It works. + So please forgive this mess. It works. Parameters which can be passed to gcc, and their SCO equivalents: GCC Parameter SCO Equivalent @@ -564,77 +136,109 @@ init_section () \ does. SCO also allows you to compile, link and generate either ELF or COFF - binaries. With gcc, unlike the SCO compiler, the default is ELF. - Specify -mcoff to gcc to produce COFF binaries. -fpic will get the - assembler and linker to produce PIC code. + binaries. With gcc, we now only support ELF mode. + + GCC also requires that the user has installed OSS646, the Execution + Environment Update, or is running release 5.0.7 or later. This has + many fixes to the ELF link editor and assembler, and a considerably + improved libc and RTLD. + + In terms of tool usage, we want to use the standard link editor always, + and either the GNU assembler or the native assembler. With OSS646 the + native assembler has grown up quite a bit. Some of the specs below + assume that /usr/gnu is the prefix for the GNU tools, because thats + where the SCO provided ones go. This is especially important for + include and library search path ordering. We want to look in /usr/gnu + first, becuase frequently people are linking against -lintl, and they + MEAN to link with gettext. What they get is the SCO intl library. Its + a REAL pity that GNU gettext chose that name; perhaps in a future + version they can be persuaded to change it to -lgnuintl and have a + link so that -lintl will work for other systems. The same goes for + header files. We want /usr/gnu/include searched for before the system + header files. Hence the -isystem /usr/gnu/include in the CPP_SPEC. + We get /usr/gnu/lib first by virtue of the MD_STARTFILE_PREFIX below. */ +#define MD_STARTFILE_PREFIX "/usr/gnu/lib/" +#define MD_STARTFILE_PREFIX_1 "/usr/ccs/lib/" + +#if USE_GAS +# define MD_EXEC_PREFIX "/usr/gnu/bin/" +#else +# define MD_EXEC_PREFIX "/usr/ccs/bin/elf/" +#endif + +/* Always use the system linker, please. */ +#ifndef DEFAULT_LINKER +# define DEFAULT_LINKER "/usr/ccs/bin/elf/ld" +#endif + /* Set up assembler flags for PIC and ELF compilations */ #undef ASM_SPEC #if USE_GAS - /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c - * Undef MD_EXEC_PREFIX because we don't know where GAS is, but it's not - * likely in /usr/ccs/bin/ - */ -#undef MD_EXEC_PREFIX + /* Leave ASM_SPEC undefined so we pick up the master copy from gcc.c */ #else - #define ASM_SPEC \ - "-b %{!mcoff:elf}%{mcoff:coff \ - %{static:%e-static not valid with -mcoff} \ - %{shared:%e-shared not valid with -mcoff} \ - %{symbolic:%e-symbolic not valid with -mcoff}} \ - %{Ym,*} %{Yd,*} %{Wa,*:%*} \ - %{!mcoff:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}}" + "%{Ym,*} %{Yd,*} %{Wa,*:%*} \ + -E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF %{Qn:} %{!Qy:-Qn}" #endif -/* Use crt1.o as a startup file and crtn.o as a closing file. */ +/* + * Use crti.o for shared objects, crt1.o for normal executables. Make sure + * to recognize both -G and -shared as a valid way of introducing shared + * library generation. This is important for backwards compatibility. + */ #undef STARTFILE_SPEC #define STARTFILE_SPEC \ - "%{shared: %{!mcoff: crti.o%s}} \ - %{!shared:\ + "%{pg:%e-pg not supported on this platform} \ + %{p:%{pp:%e-p and -pp specified - pick one}} \ + %{!shared:\ %{!symbolic: \ - %{pg:gcrt.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}}} \ + %{!G: \ + %{pp:pcrt1elf.o%s}%{p:mcrt1.o%s}%{!p:%{!pp:crt1.o%s}}}}} \ + crti.o%s \ %{ansi:values-Xc.o%s} \ %{!ansi: \ - %{Xa:values-Xa.o%s} \ - %{!Xa:%{Xc:values-Xc.o%s} \ - %{!Xc:%{Xk:values-Xk.o%s} \ - %{!Xk:%{Xt:values-Xt.o%s} \ - %{!Xt:values-Xa.o%s}}}}} \ - %{mcoff:crtbeginS.o%s} %{!mcoff:crtbegin.o%s}" + %{traditional:values-Xt.o%s} \ + %{!traditional: \ + %{Xa:values-Xa.o%s} \ + %{!Xa:%{Xc:values-Xc.o%s} \ + %{!Xc:%{Xk:values-Xk.o%s} \ + %{!Xk:%{Xt:values-Xt.o%s} \ + %{!Xt:values-Xa.o%s}}}}}} \ + crtbegin.o%s" #undef ENDFILE_SPEC #define ENDFILE_SPEC \ - "%{!mcoff:crtend.o%s} \ - %{mcoff:crtendS.o%s} \ - %{pg:gcrtn.o%s}%{!pg:crtn.o%s}" - -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__unix"); \ - builtin_define ("_SCO_DS"); \ - builtin_define ("_M_I386"); \ - builtin_define ("_M_XENIX"); \ - builtin_define ("_M_UNIX"); \ - builtin_assert ("system=svr3"); \ - if (flag_iso) \ - cpp_define (pfile, "_STRICT_ANSI"); \ - if (flag_pic) \ - { \ - builtin_define ("__PIC__"); \ - builtin_define ("__pic__"); \ - } \ - } \ + "crtend.o%s crtn.o%s" + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__unix"); \ + builtin_define ("_SCO_DS"); \ + builtin_define ("_SCO_DS_LL"); \ + builtin_define ("_SCO_ELF"); \ + builtin_define ("_M_I386"); \ + builtin_define ("_M_XENIX"); \ + builtin_define ("_M_UNIX"); \ + builtin_assert ("system=svr3"); \ + if (flag_iso) \ + cpp_define (pfile, "_STRICT_ANSI"); \ + if (flag_pic) \ + { \ + builtin_define ("__PIC__"); \ + builtin_define ("__pic__"); \ + } \ + } \ while (0) #undef CPP_SPEC #define CPP_SPEC "\ - %{fpic:%{mcoff:%e-fpic is not valid with -mcoff}} \ - %{fPIC:%{mcoff:%e-fPIC is not valid with -mcoff}} \ + -isystem /usr/gnu/include \ + %{pthread:-D_REENTRANT} \ %{!Xods30:-D_STRICT_NAMES} \ %{!ansi:%{!posix:%{!Xods30:-D_SCO_XPG_VERS=4}}} \ %{ansi:-isystem include/ansi%s -isystem /usr/include/ansi} \ @@ -652,8 +256,6 @@ init_section () \ -DM_BITFIELDS -DM_SYS5 -DM_SYSV -DM_INTERNAT -DM_SYSIII \ -DM_WORDSWAP}}}} \ %{scointl:-DM_INTERNAT -D_M_INTERNAT} \ - %{!mcoff:-D_SCO_ELF} \ - %{mcoff:-D_M_COFF -D_SCO_COFF} \ %{Xa:-D_SCO_C_DIALECT=1} \ %{!Xa:%{Xc:-D_SCO_C_DIALECT=3} \ %{!Xc:%{Xk:-D_SCO_C_DIALECT=4} \ @@ -662,109 +264,38 @@ init_section () \ #undef LINK_SPEC #define LINK_SPEC \ - "-b %{!mcoff:elf}%{mcoff:coff \ - %{static:%e-static not valid with -mcoff} \ - %{shared:%e-shared not valid with -mcoff} \ - %{symbolic:%e-symbolic not valid with -mcoff} \ - %{fpic:%e-fpic not valid with -mcoff} \ - %{fPIC:%e-fPIC not valid with -mcoff}} \ - -R%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},%{mcoff:COFF}%{!mcoff:ELF} \ - %{Wl,*%*} %{YP,*} %{YL,*} %{YU,*} \ + "%{!shared:%{!symbolic:%{!G:-E%{Xa:a}%{!Xa:%{Xc:c}%{!Xc:%{Xk:k}%{!Xk:%{Xt:t}%{!Xt:a}}}},%{ansi:ansi}%{!ansi:%{posix:posix}%{!posix:%{Xpg4:xpg4}%{!Xpg4:%{Xpg4plus:XPG4PLUS}%{!Xpg4plus:%{Xods30:ods30}%{!Xods30:XPG4PLUS}}}}},ELF}}} \ + %{Wl,*:%*} %{YP,*} %{YL,*} %{YU,*} \ %{!YP,*:%{p:-YP,/usr/ccs/libp:/lib/libp:/usr/lib/libp:/usr/ccs/lib:/lib:/usr/lib} \ %{!p:-YP,/usr/ccs/lib:/lib:/usr/lib}} \ - %{h*} %{static:-dn -Bstatic} %{shared:-G -dy %{!z*:-z text}} \ - %{symbolic:-Bsymbolic -G -dy %{!z*:-z text}} %{z*} %{R*} %{Y*} \ - %{G:-G} %{!mcoff:%{Qn:} %{!Qy:-Qn}}" - -/* The SCO COFF linker gets confused on the difference between "-ofoo" - and "-o foo". So we just always force a single space. */ - -#define SWITCHES_NEED_SPACES "o" + %{h*} %{static:-dn -Bstatic %{G:%e-G and -static are mutually exclusive}} \ + %{shared:%{!G:-G}} %{G:%{!shared:-G}} %{shared:%{G:-G}} \ + %{shared:-dy %{symbolic:-Bsymbolic -G} %{z*}} %{R*} %{Y*} \ + %{Qn:} %{!Qy:-Qn} -z alt_resolve" /* Library spec. If we are not building a shared library, provide the standard libraries, as per the SCO compiler. */ #undef LIB_SPEC #define LIB_SPEC \ - "%{shared:pic/libgcc.a%s}%{!shared:%{!symbolic:-lcrypt -lgen -lc}}" + "%{shared:%{!G:pic/libgcc.a%s}} \ + %{G:%{!shared:pic/libgcc.a%s}} \ + %{shared:%{G:pic/libgcc.a%s}} \ + %{p:%{!pp:-lelfprof -lelf}} %{pp:%{!p:-lelfprof -lelf}} \ + %{!shared:%{!symbolic:%{!G:-lcrypt -lgen -lc %{pthread:-lpthread}}}}" #undef LIBGCC_SPEC #define LIBGCC_SPEC \ - "%{!shared:-lgcc}" + "%{!shared:%{!G:-lgcc}}" -#define MASK_COFF 010000000000 /* Mask for elf generation */ -#define TARGET_ELF (1) /* (!(target_flags & MASK_COFF)) */ +/* Here for legacy support only so we still accept -melf flag */ +#define MASK_COFF 010000000000 /* Mask for COFF generation */ +#define TARGET_ELF (1) #undef SUBTARGET_SWITCHES #define SUBTARGET_SWITCHES \ { "elf", -MASK_COFF, N_("Generate ELF output") }, -#define NO_DOLLAR_IN_LABEL - -/* Implicit library calls should use memcpy, not bcopy, etc. They are - faster on OpenServer libraries. */ - -#define TARGET_MEM_FUNCTIONS - -/* Biggest alignment supported by the object file format of this - machine. Use this macro to limit the alignment which can be - specified using the `__attribute__ ((aligned (N)))' construct. If - not defined, the default value is `BIGGEST_ALIGNMENT'. */ - -#define MAX_OFILE_ALIGNMENT (32768*8) - -/* Define the `__builtin_va_list' type for the ABI. On OpenServer, this - type is `char *'. */ -#undef BUILD_VA_LIST_TYPE -#define BUILD_VA_LIST_TYPE(VALIST) \ - (VALIST) = build_pointer_type (char_type_node) - - -/* -Here comes some major hackery to get the crt stuff to compile properly. -Since we can (and do) compile for both COFF and ELF environments, we -set things up accordingly, based on the pre-processor defines for ELF -and COFF. This is insane, but then I guess having one compiler with a -single back-end supporting two vastly different file format types is -a little insane too. But it is not impossible and we get a useful -compiler at the end of the day. Onward we go ... -*/ - -#if defined(CRT_BEGIN) || defined(CRT_END) || defined(IN_LIBGCC2) -# undef OBJECT_FORMAT_ELF -# undef INIT_SECTION_ASM_OP -# undef FINI_SECTION_ASM_OP -# undef CTORS_SECTION_ASM_OP -# undef DTORS_SECTION_ASM_OP -# undef EH_FRAME_SECTION_NAME -# undef CTOR_LIST_BEGIN -# undef CTOR_LIST_END -# undef DO_GLOBAL_CTORS_BODY - -# if defined (_SCO_ELF) -# define OBJECT_FORMAT_ELF -# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_ELF -# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_ELF -# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_ELF -# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_ELF -# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_ELF -# else /* ! _SCO_ELF */ -# define INIT_SECTION_ASM_OP INIT_SECTION_ASM_OP_COFF -# define FINI_SECTION_ASM_OP FINI_SECTION_ASM_OP_COFF -# define DTORS_SECTION_ASM_OP DTORS_SECTION_ASM_OP_COFF -# define CTORS_SECTION_ASM_OP CTORS_SECTION_ASM_OP_COFF -# define EH_FRAME_SECTION_NAME EH_FRAME_SECTION_NAME_COFF -# define CTOR_LIST_BEGIN asm (INIT_SECTION_ASM_OP); asm ("pushl $0") -# define CTOR_LIST_END CTOR_LIST_BEGIN -# define DO_GLOBAL_CTORS_BODY \ -do { \ - func_ptr *p, *beg = alloca(0); \ - for (p = beg; *p;) \ - (*p++) (); \ -} while (0) -# endif /* ! _SCO_ELF */ -#endif /* CRT_BEGIN !! CRT_END */ - /* Handle special EH pointer encodings. Absolute, pc-relative, and indirect are handled automatically. */ #define ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(FILE, ENCODING, SIZE, ADDR, DONE) \ @@ -798,10 +329,3 @@ do { \ : "=d"(BASE)) #endif -/* Select a format to encode pointers in exception handling data. CODE - is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is - true if the symbol may be affected by dynamic relocations. */ -#undef ASM_PREFERRED_EH_DATA_FORMAT -#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ - (flag_pic ? (GLOBAL ? DW_EH_PE_indirect : 0) | DW_EH_PE_datarel \ - : DW_EH_PE_absptr) diff --git a/contrib/gcc/config/i386/sol2.h b/contrib/gcc/config/i386/sol2.h index fb5a184d65bf..9089a1dce6c4 100644 --- a/contrib/gcc/config/i386/sol2.h +++ b/contrib/gcc/config/i386/sol2.h @@ -1,5 +1,5 @@ /* Target definitions for GNU compiler for Intel 80386 running Solaris 2 - Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright (C) 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Fred Fish (fnf@cygnus.com). @@ -20,8 +20,6 @@ along with GNU CC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define CMOV_SUN_AS_SYNTAX 1 - /* The Solaris 2.0 x86 linker botches alignment of code sections. It tries to align to a 16 byte boundary by padding with 0x00000090 ints, rather than 0x90 bytes (nop). This generates trash in the diff --git a/contrib/gcc/config/i386/t-sco5 b/contrib/gcc/config/i386/t-sco5 index d0c457ef3459..f92a62430cc8 100644 --- a/contrib/gcc/config/i386/t-sco5 +++ b/contrib/gcc/config/i386/t-sco5 @@ -1,18 +1,16 @@ -# We need to use -fPIC when we are using gcc to compile the routines in -# crtstuff.c. This is only really needed when we are going to use gcc/g++ -# to produce a shared library, but since we don't know ahead of time when -# we will be doing that, we just always use -fPIC when compiling the -# routines in crtstuff.c. Likewise for libgcc2.c. This is less painful -# than multilibbing everything with PIC and PIC-not variants. - -# The pushl in CTOR initialization interferes with frame pointer elimination. - +# We multilib libgcc for -fPIC, to get real PIC code in it. +# NOTE: We must use -fPIC on crt{begi,end}.o else we get an RTLD error +# "cant set protections on segment of length blah at 0x8048000". CRTSTUFF_T_CFLAGS = -fPIC -fno-omit-frame-pointer -TARGET_LIBGCC2_CFLAGS = -fPIC -crti.o: $(srcdir)/config/i386/sol2-ci.asm $(GCC_PASSES) - sed -e '/^!/d' <$(srcdir)/config/i386/sol2-ci.asm >crti.s - $(GCC_FOR_TARGET) -c -o crti.o crti.s +MULTILIB_OPTIONS = fPIC +MULTILIB_DIRNAMES = pic +MUTLILIB_EXCEPTIONS = +MULTILIB_MATCHES = fPIC=fpic +MULTILIB_EXTRA_OPTS = + +LIBGCC=stmp-multilib +INSTALL_LIBGCC=install-multilib # See all the declarations. FIXPROTO_DEFINES = -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=2 diff --git a/contrib/gcc/config/i386/xmmintrin.h b/contrib/gcc/config/i386/xmmintrin.h index 43a05c1a6eef..1829ab04b6be 100644 --- a/contrib/gcc/config/i386/xmmintrin.h +++ b/contrib/gcc/config/i386/xmmintrin.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU CC. @@ -25,7 +25,7 @@ Public License. */ /* Implemented from the specification included in the Intel C++ Compiler - User Guide and Reference, version 5.0. */ + User Guide and Reference, version 8.0. */ #ifndef _XMMINTRIN_H_INCLUDED #define _XMMINTRIN_H_INCLUDED @@ -475,6 +475,12 @@ _mm_cvtss_si32 (__m128 __A) return __builtin_ia32_cvtss2si ((__v4sf) __A); } +static __inline int +_mm_cvt_ss2si (__m128 __A) +{ + return _mm_cvtss_si32 (__A); +} + #ifdef __x86_64__ /* Convert the lower SPFP value to a 32-bit integer according to the current rounding mode. */ @@ -493,6 +499,12 @@ _mm_cvtps_pi32 (__m128 __A) return (__m64) __builtin_ia32_cvtps2pi ((__v4sf) __A); } +static __inline __m64 +_mm_cvt_ps2pi (__m128 __A) +{ + return _mm_cvtps_pi32 (__A); +} + /* Truncate the lower SPFP value to a 32-bit integer. */ static __inline int _mm_cvttss_si32 (__m128 __A) @@ -500,6 +512,12 @@ _mm_cvttss_si32 (__m128 __A) return __builtin_ia32_cvttss2si ((__v4sf) __A); } +static __inline int +_mm_cvtt_ss2si (__m128 __A) +{ + return _mm_cvttss_si32 (__A); +} + #ifdef __x86_64__ /* Truncate the lower SPFP value to a 32-bit integer. */ static __inline long long @@ -517,6 +535,12 @@ _mm_cvttps_pi32 (__m128 __A) return (__m64) __builtin_ia32_cvttps2pi ((__v4sf) __A); } +static __inline __m64 +_mm_cvtt_ps2pi (__m128 __A) +{ + return _mm_cvttps_pi32 (__A); +} + /* Convert B to a SPFP value and insert it as element zero in A. */ static __inline __m128 _mm_cvtsi32_ss (__m128 __A, int __B) @@ -524,6 +548,12 @@ _mm_cvtsi32_ss (__m128 __A, int __B) return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B); } +static __inline __m128 +_mm_cvt_si2ss (__m128 __A, int __B) +{ + return _mm_cvtsi32_ss (__A, __B); +} + #ifdef __x86_64__ /* Convert B to a SPFP value and insert it as element zero in A. */ static __inline __m128 @@ -541,6 +571,12 @@ _mm_cvtpi32_ps (__m128 __A, __m64 __B) return (__m128) __builtin_ia32_cvtpi2ps ((__v4sf) __A, (__v2si)__B); } +static __inline __m128 +_mm_cvt_pi2ps (__m128 __A, __m64 __B) +{ + return _mm_cvtpi32_ps (__A, __B); +} + /* Convert the four signed 16-bit values in A to SPFP form. */ static __inline __m128 _mm_cvtpi16_ps (__m64 __A) @@ -942,9 +978,16 @@ _mm_extract_pi16 (__m64 __A, int __N) { return __builtin_ia32_pextrw ((__v4hi)__A, __N); } + +static __inline int +_m_pextrw (__m64 __A, int __N) +{ + return _mm_extract_pi16 (__A, __N); +} #else #define _mm_extract_pi16(A, N) \ __builtin_ia32_pextrw ((__v4hi)(A), (N)) +#define _m_pextrw(A, N) _mm_extract_pi16((A), (N)) #endif /* Inserts word D into one of four words of A. The selector N must be @@ -955,9 +998,16 @@ _mm_insert_pi16 (__m64 __A, int __D, int __N) { return (__m64)__builtin_ia32_pinsrw ((__v4hi)__A, __D, __N); } + +static __inline __m64 +_m_pinsrw (__m64 __A, int __D, int __N) +{ + return _mm_insert_pi16 (__A, __D, __N); +} #else #define _mm_insert_pi16(A, D, N) \ ((__m64) __builtin_ia32_pinsrw ((__v4hi)(A), (D), (N))) +#define _m_pinsrw(A, D, N) _mm_insert_pi16((A), (D), (N)) #endif /* Compute the element-wise maximum of signed 16-bit values. */ @@ -967,6 +1017,12 @@ _mm_max_pi16 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pmaxsw ((__v4hi)__A, (__v4hi)__B); } +static __inline __m64 +_m_pmaxsw (__m64 __A, __m64 __B) +{ + return _mm_max_pi16 (__A, __B); +} + /* Compute the element-wise maximum of unsigned 8-bit values. */ static __inline __m64 _mm_max_pu8 (__m64 __A, __m64 __B) @@ -974,6 +1030,12 @@ _mm_max_pu8 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pmaxub ((__v8qi)__A, (__v8qi)__B); } +static __inline __m64 +_m_pmaxub (__m64 __A, __m64 __B) +{ + return _mm_max_pu8 (__A, __B); +} + /* Compute the element-wise minimum of signed 16-bit values. */ static __inline __m64 _mm_min_pi16 (__m64 __A, __m64 __B) @@ -981,6 +1043,12 @@ _mm_min_pi16 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pminsw ((__v4hi)__A, (__v4hi)__B); } +static __inline __m64 +_m_pminsw (__m64 __A, __m64 __B) +{ + return _mm_min_pi16 (__A, __B); +} + /* Compute the element-wise minimum of unsigned 8-bit values. */ static __inline __m64 _mm_min_pu8 (__m64 __A, __m64 __B) @@ -988,6 +1056,12 @@ _mm_min_pu8 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pminub ((__v8qi)__A, (__v8qi)__B); } +static __inline __m64 +_m_pminub (__m64 __A, __m64 __B) +{ + return _mm_min_pu8 (__A, __B); +} + /* Create an 8-bit mask of the signs of 8-bit values. */ static __inline int _mm_movemask_pi8 (__m64 __A) @@ -995,6 +1069,12 @@ _mm_movemask_pi8 (__m64 __A) return __builtin_ia32_pmovmskb ((__v8qi)__A); } +static __inline int +_m_pmovmskb (__m64 __A) +{ + return _mm_movemask_pi8 (__A); +} + /* Multiply four unsigned 16-bit values in A by four unsigned 16-bit values in B and produce the high 16 bits of the 32-bit results. */ static __inline __m64 @@ -1003,6 +1083,12 @@ _mm_mulhi_pu16 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pmulhuw ((__v4hi)__A, (__v4hi)__B); } +static __inline __m64 +_m_pmulhuw (__m64 __A, __m64 __B) +{ + return _mm_mulhi_pu16 (__A, __B); +} + /* Return a combination of the four 16-bit values in A. The selector must be an immediate. */ #if 0 @@ -1011,9 +1097,16 @@ _mm_shuffle_pi16 (__m64 __A, int __N) { return (__m64) __builtin_ia32_pshufw ((__v4hi)__A, __N); } + +static __inline __m64 +_m_pshufw (__m64 __A, int __N) +{ + return _mm_shuffle_pi16 (__A, __N); +} #else #define _mm_shuffle_pi16(A, N) \ ((__m64) __builtin_ia32_pshufw ((__v4hi)(A), (N))) +#define _m_pshufw(A, N) _mm_shuffle_pi16 ((A), (N)) #endif /* Conditionally store byte elements of A into P. The high bit of each @@ -1025,6 +1118,12 @@ _mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P) __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P); } +static __inline void +_m_maskmovq (__m64 __A, __m64 __N, char *__P) +{ + _mm_maskmove_si64 (__A, __N, __P); +} + /* Compute the rounded averages of the unsigned 8-bit values in A and B. */ static __inline __m64 _mm_avg_pu8 (__m64 __A, __m64 __B) @@ -1032,6 +1131,12 @@ _mm_avg_pu8 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pavgb ((__v8qi)__A, (__v8qi)__B); } +static __inline __m64 +_m_pavgb (__m64 __A, __m64 __B) +{ + return _mm_avg_pu8 (__A, __B); +} + /* Compute the rounded averages of the unsigned 16-bit values in A and B. */ static __inline __m64 _mm_avg_pu16 (__m64 __A, __m64 __B) @@ -1039,6 +1144,12 @@ _mm_avg_pu16 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_pavgw ((__v4hi)__A, (__v4hi)__B); } +static __inline __m64 +_m_pavgw (__m64 __A, __m64 __B) +{ + return _mm_avg_pu16 (__A, __B); +} + /* Compute the sum of the absolute differences of the unsigned 8-bit values in A and B. Return the value in the lower 16-bit word; the upper words are cleared. */ @@ -1048,6 +1159,12 @@ _mm_sad_pu8 (__m64 __A, __m64 __B) return (__m64) __builtin_ia32_psadbw ((__v8qi)__A, (__v8qi)__B); } +static __inline __m64 +_m_psadbw (__m64 __A, __m64 __B) +{ + return _mm_sad_pu8 (__A, __B); +} + /* Loads one cache line from address P to a location "closer" to the processor. The selector I specifies the type of prefetch operation. */ #if 0 @@ -1106,1469 +1223,8 @@ do { \ (row3) = __builtin_ia32_shufps (__t2, __t3, 0xDD); \ } while (0) -#ifdef __SSE2__ -/* SSE2 */ -typedef int __v2df __attribute__ ((mode (V2DF))); -typedef int __v2di __attribute__ ((mode (V2DI))); -typedef int __v4si __attribute__ ((mode (V4SI))); -typedef int __v8hi __attribute__ ((mode (V8HI))); -typedef int __v16qi __attribute__ ((mode (V16QI))); - -/* Create a selector for use with the SHUFPD instruction. */ -#define _MM_SHUFFLE2(fp1,fp0) \ - (((fp1) << 1) | (fp0)) - -#define __m128i __v2di -#define __m128d __v2df - -/* Create a vector with element 0 as *P and the rest zero. */ -static __inline __m128d -_mm_load_sd (double const *__P) -{ - return (__m128d) __builtin_ia32_loadsd (__P); -} - -/* Create a vector with all two elements equal to *P. */ -static __inline __m128d -_mm_load1_pd (double const *__P) -{ - __v2df __tmp = __builtin_ia32_loadsd (__P); - return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); -} - -static __inline __m128d -_mm_load_pd1 (double const *__P) -{ - return _mm_load1_pd (__P); -} - -/* Load two DPFP values from P. The addresd must be 16-byte aligned. */ -static __inline __m128d -_mm_load_pd (double const *__P) -{ - return (__m128d) __builtin_ia32_loadapd (__P); -} - -/* Load two DPFP values from P. The addresd need not be 16-byte aligned. */ -static __inline __m128d -_mm_loadu_pd (double const *__P) -{ - return (__m128d) __builtin_ia32_loadupd (__P); -} - -/* Load two DPFP values in reverse order. The addresd must be aligned. */ -static __inline __m128d -_mm_loadr_pd (double const *__P) -{ - __v2df __tmp = __builtin_ia32_loadapd (__P); - return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,1)); -} - -/* Create a vector with element 0 as F and the rest zero. */ -static __inline __m128d -_mm_set_sd (double __F) -{ - return (__m128d) __builtin_ia32_loadsd (&__F); -} - -/* Create a vector with all two elements equal to F. */ -static __inline __m128d -_mm_set1_pd (double __F) -{ - __v2df __tmp = __builtin_ia32_loadsd (&__F); - return (__m128d) __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,0)); -} - -static __inline __m128d -_mm_set_pd1 (double __F) -{ - return _mm_set1_pd (__F); -} - -/* Create the vector [Z Y]. */ -static __inline __m128d -_mm_set_pd (double __Z, double __Y) -{ - union { - double __a[2]; - __m128d __v; - } __u; - - __u.__a[0] = __Y; - __u.__a[1] = __Z; - - return __u.__v; -} - -/* Create the vector [Y Z]. */ -static __inline __m128d -_mm_setr_pd (double __Z, double __Y) -{ - return _mm_set_pd (__Y, __Z); -} - -/* Create a vector of zeros. */ -static __inline __m128d -_mm_setzero_pd (void) -{ - return (__m128d) __builtin_ia32_setzeropd (); -} - -/* Stores the lower DPFP value. */ -static __inline void -_mm_store_sd (double *__P, __m128d __A) -{ - __builtin_ia32_storesd (__P, (__v2df)__A); -} - -/* Store the lower DPFP value acrosd two words. */ -static __inline void -_mm_store1_pd (double *__P, __m128d __A) -{ - __v2df __va = (__v2df)__A; - __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,0)); - __builtin_ia32_storeapd (__P, __tmp); -} - -static __inline void -_mm_store_pd1 (double *__P, __m128d __A) -{ - _mm_store1_pd (__P, __A); -} - -/* Store two DPFP values. The addresd must be 16-byte aligned. */ -static __inline void -_mm_store_pd (double *__P, __m128d __A) -{ - __builtin_ia32_storeapd (__P, (__v2df)__A); -} - -/* Store two DPFP values. The addresd need not be 16-byte aligned. */ -static __inline void -_mm_storeu_pd (double *__P, __m128d __A) -{ - __builtin_ia32_storeupd (__P, (__v2df)__A); -} - -/* Store two DPFP values in reverse order. The addresd must be aligned. */ -static __inline void -_mm_storer_pd (double *__P, __m128d __A) -{ - __v2df __va = (__v2df)__A; - __v2df __tmp = __builtin_ia32_shufpd (__va, __va, _MM_SHUFFLE2 (0,1)); - __builtin_ia32_storeapd (__P, __tmp); -} - -/* Sets the low DPFP value of A from the low value of B. */ -static __inline __m128d -_mm_move_sd (__m128d __A, __m128d __B) -{ - return (__m128d) __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); -} - - -static __inline __m128d -_mm_add_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_add_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_sub_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_sub_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_mul_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_mul_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_div_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_div_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_sqrt_pd (__m128d __A) -{ - return (__m128d)__builtin_ia32_sqrtpd ((__v2df)__A); -} - -/* Return pair {sqrt (A[0), B[1]}. */ -static __inline __m128d -_mm_sqrt_sd (__m128d __A, __m128d __B) -{ - __v2df __tmp = __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B); - return (__m128d)__builtin_ia32_sqrtsd ((__v2df)__tmp); -} - -static __inline __m128d -_mm_min_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_minpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_min_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_minsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_max_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_maxpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_max_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_maxsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_and_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_andpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_andnot_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_andnpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_or_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_orpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_xor_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_xorpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpeq_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpeqpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmplt_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpltpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmple_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmplepd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpgt_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpgtpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpge_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpgepd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpneq_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpneqpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpnlt_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpnltpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpnle_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpnlepd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpngt_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpngtpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpnge_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpngepd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpord_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpordpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpunord_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpunordpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpeq_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpeqsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmplt_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpltsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmple_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmplesd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpgt_sd (__m128d __A, __m128d __B) -{ - return (__m128d) __builtin_ia32_movsd ((__v2df) __A, - (__v2df) - __builtin_ia32_cmpltsd ((__v2df) __B, - (__v2df) - __A)); -} - -static __inline __m128d -_mm_cmpge_sd (__m128d __A, __m128d __B) -{ - return (__m128d) __builtin_ia32_movsd ((__v2df) __A, - (__v2df) - __builtin_ia32_cmplesd ((__v2df) __B, - (__v2df) - __A)); -} - -static __inline __m128d -_mm_cmpneq_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpneqsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpnlt_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpnltsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpnle_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpnlesd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpngt_sd (__m128d __A, __m128d __B) -{ - return (__m128d) __builtin_ia32_movsd ((__v2df) __A, - (__v2df) - __builtin_ia32_cmpnltsd ((__v2df) __B, - (__v2df) - __A)); -} - -static __inline __m128d -_mm_cmpnge_sd (__m128d __A, __m128d __B) -{ - return (__m128d) __builtin_ia32_movsd ((__v2df) __A, - (__v2df) - __builtin_ia32_cmpnlesd ((__v2df) __B, - (__v2df) - __A)); -} - -static __inline __m128d -_mm_cmpord_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpordsd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_cmpunord_sd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_cmpunordsd ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comieq_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdeq ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comilt_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdlt ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comile_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdle ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comigt_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdgt ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comige_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdge ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_comineq_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_comisdneq ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomieq_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdeq ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomilt_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdlt ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomile_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdle ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomigt_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdgt ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomige_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdge ((__v2df)__A, (__v2df)__B); -} - -static __inline int -_mm_ucomineq_sd (__m128d __A, __m128d __B) -{ - return __builtin_ia32_ucomisdneq ((__v2df)__A, (__v2df)__B); -} - -/* Create a vector with element 0 as *P and the rest zero. */ - -static __inline __m128i -_mm_load_si128 (__m128i const *__P) -{ - return (__m128i) __builtin_ia32_loaddqa ((char const *)__P); -} - -static __inline __m128i -_mm_loadu_si128 (__m128i const *__P) -{ - return (__m128i) __builtin_ia32_loaddqu ((char const *)__P); -} - -static __inline __m128i -_mm_loadl_epi64 (__m128i const *__P) -{ - return (__m128i) __builtin_ia32_movq2dq (*(unsigned long long *)__P); -} - -static __inline void -_mm_store_si128 (__m128i *__P, __m128i __B) -{ - __builtin_ia32_storedqa ((char *)__P, (__v16qi)__B); -} - -static __inline void -_mm_storeu_si128 (__m128i *__P, __m128i __B) -{ - __builtin_ia32_storedqu ((char *)__P, (__v16qi)__B); -} - -static __inline void -_mm_storel_epi64 (__m128i *__P, __m128i __B) -{ - *(long long *)__P = __builtin_ia32_movdq2q ((__v2di)__B); -} - -static __inline __m64 -_mm_movepi64_pi64 (__m128i __B) -{ - return (__m64) __builtin_ia32_movdq2q ((__v2di)__B); -} - -static __inline __m128i -_mm_move_epi64 (__m128i __A) -{ - return (__m128i) __builtin_ia32_movq ((__v2di)__A); -} - -/* Create a vector of zeros. */ -static __inline __m128i -_mm_setzero_si128 (void) -{ - return (__m128i) __builtin_ia32_setzero128 (); -} - -static __inline __m128i -_mm_set_epi64 (__m64 __A, __m64 __B) -{ - __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); - __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); - return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp2, __tmp); -} - -/* Create the vector [Z Y X W]. */ -static __inline __m128i -_mm_set_epi32 (int __Z, int __Y, int __X, int __W) -{ - union { - int __a[4]; - __m128i __v; - } __u; - - __u.__a[0] = __W; - __u.__a[1] = __X; - __u.__a[2] = __Y; - __u.__a[3] = __Z; - - return __u.__v; -} - -#ifdef __x86_64__ -/* Create the vector [Z Y]. */ -static __inline __m128i -_mm_set_epi64x (long long __Z, long long __Y) -{ - union { - long __a[2]; - __m128i __v; - } __u; - - __u.__a[0] = __Y; - __u.__a[1] = __Z; - - return __u.__v; -} -#endif - -/* Create the vector [S T U V Z Y X W]. */ -static __inline __m128i -_mm_set_epi16 (short __Z, short __Y, short __X, short __W, - short __V, short __U, short __T, short __S) -{ - union { - short __a[8]; - __m128i __v; - } __u; - - __u.__a[0] = __S; - __u.__a[1] = __T; - __u.__a[2] = __U; - __u.__a[3] = __V; - __u.__a[4] = __W; - __u.__a[5] = __X; - __u.__a[6] = __Y; - __u.__a[7] = __Z; - - return __u.__v; -} - -/* Create the vector [S T U V Z Y X W]. */ -static __inline __m128i -_mm_set_epi8 (char __Z, char __Y, char __X, char __W, - char __V, char __U, char __T, char __S, - char __Z1, char __Y1, char __X1, char __W1, - char __V1, char __U1, char __T1, char __S1) -{ - union { - char __a[16]; - __m128i __v; - } __u; - - __u.__a[0] = __S1; - __u.__a[1] = __T1; - __u.__a[2] = __U1; - __u.__a[3] = __V1; - __u.__a[4] = __W1; - __u.__a[5] = __X1; - __u.__a[6] = __Y1; - __u.__a[7] = __Z1; - __u.__a[8] = __S; - __u.__a[9] = __T; - __u.__a[10] = __U; - __u.__a[11] = __V; - __u.__a[12] = __W; - __u.__a[13] = __X; - __u.__a[14] = __Y; - __u.__a[15] = __Z; - - return __u.__v; -} - -static __inline __m128i -_mm_set1_epi64 (__m64 __A) -{ - __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); - return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp); -} - -static __inline __m128i -_mm_set1_epi32 (int __A) -{ - __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__A); - return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); -} - -#ifdef __x86_64__ -static __inline __m128i -_mm_set1_epi64x (long long __A) -{ - __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); - return (__m128i) __builtin_ia32_shufpd ((__v2df)__tmp, (__v2df)__tmp, _MM_SHUFFLE2 (0,0)); -} -#endif - -static __inline __m128i -_mm_set1_epi16 (short __A) -{ - int __Acopy = (unsigned short)__A; - __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); - __tmp = (__v4si)__builtin_ia32_punpcklwd128 ((__v8hi)__tmp, (__v8hi)__tmp); - return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); -} - -static __inline __m128i -_mm_set1_epi8 (char __A) -{ - int __Acopy = (unsigned char)__A; - __v4si __tmp = (__v4si)__builtin_ia32_loadd (&__Acopy); - __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); - __tmp = (__v4si)__builtin_ia32_punpcklbw128 ((__v16qi)__tmp, (__v16qi)__tmp); - return (__m128i) __builtin_ia32_pshufd ((__v4si)__tmp, _MM_SHUFFLE (0,0,0,0)); -} - -static __inline __m128i -_mm_setr_epi64 (__m64 __A, __m64 __B) -{ - __v2di __tmp = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__A); - __v2di __tmp2 = (__v2di)__builtin_ia32_movq2dq ((unsigned long long)__B); - return (__m128i)__builtin_ia32_punpcklqdq128 (__tmp, __tmp2); -} - -/* Create the vector [Z Y X W]. */ -static __inline __m128i -_mm_setr_epi32 (int __W, int __X, int __Y, int __Z) -{ - union { - int __a[4]; - __m128i __v; - } __u; - - __u.__a[0] = __W; - __u.__a[1] = __X; - __u.__a[2] = __Y; - __u.__a[3] = __Z; - - return __u.__v; -} -/* Create the vector [S T U V Z Y X W]. */ -static __inline __m128i -_mm_setr_epi16 (short __S, short __T, short __U, short __V, - short __W, short __X, short __Y, short __Z) -{ - union { - short __a[8]; - __m128i __v; - } __u; - - __u.__a[0] = __S; - __u.__a[1] = __T; - __u.__a[2] = __U; - __u.__a[3] = __V; - __u.__a[4] = __W; - __u.__a[5] = __X; - __u.__a[6] = __Y; - __u.__a[7] = __Z; - - return __u.__v; -} - -/* Create the vector [S T U V Z Y X W]. */ -static __inline __m128i -_mm_setr_epi8 (char __S1, char __T1, char __U1, char __V1, - char __W1, char __X1, char __Y1, char __Z1, - char __S, char __T, char __U, char __V, - char __W, char __X, char __Y, char __Z) -{ - union { - char __a[16]; - __m128i __v; - } __u; - - __u.__a[0] = __S1; - __u.__a[1] = __T1; - __u.__a[2] = __U1; - __u.__a[3] = __V1; - __u.__a[4] = __W1; - __u.__a[5] = __X1; - __u.__a[6] = __Y1; - __u.__a[7] = __Z1; - __u.__a[8] = __S; - __u.__a[9] = __T; - __u.__a[10] = __U; - __u.__a[11] = __V; - __u.__a[12] = __W; - __u.__a[13] = __X; - __u.__a[14] = __Y; - __u.__a[15] = __Z; - - return __u.__v; -} - -static __inline __m128d -_mm_cvtepi32_pd (__m128i __A) -{ - return (__m128d)__builtin_ia32_cvtdq2pd ((__v4si) __A); -} - -static __inline __m128 -_mm_cvtepi32_ps (__m128i __A) -{ - return (__m128)__builtin_ia32_cvtdq2ps ((__v4si) __A); -} - -static __inline __m128i -_mm_cvtpd_epi32 (__m128d __A) -{ - return (__m128i)__builtin_ia32_cvtpd2dq ((__v2df) __A); -} - -static __inline __m64 -_mm_cvtpd_pi32 (__m128d __A) -{ - return (__m64)__builtin_ia32_cvtpd2pi ((__v2df) __A); -} - -static __inline __m128 -_mm_cvtpd_ps (__m128d __A) -{ - return (__m128)__builtin_ia32_cvtpd2ps ((__v2df) __A); -} - -static __inline __m128i -_mm_cvttpd_epi32 (__m128d __A) -{ - return (__m128i)__builtin_ia32_cvttpd2dq ((__v2df) __A); -} - -static __inline __m64 -_mm_cvttpd_pi32 (__m128d __A) -{ - return (__m64)__builtin_ia32_cvttpd2pi ((__v2df) __A); -} - -static __inline __m128d -_mm_cvtpi32_pd (__m64 __A) -{ - return (__m128d)__builtin_ia32_cvtpi2pd ((__v2si) __A); -} - -static __inline __m128i -_mm_cvtps_epi32 (__m128 __A) -{ - return (__m128i)__builtin_ia32_cvtps2dq ((__v4sf) __A); -} - -static __inline __m128i -_mm_cvttps_epi32 (__m128 __A) -{ - return (__m128i)__builtin_ia32_cvttps2dq ((__v4sf) __A); -} - -static __inline __m128d -_mm_cvtps_pd (__m128 __A) -{ - return (__m128d)__builtin_ia32_cvtps2pd ((__v4sf) __A); -} - -static __inline int -_mm_cvtsd_si32 (__m128d __A) -{ - return __builtin_ia32_cvtsd2si ((__v2df) __A); -} - -#ifdef __x86_64__ -static __inline long long -_mm_cvtsd_si64x (__m128d __A) -{ - return __builtin_ia32_cvtsd2si64 ((__v2df) __A); -} -#endif - -static __inline int -_mm_cvttsd_si32 (__m128d __A) -{ - return __builtin_ia32_cvttsd2si ((__v2df) __A); -} - -#ifdef __x86_64__ -static __inline long long -_mm_cvttsd_si64x (__m128d __A) -{ - return __builtin_ia32_cvttsd2si64 ((__v2df) __A); -} -#endif - -static __inline __m128 -_mm_cvtsd_ss (__m128 __A, __m128d __B) -{ - return (__m128)__builtin_ia32_cvtsd2ss ((__v4sf) __A, (__v2df) __B); -} - -static __inline __m128d -_mm_cvtsi32_sd (__m128d __A, int __B) -{ - return (__m128d)__builtin_ia32_cvtsi2sd ((__v2df) __A, __B); -} - -#ifdef __x86_64__ -static __inline __m128d -_mm_cvtsi64x_sd (__m128d __A, long long __B) -{ - return (__m128d)__builtin_ia32_cvtsi642sd ((__v2df) __A, __B); -} -#endif - -static __inline __m128d -_mm_cvtss_sd (__m128d __A, __m128 __B) -{ - return (__m128d)__builtin_ia32_cvtss2sd ((__v2df) __A, (__v4sf)__B); -} - -#define _mm_shuffle_pd(__A, __B, __C) ((__m128d)__builtin_ia32_shufpd ((__v2df)__A, (__v2df)__B, (__C))) - -static __inline __m128d -_mm_unpackhi_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_unpckhpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_unpacklo_pd (__m128d __A, __m128d __B) -{ - return (__m128d)__builtin_ia32_unpcklpd ((__v2df)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_loadh_pd (__m128d __A, double const *__B) -{ - return (__m128d)__builtin_ia32_loadhpd ((__v2df)__A, (__v2si *)__B); -} - -static __inline void -_mm_storeh_pd (double *__A, __m128d __B) -{ - __builtin_ia32_storehpd ((__v2si *)__A, (__v2df)__B); -} - -static __inline __m128d -_mm_loadl_pd (__m128d __A, double const *__B) -{ - return (__m128d)__builtin_ia32_loadlpd ((__v2df)__A, (__v2si *)__B); -} - -static __inline void -_mm_storel_pd (double *__A, __m128d __B) -{ - __builtin_ia32_storelpd ((__v2si *)__A, (__v2df)__B); -} - -static __inline int -_mm_movemask_pd (__m128d __A) -{ - return __builtin_ia32_movmskpd ((__v2df)__A); -} - -static __inline __m128i -_mm_packs_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_packsswb128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_packs_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_packssdw128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_packus_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_packuswb128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_unpackhi_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpckhbw128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_unpackhi_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpckhwd128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_unpackhi_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpckhdq128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_unpackhi_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpckhqdq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_unpacklo_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpcklbw128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_unpacklo_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpcklwd128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_unpacklo_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpckldq128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_unpacklo_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_punpcklqdq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_add_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_add_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_add_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddd128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_add_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_adds_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddsb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_adds_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddsw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_adds_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddusb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_adds_epu16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_paddusw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_sub_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_sub_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_sub_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubd128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_sub_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_subs_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubsb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_subs_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubsw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_subs_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubusb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_subs_epu16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psubusw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_madd_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmaddwd128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_mulhi_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmulhw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_mullo_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmullw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m64 -_mm_mul_su32 (__m64 __A, __m64 __B) -{ - return (__m64)__builtin_ia32_pmuludq ((__v2si)__A, (__v2si)__B); -} - -static __inline __m128i -_mm_mul_epu32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmuludq128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_sll_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psllw128 ((__v8hi)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_sll_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pslld128 ((__v4si)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_sll_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psllq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_sra_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psraw128 ((__v8hi)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_sra_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psrad128 ((__v4si)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_srl_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psrlw128 ((__v8hi)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_srl_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psrld128 ((__v4si)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_srl_epi64 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psrlq128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_slli_epi16 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psllwi128 ((__v8hi)__A, __B); -} - -static __inline __m128i -_mm_slli_epi32 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_pslldi128 ((__v4si)__A, __B); -} - -static __inline __m128i -_mm_slli_epi64 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psllqi128 ((__v2di)__A, __B); -} - -static __inline __m128i -_mm_srai_epi16 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psrawi128 ((__v8hi)__A, __B); -} - -static __inline __m128i -_mm_srai_epi32 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psradi128 ((__v4si)__A, __B); -} - -#if 0 -static __m128i __attribute__((__always_inline__)) -_mm_srli_si128 (__m128i __A, const int __B) -{ - return ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) -} - -static __m128i __attribute__((__always_inline__)) -_mm_srli_si128 (__m128i __A, const int __B) -{ - return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) -} -#endif -#define _mm_srli_si128(__A, __B) ((__m128i)__builtin_ia32_psrldqi128 (__A, __B)) -#define _mm_slli_si128(__A, __B) ((__m128i)__builtin_ia32_pslldqi128 (__A, __B)) - -static __inline __m128i -_mm_srli_epi16 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psrlwi128 ((__v8hi)__A, __B); -} - -static __inline __m128i -_mm_srli_epi32 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psrldi128 ((__v4si)__A, __B); -} - -static __inline __m128i -_mm_srli_epi64 (__m128i __A, int __B) -{ - return (__m128i)__builtin_ia32_psrlqi128 ((__v2di)__A, __B); -} - -static __inline __m128i -_mm_and_si128 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pand128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_andnot_si128 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pandn128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_or_si128 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_por128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_xor_si128 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pxor128 ((__v2di)__A, (__v2di)__B); -} - -static __inline __m128i -_mm_cmpeq_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpeqb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_cmpeq_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpeqw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_cmpeq_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B); -} - -static __inline __m128i -_mm_cmplt_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__B, (__v16qi)__A); -} - -static __inline __m128i -_mm_cmplt_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__B, (__v8hi)__A); -} - -static __inline __m128i -_mm_cmplt_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__B, (__v4si)__A); -} - -static __inline __m128i -_mm_cmpgt_epi8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_cmpgt_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_cmpgt_epi32 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__A, (__v4si)__B); -} - -#define _mm_extract_epi16(__A, __B) __builtin_ia32_pextrw128 ((__v8hi)__A, __B) - -#define _mm_insert_epi16(__A, __B, __C) ((__m128i)__builtin_ia32_pinsrw128 ((__v8hi)__A, __B, __C)) - -static __inline __m128i -_mm_max_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmaxsw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_max_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmaxub128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_min_epi16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pminsw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_min_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pminub128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline int -_mm_movemask_epi8 (__m128i __A) -{ - return __builtin_ia32_pmovmskb128 ((__v16qi)__A); -} - -static __inline __m128i -_mm_mulhi_epu16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pmulhuw128 ((__v8hi)__A, (__v8hi)__B); -} - -#define _mm_shufflehi_epi16(__A, __B) ((__m128i)__builtin_ia32_pshufhw ((__v8hi)__A, __B)) -#define _mm_shufflelo_epi16(__A, __B) ((__m128i)__builtin_ia32_pshuflw ((__v8hi)__A, __B)) -#define _mm_shuffle_epi32(__A, __B) ((__m128i)__builtin_ia32_pshufd ((__v4si)__A, __B)) - -static __inline void -_mm_maskmoveu_si128 (__m128i __A, __m128i __B, char *__C) -{ - __builtin_ia32_maskmovdqu ((__v16qi)__A, (__v16qi)__B, __C); -} - -static __inline __m128i -_mm_avg_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pavgb128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline __m128i -_mm_avg_epu16 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_pavgw128 ((__v8hi)__A, (__v8hi)__B); -} - -static __inline __m128i -_mm_sad_epu8 (__m128i __A, __m128i __B) -{ - return (__m128i)__builtin_ia32_psadbw128 ((__v16qi)__A, (__v16qi)__B); -} - -static __inline void -_mm_stream_si32 (int *__A, int __B) -{ - __builtin_ia32_movnti (__A, __B); -} - -static __inline void -_mm_stream_si128 (__m128i *__A, __m128i __B) -{ - __builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B); -} - -static __inline void -_mm_stream_pd (double *__A, __m128d __B) -{ - __builtin_ia32_movntpd (__A, (__v2df)__B); -} - -static __inline __m128i -_mm_movpi64_epi64 (__m64 __A) -{ - return (__m128i)__builtin_ia32_movq2dq ((unsigned long long)__A); -} - -static __inline void -_mm_clflush (void const *__A) -{ - return __builtin_ia32_clflush (__A); -} - -static __inline void -_mm_lfence (void) -{ - __builtin_ia32_lfence (); -} - -static __inline void -_mm_mfence (void) -{ - __builtin_ia32_mfence (); -} - -static __inline __m128i -_mm_cvtsi32_si128 (int __A) -{ - return (__m128i) __builtin_ia32_loadd (&__A); -} - -#ifdef __x86_64__ -static __inline __m128i -_mm_cvtsi64x_si128 (long long __A) -{ - return (__m128i) __builtin_ia32_movq2dq (__A); -} -#endif - -static __inline int -_mm_cvtsi128_si32 (__m128i __A) -{ - int __tmp; - __builtin_ia32_stored (&__tmp, (__v4si)__A); - return __tmp; -} - -#ifdef __x86_64__ -static __inline long long -_mm_cvtsi128_si64x (__m128i __A) -{ - return __builtin_ia32_movdq2q ((__v2di)__A); -} -#endif - -#endif /* __SSE2__ */ +/* For backward source compatibility. */ +#include #endif /* __SSE__ */ #endif /* _XMMINTRIN_H_INCLUDED */ diff --git a/contrib/gcc/config/ia64/hpux.h b/contrib/gcc/config/ia64/hpux.h index 56c601b4cde7..90303eace1fc 100644 --- a/contrib/gcc/config/ia64/hpux.h +++ b/contrib/gcc/config/ia64/hpux.h @@ -49,6 +49,13 @@ do { \ } \ } while (0) +#undef CPP_SPEC +#define CPP_SPEC \ + "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}" +/* aCC defines also -DRWSTD_MULTI_THREAD, -DRW_MULTI_THREAD. These + affect only aCC's C++ library (Rogue Wave-derived) which we do not + use, and they violate the user's name space. */ + #undef ASM_EXTRA_SPEC #define ASM_EXTRA_SPEC "%{milp32:-milp32} %{mlp64:-mlp64}" @@ -68,6 +75,7 @@ do { \ #undef LIB_SPEC #define LIB_SPEC \ "%{!shared: \ + %{mt|pthread:-lpthread} \ %{p:%{!mlp64:-L/usr/lib/hpux32/libp} \ %{mlp64:-L/usr/lib/hpux64/libp} -lprof} \ %{pg:%{!mlp64:-L/usr/lib/hpux32/libp} \ @@ -134,6 +142,10 @@ do { \ #undef TARGET_HPUX_LD #define TARGET_HPUX_LD 1 +/* The HPUX dynamic linker objects to weak symbols with no + definitions, so do not use them in gthr-posix.h. */ +#define GTHREAD_USE_WEAK 0 + /* Put out the needed function declarations at the end. */ #define ASM_FILE_END(STREAM) ia64_hpux_asm_file_end(STREAM) @@ -144,6 +156,10 @@ do { \ #undef DTORS_SECTION_ASM_OP #define DTORS_SECTION_ASM_OP "\t.section\t.fini_array,\t\"aw\",\"fini_array\"" +/* The init_array/fini_array technique does not permit the use of + initialization priorities. */ +#define SUPPORTS_INIT_PRIORITY 0 + #undef READONLY_DATA_SECTION_ASM_OP #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rodata,\t\"a\",\t\"progbits\"" diff --git a/contrib/gcc/config/ia64/ia64-protos.h b/contrib/gcc/config/ia64/ia64-protos.h index 72c2279cb047..f25bb02133d2 100644 --- a/contrib/gcc/config/ia64/ia64-protos.h +++ b/contrib/gcc/config/ia64/ia64-protos.h @@ -135,6 +135,9 @@ extern void ia64_override_options PARAMS((void)); extern int ia64_dbx_register_number PARAMS((int)); extern bool ia64_function_ok_for_sibcall PARAMS ((tree)); +extern rtx ia64_return_addr_rtx PARAMS ((HOST_WIDE_INT, rtx)); +extern void ia64_split_return_addr_rtx PARAMS ((rtx)); + #ifdef SDATA_SECTION_ASM_OP extern void sdata_section PARAMS ((void)); #endif diff --git a/contrib/gcc/config/ia64/ia64.c b/contrib/gcc/config/ia64/ia64.c index 0f34d8f3a9a4..12f3204d95d2 100644 --- a/contrib/gcc/config/ia64/ia64.c +++ b/contrib/gcc/config/ia64/ia64.c @@ -175,8 +175,9 @@ static rtx ia64_expand_fetch_and_op PARAMS ((optab, enum machine_mode, tree, rtx)); static rtx ia64_expand_op_and_fetch PARAMS ((optab, enum machine_mode, tree, rtx)); -static rtx ia64_expand_compare_and_swap PARAMS ((enum machine_mode, int, - tree, rtx)); +static rtx ia64_expand_compare_and_swap PARAMS ((enum machine_mode, + enum machine_mode, + int, tree, rtx)); static rtx ia64_expand_lock_test_and_set PARAMS ((enum machine_mode, tree, rtx)); static rtx ia64_expand_lock_release PARAMS ((enum machine_mode, tree, rtx)); @@ -1154,6 +1155,7 @@ ia64_expand_move (op0, op1) if ((tls_kind = tls_symbolic_operand (op1, Pmode))) { rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp, insns; + rtx orig_op0 = op0; switch (tls_kind) { @@ -1177,8 +1179,10 @@ ia64_expand_move (op0, op1) insns = get_insns (); end_sequence (); + if (GET_MODE (op0) != Pmode) + op0 = tga_ret; emit_libcall_block (insns, op0, tga_ret, op1); - return NULL_RTX; + break; case TLS_MODEL_LOCAL_DYNAMIC: /* ??? This isn't the completely proper way to do local-dynamic @@ -1206,20 +1210,15 @@ ia64_expand_move (op0, op1) tmp = gen_reg_rtx (Pmode); emit_libcall_block (insns, tmp, tga_ret, tga_eqv); - if (register_operand (op0, Pmode)) - tga_ret = op0; - else - tga_ret = gen_reg_rtx (Pmode); + if (!register_operand (op0, Pmode)) + op0 = gen_reg_rtx (Pmode); if (TARGET_TLS64) { - emit_insn (gen_load_dtprel (tga_ret, op1)); - emit_insn (gen_adddi3 (tga_ret, tmp, tga_ret)); + emit_insn (gen_load_dtprel (op0, op1)); + emit_insn (gen_adddi3 (op0, tmp, op0)); } else - emit_insn (gen_add_dtprel (tga_ret, tmp, op1)); - if (tga_ret == op0) - return NULL_RTX; - op1 = tga_ret; + emit_insn (gen_add_dtprel (op0, tmp, op1)); break; case TLS_MODEL_INITIAL_EXEC: @@ -1229,35 +1228,32 @@ ia64_expand_move (op0, op1) RTX_UNCHANGING_P (tmp) = 1; tmp = force_reg (Pmode, tmp); - if (register_operand (op0, Pmode)) - op1 = op0; - else - op1 = gen_reg_rtx (Pmode); - emit_insn (gen_adddi3 (op1, tmp, gen_thread_pointer ())); - if (op1 == op0) - return NULL_RTX; + if (!register_operand (op0, Pmode)) + op0 = gen_reg_rtx (Pmode); + emit_insn (gen_adddi3 (op0, tmp, gen_thread_pointer ())); break; case TLS_MODEL_LOCAL_EXEC: - if (register_operand (op0, Pmode)) - tmp = op0; - else - tmp = gen_reg_rtx (Pmode); + if (!register_operand (op0, Pmode)) + op0 = gen_reg_rtx (Pmode); if (TARGET_TLS64) { - emit_insn (gen_load_tprel (tmp, op1)); - emit_insn (gen_adddi3 (tmp, gen_thread_pointer (), tmp)); + emit_insn (gen_load_tprel (op0, op1)); + emit_insn (gen_adddi3 (op0, gen_thread_pointer (), op0)); } else - emit_insn (gen_add_tprel (tmp, gen_thread_pointer (), op1)); - if (tmp == op0) - return NULL_RTX; - op1 = tmp; + emit_insn (gen_add_tprel (op0, gen_thread_pointer (), op1)); break; default: abort (); } + + if (orig_op0 == op0) + return NULL_RTX; + if (GET_MODE (orig_op0) == Pmode) + return op0; + return gen_lowpart (GET_MODE (orig_op0), op0); } else if (!TARGET_NO_PIC && (symbolic_operand (op1, Pmode) || @@ -2015,10 +2011,6 @@ ia64_initial_elimination_offset (from, to) abort (); break; - case RETURN_ADDRESS_POINTER_REGNUM: - offset = 0; - break; - default: abort (); } @@ -2369,17 +2361,6 @@ ia64_expand_prologue () reg_names[current_frame_info.reg_fp] = tmp; } - /* Fix up the return address placeholder. */ - /* ??? We can fail if __builtin_return_address is used, and we didn't - allocate a register in which to save b0. I can't think of a way to - eliminate RETURN_ADDRESS_POINTER_REGNUM to a local register and - then be sure that I got the right one. Further, reload doesn't seem - to care if an eliminable register isn't used, and "eliminates" it - anyway. */ - if (regs_ever_live[RETURN_ADDRESS_POINTER_REGNUM] - && current_frame_info.reg_save_b0 != 0) - XINT (return_address_pointer_rtx, 0) = current_frame_info.reg_save_b0; - /* We don't need an alloc instruction if we've used no outputs or locals. */ if (current_frame_info.n_local_regs == 0 && current_frame_info.n_output_regs == 0 @@ -2936,6 +2917,72 @@ ia64_direct_return () return 0; } +/* Return the magic cookie that we use to hold the return address + during early compilation. */ + +rtx +ia64_return_addr_rtx (count, frame) + HOST_WIDE_INT count; + rtx frame ATTRIBUTE_UNUSED; +{ + if (count != 0) + return NULL; + return gen_rtx_UNSPEC (Pmode, gen_rtvec (1, const0_rtx), UNSPEC_RET_ADDR); +} + +/* Split this value after reload, now that we know where the return + address is saved. */ + +void +ia64_split_return_addr_rtx (dest) + rtx dest; +{ + rtx src; + + if (TEST_HARD_REG_BIT (current_frame_info.mask, BR_REG (0))) + { + if (current_frame_info.reg_save_b0 != 0) + src = gen_rtx_REG (DImode, current_frame_info.reg_save_b0); + else + { + HOST_WIDE_INT off; + unsigned int regno; + + /* Compute offset from CFA for BR0. */ + /* ??? Must be kept in sync with ia64_expand_prologue. */ + off = (current_frame_info.spill_cfa_off + + current_frame_info.spill_size); + for (regno = GR_REG (1); regno <= GR_REG (31); ++regno) + if (TEST_HARD_REG_BIT (current_frame_info.mask, regno)) + off -= 8; + + /* Convert CFA offset to a register based offset. */ + if (frame_pointer_needed) + src = hard_frame_pointer_rtx; + else + { + src = stack_pointer_rtx; + off += current_frame_info.total_size; + } + + /* Load address into scratch register. */ + if (CONST_OK_FOR_I (off)) + emit_insn (gen_adddi3 (dest, src, GEN_INT (off))); + else + { + emit_move_insn (dest, GEN_INT (off)); + emit_insn (gen_adddi3 (dest, src, dest)); + } + + src = gen_rtx_MEM (Pmode, dest); + } + } + else + src = gen_rtx_REG (DImode, BR_REG (0)); + + emit_move_insn (dest, src); +} + int ia64_hard_regno_rename_ok (from, to) int from; @@ -3085,9 +3132,6 @@ ia64_output_function_epilogue (file, size) { int i; - /* Reset from the function's potential modifications. */ - XINT (return_address_pointer_rtx, 0) = RETURN_ADDRESS_POINTER_REGNUM; - if (current_frame_info.reg_fp) { const char *tmp = reg_names[HARD_FRAME_POINTER_REGNUM]; @@ -7060,7 +7104,8 @@ ia64_emit_nops () { while (bundle_pos < 3) { - emit_insn_before (gen_nop_type (b->t[bundle_pos]), insn); + if (b->t[bundle_pos] != TYPE_L) + emit_insn_before (gen_nop_type (b->t[bundle_pos]), insn); bundle_pos++; } continue; @@ -7666,11 +7711,16 @@ ia64_init_builtins () psi_type_node, integer_type_node, integer_type_node, NULL_TREE); - /* __sync_val_compare_and_swap_di, __sync_bool_compare_and_swap_di */ + /* __sync_val_compare_and_swap_di */ tree di_ftype_pdi_di_di = build_function_type_list (long_integer_type_node, pdi_type_node, long_integer_type_node, long_integer_type_node, NULL_TREE); + /* __sync_bool_compare_and_swap_di */ + tree si_ftype_pdi_di_di + = build_function_type_list (integer_type_node, + pdi_type_node, long_integer_type_node, + long_integer_type_node, NULL_TREE); /* __sync_synchronize */ tree void_ftype_void = build_function_type (void_type_node, void_list_node); @@ -7703,7 +7753,7 @@ ia64_init_builtins () IA64_BUILTIN_VAL_COMPARE_AND_SWAP_DI); def_builtin ("__sync_bool_compare_and_swap_si", si_ftype_psi_si_si, IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_SI); - def_builtin ("__sync_bool_compare_and_swap_di", di_ftype_pdi_di_di, + def_builtin ("__sync_bool_compare_and_swap_di", si_ftype_pdi_di_di, IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_DI); def_builtin ("__sync_synchronize", void_ftype_void, @@ -7943,7 +7993,8 @@ ia64_expand_op_and_fetch (binoptab, mode, arglist, target) */ static rtx -ia64_expand_compare_and_swap (mode, boolp, arglist, target) +ia64_expand_compare_and_swap (rmode, mode, boolp, arglist, target) + enum machine_mode rmode; enum machine_mode mode; int boolp; tree arglist; @@ -7991,7 +8042,7 @@ ia64_expand_compare_and_swap (mode, boolp, arglist, target) if (boolp) { if (! target) - target = gen_reg_rtx (mode); + target = gen_reg_rtx (rmode); return emit_store_flag_force (target, EQ, tmp, old, mode, 1, 1); } else @@ -8066,11 +8117,16 @@ ia64_expand_builtin (exp, target, subtarget, mode, ignore) tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0); unsigned int fcode = DECL_FUNCTION_CODE (fndecl); tree arglist = TREE_OPERAND (exp, 1); + enum machine_mode rmode = VOIDmode; switch (fcode) { case IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_SI: case IA64_BUILTIN_VAL_COMPARE_AND_SWAP_SI: + mode = SImode; + rmode = SImode; + break; + case IA64_BUILTIN_LOCK_TEST_AND_SET_SI: case IA64_BUILTIN_LOCK_RELEASE_SI: case IA64_BUILTIN_FETCH_AND_ADD_SI: @@ -8089,7 +8145,15 @@ ia64_expand_builtin (exp, target, subtarget, mode, ignore) break; case IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_DI: + mode = DImode; + rmode = SImode; + break; + case IA64_BUILTIN_VAL_COMPARE_AND_SWAP_DI: + mode = DImode; + rmode = DImode; + break; + case IA64_BUILTIN_LOCK_TEST_AND_SET_DI: case IA64_BUILTIN_LOCK_RELEASE_DI: case IA64_BUILTIN_FETCH_AND_ADD_DI: @@ -8115,11 +8179,13 @@ ia64_expand_builtin (exp, target, subtarget, mode, ignore) { case IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_SI: case IA64_BUILTIN_BOOL_COMPARE_AND_SWAP_DI: - return ia64_expand_compare_and_swap (mode, 1, arglist, target); + return ia64_expand_compare_and_swap (rmode, mode, 1, arglist, + target); case IA64_BUILTIN_VAL_COMPARE_AND_SWAP_SI: case IA64_BUILTIN_VAL_COMPARE_AND_SWAP_DI: - return ia64_expand_compare_and_swap (mode, 0, arglist, target); + return ia64_expand_compare_and_swap (rmode, mode, 0, arglist, + target); case IA64_BUILTIN_SYNCHRONIZE: emit_insn (gen_mf ()); @@ -8368,6 +8434,9 @@ ia64_output_mi_thunk (file, thunk, delta, vcall_offset, function) emit_note (NULL, NOTE_INSN_PROLOGUE_END); this = gen_rtx_REG (Pmode, IN_REG (0)); + if (TARGET_ILP32) + emit_insn (gen_ptr_extend (this, + gen_rtx_REG (ptr_mode, IN_REG (0)))); /* Apply the constant offset, if required. */ if (delta) @@ -8389,7 +8458,14 @@ ia64_output_mi_thunk (file, thunk, delta, vcall_offset, function) rtx vcall_offset_rtx = GEN_INT (vcall_offset); rtx tmp = gen_rtx_REG (Pmode, 2); - emit_move_insn (tmp, gen_rtx_MEM (Pmode, this)); + if (TARGET_ILP32) + { + rtx t = gen_rtx_REG (ptr_mode, 2); + emit_move_insn (t, gen_rtx_MEM (ptr_mode, this)); + emit_insn (gen_ptr_extend (tmp, t)); + } + else + emit_move_insn (tmp, gen_rtx_MEM (Pmode, this)); if (!CONST_OK_FOR_J (vcall_offset)) { @@ -8399,7 +8475,11 @@ ia64_output_mi_thunk (file, thunk, delta, vcall_offset, function) } emit_insn (gen_adddi3 (tmp, tmp, vcall_offset_rtx)); - emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp)); + if (TARGET_ILP32) + emit_move_insn (gen_rtx_REG (ptr_mode, 2), + gen_rtx_MEM (ptr_mode, tmp)); + else + emit_move_insn (tmp, gen_rtx_MEM (Pmode, tmp)); emit_insn (gen_adddi3 (this, this, tmp)); } diff --git a/contrib/gcc/config/ia64/ia64.h b/contrib/gcc/config/ia64/ia64.h index 724405a8c5f9..60d014363c1e 100644 --- a/contrib/gcc/config/ia64/ia64.h +++ b/contrib/gcc/config/ia64/ia64.h @@ -436,7 +436,7 @@ while (0) 64 predicate registers, 8 branch registers, one frame pointer, and several "application" registers. */ -#define FIRST_PSEUDO_REGISTER 335 +#define FIRST_PSEUDO_REGISTER 334 /* Ranges for the various kinds of registers. */ #define ADDL_REGNO_P(REGNO) ((unsigned HOST_WIDE_INT) (REGNO) <= 3) @@ -445,9 +445,7 @@ while (0) #define PR_REGNO_P(REGNO) ((REGNO) >= 256 && (REGNO) <= 319) #define BR_REGNO_P(REGNO) ((REGNO) >= 320 && (REGNO) <= 327) #define GENERAL_REGNO_P(REGNO) \ - (GR_REGNO_P (REGNO) \ - || (REGNO) == FRAME_POINTER_REGNUM \ - || (REGNO) == RETURN_ADDRESS_POINTER_REGNUM) + (GR_REGNO_P (REGNO) || (REGNO) == FRAME_POINTER_REGNUM) #define GR_REG(REGNO) ((REGNO) + 0) #define FR_REG(REGNO) ((REGNO) + 128) @@ -457,11 +455,11 @@ while (0) #define IN_REG(REGNO) ((REGNO) + 112) #define LOC_REG(REGNO) ((REGNO) + 32) -#define AR_CCV_REGNUM 330 -#define AR_UNAT_REGNUM 331 -#define AR_PFS_REGNUM 332 -#define AR_LC_REGNUM 333 -#define AR_EC_REGNUM 334 +#define AR_CCV_REGNUM 329 +#define AR_UNAT_REGNUM 330 +#define AR_PFS_REGNUM 331 +#define AR_LC_REGNUM 332 +#define AR_EC_REGNUM 333 #define IN_REGNO_P(REGNO) ((REGNO) >= IN_REG (0) && (REGNO) <= IN_REG (7)) #define LOC_REGNO_P(REGNO) ((REGNO) >= LOC_REG (0) && (REGNO) <= LOC_REG (79)) @@ -524,8 +522,8 @@ while (0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ /* Branch registers. */ \ 0, 0, 0, 0, 0, 0, 0, 0, \ - /*FP RA CCV UNAT PFS LC EC */ \ - 1, 1, 1, 1, 1, 0, 1 \ + /*FP CCV UNAT PFS LC EC */ \ + 1, 1, 1, 1, 0, 1 \ } /* Like `FIXED_REGISTERS' but has 1 for each register that is clobbered @@ -559,8 +557,8 @@ while (0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ /* Branch registers. */ \ 1, 0, 0, 0, 0, 0, 1, 1, \ - /*FP RA CCV UNAT PFS LC EC */ \ - 1, 1, 1, 1, 1, 0, 1 \ + /*FP CCV UNAT PFS LC EC */ \ + 1, 1, 1, 1, 0, 1 \ } /* Like `CALL_USED_REGISTERS' but used to overcome a historical @@ -597,8 +595,8 @@ while (0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ /* Branch registers. */ \ 1, 0, 0, 0, 0, 0, 1, 1, \ - /*FP RA CCV UNAT PFS LC EC */ \ - 0, 0, 1, 0, 1, 0, 0 \ + /*FP CCV UNAT PFS LC EC */ \ + 0, 1, 0, 1, 0, 0 \ } @@ -744,7 +742,7 @@ while (0) /* Special branch registers. */ \ R_BR (0), \ /* Other fixed registers. */ \ - FRAME_POINTER_REGNUM, RETURN_ADDRESS_POINTER_REGNUM, \ + FRAME_POINTER_REGNUM, \ AR_CCV_REGNUM, AR_UNAT_REGNUM, AR_PFS_REGNUM, AR_LC_REGNUM, \ AR_EC_REGNUM \ } @@ -873,11 +871,11 @@ enum reg_class /* AR_M_REGS. */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ - 0x00000000, 0x00000000, 0x0C00 }, \ + 0x00000000, 0x00000000, 0x0600 }, \ /* AR_I_REGS. */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ - 0x00000000, 0x00000000, 0x7000 }, \ + 0x00000000, 0x00000000, 0x3800 }, \ /* ADDL_REGS. */ \ { 0x0000000F, 0x00000000, 0x00000000, 0x00000000, \ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ @@ -885,7 +883,7 @@ enum reg_class /* GR_REGS. */ \ { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ - 0x00000000, 0x00000000, 0x0300 }, \ + 0x00000000, 0x00000000, 0x0100 }, \ /* FR_REGS. */ \ { 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ @@ -893,15 +891,15 @@ enum reg_class /* GR_AND_BR_REGS. */ \ { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ 0x00000000, 0x00000000, 0x00000000, 0x00000000, \ - 0x00000000, 0x00000000, 0x03FF }, \ + 0x00000000, 0x00000000, 0x01FF }, \ /* GR_AND_FR_REGS. */ \ { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ - 0x00000000, 0x00000000, 0x0300 }, \ + 0x00000000, 0x00000000, 0x0100 }, \ /* ALL_REGS. */ \ { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, \ - 0xFFFFFFFF, 0xFFFFFFFF, 0x7FFF }, \ + 0xFFFFFFFF, 0xFFFFFFFF, 0x3FFF }, \ } /* A C expression whose value is a register class containing hard register @@ -1119,7 +1117,7 @@ enum reg_class DYNAMIC_CHAIN_ADDRESS and SETUP_FRAME_ADDRESS (for the reg stack flush). */ #define RETURN_ADDR_RTX(COUNT, FRAME) \ - ((COUNT) == 0 ? return_address_pointer_rtx : const0_rtx) + ia64_return_addr_rtx (COUNT, FRAME) /* A C expression whose value is RTL representing the location of the incoming return address at the beginning of any function, before the prologue. This @@ -1180,13 +1178,6 @@ enum reg_class REGNO_POINTER_ALIGN (ARG_POINTER_REGNUM) = 64; \ } while (0) -/* The register number for the return address register. For IA-64, this - is not actually a pointer as the name suggests, but that's a name that - gen_rtx_REG already takes care to keep unique. We modify - return_address_pointer_rtx in ia64_expand_prologue to reference the - final output regnum. */ -#define RETURN_ADDRESS_POINTER_REGNUM 329 - /* Register numbers used for passing a function's static chain pointer. */ /* ??? The ABI sez the static chain should be passed as a normal parameter. */ #define STATIC_CHAIN_REGNUM 15 @@ -1210,7 +1201,6 @@ enum reg_class {ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ {FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ {FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM}, \ - {RETURN_ADDRESS_POINTER_REGNUM, BR_REG (0)}, \ } /* A C expression that returns nonzero if the compiler is allowed to try to @@ -1934,8 +1924,8 @@ do { \ "p60", "p61", "p62", "p63", \ /* Branch registers. */ \ "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", \ - /* Frame pointer. Return address. */ \ - "sfp", "retaddr", "ar.ccv", "ar.unat", "ar.pfs", "ar.lc", "ar.ec", \ + /* Frame pointer. Application registers. */ \ + "sfp", "ar.ccv", "ar.unat", "ar.pfs", "ar.lc", "ar.ec", \ } /* If defined, a C initializer for an array of structures containing a name and diff --git a/contrib/gcc/config/ia64/ia64.md b/contrib/gcc/config/ia64/ia64.md index 4baa5d3f32ce..3b88d9f81c36 100644 --- a/contrib/gcc/config/ia64/ia64.md +++ b/contrib/gcc/config/ia64/ia64.md @@ -73,6 +73,7 @@ (UNSPEC_BUNDLE_SELECTOR 23) (UNSPEC_ADDP4 24) (UNSPEC_PROLOGUE_USE 25) + (UNSPEC_RET_ADDR 26) ]) (define_constants @@ -416,6 +417,25 @@ DONE; }) +;; This is used as a placeholder for the return address during early +;; compilation. We won't know where we've placed this until during +;; reload, at which point it can wind up in b0, a general register, +;; or memory. The only safe destination under these conditions is a +;; general register. + +(define_insn_and_split "*movdi_ret_addr" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(const_int 0)] UNSPEC_RET_ADDR))] + "" + "#" + "reload_completed" + [(const_int 0)] +{ + ia64_split_return_addr_rtx (operands[0]); + DONE; +} + [(set_attr "itanium_class" "ialu")]) + (define_insn "*movdi_internal" [(set (match_operand:DI 0 "destination_operand" "=r,r,r,r, m, r,*f,*f,*f, Q, r,*b, r,*e, r,*d, r,*c") diff --git a/contrib/gcc/config/ia64/ia64intrin.h b/contrib/gcc/config/ia64/ia64intrin.h index c7bbd33e1339..262dc20e4d07 100644 --- a/contrib/gcc/config/ia64/ia64intrin.h +++ b/contrib/gcc/config/ia64/ia64intrin.h @@ -19,13 +19,11 @@ extern long __sync_val_compare_and_swap_di (long *, long, long); __sync_val_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW))) extern int __sync_bool_compare_and_swap_si (int *, int, int); -extern long __sync_bool_compare_and_swap_di (long *, long, long); +extern int __sync_bool_compare_and_swap_di (long *, long, long); #define __sync_bool_compare_and_swap(PTR, OLD, NEW) \ ((sizeof (*(PTR)) == sizeof(int)) \ - ? (__typeof__(*(PTR))) \ - __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \ - : (__typeof__(*(PTR))) \ - __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW))) + ? __sync_bool_compare_and_swap_si((int *)(PTR),(int)(OLD),(int)(NEW)) \ + : __sync_bool_compare_and_swap_di((long *)(PTR),(long)(OLD),(long)(NEW))) extern void __sync_lock_release_si (int *); extern void __sync_lock_release_di (long *); diff --git a/contrib/gcc/config/ia64/libgcc-ia64.ver b/contrib/gcc/config/ia64/libgcc-ia64.ver index 2ffb69368640..cd769907df0c 100644 --- a/contrib/gcc/config/ia64/libgcc-ia64.ver +++ b/contrib/gcc/config/ia64/libgcc-ia64.ver @@ -7,3 +7,6 @@ GCC_3.0 { __ia64_trampoline __ia64_backtrace } +GCC_3.3.2 { + _Unwind_GetBSP +} diff --git a/contrib/gcc/config/ia64/unwind-ia64.c b/contrib/gcc/config/ia64/unwind-ia64.c index 12e46ae2427b..88d236b141cd 100644 --- a/contrib/gcc/config/ia64/unwind-ia64.c +++ b/contrib/gcc/config/ia64/unwind-ia64.c @@ -1665,6 +1665,14 @@ _Unwind_GetCFA (struct _Unwind_Context *context) return (_Unwind_Ptr) context->psp; } +/* Get the value of the Backing Store Pointer as saved in CONTEXT. */ + +_Unwind_Word +_Unwind_GetBSP (struct _Unwind_Context *context) +{ + return (_Unwind_Ptr) context->bsp; +} + static _Unwind_Reason_Code uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) @@ -1786,6 +1794,11 @@ uw_update_reg_address (struct _Unwind_Context *context, addr = ia64_rse_skip_regs ((unsigned long *) context->bsp, rval - 32); else if (rval >= 2) addr = context->ireg[rval - 2].loc; + else if (rval == 0) + { + static const unsigned long dummy; + addr = (void *) &dummy; + } else abort (); break; @@ -1837,6 +1850,11 @@ uw_update_reg_address (struct _Unwind_Context *context, context->ireg[regno - UNW_REG_R2].nat = context->ireg[rval - 2].nat; } + else if (rval == 0) + { + context->ireg[regno - UNW_REG_R2].nat.type = UNW_NAT_NONE; + context->ireg[regno - UNW_REG_R2].nat.off = 0; + } else abort (); break; diff --git a/contrib/gcc/config/linux.h b/contrib/gcc/config/linux.h index 2ddb9c765a18..297fa92f7460 100644 --- a/contrib/gcc/config/linux.h +++ b/contrib/gcc/config/linux.h @@ -108,6 +108,9 @@ Boston, MA 02111-1307, USA. */ #define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " #endif +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + /* Define this so we can compile MS code for use with WINE. */ #define HANDLE_PRAGMA_PACK_PUSH_POP diff --git a/contrib/gcc/config/rs6000/linux.h b/contrib/gcc/config/rs6000/linux.h index 593e961f7433..15db88a9e6e5 100644 --- a/contrib/gcc/config/rs6000/linux.h +++ b/contrib/gcc/config/rs6000/linux.h @@ -48,6 +48,9 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SHLIB_SPEC #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + #undef LIB_DEFAULT_SPEC #define LIB_DEFAULT_SPEC "%(lib_linux)" diff --git a/contrib/gcc/config/rs6000/linux64.h b/contrib/gcc/config/rs6000/linux64.h index 55065c6a31d4..a538d02b955d 100644 --- a/contrib/gcc/config/rs6000/linux64.h +++ b/contrib/gcc/config/rs6000/linux64.h @@ -137,6 +137,9 @@ Boston, MA 02111-1307, USA. */ #undef LINK_SHLIB_SPEC #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}" +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + #undef LIB_DEFAULT_SPEC #define LIB_DEFAULT_SPEC "%(lib_linux)" diff --git a/contrib/gcc/config/rs6000/rs6000.c b/contrib/gcc/config/rs6000/rs6000.c index 3c17f2156f2d..13f4ed3dab10 100644 --- a/contrib/gcc/config/rs6000/rs6000.c +++ b/contrib/gcc/config/rs6000/rs6000.c @@ -3310,7 +3310,7 @@ function_arg_pass_by_reference (cum, mode, type, named) return 1; } - return type && int_size_in_bytes (type) <= 0; + return type && int_size_in_bytes (type) < 0; } /* Perform any needed actions needed for a function that is receiving a @@ -3551,7 +3551,7 @@ rs6000_va_arg (valist, type) if (DEFAULT_ABI != ABI_V4) { /* Variable sized types are passed by reference. */ - if (int_size_in_bytes (type) <= 0) + if (int_size_in_bytes (type) < 0) { u = build_pointer_type (type); diff --git a/contrib/gcc/config/rs6000/rs6000.md b/contrib/gcc/config/rs6000/rs6000.md index 4c9503128711..4d5ef9db4caa 100644 --- a/contrib/gcc/config/rs6000/rs6000.md +++ b/contrib/gcc/config/rs6000/rs6000.md @@ -14308,7 +14308,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrsi_internal2" [(set (pc) @@ -14332,7 +14332,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal1" [(set (pc) @@ -14356,7 +14356,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal2" [(set (pc) @@ -14380,7 +14380,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) ;; Similar, but we can use GE since we have a REG_NONNEG. @@ -14406,7 +14406,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrsi_internal4" [(set (pc) @@ -14430,7 +14430,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal3" [(set (pc) @@ -14454,7 +14454,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal4" [(set (pc) @@ -14478,7 +14478,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) ;; Similar but use EQ @@ -14504,7 +14504,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrsi_internal6" [(set (pc) @@ -14528,7 +14528,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal5" [(set (pc) @@ -14552,7 +14552,7 @@ return \"{bdn|bdnz} $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) (define_insn "*ctrdi_internal6" [(set (pc) @@ -14576,7 +14576,7 @@ return \"bdz $+8\;b %l0\"; }" [(set_attr "type" "branch") - (set_attr "length" "4,12,16")]) + (set_attr "length" "*,12,16")]) ;; Now the splitters if we could not allocate the CTR register diff --git a/contrib/gcc/config/rs6000/sysv4.h b/contrib/gcc/config/rs6000/sysv4.h index 3da996fbd54c..26450e7ee273 100644 --- a/contrib/gcc/config/rs6000/sysv4.h +++ b/contrib/gcc/config/rs6000/sysv4.h @@ -383,6 +383,21 @@ do { \ #undef STACK_BOUNDARY #define STACK_BOUNDARY (TARGET_ALTIVEC_ABI ? 128 : 64) +/* Define this macro if you wish to preserve a certain alignment for + the stack pointer, greater than what the hardware enforces. The + definition is a C expression for the desired alignment (measured + in bits). This macro must evaluate to a value equal to or larger + than STACK_BOUNDARY. + For the SYSV ABI and variants the alignment of the stack pointer + is usually controlled manually in rs6000.c. However, to maintain + alignment across alloca () in all circumstances, + PREFERRED_STACK_BOUNDARY needs to be set as well. + This has the additional advantage of allowing a bigger maximum + alignment of user objects on the stack. */ + +#undef PREFERRED_STACK_BOUNDARY +#define PREFERRED_STACK_BOUNDARY 128 + /* Real stack boundary as mandated by the appropriate ABI. */ #define ABI_STACK_BOUNDARY ((TARGET_EABI && !TARGET_ALTIVEC_ABI) ? 64 : 128) diff --git a/contrib/gcc/config/sparc/linux.h b/contrib/gcc/config/sparc/linux.h index ea16b7eed5dd..e4bd7bbe196c 100644 --- a/contrib/gcc/config/sparc/linux.h +++ b/contrib/gcc/config/sparc/linux.h @@ -256,6 +256,10 @@ do { \ #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP +#undef LINK_GCC_C_SEQUENCE_SPEC +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + /* Do code reading to identify a signal frame, and set the frame state data appropriately. See unwind-dw2.c for the structs. */ diff --git a/contrib/gcc/config/sparc/linux64.h b/contrib/gcc/config/sparc/linux64.h index 8fd3a1ff0df6..27be1d13133f 100644 --- a/contrib/gcc/config/sparc/linux64.h +++ b/contrib/gcc/config/sparc/linux64.h @@ -319,6 +319,10 @@ do { \ #undef CTORS_SECTION_ASM_OP #undef DTORS_SECTION_ASM_OP +#undef LINK_GCC_C_SEQUENCE_SPEC +#define LINK_GCC_C_SEQUENCE_SPEC \ + "%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}" + /* Do code reading to identify a signal frame, and set the frame state data appropriately. See unwind-dw2.c for the structs. */ diff --git a/contrib/gcc/config/sparc/sol2-c1.asm b/contrib/gcc/config/sparc/sol2-c1.asm index 894a8c34c084..a1cc68d6756f 100644 --- a/contrib/gcc/config/sparc/sol2-c1.asm +++ b/contrib/gcc/config/sparc/sol2-c1.asm @@ -92,6 +92,10 @@ _start: ! access those data anyway. Instead, go straight to main: mov %l0, %o0 ! argc mov %l1, %o1 ! argv +#ifdef GCRT1 + setn(___Argv, %o4, %o3) + stn %o1, [%o3] ! *___Argv +#endif ! Skip argc words past argv, to env: sll %l0, CPTRSHIFT, %o2 add %o2, CPTRSIZE, %o2 diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c index 5b03f053d969..79022b4b85dc 100644 --- a/contrib/gcc/config/sparc/sparc.c +++ b/contrib/gcc/config/sparc/sparc.c @@ -8028,6 +8028,10 @@ sparc_v8plus_shift (operands, insn, opcode) if (which_alternative != 2) operands[3] = operands[0]; + /* We can only shift by constants <= 63. */ + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); + if (GET_CODE (operands[1]) == CONST_INT) { output_asm_insn ("mov\t%1, %3", operands); diff --git a/contrib/gcc/config/sparc/sparc.md b/contrib/gcc/config/sparc/sparc.md index ebe9d2b3d50b..b53013ec397d 100644 --- a/contrib/gcc/config/sparc/sparc.md +++ b/contrib/gcc/config/sparc/sparc.md @@ -148,8 +148,12 @@ (eq_attr "branch_type" "fcc") (if_then_else (match_operand 0 "fcc0_reg_operand" "") (if_then_else (eq_attr "empty_delay_slot" "true") - (const_int 2) - (const_int 1)) + (if_then_else (eq (symbol_ref "TARGET_V9") (const_int 0)) + (const_int 3) + (const_int 2)) + (if_then_else (eq (symbol_ref "TARGET_V9") (const_int 0)) + (const_int 2) + (const_int 1))) (if_then_else (lt (pc) (match_dup 2)) (if_then_else (lt (minus (match_dup 2) (pc)) (const_int 260000)) (if_then_else (eq_attr "empty_delay_slot" "true") @@ -6881,6 +6885,8 @@ { if (operands[2] == const1_rtx) return "add\t%1, %1, %0"; + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); return "sll\t%1, %2, %0"; } [(set (attr "type") @@ -6910,6 +6916,8 @@ { if (operands[2] == const1_rtx) return "add\t%1, %1, %0"; + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); return "sllx\t%1, %2, %0"; } [(set (attr "type") @@ -6969,7 +6977,11 @@ (ashiftrt:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "arith_operand" "rI")))] "" - "sra\t%1, %2, %0" + { + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); + return "sra\t%1, %2, %0"; + } [(set_attr "type" "shift")]) (define_insn "*ashrsi3_extend" @@ -7016,12 +7028,17 @@ } }) -(define_insn "" +(define_insn "*ashrdi3_sp64" [(set (match_operand:DI 0 "register_operand" "=r") (ashiftrt:DI (match_operand:DI 1 "register_operand" "r") (match_operand:SI 2 "arith_operand" "rI")))] "TARGET_ARCH64" - "srax\t%1, %2, %0" + + { + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); + return "srax\t%1, %2, %0"; + } [(set_attr "type" "shift")]) ;; XXX @@ -7040,7 +7057,11 @@ (lshiftrt:SI (match_operand:SI 1 "register_operand" "r") (match_operand:SI 2 "arith_operand" "rI")))] "" - "srl\t%1, %2, %0" + { + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); + return "srl\t%1, %2, %0"; + } [(set_attr "type" "shift")]) ;; This handles the case where @@ -7097,12 +7118,16 @@ } }) -(define_insn "" +(define_insn "*lshrdi3_sp64" [(set (match_operand:DI 0 "register_operand" "=r") (lshiftrt:DI (match_operand:DI 1 "register_operand" "r") (match_operand:SI 2 "arith_operand" "rI")))] "TARGET_ARCH64" - "srlx\t%1, %2, %0" + { + if (GET_CODE (operands[2]) == CONST_INT) + operands[2] = GEN_INT (INTVAL (operands[2]) & 0x3f); + return "srlx\t%1, %2, %0"; + } [(set_attr "type" "shift")]) ;; XXX diff --git a/contrib/gcc/config/t-darwin b/contrib/gcc/config/t-darwin index 7fe5e9397e2b..c823fa5d7a4e 100644 --- a/contrib/gcc/config/t-darwin +++ b/contrib/gcc/config/t-darwin @@ -12,7 +12,7 @@ gt-darwin.h : s-gtype ; @true # Explain how to build crt2.o $(T)crt2$(objext): $(srcdir)/config/darwin-crt2.c $(GCC_PASSES) \ - $(TCONFIG_H) tsystem.h + $(TCONFIG_H) stmp-int-hdrs tsystem.h $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \ -c $(srcdir)/config/darwin-crt2.c -o $(T)crt2$(objext) diff --git a/contrib/gcc/config/t-libunwind b/contrib/gcc/config/t-libunwind new file mode 100644 index 000000000000..be50bc481c5f --- /dev/null +++ b/contrib/gcc/config/t-libunwind @@ -0,0 +1 @@ +LIB2ADDEH = $(srcdir)/unwind-libunwind.c $(srcdir)/unwind-sjlj.c diff --git a/contrib/gcc/configure b/contrib/gcc/configure index 5f00c7928e82..74b8a4fa6083 100755 --- a/contrib/gcc/configure +++ b/contrib/gcc/configure @@ -65,6 +65,11 @@ ac_help="$ac_help --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib" ac_help="$ac_help --enable-initfini-array use .init_array/.fini_array sections" +ac_help="$ac_help + --enable-sjlj-exceptions + arrange to use setjmp/longjmp exception handling" +ac_help="$ac_help + --enable-libunwind-exceptions force use libunwind for exceptions" ac_help="$ac_help --enable-nls use Native Language Support (default)" ac_help="$ac_help @@ -90,11 +95,6 @@ ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" -ac_help="$ac_help - --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling" -ac_help="$ac_help - --enable-libunwind-exceptions force use libunwind for exceptions" ac_help="$ac_help --enable-version-specific-runtime-libs specify that runtime libraries should be @@ -3928,7 +3928,7 @@ else # Systems known to be in this category are Windows (all variants), # VMS, and Darwin. case "$host_os" in - vms* | cygwin* | pe | mingw* | darwin*) + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) gcc_cv_func_mmap_dev_zero=no ;; *) gcc_cv_func_mmap_dev_zero=yes;; @@ -4856,6 +4856,71 @@ objext='.o' +# With Setjmp/Longjmp based exception handling. +# Check whether --enable-sjlj-exceptions or --disable-sjlj-exceptions was given. +if test "${enable_sjlj_exceptions+set}" = set; then + enableval="$enable_sjlj_exceptions" + sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` +cat >> confdefs.h <&6 +echo "configure:4873: checking for main in -lunwind" >&5 +ac_lib_var=`echo unwind'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lunwind $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + use_libunwind_default=yes +else + echo "$ac_t""no" 1>&6 +use_libunwind_default=no +fi + +# Use libunwind based exception handling. +# Check whether --enable-libunwind-exceptions or --disable-libunwind-exceptions was given. +if test "${enable_libunwind_exceptions+set}" = set; then + enableval="$enable_libunwind_exceptions" + use_libunwind_exceptions=$enableval +else + use_libunwind_exceptions=$use_libunwind_default +fi + +if test x"$use_libunwind_exceptions" = xyes; then + cat >> confdefs.h <<\EOF +#define USE_LIBUNWIND_EXCEPTIONS 1 +EOF + +fi + target_gtfiles= build_xm_file= build_xm_defines= @@ -5097,14 +5162,14 @@ fi echo $ac_n "checking for library containing strerror""... $ac_c" 1>&6 -echo "configure:5101: checking for library containing strerror" >&5 +echo "configure:5166: checking for library containing strerror" >&5 if eval "test \"`echo '$''{'ac_cv_search_strerror'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_strerror="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_strerror="none required" else @@ -5126,7 +5191,7 @@ rm -f conftest* test "$ac_cv_search_strerror" = "no" && for i in cposix; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_strerror="-l$i" break @@ -5160,12 +5225,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5164: checking for working const" >&5 +echo "configure:5229: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5235,12 +5300,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:5239: checking for off_t" >&5 +echo "configure:5304: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5268,12 +5333,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:5272: checking for size_t" >&5 +echo "configure:5337: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5303,19 +5368,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:5307: checking for working alloca.h" >&5 +echo "configure:5372: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:5319: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -5336,12 +5401,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:5340: checking for alloca" >&5 +echo "configure:5405: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -5401,12 +5466,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:5405: checking whether alloca needs Cray hooks" >&5 +echo "configure:5470: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5435: checking for $ac_func" >&5 +echo "configure:5500: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5486,7 +5551,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:5490: checking stack direction for C alloca" >&5 +echo "configure:5555: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5494,7 +5559,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -5536,12 +5601,12 @@ fi echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 -echo "configure:5540: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo "configure:5605: checking whether we are using the GNU C Library 2.1 or newer" >&5 if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5577,17 +5642,17 @@ stdlib.h string.h unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5581: checking for $ac_hdr" >&5 +echo "configure:5646: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5656: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5618,12 +5683,12 @@ getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ strdup strtoul tsearch __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5622: checking for $ac_func" >&5 +echo "configure:5687: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5687,7 +5752,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:5691: checking for iconv" >&5 +echo "configure:5756: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5695,7 +5760,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext < #include @@ -5705,7 +5770,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -5717,7 +5782,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" cat > conftest.$ac_ext < #include @@ -5727,7 +5792,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:5731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -5748,13 +5813,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:5752: checking for iconv declaration" >&5 +echo "configure:5817: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5773,7 +5838,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else @@ -5802,19 +5867,19 @@ EOF echo $ac_n "checking for nl_langinfo and CODESET""... $ac_c" 1>&6 -echo "configure:5806: checking for nl_langinfo and CODESET" >&5 +echo "configure:5871: checking for nl_langinfo and CODESET" >&5 if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char* cs = nl_langinfo(CODESET); ; return 0; } EOF -if { (eval echo configure:5818: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_langinfo_codeset=yes else @@ -5837,19 +5902,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:5841: checking for LC_MESSAGES" >&5 +echo "configure:5906: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:5853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -5870,7 +5935,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:5874: checking whether NLS is requested" >&5 +echo "configure:5939: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -5893,7 +5958,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:5897: checking whether included gettext is requested" >&5 +echo "configure:5962: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -5913,17 +5978,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:5917: checking for libintl.h" >&5 +echo "configure:5982: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5992: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5944,12 +6009,12 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then EOF echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 -echo "configure:5948: checking for GNU gettext in libc" >&5 +echo "configure:6013: checking for GNU gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < extern int _nl_msg_cat_cntr; @@ -5958,7 +6023,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:5962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6027: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libc=yes else @@ -5974,14 +6039,14 @@ echo "$ac_t""$gt_cv_func_gnugettext1_libc" 1>&6 if test "$gt_cv_func_gnugettext1_libc" != "yes"; then echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 -echo "configure:5978: checking for GNU gettext in libintl" >&5 +echo "configure:6043: checking for GNU gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gnugettext1_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -lintl $LIBICONV" cat > conftest.$ac_ext < extern int _nl_msg_cat_cntr; @@ -5990,7 +6055,7 @@ bindtextdomain ("", ""); return (int) gettext ("") + _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:5994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gnugettext1_libintl=yes else @@ -6023,12 +6088,12 @@ EOF for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6027: checking for $ac_func" >&5 +echo "configure:6092: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6080,7 +6145,7 @@ done # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6084: checking for $ac_word" >&5 +echo "configure:6149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6114,7 +6179,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6118: checking for $ac_word" >&5 +echo "configure:6183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6151,7 +6216,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6155: checking for $ac_word" >&5 +echo "configure:6220: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6201,7 +6266,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6205: checking for $ac_word" >&5 +echo "configure:6270: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6235,7 +6300,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6239: checking for $ac_word" >&5 +echo "configure:6304: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6271,7 +6336,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6275: checking for $ac_word" >&5 +echo "configure:6340: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6343,7 +6408,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6347: checking for $ac_word" >&5 +echo "configure:6412: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6376,7 +6441,7 @@ done ac_verc_fail=yes else echo $ac_n "checking version of bison""... $ac_c" 1>&6 -echo "configure:6380: checking version of bison" >&5 +echo "configure:6445: checking version of bison" >&5 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` case $ac_prog_version in '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; @@ -6421,7 +6486,7 @@ EOF if test "x$CATOBJEXT" != x; then echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:6425: checking for catalogs to be installed" >&5 +echo "configure:6490: checking for catalogs to be installed" >&5 # Look for .po and .gmo files in the source directory. CATALOGS= XLINGUAS= @@ -6479,7 +6544,7 @@ fi case $host_os in win32 | pe | cygwin* | mingw32* | uwin*) echo $ac_n "checking whether windows registry support is requested""... $ac_c" 1>&6 -echo "configure:6483: checking whether windows registry support is requested" >&5 +echo "configure:6548: checking whether windows registry support is requested" >&5 if test "x$enable_win32_registry" != xno; then cat >> confdefs.h <<\EOF #define ENABLE_WIN32_REGISTRY 1 @@ -6488,14 +6553,14 @@ EOF echo "$ac_t""yes" 1>&6 echo $ac_n "checking for library containing RegOpenKeyExA""... $ac_c" 1>&6 -echo "configure:6492: checking for library containing RegOpenKeyExA" >&5 +echo "configure:6557: checking for library containing RegOpenKeyExA" >&5 if eval "test \"`echo '$''{'ac_cv_search_RegOpenKeyExA'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_RegOpenKeyExA="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_RegOpenKeyExA="none required" else @@ -6517,7 +6582,7 @@ rm -f conftest* test "$ac_cv_search_RegOpenKeyExA" = "no" && for i in advapi32; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_RegOpenKeyExA="-l$i" break @@ -6570,7 +6635,7 @@ esac if test "x$enable_win32_registry" != xno; then echo $ac_n "checking registry key on windows hosts""... $ac_c" 1>&6 -echo "configure:6574: checking registry key on windows hosts" >&5 +echo "configure:6639: checking registry key on windows hosts" >&5 cat >> confdefs.h <&6 -echo "configure:6788: checking what assembler to use" >&5 +echo "configure:6853: checking what assembler to use" >&5 gcc_cv_as= gcc_cv_gas_major_version= gcc_cv_gas_minor_version= @@ -6878,7 +6943,7 @@ fi # Figure out what linker we will be using. echo $ac_n "checking what linker to use""... $ac_c" 1>&6 -echo "configure:6882: checking what linker to use" >&5 +echo "configure:6947: checking what linker to use" >&5 gcc_cv_ld= gcc_cv_gld_major_version= gcc_cv_gld_minor_version= @@ -6971,7 +7036,7 @@ fi # Figure out what nm we will be using. echo $ac_n "checking what nm to use""... $ac_c" 1>&6 -echo "configure:6975: checking what nm to use" >&5 +echo "configure:7040: checking what nm to use" >&5 if test -x nm$host_exeext; then gcc_cv_nm=./nm$host_exeext elif test "x$program_prefix" != xNONE; then @@ -6983,7 +7048,7 @@ echo "$ac_t""$gcc_cv_nm" 1>&6 # Figure out what objdump we will be using. echo $ac_n "checking what objdump to use""... $ac_c" 1>&6 -echo "configure:6987: checking what objdump to use" >&5 +echo "configure:7052: checking what objdump to use" >&5 if test -x objdump$host_exeext; then gcc_cv_objdump=./objdump$host_exeext elif test "x$program_prefix" != xNONE; then @@ -6995,7 +7060,7 @@ echo "$ac_t""$gcc_cv_objdump" 1>&6 # Figure out what assembler alignment features are present. echo $ac_n "checking assembler alignment features""... $ac_c" 1>&6 -echo "configure:6999: checking assembler alignment features" >&5 +echo "configure:7064: checking assembler alignment features" >&5 gcc_cv_as_alignment_features=none if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then # Gas version 2.6 and later support for .balign and .p2align. @@ -7043,7 +7108,7 @@ fi echo "$ac_t""$gcc_cv_as_alignment_features" 1>&6 echo $ac_n "checking assembler subsection support""... $ac_c" 1>&6 -echo "configure:7047: checking assembler subsection support" >&5 +echo "configure:7112: checking assembler subsection support" >&5 gcc_cv_as_subsections=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -7083,7 +7148,7 @@ fi echo "$ac_t""$gcc_cv_as_subsections" 1>&6 echo $ac_n "checking assembler weak support""... $ac_c" 1>&6 -echo "configure:7087: checking assembler weak support" >&5 +echo "configure:7152: checking assembler weak support" >&5 gcc_cv_as_weak=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 2 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -7106,7 +7171,7 @@ fi echo "$ac_t""$gcc_cv_as_weak" 1>&6 echo $ac_n "checking assembler hidden support""... $ac_c" 1>&6 -echo "configure:7110: checking assembler hidden support" >&5 +echo "configure:7175: checking assembler hidden support" >&5 gcc_cv_as_hidden=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 \ @@ -7156,6 +7221,9 @@ elif test x$gcc_cv_as != x; then fi fi fi + else + # non-GNU linkers don't seem to support .hidden yet + gcc_cv_as_hidden=no fi fi if test x"$gcc_cv_as_hidden" = xyes; then @@ -7166,23 +7234,10 @@ EOF fi echo "$ac_t""$gcc_cv_as_hidden" 1>&6 libgcc_visibility=$gcc_cv_as_hidden -case "$target" in - mips-sgi-irix6*) - if test x"$gnu_ld_flag" = x"no"; then - # Even if using gas with .hidden support, the resulting object files - # cannot be linked with the IRIX 6 O32 linker. With the N32 and - # N64 linkers, the problem is that the linker refuses to accept - # -call_shared (passed by default to the linker) and -r (used to - # link the object file generated without .hidden directives with - # one that hides symbols), so we also lose. - libgcc_visibility=no - fi - ;; -esac echo $ac_n "checking assembler leb128 support""... $ac_c" 1>&6 -echo "configure:7186: checking assembler leb128 support" >&5 +echo "configure:7241: checking assembler leb128 support" >&5 gcc_cv_as_leb128=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 11 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -7227,7 +7282,7 @@ fi echo "$ac_t""$gcc_cv_as_leb128" 1>&6 echo $ac_n "checking assembler eh_frame optimization""... $ac_c" 1>&6 -echo "configure:7231: checking assembler eh_frame optimization" >&5 +echo "configure:7286: checking assembler eh_frame optimization" >&5 gcc_cv_as_eh_frame=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -7308,7 +7363,7 @@ fi echo "$ac_t""$gcc_cv_as_eh_frame" 1>&6 echo $ac_n "checking assembler section merging support""... $ac_c" 1>&6 -echo "configure:7312: checking assembler section merging support" >&5 +echo "configure:7367: checking assembler section merging support" >&5 gcc_cv_as_shf_merge=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 12 -o "$gcc_cv_gas_major_version" -gt 2 && grep 'obj_format = elf' ../gas/Makefile > /dev/null; then @@ -7331,7 +7386,7 @@ fi echo "$ac_t""$gcc_cv_as_shf_merge" 1>&6 echo $ac_n "checking assembler thread-local storage support""... $ac_c" 1>&6 -echo "configure:7335: checking assembler thread-local storage support" >&5 +echo "configure:7390: checking assembler thread-local storage support" >&5 gcc_cv_as_tls=no conftest_s= tls_first_major= @@ -7474,7 +7529,7 @@ case "$target" in # All TARGET_ABI_OSF targets. alpha*-*-osf* | alpha*-*-linux* | alpha*-*-*bsd*) echo $ac_n "checking assembler supports explicit relocations""... $ac_c" 1>&6 -echo "configure:7478: checking assembler supports explicit relocations" >&5 +echo "configure:7533: checking assembler supports explicit relocations" >&5 if eval "test \"`echo '$''{'gcc_cv_as_explicit_relocs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7524,7 +7579,7 @@ EOF ;; sparc*-*-*) echo $ac_n "checking assembler .register pseudo-op support""... $ac_c" 1>&6 -echo "configure:7528: checking assembler .register pseudo-op support" >&5 +echo "configure:7583: checking assembler .register pseudo-op support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_register_pseudo_op'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7552,7 +7607,7 @@ EOF fi echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6 -echo "configure:7556: checking assembler supports -relax" >&5 +echo "configure:7611: checking assembler supports -relax" >&5 if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7580,7 +7635,7 @@ EOF fi echo $ac_n "checking assembler and linker support unaligned pc related relocs""... $ac_c" 1>&6 -echo "configure:7584: checking assembler and linker support unaligned pc related relocs" >&5 +echo "configure:7639: checking assembler and linker support unaligned pc related relocs" >&5 if eval "test \"`echo '$''{'gcc_cv_as_sparc_ua_pcrel'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7607,7 +7662,7 @@ EOF fi echo $ac_n "checking assembler and linker support unaligned pc related relocs against hidden symbols""... $ac_c" 1>&6 -echo "configure:7611: checking assembler and linker support unaligned pc related relocs against hidden symbols" >&5 +echo "configure:7666: checking assembler and linker support unaligned pc related relocs against hidden symbols" >&5 if eval "test \"`echo '$''{'gcc_cv_as_sparc_ua_pcrel_hidden'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7647,7 +7702,7 @@ EOF fi echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6 -echo "configure:7651: checking for assembler offsetable %lo() support" >&5 +echo "configure:7706: checking for assembler offsetable %lo() support" >&5 if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7686,7 +7741,7 @@ EOF i[34567]86-*-* | x86_64-*-*) echo $ac_n "checking assembler instructions""... $ac_c" 1>&6 -echo "configure:7690: checking assembler instructions" >&5 +echo "configure:7745: checking assembler instructions" >&5 gcc_cv_as_instructions= if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then if test "$gcc_cv_gas_major_version" -eq 2 -a "$gcc_cv_gas_minor_version" -ge 9 -o "$gcc_cv_gas_major_version" -gt 2; then @@ -7712,8 +7767,26 @@ EOF fi echo "$ac_t""$gcc_cv_as_instructions" 1>&6 + echo $ac_n "checking cmov syntax""... $ac_c" 1>&6 +echo "configure:7772: checking cmov syntax" >&5 + gcc_cv_as_ix86_cmov_sun_syntax=no + if test x$gcc_cv_as != x; then + echo 'cmovl.l %edx, %eax' > conftest.s + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then + gcc_cv_as_ix86_cmov_sun_syntax=yes + fi + rm -f conftest.s conftest.o + fi + if test "x$gcc_cv_as_ix86_cmov_sun_syntax" = xyes; then + cat >> confdefs.h <<\EOF +#define HAVE_AS_IX86_CMOV_SUN_SYNTAX 1 +EOF + + fi + echo "$ac_t""$gcc_cv_as_ix86_cmov_sun_syntax" 1>&6 + echo $ac_n "checking assembler GOTOFF in data directives""... $ac_c" 1>&6 -echo "configure:7717: checking assembler GOTOFF in data directives" >&5 +echo "configure:7790: checking assembler GOTOFF in data directives" >&5 gcc_cv_as_gotoff_in_data=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x then @@ -7743,7 +7816,7 @@ EOF ia64*-*-*) echo $ac_n "checking assembler supports ltoffx and ldxmov""... $ac_c" 1>&6 -echo "configure:7747: checking assembler supports ltoffx and ldxmov" >&5 +echo "configure:7820: checking assembler supports ltoffx and ldxmov" >&5 if eval "test \"`echo '$''{'gcc_cv_as_ltoffx_ldxmov_relocs'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -7785,7 +7858,7 @@ EOF esac echo $ac_n "checking assembler dwarf2 debug_line support""... $ac_c" 1>&6 -echo "configure:7789: checking assembler dwarf2 debug_line support" >&5 +echo "configure:7862: checking assembler dwarf2 debug_line support" >&5 gcc_cv_as_dwarf2_debug_line=no # ??? Not all targets support dwarf2 debug_line, even within a version # of gas. Moreover, we need to emit a valid instruction to trigger any @@ -7842,7 +7915,7 @@ fi echo "$ac_t""$gcc_cv_as_dwarf2_debug_line" 1>&6 echo $ac_n "checking assembler --gdwarf2 support""... $ac_c" 1>&6 -echo "configure:7846: checking assembler --gdwarf2 support" >&5 +echo "configure:7919: checking assembler --gdwarf2 support" >&5 gcc_cv_as_gdwarf2_flag=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then @@ -7871,7 +7944,7 @@ fi echo "$ac_t""$gcc_cv_as_gdwarf2_flag" 1>&6 echo $ac_n "checking assembler --gstabs support""... $ac_c" 1>&6 -echo "configure:7875: checking assembler --gstabs support" >&5 +echo "configure:7948: checking assembler --gstabs support" >&5 gcc_cv_as_gstabs_flag=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x; then @@ -7906,7 +7979,7 @@ fi echo "$ac_t""$gcc_cv_as_gstabs_flag" 1>&6 echo $ac_n "checking linker read-only and read-write section mixing""... $ac_c" 1>&6 -echo "configure:7910: checking linker read-only and read-write section mixing" >&5 +echo "configure:7983: checking linker read-only and read-write section mixing" >&5 gcc_cv_ld_ro_rw_mix=unknown if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 10 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then @@ -7944,7 +8017,7 @@ fi echo "$ac_t""$gcc_cv_ld_ro_rw_mix" 1>&6 echo $ac_n "checking linker PT_GNU_EH_FRAME support""... $ac_c" 1>&6 -echo "configure:7948: checking linker PT_GNU_EH_FRAME support" >&5 +echo "configure:8021: checking linker PT_GNU_EH_FRAME support" >&5 gcc_cv_ld_eh_frame_hdr=no if test x$gcc_cv_gld_major_version != x -a x$gcc_cv_gld_minor_version != x; then if test "$gcc_cv_gld_major_version" -eq 2 -a "$gcc_cv_gld_minor_version" -ge 12 -o "$gcc_cv_gld_major_version" -gt 2 && grep 'EMUL = elf' ../ld/Makefile > /dev/null; then @@ -7968,7 +8041,7 @@ echo "$ac_t""$gcc_cv_ld_eh_frame_hdr" 1>&6 case "$target" in mips*-*-*) echo $ac_n "checking whether libgloss uses STARTUP directives consistently""... $ac_c" 1>&6 -echo "configure:7972: checking whether libgloss uses STARTUP directives consistently" >&5 +echo "configure:8045: checking whether libgloss uses STARTUP directives consistently" >&5 gcc_cv_mips_libgloss_startup=no gcc_cv_libgloss_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/libgloss if test "x$exec_prefix" = xNONE; then @@ -8172,7 +8245,7 @@ fi echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:8176: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:8249: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -8190,34 +8263,6 @@ else MAINT='#' fi -# With Setjmp/Longjmp based exception handling. -# Check whether --enable-sjlj-exceptions or --disable-sjlj-exceptions was given. -if test "${enable_sjlj_exceptions+set}" = set; then - enableval="$enable_sjlj_exceptions" - sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` -cat >> confdefs.h <> confdefs.h <<\EOF -#define USE_LIBUNWIND_EXCEPTIONS 1 -EOF - -fi - # Make empty files to contain the specs and options for each language. # Then add #include lines to for a compiler that has specs and/or options. diff --git a/contrib/gcc/configure.in b/contrib/gcc/configure.in index 07a9b93da75e..0f64d07bf85a 100644 --- a/contrib/gcc/configure.in +++ b/contrib/gcc/configure.in @@ -797,6 +797,25 @@ objext='.o' AC_SUBST(manext) AC_SUBST(objext) +# With Setjmp/Longjmp based exception handling. +AC_ARG_ENABLE(sjlj-exceptions, +[ --enable-sjlj-exceptions + arrange to use setjmp/longjmp exception handling], +[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` +AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, + [Define 0/1 to force the choice for exception handling model.])]) + +AC_CHECK_LIB(unwind, main, use_libunwind_default=yes, use_libunwind_default=no) +# Use libunwind based exception handling. +AC_ARG_ENABLE(libunwind-exceptions, +[ --enable-libunwind-exceptions force use libunwind for exceptions], +use_libunwind_exceptions=$enableval, +use_libunwind_exceptions=$use_libunwind_default) +if test x"$use_libunwind_exceptions" = xyes; then + AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1, + [Define if gcc should use -lunwind.]) +fi + target_gtfiles= build_xm_file= build_xm_defines= @@ -1641,6 +1660,9 @@ changequote(,)dnl fi fi changequote([,])dnl + else + # non-GNU linkers don't seem to support .hidden yet + gcc_cv_as_hidden=no fi fi if test x"$gcc_cv_as_hidden" = xyes; then @@ -1649,19 +1671,6 @@ if test x"$gcc_cv_as_hidden" = xyes; then fi AC_MSG_RESULT($gcc_cv_as_hidden) libgcc_visibility=$gcc_cv_as_hidden -case "$target" in - mips-sgi-irix6*) - if test x"$gnu_ld_flag" = x"no"; then - # Even if using gas with .hidden support, the resulting object files - # cannot be linked with the IRIX 6 O32 linker. With the N32 and - # N64 linkers, the problem is that the linker refuses to accept - # -call_shared (passed by default to the linker) and -r (used to - # link the object file generated without .hidden directives with - # one that hides symbols), so we also lose. - libgcc_visibility=no - fi - ;; -esac AC_SUBST(libgcc_visibility) AC_MSG_CHECKING(assembler leb128 support) @@ -2131,6 +2140,21 @@ changequote([,])dnl fi AC_MSG_RESULT($gcc_cv_as_instructions) + AC_MSG_CHECKING(cmov syntax) + gcc_cv_as_ix86_cmov_sun_syntax=no + if test x$gcc_cv_as != x; then + echo 'cmovl.l %edx, %eax' > conftest.s + if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1; then + gcc_cv_as_ix86_cmov_sun_syntax=yes + fi + rm -f conftest.s conftest.o + fi + if test "x$gcc_cv_as_ix86_cmov_sun_syntax" = xyes; then + AC_DEFINE(HAVE_AS_IX86_CMOV_SUN_SYNTAX, 1, + [Define if your assembler supports the Sun syntax for cmov.]) + fi + AC_MSG_RESULT($gcc_cv_as_ix86_cmov_sun_syntax) + AC_MSG_CHECKING(assembler GOTOFF in data directives) gcc_cv_as_gotoff_in_data=no if test x$gcc_cv_gas_major_version != x -a x$gcc_cv_gas_minor_version != x @@ -2581,24 +2605,6 @@ else fi AC_SUBST(MAINT)dnl -# With Setjmp/Longjmp based exception handling. -AC_ARG_ENABLE(sjlj-exceptions, -[ --enable-sjlj-exceptions - arrange to use setjmp/longjmp exception handling], -[sjlj=`if test $enableval = yes; then echo 1; else echo 0; fi` -AC_DEFINE_UNQUOTED(CONFIG_SJLJ_EXCEPTIONS, $sjlj, - [Define 0/1 to force the choice for exception handling model.])]) - -# Use libunwind based exception handling. -AC_ARG_ENABLE(libunwind-exceptions, -[ --enable-libunwind-exceptions force use libunwind for exceptions], -use_libunwind_exceptions=$enableval, -use_libunwind_exceptions=no) -if test x"$use_libunwind_exceptions" = xyes; then - AC_DEFINE(USE_LIBUNWIND_EXCEPTIONS, 1, - [Define if gcc should use -lunwind.]) -fi - # Make empty files to contain the specs and options for each language. # Then add #include lines to for a compiler that has specs and/or options. diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog index 854fefa1ec21..e05c075b976b 100644 --- a/contrib/gcc/cp/ChangeLog +++ b/contrib/gcc/cp/ChangeLog @@ -1,6 +1,181 @@ -2003-08-04 Release Manager +2003-10-23 Jason Merrill - * GCC 3.3.1 Released. + PR c++/12726 + * tree.c (build_target_expr_with_type): Don't call force_rvalue + for CONSTRUCTORs. + +2003-10-16 Release Manager + + * GCC 3.3.2 Released. + +2003-10-15 Kriang Lerdsuwanakij + + PR c++/12369 + * decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend + is a member of other class. + * friend.c (do_friend): Don't build TEMPLATE_DECL if friend + is a specialization of function template. + +2003-10-15 Kriang Lerdsuwanakij + + PR c++/7939 + * typeck.c (comptypes): Don't ICE when its first argument is + error_mark_node. + (compparms): Reverse the arguments of same_type_p. + +2003-10-14 Jason Merrill + + PR c++/11878 + * tree.c (build_target_expr_with_type): Call force_rvalue for + classes with non-trivial copy ctors. + + PR c++/11063 + * typeck.c (build_modify_expr): Call convert rather than abort. + +2003-10-06 Mark Mitchell + + PR c++/10147 + * call.c (initialize_reference): Tweak error message. + + PR c++/12337 + * init.c (build_new_1): Make sure that the expression returned is + not an lvalue. + + PR c++/12344, c++/12236, c++/8656 + * decl.c (start_function): Do not ignore attributes embedded in a + function declarator. + +2003-10-04 Roger Sayle + + PR c++/11409 + * class.c (resolve_address_of_overloaded_function): When building + list of matching non-template function decls, ignore anticipated + declarations of undeclared or shadowed GCC builtins. + +2003-10-02 Mark Mitchell + + PR c++/12486 + * typeck.c (finish_class_member_access_expr): Issue diagnostic + on erroneous use of qualified name. + +2003-07-09 Mark Mitchell + + * cp-tree.h (break_out_calls): Remove declaration. + * tree.c (break_out_calls): Remove. + * typeck.c (build_modify_expr): Avoid invalid sharing of trees. + +2003-09-18 Mark Mitchell + + * class.c (resolve_address_of_overloaded_function): Replace + complain parameter with flags parameter. + (instantiate_type): Adjust accordingly. + +2003-09-17 Mark Mitchell + + PR c++/11991 + * typeck2.c (incomplete_type_diagnostic): Robustify. + + PR c++/12266 + * cp-tree.h (tsubst_flags_t): Add tf_conv. + * class.c (standard_conversion): Pass tf_conv to + instantiate_type. + (resolve_address_of_overloaded_function): Do not call mark_used + when just checking conversions. + +2003-09-14 Mark Mitchell + + PR c++/3907 + * cp-tree.h (innermost_scope_is_class_p): New function. + * class.c (maybe_note_name_used_in_class): Refine test for whether + or not we are in a class scope. + * decl.c (innermost_scope_is_class_p): Define. + +2003-09-14 Mark Mitchell + + * class.c (layout_class_type): Make DECL_MODE match TYPE_MODE for + an bit-field whose width exceeds that of its type. + +2003-09-09 Steven Bosscher + + PR c++/11595 + * decl.c (define_label): Remove unreachable timevar pop. + Always return the decl, even if the definition is invalid. + +2003-09-08 Mark Mitchell + + PR c++/11786 + * decl2.c (add_function): Do not complain about seeing the same + non-function twice. + +2003-09-08 Mark Mitchell + + PR c++/5296 + * pt.c (try_one_overload): Add addr_p parameter. + (resolve_overloaded_unification): Pass it. + +2003-09-07 Jason Merrill + + PR c++/12181 + * typeck.c (build_modify_expr): Don't always stabilize the lhs and + rhs. Do stabilize the lhs of a MODIFY_EXPR used on the lhs. + +2003-09-06 Mark Mitchell + + PR c++/11867 + * call.c (standard_conversion): Improve comments. + (perform_direct_initialization): Make sure we return an expression + of the correct type. + * typeck.c (build_static_cast): Check for ambiguity and + accessibility when performing conversions. + +2003-09-05 Mark Mitchell + + PR c++/12163 + * call.c (perform_direct_initialization): Correct logic for + direct-initialization of a class type. + + PR c++/12146 + * pt.c (lookup_template_function): Robustify. + +2003-09-04 Mark Mitchell + + Revert this patch: + * class.c (include_empty_classes): Correct logic for ABI version 1. + +2003-09-03 Mark Mitchell + + PR c++/12053 + * class.c (include_empty_classes): Correct logic for ABI version 1. + +2003-09-01 Mark Mitchell + + PR c++/12114 + * cp-tree.h (initialize_reference): Change prototype. + * call.c (initialize_reference): Add cleanup parameter. + * decl.c (grok_reference_init): Likewise. + (check_initializer): Likewise. + (cp_finish_decl): Insert a CLEANUP_STMT if necessary. + (duplicate_decls): When replacing an anticipated builtin, do not + honor TREE_NOTHROW. + * typeck.c (convert_for_initialization): Correct call to + initialize_reference. + +2003-08-29 Mark Mitchell + + PR c++/11928 + * search.c (add_conversions): Avoid adding two conversion + operators for the same type. + +2003-08-20 Kaveh R. Ghazi + + * cp-tree.h (build_function_call_real): Remove unused parameter. + * typeck.c (build_function_call_real): Likewise. Caller changed. + * decl.c (binding_table_reverse_maybe_remap): Initialize variable. + +2003-08-19 Gabriel Dos Reis + + PR c++/5293 + * call.c (initialize_reference): Improve diagnostic. 2003-08-04 Release Manager diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c index 875012829021..1a1a493774b1 100644 --- a/contrib/gcc/cp/call.c +++ b/contrib/gcc/cp/call.c @@ -756,7 +756,7 @@ standard_conversion (to, from, expr) if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to)) && expr && type_unknown_p (expr)) { - expr = instantiate_type (to, expr, tf_none); + expr = instantiate_type (to, expr, tf_conv); if (expr == error_mark_node) return NULL_TREE; from = TREE_TYPE (expr); @@ -857,16 +857,25 @@ standard_conversion (to, from, expr) } } else if (IS_AGGR_TYPE (TREE_TYPE (from)) - && IS_AGGR_TYPE (TREE_TYPE (to))) + && IS_AGGR_TYPE (TREE_TYPE (to)) + /* [conv.ptr] + + An rvalue of type "pointer to cv D," where D is a + class type, can be converted to an rvalue of type + "pointer to cv B," where B is a base class (clause + _class.derived_) of D. If B is an inaccessible + (clause _class.access_) or ambiguous + (_class.member.lookup_) base class of D, a program + that necessitates this conversion is ill-formed. */ + /* Therefore, we use DERIVED_FROM_P, and not + ACESSIBLY_UNIQUELY_DERIVED_FROM_P, in this test. */ + && DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from))) { - if (DERIVED_FROM_P (TREE_TYPE (to), TREE_TYPE (from))) - { - from = - cp_build_qualified_type (TREE_TYPE (to), - cp_type_quals (TREE_TYPE (from))); - from = build_pointer_type (from); - conv = build_conv (PTR_CONV, from, conv); - } + from = + cp_build_qualified_type (TREE_TYPE (to), + cp_type_quals (TREE_TYPE (from))); + from = build_pointer_type (from); + conv = build_conv (PTR_CONV, from, conv); } if (same_type_p (from, to)) @@ -5993,7 +6002,8 @@ perform_implicit_conversion (type, expr) /* Convert EXPR to TYPE (as a direct-initialization) if that is permitted. If the conversion is valid, the converted expression is - returned. Otherwise, NULL_TREE is returned. */ + returned. Otherwise, NULL_TREE is returned, except in the case + that TYPE is a class type; in that case, an error is issued. */ tree perform_direct_initialization_if_possible (tree type, tree expr) @@ -6002,6 +6012,22 @@ perform_direct_initialization_if_possible (tree type, tree expr) if (type == error_mark_node || error_operand_p (expr)) return error_mark_node; + /* [dcl.init] + + If the destination type is a (possibly cv-qualified) class type: + + -- If the initialization is direct-initialization ..., + constructors are considered. ... If no constructor applies, or + the overload resolution is ambiguous, the initialization is + ill-formed. */ + if (CLASS_TYPE_P (type)) + { + expr = build_special_member_call (NULL_TREE, complete_ctor_identifier, + build_tree_list (NULL_TREE, expr), + TYPE_BINFO (type), + LOOKUP_NORMAL); + return build_cplus_new (type, expr); + } conv = implicit_conversion (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); if (!conv || ICS_BAD_FLAG (conv)) @@ -6048,18 +6074,23 @@ make_temporary_var_for_ref_to_temp (tree decl, tree type) return var; } -/* Convert EXPR to the indicated reference TYPE, in a way suitable for - initializing a variable of that TYPE. If DECL is non-NULL, it is - the VAR_DECL being initialized with the EXPR. (In that case, the - type of DECL will be TYPE.) + /* Convert EXPR to the indicated reference TYPE, in a way suitable + for initializing a variable of that TYPE. If DECL is non-NULL, + it is the VAR_DECL being initialized with the EXPR. (In that + case, the type of DECL will be TYPE.) If DECL is non-NULL, then + CLEANUP must also be non-NULL, and with *CLEANUP initialized to + NULL. Upon return, if *CLEANUP is no longer NULL, it will be a + CLEANUP_STMT that should be inserted after the returned + expression is used to initialize DECL. - Return the converted expression. */ + Return the converted expression. */ tree -initialize_reference (type, expr, decl) +initialize_reference (type, expr, decl, cleanup) tree type; tree expr; tree decl; + tree *cleanup; { tree conv; @@ -6069,7 +6100,15 @@ initialize_reference (type, expr, decl) conv = reference_binding (type, TREE_TYPE (expr), expr, LOOKUP_NORMAL); if (!conv || ICS_BAD_FLAG (conv)) { - error ("could not convert `%E' to `%T'", expr, type); + if (!(TYPE_QUALS (TREE_TYPE (type)) & TYPE_QUAL_CONST) + && !real_lvalue_p (expr)) + error ("invalid initialization of non-const reference of " + "type '%T' from a temporary of type '%T'", + type, TREE_TYPE (expr)); + else + error ("invalid initialization of reference of type " + "'%T' from expression of type '%T'", type, + TREE_TYPE (expr)); return error_mark_node; } @@ -6135,14 +6174,33 @@ initialize_reference (type, expr, decl) type = TREE_TYPE (expr); var = make_temporary_var_for_ref_to_temp (decl, type); layout_decl (var, 0); + /* Create the INIT_EXPR that will initialize the temporary + variable. */ + init = build (INIT_EXPR, type, var, expr); if (at_function_scope_p ()) { - tree cleanup; - add_decl_stmt (var); - cleanup = cxx_maybe_build_cleanup (var); - if (cleanup) - finish_decl_cleanup (var, cleanup); + *cleanup = cxx_maybe_build_cleanup (var); + if (*cleanup) + /* We must be careful to destroy the temporary only + after its initialization has taken place. If the + initialization throws an exception, then the + destructor should not be run. We cannot simply + transform INIT into something like: + + (INIT, ({ CLEANUP_STMT; })) + + because emit_local_var always treats the + initializer as a full-expression. Thus, the + destructor would run too early; it would run at the + end of initializing the reference variable, rather + than at the end of the block enclosing the + reference variable. + + The solution is to pass back a CLEANUP_STMT which + the caller is responsible for attaching to the + statement tree. */ + *cleanup = build_stmt (CLEANUP_STMT, var, *cleanup); } else { @@ -6151,7 +6209,6 @@ initialize_reference (type, expr, decl) static_aggregates = tree_cons (NULL_TREE, var, static_aggregates); } - init = build (INIT_EXPR, type, var, expr); /* Use its address to initialize the reference variable. */ expr = build_address (var); expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr); diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c index c1da65493b6e..f6e03963bedc 100644 --- a/contrib/gcc/cp/class.c +++ b/contrib/gcc/cp/class.c @@ -127,8 +127,9 @@ static int field_decl_cmp PARAMS ((const tree *, const tree *)); static int method_name_cmp PARAMS ((const tree *, const tree *)); static void add_implicitly_declared_members PARAMS ((tree, int, int, int)); static tree fixed_type_or_null PARAMS ((tree, int *, int *)); -static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, int, - int, int, tree)); +static tree resolve_address_of_overloaded_function PARAMS ((tree, tree, + tsubst_flags_t, + int, int, tree)); static tree build_vtable_entry_ref PARAMS ((tree, tree, tree)); static tree build_vtbl_ref_1 PARAMS ((tree, tree)); static tree build_vtbl_initializer PARAMS ((tree, tree, tree, tree, int *)); @@ -5042,6 +5043,15 @@ layout_class_type (tree t, tree *virtuals_p) field to the size of its declared type; the rest of the field is effectively invisible. */ DECL_SIZE (field) = TYPE_SIZE (type); + /* We must also reset the DECL_MODE of the field. */ + if (abi_version_at_least (2)) + DECL_MODE (field) = TYPE_MODE (type); + else if (warn_abi + && DECL_MODE (field) != TYPE_MODE (type)) + /* Versions of G++ before G++ 3.4 did not reset the + DECL_MODE. */ + warning ("the offset of `%D' may not be ABI-compliant and may " + "change in a future version of GCC", field); } else { @@ -5994,13 +6004,13 @@ pop_lang_context () static tree resolve_address_of_overloaded_function (target_type, overload, - complain, + flags, ptrmem, template_only, explicit_targs) tree target_type; tree overload; - int complain; + tsubst_flags_t flags; int ptrmem; int template_only; tree explicit_targs; @@ -6064,7 +6074,7 @@ resolve_address_of_overloaded_function (target_type, } else { - if (complain) + if (flags & tf_error) error ("\ cannot resolve overloaded function `%D' based on conversion to type `%T'", DECL_NAME (OVL_FUNCTION (overload)), target_type); @@ -6093,7 +6103,11 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'", /* We're looking for a non-static member, and this isn't one, or vice versa. */ continue; - + + /* Ignore anticipated decls of undeclared builtins. */ + if (DECL_ANTICIPATED (fn)) + continue; + /* See if there's a match. */ fntype = TREE_TYPE (fn); if (is_ptrmem) @@ -6184,7 +6198,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'", if (matches == NULL_TREE) { /* There were *no* matches. */ - if (complain) + if (flags & tf_error) { error ("no matches converting function `%D' to type `%#T'", DECL_NAME (OVL_FUNCTION (overload)), @@ -6205,7 +6219,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'", { /* There were too many matches. */ - if (complain) + if (flags & tf_error) { tree match; @@ -6232,7 +6246,7 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'", { static int explained; - if (!complain) + if (!(flags & tf_error)) return error_mark_node; pedwarn ("assuming pointer to member `%D'", fn); @@ -6242,7 +6256,13 @@ cannot resolve overloaded function `%D' based on conversion to type `%T'", explained = 1; } } - mark_used (fn); + + /* If we're doing overload resolution purely for the purpose of + determining conversion sequences, we should not consider the + function used. If this conversion sequence is selected, the + function will be marked as used at this point. */ + if (!(flags & tf_conv)) + mark_used (fn); if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) return build_unary_op (ADDR_EXPR, fn, 0); @@ -6272,6 +6292,7 @@ instantiate_type (lhstype, rhs, flags) tree lhstype, rhs; tsubst_flags_t flags; { + tsubst_flags_t flags_in = flags; int complain = (flags & tf_error); int strict = (flags & tf_no_attributes) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT; @@ -6362,7 +6383,7 @@ instantiate_type (lhstype, rhs, flags) return resolve_address_of_overloaded_function (lhstype, fns, - complain, + flags_in, allow_ptrmem, /*template_only=*/1, args); @@ -6372,7 +6393,7 @@ instantiate_type (lhstype, rhs, flags) return resolve_address_of_overloaded_function (lhstype, rhs, - complain, + flags_in, allow_ptrmem, /*template_only=*/0, /*explicit_targs=*/NULL_TREE); @@ -6678,7 +6699,7 @@ maybe_note_name_used_in_class (name, decl) splay_tree names_used; /* If we're not defining a class, there's nothing to do. */ - if (!current_class_type || !TYPE_BEING_DEFINED (current_class_type)) + if (!innermost_scope_is_class_p ()) return; /* If there's already a binding for this NAME, then we don't have diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h index 9b529a8e67ae..493206d9ae43 100644 --- a/contrib/gcc/cp/cp-tree.h +++ b/contrib/gcc/cp/cp-tree.h @@ -3149,8 +3149,12 @@ typedef enum tsubst_flags_t { (make_typename_type use) */ tf_ptrmem_ok = 1 << 5, /* pointers to member ok (internal instantiate_type use) */ - tf_parsing = 1 << 6 /* called from parser + tf_parsing = 1 << 6, /* called from parser (make_typename_type use) */ + tf_conv = 1 << 8, /* We are determining what kind of + conversion might be permissible, not + actually performing the + conversion. */ } tsubst_flags_t; /* The kind of checking we can do looking in a class hierarchy. */ @@ -3623,7 +3627,7 @@ extern tree type_passed_as PARAMS ((tree)); extern tree convert_for_arg_passing PARAMS ((tree, tree)); extern tree cp_convert_parm_for_inlining PARAMS ((tree, tree, tree)); extern int is_properly_derived_from PARAMS ((tree, tree)); -extern tree initialize_reference PARAMS ((tree, tree, tree)); +extern tree initialize_reference PARAMS ((tree, tree, tree, tree *)); extern tree make_temporary_var_for_ref_to_temp (tree, tree); extern tree strip_top_quals PARAMS ((tree)); extern tree perform_implicit_conversion PARAMS ((tree, tree)); @@ -3696,6 +3700,7 @@ extern void adjust_clone_args PARAMS ((tree)); /* decl.c */ extern int global_bindings_p PARAMS ((void)); extern int kept_level_p PARAMS ((void)); +extern bool innermost_scope_is_class_p (void); extern tree getdecls PARAMS ((void)); extern void pushlevel PARAMS ((int)); extern tree poplevel PARAMS ((int,int, int)); @@ -4312,7 +4317,6 @@ extern tree build_min PARAMS ((enum tree_code, tree, extern tree build_min_nt PARAMS ((enum tree_code, ...)); extern tree build_cplus_new PARAMS ((tree, tree)); extern tree get_target_expr PARAMS ((tree)); -extern tree break_out_calls PARAMS ((tree)); extern tree build_cplus_method_type PARAMS ((tree, tree, tree)); extern tree build_cplus_staticfn_type PARAMS ((tree, tree, tree)); extern tree build_cplus_array_type PARAMS ((tree, tree)); @@ -4405,7 +4409,7 @@ extern tree build_x_indirect_ref PARAMS ((tree, const char *)); extern tree build_indirect_ref PARAMS ((tree, const char *)); extern tree build_array_ref PARAMS ((tree, tree)); extern tree get_member_function_from_ptrfunc PARAMS ((tree *, tree)); -extern tree build_function_call_real PARAMS ((tree, tree, int, int)); +extern tree build_function_call_real PARAMS ((tree, tree, int)); extern tree build_function_call_maybe PARAMS ((tree, tree)); extern tree convert_arguments PARAMS ((tree, tree, tree, int)); extern tree build_x_binary_op PARAMS ((enum tree_code, tree, tree)); diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c index a392ee035ed5..03b90083696d 100644 --- a/contrib/gcc/cp/decl.c +++ b/contrib/gcc/cp/decl.c @@ -72,7 +72,7 @@ static tree lookup_tag_reverse PARAMS ((tree, tree)); static tree lookup_name_real PARAMS ((tree, int, int, int)); static void push_local_name PARAMS ((tree)); static void warn_extern_redeclared_static PARAMS ((tree, tree)); -static tree grok_reference_init PARAMS ((tree, tree, tree)); +static tree grok_reference_init PARAMS ((tree, tree, tree, tree *)); static tree grokfndecl PARAMS ((tree, tree, tree, tree, int, enum overload_flags, tree, tree, int, int, int, int, int, int, tree)); @@ -123,7 +123,7 @@ static void pop_labels PARAMS ((tree)); static void maybe_deduce_size_from_array_init PARAMS ((tree, tree)); static void layout_var_decl PARAMS ((tree)); static void maybe_commonize_var PARAMS ((tree)); -static tree check_initializer (tree, tree, int); +static tree check_initializer (tree, tree, int, tree *); static void make_rtl_for_nonlocal_decl PARAMS ((tree, tree, const char *)); static void save_function_data PARAMS ((tree)); static void check_function_type PARAMS ((tree, tree)); @@ -461,7 +461,7 @@ binding_table_reverse_maybe_remap (binding_table table, tree type, tree name) { const size_t chain_count = table->chain_count; binding_entry entry = NULL; - binding_entry *p; + binding_entry *p = NULL; size_t i; for (i = 0; i < chain_count && entry == NULL; ++i) @@ -922,6 +922,14 @@ kept_level_p () && !current_binding_level->tag_transparent)); } +/* Returns the kind of the innermost scope. */ + +bool +innermost_scope_is_class_p () +{ + return current_binding_level->parm_flag == 2; +} + static void declare_namespace_level () { @@ -3380,9 +3388,9 @@ duplicate_decls (newdecl, olddecl) if (DECL_ANTICIPATED (olddecl)) ; /* Do nothing yet. */ else if ((DECL_EXTERN_C_P (newdecl) - && DECL_EXTERN_C_P (olddecl)) - || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), - TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) + && DECL_EXTERN_C_P (olddecl)) + || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), + TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { /* A near match; override the builtin. */ @@ -3409,6 +3417,10 @@ duplicate_decls (newdecl, olddecl) else if (DECL_ANTICIPATED (olddecl)) TREE_TYPE (olddecl) = TREE_TYPE (newdecl); + /* Whether or not the builtin can throw exceptions has no + bearing on this declarator. */ + TREE_NOTHROW (olddecl) = 0; + if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl)) { /* If a builtin function is redeclared as `static', merge @@ -5398,8 +5410,7 @@ check_goto (decl) } /* Define a label, specifying the location in the source file. - Return the LABEL_DECL node for the label, if the definition is valid. - Otherwise return 0. */ + Return the LABEL_DECL node for the label. */ tree define_label (filename, line, name) @@ -5426,10 +5437,7 @@ define_label (filename, line, name) pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) - { - error ("duplicate label `%D'", decl); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); - } + error ("duplicate label `%D'", decl); else { /* Mark label as having been defined. */ @@ -5443,9 +5451,10 @@ define_label (filename, line, name) ent->binding_level = current_binding_level; } check_previous_gotos (decl); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); } + timevar_pop (TV_NAME_LOOKUP); + return decl; } struct cp_switch @@ -7899,15 +7908,18 @@ start_decl_1 (decl) DECL_INITIAL (decl) = NULL_TREE; } -/* Handle initialization of references. - These three arguments are from `cp_finish_decl', and have the - same meaning here that they do there. +/* Handle initialization of references. DECL, TYPE, and INIT have the + same meaning as in cp_finish_decl. *CLEANUP must be NULL on entry, + but will be set to a new CLEANUP_STMT if a temporary is created + that must be destroeyd subsequently. - Quotes on semantics can be found in ARM 8.4.3. */ + Returns an initializer expression to use to initialize DECL, or + NULL if the initialization can be performed statically. + Quotes on semantics can be found in ARM 8.4.3. */ + static tree -grok_reference_init (decl, type, init) - tree decl, type, init; +grok_reference_init (tree decl, tree type, tree init, tree *cleanup) { tree tmp; @@ -7949,7 +7961,7 @@ grok_reference_init (decl, type, init) DECL_INITIAL for local references (instead assigning to them explicitly); we need to allow the temporary to be initialized first. */ - tmp = initialize_reference (type, init, decl); + tmp = initialize_reference (type, init, decl, cleanup); if (tmp == error_mark_node) return NULL_TREE; @@ -8380,13 +8392,14 @@ reshape_init (tree type, tree *initp) } /* Verify INIT (the initializer for DECL), and record the - initialization in DECL_INITIAL, if appropriate. + initialization in DECL_INITIAL, if appropriate. CLEANUP is as for + grok_reference_init. If the return value is non-NULL, it is an expression that must be evaluated dynamically to initialize DECL. */ static tree -check_initializer (tree decl, tree init, int flags) +check_initializer (tree decl, tree init, int flags, tree *cleanup) { tree type = TREE_TYPE (decl); @@ -8436,7 +8449,7 @@ check_initializer (tree decl, tree init, int flags) init = NULL_TREE; } else if (!DECL_EXTERNAL (decl) && TREE_CODE (type) == REFERENCE_TYPE) - init = grok_reference_init (decl, type, init); + init = grok_reference_init (decl, type, init, cleanup); else if (init) { if (TREE_CODE (init) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (init)) @@ -8745,8 +8758,9 @@ cp_finish_decl (decl, init, asmspec_tree, flags) tree asmspec_tree; int flags; { - register tree type; + tree type; tree ttype = NULL_TREE; + tree cleanup; const char *asmspec = NULL; int was_readonly = 0; @@ -8757,6 +8771,9 @@ cp_finish_decl (decl, init, asmspec_tree, flags) return; } + /* Assume no cleanup is required. */ + cleanup = NULL_TREE; + /* If a name was specified, get the string. */ if (global_scope_p (current_binding_level)) asmspec_tree = maybe_apply_renaming_pragma (decl, asmspec_tree); @@ -8857,7 +8874,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags) make_decl_rtl (decl, asmspec); } else if (TREE_CODE (decl) == RESULT_DECL) - init = check_initializer (decl, init, flags); + init = check_initializer (decl, init, flags, &cleanup); else if (TREE_CODE (decl) == VAR_DECL) { /* Only PODs can have thread-local storage. Other types may require @@ -8874,7 +8891,7 @@ cp_finish_decl (decl, init, asmspec_tree, flags) is *not* defined. */ && (!DECL_EXTERNAL (decl) || init)) { - init = check_initializer (decl, init, flags); + init = check_initializer (decl, init, flags, &cleanup); /* Thread-local storage cannot be dynamically initialized. */ if (DECL_THREAD_LOCAL (decl) && init) { @@ -8993,6 +9010,11 @@ cp_finish_decl (decl, init, asmspec_tree, flags) } } + /* If a CLEANUP_STMT was created to destroy a temporary bound to a + reference, insert it in the statement-tree now. */ + if (cleanup) + add_stmt (cleanup); + finish_end: if (was_readonly) @@ -12315,7 +12337,10 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) members of other classes. */ /* All method decls are public, so tell grokfndecl to set TREE_PUBLIC, also. */ - decl = grokfndecl (ctype, type, declarator, declarator, + decl = grokfndecl (ctype, type, + TREE_CODE (declarator) != TEMPLATE_ID_EXPR + ? declarator : dname, + declarator, virtualp, flags, quals, raises, friendp ? -1 : 0, friendp, 1, 0, funcdef_flag, template_count, in_namespace); @@ -14264,7 +14289,7 @@ start_function (declspecs, declarator, attrs, flags) } else { - decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL); + decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, &attrs); /* If the declarator is not suitable for a function definition, cause a syntax error. */ if (decl1 == NULL_TREE || TREE_CODE (decl1) != FUNCTION_DECL) diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c index 452f9ad66ac5..55613700d3bc 100644 --- a/contrib/gcc/cp/decl2.c +++ b/contrib/gcc/cp/decl2.c @@ -4137,6 +4137,8 @@ add_function (k, fn) /* We must find only functions, or exactly one non-function. */ if (!k->functions) k->functions = fn; + else if (fn == k->functions) + ; else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn)) k->functions = build_overload (fn, k->functions); else diff --git a/contrib/gcc/cp/friend.c b/contrib/gcc/cp/friend.c index 9280a09b1966..0727c397cf43 100644 --- a/contrib/gcc/cp/friend.c +++ b/contrib/gcc/cp/friend.c @@ -352,6 +352,8 @@ do_friend (ctype, declarator, decl, parmdecls, attrlist, if (is_friend_template) decl = DECL_TI_TEMPLATE (push_template_decl (decl)); + else if (DECL_TEMPLATE_INFO (decl)) + ; else if (template_class_depth (current_class_type)) decl = push_template_decl_real (decl, /*is_friend=*/1); diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c index 83a87537e8b4..91ea10c16cba 100644 --- a/contrib/gcc/cp/init.c +++ b/contrib/gcc/cp/init.c @@ -2517,6 +2517,10 @@ build_new_1 (exp) element. */ rval = convert (build_pointer_type (type), rval); + /* A new-expression is never an lvalue. */ + if (real_lvalue_p (rval)) + rval = build1 (NON_LVALUE_EXPR, TREE_TYPE (rval), rval); + return rval; } diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c index 62a66d34ea2a..64d44284d006 100644 --- a/contrib/gcc/cp/pt.c +++ b/contrib/gcc/cp/pt.c @@ -95,7 +95,7 @@ static void pop_access_scope PARAMS ((tree)); static int resolve_overloaded_unification PARAMS ((tree, tree, tree, tree, unification_kind_t, int)); static int try_one_overload PARAMS ((tree, tree, tree, tree, tree, - unification_kind_t, int)); + unification_kind_t, int, bool)); static int unify PARAMS ((tree, tree, tree, tree, int)); static void add_pending_template PARAMS ((tree)); static void reopen_tinst_level PARAMS ((tree)); @@ -3991,7 +3991,8 @@ lookup_template_function (fns, arglist) if (fns == error_mark_node || arglist == error_mark_node) return error_mark_node; - if (fns == NULL_TREE) + if (fns == NULL_TREE + || TREE_CODE (fns) == FUNCTION_DECL) { error ("non-template used as template"); return error_mark_node; @@ -8437,9 +8438,15 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, { tree tempargs = copy_node (targs); int good = 0; + bool addr_p; if (TREE_CODE (arg) == ADDR_EXPR) - arg = TREE_OPERAND (arg, 0); + { + arg = TREE_OPERAND (arg, 0); + addr_p = true; + } + else + addr_p = false; if (TREE_CODE (arg) == COMPONENT_REF) /* Handle `&x' where `x' is some static or non-static member @@ -8475,10 +8482,8 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, if (subargs) { elem = tsubst (TREE_TYPE (fn), subargs, tf_none, NULL_TREE); - if (TREE_CODE (elem) == METHOD_TYPE) - elem = build_ptrmemfunc_type (build_pointer_type (elem)); - good += try_one_overload (tparms, targs, tempargs, parm, elem, - strict, sub_strict); + good += try_one_overload (tparms, targs, tempargs, parm, + elem, strict, sub_strict, addr_p); } } } @@ -8486,14 +8491,9 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, || TREE_CODE (arg) == FUNCTION_DECL) { for (; arg; arg = OVL_NEXT (arg)) - { - tree type = TREE_TYPE (OVL_CURRENT (arg)); - if (TREE_CODE (type) == METHOD_TYPE) - type = build_ptrmemfunc_type (build_pointer_type (type)); - good += try_one_overload (tparms, targs, tempargs, parm, - type, - strict, sub_strict); - } + good += try_one_overload (tparms, targs, tempargs, parm, + TREE_TYPE (OVL_CURRENT (arg)), + strict, sub_strict, addr_p); } else abort (); @@ -8522,14 +8522,20 @@ resolve_overloaded_unification (tparms, targs, parm, arg, strict, /* Subroutine of resolve_overloaded_unification; does deduction for a single overload. Fills TARGS with any deduced arguments, or error_mark_node if different overloads deduce different arguments for a given parm. + ADDR_P is true if the expression for which deduction is being + performed was of the form "& fn" rather than simply "fn". + Returns 1 on success. */ static int -try_one_overload (tparms, orig_targs, targs, parm, arg, strict, - sub_strict) - tree tparms, orig_targs, targs, parm, arg; - unification_kind_t strict; - int sub_strict; +try_one_overload (tree tparms, + tree orig_targs, + tree targs, + tree parm, + tree arg, + unification_kind_t strict, + int sub_strict, + bool addr_p) { int nargs; tree tempargs; @@ -8545,6 +8551,11 @@ try_one_overload (tparms, orig_targs, targs, parm, arg, strict, if (uses_template_parms (arg)) return 1; + if (TREE_CODE (arg) == METHOD_TYPE) + arg = build_ptrmemfunc_type (build_pointer_type (arg)); + else if (addr_p) + arg = build_pointer_type (arg); + sub_strict |= maybe_adjust_types_for_deduction (strict, &parm, &arg); /* We don't copy orig_targs for this because if we have already deduced diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c index 4721a58c11e8..c43dd212a58f 100644 --- a/contrib/gcc/cp/search.c +++ b/contrib/gcc/cp/search.c @@ -2855,8 +2855,27 @@ add_conversions (binfo, data) /* Make sure we don't already have this conversion. */ if (! IDENTIFIER_MARKED (name)) { - *conversions = tree_cons (binfo, tmp, *conversions); - IDENTIFIER_MARKED (name) = 1; + tree t; + + /* Make sure that we do not already have a conversion + operator for this type. Merely checking the NAME is not + enough because two conversion operators to the same type + may not have the same NAME. */ + for (t = *conversions; t; t = TREE_CHAIN (t)) + { + tree fn; + for (fn = TREE_VALUE (t); fn; fn = OVL_NEXT (fn)) + if (same_type_p (TREE_TYPE (name), + DECL_CONV_FN_TYPE (OVL_CURRENT (fn)))) + break; + if (fn) + break; + } + if (!t) + { + *conversions = tree_cons (binfo, tmp, *conversions); + IDENTIFIER_MARKED (name) = 1; + } } } return NULL_TREE; diff --git a/contrib/gcc/cp/tree.c b/contrib/gcc/cp/tree.c index ce6137e6fc39..1551df051079 100644 --- a/contrib/gcc/cp/tree.c +++ b/contrib/gcc/cp/tree.c @@ -357,6 +357,14 @@ build_target_expr_with_type (init, type) if (TREE_CODE (init) == TARGET_EXPR) return init; + else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type) + && TREE_CODE (init) != COND_EXPR + && TREE_CODE (init) != CONSTRUCTOR) + /* We need to build up a copy constructor call. COND_EXPR is a special + case because we already have copies on the arms and we don't want + another one here. A CONSTRUCTOR is aggregate initialization, which + is handled separately. */ + return force_rvalue (init); slot = build (VAR_DECL, type); DECL_ARTIFICIAL (slot) = 1; @@ -375,97 +383,6 @@ get_target_expr (init) { return build_target_expr_with_type (init, TREE_TYPE (init)); } - -/* Recursively perform a preorder search EXP for CALL_EXPRs, making - copies where they are found. Returns a deep copy all nodes transitively - containing CALL_EXPRs. */ - -tree -break_out_calls (exp) - tree exp; -{ - register tree t1, t2 = NULL_TREE; - register enum tree_code code; - register int changed = 0; - register int i; - - if (exp == NULL_TREE) - return exp; - - code = TREE_CODE (exp); - - if (code == CALL_EXPR) - return copy_node (exp); - - /* Don't try and defeat a save_expr, as it should only be done once. */ - if (code == SAVE_EXPR) - return exp; - - switch (TREE_CODE_CLASS (code)) - { - default: - abort (); - - case 'c': /* a constant */ - case 't': /* a type node */ - case 'x': /* something random, like an identifier or an ERROR_MARK. */ - return exp; - - case 'd': /* A decl node */ -#if 0 /* This is bogus. jason 9/21/94 */ - - t1 = break_out_calls (DECL_INITIAL (exp)); - if (t1 != DECL_INITIAL (exp)) - { - exp = copy_node (exp); - DECL_INITIAL (exp) = t1; - } -#endif - return exp; - - case 'b': /* A block node */ - { - /* Don't know how to handle these correctly yet. Must do a - break_out_calls on all DECL_INITIAL values for local variables, - and also break_out_calls on all sub-blocks and sub-statements. */ - abort (); - } - return exp; - - case 'e': /* an expression */ - case 'r': /* a reference */ - case 's': /* an expression with side effects */ - for (i = TREE_CODE_LENGTH (code) - 1; i >= 0; i--) - { - t1 = break_out_calls (TREE_OPERAND (exp, i)); - if (t1 != TREE_OPERAND (exp, i)) - { - exp = copy_node (exp); - TREE_OPERAND (exp, i) = t1; - } - } - return exp; - - case '<': /* a comparison expression */ - case '2': /* a binary arithmetic expression */ - t2 = break_out_calls (TREE_OPERAND (exp, 1)); - if (t2 != TREE_OPERAND (exp, 1)) - changed = 1; - case '1': /* a unary arithmetic expression */ - t1 = break_out_calls (TREE_OPERAND (exp, 0)); - if (t1 != TREE_OPERAND (exp, 0)) - changed = 1; - if (changed) - { - if (TREE_CODE_LENGTH (code) == 1) - return build1 (code, TREE_TYPE (exp), t1); - else - return build (code, TREE_TYPE (exp), t1, t2); - } - return exp; - } - -} /* Construct, lay out and return the type of methods belonging to class BASETYPE and whose arguments are described by ARGTYPES and whose values diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c index c161e11889b8..4b36cc2ceaa6 100644 --- a/contrib/gcc/cp/typeck.c +++ b/contrib/gcc/cp/typeck.c @@ -909,10 +909,8 @@ comptypes (t1, t2, strict) if (t1 == t2) return 1; - /* This should never happen. */ - my_friendly_assert (t1 != error_mark_node, 307); - - if (t2 == error_mark_node) + /* Suppress errors caused by previously reported errors */ + if (t1 == error_mark_node || t2 == error_mark_node) return 0; /* If either type is the internal version of sizetype, return the @@ -1405,7 +1403,7 @@ compparms (parms1, parms2) they fail to match. */ if (t1 == 0 || t2 == 0) return 0; - if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1))) + if (!same_type_p (TREE_VALUE (t1), TREE_VALUE (t2))) return 0; t1 = TREE_CHAIN (t1); @@ -2174,8 +2172,13 @@ finish_class_member_access_expr (tree object, tree name) /* Find the base of OBJECT_TYPE corresponding to SCOPE. */ access_path = lookup_base (object_type, scope, ba_check, NULL); - if (!access_path || access_path == error_mark_node) + if (access_path == error_mark_node) return error_mark_node; + if (!access_path) + { + error ("`%T' is not a base of `%T'", scope, object_type); + return error_mark_node; + } /* Look up the member. */ member = lookup_member (access_path, name, /*protect=*/1, @@ -2641,9 +2644,9 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) } tree -build_function_call_real (function, params, require_complete, flags) +build_function_call_real (function, params, flags) tree function, params; - int require_complete, flags; + int flags; { register tree fntype, fndecl; register tree coerced_params; @@ -2757,7 +2760,7 @@ tree build_function_call (function, params) tree function, params; { - return build_function_call_real (function, params, 1, LOOKUP_NORMAL); + return build_function_call_real (function, params, LOOKUP_NORMAL); } /* Convert the actual parameter expressions in the list VALUES @@ -4739,12 +4742,13 @@ build_static_cast (type, expr) (TREE_TYPE (type)))) && at_least_as_qualified_p (TREE_TYPE (type), intype)) { - /* At this point we have checked all of the conditions except - that B is not a virtual base class of D. That will be - checked by build_base_path. */ - tree base = lookup_base (TREE_TYPE (type), intype, ba_any, NULL); + /* There is a standard conversion from "D*" to "B*" even if "B" + is ambiguous or inaccessible. Therefore, we ask lookup_base + to check these conditions. */ + tree base = lookup_base (TREE_TYPE (type), intype, ba_check, NULL); - /* Convert from B* to D*. */ + /* Convert from "B*" to "D*". This function will check that "B" + is not a virtual base of "D". */ expr = build_base_path (MINUS_EXPR, build_address (expr), base, /*nonnull=*/false); /* Convert the pointer to a reference -- but then remember that @@ -4803,7 +4807,7 @@ build_static_cast (type, expr) check_for_casting_away_constness (intype, type); base = lookup_base (TREE_TYPE (type), TREE_TYPE (intype), - ba_check | ba_quiet, NULL); + ba_check, NULL); return build_base_path (MINUS_EXPR, expr, base, /*nonnull=*/false); } if ((TYPE_PTRMEM_P (type) && TYPE_PTRMEM_P (intype)) @@ -5237,6 +5241,10 @@ build_modify_expr (lhs, modifycode, rhs) TREE_OPERAND (lhs, 0), newrhs); case MODIFY_EXPR: + if (TREE_SIDE_EFFECTS (TREE_OPERAND (lhs, 0))) + lhs = build (TREE_CODE (lhs), TREE_TYPE (lhs), + stabilize_reference (TREE_OPERAND (lhs, 0)), + TREE_OPERAND (lhs, 1)); newrhs = build_modify_expr (TREE_OPERAND (lhs, 0), modifycode, rhs); if (newrhs == error_mark_node) return error_mark_node; @@ -5288,8 +5296,9 @@ build_modify_expr (lhs, modifycode, rhs) { if (TREE_CODE (rhs) == CONSTRUCTOR) { - my_friendly_assert (same_type_p (TREE_TYPE (rhs), lhstype), - 20011220); + if (! same_type_p (TREE_TYPE (rhs), lhstype)) + /* Call convert to generate an error; see PR 11063. */ + rhs = convert (lhstype, rhs); result = build (INIT_EXPR, lhstype, lhs, rhs); TREE_SIDE_EFFECTS (result) = 1; return result; @@ -5442,14 +5451,6 @@ build_modify_expr (lhs, modifycode, rhs) } } - if (TREE_CODE (lhstype) != REFERENCE_TYPE) - { - if (TREE_SIDE_EFFECTS (lhs)) - lhs = stabilize_reference (lhs); - if (TREE_SIDE_EFFECTS (newrhs)) - newrhs = stabilize_reference (newrhs); - } - /* Convert new value to destination type. */ if (TREE_CODE (lhstype) == ARRAY_TYPE) @@ -5505,44 +5506,8 @@ build_modify_expr (lhs, modifycode, rhs) if (newrhs == error_mark_node) return error_mark_node; - if (TREE_CODE (newrhs) == COND_EXPR) - { - tree lhs1; - tree cond = TREE_OPERAND (newrhs, 0); - - if (TREE_SIDE_EFFECTS (lhs)) - cond = build_compound_expr (tree_cons - (NULL_TREE, lhs, - build_tree_list (NULL_TREE, cond))); - - /* Cannot have two identical lhs on this one tree (result) as preexpand - calls will rip them out and fill in RTL for them, but when the - rtl is generated, the calls will only be in the first side of the - condition, not on both, or before the conditional jump! (mrs) */ - lhs1 = break_out_calls (lhs); - - if (lhs == lhs1) - /* If there's no change, the COND_EXPR behaves like any other rhs. */ - result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR, - lhstype, lhs, newrhs); - else - { - tree result_type = TREE_TYPE (newrhs); - /* We have to convert each arm to the proper type because the - types may have been munged by constant folding. */ - result - = build (COND_EXPR, result_type, cond, - build_modify_expr (lhs, modifycode, - cp_convert (result_type, - TREE_OPERAND (newrhs, 1))), - build_modify_expr (lhs1, modifycode, - cp_convert (result_type, - TREE_OPERAND (newrhs, 2)))); - } - } - else - result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR, - lhstype, lhs, newrhs); + result = build (modifycode == NOP_EXPR ? MODIFY_EXPR : INIT_EXPR, + lhstype, lhs, newrhs); TREE_SIDE_EFFECTS (result) = 1; @@ -6100,7 +6065,8 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum) if (fndecl) savew = warningcount, savee = errorcount; - rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE); + rhs = initialize_reference (type, rhs, /*decl=*/NULL_TREE, + /*cleanup=*/NULL); if (fndecl) { if (warningcount > savew) diff --git a/contrib/gcc/cp/typeck2.c b/contrib/gcc/cp/typeck2.c index 0e70e2bad0a4..b063f42a9f98 100644 --- a/contrib/gcc/cp/typeck2.c +++ b/contrib/gcc/cp/typeck2.c @@ -279,7 +279,8 @@ retry: break; default: - abort (); + (*p_msg) ("invalid use of incomplete type"); + break; } } diff --git a/contrib/gcc/cpplib.c b/contrib/gcc/cpplib.c index 818451d4e308..e18564e8739c 100644 --- a/contrib/gcc/cpplib.c +++ b/contrib/gcc/cpplib.c @@ -1,6 +1,6 @@ /* CPP Library. (Directive handling.) Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -1094,7 +1094,7 @@ do_pragma (pfile) cpp_reader *pfile; { const struct pragma_entry *p = NULL; - const cpp_token *token; + const cpp_token *token, *pragma_token = pfile->cur_token; unsigned int count = 1; pfile->state.prevent_expansion++; @@ -1114,16 +1114,18 @@ do_pragma (pfile) } } - /* FIXME. This is an awful kludge to get the front ends to update - their notion of line number for diagnostic purposes. The line - number should be passed to the handler and they should do it - themselves. Stand-alone CPP must ignore us, otherwise it will - prefix the directive with spaces, hence the 1. Ugh. */ - if (pfile->cb.line_change) - (*pfile->cb.line_change)(pfile, token, 1); - if (p) - (*p->u.handler) (pfile); + { + /* Since the handler below doesn't get the line number, that it + might need for diagnostics, make sure it has the right + numbers in place. */ + if (pfile->cb.line_change) + (*pfile->cb.line_change) (pfile, pragma_token, false); + (*p->u.handler) (pfile); + if (pfile->cb.line_change) + (*pfile->cb.line_change) (pfile, pfile->cur_token, false); + + } else if (pfile->cb.def_pragma) { _cpp_backup_tokens (pfile, count); diff --git a/contrib/gcc/cppmain.c b/contrib/gcc/cppmain.c index 9d8d42c2009c..d49c6f857696 100644 --- a/contrib/gcc/cppmain.c +++ b/contrib/gcc/cppmain.c @@ -1,5 +1,5 @@ /* Preprocess only, using cpplib. - Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. diff --git a/contrib/gcc/cse.c b/contrib/gcc/cse.c index 1ace41221234..9566865debef 100644 --- a/contrib/gcc/cse.c +++ b/contrib/gcc/cse.c @@ -6844,7 +6844,15 @@ cse_set_around_loop (x, insn, loop_start) abort (); } else - emit_insn_after (move, p); + { + if (control_flow_insn_p (p)) + /* p can cause a control flow transfer so it + is the last insn of a basic block. We can't + therefore use emit_insn_after. */ + emit_insn_before (move, next_nonnote_insn (p)); + else + emit_insn_after (move, p); + } } break; } diff --git a/contrib/gcc/dbxout.c b/contrib/gcc/dbxout.c index 43dd9ab50e2f..8a8b5616082b 100644 --- a/contrib/gcc/dbxout.c +++ b/contrib/gcc/dbxout.c @@ -524,7 +524,7 @@ dbxout_typedefs (syms) tree type = TREE_TYPE (syms); if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL - && COMPLETE_TYPE_P (type) + && COMPLETE_OR_VOID_TYPE_P (type) && ! TREE_ASM_WRITTEN (TYPE_NAME (type))) dbxout_symbol (TYPE_NAME (type), 0); } diff --git a/contrib/gcc/doc/contrib.texi b/contrib/gcc/doc/contrib.texi index 1c3aa25b1703..3eb3b227f394 100644 --- a/contrib/gcc/doc/contrib.texi +++ b/contrib/gcc/doc/contrib.texi @@ -31,6 +31,9 @@ the Intel 80387 register stack. @item Alasdair Baird for various bug fixes. +@item +Giovanni Bajo for analyzing lots of complicated C++ problem reports. + @item Gerald Baumgartner added the signature extension to the C++ front end. @@ -296,6 +299,9 @@ Michael Hayes for various thankless work he's done trying to get the c30/c40 ports functional. Lots of loop and unroll improvements and fixes. +@item +Dara Hazeghi for wading through myriads of target-specific bug reports. + @item Kate Hedstrom for staking the g77 folks with an initial testsuite. @@ -326,6 +332,9 @@ Steve Holmgren for MachTen patches. @item Jan Hubicka for his x86 port improvements. +@item +Falk Hueffner for working on C and optimization bug reports. + @item Christian Iseli for various bug fixes. @@ -619,6 +628,9 @@ Gerald Pfeifer for his direction via the steering committee, pointing out lots of problems we need to solve, maintenance of the web pages, and taking care of documentation maintenance in general. +@item +Andrew Pinski for processing bug reports by the dozen. + @item Ovidiu Predescu for his work on the Objective-C front end and runtime libraries. diff --git a/contrib/gcc/doc/extend.texi b/contrib/gcc/doc/extend.texi index f65690429df4..f2aca2abd81f 100644 --- a/contrib/gcc/doc/extend.texi +++ b/contrib/gcc/doc/extend.texi @@ -2554,7 +2554,7 @@ Currently, the attribute is ignored for inlined functions. If the attribute is applied to a symbol @emph{definition}, an error is reported. If a symbol previously declared @code{dllimport} is later defined, the attribute is ignored in subsequent references, and a warning is emitted. -The attribute is also overriden by a subsequent declaration as +The attribute is also overridden by a subsequent declaration as @code{dllexport}. When applied to C++ classes, the attribute marks non-inlined @@ -2636,7 +2636,7 @@ found convenient to use @code{__attribute__} to achieve a natural attachment of attributes to their corresponding declarations, whereas @code{#pragma GCC} is of use for constructs that do not naturally form part of the grammar. @xref{Other Directives,,Miscellaneous -Preprocessing Directives, cpp, The C Preprocessor}. +Preprocessing Directives, cpp, The GNU C Preprocessor}. @node Attribute Syntax @section Attribute Syntax @@ -3666,7 +3666,7 @@ the single copy in the library. Since GCC eventually will implement ISO C99 semantics for inline functions, it is best to use @code{static inline} only -to guarentee compatibility. (The +to guarantee compatibility. (The existing semantics will remain available when @option{-std=gnu89} is specified, but eventually the default will be @option{-std=gnu99} and that will implement the C99 semantics, though it does not do so yet.) @@ -5315,6 +5315,31 @@ Generates the @code{movhps} machine instruction as a store to memory. Generates the @code{movlps} machine instruction as a store to memory. @end table +The following built-in functions are available when @option{-mpni} is used. +All of them generate the machine instruction that is part of the name. + +@example +v2df __builtin_ia32_addsubpd (v2df, v2df) +v2df __builtin_ia32_addsubps (v2df, v2df) +v2df __builtin_ia32_haddpd (v2df, v2df) +v2df __builtin_ia32_haddps (v2df, v2df) +v2df __builtin_ia32_hsubpd (v2df, v2df) +v2df __builtin_ia32_hsubps (v2df, v2df) +v16qi __builtin_ia32_lddqu (char const *) +void __builtin_ia32_monitor (void *, unsigned int, unsigned int) +v2df __builtin_ia32_movddup (v2df) +v4sf __builtin_ia32_movshdup (v4sf) +v4sf __builtin_ia32_movsldup (v4sf) +void __builtin_ia32_mwait (unsigned int, unsigned int) +@end example + +The following built-in functions are available when @option{-mpni} is used. + +@table @code +@item v2df __builtin_ia32_loadddup (double const *) +Generates the @code{movddup} machine instruction as a load from memory. +@end table + The following built-in functions are available when @option{-m3dnow} is used. All of them generate the machine instruction that is part of the name. @@ -6895,8 +6920,8 @@ can also use most of the C language extensions in your C++ programs). If you want to write code that checks whether these features are available, you can test for the GNU compiler the same way as for C programs: check for a predefined macro @code{__GNUC__}. You can also use @code{__GNUG__} to -test specifically for GNU C++ (@pxref{Standard Predefined,,Standard -Predefined Macros,cpp.info,The C Preprocessor}). +test specifically for GNU C++ (@pxref{Common Predefined Macros,, +Predefined Macros,cpp,The GNU C Preprocessor}). @menu * Min and Max:: C++ Minimum and maximum operators. diff --git a/contrib/gcc/doc/include/gcc-common.texi b/contrib/gcc/doc/include/gcc-common.texi index 0a51d93d70e5..0d2cae653b22 100644 --- a/contrib/gcc/doc/include/gcc-common.texi +++ b/contrib/gcc/doc/include/gcc-common.texi @@ -4,7 +4,7 @@ @c Common values used in the GCC manuals: -@set version-GCC 3.3.1 +@set version-GCC 3.3.3 @c DEVELOPMENT is set to indicate an in-development version, @c as compared to a release version. When making a release diff --git a/contrib/gcc/doc/invoke.texi b/contrib/gcc/doc/invoke.texi index a99440f874b1..6a128907536f 100644 --- a/contrib/gcc/doc/invoke.texi +++ b/contrib/gcc/doc/invoke.texi @@ -473,7 +473,7 @@ in the following sections. -mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol -mno-wide-multiply -mrtd -malign-double @gol -mpreferred-stack-boundary=@var{num} @gol --mmmx -msse -msse2 -m3dnow @gol +-mmmx -msse -msse2 -mpni -m3dnow @gol -mthreads -mno-align-stringops -minline-all-stringops @gol -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol -m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol @@ -7904,6 +7904,13 @@ code that expects temporaries to be 80bit. This is the default choice for x86-64 compiler. +@item pni +Use all SSE extensions enabled by @option{-msse2} as well as the new +SSE extensions in Prescott New Intrunctions. @option{-mpni} also +enables 2 builtin functions, @code{__builtin_ia32_monitor} and +@code{__builtin_ia32_mwait}, for new intrunctions @code{monitor} and +@code{mwait}. + @item sse,387 Attempt to utilize both instruction sets at once. This effectively double the amount of available registers and on chips with separate execution units for @@ -8085,6 +8092,8 @@ preferred alignment to @option{-mpreferred-stack-boundary=2}. @itemx -mno-sse @item -msse2 @itemx -mno-sse2 +@item -mpni +@itemx -mno-pni @item -m3dnow @itemx -mno-3dnow @opindex mmmx diff --git a/contrib/gcc/doc/tm.texi b/contrib/gcc/doc/tm.texi index 21c7c2a2bd50..9a7117344ac0 100644 --- a/contrib/gcc/doc/tm.texi +++ b/contrib/gcc/doc/tm.texi @@ -6589,6 +6589,22 @@ usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} and/or @code{ASM_OUTPUT_SIZE_DIRECTIVE} in the definition of this macro. +@findex ASM_DECLARE_CONSTANT_NAME +@item ASM_DECLARE_CONSTANT_NAME (@var{stream}, @var{name}, @var{exp}, @var{size}) +A C statement (sans semicolon) to output to the stdio stream +@var{stream} any text necessary for declaring the name @var{name} of a +constant which is being defined. This macro is responsible for +outputting the label definition (perhaps using +@code{ASM_OUTPUT_LABEL}). The argument @var{exp} is the +value of the constant, and @var{size} is the size of the constant +in bytes. @var{name} will be an internal label. + +If this macro is not defined, then the @var{name} is defined in the +usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}). + +You may wish to use @code{ASM_OUTPUT_TYPE_DIRECTIVE} in the definition +of this macro. + @findex ASM_DECLARE_REGISTER_GLOBAL @item ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name}) A C statement (sans semicolon) to output to the stdio stream diff --git a/contrib/gcc/dwarf2out.c b/contrib/gcc/dwarf2out.c index 75e842c0d6bd..bd86bc42d8be 100644 --- a/contrib/gcc/dwarf2out.c +++ b/contrib/gcc/dwarf2out.c @@ -432,6 +432,15 @@ expand_builtin_init_dwarf_reg_sizes (address) emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size)); } + +#ifdef DWARF_ALT_FRAME_RETURN_COLUMN + { + enum machine_mode save_mode = Pmode; + HOST_WIDE_INT offset = DWARF_ALT_FRAME_RETURN_COLUMN * GET_MODE_SIZE (mode); + HOST_WIDE_INT size = GET_MODE_SIZE (save_mode); + emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size)); + } +#endif } /* Convert a DWARF call frame info. operation to its string name */ @@ -11051,16 +11060,20 @@ gen_inlined_subroutine_die (stmt, context_die, depth) dw_die_ref context_die; int depth; { + tree decl = block_ultimate_origin (stmt); + + /* Emit info for the abstract instance first, if we haven't yet. We + must emit this even if the block is abstract, otherwise when we + emit the block below (or elsewhere), we may end up trying to emit + a die whose origin die hasn't been emitted, and crashing. */ + dwarf2out_abstract_function (decl); + if (! BLOCK_ABSTRACT (stmt)) { dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine, context_die, stmt); - tree decl = block_ultimate_origin (stmt); char label[MAX_ARTIFICIAL_LABEL_BYTES]; - /* Emit info for the abstract instance first, if we haven't yet. */ - dwarf2out_abstract_function (decl); - add_abstract_origin_attribute (subr_die, decl); ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL, BLOCK_NUMBER (stmt)); diff --git a/contrib/gcc/expr.c b/contrib/gcc/expr.c index f0e63bcc205f..9f7c2847c58d 100644 --- a/contrib/gcc/expr.c +++ b/contrib/gcc/expr.c @@ -1425,6 +1425,15 @@ convert_modes (mode, oldmode, x, unsignedp) return gen_lowpart (mode, x); } + /* Converting from integer constant into mode is always equivalent to an + subreg operation. */ + if (VECTOR_MODE_P (mode) && GET_MODE (x) == VOIDmode) + { + if (GET_MODE_BITSIZE (mode) != GET_MODE_BITSIZE (oldmode)) + abort (); + return simplify_gen_subreg (mode, x, oldmode, 0); + } + temp = gen_reg_rtx (mode); convert_move (temp, x, unsignedp); return temp; diff --git a/contrib/gcc/f/ChangeLog b/contrib/gcc/f/ChangeLog index 0fb213decb12..d88c6537208a 100644 --- a/contrib/gcc/f/ChangeLog +++ b/contrib/gcc/f/ChangeLog @@ -1,3 +1,7 @@ +2003-10-16 Release Manager + + * GCC 3.3.2 Released. + 2003-08-04 Release Manager * GCC 3.3.1 Released. diff --git a/contrib/gcc/function.c b/contrib/gcc/function.c index daa2cab6f668..e055375d8604 100644 --- a/contrib/gcc/function.c +++ b/contrib/gcc/function.c @@ -1373,8 +1373,9 @@ put_var_into_stack (decl, rescan) if (function->decl == context) break; - /* If this is a variable-size object with a pseudo to address it, - put that pseudo into the stack, if the var is nonlocal. */ + /* If this is a variable-sized object or a structure passed by invisible + reference, with a pseudo to address it, put that pseudo into the stack + if the var is non-local. */ if (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl) && GET_CODE (reg) == MEM && GET_CODE (XEXP (reg, 0)) == REG @@ -1384,8 +1385,12 @@ put_var_into_stack (decl, rescan) decl_mode = promoted_mode = GET_MODE (reg); } + /* If this variable lives in the current function and we don't need to put it + in the stack for the sake of setjmp or the non-locality, try to keep it in + a register until we know we actually need the address. */ can_use_addressof = (function == 0 + && ! (TREE_CODE (decl) != SAVE_EXPR && DECL_NONLOCAL (decl)) && optimize > 0 /* FIXME make it work for promoted modes too */ && decl_mode == promoted_mode @@ -1404,9 +1409,6 @@ put_var_into_stack (decl, rescan) if (GET_CODE (reg) == REG) { - /* If this variable lives in the current function and we don't need - to put things in the stack for the sake of setjmp, try to keep it - in a register until we know we actually need the address. */ if (can_use_addressof) gen_mem_addressof (reg, decl, rescan); else diff --git a/contrib/gcc/gcc.c b/contrib/gcc/gcc.c index c6a993fd928f..08a37cdf947b 100644 --- a/contrib/gcc/gcc.c +++ b/contrib/gcc/gcc.c @@ -1555,6 +1555,9 @@ init_spec () "-lgcc_s" #else "-lgcc_s%M" +#endif +#ifdef USE_LIBUNWIND_EXCEPTIONS + " -lunwind" #endif , "-lgcc", diff --git a/contrib/gcc/libgcc-std.ver b/contrib/gcc/libgcc-std.ver index b0bd365375c4..79e79fb512ea 100644 --- a/contrib/gcc/libgcc-std.ver +++ b/contrib/gcc/libgcc-std.ver @@ -190,3 +190,7 @@ GCC_3.3.1 { __gcc_personality_sj0 __gcc_personality_v0 } + +%inherit GCC_3.3.2 GCC_3.3.1 +GCC_3.3.2 { +} diff --git a/contrib/gcc/loop.c b/contrib/gcc/loop.c index 284d891cf21e..c0888fa6ce28 100644 --- a/contrib/gcc/loop.c +++ b/contrib/gcc/loop.c @@ -6275,7 +6275,7 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location) { enum rtx_code code; rtx *argp, arg; - rtx insn, set = 0; + rtx insn, set = 0, last, inc; code = GET_CODE (x); *location = NULL; @@ -6303,7 +6303,26 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location) if (loop_invariant_p (loop, arg) != 1) return 0; - *inc_val = convert_modes (GET_MODE (dest_reg), GET_MODE (x), arg, 0); + /* convert_modes can emit new instructions, e.g. when arg is a loop + invariant MEM and dest_reg has a different mode. + These instructions would be emitted after the end of the function + and then *inc_val would be an unitialized pseudo. + Detect this and bail in this case. + Other alternatives to solve this can be introducing a convert_modes + variant which is allowed to fail but not allowed to emit new + instructions, emit these instructions before loop start and let + it be garbage collected if *inc_val is never used or saving the + *inc_val initialization sequence generated here and when *inc_val + is going to be actually used, emit it at some suitable place. */ + last = get_last_insn (); + inc = convert_modes (GET_MODE (dest_reg), GET_MODE (x), arg, 0); + if (get_last_insn () != last) + { + delete_insns_since (last); + return 0; + } + + *inc_val = inc; *mult_val = const1_rtx; *location = argp; return 1; @@ -6384,7 +6403,15 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location) && GET_MODE_CLASS (mode) != MODE_CC) { /* Possible bug here? Perhaps we don't know the mode of X. */ - *inc_val = convert_modes (GET_MODE (dest_reg), mode, x, 0); + last = get_last_insn (); + inc = convert_modes (GET_MODE (dest_reg), mode, x, 0); + if (get_last_insn () != last) + { + delete_insns_since (last); + return 0; + } + + *inc_val = inc; *mult_val = const0_rtx; return 1; } diff --git a/contrib/gcc/loop.h b/contrib/gcc/loop.h index 362013f39781..1dffdddec2e0 100644 --- a/contrib/gcc/loop.h +++ b/contrib/gcc/loop.h @@ -143,9 +143,12 @@ struct induction based on the same biv. For bivs, links together all biv entries that refer to the same biv register. */ - struct induction *same; /* If this giv has been combined with another - giv, this points to the base giv. The base - giv will have COMBINED_WITH nonzero. */ + struct induction *same; /* For givs, if the giv has been combined with + another giv, this points to the base giv. + The base giv will have COMBINED_WITH nonzero. + For bivs, if the biv has the same LOCATION + than another biv, this points to the base + biv. */ HOST_WIDE_INT const_adjust; /* Used by loop unrolling, when an address giv is split, and a constant is eliminated from the address, the -constant is stored here diff --git a/contrib/gcc/mklibgcc.in b/contrib/gcc/mklibgcc.in index 3c3358a7b3a5..16e9fde52c38 100644 --- a/contrib/gcc/mklibgcc.in +++ b/contrib/gcc/mklibgcc.in @@ -308,8 +308,14 @@ for ml in $MULTILIBS; do done fi + # Each of these .a files depends on stmp-dirs. It would seem that + # this dependency is redundant, since each of the object files + # itself depends on stmp-dirs. However, it is possible that there + # are in fact no object files. In that case, the stmp-dirs + # dependency is required; the directory containing the archive must + # exist before the archive itself can be created. echo "" - echo "${dir}/libgcc.a: $libgcc_a_objs" + echo "${dir}/libgcc.a: stmp-dirs $libgcc_a_objs" echo " -rm -rf ${dir}/libgcc.a" echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc.a $libgcc_a_objs echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\ @@ -319,7 +325,7 @@ for ml in $MULTILIBS; do if [ "$SHLIB_LINK" ]; then echo "" - echo "${dir}/libgcc_eh.a: $libgcc_eh_objs" + echo "${dir}/libgcc_eh.a: stmp-dirs $libgcc_eh_objs" echo " -rm -rf ${dir}/libgcc_eh.a" echo ' $(AR_CREATE_FOR_TARGET)' ${dir}/libgcc_eh.a $libgcc_eh_objs echo ' if $(RANLIB_TEST_FOR_TARGET) ; then' \\ diff --git a/contrib/gcc/mkmap-symver.awk b/contrib/gcc/mkmap-symver.awk index e4bc58e18807..7953afcff806 100644 --- a/contrib/gcc/mkmap-symver.awk +++ b/contrib/gcc/mkmap-symver.awk @@ -95,22 +95,28 @@ function output(lib) { if (inherit[lib]) output(inherit[lib]); - printf("%s {\n", lib); - sawglobal = 0; + empty=1 for (sym in ver) if ((ver[sym] == lib) && (sym in def)) { - if (!sawglobal) + if (empty) { + printf("%s {\n", lib); printf(" global:\n"); - sawglobal = 1; + empty = 0; } printf("\t%s;\n", sym); if (dotsyms) printf("\t.%s;\n", sym); } - if (inherit[lib]) + if (empty) + { + for (l in libs) + if (inherit[l] == lib) + inherit[l] = inherit[lib]; + } + else if (inherit[lib]) printf("} %s;\n", inherit[lib]); else printf ("\n local:\n\t*;\n};\n"); diff --git a/contrib/gcc/real.c b/contrib/gcc/real.c index 61cbf2ece25a..f775226c1ed4 100644 --- a/contrib/gcc/real.c +++ b/contrib/gcc/real.c @@ -2612,9 +2612,10 @@ encode_ieee_single (fmt, buf, r) const REAL_VALUE_TYPE *r; { unsigned long image, sig, exp; + unsigned long sign = r->sign; bool denormal = (r->sig[SIGSZ-1] & SIG_MSB) == 0; - image = r->sign << 31; + image = sign << 31; sig = (r->sig[SIGSZ-1] >> (HOST_BITS_PER_LONG - 24)) & 0x7fffff; switch (r->class) diff --git a/contrib/gcc/reg-stack.c b/contrib/gcc/reg-stack.c index 1537c0773315..8e6731b8c7bf 100644 --- a/contrib/gcc/reg-stack.c +++ b/contrib/gcc/reg-stack.c @@ -2616,11 +2616,12 @@ convert_regs_1 (file, block) { struct stack_def regstack; block_info bi = BLOCK_INFO (block); - int inserted, reg; + int deleted, inserted, reg; rtx insn, next; edge e, beste = NULL; inserted = 0; + deleted = 0; any_malformed_asm = false; /* Find the edge we will copy stack from. It should be the most frequent @@ -2652,10 +2653,24 @@ convert_regs_1 (file, block) beste = e; } - /* Entry block does have stack already initialized. */ + /* Initialize stack at block entry. */ if (bi->stack_in.top == -2) - inserted |= compensate_edge (beste, file); + { + if (beste) + inserted |= compensate_edge (beste, file); + else + { + /* No predecessors. Create an arbitrary input stack. */ + int reg; + + bi->stack_in.top = -1; + for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg) + if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg)) + bi->stack_in.reg[++bi->stack_in.top] = reg; + } + } else + /* Entry blocks do have stack already initialized. */ beste = NULL; current_block = block; @@ -2693,6 +2708,7 @@ convert_regs_1 (file, block) print_stack (file, ®stack); } subst_stack_regs (insn, ®stack); + deleted |= (GET_CODE (insn) == NOTE || INSN_DELETED_P (insn)); } } while (next); @@ -2732,8 +2748,23 @@ convert_regs_1 (file, block) nan); insn = emit_insn_after (set, insn); subst_stack_regs (insn, ®stack); + deleted |= (GET_CODE (insn) == NOTE || INSN_DELETED_P (insn)); } } + + /* Amongst the insns possibly deleted during the substitution process above, + might have been the only trapping insn in the block. We purge the now + possibly dead EH edges here to avoid an ICE from fixup_abnormal_edges, + called at the end of convert_regs. The order in which we process the + blocks ensures that we never delete an already processed edge. + + ??? We are normally supposed not to delete trapping insns, so we pretend + that the insns deleted above don't actually trap. It would have been + better to detect this earlier and avoid creating the EH edge in the first + place, still, but we don't have enough information at that time. */ + + if (deleted) + purge_dead_edges (block); /* Something failed if the stack lives don't match. If we had malformed asms, we zapped the instruction itself, but that didn't produce the @@ -2780,6 +2811,10 @@ convert_regs_2 (file, block) basic_block *stack, *sp; int inserted; + /* We process the blocks in a top-down manner, in a way such that one block + is only processed after all its predecessors. The number of predecessors + of every block has already been computed. */ + stack = (basic_block *) xmalloc (sizeof (*stack) * n_basic_blocks); sp = stack; @@ -2791,8 +2826,19 @@ convert_regs_2 (file, block) edge e; block = *--sp; - inserted |= convert_regs_1 (file, block); - BLOCK_INFO (block)->done = 1; + + /* Processing BLOCK is achieved by convert_regs_1, which may purge + some dead EH outgoing edge after the deletion of the trapping + insn inside the block. Since the number of predecessors of + BLOCK's successors was computed based on the initial edge set, + we check the necessity to process some of these successors + before such an edge deletion may happen. However, there is + a pitfall: if BLOCK is the only predecessor of a successor and + the edge between them happens to be deleted, the successor + becomes unreachable and should not be processed. The problem + is that there is no way to preventively detect this case so we + stack the successor in all cases and hand over the task of + fixing up the discrepancy to convert_regs_1. */ for (e = block->succ; e ; e = e->succ_next) if (! (e->flags & EDGE_DFS_BACK)) @@ -2801,6 +2847,9 @@ convert_regs_2 (file, block) if (!BLOCK_INFO (e->dest)->predecessors) *sp++ = e->dest; } + + inserted |= convert_regs_1 (file, block); + BLOCK_INFO (block)->done = 1; } while (sp != stack); @@ -2841,17 +2890,7 @@ convert_regs (file) block_info bi = BLOCK_INFO (b); if (! bi->done) - { - int reg; - - /* Create an arbitrary input stack. */ - bi->stack_in.top = -1; - for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg) - if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg)) - bi->stack_in.reg[++bi->stack_in.top] = reg; - - inserted |= convert_regs_2 (file, b); - } + inserted |= convert_regs_2 (file, b); } clear_aux_for_blocks (); diff --git a/contrib/gcc/reorg.c b/contrib/gcc/reorg.c index 31918ec43e30..3fdf941ad793 100644 --- a/contrib/gcc/reorg.c +++ b/contrib/gcc/reorg.c @@ -236,6 +236,12 @@ stop_search_p (insn, labels_p) if (insn == 0) return 1; + /* If the insn can throw an exception that is caught within the function, + it may effectively perform a jump from the viewpoint of the function. + Therefore act like for a jump. */ + if (can_throw_internal (insn)) + return 1; + switch (GET_CODE (insn)) { case NOTE: diff --git a/contrib/gcc/scan-decls.c b/contrib/gcc/scan-decls.c index e56401d066f9..4f99319cc70e 100644 --- a/contrib/gcc/scan-decls.c +++ b/contrib/gcc/scan-decls.c @@ -32,7 +32,9 @@ int brace_nesting = 0; indicate the (brace nesting levels of) left braces that were prefixed by extern "C". */ int extern_C_braces_length = 0; -char extern_C_braces[20]; +/* 20 is not enough anymore on Solaris 9. */ +#define MAX_EXTERN_C_BRACES 200 +char extern_C_braces[MAX_EXTERN_C_BRACES]; #define in_extern_C_brace (extern_C_braces_length>0) /* True if the function declaration currently being scanned is @@ -222,6 +224,12 @@ scan_decls (pfile, argc, argv) brace_nesting++; extern_C_braces[extern_C_braces_length++] = brace_nesting; + if (extern_C_braces_length >= MAX_EXTERN_C_BRACES) + { + fprintf (stderr, + "Internal error: out-of-bounds index\n"); + exit (FATAL_EXIT_CODE); + } goto new_statement; } } diff --git a/contrib/gcc/stmt.c b/contrib/gcc/stmt.c index 9800ee8306b5..89b9840c25dd 100644 --- a/contrib/gcc/stmt.c +++ b/contrib/gcc/stmt.c @@ -1735,8 +1735,8 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line) } else { - warning ("use of memory input without lvalue in " - "asm operand %d is deprecated", i + noutputs); + warning ("use of memory input without lvalue in asm operand %d is deprecated", + i + noutputs); if (CONSTANT_P (op)) { diff --git a/contrib/gcc/stor-layout.c b/contrib/gcc/stor-layout.c index 4fb290847ef6..835cb7cb1e88 100644 --- a/contrib/gcc/stor-layout.c +++ b/contrib/gcc/stor-layout.c @@ -711,6 +711,9 @@ update_alignment_for_field (rli, field, known_align) desired_align = DECL_ALIGN (field); user_align = DECL_USER_ALIGN (field); } + else if (!DECL_BIT_FIELD_TYPE (field)) + /* Even packed non-bit-fields get byte alignment. */ + desired_align = MAX (desired_align, BITS_PER_UNIT); /* Some targets (i.e. i386, VMS) limit struct field alignment to a lower boundary than alignment of variables unless diff --git a/contrib/gcc/tlink.c b/contrib/gcc/tlink.c index a98b55b5f3b2..f1ad176a6d25 100644 --- a/contrib/gcc/tlink.c +++ b/contrib/gcc/tlink.c @@ -465,8 +465,8 @@ recompile_files () { file *f; - putenv (xstrdup ("COMPILER_PATH")); - putenv (xstrdup ("LIBRARY_PATH")); + putenv (xstrdup ("COMPILER_PATH=")); + putenv (xstrdup ("LIBRARY_PATH=")); while ((f = file_pop ()) != NULL) { diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c index 5abcf7f7045f..adccdc40361c 100644 --- a/contrib/gcc/toplev.c +++ b/contrib/gcc/toplev.c @@ -2816,7 +2816,8 @@ rest_of_compilation (decl) tem = cse_main (insns, max_reg_num (), 0, rtl_dump_file); if (tem) rebuild_jump_labels (insns); - purge_all_dead_edges (0); + if (purge_all_dead_edges (0)) + delete_unreachable_blocks (); delete_trivially_dead_insns (insns, max_reg_num ()); @@ -3461,6 +3462,23 @@ rest_of_compilation (decl) #endif #ifdef STACK_REGS +#if defined (HAVE_ATTR_length) + /* If flow2 creates new instructions which need splitting + and scheduling after reload is not done, they might not be + splitten until final which doesn't allow splitting + if HAVE_ATTR_length. */ +#ifdef INSN_SCHEDULING + if (optimize && !flag_schedule_insns_after_reload) +#else + if (optimize) +#endif + { + timevar_push (TV_SHORTEN_BRANCH); + split_all_insns (1); + timevar_pop (TV_SHORTEN_BRANCH); + } +#endif + timevar_push (TV_REG_STACK); open_dump_file (DFI_stack, decl); diff --git a/contrib/gcc/tree.c b/contrib/gcc/tree.c index fbb47e9220c8..e8c2541c1d99 100644 --- a/contrib/gcc/tree.c +++ b/contrib/gcc/tree.c @@ -4351,7 +4351,7 @@ const char *flag_random_seed; /* Set up a default flag_random_seed value, if there wasn't one already. */ void -default_flag_random_seed (void) +default_flag_random_seed () { unsigned HOST_WIDE_INT value; char *new_random_seed; diff --git a/contrib/gcc/tree.h b/contrib/gcc/tree.h index a64175fe61fb..1ad4b142c78a 100644 --- a/contrib/gcc/tree.h +++ b/contrib/gcc/tree.h @@ -174,7 +174,7 @@ struct tree_common GTY(()) TREE_STATIC in VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, ADDR_EXPR TREE_NO_UNUSED_WARNING in - CONVERT_EXPR, NOP_EXPR, COMPOUND_EXPR + CONVERT_EXPR, NOP_EXPR, COMPOUND_EXPR, NON_LVALUE_EXPR TREE_VIA_VIRTUAL in TREE_LIST or TREE_VEC TREE_CONSTANT_OVERFLOW in diff --git a/contrib/gcc/unroll.c b/contrib/gcc/unroll.c index 590cc944e2ff..5a15208d5d7c 100644 --- a/contrib/gcc/unroll.c +++ b/contrib/gcc/unroll.c @@ -2478,7 +2478,13 @@ biv_total_increment (bl) if (v->always_computable && v->mult_val == const1_rtx && ! v->maybe_multiple && SCALAR_INT_MODE_P (v->mode)) - result = fold_rtx_mult_add (result, const1_rtx, v->add_val, v->mode); + { + /* If we have already counted it, skip it. */ + if (v->same) + continue; + + result = fold_rtx_mult_add (result, const1_rtx, v->add_val, v->mode); + } else return 0; } @@ -3539,6 +3545,10 @@ loop_iterations (loop) return 0; } + /* If we have already counted it, skip it. */ + if (biv_inc->same) + continue; + offset -= INTVAL (biv_inc->add_val); } } diff --git a/contrib/gcc/unwind-dw2.c b/contrib/gcc/unwind-dw2.c index 6d7219eeca12..0e59c7b2ba26 100644 --- a/contrib/gcc/unwind-dw2.c +++ b/contrib/gcc/unwind-dw2.c @@ -62,7 +62,7 @@ struct _Unwind_Context }; /* Byte size of every register managed by these routines. */ -static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS]; +static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS+1]; /* The result of interpreting the frame unwind info for a frame. @@ -171,7 +171,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int index) _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *context) { - return (_Unwind_Ptr) context->cfa; + return (_Unwind_Word) context->cfa; } /* Overwrite the saved value for register REG in CONTEXT with VAL. */ @@ -929,6 +929,9 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) context->args_size = 0; context->lsda = 0; + if (context->ra == 0) + return _URC_END_OF_STACK; + fde = _Unwind_Find_FDE (context->ra - 1, &context->bases); if (fde == NULL) { diff --git a/contrib/gcc/unwind-libunwind.c b/contrib/gcc/unwind-libunwind.c new file mode 100644 index 000000000000..2e53a59eac7b --- /dev/null +++ b/contrib/gcc/unwind-libunwind.c @@ -0,0 +1,172 @@ +/* Subroutines needed for unwinding stack frames via the libunwind API. + Copyright (C) 2002, 2003 + Free Software Foundation, Inc. + Contributed by David Mosberger-Tang + + 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, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, if you link this library with other files, + some of which are compiled with GCC, to produce an executable, + this library 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 "tconfig.h" +#include "tsystem.h" +#include "unwind.h" + +#ifndef __USING_SJLJ_EXCEPTIONS__ + +#define UNW_LOCAL_ONLY + +#include + +typedef struct { + _Unwind_Personality_Fn personality; +} _Unwind_FrameState; + +struct _Unwind_Context { + unw_cursor_t cursor; +}; + + +/* First come the helper-routines that are needed by unwind.inc. */ + +static _Unwind_Reason_Code +uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) +{ + unw_proc_info_t pi; + + if (unw_step (&context->cursor) <= 0) + return _URC_END_OF_STACK; + + unw_get_proc_info(&context->cursor, &pi); + fs->personality = (_Unwind_Personality_Fn) pi.handler; + + return _URC_NO_REASON; +} + +#define uw_update_context(context,fs) do { ; } while (0) + +static inline _Unwind_Ptr +uw_identify_context (struct _Unwind_Context *context) +{ + unw_word_t ip; + unw_get_reg (&context->cursor, UNW_REG_IP, &ip); + return (_Unwind_Ptr) ip; +} + +#define uw_init_context(context) \ +do \ + { \ + unw_context_t uc; \ + unw_getcontext (&uc); \ + unw_init_local (&(context)->cursor, &uc); \ + } \ +while (0) + +static inline void __attribute__ ((noreturn)) +uw_install_context (struct _Unwind_Context *current __attribute__ ((unused)), + struct _Unwind_Context *target) +{ + unw_resume (&(target)->cursor); + abort (); +} + + +/* Now come the helper-routines which may be called from an exception + handler. The interface for these routines are defined by the C++ + ABI. See: http://www.codesourcery.com/cxx-abi/abi-eh.html */ + +_Unwind_Word +_Unwind_GetGR (struct _Unwind_Context *context, int index) +{ + unw_word_t ret; + + /* Note: here we depend on the fact that general registers are + expected to start with register number 0! */ + unw_get_reg (&context->cursor, index, &ret); + return ret; +} + +/* Get the value of the CFA as saved in CONTEXT. */ + +_Unwind_Word +_Unwind_GetCFA (struct _Unwind_Context *context) +{ + /* ??? Is there any way to get this information? */ + return NULL; +} + +/* Overwrite the saved value for register REG in CONTEXT with VAL. */ + +void +_Unwind_SetGR (struct _Unwind_Context *context, int index, _Unwind_Word val) +{ + /* Note: here we depend on the fact that general registers are + expected to start with register number 0! */ + unw_set_reg (&context->cursor, index, val); +} + +/* Retrieve the return address for CONTEXT. */ + +inline _Unwind_Ptr +_Unwind_GetIP (struct _Unwind_Context *context) +{ + unw_word_t ret; + + unw_get_reg (&context->cursor, UNW_REG_IP, &ret); + return ret; +} + +/* Overwrite the return address for CONTEXT with VAL. */ + +inline void +_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val) +{ + unw_set_reg (&context->cursor, UNW_REG_IP, val); +} + +void * +_Unwind_GetLanguageSpecificData (struct _Unwind_Context *context) +{ + unw_proc_info_t pi; + + unw_get_proc_info(&context->cursor, &pi); + return (void *) pi.lsda; +} + +_Unwind_Ptr +_Unwind_GetRegionStart (struct _Unwind_Context *context) +{ + unw_proc_info_t pi; + + unw_get_proc_info(&context->cursor, &pi); + return (_Unwind_Ptr) pi.start_ip; +} + +void * +_Unwind_FindEnclosingFunction (void *pc) +{ + return NULL; +} + +#include "unwind.inc" + +#endif /* !__USING_SJLJ_EXCEPTIONS__ */ diff --git a/contrib/gcc/unwind.h b/contrib/gcc/unwind.h index af4e8afedc63..4f39223b03ec 100644 --- a/contrib/gcc/unwind.h +++ b/contrib/gcc/unwind.h @@ -210,6 +210,9 @@ _Unwind_GetTextRelBase (struct _Unwind_Context *_C) abort (); return 0; } + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); #else extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); diff --git a/contrib/gcc/varasm.c b/contrib/gcc/varasm.c index a7c84cd3ed77..9a760998f620 100644 --- a/contrib/gcc/varasm.c +++ b/contrib/gcc/varasm.c @@ -2411,7 +2411,7 @@ compare_constant (t1, t2) if (get_set_constructor_bytes (t2, tmp2, len) != NULL_TREE) return 0; - return memcmp (tmp1, tmp2, len) != 0; + return memcmp (tmp1, tmp2, len) == 0; } else { @@ -2662,6 +2662,7 @@ output_constant_def (exp, defer) int labelno = -1; rtx rtl; + /* We can't just use the saved RTL if this is a deferred string constant and we are not to defer anymore. */ if (TREE_CODE (exp) != INTEGER_CST && TREE_CST_RTL (exp) @@ -2825,6 +2826,7 @@ output_constant_def_contents (exp, reloc, labelno) int labelno; { int align; + HOST_WIDE_INT size; /* Align the location counter as required by EXP's data type. */ align = TYPE_ALIGN (TREE_TYPE (exp)); @@ -2842,17 +2844,24 @@ output_constant_def_contents (exp, reloc, labelno) ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); } - /* Output the label itself. */ + size = int_size_in_bytes (TREE_TYPE (exp)); + if (TREE_CODE (exp) == STRING_CST) + size = MAX (TREE_STRING_LENGTH (exp), size); + + /* Do any machine/system dependent processing of the constant. */ +#ifdef ASM_DECLARE_CONSTANT_NAME + { + char label[256]; + ASM_GENERATE_INTERNAL_LABEL (label, "LC", labelno); + ASM_DECLARE_CONSTANT_NAME (asm_out_file, label, exp, size); + } +#else + /* Standard thing is just output label for the constant. */ ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LC", labelno); +#endif /* ASM_DECLARE_CONSTANT_NAME */ /* Output the value of EXP. */ - output_constant (exp, - (TREE_CODE (exp) == STRING_CST - ? MAX (TREE_STRING_LENGTH (exp), - int_size_in_bytes (TREE_TYPE (exp))) - : int_size_in_bytes (TREE_TYPE (exp))), - align); - + output_constant (exp, size, align); } /* Used in the hash tables to avoid outputting the same constant @@ -3767,11 +3776,27 @@ initializer_constant_valid_p (value, endtype) || TREE_CODE (TREE_TYPE (value)) == RECORD_TYPE) && TREE_CONSTANT (value) && CONSTRUCTOR_ELTS (value)) - return - initializer_constant_valid_p (TREE_VALUE (CONSTRUCTOR_ELTS (value)), - endtype); + { + tree elt; + bool absolute = true; + + for (elt = CONSTRUCTOR_ELTS (value); elt; elt = TREE_CHAIN (elt)) + { + tree reloc; + value = TREE_VALUE (elt); + reloc = initializer_constant_valid_p (value, TREE_TYPE (value)); + if (!reloc) + return NULL_TREE; + if (reloc != null_pointer_node) + absolute = false; + } + /* For a non-absolute relocation, there is no single + variable that can be "the variable that determines the + relocation." */ + return absolute ? null_pointer_node : error_mark_node; + } - return TREE_STATIC (value) ? null_pointer_node : 0; + return TREE_STATIC (value) ? null_pointer_node : NULL_TREE; case INTEGER_CST: case VECTOR_CST: diff --git a/contrib/gcc/version.c b/contrib/gcc/version.c index fadd8b1b8cf5..19f7d763d98e 100644 --- a/contrib/gcc/version.c +++ b/contrib/gcc/version.c @@ -6,7 +6,7 @@ please modify this string to indicate that, e.g. by putting your organization's name in parentheses at the end of the string. */ -const char version_string[] = "3.3.1"; +const char version_string[] = "3.3.3 20031106 (prerelease)"; /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, -- cgit v1.2.3