%t3 = fadd fast float %t2, 1.0
ret float %t3
}
+
+define i8 @ashr_exact_poison_constant_fold(i1 %b, i8 %x) {
+; CHECK-LABEL: @ashr_exact_poison_constant_fold(
+; CHECK-NEXT: [[X_OP:%.*]] = ashr i8 [[X:%.*]], 3
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 [[X_OP]], i8 5
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 %x, i8 42
+ %r = ashr exact i8 %s, 3
+ ret i8 %r
+}
+
+define i8 @ashr_exact(i1 %b, i8 %x) {
+; CHECK-LABEL: @ashr_exact(
+; CHECK-NEXT: [[X_OP:%.*]] = ashr i8 [[X:%.*]], 3
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 [[X_OP]], i8 2
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 %x, i8 16
+ %r = ashr exact i8 %s, 3
+ ret i8 %r
+}
+
+define i8 @shl_nsw_nuw_poison_constant_fold(i1 %b, i8 %x) {
+; CHECK-LABEL: @shl_nsw_nuw_poison_constant_fold(
+; CHECK-NEXT: [[X_OP:%.*]] = shl i8 16, [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 -128, i8 [[X_OP]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 3, i8 %x
+ %r = shl nsw nuw i8 16, %s
+ ret i8 %r
+}
+
+define i8 @shl_nsw_nuw(i1 %b, i8 %x) {
+; CHECK-LABEL: @shl_nsw_nuw(
+; CHECK-NEXT: [[X_OP:%.*]] = shl i8 7, [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 56, i8 [[X_OP]]
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 3, i8 %x
+ %r = shl nsw nuw i8 7, %s
+ ret i8 %r
+}
+
+define i8 @add_nsw_poison_constant_fold(i1 %b, i8 %x) {
+; CHECK-LABEL: @add_nsw_poison_constant_fold(
+; CHECK-NEXT: [[X_OP:%.*]] = add i8 [[X:%.*]], 64
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 [[X_OP]], i8 -127
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 %x, i8 65
+ %r = add nsw i8 %s, 64
+ ret i8 %r
+}
+
+define i8 @add_nsw(i1 %b, i8 %x) {
+; CHECK-LABEL: @add_nsw(
+; CHECK-NEXT: [[X_OP:%.*]] = add i8 [[X:%.*]], 64
+; CHECK-NEXT: [[R:%.*]] = select i1 [[B:%.*]], i8 [[X_OP]], i8 71
+; CHECK-NEXT: ret i8 [[R]]
+;
+ %s = select i1 %b, i8 %x, i8 7
+ %r = add nsw i8 %s, 64
+ ret i8 %r
+}