1; RUN: llc < %s -mtriple=i386-apple-darwin9 -O0 -optimize-regalloc -regalloc=basic -no-integrated-as | FileCheck %s
2; rdar://6992609
3
4; CHECK: movl %ecx, 4([[ESP:%e..]])
5; CHECK: movl 4([[ESP]]), [[EDX:%e..]]
6; CHECK: movl [[EDX]], 4([[ESP]])
7target triple = "i386-apple-darwin9.0"
8@llvm.used = appending global [1 x i8*] [i8* bitcast (i64 (i64)* @_OSSwapInt64 to i8*)], section "llvm.metadata"		; <[1 x i8*]*> [#uses=0]
9
10define i64 @_OSSwapInt64(i64 %_data) nounwind {
11entry:
12	%retval = alloca i64		; <i64*> [#uses=2]
13	%_data.addr = alloca i64		; <i64*> [#uses=4]
14	store i64 %_data, i64* %_data.addr
15	%tmp = load i64, i64* %_data.addr		; <i64> [#uses=1]
16	%0 = call i64 asm "bswap   %eax\0A\09bswap   %edx\0A\09xchgl   %eax, %edx", "=A,0,~{dirflag},~{fpsr},~{flags}"(i64 %tmp) nounwind		; <i64> [#uses=1]
17	store i64 %0, i64* %_data.addr
18	%tmp1 = load i64, i64* %_data.addr		; <i64> [#uses=1]
19	store i64 %tmp1, i64* %retval
20	%1 = load i64, i64* %retval		; <i64> [#uses=1]
21	ret i64 %1
22}
23
24; The tied operands are not necessarily in the same order as the defs.
25; PR13742
26define i64 @swapped(i64 %x, i64 %y) nounwind {
27entry:
28	%x0 = call { i64, i64 } asm "foo", "=r,=r,1,0,~{dirflag},~{fpsr},~{flags}"(i64 %x, i64 %y) nounwind
29        %x1 = extractvalue { i64, i64 } %x0, 0
30        ret i64 %x1
31}
32