From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by sourceware.org (Postfix) with ESMTPS id 7226B3858D28 for ; Mon, 19 Jun 2023 07:28:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7226B3858D28 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-qv1-xf34.google.com with SMTP id 6a1803df08f44-630019ff99bso20251786d6.0 for ; Mon, 19 Jun 2023 00:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687159709; x=1689751709; 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=Pafno01LMvvEjp/sByFdWuz1f1b3Jotiv3gedYm7LQM=; b=eGZD9Ri1fG+3tO0wWkrQJ2Z3ryZp/X/8H0aazSF6aXMe534RAWdvWEpSCJ8CRGVyuc 5FiCv8bF1VUajyNkFZyO1ftXHqR0OT7eimrTxFauhctdSeb9gMZBmMaUKTyqMAY5raiE MkLl6/nlQUIn/EY7C+IppkbAVMqsq8X9m5RzdOlNET04PBqZSbUyIo7/8mGfzEXAy3oy YeVXk76hMxKKtwio0KkFk+RLlRjWTA6aGUocfWU7p4U4lG9XMXTmQ+sd9IjmC+VsLEYI H+LeyilmQ5TEQTrd20Mg/oetC5MAiKp/zSQfl3vbGe79ovek10yfCqJeAqt7wEfH0UG0 1AFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687159709; x=1689751709; 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=Pafno01LMvvEjp/sByFdWuz1f1b3Jotiv3gedYm7LQM=; b=QSIqTnFWeu3IbFxHyAeOpSEporhIUrk/TdzA4iH1kcAGvw89pLAuwx/c3ZGlED3z14 O01CkhmqjZBgp4tVzqHuNXSLyQE/BsLLec61XrvHKxu4Az90kX2N2T90eJow7zEgX6wV PBGMiUQNY+SDYzovny+1uddqufHlINitPJS4tbf34FjtvKIibgGJcioBjkDo2reOjT09 yzxmSvrzfdKE12cVU9NgLr02o5s8ip/ARRCXTyamYSv93Grk4GRcDY6ajVZpC+kDm8Nr Pmd112UzV3CKf73OldfYO9uV4DAvrXb8jBpSN/8kmfvleXrbmbGSvia+AXfyUW6TtONT 1i3A== X-Gm-Message-State: AC+VfDy1+totdYzoUBzMyY6beMHOdQGsmypT+x8AsJM3coI5PozIaCTX gU6b5QBJpAnvy5efwzpDPC+fBVs6DfTyOroqPJF4A9v7cNNLIQ== X-Google-Smtp-Source: ACHHUZ4+cFolsft1RezIesVObd+CABwvFAcYsmzaWSNegrBSIY+4VoYVo6QvJWhHKL8dqCnXf5xbncY0008cZEtrXF8= X-Received: by 2002:a05:6214:d05:b0:625:aa1a:b6dc with SMTP id 5-20020a0562140d0500b00625aa1ab6dcmr10634818qvh.62.1687159708564; Mon, 19 Jun 2023 00:28:28 -0700 (PDT) MIME-Version: 1.0 References: <00ce01d99e10$a7e04b20$f7a0e160$@nextmovesoftware.com> <005c01d9a056$3f025790$bd0706b0$@nextmovesoftware.com> In-Reply-To: <005c01d9a056$3f025790$bd0706b0$@nextmovesoftware.com> From: Uros Bizjak Date: Mon, 19 Jun 2023 09:28:17 +0200 Message-ID: Subject: Re: [x86 PATCH] Convert ptestz of pandn into ptestc. To: Roger Sayle Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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 Fri, Jun 16, 2023 at 3:27=E2=80=AFPM Roger Sayle wrote: > > > Hi Uros, > Here's an updated version of this patch incorporating your comments. > It uses emit_insn (target, const1_rtx), bt_comparison operator to > combine the sete/setne to setc/setnc, and je/jne to jc/jnc patterns, > uses scan-assembler-times in the test cases, and cleans up the silly > cut'n'paste issue that mangled strict_low_part/subreg of a register > that was already QImode. I tried, but the strict_low_part variant > really is required (some of the new test cases fail without it), but > things are much neater now, and have few patterns than the original. > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > and make -k check, both with and without --target_board=3Dunix{-m32} > with no new failures. Ok for mainline? > > > 2023-06-16 Roger Sayle > Uros Bizjak > > gcc/ChangeLog > * config/i386/i386-expand.cc (ix86_expand_sse_ptest): Recognize > expansion of ptestc with equal operands as producing const1_rtx. > * config/i386/i386.cc (ix86_rtx_costs): Provide accurate cost > estimates of UNSPEC_PTEST, where the ptest performs the PAND > or PAND of its operands. > * config/i386/sse.md (define_split): Transform CCCmode UNSPEC_PTE= ST > of reg_equal_p operands into an x86_stc instruction. > (define_split): Split pandn/ptestz/set{n?}e into ptestc/set{n?}c. > (define_split): Similar to above for strict_low_part destinations= . > (define_split): Split pandn/ptestz/j{n?}e into ptestc/j{n?}c. > > gcc/testsuite/ChangeLog > * gcc.target/i386/avx-vptest-4.c: New test case. > * gcc.target/i386/avx-vptest-5.c: Likewise. > * gcc.target/i386/avx-vptest-6.c: Likewise. > * gcc.target/i386/pr109973-1.c: Update test case. > * gcc.target/i386/pr109973-2.c: Likewise. > * gcc.target/i386/sse4_1-ptest-4.c: New test case. > * gcc.target/i386/sse4_1-ptest-5.c: Likewise. > * gcc.target/i386/sse4_1-ptest-6.c: Likewise. +(define_split + [(set (strict_low_part (subreg:QI (match_operand:SI 0 "register_operand"= ) 0)) I think you should use (set (strict_low_part (match_operand:QI 0 "register_operand")) ... here and= ... + (set (strict_low_part (subreg:QI (match_dup 0) 0)) corresponding (set (strict_low_part (match_dup 0))... without explicit SUBREG here. This will handle all subregs automatically, as they are also matched by "register_operand" predicate. OK with the above change. Thanks, Uros.