From patchwork Thu Aug 16 18:00:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 178057 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 9D6952C009D for ; Fri, 17 Aug 2012 04:01:56 +1000 (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=1345744916; 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=tJbK7N6tBjtwQMG+2S+r Ty7Z/6U=; b=jRuWPdK3L/oVVUOKqRy4/dLUab/FSK/byTsA8deyDenZacMUrV7k LUIWwqoZ53j66euhQ9woLF/sdHIZZ5dHN+dbkwMjnDZmCLBDHr3hW1n0rt/nqNXF LdOBbXMVsmqUKPf9LPOO1/MjNtjGJJ3YmkmcCfaU8dyEWyjnL/df3Oc= 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=HBWGU8gVmsTnBJC5IFXYxtikQArF/tLywE1Y4OzS1nA4nCtlnPRqOKgh6P2Atb G6FGXZ7qYOjbmZppOf3UlPgu6j0aU5uTTbTnrr5zVZM+yjBVBvPnPPFZjHoSuZVK KTAPTezIiyHaXtPSX0XLTm7nAfTfTeiZ7OCaVi3RD4txU=; Received: (qmail 23593 invoked by alias); 16 Aug 2012 18:01:21 -0000 Received: (qmail 23454 invoked by uid 22791); 16 Aug 2012 18:01:18 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL, BAYES_05, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RP_MATCHES_RCVD, SUBJ_ALL_CAPS, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout01.t-online.de (HELO mailout01.t-online.de) (194.25.134.80) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Aug 2012 18:01:04 +0000 Received: from fwd53.aul.t-online.de (fwd53.aul.t-online.de ) by mailout01.t-online.de with smtp id 1T24NS-0002DN-3x; Thu, 16 Aug 2012 20:01:02 +0200 Received: from [192.168.0.100] (r3reivZEYh9otJ7EDYPYA4fYN7xbNhdB19sJNo-ghjv01xr0fzA1v3ettbdFYJMwZs@[93.218.191.124]) by fwd53.t-online.de with esmtp id 1T24NL-08DGZk0; Thu, 16 Aug 2012 20:00:55 +0200 Message-ID: <1345140050.3584.11.camel@yam-132-YW-E178-FTW> Subject: [SH] PR 54089 From: Oleg Endo To: gcc-patches Date: Thu, 16 Aug 2012 20:00:50 +0200 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 fixes the case where a dynamic shift would expand into a P27 shift sequence that clobbers T_REG, which would result in wrong code. Tested on rev 190396 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 ChangeLog: PR target/54089 * config/gcc/sh/sh.md (ashlsi3_d): Do not split if it would result in a T_REG clobber. Correct comment. (ashlsi3_n): Correct comment. Index: gcc/config/sh/sh.md =================================================================== --- gcc/config/sh/sh.md (revision 190396) +++ gcc/config/sh/sh.md (working copy) @@ -3746,7 +3746,8 @@ (match_operand:SI 2 "shift_count_operand" "r")))] "TARGET_DYNSHIFT" "shld %2,%0" - "&& (CONST_INT_P (operands[2]) && ! sh_dynamicalize_shift_p (operands[2]))" + "&& CONST_INT_P (operands[2]) && ! sh_dynamicalize_shift_p (operands[2]) + && ! sh_ashlsi_clobbers_t_reg_p (operands[2])" [(const_int 0)] { if (satisfies_constraint_P27 (operands[2])) @@ -3759,7 +3760,9 @@ /* This must happen before reload, otherwise the constant will be moved into a register due to the "r" constraint, after which this split cannot be done anymore. - Unfortunately the move insn will not always be eliminated. */ + Unfortunately the move insn will not always be eliminated. + Also, here we must not create a shift sequence that clobbers the + T_REG. */ emit_move_insn (operands[0], operands[1]); gen_shifty_op (ASHIFT, operands); DONE; @@ -3782,8 +3785,7 @@ if (sh_dynamicalize_shift_p (operands[2]) && can_create_pseudo_p ()) { /* If this pattern was picked and dynamic shifts are supported, switch - to dynamic shift pattern before reload. However, we must not - create a shift sequence that clobbers the T_REG. */ + to dynamic shift pattern before reload. */ operands[2] = force_reg (SImode, operands[2]); emit_insn (gen_ashlsi3_d (operands[0], operands[1], operands[2])); }