1; Test that ComputeNumSignBitsForTargetNode() (SELECT_CCMASK) will help
2; DAGCombiner so that it knows that %sel0 is already sign extended.
3;
4; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 -debug-only=isel < %s 2>&1 | FileCheck %s
5; REQUIRES: asserts
6
7%0 = type <{ %1*, i16, [6 x i8] }>
8%1 = type { i32 (...)** }
9
10define signext i16 @fun(%0* %Arg0, i16 signext %Arg1) {
11entry:
12  br i1 undef, label %lab0, label %lab1
13
14lab0:
15  %icmp0 = icmp eq i32 undef, 0
16  %sel0 = select i1 %icmp0, i16 %Arg1, i16 1
17  br label %lab1
18
19lab1:
20; CHECK: *** MachineFunction at end of ISel ***
21; CHECK-LABEL: bb.2.lab1:
22; CHECK-NOT:   LHR
23; CHECK:       BRC
24  %phi0 = phi i16 [ 2, %entry ], [ %sel0, %lab0 ]
25  %sext0 = sext i16 %phi0 to i32
26  br i1 undef, label %lab2, label %lab3
27
28lab2:
29  %and0 = and i32 %sext0, 8
30  %icmp1 = icmp eq i32 %and0, 0
31  %sel1 = select i1 %icmp1, i16 %phi0, i16 4
32  ret i16 %sel1
33
34lab3:
35  ret i16 8
36}
37
38