blob: a6cabc4fd33187d7ec02a0837b950b807303e8ec [file] [log] [blame]
Chris Lattner8bae1052010-01-20 07:24:05 +00001; RUN: llc < %s -mtriple=i386-apple-darwin -asm-verbose=0 | FileCheck %s
Evan Chenga9823a22008-12-19 20:58:01 +00002; PR3149
Evan Cheng2682ea02009-03-23 08:01:15 +00003; Make sure the copy after inline asm is not coalesced away.
Evan Chenga9823a22008-12-19 20:58:01 +00004
Chris Lattner9e2f6412009-08-30 21:45:23 +00005; CHECK: ## InlineAsm End
6; CHECK-NEXT: BB1_2:
7; CHECK-NEXT: movl %esi, %eax
8
9
Evan Chenga9823a22008-12-19 20:58:01 +000010@"\01LC" = internal constant [7 x i8] c"n0=%d\0A\00" ; <[7 x i8]*> [#uses=1]
11@llvm.used = appending global [1 x i8*] [ i8* bitcast (i32 (i64, i64)* @umoddi3 to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
12
13define i32 @umoddi3(i64 %u, i64 %v) nounwind noinline {
14entry:
15 %0 = trunc i64 %v to i32 ; <i32> [#uses=2]
16 %1 = trunc i64 %u to i32 ; <i32> [#uses=4]
17 %2 = lshr i64 %u, 32 ; <i64> [#uses=1]
18 %3 = trunc i64 %2 to i32 ; <i32> [#uses=2]
19 %4 = tail call i32 (i8*, ...)* @printf(i8* getelementptr ([7 x i8]* @"\01LC", i32 0, i32 0), i32 %1) nounwind ; <i32> [#uses=0]
20 %5 = icmp ult i32 %1, %0 ; <i1> [#uses=1]
21 br i1 %5, label %bb2, label %bb
22
23bb: ; preds = %entry
24 %6 = lshr i64 %v, 32 ; <i64> [#uses=1]
25 %7 = trunc i64 %6 to i32 ; <i32> [#uses=1]
26 %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]
27 %asmresult = extractvalue { i32, i32 } %asmtmp, 0 ; <i32> [#uses=1]
28 %asmresult1 = extractvalue { i32, i32 } %asmtmp, 1 ; <i32> [#uses=1]
29 br label %bb2
30
31bb2: ; preds = %bb, %entry
32 %n1.0 = phi i32 [ %asmresult, %bb ], [ %3, %entry ] ; <i32> [#uses=1]
33 %n0.0 = phi i32 [ %asmresult1, %bb ], [ %1, %entry ] ; <i32> [#uses=1]
34 %8 = add i32 %n0.0, %n1.0 ; <i32> [#uses=1]
35 ret i32 %8
36}
37
38declare i32 @printf(i8*, ...) nounwind