From patchwork Fri May 10 11:42:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaushik Phatak X-Patchwork-Id: 242961 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 6AACC2C00DA for ; Fri, 10 May 2013 21:43:49 +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:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=tvX sgsEyoPmm/ff+r//paPYBf1Cj1obIjasmk9smDjxkf0tBwGlZCKiGLjYfqR2KMDv FAyTDKW7SFN1faWLX6orBUpkinIXULb9IqIX0W8C2RRDaD9zcNEfKas5wc+XZAXb ymkgtl1HCqBhF/+TAbXGfoR7M/cd5vayB2GT6ZkM= 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:content-type :content-transfer-encoding:mime-version; s=default; bh=Ch3LPlVft 6gxkngztoqvdGc4b7k=; b=hmfRws3SwoyTHM809cA4ZO55TaAJQ72b33jUP64g3 Ic79l/ghbmibA44ARD9FMjPdLLmSdGOH8RCed08g5Ah3IVh6pSkr2Crkh0i0ir6m k30FZRys8445tZMhnMHaog5uSVi8S0P17xyIzLPxQ4+9dpc468OZ7dkylYGcz2Si pw= Received: (qmail 25898 invoked by alias); 10 May 2013 11:43: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 25863 invoked by uid 89); 10 May 2013 11:43:36 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RCVD_IN_HOSTKARMA_YE, TW_OV autolearn=ham version=3.3.1 Received: from ch1ehsobe006.messaging.microsoft.com (HELO ch1outboundpool.messaging.microsoft.com) (216.32.181.186) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 10 May 2013 11:43:35 +0000 Received: from mail222-ch1-R.bigfish.com (10.43.68.241) by CH1EHSOBE004.bigfish.com (10.43.70.54) with Microsoft SMTP Server id 14.1.225.23; Fri, 10 May 2013 11:43:33 +0000 Received: from mail222-ch1 (localhost [127.0.0.1]) by mail222-ch1-R.bigfish.com (Postfix) with ESMTP id 469032E0653; Fri, 10 May 2013 11:43:33 +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: -1 X-BigFish: VPS-1(zz936eIzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h14ddh1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1b0ah1d0ch1d2eh1d3fh1155h) Received: from mail222-ch1 (localhost.localdomain [127.0.0.1]) by mail222-ch1 (MessageSwitch) id 1368186210519754_14112; Fri, 10 May 2013 11:43:30 +0000 (UTC) Received: from CH1EHSMHS007.bigfish.com (snatpool3.int.messaging.microsoft.com [10.43.68.225]) by mail222-ch1.bigfish.com (Postfix) with ESMTP id 7B003180050; Fri, 10 May 2013 11:43:30 +0000 (UTC) Received: from KCHJEXHC02.kpit.com (59.163.77.177) by CH1EHSMHS007.bigfish.com (10.43.70.7) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 10 May 2013 11:43:30 +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; Fri, 10 May 2013 17:12:44 +0530 From: Kaushik Phatak To: "gcc-patches@gcc.gnu.org" CC: "DJ Delorie (dj@redhat.com)" Subject: [Patch:RL78] Fix hardware multiply on G13 target Date: Fri, 10 May 2013 11:42:44 +0000 Message-ID: MIME-Version: 1.0 X-OriginatorOrg: kpitcummins.com Hi, The following patch fixes an issue with the inline hardware multiply used in the RL78 G13 target. The G13 target does not have a multiply instruction, but achieves this using set of data and control registers. This patch adds an additional 'nop' after control and data registers are loaded in the multiply-accumulation operation. Currently, there is only 1 'nop'. As per the data sheet, regular multiply operation: 1 nop multiply-accumulate operation: 2 nops Section 17.4.2 of G13 hardware manual: After <6>, the multiply-accumulation operation finishes in one additional clock cycle. (There is a wait of at least two clock cycles after specifying the initial settings is finished (<5>).) Note: The multiplication fails on hardware (for certain testcases), but always works as expected using rl78-elf-run simulator. I do not think the simulator has any cycle check for nop's. Please let me know if this is OK to commit. Regards, Kaushik 2013-05-10 Kaushik Phatak * config/rl78/rl78.md (mulsi3_g13): Add additional 'nop' required in multiply-accumulate mode diff -uprN /home/kpit/fsfsrc/gcc-4.8.0-20121219/gcc/config/rl78/rl78.md gcc/config/rl78/rl78.md --- /home/kpit/fsfsrc/gcc-4.8.0-20121219/gcc/config/rl78/rl78.md 2013-01-25 16:26:27.000000000 +0530 +++ gcc/config/rl78/rl78.md 2013-05-10 16:57:26.000000000 +0530 @@ -381,6 +381,7 @@ movw ax, %h2 movw 0xffff2, ax ; MDAH nop ; mdc += mdal * mdah + nop ; Additional nop for MAC mov a, #0x40 mov !0xf00e8, a ; MDUC @@ -389,6 +390,7 @@ movw ax, %H2 movw 0xffff2, ax ; MDAH nop ; mdc += mdal * mdah + nop ; Additional nop for MAC movw ax, !0xf00e0 ; MDCL movw %H0, ax ; end of mulsi macro"