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: How to implement the instruction in the back end


"Mohamed Shafi" <shafitvm@gmail.com> writes:

> For the 16-bit target that i porting now to gcc 4.1.2 doesn't have any
> branch instructions. It only has jump instructions. For comparison
> operation it has this instruction:
>
> if cond Rx Ry
>  execute this insn
>
> So compare and branch is implemented as
>
> if cond Rx Ry
>   jmp Label

For gcc's purposes this is no different from having a usual
conditional branch instruction.  It's just a jump with a condition.

> This instructions has also another form. To check whether a particular
> bit in a register is set or not.
>
> if bs Rx, bitNo
>  execute this insn
>
> My questions is how will i be able to implement this instruction in
> the back-end?

Sure, this is just a conditional instruction where the condition is a
ZERO_EXTRACT.

Look at the ARM backend for examples of how to work with conditional
instructions.

Ian


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