This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Porting question: define_expand Vs define_split
- From: Balaji S <sivanbalaji at acmet dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 03 Nov 2004 12:11:13 +0530
- Subject: Porting question: define_expand Vs define_split
- Organization: Acme Technologies Pvt. Ltd.
Hi all,
I am porting GCC to a new architecture using stormy16 as base.
In my architecture there is no instruction for /neg/ operation. So i planned to handle it using /sub/. I am able to accomplish this job by using either define_expand or define_split without knowing its internals as follows:
(define_expand "neghi2"
[(set (match_operand:HI 0 "register_operand" "")
(const_int 0))
(set (match_dup 0)
(minus:HI (match_dup 0)
(match_operand:HI 1 "register_operand" "")))]
""
"")
(define_insn_and_split "neghi2"
[(set (match_operand:HI 0 "register_operand" "=r")
(neg:HI (match_operand:HI 1 "register_operand" "0")))]
""
"#"
"reload_completed"
[(set (match_dup 0)
(const_int 0))
(set (match_dup 0)
(minus:HI (match_dup 0)
(match_dup 1)))]
"")
I do not know whether the above m/c descriptions are correct. Please correct me if any mistakes.
Moreover, i would like to know, when to use /define_expand/ and when to use /define_split/.
Thanks in advance,
Balaji S