From patchwork Wed Feb 12 19:14:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1237038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-519430-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=lOlE7Bf9; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SknyPw+f; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Hq8Y5l2Wz9s3x for ; Thu, 13 Feb 2020 06:14:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:reply-to:to:date:mime-version :content-type; q=dns; s=default; b=Y0N/Alu7cPA6Kq0+3GDrLjQDPHLJn 53UPel4pxKMZ/0VmmLnr0Jax5+xAWadkBFxcofodm3l2j22IK4lvEQ62hM+9zqic 0BNE3hTbYcwBKQzmD+tyDn4GVGJByH4YF2sSaq7xDnoJWevH0wSMzTUMGxeNSVJC Hti+JS6Ge5PKNU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:subject:from:reply-to:to:date:mime-version :content-type; s=default; bh=jnsfIQ8Izo0x4iFKYlDe0WILR/8=; b=lOl E7Bf9dOzr8561NzgorTlizs55vO3BvtVjUBW+LUlwzxJVdJBjFK9663h5Wxr1a6S jbFBghhGBzdPDBq3n/1tVEygmIWYGVTLUXefs82vnTh8A3b5wnlDqdDgomCbsg8R ygJaEeH0avvuRf49wCQ6FatnFapeJfH0tYEvr+yU= Received: (qmail 129347 invoked by alias); 12 Feb 2020 19:14:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 129278 invoked by uid 89); 12 Feb 2020 19:14:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (207.211.31.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Feb 2020 19:14:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581534874; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type; bh=dkftD6os9JOBBWk9TPUtBtl6sGFaboa3AYkkQ+DmNqU=; b=SknyPw+fDgapVL30vOlK8PrtgqxJ0FS//U9lNeZ+uf3hL422bl7WKvMgeI5Jiogo3WHRdv /KLYgD48fFwIEjQLpe8ih5FeM9V76Ky9GjG7rXhKvAGeUdjjya4wLCwvTI1Ee/EBGHMwX7 nDjjhDDRWYAtyy5OcVA2fYdE8BYXxNo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-Z4AdNojzNVGqnu5STb_Rgg-1; Wed, 12 Feb 2020 14:14:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1585A189F770 for ; Wed, 12 Feb 2020 19:14:31 +0000 (UTC) Received: from ovpn-118-11.phx2.redhat.com (ovpn-118-11.phx2.redhat.com [10.3.118.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id A994910027B6 for ; Wed, 12 Feb 2020 19:14:30 +0000 (UTC) Message-ID: <25e0fb3baf51dee33c5e593de0d37966ff91aabc.camel@redhat.com> Subject: [committed] More H8 cleanups From: Jeff Law Reply-To: law@redhat.com To: gcc-patches List Date: Wed, 12 Feb 2020 12:14:29 -0700 User-Agent: Evolution 3.34.3 (3.34.3-1.fc31) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-IsSubscribed: yes This is another small H8 cleanup. This time we're killing a peephole2 that doesn't seem terribly useful. The peephole in question narrows a SImode comparison to QImode when it's fed by an (and (xor)) and the result is the same in either mode. I couldn't get this to trigger within libgcc, newlib or in the testsuite. Note that we do some of this kind of narrowing in match.pd these days, so it may be the case that the pattern was of marginal value before and none after the match.pd improvements. The more straightforward SI->QI and HI->QI operand narrowing when fed by a simple (and) operation were consolidated into a single peephole2. These are still triggering which may point to a failing of the match.pd patterns, but addressing in match.pd seems terribly out of scope at this point. Installing on the trunk. Jeff commit 37462a131c528d0980915d98567361aa9396b030 Author: Jeff Law Date: Wed Feb 12 12:12:22 2020 -0700 Drop unused comparison shortening pattern and consolidate remaining comparison shortening patterns. * config/h8300/h8300.md (comparison shortening peepholes): Drop (and (xor)) variant. Combine other two into single peephole. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 735cc47a3dd..1927290f568 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2020-02-12 Jeff Law + + * config/h8300/h8300.md (comparison shortening peepholes): Drop + (and (xor)) variant. Combine other two into single peephole. + 2020-02-12 Wilco Dijkstra PR rtl-optimization/93565 diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 0548368215b..dcc9c3682d6 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -5405,7 +5405,9 @@ [(cc0) (const_int 0)]) (label_ref (match_operand 2 "" "")) (pc)))] - "peep2_reg_dead_p (2, operands[0])" + "((const_int_qi_operand (operands[1], QImode) + || const_int_hi_operand (operands[1], HImode)) + && peep2_reg_dead_p (2, operands[0]))" [(set (match_dup 4) (and:QI (match_dup 4) (match_dup 5))) @@ -5416,68 +5418,11 @@ (label_ref (match_dup 2)) (pc)))] { - operands[4] = gen_rtx_REG (QImode, REGNO (operands[0])); - operands[5] = gen_int_mode (INTVAL (operands[1]), QImode); - }) + enum machine_mode mode; -(define_peephole2 - [(set (match_operand:SI 0 "register_operand" "") - (and:SI (match_dup 0) - (match_operand:SI 1 "const_int_hi_operand" ""))) - (set (cc0) (compare (match_dup 0) - (const_int 0))) - (set (pc) - (if_then_else (match_operator 3 "eqne_operator" - [(cc0) (const_int 0)]) - (label_ref (match_operand 2 "" "")) - (pc)))] - "peep2_reg_dead_p (2, operands[0])" - [(set (match_dup 4) - (and:HI (match_dup 4) - (match_dup 5))) - (set (cc0) (compare (match_dup 4) - (const_int 0))) - (set (pc) - (if_then_else (match_op_dup 3 [(cc0) (const_int 0)]) - (label_ref (match_dup 2)) - (pc)))] - { - operands[4] = gen_rtx_REG (HImode, REGNO (operands[0])); - operands[5] = gen_int_mode (INTVAL (operands[1]), HImode); - }) - -(define_peephole2 - [(set (match_operand:SI 0 "register_operand" "") - (and:SI (match_dup 0) - (match_operand:SI 1 "const_int_qi_operand" ""))) - (set (match_dup 0) - (xor:SI (match_dup 0) - (match_operand:SI 2 "const_int_qi_operand" ""))) - (set (cc0) (compare (match_dup 0) - (const_int 0))) - (set (pc) - (if_then_else (match_operator 4 "eqne_operator" - [(cc0) (const_int 0)]) - (label_ref (match_operand 3 "" "")) - (pc)))] - "peep2_reg_dead_p (3, operands[0]) - && (~INTVAL (operands[1]) & INTVAL (operands[2])) == 0" - [(set (match_dup 5) - (and:QI (match_dup 5) - (match_dup 6))) - (set (match_dup 5) - (xor:QI (match_dup 5) - (match_dup 7))) - (set (cc0) (compare (match_dup 5) - (const_int 0))) - (set (pc) - (if_then_else (match_op_dup 4 [(cc0) (const_int 0)]) - (label_ref (match_dup 3)) - (pc)))] - { - operands[5] = gen_rtx_REG (QImode, REGNO (operands[0])); - operands[6] = gen_int_mode (INTVAL (operands[1]), QImode); - operands[7] = gen_int_mode (INTVAL (operands[2]), QImode); + mode = const_int_qi_operand (operands[1], QImode) ? QImode : HImode; + operands[4] = gen_rtx_REG (mode, REGNO (operands[0])); + operands[5] = gen_int_mode (INTVAL (operands[1]), mode); }) ;; These triggers right at the end of allocation of locals in the