[llvm-bugs] [Bug 28650] New: AVX512F does a poor job passing i1s between basic blocks

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 21 15:36:39 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28650

            Bug ID: 28650
           Summary: AVX512F does a poor job passing i1s between basic
                    blocks
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: mkuper at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider the test case from r276347:

declare i1 @bar() 
define i1 @foo(i1 %i) nounwind {
entry:
  br i1 %i, label %if, label %else

if:
  %r = call i1 @bar()
  br label %else

else:
  %ret = phi i1 [%r, %if], [true, %entry]
  ret i1 %ret
}

Without AVX512, we get:
foo:
    movb    $1, %al
    testb    $1, %dil
    je    .LBB0_2
    pushq    %rax
    callq    bar
    addq    $8, %rsp
.LBB0_2:
    retq

While with AVX512F, we end up "serializing" the i1 through k registers:

foo:
    testb    $1, %dil
    je    .LBB0_1
    pushq    %rax
    callq    bar
    andb    $1, %al
    kmovw    %eax, %k0
    addq    $8, %rsp
    jmp    .LBB0_3
.LBB0_1:
    kxnorw    %k0, %k0, %k0
    kshiftrw    $15, %k0, %k0
.LBB0_3:
    kmovw    %k0, %eax
    retq

The xnor + shift sequence to create a 1 is an especially nice touch. :-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160721/2f08d9a9/attachment.html>


More information about the llvm-bugs mailing list