From: Jakub Jelinek <jakub@redhat.com>
To: Allan Sandfeld Jensen <linux@carewolf.com>,
Uros Bizjak <ubizjak@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] [x86] Avoid builtins for SSE/AVX2 immidiate logical shifts
Date: Mon, 24 Apr 2017 07:47:00 -0000 [thread overview]
Message-ID: <20170424074349.GG1809@tucnak> (raw)
In-Reply-To: <201704240933.09704.linux@carewolf.com>
On Mon, Apr 24, 2017 at 09:33:09AM +0200, Allan Sandfeld Jensen wrote:
> --- a/gcc/config/i386/avx2intrin.h
> +++ b/gcc/config/i386/avx2intrin.h
> @@ -667,7 +667,7 @@ extern __inline __m256i
> __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
> _mm256_slli_epi16 (__m256i __A, int __B)
> {
> - return (__m256i)__builtin_ia32_psllwi256 ((__v16hi)__A, __B);
> + return ((__B & 0xff) < 16) ? (__m256i)((__v16hi)__A << (__B & 0xff)) : _mm256_setzero_si256();
> }
What is the advantage of doing that when you replace one operation with
several (&, <, ?:, <<)?
I'd say instead we should fold the builtins if in the gimple fold target
hook we see the shift count constant and can decide based on that.
Or we could use __builtin_constant_p (__B) to decide whether to use
the generic vector shifts or builtin, but that means larger IL.
Jakub
next prev parent reply other threads:[~2017-04-24 7:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <201704221338.46300.linux@carewolf.com>
2017-04-24 7:43 ` Allan Sandfeld Jensen
2017-04-24 7:47 ` Jakub Jelinek [this message]
2017-04-24 8:02 ` Allan Sandfeld Jensen
2017-04-24 8:25 ` Jakub Jelinek
2017-04-24 8:25 ` Allan Sandfeld Jensen
2017-04-24 8:38 ` Jakub Jelinek
2017-04-24 8:40 ` Allan Sandfeld Jensen
2017-04-24 8:54 ` Allan Sandfeld Jensen
2017-04-24 8:57 ` Jakub Jelinek
2017-04-24 14:43 ` Allan Sandfeld Jensen
2017-05-02 10:17 ` Jakub Jelinek
2017-05-02 11:22 ` Allan Sandfeld Jensen
2017-05-02 15:58 ` Marc Glisse
[not found] ` <201704241101.29634.linux@carewolf.com>
2017-04-24 9:38 ` Jakub Jelinek
2017-04-24 9:38 ` Allan Sandfeld Jensen
2017-04-24 9:17 Allan Sandfeld Jensen
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=20170424074349.GG1809@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linux@carewolf.com \
--cc=ubizjak@gmail.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).