Issue 60957
Summary [InstCombine] fold signbit test of a pow2-or-zero
Labels new issue
Assignees
Reporter rotateright
    This probably isn't worth the compile-time cost of using ValueTracking, but we could add a direct pattern match for this and similar icmp patterns:
```ll
define i1 @src(i8 %x) {
  %negx = sub i8 0, %x
  %pow2_or_zero = and i8 %negx, %x 
  %cmp = icmp slt i8 %pow2_or_zero, 0
  ret i1 %cmp
}

define i1 @tgt(i8 %x) {
 %cmp = icmp eq i8 %x, -128
  ret i1 %cmp
}
```
https://alive2.llvm.org/ce/z/_J5q3S
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to