From patchwork Mon Dec 11 17:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Perta X-Patchwork-Id: 847145 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-468930-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="fr1HiSYb"; 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 3ywVC263fJz9sP9 for ; Tue, 12 Dec 2017 04:22:37 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=wR5gJuZVPDA/ednG 3EVURs7PFeU7xrU4DzOA5AvDngLl4DHu3hn388crZV7HJjIECTyIgYmFno9vMYKx mgSeyLCDja6xpqfJnI6S7byqE8rZkuJOyGPRQk+zecLsmFWsycy308tb3eMx//H1 jTdza1TwZvbm/pI3ZRk2g48U8n8= 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:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=s6Dzqg53fSVVKGZh8PTT6Y 6khsA=; b=fr1HiSYb0TPooJxajDWyAieflV+Lzy+p3lFz6bNyeAMihmN720p2NM ukrLY6CcB6A7O2iXWPQUE/f/qSuwsLoFf60EQh8SMLlBzDUAZSTuoqaHhIve8M1d BoAuC0U69KMRPLhVmBVTYIxRiBf9ZkUgVU2uA2SNTcCKOOJEs+U7k= Received: (qmail 69941 invoked by alias); 11 Dec 2017 17:22:29 -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 69932 invoked by uid 89); 11 Dec 2017 17:22:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*UA:Outlook, H*x:Outlook, H*UA:Microsoft, H*x:Microsoft X-HELO: relmlie1.idc.renesas.com Received: from relmlor2.renesas.com (HELO relmlie1.idc.renesas.com) (210.160.252.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Dec 2017 17:22:26 +0000 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 12 Dec 2017 02:22:23 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id EF4674A8B4 for ; Tue, 12 Dec 2017 02:22:23 +0900 (JST) Received: from unknown (HELO REEBED03978) ([10.226.37.54]) by relmlii2.idc.renesas.com with ESMTP; 12 Dec 2017 02:22:23 +0900 From: "Sebastian Perta" To: Subject: [PATCH] RL78 movdi improvement Date: Mon, 11 Dec 2017 17:22:22 -0000 Message-ID: <000001d372a4$9bd42150$d37c63f0$@renesas.com> MIME-Version: 1.0 Hello, The following patch improves 64 bit operations by instructing GCC to use 16 bit movw instead of 8 bit mov. On the following test case the patch reduces the code size from 323 bytes to 245 bytes. unsigned long long my_anddi3(unsigned long long x, unsigned long long y){ return x & y; } I did not add this to the regression as it very simple and there many test cases in the regression especially c-torture which use this patch. Regression test is OK, tested with the following command: make -k check-gcc RUNTESTFLAGS=--target_board=rl78-sim Please let me know if this is OK, Thank you! Sebastian Index: ChangeLog =================================================================== --- ChangeLog (revision 255538) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2017-12-12 Sebastian Perta + + * config/rl78/rl78-protos.h: New function declaration rl78_split_movdi + * config/rl78/rl78.md: New define_expand "movdi" + * config/rl78/rl78.c: New function definition rl78_split_movdi + 2017-12-10 Gerald Pfeifer * doc/install.texi (Specific): Tweak link to mkssoftware.com. Index: config/rl78/rl78-protos.h =================================================================== --- config/rl78/rl78-protos.h (revision 255538) +++ config/rl78/rl78-protos.h (working copy) @@ -23,6 +23,7 @@ void rl78_expand_compare (rtx *); void rl78_expand_movsi (rtx *); void rl78_split_movsi (rtx *, machine_mode); +void rl78_split_movdi (rtx *, enum machine_mode); int rl78_force_nonfar_2 (rtx *, rtx (*gen)(rtx,rtx)); int rl78_force_nonfar_3 (rtx *, rtx (*gen)(rtx,rtx,rtx)); void rl78_expand_eh_epilogue (rtx); Index: config/rl78/rl78.c =================================================================== --- config/rl78/rl78.c (revision 255538) +++ config/rl78/rl78.c (working copy) @@ -596,6 +596,18 @@ } } +void +rl78_split_movdi (rtx *operands, enum machine_mode omode) +{ + rtx op00, op04, op10, op14; + op00 = rl78_subreg (SImode, operands[0], omode, 0); + op04 = rl78_subreg (SImode, operands[0], omode, 4); + op10 = rl78_subreg (SImode, operands[1], omode, 0); + op14 = rl78_subreg (SImode, operands[1], omode, 4); + emit_insn (gen_movsi (op00, op10)); + emit_insn (gen_movsi (op04, op14)); +} + /* Used by various two-operand expanders which cannot accept all operands in the "far" namespace. Force some such operands into registers so that each pattern has at most one far operand. */ Index: config/rl78/rl78.md =================================================================== --- config/rl78/rl78.md (revision 255538) +++ config/rl78/rl78.md (working copy) @@ -718,3 +718,11 @@ [(set_attr "valloc" "macax") (set_attr "is_g13_muldiv_insn" "yes")] ) + +(define_expand "movdi" + [(set (match_operand:DI 0 "nonimmediate_operand" "") + (match_operand:DI 1 "general_operand" ""))] + "" + "rl78_split_movdi(operands, DImode); + DONE;" +)