[PATCH] D48765: [X86] The TEST instruction is eliminated when BSF/TZCNT is used
Ivan Kulagin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 9 00:17:16 PDT 2018
ikulagin added a comment.
> The test cases only cover the CTTZ_ZERO_UNDEF version right?
I can add the test for CTTZ, but in the case of using CTTZ the TEST instruction can't be eliminated
because it produces three basic blocks as follows:
bb.0:
liveins: $edi
%2:gr32 = COPY $edi
%3:gr32 = MOV32ri 32
TEST32rr %2:gr32, %2:gr32, implicit-def $eflags
JE_1 %bb.2, implicit $eflags
JMP_1 %bb.1
bb.1.cond.false:
%0:gr32 = BSF32rr %2:gr32, implicit-def dead $eflags
bb.2.cond.end:
%1:gr32 = PHI %3:gr32, %bb.0, %0:gr32, %bb.1
TEST32rr %2:gr32, %2:gr32, implicit-def $eflags
%4:gr32 = MOV32ri -1
%5:gr32 = CMOVE32rr %4:gr32, %1:gr32, implicit $eflags
%6:gr32 = ADD32ri8 %5:gr32, 6, implicit-def dead $eflags
$eax = COPY %6:gr32
RET 0, $eax
We should analyze the bb.0 and bb.1.cond.false to eliminate the TEST instruction followed by the CMOV.
Does it make sence to implement such analysis and transformation or it will suffice to eliminate the TEST
when CTTZ_ZERO_UNDEF is used?
Repository:
rL LLVM
https://reviews.llvm.org/D48765
More information about the llvm-commits
mailing list