ret <3 x i8> %sh
}
+define i8 @lshr_by_sext_bool(i1 %x, i8 %y) {
+; CHECK-LABEL: @lshr_by_sext_bool(
+; CHECK-NEXT: [[S:%.*]] = sext i1 [[X:%.*]] to i8
+; CHECK-NEXT: [[R:%.*]] = lshr i8 [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = sext i1 %x to i8
+ %r = lshr i8 %y, %s
+ ret i8 %r
+}
+
+define <2 x i8> @lshr_by_sext_bool_vec(<2 x i1> %x, <2 x i8> %y) {
+; CHECK-LABEL: @lshr_by_sext_bool_vec(
+; CHECK-NEXT: [[S:%.*]] = sext <2 x i1> [[X:%.*]] to <2 x i8>
+; CHECK-NEXT: [[R:%.*]] = lshr <2 x i8> [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret <2 x i8> [[R]]
+;
+ %s = sext <2 x i1> %x to <2 x i8>
+ %r = lshr <2 x i8> %y, %s
+ ret <2 x i8> %r
+}
+
+define i8 @ashr_by_sext_bool(i1 %x, i8 %y) {
+; CHECK-LABEL: @ashr_by_sext_bool(
+; CHECK-NEXT: [[S:%.*]] = sext i1 [[X:%.*]] to i8
+; CHECK-NEXT: [[R:%.*]] = ashr i8 [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = sext i1 %x to i8
+ %r = ashr i8 %y, %s
+ ret i8 %r
+}
+
+define <2 x i8> @ashr_by_sext_bool_vec(<2 x i1> %x, <2 x i8> %y) {
+; CHECK-LABEL: @ashr_by_sext_bool_vec(
+; CHECK-NEXT: [[S:%.*]] = sext <2 x i1> [[X:%.*]] to <2 x i8>
+; CHECK-NEXT: [[R:%.*]] = ashr <2 x i8> [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret <2 x i8> [[R]]
+;
+ %s = sext <2 x i1> %x to <2 x i8>
+ %r = ashr <2 x i8> %y, %s
+ ret <2 x i8> %r
+}
+
+define i8 @shl_by_sext_bool(i1 %x, i8 %y) {
+; CHECK-LABEL: @shl_by_sext_bool(
+; CHECK-NEXT: [[S:%.*]] = sext i1 [[X:%.*]] to i8
+; CHECK-NEXT: [[R:%.*]] = shl i8 [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = sext i1 %x to i8
+ %r = shl i8 %y, %s
+ ret i8 %r
+}
+
+define <2 x i8> @shl_by_sext_bool_vec(<2 x i1> %x, <2 x i8> %y) {
+; CHECK-LABEL: @shl_by_sext_bool_vec(
+; CHECK-NEXT: [[S:%.*]] = sext <2 x i1> [[X:%.*]] to <2 x i8>
+; CHECK-NEXT: [[R:%.*]] = shl <2 x i8> [[Y:%.*]], [[S]]
+; CHECK-NEXT: ret <2 x i8> [[R]]
+;
+ %s = sext <2 x i1> %x to <2 x i8>
+ %r = shl <2 x i8> %y, %s
+ ret <2 x i8> %r
+}
+