enforcing mode matching in SET

Jim Wilson wilson@cygnus.com
Thu Aug 13 16:21:00 GMT 1998


	(set (match_operand:SI 0 "register_operand" "=&r")
		(ne:DI (match_operand:DI 1 "register_operand" "r")
		       (const_int 0)))

The NE operator should be SImode.  There is no need for a truncate operator,
and it would be undesirable to add one.

For a comparison operator, the mode of the comparison is obtained from its
operands.  The mode of the comparison operator itself indicates the mode of
the result of the comparison, which may be a different mode than the inputs.
(See also the "RTL comparison" and "RTL comparison operations" sections of
rtl.texi.)

For example, the cmpsi_insn pattern in sparc.md has
  [(set (reg:CC 100)
        (compare:CC (match_operand:SI 0 "register_operand" "r")
                    (match_operand:SI 1 "arith_operand" "rI")))]
This is an SImode compare producing a CCmode result.  EQ/NE/LT/etc all work
similarly.

Jim



More information about the Gcc mailing list