Fix PR3149. If an early clobber def is a physical register and it is tied to an input...
[oota-llvm.git] / test / CodeGen / X86 / 2008-12-19-EarlyClobberBug.ll
1 ; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | %prcontext End 1 | grep {movl.*%ecx}
2 ; PR3149
3
4 @"\01LC" = internal constant [7 x i8] c"n0=%d\0A\00"            ; <[7 x i8]*> [#uses=1]
5 @llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i64, i64)* @umoddi3 to i8*) ], section "llvm.metadata"              ; <[1 x i8*]*> [#uses=0]
6
7 define i32 @umoddi3(i64 %u, i64 %v) nounwind noinline {
8 entry:
9         %0 = trunc i64 %v to i32                ; <i32> [#uses=2]
10         %1 = trunc i64 %u to i32                ; <i32> [#uses=4]
11         %2 = lshr i64 %u, 32            ; <i64> [#uses=1]
12         %3 = trunc i64 %2 to i32                ; <i32> [#uses=2]
13         %4 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([7 x i8]* @"\01LC", i32 0, i32 0), i32 %1) nounwind           ; <i32> [#uses=0]
14         %5 = icmp ult i32 %1, %0                ; <i1> [#uses=1]
15         br i1 %5, label %bb2, label %bb
16
17 bb:             ; preds = %entry
18         %6 = lshr i64 %v, 32            ; <i64> [#uses=1]
19         %7 = trunc i64 %6 to i32                ; <i32> [#uses=1]
20         %asmtmp = tail call { i32, i32 } asm "subl $5,$1\0A\09sbbl $3,$0", "=r,=&r,0,imr,1,imr,~{dirflag},~{fpsr},~{flags}"(i32 %3, i32 %7, i32 %1, i32 %0) nounwind            ; <{ i32, i32 }> [#uses=2]
21         %asmresult = extractvalue { i32, i32 } %asmtmp, 0               ; <i32> [#uses=1]
22         %asmresult1 = extractvalue { i32, i32 } %asmtmp, 1              ; <i32> [#uses=1]
23         br label %bb2
24
25 bb2:            ; preds = %bb, %entry
26         %n1.0 = phi i32 [ %asmresult, %bb ], [ %3, %entry ]             ; <i32> [#uses=1]
27         %n0.0 = phi i32 [ %asmresult1, %bb ], [ %1, %entry ]            ; <i32> [#uses=1]
28         %8 = add i32 %n0.0, %n1.0               ; <i32> [#uses=1]
29         ret i32 %8
30 }
31
32 declare i32 @printf(i8*, ...) nounwind