X86: Emit test instead of constant shift + compare if the shift result is unused.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Apr 2014 08:15:31 +0000 (08:15 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 24 Apr 2014 08:15:31 +0000 (08:15 +0000)
commitf43438b6c3e8cb979658c87baf681f2e24aff9df
tree45ad341f6c867addfca486b0202b4ebaee4f2ffb
parent63ed439ab5ac43a4b36e347df35db84707fc6894
X86: Emit test instead of constant shift + compare if the shift result is unused.

This allows us to compile
  return (mask & 0x8 ? a : b);
into
  testb $8, %dil
  cmovnel %edx, %esi
instead of
  andl  $8, %edi
  shrl  $3, %edi
  cmovnel %edx, %esi

which we formed previously because dag combiner canonicalizes setcc of and into shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207088 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/cmp.ll