From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18615 invoked by alias); 18 Aug 2011 14:18:47 -0000 Received: (qmail 18605 invoked by uid 22791); 18 Aug 2011 14:18:45 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Aug 2011 14:18:31 +0000 Received: by gyg4 with SMTP id 4so1538865gyg.20 for ; Thu, 18 Aug 2011 07:18:30 -0700 (PDT) Received: by 10.151.3.13 with SMTP id f13mr773372ybi.215.1313677110335; Thu, 18 Aug 2011 07:18:30 -0700 (PDT) Received: from pauldell (124-149-34-246.dyn.iinet.net.au [124.149.34.246]) by mx.google.com with ESMTPS id u31sm3811970ybu.24.2011.08.18.07.18.27 (version=SSLv3 cipher=OTHER); Thu, 18 Aug 2011 07:18:29 -0700 (PDT) Message-ID: <83AE32AC40864C5F854BAD4E3B4F9265@pauldell> From: "Paul Edwards" To: "Ulrich Weigand" Cc: References: <201108181314.p7IDEb78001020@d06av02.portsmouth.uk.ibm.com> In-Reply-To: <201108181314.p7IDEb78001020@d06av02.portsmouth.uk.ibm.com> Subject: Re: i370 port Date: Thu, 18 Aug 2011 14:18:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg00341.txt.bz2 Well done! That generated sensible code: L 15,=V(PRINTF) BALR 14,15 L 3,=F'32880' AR 3,13 MVC 0(10,3),0(2) I still have the other knock-on effects from when I did this though: C:\devel\gcc\gcc\config\i370>cvs diff i370.h Index: i370.h =================================================================== RCS file: c:\cvsroot/gcc/gcc/config/i370/i370.h,v retrieving revision 1.17 diff -r1.17 i370.h 599a600,602 > #define EXTRA_MEMORY_CONSTRAINT(C, STR) \ > ((C) == 'S') > (like the 8 byte move from F'0'). I'll do my own investigation of that and report that later. BFN. Paul. -----Original Message----- From: Ulrich Weigand Sent: Thursday, August 18, 2011 11:14 PM To: Paul Edwards Cc: gcc@gcc.gnu.org Subject: Re: i370 port Paul Edwards wrote: > Hi Ulrich. I put in the following debug: > > op0 = find_replacement (&XEXP (in, 0)); > op1 = find_replacement (&XEXP (in, 1)); > > /* Since constraint checking is strict, commutativity won't be > checked, so we need to do that here to avoid spurious failure > if the add instruction is two-address and the second operand > of the add is the same as the reload reg, which is frequently > the case. If the insn would be A = B + A, rearrange it so > it will be A = A + B as constrain_operands expects. */ > > fprintf(stderr, "REGNO(out) is %d\n", REGNO(out)); > fprintf(stderr, " REG in 1 is %d\n", REGNO(XEXP(in,1))); > if (GET_CODE (XEXP (in, 1)) == REG > && REGNO (out) == REGNO (XEXP (in, 1))) > tem = op0, op0 = op1, op1 = tem; > > And it produced this output (for exactly the same code I showed > you previously): > > C:\devel\pdos\s370>\devel\gcc\gcc\gccmvs -da -DUSE_MEMMGR -Os -DS390 -S -I > . -I ../pdpclib pdos.c > REGNO(out) is 3 > REG in 1 is 32880 > REGNO(out) is 2 > REG in 1 is 32880 > REGNO(out) is 2 > REG in 1 is 32880 > REGNO(out) is 2 > REG in 1 is 112 > REGNO(out) is 3 > REG in 1 is 32880 > REGNO(out) is 4 > REG in 1 is 112 > REGNO(out) is 2 > REG in 1 is 112 > > which looks to me like it is not seeing a register, only a constant, > so cannot perform a swap. Oops, there's clearly a bug here. "in" at this point is the original expression that has not yet been reloaded, so its second operand will indeed be a constant, not a register. However, reload has already decided that this constant will end up being replaced by a register, and that is what the "find_replacement" call is checking. So at this point in the program, XEXP (in, 1) will be the constant, but op1 will be the register it is going to be replaced with. Unfortunately the test whether to swap looks at XEXP (in, 1) -- it really needs to look at op1 instead. Can you try changing the lines if (GET_CODE (XEXP (in, 1)) == REG && REGNO (out) == REGNO (XEXP (in, 1))) to if (GET_CODE (op1) == REG && REGNO (out) == REGNO (op1)) instead? Bye, Ulrich -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com