* [patch] Do not generate libcalls to __unord[sd]f2 on PowerPC SPE
@ 2018-02-09 10:28 Eric Botcazou
2018-02-09 11:07 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2018-02-09 10:28 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 839 bytes --]
Hi,
the change
2016-05-02 Marc Glisse <marc.glisse@inria.fr>
* match.pd (X u< X, X u> X): New transformations.
has an annoying effect on targets implementing (most) unordered comparisons in
hardware but not the UNORDERED operator itself, e.g. PowerPC SPE, because it
makes the compiler generate unnecessary libcalls to __unord[sd]f2.
The attached patch contains a trick to undo the effect of the change at the
RTL level for such targets. It was tested on PowerPC SPE with a certified
version of VxWorks (which provides a minimal certified libgcc) where it fixes
the link failure of ACATS c45242b with optimization enabled.
OK for the mainline?
2018-02-09 Eric Botcazou <ebotcazou@adacore.com>
* optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison
instead of a libcall for UNORDERED.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 981 bytes --]
Index: optabs.c
===================================================================
--- optabs.c (revision 257404)
+++ optabs.c (working copy)
@@ -3935,7 +3935,20 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
if (methods != OPTAB_LIB_WIDEN)
goto fail;
- if (!SCALAR_FLOAT_MODE_P (mode))
+ if (SCALAR_FLOAT_MODE_P (mode))
+ {
+ /* Small trick if UNORDERED isn't implemented by the hardware. */
+ if (comparison == UNORDERED && rtx_equal_p (x, y))
+ {
+ prepare_cmp_insn (x, y, UNLT, NULL_RTX, unsignedp, OPTAB_WIDEN,
+ ptest, pmode);
+ if (*ptest)
+ return;
+ }
+
+ prepare_float_lib_cmp (x, y, comparison, ptest, pmode);
+ }
+ else
{
rtx result;
machine_mode ret_mode;
@@ -3982,8 +3995,6 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx
prepare_cmp_insn (x, y, comparison, NULL_RTX, unsignedp, methods,
ptest, pmode);
}
- else
- prepare_float_lib_cmp (x, y, comparison, ptest, pmode);
return;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Do not generate libcalls to __unord[sd]f2 on PowerPC SPE
2018-02-09 10:28 [patch] Do not generate libcalls to __unord[sd]f2 on PowerPC SPE Eric Botcazou
@ 2018-02-09 11:07 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2018-02-09 11:07 UTC (permalink / raw)
To: Eric Botcazou; +Cc: GCC Patches
On Fri, Feb 9, 2018 at 11:28 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> the change
>
> 2016-05-02 Marc Glisse <marc.glisse@inria.fr>
>
> * match.pd (X u< X, X u> X): New transformations.
>
> has an annoying effect on targets implementing (most) unordered comparisons in
> hardware but not the UNORDERED operator itself, e.g. PowerPC SPE, because it
> makes the compiler generate unnecessary libcalls to __unord[sd]f2.
>
> The attached patch contains a trick to undo the effect of the change at the
> RTL level for such targets. It was tested on PowerPC SPE with a certified
> version of VxWorks (which provides a minimal certified libgcc) where it fixes
> the link failure of ACATS c45242b with optimization enabled.
>
> OK for the mainline?
Ok.
Richard.
>
> 2018-02-09 Eric Botcazou <ebotcazou@adacore.com>
>
> * optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison
> instead of a libcall for UNORDERED.
>
> --
> Eric Botcazou
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-09 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 10:28 [patch] Do not generate libcalls to __unord[sd]f2 on PowerPC SPE Eric Botcazou
2018-02-09 11:07 ` Richard Biener
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).