]> granicus.if.org Git - clang/commit
Avoid undefined behavior in the x86 lzcnt header file by explicitly checking for...
authorCraig Topper <craig.topper@gmail.com>
Sat, 1 Nov 2014 22:25:23 +0000 (22:25 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 1 Nov 2014 22:25:23 +0000 (22:25 +0000)
commitfd2bb3d314deec4d2c6dfd036db8d401ec5b16bc
treec15a3393bc8cc82734e819bc023b9f9926c46fad
parent5e7180b8436993360d97b8d749f75cbdcc3967c4
Avoid undefined behavior in the x86 lzcnt header file by explicitly checking for 0 before calling __builtin_clz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.ctlz with defined zero behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@221064 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/lzcntintrin.h