From patchwork Sun Mar 3 12:07:40 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: 1907259 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=HNi7ztum; dkim=pass header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=Ec1k+gGo; dkim-atps=neutral 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 4TngZZ2xbhz23qh for ; Sun, 3 Mar 2024 23:08:05 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5251A385841E for ; Sun, 3 Mar 2024 12:08:03 +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 [85.215.255.20]) by sourceware.org (Postfix) with ESMTPS id 34C2F3858C55 for ; Sun, 3 Mar 2024 12:07:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 34C2F3858C55 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 34C2F3858C55 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=85.215.255.20 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709467665; cv=pass; b=odatGz7MnhHfYx0Con6S/tg/R4L4TVZx7FqnlNhOUaq7KSOtkAp9/fq0BHL/2oxS3iYB+SXvyTA67bVURUtzXbgM721oMvYhVpQYK0EBWZHVAEVevppX3xWK17C36Tm/c0o2xffG/e7PTiLz69cqwBSMiew3H8nX2kaUBEQduf4= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1709467665; c=relaxed/simple; bh=prmQQoIIt7R3oLoU9bK4XsjksNqKiNR0+7dPL8IJw3s=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:From: To:Subject; b=gW1Fh48ZgRPqkWgR7Wy4qtfeFJ0vBif/NVMEzYX07JCdtdVcZoupmeydtcK8LfPv919ml6GX6SJV5u/TJI0dRkomr+yxcfL4TYALr8OLMUG6b6TEEXEKEdSnyzVOCyO41vR51Fyap+GEIv2bA0qGl5jteMzuj+lUgGGuTenZTbk= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1709467661; cv=none; d=strato.com; s=strato-dkim-0002; b=NQ66nVi/2uJSH4x71vaw+0iZi+76E4NfyXxq5KPv9zq1dS2FX2JCdbhAgsgIdHQ5Iw 2rRKFohU07/XuH+PuMwgL3D1XEtoBbtm/n/Xn+U1bZB83GpbPKTQqGWylvU1zqFzraeh frgzDLmfrCnL8dwk0vf0ldnGhAc8U9ucSzGjM1YEEO3mHOKZfDRe0D5Cv39VY+wfOxXu wrvmM/Bj70uHoPGenKETokVz4wZKpMWnTWGwFXFmxCoVm5jNijrjjRvBwxoqBFDv+bws vhsDtjQSbWklNAgIW6dGQrrasa+ZXJWBSO53qsgNEOq8x7qnWMdECv4m6kVgkfgNtNwg i1mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1709467661; s=strato-dkim-0002; d=strato.com; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Mb0bmVbnFDg3PRBprBz0b1gHrhQJ6kdoCRc+1A1+QXA=; b=lSDPBPUTZXM2W8Y7C/BG0ZG7sdW0ET1GCW9jxLZPzmNoGriNy+RD/iFiSX2Zkk8zdH Js3b4grk7rrpcfRnrGolH9Hg/dFnJiClIGgrvg0FDtDPEWxdLaS3mYRvcbwnSJe0SUXb +1N4ukqRwEPRJXx4Eg7M6VlG17v7CnmPmBBMw5VwK+3t6xEXfN11Bea0pJ+6Z15u4u6V 6fPZQ6R7BQ1lkErM9UVFeJjhVoR+r12l5aP7XLCzcqUMyGk5VuOKdVD9C0b8aBswQ4jq KxKV4K1QR+yljfgmxRTpxhas3elWH3O00CkgRSHtMpXbH0liag9LVOmV/F8XkGQ0Z7vl qs5Q== 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=1709467661; s=strato-dkim-0002; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Mb0bmVbnFDg3PRBprBz0b1gHrhQJ6kdoCRc+1A1+QXA=; b=HNi7ztumb5s5F7rMeFB0XZ13VATkAK87FucfWQgfxl6LFKJyFoqSvG7GJh+OiuZmOb EbBG2LtqrvhcO7uTFKsFsSWoXFmwgyaBmDz9q8wiEfzTmeuZx0zmJ6ez142ydTs20vYR zs7n6FcapkeINvgSSAaWsZxrBS0qz2dVoKUUxOArOuD8JmOu9WQR1wuW7L7eQ8xIIhhZ ijsJLrWZ4YdNQL7pXVySQdgdOcot+FdJ07oWOrnUMfXn3jDyhd6h/TGOJxgoKWJ9P76s PFmW9t5LhdCFKIbGstW6I7cqz8y33CyiTVp1og3K+/80imSX3Hb+d7tQU+sA1Yexyery EGMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1709467661; s=strato-dkim-0003; d=gjlay.de; h=Subject:To:From:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Mb0bmVbnFDg3PRBprBz0b1gHrhQJ6kdoCRc+1A1+QXA=; b=Ec1k+gGoySIT1cUVo2F0ky89Y3vWoUovqKitjh6/ccNdCh5ftGWGMM58JExEbtDJTX H3d6YmRPtfA/1VwtNLCg== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkSgcSjpmy9KwoMJ/K0VA==" Received: from [192.168.2.102] by smtp.strato.de (RZmta 50.2.0 DYNA|AUTH) with ESMTPSA id Jdfd10023C7f6FR (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Sun, 3 Mar 2024 13:07:41 +0100 (CET) Message-ID: Date: Sun, 3 Mar 2024 13:07:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Georg-Johann Lay To: "gcc-patches@gcc.gnu.org" Subject: [patch,avr,applied] ad target/92729: Remove last cc0 remains. X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 Removed the last cc0 remains. Johann --- AVR: ad target/92792 - Remove insn attribute "cc" and its (dead) uses. The backend has remains of cc0 condition code. Unfortunately, all that information is useless with CCmode, and their use was removed with the removal of NOTICE_UPDATE_CC in PR92729 with r12-226 and r12-327. gcc/ PR target/92729 * config/avr/avr.md (define_attr "cc"): Remove. * config/avr/avr-protos.h (avr_out_plus): Remove pcc argument from prototype. * config/avr/avr.cc (avr_out_plus_1): Remove pcc argument and its uses. Add insn argument. (avr_out_plus_symbol): Remove pcc argument and its uses. (avr_out_plus): Remove pcc argument and its uses. Adjust calls of avr_out_plus_symbol and avr_out_plus_1. (avr_out_round): Adjust call of avr_out_plus. diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 064a3d23322..f4f3ffd8f28 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -93,7 +93,7 @@ extern bool avr_split_tiny_move (rtx_insn *insn, rtx *operands); extern void avr_output_addr_vec (rtx_insn*, rtx); extern const char *avr_out_sbxx_branch (rtx_insn *insn, rtx operands[]); extern const char* avr_out_bitop (rtx, rtx*, int*); -extern const char* avr_out_plus (rtx, rtx*, int* =NULL, int* =NULL, bool =true); +extern const char* avr_out_plus (rtx, rtx*, int* =NULL, bool =true); extern const char* avr_out_round (rtx_insn *, rtx*, int* =NULL); extern const char* avr_out_addto_sp (rtx*, int*); extern const char* avr_out_xload (rtx_insn *, rtx*, int*); diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc index b86f4313fe2..44d6e141b62 100644 --- a/gcc/config/avr/avr.cc +++ b/gcc/config/avr/avr.cc @@ -8799,6 +8799,7 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) /* Output addition of register XOP[0] and compile time constant XOP[2]. + INSN is a single_set insn or an insn pattern. CODE == PLUS: perform addition by using ADD instructions or CODE == MINUS: perform addition by using SUB instructions: @@ -8811,7 +8812,6 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) If PLEN == NULL, print assembler instructions to perform the operation; otherwise, set *PLEN to the length of the instruction sequence (in words) printed with PLEN == NULL. XOP[3] is an 8-bit scratch register or NULL_RTX. - Set *PCC to effect on cc0 according to respective CC_* insn attribute. CODE_SAT == UNKNOWN: Perform ordinary, non-saturating operation. CODE_SAT != UNKNOWN: Perform operation and saturate according to CODE_SAT. @@ -8825,7 +8825,7 @@ lshrsi3_out (rtx_insn *insn, rtx operands[], int *len) fixed-point rounding, cf. `avr_out_round'. */ static void -avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, +avr_out_plus_1 (rtx /*insn*/, rtx *xop, int *plen, enum rtx_code code, enum rtx_code code_sat, int sign, bool out_label) { /* MODE of the operation. */ @@ -8861,8 +8861,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, if (REG_P (xop[2])) { - *pcc = MINUS == code ? (int) CC_SET_CZN : (int) CC_CLOBBER; - for (int i = 0; i < n_bytes; i++) { /* We operate byte-wise on the destination. */ @@ -8888,21 +8886,13 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, goto saturate; } - /* Except in the case of ADIW with 16-bit register (see below) - addition does not set cc0 in a usable way. */ - - *pcc = (MINUS == code) ? CC_SET_CZN : CC_CLOBBER; - if (CONST_FIXED_P (xval)) xval = avr_to_int_mode (xval); /* Adding/Subtracting zero is a no-op. */ if (xval == const0_rtx) - { - *pcc = CC_NONE; - return; - } + return; if (MINUS == code) xval = simplify_unary_operation (NEG, imode, xval, imode); @@ -8947,9 +8937,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, /* To get usable cc0 no low-bytes must have been skipped. */ - if (i && !started) - *pcc = CC_CLOBBER; - if (!started && i % 2 == 0 && i + 2 <= n_bytes @@ -8968,9 +8955,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, started = true; avr_asm_len (code == PLUS ? "adiw %0,%1" : "sbiw %0,%1", op, plen, 1); - - if (n_bytes == 2 && PLUS == code) - *pcc = CC_SET_CZN; } i++; @@ -9018,7 +9002,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, { avr_asm_len ((code == PLUS) ^ (val8 == 1) ? "dec %0" : "inc %0", op, plen, 1); - *pcc = CC_CLOBBER; break; } @@ -9077,8 +9060,6 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, if (UNKNOWN == code_sat) return; - *pcc = (int) CC_CLOBBER; - /* Vanilla addition/subtraction is done. We are left with saturation. We have to compute A = A B where A is a register and @@ -9298,7 +9279,7 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, /* Output addition/subtraction of register XOP[0] and a constant XOP[2] that - is ont a compile-time constant: + is not a compile-time constant: XOP[0] = XOP[0] +/- XOP[2] @@ -9306,7 +9287,7 @@ avr_out_plus_1 (rtx *xop, int *plen, enum rtx_code code, int *pcc, are additions/subtraction for pointer modes, i.e. HImode and PSImode. */ static const char * -avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) +avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen) { machine_mode mode = GET_MODE (xop[0]); @@ -9314,8 +9295,6 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) gcc_assert (mode == HImode || mode == PSImode); - *pcc = MINUS == code ? (int) CC_SET_CZN : (int) CC_SET_N; - avr_asm_len (PLUS == code ? "subi %A0,lo8(-(%2))" CR_TAB "sbci %B0,hi8(-(%2))" : "subi %A0,lo8(%2)" CR_TAB "sbci %B0,hi8(%2)", @@ -9342,19 +9321,15 @@ avr_out_plus_symbol (rtx *xop, enum rtx_code code, int *plen, int *pcc) If PLEN == NULL output the instructions. If PLEN != NULL set *PLEN to the length of the sequence in words. - PCC is a pointer to store the instructions' effect on cc0. - PCC may be NULL. - - PLEN and PCC default to NULL. + PLEN defaults to NULL. OUT_LABEL defaults to TRUE. For a description, see AVR_OUT_PLUS_1. Return "" */ const char * -avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) +avr_out_plus (rtx insn, rtx *xop, int *plen, bool out_label) { - int cc_plus, cc_minus, cc_dummy; int len_plus, len_minus; rtx op[4]; rtx xpattern = INSN_P (insn) ? single_set (as_a (insn)) : insn; @@ -9367,9 +9342,6 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) = (PLUS == code_sat || SS_PLUS == code_sat || US_PLUS == code_sat ? PLUS : MINUS); - if (!pcc) - pcc = &cc_dummy; - /* PLUS and MINUS don't saturate: Use modular wrap-around. */ if (PLUS == code_sat || MINUS == code_sat) @@ -9377,7 +9349,7 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) if (n_bytes <= 4 && REG_P (xop[2])) { - avr_out_plus_1 (xop, plen, code, pcc, code_sat, 0, out_label); + avr_out_plus_1 (insn, xop, plen, code, code_sat, 0, out_label); return ""; } @@ -9393,7 +9365,7 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) && !CONST_INT_P (xop[2]) && !CONST_FIXED_P (xop[2])) { - return avr_out_plus_symbol (xop, code, plen, pcc); + return avr_out_plus_symbol (xop, code, plen); } op[0] = avr_to_int_mode (xop[0]); @@ -9420,18 +9392,15 @@ avr_out_plus (rtx insn, rtx *xop, int *plen, int *pcc, bool out_label) /* Work out the shortest sequence. */ - avr_out_plus_1 (op, &len_minus, MINUS, &cc_minus, code_sat, sign, out_label); - avr_out_plus_1 (op, &len_plus, PLUS, &cc_plus, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, &len_minus, MINUS, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, &len_plus, PLUS, code_sat, sign, out_label); if (plen) - { - *plen = (len_minus <= len_plus) ? len_minus : len_plus; - *pcc = (len_minus <= len_plus) ? cc_minus : cc_plus; - } + *plen = (len_minus <= len_plus) ? len_minus : len_plus; else if (len_minus <= len_plus) - avr_out_plus_1 (op, NULL, MINUS, pcc, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, NULL, MINUS, code_sat, sign, out_label); else - avr_out_plus_1 (op, NULL, PLUS, pcc, code_sat, sign, out_label); + avr_out_plus_1 (insn, op, NULL, PLUS, code_sat, sign, out_label); return ""; } @@ -10560,7 +10529,7 @@ avr_out_round (rtx_insn *insn ATTRIBUTE_UNUSED, rtx *xop, int *plen) op[0] = xop[0]; op[1] = xop[1]; op[2] = xadd; - avr_out_plus (xpattern, op, plen_add, NULL, false /* Don't print "0:" */); + avr_out_plus (xpattern, op, plen_add, false /* Don't print "0:" */); avr_asm_len ("rjmp 1f" CR_TAB "0:", NULL, plen_add, 1); diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md index 028f9f1254d..7f73587940f 100644 --- a/gcc/config/avr/avr.md +++ b/gcc/config/avr/avr.md @@ -116,10 +116,6 @@ (define_constants (include "predicates.md") (include "constraints.md") -;; Condition code settings. -(define_attr "cc" "none,set_czn,set_zn,set_vzn,set_n,compare,clobber, - plus,ldi" - (const_string "none")) (define_attr "type" "branch,branch1,arith,xcall" (const_string "arith"))