1; RUN: llc -o - %s | FileCheck %s
2; The selection DAG select(select()) normalisation crashed for different types
3; on the condition inputs.
4target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
5target triple = "mips--"
6
7; CHECK-LABEL: foobar
8; CHECK: sltiu ${{[0-9]*}}, ${{[0-9]*}}, 42
9; CHECK: sltiu ${{[0-9]*}}, ${{[0-9]*}}, 23
10; CHECK: and ${{[0-9]*}}, ${{[0-9]*}}, ${{[0-9]*}}
11; CHECK: sltu ${{[0-9]*}}, ${{[0-9]*}}, ${{[0-9]*}}
12; CHECK: addiu ${{[0-9]*}}, ${{[0-9]*}}, -1
13; CHECK: movn ${{[0-9]*}}, ${{[0-9]*}}, ${{[0-9]*}}
14; CHECK: jr $ra
15; CHECK: move ${{[0-9]*}}, ${{[0-9]*}}
16define i64 @foobar(i32 %arg) #0 {
17entry:
18  %cmp0 = icmp ult i32 %arg, 23
19  %cmp1 = icmp ult i32 %arg, 42
20  %and = and i1 %cmp0, %cmp1
21  %cmp2 = icmp ugt i32 %arg, 0
22  %sext = sext i1 %cmp1 to i64
23  %retval.0 = select i1 %and, i64 %sext, i64 0
24  ret i64 %retval.0
25}
26