Changes between Version 5 and Version 6 of ShufflePatternLibrary


Ignore:
Timestamp:
Apr 26, 2014, 6:19:21 PM (5 years ago)
Author:
cameron
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ShufflePatternLibrary

    v5 v6  
    44
    55The LLVM IR contains a very powerful vector operation
    6 called [http://llvm.org/docs/LangRef.html#shufflevector-instruction {{{shufflevector}}}].   Unless the target architecture
     6called [http://llvm.org/docs/LangRef.html#shufflevector-instruction shufflevector].   Unless the target architecture
    77supports a similarly powerful operation directly, good
    88code generation for {{{shufflevector}}} instructions with arbitrary
     
    2929we first perform some transformations to put shuffle vectors
    3030in canonical form.
     31
     32==== An Initial Example ====
    3133
    3234For example, consider the following three {{{shufflevector}}} patterns
     
    5557
    5658
     59==== Canonical Selection from Constant Splats ====
     60
    5761In general, in discussing canonical forms, we refer to the
    5862three consecutive arguments of {{{shufflevector}}} as
    5963vector 1 or {{{v1}}}, vector 2 or {{{v2}}} and {{{mask}}}.
     64
     65A constant splat is a constant vector having the same
     66value in every field.   When used as a vector, {{{zeroinitializer}}}
     67is a constant splat of the value {{{0}}}.
     68
     69Whenever one of the input vectors is a constant splat vector,
     70then the canonical selection mask values for selecting a
     71value from this vector must alwayws specify
     72selection from the first field in the vector.   
     73That is, if the size of the input vectors is {{{n}}},
     74and vector 2 is a constant splat, then the index {{{n}}}
     75is the canonical index for selection from this vector.   
     76Conversion to constant indexes in this case is illustrated
     77in the second step of the example above.   If vector 1
     78is a constant splat, then the canonical index
     79for selection from this vector is {{{0}}}.
    6080
    6181==== Canonical Order of Vectors ====
     
    85105 2.  If one of the vectors is {{{zeroinitializer}}} (or the equivalent constant), and the other vector is not {{{undef}}}, then vector 2 must be {{{zeroinitializer}}} in canonical order.
    86106 3.  If one of the vectors is a constant vector and the other vector is neither constant nor {{{undef}}}, then vector 2 must  be a constant vector in canonical order.
    87  4.  If all of the selector values in a mask are >= n, then the vector arguments must be exchanged to be placed in canonical order.
     107 4.  At least one of the selector values must be < n.
     108If all of the selector values in a mask are >= n, then the vector arguments must be exchanged
     109to be place the shuffle vector instance in canonical order.
    88110
    89111
    90112== Standard Pattern Examples ==
     113
     114In the following examples, the patterns are defined assuming that
     115the shufflevector arguments have been first placed in canonical form as
     116described above.
    91117
    92118=== The Rotate Pattern ===