public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Hongtao Liu <hongtao.liu@intel.com>,
	 Kirill Yukhin <kirill.yukhin@gmail.com>
Subject: Re: [PATCH 5/5] x86: yet more PR target/100711-like splitting
Date: Sun, 25 Jun 2023 13:12:33 +0800	[thread overview]
Message-ID: <CAMZc-bzwtSZh2fqYwP+3kTt4O9LQ_adR4D_fWoN62WNsZHYDwg@mail.gmail.com> (raw)
In-Reply-To: <0075f542-9dc0-33db-4cf9-cdd3ba502122@suse.com>

On Wed, Jun 21, 2023 at 2:29 PM Jan Beulich via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Following two-operand bitwise operations, add another splitter to also
> deal with not followed by broadcast all on its own, which can be
> expressed as simple embedded broadcast instead once a broadcast operand
> is actually permitted in the respective insn. While there also permit
> a broadcast operand in the corresponding expander.
The patch LGTM.
>
> gcc/
>
>         * config/i386/sse.md: New splitters to simplify
>         not;vec_duplicate as a singular vpternlog.
>         (one_cmpl<mode>2): Allow broadcast for operand 1.
>         (<mask_codefor>one_cmpl<mode>2<mask_name>): Likewise.
>
> gcc/testsuite/
>
>         * gcc.target/i386/pr100711-6.c: New test.
> ---
> For the purpose here (and elsewhere) bcst_vector_operand() (really:
> bcst_mem_operand()) isn't permissive enough: We'd want it to allow
> 128-bit and 256-bit types as well irrespective of AVX512VL being
> enabled. This would likely require a new predicate
> (bcst_intvec_operand()?) and a new constraint (BR? Bi?). (Yet for name
> selection it will want considering that this is applicable to certain
> non-calculational FP operations as well.)
I think so.
>
> --- a/gcc/config/i386/sse.md
> +++ b/gcc/config/i386/sse.md
> @@ -17156,7 +17156,7 @@
>
>  (define_expand "one_cmpl<mode>2"
>    [(set (match_operand:VI 0 "register_operand")
> -       (xor:VI (match_operand:VI 1 "vector_operand")
> +       (xor:VI (match_operand:VI 1 "bcst_vector_operand")
>                 (match_dup 2)))]
>    "TARGET_SSE"
>  {
> @@ -17168,7 +17168,7 @@
>
>  (define_insn "<mask_codefor>one_cmpl<mode>2<mask_name>"
>    [(set (match_operand:VI 0 "register_operand" "=v,v")
> -       (xor:VI (match_operand:VI 1 "nonimmediate_operand" "v,m")
> +       (xor:VI (match_operand:VI 1 "bcst_vector_operand" "vBr,m")
>                 (match_operand:VI 2 "vector_all_ones_operand" "BC,BC")))]
>    "TARGET_AVX512F
>     && (!<mask_applied>
> @@ -17191,6 +17191,19 @@
>                       (symbol_ref "<MODE_SIZE> == 64 || TARGET_AVX512VL")
>                       (const_int 1)))])
>
> +(define_split
> +  [(set (match_operand:VI48_AVX512F 0 "register_operand")
> +       (vec_duplicate:VI48_AVX512F
> +         (not:<ssescalarmode>
> +           (match_operand:<ssescalarmode> 1 "nonimmediate_operand"))))]
> +  "<MODE_SIZE> == 64 || TARGET_AVX512VL
> +   || (TARGET_AVX512F && !TARGET_PREFER_AVX256)"
> +  [(set (match_dup 0)
> +       (xor:VI48_AVX512F
> +         (vec_duplicate:VI48_AVX512F (match_dup 1))
> +         (match_dup 2)))]
> +  "operands[2] = CONSTM1_RTX (<MODE>mode);")
> +
>  (define_expand "<sse2_avx2>_andnot<mode>3"
>    [(set (match_operand:VI_AVX2 0 "register_operand")
>         (and:VI_AVX2
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/i386/pr100711-6.c
> @@ -0,0 +1,18 @@
> +/* { dg-do compile } */
> +/* { dg-options "-mavx512f -mno-avx512vl -mprefer-vector-width=512 -O2" } */
> +
> +typedef int v16si __attribute__ ((vector_size (64)));
> +typedef long long v8di __attribute__((vector_size (64)));
> +
> +v16si foo_v16si (const int *a)
> +{
> +    return (__extension__ (v16si) {~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a,
> +                                  ~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a});
> +}
> +
> +v8di foo_v8di (const long long *a)
> +{
> +    return (__extension__ (v8di) {~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a, ~*a});
> +}
> +
> +/* { dg-final { scan-assembler-times "vpternlog\[dq\]\[ \\t\]+\\\$0x55, \\(%(?:eax|rdi|edi)\\)\\\{1to\[1-8\]+\\\}" 2 } } */
>


-- 
BR,
Hongtao

  reply	other threads:[~2023-06-25  5:12 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21  6:24 [PATCH 0/5] x86: make better use of VPTERNLOG{D,Q} Jan Beulich
2023-06-21  6:25 ` [PATCH 1/5] x86: use VPTERNLOG for further bitwise two-vector operations Jan Beulich
2023-06-25  4:42   ` Hongtao Liu
2023-06-25  5:52     ` Jan Beulich
2023-06-25  7:13       ` Hongtao Liu
2023-06-25  7:23         ` Hongtao Liu
2023-06-25  7:30           ` Hongtao Liu
2023-06-25 13:35             ` Jan Beulich
2023-06-26  0:42               ` Hongtao Liu
2023-06-21  6:27 ` [PATCH 2/5] x86: use VPTERNLOG also for certain andnot forms Jan Beulich
2023-06-25  4:58   ` Hongtao Liu
2023-06-21  6:27 ` [PATCH 3/5] x86: allow memory operand for AVX2 splitter for PR target/100711 Jan Beulich
2023-06-25  4:58   ` Hongtao Liu
2023-06-21  6:27 ` [PATCH 4/5] x86: further PR target/100711-like splitting Jan Beulich
2023-06-25  5:06   ` Hongtao Liu
2023-06-25  6:16     ` Jan Beulich
2023-06-25  6:27       ` Hongtao Liu
2023-06-21  6:28 ` [PATCH 5/5] x86: yet more " Jan Beulich
2023-06-25  5:12   ` Hongtao Liu [this message]
2023-06-25  6:25     ` Jan Beulich
2023-06-25  6:35       ` Hongtao Liu
2023-06-25  6:41         ` Hongtao Liu
2023-11-06 11:10           ` Jan Beulich
2023-11-06 13:48             ` Hongtao Liu

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=CAMZc-bzwtSZh2fqYwP+3kTt4O9LQ_adR4D_fWoN62WNsZHYDwg@mail.gmail.com \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=jbeulich@suse.com \
    --cc=kirill.yukhin@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).