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]

Re: Question about Machine Description


yazdanbakhsh <amir.yazdanbakhsh@gmail.com> writes:

> (define_expand "cbranchsi4"
>   [(set (pc)
> 	(if_then_else: SI (le:SI (match_operand:SI 0 "register_operand" "=d,d")
> (match_operand:SI 1 "register_operand" "=d,d"))
> 		      (label_ref (match_operand 2 "" ""))
> 		      (pc)))]
>   ""
>   "
> {
>       gen_conditional_le (operands[0],operands[1],operands[2]);
>       DONE;
> }")

The cbranchsi4 expander will be called to generate all conditional
branches.  You are only generating a ble, which is not going work.
The insn pattern of an expander is simply the default insn that it
generates.  When you end the expander code with DONE, the insn pattern
is ignored.  If you want to take this approach you need to handle all
supported conditional branches here.

See many examples in existing backends.  Besides the extensive
internal documentation, there are dozens of working examples that you
can look at to see how to implement this.


> but it didn't work...

In your next message please tell us how it failed, not merely the fact
that it failed.

Ian


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