From patchwork Tue Aug 6 19:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 1969664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WdjWH4yzxz1ydt for ; Wed, 7 Aug 2024 05:08:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E484F3858C56 for ; Tue, 6 Aug 2024 19:08:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from dellerweb.de (dellerweb.de [173.249.48.176]) by sourceware.org (Postfix) with ESMTPS id A7CF13858C56 for ; Tue, 6 Aug 2024 19:07:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7CF13858C56 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=parisc-linux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=parisc-linux.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A7CF13858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=173.249.48.176 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722971273; cv=none; b=lOcqir74IobUquZT9EE8RfOwkCEU78+FANzrNIZzlgn+PXzgVRq4wkpcRUeAXFofglVSoXrLi1ohFz/jusVr8bBx5t2n1BSh3xjNY6jecWpGh6xovy0w/CVIEp48fIQn15YskxurmS4XpzBgIEmr3dvsEp3v9lw2amENbtOl0pU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722971273; c=relaxed/simple; bh=ey+GkGlpU/vsyMeqftRZl13PkKFA26Pm7QQN9chWoJo=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=wqzVcBuzyCMgUsqWE6KoeclY+E1kk2lD5DxvRJbgBTNqENNeSL4bkuofA7Jb0PprH23dVAfyIfHU889FUDw4LrPMv96g1/EaleKFtkb/o6tRUrfIECtZP5CG/O/399paO1AWDqXppkYTqdMvD4+L7W7IISgnFlv6SRFay18lPwY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mx3210.localdomain (unknown [76.71.115.75]) by dellerweb.de (Postfix) with ESMTPSA id 452CD1600165; Tue, 6 Aug 2024 21:07:49 +0200 (CEST) Received: by mx3210.localdomain (Postfix, from userid 1000) id 7F847D60104; Tue, 6 Aug 2024 15:07:47 -0400 (EDT) Date: Tue, 6 Aug 2024 15:07:47 -0400 From: John David Anglin To: GCC Patches Subject: [committed] hppa: Fix (plus (plus (mult (a) (mem_shadd_constant)) (b)) (c)) optimization Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Tested on hppa-unknown-linux-gnu. Committed to active branches. Dave --- hppa: Fix (plus (plus (mult (a) (mem_shadd_constant)) (b)) (c)) optimization The constant C must be an integral multiple of the shift value in the above optimization. Non integral values can occur evaluating IMAGPART_EXPR when the shadd constant is 8 and we have SFmode. 2024-08-06 John David Anglin gcc/ChangeLog: PR target/113384 * config/pa/pa.cc (hppa_legitimize_address): Add check to ensure constant is an integral multiple of shift the value. diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc index ab4bfc5d0c2..7b222875247 100644 --- a/gcc/config/pa/pa.cc +++ b/gcc/config/pa/pa.cc @@ -1410,6 +1410,7 @@ hppa_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, /* If the index adds a large constant, try to scale the constant so that it can be loaded with only one insn. */ if (GET_CODE (XEXP (idx, 1)) == CONST_INT + && INTVAL (XEXP (idx, 1)) % (1 << shift_val) == 0 && VAL_14_BITS_P (INTVAL (XEXP (idx, 1)) / INTVAL (XEXP (XEXP (idx, 0), 1))) && INTVAL (XEXP (idx, 1)) % INTVAL (XEXP (XEXP (idx, 0), 1)) == 0)