Re: shifting among patterns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rajiv KI <rajivkumarsingla@xxxxxxx> writes:

> (define_insn_and_split "*movdi"
>   [(set(match_operand: DI 0  "nonimmediate_operand" "=r,r,r,m")
>
>         (match_operand:  DI  1   "general_operand"        "r,Di,m,r"))]
>         ""
> 	"*
> 	 switch (which_alternative)
> 	 {
> 	 case 0:  return \"#\";
> 	 case 1:  
> 	 case 2:  return divert_to_si(operands);
> 	 case 3:  return output_move_double (operands);	 
> 	 }"
> 	"reload_completed"
>       [(set (match_dup 0)(match_dup 1))
> 	 (set (match_dup 2)(match_dup 3))]
>         "{
> 	    operands[2] = gen_highpart (SImode, operands[0]);
> 	    operands[0] = gen_lowpart (SImode, operands[0]);
>  	    operands[3] = gen_highpart (SImode, operands[1]);
> 	    operands[1] = gen_lowpart (SImode, operands[1]);
> 	}"
> )
>
> Here 'Di' is constraint for double integer range.
>
> And 'divert_to_si' is function i have written in '.c' file:
>
> void divert_to_si(rtx *operands)
> {
> 	printf("inside divert_to_si fxn\n");
> 	emit_insn(gen_movsi(operands[0],operands[1]));
> }
>
> My doubts are:
>
> 1.Can we do this type of diversion?
> 2.To me its giving 'segmentation fault' for simple 64bit assignment.

The general idea should work.  However, you appear to be returning a
void value from your define_insn_and_split.  That won't work.  The
define_insn_and_split needs to return a char*.  Make sure that
functions like divert_to_si are declared in your CPU-protos.h file.
Make sure your code compiles without warnings.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux