[llvm-bugs] [Bug 40214] New: [X86] clang::targets::X86TargetInfo::isCLZForZeroUndef should be BMI/LZCNT aware

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 3 07:43:33 PST 2019


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: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: andrea.dibiagio at gmail.com, craig.topper at gmail.com,
                    filcab at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190103/b098d8dc/attachment.html>


More information about the llvm-bugs mailing list