From patchwork Thu Aug 8 16:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 1970656 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gjlay.de header.i=@gjlay.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=f2rTutoN; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=zPETrosQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WftZ95HPnz1yf8 for ; Fri, 9 Aug 2024 02:59:45 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 89675385842D for ; Thu, 8 Aug 2024 16:59:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.163]) by sourceware.org (Postfix) with ESMTPS id 26EE23858432 for ; Thu, 8 Aug 2024 16:59:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 26EE23858432 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 26EE23858432 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.163 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1723136355; cv=pass; b=jjp6cwHghJpiW5flFHsgFBy+oUE+0cpKLfZCqsbG4IelvjqmHz/Ftqdf3YR1J7cuZp5MXvIIV9R/hVj/Fz7HjGOKoTYvuexo9VaMMOluyq6JIzYTBtufe9/l4Q1pju3BX/Z7rT/0nlbOIwQhkwxsyJyEer+AuoTGoodE6GbitMw= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1723136355; c=relaxed/simple; bh=90aOXpnjcSCK7xKOutMff7h848ePPGkpbwetNSsLJig=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=hJjwhNxEKqbVo68x931X0xcuOrrUbiCGp12IzllV/C4/+/qcnu6Ef+aoVZW9MUUBPfafO8S4cEgk4zW4kIbgtEiqa3n62Ky76+ImadUlqhtZCqBip9pGe4wySUxxltTUVhLzp/olGHkTVTX4qIMYUcurSgu43+X2nBWlQfQlYfA= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1723136352; cv=none; d=strato.com; s=strato-dkim-0002; b=LG5G+4hJ0sqe4r4Rdr/+/tdnGXNcgkaJ412heWawuL16VkSpuSjklAJc4mX+8dAHhK m//R+5rO4/MO7wM61nnSkKujOniv70d5FEh2jf0H0vddzenhyn1sxQMWxckgzvJdTVzL fsItftdX8kCgy18u2bdMIjOQiMevX3nU1aoJJckbYDEzAyxLaxpHx9wX/fM+TXYMbApF WTyFryOtkt8gAx+vWbUuNJZBumnQF7+O2trqanFqKbwevAeCiYTy8E/LpebZE1QwDnMk FLoSKr9zLT15QehEeEwoiTXCDF68NdY0ZNQBHa6il20EEQg+R0unpaxDo2q+CnPPRvFc tCUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1723136352; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=l20rn9jcTmotbEmbQmm9/qoAf0Z49KM9CBOum3Ao1mc=; b=XlFumKe2sF/HFjO+FmV9dUtqoFIjNNdE0u3th9rPSz7dY1VgVOVJgurjtDjSz/8bEm ja4MuSWGNzJB6NNC15WEGEBH2DENZTovdLtcM5VZ0Ymoe6aUIQoMKd+jM8hY+MDjUSiC Xu0wM7+799dztWhZdqgcPaJ2sKkKaL01V9f/hMvMrFrjIfDY0sEvZt5ss7U/1KQ9Hixe OMuGL2+KrCMRe+EIchMxqsjNMaAJ3RMTVYqqbjyiHdiT8tWA+FVla71VPjIFmaRQ6iEy gbkRnDhtgArgyiQc+4P2gNHR4yXvABhqok9O4VaPBOxK6QE8Svnr/Pu0mU03RpHhwRkU f2Cw== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1723136352; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=l20rn9jcTmotbEmbQmm9/qoAf0Z49KM9CBOum3Ao1mc=; b=f2rTutoNeWzAwFdTGRnOoY5WMUhvxF/RsCRAMggoJ+rxvuUdlaOUnfjBkVEM4IaIoG VBxWc3x5qmwt2r4MoXtF5jgI1C04tQGx5UnpKCZd4pddDZhabhILreNYG9xNINYqYw3q AcfWUWNI7SdzsKiQzWdgIjK0h5twCxjDWJ3PqZHmfUbz5o5HGB1KnJL9HkU58H5HVi1e 1y7NrsbqsLmpNlq03TOg/fBawhuc5rszryFaP4XLMgXHthNXl0eTAU1usj5KgRZ/P9ii mhXs4nLDQcefANjtQ6EqFLwKK9uuPX00QpPA56etc7gsYmngv/oXby0ubs49I1hYksfC I7vA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1723136352; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=l20rn9jcTmotbEmbQmm9/qoAf0Z49KM9CBOum3Ao1mc=; b=zPETrosQl32BocYpZWZneKXqwnplNn8Na/7UTIhD6Bdauo+I9FtSvdOKIZh/aj6a54 8xmvqtbWvWzIXG5cwBCQ== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKXKoq0dKoR0vetzhr/2IDlGFRklUq" Received: from [192.168.2.102] by smtp.strato.de (RZmta 51.1.0 DYNA|AUTH) with ESMTPSA id xa21ea078GxBoD7 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Thu, 8 Aug 2024 18:59:11 +0200 (CEST) Message-ID: <0acb4e37-1a2f-44b5-a1a4-911f17a8dc23@gjlay.de> Date: Thu, 8 Aug 2024 18:59:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Georg-Johann Lay Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Subject: [patch,avr,applied] Fix target/116295 unrecognizable insn X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, 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 Applied this fix to trunk and v14 branch. Johann --- AVR: target/116295 - Fix unrecognizable insn with __flash read. Some loads from non-generic address-spaces are performed by libgcc calls, and they don't have a POST_INC form. Don't consider such insns when running -mfuse-add. PR target/116295 gcc/ * config/avr/avr.cc (Mem_Insn::Mem_Insn): Don't consider MEMs that are avr_mem_memx_p or avr_load_libgcc_p. gcc/testsuite/ * gcc.target/avr/torture/pr116295.c: New test. diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index 0b3fd7a36d0..5cfd67a8e74 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -2121,6 +2121,10 @@ avr_pass_fuse_add::Mem_Insn::Mem_Insn (rtx_insn *insn) else return; + if (avr_mem_memx_p (mem) + || avr_load_libgcc_p (mem)) + return; + addr = XEXP (mem, 0); addr_code = GET_CODE (addr); diff --git a/gcc/testsuite/gcc.target/avr/torture/pr116295.c b/gcc/testsuite/gcc.target/avr/torture/pr116295.c new file mode 100644 index 00000000000..0b3d380ff14 --- /dev/null +++ b/gcc/testsuite/gcc.target/avr/torture/pr116295.c @@ -0,0 +1,22 @@ +/* { dg-do link } */ +/* { dg-additional-options "-std=gnu99" } */ + +#ifdef __FLASH + +long val; + +__attribute__((used)) +const __flash long* +load4_flash (const __flash long *p) +{ + val += *p++; + val += *p++; + return p; +} + +#endif + +int main (void) +{ + return 0; +}