1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -instcombine < %s | FileCheck %s
3
4define float @test1(i32 %scale) {
5; CHECK-LABEL: @test1(
6; CHECK-NEXT:    [[TMP1:%.*]] = icmp sgt i32 [[SCALE:%.*]], 1
7; CHECK-NEXT:    [[TMP2:%.*]] = select i1 [[TMP1]], i32 [[SCALE]], i32 1
8; CHECK-NEXT:    [[TMP3:%.*]] = sitofp i32 [[TMP2]] to float
9; CHECK-NEXT:    ret float [[TMP3]]
10;
11  %1 = icmp sgt i32 1, %scale
12  %2 = select i1 %1, i32 1, i32 %scale
13  %3 = sitofp i32 %2 to float
14  %4 = icmp sgt i32 %2, 0
15  %sel = select i1 %4, float %3, float 0.000000e+00
16  ret float %sel
17}
18