[LLVMbugs] [Bug 10712] New: [AVX] integer comparisons are scalarized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 20 04:47:32 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10712

           Summary: [AVX] integer comparisons are scalarized
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matt at pharr.org
                CC: llvmbugs at cs.uiuc.edu


Given:

define <8 x i32> @foo(<8 x i32> %i, <8 x i32> %j) nounwind readnone {
  %bincmp = icmp slt <8 x i32> %i, %j
  %x = sext <8 x i1> %bincmp to <8 x i32>
  ret <8 x i32> %x
}

llc -mattr=+avx extracts each element of the vector and does a scalar compare
(code below).  It'd be nice if it emitted two pcmp* instructions instead.


% llc -mattr=+avx -o - bug.ll
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
## BB#0:
    vextractf128    $1, %ymm0, %xmm2
    vextractf128    $1, %ymm1, %xmm3
    vpextrd    $2, %xmm3, %r8d
    vpextrd    $2, %xmm2, %r9d
    vmovd    %xmm3, %esi
    vmovd    %xmm2, %ecx
    vpextrd    $3, %xmm3, %edx
    vpextrd    $3, %xmm2, %edi
    movl    $-1, %r10d
    cmpl    %edx, %edi
    movl    $0, %edx
    cmovll    %r10d, %edx
    cmpl    %esi, %ecx
    movl    $0, %esi
    cmovll    %r10d, %esi
    cmpl    %r8d, %r9d
    movl    $0, %edi
    cmovll    %r10d, %edi
    vpextrd    $3, %xmm1, %ecx
    vpextrd    $3, %xmm0, %eax
    cmpl    %ecx, %eax
    movl    $0, %ecx
    cmovll    %r10d, %ecx
    vmovd    %edi, %xmm4
    vmovd    %esi, %xmm5
    vmovd    %edx, %xmm6
    vpextrd    $1, %xmm3, %edx
    vpextrd    $1, %xmm2, %esi
    cmpl    %edx, %esi
    movl    $0, %edx
    cmovll    %r10d, %edx
    vmovd    %edx, %xmm2
    vpextrd    $2, %xmm1, %edx
    vpextrd    $2, %xmm0, %esi
    cmpl    %edx, %esi
    vpunpckldq    %xmm6, %xmm2, %xmm2
    vpunpckldq    %xmm4, %xmm5, %xmm3
    movl    $0, %edx
    cmovll    %r10d, %edx
    vmovd    %ecx, %xmm4
    vpextrd    $1, %xmm1, %ecx
    vpextrd    $1, %xmm0, %esi
    cmpl    %ecx, %esi
    movl    $0, %ecx
    cmovll    %r10d, %ecx
    vmovd    %ecx, %xmm5
    vpunpckldq    %xmm2, %xmm3, %xmm2
    vpunpckldq    %xmm4, %xmm5, %xmm3
    vmovd    %edx, %xmm4
    vmovd    %xmm1, %ecx
    vmovd    %xmm0, %edx
    cmpl    %ecx, %edx
    movl    $0, %ecx
    cmovll    %r10d, %ecx
    vmovd    %ecx, %xmm0
    vpunpckldq    %xmm4, %xmm0, %xmm0
    vpunpckldq    %xmm3, %xmm0, %xmm0
    vinsertf128    $1, %xmm2, %ymm0, %ymm0
    ret

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list