From patchwork Fri Nov 2 10:22:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 196534 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]) by ozlabs.org (Postfix) with SMTP id E60062C0332 for ; Fri, 2 Nov 2012 21:23:05 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352456586; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Date:Content-Type:Mime-Version: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=ipEQIVdwWsPO+YY/0k0t 79bDCeg=; b=pwWI3T3vPoTJViwUtVkQd+9YaPSkhUlPZu1o2UIt9S9cQnsI5xth qi9hrJEfbpiwSlbDd2YMQriUC3Bnm+AGvnDNLjE513L0iyZXK6akAKPeKNIIxjLO NA0Nyhnrw8ibnkZk2hDB5ESnulzHsb7Djw2TRDqUAF8fhO6JdAMaN4w= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Subject:From:To:Date:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=KeLJg/lVFJBTvrHaUNfaL3ZdtArI1cY6iufy2bIhWk7vX7K3J50/IVfz37B1Qf g08zbmpHtm07Q0JlLNEtXYBgycW6Q6UiGaOGNickKRPLPgz0Ug/KT2mPf/+1SMdR 1rAUfox93JsdnC2syJmcXw8rhA3TDBCBmFIVKJtfepS1U=; Received: (qmail 10414 invoked by alias); 2 Nov 2012 10:23:00 -0000 Received: (qmail 10388 invoked by uid 22791); 2 Nov 2012 10:22:58 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=AWL, BAYES_00, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout02.t-online.de (HELO mailout02.t-online.de) (194.25.134.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 10:22:52 +0000 Received: from fwd14.aul.t-online.de (fwd14.aul.t-online.de ) by mailout02.t-online.de with smtp id 1TUEOo-000522-5M; Fri, 02 Nov 2012 11:22:50 +0100 Received: from [192.168.0.100] (JlSaTQZCwh-OmD6+kNsEJeOcA1XHiwBcf9LcQa+Uycs1E2cK8COZhX4dgNaC-8OgQn@[87.157.62.210]) by fwd14.t-online.de with esmtp id 1TUEOg-2FGzmy0; Fri, 2 Nov 2012 11:22:42 +0100 Message-ID: <1351851753.8110.42.camel@yam-132-YW-E178-FTW> Subject: [SH] Use some more multi-line asm in sh.c From: Oleg Endo To: gcc-patches Date: Fri, 02 Nov 2012 11:22:33 +0100 Mime-Version: 1.0 X-IsSubscribed: yes 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 Hello, This mainly reformats some of the asm output code in sh.c to use multi-line strings. Tested on rev 193061 with make -k check RUNTESTFLAGS="--target_board=sh-sim \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}" and no new failures. OK? Cheers, Oleg gcc/ChangeLog: * config/sh/sh.c (output_movedouble, output_far_jump, output_ieee_ccmpeq): Use multi-line strings for asm. (find_regmode_weight): Wrap lines. (sh_optimize_target_register_callee_saved): Remove commented out variable. (emit_load_ptr): Remove prototype. Index: gcc/config/sh/sh.c =================================================================== --- gcc/config/sh/sh.c (revision 193061) +++ gcc/config/sh/sh.c (working copy) @@ -2600,21 +2600,25 @@ if (MEM_P (dst) && GET_CODE (XEXP (dst, 0)) == PRE_DEC) - return "mov.l %T1,%0\n\tmov.l %1,%0"; + return "mov.l %T1,%0" "\n" + " mov.l %1,%0"; if (register_operand (dst, mode) && register_operand (src, mode)) { if (REGNO (src) == MACH_REG) - return "sts mach,%S0\n\tsts macl,%R0"; + return "sts mach,%S0" "\n" + " sts macl,%R0"; /* When mov.d r1,r2 do r2->r3 then r1->r2; when mov.d r1,r0 do r1->r0 then r2->r1. */ if (REGNO (src) + 1 == REGNO (dst)) - return "mov %T1,%T0\n\tmov %1,%0"; + return "mov %T1,%T0" "\n" + " mov %1,%0"; else - return "mov %1,%0\n\tmov %T1,%T0"; + return "mov %1,%0" "\n" + " mov %T1,%T0"; } else if (CONST_INT_P (src)) { @@ -2654,19 +2658,23 @@ break; case LABEL_REF: - return "mov.l %1,%0\n\tmov.l %1+4,%T0"; + return "mov.l %1,%0" "\n" + " mov.l %1+4,%T0"; case POST_INC: - return "mov.l %1,%0\n\tmov.l %1,%T0"; + return "mov.l %1,%0" "\n" + " mov.l %1,%T0"; default: gcc_unreachable (); } /* Work out the safe way to copy. Copy into the second half first. */ if (dreg == ptrreg) - return "mov.l %T1,%T0\n\tmov.l %1,%0"; + return "mov.l %T1,%T0" "\n" + " mov.l %1,%0"; } - return "mov.l %1,%0\n\tmov.l %T1,%T0"; + return "mov.l %1,%0" "\n" + " mov.l %T1,%T0"; } /* Print an instruction which would have gone into a delay slot after @@ -2698,7 +2706,8 @@ && offset - get_attr_length (insn) <= 32766) { far = 0; - jump = "mov.w %O0,%1; braf %1"; + jump = "mov.w %O0,%1" "\n" + " braf %1"; } else { @@ -2706,12 +2715,19 @@ if (flag_pic) { if (TARGET_SH2) - jump = "mov.l %O0,%1; braf %1"; + jump = "mov.l %O0,%1" "\n" + " braf %1"; else - jump = "mov.l r0,@-r15; mova %O0,r0; mov.l @r0,%1; add r0,%1; mov.l @r15+,r0; jmp @%1"; + jump = "mov.l r0,@-r15" "\n" + " mova %O0,r0" "\n" + " mov.l @r0,%1" "\n" + " add r0,%1" "\n" + " mov.l @r15+,r0" "\n" + " jmp @%1"; } else - jump = "mov.l %O0,%1; jmp @%1"; + jump = "mov.l %O0,%1" "\n" + " jmp @%1"; } /* If we have a scratch register available, use it. */ if (NONJUMP_INSN_P ((prev = prev_nonnote_insn (insn))) @@ -2719,7 +2735,12 @@ { this_jmp.reg = SET_DEST (XVECEXP (PATTERN (prev), 0, 0)); if (REGNO (this_jmp.reg) == R0_REG && flag_pic && ! TARGET_SH2) - jump = "mov.l r1,@-r15; mova %O0,r0; mov.l @r0,r1; add r1,r0; mov.l @r15+,r1; jmp @%1"; + jump = "mov.l r1,@-r15" "\n" + " mova %O0,r0" "\n" + " mov.l @r0,r1" "\n" + " add r1,r0" "\n" + " mov.l @r15+,r1" "\n" + " jmp @%1"; output_asm_insn (jump, &this_jmp.lab); if (dbr_sequence_length ()) print_slot (final_sequence); @@ -2738,12 +2759,12 @@ need its value across jumps, so save r13 in it instead of in the stack. */ if (TARGET_SH5) - output_asm_insn ("lds r13, macl", 0); + output_asm_insn ("lds r13,macl", 0); else output_asm_insn ("mov.l r13,@-r15", 0); output_asm_insn (jump, &this_jmp.lab); if (TARGET_SH5) - output_asm_insn ("sts macl, r13", 0); + output_asm_insn ("sts macl,r13", 0); else output_asm_insn ("mov.l @r15+,r13", 0); } @@ -2911,7 +2932,8 @@ const char * output_ieee_ccmpeq (rtx insn, rtx *operands) { - return output_branchy_insn (NE, "bt\t%l9\n\tfcmp/eq\t%1,%0", + return output_branchy_insn (NE, "bt %l9" "\n" + " fcmp/eq %1,%0", insn, operands); } @@ -11051,10 +11073,12 @@ if (mode == SFmode) INSN_REGMODE_WEIGHT (insn, mode) = - find_insn_regmode_weight (insn, mode) + 2 * find_insn_regmode_weight (insn, DFmode); + find_insn_regmode_weight (insn, mode) + + 2 * find_insn_regmode_weight (insn, DFmode); else if (mode == SImode) INSN_REGMODE_WEIGHT (insn, mode) = - find_insn_regmode_weight (insn, mode) + 2 * find_insn_regmode_weight (insn, DImode); + find_insn_regmode_weight (insn, mode) + + 2 * find_insn_regmode_weight (insn, DImode); } } @@ -11350,15 +11374,12 @@ static bool sh_optimize_target_register_callee_saved (bool after_prologue_epilogue_gen) { - HARD_REG_SET dummy; -#if 0 - rtx insn; -#endif - if (! shmedia_space_reserved_for_target_registers) return 0; if (after_prologue_epilogue_gen && ! TARGET_SAVE_ALL_TARGET_REGS) return 0; + + HARD_REG_SET dummy; if (calc_live_regs (&dummy) >= 6 * 8) return 1; return 0; @@ -12298,8 +12319,6 @@ return 2 * ((GET_MODE_SIZE (mode) + 3) / 4U); } -static rtx emit_load_ptr (rtx, rtx); - static rtx emit_load_ptr (rtx reg, rtx addr) {