[PATCH] Extend SLPVectorizer for cases where insertelement instructions must be rescheduled

Matt Arsenault Matthew.Arsenault at amd.com
Fri Mar 21 14:48:03 PDT 2014


  This looks like it will fix the problem I started trying to fix a few months ago where this wasn't vectorized:

  target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-apple-macosx10.8.0"

  ; Function Attrs: nounwind readnone ssp uwtable
  define <4 x float> @simple_select(<4 x float> %a, <4 x float> %b, <4 x i32> %c) #0 {
  entry:
    %0 = extractelement <4 x i32> %c, i32 0
    %tobool = icmp ne i32 %0, 0
    %a.elt = extractelement <4 x float> %a, i32 0
    %b.elt = extractelement <4 x float> %b, i32 0
    %1 = select i1 %tobool, float %a.elt, float %b.elt
    %2 = insertelement <4 x float> undef, float %1, i32 0
    %3 = extractelement <4 x i32> %c, i32 1
    %tobool1 = icmp ne i32 %3, 0
    %a.elt17 = extractelement <4 x float> %a, i32 1
    %b.elt18 = extractelement <4 x float> %b, i32 1
    %4 = select i1 %tobool1, float %a.elt17, float %b.elt18
    %5 = insertelement <4 x float> %2, float %4, i32 1
    %6 = extractelement <4 x i32> %c, i32 2
    %tobool6 = icmp ne i32 %6, 0
    %a.elt19 = extractelement <4 x float> %a, i32 2
    %b.elt20 = extractelement <4 x float> %b, i32 2
    %7 = select i1 %tobool6, float %a.elt19, float %b.elt20
    %8 = insertelement <4 x float> %5, float %7, i32 2
    %9 = extractelement <4 x i32> %c, i32 3
    %tobool11 = icmp ne i32 %9, 0
    %a.elt21 = extractelement <4 x float> %a, i32 3
    %b.elt22 = extractelement <4 x float> %b, i32 3
    %10 = select i1 %tobool11, float %a.elt21, float %b.elt22
    %11 = insertelement <4 x float> %8, float %10, i32 3
    ret <4 x float> %11
  }

  attributes #0 = { nounwind readnone ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }

http://llvm-reviews.chandlerc.com/D3143



More information about the llvm-commits mailing list