[llvm-bugs] [Bug 50096] New: __builtin_popcount(~a) & 1 - > __builtin_popcount(a) & 1

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 23 06:16:23 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50096

            Bug ID: 50096
           Summary: __builtin_popcount(~a) & 1 - > __builtin_popcount(a) &
                    1
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

----------------------------------------
define i32 @src(i32 %0) noread nowrite nofree {
%1:
  %2 = xor i32 %0, 4294967295
  %3 = ctpop i32 %2
  %4 = and i32 %3, 1
  ret i32 %4
}
=>
define i32 @tgt(i32 %0) noread nowrite nofree {
%1:
  %2 = ctpop i32 %0
  %3 = and i32 %2, 1
  ret i32 %3
}
Transformation seems to be correct!

https://godbolt.org/z/hGoxxYYd6

-- 
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/20210423/409ce05b/attachment.html>


More information about the llvm-bugs mailing list