AVX-512. Extend `perm' insn patterns.
[official-gcc.git] / gcc / config / i386 / i386-interix.h
blob98b8ae1466009638bb8c98d9430a36f58a1b8757
1 /* Target definitions for GCC for Intel 80386 running Interix
2 Parts Copyright (C) 1991-2014 Free Software Foundation, Inc.
4 Parts:
5 by Douglas B. Rupp (drupp@cs.washington.edu).
6 by Ron Guilmette (rfg@netcom.com).
7 by Donn Terry (donn@softway.com).
8 by Mumit Khan (khan@xraylith.wisc.edu).
10 This file is part of GCC.
12 GCC is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 3, or (at your option)
15 any later version.
17 GCC is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with GCC; see the file COPYING3. If not see
24 <http://www.gnu.org/licenses/>. */
26 /* Note: Interix doesn't support user-written DLLs (use conventional
27 shared libs (.so) instead). Thus a lot of the stuff that might apply
28 about dllimport/dllexport and the like does not apply here. */
30 #include <stdio.h>
32 /* Names to predefine in the preprocessor for this target machine. */
34 #define DBX_DEBUGGING_INFO 1
35 #define SDB_DEBUGGING_INFO 1
36 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
38 /* Our strategy for finding global constructors is a bit different, although
39 not a lot. */
40 #define DO_GLOBAL_CTORS_BODY \
41 do { \
42 int i; \
43 unsigned long nptrs; \
44 func_ptr *p; \
45 asm( \
46 " .section .ctor_head, \"rw\"\n" \
47 "1:\n" \
48 " .text \n" \
49 ASM_LOAD_ADDR(1b,%0) \
50 : "=r" (p) : : "cc"); \
51 for (nptrs = 0; p[nptrs] != 0; nptrs++); \
52 for (i = nptrs-1; i >= 0; i--) \
53 p[i] (); \
54 } while (0)
56 #define DO_GLOBAL_DTORS_BODY \
57 do { \
58 func_ptr *p; \
59 asm( \
60 " .section .dtor_head, \"rw\"\n" \
61 "1:\n" \
62 " .text \n" \
63 ASM_LOAD_ADDR(1b,%0) \
64 : "=r" (p) : : "cc"); \
65 while (*p) \
66 { \
67 p++; \
68 (*(p-1)) (); \
69 } \
70 } while (0)
72 /* We don't use the "usual" push-an-address solution. */
73 #undef TARGET_ASM_CONSTRUCTOR
75 #undef SUBTARGET_SWITCHES
76 #define SUBTARGET_SWITCHES \
77 { "ms-bitfields", MASK_MS_BITFIELD_LAYOUT, N_("Use native (MS) bitfield layout") }, \
78 { "no-ms-bitfields", -MASK_MS_BITFIELD_LAYOUT, N_("Use gcc default bitfield layout") },
80 #undef LIB_SPEC
81 #define LIB_SPEC "\
82 %{!shared:%{!dynamic:-lc -lpsxdll \
83 }} \
84 %{!G:%{!dynamic:-lc -lpsxdll \
85 }} \
86 %{dynamic:-lc -lpsxdll \
87 } \
88 %{v}"
90 #undef LINK_SPEC
91 #define LINK_SPEC "%{!shared:-stack 0x4000000,0x10000} \
92 %{g} \
93 %{dynamic:-Bdynamic} \
94 %{static:-Bstatic} \
95 %{shared:--shared -Bdynamic} \
96 %{G:--shared -Bdynamic} \
97 %{symbolic:--shared -Bsymbolic -Bdynamic} \
98 %{rpath*:--rpath %*} \
101 #undef STARTFILE_SPEC
102 #define STARTFILE_SPEC \
103 "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}"
105 #define TARGET_DECLSPEC 1
107 /* cpp handles __STDC__ */
108 #define TARGET_OS_CPP_BUILTINS() \
109 do \
111 builtin_define ("__INTERIX"); \
112 builtin_define ("_M_IX86=300"); \
113 builtin_define ("_X86_=1"); \
114 builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
115 builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
116 builtin_define ("__declspec(x)=__attribute__((x))"); \
117 builtin_assert ("system=unix"); \
118 builtin_assert ("system=interix"); \
119 if (preprocessing_asm_p ()) \
120 builtin_define_std ("LANGUAGE_ASSEMBLY"); \
121 else \
123 builtin_define_std ("LANGUAGE_C"); \
124 if (c_dialect_cxx ()) \
125 builtin_define_std ("LANGUAGE_C_PLUS_PLUS"); \
126 if (c_dialect_objc ()) \
127 builtin_define_std ("LANGUAGE_OBJECTIVE_C"); \
130 while (0)
132 #undef CPP_SPEC
133 #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
135 #define SIZE_TYPE "unsigned int"
136 #define PTRDIFF_TYPE "int"
137 #define WCHAR_TYPE "short unsigned int"
138 #define WCHAR_TYPE_SIZE 16
140 /* Turn off long double being 96 bits. */
141 #undef LONG_DOUBLE_TYPE_SIZE
142 #define LONG_DOUBLE_TYPE_SIZE 64
144 #define IX86_NO_LIBGCC_TFMODE
146 #undef TARGET_LIBC_HAS_FUNCTION
147 #define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
149 /* The following are needed for us to be able to use winnt.c, but are not
150 otherwise meaningful to Interix. (The functions that use these are
151 never called because we don't do DLLs.) */
152 #define TARGET_NOP_FUN_DLLIMPORT 1
153 #define drectve_section() /* nothing */
156 #define EH_FRAME_IN_DATA_SECTION
158 #define READONLY_DATA_SECTION_ASM_OP "\t.section\t.rdata,\"r\""
160 /* Define this macro if references to a symbol must be treated
161 differently depending on something about the variale or
162 function named by the symbol (such as what section it is in). */
164 #undef TARGET_ENCODE_SECTION_INFO
165 #define TARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
166 #undef TARGET_STRIP_NAME_ENCODING
167 #define TARGET_STRIP_NAME_ENCODING i386_pe_strip_name_encoding_full
169 /* Emit code to check the stack when allocating more that 4000
170 bytes in one go. */
172 #define CHECK_STACK_LIMIT 4000
174 /* By default, target has a 80387, uses IEEE compatible arithmetic,
175 and returns float values in the 387 and needs stack probes
176 We also align doubles to 64-bits forMSVC default compatibility
177 Ditto for bitfields. */
178 #undef TARGET_SUBTARGET_DEFAULT
179 #define TARGET_SUBTARGET_DEFAULT \
180 (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE | \
181 MASK_ALIGN_DOUBLE | MASK_MS_BITFIELD_LAYOUT)
183 /* The MS compilers take alignment as a number of bytes, so we do as well */
184 #undef ASM_OUTPUT_ALIGN
185 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
186 if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
189 /* Define this macro if in some cases global symbols from one translation
190 unit may not be bound to undefined symbols in another translation unit
191 without user intervention. For instance, under Microsoft Windows
192 symbols must be explicitly imported from shared libraries (DLLs). */
194 * Old gcc(3.3) did not have 1 here
196 #define MULTIPLE_SYMBOL_SPACES 1
198 extern void i386_pe_unique_section (tree, int);
199 #define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
201 /* Switch into a generic section. */
202 #define TARGET_ASM_NAMED_SECTION default_pe_asm_named_section
204 /* Select attributes for named sections. */
205 #define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
207 /* Write the extra assembler code needed to declare a function
208 properly. If we are generating SDB debugging information, this
209 will happen automatically, so we only need to handle other cases. */
210 #undef ASM_DECLARE_FUNCTION_NAME
211 #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
212 do \
214 if (write_symbols != SDB_DEBUG) \
215 i386_pe_declare_function_type (FILE, NAME, TREE_PUBLIC (DECL)); \
216 ASM_OUTPUT_LABEL (FILE, NAME); \
218 while (0)
220 /* Add an external function to the list of functions to be declared at
221 the end of the file. */
222 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
223 do \
225 if (TREE_CODE (DECL) == FUNCTION_DECL) \
226 i386_pe_record_external_function (DECL, NAME); \
228 while (0)
230 /* Declare the type properly for any external libcall. */
231 #define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
232 i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
234 /* This says out to put a global symbol in the BSS section. */
235 #undef ASM_OUTPUT_ALIGNED_BSS
236 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
237 asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
239 /* Don't assume anything about the header files. */
240 #define NO_IMPLICIT_EXTERN_C
242 /* External function declarations. */
243 extern void i386_pe_record_external_function (tree, const char *);
244 extern void i386_pe_declare_function_type (FILE *, const char *, int);
245 extern void i386_pe_record_exported_symbol (const char *, int);
246 extern void i386_pe_asm_file_end (FILE *);
248 /* For Win32 ABI compatibility */
249 #undef DEFAULT_PCC_STRUCT_RETURN
250 #define DEFAULT_PCC_STRUCT_RETURN 0
252 /* A bitfield declared as `int' forces `int' alignment for the struct. */
253 #undef PCC_BITFIELD_TYPE_MATTERS
254 #define PCC_BITFIELD_TYPE_MATTERS 1
256 /* Enable alias attribute support. */
257 #ifndef SET_ASM_OP
258 #define SET_ASM_OP "\t.set\t"
259 #endif
261 /* Note that there appears to be two different ways to support const
262 sections at the moment. You can either #define the symbol
263 READONLY_DATA_SECTION (giving it some code which switches to the
264 readonly data section) or else you can #define the symbols
265 EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
266 SELECT_RTX_SECTION. We do both here just to be on the safe side. */
268 #define USE_CONST_SECTION 1
270 /* The linker will take care of this, and having them causes problems with
271 ld -r (specifically -rU). */
272 #define CTOR_LISTS_DEFINED_EXTERNALLY 1
274 /* Output a definition (implements alias) */
275 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
276 do \
278 fputs (SET_ASM_OP, (FILE)); \
279 assemble_name (FILE, LABEL1); \
280 fputc (',', (FILE)); \
281 assemble_name (FILE, LABEL2); \
282 fputc ('\n', (FILE)); \
284 while (0)
286 #define HOST_PTR_AS_INT unsigned long
288 /* The following two flags are usually "off" for i386, because some non-gnu
289 tools (for the i386) don't handle them. However, we don't have that
290 problem, so.... */
292 /* Forward references to tags are allowed. */
293 #define SDB_ALLOW_FORWARD_REFERENCES
294 /* Unknown tags are also allowed. */
295 #define SDB_ALLOW_UNKNOWN_REFERENCES
296 /* DWARF2 Unwinding doesn't work with exception handling yet. */
297 #define DWARF2_UNWIND_INFO 0
298 /* MSVC returns structs of up to 8 bytes via registers. */
300 #undef SUBTARGET_RETURN_IN_MEMORY
301 #define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
302 (TYPE_MODE (TYPE) == BLKmode || \
303 (AGGREGATE_TYPE_P (TYPE) && int_size_in_bytes(TYPE) > 8 ))
305 #define ASM_LOAD_ADDR(loc, reg) " leal " #loc "," #reg "\n"
307 /* The integer half of this list needs to be constant. However, there's
308 a lot of disagreement about what the floating point adjustments should
309 be. We pick one that works with gdb. (The underlying problem is
310 what to do about the segment registers. Since we have access to them
311 from /proc, we'll allow them to be accessed in gdb, even tho the
312 gcc compiler can't generate them. (There's some evidence that
313 MSVC does, but possibly only for certain special "canned" sequences.) */
315 #undef DBX_REGISTER_NUMBER
316 #define DBX_REGISTER_NUMBER(n) \
317 (TARGET_64BIT ? dbx64_register_map[n] \
318 : (n) == 0 ? (int) 0 \
319 : (n) == 1 ? (int) 2 \
320 : (n) == 2 ? (int) 1 \
321 : (n) == 3 ? (int) 3 \
322 : (n) == 4 ? (int) 6 \
323 : (n) == 5 ? (int) 7 \
324 : (n) == 6 ? (int) 5 \
325 : (n) == 7 ? (int) 4 \
326 : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (int) (n)+8 \
327 : (int) (-1))
329 #define EH_FRAME_IN_DATA_SECTION
331 /* the following are OSF linker (not gld) specific... we don't want them */
332 #undef HAS_INIT_SECTION
333 #undef LD_INIT_SWITCH
334 #undef LD_FINI_SWITCH
336 /* The following are needed for us to be able to use winnt.c, but are not
337 otherwise meaningful to Interix. (The functions that use these are
338 never called because we don't do DLLs.) */
339 #define TARGET_NOP_FUN_DLLIMPORT 1
340 #define I386_PE_STRIP_ENCODING(SYM_NAME) \
341 ((SYM_NAME) + ((SYM_NAME)[0] == '@' \
342 ? ((SYM_NAME)[3] == '*' ? 4 : 3) : 0) \
343 + ((SYM_NAME)[0] == '*' ? 1 : 0))
345 #define drectve_section() /* nothing */