From patchwork Sat Jul 16 14:08:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Sayle X-Patchwork-Id: 28 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp936108eik; Sat, 16 Jul 2022 07:09:11 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vsFFIdt8deJG6MhhzSg2sVCkRluY3KoRbT+GCTwJVkwDzoV4cX48P+d7+VpVIj6GarAJki X-Received: by 2002:aa7:d044:0:b0:43b:47c9:4310 with SMTP id n4-20020aa7d044000000b0043b47c94310mr8668950edo.120.1657980551752; Sat, 16 Jul 2022 07:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657980551; cv=none; d=google.com; s=arc-20160816; b=zUy6hkkpJyKKqDn8tUu5R6czkeWZdvWAeROdLoLEg2AF2FHQXsfNEWnjpXrRkJ1I6F PiWRnAlP1n9Vqd+cXqgHQtg57QY6QCKoLZhj0P5OSQp/XhlFp48R5uT4qa8JZFikGnMo J0ayIPLnUA18dLo/YnnKaAIcypARqtIZZhL1ZJ//QwzzvbzHc1deu6I/UD5n3iFs+S7X dW4k9dwPEvQGr5dw/SDssm6bVNv9n40Fxaugof/lh10HdtF0RNs7RnAEyH/0gX5C/7UR sb6+QREBDL29vw1SnOhz1ly5CkqaiRB7mCYgUZw5ersm1S7knhCFL8M+nu2R80e4TALO zbDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-language:thread-index :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=CdazAu0WXax768LxK357Kgkz+ab4NDYQTR7Y+tzlQQk=; b=VqJabNS7XbYLZH6baabR06WksZcqf8PBZR4Infm5Brf6MBJe4uJtjtcqMbVSScJUdl nbqR2f3JVCZ3cIeBfApG+ZWHi/NkUlJet3fp0SG6IPxL/NNB0hFF7ZmNTH8NweO/K0vQ UjDMsVAIn0B3tki8A9amZElJ3X1ebb7AVU48UrbmiiW6XgVCh80Y5C587kgKbBr7RhxB /MPa1TYCv1GMJ53Fw+7hzNnWbGSmE3fRMEmcNprsoYq9s1ovSW6XZDbECyQ7OErqlNeD GbzOZBd01b/N4IdsiUtIEntMpWiWfNeZhsnggrZ3cSiQdqpaVpbeaET96kgY+jTqJYqf cSfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=lMRKNvVB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id oz40-20020a1709077da800b00722fb07523asi10613644ejc.614.2022.07.16.07.09.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 07:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@nextmovesoftware.com header.s=default header.b=lMRKNvVB; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CDAFF3858280 for ; Sat, 16 Jul 2022 14:09:03 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-LABELS: =?utf-8?b?IlxcSW1wb3J0YW50Ig==?= X-GMAIL-THRID: =?utf-8?q?1738518615457152482?= X-GMAIL-MSGID: =?utf-8?q?1738518615457152482?= 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 diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 62688f8..da50ffa 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -2072,7 +2072,8 @@ (ashift:HI (zero_extend:HI (match_operand:QI 1 "register_operand" "k")) (const_int 8)) - (zero_extend:HI (match_operand:QI 2 "register_operand" "k"))))] + (zero_extend:HI (match_operand:QI 2 "register_operand" "k")))) + (unspec [(const_int 0)] UNSPEC_MASKOP)] "TARGET_AVX512F" "kunpckbw\t{%2, %1, %0|%0, %1, %2}" [(set_attr "mode" "HI") @@ -2085,7 +2086,8 @@ (ashift:SI (zero_extend:SI (match_operand:HI 1 "register_operand" "k")) (const_int 16)) - (zero_extend:SI (match_operand:HI 2 "register_operand" "k"))))] + (zero_extend:SI (match_operand:HI 2 "register_operand" "k")))) + (unspec [(const_int 0)] UNSPEC_MASKOP)] "TARGET_AVX512BW" "kunpckwd\t{%2, %1, %0|%0, %1, %2}" [(set_attr "mode" "SI")]) @@ -2096,7 +2098,8 @@ (ashift:DI (zero_extend:DI (match_operand:SI 1 "register_operand" "k")) (const_int 32)) - (zero_extend:DI (match_operand:SI 2 "register_operand" "k"))))] + (zero_extend:DI (match_operand:SI 2 "register_operand" "k")))) + (unspec [(const_int 0)] UNSPEC_MASKOP)] "TARGET_AVX512BW" "kunpckdq\t{%2, %1, %0|%0, %1, %2}" [(set_attr "mode" "DI")]) @@ -17400,21 +17403,26 @@ }) (define_expand "vec_pack_trunc_qi" - [(set (match_operand:HI 0 "register_operand") - (ior:HI (ashift:HI (zero_extend:HI (match_operand:QI 2 "register_operand")) - (const_int 8)) - (zero_extend:HI (match_operand:QI 1 "register_operand"))))] + [(parallel + [(set (match_operand:HI 0 "register_operand") + (ior:HI + (ashift:HI (zero_extend:HI (match_operand:QI 2 "register_operand")) + (const_int 8)) + (zero_extend:HI (match_operand:QI 1 "register_operand")))) + (unspec [(const_int 0)] UNSPEC_MASKOP)])] "TARGET_AVX512F") (define_expand "vec_pack_trunc_" - [(set (match_operand: 0 "register_operand") - (ior: - (ashift: + [(parallel + [(set (match_operand: 0 "register_operand") + (ior: + (ashift: + (zero_extend: + (match_operand:SWI24 2 "register_operand")) + (match_dup 3)) (zero_extend: - (match_operand:SWI24 2 "register_operand")) - (match_dup 3)) - (zero_extend: - (match_operand:SWI24 1 "register_operand"))))] + (match_operand:SWI24 1 "register_operand")))) + (unspec [(const_int 0)] UNSPEC_MASKOP)])] "TARGET_AVX512BW" { operands[3] = GEN_INT (GET_MODE_BITSIZE (mode));