[llvm-bugs] [Bug 28044] New: [x86, SSE] legalization for SSE1 target doesn't allow cmpps/cmppd

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 7 14:50:23 PDT 2016


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

            Bug ID: 28044
           Summary: [x86, SSE] legalization for SSE1 target doesn't allow
                    cmpps/cmppd
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Forking this off of bug 28001:

define <4 x float> @test_mm_cmpeq_ps(<4 x float> %a0, <4 x float> %a1) nounwind
{
  %cmp = fcmp oeq <4 x float> %a0, %a1
  %sext = sext <4 x i1> %cmp to <4 x i32>
  %res = bitcast <4 x i32> %sext to <4 x float>
  ret <4 x float> %res
}

This should be 'cmpeqps', but DAG type legalization doesn't like the <4 x i32>
type for an SSE1 target, so:

$ ./llc -o - cmpeq.ll -mattr=sse,-sse2
...
    movaps    %xmm1, %xmm2
    shufps    $231, %xmm2, %xmm2      ## xmm2 = xmm2[3,1,2,3]
    movaps    %xmm0, %xmm3
    shufps    $231, %xmm3, %xmm3      ## xmm3 = xmm3[3,1,2,3]
    ucomiss    %xmm2, %xmm3
    setnp    %al
    sete    %cl
    andb    %al, %cl
    movzbl    %cl, %eax
    shll    $31, %eax
    sarl    $31, %eax
    movl    %eax, -8(%rsp)
    movaps    %xmm1, %xmm2
    shufps    $229, %xmm2, %xmm2      ## xmm2 = xmm2[1,1,2,3]
    movaps    %xmm0, %xmm3
    shufps    $229, %xmm3, %xmm3      ## xmm3 = xmm3[1,1,2,3]
    ucomiss    %xmm2, %xmm3
    setnp    %al
    sete    %cl
    andb    %al, %cl
    movzbl    %cl, %eax
    shll    $31, %eax
    sarl    $31, %eax
    movl    %eax, -12(%rsp)
    ucomiss    %xmm1, %xmm0
    setnp    %al
    sete    %cl
    andb    %al, %cl
    movzbl    %cl, %eax
    shll    $31, %eax
    sarl    $31, %eax
    movl    %eax, -16(%rsp)
    shufps    $230, %xmm1, %xmm1      ## xmm1 = xmm1[2,1,2,3]
    shufps    $230, %xmm0, %xmm0      ## xmm0 = xmm0[2,1,2,3]
    ucomiss    %xmm1, %xmm0
    setnp    %al
    sete    %cl
    andb    %al, %cl
    movzbl    %cl, %eax
    shll    $31, %eax
    sarl    $31, %eax
    movl    %eax, -4(%rsp)
    movss    -8(%rsp), %xmm0         ## xmm0 = mem[0],zero,zero,zero
    movss    -12(%rsp), %xmm1        ## xmm1 = mem[0],zero,zero,zero
    unpcklps    %xmm0, %xmm1    ## xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
    movss    -16(%rsp), %xmm0        ## xmm0 = mem[0],zero,zero,zero
    movss    -4(%rsp), %xmm2         ## xmm2 = mem[0],zero,zero,zero
    unpcklps    %xmm2, %xmm0    ## xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
    unpcklps    %xmm1, %xmm0    ## xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
    retq

-- 
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/20160607/2d4dc8f4/attachment.html>


More information about the llvm-bugs mailing list