• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -instcombine < %s | FileCheck %s
2
3define float @test1(i32 %scale) {
4entry:
5  %tmp1 = icmp sgt i32 1, %scale
6  %tmp2 = select i1 %tmp1, i32 1, i32 %scale
7  %tmp3 = sitofp i32 %tmp2 to float
8  %tmp4 = icmp sgt i32 %tmp2, 0
9  %sel = select i1 %tmp4, float %tmp3, float 0.000000e+00
10  ret float %sel
11}
12
13; CHECK-LABEL: define float @test1(
14; CHECK:  %[[tmp1:.*]] = icmp slt i32 %scale, 1
15; CHECK:  %[[tmp2:.*]] = select i1 %[[tmp1]], i32 1, i32 %scale
16; CHECK:  %[[tmp3:.*]] = sitofp i32 %[[tmp2]] to float
17; CHECK:  %[[tmp4:.*]] = icmp sgt i32 %[[tmp2]], 0
18; CHECK:  %[[sel:.*]] = select i1 %[[tmp4]], float %[[tmp3]], float 0.000000e+00
19; CHECK:  ret float %[[sel]]
20