blob: 6fcf2b4e68b4efaa18584dbe900103d79d63a4cd [file] [log] [blame]
Matthias Braund0d5cbe2015-04-13 18:47:19 +00001; RUN: llc -o - %s | FileCheck %s
Matthias Brauna283cb32015-04-13 17:16:33 +00002; 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
Matthias Braund0d5cbe2015-04-13 18:47:19 +00007; 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 {
Matthias Brauna283cb32015-04-13 17:16:33 +000017entry:
Matthias Braund0d5cbe2015-04-13 18:47:19 +000018 %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
Matthias Brauna283cb32015-04-13 17:16:33 +000024 ret i64 %retval.0
25}