[llvm-bugs] [Bug 30760] New: Failing to vector constant fold vXi64 on 32-bit targets

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 21 06:19:48 PDT 2016


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

            Bug ID: 30760
           Summary: Failing to vector constant fold vXi64 on 32-bit
                    targets
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
    Classification: Unclassified

We are failing to constant fold when have the opportunity because we are
perhaps too strict with only folding to legal scalar types.

e.g.

define <2 x i64> @foldv2i64() nounwind {
  %out = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> <i64 256, i64 -1>, i1 0)
  ret <2 x i64> %out
}

This works fine for 64-bit targets:

llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1

foldv2i64:
# BB#0:
  movl $8, %eax
  movd %rax, %xmm0
  retq

But for 32-bit targets we fail to fold as although v2i64 is legal, i64 isn't:

llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 

foldv2i64:
# BB#0:
  movdqa {{.*#+}} xmm0 = [256,0,4294967295,4294967295]
  pxor %xmm1, %xmm1
  pxor %xmm2, %xmm2
  psubq %xmm0, %xmm2
  pand %xmm0, %xmm2
  psubq {{\.LCPI.*}}, %xmm2
  movdqa {{.*#+}} xmm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
  movdqa %xmm2, %xmm4
  pand %xmm3, %xmm4
  movdqa {{.*#+}} xmm0 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
  movdqa %xmm0, %xmm5
  pshufb %xmm4, %xmm5
  psrlw $4, %xmm2
  pand %xmm3, %xmm2
  pshufb %xmm2, %xmm0
  paddb %xmm5, %xmm0
  psadbw %xmm1, %xmm0
  retl

-- 
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/20161021/f47ce2c9/attachment.html>


More information about the llvm-bugs mailing list