Everything
11.5.4 V2.06 and Later Versions (Compatibility with V2.05 and earlier)

(1)

Introducing the Method for Controlling the Output of Bit Manipulation Instructions

In V2.05 and earlier versions of the compiler, there was no method for the user to always output bit manipulation instructions.

In V2.06, the compiler is modified to allow the user to control whether to output bit manipulation instructions instead of using intrinsic functions.

 

To output bit manipulation instructions without using intrinsic functions, create a source program so that all conditions shown below are satisfied.

(a) A constant value is assigned.

(b) The value is assigned to a single-bit bit field of a 1-byte type.

(c) The bit field where the value is assigned is qualified with volatile.

 

To stop the output of bit manipulation instructions, satisfy condition (c) above and either assign a value that is not a constant in condition (a) or use a type that is not a 1-byte type in condition (b).

 

Otherwise, the compiler automatically determines whether to output bit manipulation instructions according to the specified optimization level and the contents of the source program.

 

Note

1-byte types are char, unsigned char, signed char, _Bool, and bool. _Bool and bool are excluded when -lang=c is specified.

 

Example

volatile struct {
  unsigned char bit0:1;
  unsigned int  bit1:1;
} data;
 
void func(void) {
  data.bit0 = 1;  /* A bit manipulation instruction is output.  */
  data.bit1 = 1;  /* No bit manipulation instruction is output. */
}

 

To always output bit manipulation instructions in V2.05, use intrinsic functions __bclr(), __bset(), and __bnot(). When the intrinsic functions are not used, the compiler automatically determines whether to output bit manipulation instructions according to the specified optimization level and the contents of the source program.

The V2.04 and earlier versions of the compiler do not support these intrinsic functions. To check whether bit manipulation instructions are output, refer to the assembly source code output by the compiler.