Fix MachineSink to be able to sink instructions that use physical registers
[oota-llvm.git] / test / CodeGen / X86 / sink.ll
1 ; RUN: llc < %s -march=x86-64 -asm-verbose=false | FileCheck %s
2
3 ; Currently, floating-point selects are lowered to CFG triangles.
4 ; This means that one side of the select is always unconditionally
5 ; evaluated, however with MachineSink we can sink the other side so
6 ; that it's conditionally evaluated.
7
8 ; CHECK: foo:
9 ; CHECK-NEXT: divsd
10 ; CHECK-NEXT: testb $1, %dil
11 ; CHECK-NEXT: jne
12
13 define double @foo(double %x, double %y, i1 %c) nounwind {
14   %a = fdiv double %x, 3.2
15   %b = fdiv double %y, 3.3
16   %z = select i1 %c, double %a, double %b
17   ret double %z
18 }