* regrename: Fix for earlyclobber operands
@ 2015-11-06 10:54 Bernd Schmidt
2015-11-06 19:30 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Bernd Schmidt @ 2015-11-06 10:54 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]
I have a patch which makes use of the renamer more often, and this
exposed a bug with earlyclobber operands. The code that does the
terminate_write step has the following comment:
/* Step 5: Close open chains that overlap writes. Similar to
step 2, we hide in-out operands, since we do not want to
close these chains. We also hide earlyclobber operands,
since we've opened chains for them in step 1, and earlier
chains they would overlap with must have been closed at
the previous insn at the latest, as such operands cannot
possibly overlap with any input operands. */
That's all right as far as it goes, but the problem is that this means
there isn't a terminate_write step for earlyclobbers.
The following seems like the simplest possible fix. It was bootstrapped
and tested with -frename-registers enabled at -O1 on x86_64-linux. Ok?
(Incidentally there are some avx tests that fail if they are renamed,
apparently because the scan-assembler doesn't allow register numbers
like %zmm10. avx512bw-vptestmb-1.c is one of those).
Bernd
[-- Attachment #2: rr-ec-term.diff --]
[-- Type: text/x-patch, Size: 581 bytes --]
* regrename.c (record_out_operands): Terminate earlyclobbered
operands here.
Index: gcc/regrename.c
===================================================================
--- gcc/regrename.c (revision 229049)
+++ gcc/regrename.c (working copy)
@@ -1513,6 +1525,8 @@ record_out_operands (rtx_insn *insn, boo
cur_operand = insn_info->op_info + i;
prev_open = open_chains;
+ if (earlyclobber)
+ scan_rtx (insn, loc, cl, terminate_write, OP_OUT);
scan_rtx (insn, loc, cl, mark_write, OP_OUT);
/* ??? Many targets have output constraints on the SET_DEST
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: regrename: Fix for earlyclobber operands
2015-11-06 10:54 regrename: Fix for earlyclobber operands Bernd Schmidt
@ 2015-11-06 19:30 ` Jeff Law
2015-11-06 23:04 ` Bernd Schmidt
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2015-11-06 19:30 UTC (permalink / raw)
To: Bernd Schmidt, GCC Patches
On 11/06/2015 03:54 AM, Bernd Schmidt wrote:
> I have a patch which makes use of the renamer more often, and this
> exposed a bug with earlyclobber operands. The code that does the
> terminate_write step has the following comment:
>
> /* Step 5: Close open chains that overlap writes. Similar to
> step 2, we hide in-out operands, since we do not want to
> close these chains. We also hide earlyclobber operands,
> since we've opened chains for them in step 1, and earlier
> chains they would overlap with must have been closed at
> the previous insn at the latest, as such operands cannot
> possibly overlap with any input operands. */
>
> That's all right as far as it goes, but the problem is that this means
> there isn't a terminate_write step for earlyclobbers.
>
> The following seems like the simplest possible fix. It was bootstrapped
> and tested with -frename-registers enabled at -O1 on x86_64-linux. Ok?
>
> (Incidentally there are some avx tests that fail if they are renamed,
> apparently because the scan-assembler doesn't allow register numbers
> like %zmm10. avx512bw-vptestmb-1.c is one of those).
>
>
> Bernd
>
> rr-ec-term.diff
>
>
> * regrename.c (record_out_operands): Terminate earlyclobbered
> operands here.
Do you want to terminate those chains after step 6 is complete so that
the earlyclobber output conflicts with all the other outputs?
Isn't that how we typically do things for earlyclobbers in life
analysis? earlyclobbers birth before the insn so they conflict with the
inputs and die after the insn so they conflict with the outputs?
Or am I fundamentally wrong in even thinking about this in a manner
similar to lifetime analysis?
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: regrename: Fix for earlyclobber operands
2015-11-06 19:30 ` Jeff Law
@ 2015-11-06 23:04 ` Bernd Schmidt
2015-11-07 4:57 ` Jeff Law
0 siblings, 1 reply; 4+ messages in thread
From: Bernd Schmidt @ 2015-11-06 23:04 UTC (permalink / raw)
To: Jeff Law, GCC Patches
On 11/06/2015 08:30 PM, Jeff Law wrote:
>> * regrename.c (record_out_operands): Terminate earlyclobbered
>> operands here.
> Do you want to terminate those chains after step 6 is complete so that
> the earlyclobber output conflicts with all the other outputs?
I'm not sure what you mean by your question. This patch is about
terminating live registers that are overwritten by earlyclobber output
operands. We open a new chain for every output, ec or not, and since
they are live at the same time, they are all considered conflicting.
Bernd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: regrename: Fix for earlyclobber operands
2015-11-06 23:04 ` Bernd Schmidt
@ 2015-11-07 4:57 ` Jeff Law
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2015-11-07 4:57 UTC (permalink / raw)
To: Bernd Schmidt, GCC Patches
On 11/06/2015 04:04 PM, Bernd Schmidt wrote:
> On 11/06/2015 08:30 PM, Jeff Law wrote:
>>> * regrename.c (record_out_operands): Terminate earlyclobbered
>>> operands here.
>> Do you want to terminate those chains after step 6 is complete so that
>> the earlyclobber output conflicts with all the other outputs?
>
> I'm not sure what you mean by your question. This patch is about
> terminating live registers that are overwritten by earlyclobber output
> operands. We open a new chain for every output, ec or not, and since
> they are live at the same time, they are all considered conflicting.
I must have completely mis-understood the code.
OK for the trunk.
jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-07 4:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06 10:54 regrename: Fix for earlyclobber operands Bernd Schmidt
2015-11-06 19:30 ` Jeff Law
2015-11-06 23:04 ` Bernd Schmidt
2015-11-07 4:57 ` Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).