Home | History | Annotate | Download | only in X86
      1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=CHECK-SSE2
      2 
      3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      4 target triple = "x86_64-unknown-unknown"
      5 
      6 define <8 x i16> @shuffle_v8i16_01012323(<8 x i16> %a, <8 x i16> %b) {
      7 ; CHECK-SSE2-LABEL: @shuffle_v8i16_01012323
      8 ; CHECK-SSE2:       # BB#0:
      9 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,0,1,1]
     10 ; CHECK-SSE2-NEXT:    retq
     11   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 1, i32 0, i32 1, i32 2, i32 3, i32 2, i32 3>
     12   ret <8 x i16> %shuffle
     13 }
     14 define <8 x i16> @shuffle_v8i16_67452301(<8 x i16> %a, <8 x i16> %b) {
     15 ; CHECK-SSE2-LABEL: @shuffle_v8i16_67452301
     16 ; CHECK-SSE2:       # BB#0:
     17 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,2,1,0]
     18 ; CHECK-SSE2-NEXT:    retq
     19   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 6, i32 7, i32 4, i32 5, i32 2, i32 3, i32 0, i32 1>
     20   ret <8 x i16> %shuffle
     21 }
     22 define <8 x i16> @shuffle_v8i16_456789AB(<8 x i16> %a, <8 x i16> %b) {
     23 ; CHECK-SSE2-LABEL: @shuffle_v8i16_456789AB
     24 ; CHECK-SSE2:       # BB#0:
     25 ; CHECK-SSE2:         shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
     26 ; CHECK-SSE2-NEXT:    retq
     27   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11>
     28   ret <8 x i16> %shuffle
     29 }
     30 
     31 define <8 x i16> @shuffle_v8i16_00000000(<8 x i16> %a, <8 x i16> %b) {
     32 ; CHECK-SSE2-LABEL: @shuffle_v8i16_00000000
     33 ; CHECK-SSE2:       # BB#0:
     34 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,0,3]
     35 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,0,0,0,4,5,6,7]
     36 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
     37 ; CHECK-SSE2-NEXT:    retq
     38   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
     39   ret <8 x i16> %shuffle
     40 }
     41 define <8 x i16> @shuffle_v8i16_00004444(<8 x i16> %a, <8 x i16> %b) {
     42 ; CHECK-SSE2-LABEL: @shuffle_v8i16_00004444
     43 ; CHECK-SSE2:       # BB#0:
     44 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,0,0,0,4,5,6,7]
     45 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
     46 ; CHECK-SSE2-NEXT:    retq
     47   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4>
     48   ret <8 x i16> %shuffle
     49 }
     50 define <8 x i16> @shuffle_v8i16_31206745(<8 x i16> %a, <8 x i16> %b) {
     51 ; CHECK-SSE2-LABEL: @shuffle_v8i16_31206745
     52 ; CHECK-SSE2:       # BB#0:
     53 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[3,1,2,0,4,5,6,7]
     54 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,3,2]
     55 ; CHECK-SSE2-NEXT:    retq
     56   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 3, i32 1, i32 2, i32 0, i32 6, i32 7, i32 4, i32 5>
     57   ret <8 x i16> %shuffle
     58 }
     59 define <8 x i16> @shuffle_v8i16_44440000(<8 x i16> %a, <8 x i16> %b) {
     60 ; CHECK-SSE2-LABEL: @shuffle_v8i16_44440000
     61 ; CHECK-SSE2:       # BB#0:
     62 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,1,0,3]
     63 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,0,0,0,4,5,6,7]
     64 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
     65 ; CHECK-SSE2-NEXT:    retq
     66   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 4, i32 4, i32 4, i32 0, i32 0, i32 0, i32 0>
     67   ret <8 x i16> %shuffle
     68 }
     69 define <8 x i16> @shuffle_v8i16_75643120(<8 x i16> %a, <8 x i16> %b) {
     70 ; CHECK-SSE2-LABEL: @shuffle_v8i16_75643120
     71 ; CHECK-SSE2:       # BB#0:
     72 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,3,0,1]
     73 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[3,1,2,0,4,5,6,7]
     74 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,7,5,6,4]
     75 ; CHECK-SSE2-NEXT:    retq
     76   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 7, i32 5, i32 6, i32 4, i32 3, i32 1, i32 2, i32 0>
     77   ret <8 x i16> %shuffle
     78 }
     79 
     80 define <8 x i16> @shuffle_v8i16_10545410(<8 x i16> %a, <8 x i16> %b) {
     81 ; CHECK-SSE2-LABEL: @shuffle_v8i16_10545410
     82 ; CHECK-SSE2:       # BB#0:
     83 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,0]
     84 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,0,3,2,4,5,6,7]
     85 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,5,4,7,6]
     86 ; CHECK-SSE2-NEXT:    retq
     87   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 1, i32 0, i32 5, i32 4, i32 5, i32 4, i32 1, i32 0>
     88   ret <8 x i16> %shuffle
     89 }
     90 define <8 x i16> @shuffle_v8i16_54105410(<8 x i16> %a, <8 x i16> %b) {
     91 ; CHECK-SSE2-LABEL: @shuffle_v8i16_54105410
     92 ; CHECK-SSE2:       # BB#0:
     93 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,0]
     94 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[3,2,1,0,4,5,6,7]
     95 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,5,4,7,6]
     96 ; CHECK-SSE2-NEXT:    retq
     97   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 5, i32 4, i32 1, i32 0, i32 5, i32 4, i32 1, i32 0>
     98   ret <8 x i16> %shuffle
     99 }
    100 define <8 x i16> @shuffle_v8i16_54101054(<8 x i16> %a, <8 x i16> %b) {
    101 ; CHECK-SSE2-LABEL: @shuffle_v8i16_54101054
    102 ; CHECK-SSE2:       # BB#0:
    103 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,0]
    104 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[3,2,1,0,4,5,6,7]
    105 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,7,6,5,4]
    106 ; CHECK-SSE2-NEXT:    retq
    107   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 5, i32 4, i32 1, i32 0, i32 1, i32 0, i32 5, i32 4>
    108   ret <8 x i16> %shuffle
    109 }
    110 define <8 x i16> @shuffle_v8i16_04400440(<8 x i16> %a, <8 x i16> %b) {
    111 ; CHECK-SSE2-LABEL: @shuffle_v8i16_04400440
    112 ; CHECK-SSE2:       # BB#0:
    113 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,0]
    114 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,2,0,4,5,6,7]
    115 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,6,4,4,6]
    116 ; CHECK-SSE2-NEXT:    retq
    117   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 4, i32 4, i32 0, i32 0, i32 4, i32 4, i32 0>
    118   ret <8 x i16> %shuffle
    119 }
    120 define <8 x i16> @shuffle_v8i16_40044004(<8 x i16> %a, <8 x i16> %b) {
    121 ; CHECK-SSE2-LABEL: @shuffle_v8i16_40044004
    122 ; CHECK-SSE2:       # BB#0:
    123 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,0]
    124 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[2,0,0,2,4,5,6,7]
    125 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,6,6,4]
    126 ; CHECK-SSE2-NEXT:    retq
    127   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 0, i32 0, i32 4, i32 4, i32 0, i32 0, i32 4>
    128   ret <8 x i16> %shuffle
    129 }
    130 
    131 define <8 x i16> @shuffle_v8i16_26405173(<8 x i16> %a, <8 x i16> %b) {
    132 ; CHECK-SSE2-LABEL: @shuffle_v8i16_26405173
    133 ; CHECK-SSE2:       # BB#0:
    134 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,1,3,4,5,6,7]
    135 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,7,5,4,6]
    136 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,2,1]
    137 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,3,2,0,4,5,6,7]
    138 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,5,6,4,7]
    139 ; CHECK-SSE2-NEXT:    retq
    140   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 2, i32 6, i32 4, i32 0, i32 5, i32 1, i32 7, i32 3>
    141   ret <8 x i16> %shuffle
    142 }
    143 define <8 x i16> @shuffle_v8i16_20645173(<8 x i16> %a, <8 x i16> %b) {
    144 ; CHECK-SSE2-LABEL: @shuffle_v8i16_20645173
    145 ; CHECK-SSE2:       # BB#0:
    146 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,1,3,4,5,6,7]
    147 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,7,5,4,6]
    148 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,2,1]
    149 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,0,3,2,4,5,6,7]
    150 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,5,6,4,7]
    151 ; CHECK-SSE2-NEXT:    retq
    152   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 2, i32 0, i32 6, i32 4, i32 5, i32 1, i32 7, i32 3>
    153   ret <8 x i16> %shuffle
    154 }
    155 define <8 x i16> @shuffle_v8i16_26401375(<8 x i16> %a, <8 x i16> %b) {
    156 ; CHECK-SSE2-LABEL: @shuffle_v8i16_26401375
    157 ; CHECK-SSE2:       # BB#0:
    158 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,1,3,4,5,6,7]
    159 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,7,5,4,6]
    160 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,1,2]
    161 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,3,2,0,4,5,6,7]
    162 ; CHECK-SSE2-NEXT:    retq
    163   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 2, i32 6, i32 4, i32 0, i32 1, i32 3, i32 7, i32 5>
    164   ret <8 x i16> %shuffle
    165 }
    166 
    167 define <8 x i16> @shuffle_v8i16_00444444(<8 x i16> %a, <8 x i16> %b) {
    168 ; CHECK-SSE2-LABEL: @shuffle_v8i16_00444444
    169 ; CHECK-SSE2:       # BB#0:
    170 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    171 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,0,2,2,4,5,6,7]
    172 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    173 ; CHECK-SSE2-NEXT:    retq
    174   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 0, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
    175   ret <8 x i16> %shuffle
    176 }
    177 define <8 x i16> @shuffle_v8i16_44004444(<8 x i16> %a, <8 x i16> %b) {
    178 ; CHECK-SSE2-LABEL: @shuffle_v8i16_44004444
    179 ; CHECK-SSE2:       # BB#0:
    180 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    181 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[2,2,0,0,4,5,6,7]
    182 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    183 ; CHECK-SSE2-NEXT:    retq
    184   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 4, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4>
    185   ret <8 x i16> %shuffle
    186 }
    187 define <8 x i16> @shuffle_v8i16_04404444(<8 x i16> %a, <8 x i16> %b) {
    188 ; CHECK-SSE2-LABEL: @shuffle_v8i16_04404444
    189 ; CHECK-SSE2:       # BB#0:
    190 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    191 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,2,0,4,5,6,7]
    192 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    193 ; CHECK-SSE2-NEXT:    retq
    194   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 4, i32 4, i32 0, i32 4, i32 4, i32 4, i32 4>
    195   ret <8 x i16> %shuffle
    196 }
    197 define <8 x i16> @shuffle_v8i16_04400000(<8 x i16> %a, <8 x i16> %b) {
    198 ; CHECK-SSE2-LABEL: @shuffle_v8i16_04400000
    199 ; CHECK-SSE2:       # BB#0:
    200 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,0,3]
    201 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,2,0,4,5,6,7]
    202 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    203 ; CHECK-SSE2-NEXT:    retq
    204   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 4, i32 4, i32 0, i32 0, i32 0, i32 0, i32 0>
    205   ret <8 x i16> %shuffle
    206 }
    207 define <8 x i16> @shuffle_v8i16_04404567(<8 x i16> %a, <8 x i16> %b) {
    208 ; CHECK-SSE2-LABEL: @shuffle_v8i16_04404567
    209 ; CHECK-SSE2:       # BB#0:
    210 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    211 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,2,0,4,5,6,7]
    212 ; CHECK-SSE2-NEXT:    retq
    213   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 4, i32 4, i32 0, i32 4, i32 5, i32 6, i32 7>
    214   ret <8 x i16> %shuffle
    215 }
    216 
    217 define <8 x i16> @shuffle_v8i16_0X444444(<8 x i16> %a, <8 x i16> %b) {
    218 ; CHECK-SSE2-LABEL: @shuffle_v8i16_0X444444
    219 ; CHECK-SSE2:       # BB#0:
    220 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    221 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,1,2,2,4,5,6,7]
    222 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    223 ; CHECK-SSE2-NEXT:    retq
    224   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 undef, i32 4, i32 4, i32 4, i32 4, i32 4, i32 4>
    225   ret <8 x i16> %shuffle
    226 }
    227 define <8 x i16> @shuffle_v8i16_44X04444(<8 x i16> %a, <8 x i16> %b) {
    228 ; CHECK-SSE2-LABEL: @shuffle_v8i16_44X04444
    229 ; CHECK-SSE2:       # BB#0:
    230 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    231 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[2,2,2,0,4,5,6,7]
    232 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    233 ; CHECK-SSE2-NEXT:    retq
    234   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 4, i32 undef, i32 0, i32 4, i32 4, i32 4, i32 4>
    235   ret <8 x i16> %shuffle
    236 }
    237 define <8 x i16> @shuffle_v8i16_X4404444(<8 x i16> %a, <8 x i16> %b) {
    238 ; CHECK-SSE2-LABEL: @shuffle_v8i16_X4404444
    239 ; CHECK-SSE2:       # BB#0:
    240 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    241 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,2,0,4,5,6,7]
    242 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,4,4,4]
    243 ; CHECK-SSE2-NEXT:    retq
    244   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 undef, i32 4, i32 4, i32 0, i32 4, i32 4, i32 4, i32 4>
    245   ret <8 x i16> %shuffle
    246 }
    247 
    248 define <8 x i16> @shuffle_v8i16_0127XXXX(<8 x i16> %a, <8 x i16> %b) {
    249 ; CHECK-SSE2-LABEL: @shuffle_v8i16_0127XXXX
    250 ; CHECK-SSE2:       # BB#0:
    251 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,1,3]
    252 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,7,6,7]
    253 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    254 ; CHECK-SSE2-NEXT:    retq
    255   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 7, i32 undef, i32 undef, i32 undef, i32 undef>
    256   ret <8 x i16> %shuffle
    257 }
    258 
    259 define <8 x i16> @shuffle_v8i16_XXXX4563(<8 x i16> %a, <8 x i16> %b) {
    260 ; CHECK-SSE2-LABEL: @shuffle_v8i16_XXXX4563
    261 ; CHECK-SSE2:       # BB#0:
    262 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,1,2,0]
    263 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,3,2,3,4,5,6,7]
    264 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,2,0]
    265 ; CHECK-SSE2-NEXT:    retq
    266   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 4, i32 5, i32 6, i32 3>
    267   ret <8 x i16> %shuffle
    268 }
    269 
    270 define <8 x i16> @shuffle_v8i16_4563XXXX(<8 x i16> %a, <8 x i16> %b) {
    271 ; CHECK-SSE2-LABEL: @shuffle_v8i16_4563XXXX
    272 ; CHECK-SSE2:       # BB#0:
    273 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,1,2,0]
    274 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,3,2,3,4,5,6,7]
    275 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,0,2,3]
    276 ; CHECK-SSE2-NEXT:    retq
    277   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 5, i32 6, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
    278   ret <8 x i16> %shuffle
    279 }
    280 
    281 define <8 x i16> @shuffle_v8i16_01274563(<8 x i16> %a, <8 x i16> %b) {
    282 ; CHECK-SSE2-LABEL: @shuffle_v8i16_01274563
    283 ; CHECK-SSE2:       # BB#0:
    284 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,1,3]
    285 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,6,5,4,7]
    286 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,1,2]
    287 ; CHECK-SSE2-NEXT:    retq
    288   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 7, i32 4, i32 5, i32 6, i32 3>
    289   ret <8 x i16> %shuffle
    290 }
    291 
    292 define <8 x i16> @shuffle_v8i16_45630127(<8 x i16> %a, <8 x i16> %b) {
    293 ; CHECK-SSE2-LABEL: @shuffle_v8i16_45630127
    294 ; CHECK-SSE2:       # BB#0:
    295 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,1,2,0]
    296 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,3,1,2,4,5,6,7]
    297 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,0,1,3]
    298 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,6,7,5,4]
    299 ; CHECK-SSE2-NEXT:    retq
    300   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 5, i32 6, i32 3, i32 0, i32 1, i32 2, i32 7>
    301   ret <8 x i16> %shuffle
    302 }
    303 
    304 define <8 x i16> @shuffle_v8i16_08192a3b(<8 x i16> %a, <8 x i16> %b) {
    305 ; CHECK-SSE2-LABEL: @shuffle_v8i16_08192a3b
    306 ; CHECK-SSE2:       # BB#0:
    307 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    308 ; CHECK-SSE2-NEXT:    retq
    309   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11>
    310   ret <8 x i16> %shuffle
    311 }
    312 
    313 define <8 x i16> @shuffle_v8i16_0c1d2e3f(<8 x i16> %a, <8 x i16> %b) {
    314 ; CHECK-SSE2-LABEL: @shuffle_v8i16_0c1d2e3f
    315 ; CHECK-SSE2:       # BB#0:
    316 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,3,2,3]
    317 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    318 ; CHECK-SSE2-NEXT:    retq
    319   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 12, i32 1, i32 13, i32 2, i32 14, i32 3, i32 15>
    320   ret <8 x i16> %shuffle
    321 }
    322 
    323 define <8 x i16> @shuffle_v8i16_4c5d6e7f(<8 x i16> %a, <8 x i16> %b) {
    324 ; CHECK-SSE2-LABEL: @shuffle_v8i16_4c5d6e7f
    325 ; CHECK-SSE2:       # BB#0:
    326 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,3,2,3]
    327 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,3,2,3]
    328 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    329 ; CHECK-SSE2-NEXT:    retq
    330   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 12, i32 5, i32 13, i32 6, i32 14, i32 7, i32 15>
    331   ret <8 x i16> %shuffle
    332 }
    333 
    334 define <8 x i16> @shuffle_v8i16_48596a7b(<8 x i16> %a, <8 x i16> %b) {
    335 ; CHECK-SSE2-LABEL: @shuffle_v8i16_48596a7b
    336 ; CHECK-SSE2:       # BB#0:
    337 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,3,2,3]
    338 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    339 ; CHECK-SSE2-NEXT:    retq
    340   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 4, i32 8, i32 5, i32 9, i32 6, i32 10, i32 7, i32 11>
    341   ret <8 x i16> %shuffle
    342 }
    343 
    344 define <8 x i16> @shuffle_v8i16_08196e7f(<8 x i16> %a, <8 x i16> %b) {
    345 ; CHECK-SSE2-LABEL: @shuffle_v8i16_08196e7f
    346 ; CHECK-SSE2:       # BB#0:
    347 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[0,3,2,3]
    348 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,2,3]
    349 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    350 ; CHECK-SSE2-NEXT:    retq
    351   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 6, i32 14, i32 7, i32 15>
    352   ret <8 x i16> %shuffle
    353 }
    354 
    355 define <8 x i16> @shuffle_v8i16_0c1d6879(<8 x i16> %a, <8 x i16> %b) {
    356 ; CHECK-SSE2-LABEL: @shuffle_v8i16_0c1d6879
    357 ; CHECK-SSE2:       # BB#0:
    358 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,0,2,3]
    359 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,3,2,3]
    360 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    361 ; CHECK-SSE2-NEXT:    retq
    362   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 12, i32 1, i32 13, i32 6, i32 8, i32 7, i32 9>
    363   ret <8 x i16> %shuffle
    364 }
    365 
    366 define <8 x i16> @shuffle_v8i16_109832ba(<8 x i16> %a, <8 x i16> %b) {
    367 ; CHECK-SSE2-LABEL: @shuffle_v8i16_109832ba
    368 ; CHECK-SSE2:       # BB#0:
    369 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    370 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm1 = xmm0[2,0,3,1,4,5,6,7]
    371 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,3,2,3]
    372 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[2,0,3,1,4,5,6,7]
    373 ; CHECK-SSE2-NEXT:    punpcklqdq %xmm0, %xmm1
    374 ; CHECK-SSE2-NEXT:    movdqa %xmm1, %xmm0
    375 ; CHECK-SSE2-NEXT:    retq
    376   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 1, i32 0, i32 9, i32 8, i32 3, i32 2, i32 11, i32 10>
    377   ret <8 x i16> %shuffle
    378 }
    379 
    380 define <8 x i16> @shuffle_v8i16_8091a2b3(<8 x i16> %a, <8 x i16> %b) {
    381 ; CHECK-SSE2-LABEL: @shuffle_v8i16_8091a2b3
    382 ; CHECK-SSE2:       # BB#0:
    383 ; CHECK-SSE2-NEXT:    punpcklwd %xmm0, %xmm1
    384 ; CHECK-SSE2-NEXT:    movdqa %xmm1, %xmm0
    385 ; CHECK-SSE2-NEXT:    retq
    386   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 8, i32 0, i32 9, i32 1, i32 10, i32 2, i32 11, i32 3>
    387   ret <8 x i16> %shuffle
    388 }
    389 define <8 x i16> @shuffle_v8i16_c4d5e6f7(<8 x i16> %a, <8 x i16> %b) {
    390 ; CHECK-SSE2-LABEL: @shuffle_v8i16_c4d5e6f7
    391 ; CHECK-SSE2:       # BB#0:
    392 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm2 = xmm0[2,3,2,3]
    393 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm1[2,3,2,3]
    394 ; CHECK-SSE2-NEXT:    punpcklwd %xmm2, %xmm0
    395 ; CHECK-SSE2-NEXT:    retq
    396   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 12, i32 4, i32 13, i32 5, i32 14, i32 6, i32 15, i32 7>
    397   ret <8 x i16> %shuffle
    398 }
    399 
    400 define <8 x i16> @shuffle_v8i16_0213cedf(<8 x i16> %a, <8 x i16> %b) {
    401 ; CHECK-SSE2-LABEL: @shuffle_v8i16_0213cedf
    402 ; CHECK-SSE2:       # BB#0:
    403 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,2,1,3,4,5,6,7]
    404 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,3,2,3]
    405 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm1 = xmm1[0,2,1,3,4,5,6,7]
    406 ; CHECK-SSE2-NEXT:    punpcklqdq %xmm1, %xmm0
    407 ; CHECK-SSE2-NEXT:    retq
    408   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 2, i32 1, i32 3, i32 12, i32 14, i32 13, i32 15>
    409   ret <8 x i16> %shuffle
    410 }
    411 
    412 define <8 x i16> @shuffle_v8i16_032dXXXX(<8 x i16> %a, <8 x i16> %b) {
    413 ; CHECK-SSE2-LABEL: @shuffle_v8i16_032dXXXX
    414 ; CHECK-SSE2:       # BB#0:
    415 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,1,2,3]
    416 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    417 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,3,2,3,4,5,6,7]
    418 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,6,6,7]
    419 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    420 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,3,2,1,4,5,6,7]
    421 ; CHECK-SSE2-NEXT:    retq
    422   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 3, i32 2, i32 13, i32 undef, i32 undef, i32 undef, i32 undef>
    423   ret <8 x i16> %shuffle
    424 }
    425 define <8 x i16> @shuffle_v8i16_XXXcXXXX(<8 x i16> %a, <8 x i16> %b) {
    426 ; CHECK-SSE2-LABEL: @shuffle_v8i16_XXXcXXXX
    427 ; CHECK-SSE2:       # BB#0:
    428 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm1[2,1,2,3]
    429 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[0,1,2,1,4,5,6,7]
    430 ; CHECK-SSE2-NEXT:    retq
    431   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 13, i32 undef, i32 undef, i32 undef, i32 undef>
    432   ret <8 x i16> %shuffle
    433 }
    434 
    435 define <8 x i16> @shuffle_v8i16_012dXXXX(<8 x i16> %a, <8 x i16> %b) {
    436 ; CHECK-SSE2-LABEL: @shuffle_v8i16_012dXXXX
    437 ; CHECK-SSE2:       # BB#0:
    438 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[2,1,2,3]
    439 ; CHECK-SSE2-NEXT:    punpcklwd %xmm1, %xmm0
    440 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,1,2,0]
    441 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,6,6,7]
    442 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,1,2,3]
    443 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,2,0,3,4,5,6,7]
    444 ; CHECK-SSE2-NEXT:    retq
    445   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 13, i32 undef, i32 undef, i32 undef, i32 undef>
    446   ret <8 x i16> %shuffle
    447 }
    448 
    449 define <8 x i16> @shuffle_v8i16_XXXXcde3(<8 x i16> %a, <8 x i16> %b) {
    450 ; CHECK-SSE2-LABEL: @shuffle_v8i16_XXXXcde3
    451 ; CHECK-SSE2:       # BB#0:
    452 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,2,1]
    453 ; CHECK-SSE2-NEXT:    punpckhwd %xmm0, %xmm1
    454 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm1[0,2,2,3,4,5,6,7]
    455 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,7,6,7]
    456 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,0,2]
    457 ; CHECK-SSE2-NEXT:    retq
    458   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 12, i32 13, i32 14, i32 3>
    459   ret <8 x i16> %shuffle
    460 }
    461 
    462 define <8 x i16> @shuffle_v8i16_cde3XXXX(<8 x i16> %a, <8 x i16> %b) {
    463 ; CHECK-SSE2-LABEL: @shuffle_v8i16_cde3XXXX
    464 ; CHECK-SSE2:       # BB#0:
    465 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,1,2,1]
    466 ; CHECK-SSE2-NEXT:    punpckhwd %xmm0, %xmm1
    467 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm1[0,2,2,3,4,5,6,7]
    468 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,7,6,7]
    469 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,2,2,3]
    470 ; CHECK-SSE2-NEXT:    retq
    471   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 12, i32 13, i32 14, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
    472   ret <8 x i16> %shuffle
    473 }
    474 
    475 define <8 x i16> @shuffle_v8i16_012dcde3(<8 x i16> %a, <8 x i16> %b) {
    476 ; CHECK-SSE2-LABEL: @shuffle_v8i16_012dcde3
    477 ; CHECK-SSE2:       # BB#0:
    478 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm2 = xmm0[0,1,2,1]
    479 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm3 = xmm1[2,1,2,3]
    480 ; CHECK-SSE2-NEXT:    punpckhwd %xmm2, %xmm1
    481 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm1 = xmm1[0,2,2,3,4,5,6,7]
    482 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm1 = xmm1[0,1,2,3,4,7,6,7]
    483 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm1 = xmm1[0,2,2,3]
    484 ; CHECK-SSE2-NEXT:    punpcklwd %xmm3, %xmm0
    485 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[3,1,2,0]
    486 ; CHECK-SSE2-NEXT:    pshufhw {{.*}} # xmm0 = xmm0[0,1,2,3,4,6,6,7]
    487 ; CHECK-SSE2-NEXT:    pshufd {{.*}} # xmm0 = xmm0[2,1,2,3]
    488 ; CHECK-SSE2-NEXT:    pshuflw {{.*}} # xmm0 = xmm0[1,2,0,3,4,5,6,7]
    489 ; CHECK-SSE2-NEXT:    punpcklqdq %xmm1, %xmm0
    490 ; CHECK-SSE2-NEXT:    retq
    491   %shuffle = shufflevector <8 x i16> %a, <8 x i16> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 13, i32 12, i32 13, i32 14, i32 3>
    492   ret <8 x i16> %shuffle
    493 }
    494