5970dcd31f08c7c86d01582cf1cc8c8778586f6e
[oota-llvm.git] / test / CodeGen / X86 / misched-copy.ll
1 ; REQUIRES: asserts
2 ;
3 ; FIXME: The following line is a hack to remove any stray files which might have
4 ; been left dangling around by this test. It can be removed once the various
5 ; bots have cycled past this commit.
6 ;
7 ; RUN: rm -f misched-copy.s %S/misched-copy.s
8 ;
9 ;
10 ; RUN: llc < %s -march=x86 -mcpu=core2 -pre-RA-sched=source -enable-misched -verify-misched -debug-only=misched -o - 2>&1 > /dev/null | FileCheck %s
11 ;
12 ; Test scheduling of copy instructions.
13 ;
14 ; Argument copies should be hoisted to the top of the block.
15 ; Return copies should be sunk to the end.
16 ; MUL_HiLo PhysReg use copies should be just above the mul.
17 ; MUL_HiLo PhysReg def copies should be just below the mul.
18 ;
19 ; CHECK:      *** Final schedule for BB#1 ***
20 ; CHECK-NEXT: %EAX<def> = COPY
21 ; CHECK:      MUL32r %vreg{{[0-9]+}}, %EAX<imp-def>, %EDX<imp-def>, %EFLAGS<imp-def,dead>, %EAX<imp-use>;
22 ; CHECK-NEXT: COPY %E{{[AD]}}X;
23 ; CHECK-NEXT: COPY %E{{[AD]}}X;
24 ; CHECK:      DIVSSrm
25 define i64 @mulhoist(i32 %a, i32 %b) #0 {
26 entry:
27   br label %body
28
29 body:
30   %convb = sitofp i32 %b to float
31   ; Generates an iMUL64r to legalize types.
32   %aa = zext i32 %a to i64
33   %mul = mul i64 %aa, 74383
34   ; Do some dependent long latency stuff.
35   %trunc = trunc i64 %mul to i32
36   %convm = sitofp i32 %trunc to float
37   %divm = fdiv float %convm, 0.75
38   ;%addmb = fadd float %divm, %convb
39   ;%divmb = fdiv float %addmb, 0.125
40   ; Do some independent long latency stuff.
41   %conva = sitofp i32 %a to float
42   %diva = fdiv float %conva, 0.75
43   %addab = fadd float %diva, %convb
44   %divab = fdiv float %addab, 0.125
45   br label %end
46
47 end:
48   %val = fptosi float %divab to i64
49   %add = add i64 %mul, %val
50   ret i64 %add
51 }
52
53 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
54
55 !0 = metadata !{metadata !"float", metadata !1}
56 !1 = metadata !{metadata !"omnipotent char", metadata !2}
57 !2 = metadata !{metadata !"Simple C/C++ TBAA"}