From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125713 invoked by alias); 14 Apr 2016 17:10:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 125058 invoked by uid 89); 14 Apr 2016 17:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=mere X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 14 Apr 2016 17:10:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 69544812CD; Thu, 14 Apr 2016 19:10:36 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DWhFjg_3KDS6; Thu, 14 Apr 2016 19:10:36 +0200 (CEST) Received: from [10.10.8.10] (unknown [10.10.8.10]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 125D0812CA; Thu, 14 Apr 2016 19:10:34 +0200 (CEST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: rs6000 stack_tie mishap again From: Olivier Hainque In-Reply-To: <570FCA3B.2070001@redhat.com> Date: Thu, 14 Apr 2016 17:10:00 -0000 Cc: Andreas Krebbel , Alan Modra , GCC Patches , Richard Henderson , Segher Boessenkool , uweigand@de.ibm.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <20160324041034.GB31470@bubble.grove.modra.org> <56F96CE2.9020001@redhat.com> <888A9BC7-458D-46DE-BEC1-8AC000C6849D@adacore.com> <570FBB7C.7060802@linux.vnet.ibm.com> <570FCA3B.2070001@redhat.com> To: Jeff Law X-SW-Source: 2016-04/txt/msg00679.txt.bz2 > On 14 Apr 2016, at 18:50, Jeff Law wrote: >=20 > I thought we had code to handle this case specially, but I can't immediat= ely find it in sched-deps.c. Unless I misunderstood what you were exactly looking for, the special code is in alias.c. E.g. write_dependence_p: /* (mem:BLK (scratch)) is a special mechanism to conflict with everything. This is used in epilogue deallocation functions. */ ... > Some ports also use an unspec_volatile to achieve the same effect: >=20 > ;; UNSPEC_VOLATILE is considered to use and clobber all hard registers and > ;; all of memory. This blocks insns from being moved across this point. >=20 > (define_insn "blockage" > [(unspec_volatile [(const_int 0)] UNSPECV_BLOCKAGE)] > "" > "" > [(set_attr "length" "0")]) Yes, I pondered this one and thought that a memory barrier would be less aggressive, while good enough. > ;; Do not schedule instructions accessing memory across this point. >=20 > (define_expand "memory_blockage" > [(set (match_dup 0) > (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BLOCKAGE))] > "" > { > operands[0] =3D gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode)); > MEM_VOLATILE_P (operands[0]) =3D 1; > }) >=20 > (define_insn "*memory_blockage" > [(set (match_operand:BLK 0) > (unspec:BLK [(match_dup 0)] UNSPEC_MEMORY_BLOCKAGE))] > "" > "" > [(set_attr "length" "0")]) Emitting just that alone isn't enough though. The first attempt I made did that and failed because the whole=20 reg-restore reg-restore tie (mem blockage only) =20=20 sequence was allowed to move past the stack pointer reset when it's performed as a mere register to register move. So I ended up adding the clobber mem:blk scratch to the existing tie parallel, which references the stack pointer register as well so is forbidden to move past it's update. Olivier