https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107172

--- Comment #12 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #11)
> Assuming (reg:CCC 17 flags) is set to 1 by compare properly, how should

A MODE_CC RTL reg is never set to "1".  It is set to the result of a
comparison,
instead.  The semantics of a consumer of a MODE_CC depends on the producer.

> (insn 50 49 51 2 (parallel [
>             (set (reg:SI 93)
>                 (neg:SI (ltu:SI (reg:CCC 17 flags)
>                         (const_int 0 [0]))))
>             (clobber (reg:CC 17 flags))
>         ]) "107172.c":4:10 1258 {*x86_movsicc_0_m1_neg}
>      (expr_list:REG_DEAD (reg:CCC 17 flags)
>         (expr_list:REG_UNUSED (reg:CC 17 flags)
>             (nil))))
> 
> work?

The semantics of
  (ltu:SI (reg:CCC 17) (const_int 0))
is: the result of "ltu" of the producer of this reg 17, taken from 17 as mode
CCC (which means only the carry output is valid), and that result as a SImode
(which then depends on what STORE_FLAG_VALUE is for your target -- 1 or -1 for
most targets, but other values are more complicated).

It never means "1".  It never means "0".  Never.

To determine the semantics of this piece of RTL you need to see the setter(s)
of reg 17 feeding this use.  In this case, the setter was
  (set (reg:CCC 17)
       (ne:CCC (reg:SI 82)
               (const_int 0 [0])))
which has no meaning for a use that uses "ltu".

Reply via email to