From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server.nextmovesoftware.com (server.nextmovesoftware.com [162.254.253.69]) by sourceware.org (Postfix) with ESMTPS id C6FD73858412 for ; Sat, 16 Jul 2022 14:08:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C6FD73858412 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=nextmovesoftware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nextmovesoftware.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nextmovesoftware.com; s=default; h=Content-Type:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=CdazAu0WXax768LxK357Kgkz+ab4NDYQTR7Y+tzlQQk=; b=lMRKNvVB22vg8i/G1aPo8R6+IU x0NCyeYAg5nfKrGNBCnZiebk65HVem/vUg0mbHce0W1ZTePk6ai8yBbrSM8F0dMpRtQQ+nrv53h2Q 6juuulcaMIT4EJY9cJhWfVSvxEqSPccQ4XHjTwrZjbEP9adAOagCQAaHDCGziwWPAiQVTQ/0KKrSc G7USDuqLxIG8WWyy3P9AteKaJRvy34Il2VXSrFB13gLNmVl2Xs5lDZAAFdv9CKkrZqTz+d2ZGiKgk MLPKmzjOvUGYXb9872rIySbBBIYJjUGMTaom6714wkcpSdMzSA2u1hzUvCLmBN8haCZFW41k80dz3 /v6AobxQ==; Received: from host109-154-33-170.range109-154.btcentralplus.com ([109.154.33.170]:52098 helo=Dell) by server.nextmovesoftware.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oCiTE-00055q-4G; Sat, 16 Jul 2022 10:08:36 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [AVX512 PATCH] Add UNSPEC_MASKOP to kupck instructions in sse.md. Date: Sat, 16 Jul 2022 15:08:35 +0100 Message-ID: <028e01d8991d$8ab68b70$a023a250$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_028F_01D89925.EC7AF370" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdiZG+tXnttsYB7iSM+kXBrU8kSYsg== Content-Language: en-gb X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.nextmovesoftware.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - nextmovesoftware.com X-Get-Message-Sender-Via: server.nextmovesoftware.com: authenticated_id: roger@nextmovesoftware.com X-Authenticated-Sender: server.nextmovesoftware.com: roger@nextmovesoftware.com X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, MEDICAL_SUBJECT, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jul 2022 14:08:40 -0000 This is a multipart message in MIME format. ------=_NextPart_000_028F_01D89925.EC7AF370 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This AVX512 specific patch to sse.md is split out from an earlier patch: https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596199.html The new splitters proposed in that patch interfere with AVX512's kunpckdq instruction which is defined as identical RTL, DW:DI = (HI:SI<<32)|zero_extend(LO:SI). To distinguish these, and avoid AVX512 mask registers accidentally being (ab)used by reload to perform SImode scalar shifts, this patch adds the explicit (unspec UNSPEC_MASKOP) to the unpack mask operations, which matches what sse.md does for the other mask specific (logic) operations. This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and make -k check, both with and without --target_board=unix{-m32} with no new failures. Ok for mainline? 2022-07-16 Roger Sayle gcc/ChangeLog * config/i386/sse.md (kunpckhi): Add UNSPEC_MASKOP unspec. (kunpcksi): Likewise, add UNSPEC_MASKOP unspec. (kunpckdi): Likewise, add UNSPEC_MASKOP unspec. (vec_pack_trunc_qi): Update to specify required UNSPEC_MASKOP unspec. (vec_pack_trunc_): Likewise. Thanks in advance, Roger -- ------=_NextPart_000_028F_01D89925.EC7AF370 Content-Type: text/plain; name="patchzt6.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patchzt6.txt" diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md=0A= index 62688f8..da50ffa 100644=0A= --- a/gcc/config/i386/sse.md=0A= +++ b/gcc/config/i386/sse.md=0A= @@ -2072,7 +2072,8 @@=0A= (ashift:HI=0A= (zero_extend:HI (match_operand:QI 1 "register_operand" "k"))=0A= (const_int 8))=0A= - (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))]=0A= + (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))=0A= + (unspec [(const_int 0)] UNSPEC_MASKOP)]=0A= "TARGET_AVX512F"=0A= "kunpckbw\t{%2, %1, %0|%0, %1, %2}"=0A= [(set_attr "mode" "HI")=0A= @@ -2085,7 +2086,8 @@=0A= (ashift:SI=0A= (zero_extend:SI (match_operand:HI 1 "register_operand" "k"))=0A= (const_int 16))=0A= - (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))]=0A= + (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))=0A= + (unspec [(const_int 0)] UNSPEC_MASKOP)]=0A= "TARGET_AVX512BW"=0A= "kunpckwd\t{%2, %1, %0|%0, %1, %2}"=0A= [(set_attr "mode" "SI")])=0A= @@ -2096,7 +2098,8 @@=0A= (ashift:DI=0A= (zero_extend:DI (match_operand:SI 1 "register_operand" "k"))=0A= (const_int 32))=0A= - (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))]=0A= + (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))=0A= + (unspec [(const_int 0)] UNSPEC_MASKOP)]=0A= "TARGET_AVX512BW"=0A= "kunpckdq\t{%2, %1, %0|%0, %1, %2}"=0A= [(set_attr "mode" "DI")])=0A= @@ -17400,21 +17403,26 @@=0A= })=0A= =0A= (define_expand "vec_pack_trunc_qi"=0A= - [(set (match_operand:HI 0 "register_operand")=0A= - (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 = "register_operand"))=0A= - (const_int 8))=0A= - (zero_extend:HI (match_operand:QI 1 "register_operand"))))]=0A= + [(parallel=0A= + [(set (match_operand:HI 0 "register_operand")=0A= + (ior:HI=0A= + (ashift:HI (zero_extend:HI (match_operand:QI 2 "register_operand"))=0A= + (const_int 8))=0A= + (zero_extend:HI (match_operand:QI 1 "register_operand"))))=0A= + (unspec [(const_int 0)] UNSPEC_MASKOP)])]=0A= "TARGET_AVX512F")=0A= =0A= (define_expand "vec_pack_trunc_"=0A= - [(set (match_operand: 0 "register_operand")=0A= - (ior:=0A= - (ashift:=0A= + [(parallel=0A= + [(set (match_operand: 0 "register_operand")=0A= + (ior:=0A= + (ashift:=0A= + (zero_extend:=0A= + (match_operand:SWI24 2 "register_operand"))=0A= + (match_dup 3))=0A= (zero_extend:=0A= - (match_operand:SWI24 2 "register_operand"))=0A= - (match_dup 3))=0A= - (zero_extend:=0A= - (match_operand:SWI24 1 "register_operand"))))]=0A= + (match_operand:SWI24 1 "register_operand"))))=0A= + (unspec [(const_int 0)] UNSPEC_MASKOP)])]=0A= "TARGET_AVX512BW"=0A= {=0A= operands[3] =3D GEN_INT (GET_MODE_BITSIZE (mode));=0A= ------=_NextPart_000_028F_01D89925.EC7AF370--