[llvm-bugs] [Bug 36419] New: *Potential* missing optimization opportunity for bzhi when input is 64bit but output is 32 bit?

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 17 09:08:52 PST 2018


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

            Bug ID: 36419
           Summary: *Potential* missing optimization opportunity for bzhi
                    when input is 64bit but output is 32 bit?
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

It's a very simple function that gets some low bits from the cache.

https://godbolt.org/g/f9JjP3

The first variant does not work when count == 32, but is optimized down to just
the bzhi.
The second variant *does* work when count == 32, but is *NOT* optimized down to
just the bzhi.
The third variant *does* work when count == 32, and *IS* optimized down to just
the bzhi.

The difference between the first and second/third variant is the 32 vs 64 bit
size of mask.
The difference between the first/second and third variant is the 32 vs 64 bit
return type.

I'm wondering if the second variant can still be optimized to bzhi,
and then still return 32-bit by discarding the upper half?

-- 
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/20180217/622f7f04/attachment.html>


More information about the llvm-bugs mailing list