ret i17 %C
}
-define i19 @test10(i19 %A) {
+; shl (lshr X, C), C --> and X, C'
+
+define i19 @test10(i19 %X) {
; CHECK-LABEL: @test10(
-; CHECK-NEXT: [[B:%.*]] = and i19 %A, -262144
-; CHECK-NEXT: ret i19 [[B]]
+; CHECK-NEXT: [[SH1:%.*]] = and i19 %X, -262144
+; CHECK-NEXT: ret i19 [[SH1]]
+;
+ %sh1 = lshr i19 %X, 18
+ %sh2 = shl i19 %sh1, 18
+ ret i19 %sh2
+}
+
+; FIXME: Same as above with vectors.
+
+define <2 x i19> @test10_splat_vec(<2 x i19> %X) {
+; CHECK-LABEL: @test10_splat_vec(
+; CHECK-NEXT: [[SH1:%.*]] = lshr <2 x i19> %X, <i19 18, i19 18>
+; CHECK-NEXT: [[SH2:%.*]] = shl nuw <2 x i19> [[SH1]], <i19 18, i19 18>
+; CHECK-NEXT: ret <2 x i19> [[SH2]]
;
- %B = lshr i19 %A, 18
- %C = shl i19 %B, 18
- ret i19 %C
+ %sh1 = lshr <2 x i19> %X, <i19 18, i19 18>
+ %sh2 = shl <2 x i19> %sh1, <i19 18, i19 18>
+ ret <2 x i19> %sh2
}
; Don't hide the shl from scalar evolution. DAGCombine will get it.
ret i23 %C
}
-define i47 @test12(i47 %A) {
+; shl (ashr X, C), C --> and X, C'
+
+define i47 @test12(i47 %X) {
; CHECK-LABEL: @test12(
-; CHECK-NEXT: [[B1:%.*]] = and i47 %A, -256
-; CHECK-NEXT: ret i47 [[B1]]
+; CHECK-NEXT: [[SH11:%.*]] = and i47 %X, -256
+; CHECK-NEXT: ret i47 [[SH11]]
+;
+ %sh1 = ashr i47 %X, 8
+ %sh2 = shl i47 %sh1, 8
+ ret i47 %sh2
+}
+
+; FIXME: Same as above with vectors.
+
+define <2 x i47> @test12_splat_vec(<2 x i47> %X) {
+; CHECK-LABEL: @test12_splat_vec(
+; CHECK-NEXT: [[SH1:%.*]] = ashr <2 x i47> %X, <i47 8, i47 8>
+; CHECK-NEXT: [[SH2:%.*]] = shl nsw <2 x i47> [[SH1]], <i47 8, i47 8>
+; CHECK-NEXT: ret <2 x i47> [[SH2]]
;
- %B = ashr i47 %A, 8
- %C = shl i47 %B, 8
- ret i47 %C
+ %sh1 = ashr <2 x i47> %X, <i47 8, i47 8>
+ %sh2 = shl <2 x i47> %sh1, <i47 8, i47 8>
+ ret <2 x i47> %sh2
}
; Don't hide the shl from scalar evolution. DAGCombine will get it.