OSDN Git Service

[X86] Don't select (cmp (and, imm), 0) to testw
authorCraig Topper <craig.topper@intel.com>
Thu, 28 Sep 2017 23:35:36 +0000 (23:35 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 28 Sep 2017 23:35:36 +0000 (23:35 +0000)
commitc7efeba6682f12c178be381b796ccbd98861d38a
tree95b60840bc6f9b028bcdbe9792c8d9cd58d1d731
parente3ae595976c2aaea22a4a2fe3970aadde98df03e
[X86] Don't select (cmp (and, imm), 0) to testw

Summary:
X86ISelDAGToDAG tries to analyze ANDs compared with 0 to optimize to narrower immediates using subregisters.

I don't think we should be optimizing to 16-bit test instructions. It goes against our normal behavior of promoting i16 operations to i32. It only saves one byte due to the need to add a 0x66 prefix. I think it would also be subject to a length changing prefix penalty in the decoders on Intel CPUs.

Reviewers: RKSimon, zvi, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314474 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelDAGToDAG.cpp
test/CodeGen/X86/tbm_patterns.ll
test/CodeGen/X86/test-shrink-bug.ll
test/CodeGen/X86/test-shrink.ll