Porting GCC: Compare-and-Branch-Instructions
Prashant Pogde
pogde@cse.iitk.ac.in
Fri Feb 4 10:59:00 GMT 2000
Hi,
U can write something like ::
first in "config/i8051.h"
extern struct rtx_def *i8051_compare_op0; /* operand 0 for comparisons */
extern struct rtx_def *i8051_compare_op1; /* operand 1 for comparisons */
then in md file :
NOTE here i m replacing define_insn with define_expand.
(define_expand "cmpqi"
[(set (cc0) (compare (match_operand:QI 0 "register_operand" "%a,a")
(match_operand:QI 1 "nonmemory_operand" "r,i")))]
""
"*
{
i8051_compare_op0 = operands[0];
i8051_compare_op1 = operands[1];
DONE;
}")
(define_insn "beq"
[(set (pc)
(if_then_else (lt (cc0)
(const_int 0))
(label_ref (match_operand 0 "" ""))
(pc)))]
""
"*
{
;; here u can emit instruction CJNE with operands
;; i8051_compare_op0, i8051_compare_op1 & operands[0] according
;; to ur assembly syntax for it.
}")
>Or do you know another GCC Target Machine that works this way so that I
>can read its machine description ?
I don't know exactly where u can find similar instructions,
but i got this idea from i386.md.
well I too am new to gcc backend,and i m not sure if it will work :)
but u can try it.
regards
prashant
-----==- Prashant Pogde
----==-- _ Graduate Student
---==---(_)__ __ ____ __ Deptt. of Computer Sc. & Engg.
--==---/ / _ \/ // /\ \/ / IIT Kanpur -208016
-=====/_/_//_/_,_/ /_/_\ e-mail: pogde@cse.iitk.ac.in
The choice of a GNU generation phone : (0512) 597653
More information about the Gcc
mailing list