[llvm-bugs] [Bug 40842] New: adding min signed value constant does not result in expected 'unsigned add with overflow' codegen

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 24 08:34:51 PST 2019


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

            Bug ID: 40842
           Summary: adding min signed value constant does not result in
                    expected 'unsigned add with overflow' codegen
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org

Forking this reduced example from bug 40486:

#include <x86intrin.h>

using u64 = unsigned;

template<u64 K>
void test(u64& alo, u64& ahi)
{
    u64 blo = K;
    u64 bhi = 0;
    bool cf = (alo += blo) < blo;
    _addcarry_u32(cf, ahi, bhi, &ahi);
}

template void test<0x80000000u>(u64&, u64&);

--------------------------------------------------------------------------

https://godbolt.org/z/lPSSir


Either we've prematurely formed bit magic from icmp or we need to recognize
this as another special-case form of uaddo:

-- 
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/20190224/42fdd83a/attachment-0001.html>


More information about the llvm-bugs mailing list