This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to implement the instruction in the back end
- From: Ian Lance Taylor <iant at google dot com>
- To: "Mohamed Shafi" <shafitvm at gmail dot com>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Thu, 08 May 2008 11:33:18 -0700
- Subject: Re: How to implement the instruction in the back end
- References: <ba0bd44d0805072236x1fabcd46p1a1bc4bff7f8fcb1@mail.gmail.com>
"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