public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Richard Biener <richard.guenther@gmail.com>,
	       "Kewen.Lin" <linkw@linux.ibm.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>,
	       Richard Sandiford <richard.sandiford@arm.com>,
	       Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: [RFC] Consider lrotate const rotation in vectorizer
Date: Thu, 18 Jul 2019 07:03:00 -0000	[thread overview]
Message-ID: <20190718070113.GK2125@tucnak> (raw)
In-Reply-To: <20190717170032.GO20882@gate.crashing.org>

On Wed, Jul 17, 2019 at 12:00:32PM -0500, Segher Boessenkool wrote:
> I think we can say that *all* targets behave like SHIFT_COUNT_TRUNCATED
> for rotates?  Not all immediates are valid of course, but that is a
> separate issue.

Well, we'd need to double check all the hw rotate instructions on all the
targets to be sure.
As for the current GCC code, SHIFT_COUNT_TRUNCATED value is used even for
rotates at least in combine.c, expmed.c and simplify-rtx.c and in
optabs.c through targetm.shift_truncation_mask, but e.g. in cse.c is used
only for shifts and not rotates.

And speaking of optabs.c, it already has code to emit the other rotate
if one rotate isn't supported, the:
  /* If we were trying to rotate, and that didn't work, try rotating
     the other direction before falling back to shifts and bitwise-or.  */
  if (((binoptab == rotl_optab
        && (icode = optab_handler (rotr_optab, mode)) != CODE_FOR_nothing)
       || (binoptab == rotr_optab
           && (icode = optab_handler (rotl_optab, mode)) != CODE_FOR_nothing))
      && is_int_mode (mode, &int_mode))
    {
      optab otheroptab = (binoptab == rotl_optab ? rotr_optab : rotl_optab);
hunk in there, just it is limited to scalar rotates ATM rather than vector
ones through is_int_mode.  So I bet the problem with the vector shifts is just that
tree-vect-generic.c support isn't there.  And the above mentioned code
actually emits the
        newop1 = expand_binop (GET_MODE (op1), sub_optab,
                               gen_int_mode (bits, GET_MODE (op1)), op1,
                               NULL_RTX, unsignedp, OPTAB_DIRECT);
as the fallback, rather than masking of negation with some mask, so if there
is some target that doesn't truncate the rotate count, it will be
problematic with variable rotate by 0.  And note that the other rotate
code explicitly uses targetm.shift_truncation_mask.

	Jakub

  reply	other threads:[~2019-07-18  7:01 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15  8:59 Check rrotate optab first when transforming lrotate Kewen.Lin
2019-07-15  9:16 ` Jakub Jelinek
2019-07-15  9:19   ` Richard Biener
2019-07-15  9:20   ` Richard Sandiford
2019-07-15 10:54   ` Kewen.Lin
2019-07-15 14:51   ` Segher Boessenkool
     [not found]   ` <d2ccc831-c805-c7b8-5a90-cb3e5ee5ed8b@linux.ibm.com>
2019-07-16  8:48     ` [RFC] Consider lrotate const rotation in vectorizer Kewen.Lin
2019-07-17  8:42       ` [PATCH, rs6000] Support vrotr<mode>3 for int vector types Kewen.Lin
2019-07-17  8:44         ` Jakub Jelinek
2019-07-17  9:38           ` Kewen.Lin
2019-07-17 10:18             ` Jakub Jelinek
2019-07-17 13:48         ` Segher Boessenkool
2019-07-18  6:06           ` Kewen.Lin
2019-07-18 20:06             ` Segher Boessenkool
2019-07-19  6:51               ` Kewen.Lin
2019-07-19 15:49                 ` Segher Boessenkool
2019-07-23  7:32                   ` [PATCH V2, " Kewen.Lin
2019-07-25 14:24                     ` Segher Boessenkool
2019-07-26  3:33                       ` [PATCH V3, " Kewen.Lin
2019-07-26  3:37                         ` [PATCH V4, " Kewen.Lin
2019-07-26 14:28                         ` [PATCH V3, " Segher Boessenkool
2019-08-02  8:59                           ` [PATCH V5, " Kewen.Lin
2019-08-03 20:52                             ` Segher Boessenkool
2019-08-05  3:41                               ` Kewen.Lin
2019-08-05 21:50                                 ` Segher Boessenkool
2019-08-06  3:11                                   ` Kewen.Lin
2019-08-06 15:12                                     ` Segher Boessenkool
2019-07-17 10:39       ` [RFC] Consider lrotate const rotation in vectorizer Richard Biener
2019-07-17 11:19         ` Jakub Jelinek
2019-07-17 11:35           ` Richard Biener
2019-07-17 11:56             ` Richard Biener
2019-07-17 13:58             ` Segher Boessenkool
2019-07-17 17:51           ` Segher Boessenkool
2019-07-18  7:03             ` Jakub Jelinek [this message]
2019-07-18 19:45               ` Segher Boessenkool
2019-07-18 15:17             ` Richard Earnshaw (lists)
2019-07-18 15:26               ` Jakub Jelinek
2019-07-18 15:31                 ` Richard Earnshaw (lists)
2019-07-18 15:35                   ` Jakub Jelinek
2019-07-18 15:44                     ` Richard Earnshaw (lists)
2019-07-18 18:04               ` Segher Boessenkool
2019-07-18  6:28         ` Kewen.Lin

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=20190718070113.GK2125@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=linkw@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=richard.sandiford@arm.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).