public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: liuhongt <hongtao.liu@intel.com>,
	gcc-patches@gcc.gnu.org, hjl.tools@gmail.com
Subject: Re: [PATCH] Fold _mm{, 256, 512}_abs_{epi8, epi16, epi32, epi64} into gimple ABSU_EXPR + VCE.
Date: Fri, 9 Jun 2023 09:47:48 +0800	[thread overview]
Message-ID: <CAMZc-bzcUT=-MmjXMJbK2g0LrzNEg-8-tTeXpKvyGa3ngRz8ew@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-byWMCNFijc84qetmMt2Eo7hncxuKyGZfp58XKKo-4WNug@mail.gmail.com>

On Wed, Jun 7, 2023 at 8:31 AM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Tue, Jun 6, 2023 at 10:36 PM Uros Bizjak <ubizjak@gmail.com> wrote:
> >
> > On Tue, Jun 6, 2023 at 1:42 PM Hongtao Liu <crazylht@gmail.com> wrote:
> > >
> > > On Tue, Jun 6, 2023 at 5:11 PM Uros Bizjak <ubizjak@gmail.com> wrote:
> > > >
> > > > On Tue, Jun 6, 2023 at 6:33 AM liuhongt via Gcc-patches
> > > > <gcc-patches@gcc.gnu.org> wrote:
> > > > >
> > > > > r14-1145 fold the intrinsics into gimple ABS_EXPR which has UB for
> > > > > TYPE_MIN, but PABSB will store unsigned result into dst. The patch
> > > > > uses ABSU_EXPR + VCE instead of ABS_EXPR.
> > > > >
> > > > > Also don't fold _mm_abs_{pi8,pi16,pi32} w/o TARGET_64BIT since 64-bit
> > > > > vector absm2 is guarded with TARGET_MMX_WITH_SSE.
> > > >
> > > >This should be !TARGET_MMX_WITH_SSE. TARGET_64BIT is not enough, see
> > > >the definition of T_M_W_S in i386.h. OTOH, these builtins are
> > > >available for TARGET_MMX, so I'm not sure if the above check is needed
> > > >at all.
> > > BDESC (OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX, 0,
> > > CODE_FOR_ssse3_absv8qi2, "__builtin_ia32_pabsb", IX86_BUILTIN_PABSB,
> > > UNKNOWN, (int) V8QI_FTYPE_V8QI)
> > >
> > > ISA requirement(OPTION_MASK_ISA_SSSE3 | OPTION_MASK_ISA_MMX) will be
> > > checked by ix86_check_builtin_isa_match which is at the beginning of
> > > ix86_gimple_fold_builtin.
> > > Here, we're folding those builtin into gimple ABSU_EXPR, and
> > > ABSU_EXPR<vector> will be lowered by vec_lower pass when backend
> > > doesn't support corressponding absm2_optab, that's why i only check
> > > TARGET_64BIT here.
> > >
> > > > Please note that we are using builtins here, so we should not fold to
> > > > absm2, but to ssse3_absm2, which is also available with TARGET_MMX.
> > > Yes, that exactly why I checked TARGET_64BIT here, w/ TARGET_64BIT,
> > > backend suppport absm2_optab which exactly matches ssse3_absm2.
> > > w/o TARGET_64BIT, the builtin shouldn't folding into gimple ABSU_EXPR,
> > > but let backend expanded to ssse3_absm2.
> >
> > Thanks for the explanation, but for consistency, I'd recommend
> > checking TARGET_MMX_WITH_SSE (= TARGET_64BIT && TARGET_SSE2) here. The
> > macro is self-explanatory, while the usage of TARGET_64BIT is not that
> > descriptive.
> Sure.
Pushed to trunk.
> >
> > Uros.
>
>
>
> --
> BR,
> Hongtao



-- 
BR,
Hongtao

      reply	other threads:[~2023-06-09  1:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  4:31 [PATCH] Fold _mm{,256,512}_abs_{epi8,epi16,epi32,epi64} " liuhongt
2023-06-06  4:31 ` [PATCH] Don't fold _mm{,256}_blendv_epi8 into (mask < 0 ? src1 : src2) when -funsigned-char liuhongt
2023-06-06  4:46   ` [PATCH] Don't fold _mm{, 256}_blendv_epi8 " Andrew Pinski
2023-06-06  8:21     ` [PATCH v2] Explicitly view_convert_expr mask to signed type when folding pblendvb builtins liuhongt
2023-06-09  1:49       ` Hongtao Liu
2023-06-06  4:49 ` [PATCH] Fold _mm{, 256, 512}_abs_{epi8, epi16, epi32, epi64} into gimple ABSU_EXPR + VCE Andrew Pinski
2023-06-06  8:15   ` Hongtao Liu
2023-06-06  8:35   ` [PATCH 1/2] Fold _mm{,256,512}_abs_{epi8,epi16,epi32,epi64} " liuhongt
2023-06-06  9:08 ` [PATCH] Fold _mm{, 256, 512}_abs_{epi8, epi16, epi32, epi64} " Uros Bizjak
2023-06-06  9:11 ` Uros Bizjak
2023-06-06 11:42   ` Hongtao Liu
2023-06-06 14:36     ` Uros Bizjak
2023-06-07  0:31       ` Hongtao Liu
2023-06-09  1:47         ` Hongtao Liu [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='CAMZc-bzcUT=-MmjXMJbK2g0LrzNEg-8-tTeXpKvyGa3ngRz8ew@mail.gmail.com' \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=hongtao.liu@intel.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).