public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102868] New: Missed optimization with __builtin_shuffle and zero vector on ppc
@ 2021-10-21  6:08 luoxhu at gcc dot gnu.org
  2021-10-25  2:52 ` [Bug target/102868] " luoxhu at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: luoxhu at gcc dot gnu.org @ 2021-10-21  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102868
           Summary: Missed optimization with __builtin_shuffle and zero
                    vector on ppc
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luoxhu at gcc dot gnu.org
  Target Milestone: ---

Similar to PR94680 and PR100165, PPC currently generates inefficient
instructions for below case:

typedef float V __attribute__((vector_size(16)));
typedef int VI __attribute__((vector_size(16)));
V foo (V x)
{
return __builtin_shuffle (x, (V) { 0, 0, 0, 0 }, (VI) {0, 1, 4, 5});
}


foo:
.LFB0:
        .cfi_startproc
.LCF0:
0:      addis 2,12,.TOC.-.LCF0@ha
        addi 2,2,.TOC.-.LCF0@l
        .localentry     foo,.-foo
        addis %r9,%r2,.LC0@toc@ha
        xxspltib %vs32,0
        addi %r9,%r9,.LC0@toc@l
        lxv %vs33,0(%r9)
        xxperm %vs34,%vs32,%vs33
        blr



It will be better to produce:

foo:
.LFB0:
        .cfi_startproc
        vspltisw %v0,0
        xxpermdi %vs34,%vs32,%vs34,3

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

* [Bug target/102868] Missed optimization with __builtin_shuffle and zero vector on ppc
  2021-10-21  6:08 [Bug target/102868] New: Missed optimization with __builtin_shuffle and zero vector on ppc luoxhu at gcc dot gnu.org
@ 2021-10-25  2:52 ` luoxhu at gcc dot gnu.org
  2021-10-29  2:28 ` cvs-commit at gcc dot gnu.org
  2021-10-29  2:31 ` luoxhu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: luoxhu at gcc dot gnu.org @ 2021-10-25  2:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from luoxhu at gcc dot gnu.org ---
Patch submitted: 
https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582452.html

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

* [Bug target/102868] Missed optimization with __builtin_shuffle and zero vector on ppc
  2021-10-21  6:08 [Bug target/102868] New: Missed optimization with __builtin_shuffle and zero vector on ppc luoxhu at gcc dot gnu.org
  2021-10-25  2:52 ` [Bug target/102868] " luoxhu at gcc dot gnu.org
@ 2021-10-29  2:28 ` cvs-commit at gcc dot gnu.org
  2021-10-29  2:31 ` luoxhu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-29  2:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Xiong Hu Luo <luoxhu@gcc.gnu.org>:

https://gcc.gnu.org/g:146b83e14a0a76a9ce8a4cb79997a078f437f779

commit r12-4781-g146b83e14a0a76a9ce8a4cb79997a078f437f779
Author: Xionghu Luo <luoxhu@linux.ibm.com>
Date:   Thu Oct 28 21:28:43 2021 -0500

    rs6000: Optimize __builtin_shuffle when it's used to zero the upper bits
[PR102868]

    If the second operand of __builtin_shuffle is const vector 0, and with
    specific mask, it can be optimized to vspltisw+xxpermdi instead of lxv.

    gcc/ChangeLog:

            PR target/102868
            * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Add
            patterns match and emit for VSX xxpermdi.

    gcc/testsuite/ChangeLog:

            PR target/102868
            * gcc.target/powerpc/pr102868.c: New test.

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

* [Bug target/102868] Missed optimization with __builtin_shuffle and zero vector on ppc
  2021-10-21  6:08 [Bug target/102868] New: Missed optimization with __builtin_shuffle and zero vector on ppc luoxhu at gcc dot gnu.org
  2021-10-25  2:52 ` [Bug target/102868] " luoxhu at gcc dot gnu.org
  2021-10-29  2:28 ` cvs-commit at gcc dot gnu.org
@ 2021-10-29  2:31 ` luoxhu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: luoxhu at gcc dot gnu.org @ 2021-10-29  2:31 UTC (permalink / raw)
  To: gcc-bugs

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

luoxhu at gcc dot gnu.org changed:

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

--- Comment #3 from luoxhu at gcc dot gnu.org ---
Fixed on master.

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

end of thread, other threads:[~2021-10-29  2:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  6:08 [Bug target/102868] New: Missed optimization with __builtin_shuffle and zero vector on ppc luoxhu at gcc dot gnu.org
2021-10-25  2:52 ` [Bug target/102868] " luoxhu at gcc dot gnu.org
2021-10-29  2:28 ` cvs-commit at gcc dot gnu.org
2021-10-29  2:31 ` luoxhu 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).