public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Fix costing of vmul+vcvt combine pattern
@ 2015-10-27 14:02 Kyrill Tkachov
  2015-11-03 10:22 ` Kyrill Tkachov
  2015-11-10 14:13 ` Ramana Radhakrishnan
  0 siblings, 2 replies; 3+ messages in thread
From: Kyrill Tkachov @ 2015-10-27 14:02 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

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

Hi all,

This patch allows us to handle the *combine_vcvtf2i pattern in rtx costs by properly identifying it
as a toint coversion. Before this I saw a pattern like:
(set (reg/i:SI 0 r0)
     (fix:SI (fix:SF (mult:SF (reg:SF 16 s0 [ a ])
                 (const_double:SF 3.2e+1 [0x0.8p+6])))))

being assigned a cost of 40 because the costs blindly recursed into the operands.
With this patch for -mcpu=cortex-a57 I see it being assigned a cost of 4.

Bootstrapped and tested on arm-none-linux-gnueabihf.

Ok for trunk?

Thanks,
Kyrill

2015-10-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * config/arm/arm.c (arm_new_rtx_costs, FIX case): Handle
     combine_vcvtf2i pattern.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: arm-vmul-vcvt-cost.patch --]
[-- Type: text/x-patch; name=arm-vmul-vcvt-cost.patch, Size: 1149 bytes --]

commit 1e040710d1022ce816eac9b4f6065bc7aa2be9cf
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Wed Oct 14 11:26:07 2015 +0100

    [ARM] Fix costing of vmul+vcvt combine pattern

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index b37b507..33ad433 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -11064,6 +11064,23 @@ arm_new_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
     case UNSIGNED_FIX:
       if (TARGET_HARD_FLOAT)
 	{
+	  /* The *combine_vcvtf2i reduces a vmul+vcvt into
+	     a vcvt fixed-point conversion.  */
+	  if (code == FIX && mode == SImode
+	      && GET_CODE (XEXP (x, 0)) == FIX
+	      && GET_MODE (XEXP (x, 0)) == SFmode
+	      && GET_CODE (XEXP (XEXP (x, 0), 0)) == MULT
+	      && vfp3_const_double_for_bits (XEXP (XEXP (XEXP (x, 0), 0), 1))
+		 > 0)
+	    {
+	      if (speed_p)
+		*cost += extra_cost->fp[0].toint;
+
+	      *cost += rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0), mode,
+				 code, 0, speed_p);
+	      return true;
+	    }
+
 	  if (GET_MODE_CLASS (mode) == MODE_INT)
 	    {
 	      mode = GET_MODE (XEXP (x, 0));

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

* Re: [PATCH][ARM] Fix costing of vmul+vcvt combine pattern
  2015-10-27 14:02 [PATCH][ARM] Fix costing of vmul+vcvt combine pattern Kyrill Tkachov
@ 2015-11-03 10:22 ` Kyrill Tkachov
  2015-11-10 14:13 ` Ramana Radhakrishnan
  1 sibling, 0 replies; 3+ messages in thread
From: Kyrill Tkachov @ 2015-11-03 10:22 UTC (permalink / raw)
  To: GCC Patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

Ping.
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02898.html

Thanks,
Kyrill

On 27/10/15 13:55, Kyrill Tkachov wrote:
> Hi all,
>
> This patch allows us to handle the *combine_vcvtf2i pattern in rtx costs by properly identifying it
> as a toint coversion. Before this I saw a pattern like:
> (set (reg/i:SI 0 r0)
>     (fix:SI (fix:SF (mult:SF (reg:SF 16 s0 [ a ])
>                 (const_double:SF 3.2e+1 [0x0.8p+6])))))
>
> being assigned a cost of 40 because the costs blindly recursed into the operands.
> With this patch for -mcpu=cortex-a57 I see it being assigned a cost of 4.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2015-10-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * config/arm/arm.c (arm_new_rtx_costs, FIX case): Handle
>     combine_vcvtf2i pattern.

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

* Re: [PATCH][ARM] Fix costing of vmul+vcvt combine pattern
  2015-10-27 14:02 [PATCH][ARM] Fix costing of vmul+vcvt combine pattern Kyrill Tkachov
  2015-11-03 10:22 ` Kyrill Tkachov
@ 2015-11-10 14:13 ` Ramana Radhakrishnan
  1 sibling, 0 replies; 3+ messages in thread
From: Ramana Radhakrishnan @ 2015-11-10 14:13 UTC (permalink / raw)
  To: Kyrill Tkachov; +Cc: GCC Patches, Ramana Radhakrishnan, Richard Earnshaw

On Tue, Oct 27, 2015 at 1:55 PM, Kyrill Tkachov <kyrylo.tkachov@arm.com> wrote:
> Hi all,
>
> This patch allows us to handle the *combine_vcvtf2i pattern in rtx costs by
> properly identifying it
> as a toint coversion. Before this I saw a pattern like:
> (set (reg/i:SI 0 r0)
>     (fix:SI (fix:SF (mult:SF (reg:SF 16 s0 [ a ])
>                 (const_double:SF 3.2e+1 [0x0.8p+6])))))
>
> being assigned a cost of 40 because the costs blindly recursed into the
> operands.
> With this patch for -mcpu=cortex-a57 I see it being assigned a cost of 4.
>
> Bootstrapped and tested on arm-none-linux-gnueabihf.
>
> Ok for trunk?
>
> Thanks,
> Kyrill
>
> 2015-10-27  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>
>     * config/arm/arm.c (arm_new_rtx_costs, FIX case): Handle
>     combine_vcvtf2i pattern.

OK.

Ramana

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

end of thread, other threads:[~2015-11-10 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-27 14:02 [PATCH][ARM] Fix costing of vmul+vcvt combine pattern Kyrill Tkachov
2015-11-03 10:22 ` Kyrill Tkachov
2015-11-10 14:13 ` Ramana Radhakrishnan

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