LegalizeDAG: Respect the result of TLI.getBooleanContents() when expanding SETCC
[oota-llvm.git] / test / CodeGen / R600 / legalizedag-bug-expand-setcc.ll
1 ; RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck %s
2
3 ; This tests a bug where LegalizeDAG was not checking the target's
4 ; BooleanContents value and always using one for true, when expanding
5 ; setcc to select_cc.
6 ;
7 ; This bug caused the icmp IR instruction to be expanded to two machine
8 ; instructions, when only one is needed.
9 ;
10
11 ; CHECK: @setcc_expand
12 ; CHECK: SET
13 ; CHECK-NOT: CND
14 define void @setcc_expand(i32 addrspace(1)* %out, i32 %in) {
15 entry:
16   %0 = icmp eq i32 %in, 5
17   br i1 %0, label %IF, label %ENDIF
18 IF:
19   %1 = getelementptr i32 addrspace(1)* %out, i32 1
20   store i32 0, i32 addrspace(1)* %1
21   br label %ENDIF
22
23 ENDIF:
24   store i32 0, i32 addrspace(1)* %out
25   ret void
26 }