OSDN Git Service

PR middle-end/31723
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / i386.h
index b4352a1..ee1fbbc 100644 (file)
@@ -20,6 +20,35 @@ along with GCC; see the file COPYING.  If not, write to
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* The purpose of this file is to define the characteristics of the i386,
+   independent of assembler syntax or operating system.
+
+   Three other files build on this one to describe a specific assembler syntax:
+   bsd386.h, att386.h, and sun386.h.
+
+   The actual tm.h file for a particular system should include
+   this file, and then the file for the appropriate assembler syntax.
+
+   Many macros that specify assembler syntax are omitted entirely from
+   this file because they really belong in the files for particular
+   assemblers.  These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR,
+   ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
+   that start with ASM_ or end in ASM_OP.  */
+
+/* Redefines for option macros.  */
+
+#define TARGET_64BIT   OPTION_ISA_64BIT
+#define TARGET_MMX     OPTION_ISA_MMX
+#define TARGET_3DNOW   OPTION_ISA_3DNOW
+#define TARGET_3DNOW_A OPTION_ISA_3DNOW_A
+#define TARGET_SSE     OPTION_ISA_SSE
+#define TARGET_SSE2    OPTION_ISA_SSE2
+#define TARGET_SSE3    OPTION_ISA_SSE3
+#define TARGET_SSSE3   OPTION_ISA_SSSE3
+#define TARGET_SSE4_1  OPTION_ISA_SSE4_1
+#define TARGET_SSE4_2  OPTION_ISA_SSE4_2
+#define TARGET_SSE4A   OPTION_ISA_SSE4A
+
 #include "config/vxworks-dummy.h"
 
 /* Algorithm to expand string function with.  */
@@ -34,7 +63,9 @@ enum stringop_alg
    loop,
    unrolled_loop
 };
+
 #define NAX_STRINGOP_ALGS 4
+
 /* Specify what algorithm to use for stringops on known size.
    When size is unknown, the UNKNOWN_SIZE alg is used.  When size is
    known at compile time or estimated via feedback, the SIZE array
@@ -43,8 +74,7 @@ enum stringop_alg
    For example initializer:
     {{256, loop}, {-1, rep_prefix_4_byte}}             
    will use loop for blocks smaller or equal to 256 bytes, rep prefix will
-   be used otherwise.
-*/
+   be used otherwise.  */
 struct stringop_algs
 {
   const enum stringop_alg unknown_size;
@@ -54,21 +84,6 @@ struct stringop_algs
   } size [NAX_STRINGOP_ALGS];
 };
 
-/* The purpose of this file is to define the characteristics of the i386,
-   independent of assembler syntax or operating system.
-
-   Three other files build on this one to describe a specific assembler syntax:
-   bsd386.h, att386.h, and sun386.h.
-
-   The actual tm.h file for a particular system should include
-   this file, and then the file for the appropriate assembler syntax.
-
-   Many macros that specify assembler syntax are omitted entirely from
-   this file because they really belong in the files for particular
-   assemblers.  These include RP, IP, LPREFIX, PUT_OP_SIZE, USE_STAR,
-   ADDR_BEG, ADDR_END, PRINT_IREG, PRINT_SCALE, PRINT_B_I_S, and many
-   that start with ASM_ or end in ASM_OP.  */
-
 /* Define the specific costs for a given cpu */
 
 struct processor_costs {
@@ -191,7 +206,7 @@ enum ix86_tune_indices {
   X86_TUNE_DEEP_BRANCH_PREDICTION,
   X86_TUNE_BRANCH_PREDICTION_HINTS,
   X86_TUNE_DOUBLE_WITH_ADD,
-  X86_TUNE_USE_SAHF,                   /* && !TARGET_64BIT */
+  X86_TUNE_USE_SAHF,
   X86_TUNE_MOVX,
   X86_TUNE_PARTIAL_REG_STALL,
   X86_TUNE_PARTIAL_FLAG_REG_STALL,
@@ -233,6 +248,14 @@ enum ix86_tune_indices {
   X86_TUNE_USE_INCDEC,
   X86_TUNE_PAD_RETURNS,
   X86_TUNE_EXT_80387_CONSTANTS,
+  X86_TUNE_SHORTEN_X87_SSE,
+  X86_TUNE_AVOID_VECTOR_DECODE,
+  X86_TUNE_PROMOTE_HIMODE_IMUL,
+  X86_TUNE_SLOW_IMUL_IMM32_MEM,
+  X86_TUNE_SLOW_IMUL_IMM8,
+  X86_TUNE_MOVE_M1_VIA_OR,
+  X86_TUNE_NOT_UNPAIRABLE,
+  X86_TUNE_NOT_VECTORMODE,
 
   X86_TUNE_LAST
 };
@@ -302,6 +325,17 @@ extern unsigned int ix86_tune_features[X86_TUNE_LAST];
 #define TARGET_PAD_RETURNS     ix86_tune_features[X86_TUNE_PAD_RETURNS]
 #define TARGET_EXT_80387_CONSTANTS \
        ix86_tune_features[X86_TUNE_EXT_80387_CONSTANTS]
+#define TARGET_SHORTEN_X87_SSE ix86_tune_features[X86_TUNE_SHORTEN_X87_SSE]
+#define TARGET_AVOID_VECTOR_DECODE \
+       ix86_tune_features[X86_TUNE_AVOID_VECTOR_DECODE]
+#define TARGET_TUNE_PROMOTE_HIMODE_IMUL \
+       ix86_tune_features[X86_TUNE_PROMOTE_HIMODE_IMUL]
+#define TARGET_SLOW_IMUL_IMM32_MEM \
+       ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM32_MEM]
+#define TARGET_SLOW_IMUL_IMM8  ix86_tune_features[X86_TUNE_SLOW_IMUL_IMM8]
+#define        TARGET_MOVE_M1_VIA_OR   ix86_tune_features[X86_TUNE_MOVE_M1_VIA_OR]
+#define TARGET_NOT_UNPAIRABLE  ix86_tune_features[X86_TUNE_NOT_UNPAIRABLE]
+#define TARGET_NOT_VECTORMODE  ix86_tune_features[X86_TUNE_NOT_VECTORMODE]
 
 /* Feature tests against the various architecture variations.  */
 enum ix86_arch_indices {
@@ -325,10 +359,13 @@ extern unsigned int ix86_arch_features[X86_ARCH_LAST];
 #define TARGET_FISTTP          (TARGET_SSE3 && TARGET_80387)
 
 extern int x86_prefetch_sse;
-#define TARGET_PREFETCH_SSE    x86_prefetch_sse
 
-extern int x86_cmpxchg16b;
+#define TARGET_ABM             x86_abm
 #define TARGET_CMPXCHG16B      x86_cmpxchg16b
+#define TARGET_POPCNT          x86_popcnt
+#define TARGET_PREFETCH_SSE    x86_prefetch_sse
+#define TARGET_SAHF            x86_sahf
+#define TARGET_RECIP           x86_recip
 
 #define ASSEMBLER_DIALECT      (ix86_asm_dialect)
 
@@ -341,6 +378,8 @@ extern int x86_cmpxchg16b;
 #define TARGET_ANY_GNU_TLS     (TARGET_GNU_TLS || TARGET_GNU2_TLS)
 #define TARGET_SUN_TLS         (ix86_tls_dialect == TLS_DIALECT_SUN)
 
+extern int ix86_isa_flags;
+
 #ifndef TARGET_64BIT_DEFAULT
 #define TARGET_64BIT_DEFAULT 0
 #endif
@@ -348,16 +387,36 @@ extern int x86_cmpxchg16b;
 #define TARGET_TLS_DIRECT_SEG_REFS_DEFAULT 0
 #endif
 
+/* Fence to use after loop using storent.  */
+
+extern tree x86_mfence;
+#define FENCE_FOLLOWING_MOVNT x86_mfence
+
 /* Once GDB has been enhanced to deal with functions without frame
    pointers, we can change this to allow for elimination of
    the frame pointer in leaf functions.  */
 #define TARGET_DEFAULT 0
 
+/* Extra bits to force.  */
+#define TARGET_SUBTARGET_DEFAULT 0
+#define TARGET_SUBTARGET_ISA_DEFAULT 0
+
+/* Extra bits to force on w/ 32-bit mode.  */
+#define TARGET_SUBTARGET32_DEFAULT 0
+#define TARGET_SUBTARGET32_ISA_DEFAULT 0
+
+/* Extra bits to force on w/ 64-bit mode.  */
+#define TARGET_SUBTARGET64_DEFAULT 0
+#define TARGET_SUBTARGET64_ISA_DEFAULT 0
+
 /* This is not really a target flag, but is done this way so that
    it's analogous to similar code for Mach-O on PowerPC.  darwin.h
    redefines this to 1.  */
 #define TARGET_MACHO 0
 
+/* Likewise, for the Windows 64-bit ABI.  */
+#define TARGET_64BIT_MS_ABI 0
+
 /* Subtargets may reset this to 1 in order to enable 96-bit long double
    with the rounding mode forced to 53 bits.  */
 #define TARGET_96_ROUND_53_LONG_DOUBLE 0
@@ -400,17 +459,8 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
 
 #ifndef CC1_CPU_SPEC
 #define CC1_CPU_SPEC_1 "\
-%{!mtune*: \
-%{m386:mtune=i386 \
-%n`-m386' is deprecated. Use `-march=i386' or `-mtune=i386' instead.\n} \
-%{m486:-mtune=i486 \
-%n`-m486' is deprecated. Use `-march=i486' or `-mtune=i486' instead.\n} \
-%{mpentium:-mtune=pentium \
-%n`-mpentium' is deprecated. Use `-march=pentium' or `-mtune=pentium' instead.\n} \
-%{mpentiumpro:-mtune=pentiumpro \
-%n`-mpentiumpro' is deprecated. Use `-march=pentiumpro' or `-mtune=pentiumpro' instead.\n} \
 %{mcpu=*:-mtune=%* \
-%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n}} \
+%n`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead.\n} \
 %<mcpu=* \
 %{mintel-syntax:-masm=intel \
 %n`-mintel-syntax' is deprecated. Use `-masm=intel' instead.\n} \
@@ -434,7 +484,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
       size_t arch_len = strlen (ix86_arch_string);             \
       size_t tune_len = strlen (ix86_tune_string);             \
       int last_arch_char = ix86_arch_string[arch_len - 1];     \
-      int last_tune_char = ix86_tune_string[tune_len - 1];             \
+      int last_tune_char = ix86_tune_string[tune_len - 1];     \
                                                                \
       if (TARGET_64BIT)                                                \
        {                                                       \
@@ -523,7 +573,11 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
        builtin_define ("__SSE3__");                            \
       if (TARGET_SSSE3)                                                \
        builtin_define ("__SSSE3__");                           \
-      if (TARGET_SSE4A)                                        \
+      if (TARGET_SSE4_1)                                       \
+       builtin_define ("__SSE4_1__");                          \
+      if (TARGET_SSE4_2)                                       \
+       builtin_define ("__SSE4_2__");                          \
+      if (TARGET_SSE4A)                                                \
        builtin_define ("__SSE4A__");                           \
       if (TARGET_SSE_MATH && TARGET_SSE)                       \
        builtin_define ("__SSE_MATH__");                        \
@@ -943,10 +997,10 @@ do {                                                                      \
                               == (TARGET_64BIT ? 3 : 2));              \
       }                                                                        \
     j = PIC_OFFSET_TABLE_REGNUM;                                       \
-    if (j != INVALID_REGNUM)                   \
+    if (j != INVALID_REGNUM)                                           \
       {                                                                        \
-       fixed_regs[j] = 1;                      \
-       call_used_regs[j] = 1;                  \
+       fixed_regs[j] = 1;                                              \
+       call_used_regs[j] = 1;                                          \
       }                                                                        \
     if (! TARGET_MMX)                                                  \
       {                                                                        \
@@ -979,6 +1033,11 @@ do {                                                                      \
        for (i = FIRST_REX_SSE_REG; i <= LAST_REX_SSE_REG; i++)         \
          reg_names[i] = "";                                            \
       }                                                                        \
+    if (TARGET_64BIT_MS_ABI)                                           \
+      {                                                                        \
+        call_used_regs[4 /*RSI*/] = 0;                                  \
+        call_used_regs[5 /*RDI*/] = 0;                                  \
+      }                                                                        \
   } while (0)
 
 /* Return number of consecutive hard regs needed starting at reg REGNO
@@ -1215,6 +1274,7 @@ enum reg_class
   GENERAL_REGS,                        /* %eax %ebx %ecx %edx %esi %edi %ebp %esp %r8 - %r15*/
   FP_TOP_REG, FP_SECOND_REG,   /* %st(0) %st(1) */
   FLOAT_REGS,
+  SSE_FIRST_REG,
   SSE_REGS,
   MMX_REGS,
   FP_TOP_SSE_REGS,
@@ -1233,7 +1293,7 @@ enum reg_class
 #define FLOAT_CLASS_P(CLASS) \
   reg_class_subset_p ((CLASS), FLOAT_REGS)
 #define SSE_CLASS_P(CLASS) \
-  ((CLASS) == SSE_REGS)
+  reg_class_subset_p ((CLASS), SSE_REGS)
 #define MMX_CLASS_P(CLASS) \
   ((CLASS) == MMX_REGS)
 #define MAYBE_INTEGER_CLASS_P(CLASS) \
@@ -1261,6 +1321,7 @@ enum reg_class
    "GENERAL_REGS",                     \
    "FP_TOP_REG", "FP_SECOND_REG",      \
    "FLOAT_REGS",                       \
+   "SSE_FIRST_REG",                    \
    "SSE_REGS",                         \
    "MMX_REGS",                         \
    "FP_TOP_SSE_REGS",                  \
@@ -1288,6 +1349,7 @@ enum reg_class
   { 0x1100ff,  0x1fe0 },               /* GENERAL_REGS */              \
      { 0x100,     0x0 }, { 0x0200, 0x0 },/* FP_TOP_REG, FP_SECOND_REG */\
     { 0xff00,     0x0 },               /* FLOAT_REGS */                \
+  { 0x200000,     0x0 },               /* SSE_FIRST_REG */             \
 { 0x1fe00000,0x1fe000 },               /* SSE_REGS */                  \
 { 0xe0000000,    0x1f },               /* MMX_REGS */                  \
 { 0x1fe00100,0x1fe000 },               /* FP_TOP_SSE_REG */            \
@@ -1331,6 +1393,9 @@ enum reg_class
 #define ANY_FP_REG_P(X) (REG_P (X) && ANY_FP_REGNO_P (REGNO (X)))
 #define ANY_FP_REGNO_P(N) (FP_REGNO_P (N) || SSE_REGNO_P (N))
 
+#define X87_FLOAT_MODE_P(MODE) \
+  (TARGET_80387 && ((MODE) == SFmode || (MODE) == DFmode || (MODE) == XFmode))
+
 #define SSE_REG_P(N) (REG_P (N) && SSE_REGNO_P (REGNO (N)))
 #define SSE_REGNO_P(N)                                         \
   (IN_RANGE ((N), FIRST_SSE_REG, LAST_SSE_REG)                 \
@@ -2328,8 +2393,6 @@ enum ix86_stack_slot
   (! IN_RANGE ((SRC), FIRST_STACK_REG, LAST_STACK_REG))
 
 \f
-#define DLL_IMPORT_EXPORT_PREFIX '#'
-
 #define FASTCALL_PREFIX '@'
 \f
 struct machine_function GTY(())
@@ -2369,7 +2432,7 @@ struct machine_function GTY(())
    verify whether there's any such instruction live by testing that
    REG_SP is live.  */
 #define ix86_current_function_calls_tls_descriptor \
-  (ix86_tls_descriptor_calls_expanded_in_cfun && regs_ever_live[SP_REG])
+  (ix86_tls_descriptor_calls_expanded_in_cfun && df_regs_ever_live_p (SP_REG))
 
 /* Control behavior of x86_file_start.  */
 #define X86_FILE_START_VERSION_DIRECTIVE false
@@ -2379,6 +2442,17 @@ struct machine_function GTY(())
 #define SYMBOL_FLAG_FAR_ADDR           (SYMBOL_FLAG_MACH_DEP << 0)
 #define SYMBOL_REF_FAR_ADDR_P(X)       \
        ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_FAR_ADDR) != 0)
+
+/* Flags to mark dllimport/dllexport.  Used by PE ports, but handy to
+   have defined always, to avoid ifdefing.  */
+#define SYMBOL_FLAG_DLLIMPORT          (SYMBOL_FLAG_MACH_DEP << 1)
+#define SYMBOL_REF_DLLIMPORT_P(X) \
+       ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLIMPORT) != 0)
+
+#define SYMBOL_FLAG_DLLEXPORT          (SYMBOL_FLAG_MACH_DEP << 2)
+#define SYMBOL_REF_DLLEXPORT_P(X) \
+       ((SYMBOL_REF_FLAGS (X) & SYMBOL_FLAG_DLLEXPORT) != 0)
+
 /*
 Local variables:
 version-control: t