This is an archive of the discontinued LLVM Phabricator instance.

[CGP] Enable select in complex addr mode
ClosedPublic

Authored by skatkov on Nov 29 2017, 9:31 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

skatkov created this revision.Nov 29 2017, 9:31 PM

To enable select I needed to update one test. Added test creator for the review whether he is ok with this change.

skatkov added a comment.EditedDec 10 2017, 11:41 PM

To make a review easier, the generated code before this patch:

.globl  BinarySearch            # -- Begin function BinarySearch
.p2align        4, 0x90
.type   BinarySearch,@function
BinarySearch:                           # @BinarySearch
.cfi_startproc
# %bb.0:                                # %entry
movl    (%rsi), %eax
jmp     .LBB4_2
.p2align        4, 0x90
.LBB4_1:                                # %while.body
                                #   in Loop: Header=BB4_2 Depth=1
movl    %ecx, %eax
leaq    16(%rdx), %rcx
addq    $8, %rdx
btl     %eax, %edi
cmovaeq %rcx, %rdx
movq    (%rdx), %rdx
.LBB4_2:                                # %while.body
                                # =>This Inner Loop Header: Depth=1
movl    (%rdx), %ecx
cmpl    %ecx, %eax
ja      .LBB4_1
# %bb.3:                                # %while.end
retq
.Lfunc_end4:
.size   BinarySearch, .Lfunc_end4-BinarySearch
.cfi_endproc

The generated code after this patch:

.globl  BinarySearch            # -- Begin function BinarySearch
.p2align        4, 0x90
.type   BinarySearch,@function
BinarySearch:                           # @BinarySearch
.cfi_startproc
# %bb.0:                                # %entry
movl    (%rsi), %eax
jmp     .LBB4_2
.p2align        4, 0x90
.LBB4_1:                                # %while.body
                                #   in Loop: Header=BB4_2 Depth=1
movl    %ecx, %eax
xorl    %ecx, %ecx
btl     %eax, %edi
setae   %cl
movq    8(%rdx,%rcx,8), %rdx
.LBB4_2:                                # %while.body
                                # =>This Inner Loop Header: Depth=1
movl    (%rdx), %ecx
cmpl    %ecx, %eax
ja      .LBB4_1
# %bb.3:                                # %while.end
retq
.Lfunc_end4:
.size   BinarySearch, .Lfunc_end4-BinarySearch
.cfi_endproc
reames accepted this revision.Dec 12 2017, 8:57 PM

The code change here is a clear improvement. Given no response from the test case author, LGTM.

This revision is now accepted and ready to land.Dec 12 2017, 8:57 PM
This revision was automatically updated to reflect the committed changes.