]> granicus.if.org Git - clang/commit
[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set...
authorCraig Topper <craig.topper@intel.com>
Wed, 26 Sep 2018 17:01:44 +0000 (17:01 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 26 Sep 2018 17:01:44 +0000 (17:01 +0000)
commit26346fbcb9bb9fe7a6374e84eb994e8743e65327
tree2a9067e82d5b0b301240a1a8ec97403b9ccc2f3e
parentf10f8c29df7bf378dcde4d3341709145d82c0156
[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set to false.

Previously we used a select and the zero_undef=true intrinsic. In -O2 this pattern will get optimized to zero_undef=false. But in -O0 this optimization won't happen. This results in a compare and cmov being wrapped around a tzcnt/lzcnt instruction.

By using the zero_undef=false intrinsic directly without the select, we can improve the -O0 codegen to just an lzcnt/tzcnt instruction.

Differential Revision: https://reviews.llvm.org/D52392

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343126 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/BuiltinsX86.def
include/clang/Basic/BuiltinsX86_64.def
lib/CodeGen/CGBuiltin.cpp
lib/Headers/bmiintrin.h
lib/Headers/lzcntintrin.h
test/CodeGen/bmi-builtins.c
test/CodeGen/lzcnt-builtins.c