From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B196A385840E for ; Tue, 30 May 2023 13:15:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B196A385840E 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-Seal: i=1; a=rsa-sha256; t=1685452527; cv=none; d=strato.com; s=strato-dkim-0002; b=R8gvoAQAINLNZ2FzsKRyeS3yRPPed9rOGlsJElv28Vpp2nFB1SoXRUgOTuRmBz7Q59 86B+CdR4M38FOAa8RKfXoVwIkHLIChmaN1bKDshLcKKjSPFEnGEeF+4XZo2Imu0bO8OM xcu6/VT5dyQvlFRfMhocDjX+ImRPm/luXpeB0DsgrVyu1D4HoKNP109RfOKOrtEK8FPw 4ixhoR6UoC1aiWmGICqKrHdajKmZNyOSO65DWPttso97GNDT3yVJoy5OUwGIuUxjdWIo 41RE59hTZXcmYn9WlRNtm7bIvge8Zn4OescOl7nG85MM/ZUUI/cyuNTGHjLKKGTK5QZT 0Dgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1685452527; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:References:Cc:To:From:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=+EOc6boDiuVdEIhCy1dS5qXJ9df5//mpFFUJY6uwLLo=; b=okf90yHvlM3f31cnZWmQ6ouUy4mgNuZYEGZCpZpX5BDDyOQTOA6CGSFEHUmatpxJ9X xadCUnnrQsyvVxpVkzAJ0XfIuzGMlY+f6SsUVQ7nqPoZNci4xbxS0Bh4a5efxEmezZB7 EWUJhDPs4+zzi8VDrg+bDq7mYLJPnfwDCO1p22IOzTh91Fdi0GJcx0JA7iOaf21xStja Cw07H1Y2j+YlrBPKFA4Rfx9wRkd/VsKT5Wup3A7Dy3934QsKbYVs+01vUpRF3td003Y0 nDwq5DQtinwhBbOpsdXWD/fZ+A6lz8uZiJeg2amG50G08dPJt7/4MT1OZ3p5nfioSkvf 6RaA== 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=1685452527; s=strato-dkim-0002; d=gjlay.de; h=In-Reply-To:References:Cc:To:From:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=+EOc6boDiuVdEIhCy1dS5qXJ9df5//mpFFUJY6uwLLo=; b=V6IxWODs3ekLr5wVI5S22C1llyozU5NsSOJB9FJGlJZlEGPv/OAQNMPIbO/ql7uxNP feYouEozXQzP6WJ2p7iwFiI2U5lAFbxjaZ55SOeTIY/f8d1FHvjl6gbxOIdqmJbVsUNt v/Iv7qOAibXuMpLgxssBwyCJVC20/XWQmzKUMHIsao4P6L7f7r6a9aKo0u6WHzjzU4m7 mmFrhAWXAe2S22+pDkK+lkOfcMbiWi3AEevqFDQ/xwq9WhVIBrvnVskyB1Ny3wy+8aSp RF/ZwLTI5XOf9d1QyC0+ZFnmIFwD7BKoXD8kWEsK3cjYJLONDFvToQC58xXW88ENc0xo JFIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1685452527; s=strato-dkim-0003; d=gjlay.de; h=In-Reply-To:References:Cc:To:From:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=+EOc6boDiuVdEIhCy1dS5qXJ9df5//mpFFUJY6uwLLo=; b=aRRWBaFHvOtEfhrnXljjHRViecJeFxzChT72fgkigCcyMejLhRIjYC//U2SxRu5sV+ YvGNX19Pp8qvElWMrOAw== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkRmM69o2y+LiO3MutATA==" Received: from [192.168.2.102] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id z691f1z4UDFQ9bk (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 30 May 2023 15:15:26 +0200 (CEST) Message-ID: <5d719757-a47d-222d-0ce5-07354d3b1c17@gjlay.de> Date: Tue, 30 May 2023 15:15:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Ping #1: [patch,avr] Fix PR109650 wrong code Content-Language: en-US From: Georg-Johann Lay To: gcc-patches@gcc.gnu.org Cc: Jeff Law , Denis Chertykov References: <48369cc7-884d-9eef-2e16-9bc2bfe825f1@gjlay.de> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,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 List-Id: Ping #1 for: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618976.html https://gcc.gnu.org/pipermail/gcc-patches/attachments/20230519/9536bf8c/attachment-0001.bin Johann Am 19.05.23 um 10:49 schrieb Georg-Johann Lay: > > Here is a revised version of the patch.  The difference to the > previous one is that it adds some combine patterns for *cbranch > insns that were lost in the PR92729 transition.  The post-reload > part of the patterns were still there.  The new patterns are > slightly more general in that they also handle fixed-point modes. > > Apart from that, the patch behaves the same: > > Am 15.05.23 um 20:05 schrieb Georg-Johann Lay: >> This patch fixes a wrong-code bug in the wake of PR92729, the transition >> that turned the AVR backend from cc0 to CCmode.  In cc0, the insn that >> uses cc0 like a conditional branch always follows the cc0 setter, which >> is no more the case with CCmode where set and use of REG_CC might be in >> different basic blocks. >> >> This patch removes the machine-dependent reorg pass in avr_reorg >> entirely. >> >> It is replaced by a new, AVR specific mini-pass that runs prior to >> split2. Canonicalization of comparisons away from the "difficult" >> codes GT[U] and LE[U] is now mostly performed by implementing >> TARGET_CANONICALIZE_COMPARISON. >> >> Moreover: >> >> * Text peephole conditions get "dead_or_set_regno_p (*, REG_CC)" as >> needed. >> >> * RTL peephole conditions get "peep2_regno_dead_p (*, REG_CC)" as >> needed. >> >> * Conditional branches no more clobber REG_CC. >> >> * insn output for compares looks ahead to determine the branch mode in >> use. This needs also "dead_or_set_regno_p (*, REG_CC)". >> >> * Add RTL peepholes for decrement-and-branch detection. >> >> Finally, it fixes some of the many indentation glitches left over from >> PR92729. >> >> Ok? >> >> I'd also backport this one because all of v12+ is affected by the >> wrong code. > > Johann > > -- > > gcc/ >     PR target/109650 >     PR target/92729 > >     * config/avr/avr-passes.def (avr_pass_ifelse): Insert new pass. >     * config/avr/avr.cc (avr_pass_ifelse): New RTL pass. >     (avr_pass_data_ifelse): New pass_data for it. >     (make_avr_pass_ifelse, avr_redundant_compare, avr_cbranch_cost) >     (avr_canonicalize_comparison, avr_out_plus_set_ZN) >     (avr_out_cmp_ext): New functions. >     (compare_condtition): Make sure REG_CC dies in the branch insn. >     (avr_rtx_costs_1): Add computation of cbranch costs. >     (avr_adjust_insn_length) [ADJUST_LEN_ADD_SET_ZN, ADJUST_LEN_CMP_ZEXT]: >     [ADJUST_LEN_CMP_SEXT]Handle them. >     (TARGET_CANONICALIZE_COMPARISON): New define. >     (avr_simplify_comparison_p, compare_diff_p, avr_compare_pattern) >     (avr_reorg_remove_redundant_compare, avr_reorg): Remove functions. >     (TARGET_MACHINE_DEPENDENT_REORG): Remove define. > >     * avr-protos.h (avr_simplify_comparison_p): Remove proto. >     (make_avr_pass_ifelse, avr_out_plus_set_ZN, cc_reg_rtx) >     (avr_out_cmp_zext): New Protos > >     * config/avr/avr.md (branch, difficult_branch): Don't split insns. >     (*cbranchhi.zero-extend.0", *cbranchhi.zero-extend.1") >     (*swapped_tst, *add.for.eqne.): New insns. >     (*cbranch4): Rename to cbranch4_insn. >     (define_peephole): Add dead_or_set_regno_p(insn,REG_CC) as needed. >     (define_deephole2): Add peep2_regno_dead_p(*,REG_CC) as needed. >     Add new RTL peepholes for decrement-and-branch and *swapped_tst. >     Rework signtest-and-branch peepholes for *sbrx_branch. >     (adjust_len) [add_set_ZN, cmp_zext]: New. >     (QIPSI): New mode iterator. >     (ALLs1, ALLs2, ALLs4, ALLs234): New mode iterators. >     (gelt): New code iterator. >     (gelt_eqne): New code attribute. >     (rvbranch, *rvbranch, difficult_rvbranch, *difficult_rvbranch) >     (branch_unspec, *negated_tst, *reversed_tst) >     (*cmpqi_sign_extend): Remove insns. >     (define_c_enum "unspec") [UNSPEC_IDENTITY]: Remove. > >     * config/avr/avr-dimode.md (cbranch4): Canonicalize comparisons. >     * config/avr/predicates.md (scratch_or_d_register_operand): New. >     * config/avr/contraints.md (Yxx): New constraint. > > gcc/testsuite/ >     PR target/109650 >     * config/avr/torture/pr109650-1.c: New test. >     * config/avr/torture/pr109650-2.c: New test.