On 07/19/2011 08:57 AM, Paulo J. Matos wrote:
> On 19/07/11 16:41, Richard Henderson wrote:
>> (or fails to set the flags in a way that
>> is useful for the comparison).
> 
> I am not sure I understand the above. Could you give an example where
> certain flags might be set but are not useful for comparison?

You pasted one before -- the RX definition of ABS.

The instruction description of the O flag for ABS reads:

# The flag is set if src before the operation was 80000000h; otherwise it is 
cleared.

The upshot is that the entire flags register is set as if
the operation was "0 - src", i.e.

  (compare:CC (const_int 0) (reg:SI src))

However, the comparison that we're actually going to try
to generate is

  (compare:CC (abs:SI (reg:SI src)) (const_int 0))

Which is of course not the same thing.  However, if we can
ignore the O flag for a given comparison, then we can still
usefully make use of some of the flags.  E.g. the Z flag in
testing for (in)equality against zero.

The other very common case is subtract, where the flags are
set as if the comparison is

  (compare:CC input1 input2)

whereas the comparison that we generate is

  (compare:CC output 0)

Have a look at all the uses of rx_match_ccmode in rx.md.



r~

Reply via email to