Fix PR4639, a ELF-TLS regression from some of my refactoring.
[oota-llvm.git] / test / CodeGen / X86 / commute-cmov.ll
1 ; RUN: llvm-as < %s | llc -march=x86 > %t
2 ; RUN: grep btl %t | count 2
3 ; RUN: grep cmov %t | count 2
4 ; RUN: not grep test %t
5 ; RUN: not grep set %t
6 ; RUN: not grep j %t
7 ; RUN: not grep cmovne %t
8 ; RUN: not grep cmove %t
9
10 define i32 @foo(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone {
11 entry:
12         %0 = lshr i32 %x, %n            ; <i32> [#uses=1]
13         %1 = and i32 %0, 1              ; <i32> [#uses=1]
14         %toBool = icmp eq i32 %1, 0             ; <i1> [#uses=1]
15         %.0 = select i1 %toBool, i32 %v, i32 12         ; <i32> [#uses=1]
16         ret i32 %.0
17 }
18 define i32 @bar(i32 %x, i32 %n, i32 %w, i32 %v) nounwind readnone {
19 entry:
20         %0 = lshr i32 %x, %n            ; <i32> [#uses=1]
21         %1 = and i32 %0, 1              ; <i32> [#uses=1]
22         %toBool = icmp eq i32 %1, 0             ; <i1> [#uses=1]
23         %.0 = select i1 %toBool, i32 12, i32 %v         ; <i32> [#uses=1]
24         ret i32 %.0
25 }