a39ea03af55edc143983955b8abb8580d48283dc
[oota-llvm.git] / test / CodeGen / X86 / misched-new.ll
1 ; RUN: llc < %s -march=x86-64 -mcpu=core2 -x86-early-ifcvt -enable-misched \
2 ; RUN:          -misched=shuffle -misched-bottomup -verify-machineinstrs \
3 ; RUN:     | FileCheck %s
4 ; REQUIRES: asserts
5 ;
6 ; Interesting MachineScheduler cases.
7 ;
8 ; FIXME: There should be an assert in the coalescer that we're not rematting
9 ; "not-quite-dead" copies, but that breaks a lot of tests <rdar://problem/11148682>.
10
11 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
12
13 ; From oggenc.
14 ; After coalescing, we have a dead superreg (RAX) definition.
15 ;
16 ; CHECK: xorl %esi, %esi
17 ; CHECK: movl $32, %ecx
18 ; CHECK: rep;movsl
19 define fastcc void @_preextrapolate_helper() nounwind uwtable ssp {
20 entry:
21   br i1 undef, label %for.cond.preheader, label %if.end
22
23 for.cond.preheader:                               ; preds = %entry
24   call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* null, i64 128, i32 4, i1 false) nounwind
25   unreachable
26
27 if.end:                                           ; preds = %entry
28   ret void
29 }
30
31 ; The machine verifier checks that EFLAGS kill flags are updated when
32 ; the scheduler reorders cmovel instructions.
33 ;
34 ; CHECK: test
35 ; CHECK: cmovel
36 ; CHECK: cmovel
37 ; CHECK: call
38 define void @foo(i32 %b) nounwind uwtable ssp {
39 entry:
40   %tobool = icmp ne i32 %b, 0
41   br i1 %tobool, label %if.then, label %if.end
42
43 if.then:                                          ; preds = %entry
44   br label %if.end
45
46 if.end:                                           ; preds = %if.then, %entry
47   %v1 = phi i32 [1, %entry], [2, %if.then]
48   %v2 = phi i32 [3, %entry], [4, %if.then]
49   call void @bar(i32 %v1, i32 %v2)
50   ret void
51 }
52
53 declare void @bar(i32,i32)
54
55 ; Test that the DAG builder can handle an undef vreg on ExitSU.
56 ; CHECK: hasundef
57 ; CHECK: call
58
59 %t0 = type { i32, i32, i8 }
60 %t6 = type { i32 (...)**, %t7* }
61 %t7 = type { i32 (...)** }
62
63 define void @hasundef() unnamed_addr uwtable ssp align 2 {
64   %1 = alloca %t0, align 8
65   br i1 undef, label %3, label %2
66
67 ; <label>:2                                       ; preds = %0
68   unreachable
69
70 ; <label>:3                                       ; preds = %0
71   br i1 undef, label %4, label %5
72
73 ; <label>:4                                       ; preds = %3
74   call void undef(%t6* undef, %t0* %1)
75   unreachable
76
77 ; <label>:5                                       ; preds = %3
78   ret void
79 }