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

Arch D. Robison arch.robison at intel.com
Fri Mar 21 15:02:39 PDT 2014


  Yes, it vectorizes Matt Arsenault's example.  Here's a transcript:

    $ opt -S -slp-vectorizer /tmp/ex.ll
    ; ModuleID = '/tmp/ex.ll'
    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 = icmp ne <4 x i32> %c, zeroinitializer
      %1 = select <4 x i1> %0, <4 x float> %a, <4 x float> %b
      %2 = extractelement <4 x float> %1, i32 0
      %3 = insertelement <4 x float> undef, float %2, i32 0
      %4 = extractelement <4 x float> %1, i32 1
      %5 = insertelement <4 x float> %3, float %4, i32 1
      %6 = extractelement <4 x float> %1, i32 2
      %7 = insertelement <4 x float> %5, float %6, i32 2
      %8 = extractelement <4 x float> %1, i32 3
      %9 = insertelement <4 x float> %7, float %8, i32 3
      ret <4 x float> %9
    }

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



More information about the llvm-commits mailing list