public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
@ 2017-08-18 20:57 Andrew Pinski
  2019-05-02 16:12 ` Andrew Pinski
  2019-11-21 22:43 ` Andrew Pinski
  0 siblings, 2 replies; 6+ messages in thread
From: Andrew Pinski @ 2017-08-18 20:57 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

Like https://gcc.gnu.org/ml/gcc-patches/2010-09/msg00060.html for
PowerPC, we should do something similar for aarch64.  This pattern
does show up in SPEC CPU 2006 in astar but I did not look into
performance improvement of it though.

OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Thanks,
Andrew Pinski

ChangeLog:
* config/aarch64/aarch64.md (*frintz): New pattern.

testsuite/ChangeLog:
* testsuite/gcc.target/aarch64/floattointtofloat-1.c: New testcase.

[-- Attachment #2: floattofixtofloat.diff.txt --]
[-- Type: text/plain, Size: 1682 bytes --]

commit 9cef5e196729df5a197b81b72192d687683a057a
Author: Andrew Pinski <apinski@cavium.com>
Date:   Thu Aug 17 22:31:15 2017 -0700

    Fix 19869: (double)(long)double_var could be better optimized
    
    Use FRINTZ to optimize this.
    
    Signed-off-by: Andrew Pinski <apinski@cavium.com>

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 5e6b027..1439bd0 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4645,6 +4645,16 @@
   [(set_attr "type" "f_cvti2f")]
 )
 
+(define_insn "*frintz"
+  [(set (match_operand:GPF 0 "register_operand" "=w")
+        (float:GPF (fix:GPI (match_operand:GPF 1 "register_operand" "w"))))]
+  "TARGET_FLOAT && flag_unsafe_math_optimizations && !flag_trapping_math"
+  "frintz %<GPF:s>0, %<GPF:s>1"
+  [(set_attr "simd" "yes")
+   (set_attr "fp" "no")
+   (set_attr "type" "neon_int_to_fp_<Vetype>")]
+)
+
 ;; If we do not have ARMv8.2-A 16-bit floating point extensions, the
 ;; midend will arrange for an SImode conversion to HFmode to first go
 ;; through DFmode, then to HFmode.  But first it will try converting
diff --git a/gcc/testsuite/gcc.target/aarch64/floattointtofloat-1.c b/gcc/testsuite/gcc.target/aarch64/floattointtofloat-1.c
new file mode 100644
index 0000000..c1209c6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/floattointtofloat-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+double dll(double a)
+{
+  return (long long)a;
+}
+double di(double a)
+{
+  return (int)a;
+}
+float fll(float a)
+{
+  return (long long)a;
+}
+float fi(float a)
+{
+  return (int)a;
+}
+/* { dg-final { scan-assembler-times "frintz" 4 } } */
+

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
  2017-08-18 20:57 [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64 Andrew Pinski
@ 2019-05-02 16:12 ` Andrew Pinski
  2019-11-21 22:43 ` Andrew Pinski
  1 sibling, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2019-05-02 16:12 UTC (permalink / raw)
  To: GCC Patches

On Fri, Aug 18, 2017 at 12:17 PM Andrew Pinski <pinskia@gmail.com> wrote:
>
> Like https://gcc.gnu.org/ml/gcc-patches/2010-09/msg00060.html for
> PowerPC, we should do something similar for aarch64.  This pattern
> does show up in SPEC CPU 2006 in astar but I did not look into
> performance improvement of it though.
>
> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Ping?  It has been over a year and half now.

>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * config/aarch64/aarch64.md (*frintz): New pattern.
>
> testsuite/ChangeLog:
> * testsuite/gcc.target/aarch64/floattointtofloat-1.c: New testcase.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
  2017-08-18 20:57 [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64 Andrew Pinski
  2019-05-02 16:12 ` Andrew Pinski
@ 2019-11-21 22:43 ` Andrew Pinski
  2019-11-26 22:41   ` Richard Sandiford
  1 sibling, 1 reply; 6+ messages in thread
From: Andrew Pinski @ 2019-11-21 22:43 UTC (permalink / raw)
  To: GCC Patches, richard.sandiford

On Fri, Aug 18, 2017 at 12:17 PM Andrew Pinski <pinskia@gmail.com> wrote:
>
> Like https://gcc.gnu.org/ml/gcc-patches/2010-09/msg00060.html for
> PowerPC, we should do something similar for aarch64.  This pattern
> does show up in SPEC CPU 2006 in astar but I did not look into
> performance improvement of it though.
>
> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.

Ping?  I has been over 2 years now too.

Thanks,
Andrew

>
> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * config/aarch64/aarch64.md (*frintz): New pattern.
>
> testsuite/ChangeLog:
> * testsuite/gcc.target/aarch64/floattointtofloat-1.c: New testcase.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
  2019-11-21 22:43 ` Andrew Pinski
@ 2019-11-26 22:41   ` Richard Sandiford
  2019-11-27  5:37     ` Andrew Pinski
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2019-11-26 22:41 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches

Andrew Pinski <pinskia@gmail.com> writes:
> On Fri, Aug 18, 2017 at 12:17 PM Andrew Pinski <pinskia@gmail.com> wrote:
>>
>> Like https://gcc.gnu.org/ml/gcc-patches/2010-09/msg00060.html for
>> PowerPC, we should do something similar for aarch64.  This pattern
>> does show up in SPEC CPU 2006 in astar but I did not look into
>> performance improvement of it though.
>>
>> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.
>
> Ping?  I has been over 2 years now too.

I think it'd better to do this in match.pd, folding to IFN_TRUNC.
The rule will then automatically check whether the target supports
IFN_TRUNC/btrunc_optab for the required mode.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
  2019-11-26 22:41   ` Richard Sandiford
@ 2019-11-27  5:37     ` Andrew Pinski
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Pinski @ 2019-11-27  5:37 UTC (permalink / raw)
  To: Andrew Pinski, GCC Patches, richard.sandiford

On Tue, Nov 26, 2019 at 2:30 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> Andrew Pinski <pinskia@gmail.com> writes:
> > On Fri, Aug 18, 2017 at 12:17 PM Andrew Pinski <pinskia@gmail.com> wrote:
> >>
> >> Like https://gcc.gnu.org/ml/gcc-patches/2010-09/msg00060.html for
> >> PowerPC, we should do something similar for aarch64.  This pattern
> >> does show up in SPEC CPU 2006 in astar but I did not look into
> >> performance improvement of it though.
> >>
> >> OK?  Bootstrapped and tested on aarch64-linux-gnu with no regressions.
> >
> > Ping?  I has been over 2 years now too.
>
> I think it'd better to do this in match.pd, folding to IFN_TRUNC.
> The rule will then automatically check whether the target supports
> IFN_TRUNC/btrunc_optab for the required mode.

Yes I agree, it should be done generically.  I will look into doing
that for stage 1.

Thanks,
Andrew

>
> Thanks,
> Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64
@ 2019-11-26 14:43 Wilco Dijkstra
  0 siblings, 0 replies; 6+ messages in thread
From: Wilco Dijkstra @ 2019-11-26 14:43 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Patches, Richard Sandiford

Hi Andrew,

Could you repost your patch please to make review easier/quicker? It's no longer linked...

Cheers,
Wilco

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-27  5:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-18 20:57 [PATCH/AARCH64] Generate FRINTZ for (double)(long) under -ffast-math on aarch64 Andrew Pinski
2019-05-02 16:12 ` Andrew Pinski
2019-11-21 22:43 ` Andrew Pinski
2019-11-26 22:41   ` Richard Sandiford
2019-11-27  5:37     ` Andrew Pinski
2019-11-26 14:43 Wilco Dijkstra

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).