From patchwork Wed Aug 5 13:18:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 1341238 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BMByy0nGHz9sPB for ; Wed, 5 Aug 2020 23:18:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 60AFC385043E; Wed, 5 Aug 2020 13:18:47 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 7FFD53851C17 for ; Wed, 5 Aug 2020 13:18:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 7FFD53851C17 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Andrew_Stubbs@mentor.com IronPort-SDR: 12IlLRY2+mZ48auodj8+WqS0qbuESoDHBnLHOO7dxLaxLg2BRloiR32vCgrM0vV3kct4qciiQK Aeb9zULz95rcvjPHJZGoDZc7Tjoz/hYFjYXpej+u7zVhIPiVwZq9Mh0O21dj5NusNESuBvHtxL R9t0U2RU9da2D/O6Dfz55t32pxBjETZYvILxQzX0Njo9SjC3xfCh4Q4CsGA1SJc+RAIq9rhr/v WiN6y357EYJfIhJqlJDT/Kcx3W21HI/ODvaKDbm/x+JzcghcnVMiLWRdfA3r1GNnqDCZFM3VSv 8m0= X-IronPort-AV: E=Sophos;i="5.75,436,1589270400"; d="scan'208";a="51616935" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 05 Aug 2020 05:18:43 -0800 IronPort-SDR: z9HtemThrHc3rC3tN3rP35M7BqLH48YwG5RtXF6gINP4Gg5YDSUSBMMIzaFrSMsnP+L1x618zi fiNHkpB5aIoRhExndtpW7g01IgofZfRVDaNGltSux0eUa/AtutfHQH4hK6RXmqy5loOcDxcLlC +j2G7nw/zZlyNpaqY8doa3zKf6QdOKxZPzYonIeXSN2lKmJoMBmfvJiZ7fOTSW+QEnDqZBHSQ4 +9ejEAqO75kw0LPe5ECLiZK9zv4umQMS5H6fNz63Vi5u0Ia6aC7VnZNtLeKeyCDBR3z9Vcsfo8 aIY= From: Andrew Stubbs Subject: [PATCH] emit-rtl.c: Allow vector subreg of float vectors To: "gcc-patches@gcc.gnu.org" Message-ID: <8f29097a-3690-5a60-ffb5-09382ed2f92e@codesourcery.com> Date: Wed, 5 Aug 2020 14:18:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-GB X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" This patch is a prerequisite for some patches I have to add multiple vector sizes on amdgcn. The problem is that validate_subreg rejects things like this: (subreg:V32SF (reg:V64SF) 0) These are commonly generated by the compiler. The integer equivalents work fine. To be honest, I don't know why other targets have not encountered this problem before? Perhaps because most other targets require all vectors to have the same number of bits, meaning that float vectors have a fixed number of lanes? In my case, amdgcn can convert V64SFmode to V32SFmode by simply masking off some lanes. OK to commit? (I have an x86_64 bootstrap and test in progress.) Andrew Allow vector subreg of float vectors Integer vector subregs were already permitted. gcc/ChangeLog: * emit-rtl.c (validate_subreg): Permit sections of float vectors. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index f9b0e9714d9..d7067989ad7 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -947,6 +947,11 @@ validate_subreg (machine_mode omode, machine_mode imode, else if (VECTOR_MODE_P (omode) && GET_MODE_INNER (omode) == GET_MODE_INNER (imode)) ; + /* Allow sections of vectors, both smaller and paradoxical. (This just + works for integers, but needs to be explicitly allowed for floats.) */ + else if (VECTOR_MODE_P (omode) && VECTOR_MODE_P (imode) + && GET_MODE_INNER (omode) == GET_MODE_INNER (imode)) + ; /* Subregs involving floating point modes are not allowed to change size. Therefore (subreg:DI (reg:DF) 0) is fine, but (subreg:SI (reg:DF) 0) isn't. */