From patchwork Thu Oct 25 09:09:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 194079 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 D945A2C0097 for ; Thu, 25 Oct 2012 20:09:24 +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=1351760965; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Subject:Date:Message-ID: User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=XNSHSxfBTq3rtVkCjrD1g2lW/S8=; b=VXaZQIpIpcvv4JG 5rCBszH5i4IVY31DEM+ReNnabfF4evKV2qbBo6BAyuiSLhzKoD7Ri3c14oN9jdTe zdP+GoRj0E/IbveA461B3KKmrDIP2qutvw1uGf6dA6TcqWJqSs8tdYrO9nBmeMCC HHFDk90fjwnDM0u8guxxyuDBZBTU= 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:Received:From:To:Mail-Followup-To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=AlZJS+OK7JsPHpP2sUzhMqxKPIQLS1K3LMc7Su3cnigYl+gsAeU0cIdOcBJo9R BwuVDZpVILsHLM3L0gqISZ4vkTYvIzhb9ZTkZQkHh7E32fCgZ+oYITHrHoPCZH6X Xgdi7JSPmk5yYsfi/BdrI/dxg6zRrVDnulyjyP5fOeWIU=; Received: (qmail 11175 invoked by alias); 25 Oct 2012 09:09:19 -0000 Received: (qmail 11165 invoked by uid 22791); 25 Oct 2012 09:09:18 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, KHOP_RCVD_TRUST, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ea0-f175.google.com (HELO mail-ea0-f175.google.com) (209.85.215.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Oct 2012 09:09:14 +0000 Received: by mail-ea0-f175.google.com with SMTP id c1so489920eaa.20 for ; Thu, 25 Oct 2012 02:09:13 -0700 (PDT) Received: by 10.14.213.65 with SMTP id z41mr25196203eeo.29.1351156153117; Thu, 25 Oct 2012 02:09:13 -0700 (PDT) Received: from localhost ([2.26.192.222]) by mx.google.com with ESMTPS id t7sm29564200eel.14.2012.10.25.02.09.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 25 Oct 2012 02:09:11 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [committed] Fix noncanonical rtl in emit_block_move_via_loop Date: Thu, 25 Oct 2012 10:09:13 +0100 Message-ID: <87mwzancjq.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 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 I was curious why LRA needed to handle noncanonical rtl in addresses: if (CONSTANT_P (arg0) || code1 == PLUS || code1 == MULT || code1 == ASHIFT) { tloc = arg1_loc; arg1_loc = arg0_loc; arg0_loc = tloc; arg0 = *arg0_loc; code0 = GET_CODE (arg0); arg1 = *arg1_loc; code1 = GET_CODE (arg1); } and the culprit in all the cases I could see was emit_block_move_via_loop, which generated (plus (const...) (reg ...)) rather than the correct (plus (reg ...) (const...)). Tested on x86_64-linux-gnu and applied as obvious. Richard gcc/ * expr.c (emit_block_move_via_loop): Use simplify_gen_binary rather than gen_rtx_PLUS. Index: gcc/expr.c =================================================================== --- gcc/expr.c 2012-10-23 19:37:49.000000000 +0100 +++ gcc/expr.c 2012-10-25 09:36:33.071286674 +0100 @@ -1464,11 +1464,11 @@ emit_block_move_via_loop (rtx x, rtx y, emit_label (top_label); tmp = convert_modes (x_addr_mode, iter_mode, iter, true); - x_addr = gen_rtx_PLUS (x_addr_mode, x_addr, tmp); + x_addr = simplify_gen_binary (PLUS, x_addr_mode, x_addr, tmp); if (x_addr_mode != y_addr_mode) tmp = convert_modes (y_addr_mode, iter_mode, iter, true); - y_addr = gen_rtx_PLUS (y_addr_mode, y_addr, tmp); + y_addr = simplify_gen_binary (PLUS, y_addr_mode, y_addr, tmp); x = change_address (x, QImode, x_addr); y = change_address (y, QImode, y_addr);