[PATCH] D38273: [X86] Don't select (cmp (and, imm), 0) to testw

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 15:30:48 PDT 2017


craig.topper created this revision.

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.


https://reviews.llvm.org/D38273

Files:
  lib/Target/X86/X86ISelDAGToDAG.cpp
  test/CodeGen/X86/tbm_patterns.ll
  test/CodeGen/X86/test-shrink-bug.ll
  test/CodeGen/X86/test-shrink.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38273.116643.patch
Type: text/x-patch
Size: 3939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170926/e408c1bb/attachment.bin>


More information about the llvm-commits mailing list