From patchwork Sun Jan 11 14:02:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 427469 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5004D14017D for ; Mon, 12 Jan 2015 01:02:46 +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 :message-id:date:from:mime-version:to:cc:subject:content-type :content-transfer-encoding; q=dns; s=default; b=BCyXSLc4PFm2AdC0 4TiWRYZcvTp/CdiLkTcVtdMHzlV0EOxvJVJ+2AEYXDjAXRwijwtkMwN66ZgN0RBY t5vGow8Dd+DYEg9EziKS76kspHyT0kTptPiykqSQjMWmewqUH2HAhCtMQ7dqSN/E 0j+MuKDsS3xfk7WKw3DhK5WMIyM= 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 :message-id:date:from:mime-version:to:cc:subject:content-type :content-transfer-encoding; s=default; bh=+xM8vx5R1opSwLvzqsrjZk Ux0LU=; b=uzlVBVKd2ayFeok4qJRROmDws6Nu4Y454vK76ktoKpcP4dfTyw2FHo BcdoWfFI+ucooJ4plJeHdM62Rh18LQz6vnOvBorG8RPpVk/C7Ml1muW3WQAumrEv Ftt7sm4qt0ojEvtqRZ0PsGBnTLbCCAw72oAiKxtmGUt0C2Iype3ek= Received: (qmail 25263 invoked by alias); 11 Jan 2015 14:02:37 -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 25250 invoked by uid 89); 11 Jan 2015 14:02:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: out1134-249.mail.aliyun.com Received: from out1134-249.mail.aliyun.com (HELO out1134-249.mail.aliyun.com) (42.120.134.249) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Jan 2015 14:02:24 +0000 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.08487807|-1; FP=0|0|0|0|0|-1|-1|-1; HT=r46d02009; MF=gang.chen@sunrus.com.cn; PH=DS; RN=3; RT=3; SR=0; Received: from 192.168.1.104(mailfrom:gang.chen@sunrus.com.cn ip:223.72.65.53) by smtp.aliyun-inc.com(10.147.11.248); Sun, 11 Jan 2015 22:02:14 +0800 Message-ID: <54B28270.8000208@sunrus.com.cn> Date: Sun, 11 Jan 2015 22:02:24 +0800 From: Chen Gang S User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Jeff Law , kazu@codesourcery.com CC: gcc-patches List Subject: [PATCH] config/h8300/h8300.c: Regress part of the original commit for fixing issue The related commit "1a1ed14 config/h8300: Use rtx_insn" gives an extra check for rtx, which will cause building libgcc break, after regress it, it can still generate the correct assemble code. The related information is below: [root@localhost libgcc]# cat libgcc2.i typedef int DItype __attribute__ ((mode (DI))); DItype __muldi3 (DItype u, DItype v) { return u + v; } [root@localhost libgcc]# /upstream/build-gcc-h8300/gcc/cc1 -ms -O2 libgcc2.i __muldi3 Analyzing compilation unit Performing interprocedural optimizations <*free_lang_data> Assembling functions: __muldi3 libgcc2.i: In function '__muldi3': libgcc2.i:5:1: internal compiler error: in as_a, at is-a.h:192 } ^ 0xce2aef as_a ../../gcc/gcc/is-a.h:192 0xce2aef Fpa ../../gcc/gcc/config/h8300/h8300.c:530 0xce2aef h8300_push_pop ../../gcc/gcc/config/h8300/h8300.c:724 0xce33e3 h8300_push_pop ../../gcc/gcc/config/h8300/h8300.c:869 0xce33e3 h8300_expand_prologue() ../../gcc/gcc/config/h8300/h8300.c:890 0xcee69a gen_prologue() ../../gcc/gcc/config/h8300/h8300.md:2651 0x7c0b19 thread_prologue_and_epilogue_insns() ../../gcc/gcc/function.c:5923 0x7c1032 rest_of_handle_thread_prologue_and_epilogue ../../gcc/gcc/function.c:6493 0x7c1032 execute ../../gcc/gcc/function.c:6531 After this patch, it can generate the correct assembly code: [root@localhost libgcc]# h8300-gchen-elf-gcc -ms -O2 -S libgcc2.i [root@localhost libgcc]# cat ./libgcc2.s .file "libgcc2.i" .h8300s .section .text .align 1 .global ___muldi3 ___muldi3: mov.l er6,@-er7 mov.l er7,er6 stm.l er4-er5,@-er7 sub.l #12,er7 mov.l er0,er2 mov.l er1,er3 mov.l @(8,er6),er0 mov.l er0,@(-20,er6) mov.l @(12,er6),er0 mov.l er0,@(-16,er6) mov.l er0,er5 add.l er1,er5 sub.l er1,er1 add.b #1,r1l cmp.l er3,er5 blo .L2 sub.l er1,er1 .L2: mov.l @(-20,er6),er4 add.l er2,er4 mov.l er1,er0 add.l er4,er0 mov.l er5,er1 add.l #12,er7 ldm.l @er7+,er4-er5 mov.l @er7+,er6 rts .size ___muldi3, .-___muldi3 .ident "GCC: (GNU) 5.0.0 20150109 (experimental)" .end For mode(DI), it generates 64-bit integer, so it uses er0 and er1 as parameter 1, and stack (8,er6) and (12,er6) for parameter 2, return value is er0 and er1. And the internal algorithim is also correct. 2015-01-11 Chen Gang * config/h8300/h8300.c (F): Use rtx instead of rtx_insn *. (Fpa): Remove additional check by rtx_insn *. --- gcc/config/h8300/h8300.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index fe85df5..994c38f 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -506,8 +506,8 @@ byte_reg (rtx x, int b) && !crtl->is_leaf))) /* We use this to wrap all emitted insns in the prologue. */ -static rtx_insn * -F (rtx_insn *x, bool set_it) +static rtx +F (rtx x, bool set_it) { if (set_it) RTX_FRAME_RELATED_P (x) = 1; @@ -527,7 +527,7 @@ Fpa (rtx par) int i; for (i = 0; i < len; i++) - F (as_a (XVECEXP (par, 0, i)), true); + F (XVECEXP (par, 0, i), true); return par; }