llvm.org GIT mirror llvm / master
[X86] Add BLSI to isUseDefConvertible. Summary: BLSI sets the C flag is the input is not zero. So if its followed by a TEST of the input where only the Z flag is consumed, we can replace it with the opposite check of the C flag. We should be able to do the same for BLSMSK and BLSR, but the naive test case for those is being optimized to a subo by CodeGenPrepare. Reviewers: spatel, RKSimon Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63589 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363957 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 25 minutes ago
2 changed file(s) with 6 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
33683368 case X86::BSR32rr:
33693369 case X86::BSR64rr:
33703370 return X86::COND_E;
3371 case X86::BLSI32rr:
3372 case X86::BLSI64rr:
3373 return X86::COND_AE;
3374 // TODO: BLSR, BLSMSK, and TBM instructions.
33713375 }
33723376 }
33733377
12391239 ; X64-LABEL: blsi_cflag_32:
12401240 ; X64: # %bb.0:
12411241 ; X64-NEXT: blsil %edi, %eax
1242 ; X64-NEXT: testl %edi, %edi
1243 ; X64-NEXT: cmovel %esi, %eax
1242 ; X64-NEXT: cmovael %esi, %eax
12441243 ; X64-NEXT: retq
12451244 %tobool = icmp eq i32 %x, 0
12461245 %sub = sub nsw i32 0, %x
12781277 ; X64-LABEL: blsi_cflag_64:
12791278 ; X64: # %bb.0:
12801279 ; X64-NEXT: blsiq %rdi, %rax
1281 ; X64-NEXT: testq %rdi, %rdi
1282 ; X64-NEXT: cmoveq %rsi, %rax
1280 ; X64-NEXT: cmovaeq %rsi, %rax
12831281 ; X64-NEXT: retq
12841282 %tobool = icmp eq i64 %x, 0
12851283 %sub = sub nsw i64 0, %x