world leader in high performance signal processing
Trace: » bittst

BIT TEST

General Form

CC = BITTST ( register, bit_position )
CC = ! BITTST ( register, bit_position )

Syntax

CC = BITTST ( Dreg , uimm5 ) ;   /* set CC if bit = 1 (a)*/
CC = ! BITTST ( Dreg , uimm5 ) ; /* set CC if bit = 0 (a)*/

Syntax Terminology

Dreg
R7–0
uimm5
5-bit unsigned field, with a range of 0 through 31

Instruction Length

In the syntax, comment (a) identifies 16-bit instruction length.

Functional Description

The Bit Test instruction sets or clears the CC bit, based on the bit designated by bit_position in the specified D-register. One version tests whether the specified bit is set; the other tests whether the bit is clear. The instruction does not affect other bits in the D-register.

The bit_position range of values is 0 through 31, where 0 indicates the LSB, and 31 indicates the MSB of the 32-bit D-register.

Flags Affected

The Bit Test instruction affects flags as follows.

  • CC is set if the tested bit is 1; cleared otherwise.
  • All other flags are unaffected.

The ADSP-BF535 processor has fewer ASTAT flags and some flags operate differently than subsequent Blackfin family products. For more information on the ADSP-BF535 status flags, see BF535 Differences

Required Mode

User & Supervisor

Parallel Issue

This instruction cannot be issued in parallel with other instructions.

Example

cc = bittst (r7, 15) ; /* test bit 15 TRUE in R7 */ 

For example, if R7 contains 0xFFFFFFFF before this instruction, CC is set to 1, and R7 still contains 0xFFFFFFFF after the instruction.

 cc = ! bittst (r3, 0) ; /* test bit 0 FALSE in R3 */

If R3 contains 0xFFFFFFFF, this instruction clears CC to 0.

Also See

Special Applications

None