public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dmitry Melnik <dm@ispras.ru>
To: gcc-patches@gcc.gnu.org
Cc: Richard Earnshaw <rearnsha@arm.com>,
	 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>,
	Andrey Belevantsev <abel@ispras.ru>
Subject: [PATCH, ARM] Reload register class fix for NEON constants
Date: Mon, 25 Apr 2011 16:45:00 -0000	[thread overview]
Message-ID: <4DB595B3.3080708@ispras.ru> (raw)

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


Hi All,

The attached patch changes the reload class for NEON constant vectors 
from GENERAL_REGS to NO_REGS.
The issue was found on this code from libevas:

void
_op_blend_p_caa_dp(unsigned *s, unsigned* e, unsigned *d, unsigned c) {
     while (d < e) {
      *d = ( (((((*s) >> 8) & 0x00ff00ff) * (c)) & 0xff00ff00) + 
(((((*s) & 0x00ff00ff) * (c)) >> 8) & 0x00ff00ff) );
      //*d = (*s) & 0x00ff00ff;
      d++;
      s++;
     }
}

Original asm:

.L4:
         adr     r8, .L10
         ldmia   r8, {r8-fp}
         ...
         vmov    d22, r8, r9  @ v4si
         vmov    d23, sl, fp
         vand    q12, q8, q11
         ...
         bhi     .L4

.L10:
         .word   16711935 @ 0xff00ff
         .word   16711935
         .word   16711935
         .word   16711935

Fixed asm:

.L4:
         vmov.i16        q11, #255  @ v4si
         ...
         vand    q12, q8, q11
         bhi     .L4

This fix results in +3.7% gain for expedite (reduced) test suite, and up 
to 15% for affected tests.

Ok for trunk?


--
Best regards,
    Dmitry



[-- Attachment #2: neon-reload-class-fix.diff --]
[-- Type: text/x-diff, Size: 711 bytes --]

2011-04-22  Sergey Grechanik  <mouseentity@ispras.ru>

	* config/arm/arm.c (coproc_secondary_reload_class): Treat constant
	vectors the same way as memory locations to prevent loading them 
	through the ARM general registers.

--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -9152,7 +9152,7 @@ coproc_secondary_reload_class (enum machine_mode mode, rtx x, bool wb)
   /* The neon move patterns handle all legitimate vector and struct
      addresses.  */
   if (TARGET_NEON
-      && MEM_P (x)
+      && (MEM_P (x) || GET_CODE (x) == CONST_VECTOR)
       && (GET_MODE_CLASS (mode) == MODE_VECTOR_INT
          || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT
          || VALID_NEON_STRUCT_MODE (mode)))


             reply	other threads:[~2011-04-25 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25 16:45 Dmitry Melnik [this message]
2011-05-04 10:00 ` Richard Earnshaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DB595B3.3080708@ispras.ru \
    --to=dm@ispras.ru \
    --cc=abel@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ramana.radhakrishnan@arm.com \
    --cc=rearnsha@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).