ibit_logic_imm.c (500B)
1 /* 32-bit bitwise ops with an immediate operand. On aarch64 these use the 2 * logical-immediate (bitmask) encoding of and/orr/eor when the constant is a 3 * representable bitmask. volatile on the variable side keeps the op live. 4 * a = 0x3C; a & 0xF0 = 0x30 (48); a | 0x03 = 0x3F (63) 5 * a ^ 0xFF = 0xC3 (195); (48 + 63 + 195) - 264 = 42. */ 6 int test_main(void) { 7 volatile int a = 0x3C; 8 int and_ = a & 0xF0; 9 int or_ = a | 0x03; 10 int xor_ = a ^ 0xFF; 11 return (and_ + or_ + xor_) - 264; 12 }