[PATCH] X86: If we have an instruction that sets a flag and a zero test on the input of that instruction try to eliminate the test.

Benjamin Kramer benny.kra at gmail.com
Tue Apr 22 09:46:23 PDT 2014


Hi nadav, craig.topper, majnemer,

For example
	tzcntl	%edi, %ebx
	testl %edi, %edi
	je	.label

can be rewritten into
	tzcntl	%edi, %ebx
	jae	.label

A minor complication is that tzcnt sets CF instead of ZF when the input
is zero, we have to rewrite users of the flags from ZF to CF. Currently
we recognize patterns using lzcnt, tzcnt and popcnt.

BRANCH
  master

http://reviews.llvm.org/D3454

Files:
  lib/Target/X86/X86InstrInfo.cpp
  test/CodeGen/X86/peep-test-4.ll

REPLY HANDLER ACTIONS
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3454.8734.patch
Type: text/x-patch
Size: 6002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140422/0345d8ee/attachment.bin>


More information about the llvm-commits mailing list