From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id EFD093857B9B for ; Fri, 9 Jun 2023 01:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFD093857B9B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-569fc874498so12320607b3.1 for ; Thu, 08 Jun 2023 18:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686275279; x=1688867279; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Q3dc0gmzWvFLCKxYN8aOExaQzVVgJvLKH4ZxmYLUv3w=; b=dThv2aEC9zbCxEFvvv+sdg2enn6sii1E9yqre8wk+ZMDi54PcLA4Q+Y+VlZHJPgrGI AvPB1ucCDTn4ctzbm7J2xe/GKfPa7Ffx4UwXIc5cPWZAmO8u3eZNPN7m/QH072ParH3W FwmCEdyfqiEWWbFMRFiW7k1S7rhL5QJ+Gt4rVooZnCBOFKufH/8oa2ygxCurkDYQcmiC +elpa6Q091Dk5ch/j7FAhwkp8vum4L3Qp7/Wmx8+EX4BTpkIp4pnuvySvufz0KVc8NuZ NATZH+gFKFln92QDarf3PMt/wt4j89b2sQfSRmH8+zEFdp45ZacREWTlMDskKIuGc0h9 nW5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686275279; x=1688867279; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q3dc0gmzWvFLCKxYN8aOExaQzVVgJvLKH4ZxmYLUv3w=; b=Isg8TOPrQSV/NRrvAuakAjugEEmgeOZhBIqSENvvW3fkyft1jqqF2eQbwGxsdAEIKp Zqh+4aqu6HZGoo3ZFm7H4zXtMy08hzvubTP1FtG4APffD8N9bkuiIHRUTWQ53LhvS2+r TENw1yphHC66SQW2uOGfLb6uMWy0/YEQSkZ/ZBGMk9vhusQRgaa1NXSMkVV1a9U0w1pR PjKGOGYp04kuCxWcOdqJqssyZFbbNcKQh6K72YdyjlLw+nzt34qWwupUGh510j6/bSHK s/0AIB9Jvh1X77u+Yj4IiNThf1BThP/sN+rngZYEqM84bZffq1neQl/Zm+F4E3Bqw9tm dpCg== X-Gm-Message-State: AC+VfDxytSxmCKZu44Jjvwl/W58pPKyifE7KuwtlSyJveR0V8LlycEMk egsnIDeUUYJBDGls2rcwlt13vRoVJBF4V9lZlh0= X-Google-Smtp-Source: ACHHUZ4Ob2rU8qyt8zuD5nBt4j64ojXc/RafV2yGMdg2vACkzT/Ri4vXyNf+3aCwV1hUIkUAcQf4FsUXg1NzW/9aQV0= X-Received: by 2002:a0d:fe84:0:b0:544:9180:3104 with SMTP id o126-20020a0dfe84000000b0054491803104mr1331681ywf.34.1686275279221; Thu, 08 Jun 2023 18:47:59 -0700 (PDT) MIME-Version: 1.0 References: <20230606043121.24843-1-hongtao.liu@intel.com> In-Reply-To: From: Hongtao Liu Date: Fri, 9 Jun 2023 09:47:48 +0800 Message-ID: Subject: Re: [PATCH] Fold _mm{, 256, 512}_abs_{epi8, epi16, epi32, epi64} into gimple ABSU_EXPR + VCE. To: Uros Bizjak Cc: liuhongt , gcc-patches@gcc.gnu.org, hjl.tools@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jun 7, 2023 at 8:31=E2=80=AFAM Hongtao Liu wro= te: > > On Tue, Jun 6, 2023 at 10:36=E2=80=AFPM Uros Bizjak w= rote: > > > > On Tue, Jun 6, 2023 at 1:42=E2=80=AFPM Hongtao Liu = wrote: > > > > > > On Tue, Jun 6, 2023 at 5:11=E2=80=AFPM Uros Bizjak wrote: > > > > > > > > On Tue, Jun 6, 2023 at 6:33=E2=80=AFAM liuhongt via Gcc-patches > > > > wrote: > > > > > > > > > > r14-1145 fold the intrinsics into gimple ABS_EXPR which has UB fo= r > > > > > TYPE_MIN, but PABSB will store unsigned result into dst. The patc= h > > > > > 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 need= ed > > > >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 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 (=3D TARGET_64BIT && TARGET_SSE2) here. Th= e > > macro is self-explanatory, while the usage of TARGET_64BIT is not that > > descriptive. > Sure. Pushed to trunk. > > > > Uros. > > > > -- > BR, > Hongtao --=20 BR, Hongtao