From patchwork Thu Mar 10 23:10:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 595999 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 E3FCC1409C2 for ; Fri, 11 Mar 2016 10:11:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=npURZTlE; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:date:from:cc:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=Zg5qM FEclnh+WeSd2ceo9yzvVjS8zb9DrGmVIPxC8YpNDPZe5/dr2wgSR4jvBK9N0rgNh UGMsmkPG/XY63/vHZmMf7Wvt0GcCWm+Eu5c5k2JtVJiGZZEEaqCxdmr2v+l55sdH LN5OIltnd6y+crYrFFZrGzQONW6UbKHtwsxI64= 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 :subject:to:date:from:cc:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=HEdWepYPtoj lyzfuU6f+DUCiA2I=; b=npURZTlEbib46LdPREX1sX0CIUc9WOxF+OQ7SSK6Bga gBNIiVsFAUwV5FmS0nxzmKZhUzUcM+9C7gqDYVRHvj84QZKM/+67S5RKUOO2FSGO HiRr+Yc6B/buE9rbzBz0A+RCx+Z5h2nWLuAGLVETR30CFViAoZuMEEdWbJm8GTPQ = Received: (qmail 123735 invoked by alias); 10 Mar 2016 23:10:46 -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 123701 invoked by uid 89); 10 Mar 2016 23:10:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=sk:reg_ove X-HELO: e06smtp06.uk.ibm.com Received: from e06smtp06.uk.ibm.com (HELO e06smtp06.uk.ibm.com) (195.75.94.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 10 Mar 2016 23:10:42 +0000 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Mar 2016 23:10:39 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp06.uk.ibm.com (192.168.101.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 10 Mar 2016 23:10:37 -0000 X-IBM-Helo: d06dlp01.portsmouth.uk.ibm.com X-IBM-MailFrom: uweigand@de.ibm.com X-IBM-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0160017D8042 for ; Thu, 10 Mar 2016 23:11:06 +0000 (GMT) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u2ANAbdk64225390 for ; Thu, 10 Mar 2016 23:10:37 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u2ANAb0G016993 for ; Thu, 10 Mar 2016 18:10:37 -0500 Received: from oc7340732750.ibm.com (icon-9-164-152-70.megacenter.de.ibm.com [9.164.152.70]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u2ANAaCc016990; Thu, 10 Mar 2016 18:10:37 -0500 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 0AAB77B54; Fri, 11 Mar 2016 00:10:35 +0100 (CET) Subject: [PATCH, rs6000] Fix PR target/70168 To: gcc-patches@gcc.gnu.org Date: Fri, 11 Mar 2016 00:10:35 +0100 (CET) From: "Ulrich Weigand" Cc: dje.gcc@gmail.com MIME-Version: 1.0 Message-Id: <20160310231036.0AAB77B54@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16031023-0025-0000-0000-0000065363B9 Hello, this patch fixes PR target/70168, a wrong code generation problem caused by rs6000_expand_atomic_compare_and_swap not properly handling the case where changing retval clobbers newval due to a register overlap. Tested with no regressions on powerpc64le-linux on mainline and gcc-5-branch. OK for both? Bye, Ulrich ChangeLog: PR target/70168 * config/rs6000/rs6000.c (rs6000_expand_atomic_compare_and_swap): Handle overlapping retval and newval. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 234119) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -20740,6 +20740,9 @@ if (mode != TImode && !reg_or_short_operand (oldval, mode)) oldval = copy_to_mode_reg (mode, oldval); + if (reg_overlap_mentioned_p (retval, newval)) + newval = copy_to_reg (newval); + mem = rs6000_pre_atomic_barrier (mem, mod_s); label1 = NULL_RTX;