public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/104600] VCE<integer_type>(vector){} should be converted (or expanded) into BIT_INSERT_EXPR
Date: Mon, 21 Feb 2022 08:45:35 +0000	[thread overview]
Message-ID: <bug-104600-4-lJ8GCjWmeB@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104600-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is another example even with 32bit int and 64bit long:
#define vector __attribute__((vector_size(8)))

long f(int a, int b)
{
  vector int t = {a, b};
  return (long)t;
}

void f1(long *t1, int a, int b)
{
  vector int t = {a, b};
  *t1 =  (long)t;
}

void f2(long *t1, int a, int b)
{
  vector int t = {a, b};
  *t1 =  ((long)t) + 1;
}

long f_1(unsigned a, unsigned b)
{
  long t = (((unsigned long)a) << 32) | (unsigned long)b;
  return (long)t;
}

void f1_1(long *t1, unsigned a, unsigned b)
{
  long t = (((unsigned long)a) << 32) | (unsigned long)b;
  *t1 =  (long)t;
}

void f2_1(long *t1, unsigned a, unsigned b)
{
  long t = (((unsigned long)a) << 32) | (unsigned long)b;
  *t1 =  ((long)t) + 1;
}

----- CUT ----
For f2 and f2_1 we have:

        movd    %esi, %xmm0
        movd    %edx, %xmm1
        punpckldq       %xmm1, %xmm0
        movq    %xmm0, %rsi
        addq    $1, %rsi
        movq    %rsi, (%rdi)

vs
        salq    $32, %rsi
        movl    %edx, %edx
        orq     %rdx, %rsi
        addq    $1, %rsi
        movq    %rsi, (%rdi)

It all depends on how fast move between GPRs and SSE register sets is vs doing
it all in the integer.

I only think this should be done for the 2x size case and nothing more.

      parent reply	other threads:[~2022-02-21  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-18 21:15 [Bug tree-optimization/104600] New: " pinskia at gcc dot gnu.org
2022-02-21  8:00 ` [Bug tree-optimization/104600] " rguenth at gcc dot gnu.org
2022-02-21  8:45 ` pinskia at gcc dot gnu.org [this message]

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-104600-4-lJ8GCjWmeB@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).