This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
shifting among patterns
- From: Rajiv KI <rajivkumarsingla at gmx dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 15 Mar 2010 00:17:55 -0700 (PDT)
- Subject: shifting among patterns
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.