From patchwork Thu May 30 13:25:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaushik Phatak X-Patchwork-Id: 247589 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 0D16F2C0095 for ; Thu, 30 May 2013 23:26:16 +1000 (EST) 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:cc:subject:date:message-id:references:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=xf5 b+g/xVc3Q0ZQuzftYt/3Q05hQ/0CSBUDz3fAdSuC9KhSua7vX4yKZk4NRoTKzMKz TmOKzojO6qiOnAIDhJzUq6X3BQb9dUaelPnNfCtYIEBshtGwFFySrfX+/cajrjDx JPHMKTQO6wG8Su+oX3sLsST19AgWk5Wcf3lDU29I= 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:cc:subject:date:message-id:references:content-type :content-transfer-encoding:mime-version; s=default; bh=Wyz4FUPqw 9So7OF8VShhfSVd0Us=; b=qUv6wroFN9nxiu7DBpGuKy9FS4hLJRJHSjogoNHMG Sy65gO4IZlBgjvf9tq7xJhPgOzBjvkrEu0DsDvvhX9XIHP2NjN2QpHV1QRyuNzVn d0o5qm6it2wPArDDj21IY0KHeIaozb3+9E0TMS57HEAkkE7wY9AQhFbc4rSM6kA2 0o= Received: (qmail 29737 invoked by alias); 30 May 2013 13:26:09 -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 29727 invoked by uid 89); 30 May 2013 13:26:08 -0000 X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, TW_LQ, TW_OV, TW_XF autolearn=ham version=3.3.1 Received: from co1ehsobe005.messaging.microsoft.com (HELO co1outboundpool.messaging.microsoft.com) (216.32.180.188) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 30 May 2013 13:25:51 +0000 Received: from mail132-co1-R.bigfish.com (10.243.78.247) by CO1EHSOBE009.bigfish.com (10.243.66.72) with Microsoft SMTP Server id 14.1.225.23; Thu, 30 May 2013 13:25:49 +0000 Received: from mail132-co1 (localhost [127.0.0.1]) by mail132-co1-R.bigfish.com (Postfix) with ESMTP id 0716A12013E; Thu, 30 May 2013 13:25:49 +0000 (UTC) X-Forefront-Antispam-Report: CIP:59.163.77.177; KIP:(null); UIP:(null); IPV:NLI; H:KCHJEXHC02.kpit.com; RD:59.163.77.177.static.vsnl.net.in; EFVD:NLI X-SpamScore: -4 X-BigFish: VPS-4(zz936eI542I4015I1447Izz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bh8275dhz2dh2a8h668h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h14ddh1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1155h) Received: from mail132-co1 (localhost.localdomain [127.0.0.1]) by mail132-co1 (MessageSwitch) id 1369920347166173_19645; Thu, 30 May 2013 13:25:47 +0000 (UTC) Received: from CO1EHSMHS002.bigfish.com (unknown [10.243.78.233]) by mail132-co1.bigfish.com (Postfix) with ESMTP id 1CAD9AC0055; Thu, 30 May 2013 13:25:47 +0000 (UTC) Received: from KCHJEXHC02.kpit.com (59.163.77.177) by CO1EHSMHS002.bigfish.com (10.243.66.12) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 30 May 2013 13:25:46 +0000 Received: from KCHJEXMB02.kpit.com ([169.254.2.54]) by KCHJEXHC02.kpit.com ([172.10.15.74]) with mapi id 14.03.0123.003; Thu, 30 May 2013 18:55:01 +0530 From: Kaushik Phatak To: "gcc-patches@gcc.gnu.org" CC: Richard Henderson , "DJ Delorie (dj@redhat.com)" Subject: RE: [PATCH:RL78] Add new insn for mulqi3 and mulhi3 Date: Thu, 30 May 2013 13:25:01 +0000 Message-ID: References: <5196909A.3050502@redhat.com> MIME-Version: 1.0 X-OriginatorOrg: kpitcummins.com Ping. Can I commit this with below changes? Thanks, Kaushik -----Original Message----- From: Kaushik Phatak Sent: 20 May 2013 20:17 To: gcc-patches@gcc.gnu.org Cc: 'Richard Henderson'; DJ Delorie (dj@redhat.com) Subject: RE: [PATCH:RL78] Add new insn for mulqi3 and mulhi3 Hi Richard, Thanks for the quick review. > No constraints on define_expand, only predicates. >> +(define_insn "mulhi3_g13" >These names are not used. They should be prefixed with "*" to indicate the name is just for documentation. I have made the suggested changes. Please find below an updated version of this patch. Let me know if OK to commit the same. Regards, Kaushik 2013-05-20 Kaushik Phatak * config/rl78/rl78.md (mulqi3,mulhi3): New define_expands. (mulqi3_rl78,mulhi3_rl78,mulhi3_g13): New define_insns. "" ) +(define_insn "*mulqi3_rl78" + [(set (match_operand:QI 0 "register_operand" "=&v") + (mult:QI (match_operand:QI 1 "general_operand" "+viU") + (match_operand:QI 2 "general_operand" "vi"))) + ] + "" ; mulu supported by all targets + "; mulqi macro %0 = %1 * %2 + mov a, %h1 + mov x, a + mov a, %h2 + mulu x ; ax = a * x + mov a, x + mov %h0, a + ; end of mulqi macro" +) + +(define_insn "*mulhi3_rl78" + [(set (match_operand:HI 0 "register_operand" "=&v") + (mult:HI (match_operand:HI 1 "general_operand" "+viU") + (match_operand:HI 2 "general_operand" "vi"))) + ] + "RL78_MUL_RL78" + "; mulhi macro %0 = %1 * %2 + movw ax, %h1 + movw bc, %h2 + mulhu ; bcax = bc * ax + movw %h0, ax + ; end of mulhi macro" +) + +(define_insn "*mulhi3_g13" + [(set (match_operand:HI 0 "register_operand" "=&v") + (mult:HI (match_operand:HI 1 "general_operand" "+viU") + (match_operand:HI 2 "general_operand" "vi"))) + ] + "RL78_MUL_G13" + "; mulhi macro %0 = %1 * %2 + mov a, #0x00 + mov !0xf00e8, a ; MDUC + movw ax, %h1 + movw 0xffff0, ax ; MDAL + movw ax, %h2 + movw 0xffff2, ax ; MDAH + nop ; mdb = mdal * mdah + movw ax, 0xffff6 ; MDBL + movw %h0, ax + ; end of mulhi macro" +) + ;; 0xFFFF0 is MACR(L). 0xFFFF2 is MACR(H) but we don't care about it ;; because we're only using the lower 16 bits (which is the upper 16 ;; bits of the result). Index: gcc/config/rl78/rl78.md =================================================================== --- gcc/config/rl78/rl78.md (revision 199105) +++ gcc/config/rl78/rl78.md (working copy) @@ -235,6 +235,24 @@ [(set_attr "valloc" "macax")] ) +(define_expand "mulqi3" + [(set (match_operand:QI 0 "register_operand" "") + (mult:QI (match_operand:QI 1 "general_operand" "") + (match_operand:QI 2 "nonmemory_operand" ""))) + ] + "" ; mulu supported by all targets + "" +) + +(define_expand "mulhi3" + [(set (match_operand:HI 0 "register_operand" "") + (mult:HI (match_operand:HI 1 "general_operand" "") + (match_operand:HI 2 "nonmemory_operand" ""))) + ] + "! RL78_MUL_NONE" + "" +) + (define_expand "mulsi3" [(set (match_operand:SI 0 "register_operand" "=&v") (mult:SI (match_operand:SI 1 "nonmemory_operand" "vi") @@ -244,6 +262,55 @@