From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94202 invoked by alias); 2 Nov 2015 22:30:09 -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 94177 invoked by uid 89); 2 Nov 2015 22:30:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,RCVD_IN_SBL autolearn=no version=3.3.2 X-HELO: contrabass.corbina.net Received: from contrabass.corbina.net (HELO contrabass.corbina.net) (85.21.78.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Nov 2015 22:30:06 +0000 Received: from corbina.ru (violin.corbina.net [195.14.50.30]) by contrabass.corbina.net (Postfix) with ESMTP id 849C6E655C; Tue, 3 Nov 2015 02:30:01 +0400 (MSK) Received: from [95.26.94.56] (account aesok@post.ru HELO Vista) by post.ru (CommuniGate Pro SMTP 6.0.10) with ESMTPA id 512628821; Tue, 03 Nov 2015 01:30:01 +0300 Message-ID: From: "Anatoly Sokolov" To: "gcc-patches" , "Bernd Schmidt" References: <562EAD37.4040402@post.ru> <562F56FD.9010806@redhat.com> In-Reply-To: <562F56FD.9010806@redhat.com> Subject: Re: [PATCH] Use subreg_regno instead of subreg_regno_offset Date: Mon, 02 Nov 2015 22:30:00 -0000 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0925_01D115D7.124133F0" X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg00136.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0925_01D115D7.124133F0 Content-Type: text/plain; format=flowed; charset="utf-8"; reply-type=response Content-Transfer-Encoding: 7bit Content-length: 2020 Hello. ----- Original Message ----- From: "Bernd Schmidt" Sent: Tuesday, October 27, 2015 1:50 PM > On 10/26/2015 11:46 PM, Anatoliy Sokolov wrote: >> This patch change code 'REGNO (subreg) + subreg_regno_offset (...)' >> with subreg_regno (subreg). > > >> Index: gcc/reg-stack.c >> =================================================================== >> --- gcc/reg-stack.c (revision 229083) >> +++ gcc/reg-stack.c (working copy) >> @@ -416,11 +416,7 @@ >> rtx subreg; >> if (STACK_REG_P (subreg = SUBREG_REG (*pat))) >> { > > Isn't this wrong? subreg_regno wants to be called with a SUBREG, but here > we already had subreg = SUBREG_REG (*pat). > Fixed. >> @@ -5522,12 +5516,7 @@ >> op0 = SUBREG_REG (op0); >> code0 = GET_CODE (op0); >> if (code0 == REG && REGNO (op0) < FIRST_PSEUDO_REGISTER) >> - op0 = gen_rtx_REG (word_mode, >> - (REGNO (op0) + >> - subreg_regno_offset (REGNO (SUBREG_REG (orig_op0)), >> - GET_MODE (SUBREG_REG (orig_op0)), >> - SUBREG_BYTE (orig_op0), >> - GET_MODE (orig_op0)))); >> + op0 = gen_rtx_REG (word_mode, subreg_regno (op0)); >> } > > Same problem as in the reg-stack code? The existing code was using > orig_op0 to get the subreg, you've changed it to use op0 which is already > the SUBREG_REG. > No promblens here. At this point op0 is equivalent orig_op0. New value to op0 can be assigned later. > With an x86 test you're not exercising reload, and even on other targets > this is not a frequently used path. I've stopped reviewing here, I think > this is a good example of the kind of cleanup patch we _shouldn't_ be > doing. We've proved it's risky, and unless these cleanup patches were a > preparation for functional changes, we should just leave the code alone > IMO. > > > Bernd Ok. In any case, a revised patch. Anatoly. ------=_NextPart_000_0925_01D115D7.124133F0 Content-Type: text/plain; format=flowed; name="sr2.diff.txt"; reply-type=response Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sr2.diff.txt" Content-length: 5613 Index: gcc/caller-save.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/caller-save.c (revision 229560) +++ gcc/caller-save.c (working copy) @@ -991,31 +991,25 @@ add_stored_regs (rtx reg, const_rtx setter, void *data) { int regno, endregno, i; - machine_mode mode =3D GET_MODE (reg); - int offset =3D 0; =20 if (GET_CODE (setter) =3D=3D CLOBBER) return; =20 - if (GET_CODE (reg) =3D=3D SUBREG + if (SUBREG_P (reg) && REG_P (SUBREG_REG (reg)) - && REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER) + && HARD_REGISTER_P (SUBREG_REG (reg))) { - offset =3D subreg_regno_offset (REGNO (SUBREG_REG (reg)), - GET_MODE (SUBREG_REG (reg)), - SUBREG_BYTE (reg), - GET_MODE (reg)); - regno =3D REGNO (SUBREG_REG (reg)) + offset; + regno =3D subreg_regno (reg); endregno =3D regno + subreg_nregs (reg); } - else + else if (REG_P (reg)=20 + && HARD_REGISTER_P (reg)) { - if (!REG_P (reg) || REGNO (reg) >=3D FIRST_PSEUDO_REGISTER) - return; - - regno =3D REGNO (reg) + offset; - endregno =3D end_hard_regno (mode, regno); + regno =3D REGNO (reg); + endregno =3D end_hard_regno (GET_MODE (reg), regno); } + else + return; =20 for (i =3D regno; i < endregno; i++) SET_REGNO_REG_SET ((regset) data, i); Index: gcc/df-scan.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/df-scan.c (revision 229560) +++ gcc/df-scan.c (working copy) @@ -2587,8 +2587,7 @@ =20 if (GET_CODE (reg) =3D=3D SUBREG) { - regno +=3D subreg_regno_offset (regno, GET_MODE (SUBREG_REG (reg)), - SUBREG_BYTE (reg), GET_MODE (reg)); + regno =3D subreg_regno (reg);=20 endregno =3D regno + subreg_nregs (reg); } else Index: gcc/reg-stack.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/reg-stack.c (revision 229560) +++ gcc/reg-stack.c (working copy) @@ -416,11 +416,7 @@ rtx subreg; if (STACK_REG_P (subreg =3D SUBREG_REG (*pat))) { - int regno_off =3D subreg_regno_offset (REGNO (subreg), - GET_MODE (subreg), - SUBREG_BYTE (*pat), - GET_MODE (*pat)); - *pat =3D FP_MODE_REG (REGNO (subreg) + regno_off, + *pat =3D FP_MODE_REG (subreg_regno (*pat), GET_MODE (subreg)); return pat; } Index: gcc/reload.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/reload.c (revision 229560) +++ gcc/reload.c (working copy) @@ -2253,10 +2253,7 @@ i =3D REGNO (SUBREG_REG (x)); if (i >=3D FIRST_PSEUDO_REGISTER) goto slow; - i +=3D subreg_regno_offset (REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), - GET_MODE (x)); + i =3D subreg_regno (x); } else i =3D REGNO (x); @@ -2266,10 +2263,7 @@ j =3D REGNO (SUBREG_REG (y)); if (j >=3D FIRST_PSEUDO_REGISTER) goto slow; - j +=3D subreg_regno_offset (REGNO (SUBREG_REG (y)), - GET_MODE (SUBREG_REG (y)), - SUBREG_BYTE (y), - GET_MODE (y)); + j =3D subreg_regno (y); } else j =3D REGNO (y); @@ -5519,12 +5513,7 @@ op0 =3D SUBREG_REG (op0); code0 =3D GET_CODE (op0); if (code0 =3D=3D REG && REGNO (op0) < FIRST_PSEUDO_REGISTER) - op0 =3D gen_rtx_REG (word_mode, - (REGNO (op0) + - subreg_regno_offset (REGNO (SUBREG_REG (orig_op0)), - GET_MODE (SUBREG_REG (orig_op0)), - SUBREG_BYTE (orig_op0), - GET_MODE (orig_op0)))); + op0 =3D gen_rtx_REG (word_mode, subreg_regno (op0)); } =20 if (GET_CODE (op1) =3D=3D SUBREG) @@ -5534,12 +5523,7 @@ if (code1 =3D=3D REG && REGNO (op1) < FIRST_PSEUDO_REGISTER) /* ??? Why is this given op1's mode and above for ??? op0 SUBREGs we use word_mode? */ - op1 =3D gen_rtx_REG (GET_MODE (op1), - (REGNO (op1) + - subreg_regno_offset (REGNO (SUBREG_REG (orig_op1)), - GET_MODE (SUBREG_REG (orig_op1)), - SUBREG_BYTE (orig_op1), - GET_MODE (orig_op1)))); + op1 =3D gen_rtx_REG (GET_MODE (op1), subreg_regno (op1)); } /* Plus in the index register may be created only as a result of register rematerialization for expression like &localvar*4. Reload it. @@ -6544,14 +6528,16 @@ return refers_to_mem_for_reload_p (in); else if (GET_CODE (x) =3D=3D SUBREG) { - regno =3D REGNO (SUBREG_REG (x)); - if (regno < FIRST_PSEUDO_REGISTER) - regno +=3D subreg_regno_offset (REGNO (SUBREG_REG (x)), - GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x), - GET_MODE (x)); - endregno =3D regno + (regno < FIRST_PSEUDO_REGISTER - ? subreg_nregs (x) : 1); + if (HARD_REGISTER_P (SUBREG_REG (x))) + { + regno =3D subreg_regno (x); + endregno =3D regno + subreg_nregs (x); + } + else + { + regno =3D REGNO (SUBREG_REG (x)); + endregno =3D regno + 1; + } =20 return refers_to_regno_for_reload_p (regno, endregno, in, (rtx*) 0); } ------=_NextPart_000_0925_01D115D7.124133F0--