From patchwork Mon Jan 12 20:19:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 428114 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 2CD8D1400F1 for ; Tue, 13 Jan 2015 07:19:23 +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:subject:content-type; q= dns; s=default; b=Me47Jx0Y3uuSPj4KW6YGjOtFCnhK1nTsv27gtj2tnCc2HA WwaVRArkCkLtbrilv6WcC7lPk5N1G3XK0zLkhxrEIxBApEA5LuvSjybCrsUQWhDY qvgojtyjc+CjmKm98AnwQuVIsb3teYCEyiW6sQL95q2oNS3YXj+oYRADjlexQ= 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:subject:content-type; s= default; bh=b93NzWq/rAWP4cgyFE2TE22CAuY=; b=FW5iB0Nhcbnz3RmL6jHm l0D7Bnf9CzOogd41RUyU1juG4pN5/vSTiBVgOB5E8mtQeUN2tFwjcysJWwlp3fgt d/Gq9qCqzId+bG164DU/DueQxsjKNE9UaTGbUiAzG6MkED95TZgJOi6MuFNTTNWb KlX5KsYKezrt4IScMV971vQ= Received: (qmail 31034 invoked by alias); 12 Jan 2015 20:19:16 -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 31017 invoked by uid 89); 12 Jan 2015 20:19:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 12 Jan 2015 20:19:14 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0CKJC4b032077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 12 Jan 2015 15:19:13 -0500 Received: from [10.3.113.77] (ovpn-113-77.phx2.redhat.com [10.3.113.77]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0CKJCYe000495 for ; Mon, 12 Jan 2015 15:19:12 -0500 Message-ID: <54B42C3F.3050401@redhat.com> Date: Mon, 12 Jan 2015 13:19:11 -0700 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR64461, Incorrect code on coldfire targets X-IsSubscribed: yes As suggested by Andreas in the PR, the simplest fix for this problem is to disable the various trunc* patterns for TARGET_COLDFIRE. That's precisely what this patch does. Built cross compilers with and without the m68k.md hunk. Verified the test failed without the m68k.mk hunk and passed with the m68k.md hunk. For "fun" I've got an m68k bootstrap of the trunk running. I don't expect it to finish for at least a week or so, assuming it runs to completion. Installed on the trunk (in separate commits due to stupidity on my part). Jeff PR target/64461 * config/m68k/m68k.md (truncsiqi2): Disable for TARGET_COLDFIRE. (trunchiqi2, truncsihi2): Similarly. PR target/64461 * gcc.target/m68k/pr64461.c: New test. diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index 2783a8f..2a314c3 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -1572,7 +1572,7 @@ [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d") (truncate:QI (match_operand:SI 1 "general_src_operand" "doJS,i")))] - "" + "!TARGET_COLDFIRE" { if (GET_CODE (operands[0]) == REG) { @@ -1590,7 +1590,7 @@ [(set (match_operand:QI 0 "nonimmediate_operand" "=dm,d") (truncate:QI (match_operand:HI 1 "general_src_operand" "doJS,i")))] - "" + "!TARGET_COLDFIRE" { if (GET_CODE (operands[0]) == REG && (GET_CODE (operands[1]) == MEM @@ -1617,7 +1617,7 @@ [(set (match_operand:HI 0 "nonimmediate_operand" "=dm,d") (truncate:HI (match_operand:SI 1 "general_src_operand" "roJS,i")))] - "" + "!TARGET_COLDFIRE" { if (GET_CODE (operands[0]) == REG) { diff --git a/gcc/testsuite/gcc.target/m68k/pr64461.c b/gcc/testsuite/gcc.target/m68k/pr64461.c new file mode 100644 index 0000000..dd70355 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/pr64461.c @@ -0,0 +1,16 @@ +/* { dg-do assemble } */ +/* { dg-options "-mcpu=5235 -Os" } */ + +typedef struct rtems_rfs_block_map_s +{ + long unsigned int blocks[(5)]; +} rtems_rfs_block_map; + +extern int foo (void); + +int +rtems_rfs_block_map_indirect_alloc (rtems_rfs_block_map *map, + unsigned char* buffer, int b) +{ + (buffer + b * 4)[3] = (unsigned char) map->blocks[b]; +}