From patchwork Wed Jul 4 00:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 939040 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-480973-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="NhfJVgY1"; 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 41L20635VHz9s3q for ; Wed, 4 Jul 2018 10:28:21 +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:from :to:subject:message-id:date:mime-version:content-type; q=dns; s= default; b=w4JOa207yQtDEi4rAVVgpFNIXevPIRmDnFQGf7kdKBPp87d94ZnLc B+iJ94vsGxc/rk85VbEXiFrnyd3TAfDnxMQh2jZXPH9nWwsxU3dTCdVxAvbdytnc 7xpWpE3/+gOzW3AKc7dCqPjXaaAoIF5DFP7uUfWclTZGT6dfVp2i7U= 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:from :to:subject:message-id:date:mime-version:content-type; s= default; bh=ahf9XdZo4RJjhmCY2z8q7+63rRA=; b=NhfJVgY1T5Xcz61DJ4N5 BM9b96o3DjfTdl9RqEEllpNIbeW5BbNItgiepIH6eXJbgVPijyVCaqyO6cG2UuFz Qi67N3FFnwgaaOuTIgzlvJ+dOIsEzjPepsFE8hxWczJI/WROA/tbEYSMXMmCfpU8 d28eI2NN5PYE9mfl1RS/ioY= Received: (qmail 59880 invoked by alias); 4 Jul 2018 00:28:14 -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 59869 invoked by uid 89); 4 Jul 2018 00:28:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=bra 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; Wed, 04 Jul 2018 00:28:11 +0000 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 946143082123 for ; Wed, 4 Jul 2018 00:28:10 +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 B43E22010CEA for ; Wed, 4 Jul 2018 00:28:09 +0000 (UTC) From: Jeff Law Openpgp: preference=signencrypt To: gcc-patches Subject: [committed] Consolidate movsd and movmd patterns/splitters for H8 Message-ID: Date: Tue, 3 Jul 2018 18:28:08 -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 So the H8 port has movmd and movsd instructions which are used to implement block moves and stpcpy. Those expanders and patters are necessarily fairly ugly, but not enough to warrant trying to simplify. What is worth simplifying is the fact that we have two copies of each pattern and splitter because Pmode varies. This patch uses the P mode iterator to consolidate the patterns & splitters that only differed in the modes they used for the pointer operands. The resulting code for libgcc & newlib is unchanged. Installed on the trunk. Jeff * config/h8300/h8300.md (movmd_internal_normal): Consolidated with (movmd_internal) into a single pattern using the P mode iterator. (movmd splitters): Similarly. (stpcpy_internal_normal, stpcpy_internal): Similarly for thes patterns. (movsd splitters): Similarly. diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 5014fd5..e654784 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -512,33 +512,16 @@ ;; This is a difficult instruction to reload since operand 0 must be the ;; frame pointer. See h8300_reg_class_from_letter for an explanation. -(define_insn "movmd_internal_normal" - [(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r")) - (mem:BLK (match_operand:HI 4 "register_operand" "1,1"))) +(define_insn "movmd_internal_" + [(set (mem:BLK (match_operand:P 3 "register_operand" "0,r")) + (mem:BLK (match_operand:P 4 "register_operand" "1,1"))) (unspec [(match_operand:HI 5 "register_operand" "2,2") (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD) - (clobber (match_operand:HI 0 "register_operand" "=d,??D")) - (clobber (match_operand:HI 1 "register_operand" "=f,f")) + (clobber (match_operand:P 0 "register_operand" "=d,??D")) + (clobber (match_operand:P 1 "register_operand" "=f,f")) (set (match_operand:HI 2 "register_operand" "=c,c") (const_int 0))] - "TARGET_H8300SX && TARGET_NORMAL_MODE" - "@ - movmd%m6 - #" - [(set_attr "length" "2,14") - (set_attr "can_delay" "no") - (set_attr "cc" "none,clobber")]) - -(define_insn "movmd_internal" - [(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r")) - (mem:BLK (match_operand:SI 4 "register_operand" "1,1"))) - (unspec [(match_operand:HI 5 "register_operand" "2,2") - (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD) - (clobber (match_operand:SI 0 "register_operand" "=d,??D")) - (clobber (match_operand:SI 1 "register_operand" "=f,f")) - (set (match_operand:HI 2 "register_operand" "=c,c") - (const_int 0))] - "TARGET_H8300SX && !TARGET_NORMAL_MODE" + "TARGET_H8300SX" "@ movmd%m6 #" @@ -563,33 +546,11 @@ (match_operand:BLK 1 "memory_operand" "")) (unspec [(match_operand:HI 2 "register_operand" "") (match_operand:HI 3 "const_int_operand" "")] UNSPEC_MOVMD) - (clobber (match_operand:HI 4 "register_operand" "")) - (clobber (match_operand:HI 5 "register_operand" "")) - (set (match_dup 2) - (const_int 0))] - "TARGET_H8300SX && TARGET_NORMAL_MODE && reload_completed - && REGNO (operands[4]) != DESTINATION_REG" - [(const_int 0)] - { - rtx dest; - - h8300_swap_into_er6 (XEXP (operands[0], 0)); - dest = replace_equiv_address (operands[0], hard_frame_pointer_rtx); - emit_insn (gen_movmd (dest, operands[1], operands[2], operands[3])); - h8300_swap_out_of_er6 (operands[4]); - DONE; - }) - -(define_split - [(set (match_operand:BLK 0 "memory_operand" "") - (match_operand:BLK 1 "memory_operand" "")) - (unspec [(match_operand:HI 2 "register_operand" "") - (match_operand:HI 3 "const_int_operand" "")] UNSPEC_MOVMD) - (clobber (match_operand:SI 4 "register_operand" "")) - (clobber (match_operand:SI 5 "register_operand" "")) + (clobber (match_operand:P 4 "register_operand" "")) + (clobber (match_operand:P 5 "register_operand" "")) (set (match_dup 2) (const_int 0))] - "TARGET_H8300SX && !TARGET_NORMAL_MODE && reload_completed + "TARGET_H8300SX && reload_completed && REGNO (operands[4]) != DESTINATION_REG" [(const_int 0)] { @@ -641,28 +602,14 @@ ;; See comments above memcpy_internal(). -(define_insn "stpcpy_internal_normal" - [(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r")) - (unspec:BLK [(mem:BLK (match_operand:HI 4 "register_operand" "1,1"))] - UNSPEC_STPCPY)) - (clobber (match_operand:HI 0 "register_operand" "=d,??D")) - (clobber (match_operand:HI 1 "register_operand" "=f,f")) - (clobber (match_operand:HI 2 "register_operand" "=c,c"))] - "TARGET_H8300SX && TARGET_NORMAL_MODE" - "@ - \n1:\tmovsd\t2f\;bra\t1b\n2: - #" - [(set_attr "length" "6,18") - (set_attr "cc" "none,clobber")]) - -(define_insn "stpcpy_internal" - [(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r")) - (unspec:BLK [(mem:BLK (match_operand:SI 4 "register_operand" "1,1"))] +(define_insn "stpcpy_internal_" + [(set (mem:BLK (match_operand:P 3 "register_operand" "0,r")) + (unspec:BLK [(mem:BLK (match_operand:P 4 "register_operand" "1,1"))] UNSPEC_STPCPY)) - (clobber (match_operand:SI 0 "register_operand" "=d,??D")) - (clobber (match_operand:SI 1 "register_operand" "=f,f")) - (clobber (match_operand:SI 2 "register_operand" "=c,c"))] - "TARGET_H8300SX && !TARGET_NORMAL_MODE" + (clobber (match_operand:P 0 "register_operand" "=d,??D")) + (clobber (match_operand:P 1 "register_operand" "=f,f")) + (clobber (match_operand:P 2 "register_operand" "=c,c"))] + "TARGET_H8300SX" "@ \n1:\tmovsd\t2f\;bra\t1b\n2: #" @@ -675,29 +622,10 @@ (define_split [(set (match_operand:BLK 0 "memory_operand" "") (unspec:BLK [(match_operand:BLK 1 "memory_operand" "")] UNSPEC_STPCPY)) - (clobber (match_operand:HI 2 "register_operand" "")) - (clobber (match_operand:HI 3 "register_operand" "")) - (clobber (match_operand:HI 4 "register_operand" ""))] - "TARGET_H8300SX && TARGET_NORMAL_MODE && reload_completed - && REGNO (operands[2]) != DESTINATION_REG" - [(const_int 0)] - { - rtx dest; - - h8300_swap_into_er6 (XEXP (operands[0], 0)); - dest = replace_equiv_address (operands[0], hard_frame_pointer_rtx); - emit_insn (gen_movsd (dest, operands[1], operands[4])); - h8300_swap_out_of_er6 (operands[2]); - DONE; - }) - -(define_split - [(set (match_operand:BLK 0 "memory_operand" "") - (unspec:BLK [(match_operand:BLK 1 "memory_operand" "")] UNSPEC_STPCPY)) - (clobber (match_operand:SI 2 "register_operand" "")) - (clobber (match_operand:SI 3 "register_operand" "")) - (clobber (match_operand:SI 4 "register_operand" ""))] - "TARGET_H8300SX && !TARGET_NORMAL_MODE && reload_completed + (clobber (match_operand:P 2 "register_operand" "")) + (clobber (match_operand:P 3 "register_operand" "")) + (clobber (match_operand:P 4 "register_operand" ""))] + "TARGET_H8300SX && reload_completed && REGNO (operands[2]) != DESTINATION_REG" [(const_int 0)] {