This is the mail archive of the gcc-help@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]

Re: adding movz to machine description



----- Original Message ----- From: "Ian Lance Taylor" <iant@google.com>
To: "Petar Bajic" <petar.bajic@micronasnit.com>
Cc: <gcc-help@gcc.gnu.org>
Sent: Thursday, July 13, 2006 9:51 AM
Subject: Re: adding movz to machine description



"Petar Bajic" <petar.bajic@micronasnit.com> writes:

If I write define_expand like this :

(define_expand "movsicc_movz"
  [(set (match_operand:SI 0 "register_operand" "=d,d")
  (if_then_else (eq (match_operand:SI 2 "register_operand" "=d,d")
(const_int 0))
     (match_operand:SI 1 "register_operand" "=d,d") (match_dup 0)))]
  ""
  "{dlx_emit_cond_move(operands[0], operands[1], operands[2]); DONE;}" )


it never gets used/generated

In order for a define_expand to be used by the machine independent code, it must have a standard name, as listed here: http://gcc.gnu.org/onlinedocs/gccint/Standard-Names.html

In this case you should call it simply "movsicc", not "movsicc_movz".

Ian


define_expand is used but instruction is not generated


(define_expand "movsicc"
[(set (match_operand:SI 0 "register_operand" "=d,d")
(if_then_else:SI (eq:SI (match_operand:SI 2 "register_operand" "=d,d") (const_int 0))
(match_operand:SI 1 "register_operand" "=d,d")
(match_dup 0)))]
""
"
{
dlx_emit_cond_move(operands[0], operands[1], operands[2]);
DONE;
}")


In function dlx_emitcond_move I try to emit my instruction "movsicc_movz".
Comment is printed out, but instruction is not generated.
dlx_emit_cond_move (rtx dest, rtx src1, rtx test_rtx)

{

printf("dlx_emit_cond_move called");



emit_insn(gen_movsicc_movz(dest, src1, test_rtx));

return TRUE;

}

and finally instruction is defined like this:

(define_insn "movsicc_movz"
 [(set (match_operand:SI 0 "register_operand" "=d,d")
  (if_then_else:SI (match_operand:SI 1 "comparison_operator" "")
   (match_operand:SI 2 "register_operand" "=d,d")
   (match_dup 0)))]
 ""
 "movz\\t%0,%2,%1"
 [(set_attr "type" "condmove")
  (set_attr "mode" "SI")])

I also have regular patern movsicc_insn wich is always used, and if I skip it's definition, I can't build compiler (errpor "gen_movsicc_move not defined")

(define_insn "movsicc_internal"
[(set (match_operand:SI 0 "register_operand" "=j,j")
(if_then_else:SI
(match_operator 1 "comparison_operator" [(match_operand:SI 4 "register_operand" "=k,k") (const_int 0)])
(match_operand:SI 2 "register_operand" "=d,d")
(match_operand:SI 3 "register_operand" "=d,d")))]
""
"movz\\t%0,%2,%4\\n\\tmovn\\t%0,%3,%4"
[(set_attr "type" "condmove")
(set_attr "mode" "SI")])


What do I have to do to make compiler use movsicc_movz when appropriate?



Petar


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