[llvm-bugs] [Bug 34394] New: [X86] broadcast i32x2 from memory not lowered to the memory form of vbroadcasti32x2

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 31 02:07:54 PDT 2017


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

            Bug ID: 34394
           Summary: [X86] broadcast i32x2 from memory not lowered to the
                    memory form of vbroadcasti32x2
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: ayman.musa at intel.com
                CC: llvm-bugs at lists.llvm.org

Broadcasting <2 x i32> from memory gets lowered to bad sequence instead of
simply using the vbroadcasti32x2 instruction.

define <4 x i32> @test_2xi32_to_4xi32_mem(<2 x i32>* %vp) {
   %vec = load <2 x i32>, <2 x i32>* %vp
   %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <4 x i32> <i32 0, i32
1, i32 0, i32 1>
   ret <4 x i32> %res
 }

LLVM emits:
  vpmovzxdq   (%rdi), %xmm0   # xmm0 = mem[0],zero,mem[1],zero
  vpshufd $136, %xmm0, %xmm0      # xmm0 = xmm0[0,2,0,2]
  retq

Instead of:
  vbroadcasti32x2 (%rdi), %xmm0
  retq

==============================================================================

define <8 x i32> @test_2xi32_to_8xi32_mem(<2 x i32>* %vp) {
   %vec = load <2 x i32>, <2 x i32>* %vp
   %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <8 x i32> <i32 0, i32
1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1>
   ret <8 x i32> %res
 }

LLVM emits:
  vpmovzxdq   (%rdi), %xmm0   # xmm0 = mem[0],zero,mem[1],zero
  vpshufd $232, %xmm0, %xmm0      # xmm0 = xmm0[0,2,2,3]
  vpbroadcastq    %xmm0, %ymm0
  retq

Instead of:
  vbroadcasti32x2 (%rdi), %ymm0
  retq

==============================================================================

define <16 x i32> @test_2xi32_to_16xi32_mem(<2 x i32>* %vp) {
   %vec = load <2 x i32>, <2 x i32>* %vp
   %res = shufflevector <2 x i32> %vec, <2 x i32> undef, <16 x i32> <i32 0, i32
1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 0,
i32 1, i32 0, i32 1>
   ret <16 x i32> %res 
 }

LLVM emits the following:
  vpmovzxdq (%rdi), %xmm0 # xmm0 = mem[0],zero,mem[1],zero
  vmovdqa32 .LCPI45_0(%rip), %zmm1 # zmm1 = [0,2,0,2,0,2,0,2,0,2,0,2,0,2,0,2]
  vpermd %zmm0, %zmm1, %zmm0
  retq 

Instead of:
  vbroadcasti32x2 (%rdi), %zmm0
  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/20170831/231042c1/attachment.html>


More information about the llvm-bugs mailing list