Let C be an integer constant. Then
(a & C) ^ (b & C) == (a ^ b) & C.
The latter requires one operation less (and has lower register pressure). SDCC should optimize the former into the latter.
I noticed this in a real world example of a checksum calculation routine, in the line
x16 = (unsigned char)((data & 1) ^ ((unsigned char)crc & 1));
Philipp
Patches: #392
Wiki: SDCC 4.3.0 Release
Wiki: SDCC 4.4.0 Release
Wiki: SDCC 4.5.0 Release