From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by sourceware.org (Postfix) with ESMTPS id C26AC3858D35 for ; Sun, 25 Jun 2023 05:12:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C26AC3858D35 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-yb1-xb32.google.com with SMTP id 3f1490d57ef6-bd6d9d7da35so2209068276.0 for ; Sat, 24 Jun 2023 22:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687669965; x=1690261965; 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=LetcFpF5HbToMmNvU2ogu9cNyNtKtyrSkDDDbSXhWqc=; b=i4eh9Eozx58do9GzXRGF/6V/qhzHK6+Vjor/Q+bboTFVYDnTPQUru4mqUIdKmMwzbZ ZVNuFPyMisnMF6+XqxZk3XiFR+XoKfzkCqWrt7BroFveOB4F0JMT0nXghXvRg7G94aBY Qx2+v3pQwkLaKZXIOLXqoGZaf5clSgPA0c9FRC4BdQkFpWCw/B8fB1xZ7he6XtRz+csb 2zOD2cqLQ4Pzqgau27hebnXtFGGpn34GAmcr1voa9OvzryS64Ek+0QoEEgvDZbhKUj0h Gub5DojMXBbDxrueL8RfvearfiUm93CDqw08gJh807L4eOZO6egS7bjQ+lXcuIh1XhQq jn9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687669965; x=1690261965; 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=LetcFpF5HbToMmNvU2ogu9cNyNtKtyrSkDDDbSXhWqc=; b=Q1T9yYX34JqeaNvXOQahcW+j2jylxGzsXDJuq9rpsYO85cYpWACmfbUSFCa8tTBdXQ +yx/4Ctpz206Iq7PULD5AXN5nsq/OQ8cqQ2oSFo0jz7t7dUjGu0Q04hnKoCthWOXM0Hd 7TKjI0y0xfm/tF0dn9mz624jrqNJ5jHwtx0KZvnHRYmFRUZuzHSqlDhcsQ0R1AuRb1WN gOEYlZu2eYGeCNfrgZ/QxG9xxv60KcKKy/SorXPdX7Gh9UFmlt+rbUGJ7HdBCL/hszmL +SyN6e0j+lgUwtG0ejb1TvrOmmoSZLRqnAfx8OvJoYosVqlTPa/it7/rTEcA+Btu7VmB oaZQ== X-Gm-Message-State: AC+VfDzGokvNRYkD5mA0NB1u/Wa9I9Ih6GpxyIQsnITIRMQ/GBSdEkd4 jQCWyv6ohs1YWBvjRsyC+mh5bXCthx2ThFe1zGo= X-Google-Smtp-Source: ACHHUZ7tgBzwjrosBmW/irEmPbkoFjGMbjRG6jWNXdNPXQSmeF+QTJXJZPljTKGHSOCpINvVUlVosKGBM5kEA+9JC9M= X-Received: by 2002:a81:fd0f:0:b0:576:916d:973 with SMTP id g15-20020a81fd0f000000b00576916d0973mr4617808ywn.3.1687669964941; Sat, 24 Jun 2023 22:12:44 -0700 (PDT) MIME-Version: 1.0 References: <04f99abe-a563-d093-23b7-4abf0f91633d@suse.com> <0075f542-9dc0-33db-4cf9-cdd3ba502122@suse.com> In-Reply-To: <0075f542-9dc0-33db-4cf9-cdd3ba502122@suse.com> From: Hongtao Liu Date: Sun, 25 Jun 2023 13:12:33 +0800 Message-ID: Subject: Re: [PATCH 5/5] x86: yet more PR target/100711-like splitting To: Jan Beulich Cc: "gcc-patches@gcc.gnu.org" , Hongtao Liu , Kirill Yukhin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 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 Wed, Jun 21, 2023 at 2:29=E2=80=AFPM Jan Beulich via Gcc-patches 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_cmpl2): Allow broadcast for operand 1. > (one_cmpl2): 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_cmpl2" > [(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 "one_cmpl2" > [(set (match_operand:VI 0 "register_operand" "=3Dv,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 > && (! > @@ -17191,6 +17191,19 @@ > (symbol_ref " =3D=3D 64 || TARGET_AVX512= VL") > (const_int 1)))]) > > +(define_split > + [(set (match_operand:VI48_AVX512F 0 "register_operand") > + (vec_duplicate:VI48_AVX512F > + (not: > + (match_operand: 1 "nonimmediate_operand"))))] > + " =3D=3D 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] =3D CONSTM1_RTX (mode);") > + > (define_expand "_andnot3" > [(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=3D512 -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 } } */ > --=20 BR, Hongtao