shifting among patterns
Bill McEnaney
bill@rkirkpat.net
Mon Mar 15 10:29:00 GMT 2010
Rajiv,
I'm sorry I don't know the answer to your question. But thank you for
writing such readable code.
Cheers,
Bill
>
> Hi all,
>
> I am new to this porting gcc architecture field. I have a doubt.
>
> What i was trying is, In "movdi" pattern for some pairs of constraints
like
> (r,r) or (m,r) i was letting movdi pattern to handle this while
working over
> 64bit data. But for other constraints pair like (r,i) or (r,m) i was
trying
> to make movsi handle this pair of constraints by diverting from movdi to
> movsi. I did it in this way:
>
> (define_expand "movdi"
> [(set (match_operand:DI 0 "general_operand" "")
> (match_operand:DI 1 "general_operand" ""))]
> ""
> "
> if(GET_CODE(operands[0])==MEM && GET_CODE(operands[1])!=REG)
>
> {
>
> if(can_create_pseudo_p())
>
> {
>
> operands[1]=force_reg(DImode,operands[1]);
>
> }
>
> }
> "
> )
> (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.
>
> I am new, learning while practising. Please help me in this.
>
> Rajiv.
>
>
>
>
>
>
>
>
> --
> View this message in context:
http://old.nabble.com/shifting-among-patterns-tp27901006p27901006.html
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>
________________________________________________________________
Please visit a saintly hero:
http://www.jakemoore.org
More information about the Gcc-help
mailing list