%div = sdiv i8 %s, %x
ret i8 %div
}
+
+define i8 @sdiv_shl_shl_nsw2_nuw(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @sdiv_shl_shl_nsw2_nuw(
+; CHECK-NEXT: [[XZ:%.*]] = shl nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = sdiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nsw i8 %x, %z
+ %yz = shl nsw nuw i8 %y, %z
+ %d = sdiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @sdiv_shl_shl_nsw2_nuw_exact_use(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @sdiv_shl_shl_nsw2_nuw_exact_use(
+; CHECK-NEXT: [[XZ:%.*]] = shl nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: call void @use(i8 [[XZ]])
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = sdiv exact i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nsw i8 %x, %z
+ call void @use(i8 %xz)
+ %yz = shl nsw nuw i8 %y, %z
+ %d = sdiv exact i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @sdiv_shl_shl_nsw_nuw2(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @sdiv_shl_shl_nsw_nuw2(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = sdiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nuw i8 %x, %z
+ %yz = shl nsw nuw i8 %y, %z
+ %d = sdiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @sdiv_shl_shl_nsw_nuw(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @sdiv_shl_shl_nsw_nuw(
+; CHECK-NEXT: [[XZ:%.*]] = shl nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = sdiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nsw i8 %x, %z
+ %yz = shl nuw i8 %y, %z
+ %d = sdiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @sdiv_shl_shl_nuw_nsw2(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @sdiv_shl_shl_nuw_nsw2(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = sdiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nuw nsw i8 %x, %z
+ %yz = shl nsw i8 %y, %z
+ %d = sdiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define <2 x i8> @udiv_shl_shl_nuw2(<2 x i8> %x, <2 x i8> %y, <2 x i8> %z) {
+; CHECK-LABEL: @udiv_shl_shl_nuw2(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw <2 x i8> [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw <2 x i8> [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = udiv <2 x i8> [[XZ]], [[YZ]]
+; CHECK-NEXT: ret <2 x i8> [[D]]
+;
+ %xz = shl nuw <2 x i8> %x, %z
+ %yz = shl nuw <2 x i8> %y, %z
+ %d = udiv <2 x i8> %xz, %yz
+ ret <2 x i8> %d
+}
+
+define i8 @udiv_shl_shl_nuw2_exact_use2(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @udiv_shl_shl_nuw2_exact_use2(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: call void @use(i8 [[XZ]])
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: call void @use(i8 [[YZ]])
+; CHECK-NEXT: [[D:%.*]] = udiv exact i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nuw i8 %x, %z
+ call void @use(i8 %xz)
+ %yz = shl nuw i8 %y, %z
+ call void @use(i8 %yz)
+ %d = udiv exact i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @udiv_shl_shl_nuw_nsw(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @udiv_shl_shl_nuw_nsw(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = udiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nuw i8 %x, %z
+ %yz = shl nsw i8 %y, %z
+ %d = udiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @udiv_shl_shl_nsw_nuw(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @udiv_shl_shl_nsw_nuw(
+; CHECK-NEXT: [[XZ:%.*]] = shl nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nuw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = udiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nsw i8 %x, %z
+ %yz = shl nuw i8 %y, %z
+ %d = udiv i8 %xz, %yz
+ ret i8 %d
+}
+
+define i8 @udiv_shl_shl_nuw_nsw2(i8 %x, i8 %y, i8 %z) {
+; CHECK-LABEL: @udiv_shl_shl_nuw_nsw2(
+; CHECK-NEXT: [[XZ:%.*]] = shl nuw nsw i8 [[X:%.*]], [[Z:%.*]]
+; CHECK-NEXT: [[YZ:%.*]] = shl nsw i8 [[Y:%.*]], [[Z]]
+; CHECK-NEXT: [[D:%.*]] = udiv i8 [[XZ]], [[YZ]]
+; CHECK-NEXT: ret i8 [[D]]
+;
+ %xz = shl nuw nsw i8 %x, %z
+ %yz = shl nsw i8 %y, %z
+ %d = udiv i8 %xz, %yz
+ ret i8 %d
+}