1 ; RUN: opt -instcombine -S < %s | FileCheck %s
4 define float @foo1(float %a) #0 {
6 %b = fcmp ogt float %a, 0.000000e+00
7 %c = select i1 %b, float %a, float 0.000000e+00
8 %d = fcmp olt float %c, 1.000000e+00
9 %f = select i1 %d, float %c, float 1.000000e+00
14 define float @foo2(float %a) #0 {
16 %b = fcmp ogt float %a, 0.000000e+00
17 %c = select i1 %b, float %a, float 0.000000e+00
18 %d = fcmp olt float %c, 1.000000e+00
19 %e = select i1 %b, float %a, float 0.000000e+00
20 %f = select i1 %d, float %e, float 1.000000e+00
25 define <2 x i32> @foo3(<2 x i1> %vec_bool, i1 %bool, <2 x i32> %V) {
26 ; CHECK: %[[sel0:.*]] = select <2 x i1> %vec_bool, <2 x i32> zeroinitializer, <2 x i32> %V
27 ; CHECK: %[[sel1:.*]] = select i1 %bool, <2 x i32> %[[sel0]], <2 x i32> %V
28 ; CHECK: ret <2 x i32> %[[sel1]]
29 %sel0 = select <2 x i1> %vec_bool, <2 x i32> zeroinitializer, <2 x i32> %V
30 %sel1 = select i1 %bool, <2 x i32> %sel0, <2 x i32> %V
34 attributes #0 = { nounwind readnone ssp uwtable }