From patchwork Wed Feb 10 18:03:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 581525 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 BA6E2140779 for ; Thu, 11 Feb 2016 05:03:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=M0vaHka3; 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:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=oYwmLuFg9RkI2DbtSiJWJuXF6v5r8PTUuN216Z3rv+uOb2j7mY QyQxGLsb4L/XCEv/qkLXeSVePe/wiDCvv2Q0Vn6tXIw0kIN/qs9Nupsf8GYxY8VF tg9xB1tyB1fbpL1fSwSvNntvRgJVpNYVttuzBbRTZivulP+cl7r8I5x/U= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=EYS7jnqqGiHcgj1bJfONjfUbj5Y=; b=M0vaHka3fUcG5a/lOA5N kZU2hpWtDkfKaufBqfrrU8249NbzIIRBEpqiv1rJQkcLmsMRZSvtLFe/goDN/cX1 vJxpd4yElrMwhRcn2AYhWcRms7lXhbhoFzklgM2ZEiii+Agia4t47Ze2WP4Znb+a IaGn//IRKpwHKCiRpmKEjWQ= Received: (qmail 63468 invoked by alias); 10 Feb 2016 18:03:27 -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 63452 invoked by uid 89); 10 Feb 2016 18:03:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=BAYES_00, KAM_ASCII_DIVIDERS, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 spammy=rld, yr 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; Wed, 10 Feb 2016 18:03:24 +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 (Postfix) with ESMTPS id 8D72880511 for ; Wed, 10 Feb 2016 18:03:23 +0000 (UTC) Received: from [10.3.112.82] (ovpn-112-82.phx2.redhat.com [10.3.112.82]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1AI3Mvn017365 for ; Wed, 10 Feb 2016 13:03:22 -0500 To: gcc-patches From: Vladimir Makarov Subject: Patch to fix PR69148 Message-ID: <56BB7B69.40701@redhat.com> Date: Wed, 10 Feb 2016 13:03:21 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 X-IsSubscribed: yes The following patch fixes https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69148 The patch was successfully bootstrapped and tested on x86/x86-64 and s390x. Committed as rev. 233283 I'll wait for a few days before committing it into gcc-5 branch. Index: ChangeLog =================================================================== --- ChangeLog (revision 233282) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2016-02-10 Vladimir Makarov + + PR target/69148 + * lra-constraints.c (curr_insn_transform): Find in/out operands + for secondary memory moves. Update dups. + 2016-02-10 Yuri Rumyantsev PR tree-optimization/69652 Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 233282) +++ lra-constraints.c (working copy) @@ -3559,14 +3559,26 @@ curr_insn_transform (bool check_only_p) if (use_sec_mem_p) { + int in = -1, out = -1; rtx new_reg, src, dest, rld; machine_mode sec_mode, rld_mode; - lra_assert (sec_mem_p); - lra_assert (curr_static_id->operand[0].type == OP_OUT - && curr_static_id->operand[1].type == OP_IN); - dest = *curr_id->operand_loc[0]; - src = *curr_id->operand_loc[1]; + lra_assert (curr_insn_set != NULL_RTX && sec_mem_p); + dest = SET_DEST (curr_insn_set); + src = SET_SRC (curr_insn_set); + for (i = 0; i < n_operands; i++) + if (*curr_id->operand_loc[i] == dest) + out = i; + else if (*curr_id->operand_loc[i] == src) + in = i; + for (i = 0; i < curr_static_id->n_dups; i++) + if (out < 0 && *curr_id->dup_loc[i] == dest) + out = curr_static_id->dup_num[i]; + else if (in < 0 && *curr_id->dup_loc[i] == src) + in = curr_static_id->dup_num[i]; + lra_assert (out >= 0 && in >= 0 + && curr_static_id->operand[out].type == OP_OUT + && curr_static_id->operand[in].type == OP_IN); rld = (GET_MODE_SIZE (GET_MODE (dest)) <= GET_MODE_SIZE (GET_MODE (src)) ? dest : src); rld_mode = GET_MODE (rld); @@ -3599,14 +3611,16 @@ curr_insn_transform (bool check_only_p) } else if (dest == rld) { - *curr_id->operand_loc[0] = new_reg; + *curr_id->operand_loc[out] = new_reg; + lra_update_dup (curr_id, out); after = emit_spill_move (false, new_reg, dest); lra_process_new_insns (curr_insn, NULL, after, "Inserting the sec. move"); } else { - *curr_id->operand_loc[1] = new_reg; + *curr_id->operand_loc[in] = new_reg; + lra_update_dup (curr_id, in); /* See comments above. */ push_to_sequence (before); before = emit_spill_move (true, new_reg, src); Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 233282) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2016-02-10 Vladimir Makarov + + PR target/69468 + * gcc.target/s390/pr69148.c: New. + 2016-02-10 Yuri Rumyantsev PR tree-optimization/69652 Index: testsuite/gcc.target/s390/pr69148.c =================================================================== --- testsuite/gcc.target/s390/pr69148.c (revision 0) +++ testsuite/gcc.target/s390/pr69148.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O -march=z196 -m64 -w" } */ +union U { int r; float f; }; +struct A { + int a; + union U b[64]; + }; + double foo (double); + +void +bar (struct A *z, int x) +{ + union U y; + y.f = foo (z->b[x].f); + z->a = y.r ? 4 : y.r; +}