This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Questions about comparison insns in mips.md


Hello,
    Who can explains for me about the comparison insns in mips.md.
    One question, why there is only define_expand patterns but no
define_insn. Supposed that I have a comparison instruction say 'cmp
%1, %2', should I implement define_insn patterns for comparison insns?
Here is a pattern from mips.md,
(define_expand "cmpsi"
  [(set (cc0)
	(compare:CC (match_operand:SI 0 "register_operand" "")
		    (match_operand:SI 1 "arith_operand" "")))]
  ""
{
  branch_cmp[0] = operands[0];
  branch_cmp[1] = operands[1];
  branch_type = CMP_SI;
  DONE;
})
    The second question. As for SETTING A REGISTER FROM A COMPARISON,
must I implement them? Here is a pattern from mips.md,
(define_expand "seq"
  [(set (match_operand:SI 0 "register_operand" "=d")
	(lt:SI (match_dup 1)
	       (match_dup 2 )))]
  ""
{
   /* Set up operands from compare.  */
  operands[1] = branch_cmp[0];
  operands[2] = branch_cmp[1];
})
Why here use match_dup not match_operand? And why to set up operands
from compare?

Thanks a lot.

Eric.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]