Abt RTL expression - combining instruction
Rohit Arul Raj
rohitarulraj@gmail.com
Wed Nov 8 14:00:00 GMT 2006
Hi all,
I have used cbranchmode4 instruction to generate combined compare and
branch instruction.
(define_insn "cbranchmode4"
(set (pc) (if_then_else
(match_operator:CC 0 "comparison_operator"
[ (match_operand:SI 1 "register_operand" "r,r")
(match_operand:SI 2 "nonmemory_operand" "O,r")])
(label_ref (match_operand 3 "" ""))
(pc)))]
This pattern matches if the code is of the form
if ( h == 1)
p = 0;
if the code is of the form
if (h), if (h >= 0)
p = 0;
Then it matches the seperate compare and branch instructions and not
cbranch instruction.
Can anyone point out where i am going wrong?
Regards,
Rohit
On 06 Nov 2006 23:15:04 -0800, Ian Lance Taylor <iant@google.com> wrote:
> "Rohit Arul Raj" <rohitarulraj@gmail.com> writes:
>
> > I am trying to combine the compare and branch instruction. But my
> > instructions are not getting generated as my operands are not matched
> > properly.
> >
> > Previously for individual compare instructions, i had
> > operand 0 - Register operand
> > operand 1 - Non memory operand.
> >
> > For branch instruction,
> > operator 0 - compare operator
> > operand 1 - label.
> >
> > So when i combined compare and branch, i just superimposed both
> > statements with same conditions with
> > operand 0 - Register operand
> > operand 1 - Non memory operand
> > operator 2 - comparison operator
> > operand 3 - label.
> >
> > 1. Is it the right way to match operands and operators while combining
> > instruction?
> > 2. How to check where my instruction matching goes wrong?
>
> When writing an MD file you have to think about what you generate
> (insns/expanders with standard names) and what you recognize (insns).
> You have to always generate something which you can recognize.
>
> Anyhow, the easier way to generate a combined compare and branch
> instruction is to use an insn or expander with the cbranchMM4 standard
> name. See the documentation.
>
> Ian
>
More information about the Gcc
mailing list