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]

Porting question: define_expand Vs define_split


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


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