[X86] Use bts/btr/btc for single bit set/clear/complement of a variable bit position
authorCraig Topper <craig.topper@intel.com>
Wed, 27 Jun 2018 16:47:39 +0000 (16:47 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 27 Jun 2018 16:47:39 +0000 (16:47 +0000)
commit812fcb35e79ac3aab4c3ec8ae239ab54f820d94c
tree672953bf6893a5d42d106dd9b935a4ac7f4a6e6d
parent069628b4dff2f358da7b94f76410060c2dacaad1
[X86] Use bts/btr/btc for single bit set/clear/complement of a variable bit position

If we are just modifying a single bit at a variable bit position we can use the BT* instructions to make the change instead of shifting a 1(or rotating a -1) and doing a binop. These instruction also ignore the upper bits of their index input so we can also remove an and if one is present on the index.

Fixes PR37938.

llvm-svn: 335754
llvm/lib/Target/X86/X86InstrCompiler.td
llvm/test/CodeGen/X86/btc_bts_btr.ll