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 63DBA3858D39 for ; Mon, 1 Aug 2022 13:43:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 63DBA3858D39 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=oo5iyc3fj/LS0Z+o6foxYzgSjxIp6ag2HrDla/vXzrA=; b=CbdB8UoRjminAeV5yIqxopL9Ar rInmZuhkAlYqv482XKWavg417Y3BOwE0KO9Wx0d5MJ+sBYEJJ+XXCUMC8Tk4EAJjDSELv2jvALH8a 03gGGzU+s/BUdzfBsCzFL2ZeZgwYPpKMwTP1kv83M8rVBW5t4nttcVBocWu0w9YDR4uFnTwi4QNQX o6eRtRflpZNOEbYtIPMcEZy1n37zyY2RrS9RvvUyTU3N4FmUDDdpK3frrWMkTzdAs4a70D2s10IHH r47PgBvwu1d5sfHYaKcOVyzlhe6BgAR7gKIwnVOhCdK4mmsYKoKbbSVOqA8Gx8LCp+U6C6rgTw2pE sz9rElKA==; Received: from [185.62.158.67] (port=58119 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 1oIViA-0003cF-IK; Mon, 01 Aug 2022 09:43:58 -0400 From: "Roger Sayle" To: "'GCC Patches'" Subject: [x86_64 PATCH] PR target/106481: Handle CONST_WIDE_INT in REG_EQUAL during STV. Date: Mon, 1 Aug 2022 14:43:56 +0100 Message-ID: <01fd01d8a5ac$bfe5dc60$3fb19520$@nextmovesoftware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_01FE_01D8A5B5.21AB55D0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: Adilq8IJHKg2Ts+rToGOKkMWH9ODsg== 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=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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: Mon, 01 Aug 2022 13:44:01 -0000 This is a multipart message in MIME format. ------=_NextPart_000_01FE_01D8A5B5.21AB55D0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit This patch resolves PR target/106481, and is an oversight in my recent battles with REG_EQUAL notes during TImode STV (see PR target/106278 https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598416.html). The patch above's/current behaviour is that we check that the mode of the REG_EQUAL note is TImode before using PUT_MODE to set it to V1TImode. However, the new test case reveals that this doesn't consider REG_EQUAL notes that are CONST_INT or CONST_WIDE_INT, i.e. that are VOIDmode, and so STV produces: (insn 85 84 86 2 (set (reg:V1TI 113) (reg:V1TI 84)) "pr106481.c":13:3 1766 {movv1ti_internal} (expr_list:REG_EQUAL (const_wide_int 0x0ffffffff00000004) (nil))) which causes problems as the const_wide_int isn't a valid immediate constant for V1TImode. With this patch, we now generate the correct: (insn 85 84 86 2 (set (reg:V1TI 113) (reg:V1TI 84)) "pr106481.c":13:3 1766 {movv1ti_internal} (expr_list:REG_EQUAL (const_vector:V1TI [ (const_wide_int 0x0ffffffff00000004) ]) (nil))) 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-08-01 Roger Sayle gcc/ChangeLog PR target/106481 * config/i386/i386-features.cc (timode_scalar_chain::convert_insn): Convert a CONST_SCALAR_INT_P in a REG_EQUAL note into a V1TImode CONST_VECTOR. gcc/testsuite/ChangeLog PR target/106481 * gcc.target/i386/pr106481.c: New test case. Thanks again, Roger -- ------=_NextPart_000_01FE_01D8A5B5.21AB55D0 Content-Type: text/plain; name="patchvw2.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patchvw2.txt" diff --git a/gcc/config/i386/i386-features.cc = b/gcc/config/i386/i386-features.cc=0A= index aa5de71..c1564c4 100644=0A= --- a/gcc/config/i386/i386-features.cc=0A= +++ b/gcc/config/i386/i386-features.cc=0A= @@ -1355,6 +1355,10 @@ timode_scalar_chain::convert_insn (rtx_insn *insn)=0A= tmp =3D find_reg_equal_equiv_note (insn);=0A= if (tmp && GET_MODE (XEXP (tmp, 0)) =3D=3D TImode)=0A= PUT_MODE (XEXP (tmp, 0), V1TImode);=0A= + else if (tmp && CONST_SCALAR_INT_P (XEXP (tmp, 0)))=0A= + XEXP (tmp, 0) =3D gen_rtx_CONST_VECTOR (V1TImode,=0A= + gen_rtvec (1,=0A= + XEXP (tmp, 0)));=0A= }=0A= break;=0A= case MEM:=0A= diff --git a/gcc/testsuite/gcc.target/i386/pr106481.c = b/gcc/testsuite/gcc.target/i386/pr106481.c=0A= new file mode 100644=0A= index 0000000..8cc7048=0A= --- /dev/null=0A= +++ b/gcc/testsuite/gcc.target/i386/pr106481.c=0A= @@ -0,0 +1,17 @@=0A= +/* { dg-do compile { target int128 } } */=0A= +/* { dg-options "-O2 -fno-dce -fno-forward-propagate = -fno-rerun-cse-after-loop -Wno-psabi" } */=0A= +=0A= +typedef int V __attribute__((vector_size (64)));=0A= +typedef __int128 W __attribute__((vector_size (64)));=0A= +=0A= +W w;=0A= +V bar (void);=0A= +=0A= +void=0A= +foo (V v, W)=0A= +{=0A= + foo ((V){4, ~0}, (W) v);=0A= + foo (v, w);=0A= + bar ();=0A= +}=0A= +=0A= ------=_NextPart_000_01FE_01D8A5B5.21AB55D0--