emit_no_conflict_block breaks some conditional moves

James E Wilson wilson@specifixinc.com
Tue Apr 26 00:26:00 GMT 2005


Greg McGary wrote:
> That will do fine for ports that have conditional move, but without
> movsicc, you'll have this case:
>     cmpsi ...
>     bcc 1f
>     movsi target, ...
>   1:
>     cmpsi ...
>     bcc 2f
>     movsi target, ...
>   2:
>     <cc-clobbering insns...>

Thanks for the additional details.  I had to remind myself what 
emit_no_conflict_block does.

Looking at emit_no_conflict_block, I see that it already tests for 
!NONJUMP_INSN_P, and returns without emitting a no conflict block in 
that case, which looks like the right solution to me.  So this case with 
branches is not a problem.

That just leaves the case with multiple compares and conditional moves.

I think there are possible register allocation problems here, as a 
REG_NO_CONFLICT block note is really only supposed to be attached to 
insns that set a word of the output using a word of the input.  If we 
attach them to other instructions, that might confuse the register 
allocator into failing.  Also, REG_NO_CONFLICT is supposed to be 
attached to every instruction inside a no conflict block, and some 
passes look for that, so fixing the code to emit REG_NO_CONFLICT on only 
some of the instructions doesn't seem safe either.

I think this has to be fixed by not emitting the no conflict block, just 
as we already handle the branching case.  So this means adding a check 
where we also check !NONJUMP_INSN_P to handle this case.  You didn't get 
a sample sequence for this case, so it isn't clear what the exact 
criteria should be.  I suggested earlier checking for a hard reg CCmode 
dest.  Alternatively, maybe checking for a conditional move insn would 
make sense, i.e. an insn with if_then_else in the source.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list