From patchwork Thu Jun 1 11:31:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 769636 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 3wdlYc4d24z9s78 for ; Thu, 1 Jun 2017 21:32:01 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="kcgU77pu"; 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:from :to:subject:date:message-id; q=dns; s=default; b=c884qfTkaWJoAdi OQ3q4OJ389g3zzglJT58FHB7VLyPU4P8QJmxAGYe41vb8iH0NBviExp3g4O04yrd k2lh7HCuL64XrVQcW1yoEMYdZnaPwmdrM0+owlKLYP4smc4HlCFCY+wb1yUbcfEr YQaNlnt9+4Xns/40MGHep8419G6s= 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:from :to:subject:date:message-id; s=default; bh=RrRJDnfsrZ2yO9uI3P7NA TQXvkY=; b=kcgU77puXallg/Ysz4U62nPyU0D9Mu5weHPidMdG7kNISshCZlcot BCI6Z+asO494A+B82ZaIFTuZ3ua7mRXOznq+oGrpOc9xydQG4OUeyAeX9bRV2Mr+ ST1Y1eQHXxLFx4Q9j0TmTY5FvRzXxHfOD3SIJyw7JDylpHHRSvq99I= Received: (qmail 13452 invoked by alias); 1 Jun 2017 11:31:48 -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 13433 invoked by uid 89); 1 Jun 2017 11:31:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=ooo X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0a-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.156.1) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Jun 2017 11:31:45 +0000 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v51BT2vh056659 for ; Thu, 1 Jun 2017 07:31:48 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ate7tvmnn-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 01 Jun 2017 07:31:47 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Jun 2017 12:31:45 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Jun 2017 12:31:44 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v51BViI84981194 for ; Thu, 1 Jun 2017 11:31:44 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 919FF5203F for ; Thu, 1 Jun 2017 11:28:40 +0100 (BST) Received: from maggie.boeblingen.de.ibm.com (unknown [9.152.212.134]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 8134D5204B for ; Thu, 1 Jun 2017 11:28:40 +0100 (BST) From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [Committed] S/390: Don't fetch the return address early with ooo Date: Thu, 1 Jun 2017 13:31:43 +0200 X-TM-AS-GCONF: 00 x-cbid: 17060111-0040-0000-0000-000003BF1572 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060111-0041-0000-0000-00002053CABC Message-Id: <20170601113143.13851-1-krebbel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-01_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706010211 X-IsSubscribed: yes We used to load the return address slot some time in advance. This helped on older machines to resolve the data dependencies in time. However, it is pointless on out of order CPUs. Disabled with that patch. Regression tested on s390x. Committed to mainline. Bye, -Andreas- gcc/ChangeLog: 2017-06-01 Andreas Krebbel * config/s390/s390.c (s390_emit_epilogue): Disable early return address fetch for z10 or later. --- gcc/config/s390/s390.c | 63 +++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 7be22d9..eb94237 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -11410,38 +11410,39 @@ s390_emit_epilogue (bool sibcall) gen_rtx_REG (Pmode, i), cfa_restores); } - if (! sibcall) - { - /* Fetch return address from stack before load multiple, - this will do good for scheduling. - - Only do this if we already decided that r14 needs to be - saved to a stack slot. (And not just because r14 happens to - be in between two GPRs which need saving.) Otherwise it - would be difficult to take that decision back in - s390_optimize_prologue. */ - if (cfun_gpr_save_slot (RETURN_REGNUM) == SAVE_SLOT_STACK) - { - int return_regnum = find_unused_clobbered_reg(); - if (!return_regnum) - return_regnum = 4; - return_reg = gen_rtx_REG (Pmode, return_regnum); - - addr = plus_constant (Pmode, frame_pointer, - offset + cfun_frame_layout.gprs_offset - + (RETURN_REGNUM - - cfun_frame_layout.first_save_gpr_slot) - * UNITS_PER_LONG); - addr = gen_rtx_MEM (Pmode, addr); - set_mem_alias_set (addr, get_frame_alias_set ()); - emit_move_insn (return_reg, addr); + /* Fetch return address from stack before load multiple, + this will do good for scheduling. + + Only do this if we already decided that r14 needs to be + saved to a stack slot. (And not just because r14 happens to + be in between two GPRs which need saving.) Otherwise it + would be difficult to take that decision back in + s390_optimize_prologue. + + This optimization is only helpful on in-order machines. */ + if (! sibcall + && cfun_gpr_save_slot (RETURN_REGNUM) == SAVE_SLOT_STACK + && s390_tune <= PROCESSOR_2097_Z10) + { + int return_regnum = find_unused_clobbered_reg(); + if (!return_regnum) + return_regnum = 4; + return_reg = gen_rtx_REG (Pmode, return_regnum); + + addr = plus_constant (Pmode, frame_pointer, + offset + cfun_frame_layout.gprs_offset + + (RETURN_REGNUM + - cfun_frame_layout.first_save_gpr_slot) + * UNITS_PER_LONG); + addr = gen_rtx_MEM (Pmode, addr); + set_mem_alias_set (addr, get_frame_alias_set ()); + emit_move_insn (return_reg, addr); - /* Once we did that optimization we have to make sure - s390_optimize_prologue does not try to remove the - store of r14 since we will not be able to find the - load issued here. */ - cfun_frame_layout.save_return_addr_p = true; - } + /* Once we did that optimization we have to make sure + s390_optimize_prologue does not try to remove the store + of r14 since we will not be able to find the load issued + here. */ + cfun_frame_layout.save_return_addr_p = true; } insn = restore_gprs (frame_pointer,