public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "shawn at git dot icu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94687] New: PPC vector fails to optimize shift (used bits)
Date: Tue, 21 Apr 2020 10:32:28 +0000	[thread overview]
Message-ID: <bug-94687-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 94687
           Summary: PPC vector fails to optimize shift (used bits)
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shawn at git dot icu
  Target Milestone: ---

https://godbolt.org/z/ZyTG9b


#include <altivec.h>

typedef vector unsigned __int128 block;
typedef vector unsigned long long vector2_u64;

block swap_with_shift(block num) {
    return num << 64 | num >> 64;
}

block swap_without_shift(block num) {
    vector unsigned long long ret;
    ret[0] = ((vector2_u64)num)[1];
    ret[1] = ((vector2_u64)num)[0];
    return (block)ret;
}

typedef unsigned __int128 u128;

u128 swap_scalar(u128 in) {
    return in << 64 | in >> 64;
}

swap_with_shift:
        xxpermdi 34,34,34,2
        addi 9,1,-16
        stxvd2x 34,0,9
        ld 8,-8(1)
        ld 9,-16(1)
        mtvsrd 1,8
        mtvsrd 0,9
        xxpermdi 34,0,1,0
        blr
        .long 0
        .byte 0,0,0,0,0,0,0,0
swap_without_shift:
        xxpermdi 34,34,34,2
        blr
        .long 0
        .byte 0,0,0,0,0,0,0,0
swap_scalar:
        mr 9,3
        mr 3,4
        mr 4,9
        blr
        .long 0
        .byte 0,0,0,0,0,0,0,0

             reply	other threads:[~2020-04-21 10:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21 10:32 shawn at git dot icu [this message]
2020-04-30 17:16 ` [Bug target/94687] " segher at gcc dot gnu.org
2020-06-16 11:40 ` shawn at git dot icu

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=bug-94687-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).