[LLVMbugs] [Bug 14667] New: X86: Need to match vpminsd and vpmaxsd

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 19 22:12:09 PST 2012


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

             Bug #: 14667
           Summary: X86: Need to match vpminsd and vpmaxsd
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nrotem at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I am optimizing the function below.  LLC outputs the assembly sequence below.
This is inefficient. I'd like to see vpminsd and vpmaxsd. The generated code is
poor probably due operation legalization artifacts. 


define void @_Z8example1v() nounwind uwtable noinline ssp {
vector.ph:
  br label %vector.body

vector.body:                                      ; preds = %vector.body,
%vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %0 = getelementptr inbounds [2048 x i32]* @a, i64 0, i64 %index
  %1 = bitcast i32* %0 to <8 x i32>*
  %2 = load <8 x i32>* %1, align 16
  %3 = icmp sgt <8 x i32> %2, <i32 9, i32 9, i32 9, i32 9, i32 9, i32 9, i32 9,
i32 9>
  %4 = select <8 x i1> %3, <8 x i32> <i32 9, i32 9, i32 9, i32 9, i32 9, i32 9,
i32 9, i32 9>, <8 x i32> %2
  %5 = icmp slt <8 x i32> %4, <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4,
i32 4>
  %6 = select <8 x i1> %5, <8 x i32> <i32 4, i32 4, i32 4, i32 4, i32 4, i32 4,
i32 4, i32 4>, <8 x i32> %4
  store <8 x i32> %6, <8 x i32>* %1, align 16
  %index.next = add i64 %index, 8
  %7 = icmp eq i64 %index.next, 256
  br i1 %7, label %for.end, label %vector.body

for.end:                                          ; preds = %vector.body
  ret void 
}



  00000001000010d0  vmovups (%rcx,%rax), %ymm4
  00000001000010d5  vextractf128  $1, %ymm4, %xmm5
  00000001000010db  vpcmpgtd  %xmm1, %xmm5, %xmm5
  00000001000010df  vpcmpgtd  %xmm0, %xmm4, %xmm6
  00000001000010e3  vinsertf128 $1, %xmm5, %ymm6, %ymm5
  00000001000010e9  vblendvps %ymm5, %ymm0, %ymm4, %ymm4
  00000001000010ef  vextractf128  $1, %ymm4, %xmm5
  00000001000010f5  leaq  32(%rcx), %rdx 
  00000001000010f9  vpcmpgtd  %xmm5, %xmm3, %xmm5
  00000001000010fd  vpcmpgtd  %xmm4, %xmm2, %xmm6
  0000000100001101  cmpq  $1024, %rdx 
  0000000100001108  vinsertf128 $1, %xmm5, %ymm6, %ymm5
  000000010000110e  vblendvps %ymm5, %ymm2, %ymm4, %ymm4
  0000000100001114  vmovups %ymm4, (%rcx,%rax)
  0000000100001119  movq  %rdx, %rcx 
  000000010000111c  jne 0x1000010d0

-- 
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