[Committed] S/390: Avoid true-complementary bypass problem for reg-reg compares

Andreas Krebbel Andreas.Krebbel@de.ibm.com
Fri Feb 27 22:33:00 GMT 2009


> It is curious that you do the first swap depending on reg_mentioned_p,
> but the second one only depending on s390_non_addr_reg_read_p.

That's because in the first 'if' we only swap the compare operands and
this does never cost us performance.  So the check is less strict
since it doesn't matter if the swap is not actually needed.  The
second 'if' might add a NOP instruction which we would like to avoid
if not necessary.  Certainly it doesn't hurt to use
s390_non_addr_reg_read_p also in the first check but I think it is ok
the way it is.

> s390_non_addr_reg_read_p itself is strange because it will return
> false for a store that stores a register to an address containing
> that register.

This is expected behavior.  The function is intended to only return
true if the register is solely read outside an address.  The bypass
problem does not occur with the store you mentioned.

> Finally, it would seem that if both op0 and op1 potentially conflict
> with prev_insn, you end up with a the original op0 now in op1 and
> thus conflicting. (op0 and op1 would usually be different, and
> they may be used as input to a binary operator in the other insn,
> but I would assume they may even be identical unless you can prove
> otherwise).

S/390 does not have instructions which read 2 general purpose
registers outside an address and a comparison with 2 identical
registers will not occur.  For comparisons with 0 we usually use a
load and test instruction which does not suffer from the bypass
problem.

Bye,

-Andreas-



More information about the Gcc-patches mailing list