HomePhabricator

[InstCombine] add folds for icmp+ctpop

Authored by spatel on Oct 26 2020, 1:28 PM.

Description

[InstCombine] add folds for icmp+ctpop

https://alive2.llvm.org/ce/z/XjFPQJ

define void @src(i64 %value) {
  %t0 = call i64 @llvm.ctpop.i64(i64 %value)
  %gt = icmp ugt i64 %t0, 63
  %lt = icmp ult i64 %t0, 64
  call void @use(i1 %gt, i1 %lt)
  ret void
}

define void @tgt(i64 %value) {
  %eq = icmp eq i64 %value, -1
  %ne = icmp ne i64 %value, -1
  call void @use(i1 %eq, i1 %ne)
  ret void
}

declare i64 @llvm.ctpop.i64(i64) #1
declare void @use(i1, i1)

Details

Committed
spatelOct 26 2020, 1:48 PM
Parents
rG05f011b2b6e5: [InstCombine] add tests for ctpop at bitwidth limit; NFC
Branches
Unknown
Tags
Unknown