libgcc-5.4.0 initial commit

git-svn-id: svn://kolibrios.org@6515 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2016-09-08 17:51:39 +00:00
parent 640dae6ddf
commit c7fc8e91d0
357 changed files with 287131 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
/* Definitions needed when using stabs embedded in COFF sections.
Copyright (C) 1996-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* This file may be included by any COFF target which wishes to
support -gstabs generating stabs in sections, as produced by gas
and understood by gdb. */
/* Output DBX (stabs) debugging information if doing -gstabs. */
#define DBX_DEBUGGING_INFO 1
/* Generate SDB debugging information by default. */
#ifndef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
#endif
/* Be function-relative for block and source line stab directives. */
#define DBX_BLOCKS_FUNCTION_RELATIVE 1
/* but, to make this work, functions must appear prior to line info. */
#define DBX_FUNCTION_FIRST
/* Generate a blank trailing N_SO to mark the end of the .o file, since
we can't depend upon the linker to mark .o file boundaries with
embedded stabs. */
#define DBX_OUTPUT_NULL_N_SO_AT_MAIN_SOURCE_FILE_END
/* Like block addresses, stabs line numbers are relative to the
current function. */
#define DBX_LINES_FUNCTION_RELATIVE 1
/* When generating stabs debugging, use N_BINCL entries. */
#undef DBX_USE_BINCL
#define DBX_USE_BINCL
/* There is no limit to the length of stabs strings. */
#ifndef DBX_CONTIN_LENGTH
#define DBX_CONTIN_LENGTH 0
#endif

View File

@ -0,0 +1,99 @@
/* Definitions for BSD assembler syntax for Intel 386
(actually AT&T syntax for insns and operands,
adapted to BSD conventions for symbol names and debugging.)
Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Use the Sequent Symmetry assembler syntax. */
/* Define the syntax of pseudo-ops, labels and comments. */
/* Prefix for internally generated assembler labels. If we aren't using
underscores, we are using prefix `.'s to identify labels that should
be ignored, as in `i386/gas.h' --karl@cs.umb.edu */
#define LPREFIX "L"
/* Assembler pseudos to introduce constants of various size. */
#define ASM_BYTE "\t.byte\t"
#define ASM_SHORT "\t.word\t"
#define ASM_LONG "\t.long\t"
#define ASM_QUAD "\t.quad\t" /* Should not be used for 32bit compilation. */
/* This was suggested, but it shouldn't be right for DBX output. -- RMS
#define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */
/* Define the syntax of labels and symbol definitions/declarations. */
/* This is how to output an assembler line
that says to advance the location counter by SIZE bytes. */
#define ASM_OUTPUT_SKIP(FILE,SIZE) \
fprintf (FILE, "\t.space "HOST_WIDE_INT_PRINT_UNSIGNED"\n", (SIZE))
/* Define the syntax of labels and symbol definitions/declarations. */
/* This says how to output an assembler line
to define a global common symbol. */
#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
( fputs (".comm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
/* This says how to output an assembler line
to define a local common symbol. */
#define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \
( fputs (".lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u\n", (int)(ROUNDED)))
#ifdef HAVE_GAS_LCOMM_WITH_ALIGNMENT
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGNMENT) \
( fputs (".lcomm ", (FILE)), \
assemble_name ((FILE), (NAME)), \
fprintf ((FILE), ",%u,%u\n", (int)(SIZE), (int)(ALIGNMENT) / BITS_PER_UNIT))
#endif
/* This is how to output an assembler line
that says to advance the location counter
to a multiple of 2**LOG bytes. */
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG))
/* This is how to store into the string BUF
the symbol_ref name of an internal numbered label where
PREFIX is the class of label and NUM is the number within the class.
This is suitable for output with `assemble_name'. */
#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
sprintf ((BUF), "*%s%ld", (PREFIX), (long)(NUMBER))
/* The prefix to add to user-visible assembler symbols. */
#define USER_LABEL_PREFIX "_"
/* Sequent has some changes in the format of DBX symbols. */
#define DBX_NO_XREFS 1
/* Don't split DBX symbols into continuations. */
#define DBX_CONTIN_LENGTH 0

View File

@ -0,0 +1,481 @@
/* Operating system specific defines to be used when targeting GCC for
hosting on Windows32, using a Unix style C library and tools.
Copyright (C) 1995-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#define DBX_DEBUGGING_INFO 1
#define SDB_DEBUGGING_INFO 1
#if TARGET_64BIT_DEFAULT || defined (HAVE_GAS_PE_SECREL32_RELOC)
#define DWARF2_DEBUGGING_INFO 1
#endif
#undef PREFERRED_DEBUGGING_TYPE
#if (DWARF2_DEBUGGING_INFO)
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
#else
#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
#endif
#undef TARGET_SEH
#define TARGET_SEH (TARGET_64BIT_MS_ABI && flag_unwind_tables)
/* Win64 with SEH cannot represent DRAP stack frames. Disable its use.
Force the use of different mechanisms to allocate aligned local data. */
#undef MAX_STACK_ALIGNMENT
#define MAX_STACK_ALIGNMENT (TARGET_SEH ? 128 : MAX_OFILE_ALIGNMENT)
/* Support hooks for SEH. */
#undef TARGET_ASM_UNWIND_EMIT
#define TARGET_ASM_UNWIND_EMIT i386_pe_seh_unwind_emit
#undef TARGET_ASM_UNWIND_EMIT_BEFORE_INSN
#define TARGET_ASM_UNWIND_EMIT_BEFORE_INSN false
#undef TARGET_ASM_FUNCTION_END_PROLOGUE
#define TARGET_ASM_FUNCTION_END_PROLOGUE i386_pe_seh_end_prologue
#undef TARGET_ASM_EMIT_EXCEPT_PERSONALITY
#define TARGET_ASM_EMIT_EXCEPT_PERSONALITY i386_pe_seh_emit_except_personality
#undef TARGET_ASM_INIT_SECTIONS
#define TARGET_ASM_INIT_SECTIONS i386_pe_seh_init_sections
#define SUBTARGET_ASM_UNWIND_INIT i386_pe_seh_init
#undef DEFAULT_ABI
#define DEFAULT_ABI (TARGET_64BIT ? MS_ABI : SYSV_ABI)
#undef TARGET_PECOFF
#define TARGET_PECOFF 1
#if ! defined (USE_MINGW64_LEADING_UNDERSCORES)
#undef USER_LABEL_PREFIX
#define USER_LABEL_PREFIX (TARGET_64BIT ? "" : "_")
#undef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX (TARGET_64BIT ? "." : "")
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \
sprintf ((BUF), "*%s%s%ld", LOCAL_LABEL_PREFIX, \
(PREFIX), (long)(NUMBER))
#undef LPREFIX
#define LPREFIX (TARGET_64BIT ? ".L" : "L")
#endif
#undef DBX_REGISTER_NUMBER
#define DBX_REGISTER_NUMBER(n) \
(TARGET_64BIT ? dbx64_register_map[n] \
: (write_symbols == DWARF2_DEBUG \
? svr4_dbx_register_map[n] : dbx_register_map[n]))
/* Map gcc register number to DWARF 2 CFA column number. For 32 bit
target, always use the svr4_dbx_register_map for DWARF .eh_frame
even if we don't use DWARF .debug_frame. */
#undef DWARF_FRAME_REGNUM
#define DWARF_FRAME_REGNUM(n) \
(TARGET_64BIT ? dbx64_register_map[(n)] \
: svr4_dbx_register_map[(n)])
/* The 64-bit MS_ABI changes the set of call-used registers. */
#undef DWARF_FRAME_REGISTERS
#define DWARF_FRAME_REGISTERS (TARGET_64BIT ? 33 : 17)
#ifdef HAVE_GAS_PE_SECREL32_RELOC
/* Use section relative relocations for debugging offsets. Unlike
other targets that fake this by putting the section VMA at 0, PE
won't allow it. */
#define ASM_OUTPUT_DWARF_OFFSET(FILE, SIZE, LABEL, SECTION) \
do { \
switch (SIZE) \
{ \
case 4: \
fputs ("\t.secrel32\t", FILE); \
assemble_name (FILE, LABEL); \
break; \
case 8: \
/* This is a hack. There is no 64-bit section relative \
relocation. However, the COFF format also does not \
support 64-bit file offsets; 64-bit applications are \
limited to 32-bits of code+data in any one module. \
Fake the 64-bit offset by zero-extending it. */ \
fputs ("\t.secrel32\t", FILE); \
assemble_name (FILE, LABEL); \
fputs ("\n\t.long\t0", FILE); \
break; \
default: \
gcc_unreachable (); \
} \
} while (0)
#endif
#define TARGET_EXECUTABLE_SUFFIX ".exe"
#define TARGET_OS_CPP_BUILTINS() \
do \
{ \
if (!TARGET_64BIT) \
builtin_define ("_X86_=1"); \
if (TARGET_SEH) \
builtin_define ("__SEH__"); \
builtin_assert ("system=winnt"); \
builtin_define ("__stdcall=__attribute__((__stdcall__))"); \
builtin_define ("__fastcall=__attribute__((__fastcall__))"); \
builtin_define ("__thiscall=__attribute__((__thiscall__))"); \
builtin_define ("__cdecl=__attribute__((__cdecl__))"); \
if (!flag_iso) \
{ \
builtin_define ("_stdcall=__attribute__((__stdcall__))"); \
builtin_define ("_fastcall=__attribute__((__fastcall__))"); \
builtin_define ("_thiscall=__attribute__((__thiscall__))"); \
builtin_define ("_cdecl=__attribute__((__cdecl__))"); \
} \
/* Even though linkonce works with static libs, this is needed \
to compare typeinfo symbols across dll boundaries. */ \
builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \
builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \
EXTRA_OS_CPP_BUILTINS (); \
} \
while (0)
/* Get tree.c to declare a target-specific specialization of
merge_decl_attributes. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
/* This macro defines names of additional specifications to put in the specs
that can be used in various specifications like CC1_SPEC. Its definition
is an initializer with a subgrouping for each command option.
Each subgrouping contains a string constant, that defines the
specification name, and a string constant that used by the GCC driver
program.
Do not define this macro if it does not need to do anything. */
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "mingw_include_path", DEFAULT_TARGET_MACHINE }
#undef MATH_LIBRARY
#define MATH_LIBRARY ""
#undef TARGET_LIBC_HAS_FUNCTION
#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
#define SIZE_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")
#define PTRDIFF_TYPE (TARGET_64BIT ? "long long int" : "int")
#define WCHAR_TYPE_SIZE 16
#define WCHAR_TYPE "short unsigned int"
/* Windows64 continues to use a 32-bit long type. */
#undef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE 32
#define drectve_section() \
(fprintf (asm_out_file, "\t.section .drectve\n"), \
in_section = NULL)
/* Older versions of gas don't handle 'r' as data.
Explicitly set data flag with 'd'. */
#define READONLY_DATA_SECTION_ASM_OP "\t.section .rdata,\"dr\""
/* Don't allow flag_pic to propagate since gas may produce invalid code
otherwise. */
#undef SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS \
do { \
if (TARGET_64BIT && flag_pic != 1) \
{ \
if (flag_pic > 1) \
warning (0, \
"-fPIC ignored for target (all code is position independent)"\
); \
flag_pic = 1; \
} \
else if (!TARGET_64BIT && flag_pic) \
{ \
warning (0, "-f%s ignored for target (all code is position independent)",\
(flag_pic > 1) ? "PIC" : "pic"); \
flag_pic = 0; \
} \
} while (0)
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or
function named by the symbol (such as what section it is in).
On i386 running Windows NT, modify the assembler name with a suffix
consisting of an atsign (@) followed by string of digits that represents
the number of bytes of arguments passed to the function, if it has the
attribute STDCALL.
In addition, we must mark dll symbols specially. Definitions of
dllexport'd objects install some info in the .drectve section.
References to dllimport'd objects are fetched indirectly via
_imp__. If both are declared, dllexport overrides. This is also
needed to implement one-only vtables: they go into their own
section and we need to set DECL_SECTION_NAME so we do that here.
Note that we can be called twice on the same decl. */
#define SUBTARGET_ENCODE_SECTION_INFO i386_pe_encode_section_info
/* Local and global relocs can be placed always into readonly memory
for PE-COFF targets. */
#undef TARGET_ASM_RELOC_RW_MASK
#define TARGET_ASM_RELOC_RW_MASK i386_pe_reloc_rw_mask
/* Output a common block. */
#undef ASM_OUTPUT_ALIGNED_DECL_COMMON
#define ASM_OUTPUT_ALIGNED_DECL_COMMON \
i386_pe_asm_output_aligned_decl_common
/* Output the label for an initialized variable. */
#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME(STREAM, NAME, DECL) \
do { \
i386_pe_maybe_record_exported_symbol (DECL, NAME, 1); \
ASM_OUTPUT_LABEL ((STREAM), (NAME)); \
} while (0)
/* Output a reference to a label. Fastcall function symbols
keep their '@' prefix, while other symbols are prefixed
with user_label_prefix. */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(STREAM, NAME) \
do { \
if ((NAME)[0] != FASTCALL_PREFIX) \
fputs (user_label_prefix, (STREAM)); \
fputs ((NAME), (STREAM)); \
} while (0)
/* This does much the same in memory rather than to a stream. */
#undef TARGET_MANGLE_ASSEMBLER_NAME
#define TARGET_MANGLE_ASSEMBLER_NAME i386_pe_mangle_assembler_name
/* Emit code to check the stack when allocating more than 4000
bytes in one go. */
#define CHECK_STACK_LIMIT 4000
#undef STACK_BOUNDARY
#define STACK_BOUNDARY (TARGET_64BIT && ix86_abi == MS_ABI ? 128 : BITS_PER_WORD)
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
We also align doubles to 64-bits for MSVC default compatibility. */
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE)
#undef TARGET_SUBTARGET64_DEFAULT
#define TARGET_SUBTARGET64_DEFAULT \
MASK_128BIT_LONG_DOUBLE
/* This is how to output an assembler line
that says to advance the location counter
to a multiple of 2**LOG bytes. */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1<<(LOG))
/* Windows uses explicit import from shared libraries. */
#define MULTIPLE_SYMBOL_SPACES 1
#define TARGET_ASM_UNIQUE_SECTION i386_pe_unique_section
#define TARGET_ASM_FUNCTION_RODATA_SECTION default_no_function_rodata_section
#define SUPPORTS_ONE_ONLY 1
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION i386_pe_asm_named_section
/* Select attributes for named sections. */
#define TARGET_SECTION_TYPE_FLAGS i386_pe_section_type_flags
/* Write the extra assembler code needed to declare a function
properly. If we are generating SDB debugging information, this
will happen automatically, so we only need to handle other cases. */
#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
i386_pe_start_function (FILE, NAME, DECL)
#undef ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(FILE,NAME,DECL) \
i386_pe_end_function (FILE, NAME, DECL)
/* Add an external function to the list of functions to be declared at
the end of the file. */
#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME) \
do \
{ \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
i386_pe_record_external_function ((DECL), (NAME)); \
} \
while (0)
/* Declare the type properly for any external libcall. */
#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN) \
i386_pe_declare_function_type (FILE, XSTR (FUN, 0), 1)
/* This says out to put a global symbol in the BSS section. */
#undef ASM_OUTPUT_ALIGNED_BSS
#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
asm_output_aligned_bss ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
/* Output function declarations at the end of the file. */
#undef TARGET_ASM_FILE_END
#define TARGET_ASM_FILE_END i386_pe_file_end
#undef ASM_COMMENT_START
#define ASM_COMMENT_START " #"
#ifndef DWARF2_UNWIND_INFO
/* If configured with --disable-sjlj-exceptions, use DWARF2, else
default to SJLJ. */
#if (defined (CONFIG_SJLJ_EXCEPTIONS) && !CONFIG_SJLJ_EXCEPTIONS)
/* The logic of this #if must be kept synchronised with the logic
for selecting the tmake_eh_file fragment in config.gcc. */
#define DWARF2_UNWIND_INFO 1
/* If multilib is selected break build as sjlj is required. */
#if defined (TARGET_BI_ARCH)
#error For 64-bit windows and 32-bit based multilib version of gcc just SJLJ exceptions are supported.
#endif
#else
#define DWARF2_UNWIND_INFO 0
#endif
#endif
/* Don't assume anything about the header files. */
#define NO_IMPLICIT_EXTERN_C
#undef PROFILE_HOOK
#define PROFILE_HOOK(LABEL) \
if (MAIN_NAME_P (DECL_NAME (current_function_decl))) \
{ \
emit_call_insn (gen_rtx_CALL (VOIDmode, \
gen_rtx_MEM (FUNCTION_MODE, \
gen_rtx_SYMBOL_REF (Pmode, "_monstartup")), \
const0_rtx)); \
}
/* Java Native Interface (JNI) methods on Win32 are invoked using the
stdcall calling convention. */
#undef MODIFY_JNI_METHOD_CALL
#define MODIFY_JNI_METHOD_CALL(MDECL) \
build_type_attribute_variant ((MDECL), \
build_tree_list (get_identifier ("stdcall"), \
NULL))
/* For Win32 ABI compatibility */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
/* MSVC returns aggregate types of up to 8 bytes via registers.
See i386.c:ix86_return_in_memory. */
#undef MS_AGGREGATE_RETURN
#define MS_AGGREGATE_RETURN 1
/* Biggest alignment supported by the object file format of this
machine. Use this macro to limit the alignment which can be
specified using the `__attribute__ ((aligned (N)))' construct. If
not defined, the default value is `BIGGEST_ALIGNMENT'. */
/* IMAGE_SCN_ALIGN_8192BYTES is the largest section alignment flag
specified in the PECOFF60 spec. Native MS compiler also limits
user-specified alignment to 8192 bytes. */
#undef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT (8192 * 8)
/* BIGGEST_FIELD_ALIGNMENT macro is used directly by libobjc, There, we
align internal doubles in structures on dword boundaries. Otherwise,
support vector modes using ADJUST_FIELD_ALIGN, defined in i386.h. */
#ifdef IN_TARGET_LIBS
#undef BIGGEST_FIELD_ALIGNMENT
#define BIGGEST_FIELD_ALIGNMENT 64
#endif
/* A bit-field declared as `int' forces `int' alignment for the struct. */
#undef PCC_BITFIELD_TYPE_MATTERS
#define PCC_BITFIELD_TYPE_MATTERS 1
#define GROUP_BITFIELDS_BY_ALIGN TYPE_NATIVE(rec)
/* Enable alias attribute support. */
#ifndef SET_ASM_OP
#define SET_ASM_OP "\t.set\t"
#endif
/* This implements the `alias' attribute, keeping any stdcall or
fastcall decoration. */
#undef ASM_OUTPUT_DEF_FROM_DECLS
#define ASM_OUTPUT_DEF_FROM_DECLS(STREAM, DECL, TARGET) \
do \
{ \
const char *alias \
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (DECL)); \
i386_pe_maybe_record_exported_symbol (DECL, alias, 0); \
if (TREE_CODE (DECL) == FUNCTION_DECL) \
i386_pe_declare_function_type (STREAM, alias, \
TREE_PUBLIC (DECL)); \
ASM_OUTPUT_DEF (STREAM, alias, IDENTIFIER_POINTER (TARGET)); \
} while (0)
/* GNU as supports weak symbols on PECOFF. */
#ifdef HAVE_GAS_WEAK
#define ASM_WEAKEN_LABEL(FILE, NAME) \
do \
{ \
fputs ("\t.weak\t", (FILE)); \
assemble_name ((FILE), (NAME)); \
fputc ('\n', (FILE)); \
} \
while (0)
#endif /* HAVE_GAS_WEAK */
/* FIXME: SUPPORTS_WEAK && TARGET_HAVE_NAMED_SECTIONS is true,
but for .jcr section to work we also need crtbegin and crtend
objects. */
#define TARGET_USE_JCR_SECTION 1
/* Decide whether it is safe to use a local alias for a virtual function
when constructing thunks. */
#undef TARGET_USE_LOCAL_THUNK_ALIAS_P
#define TARGET_USE_LOCAL_THUNK_ALIAS_P(DECL) (!DECL_ONE_ONLY (DECL))
#define SUBTARGET_ATTRIBUTE_TABLE \
{ "selectany", 0, 0, true, false, false, ix86_handle_selectany_attribute, \
false }
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
affects_type_identity } */
/* mcount() does not need a counter variable. */
#undef NO_PROFILE_COUNTERS
#define NO_PROFILE_COUNTERS 1
#define TARGET_VALID_DLLIMPORT_ATTRIBUTE_P i386_pe_valid_dllimport_attribute_p
#define TARGET_CXX_ADJUST_CLASS_AT_DEFINITION i386_pe_adjust_class_at_definition
#define SUBTARGET_MANGLE_DECL_ASSEMBLER_NAME i386_pe_mangle_decl_assembler_name
#undef TARGET_ASM_ASSEMBLE_VISIBILITY
#define TARGET_ASM_ASSEMBLE_VISIBILITY i386_pe_assemble_visibility
#undef SUB_TARGET_RECORD_STUB
#define SUB_TARGET_RECORD_STUB i386_pe_record_stub
/* Static stack checking is supported by means of probes. */
#define STACK_CHECK_STATIC_BUILTIN 1

View File

@ -0,0 +1,124 @@
/* Definitions for Intel 386 using GAS.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Note that i386/seq-gas.h is a GAS configuration that does not use this
file. */
/* Use the bsd assembler syntax. */
/* we need to do this because gas is really a bsd style assembler,
* and so doesn't work well this these att-isms:
*
* ASM_OUTPUT_SKIP is .set .,.+N, which isn't implemented in gas
* ASM_OUTPUT_LOCAL is done with .set .,.+N, but that can't be
* used to define bss static space
*
* Next is the question of whether to uses underscores. RMS didn't
* like this idea at first, but since it is now obvious that we
* need this separate tm file for use with gas, at least to get
* dbx debugging info, I think we should also switch to underscores.
* We can keep i386v for real att style output, and the few
* people who want both form will have to compile twice.
*/
/* these come from i386/bsd.h, but are specific to sequent */
#undef DBX_NO_XREFS
#undef DBX_CONTIN_LENGTH
/* Ask for COFF symbols. */
#define SDB_DEBUGGING_INFO 1
/* Output #ident as a .ident. */
#undef TARGET_ASM_OUTPUT_IDENT
#define TARGET_ASM_OUTPUT_IDENT default_asm_output_ident_directive
/* In the past there was confusion as to what the argument to .align was
in GAS. For the last several years the rule has been this: for a.out
file formats that argument is LOG, and for all other file formats the
argument is 1<<LOG.
However, GAS now has .p2align and .balign pseudo-ops so to remove any
doubt or guess work, and since this file is used for both a.out and other
file formats, we use one of them. */
#ifdef HAVE_GAS_BALIGN_AND_P2ALIGN
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.balign %d\n", 1<<(LOG))
#endif
/* A C statement to output to the stdio stream FILE an assembler
command to advance the location counter to a multiple of 1<<LOG
bytes if it is within MAX_SKIP bytes.
This is used to align code labels according to Intel recommendations. */
#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
# define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
if ((LOG) != 0) {\
if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
}
#endif
/* A C statement or statements which output an assembler instruction
opcode to the stdio stream STREAM. The macro-operand PTR is a
variable of type `char *' which points to the opcode name in its
"internal" form--the form that is written in the machine description.
GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic.
So use `repe' instead. */
#undef ASM_OUTPUT_OPCODE
#define ASM_OUTPUT_OPCODE(STREAM, PTR) \
{ \
if ((PTR)[0] == 'r' \
&& (PTR)[1] == 'e' \
&& (PTR)[2] == 'p') \
{ \
if ((PTR)[3] == 'z') \
{ \
fputs ("repe", (STREAM)); \
(PTR) += 4; \
} \
else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \
{ \
fputs ("repne", (STREAM)); \
(PTR) += 5; \
} \
} \
else \
ASM_OUTPUT_AVX_PREFIX ((STREAM), (PTR)); \
}
/* Define macro used to output shift-double opcodes when the shift
count is in %cl. Some assemblers require %cl as an argument;
some don't.
GAS requires the %cl argument, so override i386/unix.h. */
#undef SHIFT_DOUBLE_OMITS_COUNT
#define SHIFT_DOUBLE_OMITS_COUNT 0
/* The comment-starter string as GAS expects it. */
#undef ASM_COMMENT_START
#define ASM_COMMENT_START "#"
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true

View File

@ -0,0 +1,102 @@
/* Definitions for option handling for IA-32.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef I386_OPTS_H
#define I386_OPTS_H
/* Algorithm to expand string function with. */
enum stringop_alg
{
#undef DEF_ENUM
#define DEF_ENUM
#undef DEF_ALG
#define DEF_ALG(alg, name) alg,
#include "stringop.def"
last_alg
#undef DEF_ENUM
#undef DEF_ALG
};
/* Available call abi. */
enum calling_abi
{
SYSV_ABI = 0,
MS_ABI = 1
};
enum fpmath_unit
{
FPMATH_387 = 1,
FPMATH_SSE = 2
};
enum tls_dialect
{
TLS_DIALECT_GNU,
TLS_DIALECT_GNU2,
TLS_DIALECT_SUN
};
enum cmodel {
CM_32, /* The traditional 32-bit ABI. */
CM_SMALL, /* Assumes all code and data fits in the low 31 bits. */
CM_KERNEL, /* Assumes all code and data fits in the high 31 bits. */
CM_MEDIUM, /* Assumes code fits in the low 31 bits; data unlimited. */
CM_LARGE, /* No assumptions. */
CM_SMALL_PIC, /* Assumes code+data+got/plt fits in a 31 bit region. */
CM_MEDIUM_PIC,/* Assumes code+got/plt fits in a 31 bit region. */
CM_LARGE_PIC /* No assumptions. */
};
enum pmode {
PMODE_SI, /* Pmode == SImode. */
PMODE_DI /* Pmode == DImode. */
};
enum ix86_align_data {
ix86_align_data_type_compat,
ix86_align_data_type_abi,
ix86_align_data_type_cacheline
};
enum asm_dialect {
ASM_ATT,
ASM_INTEL
};
enum ix86_veclibabi {
ix86_veclibabi_type_none,
ix86_veclibabi_type_svml,
ix86_veclibabi_type_acml
};
enum stack_protector_guard {
SSP_TLS, /* per-thread canary in TLS block */
SSP_GLOBAL /* global canary */
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* Definitions for <stdint.h> types on systems using mingw.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#define SIG_ATOMIC_TYPE "int"
#define INT8_TYPE "signed char"
#define INT16_TYPE "short int"
#define INT32_TYPE "int"
#define INT64_TYPE "long long int"
#define UINT8_TYPE "unsigned char"
#define UINT16_TYPE "short unsigned int"
#define UINT32_TYPE "unsigned int"
#define UINT64_TYPE "long long unsigned int"
#define INT_LEAST8_TYPE "signed char"
#define INT_LEAST16_TYPE "short int"
#define INT_LEAST32_TYPE "int"
#define INT_LEAST64_TYPE "long long int"
#define UINT_LEAST8_TYPE "unsigned char"
#define UINT_LEAST16_TYPE "short unsigned int"
#define UINT_LEAST32_TYPE "unsigned int"
#define UINT_LEAST64_TYPE "long long unsigned int"
#define INT_FAST8_TYPE "signed char"
#define INT_FAST16_TYPE "short int"
#define INT_FAST32_TYPE "int"
#define INT_FAST64_TYPE "long long int"
#define UINT_FAST8_TYPE "unsigned char"
#define UINT_FAST16_TYPE "short unsigned int"
#define UINT_FAST32_TYPE "unsigned int"
#define UINT_FAST64_TYPE "long long unsigned int"
#define INTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")
#define UINTPTR_TYPE (TARGET_64BIT ? "long long unsigned int" : "unsigned int")

View File

@ -0,0 +1,257 @@
/* Operating system specific defines to be used when targeting GCC for
hosting on Windows32, using GNU tools and the Windows32 API Library.
Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#undef DEFAULT_ABI
#define DEFAULT_ABI MS_ABI
/* By default, target has a 80387, uses IEEE compatible arithmetic,
returns float values in the 387 and needs stack probes.
We also align doubles to 64-bits for MSVC default compatibility.
Additionally we enable MS_BITFIELD_LAYOUT by default. */
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS \
| MASK_STACK_PROBE | MASK_ALIGN_DOUBLE \
| MASK_MS_BITFIELD_LAYOUT)
/* See i386/crtdll.h for an alternative definition. _INTEGRAL_MAX_BITS
is for compatibility with native compiler. */
#define EXTRA_OS_CPP_BUILTINS() \
do \
{ \
builtin_define ("__MSVCRT__"); \
builtin_define ("__MINGW32__"); \
builtin_define ("_WIN32"); \
builtin_define_std ("WIN32"); \
builtin_define_std ("WINNT"); \
builtin_define_with_int_value ("_INTEGRAL_MAX_BITS", \
TYPE_PRECISION (intmax_type_node));\
if (TARGET_64BIT && ix86_abi == MS_ABI) \
{ \
builtin_define ("__MINGW64__"); \
builtin_define_std ("WIN64"); \
builtin_define ("_WIN64"); \
} \
} \
while (0)
#ifndef TARGET_USE_PTHREAD_BY_DEFAULT
#define SPEC_PTHREAD1 "pthread"
#define SPEC_PTHREAD2 "!no-pthread"
#else
#define SPEC_PTHREAD1 "!no-pthread"
#define SPEC_PTHREAD2 "pthread"
#endif
#undef SUB_LINK_ENTRY32
#undef SUB_LINK_ENTRY64
#define SUB_LINK_ENTRY32 "-e _DllMainCRTStartup@12"
#if defined(USE_MINGW64_LEADING_UNDERSCORES)
#define SUB_LINK_ENTRY64 "-e _DllMainCRTStartup"
#else
#define SUB_LINK_ENTRY64 "-e DllMainCRTStartup"
#endif
#undef SUB_LINK_ENTRY
#if TARGET_64BIT_DEFAULT
#define SUB_LINK_ENTRY SUB_LINK_ENTRY64
#else
#define SUB_LINK_ENTRY SUB_LINK_ENTRY32
#endif
#undef NATIVE_SYSTEM_HEADER_COMPONENT
#define NATIVE_SYSTEM_HEADER_COMPONENT "MINGW"
#undef CPP_SPEC
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} " \
"%{" SPEC_PTHREAD1 ":-D_REENTRANT} " \
"%{" SPEC_PTHREAD2 ": } "
/* For Windows applications, include more libraries, but always include
kernel32. */
#undef LIB_SPEC
#define LIB_SPEC "%{pg:-lgmon} %{" SPEC_PTHREAD1 ":-lpthread} " \
"%{" SPEC_PTHREAD2 ": } " \
"%{mwindows:-lgdi32 -lcomdlg32} " \
"%{fvtable-verify=preinit:-lvtv -lpsapi; \
fvtable-verify=std:-lvtv -lpsapi} " \
"-ladvapi32 -lshell32 -luser32 -lkernel32"
/* Weak symbols do not get resolved if using a Windows dll import lib.
Make the unwind registration references strong undefs. */
#if DWARF2_UNWIND_INFO
/* DW2-unwind is just available for 32-bit mode. */
#if TARGET_64BIT_DEFAULT
#error DW2 unwind is not available for 64-bit.
#endif
#define SHARED_LIBGCC_UNDEFS_SPEC \
"%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info}"
#else
#define SHARED_LIBGCC_UNDEFS_SPEC ""
#endif
#undef SUBTARGET_EXTRA_SPECS
#define SUBTARGET_EXTRA_SPECS \
{ "shared_libgcc_undefs", SHARED_LIBGCC_UNDEFS_SPEC }
#define LINK_SPEC "%{mwindows:--subsystem windows} \
%{mconsole:--subsystem console} \
%{shared: %{mdll: %eshared and mdll are not compatible}} \
%{shared: --shared} %{mdll:--dll} \
%{static:-Bstatic} %{!static:-Bdynamic} \
%{shared|mdll: " SUB_LINK_ENTRY " --enable-auto-image-base} \
%(shared_libgcc_undefs)"
/* Include in the mingw32 libraries with libgcc */
#ifdef ENABLE_SHARED_LIBGCC
#define SHARED_LIBGCC_SPEC " \
%{static|static-libgcc:-lgcc -lgcc_eh} \
%{!static: \
%{!static-libgcc: \
%{!shared: \
%{!shared-libgcc:-lgcc -lgcc_eh} \
%{shared-libgcc:-lgcc_s -lgcc} \
} \
%{shared:-lgcc_s -lgcc} \
} \
} "
#else
#define SHARED_LIBGCC_SPEC " -lgcc "
#endif
#undef REAL_LIBGCC_SPEC
#define REAL_LIBGCC_SPEC \
"%{mthreads:-lmingwthrd} -lmingw32 \
"SHARED_LIBGCC_SPEC" \
-lmoldname -lmingwex -lmsvcrt"
#undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{shared|mdll:dllcrt2%O%s} \
%{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} \
crtbegin.o%s \
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_start.o%s; \
fvtable-verify=std:vtv_start.o%s}"
#undef ENDFILE_SPEC
#define ENDFILE_SPEC \
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} \
%{!shared:%:if-exists(default-manifest.o%s)}\
%{fvtable-verify=none:%s; \
fvtable-verify=preinit:vtv_end.o%s; \
fvtable-verify=std:vtv_end.o%s} \
crtend.o%s"
/* Override startfile prefix defaults. */
#ifndef STANDARD_STARTFILE_PREFIX_1
#define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
#endif
#ifndef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_2 ""
#endif
/* For native mingw-version we need to take care that NATIVE_SYSTEM_HEADER_DIR
macro contains POSIX-style path. See bug 52947. */
#undef NATIVE_SYSTEM_HEADER_DIR
#define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
/* Output STRING, a string representing a filename, to FILE.
We canonicalize it to be in Unix format (backslashes are replaced
forward slashes. */
#undef OUTPUT_QUOTED_STRING
#define OUTPUT_QUOTED_STRING(FILE, STRING) \
do { \
const char *_string = (const char *) (STRING); \
char c; \
\
putc ('\"', (FILE)); \
\
while ((c = *_string++) != 0) \
{ \
if (c == '\\') \
c = '/'; \
\
if (ISPRINT (c)) \
{ \
if (c == '\"') \
putc ('\\', (FILE)); \
putc (c, (FILE)); \
} \
else \
fprintf ((FILE), "\\%03o", (unsigned char) c); \
} \
\
putc ('\"', (FILE)); \
} while (0)
/* Define as short unsigned for compatibility with MS runtime. */
#undef WINT_TYPE
#define WINT_TYPE "short unsigned int"
/* mingw32 uses the -mthreads option to enable thread support. */
#undef GOMP_SELF_SPECS
#define GOMP_SELF_SPECS "%{fopenacc|fopenmp|ftree-parallelize-loops=*: " \
"-mthreads -pthread}"
#undef GTM_SELF_SPECS
#define GTM_SELF_SPECS "%{fgnu-tm:-mthreads -pthread}"
/* mingw32 atexit function is safe to use in shared libraries. Use it
to register C++ static destructors. */
#define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true
/* Contains a pointer to type target_ovr_attr defining the target specific
overrides of format attributes. See c-format.h for structure
definition. */
#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES
#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES mingw_format_attribute_overrides
/* Specify the count of elements in TARGET_OVERRIDES_ATTRIBUTE. */
#undef TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT
#define TARGET_OVERRIDES_FORMAT_ATTRIBUTES_COUNT 3
/* Custom initialization for warning -Wpedantic-ms-format for c-format. */
#undef TARGET_OVERRIDES_FORMAT_INIT
#define TARGET_OVERRIDES_FORMAT_INIT msformat_init
/* MS specific format attributes for ms_printf, ms_scanf, ms_strftime. */
#undef TARGET_FORMAT_TYPES
#define TARGET_FORMAT_TYPES mingw_format_attributes
#undef TARGET_N_FORMAT_TYPES
#define TARGET_N_FORMAT_TYPES 3
/* Let defaults.h definition of TARGET_USE_JCR_SECTION apply. */
#undef TARGET_USE_JCR_SECTION
#define HAVE_ENABLE_EXECUTE_STACK
#undef CHECK_EXECUTE_STACK_ENABLED
#define CHECK_EXECUTE_STACK_ENABLED flag_setstackexecutable
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygming. */
/* This matches SHLIB_SONAME and SHLIB_SOVERSION in t-cygwin. */
#if DWARF2_UNWIND_INFO
#define LIBGCC_EH_EXTN "_dw2"
#else
#define LIBGCC_EH_EXTN "_sjlj"
#endif
#define LIBGCC_SONAME "libgcc_s" LIBGCC_EH_EXTN "-1.dll"
/* We should find a way to not have to update this manually. */
#define LIBGCJ_SONAME "libgcj" /*LIBGCC_EH_EXTN*/ "-16.dll"

View File

@ -0,0 +1,37 @@
/* Definitions for stringop strategy for IA-32.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the files COPYING3. If not,
see <http://www.gnu.org/licenses/>. */
DEF_ENUM
DEF_ALG (no_stringop, no_stringop)
DEF_ENUM
DEF_ALG (libcall, libcall)
DEF_ENUM
DEF_ALG (rep_prefix_1_byte, rep_byte)
DEF_ENUM
DEF_ALG (rep_prefix_4_byte, rep_4byte)
DEF_ENUM
DEF_ALG (rep_prefix_8_byte, rep_8byte)
DEF_ENUM
DEF_ALG (loop_1_byte, byte_loop)
DEF_ENUM
DEF_ALG (loop, loop)
DEF_ENUM
DEF_ALG (unrolled_loop, unrolled_loop)
DEF_ENUM
DEF_ALG (vector_loop, vector_loop)

View File

@ -0,0 +1,80 @@
/* Definitions for Unix assembler syntax for the Intel 80386.
Copyright (C) 1988-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file defines the aspects of assembler syntax
that are the same for all the i386 Unix systems
(though they may differ in non-Unix systems). */
/* Define macro used to output shift-double opcodes when the shift
count is in %cl. Some assemblers require %cl as an argument;
some don't. This macro controls what to do: by default, don't
print %cl. */
#define SHIFT_DOUBLE_OMITS_COUNT 1
/* Define the syntax of pseudo-ops, labels and comments. */
/* String containing the assembler's comment-starter.
Note the trailing space is necessary in case the character
that immediately follows the comment is '*'. If this happens
and the space is not there the assembler will interpret this
as the start of a C-like slash-star comment and complain when
there is no terminator. */
#define ASM_COMMENT_START "/ "
/* Output to assembler file text saying following lines
may contain character constants, extra white space, comments, etc. */
#define ASM_APP_ON "/APP\n"
/* Output to assembler file text saying following lines
no longer contain unusual constructs. */
#define ASM_APP_OFF "/NO_APP\n"
/* Output before read-only data. */
#define TEXT_SECTION_ASM_OP "\t.text"
/* Output before writable (initialized) data. */
#define DATA_SECTION_ASM_OP "\t.data"
/* Output before writable (uninitialized) data. */
#define BSS_SECTION_ASM_OP "\t.bss"
/* Globalizing directive for a label. */
#define GLOBAL_ASM_OP "\t.globl\t"
/* By default, target has a 80387, uses IEEE compatible arithmetic,
and returns float values in the 387. */
#undef TARGET_SUBTARGET_DEFAULT
#define TARGET_SUBTARGET_DEFAULT \
(MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS)
/* By default, 64-bit mode uses 128-bit long double. */
#undef TARGET_SUBTARGET64_DEFAULT
#define TARGET_SUBTARGET64_DEFAULT \
MASK_128BIT_LONG_DOUBLE

View File

@ -0,0 +1,544 @@
/* Definitions of x86 tunable features.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Tuning for a given CPU XXXX consists of:
- adding new CPU into:
- adding PROCESSOR_XXX to processor_type (in i386.h)
- possibly adding XXX into CPU attribute in i386.md
- adding XXX to processor_alias_table (in i386.c)
- introducing ix86_XXX_cost in i386.c
- Stringop generation table can be build based on test_stringop
- script (once rest of tuning is complete)
- designing a scheduler model in
- XXXX.md file
- Updating ix86_issue_rate and ix86_adjust_cost in i386.md
- possibly updating ia32_multipass_dfa_lookahead, ix86_sched_reorder
and ix86_sched_init_global if those tricks are needed.
- Tunning the flags bellow. Those are split into sections and each
section is very roughly ordered by importance. */
/*****************************************************************************/
/* Scheduling flags. */
/*****************************************************************************/
/* X86_TUNE_SCHEDULE: Enable scheduling. */
DEF_TUNE (X86_TUNE_SCHEDULE, "schedule",
m_PENT | m_PPRO | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL
| m_KNL | m_K6_GEODE | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_PARTIAL_REG_DEPENDENCY: Enable more register renaming
on modern chips. Preffer stores affecting whole integer register
over partial stores. For example preffer MOVZBL or MOVQ to load 8bit
value over movb. */
DEF_TUNE (X86_TUNE_PARTIAL_REG_DEPENDENCY, "partial_reg_dependency",
m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL
| m_KNL | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY: This knob promotes all store
destinations to be 128bit to allow register renaming on 128bit SSE units,
but usually results in one extra microop on 64bit SSE units.
Experimental results shows that disabling this option on P4 brings over 20%
SPECfp regression, while enabling it on K8 brings roughly 2.4% regression
that can be partly masked by careful scheduling of moves. */
DEF_TUNE (X86_TUNE_SSE_PARTIAL_REG_DEPENDENCY, "sse_partial_reg_dependency",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_AMDFAM10
| m_BDVER | m_GENERIC)
/* X86_TUNE_SSE_SPLIT_REGS: Set for machines where the type and dependencies
are resolved on SSE register parts instead of whole registers, so we may
maintain just lower part of scalar values in proper format leaving the
upper part undefined. */
DEF_TUNE (X86_TUNE_SSE_SPLIT_REGS, "sse_split_regs", m_ATHLON_K8)
/* X86_TUNE_PARTIAL_FLAG_REG_STALL: this flag disables use of of flags
set by instructions affecting just some flags (in particular shifts).
This is because Core2 resolves dependencies on whole flags register
and such sequences introduce false dependency on previous instruction
setting full flags.
The flags does not affect generation of INC and DEC that is controlled
by X86_TUNE_USE_INCDEC.
This flag may be dropped from generic once core2-corei5 machines are
rare enough. */
DEF_TUNE (X86_TUNE_PARTIAL_FLAG_REG_STALL, "partial_flag_reg_stall",
m_CORE2 | m_GENERIC)
/* X86_TUNE_MOVX: Enable to zero extend integer registers to avoid
partial dependencies. */
DEF_TUNE (X86_TUNE_MOVX, "movx",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
| m_KNL | m_INTEL | m_GEODE | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_MEMORY_MISMATCH_STALL: Avoid partial stores that are followed by
full sized loads. */
DEF_TUNE (X86_TUNE_MEMORY_MISMATCH_STALL, "memory_mismatch_stall",
m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL
| m_KNL | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_FUSE_CMP_AND_BRANCH_32: Fuse compare with a subsequent
conditional jump instruction for 32 bit TARGET.
FIXME: revisit for generic. */
DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_32, "fuse_cmp_and_branch_32",
m_CORE_ALL | m_BDVER)
/* X86_TUNE_FUSE_CMP_AND_BRANCH_64: Fuse compare with a subsequent
conditional jump instruction for TARGET_64BIT.
FIXME: revisit for generic. */
DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_64, "fuse_cmp_and_branch_64",
m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_BDVER)
/* X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS: Fuse compare with a
subsequent conditional jump instruction when the condition jump
check sign flag (SF) or overflow flag (OF). */
DEF_TUNE (X86_TUNE_FUSE_CMP_AND_BRANCH_SOFLAGS, "fuse_cmp_and_branch_soflags",
m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_BDVER)
/* X86_TUNE_FUSE_ALU_AND_BRANCH: Fuse alu with a subsequent conditional
jump instruction when the alu instruction produces the CCFLAG consumed by
the conditional jump instruction. */
DEF_TUNE (X86_TUNE_FUSE_ALU_AND_BRANCH, "fuse_alu_and_branch",
m_SANDYBRIDGE | m_HASWELL)
/* X86_TUNE_REASSOC_INT_TO_PARALLEL: Try to produce parallel computations
during reassociation of integer computation. */
DEF_TUNE (X86_TUNE_REASSOC_INT_TO_PARALLEL, "reassoc_int_to_parallel",
m_BONNELL)
/* X86_TUNE_REASSOC_FP_TO_PARALLEL: Try to produce parallel computations
during reassociation of fp computation. */
DEF_TUNE (X86_TUNE_REASSOC_FP_TO_PARALLEL, "reassoc_fp_to_parallel",
m_BONNELL | m_SILVERMONT | m_HASWELL | m_KNL |m_INTEL | m_BDVER1
| m_BDVER2 | m_GENERIC)
/*****************************************************************************/
/* Function prologue, epilogue and function calling sequences. */
/*****************************************************************************/
/* X86_TUNE_ACCUMULATE_OUTGOING_ARGS: Allocate stack space for outgoing
arguments in prologue/epilogue instead of separately for each call
by push/pop instructions.
This increase code size by about 5% in 32bit mode, less so in 64bit mode
because parameters are passed in registers. It is considerable
win for targets without stack engine that prevents multple push operations
to happen in parallel.
FIXME: the flags is incorrectly enabled for amdfam10, Bulldozer,
Bobcat and Generic. This is because disabling it causes large
regression on mgrid due to IRA limitation leading to unecessary
use of the frame pointer in 32bit mode. */
DEF_TUNE (X86_TUNE_ACCUMULATE_OUTGOING_ARGS, "accumulate_outgoing_args",
m_PPRO | m_P4_NOCONA | m_BONNELL | m_SILVERMONT | m_KNL | m_INTEL
| m_ATHLON_K8)
/* X86_TUNE_PROLOGUE_USING_MOVE: Do not use push/pop in prologues that are
considered on critical path. */
DEF_TUNE (X86_TUNE_PROLOGUE_USING_MOVE, "prologue_using_move",
m_PPRO | m_ATHLON_K8)
/* X86_TUNE_PROLOGUE_USING_MOVE: Do not use push/pop in epilogues that are
considered on critical path. */
DEF_TUNE (X86_TUNE_EPILOGUE_USING_MOVE, "epilogue_using_move",
m_PPRO | m_ATHLON_K8)
/* X86_TUNE_USE_LEAVE: Use "leave" instruction in epilogues where it fits. */
DEF_TUNE (X86_TUNE_USE_LEAVE, "use_leave",
m_386 | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_PUSH_MEMORY: Enable generation of "push mem" instructions.
Some chips, like 486 and Pentium works faster with separate load
and push instructions. */
DEF_TUNE (X86_TUNE_PUSH_MEMORY, "push_memory",
m_386 | m_P4_NOCONA | m_CORE_ALL | m_K6_GEODE | m_AMD_MULTIPLE
| m_GENERIC)
/* X86_TUNE_SINGLE_PUSH: Enable if single push insn is preferred
over esp subtraction. */
DEF_TUNE (X86_TUNE_SINGLE_PUSH, "single_push", m_386 | m_486 | m_PENT
| m_K6_GEODE)
/* X86_TUNE_DOUBLE_PUSH. Enable if double push insn is preferred
over esp subtraction. */
DEF_TUNE (X86_TUNE_DOUBLE_PUSH, "double_push", m_PENT | m_K6_GEODE)
/* X86_TUNE_SINGLE_POP: Enable if single pop insn is preferred
over esp addition. */
DEF_TUNE (X86_TUNE_SINGLE_POP, "single_pop", m_386 | m_486 | m_PENT | m_PPRO)
/* X86_TUNE_DOUBLE_POP: Enable if double pop insn is preferred
over esp addition. */
DEF_TUNE (X86_TUNE_DOUBLE_POP, "double_pop", m_PENT)
/*****************************************************************************/
/* Branch predictor tuning */
/*****************************************************************************/
/* X86_TUNE_PAD_SHORT_FUNCTION: Make every function to be at least 4
instructions long. */
DEF_TUNE (X86_TUNE_PAD_SHORT_FUNCTION, "pad_short_function", m_BONNELL)
/* X86_TUNE_PAD_RETURNS: Place NOP before every RET that is a destination
of conditional jump or directly preceded by other jump instruction.
This is important for AND K8-AMDFAM10 because the branch prediction
architecture expect at most one jump per 2 byte window. Failing to
pad returns leads to misaligned return stack. */
DEF_TUNE (X86_TUNE_PAD_RETURNS, "pad_returns",
m_ATHLON_K8 | m_AMDFAM10 | m_GENERIC)
/* X86_TUNE_FOUR_JUMP_LIMIT: Some CPU cores are not able to predict more
than 4 branch instructions in the 16 byte window. */
DEF_TUNE (X86_TUNE_FOUR_JUMP_LIMIT, "four_jump_limit",
m_PPRO | m_P4_NOCONA | m_BONNELL | m_SILVERMONT | m_KNL |m_INTEL |
m_ATHLON_K8 | m_AMDFAM10)
/*****************************************************************************/
/* Integer instruction selection tuning */
/*****************************************************************************/
/* X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL: Enable software prefetching
at -O3. For the moment, the prefetching seems badly tuned for Intel
chips. */
DEF_TUNE (X86_TUNE_SOFTWARE_PREFETCHING_BENEFICIAL, "software_prefetching_beneficial",
m_K6_GEODE | m_AMD_MULTIPLE)
/* X86_TUNE_LCP_STALL: Avoid an expensive length-changing prefix stall
on 16-bit immediate moves into memory on Core2 and Corei7. */
DEF_TUNE (X86_TUNE_LCP_STALL, "lcp_stall", m_CORE_ALL | m_GENERIC)
/* X86_TUNE_READ_MODIFY: Enable use of read-modify instructions such
as "add mem, reg". */
DEF_TUNE (X86_TUNE_READ_MODIFY, "read_modify", ~(m_PENT | m_PPRO))
/* X86_TUNE_USE_INCDEC: Enable use of inc/dec instructions. */
DEF_TUNE (X86_TUNE_USE_INCDEC, "use_incdec",
~(m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_INTEL
| m_KNL | m_GENERIC))
/* X86_TUNE_INTEGER_DFMODE_MOVES: Enable if integer moves are preferred
for DFmode copies */
DEF_TUNE (X86_TUNE_INTEGER_DFMODE_MOVES, "integer_dfmode_moves",
~(m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
| m_KNL | m_INTEL | m_GEODE | m_AMD_MULTIPLE | m_GENERIC))
/* X86_TUNE_OPT_AGU: Optimize for Address Generation Unit. This flag
will impact LEA instruction selection. */
DEF_TUNE (X86_TUNE_OPT_AGU, "opt_agu", m_BONNELL | m_SILVERMONT | m_KNL
| m_INTEL)
/* X86_TUNE_AVOID_LEA_FOR_ADDR: Avoid lea for address computation. */
DEF_TUNE (X86_TUNE_AVOID_LEA_FOR_ADDR, "avoid_lea_for_addr",
m_BONNELL | m_SILVERMONT | m_KNL)
/* X86_TUNE_SLOW_IMUL_IMM32_MEM: Imul of 32-bit constant and memory is
vector path on AMD machines.
FIXME: Do we need to enable this for core? */
DEF_TUNE (X86_TUNE_SLOW_IMUL_IMM32_MEM, "slow_imul_imm32_mem",
m_K8 | m_AMDFAM10)
/* X86_TUNE_SLOW_IMUL_IMM8: Imul of 8-bit constant is vector path on AMD
machines.
FIXME: Do we need to enable this for core? */
DEF_TUNE (X86_TUNE_SLOW_IMUL_IMM8, "slow_imul_imm8",
m_K8 | m_AMDFAM10)
/* X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE: Try to avoid memory operands for
a conditional move. */
DEF_TUNE (X86_TUNE_AVOID_MEM_OPND_FOR_CMOVE, "avoid_mem_opnd_for_cmove",
m_BONNELL | m_SILVERMONT | m_KNL | m_INTEL)
/* X86_TUNE_SINGLE_STRINGOP: Enable use of single string operations, such
as MOVS and STOS (without a REP prefix) to move/set sequences of bytes. */
DEF_TUNE (X86_TUNE_SINGLE_STRINGOP, "single_stringop", m_386 | m_P4_NOCONA)
/* X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES: Enable generation of
compact prologues and epilogues by issuing a misaligned moves. This
requires target to handle misaligned moves and partial memory stalls
reasonably well.
FIXME: This may actualy be a win on more targets than listed here. */
DEF_TUNE (X86_TUNE_MISALIGNED_MOVE_STRING_PRO_EPILOGUES,
"misaligned_move_string_pro_epilogues",
m_386 | m_486 | m_CORE_ALL | m_AMD_MULTIPLE | m_GENERIC)
/* X86_TUNE_USE_SAHF: Controls use of SAHF. */
DEF_TUNE (X86_TUNE_USE_SAHF, "use_sahf",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
| m_KNL | m_INTEL | m_K6_GEODE | m_K8 | m_AMDFAM10 | m_BDVER
| m_BTVER | m_GENERIC)
/* X86_TUNE_USE_CLTD: Controls use of CLTD and CTQO instructions. */
DEF_TUNE (X86_TUNE_USE_CLTD, "use_cltd",
~(m_PENT | m_BONNELL | m_SILVERMONT | m_KNL | m_INTEL | m_K6))
/* X86_TUNE_USE_BT: Enable use of BT (bit test) instructions. */
DEF_TUNE (X86_TUNE_USE_BT, "use_bt",
m_CORE_ALL | m_BONNELL | m_SILVERMONT | m_KNL | m_INTEL
| m_AMD_MULTIPLE | m_GENERIC)
/*****************************************************************************/
/* 387 instruction selection tuning */
/*****************************************************************************/
/* X86_TUNE_USE_HIMODE_FIOP: Enables use of x87 instructions with 16bit
integer operand.
FIXME: Why this is disabled for modern chips? */
DEF_TUNE (X86_TUNE_USE_HIMODE_FIOP, "use_himode_fiop",
m_386 | m_486 | m_K6_GEODE)
/* X86_TUNE_USE_SIMODE_FIOP: Enables use of x87 instructions with 32bit
integer operand. */
DEF_TUNE (X86_TUNE_USE_SIMODE_FIOP, "use_simode_fiop",
~(m_PENT | m_PPRO | m_CORE_ALL | m_BONNELL | m_SILVERMONT
| m_KNL | m_INTEL | m_AMD_MULTIPLE | m_GENERIC))
/* X86_TUNE_USE_FFREEP: Use freep instruction instead of fstp. */
DEF_TUNE (X86_TUNE_USE_FFREEP, "use_ffreep", m_AMD_MULTIPLE)
/* X86_TUNE_EXT_80387_CONSTANTS: Use fancy 80387 constants, such as PI. */
DEF_TUNE (X86_TUNE_EXT_80387_CONSTANTS, "ext_80387_constants",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BONNELL | m_SILVERMONT
| m_KNL | m_INTEL | m_K6_GEODE | m_ATHLON_K8 | m_GENERIC)
/*****************************************************************************/
/* SSE instruction selection tuning */
/*****************************************************************************/
/* X86_TUNE_VECTORIZE_DOUBLE: Enable double precision vector
instructions. */
DEF_TUNE (X86_TUNE_VECTORIZE_DOUBLE, "vectorize_double", ~m_BONNELL)
/* X86_TUNE_GENERAL_REGS_SSE_SPILL: Try to spill general regs to SSE
regs instead of memory. */
DEF_TUNE (X86_TUNE_GENERAL_REGS_SSE_SPILL, "general_regs_sse_spill",
m_CORE_ALL)
/* X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL: Use movups for misaligned loads instead
of a sequence loading registers by parts. */
DEF_TUNE (X86_TUNE_SSE_UNALIGNED_LOAD_OPTIMAL, "sse_unaligned_load_optimal",
m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_AMDFAM10 | m_BDVER
| m_BTVER | m_SILVERMONT | m_KNL | m_INTEL | m_GENERIC)
/* X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL: Use movups for misaligned stores instead
of a sequence loading registers by parts. */
DEF_TUNE (X86_TUNE_SSE_UNALIGNED_STORE_OPTIMAL, "sse_unaligned_store_optimal",
m_NEHALEM | m_SANDYBRIDGE | m_HASWELL | m_BDVER | m_SILVERMONT
| m_KNL | m_INTEL | m_GENERIC)
/* Use packed single precision instructions where posisble. I.e. movups instead
of movupd. */
DEF_TUNE (X86_TUNE_SSE_PACKED_SINGLE_INSN_OPTIMAL, "sse_packed_single_insn_optimal",
m_BDVER)
/* X86_TUNE_SSE_TYPELESS_STORES: Always movaps/movups for 128bit stores. */
DEF_TUNE (X86_TUNE_SSE_TYPELESS_STORES, "sse_typeless_stores",
m_AMD_MULTIPLE | m_CORE_ALL | m_GENERIC)
/* X86_TUNE_SSE_LOAD0_BY_PXOR: Always use pxor to load0 as opposed to
xorps/xorpd and other variants. */
DEF_TUNE (X86_TUNE_SSE_LOAD0_BY_PXOR, "sse_load0_by_pxor",
m_PPRO | m_P4_NOCONA | m_CORE_ALL | m_BDVER | m_BTVER | m_GENERIC)
/* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from integer
to SSE registers. If disabled, the moves will be done by storing
the value to memory and reloading. */
DEF_TUNE (X86_TUNE_INTER_UNIT_MOVES_TO_VEC, "inter_unit_moves_to_vec",
~(m_AMD_MULTIPLE | m_GENERIC))
/* X86_TUNE_INTER_UNIT_MOVES_TO_VEC: Enable moves in from SSE
to integer registers. If disabled, the moves will be done by storing
the value to memory and reloading. */
DEF_TUNE (X86_TUNE_INTER_UNIT_MOVES_FROM_VEC, "inter_unit_moves_from_vec",
~m_ATHLON_K8)
/* X86_TUNE_INTER_UNIT_CONVERSIONS: Enable float<->integer conversions
to use both SSE and integer registers at a same time.
FIXME: revisit importance of this for generic. */
DEF_TUNE (X86_TUNE_INTER_UNIT_CONVERSIONS, "inter_unit_conversions",
~(m_AMDFAM10 | m_BDVER))
/* X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS: Try to split memory operand for
fp converts to destination register. */
DEF_TUNE (X86_TUNE_SPLIT_MEM_OPND_FOR_FP_CONVERTS, "split_mem_opnd_for_fp_converts",
m_SILVERMONT | m_KNL | m_INTEL)
/* X86_TUNE_USE_VECTOR_FP_CONVERTS: Prefer vector packed SSE conversion
from FP to FP. This form of instructions avoids partial write to the
destination. */
DEF_TUNE (X86_TUNE_USE_VECTOR_FP_CONVERTS, "use_vector_fp_converts",
m_AMDFAM10)
/* X86_TUNE_USE_VECTOR_CONVERTS: Prefer vector packed SSE conversion
from integer to FP. */
DEF_TUNE (X86_TUNE_USE_VECTOR_CONVERTS, "use_vector_converts", m_AMDFAM10)
/* X86_TUNE_SLOW_SHUFB: Indicates tunings with slow pshufb instruction. */
DEF_TUNE (X86_TUNE_SLOW_PSHUFB, "slow_pshufb",
m_BONNELL | m_SILVERMONT | m_KNL | m_INTEL)
/* X86_TUNE_VECTOR_PARALLEL_EXECUTION: Indicates tunings with ability to
execute 2 or more vector instructions in parallel. */
DEF_TUNE (X86_TUNE_VECTOR_PARALLEL_EXECUTION, "vec_parallel",
m_NEHALEM | m_SANDYBRIDGE | m_HASWELL)
/* X86_TUNE_AVOID_4BYTE_PREFIXES: Avoid instructions requiring 4+ bytes of prefixes. */
DEF_TUNE (X86_TUNE_AVOID_4BYTE_PREFIXES, "avoid_4byte_prefixes",
m_SILVERMONT | m_INTEL)
/*****************************************************************************/
/* AVX instruction selection tuning (some of SSE flags affects AVX, too) */
/*****************************************************************************/
/* X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL: if false, unaligned loads are
split. */
DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL, "256_unaligned_load_optimal",
~(m_NEHALEM | m_SANDYBRIDGE | m_GENERIC))
/* X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL: if false, unaligned stores are
split. */
DEF_TUNE (X86_TUNE_AVX256_UNALIGNED_STORE_OPTIMAL, "256_unaligned_store_optimal",
~(m_NEHALEM | m_SANDYBRIDGE | m_BDVER | m_GENERIC))
/* X86_TUNE_AVX128_OPTIMAL: Enable 128-bit AVX instruction generation for
the auto-vectorizer. */
DEF_TUNE (X86_TUNE_AVX128_OPTIMAL, "avx128_optimal", m_BDVER | m_BTVER2)
/*****************************************************************************/
/* Historical relics: tuning flags that helps a specific old CPU designs */
/*****************************************************************************/
/* X86_TUNE_DOUBLE_WITH_ADD: Use add instead of sal to double value in
an integer register. */
DEF_TUNE (X86_TUNE_DOUBLE_WITH_ADD, "double_with_add", ~m_386)
/* X86_TUNE_ALWAYS_FANCY_MATH_387: controls use of fancy 387 operations,
such as fsqrt, fprem, fsin, fcos, fsincos etc.
Should be enabled for all targets that always has coprocesor. */
DEF_TUNE (X86_TUNE_ALWAYS_FANCY_MATH_387, "always_fancy_math_387",
~(m_386 | m_486))
/* X86_TUNE_UNROLL_STRLEN: Produce (quite lame) unrolled sequence for
inline strlen. This affects only -minline-all-stringops mode. By
default we always dispatch to a library since our internal strlen
is bad. */
DEF_TUNE (X86_TUNE_UNROLL_STRLEN, "unroll_strlen", ~m_386)
/* X86_TUNE_SHIFT1: Enables use of short encoding of "sal reg" instead of
longer "sal $1, reg". */
DEF_TUNE (X86_TUNE_SHIFT1, "shift1", ~m_486)
/* X86_TUNE_ZERO_EXTEND_WITH_AND: Use AND instruction instead
of mozbl/movwl. */
DEF_TUNE (X86_TUNE_ZERO_EXTEND_WITH_AND, "zero_extend_with_and", m_486 | m_PENT)
/* X86_TUNE_PROMOTE_HIMODE_IMUL: Modern CPUs have same latency for HImode
and SImode multiply, but 386 and 486 do HImode multiply faster. */
DEF_TUNE (X86_TUNE_PROMOTE_HIMODE_IMUL, "promote_himode_imul",
~(m_386 | m_486))
/* X86_TUNE_FAST_PREFIX: Enable demoting some 32bit or 64bit arithmetic
into 16bit/8bit when resulting sequence is shorter. For example
for "and $-65536, reg" to 16bit store of 0. */
DEF_TUNE (X86_TUNE_FAST_PREFIX, "fast_prefix", ~(m_386 | m_486 | m_PENT))
/* X86_TUNE_READ_MODIFY_WRITE: Enable use of read modify write instructions
such as "add $1, mem". */
DEF_TUNE (X86_TUNE_READ_MODIFY_WRITE, "read_modify_write", ~m_PENT)
/* X86_TUNE_MOVE_M1_VIA_OR: On pentiums, it is faster to load -1 via OR
than a MOV. */
DEF_TUNE (X86_TUNE_MOVE_M1_VIA_OR, "move_m1_via_or", m_PENT)
/* X86_TUNE_NOT_UNPAIRABLE: NOT is not pairable on Pentium, while XOR is,
but one byte longer. */
DEF_TUNE (X86_TUNE_NOT_UNPAIRABLE, "not_unpairable", m_PENT)
/* X86_TUNE_PARTIAL_REG_STALL: Pentium pro, unlike later chips, handled
use of partial registers by renaming. This improved performance of 16bit
code where upper halves of registers are not used. It also leads to
an penalty whenever a 16bit store is followed by 32bit use. This flag
disables production of such sequences in common cases.
See also X86_TUNE_HIMODE_MATH.
In current implementation the partial register stalls are not eliminated
very well - they can be introduced via subregs synthesized by combine
and can happen in caller/callee saving sequences. */
DEF_TUNE (X86_TUNE_PARTIAL_REG_STALL, "partial_reg_stall", m_PPRO)
/* X86_TUNE_PROMOTE_QIMODE: When it is cheap, turn 8bit arithmetic to
corresponding 32bit arithmetic. */
DEF_TUNE (X86_TUNE_PROMOTE_QIMODE, "promote_qimode",
~m_PPRO)
/* X86_TUNE_PROMOTE_HI_REGS: Same, but for 16bit artihmetic. Again we avoid
partial register stalls on PentiumPro targets. */
DEF_TUNE (X86_TUNE_PROMOTE_HI_REGS, "promote_hi_regs", m_PPRO)
/* X86_TUNE_HIMODE_MATH: Enable use of 16bit arithmetic.
On PPro this flag is meant to avoid partial register stalls. */
DEF_TUNE (X86_TUNE_HIMODE_MATH, "himode_math", ~m_PPRO)
/* X86_TUNE_SPLIT_LONG_MOVES: Avoid instructions moving immediates
directly to memory. */
DEF_TUNE (X86_TUNE_SPLIT_LONG_MOVES, "split_long_moves", m_PPRO)
/* X86_TUNE_USE_XCHGB: Use xchgb %rh,%rl instead of rolw/rorw $8,rx. */
DEF_TUNE (X86_TUNE_USE_XCHGB, "use_xchgb", m_PENT4)
/* X86_TUNE_USE_MOV0: Use "mov $0, reg" instead of "xor reg, reg" to clear
integer register. */
DEF_TUNE (X86_TUNE_USE_MOV0, "use_mov0", m_K6)
/* X86_TUNE_NOT_VECTORMODE: On AMD K6, NOT is vector decoded with memory
operand that cannot be represented using a modRM byte. The XOR
replacement is long decoded, so this split helps here as well. */
DEF_TUNE (X86_TUNE_NOT_VECTORMODE, "not_vectormode", m_K6)
/* X86_TUNE_AVOID_VECTOR_DECODE: Enable splitters that avoid vector decoded
forms of instructions on K8 targets. */
DEF_TUNE (X86_TUNE_AVOID_VECTOR_DECODE, "avoid_vector_decode",
m_K8)
/* X86_TUNE_AVOID_FALSE_DEP_FOR_BMI: Avoid false dependency
for bit-manipulation instructions. */
DEF_TUNE (X86_TUNE_AVOID_FALSE_DEP_FOR_BMI, "avoid_false_dep_for_bmi",
m_SANDYBRIDGE | m_HASWELL | m_GENERIC)
/*****************************************************************************/
/* This never worked well before. */
/*****************************************************************************/
/* X86_TUNE_BRANCH_PREDICTION_HINTS: Branch hints were put in P4 based
on simulation result. But after P4 was made, no performance benefit
was observed with branch hints. It also increases the code size.
As a result, icc never generates branch hints. */
DEF_TUNE (X86_TUNE_BRANCH_PREDICTION_HINTS, "branch_prediction_hints", 0)
/* X86_TUNE_QIMODE_MATH: Enable use of 8bit arithmetic. */
DEF_TUNE (X86_TUNE_QIMODE_MATH, "qimode_math", ~0)
/* X86_TUNE_PROMOTE_QI_REGS: This enables generic code that promotes all 8bit
arithmetic to 32bit via PROMOTE_MODE macro. This code generation scheme
is usually used for RISC targets. */
DEF_TUNE (X86_TUNE_PROMOTE_QI_REGS, "promote_qi_regs", 0)
/* X86_TUNE_ADJUST_UNROLL: This enables adjusting the unroll factor based
on hardware capabilities. Bdver3 hardware has a loop buffer which makes
unrolling small loop less important. For, such architectures we adjust
the unroll factor so that the unrolled loop fits the loop buffer. */
DEF_TUNE (X86_TUNE_ADJUST_UNROLL, "adjust_unroll_factor", m_BDVER3 | m_BDVER4)

View File

@ -0,0 +1,31 @@
/* Configuration for GCC for hosting on Windows32.
using GNU tools and the Windows32 API Library.
Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#define HOST_EXECUTABLE_SUFFIX ""
#undef PATH_SEPARATOR
#define PATH_SEPARATOR ';'
/* This is the name of the null device on windows. */
#define HOST_BIT_BUCKET "nul"
/* The st_ino field of struct stat is always 0. */
#define HOST_LACKS_INODE_NUMBERS

View File

@ -0,0 +1,45 @@
/* Definitions for ELF systems with .init_array/.fini_array section
support.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifdef HAVE_INITFINI_ARRAY_SUPPORT
#define USE_INITFINI_ARRAY
#undef INIT_SECTION_ASM_OP
#undef FINI_SECTION_ASM_OP
#undef INIT_ARRAY_SECTION_ASM_OP
#define INIT_ARRAY_SECTION_ASM_OP
#undef FINI_ARRAY_SECTION_ASM_OP
#define FINI_ARRAY_SECTION_ASM_OP
/* Use .init_array/.fini_array section for constructors and destructors. */
#undef TARGET_ASM_CONSTRUCTOR
#define TARGET_ASM_CONSTRUCTOR default_elf_init_array_asm_out_constructor
#undef TARGET_ASM_DESTRUCTOR
#define TARGET_ASM_DESTRUCTOR default_elf_fini_array_asm_out_destructor
#endif

View File

@ -0,0 +1,4 @@
/* Enable Dwarf2 debugging and make it the default */
#define DWARF2_DEBUGGING_INFO 1
#undef PREFERRED_DEBUGGING_TYPE
#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG

View File

@ -0,0 +1,40 @@
/* Dummy definitions of VxWorks-related macros
Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* True if we're targeting VxWorks. */
#ifndef TARGET_VXWORKS
#define TARGET_VXWORKS 0
#endif
/* True if generating code for a VxWorks RTP. */
#ifndef TARGET_VXWORKS_RTP
#define TARGET_VXWORKS_RTP false
#endif
/* The symbol that points to an RTP's table of GOTs. */
#define VXWORKS_GOTT_BASE (gcc_unreachable (), "")
/* The symbol that holds the index of the current module's GOT in
VXWORKS_GOTT_BASE. */
#define VXWORKS_GOTT_INDEX (gcc_unreachable (), "")

View File

@ -0,0 +1,302 @@
/* GCC core type declarations.
Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Provide forward declarations of core types which are referred to by
most of the compiler. This allows header files to use these types
(e.g. in function prototypes) without concern for whether the full
definitions are visible. Some other declarations that need to be
universally visible are here, too.
In the context of tconfig.h, most of these have special definitions
which prevent them from being used except in further type
declarations. This is a kludge; the right thing is to avoid
including the "tm.h" header set in the context of tconfig.h, but
we're not there yet. */
#ifndef GCC_CORETYPES_H
#define GCC_CORETYPES_H
#ifndef GTY
#define GTY(x) /* nothing - marker for gengtype */
#endif
#ifndef USED_FOR_TARGET
typedef int64_t gcov_type;
typedef uint64_t gcov_type_unsigned;
struct bitmap_head;
typedef struct bitmap_head *bitmap;
typedef const struct bitmap_head *const_bitmap;
struct simple_bitmap_def;
typedef struct simple_bitmap_def *sbitmap;
typedef const struct simple_bitmap_def *const_sbitmap;
struct rtx_def;
typedef struct rtx_def *rtx;
typedef const struct rtx_def *const_rtx;
/* Subclasses of rtx_def, using indentation to show the class
hierarchy, along with the relevant invariant.
Where possible, keep this list in the same order as in rtl.def. */
class rtx_def;
class rtx_expr_list; /* GET_CODE (X) == EXPR_LIST */
class rtx_insn_list; /* GET_CODE (X) == INSN_LIST */
class rtx_sequence; /* GET_CODE (X) == SEQUENCE */
class rtx_insn;
class rtx_debug_insn; /* DEBUG_INSN_P (X) */
class rtx_nonjump_insn; /* NONJUMP_INSN_P (X) */
class rtx_jump_insn; /* JUMP_P (X) */
class rtx_call_insn; /* CALL_P (X) */
class rtx_jump_table_data; /* JUMP_TABLE_DATA_P (X) */
class rtx_barrier; /* BARRIER_P (X) */
class rtx_code_label; /* LABEL_P (X) */
class rtx_note; /* NOTE_P (X) */
struct rtvec_def;
typedef struct rtvec_def *rtvec;
typedef const struct rtvec_def *const_rtvec;
struct hwivec_def;
typedef struct hwivec_def *hwivec;
typedef const struct hwivec_def *const_hwivec;
union tree_node;
typedef union tree_node *tree;
typedef const union tree_node *const_tree;
typedef struct gimple_statement_base *gimple;
typedef const struct gimple_statement_base *const_gimple;
typedef gimple gimple_seq;
struct gimple_stmt_iterator;
/* Forward decls for leaf gimple subclasses (for individual gimple codes).
Keep this in the same order as the corresponding codes in gimple.def. */
struct gcond;
struct gdebug;
struct ggoto;
struct glabel;
struct gswitch;
struct gassign;
struct gasm;
struct gcall;
struct gtransaction;
struct greturn;
struct gbind;
struct gcatch;
struct geh_filter;
struct geh_mnt;
struct geh_else;
struct gresx;
struct geh_dispatch;
struct gphi;
struct gtry;
struct gomp_atomic_load;
struct gomp_atomic_store;
struct gomp_continue;
struct gomp_critical;
struct gomp_for;
struct gomp_parallel;
struct gomp_task;
struct gomp_sections;
struct gomp_single;
struct gomp_target;
struct gomp_teams;
union section;
typedef union section section;
struct gcc_options;
struct cl_target_option;
struct cl_optimization;
struct cl_option;
struct cl_decoded_option;
struct cl_option_handlers;
struct diagnostic_context;
struct pretty_printer;
/* Address space number for named address space support. */
typedef unsigned char addr_space_t;
/* The value of addr_space_t that represents the generic address space. */
#define ADDR_SPACE_GENERIC 0
#define ADDR_SPACE_GENERIC_P(AS) ((AS) == ADDR_SPACE_GENERIC)
/* The major intermediate representations of GCC. */
enum ir_type {
IR_GIMPLE,
IR_RTL_CFGRTL,
IR_RTL_CFGLAYOUT
};
/* Provide forward struct declaration so that we don't have to include
all of cpplib.h whenever a random prototype includes a pointer.
Note that the cpp_reader and cpp_token typedefs remain part of
cpplib.h. */
struct cpp_reader;
struct cpp_token;
/* The thread-local storage model associated with a given VAR_DECL
or SYMBOL_REF. This isn't used much, but both trees and RTL refer
to it, so it's here. */
enum tls_model {
TLS_MODEL_NONE,
TLS_MODEL_EMULATED,
TLS_MODEL_REAL,
TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL,
TLS_MODEL_LOCAL_DYNAMIC,
TLS_MODEL_INITIAL_EXEC,
TLS_MODEL_LOCAL_EXEC
};
/* Types of ABI for an offload compiler. */
enum offload_abi {
OFFLOAD_ABI_UNSET,
OFFLOAD_ABI_LP64,
OFFLOAD_ABI_ILP32
};
/* Types of unwind/exception handling info that can be generated. */
enum unwind_info_type
{
UI_NONE,
UI_SJLJ,
UI_DWARF2,
UI_TARGET,
UI_SEH
};
/* Callgraph node profile representation. */
enum node_frequency {
/* This function most likely won't be executed at all.
(set only when profile feedback is available or via function attribute). */
NODE_FREQUENCY_UNLIKELY_EXECUTED,
/* For functions that are known to be executed once (i.e. constructors, destructors
and main function. */
NODE_FREQUENCY_EXECUTED_ONCE,
/* The default value. */
NODE_FREQUENCY_NORMAL,
/* Optimize this function hard
(set only when profile feedback is available or via function attribute). */
NODE_FREQUENCY_HOT
};
/* Possible initialization status of a variable. When requested
by the user, this information is tracked and recorded in the DWARF
debug information, along with the variable's location. */
enum var_init_status
{
VAR_INIT_STATUS_UNKNOWN,
VAR_INIT_STATUS_UNINITIALIZED,
VAR_INIT_STATUS_INITIALIZED
};
struct edge_def;
typedef struct edge_def *edge;
typedef const struct edge_def *const_edge;
struct basic_block_def;
typedef struct basic_block_def *basic_block;
typedef const struct basic_block_def *const_basic_block;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
#define OBSTACK_CHUNK_SIZE 0
#define gcc_obstack_init(OBSTACK) \
obstack_specify_allocation ((OBSTACK), OBSTACK_CHUNK_SIZE, 0, \
obstack_chunk_alloc, \
obstack_chunk_free)
/* enum reg_class is target specific, so it should not appear in
target-independent code or interfaces, like the target hook declarations
in target.h. */
typedef int reg_class_t;
class rtl_opt_pass;
namespace gcc {
class context;
}
#else
struct _dont_use_rtx_here_;
struct _dont_use_rtvec_here_;
struct _dont_use_rtx_insn_here_;
union _dont_use_tree_here_;
#define rtx struct _dont_use_rtx_here_ *
#define const_rtx struct _dont_use_rtx_here_ *
#define rtvec struct _dont_use_rtvec_here *
#define const_rtvec struct _dont_use_rtvec_here *
#define rtx_insn struct _dont_use_rtx_insn_here_
#define tree union _dont_use_tree_here_ *
#define const_tree union _dont_use_tree_here_ *
#endif
/* Classes of functions that compiler needs to check
whether they are present at the runtime or not. */
enum function_class {
function_c94,
function_c99_misc,
function_c99_math_complex,
function_sincos,
function_c11_misc
};
/* Suppose that higher bits are target dependent. */
#define MEMMODEL_MASK ((1<<16)-1)
/* Legacy sync operations set this upper flag in the memory model. This allows
targets that need to do something stronger for sync operations to
differentiate with their target patterns and issue a more appropriate insn
sequence. See bugzilla 65697 for background. */
#define MEMMODEL_SYNC (1<<15)
/* Memory model without SYNC bit for targets/operations that do not care. */
#define MEMMODEL_BASE_MASK (MEMMODEL_SYNC-1)
/* Memory model types for the __atomic* builtins.
This must match the order in libstdc++-v3/include/bits/atomic_base.h. */
enum memmodel
{
MEMMODEL_RELAXED = 0,
MEMMODEL_CONSUME = 1,
MEMMODEL_ACQUIRE = 2,
MEMMODEL_RELEASE = 3,
MEMMODEL_ACQ_REL = 4,
MEMMODEL_SEQ_CST = 5,
MEMMODEL_LAST = 6,
MEMMODEL_SYNC_ACQUIRE = MEMMODEL_ACQUIRE | MEMMODEL_SYNC,
MEMMODEL_SYNC_RELEASE = MEMMODEL_RELEASE | MEMMODEL_SYNC,
MEMMODEL_SYNC_SEQ_CST = MEMMODEL_SEQ_CST | MEMMODEL_SYNC
};
/* Support for user-provided GGC and PCH markers. The first parameter
is a pointer to a pointer, the second a cookie. */
typedef void (*gt_pointer_operator) (void *, void *);
#if !defined (HAVE_UCHAR)
typedef unsigned char uchar;
#endif
#endif /* coretypes.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,301 @@
/* Compilation switch flag type definitions for GCC.
Copyright (C) 1987-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_FLAG_TYPES_H
#define GCC_FLAG_TYPES_H
enum debug_info_type
{
NO_DEBUG, /* Write no debug info. */
DBX_DEBUG, /* Write BSD .stabs for DBX (using dbxout.c). */
SDB_DEBUG, /* Write COFF for (old) SDB (using sdbout.c). */
DWARF2_DEBUG, /* Write Dwarf v2 debug info (using dwarf2out.c). */
XCOFF_DEBUG, /* Write IBM/Xcoff debug info (using dbxout.c). */
VMS_DEBUG, /* Write VMS debug info (using vmsdbgout.c). */
VMS_AND_DWARF2_DEBUG /* Write VMS debug info (using vmsdbgout.c).
and DWARF v2 debug info (using dwarf2out.c). */
};
enum debug_info_levels
{
DINFO_LEVEL_NONE, /* Write no debugging info. */
DINFO_LEVEL_TERSE, /* Write minimal info to support tracebacks only. */
DINFO_LEVEL_NORMAL, /* Write info for all declarations (and line table). */
DINFO_LEVEL_VERBOSE /* Write normal info plus #define/#undef info. */
};
/* A major contribution to object and executable size is debug
information size. A major contribution to debug information
size is struct descriptions replicated in several object files.
The following function determines whether or not debug information
should be generated for a given struct. The indirect parameter
indicates that the struct is being handled indirectly, via
a pointer. See opts.c for the implementation. */
enum debug_info_usage
{
DINFO_USAGE_DFN, /* A struct definition. */
DINFO_USAGE_DIR_USE, /* A direct use, such as the type of a variable. */
DINFO_USAGE_IND_USE, /* An indirect use, such as through a pointer. */
DINFO_USAGE_NUM_ENUMS /* The number of enumerators. */
};
/* A major contribution to object and executable size is debug
information size. A major contribution to debug information size
is struct descriptions replicated in several object files. The
following flags attempt to reduce this information. The basic
idea is to not emit struct debugging information in the current
compilation unit when that information will be generated by
another compilation unit.
Debug information for a struct defined in the current source
file should be generated in the object file. Likewise the
debug information for a struct defined in a header should be
generated in the object file of the corresponding source file.
Both of these case are handled when the base name of the file of
the struct definition matches the base name of the source file
of the current compilation unit. This matching emits minimal
struct debugging information.
The base file name matching rule above will fail to emit debug
information for structs defined in system headers. So a second
category of files includes system headers in addition to files
with matching bases.
The remaining types of files are library headers and application
headers. We cannot currently distinguish these two types. */
enum debug_struct_file
{
DINFO_STRUCT_FILE_NONE, /* Debug no structs. */
DINFO_STRUCT_FILE_BASE, /* Debug structs defined in files with the
same base name as the compilation unit. */
DINFO_STRUCT_FILE_SYS, /* Also debug structs defined in system
header files. */
DINFO_STRUCT_FILE_ANY /* Debug structs defined in all files. */
};
/* Enumerate visibility settings. This is deliberately ordered from most
to least visibility. */
#ifndef SYMBOL_VISIBILITY_DEFINED
#define SYMBOL_VISIBILITY_DEFINED
enum symbol_visibility
{
VISIBILITY_DEFAULT,
VISIBILITY_PROTECTED,
VISIBILITY_HIDDEN,
VISIBILITY_INTERNAL
};
#endif
/* Enumerate Objective-c instance variable visibility settings. */
enum ivar_visibility
{
IVAR_VISIBILITY_PRIVATE,
IVAR_VISIBILITY_PROTECTED,
IVAR_VISIBILITY_PUBLIC,
IVAR_VISIBILITY_PACKAGE
};
/* The stack reuse level. */
enum stack_reuse_level
{
SR_NONE,
SR_NAMED_VARS,
SR_ALL
};
/* The algorithm used for the integrated register allocator (IRA). */
enum ira_algorithm
{
IRA_ALGORITHM_CB,
IRA_ALGORITHM_PRIORITY
};
/* The regions used for the integrated register allocator (IRA). */
enum ira_region
{
IRA_REGION_ONE,
IRA_REGION_ALL,
IRA_REGION_MIXED,
/* This value means that there were no options -fira-region on the
command line and that we should choose a value depending on the
used -O option. */
IRA_REGION_AUTODETECT
};
/* The options for excess precision. */
enum excess_precision
{
EXCESS_PRECISION_DEFAULT,
EXCESS_PRECISION_FAST,
EXCESS_PRECISION_STANDARD
};
/* Type of stack check. */
enum stack_check_type
{
/* Do not check the stack. */
NO_STACK_CHECK = 0,
/* Check the stack generically, i.e. assume no specific support
from the target configuration files. */
GENERIC_STACK_CHECK,
/* Check the stack and rely on the target configuration files to
check the static frame of functions, i.e. use the generic
mechanism only for dynamic stack allocations. */
STATIC_BUILTIN_STACK_CHECK,
/* Check the stack and entirely rely on the target configuration
files, i.e. do not use the generic mechanism at all. */
FULL_BUILTIN_STACK_CHECK
};
/* Names for the different levels of -Wstrict-overflow=N. The numeric
values here correspond to N. */
enum warn_strict_overflow_code
{
/* Overflow warning that should be issued with -Wall: a questionable
construct that is easy to avoid even when using macros. Example:
folding (x + CONSTANT > x) to 1. */
WARN_STRICT_OVERFLOW_ALL = 1,
/* Overflow warning about folding a comparison to a constant because
of undefined signed overflow, other than cases covered by
WARN_STRICT_OVERFLOW_ALL. Example: folding (abs (x) >= 0) to 1
(this is false when x == INT_MIN). */
WARN_STRICT_OVERFLOW_CONDITIONAL = 2,
/* Overflow warning about changes to comparisons other than folding
them to a constant. Example: folding (x + 1 > 1) to (x > 0). */
WARN_STRICT_OVERFLOW_COMPARISON = 3,
/* Overflow warnings not covered by the above cases. Example:
folding ((x * 10) / 5) to (x * 2). */
WARN_STRICT_OVERFLOW_MISC = 4,
/* Overflow warnings about reducing magnitude of constants in
comparison. Example: folding (x + 2 > y) to (x + 1 >= y). */
WARN_STRICT_OVERFLOW_MAGNITUDE = 5
};
/* Floating-point contraction mode. */
enum fp_contract_mode {
FP_CONTRACT_OFF = 0,
FP_CONTRACT_ON = 1,
FP_CONTRACT_FAST = 2
};
/* Vectorizer cost-model. */
enum vect_cost_model {
VECT_COST_MODEL_UNLIMITED = 0,
VECT_COST_MODEL_CHEAP = 1,
VECT_COST_MODEL_DYNAMIC = 2,
VECT_COST_MODEL_DEFAULT = 3
};
/* Different instrumentation modes. */
enum sanitize_code {
/* AddressSanitizer. */
SANITIZE_ADDRESS = 1 << 0,
SANITIZE_USER_ADDRESS = 1 << 1,
SANITIZE_KERNEL_ADDRESS = 1 << 2,
/* ThreadSanitizer. */
SANITIZE_THREAD = 1 << 3,
/* LeakSanitizer. */
SANITIZE_LEAK = 1 << 4,
/* UndefinedBehaviorSanitizer. */
SANITIZE_SHIFT = 1 << 5,
SANITIZE_DIVIDE = 1 << 6,
SANITIZE_UNREACHABLE = 1 << 7,
SANITIZE_VLA = 1 << 8,
SANITIZE_NULL = 1 << 9,
SANITIZE_RETURN = 1 << 10,
SANITIZE_SI_OVERFLOW = 1 << 11,
SANITIZE_BOOL = 1 << 12,
SANITIZE_ENUM = 1 << 13,
SANITIZE_FLOAT_DIVIDE = 1 << 14,
SANITIZE_FLOAT_CAST = 1 << 15,
SANITIZE_BOUNDS = 1UL << 16,
SANITIZE_ALIGNMENT = 1UL << 17,
SANITIZE_NONNULL_ATTRIBUTE = 1UL << 18,
SANITIZE_RETURNS_NONNULL_ATTRIBUTE = 1UL << 19,
SANITIZE_OBJECT_SIZE = 1UL << 20,
SANITIZE_VPTR = 1UL << 21,
SANITIZE_UNDEFINED = SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_UNREACHABLE
| SANITIZE_VLA | SANITIZE_NULL | SANITIZE_RETURN
| SANITIZE_SI_OVERFLOW | SANITIZE_BOOL | SANITIZE_ENUM
| SANITIZE_BOUNDS | SANITIZE_ALIGNMENT
| SANITIZE_NONNULL_ATTRIBUTE
| SANITIZE_RETURNS_NONNULL_ATTRIBUTE
| SANITIZE_OBJECT_SIZE | SANITIZE_VPTR,
SANITIZE_NONDEFAULT = SANITIZE_FLOAT_DIVIDE | SANITIZE_FLOAT_CAST
};
/* flag_vtable_verify initialization levels. */
enum vtv_priority {
VTV_NO_PRIORITY = 0, /* i.E. Do NOT do vtable verification. */
VTV_STANDARD_PRIORITY = 1,
VTV_PREINIT_PRIORITY = 2
};
/* flag_lto_partition initialization values. */
enum lto_partition_model {
LTO_PARTITION_NONE = 0,
LTO_PARTITION_ONE = 1,
LTO_PARTITION_BALANCED = 2,
LTO_PARTITION_1TO1 = 3,
LTO_PARTITION_MAX = 4
};
/* gfortran -finit-real= values. */
enum gfc_init_local_real
{
GFC_INIT_REAL_OFF = 0,
GFC_INIT_REAL_ZERO,
GFC_INIT_REAL_NAN,
GFC_INIT_REAL_SNAN,
GFC_INIT_REAL_INF,
GFC_INIT_REAL_NEG_INF
};
/* gfortran -fcoarray= values. */
enum gfc_fcoarray
{
GFC_FCOARRAY_NONE = 0,
GFC_FCOARRAY_SINGLE,
GFC_FCOARRAY_LIB
};
/* gfortran -fconvert= values; used for unformatted I/O.
Keep in sync with GFC_CONVERT_* in gcc/fortran/libgfortran.h. */
enum gfc_convert
{
GFC_FLAG_CONVERT_NATIVE = 0,
GFC_FLAG_CONVERT_SWAP,
GFC_FLAG_CONVERT_BIG,
GFC_FLAG_CONVERT_LITTLE
};
#endif /* ! GCC_FLAG_TYPES_H */

View File

@ -0,0 +1,385 @@
/* Generated automatically by the program `genconstants'
from the machine description file `md'. */
#ifndef GCC_INSN_CONSTANTS_H
#define GCC_INSN_CONSTANTS_H
#define XMM27_REG 64
#define XMM9_REG 46
#define ST6_REG 14
#define MASK5_REG 74
#define R13_REG 42
#define XMM14_REG 51
#define ROUND_CEIL 0x2
#define PCOM_TRUE 1
#define XMM7_REG 28
#define PPERM_SRC 0x00
#define PPERM_ZERO 0x80
#define MM7_REG 36
#define XMM6_REG 27
#define ST3_REG 11
#define MASK2_REG 71
#define R10_REG 39
#define XMM11_REG 48
#define XMM19_REG 56
#define ST1_REG 9
#define MASK3_REG 72
#define MM4_REG 33
#define ST7_REG 15
#define COM_FALSE_P 3
#define XMM3_REG 24
#define XMM24_REG 61
#define ST0_REG 8
#define MASK7_REG 76
#define BND1_REG 78
#define COM_FALSE_S 2
#define SP_REG 7
#define AX_REG 0
#define BND0_REG 77
#define ROUND_NO_EXC 0x8
#define MM1_REG 30
#define MM3_REG 32
#define XMM1_REG 22
#define ROUND_ZERO 3
#define XMM16_REG 53
#define FPCR_REG 19
#define XMM8_REG 45
#define XMM4_REG 25
#define ST5_REG 13
#define XMM23_REG 60
#define R12_REG 41
#define R9_REG 38
#define XMM26_REG 63
#define ROUND_MXCSR 0x4
#define PCOM_FALSE 0
#define MASK4_REG 73
#define XMM12_REG 49
#define FLAGS_REG 17
#define PPERM_INVERT 0x20
#define MM6_REG 35
#define PPERM_SRC1 0x00
#define PPERM_SRC2 0x10
#define ST2_REG 10
#define MASK1_REG 70
#define XMM10_REG 47
#define XMM20_REG 57
#define ROUND_TRUNC 0x3
#define XMM18_REG 55
#define DI_REG 5
#define ROUND_SAE 8
#define XMM25_REG 62
#define DX_REG 1
#define XMM29_REG 66
#define NO_ROUND 4
#define BP_REG 6
#define XMM5_REG 26
#define COM_TRUE_P 5
#define COM_TRUE_S 4
#define ROUND_FLOOR 0x1
#define FPSR_REG 18
#define MASK6_REG 75
#define R14_REG 43
#define XMM28_REG 65
#define R15_REG 44
#define XMM13_REG 50
#define ROUND_NEAREST_INT 0
#define PPERM_SIGN 0xc0
#define MM0_REG 29
#define XMM31_REG 68
#define BX_REG 3
#define XMM30_REG 67
#define ST4_REG 12
#define PPERM_INV_SIGN 0xe0
#define R11_REG 40
#define MM5_REG 34
#define PPERM_REVERSE 0x40
#define CX_REG 2
#define MASK0_REG 69
#define R8_REG 37
#define SI_REG 4
#define XMM22_REG 59
#define XMM15_REG 52
#define XMM0_REG 21
#define XMM17_REG 54
#define ROUND_NEG_INF 1
#define ROUND_POS_INF 2
#define XMM2_REG 23
#define PPERM_ONES 0xa0
#define XMM21_REG 58
#define MM2_REG 31
#define PPERM_REV_INV 0x60
enum unspec {
UNSPEC_GOT = 0,
UNSPEC_GOTOFF = 1,
UNSPEC_GOTPCREL = 2,
UNSPEC_GOTTPOFF = 3,
UNSPEC_TPOFF = 4,
UNSPEC_NTPOFF = 5,
UNSPEC_DTPOFF = 6,
UNSPEC_GOTNTPOFF = 7,
UNSPEC_INDNTPOFF = 8,
UNSPEC_PLTOFF = 9,
UNSPEC_MACHOPIC_OFFSET = 10,
UNSPEC_PCREL = 11,
UNSPEC_SIZEOF = 12,
UNSPEC_STACK_ALLOC = 13,
UNSPEC_SET_GOT = 14,
UNSPEC_SET_RIP = 15,
UNSPEC_SET_GOT_OFFSET = 16,
UNSPEC_MEMORY_BLOCKAGE = 17,
UNSPEC_STACK_CHECK = 18,
UNSPEC_TP = 19,
UNSPEC_TLS_GD = 20,
UNSPEC_TLS_LD_BASE = 21,
UNSPEC_TLSDESC = 22,
UNSPEC_TLS_IE_SUN = 23,
UNSPEC_SCAS = 24,
UNSPEC_FNSTSW = 25,
UNSPEC_SAHF = 26,
UNSPEC_PARITY = 27,
UNSPEC_FSTCW = 28,
UNSPEC_FLDCW = 29,
UNSPEC_REP = 30,
UNSPEC_LD_MPIC = 31,
UNSPEC_TRUNC_NOOP = 32,
UNSPEC_DIV_ALREADY_SPLIT = 33,
UNSPEC_PAUSE = 34,
UNSPEC_LEA_ADDR = 35,
UNSPEC_XBEGIN_ABORT = 36,
UNSPEC_STOS = 37,
UNSPEC_PEEPSIB = 38,
UNSPEC_INSN_FALSE_DEP = 39,
UNSPEC_FIX_NOTRUNC = 40,
UNSPEC_MASKMOV = 41,
UNSPEC_MOVMSK = 42,
UNSPEC_RCP = 43,
UNSPEC_RSQRT = 44,
UNSPEC_PSADBW = 45,
UNSPEC_COPYSIGN = 46,
UNSPEC_IEEE_MIN = 47,
UNSPEC_IEEE_MAX = 48,
UNSPEC_SIN = 49,
UNSPEC_COS = 50,
UNSPEC_FPATAN = 51,
UNSPEC_FYL2X = 52,
UNSPEC_FYL2XP1 = 53,
UNSPEC_FRNDINT = 54,
UNSPEC_FIST = 55,
UNSPEC_F2XM1 = 56,
UNSPEC_TAN = 57,
UNSPEC_FXAM = 58,
UNSPEC_FRNDINT_FLOOR = 59,
UNSPEC_FRNDINT_CEIL = 60,
UNSPEC_FRNDINT_TRUNC = 61,
UNSPEC_FRNDINT_MASK_PM = 62,
UNSPEC_FIST_FLOOR = 63,
UNSPEC_FIST_CEIL = 64,
UNSPEC_SINCOS_COS = 65,
UNSPEC_SINCOS_SIN = 66,
UNSPEC_XTRACT_FRACT = 67,
UNSPEC_XTRACT_EXP = 68,
UNSPEC_FSCALE_FRACT = 69,
UNSPEC_FSCALE_EXP = 70,
UNSPEC_FPREM_F = 71,
UNSPEC_FPREM_U = 72,
UNSPEC_FPREM1_F = 73,
UNSPEC_FPREM1_U = 74,
UNSPEC_C2_FLAG = 75,
UNSPEC_FXAM_MEM = 76,
UNSPEC_SP_SET = 77,
UNSPEC_SP_TEST = 78,
UNSPEC_SP_TLS_SET = 79,
UNSPEC_SP_TLS_TEST = 80,
UNSPEC_ROUND = 81,
UNSPEC_CRC32 = 82,
UNSPEC_BEXTR = 83,
UNSPEC_PDEP = 84,
UNSPEC_PEXT = 85,
UNSPEC_KMOV = 86,
UNSPEC_BNDMK = 87,
UNSPEC_BNDMK_ADDR = 88,
UNSPEC_BNDSTX = 89,
UNSPEC_BNDLDX = 90,
UNSPEC_BNDLDX_ADDR = 91,
UNSPEC_BNDCL = 92,
UNSPEC_BNDCU = 93,
UNSPEC_BNDCN = 94,
UNSPEC_MPX_FENCE = 95,
UNSPEC_MOVNTQ = 96,
UNSPEC_PFRCP = 97,
UNSPEC_PFRCPIT1 = 98,
UNSPEC_PFRCPIT2 = 99,
UNSPEC_PFRSQRT = 100,
UNSPEC_PFRSQIT1 = 101,
UNSPEC_MOVNT = 102,
UNSPEC_LOADU = 103,
UNSPEC_STOREU = 104,
UNSPEC_LDDQU = 105,
UNSPEC_PSHUFB = 106,
UNSPEC_PSIGN = 107,
UNSPEC_PALIGNR = 108,
UNSPEC_EXTRQI = 109,
UNSPEC_EXTRQ = 110,
UNSPEC_INSERTQI = 111,
UNSPEC_INSERTQ = 112,
UNSPEC_BLENDV = 113,
UNSPEC_INSERTPS = 114,
UNSPEC_DP = 115,
UNSPEC_MOVNTDQA = 116,
UNSPEC_MPSADBW = 117,
UNSPEC_PHMINPOSUW = 118,
UNSPEC_PTEST = 119,
UNSPEC_PCMPESTR = 120,
UNSPEC_PCMPISTR = 121,
UNSPEC_FMADDSUB = 122,
UNSPEC_XOP_UNSIGNED_CMP = 123,
UNSPEC_XOP_TRUEFALSE = 124,
UNSPEC_XOP_PERMUTE = 125,
UNSPEC_FRCZ = 126,
UNSPEC_AESENC = 127,
UNSPEC_AESENCLAST = 128,
UNSPEC_AESDEC = 129,
UNSPEC_AESDECLAST = 130,
UNSPEC_AESIMC = 131,
UNSPEC_AESKEYGENASSIST = 132,
UNSPEC_PCLMUL = 133,
UNSPEC_PCMP = 134,
UNSPEC_VPERMIL = 135,
UNSPEC_VPERMIL2 = 136,
UNSPEC_VPERMIL2F128 = 137,
UNSPEC_CAST = 138,
UNSPEC_VTESTP = 139,
UNSPEC_VCVTPH2PS = 140,
UNSPEC_VCVTPS2PH = 141,
UNSPEC_VPERMVAR = 142,
UNSPEC_VPERMTI = 143,
UNSPEC_GATHER = 144,
UNSPEC_VSIBADDR = 145,
UNSPEC_VPERMI2 = 146,
UNSPEC_VPERMT2 = 147,
UNSPEC_VPERMI2_MASK = 148,
UNSPEC_UNSIGNED_FIX_NOTRUNC = 149,
UNSPEC_UNSIGNED_PCMP = 150,
UNSPEC_TESTM = 151,
UNSPEC_TESTNM = 152,
UNSPEC_SCATTER = 153,
UNSPEC_RCP14 = 154,
UNSPEC_RSQRT14 = 155,
UNSPEC_FIXUPIMM = 156,
UNSPEC_SCALEF = 157,
UNSPEC_VTERNLOG = 158,
UNSPEC_GETEXP = 159,
UNSPEC_GETMANT = 160,
UNSPEC_ALIGN = 161,
UNSPEC_CONFLICT = 162,
UNSPEC_COMPRESS = 163,
UNSPEC_COMPRESS_STORE = 164,
UNSPEC_EXPAND = 165,
UNSPEC_MASKED_EQ = 166,
UNSPEC_MASKED_GT = 167,
UNSPEC_EMBEDDED_ROUNDING = 168,
UNSPEC_GATHER_PREFETCH = 169,
UNSPEC_SCATTER_PREFETCH = 170,
UNSPEC_EXP2 = 171,
UNSPEC_RCP28 = 172,
UNSPEC_RSQRT28 = 173,
UNSPEC_SHA1MSG1 = 174,
UNSPEC_SHA1MSG2 = 175,
UNSPEC_SHA1NEXTE = 176,
UNSPEC_SHA1RNDS4 = 177,
UNSPEC_SHA256MSG1 = 178,
UNSPEC_SHA256MSG2 = 179,
UNSPEC_SHA256RNDS2 = 180,
UNSPEC_DBPSADBW = 181,
UNSPEC_PMADDUBSW512 = 182,
UNSPEC_PMADDWD512 = 183,
UNSPEC_PSHUFHW = 184,
UNSPEC_PSHUFLW = 185,
UNSPEC_CVTINT2MASK = 186,
UNSPEC_REDUCE = 187,
UNSPEC_FPCLASS = 188,
UNSPEC_RANGE = 189,
UNSPEC_VPMADD52LUQ = 190,
UNSPEC_VPMADD52HUQ = 191,
UNSPEC_VPMULTISHIFT = 192,
UNSPEC_LFENCE = 193,
UNSPEC_SFENCE = 194,
UNSPEC_MFENCE = 195,
UNSPEC_FILD_ATOMIC = 196,
UNSPEC_FIST_ATOMIC = 197,
UNSPEC_LDA = 198,
UNSPEC_STA = 199
};
#define NUM_UNSPEC_VALUES 200
extern const char *const unspec_strings[];
enum unspecv {
UNSPECV_BLOCKAGE = 0,
UNSPECV_STACK_PROBE = 1,
UNSPECV_PROBE_STACK_RANGE = 2,
UNSPECV_ALIGN = 3,
UNSPECV_PROLOGUE_USE = 4,
UNSPECV_SPLIT_STACK_RETURN = 5,
UNSPECV_CLD = 6,
UNSPECV_NOPS = 7,
UNSPECV_RDTSC = 8,
UNSPECV_RDTSCP = 9,
UNSPECV_RDPMC = 10,
UNSPECV_LLWP_INTRINSIC = 11,
UNSPECV_SLWP_INTRINSIC = 12,
UNSPECV_LWPVAL_INTRINSIC = 13,
UNSPECV_LWPINS_INTRINSIC = 14,
UNSPECV_RDFSBASE = 15,
UNSPECV_RDGSBASE = 16,
UNSPECV_WRFSBASE = 17,
UNSPECV_WRGSBASE = 18,
UNSPECV_FXSAVE = 19,
UNSPECV_FXRSTOR = 20,
UNSPECV_FXSAVE64 = 21,
UNSPECV_FXRSTOR64 = 22,
UNSPECV_XSAVE = 23,
UNSPECV_XRSTOR = 24,
UNSPECV_XSAVE64 = 25,
UNSPECV_XRSTOR64 = 26,
UNSPECV_XSAVEOPT = 27,
UNSPECV_XSAVEOPT64 = 28,
UNSPECV_XSAVES = 29,
UNSPECV_XRSTORS = 30,
UNSPECV_XSAVES64 = 31,
UNSPECV_XRSTORS64 = 32,
UNSPECV_XSAVEC = 33,
UNSPECV_XSAVEC64 = 34,
UNSPECV_FNSTENV = 35,
UNSPECV_FLDENV = 36,
UNSPECV_FNSTSW = 37,
UNSPECV_FNCLEX = 38,
UNSPECV_RDRAND = 39,
UNSPECV_RDSEED = 40,
UNSPECV_XBEGIN = 41,
UNSPECV_XEND = 42,
UNSPECV_XABORT = 43,
UNSPECV_XTEST = 44,
UNSPECV_NLGR = 45,
UNSPECV_CLWB = 46,
UNSPECV_PCOMMIT = 47,
UNSPECV_CLFLUSHOPT = 48,
UNSPECV_MONITORX = 49,
UNSPECV_MWAITX = 50,
UNSPECV_EMMS = 51,
UNSPECV_FEMMS = 52,
UNSPECV_LDMXCSR = 53,
UNSPECV_STMXCSR = 54,
UNSPECV_CLFLUSH = 55,
UNSPECV_MONITOR = 56,
UNSPECV_MWAIT = 57,
UNSPECV_VZEROALL = 58,
UNSPECV_VZEROUPPER = 59,
UNSPECV_CMPXCHG = 60,
UNSPECV_XCHG = 61,
UNSPECV_LOCK = 62
};
#define NUM_UNSPECV_VALUES 63
extern const char *const unspecv_strings[];
#endif /* GCC_INSN_CONSTANTS_H */

View File

@ -0,0 +1,638 @@
/* Generated automatically from machmode.def and config/i386/i386-modes.def
by genmodes. */
#ifndef GCC_INSN_MODES_H
#define GCC_INSN_MODES_H
enum machine_mode
{
VOIDmode, /* machmode.def:172 */
#define HAVE_VOIDmode
BLKmode, /* machmode.def:176 */
#define HAVE_BLKmode
CCmode, /* machmode.def:214 */
#define HAVE_CCmode
CCGCmode, /* config/i386/i386-modes.def:61 */
#define HAVE_CCGCmode
CCGOCmode, /* config/i386/i386-modes.def:62 */
#define HAVE_CCGOCmode
CCNOmode, /* config/i386/i386-modes.def:63 */
#define HAVE_CCNOmode
CCAmode, /* config/i386/i386-modes.def:64 */
#define HAVE_CCAmode
CCCmode, /* config/i386/i386-modes.def:65 */
#define HAVE_CCCmode
CCOmode, /* config/i386/i386-modes.def:66 */
#define HAVE_CCOmode
CCSmode, /* config/i386/i386-modes.def:67 */
#define HAVE_CCSmode
CCZmode, /* config/i386/i386-modes.def:68 */
#define HAVE_CCZmode
CCFPmode, /* config/i386/i386-modes.def:69 */
#define HAVE_CCFPmode
CCFPUmode, /* config/i386/i386-modes.def:70 */
#define HAVE_CCFPUmode
BImode, /* machmode.def:179 */
#define HAVE_BImode
QImode, /* machmode.def:187 */
#define HAVE_QImode
HImode, /* machmode.def:188 */
#define HAVE_HImode
SImode, /* machmode.def:189 */
#define HAVE_SImode
DImode, /* machmode.def:190 */
#define HAVE_DImode
TImode, /* machmode.def:191 */
#define HAVE_TImode
OImode, /* config/i386/i386-modes.def:96 */
#define HAVE_OImode
XImode, /* config/i386/i386-modes.def:97 */
#define HAVE_XImode
BND32mode, /* config/i386/i386-modes.def:93 */
#define HAVE_BND32mode
BND64mode, /* config/i386/i386-modes.def:94 */
#define HAVE_BND64mode
QQmode, /* machmode.def:217 */
#define HAVE_QQmode
HQmode, /* machmode.def:218 */
#define HAVE_HQmode
SQmode, /* machmode.def:219 */
#define HAVE_SQmode
DQmode, /* machmode.def:220 */
#define HAVE_DQmode
TQmode, /* machmode.def:221 */
#define HAVE_TQmode
UQQmode, /* machmode.def:223 */
#define HAVE_UQQmode
UHQmode, /* machmode.def:224 */
#define HAVE_UHQmode
USQmode, /* machmode.def:225 */
#define HAVE_USQmode
UDQmode, /* machmode.def:226 */
#define HAVE_UDQmode
UTQmode, /* machmode.def:227 */
#define HAVE_UTQmode
HAmode, /* machmode.def:229 */
#define HAVE_HAmode
SAmode, /* machmode.def:230 */
#define HAVE_SAmode
DAmode, /* machmode.def:231 */
#define HAVE_DAmode
TAmode, /* machmode.def:232 */
#define HAVE_TAmode
UHAmode, /* machmode.def:234 */
#define HAVE_UHAmode
USAmode, /* machmode.def:235 */
#define HAVE_USAmode
UDAmode, /* machmode.def:236 */
#define HAVE_UDAmode
UTAmode, /* machmode.def:237 */
#define HAVE_UTAmode
SFmode, /* machmode.def:209 */
#define HAVE_SFmode
DFmode, /* machmode.def:210 */
#define HAVE_DFmode
XFmode, /* config/i386/i386-modes.def:24 */
#define HAVE_XFmode
TFmode, /* config/i386/i386-modes.def:25 */
#define HAVE_TFmode
SDmode, /* machmode.def:249 */
#define HAVE_SDmode
DDmode, /* machmode.def:250 */
#define HAVE_DDmode
TDmode, /* machmode.def:251 */
#define HAVE_TDmode
CQImode, /* machmode.def:245 */
#define HAVE_CQImode
CHImode, /* machmode.def:245 */
#define HAVE_CHImode
CSImode, /* machmode.def:245 */
#define HAVE_CSImode
CDImode, /* machmode.def:245 */
#define HAVE_CDImode
CTImode, /* machmode.def:245 */
#define HAVE_CTImode
COImode, /* machmode.def:245 */
#define HAVE_COImode
CXImode, /* machmode.def:245 */
#define HAVE_CXImode
SCmode, /* machmode.def:246 */
#define HAVE_SCmode
DCmode, /* machmode.def:246 */
#define HAVE_DCmode
XCmode, /* machmode.def:246 */
#define HAVE_XCmode
TCmode, /* machmode.def:246 */
#define HAVE_TCmode
V2QImode, /* config/i386/i386-modes.def:88 */
#define HAVE_V2QImode
V4QImode, /* config/i386/i386-modes.def:74 */
#define HAVE_V4QImode
V2HImode, /* config/i386/i386-modes.def:74 */
#define HAVE_V2HImode
V1SImode, /* config/i386/i386-modes.def:87 */
#define HAVE_V1SImode
V8QImode, /* config/i386/i386-modes.def:75 */
#define HAVE_V8QImode
V4HImode, /* config/i386/i386-modes.def:75 */
#define HAVE_V4HImode
V2SImode, /* config/i386/i386-modes.def:75 */
#define HAVE_V2SImode
V1DImode, /* config/i386/i386-modes.def:86 */
#define HAVE_V1DImode
V12QImode, /* config/i386/i386-modes.def:89 */
#define HAVE_V12QImode
V6HImode, /* config/i386/i386-modes.def:91 */
#define HAVE_V6HImode
V14QImode, /* config/i386/i386-modes.def:90 */
#define HAVE_V14QImode
V16QImode, /* config/i386/i386-modes.def:76 */
#define HAVE_V16QImode
V8HImode, /* config/i386/i386-modes.def:76 */
#define HAVE_V8HImode
V4SImode, /* config/i386/i386-modes.def:76 */
#define HAVE_V4SImode
V2DImode, /* config/i386/i386-modes.def:76 */
#define HAVE_V2DImode
V1TImode, /* config/i386/i386-modes.def:85 */
#define HAVE_V1TImode
V32QImode, /* config/i386/i386-modes.def:77 */
#define HAVE_V32QImode
V16HImode, /* config/i386/i386-modes.def:77 */
#define HAVE_V16HImode
V8SImode, /* config/i386/i386-modes.def:77 */
#define HAVE_V8SImode
V4DImode, /* config/i386/i386-modes.def:77 */
#define HAVE_V4DImode
V2TImode, /* config/i386/i386-modes.def:77 */
#define HAVE_V2TImode
V64QImode, /* config/i386/i386-modes.def:78 */
#define HAVE_V64QImode
V32HImode, /* config/i386/i386-modes.def:78 */
#define HAVE_V32HImode
V16SImode, /* config/i386/i386-modes.def:78 */
#define HAVE_V16SImode
V8DImode, /* config/i386/i386-modes.def:78 */
#define HAVE_V8DImode
V4TImode, /* config/i386/i386-modes.def:78 */
#define HAVE_V4TImode
V128QImode, /* config/i386/i386-modes.def:79 */
#define HAVE_V128QImode
V64HImode, /* config/i386/i386-modes.def:79 */
#define HAVE_V64HImode
V32SImode, /* config/i386/i386-modes.def:79 */
#define HAVE_V32SImode
V16DImode, /* config/i386/i386-modes.def:79 */
#define HAVE_V16DImode
V8TImode, /* config/i386/i386-modes.def:79 */
#define HAVE_V8TImode
V2SFmode, /* config/i386/i386-modes.def:80 */
#define HAVE_V2SFmode
V4SFmode, /* config/i386/i386-modes.def:81 */
#define HAVE_V4SFmode
V2DFmode, /* config/i386/i386-modes.def:81 */
#define HAVE_V2DFmode
V8SFmode, /* config/i386/i386-modes.def:82 */
#define HAVE_V8SFmode
V4DFmode, /* config/i386/i386-modes.def:82 */
#define HAVE_V4DFmode
V2TFmode, /* config/i386/i386-modes.def:82 */
#define HAVE_V2TFmode
V16SFmode, /* config/i386/i386-modes.def:83 */
#define HAVE_V16SFmode
V8DFmode, /* config/i386/i386-modes.def:83 */
#define HAVE_V8DFmode
V4TFmode, /* config/i386/i386-modes.def:83 */
#define HAVE_V4TFmode
V32SFmode, /* config/i386/i386-modes.def:84 */
#define HAVE_V32SFmode
V16DFmode, /* config/i386/i386-modes.def:84 */
#define HAVE_V16DFmode
V8TFmode, /* config/i386/i386-modes.def:84 */
#define HAVE_V8TFmode
MAX_MACHINE_MODE,
MIN_MODE_RANDOM = VOIDmode,
MAX_MODE_RANDOM = BLKmode,
MIN_MODE_CC = CCmode,
MAX_MODE_CC = CCFPUmode,
MIN_MODE_INT = QImode,
MAX_MODE_INT = XImode,
MIN_MODE_PARTIAL_INT = VOIDmode,
MAX_MODE_PARTIAL_INT = VOIDmode,
MIN_MODE_POINTER_BOUNDS = BND32mode,
MAX_MODE_POINTER_BOUNDS = BND64mode,
MIN_MODE_FRACT = QQmode,
MAX_MODE_FRACT = TQmode,
MIN_MODE_UFRACT = UQQmode,
MAX_MODE_UFRACT = UTQmode,
MIN_MODE_ACCUM = HAmode,
MAX_MODE_ACCUM = TAmode,
MIN_MODE_UACCUM = UHAmode,
MAX_MODE_UACCUM = UTAmode,
MIN_MODE_FLOAT = SFmode,
MAX_MODE_FLOAT = TFmode,
MIN_MODE_DECIMAL_FLOAT = SDmode,
MAX_MODE_DECIMAL_FLOAT = TDmode,
MIN_MODE_COMPLEX_INT = CQImode,
MAX_MODE_COMPLEX_INT = CXImode,
MIN_MODE_COMPLEX_FLOAT = SCmode,
MAX_MODE_COMPLEX_FLOAT = TCmode,
MIN_MODE_VECTOR_INT = V2QImode,
MAX_MODE_VECTOR_INT = V8TImode,
MIN_MODE_VECTOR_FRACT = VOIDmode,
MAX_MODE_VECTOR_FRACT = VOIDmode,
MIN_MODE_VECTOR_UFRACT = VOIDmode,
MAX_MODE_VECTOR_UFRACT = VOIDmode,
MIN_MODE_VECTOR_ACCUM = VOIDmode,
MAX_MODE_VECTOR_ACCUM = VOIDmode,
MIN_MODE_VECTOR_UACCUM = VOIDmode,
MAX_MODE_VECTOR_UACCUM = VOIDmode,
MIN_MODE_VECTOR_FLOAT = V2SFmode,
MAX_MODE_VECTOR_FLOAT = V8TFmode,
NUM_MACHINE_MODES = MAX_MACHINE_MODE
};
#define CONST_MODE_SIZE
#define CONST_MODE_BASE_ALIGN
#define CONST_MODE_IBIT const
#define CONST_MODE_FBIT const
#define BITS_PER_UNIT (8)
#define MAX_BITSIZE_MODE_ANY_INT 128
#define MAX_BITSIZE_MODE_ANY_MODE (128*BITS_PER_UNIT)
#define NUM_INT_N_ENTS 1
#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001
#ifdef __cplusplus
inline __attribute__((__always_inline__))
#else
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
#endif
unsigned char
mode_size_inline (machine_mode mode)
{
extern unsigned char mode_size[NUM_MACHINE_MODES];
switch (mode)
{
case VOIDmode: return 0;
case BLKmode: return 0;
case CCmode: return 4;
case CCGCmode: return 4;
case CCGOCmode: return 4;
case CCNOmode: return 4;
case CCAmode: return 4;
case CCCmode: return 4;
case CCOmode: return 4;
case CCSmode: return 4;
case CCZmode: return 4;
case CCFPmode: return 4;
case CCFPUmode: return 4;
case BImode: return 1;
case QImode: return 1;
case HImode: return 2;
case SImode: return 4;
case DImode: return 8;
case TImode: return 16;
case OImode: return 32;
case XImode: return 64;
case BND32mode: return 8;
case BND64mode: return 16;
case QQmode: return 1;
case HQmode: return 2;
case SQmode: return 4;
case DQmode: return 8;
case TQmode: return 16;
case UQQmode: return 1;
case UHQmode: return 2;
case USQmode: return 4;
case UDQmode: return 8;
case UTQmode: return 16;
case HAmode: return 2;
case SAmode: return 4;
case DAmode: return 8;
case TAmode: return 16;
case UHAmode: return 2;
case USAmode: return 4;
case UDAmode: return 8;
case UTAmode: return 16;
case SFmode: return 4;
case DFmode: return 8;
case TFmode: return 16;
case SDmode: return 4;
case DDmode: return 8;
case TDmode: return 16;
case CQImode: return 2;
case CHImode: return 4;
case CSImode: return 8;
case CDImode: return 16;
case CTImode: return 32;
case COImode: return 64;
case CXImode: return 128;
case SCmode: return 8;
case DCmode: return 16;
case TCmode: return 32;
case V2QImode: return 2;
case V4QImode: return 4;
case V2HImode: return 4;
case V1SImode: return 4;
case V8QImode: return 8;
case V4HImode: return 8;
case V2SImode: return 8;
case V1DImode: return 8;
case V12QImode: return 12;
case V6HImode: return 12;
case V14QImode: return 14;
case V16QImode: return 16;
case V8HImode: return 16;
case V4SImode: return 16;
case V2DImode: return 16;
case V1TImode: return 16;
case V32QImode: return 32;
case V16HImode: return 32;
case V8SImode: return 32;
case V4DImode: return 32;
case V2TImode: return 32;
case V64QImode: return 64;
case V32HImode: return 64;
case V16SImode: return 64;
case V8DImode: return 64;
case V4TImode: return 64;
case V128QImode: return 128;
case V64HImode: return 128;
case V32SImode: return 128;
case V16DImode: return 128;
case V8TImode: return 128;
case V2SFmode: return 8;
case V4SFmode: return 16;
case V2DFmode: return 16;
case V8SFmode: return 32;
case V4DFmode: return 32;
case V2TFmode: return 32;
case V16SFmode: return 64;
case V8DFmode: return 64;
case V4TFmode: return 64;
case V32SFmode: return 128;
case V16DFmode: return 128;
case V8TFmode: return 128;
default: return mode_size[mode];
}
}
#ifdef __cplusplus
inline __attribute__((__always_inline__))
#else
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
#endif
unsigned char
mode_nunits_inline (machine_mode mode)
{
extern const unsigned char mode_nunits[NUM_MACHINE_MODES];
switch (mode)
{
case VOIDmode: return 0;
case BLKmode: return 0;
case CCmode: return 1;
case CCGCmode: return 1;
case CCGOCmode: return 1;
case CCNOmode: return 1;
case CCAmode: return 1;
case CCCmode: return 1;
case CCOmode: return 1;
case CCSmode: return 1;
case CCZmode: return 1;
case CCFPmode: return 1;
case CCFPUmode: return 1;
case BImode: return 1;
case QImode: return 1;
case HImode: return 1;
case SImode: return 1;
case DImode: return 1;
case TImode: return 1;
case OImode: return 1;
case XImode: return 1;
case BND32mode: return 1;
case BND64mode: return 1;
case QQmode: return 1;
case HQmode: return 1;
case SQmode: return 1;
case DQmode: return 1;
case TQmode: return 1;
case UQQmode: return 1;
case UHQmode: return 1;
case USQmode: return 1;
case UDQmode: return 1;
case UTQmode: return 1;
case HAmode: return 1;
case SAmode: return 1;
case DAmode: return 1;
case TAmode: return 1;
case UHAmode: return 1;
case USAmode: return 1;
case UDAmode: return 1;
case UTAmode: return 1;
case SFmode: return 1;
case DFmode: return 1;
case XFmode: return 1;
case TFmode: return 1;
case SDmode: return 1;
case DDmode: return 1;
case TDmode: return 1;
case CQImode: return 2;
case CHImode: return 2;
case CSImode: return 2;
case CDImode: return 2;
case CTImode: return 2;
case COImode: return 2;
case CXImode: return 2;
case SCmode: return 2;
case DCmode: return 2;
case XCmode: return 2;
case TCmode: return 2;
case V2QImode: return 2;
case V4QImode: return 4;
case V2HImode: return 2;
case V1SImode: return 1;
case V8QImode: return 8;
case V4HImode: return 4;
case V2SImode: return 2;
case V1DImode: return 1;
case V12QImode: return 12;
case V6HImode: return 6;
case V14QImode: return 14;
case V16QImode: return 16;
case V8HImode: return 8;
case V4SImode: return 4;
case V2DImode: return 2;
case V1TImode: return 1;
case V32QImode: return 32;
case V16HImode: return 16;
case V8SImode: return 8;
case V4DImode: return 4;
case V2TImode: return 2;
case V64QImode: return 64;
case V32HImode: return 32;
case V16SImode: return 16;
case V8DImode: return 8;
case V4TImode: return 4;
case V128QImode: return 128;
case V64HImode: return 64;
case V32SImode: return 32;
case V16DImode: return 16;
case V8TImode: return 8;
case V2SFmode: return 2;
case V4SFmode: return 4;
case V2DFmode: return 2;
case V8SFmode: return 8;
case V4DFmode: return 4;
case V2TFmode: return 2;
case V16SFmode: return 16;
case V8DFmode: return 8;
case V4TFmode: return 4;
case V32SFmode: return 32;
case V16DFmode: return 16;
case V8TFmode: return 8;
default: return mode_nunits[mode];
}
}
#ifdef __cplusplus
inline __attribute__((__always_inline__))
#else
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))
#endif
unsigned char
mode_inner_inline (machine_mode mode)
{
extern const unsigned char mode_inner[NUM_MACHINE_MODES];
switch (mode)
{
case VOIDmode: return VOIDmode;
case BLKmode: return VOIDmode;
case CCmode: return VOIDmode;
case CCGCmode: return VOIDmode;
case CCGOCmode: return VOIDmode;
case CCNOmode: return VOIDmode;
case CCAmode: return VOIDmode;
case CCCmode: return VOIDmode;
case CCOmode: return VOIDmode;
case CCSmode: return VOIDmode;
case CCZmode: return VOIDmode;
case CCFPmode: return VOIDmode;
case CCFPUmode: return VOIDmode;
case BImode: return VOIDmode;
case QImode: return VOIDmode;
case HImode: return VOIDmode;
case SImode: return VOIDmode;
case DImode: return VOIDmode;
case TImode: return VOIDmode;
case OImode: return VOIDmode;
case XImode: return VOIDmode;
case BND32mode: return VOIDmode;
case BND64mode: return VOIDmode;
case QQmode: return VOIDmode;
case HQmode: return VOIDmode;
case SQmode: return VOIDmode;
case DQmode: return VOIDmode;
case TQmode: return VOIDmode;
case UQQmode: return VOIDmode;
case UHQmode: return VOIDmode;
case USQmode: return VOIDmode;
case UDQmode: return VOIDmode;
case UTQmode: return VOIDmode;
case HAmode: return VOIDmode;
case SAmode: return VOIDmode;
case DAmode: return VOIDmode;
case TAmode: return VOIDmode;
case UHAmode: return VOIDmode;
case USAmode: return VOIDmode;
case UDAmode: return VOIDmode;
case UTAmode: return VOIDmode;
case SFmode: return VOIDmode;
case DFmode: return VOIDmode;
case XFmode: return VOIDmode;
case TFmode: return VOIDmode;
case SDmode: return VOIDmode;
case DDmode: return VOIDmode;
case TDmode: return VOIDmode;
case CQImode: return QImode;
case CHImode: return HImode;
case CSImode: return SImode;
case CDImode: return DImode;
case CTImode: return TImode;
case COImode: return OImode;
case CXImode: return XImode;
case SCmode: return SFmode;
case DCmode: return DFmode;
case XCmode: return XFmode;
case TCmode: return TFmode;
case V2QImode: return QImode;
case V4QImode: return QImode;
case V2HImode: return HImode;
case V1SImode: return SImode;
case V8QImode: return QImode;
case V4HImode: return HImode;
case V2SImode: return SImode;
case V1DImode: return DImode;
case V12QImode: return QImode;
case V6HImode: return HImode;
case V14QImode: return QImode;
case V16QImode: return QImode;
case V8HImode: return HImode;
case V4SImode: return SImode;
case V2DImode: return DImode;
case V1TImode: return TImode;
case V32QImode: return QImode;
case V16HImode: return HImode;
case V8SImode: return SImode;
case V4DImode: return DImode;
case V2TImode: return TImode;
case V64QImode: return QImode;
case V32HImode: return HImode;
case V16SImode: return SImode;
case V8DImode: return DImode;
case V4TImode: return TImode;
case V128QImode: return QImode;
case V64HImode: return HImode;
case V32SImode: return SImode;
case V16DImode: return DImode;
case V8TImode: return TImode;
case V2SFmode: return SFmode;
case V4SFmode: return SFmode;
case V2DFmode: return DFmode;
case V8SFmode: return SFmode;
case V4DFmode: return DFmode;
case V2TFmode: return TFmode;
case V16SFmode: return SFmode;
case V8DFmode: return DFmode;
case V4TFmode: return TFmode;
case V32SFmode: return SFmode;
case V16DFmode: return DFmode;
case V8TFmode: return TFmode;
default: return mode_inner[mode];
}
}
#endif /* GCC_VERSION >= 4001 */
#endif /* insn-modes.h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
#ifndef GCC_TCONFIG_H
#define GCC_TCONFIG_H
#ifndef USED_FOR_TARGET
# define USED_FOR_TARGET
#endif
#include "auto-host.h"
#ifdef IN_GCC
# include "ansidecl.h"
# include "config/i386/xm-mingw32.h"
#endif
#endif /* GCC_TCONFIG_H */

View File

@ -0,0 +1,37 @@
#ifndef GCC_TM_H
#define GCC_TM_H
#ifndef LIBC_GLIBC
# define LIBC_GLIBC 1
#endif
#ifndef LIBC_UCLIBC
# define LIBC_UCLIBC 2
#endif
#ifndef LIBC_BIONIC
# define LIBC_BIONIC 3
#endif
#ifdef IN_GCC
# include "options.h"
# include "insn-constants.h"
# include "config/vxworks-dummy.h"
# include "config/i386/i386.h"
# include "config/i386/unix.h"
# include "config/i386/bsd.h"
# include "config/i386/gas.h"
# include "config/dbxcoff.h"
# include "config/i386/cygming.h"
# include "config/i386/mingw32.h"
# include "config/i386/mingw-stdint.h"
# include "config/initfini-array.h"
# include "config/tm-dwarf2.h"
#endif
#if defined IN_GCC && !defined GENERATOR_FILE && !defined USED_FOR_TARGET
# include "insn-flags.h"
#endif
#if defined IN_GCC && !defined GENERATOR_FILE
# include "insn-modes.h"
#endif
#if defined IN_GCC && defined GENERATOR_FILE && !defined BITS_PER_UNIT
#include "machmode.h"
#endif
# include "defaults.h"
#endif /* GCC_TM_H */

View File

@ -0,0 +1,137 @@
/* Get common system includes and various definitions and declarations
based on target macros.
Copyright (C) 2000-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_TSYSTEM_H
#define GCC_TSYSTEM_H
/* System headers (e.g. stdio.h, stdlib.h, unistd.h) sometimes
indirectly include getopt.h. Our -I flags will cause gcc's gnu
getopt.h to be included, not the platform's copy. In the default
case, gnu getopt.h will provide us with a no-argument prototype
which will generate -Wstrict-prototypes warnings. None of the
target files actually use getopt, so it is safe to tell gnu
getopt.h we never need this prototype. */
#ifndef HAVE_DECL_GETOPT
#define HAVE_DECL_GETOPT 1
#endif
/* We want everything from the glibc headers. */
#define _GNU_SOURCE 1
/* GCC supplies these headers. */
#include <stddef.h>
#include <float.h>
#ifdef inhibit_libc
#ifndef malloc
extern void *malloc (size_t);
#endif
#ifndef free
extern void free (void *);
#endif
#ifndef atexit
extern int atexit (void (*)(void));
#endif
#ifndef abort
extern void abort (void) __attribute__ ((__noreturn__));
#endif
#ifndef strlen
extern size_t strlen (const char *);
#endif
#ifndef memcpy
extern void *memcpy (void *, const void *, size_t);
#endif
#ifndef memset
extern void *memset (void *, int, size_t);
#endif
#else /* ! inhibit_libc */
/* We disable this when inhibit_libc, so that gcc can still be built without
needing header files first. */
/* ??? This is not a good solution, since prototypes may be required in
some cases for correct code. */
/* GCC supplies this header. */
#include <stdarg.h>
/* All systems have this header. */
#include <stdio.h>
/* All systems have this header. */
#include <sys/types.h>
/* All systems have this header. */
#include <errno.h>
#ifndef errno
extern int errno;
#endif
/* If these system headers do not exist, fixincludes must create them. */
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
/* GCC supplies this header. */
#include <limits.h>
/* If these system headers do not exist, fixincludes must create them. */
#include <time.h>
#endif /* inhibit_libc */
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
/* GCC always provides __builtin_alloca(x). */
#undef alloca
#define alloca(x) __builtin_alloca(x)
#ifdef ENABLE_RUNTIME_CHECKING
#define gcc_assert(EXPR) ((void)(!(EXPR) ? abort (), 0 : 0))
#else
/* Include EXPR, so that unused variable warnings do not occur. */
#define gcc_assert(EXPR) ((void)(0 && (EXPR)))
#endif
/* Use gcc_unreachable() to mark unreachable locations (like an
unreachable default case of a switch. Do not use gcc_assert(0). */
#define gcc_unreachable() (abort ())
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
#define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
/* Filename handling macros. */
#include "filenames.h"
#endif /* ! GCC_TSYSTEM_H */

View File

@ -0,0 +1,40 @@
/* Dummy definitions of VxWorks-related macros
Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* True if we're targeting VxWorks. */
#ifndef TARGET_VXWORKS
#define TARGET_VXWORKS 0
#endif
/* True if generating code for a VxWorks RTP. */
#ifndef TARGET_VXWORKS_RTP
#define TARGET_VXWORKS_RTP false
#endif
/* The symbol that points to an RTP's table of GOTs. */
#define VXWORKS_GOTT_BASE (gcc_unreachable (), "")
/* The symbol that holds the index of the current module's GOT in
VXWORKS_GOTT_BASE. */
#define VXWORKS_GOTT_INDEX (gcc_unreachable (), "")

View File

@ -0,0 +1,99 @@
/* Macros for taking apart, interpreting and processing file names.
These are here because some non-Posix (a.k.a. DOSish) systems have
drive letter brain-damage at the beginning of an absolute file name,
use forward- and back-slash in path names interchangeably, and
some of them have case-insensitive file names.
Copyright 2000, 2001, 2007, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
This program 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 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef FILENAMES_H
#define FILENAMES_H
#include "hashtab.h" /* for hashval_t */
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
# ifndef HAVE_DOS_BASED_FILE_SYSTEM
# define HAVE_DOS_BASED_FILE_SYSTEM 1
# endif
# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
# endif
# define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f)
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f)
#else /* not DOSish */
# if defined(__APPLE__)
# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM
# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1
# endif
# endif /* __APPLE__ */
# define HAS_DRIVE_SPEC(f) (0)
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c)
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f)
#endif
#define IS_DIR_SEPARATOR_1(dos_based, c) \
(((c) == '/') \
|| (((c) == '\\') && (dos_based)))
#define HAS_DRIVE_SPEC_1(dos_based, f) \
((f)[0] && ((f)[1] == ':') && (dos_based))
/* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f).
The result is a pointer to the remainder of F. */
#define STRIP_DRIVE_SPEC(f) ((f) + 2)
#define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c)
#define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f)
#define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f)
#define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c)
#define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f)
/* Note that when DOS_BASED is true, IS_ABSOLUTE_PATH accepts d:foo as
well, although it is only semi-absolute. This is because the users
of IS_ABSOLUTE_PATH want to know whether to prepend the current
working directory to a file name, which should not be done with a
name like d:foo. */
#define IS_ABSOLUTE_PATH_1(dos_based, f) \
(IS_DIR_SEPARATOR_1 (dos_based, (f)[0]) \
|| HAS_DRIVE_SPEC_1 (dos_based, f))
extern int filename_cmp (const char *s1, const char *s2);
#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2)
extern int filename_ncmp (const char *s1, const char *s2,
size_t n);
extern hashval_t filename_hash (const void *s);
extern int filename_eq (const void *s1, const void *s2);
extern int canonical_filename_eq (const char *a, const char *b);
#ifdef __cplusplus
}
#endif
#endif /* FILENAMES_H */

View File

@ -0,0 +1,205 @@
/* An expandable hash tables datatype.
Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov (vmakarov@cygnus.com).
This program 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 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This package implements basic hash table functionality. It is possible
to search for an entry, create an entry and destroy an entry.
Elements in the table are generic pointers.
The size of the table is not fixed; if the occupancy of the table
grows too high the hash table will be expanded.
The abstract data implementation is based on generalized Algorithm D
from Knuth's book "The art of computer programming". Hash table is
expanded by creation of new hash table and transferring elements from
the old table to the new table. */
#ifndef __HASHTAB_H__
#define __HASHTAB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "ansidecl.h"
/* The type for a hash code. */
typedef unsigned int hashval_t;
/* Callback function pointer types. */
/* Calculate hash of a table entry. */
typedef hashval_t (*htab_hash) (const void *);
/* Compare a table entry with a possible entry. The entry already in
the table always comes first, so the second element can be of a
different type (but in this case htab_find and htab_find_slot
cannot be used; instead the variants that accept a hash value
must be used). */
typedef int (*htab_eq) (const void *, const void *);
/* Cleanup function called whenever a live element is removed from
the hash table. */
typedef void (*htab_del) (void *);
/* Function called by htab_traverse for each live element. The first
arg is the slot of the element (which can be passed to htab_clear_slot
if desired), the second arg is the auxiliary pointer handed to
htab_traverse. Return 1 to continue scan, 0 to stop. */
typedef int (*htab_trav) (void **, void *);
/* Memory-allocation function, with the same functionality as calloc().
Iff it returns NULL, the hash table implementation will pass an error
code back to the user, so if your code doesn't handle errors,
best if you use xcalloc instead. */
typedef void *(*htab_alloc) (size_t, size_t);
/* We also need a free() routine. */
typedef void (*htab_free) (void *);
/* Memory allocation and deallocation; variants which take an extra
argument. */
typedef void *(*htab_alloc_with_arg) (void *, size_t, size_t);
typedef void (*htab_free_with_arg) (void *, void *);
/* This macro defines reserved value for empty table entry. */
#define HTAB_EMPTY_ENTRY ((PTR) 0)
/* This macro defines reserved value for table entry which contained
a deleted element. */
#define HTAB_DELETED_ENTRY ((PTR) 1)
/* Hash tables are of the following type. The structure
(implementation) of this type is not needed for using the hash
tables. All work with hash table should be executed only through
functions mentioned below. The size of this structure is subject to
change. */
struct htab {
/* Pointer to hash function. */
htab_hash hash_f;
/* Pointer to comparison function. */
htab_eq eq_f;
/* Pointer to cleanup function. */
htab_del del_f;
/* Table itself. */
void **entries;
/* Current size (in entries) of the hash table. */
size_t size;
/* Current number of elements including also deleted elements. */
size_t n_elements;
/* Current number of deleted elements in the table. */
size_t n_deleted;
/* The following member is used for debugging. Its value is number
of all calls of `htab_find_slot' for the hash table. */
unsigned int searches;
/* The following member is used for debugging. Its value is number
of collisions fixed for time of work with the hash table. */
unsigned int collisions;
/* Pointers to allocate/free functions. */
htab_alloc alloc_f;
htab_free free_f;
/* Alternate allocate/free functions, which take an extra argument. */
void *alloc_arg;
htab_alloc_with_arg alloc_with_arg_f;
htab_free_with_arg free_with_arg_f;
/* Current size (in entries) of the hash table, as an index into the
table of primes. */
unsigned int size_prime_index;
};
typedef struct htab *htab_t;
/* An enum saying whether we insert into the hash table or not. */
enum insert_option {NO_INSERT, INSERT};
/* The prototypes of the package functions. */
extern htab_t htab_create_alloc (size_t, htab_hash,
htab_eq, htab_del,
htab_alloc, htab_free);
extern htab_t htab_create_alloc_ex (size_t, htab_hash,
htab_eq, htab_del,
void *, htab_alloc_with_arg,
htab_free_with_arg);
extern htab_t htab_create_typed_alloc (size_t, htab_hash, htab_eq, htab_del,
htab_alloc, htab_alloc, htab_free);
/* Backward-compatibility functions. */
extern htab_t htab_create (size_t, htab_hash, htab_eq, htab_del);
extern htab_t htab_try_create (size_t, htab_hash, htab_eq, htab_del);
extern void htab_set_functions_ex (htab_t, htab_hash,
htab_eq, htab_del,
void *, htab_alloc_with_arg,
htab_free_with_arg);
extern void htab_delete (htab_t);
extern void htab_empty (htab_t);
extern void * htab_find (htab_t, const void *);
extern void ** htab_find_slot (htab_t, const void *, enum insert_option);
extern void * htab_find_with_hash (htab_t, const void *, hashval_t);
extern void ** htab_find_slot_with_hash (htab_t, const void *,
hashval_t, enum insert_option);
extern void htab_clear_slot (htab_t, void **);
extern void htab_remove_elt (htab_t, void *);
extern void htab_remove_elt_with_hash (htab_t, void *, hashval_t);
extern void htab_traverse (htab_t, htab_trav, void *);
extern void htab_traverse_noresize (htab_t, htab_trav, void *);
extern size_t htab_size (htab_t);
extern size_t htab_elements (htab_t);
extern double htab_collisions (htab_t);
/* A hash function for pointers. */
extern htab_hash htab_hash_pointer;
/* An equality function for pointers. */
extern htab_eq htab_eq_pointer;
/* A hash function for null-terminated strings. */
extern hashval_t htab_hash_string (const void *);
/* An iterative hash function for arbitrary data. */
extern hashval_t iterative_hash (const void *, size_t, hashval_t);
/* Shorthand for hashing something with an intrinsic size. */
#define iterative_hash_object(OB,INIT) iterative_hash (&OB, sizeof (OB), INIT)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HASHTAB_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
export CC = kos32-gcc
export AR = kos32-ar
export LD = kos32-ld
export STRIP = kos32-strip
export SDK_DIR:= $(abspath ../../../../sdk)
CFLAGS_OPT+= -fomit-frame-pointer -fno-ident -mno-ms-bitfields
CFLAGS_OPT+= -fbuilding-libgcc -fno-stack-protector
CFLAGS = -c -O2 -DIN_GCC -DIN_LIBGCC2 -DHAVE_CC_TLS -DUSE_EMUTLS -DENABLE_DECIMAL_BID_FORMAT
CFLAGS+= -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -U_MSC_VER
CFLAGS+= -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes
CFLAGS+= -Wmissing-prototypes -Wold-style-definition $(CFLAGS_OPT)
INCLUDES = -I../gcc -I../include
objext = .o
lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
_clear_cache _trampoline __main _absvsi2 _absvdi2 _addvsi3 \
_addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 \
_ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 \
_popcount_tab _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 \
_powisf2 _powidf2 _powixf2 _powitf2 _mulsc3 _muldc3 _mulxc3 \
_multc3 _divsc3 _divdc3 _divxc3 _divtc3 _bswapsi2 _bswapdi2 \
_clrsbsi2 _clrsbdi2
swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
$(patsubst %,_fixuns%XX,sf df xf tf) \
$(patsubst %,_floatXX%,sf df xf tf) \
$(patsubst %,_floatunXX%,sf df xf tf)
lib2funcs += $(subst XX,si,$(swfloatfuncs))
lib2funcs += $(subst XX,di,$(dwfloatfuncs))
# targets
all: libgcc.a
lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
$(lib2funcs-o): %$(objext): libgcc2.c
$(CC) $(INCLUDES) $(CFLAGS) -DL$* -c $< -o $@
libgcc.a : $(lib2funcs-o) MAkefile
$(AR) crs libgcc.a $(lib2funcs-o)
# mv -f libbfd.a $(SDK_DIR)/lib

View File

@ -0,0 +1,61 @@
/* Threads compatibility routines for libgcc2 and libobjc for
LynxOS. */
/* Compile this one with gcc. */
/* Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GTHR_LYNX_H
#define GCC_GTHR_LYNX_H
#ifdef _MULTITHREADED
/* Using the macro version of pthread_setspecific leads to a
compilation error. Instead we have two choices either kill all
macros in pthread.h with defining _POSIX_THREADS_CALLS or undefine
individual macros where we should fall back on the function
implementation. We choose the second approach. */
#include <pthread.h>
#undef pthread_setspecific
/* When using static libc on LynxOS, we cannot define pthread_create
weak. If the multi-threaded application includes iostream.h,
gthr-posix.h is included and pthread_create will be defined weak.
If pthread_create is weak its defining module in libc is not
necessarily included in the link and the symbol is resolved to zero.
Therefore the first call to it will crash.
Since -mthreads is a multilib switch on LynxOS we know that at this
point we are compiling for multi-threaded. Omitting the weak
definitions at this point should have no effect. */
#undef GTHREAD_USE_WEAK
#define GTHREAD_USE_WEAK 0
#include "gthr-posix.h"
#else
#include "gthr-single.h"
#endif
#endif /* GCC_GTHR_LYNX_H */

View File

@ -0,0 +1,164 @@
/* RTEMS threads compatibility routines for libgcc2 and libobjc.
by: Rosimildo da Silva( rdasilva@connecttel.com ) */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GTHR_RTEMS_H
#define GCC_GTHR_RTEMS_H
#ifdef __cplusplus
extern "C" {
#endif
#define __GTHREADS 1
#define __GTHREAD_ONCE_INIT 0
#define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION rtems_gxx_recursive_mutex_init
/* Avoid dependency on rtems specific headers. */
typedef void *__gthread_key_t;
typedef int __gthread_once_t;
typedef void *__gthread_mutex_t;
typedef void *__gthread_recursive_mutex_t;
/*
* External functions provided by RTEMS. They are very similar to their POSIX
* counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
* header files.
*/
/* generic per task variables */
extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void));
extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *));
extern int rtems_gxx_key_delete (__gthread_key_t __key);
extern void *rtems_gxx_getspecific (__gthread_key_t __key);
extern int rtems_gxx_setspecific (__gthread_key_t __key, const void *__ptr);
/* mutex support */
extern void rtems_gxx_mutex_init (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_lock (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *__mutex);
extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *__mutex);
/* recursive mutex support */
extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex);
extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex);
/* RTEMS threading is always active */
static inline int
__gthread_active_p (void)
{
return 1;
}
/* Wrapper calls */
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
return rtems_gxx_once( __once, __func );
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return rtems_gxx_key_create( __key, __dtor );
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return rtems_gxx_key_delete (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return rtems_gxx_getspecific (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return rtems_gxx_setspecific (__key, __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_destroy (__mutex);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_lock (__mutex);
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_trylock (__mutex);
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_unlock( __mutex );
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_unlock( __mutex );
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
/* This requires that recursive and non-recursive mutexes have the same
representation. */
return rtems_gxx_mutex_destroy (__mutex );
}
#ifdef __cplusplus
}
#endif
#endif /* ! GCC_GTHR_RTEMS_H */

View File

@ -0,0 +1,175 @@
/* Threads compatibility routines for libgcc2 and libobjc for VxWorks. */
/* Compile this one with gcc. */
/* Copyright (C) 1997-2015 Free Software Foundation, Inc.
Contributed by Mike Stump <mrs@wrs.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GTHR_VXWORKS_H
#define GCC_GTHR_VXWORKS_H
#ifdef _LIBOBJC
/* libobjc requires the optional pthreads component. */
#include "gthr-posix.h"
#else
#ifdef __cplusplus
#define UNUSED(x)
#else
#define UNUSED(x) x __attribute__((__unused__))
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define __GTHREADS 1
#define __gthread_active_p() 1
/* Mutexes are easy, except that they need to be initialized at runtime. */
#include <semLib.h>
typedef SEM_ID __gthread_mutex_t;
/* All VxWorks mutexes are recursive. */
typedef SEM_ID __gthread_recursive_mutex_t;
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *mutex)
{
*mutex = semMCreate (SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
{
return semTake (*mutex, WAIT_FOREVER);
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
{
return semTake (*mutex, NO_WAIT);
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
{
return semGive (*mutex);
}
static inline void
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
{
__gthread_mutex_init_function (mutex);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
{
return __gthread_mutex_lock (mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
{
return __gthread_mutex_trylock (mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
{
return __gthread_mutex_unlock (mutex);
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_destroy (__mutex);
}
/* pthread_once is complicated enough that it's implemented
out-of-line. See config/vxlib.c. */
typedef struct
{
#if !defined(__RTP__)
#if defined(__PPC__)
__attribute ((aligned (__alignof (unsigned))))
#endif
volatile unsigned char busy;
#endif
volatile unsigned char done;
#if !defined(__RTP__) && defined(__PPC__)
/* PPC's test-and-set implementation requires a 4 byte aligned
object, of which it only sets the first byte. We use padding
here, in order to maintain some amount of backwards
compatibility. Without this padding, gthread_once objects worked
by accident because they happen to be static objects and the ppc
port automatically increased their alignment to 4 bytes. */
unsigned char pad1;
unsigned char pad2;
#endif
}
__gthread_once_t;
#if defined (__RTP__)
# define __GTHREAD_ONCE_INIT { 0 }
#elif defined (__PPC__)
# define __GTHREAD_ONCE_INIT { 0, 0, 0, 0 }
#else
# define __GTHREAD_ONCE_INIT { 0, 0 }
#endif
extern int __gthread_once (__gthread_once_t *__once, void (*__func)(void));
/* Thread-specific data requires a great deal of effort, since VxWorks
is not really set up for it. See config/vxlib.c for the gory
details. All the TSD routines are sufficiently complex that they
need to be implemented out of line. */
typedef unsigned int __gthread_key_t;
extern int __gthread_key_create (__gthread_key_t *__keyp, void (*__dtor)(void *));
extern int __gthread_key_delete (__gthread_key_t __key);
extern void *__gthread_getspecific (__gthread_key_t __key);
extern int __gthread_setspecific (__gthread_key_t __key, void *__ptr);
#undef UNUSED
#ifdef __cplusplus
}
#endif
#endif /* not _LIBOBJC */
#endif /* gthr-vxworks.h */

View File

@ -0,0 +1,62 @@
/* Dummy floating-point routines for hard-float code.
Copyright (C) 2014-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#define sf float
#define df double
#if defined (OP_add3)
TYPE FUNC (TYPE x, TYPE y) { return x + y; }
#elif defined (OP_sub3)
TYPE FUNC (TYPE x, TYPE y) { return x - y; }
#elif defined (OP_neg2)
TYPE FUNC (TYPE x) { return -x; }
#elif defined (OP_mul3)
TYPE FUNC (TYPE x, TYPE y) { return x * y; }
#elif defined (OP_div3)
TYPE FUNC (TYPE x, TYPE y) { return x / y; }
#elif defined (OP_eq2) || defined (OP_ne2)
int FUNC (TYPE x, TYPE y) { return x == y ? 0 : 1; }
#elif defined (OP_ge2)
int FUNC (TYPE x, TYPE y) { return x >= y ? 0 : -1; }
#elif defined (OP_gt2)
int FUNC (TYPE x, TYPE y) { return x > y ? 1 : 0; }
#elif defined (OP_le2)
int FUNC (TYPE x, TYPE y) { return x <= y ? 0 : 1; }
#elif defined (OP_lt2)
int FUNC (TYPE x, TYPE y) { return x < y ? -1 : 0; }
#elif defined (OP_unord2)
int FUNC (TYPE x, TYPE y) { return __builtin_isunordered (x, y); }
#elif defined (OP_fixsi)
int FUNC (TYPE x) { return (int) x; }
#elif defined (OP_floatsi)
TYPE FUNC (int x) { return (TYPE) x; }
#elif defined (OP_floatunsi)
TYPE FUNC (unsigned int x) { return (TYPE) x; }
#elif defined (OP_extendsf2)
TYPE FUNC (float x) { return (TYPE) x; }
#elif defined (OP_truncdf2)
TYPE FUNC (double x) { return (TYPE) x; }
#else
#error Unknown operation
#endif

View File

@ -0,0 +1,113 @@
#define _FP_W_TYPE_SIZE 32
#define _FP_W_TYPE unsigned int
#define _FP_WS_TYPE signed int
#define _FP_I_TYPE int
#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
__asm__ ("add{l} {%11,%3|%3,%11}\n\t" \
"adc{l} {%9,%2|%2,%9}\n\t" \
"adc{l} {%7,%1|%1,%7}\n\t" \
"adc{l} {%5,%0|%0,%5}" \
: "=r" ((USItype) (r3)), \
"=&r" ((USItype) (r2)), \
"=&r" ((USItype) (r1)), \
"=&r" ((USItype) (r0)) \
: "%0" ((USItype) (x3)), \
"g" ((USItype) (y3)), \
"%1" ((USItype) (x2)), \
"g" ((USItype) (y2)), \
"%2" ((USItype) (x1)), \
"g" ((USItype) (y1)), \
"%3" ((USItype) (x0)), \
"g" ((USItype) (y0)))
#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
__asm__ ("add{l} {%8,%2|%2,%8}\n\t" \
"adc{l} {%6,%1|%1,%6}\n\t" \
"adc{l} {%4,%0|%0,%4}" \
: "=r" ((USItype) (r2)), \
"=&r" ((USItype) (r1)), \
"=&r" ((USItype) (r0)) \
: "%0" ((USItype) (x2)), \
"g" ((USItype) (y2)), \
"%1" ((USItype) (x1)), \
"g" ((USItype) (y1)), \
"%2" ((USItype) (x0)), \
"g" ((USItype) (y0)))
#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \
__asm__ ("sub{l} {%11,%3|%3,%11}\n\t" \
"sbb{l} {%9,%2|%2,%9}\n\t" \
"sbb{l} {%7,%1|%1,%7}\n\t" \
"sbb{l} {%5,%0|%0,%5}" \
: "=r" ((USItype) (r3)), \
"=&r" ((USItype) (r2)), \
"=&r" ((USItype) (r1)), \
"=&r" ((USItype) (r0)) \
: "0" ((USItype) (x3)), \
"g" ((USItype) (y3)), \
"1" ((USItype) (x2)), \
"g" ((USItype) (y2)), \
"2" ((USItype) (x1)), \
"g" ((USItype) (y1)), \
"3" ((USItype) (x0)), \
"g" ((USItype) (y0)))
#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
__asm__ ("sub{l} {%8,%2|%2,%8}\n\t" \
"sbb{l} {%6,%1|%1,%6}\n\t" \
"sbb{l} {%4,%0|%0,%4}" \
: "=r" ((USItype) (r2)), \
"=&r" ((USItype) (r1)), \
"=&r" ((USItype) (r0)) \
: "0" ((USItype) (x2)), \
"g" ((USItype) (y2)), \
"1" ((USItype) (x1)), \
"g" ((USItype) (y1)), \
"2" ((USItype) (x0)), \
"g" ((USItype) (y0)))
#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \
__asm__ ("add{l} {%4,%3|%3,%4}\n\t" \
"adc{l} {$0,%2|%2,0}\n\t" \
"adc{l} {$0,%1|%1,0}\n\t" \
"adc{l} {$0,%0|%0,0}" \
: "+r" ((USItype) (x3)), \
"+&r" ((USItype) (x2)), \
"+&r" ((USItype) (x1)), \
"+&r" ((USItype) (x0)) \
: "g" ((USItype) (i)))
#define _FP_MUL_MEAT_S(R,X,Y) \
_FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm)
#define _FP_MUL_MEAT_D(R,X,Y) \
_FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm)
#define _FP_MUL_MEAT_Q(R,X,Y) \
_FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_loop(S,R,X,Y)
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
#define _FP_NANFRAC_S _FP_QNANBIT_S
#define _FP_NANFRAC_D _FP_QNANBIT_D, 0
/* Even if XFmode is 12byte, we have to pad it to
16byte since soft-fp emulation is done in 16byte. */
#define _FP_NANFRAC_E _FP_QNANBIT_E, 0, 0, 0
#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0
#ifndef _SOFT_FLOAT
#define FP_EX_SHIFT 0
#define _FP_DECL_EX \
unsigned short _fcw __attribute__ ((unused)) = FP_RND_NEAREST;
#define FP_RND_NEAREST 0
#define FP_RND_ZERO 0xc00
#define FP_RND_PINF 0x800
#define FP_RND_MINF 0x400
#define FP_RND_MASK 0xc00
#define FP_INIT_ROUNDMODE \
do { \
__asm__ __volatile__ ("fnstcw\t%0" : "=m" (_fcw)); \
} while (0)
#endif

View File

@ -0,0 +1,62 @@
/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
union _FP_UNION_Q
{
__float128 flt;
struct
{
unsigned long frac0 : 32;
unsigned long frac1 : 32;
unsigned long frac2 : 32;
unsigned long frac3 : 16;
unsigned exp : 15;
unsigned sign : 1;
} bits __attribute__((packed));
};
__float128 __copysigntf3 (__float128, __float128);
__float128 __fabstf2 (__float128);
__float128
__copysigntf3 (__float128 a, __float128 b)
{
union _FP_UNION_Q A, B;
A.flt = a;
B.flt = b;
A.bits.sign = B.bits.sign;
return A.flt;
}
__float128
__fabstf2 (__float128 a)
{
union _FP_UNION_Q A;
A.flt = a;
A.bits.sign = 0;
return A.flt;
}

View File

@ -0,0 +1,429 @@
/* Get CPU type and Features for x86 processors.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Contributed by Sriraman Tallam (tmsriram@google.com)
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "cpuid.h"
#include "tsystem.h"
#include "auto-target.h"
#ifdef HAVE_INIT_PRIORITY
#define CONSTRUCTOR_PRIORITY (101)
#else
#define CONSTRUCTOR_PRIORITY
#endif
int __cpu_indicator_init (void)
__attribute__ ((constructor CONSTRUCTOR_PRIORITY));
/* Processor Vendor and Models. */
enum processor_vendor
{
VENDOR_INTEL = 1,
VENDOR_AMD,
VENDOR_OTHER,
VENDOR_MAX
};
/* Any new types or subtypes have to be inserted at the end. */
enum processor_types
{
INTEL_BONNELL = 1,
INTEL_CORE2,
INTEL_COREI7,
AMDFAM10H,
AMDFAM15H,
INTEL_SILVERMONT,
AMD_BTVER1,
AMD_BTVER2,
CPU_TYPE_MAX
};
enum processor_subtypes
{
INTEL_COREI7_NEHALEM = 1,
INTEL_COREI7_WESTMERE,
INTEL_COREI7_SANDYBRIDGE,
AMDFAM10H_BARCELONA,
AMDFAM10H_SHANGHAI,
AMDFAM10H_ISTANBUL,
AMDFAM15H_BDVER1,
AMDFAM15H_BDVER2,
AMDFAM15H_BDVER3,
AMDFAM15H_BDVER4,
INTEL_COREI7_IVYBRIDGE,
INTEL_COREI7_HASWELL,
INTEL_COREI7_BROADWELL,
CPU_SUBTYPE_MAX
};
/* ISA Features supported. */
enum processor_features
{
FEATURE_CMOV = 0,
FEATURE_MMX,
FEATURE_POPCNT,
FEATURE_SSE,
FEATURE_SSE2,
FEATURE_SSE3,
FEATURE_SSSE3,
FEATURE_SSE4_1,
FEATURE_SSE4_2,
FEATURE_AVX,
FEATURE_AVX2,
FEATURE_SSE4_A,
FEATURE_FMA4,
FEATURE_XOP,
FEATURE_FMA,
FEATURE_AVX512F,
FEATURE_BMI,
FEATURE_BMI2
};
struct __processor_model
{
unsigned int __cpu_vendor;
unsigned int __cpu_type;
unsigned int __cpu_subtype;
unsigned int __cpu_features[1];
} __cpu_model;
/* Get the specific type of AMD CPU. */
static void
get_amd_cpu (unsigned int family, unsigned int model)
{
switch (family)
{
/* AMD Family 10h. */
case 0x10:
__cpu_model.__cpu_type = AMDFAM10H;
switch (model)
{
case 0x2:
/* Barcelona. */
__cpu_model.__cpu_subtype = AMDFAM10H_BARCELONA;
break;
case 0x4:
/* Shanghai. */
__cpu_model.__cpu_subtype = AMDFAM10H_SHANGHAI;
break;
case 0x8:
/* Istanbul. */
__cpu_model.__cpu_subtype = AMDFAM10H_ISTANBUL;
break;
default:
break;
}
break;
/* AMD Family 14h "btver1". */
case 0x14:
__cpu_model.__cpu_type = AMD_BTVER1;
break;
/* AMD Family 15h "Bulldozer". */
case 0x15:
__cpu_model.__cpu_type = AMDFAM15H;
/* Bulldozer version 1. */
if ( model <= 0xf)
__cpu_model.__cpu_subtype = AMDFAM15H_BDVER1;
/* Bulldozer version 2 "Piledriver" */
if (model >= 0x10 && model <= 0x2f)
__cpu_model.__cpu_subtype = AMDFAM15H_BDVER2;
/* Bulldozer version 3 "Steamroller" */
if (model >= 0x30 && model <= 0x4f)
__cpu_model.__cpu_subtype = AMDFAM15H_BDVER3;
/* Bulldozer version 4 "Excavator" */
if (model >= 0x60 && model <= 0x7f)
__cpu_model.__cpu_subtype = AMDFAM15H_BDVER4;
break;
/* AMD Family 16h "btver2" */
case 0x16:
__cpu_model.__cpu_type = AMD_BTVER2;
break;
default:
break;
}
}
/* Get the specific type of Intel CPU. */
static void
get_intel_cpu (unsigned int family, unsigned int model, unsigned int brand_id)
{
/* Parse family and model only if brand ID is 0. */
if (brand_id == 0)
{
switch (family)
{
case 0x5:
/* Pentium. */
break;
case 0x6:
switch (model)
{
case 0x1c:
case 0x26:
/* Bonnell. */
__cpu_model.__cpu_type = INTEL_BONNELL;
break;
case 0x37:
case 0x4a:
case 0x4d:
case 0x5a:
case 0x5d:
/* Silvermont. */
__cpu_model.__cpu_type = INTEL_SILVERMONT;
break;
case 0x1a:
case 0x1e:
case 0x1f:
case 0x2e:
/* Nehalem. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_NEHALEM;
break;
case 0x25:
case 0x2c:
case 0x2f:
/* Westmere. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_WESTMERE;
break;
case 0x2a:
case 0x2d:
/* Sandy Bridge. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_SANDYBRIDGE;
break;
case 0x3a:
case 0x3e:
/* Ivy Bridge. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_IVYBRIDGE;
break;
case 0x3c:
case 0x3f:
case 0x45:
case 0x46:
/* Haswell. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_HASWELL;
break;
case 0x3d:
case 0x4f:
case 0x56:
/* Broadwell. */
__cpu_model.__cpu_type = INTEL_COREI7;
__cpu_model.__cpu_subtype = INTEL_COREI7_BROADWELL;
break;
case 0x17:
case 0x1d:
/* Penryn. */
case 0x0f:
/* Merom. */
__cpu_model.__cpu_type = INTEL_CORE2;
break;
default:
break;
}
break;
default:
/* We have no idea. */
break;
}
}
}
/* ECX and EDX are output of CPUID at level one. MAX_CPUID_LEVEL is
the max possible level of CPUID insn. */
static void
get_available_features (unsigned int ecx, unsigned int edx,
int max_cpuid_level)
{
unsigned int features = 0;
if (edx & bit_CMOV)
features |= (1 << FEATURE_CMOV);
if (edx & bit_MMX)
features |= (1 << FEATURE_MMX);
if (edx & bit_SSE)
features |= (1 << FEATURE_SSE);
if (edx & bit_SSE2)
features |= (1 << FEATURE_SSE2);
if (ecx & bit_POPCNT)
features |= (1 << FEATURE_POPCNT);
if (ecx & bit_SSE3)
features |= (1 << FEATURE_SSE3);
if (ecx & bit_SSSE3)
features |= (1 << FEATURE_SSSE3);
if (ecx & bit_SSE4_1)
features |= (1 << FEATURE_SSE4_1);
if (ecx & bit_SSE4_2)
features |= (1 << FEATURE_SSE4_2);
if (ecx & bit_AVX)
features |= (1 << FEATURE_AVX);
if (ecx & bit_FMA)
features |= (1 << FEATURE_FMA);
/* Get Advanced Features at level 7 (eax = 7, ecx = 0). */
if (max_cpuid_level >= 7)
{
unsigned int eax, ebx, ecx, edx;
__cpuid_count (7, 0, eax, ebx, ecx, edx);
if (ebx & bit_BMI)
features |= (1 << FEATURE_BMI);
if (ebx & bit_AVX2)
features |= (1 << FEATURE_AVX2);
if (ebx & bit_BMI2)
features |= (1 << FEATURE_BMI2);
if (ebx & bit_AVX512F)
features |= (1 << FEATURE_AVX512F);
}
unsigned int ext_level;
unsigned int eax, ebx;
/* Check cpuid level of extended features. */
__cpuid (0x80000000, ext_level, ebx, ecx, edx);
if (ext_level > 0x80000000)
{
__cpuid (0x80000001, eax, ebx, ecx, edx);
if (ecx & bit_SSE4a)
features |= (1 << FEATURE_SSE4_A);
if (ecx & bit_FMA4)
features |= (1 << FEATURE_FMA4);
if (ecx & bit_XOP)
features |= (1 << FEATURE_XOP);
}
__cpu_model.__cpu_features[0] = features;
}
/* A noinline function calling __get_cpuid. Having many calls to
cpuid in one function in 32-bit mode causes GCC to complain:
"can't find a register in class CLOBBERED_REGS". This is
related to PR rtl-optimization 44174. */
static int __attribute__ ((noinline))
__get_cpuid_output (unsigned int __level,
unsigned int *__eax, unsigned int *__ebx,
unsigned int *__ecx, unsigned int *__edx)
{
return __get_cpuid (__level, __eax, __ebx, __ecx, __edx);
}
/* A constructor function that is sets __cpu_model and __cpu_features with
the right values. This needs to run only once. This constructor is
given the highest priority and it should run before constructors without
the priority set. However, it still runs after ifunc initializers and
needs to be called explicitly there. */
int __attribute__ ((constructor CONSTRUCTOR_PRIORITY))
__cpu_indicator_init (void)
{
unsigned int eax, ebx, ecx, edx;
int max_level = 5;
unsigned int vendor;
unsigned int model, family, brand_id;
unsigned int extended_model, extended_family;
/* This function needs to run just once. */
if (__cpu_model.__cpu_vendor)
return 0;
/* Assume cpuid insn present. Run in level 0 to get vendor id. */
if (!__get_cpuid_output (0, &eax, &ebx, &ecx, &edx))
{
__cpu_model.__cpu_vendor = VENDOR_OTHER;
return -1;
}
vendor = ebx;
max_level = eax;
if (max_level < 1)
{
__cpu_model.__cpu_vendor = VENDOR_OTHER;
return -1;
}
if (!__get_cpuid_output (1, &eax, &ebx, &ecx, &edx))
{
__cpu_model.__cpu_vendor = VENDOR_OTHER;
return -1;
}
model = (eax >> 4) & 0x0f;
family = (eax >> 8) & 0x0f;
brand_id = ebx & 0xff;
extended_model = (eax >> 12) & 0xf0;
extended_family = (eax >> 20) & 0xff;
if (vendor == signature_INTEL_ebx)
{
/* Adjust model and family for Intel CPUS. */
if (family == 0x0f)
{
family += extended_family;
model += extended_model;
}
else if (family == 0x06)
model += extended_model;
/* Get CPU type. */
get_intel_cpu (family, model, brand_id);
/* Find available features. */
get_available_features (ecx, edx, max_level);
__cpu_model.__cpu_vendor = VENDOR_INTEL;
}
else if (vendor == signature_AMD_ebx)
{
/* Adjust model and family for AMD CPUS. */
if (family == 0x0f)
{
family += extended_family;
model += extended_model;
}
/* Get CPU type. */
get_amd_cpu (family, model);
/* Find available features. */
get_available_features (ecx, edx, max_level);
__cpu_model.__cpu_vendor = VENDOR_AMD;
}
else
__cpu_model.__cpu_vendor = VENDOR_OTHER;
gcc_assert (__cpu_model.__cpu_vendor < VENDOR_MAX);
gcc_assert (__cpu_model.__cpu_type < CPU_TYPE_MAX);
gcc_assert (__cpu_model.__cpu_subtype < CPU_SUBTYPE_MAX);
return 0;
}

View File

@ -0,0 +1,96 @@
/*
* Copyright (C) 2005-2015 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3, or (at your option) any
* later version.
*
* This file 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.
*
* Under Section 7 of GPL version 3, you are granted additional
* permissions described in the GCC Runtime Library Exception, version
* 3.1, as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License and
* a copy of the GCC Runtime Library Exception along with this program;
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _SOFT_FLOAT
#define MXCSR_DAZ (1 << 6) /* Enable denormals are zero mode */
#define MXCSR_FTZ (1 << 15) /* Enable flush to zero mode */
#ifndef __x86_64__
/* All 64-bit targets have SSE and DAZ;
only check them explicitly for 32-bit ones. */
#include "cpuid.h"
#endif
static void __attribute__((constructor))
#ifndef __x86_64__
/* The i386 ABI only requires 4-byte stack alignment, so this is necessary
to make sure the fxsave struct gets correct alignment.
See PR27537 and PR28621. */
__attribute__ ((force_align_arg_pointer))
#endif
set_fast_math (void)
{
#ifndef __x86_64__
unsigned int eax, ebx, ecx, edx;
if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
return;
if (edx & bit_SSE)
{
unsigned int mxcsr;
if (edx & bit_FXSAVE)
{
/* Check if DAZ is available. */
struct
{
unsigned short cwd;
unsigned short swd;
unsigned short twd;
unsigned short fop;
unsigned int fip;
unsigned int fcs;
unsigned int foo;
unsigned int fos;
unsigned int mxcsr;
unsigned int mxcsr_mask;
unsigned int st_space[32];
unsigned int xmm_space[32];
unsigned int padding[56];
} __attribute__ ((aligned (16))) fxsave;
/* This is necessary since some implementations of FXSAVE
do not modify reserved areas within the image. */
fxsave.mxcsr_mask = 0;
__builtin_ia32_fxsave (&fxsave);
mxcsr = fxsave.mxcsr;
if (fxsave.mxcsr_mask & MXCSR_DAZ)
mxcsr |= MXCSR_DAZ;
}
else
mxcsr = __builtin_ia32_stmxcsr ();
mxcsr |= MXCSR_FTZ;
__builtin_ia32_ldmxcsr (mxcsr);
}
#else
unsigned int mxcsr = __builtin_ia32_stmxcsr ();
mxcsr |= MXCSR_DAZ | MXCSR_FTZ;
__builtin_ia32_ldmxcsr (mxcsr);
#endif
}
#endif

View File

@ -0,0 +1,40 @@
/* crti.S for x86.
Copyright (C) 1993-2015 Free Software Foundation, Inc.
Written By Fred Fish, Nov 1992
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This file 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file just supplies labeled starting points for the .init and .fini
sections. It is linked in before the values-Xx.o files and also before
crtbegin.o. */
.ident "GNU C crti.s"
.section .init
.globl _init
.type _init,@function
_init:
.section .fini
.globl _fini
.type _fini,@function
_fini:

View File

@ -0,0 +1,35 @@
/* crtn.S for x86.
Copyright (C) 1993-2015 Free Software Foundation, Inc.
Written By Fred Fish, Nov 1992
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This file 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file just supplies returns for the .init and .fini sections. It is
linked in after all other files. */
.ident "GNU C crtn.o"
.section .init
ret $0x0
.section .fini
ret $0x0

View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2007-2015 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3, or (at your option) any
* later version.
*
* This file 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.
*
* Under Section 7 of GPL version 3, you are granted additional
* permissions described in the GCC Runtime Library Exception, version
* 3.1, as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License and
* a copy of the GCC Runtime Library Exception along with this program;
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _SOFT_FLOAT
#if __PREC == 32
#define X87CW (0 << 8) /* Single precision (24 bits) */
#elif __PREC == 64
#define X87CW (2 << 8) /* Double precision (53 bits) */
#elif __PREC == 80
#define X87CW (3 << 8) /* Extended precision (64 bits) */
#else
#error "Wrong precision requested."
#endif
#define X87CW_PCMASK (3 << 8)
static void __attribute__((constructor))
set_precision (void)
{
unsigned short int cwd;
asm volatile ("fstcw\t%0" : "=m" (cwd));
cwd &= ~X87CW_PCMASK;
cwd |= X87CW;
asm volatile ("fldcw\t%0" : : "m" (cwd));
}
#endif

View File

@ -0,0 +1,199 @@
/* crtbegin object for windows32 targets.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Contributed by Danny Smith <dannysmith@users.sourceforge.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Target machine header files require this define. */
#define IN_LIBGCC2
#include "auto-host.h"
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
#include "libgcc_tm.h"
#include "unwind-dw2-fde.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#ifndef LIBGCC_SONAME
#define LIBGCC_SONAME "libgcc_s.dll"
#endif
#ifndef LIBGCJ_SONAME
#define LIBGCJ_SONAME "libgcj_s.dll"
#endif
#if DWARF2_UNWIND_INFO
/* Make the declarations weak. This is critical for
_Jv_RegisterClasses because it lives in libgcj.a */
extern void __register_frame_info (__attribute__((unused)) const void *,
__attribute__((unused)) struct object *)
TARGET_ATTRIBUTE_WEAK;
extern void *__deregister_frame_info (__attribute__((unused)) const void *)
TARGET_ATTRIBUTE_WEAK;
/* Work around for current cygwin32 build problems (Bug gas/16858).
Compile weak default functions only for 64-bit systems,
when absolutely necessary. */
#ifdef __x86_64__
TARGET_ATTRIBUTE_WEAK void
__register_frame_info (__attribute__((unused)) const void *p,
__attribute__((unused)) struct object *o)
{
}
TARGET_ATTRIBUTE_WEAK void *
__deregister_frame_info (__attribute__((unused)) const void *p)
{
return (void*) 0;
}
#endif
#endif /* DWARF2_UNWIND_INFO */
#if TARGET_USE_JCR_SECTION
extern void _Jv_RegisterClasses (__attribute__((unused)) const void *)
TARGET_ATTRIBUTE_WEAK;
#ifdef __x86_64__
TARGET_ATTRIBUTE_WEAK void
_Jv_RegisterClasses (__attribute__((unused)) const void *p)
{
}
#endif
#endif /* TARGET_USE_JCR_SECTION */
#if defined(HAVE_LD_RO_RW_SECTION_MIXING)
# define EH_FRAME_SECTION_CONST const
#else
# define EH_FRAME_SECTION_CONST
#endif
/* Stick a label at the beginning of the frame unwind info so we can
register/deregister it with the exception handling library code. */
#if DWARF2_UNWIND_INFO
static EH_FRAME_SECTION_CONST char __EH_FRAME_BEGIN__[]
__attribute__((used, section(__LIBGCC_EH_FRAME_SECTION_NAME__), aligned(4)))
= { };
static struct object obj;
/* Handle of libgcc's DLL reference. */
HANDLE hmod_libgcc;
static void * (*deregister_frame_fn) (const void *) = NULL;
#endif
#if TARGET_USE_JCR_SECTION
static void *__JCR_LIST__[]
__attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__), aligned(4)))
= { };
#endif
#ifdef __CYGWIN__
/* Declare the __dso_handle variable. It should have a unique value
in every shared-object; in a main program its value is zero. The
object should in any case be protected. This means the instance
in one DSO or the main program is not used in another object. The
dynamic linker takes care of this. */
#ifdef CRTSTUFFS_O
extern void *__ImageBase;
void *__dso_handle = &__ImageBase;
#else
void *__dso_handle = 0;
#endif
#endif /* __CYGWIN__ */
/* Pull in references from libgcc.a(unwind-dw2-fde.o) in the
startfile. These are referenced by a ctor and dtor in crtend.o. */
extern void __gcc_register_frame (void);
extern void __gcc_deregister_frame (void);
void
__gcc_register_frame (void)
{
#if DWARF2_UNWIND_INFO
/* Weak undefined symbols won't be pulled in from dlls; hence
we first test if the dll is already loaded and, if so,
get the symbol's address at run-time. If the dll is not loaded,
fallback to weak linkage to static archive. */
void (*register_frame_fn) (const void *, struct object *);
HANDLE h = GetModuleHandle (LIBGCC_SONAME);
if (h)
{
/* Increasing the load-count of LIBGCC_SONAME DLL. */
hmod_libgcc = LoadLibrary (LIBGCC_SONAME);
register_frame_fn = (void (*) (const void *, struct object *))
GetProcAddress (h, "__register_frame_info");
deregister_frame_fn = (void* (*) (const void *))
GetProcAddress (h, "__deregister_frame_info");
}
else
{
register_frame_fn = __register_frame_info;
deregister_frame_fn = __deregister_frame_info;
}
if (register_frame_fn)
register_frame_fn (__EH_FRAME_BEGIN__, &obj);
#endif
#if TARGET_USE_JCR_SECTION
if (__JCR_LIST__[0])
{
void (*register_class_fn) (const void *);
HANDLE h = GetModuleHandle (LIBGCJ_SONAME);
if (h)
register_class_fn = (void (*) (const void *))
GetProcAddress (h, "_Jv_RegisterClasses");
else
register_class_fn = _Jv_RegisterClasses;
if (register_class_fn)
register_class_fn (__JCR_LIST__);
}
#endif
#if DEFAULT_USE_CXA_ATEXIT
/* If we use the __cxa_atexit method to register C++ dtors
at object construction, also use atexit to register eh frame
info cleanup. */
atexit(__gcc_deregister_frame);
#endif /* DEFAULT_USE_CXA_ATEXIT */
}
void
__gcc_deregister_frame (void)
{
#if DWARF2_UNWIND_INFO
if (deregister_frame_fn)
deregister_frame_fn (__EH_FRAME_BEGIN__);
if (hmod_libgcc)
FreeLibrary (hmod_libgcc);
#endif
}

View File

@ -0,0 +1,83 @@
/* crtend object for windows32 targets.
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Contributed by Danny Smith <dannysmith@users.sourceforge.net>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Target machine header files require this define. */
#define IN_LIBGCC2
/* auto-host.h is needed by cygming.h for HAVE_GAS_WEAK and here
for HAVE_LD_RO_RW_SECTION_MIXING. */
#include "auto-host.h"
#include "tconfig.h"
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
#include "libgcc_tm.h"
#include "unwind-dw2-fde.h"
#if defined(HAVE_LD_RO_RW_SECTION_MIXING)
# define EH_FRAME_SECTION_CONST const
#else
# define EH_FRAME_SECTION_CONST
#endif
#if DWARF2_UNWIND_INFO
/* Terminate the frame unwind info section with a 0 as a sentinel;
this would be the 'length' field in a real FDE. */
static EH_FRAME_SECTION_CONST int __FRAME_END__[]
__attribute__ ((used, section(__LIBGCC_EH_FRAME_SECTION_NAME__),
aligned(4)))
= { 0 };
#endif
#if TARGET_USE_JCR_SECTION
/* Null terminate the .jcr section array. */
static void *__JCR_END__[1]
__attribute__ ((used, section(__LIBGCC_JCR_SECTION_NAME__),
aligned(sizeof(void *))))
= { 0 };
#endif
extern void __gcc_register_frame (void);
extern void __gcc_deregister_frame (void);
static void register_frame_ctor (void) __attribute__ ((constructor (0)));
static void
register_frame_ctor (void)
{
__gcc_register_frame ();
}
#if !DEFAULT_USE_CXA_ATEXIT
static void deregister_frame_dtor (void) __attribute__ ((destructor (0)));
static void
deregister_frame_dtor (void)
{
__gcc_deregister_frame ();
}
#endif

View File

@ -0,0 +1,187 @@
/* stuff needed for libgcc on win32.
*
* Copyright (C) 1996-2015 Free Software Foundation, Inc.
* Written By Steve Chamberlain
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3, or (at your option) any
* later version.
*
* This file 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.
*
* Under Section 7 of GPL version 3, you are granted additional
* permissions described in the GCC Runtime Library Exception, version
* 3.1, as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License and
* a copy of the GCC Runtime Library Exception along with this program;
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* <http://www.gnu.org/licenses/>.
*/
#include "auto-host.h"
#ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE
.cfi_sections .debug_frame
# define cfi_startproc() .cfi_startproc
# define cfi_endproc() .cfi_endproc
# define cfi_adjust_cfa_offset(X) .cfi_adjust_cfa_offset X
# define cfi_def_cfa_register(X) .cfi_def_cfa_register X
# define cfi_register(D,S) .cfi_register D, S
# ifdef __x86_64__
# define cfi_push(X) .cfi_adjust_cfa_offset 8; .cfi_rel_offset X, 0
# define cfi_pop(X) .cfi_adjust_cfa_offset -8; .cfi_restore X
# else
# define cfi_push(X) .cfi_adjust_cfa_offset 4; .cfi_rel_offset X, 0
# define cfi_pop(X) .cfi_adjust_cfa_offset -4; .cfi_restore X
# endif
#else
# define cfi_startproc()
# define cfi_endproc()
# define cfi_adjust_cfa_offset(X)
# define cfi_def_cfa_register(X)
# define cfi_register(D,S)
# define cfi_push(X)
# define cfi_pop(X)
#endif /* HAVE_GAS_CFI_SECTIONS_DIRECTIVE */
#ifdef L_chkstk
/* Function prologue calls __chkstk to probe the stack when allocating more
than CHECK_STACK_LIMIT bytes in one go. Touching the stack at 4K
increments is necessary to ensure that the guard pages used
by the OS virtual memory manger are allocated in correct sequence. */
.global ___chkstk
.global __alloca
#ifdef __x86_64__
/* __alloca is a normal function call, which uses %rcx as the argument. */
cfi_startproc()
__alloca:
movq %rcx, %rax
/* FALLTHRU */
/* ___chkstk is a *special* function call, which uses %rax as the argument.
We avoid clobbering the 4 integer argument registers, %rcx, %rdx,
%r8 and %r9, which leaves us with %rax, %r10, and %r11 to use. */
.align 4
___chkstk:
popq %r11 /* pop return address */
cfi_adjust_cfa_offset(-8) /* indicate return address in r11 */
cfi_register(%rip, %r11)
movq %rsp, %r10
cmpq $0x1000, %rax /* > 4k ?*/
jb 2f
1: subq $0x1000, %r10 /* yes, move pointer down 4k*/
orl $0x0, (%r10) /* probe there */
subq $0x1000, %rax /* decrement count */
cmpq $0x1000, %rax
ja 1b /* and do it again */
2: subq %rax, %r10
movq %rsp, %rax /* hold CFA until return */
cfi_def_cfa_register(%rax)
orl $0x0, (%r10) /* less than 4k, just peek here */
movq %r10, %rsp /* decrement stack */
/* Push the return value back. Doing this instead of just
jumping to %r11 preserves the cached call-return stack
used by most modern processors. */
pushq %r11
ret
cfi_endproc()
#else
cfi_startproc()
___chkstk:
__alloca:
pushl %ecx /* save temp */
cfi_push(%eax)
leal 8(%esp), %ecx /* point past return addr */
cmpl $0x1000, %eax /* > 4k ?*/
jb 2f
1: subl $0x1000, %ecx /* yes, move pointer down 4k*/
orl $0x0, (%ecx) /* probe there */
subl $0x1000, %eax /* decrement count */
cmpl $0x1000, %eax
ja 1b /* and do it again */
2: subl %eax, %ecx
orl $0x0, (%ecx) /* less than 4k, just peek here */
movl %esp, %eax /* save current stack pointer */
cfi_def_cfa_register(%eax)
movl %ecx, %esp /* decrement stack */
movl (%eax), %ecx /* recover saved temp */
/* Copy the return register. Doing this instead of just jumping to
the address preserves the cached call-return stack used by most
modern processors. */
pushl 4(%eax)
ret
cfi_endproc()
#endif /* __x86_64__ */
#endif /* L_chkstk */
#ifdef L_chkstk_ms
/* ___chkstk_ms is a *special* function call, which uses %rax as the argument.
We avoid clobbering any registers. Unlike ___chkstk, it just probes the
stack and does no stack allocation. */
.global ___chkstk_ms
#ifdef __x86_64__
cfi_startproc()
___chkstk_ms:
pushq %rcx /* save temps */
cfi_push(%rcx)
pushq %rax
cfi_push(%rax)
cmpq $0x1000, %rax /* > 4k ?*/
leaq 24(%rsp), %rcx /* point past return addr */
jb 2f
1: subq $0x1000, %rcx /* yes, move pointer down 4k */
orq $0x0, (%rcx) /* probe there */
subq $0x1000, %rax /* decrement count */
cmpq $0x1000, %rax
ja 1b /* and do it again */
2: subq %rax, %rcx
orq $0x0, (%rcx) /* less than 4k, just peek here */
popq %rax
cfi_pop(%rax)
popq %rcx
cfi_pop(%rcx)
ret
cfi_endproc()
#else
cfi_startproc()
___chkstk_ms:
pushl %ecx /* save temp */
cfi_push(%ecx)
pushl %eax
cfi_push(%eax)
cmpl $0x1000, %eax /* > 4k ?*/
leal 12(%esp), %ecx /* point past return addr */
jb 2f
1: subl $0x1000, %ecx /* yes, move pointer down 4k*/
orl $0x0, (%ecx) /* probe there */
subl $0x1000, %eax /* decrement count */
cmpl $0x1000, %eax
ja 1b /* and do it again */
2: subl %eax, %ecx
orl $0x0, (%ecx) /* less than 4k, just peek here */
popl %eax
cfi_pop(%eax)
popl %ecx
cfi_pop(%ecx)
ret
cfi_endproc()
#endif /* __x86_64__ */
#endif /* L_chkstk_ms */

View File

@ -0,0 +1,32 @@
/* Target definitions for x86 running Darwin, library renames.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* The system ___divdc3 routine in libSystem on darwin10 is not
accurate to 1ulp, ours is, so we avoid ever using the system name
for this routine and instead install a non-conflicting name that is
accurate. See darwin_rename_builtins. */
#ifdef L_divdc3
#define DECLARE_LIBRARY_RENAMES \
asm(".text; ___divdc3: jmp ___ieee_divdc3 ; .globl ___divdc3");
#endif

View File

@ -0,0 +1,180 @@
/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
Copyright (C) 2014-2015 Free Software Foundation, Inc.
Contributed by John Marino <gnugcc@marino.st>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs. */
#include <sys/types.h>
#include <sys/sysctl.h>
#include <signal.h>
#include <sys/ucontext.h>
#include <machine/sigframe.h>
#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg
#ifdef __x86_64__
#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
static void
x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
{
unsigned long ps_strings;
int mib[2];
size_t len;
mib[0] = CTL_KERN;
mib[1] = KERN_PS_STRINGS;
len = sizeof (ps_strings);
sysctl (mib, 2, &ps_strings, &len, NULL, 0);
*start = (unsigned char *)ps_strings - 32;
*end = (unsigned char *)ps_strings;
}
static _Unwind_Reason_Code
x86_64_dragonfly_fallback_frame_state
(struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
unsigned char *sigtramp_start, *sigtramp_end;
struct sigframe *sf;
long new_cfa;
x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
if (pc >= sigtramp_end || pc < sigtramp_start)
return _URC_END_OF_STACK;
sf = (struct sigframe *) context->cfa;
new_cfa = sf->REG_NAME(rsp);
fs->regs.cfa_how = CFA_REG_OFFSET;
/* Register 7 is rsp */
fs->regs.cfa_reg = 7;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
fs->regs.reg[4].how = REG_SAVED_OFFSET;
fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
fs->regs.reg[9].how = REG_SAVED_OFFSET;
fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
fs->regs.reg[10].how = REG_SAVED_OFFSET;
fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
fs->regs.reg[11].how = REG_SAVED_OFFSET;
fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
fs->regs.reg[12].how = REG_SAVED_OFFSET;
fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
fs->regs.reg[13].how = REG_SAVED_OFFSET;
fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
fs->regs.reg[14].how = REG_SAVED_OFFSET;
fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
fs->regs.reg[15].how = REG_SAVED_OFFSET;
fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
fs->regs.reg[16].how = REG_SAVED_OFFSET;
fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
fs->retaddr_column = 16;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#else /* Next section is for i386 */
#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
static void
x86_sigtramp_range (unsigned char **start, unsigned char **end)
{
unsigned long ps_strings;
int mib[2];
size_t len;
mib[0] = CTL_KERN;
mib[1] = KERN_PS_STRINGS;
len = sizeof (ps_strings);
sysctl (mib, 2, &ps_strings, &len, NULL, 0);
*start = (unsigned char *)ps_strings - 128;
*end = (unsigned char *)ps_strings;
}
static _Unwind_Reason_Code
x86_dragonfly_fallback_frame_state
(struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
unsigned char *sigtramp_start, *sigtramp_end;
struct sigframe *sf;
long new_cfa;
x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
if (pc >= sigtramp_end || pc < sigtramp_start)
return _URC_END_OF_STACK;
sf = (struct sigframe *) context->cfa;
new_cfa = sf->REG_NAME(esp);
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = 4;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
fs->regs.reg[7].how = REG_SAVED_OFFSET;
fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
fs->retaddr_column = 8;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#endif /* ifdef __x86_64__ */

View File

@ -0,0 +1,36 @@
/* Definitions for Intel 386 ELF systems.
Copyright (C) 2015 Free Software Foundation, Inc.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifdef __i386__
/* Used by crtstuff.c to initialize the base of data-relative relocations.
These are GOT relative on x86, so return the pic register. */
#define CRT_GET_RFIB_DATA(BASE) \
__asm__ ("call\t.LPR%=\n" \
".LPR%=:\n\t" \
"pop{l}\t%0\n\t" \
/* Due to a GAS bug, this cannot use EAX. That encodes \
smaller than the traditional EBX, which results in the \
offset being off by one. */ \
"add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
"|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
: "=d"(BASE))
#endif

View File

@ -0,0 +1,38 @@
/* Implement __enable_execute_stack for Windows32.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include <windows.h>
extern void __enable_execute_stack (void *);
void
__enable_execute_stack (void *addr)
{
MEMORY_BASIC_INFORMATION b;
if (!VirtualQuery (addr, &b, sizeof(b)))
abort ();
VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE,
&b.Protect);
}

View File

@ -0,0 +1,173 @@
/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86.
Copyright (C) 2015 Free Software Foundation, Inc.
Contributed by John Marino <gnugcc@marino.st>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs. */
#include <sys/types.h>
#include <signal.h>
#include <sys/ucontext.h>
#include <machine/sigframe.h>
#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg
#ifdef __x86_64__
#define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state
static _Unwind_Reason_Code
x86_64_freebsd_fallback_frame_state
(struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
struct sigframe *sf;
long new_cfa;
/* Prior to FreeBSD 9, the signal trampoline was located immediately
before the ps_strings. To support non-executable stacks on AMD64,
the sigtramp was moved to a shared page for FreeBSD 9. Unfortunately
this means looking frame patterns again (sys/amd64/amd64/sigtramp.S)
rather than using the robust and convenient KERN_PS_STRINGS trick.
<pc + 00>: lea 0x10(%rsp),%rdi
<pc + 05>: pushq $0x0
<pc + 17>: mov $0x1a1,%rax
<pc + 14>: syscall
If we can't find this pattern, we're at the end of the stack.
*/
if (!( *(unsigned int *)(context->ra) == 0x247c8d48
&& *(unsigned int *)(context->ra + 4) == 0x48006a10
&& *(unsigned int *)(context->ra + 8) == 0x01a1c0c7
&& *(unsigned int *)(context->ra + 12) == 0x050f0000 ))
return _URC_END_OF_STACK;
sf = (struct sigframe *) context->cfa;
new_cfa = sf->REG_NAME(rsp);
fs->regs.cfa_how = CFA_REG_OFFSET;
/* Register 7 is rsp */
fs->regs.cfa_reg = 7;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
fs->regs.reg[4].how = REG_SAVED_OFFSET;
fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
fs->regs.reg[9].how = REG_SAVED_OFFSET;
fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
fs->regs.reg[10].how = REG_SAVED_OFFSET;
fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
fs->regs.reg[11].how = REG_SAVED_OFFSET;
fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
fs->regs.reg[12].how = REG_SAVED_OFFSET;
fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
fs->regs.reg[13].how = REG_SAVED_OFFSET;
fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
fs->regs.reg[14].how = REG_SAVED_OFFSET;
fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
fs->regs.reg[15].how = REG_SAVED_OFFSET;
fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
fs->regs.reg[16].how = REG_SAVED_OFFSET;
fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
fs->retaddr_column = 16;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#else /* Next section is for i386 */
#define MD_FALLBACK_FRAME_STATE_FOR x86_freebsd_fallback_frame_state
/*
* We can't use KERN_PS_STRINGS anymore if we want to support FreeBSD32
* compat on AMD64. The sigtramp is in a shared page in that case so the
* x86_sigtramp_range only works on a true i386 system. We have to
* search for the sigtramp frame if we want it working everywhere.
*/
static _Unwind_Reason_Code
x86_freebsd_fallback_frame_state
(struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
struct sigframe *sf;
long new_cfa;
/*
* i386 sigtramp frame we are looking for follows.
* Apparently PSL_VM is variable, so we can't look past context->ra + 4
* <sigcode>:
* 0: ff 54 24 10 call *0x10(%esp) *SIGF_HANDLER
* 4: 8d 44 24 20 lea 0x20(%esp),%eax SIGF_UC
* 8: 50 push %eax
* 9: f7 40 54 00 00 02 00 testl $0x20000,0x54(%eax) $PSL_VM
* 10: 75 03 jne 15 <sigcode+0x15>
* 12: 8e 68 14 mov 0x14(%eax),%gs UC_GS
* 15: b8 a1 01 00 00 mov 0x1a1,%eax $SYS_sigreturn
*/
if (!( *(unsigned int *)(context->ra - 4) == 0x102454ff
&& *(unsigned int *)(context->ra) == 0x2024448d ))
return _URC_END_OF_STACK;
sf = (struct sigframe *) context->cfa;
new_cfa = sf->REG_NAME(esp);
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = 4;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
fs->regs.reg[7].how = REG_SAVED_OFFSET;
fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
fs->retaddr_column = 8;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#endif /* ifdef __x86_64__ */

View File

@ -0,0 +1,267 @@
/* Implementation of W32-specific threads compatibility routines for
libgcc2. */
/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
Modified and moved to separate file by Danny Smith
<dannysmith@users.sourceforge.net>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include <windows.h>
#ifndef __GTHREAD_HIDE_WIN32API
# define __GTHREAD_HIDE_WIN32API 1
#endif
#undef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
#define __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
#include "gthr-win32.h"
/* Windows32 threads specific definitions. The windows32 threading model
does not map well into pthread-inspired gcc's threading model, and so
there are caveats one needs to be aware of.
1. The destructor supplied to __gthread_key_create is ignored for
generic x86-win32 ports. This will certainly cause memory leaks
due to unreclaimed eh contexts (sizeof (eh_context) is at least
24 bytes for x86 currently).
This memory leak may be significant for long-running applications
that make heavy use of C++ EH.
However, Mingw runtime (version 0.3 or newer) provides a mechanism
to emulate pthreads key dtors; the runtime provides a special DLL,
linked in if -mthreads option is specified, that runs the dtors in
the reverse order of registration when each thread exits. If
-mthreads option is not given, a stub is linked in instead of the
DLL, which results in memory leak. Other x86-win32 ports can use
the same technique of course to avoid the leak.
2. The error codes returned are non-POSIX like, and cast into ints.
This may cause incorrect error return due to truncation values on
hw where sizeof (DWORD) > sizeof (int).
3. We are currently using a special mutex instead of the Critical
Sections, since Win9x does not support TryEnterCriticalSection
(while NT does).
The basic framework should work well enough. In the long term, GCC
needs to use Structured Exception Handling on Windows32. */
int
__gthr_win32_once (__gthread_once_t *once, void (*func) (void))
{
if (once == NULL || func == NULL)
return EINVAL;
if (! once->done)
{
if (InterlockedIncrement (&(once->started)) == 0)
{
(*func) ();
once->done = TRUE;
}
else
{
/* Another thread is currently executing the code, so wait for it
to finish; yield the CPU in the meantime. If performance
does become an issue, the solution is to use an Event that
we wait on here (and set above), but that implies a place to
create the event before this routine is called. */
while (! once->done)
Sleep (0);
}
}
return 0;
}
/* Windows32 thread local keys don't support destructors; this leads to
leaks, especially in threaded applications making extensive use of
C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
int
__gthr_win32_key_create (__gthread_key_t *key,
void (*dtor) (void *) __attribute__((unused)))
{
int status = 0;
DWORD tls_index = TlsAlloc ();
if (tls_index != 0xFFFFFFFF)
{
*key = tls_index;
#ifdef MINGW32_SUPPORTS_MT_EH
/* Mingw runtime will run the dtors in reverse order for each thread
when the thread exits. */
status = __mingwthr_key_dtor (*key, dtor);
#endif
}
else
status = (int) GetLastError ();
return status;
}
int
__gthr_win32_key_delete (__gthread_key_t key)
{
return (TlsFree (key) != 0) ? 0 : (int) GetLastError ();
}
void *
__gthr_win32_getspecific (__gthread_key_t key)
{
DWORD lasterror;
void *ptr;
lasterror = GetLastError();
ptr = TlsGetValue(key);
SetLastError( lasterror );
return ptr;
}
int
__gthr_win32_setspecific (__gthread_key_t key, const void *ptr)
{
if (TlsSetValue (key, CONST_CAST2(void *, const void *, ptr)) != 0)
return 0;
else
return GetLastError ();
}
void
__gthr_win32_mutex_init_function (__gthread_mutex_t *mutex)
{
mutex->counter = -1;
mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
void
__gthr_win32_mutex_destroy (__gthread_mutex_t *mutex)
{
CloseHandle ((HANDLE) mutex->sema);
}
int
__gthr_win32_mutex_lock (__gthread_mutex_t *mutex)
{
if (InterlockedIncrement (&mutex->counter) == 0 ||
WaitForSingleObject (mutex->sema, INFINITE) == WAIT_OBJECT_0)
return 0;
else
{
/* WaitForSingleObject returns WAIT_FAILED, and we can only do
some best-effort cleanup here. */
InterlockedDecrement (&mutex->counter);
return 1;
}
}
int
__gthr_win32_mutex_trylock (__gthread_mutex_t *mutex)
{
if (__GTHR_W32_InterlockedCompareExchange (&mutex->counter, 0, -1) < 0)
return 0;
else
return 1;
}
int
__gthr_win32_mutex_unlock (__gthread_mutex_t *mutex)
{
if (InterlockedDecrement (&mutex->counter) >= 0)
return ReleaseSemaphore (mutex->sema, 1, NULL) ? 0 : 1;
else
return 0;
}
void
__gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
{
mutex->counter = -1;
mutex->depth = 0;
mutex->owner = 0;
mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
int
__gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
{
DWORD me = GetCurrentThreadId();
if (InterlockedIncrement (&mutex->counter) == 0)
{
mutex->depth = 1;
mutex->owner = me;
}
else if (mutex->owner == me)
{
InterlockedDecrement (&mutex->counter);
++(mutex->depth);
}
else if (WaitForSingleObject (mutex->sema, INFINITE) == WAIT_OBJECT_0)
{
mutex->depth = 1;
mutex->owner = me;
}
else
{
/* WaitForSingleObject returns WAIT_FAILED, and we can only do
some best-effort cleanup here. */
InterlockedDecrement (&mutex->counter);
return 1;
}
return 0;
}
int
__gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
{
DWORD me = GetCurrentThreadId();
if (__GTHR_W32_InterlockedCompareExchange (&mutex->counter, 0, -1) < 0)
{
mutex->depth = 1;
mutex->owner = me;
}
else if (mutex->owner == me)
++(mutex->depth);
else
return 1;
return 0;
}
int
__gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
{
--(mutex->depth);
if (mutex->depth == 0)
{
mutex->owner = 0;
if (InterlockedDecrement (&mutex->counter) >= 0)
return ReleaseSemaphore (mutex->sema, 1, NULL) ? 0 : 1;
}
return 0;
}
int
__gthr_win32_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex)
{
CloseHandle ((HANDLE) mutex->sema);
return 0;
}

View File

@ -0,0 +1,786 @@
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
Contributed by Mumit Khan <khan@xraylith.wisc.edu>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_GTHR_WIN32_H
#define GCC_GTHR_WIN32_H
/* Make sure CONST_CAST2 (origin in system.h) is declared. */
#ifndef CONST_CAST2
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
#endif
/* Windows32 threads specific definitions. The windows32 threading model
does not map well into pthread-inspired gcc's threading model, and so
there are caveats one needs to be aware of.
1. The destructor supplied to __gthread_key_create is ignored for
generic x86-win32 ports. This will certainly cause memory leaks
due to unreclaimed eh contexts (sizeof (eh_context) is at least
24 bytes for x86 currently).
This memory leak may be significant for long-running applications
that make heavy use of C++ EH.
However, Mingw runtime (version 0.3 or newer) provides a mechanism
to emulate pthreads key dtors; the runtime provides a special DLL,
linked in if -mthreads option is specified, that runs the dtors in
the reverse order of registration when each thread exits. If
-mthreads option is not given, a stub is linked in instead of the
DLL, which results in memory leak. Other x86-win32 ports can use
the same technique of course to avoid the leak.
2. The error codes returned are non-POSIX like, and cast into ints.
This may cause incorrect error return due to truncation values on
hw where sizeof (DWORD) > sizeof (int).
3. We are currently using a special mutex instead of the Critical
Sections, since Win9x does not support TryEnterCriticalSection
(while NT does).
The basic framework should work well enough. In the long term, GCC
needs to use Structured Exception Handling on Windows32. */
#define __GTHREADS 1
#include <errno.h>
#ifdef __MINGW32__
#include <_mingw.h>
#endif
#ifndef __UNUSED_PARAM
#define __UNUSED_PARAM(x) x
#endif
#ifdef _LIBOBJC
/* This is necessary to prevent windef.h (included from windows.h) from
defining its own BOOL as a typedef. */
#ifndef __OBJC__
#define __OBJC__
#endif
#include <windows.h>
/* Now undef the windows BOOL. */
#undef BOOL
/* Key structure for maintaining thread specific storage */
static DWORD __gthread_objc_data_tls = (DWORD) -1;
/* Backend initialization functions */
/* Initialize the threads subsystem. */
int
__gthread_objc_init_thread_system (void)
{
/* Initialize the thread storage key. */
if ((__gthread_objc_data_tls = TlsAlloc ()) != (DWORD) -1)
return 0;
else
return -1;
}
/* Close the threads subsystem. */
int
__gthread_objc_close_thread_system (void)
{
if (__gthread_objc_data_tls != (DWORD) -1)
TlsFree (__gthread_objc_data_tls);
return 0;
}
/* Backend thread functions */
/* Create a new thread of execution. */
objc_thread_t
__gthread_objc_thread_detach (void (*func)(void *arg), void *arg)
{
DWORD thread_id = 0;
HANDLE win32_handle;
if (!(win32_handle = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) func,
arg, 0, &thread_id)))
thread_id = 0;
return (objc_thread_t) (INT_PTR) thread_id;
}
/* Set the current thread's priority. */
int
__gthread_objc_thread_set_priority (int priority)
{
int sys_priority = 0;
switch (priority)
{
case OBJC_THREAD_INTERACTIVE_PRIORITY:
sys_priority = THREAD_PRIORITY_NORMAL;
break;
default:
case OBJC_THREAD_BACKGROUND_PRIORITY:
sys_priority = THREAD_PRIORITY_BELOW_NORMAL;
break;
case OBJC_THREAD_LOW_PRIORITY:
sys_priority = THREAD_PRIORITY_LOWEST;
break;
}
/* Change priority */
if (SetThreadPriority (GetCurrentThread (), sys_priority))
return 0;
else
return -1;
}
/* Return the current thread's priority. */
int
__gthread_objc_thread_get_priority (void)
{
int sys_priority;
sys_priority = GetThreadPriority (GetCurrentThread ());
switch (sys_priority)
{
case THREAD_PRIORITY_HIGHEST:
case THREAD_PRIORITY_TIME_CRITICAL:
case THREAD_PRIORITY_ABOVE_NORMAL:
case THREAD_PRIORITY_NORMAL:
return OBJC_THREAD_INTERACTIVE_PRIORITY;
default:
case THREAD_PRIORITY_BELOW_NORMAL:
return OBJC_THREAD_BACKGROUND_PRIORITY;
case THREAD_PRIORITY_IDLE:
case THREAD_PRIORITY_LOWEST:
return OBJC_THREAD_LOW_PRIORITY;
}
/* Couldn't get priority. */
return -1;
}
/* Yield our process time to another thread. */
void
__gthread_objc_thread_yield (void)
{
Sleep (0);
}
/* Terminate the current thread. */
int
__gthread_objc_thread_exit (void)
{
/* exit the thread */
ExitThread (__objc_thread_exit_status);
/* Failed if we reached here */
return -1;
}
/* Returns an integer value which uniquely describes a thread. */
objc_thread_t
__gthread_objc_thread_id (void)
{
return (objc_thread_t) (INT_PTR) GetCurrentThreadId ();
}
/* Sets the thread's local storage pointer. */
int
__gthread_objc_thread_set_data (void *value)
{
if (TlsSetValue (__gthread_objc_data_tls, value))
return 0;
else
return -1;
}
/* Returns the thread's local storage pointer. */
void *
__gthread_objc_thread_get_data (void)
{
DWORD lasterror;
void *ptr;
lasterror = GetLastError ();
ptr = TlsGetValue (__gthread_objc_data_tls); /* Return thread data. */
SetLastError (lasterror);
return ptr;
}
/* Backend mutex functions */
/* Allocate a mutex. */
int
__gthread_objc_mutex_allocate (objc_mutex_t mutex)
{
if ((mutex->backend = (void *) CreateMutex (NULL, 0, NULL)) == NULL)
return -1;
else
return 0;
}
/* Deallocate a mutex. */
int
__gthread_objc_mutex_deallocate (objc_mutex_t mutex)
{
CloseHandle ((HANDLE) (mutex->backend));
return 0;
}
/* Grab a lock on a mutex. */
int
__gthread_objc_mutex_lock (objc_mutex_t mutex)
{
int status;
status = WaitForSingleObject ((HANDLE) (mutex->backend), INFINITE);
if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
return -1;
else
return 0;
}
/* Try to grab a lock on a mutex. */
int
__gthread_objc_mutex_trylock (objc_mutex_t mutex)
{
int status;
status = WaitForSingleObject ((HANDLE) (mutex->backend), 0);
if (status != WAIT_OBJECT_0 && status != WAIT_ABANDONED)
return -1;
else
return 0;
}
/* Unlock the mutex */
int
__gthread_objc_mutex_unlock (objc_mutex_t mutex)
{
if (ReleaseMutex ((HANDLE) (mutex->backend)) == 0)
return -1;
else
return 0;
}
/* Backend condition mutex functions */
/* Allocate a condition. */
int
__gthread_objc_condition_allocate (objc_condition_t __UNUSED_PARAM(condition))
{
/* Unimplemented. */
return -1;
}
/* Deallocate a condition. */
int
__gthread_objc_condition_deallocate (objc_condition_t __UNUSED_PARAM(condition))
{
/* Unimplemented. */
return -1;
}
/* Wait on the condition */
int
__gthread_objc_condition_wait (objc_condition_t __UNUSED_PARAM(condition),
objc_mutex_t __UNUSED_PARAM(mutex))
{
/* Unimplemented. */
return -1;
}
/* Wake up all threads waiting on this condition. */
int
__gthread_objc_condition_broadcast (objc_condition_t __UNUSED_PARAM(condition))
{
/* Unimplemented. */
return -1;
}
/* Wake up one thread waiting on this condition. */
int
__gthread_objc_condition_signal (objc_condition_t __UNUSED_PARAM(condition))
{
/* Unimplemented. */
return -1;
}
#else /* _LIBOBJC */
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long __gthread_key_t;
typedef struct {
int done;
long started;
} __gthread_once_t;
typedef struct {
long counter;
void *sema;
} __gthread_mutex_t;
typedef struct {
long counter;
long depth;
unsigned long owner;
void *sema;
} __gthread_recursive_mutex_t;
#define __GTHREAD_ONCE_INIT {0, -1}
#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function
#define __GTHREAD_MUTEX_INIT_DEFAULT {-1, 0}
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION \
__gthread_recursive_mutex_init_function
#define __GTHREAD_RECURSIVE_MUTEX_INIT_DEFAULT {-1, 0, 0, 0}
#if defined (_WIN32) && !defined(__CYGWIN__)
#define MINGW32_SUPPORTS_MT_EH 1
/* Mingw runtime >= v0.3 provides a magic variable that is set to nonzero
if -mthreads option was specified, or 0 otherwise. This is to get around
the lack of weak symbols in PE-COFF. */
extern int _CRT_MT;
extern int __mingwthr_key_dtor (unsigned long, void (*) (void *));
#endif /* _WIN32 && !__CYGWIN__ */
/* The Windows95 kernel does not export InterlockedCompareExchange.
This provides a substitute. When building apps that reference
gthread_mutex_try_lock, the __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
macro must be defined if Windows95 is a target. Currently
gthread_mutex_try_lock is not referenced by libgcc or libstdc++. */
#ifdef __GTHREAD_I486_INLINE_LOCK_PRIMITIVES
static inline long
__gthr_i486_lock_cmp_xchg(long *__dest, long __xchg, long __comperand)
{
long result;
__asm__ __volatile__ ("\n\
lock\n\
cmpxchg{l} {%4, %1|%1, %4}\n"
: "=a" (result), "=m" (*__dest)
: "0" (__comperand), "m" (*__dest), "r" (__xchg)
: "cc");
return result;
}
#define __GTHR_W32_InterlockedCompareExchange __gthr_i486_lock_cmp_xchg
#else /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
#define __GTHR_W32_InterlockedCompareExchange InterlockedCompareExchange
#endif /* __GTHREAD_I486_INLINE_LOCK_PRIMITIVES */
static inline int
__gthread_active_p (void)
{
#ifdef MINGW32_SUPPORTS_MT_EH
return _CRT_MT;
#else
return 1;
#endif
}
#if __GTHREAD_HIDE_WIN32API
/* The implementations are in config/i386/gthr-win32.c in libgcc.a.
Only stubs are exposed to avoid polluting the C++ namespace with
windows api definitions. */
extern int __gthr_win32_once (__gthread_once_t *, void (*) (void));
extern int __gthr_win32_key_create (__gthread_key_t *, void (*) (void*));
extern int __gthr_win32_key_delete (__gthread_key_t);
extern void * __gthr_win32_getspecific (__gthread_key_t);
extern int __gthr_win32_setspecific (__gthread_key_t, const void *);
extern void __gthr_win32_mutex_init_function (__gthread_mutex_t *);
extern int __gthr_win32_mutex_lock (__gthread_mutex_t *);
extern int __gthr_win32_mutex_trylock (__gthread_mutex_t *);
extern int __gthr_win32_mutex_unlock (__gthread_mutex_t *);
extern void
__gthr_win32_recursive_mutex_init_function (__gthread_recursive_mutex_t *);
extern int __gthr_win32_recursive_mutex_lock (__gthread_recursive_mutex_t *);
extern int
__gthr_win32_recursive_mutex_trylock (__gthread_recursive_mutex_t *);
extern int __gthr_win32_recursive_mutex_unlock (__gthread_recursive_mutex_t *);
extern void __gthr_win32_mutex_destroy (__gthread_mutex_t *);
extern int
__gthr_win32_recursive_mutex_destroy (__gthread_recursive_mutex_t *);
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthr_win32_once (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthr_win32_key_create (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return __gthr_win32_key_delete (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
return __gthr_win32_getspecific (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthr_win32_setspecific (__key, __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
__gthr_win32_mutex_init_function (__mutex);
}
static inline void
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
__gthr_win32_mutex_destroy (__mutex);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_mutex_lock (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_mutex_trylock (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_mutex_unlock (__mutex);
else
return 0;
}
static inline void
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
__gthr_win32_recursive_mutex_init_function (__mutex);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_recursive_mutex_lock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_recursive_mutex_trylock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthr_win32_recursive_mutex_unlock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
return __gthr_win32_recursive_mutex_destroy (__mutex);
}
#else /* ! __GTHREAD_HIDE_WIN32API */
#include <windows.h>
#include <errno.h>
static inline int
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (! __gthread_active_p ())
return -1;
else if (__once == NULL || __func == NULL)
return EINVAL;
if (! __once->done)
{
if (InterlockedIncrement (&(__once->started)) == 0)
{
(*__func) ();
__once->done = TRUE;
}
else
{
/* Another thread is currently executing the code, so wait for it
to finish; yield the CPU in the meantime. If performance
does become an issue, the solution is to use an Event that
we wait on here (and set above), but that implies a place to
create the event before this routine is called. */
while (! __once->done)
Sleep (0);
}
}
return 0;
}
/* Windows32 thread local keys don't support destructors; this leads to
leaks, especially in threaded applications making extensive use of
C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
static inline int
__gthread_key_create (__gthread_key_t *__key,
void (*__dtor) (void *) __attribute__((__unused__)))
{
int __status = 0;
DWORD __tls_index = TlsAlloc ();
if (__tls_index != 0xFFFFFFFF)
{
*__key = __tls_index;
#ifdef MINGW32_SUPPORTS_MT_EH
/* Mingw runtime will run the dtors in reverse order for each thread
when the thread exits. */
__status = __mingwthr_key_dtor (*__key, __dtor);
#endif
}
else
__status = (int) GetLastError ();
return __status;
}
static inline int
__gthread_key_delete (__gthread_key_t __key)
{
return (TlsFree (__key) != 0) ? 0 : (int) GetLastError ();
}
static inline void *
__gthread_getspecific (__gthread_key_t __key)
{
DWORD __lasterror;
void *__ptr;
__lasterror = GetLastError ();
__ptr = TlsGetValue (__key);
SetLastError (__lasterror);
return __ptr;
}
static inline int
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
if (TlsSetValue (__key, CONST_CAST2(void *, const void *, __ptr)) != 0)
return 0;
else
return GetLastError ();
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
__mutex->counter = -1;
__mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
static inline void
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
CloseHandle ((HANDLE) __mutex->sema);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
int __status = 0;
if (__gthread_active_p ())
{
if (InterlockedIncrement (&__mutex->counter) == 0 ||
WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0)
__status = 0;
else
{
/* WaitForSingleObject returns WAIT_FAILED, and we can only do
some best-effort cleanup here. */
InterlockedDecrement (&__mutex->counter);
__status = 1;
}
}
return __status;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
int __status = 0;
if (__gthread_active_p ())
{
if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0)
__status = 0;
else
__status = 1;
}
return __status;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
if (InterlockedDecrement (&__mutex->counter) >= 0)
return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1;
}
return 0;
}
static inline void
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
__mutex->counter = -1;
__mutex->depth = 0;
__mutex->owner = 0;
__mutex->sema = CreateSemaphoreW (NULL, 0, 65535, NULL);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
DWORD __me = GetCurrentThreadId();
if (InterlockedIncrement (&__mutex->counter) == 0)
{
__mutex->depth = 1;
__mutex->owner = __me;
}
else if (__mutex->owner == __me)
{
InterlockedDecrement (&__mutex->counter);
++(__mutex->depth);
}
else if (WaitForSingleObject (__mutex->sema, INFINITE) == WAIT_OBJECT_0)
{
__mutex->depth = 1;
__mutex->owner = __me;
}
else
{
/* WaitForSingleObject returns WAIT_FAILED, and we can only do
some best-effort cleanup here. */
InterlockedDecrement (&__mutex->counter);
return 1;
}
}
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
DWORD __me = GetCurrentThreadId();
if (__GTHR_W32_InterlockedCompareExchange (&__mutex->counter, 0, -1) < 0)
{
__mutex->depth = 1;
__mutex->owner = __me;
}
else if (__mutex->owner == __me)
++(__mutex->depth);
else
return 1;
}
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
--(__mutex->depth);
if (__mutex->depth == 0)
{
__mutex->owner = 0;
if (InterlockedDecrement (&__mutex->counter) >= 0)
return ReleaseSemaphore (__mutex->sema, 1, NULL) ? 0 : 1;
}
}
return 0;
}
static inline int
__gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *__mutex)
{
CloseHandle ((HANDLE) __mutex->sema);
return 0;
}
#endif /* __GTHREAD_HIDE_WIN32API */
#ifdef __cplusplus
}
#endif
#endif /* _LIBOBJC */
#endif /* ! GCC_GTHR_WIN32_H */

View File

@ -0,0 +1,198 @@
/* DWARF2 EH unwinding support for AMD x86-64 and x86.
Copyright (C) 2004-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs.
Don't use this at all if inhibit_libc is used. */
#ifndef inhibit_libc
/* There's no sys/ucontext.h for glibc 2.0, so no
signal-turned-exceptions for them. There's also no configure-run for
the target, so we can't check on (e.g.) HAVE_SYS_UCONTEXT_H. Using the
target libc version macro should be enough. */
#if defined __GLIBC__ && !(__GLIBC__ == 2 && __GLIBC_MINOR__ == 0)
#include <signal.h>
#include <sys/ucontext.h>
#ifdef __x86_64__
#define MD_FALLBACK_FRAME_STATE_FOR x86_64_fallback_frame_state
static _Unwind_Reason_Code
x86_64_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
struct sigcontext *sc;
long new_cfa;
/* movq $__NR_rt_sigreturn, %rax ; syscall. */
#ifdef __LP64__
#define RT_SIGRETURN_SYSCALL 0x050f0000000fc0c7ULL
#else
#define RT_SIGRETURN_SYSCALL 0x050f40000201c0c7ULL
#endif
if (*(unsigned char *)(pc+0) == 0x48
&& *(unsigned long long *)(pc+1) == RT_SIGRETURN_SYSCALL)
{
struct ucontext *uc_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
The aliasing warning is correct, but should not be a problem
because it does not alias anything. */
sc = (struct sigcontext *) (void *) &uc_->uc_mcontext;
}
else
return _URC_END_OF_STACK;
new_cfa = sc->rsp;
fs->regs.cfa_how = CFA_REG_OFFSET;
/* Register 7 is rsp */
fs->regs.cfa_reg = 7;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sc->rax - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sc->rdx - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sc->rcx - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sc->rbx - new_cfa;
fs->regs.reg[4].how = REG_SAVED_OFFSET;
fs->regs.reg[4].loc.offset = (long)&sc->rsi - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sc->rdi - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sc->rbp - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sc->r8 - new_cfa;
fs->regs.reg[9].how = REG_SAVED_OFFSET;
fs->regs.reg[9].loc.offset = (long)&sc->r9 - new_cfa;
fs->regs.reg[10].how = REG_SAVED_OFFSET;
fs->regs.reg[10].loc.offset = (long)&sc->r10 - new_cfa;
fs->regs.reg[11].how = REG_SAVED_OFFSET;
fs->regs.reg[11].loc.offset = (long)&sc->r11 - new_cfa;
fs->regs.reg[12].how = REG_SAVED_OFFSET;
fs->regs.reg[12].loc.offset = (long)&sc->r12 - new_cfa;
fs->regs.reg[13].how = REG_SAVED_OFFSET;
fs->regs.reg[13].loc.offset = (long)&sc->r13 - new_cfa;
fs->regs.reg[14].how = REG_SAVED_OFFSET;
fs->regs.reg[14].loc.offset = (long)&sc->r14 - new_cfa;
fs->regs.reg[15].how = REG_SAVED_OFFSET;
fs->regs.reg[15].loc.offset = (long)&sc->r15 - new_cfa;
fs->regs.reg[16].how = REG_SAVED_OFFSET;
fs->regs.reg[16].loc.offset = (long)&sc->rip - new_cfa;
fs->retaddr_column = 16;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#else /* ifdef __x86_64__ */
#define MD_FALLBACK_FRAME_STATE_FOR x86_fallback_frame_state
static _Unwind_Reason_Code
x86_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
struct sigcontext *sc;
long new_cfa;
/* popl %eax ; movl $__NR_sigreturn,%eax ; int $0x80 */
if (*(unsigned short *)(pc+0) == 0xb858
&& *(unsigned int *)(pc+2) == 119
&& *(unsigned short *)(pc+6) == 0x80cd)
sc = context->cfa + 4;
/* movl $__NR_rt_sigreturn,%eax ; int $0x80 */
else if (*(unsigned char *)(pc+0) == 0xb8
&& *(unsigned int *)(pc+1) == 173
&& *(unsigned short *)(pc+5) == 0x80cd)
{
struct rt_sigframe {
int sig;
siginfo_t *pinfo;
void *puc;
siginfo_t info;
struct ucontext uc;
} *rt_ = context->cfa;
/* The void * cast is necessary to avoid an aliasing warning.
The aliasing warning is correct, but should not be a problem
because it does not alias anything. */
sc = (struct sigcontext *) (void *) &rt_->uc.uc_mcontext;
}
else
return _URC_END_OF_STACK;
new_cfa = sc->esp;
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = 4;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&sc->eax - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&sc->ebx - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&sc->ecx - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&sc->edx - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&sc->esi - new_cfa;
fs->regs.reg[7].how = REG_SAVED_OFFSET;
fs->regs.reg[7].loc.offset = (long)&sc->edi - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&sc->ebp - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&sc->eip - new_cfa;
fs->retaddr_column = 8;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#define MD_FROB_UPDATE_CONTEXT x86_frob_update_context
/* Fix up for kernels that have vDSO, but don't have S flag in it. */
static void
x86_frob_update_context (struct _Unwind_Context *context,
_Unwind_FrameState *fs ATTRIBUTE_UNUSED)
{
unsigned char *pc = context->ra;
/* movl $__NR_rt_sigreturn,%eax ; {int $0x80 | syscall} */
if (*(unsigned char *)(pc+0) == 0xb8
&& *(unsigned int *)(pc+1) == 173
&& (*(unsigned short *)(pc+5) == 0x80cd
|| *(unsigned short *)(pc+5) == 0x050f))
_Unwind_SetSignalFrame (context, 1);
}
#endif /* ifdef __x86_64__ */
#endif /* not glibc 2.0 */
#endif /* ifdef inhibit_libc */

View File

@ -0,0 +1,863 @@
# x86/x86_64 support for -fsplit-stack.
# Copyright (C) 2009-2015 Free Software Foundation, Inc.
# Contributed by Ian Lance Taylor <iant@google.com>.
# This file is part of GCC.
# GCC is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
# GCC is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
# Under Section 7 of GPL version 3, you are granted additional
# permissions described in the GCC Runtime Library Exception, version
# 3.1, as published by the Free Software Foundation.
# You should have received a copy of the GNU General Public License and
# a copy of the GCC Runtime Library Exception along with this program;
# see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# <http://www.gnu.org/licenses/>.
# Support for allocating more stack space when using -fsplit-stack.
# When a function discovers that it needs more stack space, it will
# call __morestack with the size of the stack frame and the size of
# the parameters to copy from the old stack frame to the new one.
# The __morestack function preserves the parameter registers and
# calls __generic_morestack to actually allocate the stack space.
# When this is called stack space is very low, but we ensure that
# there is enough space to push the parameter registers and to call
# __generic_morestack.
# When calling __generic_morestack, FRAME_SIZE points to the size of
# the desired frame when the function is called, and the function
# sets it to the size of the allocated stack. OLD_STACK points to
# the parameters on the old stack and PARAM_SIZE is the number of
# bytes of parameters to copy to the new stack. These are the
# parameters of the function that called __morestack. The
# __generic_morestack function returns the new stack pointer,
# pointing to the address of the first copied parameter. The return
# value minus the returned *FRAME_SIZE will be the first address on
# the stack which we should not use.
# void *__generic_morestack (size_t *frame_size, void *old_stack,
# size_t param_size);
# The __morestack routine has to arrange for the caller to return to a
# stub on the new stack. The stub is responsible for restoring the
# old stack pointer and returning to the caller's caller. This calls
# __generic_releasestack to retrieve the old stack pointer and release
# the newly allocated stack.
# void *__generic_releasestack (size_t *available);
# We do a little dance so that the processor's call/return return
# address prediction works out. The compiler arranges for the caller
# to look like this:
# call __generic_morestack
# ret
# L:
# // carry on with function
# After we allocate more stack, we call L, which is in our caller.
# When that returns (to the predicted instruction), we release the
# stack segment and reset the stack pointer. We then return to the
# predicted instruction, namely the ret instruction immediately after
# the call to __generic_morestack. That then returns to the caller of
# the original caller.
# The amount of extra space we ask for. In general this has to be
# enough for the dynamic loader to find a symbol and for a signal
# handler to run.
#ifndef __x86_64__
#define BACKOFF (1024)
#else
#define BACKOFF (1536)
#endif
# The amount of space we ask for when calling non-split-stack code.
#define NON_SPLIT_STACK 0x100000
# This entry point is for split-stack code which calls non-split-stack
# code. When the linker sees this case, it converts the call to
# __morestack to call __morestack_non_split instead. We just bump the
# requested stack space by 16K.
.global __morestack_non_split
.hidden __morestack_non_split
#ifdef __ELF__
.type __morestack_non_split,@function
#endif
__morestack_non_split:
.cfi_startproc
#ifndef __x86_64__
# See below for an extended explanation of this.
.cfi_def_cfa %esp,16
pushl %eax # Save %eax in case it is a parameter.
.cfi_adjust_cfa_offset 4 # Account for pushed register.
movl %esp,%eax # Current stack,
subl 8(%esp),%eax # less required stack frame size,
subl $NON_SPLIT_STACK,%eax # less space for non-split code.
cmpl %gs:0x30,%eax # See if we have enough space.
jb 2f # Get more space if we need it.
# Here the stack is
# %esp + 20: stack pointer after two returns
# %esp + 16: return address of morestack caller's caller
# %esp + 12: size of parameters
# %esp + 8: new stack frame size
# %esp + 4: return address of this function
# %esp: saved %eax
#
# Since we aren't doing a full split stack, we don't need to
# do anything when our caller returns. So we return to our
# caller rather than calling it, and let it return as usual.
# To make that work we adjust the return address.
# This breaks call/return address prediction for the call to
# this function. I can't figure out a way to make it work
# short of copying the parameters down the stack, which will
# probably take more clock cycles than we will lose breaking
# call/return address prediction. We will only break
# prediction for this call, not for our caller.
movl 4(%esp),%eax # Increment the return address
cmpb $0xc3,(%eax) # to skip the ret instruction;
je 1f # see above.
addl $2,%eax
1: inc %eax
# If the instruction that we return to is
# leal 20(%ebp),{%eax,%ecx,%edx}
# then we have been called by a varargs function that expects
# %ebp to hold a real value. That can only work if we do the
# full stack split routine. FIXME: This is fragile.
cmpb $0x8d,(%eax)
jne 3f
cmpb $0x14,2(%eax)
jne 3f
cmpb $0x45,1(%eax)
je 2f
cmpb $0x4d,1(%eax)
je 2f
cmpb $0x55,1(%eax)
je 2f
3:
movl %eax,4(%esp) # Update return address.
popl %eax # Restore %eax and stack.
.cfi_adjust_cfa_offset -4 # Account for popped register.
ret $8 # Return to caller, popping args.
2:
.cfi_adjust_cfa_offset 4 # Back to where we were.
popl %eax # Restore %eax and stack.
.cfi_adjust_cfa_offset -4 # Account for popped register.
# Increment space we request.
addl $NON_SPLIT_STACK+0x1000+BACKOFF,4(%esp)
# Fall through into morestack.
#else
# See below for an extended explanation of this.
.cfi_def_cfa %rsp,16
pushq %rax # Save %rax in case caller is using
# it to preserve original %r10.
.cfi_adjust_cfa_offset 8 # Adjust for pushed register.
movq %rsp,%rax # Current stack,
subq %r10,%rax # less required stack frame size,
subq $NON_SPLIT_STACK,%rax # less space for non-split code.
#ifdef __LP64__
cmpq %fs:0x70,%rax # See if we have enough space.
#else
cmpl %fs:0x40,%eax
#endif
jb 2f # Get more space if we need it.
# If the instruction that we return to is
# leaq 24(%rbp), %r11n
# then we have been called by a varargs function that expects
# %ebp to hold a real value. That can only work if we do the
# full stack split routine. FIXME: This is fragile.
movq 8(%rsp),%rax
incq %rax # Skip ret instruction in caller.
cmpl $0x185d8d4c,(%rax)
je 2f
# This breaks call/return prediction, as described above.
incq 8(%rsp) # Increment the return address.
popq %rax # Restore register.
.cfi_adjust_cfa_offset -8 # Adjust for popped register.
ret # Return to caller.
2:
popq %rax # Restore register.
.cfi_adjust_cfa_offset -8 # Adjust for popped register.
# Increment space we request.
addq $NON_SPLIT_STACK+0x1000+BACKOFF,%r10
# Fall through into morestack.
#endif
.cfi_endproc
#ifdef __ELF__
.size __morestack_non_split, . - __morestack_non_split
#endif
# __morestack_non_split falls through into __morestack.
# The __morestack function.
.global __morestack
.hidden __morestack
#ifdef __ELF__
.type __morestack,@function
#endif
__morestack:
.LFB1:
.cfi_startproc
#ifndef __x86_64__
# The 32-bit __morestack function.
# We use a cleanup to restore the stack guard if an exception
# is thrown through this code.
#ifndef __PIC__
.cfi_personality 0,__gcc_personality_v0
.cfi_lsda 0,.LLSDA1
#else
.cfi_personality 0x9b,DW.ref.__gcc_personality_v0
.cfi_lsda 0x1b,.LLSDA1
#endif
# We return below with a ret $8. We will return to a single
# return instruction, which will return to the caller of our
# caller. We let the unwinder skip that single return
# instruction, and just return to the real caller.
# Here CFA points just past the return address on the stack,
# e.g., on function entry it is %esp + 4. The stack looks
# like this:
# CFA + 12: stack pointer after two returns
# CFA + 8: return address of morestack caller's caller
# CFA + 4: size of parameters
# CFA: new stack frame size
# CFA - 4: return address of this function
# CFA - 8: previous value of %ebp; %ebp points here
# Setting the new CFA to be the current CFA + 12 (i.e., %esp +
# 16) will make the unwinder pick up the right return address.
.cfi_def_cfa %esp,16
pushl %ebp
.cfi_adjust_cfa_offset 4
.cfi_offset %ebp, -20
movl %esp,%ebp
.cfi_def_cfa_register %ebp
# In 32-bit mode the parameters are pushed on the stack. The
# argument size is pushed then the new stack frame size is
# pushed.
# In the body of a non-leaf function, the stack pointer will
# be aligned to a 16-byte boundary. That is CFA + 12 in the
# stack picture above: (CFA + 12) % 16 == 0. At this point we
# have %esp == CFA - 8, so %esp % 16 == 12. We need some
# space for saving registers and passing parameters, and we
# need to wind up with %esp % 16 == 0.
subl $44,%esp
# Because our cleanup code may need to clobber %ebx, we need
# to save it here so the unwinder can restore the value used
# by the caller. Note that we don't have to restore the
# register, since we don't change it, we just have to save it
# for the unwinder.
movl %ebx,-4(%ebp)
.cfi_offset %ebx, -24
# In 32-bit mode the registers %eax, %edx, and %ecx may be
# used for parameters, depending on the regparm and fastcall
# attributes.
movl %eax,-8(%ebp)
movl %edx,-12(%ebp)
movl %ecx,-16(%ebp)
call __morestack_block_signals
movl 12(%ebp),%eax # The size of the parameters.
movl %eax,8(%esp)
leal 20(%ebp),%eax # Address of caller's parameters.
movl %eax,4(%esp)
addl $BACKOFF,8(%ebp) # Ask for backoff bytes.
leal 8(%ebp),%eax # The address of the new frame size.
movl %eax,(%esp)
call __generic_morestack
movl %eax,%esp # Switch to the new stack.
subl 8(%ebp),%eax # The end of the stack space.
addl $BACKOFF,%eax # Back off 512 bytes.
.LEHB0:
# FIXME: The offset must match
# TARGET_THREAD_SPLIT_STACK_OFFSET in
# gcc/config/i386/linux.h.
movl %eax,%gs:0x30 # Save the new stack boundary.
call __morestack_unblock_signals
movl -12(%ebp),%edx # Restore registers.
movl -16(%ebp),%ecx
movl 4(%ebp),%eax # Increment the return address
cmpb $0xc3,(%eax) # to skip the ret instruction;
je 1f # see above.
addl $2,%eax
1: inc %eax
movl %eax,-12(%ebp) # Store return address in an
# unused slot.
movl -8(%ebp),%eax # Restore the last register.
call *-12(%ebp) # Call our caller!
# The caller will return here, as predicted.
# Save the registers which may hold a return value. We
# assume that __generic_releasestack does not touch any
# floating point or vector registers.
pushl %eax
pushl %edx
# Push the arguments to __generic_releasestack now so that the
# stack is at a 16-byte boundary for
# __morestack_block_signals.
pushl $0 # Where the available space is returned.
leal 0(%esp),%eax # Push its address.
push %eax
call __morestack_block_signals
call __generic_releasestack
subl 4(%esp),%eax # Subtract available space.
addl $BACKOFF,%eax # Back off 512 bytes.
.LEHE0:
movl %eax,%gs:0x30 # Save the new stack boundary.
addl $8,%esp # Remove values from stack.
# We need to restore the old stack pointer, which is in %rbp,
# before we unblock signals. We also need to restore %eax and
# %edx after we unblock signals but before we return. Do this
# by moving %eax and %edx from the current stack to the old
# stack.
popl %edx # Pop return value from current stack.
popl %eax
movl %ebp,%esp # Restore stack pointer.
# As before, we now have %esp % 16 == 12.
pushl %eax # Push return value on old stack.
pushl %edx
subl $4,%esp # Align stack to 16-byte boundary.
call __morestack_unblock_signals
addl $4,%esp
popl %edx # Restore return value.
popl %eax
.cfi_remember_state
# We never changed %ebx, so we don't have to actually restore it.
.cfi_restore %ebx
popl %ebp
.cfi_restore %ebp
.cfi_def_cfa %esp, 16
ret $8 # Return to caller, which will
# immediately return. Pop
# arguments as we go.
# This is the cleanup code called by the stack unwinder when unwinding
# through the code between .LEHB0 and .LEHE0 above.
.L1:
.cfi_restore_state
subl $16,%esp # Maintain 16 byte alignment.
movl %eax,4(%esp) # Save exception header.
movl %ebp,(%esp) # Stack pointer after resume.
call __generic_findstack
movl %ebp,%ecx # Get the stack pointer.
subl %eax,%ecx # Subtract available space.
addl $BACKOFF,%ecx # Back off 512 bytes.
movl %ecx,%gs:0x30 # Save new stack boundary.
movl 4(%esp),%eax # Function argument.
movl %eax,(%esp)
#ifdef __PIC__
call __x86.get_pc_thunk.bx # %ebx may not be set up for us.
addl $_GLOBAL_OFFSET_TABLE_, %ebx
call _Unwind_Resume@PLT # Resume unwinding.
#else
call _Unwind_Resume
#endif
#else /* defined(__x86_64__) */
# The 64-bit __morestack function.
# We use a cleanup to restore the stack guard if an exception
# is thrown through this code.
#ifndef __PIC__
.cfi_personality 0x3,__gcc_personality_v0
.cfi_lsda 0x3,.LLSDA1
#else
.cfi_personality 0x9b,DW.ref.__gcc_personality_v0
.cfi_lsda 0x1b,.LLSDA1
#endif
# We will return a single return instruction, which will
# return to the caller of our caller. Let the unwinder skip
# that single return instruction, and just return to the real
# caller.
.cfi_def_cfa %rsp,16
# Set up a normal backtrace.
pushq %rbp
.cfi_adjust_cfa_offset 8
.cfi_offset %rbp, -24
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
# In 64-bit mode the new stack frame size is passed in r10
# and the argument size is passed in r11.
addq $BACKOFF,%r10 # Ask for backoff bytes.
pushq %r10 # Save new frame size.
# In 64-bit mode the registers %rdi, %rsi, %rdx, %rcx, %r8,
# and %r9 may be used for parameters. We also preserve %rax
# which the caller may use to hold %r10.
pushq %rax
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
pushq %r8
pushq %r9
pushq %r11
# We entered morestack with the stack pointer aligned to a
# 16-byte boundary (the call to morestack's caller used 8
# bytes, and the call to morestack used 8 bytes). We have now
# pushed 10 registers, so we are still aligned to a 16-byte
# boundary.
call __morestack_block_signals
leaq -8(%rbp),%rdi # Address of new frame size.
leaq 24(%rbp),%rsi # The caller's parameters.
popq %rdx # The size of the parameters.
subq $8,%rsp # Align stack.
call __generic_morestack
movq -8(%rbp),%r10 # Reload modified frame size
movq %rax,%rsp # Switch to the new stack.
subq %r10,%rax # The end of the stack space.
addq $BACKOFF,%rax # Back off 1024 bytes.
.LEHB0:
# FIXME: The offset must match
# TARGET_THREAD_SPLIT_STACK_OFFSET in
# gcc/config/i386/linux64.h.
# Macro to save the new stack boundary.
#ifdef __LP64__
#define X86_64_SAVE_NEW_STACK_BOUNDARY(reg) movq %r##reg,%fs:0x70
#else
#define X86_64_SAVE_NEW_STACK_BOUNDARY(reg) movl %e##reg,%fs:0x40
#endif
X86_64_SAVE_NEW_STACK_BOUNDARY (ax)
call __morestack_unblock_signals
movq -24(%rbp),%rdi # Restore registers.
movq -32(%rbp),%rsi
movq -40(%rbp),%rdx
movq -48(%rbp),%rcx
movq -56(%rbp),%r8
movq -64(%rbp),%r9
movq 8(%rbp),%r10 # Increment the return address
incq %r10 # to skip the ret instruction;
# see above.
movq -16(%rbp),%rax # Restore caller's %rax.
call *%r10 # Call our caller!
# The caller will return here, as predicted.
# Save the registers which may hold a return value. We
# assume that __generic_releasestack does not touch any
# floating point or vector registers.
pushq %rax
pushq %rdx
call __morestack_block_signals
pushq $0 # For alignment.
pushq $0 # Where the available space is returned.
leaq 0(%rsp),%rdi # Pass its address.
call __generic_releasestack
subq 0(%rsp),%rax # Subtract available space.
addq $BACKOFF,%rax # Back off 1024 bytes.
.LEHE0:
X86_64_SAVE_NEW_STACK_BOUNDARY (ax)
addq $16,%rsp # Remove values from stack.
# We need to restore the old stack pointer, which is in %rbp,
# before we unblock signals. We also need to restore %rax and
# %rdx after we unblock signals but before we return. Do this
# by moving %rax and %rdx from the current stack to the old
# stack.
popq %rdx # Pop return value from current stack.
popq %rax
movq %rbp,%rsp # Restore stack pointer.
# Now (%rsp & 16) == 8.
subq $8,%rsp # For alignment.
pushq %rax # Push return value on old stack.
pushq %rdx
call __morestack_unblock_signals
popq %rdx # Restore return value.
popq %rax
addq $8,%rsp
.cfi_remember_state
popq %rbp
.cfi_restore %rbp
.cfi_def_cfa %rsp, 16
ret # Return to caller, which will
# immediately return.
# This is the cleanup code called by the stack unwinder when unwinding
# through the code between .LEHB0 and .LEHE0 above.
.L1:
.cfi_restore_state
subq $16,%rsp # Maintain 16 byte alignment.
movq %rax,(%rsp) # Save exception header.
movq %rbp,%rdi # Stack pointer after resume.
call __generic_findstack
movq %rbp,%rcx # Get the stack pointer.
subq %rax,%rcx # Subtract available space.
addq $BACKOFF,%rcx # Back off 1024 bytes.
X86_64_SAVE_NEW_STACK_BOUNDARY (cx)
movq (%rsp),%rdi # Restore exception data for call.
#ifdef __PIC__
call _Unwind_Resume@PLT # Resume unwinding.
#else
call _Unwind_Resume # Resume unwinding.
#endif
#endif /* defined(__x86_64__) */
.cfi_endproc
#ifdef __ELF__
.size __morestack, . - __morestack
#endif
#if !defined(__x86_64__) && defined(__PIC__)
# Output the thunk to get PC into bx, since we use it above.
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
#ifdef __ELF__
.type __x86.get_pc_thunk.bx, @function
#endif
__x86.get_pc_thunk.bx:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
#ifdef __ELF__
.size __x86.get_pc_thunk.bx, . - __x86.get_pc_thunk.bx
#endif
#endif
# The exception table. This tells the personality routine to execute
# the exception handler.
.section .gcc_except_table,"a",@progbits
.align 4
.LLSDA1:
.byte 0xff # @LPStart format (omit)
.byte 0xff # @TType format (omit)
.byte 0x1 # call-site format (uleb128)
.uleb128 .LLSDACSE1-.LLSDACSB1 # Call-site table length
.LLSDACSB1:
.uleb128 .LEHB0-.LFB1 # region 0 start
.uleb128 .LEHE0-.LEHB0 # length
.uleb128 .L1-.LFB1 # landing pad
.uleb128 0 # action
.LLSDACSE1:
.global __gcc_personality_v0
#ifdef __PIC__
# Build a position independent reference to the basic
# personality function.
.hidden DW.ref.__gcc_personality_v0
.weak DW.ref.__gcc_personality_v0
.section .data.DW.ref.__gcc_personality_v0,"awG",@progbits,DW.ref.__gcc_personality_v0,comdat
.type DW.ref.__gcc_personality_v0, @object
DW.ref.__gcc_personality_v0:
#ifndef __LP64__
.align 4
.size DW.ref.__gcc_personality_v0, 4
.long __gcc_personality_v0
#else
.align 8
.size DW.ref.__gcc_personality_v0, 8
.quad __gcc_personality_v0
#endif
#endif
#if defined __x86_64__ && defined __LP64__
# This entry point is used for the large model. With this entry point
# the upper 32 bits of %r10 hold the argument size and the lower 32
# bits hold the new stack frame size. There doesn't seem to be a way
# to know in the assembler code that we are assembling for the large
# model, and there doesn't seem to be a large model multilib anyhow.
# If one is developed, then the non-PIC code is probably OK since we
# will probably be close to the morestack code, but the PIC code
# almost certainly needs to be changed. FIXME.
.text
.global __morestack_large_model
.hidden __morestack_large_model
#ifdef __ELF__
.type __morestack_large_model,@function
#endif
__morestack_large_model:
.cfi_startproc
movq %r10, %r11
andl $0xffffffff, %r10d
sarq $32, %r11
jmp __morestack
.cfi_endproc
#ifdef __ELF__
.size __morestack_large_model, . - __morestack_large_model
#endif
#endif /* __x86_64__ && __LP64__ */
# Initialize the stack test value when the program starts or when a
# new thread starts. We don't know how large the main stack is, so we
# guess conservatively. We might be able to use getrlimit here.
.text
.global __stack_split_initialize
.hidden __stack_split_initialize
#ifdef __ELF__
.type __stack_split_initialize, @function
#endif
__stack_split_initialize:
#ifndef __x86_64__
leal -16000(%esp),%eax # We should have at least 16K.
movl %eax,%gs:0x30
subl $4,%esp # Align stack.
pushl $16000
pushl %esp
#ifdef __PIC__
call __generic_morestack_set_initial_sp@PLT
#else
call __generic_morestack_set_initial_sp
#endif
addl $12,%esp
ret
#else /* defined(__x86_64__) */
leaq -16000(%rsp),%rax # We should have at least 16K.
X86_64_SAVE_NEW_STACK_BOUNDARY (ax)
subq $8,%rsp # Align stack.
movq %rsp,%rdi
movq $16000,%rsi
#ifdef __PIC__
call __generic_morestack_set_initial_sp@PLT
#else
call __generic_morestack_set_initial_sp
#endif
addq $8,%rsp
ret
#endif /* defined(__x86_64__) */
#ifdef __ELF__
.size __stack_split_initialize, . - __stack_split_initialize
#endif
# Routines to get and set the guard, for __splitstack_getcontext,
# __splitstack_setcontext, and __splitstack_makecontext.
# void *__morestack_get_guard (void) returns the current stack guard.
.text
.global __morestack_get_guard
.hidden __morestack_get_guard
#ifdef __ELF__
.type __morestack_get_guard,@function
#endif
__morestack_get_guard:
#ifndef __x86_64__
movl %gs:0x30,%eax
#else
#ifdef __LP64__
movq %fs:0x70,%rax
#else
movl %fs:0x40,%eax
#endif
#endif
ret
#ifdef __ELF__
.size __morestack_get_guard, . - __morestack_get_guard
#endif
# void __morestack_set_guard (void *) sets the stack guard.
.global __morestack_set_guard
.hidden __morestack_set_guard
#ifdef __ELF__
.type __morestack_set_guard,@function
#endif
__morestack_set_guard:
#ifndef __x86_64__
movl 4(%esp),%eax
movl %eax,%gs:0x30
#else
X86_64_SAVE_NEW_STACK_BOUNDARY (di)
#endif
ret
#ifdef __ELF__
.size __morestack_set_guard, . - __morestack_set_guard
#endif
# void *__morestack_make_guard (void *, size_t) returns the stack
# guard value for a stack.
.global __morestack_make_guard
.hidden __morestack_make_guard
#ifdef __ELF__
.type __morestack_make_guard,@function
#endif
__morestack_make_guard:
#ifndef __x86_64__
movl 4(%esp),%eax
subl 8(%esp),%eax
addl $BACKOFF,%eax
#else
subq %rsi,%rdi
addq $BACKOFF,%rdi
movq %rdi,%rax
#endif
ret
#ifdef __ELF__
.size __morestack_make_guard, . - __morestack_make_guard
#endif
# Make __stack_split_initialize a high priority constructor. FIXME:
# This is ELF specific.
.section .ctors.65535,"aw",@progbits
#ifndef __LP64__
.align 4
.long __stack_split_initialize
.long __morestack_load_mmap
#else
.align 8
.quad __stack_split_initialize
.quad __morestack_load_mmap
#endif
#ifdef __ELF__
.section .note.GNU-stack,"",@progbits
.section .note.GNU-split-stack,"",@progbits
.section .note.GNU-no-split-stack,"",@progbits
#endif

View File

@ -0,0 +1,108 @@
/*
* Copyright (C) 2012-2015 Free Software Foundation, Inc.
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3, or (at your option) any
* later version.
*
* This file 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.
*
* Under Section 7 of GPL version 3, you are granted additional
* permissions described in the GCC Runtime Library Exception, version
* 3.1, as published by the Free Software Foundation.
*
* You should have received a copy of the GNU General Public License and
* a copy of the GCC Runtime Library Exception along with this program;
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _SOFT_FLOAT
#include "sfp-machine.h"
struct fenv
{
unsigned short int __control_word;
unsigned short int __unused1;
unsigned short int __status_word;
unsigned short int __unused2;
unsigned short int __tags;
unsigned short int __unused3;
unsigned int __eip;
unsigned short int __cs_selector;
unsigned int __opcode:11;
unsigned int __unused4:5;
unsigned int __data_offset;
unsigned short int __data_selector;
unsigned short int __unused5;
};
void
__sfp_handle_exceptions (int _fex)
{
if (_fex & FP_EX_INVALID)
{
float f = 0.0f;
#ifdef __SSE_MATH__
volatile float r __attribute__ ((unused));
asm volatile ("%vdivss\t{%0, %d0|%d0, %0}" : "+x" (f));
r = f; /* Needed to trigger exception. */
#else
asm volatile ("fdiv\t{%y0, %0|%0, %y0}" : "+t" (f));
/* No need for fwait, exception is triggered by emitted fstp. */
#endif
}
if (_fex & FP_EX_DENORM)
{
struct fenv temp;
asm volatile ("fnstenv\t%0" : "=m" (temp));
temp.__status_word |= FP_EX_DENORM;
asm volatile ("fldenv\t%0" : : "m" (temp));
asm volatile ("fwait");
}
if (_fex & FP_EX_DIVZERO)
{
float f = 1.0f, g = 0.0f;
#ifdef __SSE_MATH__
volatile float r __attribute__ ((unused));
asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
r = f; /* Needed to trigger exception. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
#endif
}
if (_fex & FP_EX_OVERFLOW)
{
struct fenv temp;
asm volatile ("fnstenv\t%0" : "=m" (temp));
temp.__status_word |= FP_EX_OVERFLOW;
asm volatile ("fldenv\t%0" : : "m" (temp));
asm volatile ("fwait");
}
if (_fex & FP_EX_UNDERFLOW)
{
struct fenv temp;
asm volatile ("fnstenv\t%0" : "=m" (temp));
temp.__status_word |= FP_EX_UNDERFLOW;
asm volatile ("fldenv\t%0" : : "m" (temp));
asm volatile ("fwait");
}
if (_fex & FP_EX_INEXACT)
{
float f = 1.0f, g = 3.0f;
#ifdef __SSE_MATH__
volatile float r __attribute__ ((unused));
asm volatile ("%vdivss\t{%1, %d0|%d0, %1}" : "+x" (f) : "xm" (g));
r = f; /* Needed to trigger exception. */
#else
asm volatile ("fdivs\t%1" : "+t" (f) : "m" (g));
/* No need for fwait, exception is triggered by emitted fstp. */
#endif
}
};
#endif

View File

@ -0,0 +1,85 @@
#ifdef __MINGW32__
/* Make sure we are using gnu-style bitfield handling. */
#define _FP_STRUCT_LAYOUT __attribute__ ((gcc_struct))
#endif
/* The type of the result of a floating point comparison. This must
match `__libgcc_cmp_return__' in GCC for the target. */
typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
#define CMPtype __gcc_CMPtype
#ifdef __x86_64__
#include "config/i386/64/sfp-machine.h"
#else
#include "config/i386/32/sfp-machine.h"
#endif
#define _FP_KEEPNANFRACP 1
#define _FP_QNANNEGATEDP 0
#define _FP_NANSIGN_S 1
#define _FP_NANSIGN_D 1
#define _FP_NANSIGN_E 1
#define _FP_NANSIGN_Q 1
/* Here is something Intel misdesigned: the specs don't define
the case where we have two NaNs with same mantissas, but
different sign. Different operations pick up different NaNs. */
#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \
do { \
if (_FP_FRAC_GT_##wc(X, Y) \
|| (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \
{ \
R##_s = X##_s; \
_FP_FRAC_COPY_##wc(R,X); \
} \
else \
{ \
R##_s = Y##_s; \
_FP_FRAC_COPY_##wc(R,Y); \
} \
R##_c = FP_CLS_NAN; \
} while (0)
#ifndef _SOFT_FLOAT
#define FP_EX_INVALID 0x01
#define FP_EX_DENORM 0x02
#define FP_EX_DIVZERO 0x04
#define FP_EX_OVERFLOW 0x08
#define FP_EX_UNDERFLOW 0x10
#define FP_EX_INEXACT 0x20
#define FP_EX_ALL \
(FP_EX_INVALID | FP_EX_DENORM | FP_EX_DIVZERO | FP_EX_OVERFLOW \
| FP_EX_UNDERFLOW | FP_EX_INEXACT)
void __sfp_handle_exceptions (int);
#define FP_HANDLE_EXCEPTIONS \
do { \
if (__builtin_expect (_fex, 0)) \
__sfp_handle_exceptions (_fex); \
} while (0);
#define FP_TRAPPING_EXCEPTIONS ((~_fcw >> FP_EX_SHIFT) & FP_EX_ALL)
#define FP_ROUNDMODE (_fcw & FP_RND_MASK)
#endif
#define _FP_TININESS_AFTER_ROUNDING 1
#define __LITTLE_ENDIAN 1234
#define __BIG_ENDIAN 4321
#define __BYTE_ORDER __LITTLE_ENDIAN
/* Define ALIASNAME as a strong alias for NAME. */
#if defined __MACH__
/* Mach-O doesn't support aliasing. If these functions ever return
anything but CMPtype we need to revisit this... */
#define strong_alias(name, aliasname) \
CMPtype aliasname (TFtype a, TFtype b) { return name(a, b); }
#else
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name)));
#endif

View File

@ -0,0 +1,173 @@
/* crt1.s for Solaris 2, x86
Copyright (C) 1993-2015 Free Software Foundation, Inc.
Written By Fred Fish, Nov 1992
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This file 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file takes control of the process from the kernel, as specified
in section 3 of the System V Application Binary Interface, Intel386
Processor Supplement. It has been constructed from information obtained
from the ABI, information obtained from single stepping existing
Solaris executables through their startup code with gdb, and from
information obtained by single stepping executables on other i386 SVR4
implementations. This file is the first thing linked into any
executable. */
#ifndef GCRT1
.ident "GNU C crt1.s"
#define CLEANUP _cleanup
#else
/* This is a modified crt1.s by J.W.Hawtin <oolon@ankh.org> 15/8/96,
to allow program profiling, by calling monstartup on entry and _mcleanup
on exit. */
.ident "GNU C gcrt1.s"
#define CLEANUP _mcleanup
#endif
.weak _cleanup
.weak _DYNAMIC
.text
/* Start creating the initial frame by pushing a NULL value for the return
address of the initial frame, and mark the end of the stack frame chain
(the innermost stack frame) with a NULL value, per page 3-32 of the ABI.
Initialize the first stack frame pointer in %ebp (the contents of which
are unspecified at process initialization). */
.globl _start
_start:
pushl $0x0
pushl $0x0
movl %esp,%ebp
/* As specified per page 3-32 of the ABI, %edx contains a function
pointer that should be registered with atexit(), for proper
shared object termination. Just push it onto the stack for now
to preserve it. We want to register _cleanup() first. */
pushl %edx
/* Check to see if there is an _cleanup() function linked in, and if
so, register it with atexit() as the last thing to be run by
atexit(). */
movl $CLEANUP,%eax
testl %eax,%eax
je .L1
pushl $CLEANUP
call atexit
addl $0x4,%esp
.L1:
/* Now check to see if we have an _DYNAMIC table, and if so then
we need to register the function pointer previously in %edx, but
now conveniently saved on the stack as the argument to pass to
atexit(). */
movl $_DYNAMIC,%eax
testl %eax,%eax
je .L2
call atexit
.L2:
/* Register _fini() with atexit(). We will take care of calling _init()
directly. */
pushl $_fini
call atexit
#ifdef GCRT1
/* Start profiling. */
pushl %ebp
movl %esp,%ebp
pushl $_etext
pushl $_start
call monstartup
addl $8,%esp
popl %ebp
#endif
/* Compute the address of the environment vector on the stack and load
it into the global variable _environ. Currently argc is at 8 off
the frame pointer. Fetch the argument count into %eax, scale by the
size of each arg (4 bytes) and compute the address of the environment
vector which is 16 bytes (the two zero words we pushed, plus argc,
plus the null word terminating the arg vector) further up the stack,
off the frame pointer (whew!). */
movl 8(%ebp),%eax
leal 16(%ebp,%eax,4),%edx
movl %edx,_environ
/* Push the environment vector pointer, the argument vector pointer,
and the argument count on to the stack to set up the arguments
for _init(), _fpstart(), and main(). Note that the environment
vector pointer and the arg count were previously loaded into
%edx and %eax respectively. The only new value we need to compute
is the argument vector pointer, which is at a fixed address off
the initial frame pointer. */
/* Make sure the stack is properly aligned. */
andl $0xfffffff0,%esp
subl $4,%esp
pushl %edx
leal 12(%ebp),%edx
pushl %edx
pushl %eax
/* Call _init(argc, argv, environ), _fpstart(argc, argv, environ), and
main(argc, argv, environ). */
call _init
call __fpstart
call main
/* Pop the argc, argv, and environ arguments off the stack, push the
value returned from main(), and call exit(). */
addl $12,%esp
pushl %eax
call exit
/* An inline equivalent of _exit, as specified in Figure 3-26 of the ABI. */
pushl $0x0
movl $0x1,%eax
lcall $7,$0
/* If all else fails, just try a halt! */
hlt
.type _start,@function
.size _start,.-_start
#ifndef GCRT1
/* A dummy profiling support routine for non-profiling executables,
in case we link in some objects that have been compiled for profiling. */
.weak _mcount
_mcount:
ret
.type _mcount,@function
.size _mcount,.-_mcount
#endif

View File

@ -0,0 +1,244 @@
/* DWARF2 EH unwinding support for AMD x86-64 and x86.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Do code reading to identify a signal frame, and set the frame
state data appropriately. See unwind-dw2.c for the structs. */
#include <ucontext.h>
#include <sys/frame.h>
#ifdef __x86_64__
#define MD_FALLBACK_FRAME_STATE_FOR x86_64_fallback_frame_state
static _Unwind_Reason_Code
x86_64_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
mcontext_t *mctx;
long new_cfa;
if (/* Solaris 10+
------------
<__sighndlr+0>: push %rbp
<__sighndlr+1>: mov %rsp,%rbp
<__sighndlr+4>: callq *%rcx
<__sighndlr+6>: leaveq <--- PC
<__sighndlr+7>: retq */
*(unsigned long *)(pc - 6) == 0xc3c9d1ffe5894855)
/* We need to move up three frames:
<signal handler> <-- context->cfa
__sighndlr
call_user_handler
sigacthandler
<kernel>
context->cfa points into the frame after the saved frame pointer and
saved pc (struct frame).
The ucontext_t structure is in the kernel frame after the signal
number and a siginfo_t *. Since the frame sizes vary even within
Solaris 10 updates, we need to walk the stack to get there. */
{
struct frame *fp = (struct frame *) context->cfa - 1;
struct handler_args {
int signo;
siginfo_t *sip;
ucontext_t ucontext;
} *handler_args;
ucontext_t *ucp;
/* Next frame: __sighndlr frame pointer. */
fp = (struct frame *) fp->fr_savfp;
/* call_user_handler frame pointer. */
fp = (struct frame *) fp->fr_savfp;
/* sigacthandler frame pointer. */
fp = (struct frame *) fp->fr_savfp;
/* The argument area precedes the struct frame. */
handler_args = (struct handler_args *) (fp + 1);
ucp = &handler_args->ucontext;
mctx = &ucp->uc_mcontext;
}
else
return _URC_END_OF_STACK;
new_cfa = mctx->gregs[REG_RSP];
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = 7;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&mctx->gregs[REG_RAX] - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&mctx->gregs[REG_RDX] - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&mctx->gregs[REG_RCX] - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&mctx->gregs[REG_RBX] - new_cfa;
fs->regs.reg[4].how = REG_SAVED_OFFSET;
fs->regs.reg[4].loc.offset = (long)&mctx->gregs[REG_RSI] - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&mctx->gregs[REG_RDI] - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&mctx->gregs[REG_RBP] - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&mctx->gregs[REG_R8] - new_cfa;
fs->regs.reg[9].how = REG_SAVED_OFFSET;
fs->regs.reg[9].loc.offset = (long)&mctx->gregs[REG_R9] - new_cfa;
fs->regs.reg[10].how = REG_SAVED_OFFSET;
fs->regs.reg[10].loc.offset = (long)&mctx->gregs[REG_R10] - new_cfa;
fs->regs.reg[11].how = REG_SAVED_OFFSET;
fs->regs.reg[11].loc.offset = (long)&mctx->gregs[REG_R11] - new_cfa;
fs->regs.reg[12].how = REG_SAVED_OFFSET;
fs->regs.reg[12].loc.offset = (long)&mctx->gregs[REG_R12] - new_cfa;
fs->regs.reg[13].how = REG_SAVED_OFFSET;
fs->regs.reg[13].loc.offset = (long)&mctx->gregs[REG_R13] - new_cfa;
fs->regs.reg[14].how = REG_SAVED_OFFSET;
fs->regs.reg[14].loc.offset = (long)&mctx->gregs[REG_R14] - new_cfa;
fs->regs.reg[15].how = REG_SAVED_OFFSET;
fs->regs.reg[15].loc.offset = (long)&mctx->gregs[REG_R15] - new_cfa;
fs->regs.reg[16].how = REG_SAVED_OFFSET;
fs->regs.reg[16].loc.offset = (long)&mctx->gregs[REG_RIP] - new_cfa;
fs->retaddr_column = 16;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#else
#define MD_FALLBACK_FRAME_STATE_FOR x86_fallback_frame_state
static _Unwind_Reason_Code
x86_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
unsigned char *pc = context->ra;
mcontext_t *mctx;
long new_cfa;
if (/* Solaris 10
-----------
<__sighndlr+0>: push %ebp
<__sighndlr+1>: mov %esp,%ebp
<__sighndlr+3>: pushl 0x10(%ebp)
<__sighndlr+6>: pushl 0xc(%ebp)
<__sighndlr+9>: pushl 0x8(%ebp)
<__sighndlr+12>: call *0x14(%ebp)
<__sighndlr+15>: add $0xc,%esp <--- PC
<__sighndlr+18>: leave
<__sighndlr+19>: ret */
(*(unsigned long *)(pc - 15) == 0xffec8b55
&& *(unsigned long *)(pc - 11) == 0x75ff1075
&& *(unsigned long *)(pc - 7) == 0x0875ff0c
&& *(unsigned long *)(pc - 3) == 0x831455ff
&& *(unsigned long *)(pc + 1) == 0xc3c90cc4)
|| /* Solaris 11 before snv_125
--------------------------
<__sighndlr+0> push %ebp
<__sighndlr+1> mov %esp,%ebp
<__sighndlr+4> pushl 0x10(%ebp)
<__sighndlr+6> pushl 0xc(%ebp)
<__sighndlr+9> pushl 0x8(%ebp)
<__sighndlr+12> call *0x14(%ebp)
<__sighndlr+15> add $0xc,%esp
<__sighndlr+18> leave <--- PC
<__sighndlr+19> ret */
(*(unsigned long *)(pc - 18) == 0xffec8b55
&& *(unsigned long *)(pc - 14) == 0x7fff107f
&& *(unsigned long *)(pc - 10) == 0x0875ff0c
&& *(unsigned long *)(pc - 6) == 0x83145fff
&& *(unsigned long *)(pc - 1) == 0xc3c90cc4)
|| /* Solaris 11 since snv_125
-------------------------
<__sighndlr+0> push %ebp
<__sighndlr+1> mov %esp,%ebp
<__sighndlr+3> and $0xfffffff0,%esp
<__sighndlr+6> sub $0x4,%esp
<__sighndlr+9> pushl 0x10(%ebp)
<__sighndlr+12> pushl 0xc(%ebp)
<__sighndlr+15> pushl 0x8(%ebp)
<__sighndlr+18> call *0x14(%ebp)
<__sighndlr+21> leave <--- PC
<__sighndlr+22> ret */
(*(unsigned long *)(pc - 21) == 0x83ec8b55
&& *(unsigned long *)(pc - 17) == 0xec83f0e4
&& *(unsigned long *)(pc - 13) == 0x1075ff04
&& *(unsigned long *)(pc - 9) == 0xff0c75ff
&& *(unsigned long *)(pc - 5) == 0x55ff0875
&& (*(unsigned long *)(pc - 1) & 0x00ffffff) == 0x00c3c914))
{
struct handler_args {
int signo;
siginfo_t *sip;
ucontext_t *ucontext;
} *handler_args = context->cfa;
mctx = &handler_args->ucontext->uc_mcontext;
}
else
return _URC_END_OF_STACK;
new_cfa = mctx->gregs[UESP];
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = 4;
fs->regs.cfa_offset = new_cfa - (long) context->cfa;
/* The SVR4 register numbering macros aren't usable in libgcc. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&mctx->gregs[EAX] - new_cfa;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&mctx->gregs[EBX] - new_cfa;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&mctx->gregs[ECX] - new_cfa;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&mctx->gregs[EDX] - new_cfa;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&mctx->gregs[ESI] - new_cfa;
fs->regs.reg[7].how = REG_SAVED_OFFSET;
fs->regs.reg[7].loc.offset = (long)&mctx->gregs[EDI] - new_cfa;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&mctx->gregs[EBP] - new_cfa;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&mctx->gregs[EIP] - new_cfa;
fs->retaddr_column = 8;
/* SIGFPE for IEEE-754 exceptions is delivered after the faulting insn
rather than before it, so don't set fs->signal_frame in that case.
We test whether the ES field of the Status Register is zero. */
if ((mctx->fpregs.fp_reg_set.fpchip_state.status & 0x80) == 0)
fs->signal_frame = 1;
return _URC_NO_REASON;
}
#endif

View File

@ -0,0 +1,25 @@
/* Store register values as _Unwind_Word type in DWARF2 EH unwind context.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 3, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* Define this macro if the target stores register values as _Unwind_Word
type in unwind context. Only enable it for x32. */
#if defined __x86_64 && !defined __LP64__
# define REG_VALUE_IN_UNWIND_CONTEXT
#endif

View File

@ -0,0 +1,207 @@
/* Definitions for Dwarf2 EH unwind support for Windows32 targets
Copyright (C) 2007-2015 Free Software Foundation, Inc.
Contributed by Pascal Obry <obry@adacore.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* This file implements the md_fallback_frame_state_for routine for
Windows, triggered when the GCC table based unwinding process hits a
frame for which no unwind info has been registered. This typically
occurs when raising an exception from a signal handler, because the
handler is actually called from the OS kernel.
The basic idea is to detect that we are indeed trying to unwind past a
signal handler and to fill out the GCC internal unwinding structures for
the OS kernel frame as if it had been directly called from the
interrupted context.
This is all assuming that the code to set the handler asked the kernel
to pass a pointer to such context information.
There is three main parts.
1) The first thing to do is to check if we are in a signal context. If
not we can just return as there is nothing to do. We are probably on
some foreign code for which no unwind frame can be found. If this is
a call from the Windows signal handler, then:
2) We must get the signal context information.
* With the standard exception filter:
This is on Windows pointed to by an EXCEPTION_POINTERS. We know that
the signal handle will call an UnhandledExceptionFilter with this
parameter. The spec for this routine is:
LONG WINAPI UnhandledExceptionFilter(struct _EXCEPTION_POINTERS*);
So the pointer to struct _EXCEPTION_POINTERS must be somewhere on the
stack.
This was found experimentally to always be at offset 0 of the context
frame in all cases handled by this implementation.
* With the SEH exception handler:
In this case the signal context is directly on the stack as the SEH
exception handler has the following prototype:
DWORD
SEH_error_handler (PEXCEPTION_RECORD ExceptionRecord,
PVOID EstablisherFrame,
PCONTEXT ContextRecord,
PVOID DispatcherContext)
This was found experimentally to always be at offset 56 of the
context frame in all cases handled by this implementation.
3) When we have the signal context we just have to save some registers
and set the return address based on the program counter (Eip).
Note that this implementation follows closely the same principles as the
GNU/Linux and OSF ones. */
#ifndef __MINGW64__
#define WIN32_MEAN_AND_LEAN
#include <windows.h>
/* Patterns found experimentally to be on a Windows signal handler */
/* In a standard exception filter */
#define SIG_PAT1 \
(pc_[-2] == 0xff && pc_[-1] == 0xd0 /* call %eax */ \
&& pc_[0] == 0x83 && pc_[1] == 0xf8) /* cmp 0xdepl,%eax */
#define SIG_PAT2 \
(pc_[-5] == 0xe8 && pc_[-4] == 0x68 /* call (depl16) */ \
&& pc_[0] == 0xc3) /* ret */
/* In a Win32 SEH handler */
#define SIG_SEH1 \
(pc_[-5] == 0xe8 /* call addr */ \
&& pc_[0] == 0x83 && pc_[1] == 0xc4 /* add 0xval,%esp */ \
&& pc_[3] == 0xb8) /* mov 0xval,%eax */
#define SIG_SEH2 \
(pc_[-5] == 0x8b && pc_[-4] == 0x4d /* mov depl(%ebp),%ecx */ \
&& pc_[0] == 0x64 && pc_[1] == 0x8b) /* mov %fs:(0),<reg> */ \
/* In the GCC alloca (stack probing) */
#define SIG_ALLOCA \
(pc_[-1] == 0x83 /* orl $0x0,(%ecx) */ \
&& pc_[0] == 0x9 && pc_[1] == 0 \
&& pc_[2] == 0x2d && pc_[3] == 0 /* subl $0x1000,%eax */ \
&& pc_[4] == 0x10 && pc_[5] == 0)
#define MD_FALLBACK_FRAME_STATE_FOR i386_w32_fallback_frame_state
static _Unwind_Reason_Code
i386_w32_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
void * ctx_ra_ = (void *)(context->ra); /* return address */
void * ctx_cfa_ = (void *)(context->cfa); /* context frame address */
unsigned char * pc_ = (unsigned char *) ctx_ra_;
/* In the test below we look for two specific patterns found
experimentally to be in the Windows signal handler. */
if (SIG_PAT1 || SIG_PAT2 || SIG_SEH1 || SIG_SEH2)
{
PEXCEPTION_POINTERS weinfo_;
PCONTEXT proc_ctx_;
long new_cfa_;
if (SIG_SEH1)
proc_ctx_ = (PCONTEXT) (*(int*)(ctx_cfa_ + 56));
else if (SIG_SEH2)
proc_ctx_ = (PCONTEXT) (*(int*)(ctx_cfa_ + 8));
else
{
weinfo_ = (PEXCEPTION_POINTERS) (*(int*)ctx_cfa_);
proc_ctx_ = weinfo_->ContextRecord;
}
/* The new context frame address is the stack pointer. */
new_cfa_ = proc_ctx_->Esp;
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = __builtin_dwarf_sp_column();
fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_;
/* Restore registers. */
fs->regs.reg[0].how = REG_SAVED_OFFSET;
fs->regs.reg[0].loc.offset = (long)&proc_ctx_->Eax - new_cfa_;
fs->regs.reg[3].how = REG_SAVED_OFFSET;
fs->regs.reg[3].loc.offset = (long)&proc_ctx_->Ebx - new_cfa_;
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = (long)&proc_ctx_->Ecx - new_cfa_;
fs->regs.reg[2].how = REG_SAVED_OFFSET;
fs->regs.reg[2].loc.offset = (long)&proc_ctx_->Edx - new_cfa_;
fs->regs.reg[6].how = REG_SAVED_OFFSET;
fs->regs.reg[6].loc.offset = (long)&proc_ctx_->Esi - new_cfa_;
fs->regs.reg[7].how = REG_SAVED_OFFSET;
fs->regs.reg[7].loc.offset = (long)&proc_ctx_->Edi - new_cfa_;
fs->regs.reg[5].how = REG_SAVED_OFFSET;
fs->regs.reg[5].loc.offset = (long)&proc_ctx_->Ebp - new_cfa_;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = (long)&proc_ctx_->Eip - new_cfa_;
fs->retaddr_column = 8;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
/* Unwinding through _alloca, propagating from a trap triggered by
one of it's probes prior to the real SP adjustment. The only
operations of interest performed is "pushl %ecx", followed by
ecx clobbering. */
else if (SIG_ALLOCA)
{
/* Only one push between entry in _alloca and the probe trap. */
long new_cfa_ = (long) ctx_cfa_ + 4;
fs->regs.cfa_how = CFA_REG_OFFSET;
fs->regs.cfa_reg = __builtin_dwarf_sp_column();
fs->regs.cfa_offset = new_cfa_ - (long) ctx_cfa_;
/* The saved value of %ecx is at CFA - 4 */
fs->regs.reg[1].how = REG_SAVED_OFFSET;
fs->regs.reg[1].loc.offset = -4;
/* and what is stored at the CFA is the return address. */
fs->retaddr_column = 8;
fs->regs.reg[8].how = REG_SAVED_OFFSET;
fs->regs.reg[8].loc.offset = 0;
fs->signal_frame = 1;
return _URC_NO_REASON;
}
else
return _URC_END_OF_STACK;
}
#endif /* !__MINGW64__ */

View File

@ -0,0 +1,46 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal64
__bid_adddd3 (_Decimal64 x, _Decimal64 y) {
union decimal64 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid64_add (ux.i, uy.i);
return (res.d);
}
_Decimal64
__bid_subdd3 (_Decimal64 x, _Decimal64 y) {
union decimal64 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid64_sub (ux.i, uy.i);
return (res.d);
}

View File

@ -0,0 +1,54 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal32
__bid_addsd3 (_Decimal32 x, _Decimal32 y) {
UINT64 x64, y64, res64;
union decimal32 ux, uy, res;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res64 = __bid64_add (x64, y64);
res.i = __bid64_to_bid32 (res64);
return (res.d);
}
_Decimal32
__bid_subsd3 (_Decimal32 x, _Decimal32 y) {
UINT64 x64, y64, res64;
union decimal32 ux, uy, res;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res64 = __bid64_sub (x64, y64);
res.i = __bid64_to_bid32 (res64);
return (res.d);
}

View File

@ -0,0 +1,46 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal128
__bid_addtd3 (_Decimal128 x, _Decimal128 y) {
union decimal128 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid128_add (ux.i, uy.i);
return (res.d);
}
_Decimal128
__bid_subtd3 (_Decimal128 x, _Decimal128 y) {
union decimal128 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid128_sub (ux.i, uy.i);
return (res.d);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
DFtype
__bid_truncdddf (_Decimal64 x) {
DFtype res;
union decimal64 ux;
ux.d = x;
res = __bid64_to_binary64 (ux.i);
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
DItype
__bid_fixdddi (_Decimal64 x) {
DItype res = 0xbaddbaddbaddbaddull;
union decimal64 ux;
ux.d = x;
res = __bid64_to_int64_xint (ux.i);
return (res);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal32
__bid_truncddsd2 (_Decimal64 x) {
union decimal32 res;
union decimal64 ux;
ux.d = x;
res.i = __bid64_to_bid32 (ux.i);
return (res.d);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
SFtype
__bid_truncddsf (_Decimal64 x) {
SFtype res;
union decimal64 ux;
ux.d = x;
res = __bid64_to_binary32 (ux.i);
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
SItype
__bid_fixddsi (_Decimal64 x) {
SItype res = 0xbaddbadd;
union decimal64 ux;
ux.d = x;
res = __bid64_to_int32_xint (ux.i);
return (res);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal128
__bid_extendddtd2 (_Decimal64 x) {
union decimal128 res;
union decimal64 ux;
ux.d = x;
res.i = __bid64_to_bid128 (ux.i);
return (res.d);
}

View File

@ -0,0 +1,38 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
#if LIBGCC2_HAS_TF_MODE || BID_HAS_TF_MODE
TFtype
__bid_extendddtf (_Decimal64 x) {
union float128 res;
union decimal64 ux;
ux.d = x;
res.i = __bid64_to_binary128 (ux.i);
return (res.f);
}
#endif

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
UDItype
__bid_fixunsdddi (_Decimal64 x) {
UDItype res = 0xbaddbaddbaddbaddull;
union decimal64 ux;
ux.d = x;
res = __bid64_to_uint64_xint (ux.i);
if (res == 0x8000000000000000ull) res = 0; // for NaNs too
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
USItype
__bid_fixunsddsi (_Decimal64 x) {
USItype res = 0xbaddbadd;
union decimal64 ux;
ux.d = x;
res = __bid64_to_uint32_xint (ux.i);
if (res == 0x80000000) res = 0; // for NaNs too
return (res);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
XFtype
__bid_extendddxf (_Decimal64 x) {
XFtype res;
union decimal64 ux;
ux.d = x;
res = __bid64_to_binary80 (ux.i);
return (res);
}

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal64
__bid_extenddfdd (DFtype x) {
union decimal64 res;
res.i = __binary64_to_bid64 (x);
return (res.d);
}

View File

@ -0,0 +1,34 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal32
__bid_truncdfsd (DFtype x) {
union decimal32 res;
res.i = __binary64_to_bid32 (x);
return (res.d);
}

View File

@ -0,0 +1,33 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal128
__bid_extenddftd (DFtype x) {
union decimal128 res;
res.i = __binary64_to_bid128 (x);
return (res.d);
}

View File

@ -0,0 +1,35 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal64
__bid_floatdidd (DItype x) {
union decimal64 res;
res.i = __bid64_from_int64 (x);
return (res.d);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal32
__bid_floatdisd (DItype x) {
union decimal32 res;
UINT64 res64;
res64 = __bid64_from_int64 (x);
res.i = __bid64_to_bid32 (res64);
return (res.d);
}

View File

@ -0,0 +1,35 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal128
__bid_floatditd (DItype x) {
union decimal128 res;
res.i = __bid128_from_int64 (x);
return (res.d);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal64
__bid_divdd3 (_Decimal64 x, _Decimal64 y) {
union decimal64 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid64_div (ux.i, uy.i);
return (res.d);
}

View File

@ -0,0 +1,40 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal32
__bid_divsd3 (_Decimal32 x, _Decimal32 y) {
UINT64 x64, y64, res64;
union decimal32 ux, uy, res;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res64 = __bid64_div (x64, y64);
res.i = __bid64_to_bid32 (res64);
return (res.d);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal128
__bid_divtd3 (_Decimal128 x, _Decimal128 y) {
union decimal128 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid128_div (ux.i, uy.i);
return (res.d);
}

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_eqdd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = __bid64_quiet_equal (ux.i, uy.i);
if (res == 0)
res = 1;
else
res = 0;
return (res);
}

View File

@ -0,0 +1,44 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_eqsd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = __bid64_quiet_equal (x64, y64);
if (res == 0)
res = 1;
else
res = 0;
return (res);
}

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_eqtd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = __bid128_quiet_equal (ux.i, uy.i);
if (res == 0)
res = 1;
else
res = 0;
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gedd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = __bid64_quiet_greater_equal (ux.i, uy.i);
if (res == 0) res = -1;
return (res);
}

View File

@ -0,0 +1,42 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gesd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = __bid64_quiet_greater_equal (x64, y64);
if (res == 0) res = -1;
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_getd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = __bid128_quiet_greater_equal (ux.i, uy.i);
if (res == 0) res = -1;
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gtdd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = __bid64_quiet_greater (ux.i, uy.i);
return (res);
}

View File

@ -0,0 +1,40 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gtsd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = __bid64_quiet_greater (x64, y64);
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_gttd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = __bid128_quiet_greater (ux.i, uy.i);
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
int
isinfd128 (_Decimal128 x) {
int res;
union decimal128 ux;
ux.d = x;
res = __bid128_isInf (ux.i);
return (res);
}

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
int
isinfd32 (_Decimal32 x) {
int res;
UINT64 x64;
union decimal32 ux;
ux.d = x;
x64 = __bid32_to_bid64 (ux.i);
res = __bid64_isInf (x64);
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
int
isinfd64 (_Decimal64 x) {
int res;
union decimal64 ux;
ux.d = x;
res = __bid64_isInf (ux.i);
return (res);
}

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_ledd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = __bid64_quiet_less_equal (ux.i, uy.i);
if (res != 0)
res = -1;
else
res = 1;
return (res);
}

View File

@ -0,0 +1,44 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_lesd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = __bid64_quiet_less_equal (x64, y64);
if (res != 0)
res = -1;
else
res = 1;
return (res);
}

View File

@ -0,0 +1,41 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_letd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = __bid128_quiet_less_equal (ux.i, uy.i);
if (res != 0)
res = -1;
else
res = 1;
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_ltdd2 (_Decimal64 x, _Decimal64 y) {
CMPtype res;
union decimal64 ux, uy;
ux.d = x;
uy.d = y;
res = -__bid64_quiet_less (ux.i, uy.i);
return (res);
}

View File

@ -0,0 +1,40 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_ltsd2 (_Decimal32 x, _Decimal32 y) {
CMPtype res;
UINT64 x64, y64;
union decimal32 ux, uy;
ux.d = x;
uy.d = y;
x64 = __bid32_to_bid64 (ux.i);
y64 = __bid32_to_bid64 (uy.i);
res = -__bid64_quiet_less (x64, y64);
return (res);
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
CMPtype
__bid_lttd2 (_Decimal128 x, _Decimal128 y) {
CMPtype res;
union decimal128 ux, uy;
ux.d = x;
uy.d = y;
res = -__bid128_quiet_less (ux.i, uy.i);
return (res);
}

View File

@ -0,0 +1,36 @@
/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#include "bid_conf.h"
#include "bid_functions.h"
#include "bid_gcc_intrinsics.h"
_Decimal64
__bid_muldd3 (_Decimal64 x, _Decimal64 y) {
union decimal64 ux, uy, res;
ux.d = x;
uy.d = y;
res.i = __bid64_mul (ux.i, uy.i);
return (res.d);
}

Some files were not shown because too many files have changed in this diff Show More