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

            Bug ID: 40214
           Summary: [X86] clang::targets::X86TargetInfo::isCLZForZeroUndef
                    should be BMI/LZCNT aware
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected], [email protected]

On x86 targets with BMI and LZCNT we should be able to return false from
isCLZForZeroUndef().

This would help avoid an issue we're seeing with ubsan warning that we have
zero inputs to clz/ctz in cases like:

#include <stdint.h>
uint64_t foo(uint64_t a0) {
    uint64_t r0 = static_cast<uint64_t>( __builtin_clzll( a0 ) );
    r0 = ( a0 ? r0 : 64 );
    return r0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to