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: unassignedb...@nondot.org
          Reporter: ayman.m...@intel.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to