1; RUN: llc < %s -O0 -mtriple=x86_64-apple-darwin10 | FileCheck %s
2
3; Test if we do not fold the cmp into select if the instructions are in
4; different basic blocks.
5
6define i32 @select_cmp_cmov_i32(i32 %a, i32 %b) {
7; CHECK-LABEL: select_cmp_cmov_i32
8; CHECK-LABEL: continue
9; CHECK-NOT:   cmp
10  %1 = icmp ult i32 %a, %b
11  br i1 %1, label %continue, label %exit
12
13continue:
14  %2 = select i1 %1, i32 %a, i32 %b
15  ret i32 %2
16
17exit:
18  ret i32 -1
19}
20
21define float @select_fcmp_oeq_f32(float %a, float %b, float %c, float %d) {
22; CHECK-LABEL: select_fcmp_oeq_f32
23; CHECK-LABEL: continue
24; CHECK-NOT:   cmp
25  %1 = fcmp oeq float %a, %b
26  br i1 %1, label %continue, label %exit
27
28continue:
29  %2 = select i1 %1, float %c, float %d
30  ret float %2
31
32exit:
33  ret float -1.0
34}
35
36define float @select_fcmp_one_f32(float %a, float %b, float %c, float %d) {
37; CHECK-LABEL: select_fcmp_one_f32
38; CHECK-LABEL: continue
39; CHECK-NOT:   ucomi
40  %1 = fcmp one float %a, %b
41  br i1 %1, label %continue, label %exit
42
43continue:
44  %2 = select i1 %1, float %c, float %d
45  ret float %2
46
47exit:
48  ret float -1.0
49}
50
51