From patchwork Tue Jul 3 05:15:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 938331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-480884-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.b="yfEqhZld"; 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 41KXQL42wCz9s3R for ; Tue, 3 Jul 2018 15:15:51 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=kesY8kcM1uGY31md0zprtJH9Nvm0J9h2uvOfq2PTdqBpW/gCJw /piPnxoqoiYzgYFfe+AwJwwpYnoN+D0RbO10OuzcocInP0cgVbzUn6XLbhvnZgEx hfwHw9Gf7TlOAPsV5kMy+6TFA9aznZDaGp7PfZh7eakPmbsr/C9adRk2I= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=Yj2wox1aqbux872CXVfe8E4NBUE=; b=yfEqhZldXePCuDa00j+2 f06LdzhK7wxkenIDPATgdUcJDPHJKhPN03SvzELV2oM10W/TTDtVxjp3h08/I0qp 43d6rNEdP+qcF34jVf7STJEEohoekOeYeTkdPRsobpeG0VpJ83TShiLV2OXjhA54 Sj+ITMobX142hi0yyTaniOQ= Received: (qmail 94680 invoked by alias); 3 Jul 2018 05:15:43 -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 79853 invoked by uid 89); 3 Jul 2018 05:15:30 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Consolidate, 24110 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Jul 2018 05:15:28 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97E8F308A94F for ; Tue, 3 Jul 2018 05:15:26 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-54.rdu2.redhat.com [10.10.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED5755C54A for ; Tue, 3 Jul 2018 05:15:25 +0000 (UTC) To: gcc-patches From: Jeff Law Subject: [committed] Consolidate some H8 patterns Openpgp: preference=signencrypt Message-ID: Date: Mon, 2 Jul 2018 23:15:24 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 X-IsSubscribed: yes The h8 port has 3 movqi and movhi patterns. One for the H8, another for the H8/H and H8/S and another for the H8/SX. The basic H8 pattern can be trivially merged with the H8/H and H8/S patterns. In addition to just simplifing the port, the movqi H8/H and H8/S pattern is better WRT condition code handling and length computation. The latter in particular can result in better code as we're more likely to use short branches without resorting to linker relaxation. We can also combine the pushqi and pushhi patterns into a single pattern using a mode iterator. I've verified that the only changes in libgcc are the conversion of long branches to short branches. These aren't huge cleanups, but every little bit helps this rather convoluted machine description. I expect to find more cleanups of a similar nature. Jeff diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15becdc2466..a1f2d351983 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2018-07-02 Jeff Law + * config/h8300/h8300.md (movqi_h8300, movqi_h8300hs): Consolidate + the H8/300, H8/300H and H8/S variants into a single pattern. + (movhi_h8300, movqi_h8300hs): Similarly. + (pushqi_h8300hs, pushhi_h8300hs): Consolidate into a single pattern. + (QHI mode iterator): New. + * config/h8300/h8300.md: Remove trailing whitespace. 2018-07-02 Jim Wilson diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 846fd735de0..74b22338c21 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -184,6 +184,7 @@ (define_mode_iterator P [(HI "Pmode == HImode") (SI "Pmode == SImode")]) +(define_mode_iterator QHI [QI HI]) ;; ---------------------------------------------------------------------- ;; MOVE INSTRUCTIONS @@ -191,25 +192,10 @@ ;; movqi -(define_insn "*movqi_h8300" +(define_insn "*movqi_h8nosx" [(set (match_operand:QI 0 "general_operand_dst" "=r,r ,<,r,r,m") (match_operand:QI 1 "general_operand_src" " I,r>,r,n,m,r"))] - "TARGET_H8300 - && h8300_move_ok (operands[0], operands[1])" - "@ - sub.b %X0,%X0 - mov.b %R1,%X0 - mov.b %X1,%R0 - mov.b %R1,%X0 - mov.b %R1,%X0 - mov.b %X1,%R0" - [(set_attr "length" "2,2,2,2,4,4") - (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")]) - -(define_insn "*movqi_h8300hs" - [(set (match_operand:QI 0 "general_operand_dst" "=r,r ,<,r,r,m") - (match_operand:QI 1 "general_operand_src" " I,r>,r,n,m,r"))] - "(TARGET_H8300H || TARGET_H8300S) && !TARGET_H8300SX + "(TARGET_H8300 || TARGET_H8300H || TARGET_H8300S) && !TARGET_H8300SX && h8300_move_ok (operands[0], operands[1])" "@ sub.b %X0,%X0 @@ -220,7 +206,7 @@ mov.b %X1,%R0" [(set (attr "length") (symbol_ref "compute_mov_length (operands)")) - (set_attr "cc" "set_zn,set_znv,set_znv,clobber,set_znv,set_znv")]) + (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")]) (define_insn "*movqi_h8sx" [(set (match_operand:QI 0 "general_operand_dst" "=Z,rQ") @@ -255,26 +241,10 @@ ;; movhi -(define_insn "*movhi_h8300" +(define_insn "*movhi_h8nosx" [(set (match_operand:HI 0 "general_operand_dst" "=r,r,<,r,r,m") (match_operand:HI 1 "general_operand_src" "I,r>,r,i,m,r"))] - "TARGET_H8300 - && h8300_move_ok (operands[0], operands[1])" - "@ - sub.w %T0,%T0 - mov.w %T1,%T0 - mov.w %T1,%T0 - mov.w %T1,%T0 - mov.w %T1,%T0 - mov.w %T1,%T0" - [(set (attr "length") - (symbol_ref "compute_mov_length (operands)")) - (set_attr "cc" "set_zn,set_znv,set_znv,set_znv,set_znv,set_znv")]) - -(define_insn "*movhi_h8300hs" - [(set (match_operand:HI 0 "general_operand_dst" "=r,r,<,r,r,m") - (match_operand:HI 1 "general_operand_src" "I,r>,r,i,m,r"))] - "(TARGET_H8300H || TARGET_H8300S) && !TARGET_H8300SX + "(TARGET_H8300 || TARGET_H8300H || TARGET_H8300S) && !TARGET_H8300SX && h8300_move_ok (operands[0], operands[1])" "@ sub.w %T0,%T0 @@ -855,25 +825,16 @@ "mov.w\\t%T0,@-r7" [(set_attr "length" "2")]) -(define_insn "*pushqi1_h8300hs_" - [(set (mem:QI +(define_insn "*push1_h8300hs_" + [(set (mem:QHI (pre_modify:P (reg:P SP_REG) (plus:P (reg:P SP_REG) (const_int -4)))) - (match_operand:QI 0 "register_no_sp_elim_operand" "r"))] + (match_operand:QHI 0 "register_no_sp_elim_operand" "r"))] "TARGET_H8300H || TARGET_H8300S" "mov.l\\t%S0,@-er7" [(set_attr "length" "4")]) -(define_insn "*pushhi1_h8300hs_" - [(set (mem:HI - (pre_modify:P - (reg:P SP_REG) - (plus:P (reg:P SP_REG) (const_int -4)))) - (match_operand:HI 0 "register_no_sp_elim_operand" "r"))] - "TARGET_H8300H || TARGET_H8300S" - "mov.l\\t%S0,@-er7" - [(set_attr "length" "4")]) ;; ---------------------------------------------------------------------- ;; TEST INSTRUCTIONS