This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Porting GCC: Compare-and-Branch-Instructions
- To: Anja Müller <Mueller-Lehnitz at t-online dot de>
- Subject: Re: Porting GCC: Compare-and-Branch-Instructions
- From: Prashant Pogde <pogde at cse dot iitk dot ac dot in>
- Date: Sat, 5 Feb 2000 00:19:08 +0530 (IST)
- cc: gcc at gcc dot gnu dot org, "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>, Joern Rennecke <amylaar at cygnus dot co dot uk>, Richard Hadsell <hadsell at blueskystudios dot com>
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