@@ -33,10 +33,10 @@ define <4 x float> @bitcast_shuf_same_size(<4 x i32> %v) {
3333 ret <4 x float > %r
3434}
3535
36- ; Negative test - length-changing shuffle
36+ ; TODO - length-changing shuffle
3737
38- define <16 x i8 > @bitcast_shuf_narrow_element_wrong_size (<2 x i32 > %v ) {
39- ; CHECK-LABEL: @bitcast_shuf_narrow_element_wrong_size (
38+ define <16 x i8 > @bitcast_shuf_narrow_element_subvector (<2 x i32 > %v ) {
39+ ; CHECK-LABEL: @bitcast_shuf_narrow_element_subvector (
4040; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <2 x i32> [[V:%.*]], <2 x i32> poison, <4 x i32> <i32 1, i32 0, i32 1, i32 0>
4141; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to <16 x i8>
4242; CHECK-NEXT: ret <16 x i8> [[R]]
@@ -46,6 +46,28 @@ define <16 x i8> @bitcast_shuf_narrow_element_wrong_size(<2 x i32> %v) {
4646 ret <16 x i8 > %r
4747}
4848
49+ define <16 x i16 > @bitcast_shuf_narrow_element_concat_subvectors (<2 x i64 > %v ) {
50+ ; CHECK-LABEL: @bitcast_shuf_narrow_element_concat_subvectors(
51+ ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <2 x i64> [[V:%.*]], <2 x i64> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
52+ ; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i64> [[SHUF]] to <16 x i16>
53+ ; CHECK-NEXT: ret <16 x i16> [[R]]
54+ ;
55+ %shuf = shufflevector <2 x i64 > %v , <2 x i64 > poison, <4 x i32 > <i32 0 , i32 1 , i32 0 , i32 1 >
56+ %r = bitcast <4 x i64 > %shuf to <16 x i16 >
57+ ret <16 x i16 > %r
58+ }
59+
60+ define <16 x i8 > @bitcast_shuf_extract_subvector (<8 x i32 > %v ) {
61+ ; CHECK-LABEL: @bitcast_shuf_extract_subvector(
62+ ; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <8 x i32> [[V:%.*]], <8 x i32> poison, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
63+ ; CHECK-NEXT: [[R:%.*]] = bitcast <4 x i32> [[SHUF]] to <16 x i8>
64+ ; CHECK-NEXT: ret <16 x i8> [[R]]
65+ ;
66+ %shuf = shufflevector <8 x i32 > %v , <8 x i32 > poison, <4 x i32 > <i32 4 , i32 5 , i32 6 , i32 7 >
67+ %r = bitcast <4 x i32 > %shuf to <16 x i8 >
68+ ret <16 x i8 > %r
69+ }
70+
4971; Negative test - must cast to vector type
5072
5173define i128 @bitcast_shuf_narrow_element_wrong_type (<4 x i32 > %v ) {
0 commit comments