DAGCombiner: Fix crash in select(select) opt.
[oota-llvm.git] / test / CodeGen / Mips / dagcombine_crash.ll
1 ; RUN: llc -o - %s
2 ; The selection DAG select(select()) normalisation crashed for different types
3 ; on the condition inputs.
4 target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"
5 target triple = "mips--"
6
7 define i64 @foobar(double %a) #0 {
8 entry:
9   %0 = bitcast double %a to i64
10   %trunc = trunc i64 %0 to i32
11   %and = and i32 %trunc, 32767
12   %sub = add nsw i32 %and, -16383
13   %cmp = icmp ugt i32 %and, 16382
14   %and5 = and i32 %trunc, 32768
15   %tobool = icmp eq i32 %and5, 0
16   %or = and i1 %cmp, %tobool
17   %cmp6 = icmp ugt i32 %sub, 64
18   %sext = sext i1 %cmp6 to i64
19   %retval.0 = select i1 %or, i64 %sext, i64 0
20   ret i64 %retval.0
21 }