306 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -O2 -S -mattr=avx < %s | FileCheck %s3; RUN: opt -passes="default<O2>" -S -mattr=avx < %s | FileCheck %s4 5target triple = "x86_64--"6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"7 8; Eliminate redundant shuffles9 10define <2 x i64> @shuffle_32_add_16_shuffle_32_masks_are_eq(<2 x i64> %v) {11; CHECK-LABEL: @shuffle_32_add_16_shuffle_32_masks_are_eq(12; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[V:%.*]] to <8 x i16>13; CHECK-NEXT: [[TMP2:%.*]] = shl <8 x i16> [[TMP1]], splat (i16 1)14; CHECK-NEXT: [[BC5:%.*]] = bitcast <8 x i16> [[TMP2]] to <2 x i64>15; CHECK-NEXT: ret <2 x i64> [[BC5]]16;17 %bc0 = bitcast <2 x i64> %v to <4 x i32>18 %shuffle = shufflevector <4 x i32> %bc0, <4 x i32> zeroinitializer, <4 x i32> <i32 3, i32 2, i32 1, i32 0>19 %bc1 = bitcast <4 x i32> %shuffle to <2 x i64>20 %bc2 = bitcast <2 x i64> %bc1 to <8 x i16>21 %add.i = add <8 x i16> %bc2, %bc222 %bc3 = bitcast <8 x i16> %add.i to <2 x i64>23 %bc4 = bitcast <2 x i64> %bc3 to <4 x i32>24 %shuffle4 = shufflevector <4 x i32> %bc4, <4 x i32> zeroinitializer, <4 x i32> <i32 3, i32 2, i32 1, i32 0>25 %bc5 = bitcast <4 x i32> %shuffle4 to <2 x i64>26 ret <2 x i64> %bc527}28 29; Eliminate redundant shuffles30 31define <2 x i64> @shuffle_32_add_8_shuffle_32_masks_are_eq(<2 x i64> %v) {32; CHECK-LABEL: @shuffle_32_add_8_shuffle_32_masks_are_eq(33; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[V:%.*]] to <16 x i8>34; CHECK-NEXT: [[TMP2:%.*]] = shl <16 x i8> [[TMP1]], splat (i8 1)35; CHECK-NEXT: [[BC5:%.*]] = bitcast <16 x i8> [[TMP2]] to <2 x i64>36; CHECK-NEXT: ret <2 x i64> [[BC5]]37;38 %bc0 = bitcast <2 x i64> %v to <4 x i32>39 %shuffle = shufflevector <4 x i32> %bc0, <4 x i32> zeroinitializer, <4 x i32> <i32 3, i32 2, i32 1, i32 0>40 %bc1 = bitcast <4 x i32> %shuffle to <2 x i64>41 %bc2 = bitcast <2 x i64> %bc1 to <16 x i8>42 %add.i = add <16 x i8> %bc2, %bc243 %bc3 = bitcast <16 x i8> %add.i to <2 x i64>44 %bc4 = bitcast <2 x i64> %bc3 to <4 x i32>45 %shuffle4 = shufflevector <4 x i32> %bc4, <4 x i32> zeroinitializer, <4 x i32> <i32 3, i32 2, i32 1, i32 0>46 %bc5 = bitcast <4 x i32> %shuffle4 to <2 x i64>47 ret <2 x i64> %bc548}49 50; Eliminate redundant shuffles51 52define <2 x i64> @shuffle_8_add_32_shuffle_8_masks_are_eq(<2 x i64> %v) {53; CHECK-LABEL: @shuffle_8_add_32_shuffle_8_masks_are_eq(54; CHECK-NEXT: [[TMP1:%.*]] = bitcast <2 x i64> [[V:%.*]] to <4 x i32>55; CHECK-NEXT: [[TMP2:%.*]] = shl <4 x i32> [[TMP1]], splat (i32 1)56; CHECK-NEXT: [[BC5:%.*]] = bitcast <4 x i32> [[TMP2]] to <2 x i64>57; CHECK-NEXT: ret <2 x i64> [[BC5]]58;59 %bc0 = bitcast <2 x i64> %v to <16 x i8>60 %shuffle = shufflevector <16 x i8> %bc0, <16 x i8> zeroinitializer, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>61 %bc1 = bitcast <16 x i8> %shuffle to <2 x i64>62 %bc2 = bitcast <2 x i64> %bc1 to <4 x i32>63 %add.i = add <4 x i32> %bc2, %bc264 %bc3 = bitcast <4 x i32> %add.i to <2 x i64>65 %bc4 = bitcast <2 x i64> %bc3 to <16 x i8>66 %shuffle4 = shufflevector <16 x i8> %bc4, <16 x i8> zeroinitializer, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>67 %bc5 = bitcast <16 x i8> %shuffle4 to <2 x i64>68 ret <2 x i64> %bc569}70 71; Single shuffle should sink.72 73define <8 x i16> @shuffle_32_add_16_masks_are_eq(<4 x i32> %v1, <4 x i32> %v2) {74; CHECK-LABEL: @shuffle_32_add_16_masks_are_eq(75; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <8 x i16>76; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i32> [[V2:%.*]] to <8 x i16>77; CHECK-NEXT: [[TMP3:%.*]] = add <8 x i16> [[TMP2]], [[TMP1]]78; CHECK-NEXT: [[ADD:%.*]] = shufflevector <8 x i16> [[TMP3]], <8 x i16> poison, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>79; CHECK-NEXT: ret <8 x i16> [[ADD]]80;81 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>82 %shuffle2 = shufflevector <4 x i32> %v2, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>83 %bc1 = bitcast <4 x i32> %shuffle1 to <8 x i16>84 %bc2 = bitcast <4 x i32> %shuffle2 to <8 x i16>85 %add = add <8 x i16> %bc1, %bc286 ret <8 x i16> %add87}88 89; Sink single shuffle.90 91define <16 x i8> @shuffle_32_add_8_masks_are_eq(<4 x i32> %v1, <4 x i32> %v2) {92; CHECK-LABEL: @shuffle_32_add_8_masks_are_eq(93; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <16 x i8>94; CHECK-NEXT: [[TMP2:%.*]] = bitcast <4 x i32> [[V2:%.*]] to <16 x i8>95; CHECK-NEXT: [[TMP3:%.*]] = add <16 x i8> [[TMP2]], [[TMP1]]96; CHECK-NEXT: [[ADD:%.*]] = shufflevector <16 x i8> [[TMP3]], <16 x i8> poison, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>97; CHECK-NEXT: ret <16 x i8> [[ADD]]98;99 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>100 %shuffle2 = shufflevector <4 x i32> %v2, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>101 %bc1 = bitcast <4 x i32> %shuffle1 to <16 x i8>102 %bc2 = bitcast <4 x i32> %shuffle2 to <16 x i8>103 %add = add <16 x i8> %bc1, %bc2104 ret <16 x i8> %add105}106 107; Sink single shuffle.108 109define <16 x i8> @shuffle_16_add_8_masks_are_eq(<8 x i16> %v1, <8 x i16> %v2) {110; CHECK-LABEL: @shuffle_16_add_8_masks_are_eq(111; CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[V1:%.*]] to <16 x i8>112; CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i16> [[V2:%.*]] to <16 x i8>113; CHECK-NEXT: [[TMP3:%.*]] = add <16 x i8> [[TMP2]], [[TMP1]]114; CHECK-NEXT: [[ADD:%.*]] = shufflevector <16 x i8> [[TMP3]], <16 x i8> poison, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1, i32 8, i32 9, i32 10, i32 11, i32 14, i32 15, i32 12, i32 13>115; CHECK-NEXT: ret <16 x i8> [[ADD]]116;117 %shuffle1 = shufflevector <8 x i16> %v1, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 1, i32 0, i32 4, i32 5, i32 7, i32 6>118 %shuffle2 = shufflevector <8 x i16> %v2, <8 x i16> undef, <8 x i32> <i32 2, i32 3, i32 1, i32 0, i32 4, i32 5, i32 7, i32 6>119 %bc1 = bitcast <8 x i16> %shuffle1 to <16 x i8>120 %bc2 = bitcast <8 x i16> %shuffle2 to <16 x i8>121 %add = add <16 x i8> %bc1, %bc2122 ret <16 x i8> %add123}124 125; Sink single shuffle.126 127define <4 x i32> @shuffle_16_add_32_masks_are_eq_and_can_be_converted_up(<8 x i16> %v1, <8 x i16> %v2) {128; CHECK-LABEL: @shuffle_16_add_32_masks_are_eq_and_can_be_converted_up(129; CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[V1:%.*]] to <4 x i32>130; CHECK-NEXT: [[TMP2:%.*]] = bitcast <8 x i16> [[V2:%.*]] to <4 x i32>131; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i32> [[TMP2]], [[TMP1]]132; CHECK-NEXT: [[ADD:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 1>133; CHECK-NEXT: ret <4 x i32> [[ADD]]134;135 %shuffle1 = shufflevector <8 x i16> %v1, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>136 %shuffle2 = shufflevector <8 x i16> %v2, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>137 %bc1 = bitcast <8 x i16> %shuffle1 to <4 x i32>138 %bc2 = bitcast <8 x i16> %shuffle2 to <4 x i32>139 %add = add <4 x i32> %bc1, %bc2140 ret <4 x i32> %add141}142 143; Sink single shuffle.144 145define <4 x i32> @shuffle_8_add_32_masks_are_eq_and_can_be_converted_up(<16 x i8> %v1, <16 x i8> %v2) {146; CHECK-LABEL: @shuffle_8_add_32_masks_are_eq_and_can_be_converted_up(147; CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x i8> [[V1:%.*]] to <4 x i32>148; CHECK-NEXT: [[TMP2:%.*]] = bitcast <16 x i8> [[V2:%.*]] to <4 x i32>149; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i32> [[TMP2]], [[TMP1]]150; CHECK-NEXT: [[ADD:%.*]] = shufflevector <4 x i32> [[TMP3]], <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 2, i32 3>151; CHECK-NEXT: ret <4 x i32> [[ADD]]152;153 %shuffle1 = shufflevector <16 x i8> %v1, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>154 %shuffle2 = shufflevector <16 x i8> %v2, <16 x i8> undef, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>155 %bc1 = bitcast <16 x i8> %shuffle1 to <4 x i32>156 %bc2 = bitcast <16 x i8> %shuffle2 to <4 x i32>157 %add = add <4 x i32> %bc1, %bc2158 ret <4 x i32> %add159}160 161; shuffle<8 x i16>( bitcast<8 x i16>( shuffle<4 x i32>(v)))162 163define <8 x i16> @shuffle_32_bitcast_16_shuffle_16_can_be_converted_up(<4 x i32> %v1) {164; CHECK-LABEL: @shuffle_32_bitcast_16_shuffle_16_can_be_converted_up(165; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <8 x i16>166; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> poison, <8 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5>167; CHECK-NEXT: ret <8 x i16> [[SHUFFLE2]]168;169 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>170 %bc1 = bitcast <4 x i32> %shuffle1 to <8 x i16>171 %shuffle2 = shufflevector <8 x i16> %bc1, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>172 ret <8 x i16> %shuffle2173}174 175; shuffle<8 x i16>( bitcast<8 x i16>( shuffle<4 x i32>(v)))176 177define <8 x i16> @shuffle_32_bitcast_16_shuffle_16_can_not_be_converted_up(<4 x i32> %v1) {178; CHECK-LABEL: @shuffle_32_bitcast_16_shuffle_16_can_not_be_converted_up(179; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <8 x i16>180; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> poison, <8 x i32> <i32 3, i32 2, i32 0, i32 1, i32 4, i32 5, i32 6, i32 7>181; CHECK-NEXT: ret <8 x i16> [[SHUFFLE2]]182;183 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>184 %bc1 = bitcast <4 x i32> %shuffle1 to <8 x i16>185 %shuffle2 = shufflevector <8 x i16> %bc1, <8 x i16> undef, <8 x i32> <i32 5, i32 4, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>186 ret <8 x i16> %shuffle2187}188 189; shuffle<16 x i8>( bitcast<16 x i8>( shuffle<4 x i32>(v)))190 191define <16 x i8> @shuffle_32_bitcast_8_shuffle_8_can_be_converted_up(<4 x i32> %v1) {192; CHECK-LABEL: @shuffle_32_bitcast_8_shuffle_8_can_be_converted_up(193; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <16 x i8>194; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> poison, <16 x i32> <i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 12, i32 13, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11>195; CHECK-NEXT: ret <16 x i8> [[SHUFFLE2]]196;197 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>198 %bc1 = bitcast <4 x i32> %shuffle1 to <16 x i8>199 %shuffle2 = shufflevector <16 x i8> %bc1, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>200 ret <16 x i8> %shuffle2201}202 203; shuffle<16 x i8>( bitcast<16 x i8>( shuffle<4 x i32>(v)))204 205define <16 x i8> @shuffle_32_bitcast_8_shuffle_8_can_not_be_converted_up(<4 x i32> %v1) {206; CHECK-LABEL: @shuffle_32_bitcast_8_shuffle_8_can_not_be_converted_up(207; CHECK-NEXT: [[TMP1:%.*]] = bitcast <4 x i32> [[V1:%.*]] to <16 x i8>208; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <16 x i8> [[TMP1]], <16 x i8> poison, <16 x i32> <i32 13, i32 12, i32 14, i32 15, i32 8, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>209; CHECK-NEXT: ret <16 x i8> [[SHUFFLE2]]210;211 %shuffle1 = shufflevector <4 x i32> %v1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>212 %bc1 = bitcast <4 x i32> %shuffle1 to <16 x i8>213 %shuffle2 = shufflevector <16 x i8> %bc1, <16 x i8> undef, <16 x i32> <i32 5, i32 4, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>214 ret <16 x i8> %shuffle2215}216 217; shuffle<4 x i32>( bitcast<4 x i32>( shuffle<16 x i8>(v)))218 219define <4 x i32> @shuffle_8_bitcast_32_shuffle_32_can_be_converted_up(<16 x i8> %v1) {220; CHECK-LABEL: @shuffle_8_bitcast_32_shuffle_32_can_be_converted_up(221; CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x i8> [[V1:%.*]] to <4 x i32>222; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>223; CHECK-NEXT: ret <4 x i32> [[SHUFFLE2]]224;225 %shuffle1 = shufflevector <16 x i8> %v1, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>226 %bc1 = bitcast <16 x i8> %shuffle1 to <4 x i32>227 %shuffle2 = shufflevector <4 x i32> %bc1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>228 ret <4 x i32> %shuffle2229}230 231; shuffle<4 x i32>( bitcast<4 x i32>( shuffle<8 x i16>(v)))232 233define <4 x i32> @shuffle_16_bitcast_32_shuffle_32_can_be_converted_up(<8 x i16> %v1) {234; CHECK-LABEL: @shuffle_16_bitcast_32_shuffle_32_can_be_converted_up(235; CHECK-NEXT: [[TMP1:%.*]] = bitcast <8 x i16> [[V1:%.*]] to <4 x i32>236; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[TMP1]], <4 x i32> poison, <4 x i32> <i32 1, i32 0, i32 3, i32 2>237; CHECK-NEXT: ret <4 x i32> [[SHUFFLE2]]238;239 %shuffle1 = shufflevector <8 x i16> %v1, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>240 %bc1 = bitcast <8 x i16> %shuffle1 to <4 x i32>241 %shuffle2 = shufflevector <4 x i32> %bc1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>242 ret <4 x i32> %shuffle2243}244 245; shuffle<4 x i32>( bitcast<4 x i32>( shuffle<16 x i8>(v)))246; TODO: Narrow and squash shuffles?247 248define <4 x i32> @shuffle_8_bitcast_32_shuffle_32_can_not_be_converted_up(<16 x i8> %v1) {249; CHECK-LABEL: @shuffle_8_bitcast_32_shuffle_32_can_not_be_converted_up(250; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <16 x i8> [[V1:%.*]], <16 x i8> poison, <16 x i32> <i32 9, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>251; CHECK-NEXT: [[BC1:%.*]] = bitcast <16 x i8> [[SHUFFLE1]] to <4 x i32>252; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[BC1]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>253; CHECK-NEXT: ret <4 x i32> [[SHUFFLE2]]254;255 %shuffle1 = shufflevector <16 x i8> %v1, <16 x i8> undef, <16 x i32> <i32 9, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>256 %bc1 = bitcast <16 x i8> %shuffle1 to <4 x i32>257 %shuffle2 = shufflevector <4 x i32> %bc1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>258 ret <4 x i32> %shuffle2259}260 261; shuffle<4 x i32>( bitcast<4 x i32>( shuffle<8 x i16>(v)))262; TODO: Narrow and squash shuffles?263 264define <4 x i32> @shuffle_16_bitcast_32_shuffle_32_can_not_be_converted_up(<8 x i16> %v1) {265; CHECK-LABEL: @shuffle_16_bitcast_32_shuffle_32_can_not_be_converted_up(266; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <8 x i16> [[V1:%.*]], <8 x i16> poison, <8 x i32> <i32 5, i32 4, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>267; CHECK-NEXT: [[BC1:%.*]] = bitcast <8 x i16> [[SHUFFLE1]] to <4 x i32>268; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <4 x i32> [[BC1]], <4 x i32> poison, <4 x i32> <i32 2, i32 3, i32 1, i32 0>269; CHECK-NEXT: ret <4 x i32> [[SHUFFLE2]]270;271 %shuffle1 = shufflevector <8 x i16> %v1, <8 x i16> undef, <8 x i32> <i32 5, i32 4, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>272 %bc1 = bitcast <8 x i16> %shuffle1 to <4 x i32>273 %shuffle2 = shufflevector <4 x i32> %bc1, <4 x i32> undef, <4 x i32> <i32 2, i32 3, i32 1, i32 0>274 ret <4 x i32> %shuffle2275}276 277; shuffle<8 x i16>( bitcast<8 x i16>( shuffle<16 x i8>(v)))278 279define <8 x i16> @shuffle_8_bitcast_16_shuffle_16_can__be_converted_up(<16 x i8> %v1) {280; CHECK-LABEL: @shuffle_8_bitcast_16_shuffle_16_can__be_converted_up(281; CHECK-NEXT: [[TMP1:%.*]] = bitcast <16 x i8> [[V1:%.*]] to <8 x i16>282; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <8 x i16> [[TMP1]], <8 x i16> poison, <8 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5>283; CHECK-NEXT: ret <8 x i16> [[SHUFFLE2]]284;285 %shuffle1 = shufflevector <16 x i8> %v1, <16 x i8> undef, <16 x i32> <i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>286 %bc1 = bitcast <16 x i8> %shuffle1 to <8 x i16>287 %shuffle2 = shufflevector <8 x i16> %bc1, <8 x i16> undef, <8 x i32> <i32 4, i32 5, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>288 ret <8 x i16> %shuffle2289}290 291; shuffle<8 x i16>( bitcast<8 x i16>( shuffle<16 x i8>(v)))292; TODO: Narrow and squash shuffles?293 294define <8 x i16> @shuffle_8_bitcast_16_shuffle_16_can_not_be_converted_up(<16 x i8> %v1) {295; CHECK-LABEL: @shuffle_8_bitcast_16_shuffle_16_can_not_be_converted_up(296; CHECK-NEXT: [[SHUFFLE1:%.*]] = shufflevector <16 x i8> [[V1:%.*]], <16 x i8> poison, <16 x i32> <i32 9, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>297; CHECK-NEXT: [[BC1:%.*]] = bitcast <16 x i8> [[SHUFFLE1]] to <8 x i16>298; CHECK-NEXT: [[SHUFFLE2:%.*]] = shufflevector <8 x i16> [[BC1]], <8 x i16> poison, <8 x i32> <i32 5, i32 4, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>299; CHECK-NEXT: ret <8 x i16> [[SHUFFLE2]]300;301 %shuffle1 = shufflevector <16 x i8> %v1, <16 x i8> undef, <16 x i32> <i32 9, i32 8, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 2, i32 3>302 %bc1 = bitcast <16 x i8> %shuffle1 to <8 x i16>303 %shuffle2 = shufflevector <8 x i16> %bc1, <8 x i16> undef, <8 x i32> <i32 5, i32 4, i32 6, i32 7, i32 2, i32 3, i32 0, i32 1>304 ret <8 x i16> %shuffle2305}306