From patchwork Fri Oct 23 06:45:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 1386530 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=I1ttScFi; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4CHZVV1p5bz9sTD for ; Fri, 23 Oct 2020 17:45:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DC17E3858002; Fri, 23 Oct 2020 06:45:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC17E3858002 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1603435516; bh=TO/SANsLJbHpvkhSOpa5wXMM8/vznqSR4AdFvjnQI2g=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=I1ttScFiwoyz11VofBsWsvrp8jq8qFLvh/sNihzG/uWRNQI0c8k0iyDdhrq6wMlD/ aPZ+aIMZliEroKn0oNzu3Twk0RG8y48KPYkxsnIYt7jMDy7me1bHbYW/J8tSWLLBuk fkNn9ozyDvMSV9C5YVo47Uay0FhNwsDiPdZw0/9s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id EF3953858002 for ; Fri, 23 Oct 2020 06:45:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EF3953858002 Received: by mail-pg1-x52e.google.com with SMTP id x13so451381pgp.7 for ; Thu, 22 Oct 2020 23:45:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=TO/SANsLJbHpvkhSOpa5wXMM8/vznqSR4AdFvjnQI2g=; b=C9o5gcPNdH5gHD9QDjceaNRFNr6D/XUV6D5N7MgjKU+DFJM0ydduPVcbgn6UmIoKtn jWv4oK0XWkP2ztJyut0zUBKn7ZmgWVNMzHEBEZHzE0e9sUFpqtvFCW1QIoGSWIHmzQzS 6tInD1SRiRiZpyDv3EQPFyCGsJ0rr2awyMa8p0CLihfRtrVE4sSwqf5i8ExR0SKWKxd7 CKt/Hxw97QU3w18t3+uvvQAOmRsmzJO6HQcEgLIPVBvtHukVGMAzOFJRSkIx7pNz+npd xo8szQtT8PKNnznn+IHNCZqGYx7+qygQbwDncMqyWs2XxPetNVoAFKOpT6r8gAfpfMSg BQKQ== X-Gm-Message-State: AOAM532OPt4lyomoLiijPJyPLmKiPjkFDaSZPMR6rMwTNvtarMzLWjZ+ OQzj+1L5A33H3Tz+z04wONu/W0YEyzyQ2Q== X-Google-Smtp-Source: ABdhPJy/Li+ToE7Ds45qfyv+3jXZJ1oSQtTwRzqwg7b3N5IjWLO21FDLB5SmMRWOol84z042h1/H8w== X-Received: by 2002:a17:90a:4213:: with SMTP id o19mr899037pjg.62.1603435512586; Thu, 22 Oct 2020 23:45:12 -0700 (PDT) Received: from bubble.grove.modra.org ([2406:3400:51d:8cc0:8c91:1a62:b340:826d]) by smtp.gmail.com with ESMTPSA id cs21sm1496415pjb.0.2020.10.22.23.45.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2020 23:45:11 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 3E9FE84B64; Fri, 23 Oct 2020 17:15:08 +1030 (ACDT) Date: Fri, 23 Oct 2020 17:15:08 +1030 To: gcc-patches@gcc.gnu.org Subject: [RS6000] altivec style lvx/stvx addresses vs power10 Message-ID: <20201023064508.GS4898@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: , X-Patchwork-Original-From: Alan Modra via Gcc-patches From: Alan Modra Reply-To: Alan Modra Cc: Segher Boessenkool Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" gcc.target/powerpc/fold-vec-st-pixel.c and other testcases fail on power10, generating addi 9,5,12 rldicr 9,9,0,59 stxv 34,0(9) rather than addi 5,5,12 stvx 2,0,5 for an altivec lvx/stvx style address. The problem starts with fwprop creating (insn 9 4 0 2 (set (mem:V8HI (and:DI (plus:DI (reg/v/f:DI 121 [ vpp ]) (const_int 12 [0xc])) (const_int -16 [0xfffffffffffffff0])) [0 MEM [(void *)_4 & -16B]+0 S16 A128]) (reg/v:V8HI 120 [ vp1 ])) "pixel.c":6:10 1237 {vsx_movv8hi_64bit} which is finally thrown out as invalid by lra. lra of course does that by reloading the entire address. fwprop creates the invalid address due to rs6000_legitimate_address_p trimming off the outer AND of altivec style addresses before applying other predicates. address_is_prefixed then allows the inner address. Now at the time the AND stripping was added (git commit 850e8d3d56d), rs6000_legitimate_address looked a lot simpler. This patch allows through just those addresses that were legitimate in those simpler days. (legitimate_small_data_p, legitimate_constant_pool_address_p, legitimate_lo_sum_address_p, and legitimate_offset_address_p did get to look at the inside of an AND address, but I'm fairly certain small_data, constant_pool and lo_sum addresses would never be wrapped in an AND, and offset_address_p of that time excluded altivec modes.) Regstrapped powerpc64le-linux power8 and power10, with tests on powerpc64-linux -m64/-m32 still running. OK assuming they pass? * config/rs6000/rs6000.c (rs6000_legitimate_address_p): Limit AND addressing to just lvx/stvx style addresses. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 2f0ca7af030..7fd80fb75ff 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -9128,15 +9128,21 @@ rs6000_legitimate_address_p (machine_mode mode, rtx x, bool reg_ok_strict) bool reg_offset_p = reg_offset_addressing_ok_p (mode); bool quad_offset_p = mode_supports_dq_form (mode); - /* If this is an unaligned stvx/ldvx type address, discard the outer AND. */ + if (TARGET_ELF && RS6000_SYMBOL_REF_TLS_P (x)) + return 0; + + /* Handle unaligned altivec lvx/stvx type addresses. */ if (VECTOR_MEM_ALTIVEC_OR_VSX_P (mode) && GET_CODE (x) == AND && CONST_INT_P (XEXP (x, 1)) && INTVAL (XEXP (x, 1)) == -16) - x = XEXP (x, 0); + { + x = XEXP (x, 0); + return (legitimate_indirect_address_p (x, reg_ok_strict) + || legitimate_indexed_address_p (x, reg_ok_strict) + || virtual_stack_registers_memory_p (x)); + } - if (TARGET_ELF && RS6000_SYMBOL_REF_TLS_P (x)) - return 0; if (legitimate_indirect_address_p (x, reg_ok_strict)) return 1; if (TARGET_UPDATE