OSDN Git Service

* config/i386/i386-interix.h: Remove uses of "register"
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386.c
index f36c99c..d4653ac 100644 (file)
@@ -2,20 +2,20 @@
    Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    2002, 2003 Free Software Foundation, Inc.
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
+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.
 
-GNU CC is distributed in the hope that it will be useful,
+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 GNU CC; see the file COPYING.  If not, write to
+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.  */
 
@@ -782,55 +782,56 @@ const char *ix86_align_funcs_string;
 static char internal_label_prefix[16];
 static int internal_label_prefix_len;
 \f
-static int local_symbolic_operand PARAMS ((rtx, enum machine_mode));
-static int tls_symbolic_operand_1 PARAMS ((rtx, enum tls_model));
-static void output_pic_addr_const PARAMS ((FILE *, rtx, int));
-static void put_condition_code PARAMS ((enum rtx_code, enum machine_mode,
-                                      int, int, FILE *));
-static const char *get_some_local_dynamic_name PARAMS ((void));
-static int get_some_local_dynamic_name_1 PARAMS ((rtx *, void *));
-static rtx maybe_get_pool_constant PARAMS ((rtx));
-static rtx ix86_expand_int_compare PARAMS ((enum rtx_code, rtx, rtx));
-static enum rtx_code ix86_prepare_fp_compare_args PARAMS ((enum rtx_code,
-                                                          rtx *, rtx *));
-static rtx get_thread_pointer PARAMS ((int));
-static rtx legitimize_tls_address PARAMS ((rtx, enum tls_model, int));
-static void get_pc_thunk_name PARAMS ((char [32], unsigned int));
-static rtx gen_push PARAMS ((rtx));
-static int memory_address_length PARAMS ((rtx addr));
-static int ix86_flags_dependant PARAMS ((rtx, rtx, enum attr_type));
-static int ix86_agi_dependant PARAMS ((rtx, rtx, enum attr_type));
-static enum attr_ppro_uops ix86_safe_ppro_uops PARAMS ((rtx));
-static void ix86_dump_ppro_packet PARAMS ((FILE *));
-static void ix86_reorder_insn PARAMS ((rtx *, rtx *));
-static struct machine_function * ix86_init_machine_status PARAMS ((void));
-static int ix86_split_to_parts PARAMS ((rtx, rtx *, enum machine_mode));
-static int ix86_nsaved_regs PARAMS ((void));
-static void ix86_emit_save_regs PARAMS ((void));
-static void ix86_emit_save_regs_using_mov PARAMS ((rtx, HOST_WIDE_INT));
-static void ix86_emit_restore_regs_using_mov PARAMS ((rtx, int, int));
-static void ix86_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
-static void ix86_set_move_mem_attrs_1 PARAMS ((rtx, rtx, rtx, rtx, rtx));
-static void ix86_sched_reorder_ppro PARAMS ((rtx *, rtx *));
-static HOST_WIDE_INT ix86_GOT_alias_set PARAMS ((void));
-static void ix86_adjust_counter PARAMS ((rtx, HOST_WIDE_INT));
-static rtx ix86_expand_aligntest PARAMS ((rtx, int));
-static void ix86_expand_strlensi_unroll_1 PARAMS ((rtx, rtx));
-static int ix86_issue_rate PARAMS ((void));
-static int ix86_adjust_cost PARAMS ((rtx, rtx, rtx, int));
-static void ix86_sched_init PARAMS ((FILE *, int, int));
-static int ix86_sched_reorder PARAMS ((FILE *, int, rtx *, int *, int));
-static int ix86_variable_issue PARAMS ((FILE *, int, rtx, int));
-static int ia32_use_dfa_pipeline_interface PARAMS ((void));
-static int ia32_multipass_dfa_lookahead PARAMS ((void));
-static void ix86_init_mmx_sse_builtins PARAMS ((void));
-static rtx x86_this_parameter PARAMS ((tree));
-static void x86_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
-                                        HOST_WIDE_INT, tree));
-static bool x86_can_output_mi_thunk PARAMS ((tree, HOST_WIDE_INT,
-                                            HOST_WIDE_INT, tree));
-static void ix86_reorg PARAMS ((void));
-bool ix86_expand_carry_flag_compare PARAMS ((enum rtx_code, rtx, rtx, rtx*));
+static int local_symbolic_operand (rtx, enum machine_mode);
+static int tls_symbolic_operand_1 (rtx, enum tls_model);
+static void output_pic_addr_const (FILE *, rtx, int);
+static void put_condition_code (enum rtx_code, enum machine_mode,
+                               int, int, FILE *);
+static const char *get_some_local_dynamic_name (void);
+static int get_some_local_dynamic_name_1 (rtx *, void *);
+static rtx maybe_get_pool_constant (rtx);
+static rtx ix86_expand_int_compare (enum rtx_code, rtx, rtx);
+static enum rtx_code ix86_prepare_fp_compare_args (enum rtx_code, rtx *,
+                                                  rtx *);
+static rtx get_thread_pointer (int);
+static rtx legitimize_tls_address (rtx, enum tls_model, int);
+static void get_pc_thunk_name (char [32], unsigned int);
+static rtx gen_push (rtx);
+static int memory_address_length (rtx addr);
+static int ix86_flags_dependant (rtx, rtx, enum attr_type);
+static int ix86_agi_dependant (rtx, rtx, enum attr_type);
+static enum attr_ppro_uops ix86_safe_ppro_uops (rtx);
+static void ix86_dump_ppro_packet (FILE *);
+static void ix86_reorder_insn (rtx *, rtx *);
+static struct machine_function * ix86_init_machine_status (void);
+static int ix86_split_to_parts (rtx, rtx *, enum machine_mode);
+static int ix86_nsaved_regs (void);
+static void ix86_emit_save_regs (void);
+static void ix86_emit_save_regs_using_mov (rtx, HOST_WIDE_INT);
+static void ix86_emit_restore_regs_using_mov (rtx, int, int);
+static void ix86_output_function_epilogue (FILE *, HOST_WIDE_INT);
+static void ix86_set_move_mem_attrs_1 (rtx, rtx, rtx, rtx, rtx);
+static void ix86_sched_reorder_ppro (rtx *, rtx *);
+static HOST_WIDE_INT ix86_GOT_alias_set (void);
+static void ix86_adjust_counter (rtx, HOST_WIDE_INT);
+static rtx ix86_expand_aligntest (rtx, int);
+static void ix86_expand_strlensi_unroll_1 (rtx, rtx);
+static int ix86_issue_rate (void);
+static int ix86_adjust_cost (rtx, rtx, rtx, int);
+static void ix86_sched_init (FILE *, int, int);
+static int ix86_sched_reorder (FILE *, int, rtx *, int *, int);
+static int ix86_variable_issue (FILE *, int, rtx, int);
+static int ia32_use_dfa_pipeline_interface (void);
+static int ia32_multipass_dfa_lookahead (void);
+static void ix86_init_mmx_sse_builtins (void);
+static rtx x86_this_parameter (tree);
+static void x86_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
+                                HOST_WIDE_INT, tree);
+static bool x86_can_output_mi_thunk (tree, HOST_WIDE_INT, HOST_WIDE_INT, tree);
+static void x86_file_start (void);
+static void ix86_reorg (void);
+static bool ix86_expand_carry_flag_compare (enum rtx_code, rtx, rtx, rtx*);
+static tree ix86_build_builtin_va_list (void);
 
 struct ix86_address
 {
@@ -839,52 +840,49 @@ struct ix86_address
   enum ix86_address_seg { SEG_DEFAULT, SEG_FS, SEG_GS } seg;
 };
 
-static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *));
-static int ix86_address_cost PARAMS ((rtx));
-static bool ix86_cannot_force_const_mem PARAMS ((rtx));
-static rtx ix86_delegitimize_address PARAMS ((rtx));
+static int ix86_decompose_address (rtx, struct ix86_address *);
+static int ix86_address_cost (rtx);
+static bool ix86_cannot_force_const_mem (rtx);
+static rtx ix86_delegitimize_address (rtx);
 
 struct builtin_description;
-static rtx ix86_expand_sse_comi PARAMS ((const struct builtin_description *,
-                                        tree, rtx));
-static rtx ix86_expand_sse_compare PARAMS ((const struct builtin_description *,
-                                           tree, rtx));
-static rtx ix86_expand_unop1_builtin PARAMS ((enum insn_code, tree, rtx));
-static rtx ix86_expand_unop_builtin PARAMS ((enum insn_code, tree, rtx, int));
-static rtx ix86_expand_binop_builtin PARAMS ((enum insn_code, tree, rtx));
-static rtx ix86_expand_store_builtin PARAMS ((enum insn_code, tree));
-static rtx safe_vector_operand PARAMS ((rtx, enum machine_mode));
-static enum rtx_code ix86_fp_compare_code_to_integer PARAMS ((enum rtx_code));
-static void ix86_fp_comparison_codes PARAMS ((enum rtx_code code,
-                                             enum rtx_code *,
-                                             enum rtx_code *,
-                                             enum rtx_code *));
-static rtx ix86_expand_fp_compare PARAMS ((enum rtx_code, rtx, rtx, rtx,
-                                         rtx *, rtx *));
-static int ix86_fp_comparison_arithmetics_cost PARAMS ((enum rtx_code code));
-static int ix86_fp_comparison_fcomi_cost PARAMS ((enum rtx_code code));
-static int ix86_fp_comparison_sahf_cost PARAMS ((enum rtx_code code));
-static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code));
-static unsigned int ix86_select_alt_pic_regnum PARAMS ((void));
-static int ix86_save_reg PARAMS ((unsigned int, int));
-static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));
-static int ix86_comp_type_attributes PARAMS ((tree, tree));
-static int ix86_fntype_regparm PARAMS ((tree));
+static rtx ix86_expand_sse_comi (const struct builtin_description *,
+                                tree, rtx);
+static rtx ix86_expand_sse_compare (const struct builtin_description *,
+                                   tree, rtx);
+static rtx ix86_expand_unop1_builtin (enum insn_code, tree, rtx);
+static rtx ix86_expand_unop_builtin (enum insn_code, tree, rtx, int);
+static rtx ix86_expand_binop_builtin (enum insn_code, tree, rtx);
+static rtx ix86_expand_store_builtin (enum insn_code, tree);
+static rtx safe_vector_operand (rtx, enum machine_mode);
+static enum rtx_code ix86_fp_compare_code_to_integer (enum rtx_code);
+static void ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *,
+                                     enum rtx_code *, enum rtx_code *);
+static rtx ix86_expand_fp_compare (enum rtx_code, rtx, rtx, rtx, rtx *, rtx *);
+static int ix86_fp_comparison_arithmetics_cost (enum rtx_code code);
+static int ix86_fp_comparison_fcomi_cost (enum rtx_code code);
+static int ix86_fp_comparison_sahf_cost (enum rtx_code code);
+static int ix86_fp_comparison_cost (enum rtx_code code);
+static unsigned int ix86_select_alt_pic_regnum (void);
+static int ix86_save_reg (unsigned int, int);
+static void ix86_compute_frame_layout (struct ix86_frame *);
+static int ix86_comp_type_attributes (tree, tree);
+static int ix86_function_regparm (tree, tree);
 const struct attribute_spec ix86_attribute_table[];
-static bool ix86_function_ok_for_sibcall PARAMS ((tree, tree));
-static tree ix86_handle_cdecl_attribute PARAMS ((tree *, tree, tree, int, bool *));
-static tree ix86_handle_regparm_attribute PARAMS ((tree *, tree, tree, int, bool *));
-static int ix86_value_regno PARAMS ((enum machine_mode));
-static bool contains_128bit_aligned_vector_p PARAMS ((tree));
-static bool ix86_ms_bitfield_layout_p PARAMS ((tree));
-static tree ix86_handle_struct_attribute PARAMS ((tree *, tree, tree, int, bool *));
-static int extended_reg_mentioned_1 PARAMS ((rtx *, void *));
-static bool ix86_rtx_costs PARAMS ((rtx, int, int, int *));
-static int min_insn_size PARAMS ((rtx));
-static void k8_avoid_jump_misspredicts PARAMS ((void));
+static bool ix86_function_ok_for_sibcall (tree, tree);
+static tree ix86_handle_cdecl_attribute (tree *, tree, tree, int, bool *);
+static tree ix86_handle_regparm_attribute (tree *, tree, tree, int, bool *);
+static int ix86_value_regno (enum machine_mode);
+static bool contains_128bit_aligned_vector_p (tree);
+static bool ix86_ms_bitfield_layout_p (tree);
+static tree ix86_handle_struct_attribute (tree *, tree, tree, int, bool *);
+static int extended_reg_mentioned_1 (rtx *, void *);
+static bool ix86_rtx_costs (rtx, int, int, int *);
+static int min_insn_size (rtx);
+static void k8_avoid_jump_misspredicts (void);
 
 #if defined (DO_GLOBAL_CTORS_BODY) && defined (HAS_INIT_SECTION)
-static void ix86_svr3_asm_out_constructor PARAMS ((rtx, int));
+static void ix86_svr3_asm_out_constructor (rtx, int);
 #endif
 
 /* Register class used for passing given 64bit part of the argument.
@@ -912,20 +910,18 @@ static const char * const x86_64_reg_class_name[] =
    {"no", "integer", "integerSI", "sse", "sseSF", "sseDF", "sseup", "x87", "x87up", "no"};
 
 #define MAX_CLASSES 4
-static int classify_argument PARAMS ((enum machine_mode, tree,
-                                     enum x86_64_reg_class [MAX_CLASSES],
-                                     int));
-static int examine_argument PARAMS ((enum machine_mode, tree, int, int *,
-                                    int *));
-static rtx construct_container PARAMS ((enum machine_mode, tree, int, int, int,
-                                       const int *, int));
-static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class,
-                                                   enum x86_64_reg_class));
+static int classify_argument (enum machine_mode, tree,
+                             enum x86_64_reg_class [MAX_CLASSES], int);
+static int examine_argument (enum machine_mode, tree, int, int *, int *);
+static rtx construct_container (enum machine_mode, tree, int, int, int,
+                               const int *, int);
+static enum x86_64_reg_class merge_classes (enum x86_64_reg_class,
+                                           enum x86_64_reg_class);
 
 /* Table of constants used by fldpi, fldln2, etc...  */
 static REAL_VALUE_TYPE ext_80387_constants_table [5];
 static bool ext_80387_constants_init = 0;
-static void init_ext_80387_constants PARAMS ((void));
+static void init_ext_80387_constants (void);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
@@ -1006,6 +1002,9 @@ static void init_ext_80387_constants PARAMS ((void));
 #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
 #define TARGET_ASM_CAN_OUTPUT_MI_THUNK x86_can_output_mi_thunk
 
+#undef TARGET_ASM_FILE_START
+#define TARGET_ASM_FILE_START x86_file_start
+
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ix86_rtx_costs
 #undef TARGET_ADDRESS_COST
@@ -1014,6 +1013,9 @@ static void init_ext_80387_constants PARAMS ((void));
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG ix86_reorg
 
+#undef TARGET_BUILD_BUILTIN_VA_LIST
+#define TARGET_BUILD_BUILTIN_VA_LIST ix86_build_builtin_va_list
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* The svr4 ABI for the i386 says that records and unions are returned
@@ -1032,7 +1034,7 @@ struct gcc_target targetm = TARGET_INITIALIZER;
    `-O'.  That is what `OPTIMIZATION_OPTIONS' is for.  */
 
 void
-override_options ()
+override_options (void)
 {
   int i;
   /* Comes from final.c -- no real reason to change it.  */
@@ -1113,11 +1115,6 @@ override_options ()
 
   int const pta_size = ARRAY_SIZE (processor_alias_table);
 
-  /* By default our XFmode is the 80-bit extended format.  If we have
-     use TFmode instead, it's also the 80-bit format, but with padding.  */
-  real_format_for_mode[XFmode - QFmode] = &ieee_extended_intel_96_format;
-  real_format_for_mode[TFmode - QFmode] = &ieee_extended_intel_128_format;
-
   /* Set the default values for switches whose default depends on TARGET_64BIT
      in case they weren't overwritten by command line options.  */
   if (TARGET_64BIT)
@@ -1369,6 +1366,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)
@@ -1455,9 +1460,7 @@ override_options ()
 }
 \f
 void
-optimization_options (level, size)
-     int level;
-     int size ATTRIBUTE_UNUSED;
+optimization_options (int level, int size ATTRIBUTE_UNUSED)
 {
   /* For -O2 and beyond, turn off -fschedule-insns by default.  It tends to
      make the problem with not enough registers even worse.  */
@@ -1506,9 +1509,7 @@ const struct attribute_spec ix86_attribute_table[] =
    CALL_EXPR representing the call.  */
 
 static bool
-ix86_function_ok_for_sibcall (decl, exp)
-     tree decl;
-     tree exp;
+ix86_function_ok_for_sibcall (tree decl, tree exp)
 {
   /* If we are generating position-independent code, we cannot sibcall
      optimize any indirect call, or a direct call to a global function,
@@ -1526,23 +1527,18 @@ ix86_function_ok_for_sibcall (decl, exp)
     return false;
 
   /* If this call is indirect, we'll need to be able to use a call-clobbered
-     register for the address of the target function.  Make sure that all 
+     register for the address of the target function.  Make sure that all
      such registers are not used for passing parameters.  */
   if (!decl && !TARGET_64BIT)
     {
-      int regparm = ix86_regparm;
-      tree attr, type;
+      tree type;
 
       /* We're looking at the CALL_EXPR, we need the type of the function.  */
       type = TREE_OPERAND (exp, 0);            /* pointer expression */
       type = TREE_TYPE (type);                 /* pointer type */
       type = TREE_TYPE (type);                 /* function type */
 
-      attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type));
-      if (attr)
-        regparm = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
-
-      if (regparm >= 3)
+      if (ix86_function_regparm (type, NULL) >= 3)
        {
          /* ??? Need to count the actual number of registers to be used,
             not the possible number of registers.  Fix later.  */
@@ -1557,12 +1553,9 @@ ix86_function_ok_for_sibcall (decl, exp)
 /* Handle a "cdecl", "stdcall", or "fastcall" attribute;
    arguments as in struct attribute_spec.handler.  */
 static tree
-ix86_handle_cdecl_attribute (node, name, args, flags, no_add_attrs)
-     tree *node;
-     tree name;
-     tree args ATTRIBUTE_UNUSED;
-     int flags ATTRIBUTE_UNUSED;
-     bool *no_add_attrs;
+ix86_handle_cdecl_attribute (tree *node, tree name,
+                            tree args ATTRIBUTE_UNUSED,
+                            int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE
       && TREE_CODE (*node) != METHOD_TYPE
@@ -1607,12 +1600,8 @@ ix86_handle_cdecl_attribute (node, name, args, flags, no_add_attrs)
 /* Handle a "regparm" attribute;
    arguments as in struct attribute_spec.handler.  */
 static tree
-ix86_handle_regparm_attribute (node, name, args, flags, no_add_attrs)
-     tree *node;
-     tree name;
-     tree args;
-     int flags ATTRIBUTE_UNUSED;
-     bool *no_add_attrs;
+ix86_handle_regparm_attribute (tree *node, tree name, tree args,
+                              int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE
       && TREE_CODE (*node) != METHOD_TYPE
@@ -1642,9 +1631,9 @@ ix86_handle_regparm_attribute (node, name, args, flags, no_add_attrs)
        }
 
       if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (*node)))
-    {
-      error ("fastcall and regparm attributes are not compatible");
-    }
+       {
+         error ("fastcall and regparm attributes are not compatible");
+       }
     }
 
   return NULL_TREE;
@@ -1655,9 +1644,7 @@ ix86_handle_regparm_attribute (node, name, args, flags, no_add_attrs)
    warning to be generated).  */
 
 static int
-ix86_comp_type_attributes (type1, type2)
-     tree type1;
-     tree type2;
+ix86_comp_type_attributes (tree type1, tree type2)
 {
   /* Check for mismatch of non-default calling convention.  */
   const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall";
@@ -1665,10 +1652,10 @@ ix86_comp_type_attributes (type1, type2)
   if (TREE_CODE (type1) != FUNCTION_TYPE)
     return 1;
 
-  /*  Check for mismatched fastcall types */ 
+  /*  Check for mismatched fastcall types */
   if (!lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type1))
       != !lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type2)))
-    return 0; 
+    return 0;
 
   /* Check for mismatched return types (cdecl vs stdcall).  */
   if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1))
@@ -1677,19 +1664,65 @@ ix86_comp_type_attributes (type1, type2)
   return 1;
 }
 \f
-/* Return the regparm value for a fuctio with the indicated TYPE.  */
+/* Return the regparm value for a fuctio with the indicated TYPE and DECL.
+   DECL may be NULL when calling function indirectly
+   or considering a libcall.  */
 
 static int
-ix86_fntype_regparm (type)
-     tree type;
+ix86_function_regparm (tree type, tree decl)
 {
   tree attr;
+  int regparm = ix86_regparm;
+  bool user_convention = false;
 
-  attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type));
-  if (attr)
-    return TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
-  else
-    return ix86_regparm;
+  if (!TARGET_64BIT)
+    {
+      attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (type));
+      if (attr)
+       {
+         regparm = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
+         user_convention = true;
+       }
+
+      if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
+       {
+         regparm = 2;
+         user_convention = true;
+       }
+
+      /* Use register calling convention for local functions when possible.  */
+      if (!TARGET_64BIT && !user_convention && decl
+         && flag_unit_at_a_time && !profile_flag)
+       {
+         struct cgraph_local_info *i = cgraph_local_info (decl);
+         if (i && i->local)
+           {
+             /* We can't use regparm(3) for nested functions as these use
+                static chain pointer in third argument.  */
+             if (DECL_CONTEXT (decl) && !DECL_NO_STATIC_CHAIN (decl))
+               regparm = 2;
+             else
+               regparm = 3;
+           }
+       }
+    }
+  return regparm;
+}
+
+/* Return true if EAX is live at the start of the function.  Used by 
+   ix86_expand_prologue to determine if we need special help before
+   calling allocate_stack_worker.  */
+
+static bool
+ix86_eax_live_at_start_p (void)
+{
+  /* Cheat.  Don't bother working forward from ix86_function_regparm
+     to the function type to whether an actual argument is located in
+     eax.  Instead just look at cfg info, which is still close enough
+     to correct at this point.  This gives false positives for broken
+     functions that might use uninitialized data that happens to be
+     allocated in eax, but who cares?  */
+  return REGNO_REG_SET_P (ENTRY_BLOCK_PTR->global_live_at_end, 0);
 }
 
 /* Value is the number of bytes of arguments automatically
@@ -1710,10 +1743,7 @@ ix86_fntype_regparm (type)
    The attribute stdcall is equivalent to RTD on a per module basis.  */
 
 int
-ix86_return_pops_args (fundecl, funtype, size)
-     tree fundecl;
-     tree funtype;
-     int size;
+ix86_return_pops_args (tree fundecl, tree funtype, int size)
 {
   int rtd = TARGET_RTD && (!fundecl || TREE_CODE (fundecl) != IDENTIFIER_NODE);
 
@@ -1733,10 +1763,10 @@ ix86_return_pops_args (fundecl, funtype, size)
   }
 
   /* Lose any fake structure return argument if it is passed on the stack.  */
-  if (aggregate_value_p (TREE_TYPE (funtype))
+  if (aggregate_value_p (TREE_TYPE (funtype), fundecl)
       && !TARGET_64BIT)
     {
-      int nregs = ix86_fntype_regparm (funtype);
+      int nregs = ix86_function_regparm (funtype, fundecl);
 
       if (!nregs)
        return GET_MODE_SIZE (Pmode);
@@ -1749,8 +1779,7 @@ ix86_return_pops_args (fundecl, funtype, size)
 
 /* Return true when register may be used to pass function parameters.  */
 bool
-ix86_function_arg_regno_p (regno)
-     int regno;
+ix86_function_arg_regno_p (int regno)
 {
   int i;
   if (!TARGET_64BIT)
@@ -1772,15 +1801,13 @@ ix86_function_arg_regno_p (regno)
    For a library call, FNTYPE is 0.  */
 
 void
-init_cumulative_args (cum, fntype, libname, fndecl)
-     CUMULATIVE_ARGS *cum;     /* Argument info to initialize */
-     tree fntype;              /* tree ptr for function decl */
-     rtx libname;              /* SYMBOL_REF of library name or 0 */
-     tree fndecl;
+init_cumulative_args (CUMULATIVE_ARGS *cum,  /* Argument info to initialize */
+                     tree fntype,      /* tree ptr for function decl */
+                     rtx libname,      /* SYMBOL_REF of library name or 0 */
+                     tree fndecl)
 {
   static CUMULATIVE_ARGS zero_cum;
   tree param, next_param;
-  bool user_convention = false;
 
   if (TARGET_DEBUG_ARG)
     {
@@ -1799,18 +1826,11 @@ init_cumulative_args (cum, fntype, libname, fndecl)
   *cum = zero_cum;
 
   /* Set up the number of registers to use for passing arguments.  */
-  cum->nregs = ix86_regparm;
+  if (fntype)
+    cum->nregs = ix86_function_regparm (fntype, fndecl);
+  else
+    cum->nregs = ix86_regparm;
   cum->sse_nregs = SSE_REGPARM_MAX;
-  if (fntype && !TARGET_64BIT)
-    {
-      tree attr = lookup_attribute ("regparm", TYPE_ATTRIBUTES (fntype));
-
-      if (attr)
-       {
-         cum->nregs = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (attr)));
-         user_convention = true;
-       }
-    }
   cum->maybe_vaarg = false;
 
   /* Use ecx and edx registers if function has fastcall attribute */
@@ -1820,23 +1840,6 @@ init_cumulative_args (cum, fntype, libname, fndecl)
        {
          cum->nregs = 2;
          cum->fastcall = 1;
-         user_convention = true;
-       }
-    }
-
-  /* Use register calling convention for local functions when possible.  */
-  if (!TARGET_64BIT && !user_convention && fndecl
-      && flag_unit_at_a_time)
-    {
-      struct cgraph_local_info *i = cgraph_local_info (fndecl);
-      if (i && i->local)
-       {
-         /* We can't use regparm(3) for nested functions as these use
-            static chain pointer in third argument.  */
-         if (DECL_CONTEXT (fndecl) && !DECL_NO_STATIC_CHAIN (fndecl))
-           cum->nregs = 2;
-         else
-           cum->nregs = 3;
        }
     }
 
@@ -1881,8 +1884,7 @@ init_cumulative_args (cum, fntype, libname, fndecl)
    See the x86-64 PS ABI for details.  */
 
 static enum x86_64_reg_class
-merge_classes (class1, class2)
-     enum x86_64_reg_class class1, class2;
+merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
 {
   /* Rule #1: If both classes are equal, this is the resulting class.  */
   if (class1 == class2)
@@ -1929,13 +1931,10 @@ merge_classes (class1, class2)
 */
 
 static int
-classify_argument (mode, type, classes, bit_offset)
-     enum machine_mode mode;
-     tree type;
-     enum x86_64_reg_class classes[MAX_CLASSES];
-     int bit_offset;
+classify_argument (enum machine_mode mode, tree type,
+                  enum x86_64_reg_class classes[MAX_CLASSES], int bit_offset)
 {
-  int bytes =
+  HOST_WIDE_INT bytes =
     (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
   int words = (bytes + (bit_offset % 64) / 8 + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
 
@@ -2013,7 +2012,7 @@ classify_argument (mode, type, classes, bit_offset)
                      for (i = int_bit_position (field) / 8 / 8;
                           i < (int_bit_position (field)
                                + tree_low_cst (DECL_SIZE (field), 0)
-                               + 63) / 8 / 8; i++)
+                               + 63) / 8 / 8; i++)
                        classes[i] =
                          merge_classes (X86_64_INTEGER_CLASS,
                                         classes[i]);
@@ -2101,6 +2100,31 @@ classify_argument (mode, type, classes, bit_offset)
                }
            }
        }
+      else if (TREE_CODE (type) == SET_TYPE)
+       {
+         if (bytes <= 4)
+           {
+             classes[0] = X86_64_INTEGERSI_CLASS;
+             return 1;
+           }
+         else if (bytes <= 8)
+           {
+             classes[0] = X86_64_INTEGER_CLASS;
+             return 1;
+           }
+         else if (bytes <= 12)
+           {
+             classes[0] = X86_64_INTEGER_CLASS;
+             classes[1] = X86_64_INTEGERSI_CLASS;
+             return 2;
+           }
+         else
+           {
+             classes[0] = X86_64_INTEGER_CLASS;
+             classes[1] = X86_64_INTEGER_CLASS;
+             return 2;
+           }
+       }
       else
        abort ();
 
@@ -2173,11 +2197,14 @@ classify_argument (mode, type, classes, bit_offset)
     case DFmode:
       classes[0] = X86_64_SSEDF_CLASS;
       return 1;
-    case TFmode:
+    case XFmode:
       classes[0] = X86_64_X87_CLASS;
       classes[1] = X86_64_X87UP_CLASS;
       return 2;
+    case TFmode:
     case TCmode:
+      return 0;
+    case XCmode:
       classes[0] = X86_64_X87_CLASS;
       classes[1] = X86_64_X87UP_CLASS;
       classes[2] = X86_64_X87_CLASS;
@@ -2215,11 +2242,8 @@ classify_argument (mode, type, classes, bit_offset)
 /* Examine the argument and return set number of register required in each
    class.  Return 0 iff parameter should be passed in memory.  */
 static int
-examine_argument (mode, type, in_return, int_nregs, sse_nregs)
-     enum machine_mode mode;
-     tree type;
-     int *int_nregs, *sse_nregs;
-     int in_return;
+examine_argument (enum machine_mode mode, tree type, int in_return,
+                 int *int_nregs, int *sse_nregs)
 {
   enum x86_64_reg_class class[MAX_CLASSES];
   int n = classify_argument (mode, type, class, 0);
@@ -2256,13 +2280,9 @@ examine_argument (mode, type, in_return, int_nregs, sse_nregs)
 /* Construct container for the argument used by GCC interface.  See
    FUNCTION_ARG for the detailed description.  */
 static rtx
-construct_container (mode, type, in_return, nintregs, nsseregs, intreg, sse_regno)
-     enum machine_mode mode;
-     tree type;
-     int in_return;
-     int nintregs, nsseregs;
-     const int * intreg;
-     int sse_regno;
+construct_container (enum machine_mode mode, tree type, int in_return,
+                    int nintregs, int nsseregs, const int * intreg,
+                    int sse_regno)
 {
   enum machine_mode tmpmode;
   int bytes =
@@ -2321,16 +2341,16 @@ construct_container (mode, type, in_return, nintregs, nsseregs, intreg, sse_regn
     return gen_rtx_REG (mode, SSE_REGNO (sse_regno));
   if (n == 2
       && class[0] == X86_64_X87_CLASS && class[1] == X86_64_X87UP_CLASS)
-    return gen_rtx_REG (TFmode, FIRST_STACK_REG);
+    return gen_rtx_REG (XFmode, FIRST_STACK_REG);
   if (n == 2 && class[0] == X86_64_INTEGER_CLASS
       && class[1] == X86_64_INTEGER_CLASS
-      && (mode == CDImode || mode == TImode)
+      && (mode == CDImode || mode == TImode || mode == TFmode)
       && intreg[0] + 1 == intreg[1])
     return gen_rtx_REG (mode, intreg[0]);
   if (n == 4
       && class[0] == X86_64_X87_CLASS && class[1] == X86_64_X87UP_CLASS
       && class[2] == X86_64_X87_CLASS && class[3] == X86_64_X87UP_CLASS)
-    return gen_rtx_REG (TCmode, FIRST_STACK_REG);
+    return gen_rtx_REG (XCmode, FIRST_STACK_REG);
 
   /* Otherwise figure out the entries of the PARALLEL.  */
   for (i = 0; i < n; i++)
@@ -2398,11 +2418,10 @@ construct_container (mode, type, in_return, nintregs, nsseregs, intreg, sse_regn
    (TYPE is null for libcalls where that information may not be available.)  */
 
 void
-function_arg_advance (cum, mode, type, named)
-     CUMULATIVE_ARGS *cum;     /* current arg information */
-     enum machine_mode mode;   /* current arg mode */
-     tree type;                        /* type of the argument or 0 if lib support */
-     int named;                        /* whether or not the argument was named */
+function_arg_advance (CUMULATIVE_ARGS *cum,    /* current arg information */
+                     enum machine_mode mode,   /* current arg mode */
+                     tree type,        /* type of the argument or 0 if lib support */
+                     int named)        /* whether or not the argument was named */
 {
   int bytes =
     (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode);
@@ -2470,11 +2489,10 @@ function_arg_advance (cum, mode, type, named)
     (otherwise it is an extra parameter matching an ellipsis).  */
 
 rtx
-function_arg (cum, mode, type, named)
-     CUMULATIVE_ARGS *cum;     /* current arg information */
-     enum machine_mode mode;   /* current arg mode */
-     tree type;                        /* type of the argument or 0 if lib support */
-     int named;                        /* != 0 for normal args, == 0 for ... args */
+function_arg (CUMULATIVE_ARGS *cum,    /* current arg information */
+             enum machine_mode mode,   /* current arg mode */
+             tree type,        /* type of the argument or 0 if lib support */
+             int named)        /* != 0 for normal args, == 0 for ...  args */
 {
   rtx ret   = NULL_RTX;
   int bytes =
@@ -2515,22 +2533,22 @@ function_arg (cum, mode, type, named)
       case HImode:
       case QImode:
        if (words <= cum->nregs)
-         {
-           int regno = cum->regno;
-
-           /* Fastcall allocates the first two DWORD (SImode) or
-              smaller arguments to ECX and EDX.  */
-           if (cum->fastcall)
-             {
-               if (mode == BLKmode || mode == DImode)
-                 break;
-               /* ECX not EAX is the first allocated register.  */
-               if (regno == 0)
-                     regno = 2;
-             }
-           ret = gen_rtx_REG (mode, regno);
-         }
+         {
+           int regno = cum->regno;
+
+           /* Fastcall allocates the first two DWORD (SImode) or
+              smaller arguments to ECX and EDX.  */
+           if (cum->fastcall)
+             {
+               if (mode == BLKmode || mode == DImode)
+                 break;
+
+               /* ECX not EAX is the first allocated register.  */
+               if (regno == 0)
+                 regno = 2;
+             }
+           ret = gen_rtx_REG (mode, regno);
+         }
        break;
       case TImode:
        if (cum->sse_nregs)
@@ -2562,11 +2580,9 @@ function_arg (cum, mode, type, named)
    appropriate for passing a pointer to that type.  */
 
 int
-function_arg_pass_by_reference (cum, mode, type, named)
-     CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
-     tree type;
-     int named ATTRIBUTE_UNUSED;
+function_arg_pass_by_reference (CUMULATIVE_ARGS *cum ATTRIBUTE_UNUSED,
+                               enum machine_mode mode ATTRIBUTE_UNUSED,
+                               tree type, int named ATTRIBUTE_UNUSED)
 {
   if (!TARGET_64BIT)
     return 0;
@@ -2584,8 +2600,7 @@ function_arg_pass_by_reference (cum, mode, type, named)
 /* Return true when TYPE should be 128bit aligned for 32bit argument passing
    ABI  */
 static bool
-contains_128bit_aligned_vector_p (type)
-     tree type;
+contains_128bit_aligned_vector_p (tree type)
 {
   enum machine_mode mode = TYPE_MODE (type);
   if (SSE_REG_MODE_P (mode)
@@ -2596,7 +2611,7 @@ contains_128bit_aligned_vector_p (type)
 
   if (AGGREGATE_TYPE_P (type))
     {
-      /* Walk the agregates recursivly.  */
+      /* Walk the aggregates recursively.  */
       if (TREE_CODE (type) == RECORD_TYPE
          || TREE_CODE (type) == UNION_TYPE
          || TREE_CODE (type) == QUAL_UNION_TYPE)
@@ -2639,13 +2654,11 @@ contains_128bit_aligned_vector_p (type)
   return false;
 }
 
-/* Gives the alignment boundary, in bits, of an argument with the specified mode
-   and type.   */
+/* Gives the alignment boundary, in bits, of an argument with the
+   specified mode and type.  */
 
 int
-ix86_function_arg_boundary (mode, type)
-     enum machine_mode mode;
-     tree type;
+ix86_function_arg_boundary (enum machine_mode mode, tree type)
 {
   int align;
   if (type)
@@ -2658,7 +2671,7 @@ ix86_function_arg_boundary (mode, type)
     {
       /* i386 ABI defines all arguments to be 4 byte aligned.  We have to
         make an exception for SSE modes since these require 128bit
-        alignment.  
+        alignment.
 
         The handling here differs from field_alignment.  ICC aligns MMX
         arguments to 4 byte boundaries, while structure fields are aligned
@@ -2673,8 +2686,6 @@ ix86_function_arg_boundary (mode, type)
          if (!contains_128bit_aligned_vector_p (type))
            align = PARM_BOUNDARY;
        }
-      if (align != PARM_BOUNDARY && !TARGET_SSE)
-       abort();
     }
   if (align > 128)
     align = 128;
@@ -2683,8 +2694,7 @@ ix86_function_arg_boundary (mode, type)
 
 /* Return true if N is a possible register number of function value.  */
 bool
-ix86_function_value_regno_p (regno)
-     int regno;
+ix86_function_value_regno_p (int regno)
 {
   if (!TARGET_64BIT)
     {
@@ -2702,8 +2712,7 @@ ix86_function_value_regno_p (regno)
    If the precise function being called is known, FUNC is its FUNCTION_DECL;
    otherwise, FUNC is 0.  */
 rtx
-ix86_function_value (valtype)
-     tree valtype;
+ix86_function_value (tree valtype)
 {
   if (TARGET_64BIT)
     {
@@ -2723,77 +2732,112 @@ ix86_function_value (valtype)
 
 /* Return false iff type is returned in memory.  */
 int
-ix86_return_in_memory (type)
-     tree type;
+ix86_return_in_memory (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 (MS_AGGREGATE_RETURN && AGGREGATE_TYPE_P (type) && size <= 8)
+    return 0;
+
+  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)
-       return 1;
-      else if (MS_AGGREGATE_RETURN
-              && AGGREGATE_TYPE_P (type)
-              && int_size_in_bytes(type) <= 8)
+      /* User-created vectors small enough to fit in EAX.  */
+      if (size < 8)
        return 0;
-      else if ((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))))
+
+      /* 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 == XFmode)
+    return 0;
+
+  if (size > 12)
+    return 1;
+  return 0;
 }
 
 /* Define how to find the value returned by a library function
    assuming the value has mode MODE.  */
 rtx
-ix86_libcall_value (mode)
-   enum machine_mode mode;
+ix86_libcall_value (enum machine_mode mode)
 {
   if (TARGET_64BIT)
     {
       switch (mode)
        {
-         case SFmode:
-         case SCmode:
-         case DFmode:
-         case DCmode:
-           return gen_rtx_REG (mode, FIRST_SSE_REG);
-         case TFmode:
-         case TCmode:
-           return gen_rtx_REG (mode, FIRST_FLOAT_REG);
-         default:
-           return gen_rtx_REG (mode, 0);
+       case SFmode:
+       case SCmode:
+       case DFmode:
+       case DCmode:
+         return gen_rtx_REG (mode, FIRST_SSE_REG);
+       case XFmode:
+       case XCmode:
+         return gen_rtx_REG (mode, FIRST_FLOAT_REG);
+       case TFmode:
+       case TCmode:
+         return NULL;
+       default:
+         return gen_rtx_REG (mode, 0);
        }
     }
   else
-   return gen_rtx_REG (mode, ix86_value_regno (mode));
+    return gen_rtx_REG (mode, ix86_value_regno (mode));
 }
 
 /* Given a mode, return the register to use for a return value.  */
 
 static int
-ix86_value_regno (mode)
-     enum machine_mode mode;
+ix86_value_regno (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;
 }
 \f
 /* Create the va_list data type.  */
 
-tree
-ix86_build_va_list ()
+static tree
+ix86_build_builtin_va_list (void)
 {
   tree f_gpr, f_fpr, f_ovf, f_sav, record, type_decl;
 
@@ -2846,13 +2890,9 @@ ix86_build_va_list ()
    stack and set PRETEND_SIZE to the length of the registers pushed.  */
 
 void
-ix86_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
-     CUMULATIVE_ARGS *cum;
-     enum machine_mode mode;
-     tree type;
-     int *pretend_size ATTRIBUTE_UNUSED;
-     int no_rtl;
-
+ix86_setup_incoming_varargs (CUMULATIVE_ARGS *cum, enum machine_mode mode,
+                            tree type, int *pretend_size ATTRIBUTE_UNUSED,
+                            int no_rtl)
 {
   CUMULATIVE_ARGS next_cum;
   rtx save_area = NULL_RTX, mem;
@@ -2948,9 +2988,7 @@ ix86_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
 /* Implement va_start.  */
 
 void
-ix86_va_start (valist, nextarg)
-     tree valist;
-     rtx nextarg;
+ix86_va_start (tree valist, rtx nextarg)
 {
   HOST_WIDE_INT words, n_gpr, n_fpr;
   tree f_gpr, f_fpr, f_ovf, f_sav;
@@ -3012,8 +3050,7 @@ ix86_va_start (valist, nextarg)
 
 /* Implement va_arg.  */
 rtx
-ix86_va_arg (valist, type)
-     tree valist, type;
+ix86_va_arg (tree valist, tree type)
 {
   static const int intreg[6] = { 0, 1, 2, 3, 4, 5 };
   tree f_gpr, f_fpr, f_ovf, f_sav;
@@ -3153,10 +3190,12 @@ ix86_va_arg (valist, type)
        {
          int i;
          rtx mem;
+         rtx x;
 
          /* Never use the memory itself, as it has the alias set.  */
-         addr_rtx = XEXP (assign_temp (type, 0, 1, 0), 0);
-         mem = gen_rtx_MEM (BLKmode, addr_rtx);
+         x = XEXP (assign_temp (type, 0, 1, 0), 0);
+         mem = gen_rtx_MEM (BLKmode, x);
+         force_operand (x, addr_rtx);
          set_mem_alias_set (mem, get_varargs_alias_set ());
          set_mem_align (mem, BITS_PER_UNIT);
 
@@ -3251,27 +3290,21 @@ ix86_va_arg (valist, type)
 \f
 /* Return nonzero if OP is either a i387 or SSE fp register.  */
 int
-any_fp_register_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+any_fp_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return ANY_FP_REG_P (op);
 }
 
 /* Return nonzero if OP is an i387 fp register.  */
 int
-fp_register_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+fp_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return FP_REG_P (op);
 }
 
 /* Return nonzero if OP is a non-fp register_operand.  */
 int
-register_and_not_any_fp_reg_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+register_and_not_any_fp_reg_operand (rtx op, enum machine_mode mode)
 {
   return register_operand (op, mode) && !ANY_FP_REG_P (op);
 }
@@ -3279,9 +3312,7 @@ register_and_not_any_fp_reg_operand (op, mode)
 /* Return nonzero if OP is a register operand other than an
    i387 fp register.  */
 int
-register_and_not_fp_reg_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+register_and_not_fp_reg_operand (rtx op, enum machine_mode mode)
 {
   return register_operand (op, mode) && !FP_REG_P (op);
 }
@@ -3289,9 +3320,7 @@ register_and_not_fp_reg_operand (op, mode)
 /* Return nonzero if OP is general operand representable on x86_64.  */
 
 int
-x86_64_general_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_general_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT)
     return general_operand (op, mode);
@@ -3304,9 +3333,7 @@ x86_64_general_operand (op, mode)
    as either sign extended or zero extended constant.  */
 
 int
-x86_64_szext_general_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_szext_general_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT)
     return general_operand (op, mode);
@@ -3318,9 +3345,7 @@ x86_64_szext_general_operand (op, mode)
 /* Return nonzero if OP is nonmemory operand representable on x86_64.  */
 
 int
-x86_64_nonmemory_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_nonmemory_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT)
     return nonmemory_operand (op, mode);
@@ -3332,9 +3357,7 @@ x86_64_nonmemory_operand (op, mode)
 /* Return nonzero if OP is nonmemory operand acceptable by movabs patterns.  */
 
 int
-x86_64_movabs_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_movabs_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT || !flag_pic)
     return nonmemory_operand (op, mode);
@@ -3345,12 +3368,31 @@ x86_64_movabs_operand (op, mode)
   return 0;
 }
 
+/* Return nonzero if OPNUM's MEM should be matched
+   in movabs* patterns.  */
+
+int
+ix86_check_movabs (rtx insn, int opnum)
+{
+  rtx set, mem;
+
+  set = PATTERN (insn);
+  if (GET_CODE (set) == PARALLEL)
+    set = XVECEXP (set, 0, 0);
+  if (GET_CODE (set) != SET)
+    abort ();
+  mem = XEXP (set, opnum);
+  while (GET_CODE (mem) == SUBREG)
+    mem = SUBREG_REG (mem);
+  if (GET_CODE (mem) != MEM)
+    abort ();
+  return (volatile_ok || !MEM_VOLATILE_P (mem));
+}
+
 /* Return nonzero if OP is nonmemory operand representable on x86_64.  */
 
 int
-x86_64_szext_nonmemory_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_szext_nonmemory_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT)
     return nonmemory_operand (op, mode);
@@ -3362,9 +3404,7 @@ x86_64_szext_nonmemory_operand (op, mode)
 /* Return nonzero if OP is immediate operand representable on x86_64.  */
 
 int
-x86_64_immediate_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+x86_64_immediate_operand (rtx op, enum machine_mode mode)
 {
   if (!TARGET_64BIT)
     return immediate_operand (op, mode);
@@ -3374,9 +3414,7 @@ x86_64_immediate_operand (op, mode)
 /* Return nonzero if OP is immediate operand representable on x86_64.  */
 
 int
-x86_64_zext_immediate_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+x86_64_zext_immediate_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return x86_64_zero_extended_value (op);
 }
@@ -3384,11 +3422,9 @@ x86_64_zext_immediate_operand (op, mode)
 /* Return nonzero if OP is (const_int 1), else return zero.  */
 
 int
-const_int_1_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+const_int_1_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
-  return (GET_CODE (op) == CONST_INT && INTVAL (op) == 1);
+  return op == const1_rtx;
 }
 
 /* Return nonzero if OP is CONST_INT >= 1 and <= 31 (a valid operand
@@ -3396,9 +3432,7 @@ const_int_1_operand (op, mode)
    else return zero.  */
 
 int
-const_int_1_31_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+const_int_1_31_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 1 && INTVAL (op) <= 31);
 }
@@ -3407,9 +3441,7 @@ const_int_1_31_operand (op, mode)
    reference and a constant.  */
 
 int
-symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   switch (GET_CODE (op))
     {
@@ -3453,16 +3485,19 @@ symbolic_operand (op, mode)
 /* Return true if the operand contains a @GOT or @GOTOFF reference.  */
 
 int
-pic_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+pic_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (op) != CONST)
     return 0;
   op = XEXP (op, 0);
   if (TARGET_64BIT)
     {
-      if (GET_CODE (XEXP (op, 0)) == UNSPEC)
+      if (GET_CODE (op) == UNSPEC
+         && XINT (op, 1) == UNSPEC_GOTPCREL)
+       return 1;
+      if (GET_CODE (op) == PLUS
+         && GET_CODE (XEXP (op, 0)) == UNSPEC
+         && XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL)
        return 1;
     }
   else
@@ -3482,9 +3517,7 @@ pic_symbolic_operand (op, mode)
 /* Return true if OP is a symbolic operand that resolves locally.  */
 
 static int
-local_symbolic_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+local_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (op) == CONST
       && GET_CODE (XEXP (op, 0)) == PLUS
@@ -3515,9 +3548,7 @@ local_symbolic_operand (op, mode)
 /* Test for various thread-local symbols.  */
 
 int
-tls_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+tls_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (op) != SYMBOL_REF)
     return 0;
@@ -3525,9 +3556,7 @@ tls_symbolic_operand (op, mode)
 }
 
 static inline int
-tls_symbolic_operand_1 (op, kind)
-     rtx op;
-     enum tls_model kind;
+tls_symbolic_operand_1 (rtx op, enum tls_model kind)
 {
   if (GET_CODE (op) != SYMBOL_REF)
     return 0;
@@ -3535,33 +3564,27 @@ tls_symbolic_operand_1 (op, kind)
 }
 
 int
-global_dynamic_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+global_dynamic_symbolic_operand (rtx op,
+                                enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return tls_symbolic_operand_1 (op, TLS_MODEL_GLOBAL_DYNAMIC);
 }
 
 int
-local_dynamic_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+local_dynamic_symbolic_operand (rtx op,
+                               enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return tls_symbolic_operand_1 (op, TLS_MODEL_LOCAL_DYNAMIC);
 }
 
 int
-initial_exec_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+initial_exec_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return tls_symbolic_operand_1 (op, TLS_MODEL_INITIAL_EXEC);
 }
 
 int
-local_exec_symbolic_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+local_exec_symbolic_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return tls_symbolic_operand_1 (op, TLS_MODEL_LOCAL_EXEC);
 }
@@ -3571,9 +3594,7 @@ local_exec_symbolic_operand (op, mode)
    reg + const, which the patterns can't handle.  */
 
 int
-call_insn_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+call_insn_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   /* Disallow indirect through a virtual register.  This leads to
      compiler aborts when trying to eliminate them.  */
@@ -3602,9 +3623,7 @@ call_insn_operand (op, mode)
    reg + const, which the patterns can't handle.  */
 
 int
-sibcall_insn_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+sibcall_insn_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   /* Disallow indirect through a virtual register.  This leads to
      compiler aborts when trying to eliminate them.  */
@@ -3624,9 +3643,7 @@ sibcall_insn_operand (op, mode)
 }
 
 int
-constant_call_address_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+constant_call_address_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (op) == CONST
       && GET_CODE (XEXP (op, 0)) == PLUS
@@ -3638,17 +3655,13 @@ constant_call_address_operand (op, mode)
 /* Match exactly zero and one.  */
 
 int
-const0_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+const0_operand (rtx op, enum machine_mode mode)
 {
   return op == CONST0_RTX (mode);
 }
 
 int
-const1_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+const1_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return op == const1_rtx;
 }
@@ -3656,20 +3669,41 @@ const1_operand (op, mode)
 /* Match 2, 4, or 8.  Used for leal multiplicands.  */
 
 int
-const248_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+const248_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return (GET_CODE (op) == CONST_INT
          && (INTVAL (op) == 2 || INTVAL (op) == 4 || INTVAL (op) == 8));
 }
 
+int
+const_0_to_3_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) < 4);
+}
+
+int
+const_0_to_7_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) < 8);
+}
+
+int
+const_0_to_15_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) < 16);
+}
+
+int
+const_0_to_255_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return (GET_CODE (op) == CONST_INT && INTVAL (op) >= 0 && INTVAL (op) < 256);
+}
+
+
 /* True if this is a constant appropriate for an increment or decrement.  */
 
 int
-incdec_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+incdec_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   /* On Pentium4, the inc and dec operations causes extra dependency on flag
      registers, since carry flag is not set.  */
@@ -3682,9 +3716,7 @@ incdec_operand (op, mode)
    expander.  */
 
 int
-shiftdi_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+shiftdi_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   if (TARGET_64BIT)
     return nonimmediate_operand (op, mode);
@@ -3700,9 +3732,7 @@ shiftdi_operand (op, mode)
    Which would only happen in pathological cases.  */
 
 int
-reg_no_sp_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+reg_no_sp_operand (rtx op, enum machine_mode mode)
 {
   rtx t = op;
   if (GET_CODE (t) == SUBREG)
@@ -3714,9 +3744,7 @@ reg_no_sp_operand (op, mode)
 }
 
 int
-mmx_reg_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+mmx_reg_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return MMX_REG_P (op);
 }
@@ -3725,9 +3753,7 @@ mmx_reg_operand (op, mode)
    general_operand.  */
 
 int
-general_no_elim_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+general_no_elim_operand (rtx op, enum machine_mode mode)
 {
   rtx t = op;
   if (GET_CODE (t) == SUBREG)
@@ -3748,9 +3774,7 @@ general_no_elim_operand (op, mode)
    register_operand or const_int.  */
 
 int
-nonmemory_no_elim_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+nonmemory_no_elim_operand (rtx op, enum machine_mode mode)
 {
   rtx t = op;
   if (GET_CODE (t) == SUBREG)
@@ -3767,9 +3791,7 @@ nonmemory_no_elim_operand (op, mode)
    otherwise work like register_operand.  */
 
 int
-index_register_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+index_register_operand (rtx op, enum machine_mode mode)
 {
   rtx t = op;
   if (GET_CODE (t) == SUBREG)
@@ -3790,9 +3812,7 @@ index_register_operand (op, mode)
 /* Return true if op is a Q_REGS class register.  */
 
 int
-q_regs_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+q_regs_operand (rtx op, enum machine_mode mode)
 {
   if (mode != VOIDmode && GET_MODE (op) != mode)
     return 0;
@@ -3804,9 +3824,7 @@ q_regs_operand (op, mode)
 /* Return true if op is an flags register.  */
 
 int
-flags_reg_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+flags_reg_operand (rtx op, enum machine_mode mode)
 {
   if (mode != VOIDmode && GET_MODE (op) != mode)
     return 0;
@@ -3816,9 +3834,7 @@ flags_reg_operand (op, mode)
 /* Return true if op is a NON_Q_REGS class register.  */
 
 int
-non_q_regs_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+non_q_regs_operand (rtx op, enum machine_mode mode)
 {
   if (mode != VOIDmode && GET_MODE (op) != mode)
     return 0;
@@ -3828,9 +3844,8 @@ non_q_regs_operand (op, mode)
 }
 
 int
-zero_extended_scalar_load_operand (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+zero_extended_scalar_load_operand (rtx op,
+                                  enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   unsigned n_elts;
   if (GET_CODE (op) != MEM)
@@ -3854,9 +3869,7 @@ zero_extended_scalar_load_operand (op, mode)
 
 /*  Return 1 when OP is operand acceptable for standard SSE move.  */
 int
-vector_move_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+vector_move_operand (rtx op, enum machine_mode mode)
 {
   if (nonimmediate_operand (op, mode))
     return 1;
@@ -3869,9 +3882,7 @@ vector_move_operand (op, mode)
    a segment override.  */
 
 int
-no_seg_address_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+no_seg_address_operand (rtx op, enum machine_mode mode)
 {
   struct ix86_address parts;
 
@@ -3887,9 +3898,7 @@ no_seg_address_operand (op, mode)
 /* Return 1 if OP is a comparison that can be used in the CMPSS/CMPPS
    insns.  */
 int
-sse_comparison_operator (op, mode)
-     rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+sse_comparison_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   enum rtx_code code = GET_CODE (op);
   switch (code)
@@ -3918,9 +3927,7 @@ sse_comparison_operator (op, mode)
 }
 /* Return 1 if OP is a valid comparison operator in valid mode.  */
 int
-ix86_comparison_operator (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+ix86_comparison_operator (rtx op, enum machine_mode mode)
 {
   enum machine_mode inmode;
   enum rtx_code code = GET_CODE (op);
@@ -3961,9 +3968,7 @@ ix86_comparison_operator (op, mode)
 /* Return 1 if OP is a valid comparison operator testing carry flag
    to be set.  */
 int
-ix86_carry_flag_operator (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+ix86_carry_flag_operator (rtx op, enum machine_mode mode)
 {
   enum machine_mode inmode;
   enum rtx_code code = GET_CODE (op);
@@ -3995,9 +4000,7 @@ ix86_carry_flag_operator (op, mode)
 /* Return 1 if OP is a comparison operator that can be issued by fcmov.  */
 
 int
-fcmov_comparison_operator (op, mode)
-    register rtx op;
-    enum machine_mode mode;
+fcmov_comparison_operator (rtx op, enum machine_mode mode)
 {
   enum machine_mode inmode;
   enum rtx_code code = GET_CODE (op);
@@ -4034,9 +4037,7 @@ fcmov_comparison_operator (op, mode)
 /* Return 1 if OP is a binary operator that can be promoted to wider mode.  */
 
 int
-promotable_binary_operator (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+promotable_binary_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   switch (GET_CODE (op))
     {
@@ -4060,9 +4061,7 @@ promotable_binary_operator (op, mode)
    into registers.  */
 
 int
-cmp_fp_expander_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+cmp_fp_expander_operand (rtx op, enum machine_mode mode)
 {
   if (mode != VOIDmode && mode != GET_MODE (op))
     return 0;
@@ -4074,9 +4073,7 @@ cmp_fp_expander_operand (op, mode)
 /* Match an SI or HImode register for a zero_extract.  */
 
 int
-ext_register_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
+ext_register_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   int regno;
   if ((!TARGET_64BIT || GET_MODE (op) != DImode)
@@ -4095,9 +4092,7 @@ ext_register_operand (op, mode)
    OP is the expression matched, and MODE is its mode.  */
 
 int
-binary_fp_operator (op, mode)
-    register rtx op;
-    enum machine_mode mode;
+binary_fp_operator (rtx op, enum machine_mode mode)
 {
   if (mode != VOIDmode && mode != GET_MODE (op))
     return 0;
@@ -4116,25 +4111,19 @@ binary_fp_operator (op, mode)
 }
 
 int
-mult_operator (op, mode)
-    register rtx op;
-    enum machine_mode mode ATTRIBUTE_UNUSED;
+mult_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return GET_CODE (op) == MULT;
 }
 
 int
-div_operator (op, mode)
-    register rtx op;
-    enum machine_mode mode ATTRIBUTE_UNUSED;
+div_operator (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
 {
   return GET_CODE (op) == DIV;
 }
 
 int
-arith_or_logical_operator (op, mode)
-      rtx op;
-      enum machine_mode mode;
+arith_or_logical_operator (rtx op, enum machine_mode mode)
 {
   return ((mode == VOIDmode || GET_MODE (op) == mode)
           && (GET_RTX_CLASS (GET_CODE (op)) == 'c'
@@ -4144,9 +4133,7 @@ arith_or_logical_operator (op, mode)
 /* Returns 1 if OP is memory operand with a displacement.  */
 
 int
-memory_displacement_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+memory_displacement_operand (rtx op, enum machine_mode mode)
 {
   struct ix86_address parts;
 
@@ -4166,9 +4153,7 @@ memory_displacement_operand (op, mode)
    expander, and no actual insns use this.  */
 
 int
-cmpsi_operand (op, mode)
-      rtx op;
-      enum machine_mode mode;
+cmpsi_operand (rtx op, enum machine_mode mode)
 {
   if (nonimmediate_operand (op, mode))
     return 1;
@@ -4190,9 +4175,7 @@ cmpsi_operand (op, mode)
    modRM array.  */
 
 int
-long_memory_operand (op, mode)
-     register rtx op;
-     enum machine_mode mode;
+long_memory_operand (rtx op, enum machine_mode mode)
 {
   if (! memory_operand (op, mode))
     return 0;
@@ -4203,9 +4186,7 @@ long_memory_operand (op, mode)
 /* Return nonzero if the rtx is known aligned.  */
 
 int
-aligned_operand (op, mode)
-     rtx op;
-     enum machine_mode mode;
+aligned_operand (rtx op, enum machine_mode mode)
 {
   struct ix86_address parts;
 
@@ -4262,7 +4243,7 @@ aligned_operand (op, mode)
 /* Initialize the table of extra 80387 mathematical constants.  */
 
 static void
-init_ext_80387_constants ()
+init_ext_80387_constants (void)
 {
   static const char * cst[5] =
   {
@@ -4278,8 +4259,8 @@ init_ext_80387_constants ()
     {
       real_from_string (&ext_80387_constants_table[i], cst[i]);
       /* Ensure each constant is rounded to XFmode precision.  */
-      real_convert (&ext_80387_constants_table[i], XFmode,
-                   &ext_80387_constants_table[i]);
+      real_convert (&ext_80387_constants_table[i],
+                   XFmode, &ext_80387_constants_table[i]);
     }
 
   ext_80387_constants_init = 1;
@@ -4289,8 +4270,7 @@ init_ext_80387_constants ()
    a special instruction.  */
 
 int
-standard_80387_constant_p (x)
-     rtx x;
+standard_80387_constant_p (rtx x)
 {
   if (GET_CODE (x) != CONST_DOUBLE || !FLOAT_MODE_P (GET_MODE (x)))
     return -1;
@@ -4324,24 +4304,23 @@ standard_80387_constant_p (x)
    the constant X.  */
 
 const char *
-standard_80387_constant_opcode (x)
-     rtx x;
+standard_80387_constant_opcode (rtx x)
 {
   switch (standard_80387_constant_p (x))
     {
-    case 1: 
+    case 1:
       return "fldz";
     case 2:
       return "fld1";
-    case 3: 
+    case 3:
       return "fldlg2";
     case 4:
       return "fldln2";
-    case 5: 
+    case 5:
       return "fldl2e";
     case 6:
       return "fldl2t";
-    case 7: 
+    case 7:
       return "fldpi";
     }
   abort ();
@@ -4352,8 +4331,7 @@ standard_80387_constant_opcode (x)
    matches the return value from standard_80387_constant_p.  */
 
 rtx
-standard_80387_constant_rtx (idx)
-     int idx;
+standard_80387_constant_rtx (int idx)
 {
   int i;
 
@@ -4374,14 +4352,14 @@ standard_80387_constant_rtx (idx)
       abort ();
     }
 
-  return CONST_DOUBLE_FROM_REAL_VALUE (ext_80387_constants_table[i], XFmode);
+  return CONST_DOUBLE_FROM_REAL_VALUE (ext_80387_constants_table[i],
+                                      XFmode);
 }
 
 /* Return 1 if X is FP constant we can load to SSE register w/o using memory.
  */
 int
-standard_sse_constant_p (x)
-     rtx x;
+standard_sse_constant_p (rtx x)
 {
   if (x == const0_rtx)
     return 1;
@@ -4391,11 +4369,10 @@ standard_sse_constant_p (x)
 /* Returns 1 if OP contains a symbol reference */
 
 int
-symbolic_reference_mentioned_p (op)
-     rtx op;
+symbolic_reference_mentioned_p (rtx op)
 {
-  register const char *fmt;
-  register int i;
+  const char *fmt;
+  int i;
 
   if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
     return 1;
@@ -4405,7 +4382,7 @@ symbolic_reference_mentioned_p (op)
     {
       if (fmt[i] == 'E')
        {
-         register int j;
+         int j;
 
          for (j = XVECLEN (op, i) - 1; j >= 0; j--)
            if (symbolic_reference_mentioned_p (XVECEXP (op, i, j)))
@@ -4432,7 +4409,7 @@ symbolic_reference_mentioned_p (op)
    `return' is OK.  */
 
 int
-ix86_can_use_return_insn_p ()
+ix86_can_use_return_insn_p (void)
 {
   struct ix86_frame frame;
 
@@ -4456,8 +4433,7 @@ ix86_can_use_return_insn_p ()
 \f
 /* Return 1 if VALUE can be stored in the sign extended immediate field.  */
 int
-x86_64_sign_extended_value (value)
-     rtx value;
+x86_64_sign_extended_value (rtx value)
 {
   switch (GET_CODE (value))
     {
@@ -4479,6 +4455,9 @@ x86_64_sign_extended_value (value)
         library.  Don't count TLS SYMBOL_REFs here, since they should fit
         only if inside of UNSPEC handled below.  */
       case SYMBOL_REF:
+       /* TLS symbols are not constant.  */
+       if (tls_symbolic_operand (value, Pmode))
+         return false;
        return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);
 
       /* For certain code models, the code is near as well.  */
@@ -4565,8 +4544,7 @@ x86_64_sign_extended_value (value)
 
 /* Return 1 if VALUE can be stored in the zero extended immediate field.  */
 int
-x86_64_zero_extended_value (value)
-     rtx value;
+x86_64_zero_extended_value (rtx value)
 {
   switch (GET_CODE (value))
     {
@@ -4585,6 +4563,9 @@ x86_64_zero_extended_value (value)
 
       /* For certain code models, the symbolic references are known to fit.  */
       case SYMBOL_REF:
+       /* TLS symbols are not constant.  */
+       if (tls_symbolic_operand (value, Pmode))
+         return false;
        return ix86_cmodel == CM_SMALL;
 
       /* For certain code models, the code is near as well.  */
@@ -4645,7 +4626,7 @@ x86_64_zero_extended_value (value)
    be accessed via the stack pointer) in functions that seem suitable.  */
 
 int
-ix86_frame_pointer_required ()
+ix86_frame_pointer_required (void)
 {
   /* If we accessed previous frames, then the generated code expects
      to be able to access the saved ebp value in our frame.  */
@@ -4673,7 +4654,7 @@ ix86_frame_pointer_required ()
 /* Record that the current function accesses previous call frames.  */
 
 void
-ix86_setup_frame_addresses ()
+ix86_setup_frame_addresses (void)
 {
   cfun->machine->accesses_prev_frame = 1;
 }
@@ -4690,9 +4671,7 @@ static int pic_labels_used;
    the given register.  */
 
 static void
-get_pc_thunk_name (name, regno)
-     char name[32];
-     unsigned int regno;
+get_pc_thunk_name (char name[32], unsigned int regno)
 {
   if (USE_HIDDEN_LINKONCE)
     sprintf (name, "__i686.get_pc_thunk.%s", reg_names[regno]);
@@ -4705,8 +4684,7 @@ get_pc_thunk_name (name, regno)
    the return address of the caller and then returns.  */
 
 void
-ix86_asm_file_end (file)
-     FILE *file;
+ix86_file_end (void)
 {
   rtx xops[2];
   int regno;
@@ -4733,16 +4711,16 @@ ix86_asm_file_end (file)
          (*targetm.asm_out.unique_section) (decl, 0);
          named_section (decl, NULL, 0);
 
-         (*targetm.asm_out.globalize_label) (file, name);
-         fputs ("\t.hidden\t", file);
-         assemble_name (file, name);
-         fputc ('\n', file);
-         ASM_DECLARE_FUNCTION_NAME (file, name, decl);
+         (*targetm.asm_out.globalize_label) (asm_out_file, name);
+         fputs ("\t.hidden\t", asm_out_file);
+         assemble_name (asm_out_file, name);
+         fputc ('\n', asm_out_file);
+         ASM_DECLARE_FUNCTION_NAME (asm_out_file, name, decl);
        }
       else
        {
          text_section ();
-         ASM_OUTPUT_LABEL (file, name);
+         ASM_OUTPUT_LABEL (asm_out_file, name);
        }
 
       xops[0] = gen_rtx_REG (SImode, regno);
@@ -4751,16 +4729,14 @@ ix86_asm_file_end (file)
       output_asm_insn ("ret", xops);
     }
 
-#ifdef SUBTARGET_FILE_END
-  SUBTARGET_FILE_END (file);
-#endif
+  if (NEED_INDICATE_EXEC_STACK)
+    file_end_indicate_exec_stack ();
 }
 
 /* Emit code for the SET_GOT patterns.  */
 
 const char *
-output_set_got (dest)
-     rtx dest;
+output_set_got (rtx dest)
 {
   rtx xops[3];
 
@@ -4809,8 +4785,7 @@ output_set_got (dest)
 /* Generate an "push" pattern for input ARG.  */
 
 static rtx
-gen_push (arg)
-     rtx arg;
+gen_push (rtx arg)
 {
   return gen_rtx_SET (VOIDmode,
                      gen_rtx_MEM (Pmode,
@@ -4823,7 +4798,7 @@ gen_push (arg)
    for the entire function.  */
 
 static unsigned int
-ix86_select_alt_pic_regnum ()
+ix86_select_alt_pic_regnum (void)
 {
   if (current_function_is_leaf && !current_function_profile)
     {
@@ -4838,9 +4813,7 @@ ix86_select_alt_pic_regnum ()
 
 /* Return 1 if we need to save REGNO.  */
 static int
-ix86_save_reg (regno, maybe_eh_return)
-     unsigned int regno;
-     int maybe_eh_return;
+ix86_save_reg (unsigned int regno, int maybe_eh_return)
 {
   if (pic_offset_table_rtx
       && regno == REAL_PIC_OFFSET_TABLE_REGNUM
@@ -4876,7 +4849,7 @@ ix86_save_reg (regno, maybe_eh_return)
 /* Return number of registers to be saved on the stack.  */
 
 static int
-ix86_nsaved_regs ()
+ix86_nsaved_regs (void)
 {
   int nregs = 0;
   int regno;
@@ -4891,9 +4864,7 @@ ix86_nsaved_regs ()
    its replacement, at the start of a routine.  */
 
 HOST_WIDE_INT
-ix86_initial_elimination_offset (from, to)
-     int from;
-     int to;
+ix86_initial_elimination_offset (int from, int to)
 {
   struct ix86_frame frame;
   ix86_compute_frame_layout (&frame);
@@ -4919,12 +4890,11 @@ ix86_initial_elimination_offset (from, to)
 /* Fill structure ix86_frame about frame of currently computed function.  */
 
 static void
-ix86_compute_frame_layout (frame)
-     struct ix86_frame *frame;
+ix86_compute_frame_layout (struct ix86_frame *frame)
 {
   HOST_WIDE_INT total_size;
   int stack_alignment_needed = cfun->stack_alignment_needed / BITS_PER_UNIT;
-  int offset;
+  HOST_WIDE_INT offset;
   int preferred_alignment = cfun->preferred_stack_boundary / BITS_PER_UNIT;
   HOST_WIDE_INT size = get_frame_size ();
 
@@ -4944,7 +4914,7 @@ ix86_compute_frame_layout (frame)
       /* The fast prologue uses move instead of push to save registers.  This
          is significantly longer, but also executes faster as modern hardware
          can execute the moves in parallel, but can't do that for push/pop.
-        
+
         Be careful about choosing what prologue to emit:  When function takes
         many instructions to execute we may use slow version as well as in
         case function is known to be outside hot spot (this is known with
@@ -5040,7 +5010,8 @@ ix86_compute_frame_layout (frame)
     (size + frame->padding1 + frame->padding2
      + frame->outgoing_arguments_size + frame->va_arg_size);
 
-  if (!frame->to_allocate && frame->nregs <= 1)
+  if ((!frame->to_allocate && frame->nregs <= 1)
+      || (TARGET_64BIT && frame->to_allocate >= (HOST_WIDE_INT) 0x80000000))
     frame->save_regs_using_mov = false;
 
   if (TARGET_RED_ZONE && current_function_sp_is_unchanging
@@ -5075,9 +5046,9 @@ ix86_compute_frame_layout (frame)
 /* Emit code to save registers in the prologue.  */
 
 static void
-ix86_emit_save_regs ()
+ix86_emit_save_regs (void)
 {
-  register int regno;
+  int regno;
   rtx insn;
 
   for (regno = FIRST_PSEUDO_REGISTER - 1; regno >= 0; regno--)
@@ -5091,9 +5062,7 @@ ix86_emit_save_regs ()
 /* Emit code to save registers using MOV insns.  First register
    is restored from POINTER + OFFSET.  */
 static void
-ix86_emit_save_regs_using_mov (pointer, offset)
-     rtx pointer;
-     HOST_WIDE_INT offset;
+ix86_emit_save_regs_using_mov (rtx pointer, HOST_WIDE_INT offset)
 {
   int regno;
   rtx insn;
@@ -5109,10 +5078,45 @@ ix86_emit_save_regs_using_mov (pointer, offset)
       }
 }
 
+/* Expand prologue or epilogue stack adjustment.
+   The pattern exist to put a dependency on all ebp-based memory accesses.
+   STYLE should be negative if instructions should be marked as frame related,
+   zero if %r11 register is live and cannot be freely used and positive
+   otherwise.  */
+
+static void
+pro_epilogue_adjust_stack (rtx dest, rtx src, rtx offset, int style)
+{
+  rtx insn;
+
+  if (! TARGET_64BIT)
+    insn = emit_insn (gen_pro_epilogue_adjust_stack_1 (dest, src, offset));
+  else if (x86_64_immediate_operand (offset, DImode))
+    insn = emit_insn (gen_pro_epilogue_adjust_stack_rex64 (dest, src, offset));
+  else
+    {
+      rtx r11;
+      /* r11 is used by indirect sibcall return as well, set before the
+        epilogue and used after the epilogue.  ATM indirect sibcall
+        shouldn't be used together with huge frame sizes in one
+        function because of the frame_size check in sibcall.c.  */
+      if (style == 0)
+       abort ();
+      r11 = gen_rtx_REG (DImode, FIRST_REX_INT_REG + 3 /* R11 */);
+      insn = emit_insn (gen_rtx_SET (DImode, r11, offset));
+      if (style < 0)
+       RTX_FRAME_RELATED_P (insn) = 1;
+      insn = emit_insn (gen_pro_epilogue_adjust_stack_rex64_2 (dest, src, r11,
+                                                              offset));
+    }
+  if (style < 0)
+    RTX_FRAME_RELATED_P (insn) = 1;
+}
+
 /* Expand the prologue into a bunch of separate insns.  */
 
 void
-ix86_expand_prologue ()
+ix86_expand_prologue (void)
 {
   rtx insn;
   bool pic_reg_used;
@@ -5150,36 +5154,36 @@ ix86_expand_prologue ()
   if (allocate == 0)
     ;
   else if (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)
-    {
-      insn = emit_insn (gen_pro_epilogue_adjust_stack
-                       (stack_pointer_rtx, stack_pointer_rtx,
-                        GEN_INT (-allocate)));
-      RTX_FRAME_RELATED_P (insn) = 1;
-    }
+    pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
+                              GEN_INT (-allocate), -1);
   else
     {
-      /* ??? Is this only valid for Win32?  */
-
-      rtx arg0, sym;
+      /* Only valid for Win32.  */
+      rtx eax = gen_rtx_REG (SImode, 0);
+      bool eax_live = ix86_eax_live_at_start_p ();
 
       if (TARGET_64BIT)
-       abort ();
+        abort ();
 
-      arg0 = gen_rtx_REG (SImode, 0);
-      emit_move_insn (arg0, GEN_INT (allocate));
+      if (eax_live)
+       {
+         emit_insn (gen_push (eax));
+         allocate -= 4;
+       }
 
-      sym = gen_rtx_MEM (FUNCTION_MODE,
-                        gen_rtx_SYMBOL_REF (Pmode, "_alloca"));
-      insn = emit_call_insn (gen_call (sym, const0_rtx, constm1_rtx));
+      insn = emit_move_insn (eax, GEN_INT (allocate));
+      RTX_FRAME_RELATED_P (insn) = 1;
 
-      CALL_INSN_FUNCTION_USAGE (insn)
-       = gen_rtx_EXPR_LIST (VOIDmode, gen_rtx_USE (VOIDmode, arg0),
-                            CALL_INSN_FUNCTION_USAGE (insn));
+      insn = emit_insn (gen_allocate_stack_worker (eax));
+      RTX_FRAME_RELATED_P (insn) = 1;
 
-      /* Don't allow scheduling pass to move insns across __alloca
-         call.  */
-      emit_insn (gen_blockage (const0_rtx));
+      if (eax_live)
+       {
+         rtx t = plus_constant (stack_pointer_rtx, allocate);
+         emit_move_insn (eax, gen_rtx_MEM (SImode, t));
+       }
     }
+
   if (frame.save_regs_using_mov && !TARGET_RED_ZONE)
     {
       if (!frame_pointer_needed || !frame.to_allocate)
@@ -5224,10 +5228,7 @@ ix86_expand_prologue ()
 /* Emit code to restore saved registers using MOV insns.  First register
    is restored from POINTER + OFFSET.  */
 static void
-ix86_emit_restore_regs_using_mov (pointer, offset, maybe_eh_return)
-     rtx pointer;
-     int offset;
-     int maybe_eh_return;
+ix86_emit_restore_regs_using_mov (rtx pointer, int offset, int maybe_eh_return)
 {
   int regno;
 
@@ -5244,8 +5245,7 @@ ix86_emit_restore_regs_using_mov (pointer, offset, maybe_eh_return)
 /* Restore function stack, frame, and registers.  */
 
 void
-ix86_expand_epilogue (style)
-     int style;
+ix86_expand_epilogue (int style)
 {
   int regno;
   int sp_valid = !frame_pointer_needed || current_function_sp_is_unchanging;
@@ -5310,8 +5310,8 @@ ix86_expand_epilogue (style)
              tmp = gen_rtx_MEM (Pmode, hard_frame_pointer_rtx);
              emit_move_insn (hard_frame_pointer_rtx, tmp);
 
-             emit_insn (gen_pro_epilogue_adjust_stack
-                        (stack_pointer_rtx, sa, const0_rtx));
+             pro_epilogue_adjust_stack (stack_pointer_rtx, sa,
+                                        const0_rtx, style);
            }
          else
            {
@@ -5322,19 +5322,19 @@ ix86_expand_epilogue (style)
            }
        }
       else if (!frame_pointer_needed)
-       emit_insn (gen_pro_epilogue_adjust_stack
-                  (stack_pointer_rtx, stack_pointer_rtx,
-                   GEN_INT (frame.to_allocate
-                            + frame.nregs * UNITS_PER_WORD)));
+       pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
+                                  GEN_INT (frame.to_allocate
+                                           + frame.nregs * UNITS_PER_WORD),
+                                  style);
       /* If not an i386, mov & pop is faster than "leave".  */
       else if (TARGET_USE_LEAVE || optimize_size
               || !cfun->machine->use_fast_prologue_epilogue)
        emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
       else
        {
-         emit_insn (gen_pro_epilogue_adjust_stack (stack_pointer_rtx,
-                                                   hard_frame_pointer_rtx,
-                                                   const0_rtx));
+         pro_epilogue_adjust_stack (stack_pointer_rtx,
+                                    hard_frame_pointer_rtx,
+                                    const0_rtx, style);
          if (TARGET_64BIT)
            emit_insn (gen_popdi1 (hard_frame_pointer_rtx));
          else
@@ -5349,14 +5349,13 @@ ix86_expand_epilogue (style)
        {
          if (!frame_pointer_needed)
            abort ();
-          emit_insn (gen_pro_epilogue_adjust_stack (stack_pointer_rtx,
-                                                   hard_frame_pointer_rtx,
-                                                   GEN_INT (offset)));
+         pro_epilogue_adjust_stack (stack_pointer_rtx,
+                                    hard_frame_pointer_rtx,
+                                    GEN_INT (offset), style);
        }
       else if (frame.to_allocate)
-       emit_insn (gen_pro_epilogue_adjust_stack
-                  (stack_pointer_rtx, stack_pointer_rtx,
-                   GEN_INT (frame.to_allocate)));
+       pro_epilogue_adjust_stack (stack_pointer_rtx, stack_pointer_rtx,
+                                  GEN_INT (frame.to_allocate), style);
 
       for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
        if (ix86_save_reg (regno, false))
@@ -5395,7 +5394,7 @@ ix86_expand_epilogue (style)
        {
          rtx ecx = gen_rtx_REG (SImode, 2);
 
-         /* There are is no "pascal" calling convention in 64bit ABI.  */
+         /* There is no "pascal" calling convention in 64bit ABI.  */
          if (TARGET_64BIT)
            abort ();
 
@@ -5413,9 +5412,8 @@ ix86_expand_epilogue (style)
 /* Reset from the function's potential modifications.  */
 
 static void
-ix86_output_function_epilogue (file, size)
-     FILE *file ATTRIBUTE_UNUSED;
-     HOST_WIDE_INT size ATTRIBUTE_UNUSED;
+ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
+                              HOST_WIDE_INT size ATTRIBUTE_UNUSED)
 {
   if (pic_offset_table_rtx)
     REGNO (pic_offset_table_rtx) = REAL_PIC_OFFSET_TABLE_REGNUM;
@@ -5427,9 +5425,7 @@ ix86_output_function_epilogue (file, size)
    strictly valid, but still used for computing length of lea instruction.  */
 
 static int
-ix86_decompose_address (addr, out)
-     register rtx addr;
-     struct ix86_address *out;
+ix86_decompose_address (rtx addr, struct ix86_address *out)
 {
   rtx base = NULL_RTX;
   rtx index = NULL_RTX;
@@ -5583,8 +5579,7 @@ ix86_decompose_address (addr, out)
    requires to two regs - that would mean more pseudos with longer
    lifetimes.  */
 static int
-ix86_address_cost (x)
-     rtx x;
+ix86_address_cost (rtx x)
 {
   struct ix86_address parts;
   int cost = 1;
@@ -5647,8 +5642,7 @@ ix86_address_cost (x)
    UNSPEC), then return the base term.  Otherwise return X.  */
 
 rtx
-ix86_find_base_term (x)
-     rtx x;
+ix86_find_base_term (rtx x)
 {
   rtx term;
 
@@ -5687,8 +5681,7 @@ ix86_find_base_term (x)
    satisfies CONSTANT_P.  */
 
 bool
-legitimate_constant_p (x)
-     rtx x;
+legitimate_constant_p (rtx x)
 {
   rtx inner;
 
@@ -5721,7 +5714,10 @@ legitimate_constant_p (x)
        switch (XINT (inner, 1))
          {
          case UNSPEC_TPOFF:
+         case UNSPEC_NTPOFF:
            return local_exec_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
+         case UNSPEC_DTPOFF:
+           return local_dynamic_symbolic_operand (XVECEXP (inner, 0, 0), Pmode);
          default:
            return false;
          }
@@ -5740,8 +5736,7 @@ legitimate_constant_p (x)
    is checked above.  */
 
 static bool
-ix86_cannot_force_const_mem (x)
-     rtx x;
+ix86_cannot_force_const_mem (rtx x)
 {
   return !legitimate_constant_p (x);
 }
@@ -5749,8 +5744,7 @@ ix86_cannot_force_const_mem (x)
 /* Determine if a given RTX is a valid constant address.  */
 
 bool
-constant_address_p (x)
-     rtx x;
+constant_address_p (rtx x)
 {
   return CONSTANT_P (x) && legitimate_address_p (Pmode, x, 1);
 }
@@ -5760,8 +5754,7 @@ constant_address_p (x)
    that X satisfies CONSTANT_P or is a CONST_DOUBLE.  */
 
 bool
-legitimate_pic_operand_p (x)
-     rtx x;
+legitimate_pic_operand_p (rtx x)
 {
   rtx inner;
 
@@ -5794,8 +5787,7 @@ legitimate_pic_operand_p (x)
    in PIC mode.  */
 
 int
-legitimate_pic_address_disp_p (disp)
-     register rtx disp;
+legitimate_pic_address_disp_p (rtx disp)
 {
   bool saw_plus;
 
@@ -5813,15 +5805,23 @@ legitimate_pic_address_disp_p (disp)
       if (GET_CODE (disp) == LABEL_REF)
        return 1;
       if (GET_CODE (disp) == CONST
-         && GET_CODE (XEXP (disp, 0)) == PLUS
-         && ((GET_CODE (XEXP (XEXP (disp, 0), 0)) == SYMBOL_REF
-              && ix86_cmodel == CM_SMALL_PIC
-              && SYMBOL_REF_LOCAL_P (XEXP (XEXP (disp, 0), 0)))
-             || GET_CODE (XEXP (XEXP (disp, 0), 0)) == LABEL_REF)
-         && GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT
-         && INTVAL (XEXP (XEXP (disp, 0), 1)) < 16*1024*1024
-         && INTVAL (XEXP (XEXP (disp, 0), 1)) >= -16*1024*1024)
-       return 1;
+         && GET_CODE (XEXP (disp, 0)) == PLUS)
+       {
+         rtx op0 = XEXP (XEXP (disp, 0), 0);
+         rtx op1 = XEXP (XEXP (disp, 0), 1);
+
+         /* TLS references should always be enclosed in UNSPEC.  */
+         if (tls_symbolic_operand (op0, GET_MODE (op0)))
+           return 0;
+         if (((GET_CODE (op0) == SYMBOL_REF
+               && ix86_cmodel == CM_SMALL_PIC
+               && SYMBOL_REF_LOCAL_P (op0))
+              || GET_CODE (op0) == LABEL_REF)
+             && GET_CODE (op1) == CONST_INT
+             && INTVAL (op1) < 16*1024*1024
+             && INTVAL (op1) >= -16*1024*1024)
+           return 1;
+       }
     }
   if (GET_CODE (disp) != CONST)
     return 0;
@@ -5858,7 +5858,7 @@ legitimate_pic_address_disp_p (disp)
         if (GET_CODE (XEXP (disp, 1)) == SYMBOL_REF)
           {
             const char *sym_name = XSTR (XEXP (disp, 1), 0);
-            if (strstr (sym_name, "$pb") != 0)
+            if (! strcmp (sym_name, "<pic base>"))
               return 1;
           }
     }
@@ -5901,10 +5901,7 @@ legitimate_pic_address_disp_p (disp)
    be recognized.  */
 
 int
-legitimate_address_p (mode, addr, strict)
-     enum machine_mode mode;
-     register rtx addr;
-     int strict;
+legitimate_address_p (enum machine_mode mode, rtx addr, int strict)
 {
   struct ix86_address parts;
   rtx base, index, disp;
@@ -6131,7 +6128,7 @@ legitimate_address_p (mode, addr, strict)
 /* Return an unique alias set for the GOT.  */
 
 static HOST_WIDE_INT
-ix86_GOT_alias_set ()
+ix86_GOT_alias_set (void)
 {
   static HOST_WIDE_INT set = -1;
   if (set == -1)
@@ -6158,9 +6155,7 @@ ix86_GOT_alias_set ()
    reg also appears in the address.  */
 
 rtx
-legitimize_pic_address (orig, reg)
-     rtx orig;
-     rtx reg;
+legitimize_pic_address (rtx orig, rtx reg)
 {
   rtx addr = orig;
   rtx new = orig;
@@ -6312,8 +6307,7 @@ legitimize_pic_address (orig, reg)
 /* Load the thread pointer.  If TO_REG is true, force it into a register.  */
 
 static rtx
-get_thread_pointer (to_reg)
-     int to_reg;
+get_thread_pointer (int to_reg)
 {
   rtx tp, reg, insn;
 
@@ -6333,10 +6327,7 @@ get_thread_pointer (to_reg)
    we expect to load the address into a register.  */
 
 static rtx
-legitimize_tls_address (x, model, for_mov)
-     rtx x;
-     enum tls_model model;
-     int for_mov;
+legitimize_tls_address (rtx x, enum tls_model model, int for_mov)
 {
   rtx dest, base, off, pic;
   int type;
@@ -6478,10 +6469,7 @@ legitimize_tls_address (x, model, for_mov)
    See comments by legitimize_pic_address in i386.c for details.  */
 
 rtx
-legitimize_address (x, oldx, mode)
-     register rtx x;
-     register rtx oldx ATTRIBUTE_UNUSED;
-     enum machine_mode mode;
+legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, enum machine_mode mode)
 {
   int changed = 0;
   unsigned log;
@@ -6621,8 +6609,8 @@ legitimize_address (x, oldx, mode)
 
       if (GET_CODE (XEXP (x, 0)) == REG)
        {
-         register rtx temp = gen_reg_rtx (Pmode);
-         register rtx val  = force_operand (XEXP (x, 1), temp);
+         rtx temp = gen_reg_rtx (Pmode);
+         rtx val  = force_operand (XEXP (x, 1), temp);
          if (val != temp)
            emit_move_insn (temp, val);
 
@@ -6632,8 +6620,8 @@ legitimize_address (x, oldx, mode)
 
       else if (GET_CODE (XEXP (x, 1)) == REG)
        {
-         register rtx temp = gen_reg_rtx (Pmode);
-         register rtx val  = force_operand (XEXP (x, 0), temp);
+         rtx temp = gen_reg_rtx (Pmode);
+         rtx val  = force_operand (XEXP (x, 0), temp);
          if (val != temp)
            emit_move_insn (temp, val);
 
@@ -6651,10 +6639,7 @@ legitimize_address (x, oldx, mode)
    CODE is the operand print code from the output string.  */
 
 static void
-output_pic_addr_const (file, x, code)
-     FILE *file;
-     rtx x;
-     int code;
+output_pic_addr_const (FILE *file, rtx x, int code)
 {
   char buf[256];
 
@@ -6791,9 +6776,7 @@ output_pic_addr_const (file, x, code)
    We need to handle our special PIC relocations.  */
 
 void
-i386_dwarf_output_addr_const (file, x)
-     FILE *file;
-     rtx x;
+i386_dwarf_output_addr_const (FILE *file, rtx x)
 {
 #ifdef ASM_QUAD
   fprintf (file, "%s", TARGET_64BIT ? ASM_QUAD : ASM_LONG);
@@ -6813,10 +6796,7 @@ i386_dwarf_output_addr_const (file, x)
    We need to emit DTP-relative relocations.  */
 
 void
-i386_output_dwarf_dtprel (file, size, x)
-     FILE *file;
-     int size;
-     rtx x;
+i386_output_dwarf_dtprel (FILE *file, int size, rtx x)
 {
   fputs (ASM_LONG, file);
   output_addr_const (file, x);
@@ -6838,8 +6818,7 @@ i386_output_dwarf_dtprel (file, size, x)
    into a direct symbol reference.  */
 
 static rtx
-ix86_delegitimize_address (orig_x)
-     rtx orig_x;
+ix86_delegitimize_address (rtx orig_x)
 {
   rtx x = orig_x, y;
 
@@ -6911,11 +6890,8 @@ ix86_delegitimize_address (orig_x)
 }
 \f
 static void
-put_condition_code (code, mode, reverse, fp, file)
-     enum rtx_code code;
-     enum machine_mode mode;
-     int reverse, fp;
-     FILE *file;
+put_condition_code (enum rtx_code code, enum machine_mode mode, int reverse,
+                   int fp, FILE *file)
 {
   const char *suffix;
 
@@ -7001,15 +6977,16 @@ put_condition_code (code, mode, reverse, fp, file)
 }
 
 void
-print_reg (x, code, file)
-     rtx x;
-     int code;
-     FILE *file;
-{
-  if (REGNO (x) == ARG_POINTER_REGNUM
-      || REGNO (x) == FRAME_POINTER_REGNUM
-      || REGNO (x) == FLAGS_REG
-      || REGNO (x) == FPSR_REG)
+print_reg (rtx x, int code, FILE *file)
+{
+  /* Code -1 indicates we are called from print_rtx, and it is not
+     an error for a virtual register to appear here.  */
+  if (code == -1)
+    code = 0;
+  else if (REGNO (x) == ARG_POINTER_REGNUM
+          || REGNO (x) == FRAME_POINTER_REGNUM
+          || REGNO (x) == FLAGS_REG
+          || REGNO (x) == FPSR_REG)
     abort ();
 
   if (ASSEMBLER_DIALECT == ASM_ATT || USER_LABEL_PREFIX[0] == 0)
@@ -7076,12 +7053,17 @@ print_reg (x, code, file)
       /* FALLTHRU */
     case 16:
     case 2:
+    normal:
       fputs (hi_reg_name[REGNO (x)], file);
       break;
     case 1:
+      if (REGNO (x) >= ARRAY_SIZE (qi_reg_name))
+       goto normal;
       fputs (qi_reg_name[REGNO (x)], file);
       break;
     case 0:
+      if (REGNO (x) >= ARRAY_SIZE (qi_high_reg_name))
+       goto normal;
       fputs (qi_high_reg_name[REGNO (x)], file);
       break;
     default:
@@ -7094,7 +7076,7 @@ print_reg (x, code, file)
    pattern.  */
 
 static const char *
-get_some_local_dynamic_name ()
+get_some_local_dynamic_name (void)
 {
   rtx insn;
 
@@ -7110,9 +7092,7 @@ get_some_local_dynamic_name ()
 }
 
 static int
-get_some_local_dynamic_name_1 (px, data)
-     rtx *px;
-     void *data ATTRIBUTE_UNUSED;
+get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
 {
   rtx x = *px;
 
@@ -7131,8 +7111,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)
@@ -7154,10 +7134,7 @@ get_some_local_dynamic_name_1 (px, data)
  */
 
 void
-print_operand (file, x, code)
-     FILE *file;
-     rtx x;
-     int code;
+print_operand (FILE *file, rtx x, int code)
 {
   if (code)
     {
@@ -7336,7 +7313,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))
@@ -7356,7 +7333,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
@@ -7375,7 +7352,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
@@ -7475,7 +7452,7 @@ print_operand (file, x, code)
 
       if (ASSEMBLER_DIALECT == ASM_ATT)
        putc ('$', file);
-      fprintf (file, "0x%lx", l);
+      fprintf (file, "0x%08lx", l);
     }
 
   /* These float cases don't actually occur as immediate operands.  */
@@ -7488,7 +7465,7 @@ print_operand (file, x, code)
     }
 
   else if (GET_CODE (x) == CONST_DOUBLE
-          && (GET_MODE (x) == XFmode || GET_MODE (x) == TFmode))
+          && GET_MODE (x) == XFmode)
     {
       char dstr[30];
 
@@ -7526,9 +7503,7 @@ print_operand (file, x, code)
 /* Print a memory operand whose address is ADDR.  */
 
 void
-print_operand_address (file, addr)
-     FILE *file;
-     register rtx addr;
+print_operand_address (FILE *file, rtx addr)
 {
   struct ix86_address parts;
   rtx base, index, disp;
@@ -7668,9 +7643,7 @@ print_operand_address (file, addr)
 }
 
 bool
-output_addr_const_extra (file, x)
-     FILE *file;
-     rtx x;
+output_addr_const_extra (FILE *file, rtx x)
 {
   rtx op;
 
@@ -7726,10 +7699,7 @@ output_addr_const_extra (file, x)
    that parallel "operands".  */
 
 void
-split_di (operands, num, lo_half, hi_half)
-     rtx operands[];
-     int num;
-     rtx lo_half[], hi_half[];
+split_di (rtx operands[], int num, rtx lo_half[], rtx hi_half[])
 {
   while (num--)
     {
@@ -7760,10 +7730,7 @@ split_di (operands, num, lo_half, hi_half)
    that parallel "operands".  */
 
 void
-split_ti (operands, num, lo_half, hi_half)
-     rtx operands[];
-     int num;
-     rtx lo_half[], hi_half[];
+split_ti (rtx operands[], int num, rtx lo_half[], rtx hi_half[])
 {
   while (num--)
     {
@@ -7802,9 +7769,7 @@ split_ti (operands, num, lo_half, hi_half)
 #endif
 
 const char *
-output_387_binary_op (insn, operands)
-     rtx insn;
-     rtx *operands;
+output_387_binary_op (rtx insn, rtx *operands)
 {
   static char buf[30];
   const char *p;
@@ -8012,8 +7977,7 @@ output_387_binary_op (insn, operands)
    trunc?f?i patterns.  NORMAL is set to current control word, while ROUND_DOWN
    is set to control word rounding downwards.  */
 void
-emit_i387_cw_initialization (normal, round_down)
-     rtx normal, round_down;
+emit_i387_cw_initialization (rtx normal, rtx round_down)
 {
   rtx reg = gen_reg_rtx (HImode);
 
@@ -8032,9 +7996,7 @@ emit_i387_cw_initialization (normal, round_down)
    operand may be [SDX]Fmode.  */
 
 const char *
-output_fix_trunc (insn, operands)
-     rtx insn;
-     rtx *operands;
+output_fix_trunc (rtx insn, rtx *operands)
 {
   int stack_top_dies = find_regno_note (insn, REG_DEAD, FIRST_STACK_REG) != 0;
   int dimode_p = GET_MODE (operands[0]) == DImode;
@@ -8066,10 +8028,7 @@ output_fix_trunc (insn, operands)
    when fucom should be used.  */
 
 const char *
-output_fp_compare (insn, operands, eflags_p, unordered_p)
-     rtx insn;
-     rtx *operands;
-     int eflags_p, unordered_p;
+output_fp_compare (rtx insn, rtx *operands, int eflags_p, int unordered_p)
 {
   int stack_top_dies;
   rtx cmp_op0 = operands[0];
@@ -8193,9 +8152,7 @@ output_fp_compare (insn, operands, eflags_p, unordered_p)
 }
 
 void
-ix86_output_addr_vec_elt (file, value)
-     FILE *file;
-     int value;
+ix86_output_addr_vec_elt (FILE *file, int value)
 {
   const char *directive = ASM_LONG;
 
@@ -8212,9 +8169,7 @@ ix86_output_addr_vec_elt (file, value)
 }
 
 void
-ix86_output_addr_diff_elt (file, value, rel)
-     FILE *file;
-     int value, rel;
+ix86_output_addr_diff_elt (FILE *file, int value, int rel)
 {
   if (TARGET_64BIT)
     fprintf (file, "%s%s%d-%s%d\n",
@@ -8223,8 +8178,11 @@ ix86_output_addr_diff_elt (file, value, rel)
     fprintf (file, "%s%s%d@GOTOFF\n", ASM_LONG, LPREFIX, value);
 #if TARGET_MACHO
   else if (TARGET_MACHO)
-    fprintf (file, "%s%s%d-%s\n", ASM_LONG, LPREFIX, value,
-            machopic_function_base_name () + 1);
+    {
+      fprintf (file, "%s%s%d-", ASM_LONG, LPREFIX, value);
+      machopic_output_function_base_name (file);
+      fprintf(file, "\n");
+    }
 #endif
   else
     asm_fprintf (file, "%s%U%s+[.-%s%d]\n",
@@ -8235,8 +8193,7 @@ ix86_output_addr_diff_elt (file, value, rel)
    for the target.  */
 
 void
-ix86_expand_clear (dest)
-     rtx dest;
+ix86_expand_clear (rtx dest)
 {
   rtx tmp;
 
@@ -8264,8 +8221,7 @@ ix86_expand_clear (dest)
    the constant pool rtx, else NULL.  */
 
 static rtx
-maybe_get_pool_constant (x)
-     rtx x;
+maybe_get_pool_constant (rtx x)
 {
   x = ix86_delegitimize_address (XEXP (x, 0));
 
@@ -8276,9 +8232,7 @@ maybe_get_pool_constant (x)
 }
 
 void
-ix86_expand_move (mode, operands)
-     enum machine_mode mode;
-     rtx operands[];
+ix86_expand_move (enum machine_mode mode, rtx operands[])
 {
   int strict = (reload_in_progress || reload_completed);
   rtx op0, op1;
@@ -8375,9 +8329,7 @@ ix86_expand_move (mode, operands)
 }
 
 void
-ix86_expand_vector_move (mode, operands)
-     enum machine_mode mode;
-     rtx operands[];
+ix86_expand_vector_move (enum machine_mode mode, rtx operands[])
 {
   /* Force constants other than zero into memory.  We do not know how
      the instructions used to build constants modify the upper 64 bits
@@ -8406,10 +8358,8 @@ ix86_expand_vector_move (mode, operands)
    memory references (one output, two input) in a single insn.  */
 
 void
-ix86_expand_binary_operator (code, mode, operands)
-     enum rtx_code code;
-     enum machine_mode mode;
-     rtx operands[];
+ix86_expand_binary_operator (enum rtx_code code, enum machine_mode mode,
+                            rtx operands[])
 {
   int matching_memory;
   rtx src1, src2, dst, op, clob;
@@ -8495,10 +8445,9 @@ ix86_expand_binary_operator (code, mode, operands)
    appropriate constraints.  */
 
 int
-ix86_binary_operator_ok (code, mode, operands)
-     enum rtx_code code;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
-     rtx operands[3];
+ix86_binary_operator_ok (enum rtx_code code,
+                        enum machine_mode mode ATTRIBUTE_UNUSED,
+                        rtx operands[3])
 {
   /* Both source operands cannot be in memory.  */
   if (GET_CODE (operands[1]) == MEM && GET_CODE (operands[2]) == MEM)
@@ -8526,10 +8475,8 @@ ix86_binary_operator_ok (code, mode, operands)
    memory references (one output, one input) in a single insn.  */
 
 void
-ix86_expand_unary_operator (code, mode, operands)
-     enum rtx_code code;
-     enum machine_mode mode;
-     rtx operands[];
+ix86_expand_unary_operator (enum rtx_code code, enum machine_mode mode,
+                           rtx operands[])
 {
   int matching_memory;
   rtx src, dst, op, clob;
@@ -8587,10 +8534,9 @@ ix86_expand_unary_operator (code, mode, operands)
    appropriate constraints.  */
 
 int
-ix86_unary_operator_ok (code, mode, operands)
-     enum rtx_code code ATTRIBUTE_UNUSED;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
-     rtx operands[2] ATTRIBUTE_UNUSED;
+ix86_unary_operator_ok (enum rtx_code code ATTRIBUTE_UNUSED,
+                       enum machine_mode mode ATTRIBUTE_UNUSED,
+                       rtx operands[2] ATTRIBUTE_UNUSED)
 {
   /* If one of operands is memory, source and destination must match.  */
   if ((GET_CODE (operands[0]) == MEM
@@ -8605,9 +8551,7 @@ ix86_unary_operator_ok (code, mode, operands)
    CC mode is at least as constrained as REQ_MODE.  */
 
 int
-ix86_match_ccmode (insn, req_mode)
-     rtx insn;
-     enum machine_mode req_mode;
+ix86_match_ccmode (rtx insn, enum machine_mode req_mode)
 {
   rtx set;
   enum machine_mode set_mode;
@@ -8654,9 +8598,7 @@ ix86_match_ccmode (insn, req_mode)
 /* Generate insn patterns to do an integer compare of OPERANDS.  */
 
 static rtx
-ix86_expand_int_compare (code, op0, op1)
-     enum rtx_code code;
-     rtx op0, op1;
+ix86_expand_int_compare (enum rtx_code code, rtx op0, rtx op1)
 {
   enum machine_mode cmpmode;
   rtx tmp, flags;
@@ -8678,8 +8620,7 @@ ix86_expand_int_compare (code, op0, op1)
    Return the appropriate mode to use.  */
 
 enum machine_mode
-ix86_fp_compare_mode (code)
-     enum rtx_code code ATTRIBUTE_UNUSED;
+ix86_fp_compare_mode (enum rtx_code code ATTRIBUTE_UNUSED)
 {
   /* ??? In order to make all comparisons reversible, we do all comparisons
      non-trapping when compiling for IEEE.  Once gcc is able to distinguish
@@ -8690,9 +8631,7 @@ ix86_fp_compare_mode (code)
 }
 
 enum machine_mode
-ix86_cc_mode (code, op0, op1)
-     enum rtx_code code;
-     rtx op0, op1;
+ix86_cc_mode (enum rtx_code code, rtx op0, rtx op1)
 {
   if (GET_MODE_CLASS (GET_MODE (op0)) == MODE_FLOAT)
     return ix86_fp_compare_mode (code);
@@ -8739,8 +8678,7 @@ ix86_cc_mode (code, op0, op1)
 /* Return true if we should use an FCOMI instruction for this fp comparison.  */
 
 int
-ix86_use_fcomi_compare (code)
-     enum rtx_code code ATTRIBUTE_UNUSED;
+ix86_use_fcomi_compare (enum rtx_code code ATTRIBUTE_UNUSED)
 {
   enum rtx_code swapped_code = swap_condition (code);
   return ((ix86_fp_comparison_cost (code) == ix86_fp_comparison_fcomi_cost (code))
@@ -8753,9 +8691,7 @@ ix86_use_fcomi_compare (code)
    comparison code is returned.  */
 
 static enum rtx_code
-ix86_prepare_fp_compare_args (code, pop0, pop1)
-     enum rtx_code code;
-     rtx *pop0, *pop1;
+ix86_prepare_fp_compare_args (enum rtx_code code, rtx *pop0, rtx *pop1)
 {
   enum machine_mode fpcmp_mode = ix86_fp_compare_mode (code);
   rtx op0 = *pop0, op1 = *pop1;
@@ -8769,7 +8705,6 @@ ix86_prepare_fp_compare_args (code, pop0, pop1)
   if (!is_sse
       && (fpcmp_mode == CCFPUmode
          || op_mode == XFmode
-         || op_mode == TFmode
          || ix86_use_fcomi_compare (code)))
     {
       op0 = force_reg (op_mode, op0);
@@ -8824,8 +8759,7 @@ ix86_prepare_fp_compare_args (code, pop0, pop1)
    code that will result in proper branch.  Return UNKNOWN if no such code
    is available.  */
 static enum rtx_code
-ix86_fp_compare_code_to_integer (code)
-     enum rtx_code code;
+ix86_fp_compare_code_to_integer (enum rtx_code code)
 {
   switch (code)
     {
@@ -8860,8 +8794,9 @@ ix86_fp_compare_code_to_integer (code)
    is not required, set value to NIL.
    We never require more than two branches.  */
 static void
-ix86_fp_comparison_codes (code, bypass_code, first_code, second_code)
-     enum rtx_code code, *bypass_code, *first_code, *second_code;
+ix86_fp_comparison_codes (enum rtx_code code, enum rtx_code *bypass_code,
+                         enum rtx_code *first_code,
+                         enum rtx_code *second_code)
 {
   *first_code = code;
   *bypass_code = NIL;
@@ -8925,8 +8860,7 @@ ix86_fp_comparison_codes (code, bypass_code, first_code, second_code)
    In future this should be tweaked to compute bytes for optimize_size and
    take into account performance of various instructions on various CPUs.  */
 static int
-ix86_fp_comparison_arithmetics_cost (code)
-     enum rtx_code code;
+ix86_fp_comparison_arithmetics_cost (enum rtx_code code)
 {
   if (!TARGET_IEEE_FP)
     return 4;
@@ -8961,8 +8895,7 @@ ix86_fp_comparison_arithmetics_cost (code)
 /* Return cost of comparison done using fcomi operation.
    See ix86_fp_comparison_arithmetics_cost for the metrics.  */
 static int
-ix86_fp_comparison_fcomi_cost (code)
-     enum rtx_code code;
+ix86_fp_comparison_fcomi_cost (enum rtx_code code)
 {
   enum rtx_code bypass_code, first_code, second_code;
   /* Return arbitrarily high cost when instruction is not supported - this
@@ -8976,8 +8909,7 @@ ix86_fp_comparison_fcomi_cost (code)
 /* Return cost of comparison done using sahf operation.
    See ix86_fp_comparison_arithmetics_cost for the metrics.  */
 static int
-ix86_fp_comparison_sahf_cost (code)
-     enum rtx_code code;
+ix86_fp_comparison_sahf_cost (enum rtx_code code)
 {
   enum rtx_code bypass_code, first_code, second_code;
   /* Return arbitrarily high cost when instruction is not preferred - this
@@ -8991,8 +8923,7 @@ ix86_fp_comparison_sahf_cost (code)
 /* Compute cost of the comparison done using any method.
    See ix86_fp_comparison_arithmetics_cost for the metrics.  */
 static int
-ix86_fp_comparison_cost (code)
-     enum rtx_code code;
+ix86_fp_comparison_cost (enum rtx_code code)
 {
   int fcomi_cost, sahf_cost, arithmetics_cost = 1024;
   int min;
@@ -9011,11 +8942,8 @@ ix86_fp_comparison_cost (code)
 /* Generate insn patterns to do a floating point compare of OPERANDS.  */
 
 static rtx
-ix86_expand_fp_compare (code, op0, op1, scratch, second_test, bypass_test)
-     enum rtx_code code;
-     rtx op0, op1, scratch;
-     rtx *second_test;
-     rtx *bypass_test;
+ix86_expand_fp_compare (enum rtx_code code, rtx op0, rtx op1, rtx scratch,
+                       rtx *second_test, rtx *bypass_test)
 {
   enum machine_mode fpcmp_mode, intcmp_mode;
   rtx tmp, tmp2;
@@ -9199,9 +9127,7 @@ ix86_expand_fp_compare (code, op0, op1, scratch, second_test, bypass_test)
 }
 
 rtx
-ix86_expand_compare (code, second_test, bypass_test)
-     enum rtx_code code;
-     rtx *second_test, *bypass_test;
+ix86_expand_compare (enum rtx_code code, rtx *second_test, rtx *bypass_test)
 {
   rtx op0, op1, ret;
   op0 = ix86_compare_op0;
@@ -9223,8 +9149,7 @@ ix86_expand_compare (code, second_test, bypass_test)
 
 /* Return true if the CODE will result in nontrivial jump sequence.  */
 bool
-ix86_fp_jump_nontrivial_p (code)
-    enum rtx_code code;
+ix86_fp_jump_nontrivial_p (enum rtx_code code)
 {
   enum rtx_code bypass_code, first_code, second_code;
   if (!TARGET_CMOVE)
@@ -9234,9 +9159,7 @@ ix86_fp_jump_nontrivial_p (code)
 }
 
 void
-ix86_expand_branch (code, label)
-     enum rtx_code code;
-     rtx label;
+ix86_expand_branch (enum rtx_code code, rtx label)
 {
   rtx tmp;
 
@@ -9256,7 +9179,6 @@ ix86_expand_branch (code, label)
     case SFmode:
     case DFmode:
     case XFmode:
-    case TFmode:
       {
        rtvec vec;
        int use_fcomi;
@@ -9422,9 +9344,8 @@ ix86_expand_branch (code, label)
 
 /* Split branch based on floating point condition.  */
 void
-ix86_split_fp_branch (code, op1, op2, target1, target2, tmp)
-     enum rtx_code code;
-     rtx op1, op2, target1, target2, tmp;
+ix86_split_fp_branch (enum rtx_code code, rtx op1, rtx op2,
+                     rtx target1, rtx target2, rtx tmp)
 {
   rtx second, bypass;
   rtx label = NULL_RTX;
@@ -9500,11 +9421,9 @@ ix86_split_fp_branch (code, op1, op2, target1, target2, tmp)
 }
 
 int
-ix86_expand_setcc (code, dest)
-     enum rtx_code code;
-     rtx dest;
+ix86_expand_setcc (enum rtx_code code, rtx dest)
 {
-  rtx ret, tmp, tmpreg;
+  rtx ret, tmp, tmpreg, equiv;
   rtx second_test, bypass_test;
 
   if (GET_MODE (ix86_compare_op0) == DImode
@@ -9543,15 +9462,19 @@ ix86_expand_setcc (code, dest)
        emit_insn (gen_iorqi3 (tmp, tmpreg, tmp2));
     }
 
+  /* Attach a REG_EQUAL note describing the comparison result.  */
+  equiv = simplify_gen_relational (code, QImode,
+                                  GET_MODE (ix86_compare_op0),
+                                  ix86_compare_op0, ix86_compare_op1);
+  set_unique_reg_note (get_last_insn (), REG_EQUAL, equiv);
+
   return 1; /* DONE */
 }
 
-/* Expand comparison setting or clearing carry flag.  Return true when successful
-   and set pop for the operation.  */
-bool
-ix86_expand_carry_flag_compare (code, op0, op1, pop)
-     rtx op0, op1, *pop;
-     enum rtx_code code;
+/* Expand comparison setting or clearing carry flag.  Return true when
+   successful and set pop for the operation.  */
+static bool
+ix86_expand_carry_flag_compare (enum rtx_code code, rtx op0, rtx op1, rtx *pop)
 {
   enum machine_mode mode =
     GET_MODE (op0) != VOIDmode ? GET_MODE (op0) : GET_MODE (op1);
@@ -9580,9 +9503,9 @@ ix86_expand_carry_flag_compare (code, op0, op1, pop)
          code = swap_condition (code);
        }
 
-      /* Try to expand the comparsion and verify that we end up with carry flag
-        based comparsion.  This is fails to be true only when we decide to expand
-        comparsion using arithmetic that is not too common scenario.  */
+      /* Try to expand the comparison and verify that we end up with carry flag
+        based comparison.  This is fails to be true only when we decide to expand
+        comparison using arithmetic that is not too common scenario.  */
       start_sequence ();
       compare_op = ix86_expand_fp_compare (code, op0, op1, NULL_RTX,
                                           &second_test, &bypass_test);
@@ -9641,25 +9564,32 @@ ix86_expand_carry_flag_compare (code, op0, op1, pop)
        }
       break;
 
-    /* Convert a>0 into (unsigned)a<0x7fffffff.  */
+    /* Convert a>=0 into (unsigned)a<0x80000000.  */
     case LT:
     case GE:
       if (mode == DImode || op1 != const0_rtx)
        return false;
-      op1 = gen_int_mode (~(1 << (GET_MODE_BITSIZE (mode) - 1)), mode);
+      op1 = gen_int_mode (1 << (GET_MODE_BITSIZE (mode) - 1), mode);
       code = (code == LT ? GEU : LTU);
       break;
     case LE:
     case GT:
       if (mode == DImode || op1 != constm1_rtx)
        return false;
-      op1 = gen_int_mode (~(1 << (GET_MODE_BITSIZE (mode) - 1)), mode);
+      op1 = gen_int_mode (1 << (GET_MODE_BITSIZE (mode) - 1), mode);
       code = (code == LE ? GEU : LTU);
       break;
 
     default:
       return false;
     }
+  /* Swapping operands may cause constant to appear as first operand.  */
+  if (!nonimmediate_operand (op0, VOIDmode))
+    {
+      if (no_new_pseudos)
+       return false;
+      op0 = force_reg (mode, op0);
+    }
   ix86_compare_op0 = op0;
   ix86_compare_op1 = op1;
   *pop = ix86_expand_compare (code, NULL, NULL);
@@ -9669,8 +9599,7 @@ ix86_expand_carry_flag_compare (code, op0, op1, pop)
 }
 
 int
-ix86_expand_int_movcc (operands)
-     rtx operands[];
+ix86_expand_int_movcc (rtx operands[])
 {
   enum rtx_code code = GET_CODE (operands[1]), compare_code;
   rtx compare_seq, compare_op;
@@ -9704,7 +9633,7 @@ ix86_expand_int_movcc (operands)
 
       diff = ct - cf;
       /*  Sign bit compares are better done using shifts than we do by using
-         sbb.  */
+         sbb.  */
       if (sign_bit_compare_p
          || ix86_expand_carry_flag_compare (code, ix86_compare_op0,
                                             ix86_compare_op1, &compare_op))
@@ -9779,7 +9708,7 @@ ix86_expand_int_movcc (operands)
               * Size 5 - 8.
               */
              if (ct)
-               tmp = expand_simple_binop (mode, PLUS,
+               tmp = expand_simple_binop (mode, PLUS,
                                           tmp, GEN_INT (ct),
                                           copy_rtx (tmp), 1, OPTAB_DIRECT);
            }
@@ -9808,7 +9737,7 @@ ix86_expand_int_movcc (operands)
               */
              tmp = expand_simple_unop (mode, NOT, tmp, copy_rtx (tmp), 1);
              if (cf)
-               tmp = expand_simple_binop (mode, PLUS,
+               tmp = expand_simple_binop (mode, PLUS,
                                           copy_rtx (tmp), GEN_INT (cf),
                                           copy_rtx (tmp), 1, OPTAB_DIRECT);
            }
@@ -9836,7 +9765,7 @@ ix86_expand_int_movcc (operands)
                                         gen_int_mode (cf - ct, mode),
                                         copy_rtx (tmp), 1, OPTAB_DIRECT);
              if (ct)
-               tmp = expand_simple_binop (mode, PLUS,
+               tmp = expand_simple_binop (mode, PLUS,
                                           copy_rtx (tmp), GEN_INT (ct),
                                           copy_rtx (tmp), 1, OPTAB_DIRECT);
            }
@@ -9905,7 +9834,7 @@ ix86_expand_int_movcc (operands)
              if (ct != -1)
                {
                  cf = ct;
-                 ct = -1;
+                 ct = -1;
                  code = reverse_condition (code);
                }
 
@@ -10022,7 +9951,7 @@ ix86_expand_int_movcc (operands)
              /* notl op1       (if needed)
                 sarl $31, op1
                 andl (cf-ct), op1
-                addl ct, op1
+                addl ct, op1
 
                 For x < 0 (resp. x <= -1) there will be no notl,
                 so if possible swap the constants to get rid of the
@@ -10033,13 +9962,13 @@ ix86_expand_int_movcc (operands)
 
              if (compare_code == GE || !cf)
                {
-                 code = reverse_condition (code);
+                 code = reverse_condition (code);
                  compare_code = LT;
                }
              else
                {
                  HOST_WIDE_INT tmp = cf;
-                 cf = ct;
+                 cf = ct;
                  ct = tmp;
                }
 
@@ -10151,7 +10080,7 @@ ix86_expand_int_movcc (operands)
     }
 
   if (! register_operand (operands[2], VOIDmode)
-      && (mode == QImode 
+      && (mode == QImode
           || ! register_operand (operands[3], VOIDmode)))
     operands[2] = force_reg (mode, operands[2]);
 
@@ -10181,8 +10110,7 @@ ix86_expand_int_movcc (operands)
 }
 
 int
-ix86_expand_fp_movcc (operands)
-     rtx operands[];
+ix86_expand_fp_movcc (rtx operands[])
 {
   enum rtx_code code;
   rtx tmp;
@@ -10350,8 +10278,7 @@ ix86_expand_fp_movcc (operands)
    The default case using setcc followed by the conditional move can be
    done by generic code.  */
 int
-ix86_expand_int_addcc (operands)
-     rtx operands[];
+ix86_expand_int_addcc (rtx operands[])
 {
   enum rtx_code code = GET_CODE (operands[1]);
   rtx compare_op;
@@ -10437,15 +10364,12 @@ ix86_expand_int_addcc (operands)
    in the right order.  Maximally three parts are generated.  */
 
 static int
-ix86_split_to_parts (operand, parts, mode)
-     rtx operand;
-     rtx *parts;
-     enum machine_mode mode;
+ix86_split_to_parts (rtx operand, rtx *parts, enum machine_mode mode)
 {
   int size;
 
   if (!TARGET_64BIT)
-    size = mode == TFmode ? 3 : (GET_MODE_SIZE (mode) / 4);
+    size = mode==XFmode ? 3 : GET_MODE_SIZE (mode) / 4;
   else
     size = (GET_MODE_SIZE (mode) + 4) / 8;
 
@@ -10505,7 +10429,6 @@ ix86_split_to_parts (operand, parts, mode)
              switch (mode)
                {
                case XFmode:
-               case TFmode:
                  REAL_VALUE_TO_TARGET_LONG_DOUBLE (r, l);
                  parts[2] = gen_int_mode (l[2], SImode);
                  break;
@@ -10528,18 +10451,19 @@ ix86_split_to_parts (operand, parts, mode)
        split_ti (&operand, 1, &parts[0], &parts[1]);
       if (mode == XFmode || mode == TFmode)
        {
+         enum machine_mode upper_mode = mode==XFmode ? SImode : DImode;
          if (REG_P (operand))
            {
              if (!reload_completed)
                abort ();
              parts[0] = gen_rtx_REG (DImode, REGNO (operand) + 0);
-             parts[1] = gen_rtx_REG (SImode, REGNO (operand) + 1);
+             parts[1] = gen_rtx_REG (upper_mode, REGNO (operand) + 1);
            }
          else if (offsettable_memref_p (operand))
            {
              operand = adjust_address (operand, DImode, 0);
              parts[0] = operand;
-             parts[1] = adjust_address (operand, SImode, 8);
+             parts[1] = adjust_address (operand, upper_mode, 8);
            }
          else if (GET_CODE (operand) == CONST_DOUBLE)
            {
@@ -10557,7 +10481,16 @@ ix86_split_to_parts (operand, parts, mode)
                       DImode);
              else
                parts[0] = immed_double_const (l[0], l[1], DImode);
-             parts[1] = gen_int_mode (l[2], SImode);
+             if (upper_mode == SImode)
+               parts[1] = gen_int_mode (l[2], SImode);
+             else if (HOST_BITS_PER_WIDE_INT >= 64)
+               parts[1]
+                 = gen_int_mode
+                     ((l[2] & (((HOST_WIDE_INT) 2 << 31) - 1))
+                      + ((((HOST_WIDE_INT) l[3]) << 31) << 1),
+                      DImode);
+             else
+               parts[1] = immed_double_const (l[2], l[3], DImode);
            }
          else
            abort ();
@@ -10573,8 +10506,7 @@ ix86_split_to_parts (operand, parts, mode)
    int the correct order; operands 5-7 contain the output values.  */
 
 void
-ix86_split_long_move (operands)
-     rtx operands[];
+ix86_split_long_move (rtx operands[])
 {
   rtx part[2][3];
   int nparts;
@@ -10679,12 +10611,8 @@ ix86_split_long_move (operands)
        {
          if (nparts == 3)
            {
-             /* We use only first 12 bytes of TFmode value, but for pushing we
-                are required to adjust stack as if we were pushing real 16byte
-                value.  */
-             if (mode == TFmode && !TARGET_64BIT)
-               emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
-                                      GEN_INT (-4)));
+             if (TARGET_128BIT_LONG_DOUBLE && mode == XFmode)
+                emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx, GEN_INT (-4)));
              emit_move_insn (part[0][2], part[1][2]);
            }
        }
@@ -10765,8 +10693,7 @@ ix86_split_long_move (operands)
 }
 
 void
-ix86_split_ashldi (operands, scratch)
-     rtx *operands, scratch;
+ix86_split_ashldi (rtx *operands, rtx scratch)
 {
   rtx low[2], high[2];
   int count;
@@ -10818,8 +10745,7 @@ ix86_split_ashldi (operands, scratch)
 }
 
 void
-ix86_split_ashrdi (operands, scratch)
-     rtx *operands, scratch;
+ix86_split_ashrdi (rtx *operands, rtx scratch)
 {
   rtx low[2], high[2];
   int count;
@@ -10877,8 +10803,7 @@ ix86_split_ashrdi (operands, scratch)
 }
 
 void
-ix86_split_lshrdi (operands, scratch)
-     rtx *operands, scratch;
+ix86_split_lshrdi (rtx *operands, rtx scratch)
 {
   rtx low[2], high[2];
   int count;
@@ -10933,9 +10858,7 @@ ix86_split_lshrdi (operands, scratch)
 /* Helper function for the string operations below.  Dest VARIABLE whether
    it is aligned to VALUE bytes.  If true, jump to the label.  */
 static rtx
-ix86_expand_aligntest (variable, value)
-     rtx variable;
-     int value;
+ix86_expand_aligntest (rtx variable, int value)
 {
   rtx label = gen_label_rtx ();
   rtx tmpcount = gen_reg_rtx (GET_MODE (variable));
@@ -10950,9 +10873,7 @@ ix86_expand_aligntest (variable, value)
 
 /* Adjust COUNTER by the VALUE.  */
 static void
-ix86_adjust_counter (countreg, value)
-     rtx countreg;
-     HOST_WIDE_INT value;
+ix86_adjust_counter (rtx countreg, HOST_WIDE_INT value)
 {
   if (GET_MODE (countreg) == DImode)
     emit_insn (gen_adddi3 (countreg, countreg, GEN_INT (-value)));
@@ -10962,8 +10883,7 @@ ix86_adjust_counter (countreg, value)
 
 /* Zero extend possibly SImode EXP to Pmode register.  */
 rtx
-ix86_zero_extend_to_Pmode (exp)
-   rtx exp;
+ix86_zero_extend_to_Pmode (rtx exp)
 {
   rtx r;
   if (GET_MODE (exp) == VOIDmode)
@@ -10978,8 +10898,7 @@ ix86_zero_extend_to_Pmode (exp)
 /* Expand string move (memcpy) operation.  Use i386 string operations when
    profitable.  expand_clrstr contains similar code.  */
 int
-ix86_expand_movstr (dst, src, count_exp, align_exp)
-     rtx dst, src, count_exp, align_exp;
+ix86_expand_movstr (rtx dst, rtx src, rtx count_exp, rtx align_exp)
 {
   rtx srcreg, destreg, countreg;
   enum machine_mode counter_mode;
@@ -11089,7 +11008,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
 
       /* In case we don't know anything about the alignment, default to
          library version, since it is usually equally fast and result in
-         shorter code. 
+         shorter code.
 
         Also emit call when we know that the count is large and call overhead
         will not be important.  */
@@ -11217,8 +11136,7 @@ ix86_expand_movstr (dst, src, count_exp, align_exp)
 /* Expand string clear operation (bzero).  Use i386 string operations when
    profitable.  expand_movstr contains similar code.  */
 int
-ix86_expand_clrstr (src, count_exp, align_exp)
-     rtx src, count_exp, align_exp;
+ix86_expand_clrstr (rtx src, rtx count_exp, rtx align_exp)
 {
   rtx destreg, zeroreg, countreg;
   enum machine_mode counter_mode;
@@ -11432,8 +11350,7 @@ ix86_expand_clrstr (src, count_exp, align_exp)
 }
 /* Expand strlen.  */
 int
-ix86_expand_strlen (out, src, eoschar, align)
-     rtx out, src, eoschar, align;
+ix86_expand_strlen (rtx out, rtx src, rtx eoschar, rtx align)
 {
   rtx addr, scratch1, scratch2, scratch3, scratch4;
 
@@ -11508,12 +11425,11 @@ ix86_expand_strlen (out, src, eoschar, align)
    scratch = scratch register, initialized with the startaddress when
        not aligned, otherwise undefined
 
-   This is just the body. It needs the initialisations mentioned above and
+   This is just the body. It needs the initializations mentioned above and
    some address computing at the end.  These things are done in i386.md.  */
 
 static void
-ix86_expand_strlensi_unroll_1 (out, align_rtx)
-     rtx out, align_rtx;
+ix86_expand_strlensi_unroll_1 (rtx out, rtx align_rtx)
 {
   int align;
   rtx tmp;
@@ -11693,9 +11609,9 @@ ix86_expand_strlensi_unroll_1 (out, align_rtx)
 }
 
 void
-ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop, sibcall)
-     rtx retval, fnaddr, callarg1, callarg2, pop;
-     int sibcall;
+ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
+                 rtx callarg2 ATTRIBUTE_UNUSED,
+                 rtx pop, int sibcall)
 {
   rtx use = NULL, call;
 
@@ -11732,7 +11648,7 @@ ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop, sibcall)
     {
       rtx addr;
       addr = copy_to_mode_reg (Pmode, XEXP (fnaddr, 0));
-      fnaddr = gen_rtx_REG (Pmode, 40);
+      fnaddr = gen_rtx_REG (Pmode, FIRST_REX_INT_REG + 3 /* R11 */);
       emit_move_insn (fnaddr, addr);
       fnaddr = gen_rtx_MEM (QImode, fnaddr);
     }
@@ -11758,7 +11674,7 @@ ix86_expand_call (retval, fnaddr, callarg1, callarg2, pop, sibcall)
    function.  */
 
 static struct machine_function *
-ix86_init_machine_status ()
+ix86_init_machine_status (void)
 {
   struct machine_function *f;
 
@@ -11775,9 +11691,7 @@ ix86_init_machine_status ()
    which slot to use.  */
 
 rtx
-assign_386_stack_local (mode, n)
-     enum machine_mode mode;
-     int n;
+assign_386_stack_local (enum machine_mode mode, int n)
 {
   struct stack_local_entry *s;
 
@@ -11803,7 +11717,7 @@ assign_386_stack_local (mode, n)
 
 static GTY(()) rtx ix86_tls_symbol;
 rtx
-ix86_tls_get_addr ()
+ix86_tls_get_addr (void)
 {
 
   if (!ix86_tls_symbol)
@@ -11821,8 +11735,7 @@ ix86_tls_get_addr ()
    encoding.  Does not include the one-byte modrm, opcode, or prefix.  */
 
 static int
-memory_address_length (addr)
-     rtx addr;
+memory_address_length (rtx addr)
 {
   struct ix86_address parts;
   rtx base, index, disp;
@@ -11842,10 +11755,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
@@ -11869,9 +11787,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;
     }
 
@@ -11881,9 +11806,7 @@ memory_address_length (addr)
 /* Compute default value for "length_immediate" attribute.  When SHORTFORM
    is set, expect that insn have 8bit immediate alternative.  */
 int
-ix86_attr_length_immediate_default (insn, shortform)
-     rtx insn;
-     int shortform;
+ix86_attr_length_immediate_default (rtx insn, int shortform)
 {
   int len = 0;
   int i;
@@ -11923,8 +11846,7 @@ ix86_attr_length_immediate_default (insn, shortform)
 }
 /* Compute default value for "length_address" attribute.  */
 int
-ix86_attr_length_address_default (insn)
-     rtx insn;
+ix86_attr_length_address_default (rtx insn)
 {
   int i;
 
@@ -11960,7 +11882,7 @@ ix86_attr_length_address_default (insn)
 /* Return the maximum number of instructions a cpu can issue.  */
 
 static int
-ix86_issue_rate ()
+ix86_issue_rate (void)
 {
   switch (ix86_tune)
     {
@@ -11983,9 +11905,7 @@ ix86_issue_rate ()
    by DEP_INSN and nothing set by DEP_INSN.  */
 
 static int
-ix86_flags_dependant (insn, dep_insn, insn_type)
-     rtx insn, dep_insn;
-     enum attr_type insn_type;
+ix86_flags_dependant (rtx insn, rtx dep_insn, enum attr_type insn_type)
 {
   rtx set, set2;
 
@@ -12030,9 +11950,7 @@ ix86_flags_dependant (insn, dep_insn, insn_type)
    address with operands set by DEP_INSN.  */
 
 static int
-ix86_agi_dependant (insn, dep_insn, insn_type)
-     rtx insn, dep_insn;
-     enum attr_type insn_type;
+ix86_agi_dependant (rtx insn, rtx dep_insn, enum attr_type insn_type)
 {
   rtx addr;
 
@@ -12067,9 +11985,7 @@ ix86_agi_dependant (insn, dep_insn, insn_type)
 }
 
 static int
-ix86_adjust_cost (insn, link, dep_insn, cost)
-     rtx insn, link, dep_insn;
-     int cost;
+ix86_adjust_cost (rtx insn, rtx link, rtx dep_insn, int cost)
 {
   enum attr_type insn_type, dep_insn_type;
   enum attr_memory memory, dep_memory;
@@ -12135,7 +12051,7 @@ ix86_adjust_cost (insn, link, dep_insn, cost)
         previous instruction is not needed to compute the address.  */
       if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
          && !ix86_agi_dependant (insn, dep_insn, insn_type))
-       {
+       {
          /* Claim moves to take one cycle, as core can issue one load
             at time and the next load can start cycle later.  */
          if (dep_insn_type == TYPE_IMOV
@@ -12169,7 +12085,7 @@ ix86_adjust_cost (insn, link, dep_insn, cost)
         previous instruction is not needed to compute the address.  */
       if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
          && !ix86_agi_dependant (insn, dep_insn, insn_type))
-       {
+       {
          /* Claim moves to take one cycle, as core can issue one load
             at time and the next load can start cycle later.  */
          if (dep_insn_type == TYPE_IMOV
@@ -12192,15 +12108,15 @@ ix86_adjust_cost (insn, link, dep_insn, cost)
         previous instruction is not needed to compute the address.  */
       if ((memory == MEMORY_LOAD || memory == MEMORY_BOTH)
          && !ix86_agi_dependant (insn, dep_insn, insn_type))
-       {
+       {
          enum attr_unit unit = get_attr_unit (insn);
          int loadcost = 3;
 
          /* Because of the difference between the length of integer and
             floating unit pipeline preparation stages, the memory operands
-            for floating point are cheaper. 
+            for floating point are cheaper.
 
-            ??? For Athlon it the difference is most propbably 2.  */
+            ??? For Athlon it the difference is most probably 2.  */
          if (unit == UNIT_INTEGER || unit == UNIT_UNKNOWN)
            loadcost = 3;
          else
@@ -12229,8 +12145,7 @@ static union
 } ix86_sched_data;
 
 static enum attr_ppro_uops
-ix86_safe_ppro_uops (insn)
-     rtx insn;
+ix86_safe_ppro_uops (rtx insn)
 {
   if (recog_memoized (insn) >= 0)
     return get_attr_ppro_uops (insn);
@@ -12239,8 +12154,7 @@ ix86_safe_ppro_uops (insn)
 }
 
 static void
-ix86_dump_ppro_packet (dump)
-     FILE *dump;
+ix86_dump_ppro_packet (FILE *dump)
 {
   if (ix86_sched_data.ppro.decode[0])
     {
@@ -12257,10 +12171,9 @@ ix86_dump_ppro_packet (dump)
 /* We're beginning a new block.  Initialize data structures as necessary.  */
 
 static void
-ix86_sched_init (dump, sched_verbose, veclen)
-     FILE *dump ATTRIBUTE_UNUSED;
-     int sched_verbose ATTRIBUTE_UNUSED;
-     int veclen ATTRIBUTE_UNUSED;
+ix86_sched_init (FILE *dump ATTRIBUTE_UNUSED,
+                int sched_verbose ATTRIBUTE_UNUSED,
+                int veclen ATTRIBUTE_UNUSED)
 {
   memset (&ix86_sched_data, 0, sizeof (ix86_sched_data));
 }
@@ -12268,8 +12181,7 @@ ix86_sched_init (dump, sched_verbose, veclen)
 /* Shift INSN to SLOT, and shift everything else down.  */
 
 static void
-ix86_reorder_insn (insnp, slot)
-     rtx *insnp, *slot;
+ix86_reorder_insn (rtx *insnp, rtx *slot)
 {
   if (insnp != slot)
     {
@@ -12282,9 +12194,7 @@ ix86_reorder_insn (insnp, slot)
 }
 
 static void
-ix86_sched_reorder_ppro (ready, e_ready)
-     rtx *ready;
-     rtx *e_ready;
+ix86_sched_reorder_ppro (rtx *ready, rtx *e_ready)
 {
   rtx decode[3];
   enum attr_ppro_uops cur_uops;
@@ -12369,12 +12279,9 @@ ix86_sched_reorder_ppro (ready, e_ready)
 /* We are about to being issuing insns for this clock cycle.
    Override the default sort algorithm to better slot instructions.  */
 static int
-ix86_sched_reorder (dump, sched_verbose, ready, n_readyp, clock_var)
-     FILE *dump ATTRIBUTE_UNUSED;
-     int sched_verbose ATTRIBUTE_UNUSED;
-     rtx *ready;
-     int *n_readyp;
-     int clock_var ATTRIBUTE_UNUSED;
+ix86_sched_reorder (FILE *dump ATTRIBUTE_UNUSED,
+                   int sched_verbose ATTRIBUTE_UNUSED, rtx *ready,
+                   int *n_readyp, int clock_var ATTRIBUTE_UNUSED)
 {
   int n_ready = *n_readyp;
   rtx *e_ready = ready + n_ready - 1;
@@ -12406,11 +12313,8 @@ out:
    ready queue that can be issued this cycle.  */
 
 static int
-ix86_variable_issue (dump, sched_verbose, insn, can_issue_more)
-     FILE *dump;
-     int sched_verbose;
-     rtx insn;
-     int can_issue_more;
+ix86_variable_issue (FILE *dump, int sched_verbose, rtx insn,
+                    int can_issue_more)
 {
   int i;
   switch (ix86_tune)
@@ -12466,7 +12370,7 @@ ix86_variable_issue (dump, sched_verbose, insn, can_issue_more)
 }
 
 static int
-ia32_use_dfa_pipeline_interface ()
+ia32_use_dfa_pipeline_interface (void)
 {
   if (TARGET_PENTIUM || TARGET_ATHLON_K8)
     return 1;
@@ -12478,7 +12382,7 @@ ia32_use_dfa_pipeline_interface ()
    large results extra work for the scheduler.  */
 
 static int
-ia32_multipass_dfa_lookahead ()
+ia32_multipass_dfa_lookahead (void)
 {
   if (ix86_tune == PROCESSOR_PENTIUM)
     return 2;
@@ -12492,9 +12396,8 @@ ia32_multipass_dfa_lookahead ()
    appropriate.  */
 
 void
-ix86_set_move_mem_attrs (insns, dstref, srcref, dstreg, srcreg)
-     rtx insns;
-     rtx dstref, srcref, dstreg, srcreg;
+ix86_set_move_mem_attrs (rtx insns, rtx dstref, rtx srcref, rtx dstreg,
+                        rtx srcreg)
 {
   rtx insn;
 
@@ -12508,9 +12411,8 @@ ix86_set_move_mem_attrs (insns, dstref, srcref, dstreg, srcreg)
    the rtx.  */
 
 static void
-ix86_set_move_mem_attrs_1 (x, dstref, srcref, dstreg, srcreg)
-     rtx x;
-     rtx dstref, srcref, dstreg, srcreg;
+ix86_set_move_mem_attrs_1 (rtx x, rtx dstref, rtx srcref, rtx dstreg,
+                          rtx srcreg)
 {
   enum rtx_code code = GET_CODE (x);
   const char *format_ptr = GET_RTX_FORMAT (code);
@@ -12540,9 +12442,7 @@ ix86_set_move_mem_attrs_1 (x, dstref, srcref, dstreg, srcreg)
    the object.  */
 
 int
-ix86_constant_alignment (exp, align)
-     tree exp;
-     int align;
+ix86_constant_alignment (tree exp, int align)
 {
   if (TREE_CODE (exp) == REAL_CST)
     {
@@ -12564,9 +12464,7 @@ ix86_constant_alignment (exp, align)
    instead of that alignment to align the object.  */
 
 int
-ix86_data_alignment (type, align)
-     tree type;
-     int align;
+ix86_data_alignment (tree type, int align)
 {
   if (AGGREGATE_TYPE_P (type)
        && TYPE_SIZE (type)
@@ -12630,9 +12528,7 @@ ix86_data_alignment (type, align)
    instead of that alignment to align the object.  */
 
 int
-ix86_local_alignment (type, align)
-     tree type;
-     int align;
+ix86_local_alignment (tree type, int align)
 {
   /* x86-64 ABI requires arrays greater than 16 bytes to be aligned
      to 16byte boundary.  */
@@ -12685,8 +12581,7 @@ ix86_local_alignment (type, align)
    FNADDR is an RTX for the address of the function's pure code.
    CXT is an RTX for the static chain value for the function.  */
 void
-x86_initialize_trampoline (tramp, fnaddr, cxt)
-     rtx tramp, fnaddr, cxt;
+x86_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
 {
   if (!TARGET_64BIT)
     {
@@ -12764,25 +12659,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 },
@@ -12800,51 +12690,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 },
@@ -12867,15 +12757,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 },
@@ -12884,10 +12774,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 },
@@ -12901,9 +12791,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 },
@@ -12924,7 +12814,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 */
@@ -13054,26 +12944,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 },
@@ -13095,18 +12993,23 @@ 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
-ix86_init_builtins ()
+ix86_init_builtins (void)
 {
   if (TARGET_MMX)
     ix86_init_mmx_sse_builtins ();
@@ -13116,7 +13019,7 @@ ix86_init_builtins ()
    is zero.  Otherwise, if TARGET_SSE is not set, only expand the MMX
    builtins.  */
 static void
-ix86_init_mmx_sse_builtins ()
+ix86_init_mmx_sse_builtins (void)
 {
   const struct builtin_description * d;
   size_t i;
@@ -13193,6 +13096,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
@@ -13306,7 +13216,7 @@ ix86_init_mmx_sse_builtins ()
     = build_function_type_list (integer_type_node, V2DF_type_node, NULL_TREE);
   tree int64_ftype_v2df
     = build_function_type_list (long_long_integer_type_node,
-                               V2DF_type_node, NULL_TREE);
+                               V2DF_type_node, NULL_TREE);
   tree v2df_ftype_v2df_int
     = build_function_type_list (V2DF_type_node,
                                V2DF_type_node, integer_type_node, NULL_TREE);
@@ -13414,6 +13324,27 @@ ix86_init_mmx_sse_builtins ()
   tree v2di_ftype_v2di
     = build_function_type_list (V2DI_type_node, V2DI_type_node, NULL_TREE);
 
+  tree float80_type;
+  tree float128_type;
+
+  /* The __float80 type.  */
+  if (TYPE_MODE (long_double_type_node) == XFmode)
+    (*lang_hooks.types.register_builtin_type) (long_double_type_node,
+                                              "__float80");
+  else
+    {
+      /* The __float80 type.  */
+      float80_type = make_node (REAL_TYPE);
+      TYPE_PRECISION (float80_type) = 96;
+      layout_type (float80_type);
+      (*lang_hooks.types.register_builtin_type) (float80_type, "__float80");
+    }
+
+  float128_type = make_node (REAL_TYPE);
+  TYPE_PRECISION (float128_type) = 128;
+  layout_type (float128_type);
+  (*lang_hooks.types.register_builtin_type) (float128_type, "__float128");
+
   /* Add all builtins that are more or less simple operations on two
      operands.  */
   for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
@@ -13511,52 +13442,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);
@@ -13588,7 +13519,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);
@@ -13639,15 +13570,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);
 
@@ -13671,7 +13602,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);
@@ -13698,15 +13629,33 @@ 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
    where we expect a vector.  To avoid crashing, use one of the vector
    clear instructions.  */
 static rtx
-safe_vector_operand (x, mode)
-     rtx x;
-     enum machine_mode mode;
+safe_vector_operand (rtx x, enum machine_mode mode)
 {
   if (x != const0_rtx)
     return x;
@@ -13725,10 +13674,7 @@ safe_vector_operand (x, mode)
 /* Subroutine of ix86_expand_builtin to take care of binop insns.  */
 
 static rtx
-ix86_expand_binop_builtin (icode, arglist, target)
-     enum insn_code icode;
-     tree arglist;
-     rtx target;
+ix86_expand_binop_builtin (enum insn_code icode, tree arglist, rtx target)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13758,7 +13704,8 @@ ix86_expand_binop_builtin (icode, arglist, target)
 
   /* In case the insn wants input operands in modes different from
      the result, abort.  */
-  if (GET_MODE (op0) != mode0 || GET_MODE (op1) != mode1)
+  if ((GET_MODE (op0) != mode0 && GET_MODE (op0) != VOIDmode)
+      || (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode))
     abort ();
 
   if (! (*insn_data[icode].operand[1].predicate) (op0, mode0))
@@ -13782,9 +13729,7 @@ ix86_expand_binop_builtin (icode, arglist, target)
 /* Subroutine of ix86_expand_builtin to take care of stores.  */
 
 static rtx
-ix86_expand_store_builtin (icode, arglist)
-     enum insn_code icode;
-     tree arglist;
+ix86_expand_store_builtin (enum insn_code icode, tree arglist)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13809,11 +13754,8 @@ ix86_expand_store_builtin (icode, arglist)
 /* Subroutine of ix86_expand_builtin to take care of unop insns.  */
 
 static rtx
-ix86_expand_unop_builtin (icode, arglist, target, do_load)
-     enum insn_code icode;
-     tree arglist;
-     rtx target;
-     int do_load;
+ix86_expand_unop_builtin (enum insn_code icode, tree arglist,
+                         rtx target, int do_load)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13847,10 +13789,7 @@ ix86_expand_unop_builtin (icode, arglist, target, do_load)
    sqrtss, rsqrtss, rcpss.  */
 
 static rtx
-ix86_expand_unop1_builtin (icode, arglist, target)
-     enum insn_code icode;
-     tree arglist;
-     rtx target;
+ix86_expand_unop1_builtin (enum insn_code icode, tree arglist, rtx target)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13883,10 +13822,8 @@ ix86_expand_unop1_builtin (icode, arglist, target)
 /* Subroutine of ix86_expand_builtin to take care of comparison insns.  */
 
 static rtx
-ix86_expand_sse_compare (d, arglist, target)
-     const struct builtin_description *d;
-     tree arglist;
-     rtx target;
+ix86_expand_sse_compare (const struct builtin_description *d, tree arglist,
+                        rtx target)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13935,10 +13872,8 @@ ix86_expand_sse_compare (d, arglist, target)
 /* Subroutine of ix86_expand_builtin to take care of comi insns.  */
 
 static rtx
-ix86_expand_sse_comi (d, arglist, target)
-     const struct builtin_description *d;
-     tree arglist;
-     rtx target;
+ix86_expand_sse_comi (const struct builtin_description *d, tree arglist,
+                     rtx target)
 {
   rtx pat;
   tree arg0 = TREE_VALUE (arglist);
@@ -13994,12 +13929,9 @@ ix86_expand_sse_comi (d, arglist, target)
    IGNORE is nonzero if the value is to be ignored.  */
 
 rtx
-ix86_expand_builtin (exp, target, subtarget, mode, ignore)
-     tree exp;
-     rtx target;
-     rtx subtarget ATTRIBUTE_UNUSED;
-     enum machine_mode mode ATTRIBUTE_UNUSED;
-     int ignore ATTRIBUTE_UNUSED;
+ix86_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
+                    enum machine_mode mode ATTRIBUTE_UNUSED,
+                    int ignore ATTRIBUTE_UNUSED)
 {
   const struct builtin_description *d;
   size_t i;
@@ -14038,8 +13970,8 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore)
        op0 = copy_to_mode_reg (mode0, op0);
       if (! (*insn_data[icode].operand[2].predicate) (op1, mode1))
        {
-         /* @@@ better error message */
-         error ("selector must be an immediate");
+         error ("selector must be an integer constant in the range 0..%i",
+                 fcode == IX86_BUILTIN_PEXTRW ? 3:7);
          return gen_reg_rtx (tmode);
        }
       if (target == 0
@@ -14074,8 +14006,8 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore)
        op1 = copy_to_mode_reg (mode1, op1);
       if (! (*insn_data[icode].operand[3].predicate) (op2, mode2))
        {
-         /* @@@ better error message */
-         error ("selector must be an immediate");
+         error ("selector must be an integer constant in the range 0..%i",
+                 fcode == IX86_BUILTIN_PINSRW ? 15:255);
          return const0_rtx;
        }
       if (target == 0
@@ -14507,6 +14439,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;
     }
@@ -14543,9 +14510,7 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore)
 /* Store OPERAND to the memory after reload is completed.  This means
    that we can't easily use assign_stack_local.  */
 rtx
-ix86_force_to_memory (mode, operand)
-     enum machine_mode mode;
-     rtx operand;
+ix86_force_to_memory (enum machine_mode mode, rtx operand)
 {
   rtx result;
   if (!reload_completed)
@@ -14624,8 +14589,7 @@ ix86_force_to_memory (mode, operand)
 
 /* Free operand from the memory.  */
 void
-ix86_free_from_memory (mode)
-     enum machine_mode mode;
+ix86_free_from_memory (enum machine_mode mode)
 {
   if (!TARGET_RED_ZONE)
     {
@@ -14650,9 +14614,7 @@ ix86_free_from_memory (mode)
    Narrow ALL_REGS to GENERAL_REGS.  This supports allowing movsf and
    movdf to do mem-to-mem moves through integer regs.  */
 enum reg_class
-ix86_preferred_reload_class (x, class)
-     rtx x;
-     enum reg_class class;
+ix86_preferred_reload_class (rtx x, enum reg_class class)
 {
   if (GET_CODE (x) == CONST_VECTOR && x != CONST0_RTX (GET_MODE (x)))
     return NO_REGS;
@@ -14696,10 +14658,8 @@ ix86_preferred_reload_class (x, class)
    When STRICT is false, we are being called from REGISTER_MOVE_COST, so do not
    enforce these sanity checks.  */
 int
-ix86_secondary_memory_needed (class1, class2, mode, strict)
-     enum reg_class class1, class2;
-     enum machine_mode mode;
-     int strict;
+ix86_secondary_memory_needed (enum reg_class class1, enum reg_class class2,
+                             enum machine_mode mode, int strict)
 {
   if (MAYBE_FLOAT_CLASS_P (class1) != FLOAT_CLASS_P (class1)
       || MAYBE_FLOAT_CLASS_P (class2) != FLOAT_CLASS_P (class2)
@@ -14726,12 +14686,11 @@ ix86_secondary_memory_needed (class1, class2, mode, strict)
    on some machines it is expensive to move between registers if they are not
    general registers.  */
 int
-ix86_register_move_cost (mode, class1, class2)
-     enum machine_mode mode;
-     enum reg_class class1, class2;
+ix86_register_move_cost (enum machine_mode mode, enum reg_class class1,
+                        enum reg_class class2)
 {
   /* In case we require secondary memory, compute cost of the store followed
-     by load.  In order to avoid bad register allocation choices, we need 
+     by load.  In order to avoid bad register allocation choices, we need
      for this to be *at least* as high as the symmetric MEMORY_MOVE_COST.  */
 
   if (ix86_secondary_memory_needed (class1, class2, mode, 0))
@@ -14742,7 +14701,7 @@ ix86_register_move_cost (mode, class1, class2)
                   MEMORY_MOVE_COST (mode, class1, 1));
       cost += MAX (MEMORY_MOVE_COST (mode, class2, 0),
                   MEMORY_MOVE_COST (mode, class2, 1));
-      
+
       /* In case of copying from general_purpose_register we may emit multiple
          stores followed by single load causing memory size mismatch stall.
          Count this as arbitrarily high cost of 20.  */
@@ -14773,9 +14732,7 @@ ix86_register_move_cost (mode, class1, class2)
 
 /* Return 1 if hard register REGNO can hold a value of machine-mode MODE.  */
 int
-ix86_hard_regno_mode_ok (regno, mode)
-     int regno;
-     enum machine_mode mode;
+ix86_hard_regno_mode_ok (int regno, enum machine_mode mode)
 {
   /* Flags and only flags can only hold CCmode values.  */
   if (CC_REGNO_P (regno))
@@ -14814,10 +14771,7 @@ ix86_hard_regno_mode_ok (regno, mode)
    Q_REGS classes.
  */
 int
-ix86_memory_move_cost (mode, class, in)
-     enum machine_mode mode;
-     enum reg_class class;
-     int in;
+ix86_memory_move_cost (enum machine_mode mode, enum reg_class class, int in)
 {
   if (FLOAT_CLASS_P (class))
     {
@@ -14831,7 +14785,6 @@ ix86_memory_move_cost (mode, class, in)
            index = 1;
            break;
          case XFmode:
-         case TFmode:
            index = 2;
            break;
          default:
@@ -14891,8 +14844,8 @@ ix86_memory_move_cost (mode, class, in)
        if (mode == TFmode)
          mode = XFmode;
        return ((in ? ix86_cost->int_load[2] : ix86_cost->int_store[2])
-               * ((int) GET_MODE_SIZE (mode)
-                  + UNITS_PER_WORD -1 ) / UNITS_PER_WORD);
+               * (((int) GET_MODE_SIZE (mode)
+                   + UNITS_PER_WORD - 1) / UNITS_PER_WORD));
     }
 }
 
@@ -14901,10 +14854,7 @@ ix86_memory_move_cost (mode, class, in)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-ix86_rtx_costs (x, code, outer_code, total)
-     rtx x;
-     int code, outer_code;
-     int *total;
+ix86_rtx_costs (rtx x, int code, int outer_code, int *total)
 {
   enum machine_mode mode = GET_MODE (x);
 
@@ -15112,7 +15062,7 @@ ix86_rtx_costs (x, code, outer_code, total)
                    + (rtx_cost (XEXP (x, 0), outer_code)
                       << (GET_MODE (XEXP (x, 0)) != DImode))
                    + (rtx_cost (XEXP (x, 1), outer_code)
-                      << (GET_MODE (XEXP (x, 1)) != DImode)));
+                      << (GET_MODE (XEXP (x, 1)) != DImode)));
          return true;
        }
       /* FALLTHRU */
@@ -15159,9 +15109,7 @@ ix86_rtx_costs (x, code, outer_code, total)
 
 #if defined (DO_GLOBAL_CTORS_BODY) && defined (HAS_INIT_SECTION)
 static void
-ix86_svr3_asm_out_constructor (symbol, priority)
-     rtx symbol;
-     int priority ATTRIBUTE_UNUSED;
+ix86_svr3_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
 {
   init_section ();
   fputs ("\tpushl $", asm_out_file);
@@ -15178,9 +15126,7 @@ static int current_machopic_label_num;
    definition of the stub.  */
 
 void
-machopic_output_stub (file, symb, stub)
-     FILE *file;
-     const char *symb, *stub;
+machopic_output_stub (FILE *file, const char *symb, const char *stub)
 {
   unsigned int length;
   char *binder_name, *symbol_name, lazy_ptr_name[32];
@@ -15215,9 +15161,9 @@ machopic_output_stub (file, symb, stub)
     }
   else
     fprintf (file, "\tjmp *%s\n", lazy_ptr_name);
-  
+
   fprintf (file, "%s:\n", binder_name);
-  
+
   if (MACHOPIC_PURE)
     {
       fprintf (file, "\tlea %s-LPC$%d(%%eax),%%eax\n", lazy_ptr_name, label);
@@ -15238,7 +15184,7 @@ machopic_output_stub (file, symb, stub)
 /* Order the registers for register allocator.  */
 
 void
-x86_order_regs_for_local_alloc ()
+x86_order_regs_for_local_alloc (void)
 {
    int pos = 0;
    int i;
@@ -15286,12 +15232,9 @@ x86_order_regs_for_local_alloc ()
 /* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
    struct attribute_spec.handler.  */
 static tree
-ix86_handle_struct_attribute (node, name, args, flags, no_add_attrs)
-     tree *node;
-     tree name;
-     tree args ATTRIBUTE_UNUSED;
-     int flags ATTRIBUTE_UNUSED;
-     bool *no_add_attrs;
+ix86_handle_struct_attribute (tree *node, tree name,
+                             tree args ATTRIBUTE_UNUSED,
+                             int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
 {
   tree *type = NULL;
   if (DECL_P (*node))
@@ -15323,8 +15266,7 @@ ix86_handle_struct_attribute (node, name, args, flags, no_add_attrs)
 }
 
 static bool
-ix86_ms_bitfield_layout_p (record_type)
-     tree record_type;
+ix86_ms_bitfield_layout_p (tree record_type)
 {
   return (TARGET_USE_MS_BITFIELD_LAYOUT &&
          !lookup_attribute ("gcc_struct", TYPE_ATTRIBUTES (record_type)))
@@ -15335,18 +15277,17 @@ ix86_ms_bitfield_layout_p (record_type)
    located on entry to the FUNCTION.  */
 
 static rtx
-x86_this_parameter (function)
-     tree function;
+x86_this_parameter (tree function)
 {
   tree type = TREE_TYPE (function);
 
   if (TARGET_64BIT)
     {
-      int n = aggregate_value_p (TREE_TYPE (type)) != 0;
+      int n = aggregate_value_p (TREE_TYPE (type), type) != 0;
       return gen_rtx_REG (DImode, x86_64_int_parameter_registers[n]);
     }
 
-  if (ix86_fntype_regparm (type) > 0)
+  if (ix86_function_regparm (type, function) > 0)
     {
       tree parm;
 
@@ -15356,12 +15297,17 @@ x86_this_parameter (function)
       for (; parm; parm = TREE_CHAIN (parm))
        if (TREE_VALUE (parm) == void_type_node)
          break;
-      /* If not, the this parameter is in %eax.  */
+      /* If not, the this parameter is in the first argument.  */
       if (parm)
-       return gen_rtx_REG (SImode, 0);
+       {
+         int regno = 0;
+         if (lookup_attribute ("fastcall", TYPE_ATTRIBUTES (type)))
+           regno = 2;
+         return gen_rtx_REG (SImode, regno);
+       }
     }
 
-  if (aggregate_value_p (TREE_TYPE (type)))
+  if (aggregate_value_p (TREE_TYPE (type), type))
     return gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx, 8));
   else
     return gen_rtx_MEM (SImode, plus_constant (stack_pointer_rtx, 4));
@@ -15370,18 +15316,16 @@ x86_this_parameter (function)
 /* Determine whether x86_output_mi_thunk can succeed.  */
 
 static bool
-x86_can_output_mi_thunk (thunk, delta, vcall_offset, function)
-     tree thunk ATTRIBUTE_UNUSED;
-     HOST_WIDE_INT delta ATTRIBUTE_UNUSED;
-     HOST_WIDE_INT vcall_offset;
-     tree function;
+x86_can_output_mi_thunk (tree thunk ATTRIBUTE_UNUSED,
+                        HOST_WIDE_INT delta ATTRIBUTE_UNUSED,
+                        HOST_WIDE_INT vcall_offset, tree function)
 {
   /* 64-bit can handle anything.  */
   if (TARGET_64BIT)
     return true;
 
   /* For 32-bit, everything's fine if we have one free register.  */
-  if (ix86_fntype_regparm (TREE_TYPE (function)) < 3)
+  if (ix86_function_regparm (TREE_TYPE (function), function) < 3)
     return true;
 
   /* Need a free register for vcall_offset.  */
@@ -15403,12 +15347,9 @@ x86_can_output_mi_thunk (thunk, delta, vcall_offset, function)
    *(*this + vcall_offset) should be added to THIS.  */
 
 static void
-x86_output_mi_thunk (file, thunk, delta, vcall_offset, function)
-     FILE *file ATTRIBUTE_UNUSED;
-     tree thunk ATTRIBUTE_UNUSED;
-     HOST_WIDE_INT delta;
-     HOST_WIDE_INT vcall_offset;
-     tree function;
+x86_output_mi_thunk (FILE *file ATTRIBUTE_UNUSED,
+                    tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta,
+                    HOST_WIDE_INT vcall_offset, tree function)
 {
   rtx xops[3];
   rtx this = x86_this_parameter (function);
@@ -15455,7 +15396,13 @@ x86_output_mi_thunk (file, thunk, delta, vcall_offset, function)
       if (TARGET_64BIT)
        tmp = gen_rtx_REG (DImode, FIRST_REX_INT_REG + 2 /* R10 */);
       else
-       tmp = gen_rtx_REG (SImode, 2 /* ECX */);
+       {
+         int tmp_regno = 2 /* ECX */;
+         if (lookup_attribute ("fastcall",
+             TYPE_ATTRIBUTES (TREE_TYPE (function))))
+           tmp_regno = 0 /* EAX */;
+         tmp = gen_rtx_REG (SImode, tmp_regno);
+       }
 
       xops[0] = gen_rtx_MEM (Pmode, this_reg);
       xops[1] = tmp;
@@ -15489,15 +15436,14 @@ x86_output_mi_thunk (file, thunk, delta, vcall_offset, function)
       output_asm_insn ("mov{l}\t{%0, %1|%1, %0}", xops);
     }
 
-  xops[0] = DECL_RTL (function);
+  xops[0] = XEXP (DECL_RTL (function), 0);
   if (TARGET_64BIT)
     {
       if (!flag_pic || (*targetm.binds_local_p) (function))
        output_asm_insn ("jmp\t%P0", xops);
       else
        {
-         tmp = XEXP (xops[0], 0);
-         tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, tmp), UNSPEC_GOTPCREL);
+         tmp = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, xops[0]), UNSPEC_GOTPCREL);
          tmp = gen_rtx_CONST (Pmode, tmp);
          tmp = gen_rtx_MEM (QImode, tmp);
          xops[0] = tmp;
@@ -15512,7 +15458,7 @@ x86_output_mi_thunk (file, thunk, delta, vcall_offset, function)
 #if TARGET_MACHO
        if (TARGET_MACHO)
          {
-           char *ip = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function));
+           const char *ip = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (function));
            tmp = gen_rtx_SYMBOL_REF (Pmode, machopic_stub_name (ip));
            tmp = gen_rtx_MEM (QImode, tmp);
            xops[0] = tmp;
@@ -15531,10 +15477,20 @@ x86_output_mi_thunk (file, thunk, delta, vcall_offset, function)
     }
 }
 
+static void
+x86_file_start (void)
+{
+  default_file_start ();
+  if (X86_FILE_START_VERSION_DIRECTIVE)
+    fputs ("\t.version\t\"01.01\"\n", asm_out_file);
+  if (X86_FILE_START_FLTUSED)
+    fputs ("\t.global\t__fltused\n", asm_out_file);
+  if (ix86_asm_dialect == ASM_INTEL)
+    fputs ("\t.intel_syntax\n", asm_out_file);
+}
+
 int
-x86_field_alignment (field, computed)
-     tree field;
-     int computed;
+x86_field_alignment (tree field, int computed)
 {
   enum machine_mode mode;
   tree type = TREE_TYPE (field);
@@ -15553,9 +15509,7 @@ x86_field_alignment (field, computed)
 /* Output assembler code to FILE to increment profiler label # LABELNO
    for profiling a function entry.  */
 void
-x86_function_profiler (file, labelno)
-     FILE *file;
-     int labelno ATTRIBUTE_UNUSED;
+x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED)
 {
   if (TARGET_64BIT)
     if (flag_pic)
@@ -15592,12 +15546,11 @@ x86_function_profiler (file, labelno)
 
 /* We don't have exact information about the insn sizes, but we may assume
    quite safely that we are informed about all 1 byte insns and memory
-   address sizes.  This is enought to elliminate unnecesary padding in
+   address sizes.  This is enough to eliminate unnecessary padding in
    99% of cases.  */
 
 static int
-min_insn_size (insn)
-     rtx insn;
+min_insn_size (rtx insn)
 {
   int l = 0;
 
@@ -15637,11 +15590,11 @@ min_insn_size (insn)
     return 2;
 }
 
-/* AMD K8 core misspredicts jumps when there are more than 3 jumps in 16 byte
+/* AMD K8 core mispredicts jumps when there are more than 3 jumps in 16 byte
    window.  */
 
 static void
-k8_avoid_jump_misspredicts ()
+k8_avoid_jump_misspredicts (void)
 {
   rtx insn, start = get_insns ();
   int nbytes = 0, njumps = 0;
@@ -15662,7 +15615,7 @@ k8_avoid_jump_misspredicts ()
 
       nbytes += min_insn_size (insn);
       if (rtl_dump_file)
-        fprintf(stderr,"Insn %i estimated to %i bytes\n",
+        fprintf(rtl_dump_file, "Insn %i estimated to %i bytes\n",
                INSN_UID (insn), min_insn_size (insn));
       if ((GET_CODE (insn) == JUMP_INSN
           && GET_CODE (PATTERN (insn)) != ADDR_VEC
@@ -15687,7 +15640,7 @@ k8_avoid_jump_misspredicts ()
       if (njumps < 0)
        abort ();
       if (rtl_dump_file)
-        fprintf(stderr,"Interval %i to %i has %i bytes\n",
+        fprintf(rtl_dump_file, "Interval %i to %i has %i bytes\n",
                INSN_UID (start), INSN_UID (insn), nbytes);
 
       if (njumps == 3 && isjump && nbytes < 16)
@@ -15701,13 +15654,13 @@ k8_avoid_jump_misspredicts ()
     }
 }
 
-/* Implement machine specific optimizations.  
+/* Implement machine specific optimizations.
    At the moment we implement single transformation: AMD Athlon works faster
    when RET is not destination of conditional jump or directly preceded
    by other jump instruction.  We avoid the penalty by inserting NOP just
    before the RET instructions in such cases.  */
 static void
-ix86_reorg ()
+ix86_reorg (void)
 {
   edge e;
 
@@ -15716,7 +15669,7 @@ ix86_reorg ()
   for (e = EXIT_BLOCK_PTR->pred; e; e = e->pred_next)
   {
     basic_block bb = e->src;
-    rtx ret = bb->end;
+    rtx ret = BB_END (bb);
     rtx prev;
     bool replace = false;
 
@@ -15741,7 +15694,7 @@ ix86_reorg ()
            && ((GET_CODE (prev) == JUMP_INSN && any_condjump_p (prev))
                || GET_CODE (prev) == CALL_INSN))
          replace = true;
-       /* Empty functions get branch misspredict even when the jump destination
+       /* Empty functions get branch mispredict even when the jump destination
           is not visible to us.  */
        if (!prev && cfun->function_frequency > FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
          replace = true;
@@ -15758,8 +15711,7 @@ ix86_reorg ()
 /* Return nonzero when QImode register that must be represented via REX prefix
    is used.  */
 bool
-x86_extended_QIreg_mentioned_p (insn)
-     rtx insn;
+x86_extended_QIreg_mentioned_p (rtx insn)
 {
   int i;
   extract_insn_cached (insn);
@@ -15773,9 +15725,7 @@ x86_extended_QIreg_mentioned_p (insn)
 /* Return nonzero when P points to register encoded via REX prefix.
    Called via for_each_rtx.  */
 static int
-extended_reg_mentioned_1 (p, data)
-       rtx *p;
-       void *data ATTRIBUTE_UNUSED;
+extended_reg_mentioned_1 (rtx *p, void *data ATTRIBUTE_UNUSED)
 {
    unsigned int regno;
    if (!REG_P (*p))
@@ -15787,24 +15737,27 @@ extended_reg_mentioned_1 (p, data)
 /* Return true when INSN mentions register that must be encoded using REX
    prefix.  */
 bool
-x86_extended_reg_mentioned_p (insn)
-     rtx insn;
+x86_extended_reg_mentioned_p (rtx insn)
 {
   return for_each_rtx (&PATTERN (insn), extended_reg_mentioned_1, NULL);
 }
 
-/* Generate an unsigned DImode to FP conversion.  This is the same code
+/* Generate an unsigned DImode/SImode to FP conversion.  This is the same code
    optabs would emit if we didn't have TFmode patterns.  */
 
 void
-x86_emit_floatuns (operands)
-     rtx operands[2];
+x86_emit_floatuns (rtx operands[2])
 {
   rtx neglab, donelab, i0, i1, f0, in, out;
-  enum machine_mode mode;
+  enum machine_mode mode, inmode;
+
+  inmode = GET_MODE (operands[1]);
+  if (inmode != SImode
+      && inmode != DImode)
+    abort ();
 
   out = operands[0];
-  in = force_reg (DImode, operands[1]);
+  in = force_reg (inmode, operands[1]);
   mode = GET_MODE (out);
   neglab = gen_label_rtx ();
   donelab = gen_label_rtx ();
@@ -15830,9 +15783,7 @@ x86_emit_floatuns (operands)
 
 /* Return if we do not know how to pass TYPE solely in registers.  */
 bool
-ix86_must_pass_in_stack (mode, type)
-       enum machine_mode mode;
-       tree type;
+ix86_must_pass_in_stack (enum machine_mode mode, tree type)
 {
    if (default_must_pass_in_stack (mode, type))
      return true;