[llvm] [SDAG] Simplify is-power-of-2 codegen (PR #72275)
Tavian Barnes via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 12:49:20 PST 2023
tavianator wrote:
> Do you have an alive2 proof please?
https://alive2.llvm.org/ce/z/kttm55
```
----------------------------------------
define i1 @src(i32 %x) {
0:
%cnt = ctpop i32 %x
%r = icmp eq i32 %cnt, 1
ret i1 %r
}
=>
define i1 @tgt(i32 %x) {
0:
%y = sub i32 %x, 1
%z = xor i32 %x, %y
%r = icmp ugt i32 %z, %y
ret i1 %r
}
Transformation seems to be correct!
```
https://github.com/llvm/llvm-project/pull/72275
More information about the llvm-commits
mailing list