-
Couldn't load subscription status.
- Fork 15k
Open
Description
define i1 @btr_eq_i32(ptr %word, i32 %position) nounwind { %ofs = and i32 %position, 31 %bit = shl nuw i32 1, %ofs %mask = xor i32 %bit, -1 %ld = load i32, ptr %word %test = and i32 %ld, %bit %res = and i32 %ld, %mask %cmp = icmp eq i32 %test, 0 store i32 %res, ptr %word ret i1 %cmp }btr_eq_i32: # @btr_eq_i32 movl (%rdi), %eax movl %eax, %ecx btrl %esi, %ecx btl %esi, %eax setae %al movl %ecx, (%rdi) retqThe BTR (or BTC/BTS) sets the same EFLAGS CF result as BT (it then clears the bit value afterward) - so we could perform this as:
btr_eq_i32: # @btr_eq_i32 movl (%rdi), %eax btrl %esi, %eax movl %eax, (%rdi) setae %al retq