public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx
@ 2020-09-11 10:29 linkw at gcc dot gnu.org
  2020-09-11 10:32 ` [Bug target/97019] " linkw at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2020-09-11 10:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97019

            Bug ID: 97019
           Summary: rs6000:redundant rldicr fed to lvx/stvx
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: linkw at gcc dot gnu.org
  Target Milestone: ---

When we do the early expansion for altivec built-in function vec_ld/vec_st, we
can probably leave some redundant rldicr x,y,0,59 which aims to AND (-16) for
the vector access address, since the lvx/stvx will do the aligned and with -16
themselves, they are useless.

===== test case ====

extern int a, b, c;
extern vector unsigned long long ev5, ev6, ev7, ev8;

int test(unsigned char *pe) {
  vector unsigned long long v1, v2, v3, v4, v9;
  vector unsigned long long v5 = ev5;
  vector unsigned long long v6 = ev6;
  vector unsigned long long v7 = ev7;
  vector unsigned long long v8 = ev8;

  unsigned char *e = pe;

  do {
    if (a) {
      asm("memory");
      v1 = __builtin_vec_ld(16, (unsigned long long *)e);
      v2 = __builtin_vec_ld(32, (unsigned long long *)e);
      v3 = __builtin_vec_ld(48, (unsigned long long *)e);
      e = e + 8;
      for (int i = 0; i < a; i++) {
        v4 = v5;
        v5 = __builtin_crypto_vpmsumd(v1, v6);
        v6 = __builtin_crypto_vpmsumd(v2, v7);
        v7 = __builtin_crypto_vpmsumd(v3, v8);
        e = e + 8;
      }
    }
    v5 = __builtin_vec_ld(16, (unsigned long long *)e);
    v6 = __builtin_vec_ld(32, (unsigned long long *)e);
    v7 = __builtin_vec_ld(48, (unsigned long long *)e);
    if (c)
      b = 1;
  } while (b);

  v9 = v4;

  int p = __builtin_unpack_vector_int128((vector __int128_t)v9, 0);

  return p;
}

==== command ====
  -m64 -O2 -mcpu=power8

Currently the function find_alignment_op in RTL swaps pass cares the case where
have one single AND operation definition, we can extend it to check all
definitions are AND operations and aligned with -16B.

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

* [Bug target/97019] rs6000:redundant rldicr fed to lvx/stvx
  2020-09-11 10:29 [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx linkw at gcc dot gnu.org
@ 2020-09-11 10:32 ` linkw at gcc dot gnu.org
  2020-09-11 16:19 ` segher at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2020-09-11 10:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97019

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |bergner at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org,
                   |                            |wschmidt at gcc dot gnu.org
           Keywords|                            |missed-optimization
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-09-11
             Target|                            |powerpc

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

* [Bug target/97019] rs6000:redundant rldicr fed to lvx/stvx
  2020-09-11 10:29 [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx linkw at gcc dot gnu.org
  2020-09-11 10:32 ` [Bug target/97019] " linkw at gcc dot gnu.org
@ 2020-09-11 16:19 ` segher at gcc dot gnu.org
  2020-09-16  5:23 ` cvs-commit at gcc dot gnu.org
  2020-09-16  5:28 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: segher at gcc dot gnu.org @ 2020-09-11 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97019

--- Comment #1 from Segher Boessenkool <segher at gcc dot gnu.org> ---
Cool, if that helps, great!

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

* [Bug target/97019] rs6000:redundant rldicr fed to lvx/stvx
  2020-09-11 10:29 [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx linkw at gcc dot gnu.org
  2020-09-11 10:32 ` [Bug target/97019] " linkw at gcc dot gnu.org
  2020-09-11 16:19 ` segher at gcc dot gnu.org
@ 2020-09-16  5:23 ` cvs-commit at gcc dot gnu.org
  2020-09-16  5:28 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16  5:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97019

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kewen Lin <linkw@gcc.gnu.org>:

https://gcc.gnu.org/g:e0d98ffd14487b7105de3d151122144086faa1fa

commit r11-3217-ge0d98ffd14487b7105de3d151122144086faa1fa
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Sep 15 22:32:55 2020 -0500

    rs6000: Remove useless insns fed into lvx/stvx [PR97019]

    This patch is to extend the existing function find_alignment_op to
    check all defintions of base_reg are AND operations with mask -16B
    to force the alignment.  If all are satifised, it passes all AND
    operations and instructions to function recombine_lvx_pattern
    and recombine_stvx_pattern, they can remove all useless ANDs
    further.

    Bootstrapped/regtested on powerpc64le-linux-gnu P8.

    gcc/ChangeLog:

            PR target/97019
            * config/rs6000/rs6000-p8swap.c (find_alignment_op): Adjust to
            support multiple defintions which are all AND operations with
            the mask -16B.
            (recombine_lvx_pattern): Adjust to handle multiple AND operations
            from find_alignment_op.
            (recombine_stvx_pattern): Likewise.

    gcc/testsuite/ChangeLog:

            PR target/97019
            * gcc.target/powerpc/pr97019.c: New test.

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

* [Bug target/97019] rs6000:redundant rldicr fed to lvx/stvx
  2020-09-11 10:29 [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx linkw at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-09-16  5:23 ` cvs-commit at gcc dot gnu.org
@ 2020-09-16  5:28 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2020-09-16  5:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97019

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
Should be fixed on latest trunk now.

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

end of thread, other threads:[~2020-09-16  5:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 10:29 [Bug target/97019] New: rs6000:redundant rldicr fed to lvx/stvx linkw at gcc dot gnu.org
2020-09-11 10:32 ` [Bug target/97019] " linkw at gcc dot gnu.org
2020-09-11 16:19 ` segher at gcc dot gnu.org
2020-09-16  5:23 ` cvs-commit at gcc dot gnu.org
2020-09-16  5:28 ` linkw at gcc dot gnu.org

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