From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by sourceware.org (Postfix) with ESMTPS id BB1273858C62 for ; Sun, 25 Jun 2023 06:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BB1273858C62 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-qk1-x734.google.com with SMTP id af79cd13be357-7659dc74d91so8965185a.0 for ; Sat, 24 Jun 2023 23:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687674458; x=1690266458; 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=UR5FP+JgxJFILXWtUxTBxOCRNcuEq47Zynpuli7WAyw=; b=CROvdHaGeW6qawPUkXvyOhsXoJav761E419f9qnRM0M7zOhsAhY+/qGl8eVif6tgGL NuSwrI1LnKzQa8FzbtZIFhJqrokdiumHlqb2pnzYkDCVdUt2ANtBtKYpVQroc3BdVjH2 n/DnvZAE+FzOmuYHeoV9oPlPKPWW0pqhvtlfvZuwb03oN7fl3A79g1wLeVpL2FTk4/Oe +Ih8i/C2QantB8OXMbBVe4YEKnmFBs1Jrb3KqeYXIX1I1kAOQpRgGY8ardpLb8PfPBzN GfCK7JWqsYDC9Ij0Jte/bpymjPSyVGdt8ykniE+a5W3Q051KLr0YpdwIiNHBricHb31D Gxuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687674458; x=1690266458; 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=UR5FP+JgxJFILXWtUxTBxOCRNcuEq47Zynpuli7WAyw=; b=Gz2/ZSuG++MU4t/r+ibaz0JC1QIARgJTZi665F5KQNOGSo44tUehnhLR8OseiZxhOe 7PIYtiXdxiXHj72Odp+aLF97gTTFVTcHRLPUW5g/nn/v0BuRMZy3Rb3UY1Kh3YhaVVZ0 gA3o9jKdQLuL+QfTwEkacL3tad7UFsDC5LBH8V8Qj2gHqaw+/hOfaNBuRb6RGk1jFuw9 Y0bBg4q+ywGi33davYNEAzgNV3Ve4IwC5OyfVDczytjjO2DF4TUfsWUVL/6SbvPuNkCj 4Fqq7+6bPlTFAq1Or/cqlAXADJLacjlPqFHJEjWR14Zw1KPaPebpFoF0acpcyOKoT8WL qeVQ== X-Gm-Message-State: AC+VfDxgjaQkZgkbI/eNERD85CMWFSpaf7OE1bwKIbUeeRYQL95S83tc 8kr35CqIle/18wRoNJW+DoFu0RYvEXrYgMvi4Og= X-Google-Smtp-Source: ACHHUZ7mRmai5mjn6eNbUPZhDF3rpzz9MZME8I5dN19t0EYMH1KEboA8trGsKo7y62thCo9F60lnteSjphW+4Ro0LBo= X-Received: by 2002:a05:620a:4881:b0:75d:5534:865d with SMTP id ea1-20020a05620a488100b0075d5534865dmr21567570qkb.60.1687674458001; Sat, 24 Jun 2023 23:27:38 -0700 (PDT) MIME-Version: 1.0 References: <04f99abe-a563-d093-23b7-4abf0f91633d@suse.com> <514c011d-27a4-45d1-f353-f3016c59db65@suse.com> In-Reply-To: <514c011d-27a4-45d1-f353-f3016c59db65@suse.com> From: Hongtao Liu Date: Sun, 25 Jun 2023 14:27:27 +0800 Message-ID: Subject: Re: [PATCH 4/5] x86: further 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=-2.5 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 Sun, Jun 25, 2023 at 2:16=E2=80=AFPM Jan Beulich wro= te: > > On 25.06.2023 07:06, Hongtao Liu wrote: > > On Wed, Jun 21, 2023 at 2:28=E2=80=AFPM Jan Beulich via Gcc-patches > > wrote: > >> > >> With respective two-operand bitwise operations now expressable by a > >> single VPTERNLOG, add splitters to also deal with ior and xor > >> counterparts of the original and-only case. Note that the splitters ne= ed > >> to be separate, as the placement of "not" differs in the final insns > >> (*iornot3, *xnor3) which are intended to pick up one half = of > >> the result. > >> > >> gcc/ > >> > >> * config/i386/sse.md: New splitters to simplify > >> not;vec_duplicate;{ior,xor} as vec_duplicate;{iornot,xnor}. > >> > >> gcc/testsuite/ > >> > >> * gcc.target/i386/pr100711-4.c: New test. > >> * gcc.target/i386/pr100711-5.c: New test. > >> > >> --- a/gcc/config/i386/sse.md > >> +++ b/gcc/config/i386/sse.md > >> @@ -17366,6 +17366,36 @@ > >> (match_dup 2)))] > >> "operands[3] =3D gen_reg_rtx (mode);") > >> > >> +(define_split > >> + [(set (match_operand:VI 0 "register_operand") > >> + (ior:VI > >> + (vec_duplicate:VI > >> + (not: > >> + (match_operand: 1 "nonimmediate_operand")= )) > >> + (match_operand:VI 2 "vector_operand")))] > >> + " =3D=3D 64 || TARGET_AVX512VL > >> + || (TARGET_AVX512F && !TARGET_PREFER_AVX256)" > >> + [(set (match_dup 3) > >> + (vec_duplicate:VI (match_dup 1))) > >> + (set (match_dup 0) > >> + (ior:VI (not:VI (match_dup 3)) (match_dup 2)))] > >> + "operands[3] =3D gen_reg_rtx (mode);") > >> + > >> +(define_split > >> + [(set (match_operand:VI 0 "register_operand") > >> + (xor:VI > >> + (vec_duplicate:VI > >> + (not: > >> + (match_operand: 1 "nonimmediate_operand")= )) > >> + (match_operand:VI 2 "vector_operand")))] > >> + " =3D=3D 64 || TARGET_AVX512VL > >> + || (TARGET_AVX512F && !TARGET_PREFER_AVX256)" > >> + [(set (match_dup 3) > >> + (vec_duplicate:VI (match_dup 1))) > >> + (set (match_dup 0) > >> + (not:VI (xor:VI (match_dup 3) (match_dup 2))))] > >> + "operands[3] =3D gen_reg_rtx (mode);") > >> + > > Can we merge this splitter(xor:not) into ior:not one with a code > > iterator for xor,ior, They look the same except for the xor/ior. > > They're only almost the same: Note (ior (not )) vs (not (xor )) as > the result of the splitting. The difference is necessary to fit > with what patch 1 introduces (which in turn is the way it is to > fit with what generic code transforms things to up front). (I had > it the way you suggest initially, until I figured why one of the > two would end up never being used.) > 3597 /* Convert (XOR (NOT x) (NOT y)) to (XOR x y). 3598 Also convert (XOR (NOT x) y) to (NOT (XOR x y)), similarly for 3599 (NOT y). */ 3600 { 3601 int num_negated =3D 0; 3602 3603 if (GET_CODE (op0) =3D=3D NOT) 3604 num_negated++, op0 =3D XEXP (op0, 0); 3605 if (GET_CODE (op1) =3D=3D NOT) 3606 num_negated++, op1 =3D XEXP (op1, 0); It looks simplify_rtx plays the trick. And it's documented. 8602@cindex @code{xor}, canonicalization of 8603@item 8604The only possible RTL expressions involving both bitwise exclusive-or 8605and bitwise negation are @code{(xor:@var{m} @var{x} @var{y})} 8606and @code{(not:@var{m} (xor:@var{m} @var{x} @var{y}))}. Then the original patch LGTM. > Jan --=20 BR, Hongtao