[llvm-bugs] [Bug 28668] New: [InstCombine] missing folds for bit manipulation intrinsics
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 22 09:56:41 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28668
Bug ID: 28668
Summary: [InstCombine] missing folds for bit manipulation
intrinsics
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: spatel+llvm at rotateright.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
define i1 @ctlz_cmp(i32 %a) {
%x = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) #0
%cmp = icmp eq i32 %x, 0 ; no zeros? --> all ones
ret i1 %cmp
}
define i1 @cttz_cmp(i32 %a) {
%x = tail call i32 @llvm.cttz.i32(i32 %a, i1 false) #0
%cmp = icmp eq i32 %x, 0 ; no zeros? --> all ones
ret i1 %cmp
}
define i1 @ctpop_cmp(i32 %a) {
%x = tail call i32 @llvm.ctpop.i32(i32 %a) #0
%cmp = icmp eq i32 %x, 32 ; all ones? --> no zeros
ret i1 %cmp
}
-----------------------------------------------------------------------------
$ ./opt -instcombine more_bitz.ll -S
(doesn't change anything)
Note that these all work:
define i1 @ctlz_cmp(i32 %a) {
%x = tail call i32 @llvm.ctlz.i32(i32 %a, i1 false) nounwind readnone
%cmp = icmp eq i32 %x, 32 ; all zeros? --> no ones
ret i1 %cmp
}
define i1 @cttz_cmp(i32 %a) {
%x = tail call i32 @llvm.cttz.i32(i32 %a, i1 false) nounwind readnone
%cmp = icmp eq i32 %x, 32 ; all zeros? --> no ones
ret i1 %cmp
}
define i1 @ctpop_cmp(i32 %a) {
%x = tail call i32 @llvm.ctpop.i32(i32 %a) nounwind readnone
%cmp = icmp eq i32 %x, 0 ; no ones? --> all zeros
ret i1 %cmp
}
$ ./opt -instcombine more_bitz.ll -S
...
define i1 @ctlz_cmp(i32 %a) {
%cmp = icmp eq i32 %a, 0
ret i1 %cmp
}
define i1 @cttz_cmp(i32 %a) {
%cmp = icmp eq i32 %a, 0
ret i1 %cmp
}
define i1 @ctpop_cmp(i32 %a) {
%cmp = icmp eq i32 %a, 0
ret i1 %cmp
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160722/550896e6/attachment-0001.html>
More information about the llvm-bugs
mailing list