aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2016-11-02 23:25:44 +0100
committerUros Bizjak <uros@gcc.gnu.org>2016-11-02 23:25:44 +0100
commit7ce53bd9437da27ca59d08c974376df130be5415 (patch)
tree964ff287ac1b35fb485701dc8760c50744d61a31 /gcc
parent183624479fd426c67928bb931a6474b15a8e8e95 (diff)
downloadgcc-7ce53bd9437da27ca59d08c974376df130be5415.zip
gcc-7ce53bd9437da27ca59d08c974376df130be5415.tar.gz
gcc-7ce53bd9437da27ca59d08c974376df130be5415.tar.bz2
i386.c (ix86_init_libfuncs): New.
* config/i386/i386.c (ix86_init_libfuncs): New. Call darwin_rename_builtins here. (ix86_expand_divmod_libfunc): New. (TARGET_INIT_LIBFUNCS): Unconditionally define to ix86_init_libfuncs. (TARGET_EXPAND_DIVMOD_LIBFUNC): Define. From-SVN: r241805
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/i386/i386.c53
2 files changed, 56 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2debfb6..5a6f7bf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-02 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.c (ix86_init_libfuncs): New. Call
+ darwin_rename_builtins here.
+ (ix86_expand_divmod_libfunc): New.
+ (TARGET_INIT_LIBFUNCS): Unconditionally define to ix86_init_libfuncs.
+ (TARGET_EXPAND_DIVMOD_LIBFUNC): Define.
+
2016-11-02 Cesar Philippidis <cesar@codesourcery.com>
Nathan Sidwell <nathan@acm.org>
@@ -651,7 +659,7 @@
2016-10-28 Eric Botcazou <ebotcazou@adacore.com>
* doc/sourcebuild.texi (Ada Tests): Remove mention of gcc chapter.
-
+
2016-10-28 Eric Botcazou <ebotcazou@adacore.com>
* target.def (min_arithmetic_precision): New hook.
@@ -698,7 +706,7 @@
divmod_simode.
2016-10-28 Eric Botcazou <ebotcazou@adacore.com>
- Segher Boessenkool <segher@kernel.crashing.org>
+ Segher Boessenkool <segher@kernel.crashing.org>
* dojump.c (do_jump_by_parts_greater_rtx): Invert probability when
swapping the arms of the branch.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5bb6efa..b42ecd3 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -50572,8 +50572,43 @@ ix86_addr_space_zero_address_valid (addr_space_t as)
{
return as != ADDR_SPACE_GENERIC;
}
-#undef TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
-#define TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID ix86_addr_space_zero_address_valid
+
+static void
+ix86_init_libfuncs (void)
+{
+ if (TARGET_64BIT)
+ {
+ set_optab_libfunc (sdivmod_optab, TImode, "__divmodti4");
+ set_optab_libfunc (udivmod_optab, TImode, "__udivmodti4");
+ }
+ else
+ {
+ set_optab_libfunc (sdivmod_optab, DImode, "__divmoddi4");
+ set_optab_libfunc (udivmod_optab, DImode, "__udivmoddi4");
+ }
+
+#if TARGET_MACHO
+ darwin_rename_builtins ();
+#endif
+}
+
+/* Generate call to __divmoddi4. */
+
+static void
+ix86_expand_divmod_libfunc (rtx libfunc, machine_mode mode,
+ rtx op0, rtx op1,
+ rtx *quot_p, rtx *rem_p)
+{
+ rtx rem = assign_386_stack_local (mode, SLOT_TEMP);
+
+ rtx quot = emit_library_call_value (libfunc, NULL_RTX, LCT_NORMAL,
+ mode, 3,
+ op0, GET_MODE (op0),
+ op1, GET_MODE (op1),
+ XEXP (rem, 0), Pmode);
+ *quot_p = quot;
+ *rem_p = rem;
+}
/* Initialize the GCC target structure. */
#undef TARGET_RETURN_IN_MEMORY
@@ -50958,11 +50993,6 @@ ix86_addr_space_zero_address_valid (addr_space_t as)
#undef TARGET_CONDITIONAL_REGISTER_USAGE
#define TARGET_CONDITIONAL_REGISTER_USAGE ix86_conditional_register_usage
-#if TARGET_MACHO
-#undef TARGET_INIT_LIBFUNCS
-#define TARGET_INIT_LIBFUNCS darwin_rename_builtins
-#endif
-
#undef TARGET_LOOP_UNROLL_ADJUST
#define TARGET_LOOP_UNROLL_ADJUST ix86_loop_unroll_adjust
@@ -51053,6 +51083,15 @@ ix86_addr_space_zero_address_valid (addr_space_t as)
#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1
+#undef TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
+#define TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID ix86_addr_space_zero_address_valid
+
+#undef TARGET_INIT_LIBFUNCS
+#define TARGET_INIT_LIBFUNCS ix86_init_libfuncs
+
+#undef TARGET_EXPAND_DIVMOD_LIBFUNC
+#define TARGET_EXPAND_DIVMOD_LIBFUNC ix86_expand_divmod_libfunc
+
struct gcc_target targetm = TARGET_INITIALIZER;
#include "gt-i386.h"