The compiler generates BFSET for |= , BFCLR for &=, and BFCHG for ^= operators.
The following listing shows a C source example and the generated sample code.
int i;
int *ip;
void main(void)
{
i &= ~1;
/* generated codes
P: 00000082: 8054022D0001 bfclr #1,X:0x00022d
*/
(*(ip))^= 1;
/* generated codes
P:00000085: F87C022C moveu.w X:0x00022c,R0
P:00000087: 84400001 bfchg #1,X:(R0)
*/
*((int*)(0x1234))|=1;
/* generated codes
P:00000089: E4081234 move.l #4660,R0
P:0000008B: 82400001 bfset #1,X:(R0)
*/
}
/* generated codes
P:0000008D: E708 rts
*/
Note the following example:
#define word int
union {
word Word;
struct {
word SBK :1;
word RWU :1;
word RE :1;
word TE :1;
word REIE :1;
word RFIE :1;
word TIIE :1;
word TEIE :1;
word PT :1;
word PE :1;
word POL :1;
word WAKE :1;
word M :1;
word RSRC :1;
word SWAI :1;
word LOOP :1;
} Bits;
} SCICR;
/* Code:*/
SCICR.Bits.TE = 1; /* SCICR content is 0x0800 */
SCICR.Bits.PE = 1; /* SCICR content is 0x0002 ??? */