From patchwork Sun Sep 29 17:59:24 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: 1990637 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=tIFhRtXl; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=saOZGi5N; 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 4XGsRW3QQMz1xt8 for ; Mon, 30 Sep 2024 03:59:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2032A385EC29 for ; Sun, 29 Sep 2024 17:59:49 +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.217]) by sourceware.org (Postfix) with ESMTPS id DF303385DDDB for ; Sun, 29 Sep 2024 17:59:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF303385DDDB 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 DF303385DDDB Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.217 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1727632770; cv=pass; b=gxBG5ln4isj2P1faN3hi6GSdcPYCZoluN4dADdH5xaUS5+4rzVLhiLHSnY6oCzugabiwaPeSPzdMvV+TmOooozAo8a9Z8Tk1yN2/bGUQH0LKdW/NtZxNqI+HqAi9VRdbbJvCxnJOhIE6e2vK7BuQXZoRV6oV2WoWGAEutJzCu+A= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1727632770; c=relaxed/simple; bh=CCWSK6mU1WO31lrxWTGanF34uMeHLnU0+6j+s+1v/Bs=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:From:To; b=XcZIhkD4YAdhXbz8jukjGoA0hw1QWcV0YBTpV2xqUd6FLnhSXMuOFoQYxu2Lv5zfW+Ekepxw53DaQdYgOcR66odxHd7h/oh7n3UVxMJefpPwpHFEVmF6kdkVjoq+1740sf0675Eb/YqE4VkGNdzq0wzdvNMM9HcvqhiNY8qpJAE= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1727632766; cv=none; d=strato.com; s=strato-dkim-0002; b=fvzHugycM0e7mFKNRH3LbW3waI+onEvdpGY2Z6mxClGMetndSu7oEqKruQkIFUJLUy S+jz7FuoeEPHg1HXxccLJEvjLt712OX9exhtjziiHow7dE7nSQFEzep48IaLoDPW3SUK 3hG6cCBijs+VCg2+Rlw6QNCc8Akm8xwz314wnc3qXYJJfZz3fTFZefG2zL7riO/tbqWD /KfsOFUOwKkm27ThjRc3CUOrmcH9BHZtoE+HRiYZ6rV3ij4M9aW6vbqIGMxBCk1ef0q/ KvQjZbADIeKdGpZvEK3MxqnbljicQvUOrAufKrpUE3PGYdG0JRRLAMySyfbK560qmiwR mTRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1727632766; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:References:To:From:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=0OSZK0ksmz1dmPmC8yCXMM+0wDLro1blj5b8mqI2BzU=; b=FnYVgYukF9ZnblFQRjsBKjXtag3Jeztua5QaFiouBbjz78oqtGcGRO5MWQdYKjX02m fga4PA9fhhnq19DZ3WnscuBzxXII7PBocDS0LrsyHjz0mPHwa3Vyyf8ns2048mwFeFCQ 8iejnTH1LCNZg3xahBg4/0rCirisD20jEwyIax/w6SqPeKrPCfm7amkwgKIAoKqZwIam qIARWTw/4CDbt2FMF04CE5BYRGZJRlNd+UBgERUH2xtsxPO0xf6ddFsQ+idlHSjR1iJg rIwRT//DkDP3F3Rv8JwwF2KU+av4wJqQ5MvlxNNNJ8fvzIWyvQ7wEzDIyn5rLbSUTIM+ dCRA== 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=1727632766; s=strato-dkim-0002; d=gjlay.de; h=In-Reply-To:References:To:From:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=0OSZK0ksmz1dmPmC8yCXMM+0wDLro1blj5b8mqI2BzU=; b=tIFhRtXlZp6wVqsd9X34Viw6O1NmewrxlAXlIvL3DBIww1X0GVgftwoP3ct39FXxAC Zq3fuycE8k0AimTxpPKAISQb0G69DRpeGlErSqkvHl97PL7WWXCf+jYvf7lVHsRrx5oo DHzFgy5uYu+qiBIo6hdmfrblabWMEmedT9BWYyP/Rz+FVnTC23LaOYOpisZcbG36QF9l CGc30qLVSY7vjHDKoi7N4PtFxqxWBDDv7aI0xSqvDZeeK11nckQ0icryfhFLPKxdlZmu AoKlMkvWMNzwKOVojWsa2WhIWN5FnTqNF0OXogHPVp552is30374LBBcqpeO4d24TIqa 4Jdg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1727632766; s=strato-dkim-0003; d=gjlay.de; h=In-Reply-To:References:To:From:Subject:Date:Message-ID:Cc:Date:From: Subject:Sender; bh=0OSZK0ksmz1dmPmC8yCXMM+0wDLro1blj5b8mqI2BzU=; b=saOZGi5N5ERZb8sQJauuDgqsxd+WcIqYXCqf439sQZgpVf8uQtrvGYLTZtn9uQZDaW pHgUIOzTlgPgSD1lwtDA== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKXKoq0dKoR0vetzhr/2IDlGFRklUq" Received: from [192.168.2.102] by smtp.strato.de (RZmta 51.2.8 DYNA|AUTH) with ESMTPSA id x2e25d08THxPiRy (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 29 Sep 2024 19:59:25 +0200 (CEST) Message-ID: Date: Sun, 29 Sep 2024 19:59:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [patch,avr] Use (symbol_ref { code }) in insn length computation. From: Georg-Johann Lay To: Richard Sandiford , "gcc-patches@gcc.gnu.org" , Denis Chertykov References: <020fd262-e19b-4c68-ab3d-04356bc6ca0b@gjlay.de> Content-Language: en-US In-Reply-To: <020fd262-e19b-4c68-ab3d-04356bc6ca0b@gjlay.de> 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_MSPIKE_H4, 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 This patch uses the new gensupport feature (review pending) that allows to provide a block of C++ code in a symbol_ref sub-expression instead of just a C++ expression: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/664093.html Ok for trunk (provided the gensupport part is upstream) ? Johann --- AVR: Use (symbol_ref { code }) in attribute "length" computation. The symbol_ref sub-expression of an insn attribute may host the body of a C++ function provided (symbol_ref { code }) is used. gcc/ * config/avr/avr-protos.h (avr_len_op8_set_ZN): Remove. * config/avr/avr.cc (avr_len_op8_set_ZN): Remove. * config/avr/avr.md (*op8.for.cczn.): Compute attribute "length" with the help of a symbol_ref that hosts the body of a C++ function. diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 96708eb4db5..71514a37812 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -64,7 +64,6 @@ extern const char *avr_out_extr_not (rtx_insn *, rtx*, int*); extern const char *avr_out_plus_set_ZN (rtx*, int*); extern const char *avr_out_plus_set_N (rtx*, int*); extern const char *avr_out_op8_set_ZN (rtx_code, rtx*, int*); -extern int avr_len_op8_set_ZN (rtx_code, rtx*); extern bool avr_op8_ZN_operator (rtx); extern const char *avr_out_cmp_ext (rtx*, rtx_code, int*); diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index c0bf1320fdd..bbc9b278511 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -8958,18 +8958,6 @@ avr_out_op8_set_ZN (rtx_code code, rtx *xop, int *plen) } -/* Used in the "length" attribute of insn "*op8.for.cczn.". */ - -int -avr_len_op8_set_ZN (rtx_code code, rtx *xop) -{ - int len; - (void) avr_out_op8_set_ZN (code, xop, &len); - - return len; -} - - /* Output bit operation (IOR, AND, XOR) with register XOP[0] and compile time constant XOP[2]: diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index aae8a696a63..84023866b30 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -7337,7 +7337,12 @@ (define_insn "*op8.for.cczn." return avr_out_op8_set_ZN (, operands, nullptr); } [(set (attr "length") - (symbol_ref "avr_len_op8_set_ZN (, operands)"))]) + (symbol_ref + { + int len; + avr_out_op8_set_ZN (, operands, &len); + return len; + }))]) ;; Test a single bit in a QI/HI/SImode register.