* Fix PR42333
@ 2011-02-07 20:52 Mike Stump
2011-02-07 21:40 ` Jack Howarth
0 siblings, 1 reply; 3+ messages in thread
From: Mike Stump @ 2011-02-07 20:52 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
This is prep work for PR47558. This ensures that we get the right answer for double complex division.
PR target/42333
Add __ieee_divdc3 entry point.
* config/i386/darwin.h (DECLARE_LIBRARY_RENAMES): Retain ___divdc3
entry point.
(SUBTARGET_INIT_BUILTINS): Call darwin_rename_builtins.
* config/i386/i386.c (TARGET_INIT_LIBFUNCS): Likewise.
* config/darwin.c (darwin_rename_builtins): Add.
* config/darwin-protos.h (darwin_rename_builtins): Add.
[-- Attachment #2: div.diffs --]
[-- Type: application/octet-stream, Size: 3433 bytes --]
2011-02-07 Mike Stump <mikestump@comcast.net>
PR target/42333
Add __ieee_divdc3 entry point.
* config/i386/darwin.h (DECLARE_LIBRARY_RENAMES): Retain ___divdc3
entry point.
(SUBTARGET_INIT_BUILTINS): Call darwin_rename_builtins.
* config/i386/i386.c (TARGET_INIT_LIBFUNCS): Likewise.
* config/darwin.c (darwin_rename_builtins): Add.
* config/darwin-protos.h (darwin_rename_builtins): Add.
Index: config/i386/darwin.h
===================================================================
--- config/i386/darwin.h (revision 169897)
+++ config/i386/darwin.h (working copy)
@@ -309,5 +309,14 @@
#define SUBTARGET_INIT_BUILTINS \
do { \
darwin_init_cfstring_builtins ((unsigned) (IX86_BUILTIN_MAX));\
+ darwin_rename_builtins (); \
} while(0)
+/* 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
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 169897)
+++ config/i386/i386.c (working copy)
@@ -35040,6 +35040,11 @@
#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
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
#include "gt-i386.h"
Index: config/darwin-protos.h
===================================================================
--- config/darwin-protos.h (revision 169897)
+++ config/darwin-protos.h (working copy)
@@ -124,3 +124,4 @@
extern bool darwin_kextabi_p (void);
extern void darwin_override_options (void);
extern void darwin_patch_builtins (void);
+extern void darwin_rename_builtins (void);
Index: config/darwin.c
===================================================================
--- config/darwin.c (revision 169897)
+++ config/darwin.c (working copy)
@@ -2823,6 +2823,34 @@
return NULL_TREE;
}
+void
+darwin_rename_builtins (void)
+{
+ /* 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.
+
+ When -ffast-math or -funsafe-math-optimizations is given, we can
+ use the faster version. */
+ if (!flag_unsafe_math_optimizations)
+ {
+ int dcode = (BUILT_IN_COMPLEX_DIV_MIN
+ + DCmode - MIN_MODE_COMPLEX_FLOAT);
+ tree fn = built_in_decls[dcode];
+ /* Fortran and c call TARGET_INIT_BUILTINS and
+ TARGET_INIT_LIBFUNCS at different times, so we have to put a
+ call into each to ensure that at least one of them is called
+ after build_common_builtin_nodes. A better fix is to add a
+ new hook to run after build_common_builtin_nodes runs. */
+ if (fn)
+ set_user_assembler_name (fn, "___ieee_divdc3");
+ fn = implicit_built_in_decls[dcode];
+ if (fn)
+ set_user_assembler_name (fn, "___ieee_divdc3");
+ }
+}
+
static hashval_t
cfstring_hash (const void *ptr)
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix PR42333
2011-02-07 20:52 Fix PR42333 Mike Stump
@ 2011-02-07 21:40 ` Jack Howarth
2011-02-07 22:16 ` Mike Stump
0 siblings, 1 reply; 3+ messages in thread
From: Jack Howarth @ 2011-02-07 21:40 UTC (permalink / raw)
To: Mike Stump; +Cc: GCC Patches
On Mon, Feb 07, 2011 at 12:52:36PM -0800, Mike Stump wrote:
> This is prep work for PR47558. This ensures that we get the right answer for double complex division.
>
> PR target/42333
> Add __ieee_divdc3 entry point.
> * config/i386/darwin.h (DECLARE_LIBRARY_RENAMES): Retain ___divdc3
> entry point.
> (SUBTARGET_INIT_BUILTINS): Call darwin_rename_builtins.
> * config/i386/i386.c (TARGET_INIT_LIBFUNCS): Likewise.
> * config/darwin.c (darwin_rename_builtins): Add.
> * config/darwin-protos.h (darwin_rename_builtins): Add.
>
Mike,
The i386-apple-darwin10 regtesting is complete...
http://gcc.gnu.org/ml/gcc-testresults/2011-02/msg00780.html
I assume this patch is identical to div.diffs2 except for the comment
changes and ChangeLog, correct? Also, as you saw from the forwarded
message from Eric, we can hopefully get both patches tested for
an Ada bootstrap as well.
Jack
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix PR42333
2011-02-07 21:40 ` Jack Howarth
@ 2011-02-07 22:16 ` Mike Stump
0 siblings, 0 replies; 3+ messages in thread
From: Mike Stump @ 2011-02-07 22:16 UTC (permalink / raw)
To: Jack Howarth; +Cc: GCC Patches
On Feb 7, 2011, at 1:40 PM, Jack Howarth wrote:
> I assume this patch is identical to div.diffs2 except for the comment
> changes and ChangeLog, correct?
Different. Should be the same though... Check out the stuff between []. I put in the correct long term spelling for it instead of the magic numbers.
> Also, as you saw from the forwarded message from Eric, we can hopefully get both patches tested for an Ada bootstrap as well.
I don't worry about the bootstrap, I want to know which routine is called for a double complex division in ada. We want it to be the new routine (ieee in the name), if it isn't, that's a bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-02-07 22:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-07 20:52 Fix PR42333 Mike Stump
2011-02-07 21:40 ` Jack Howarth
2011-02-07 22:16 ` Mike Stump
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).