2013-02-18 02:26:11 +08:00
|
|
|
; RUN: llc < %s -march=x86 -mcpu=core2 | FileCheck %s
|
2012-09-11 05:10:49 +08:00
|
|
|
|
|
|
|
define i32 @t1() nounwind {
|
|
|
|
entry:
|
2012-09-12 00:33:10 +08:00
|
|
|
%0 = tail call i32 asm sideeffect inteldialect "mov eax, $1\0A\09mov $0, eax", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 1) nounwind
|
2012-09-11 05:10:49 +08:00
|
|
|
ret i32 %0
|
2012-09-11 05:31:43 +08:00
|
|
|
; CHECK: t1
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2012-09-11 06:04:54 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
2012-09-11 05:36:05 +08:00
|
|
|
; CHECK: .intel_syntax
|
2012-09-11 05:10:49 +08:00
|
|
|
; CHECK: mov eax, ecx
|
|
|
|
; CHECK: mov ecx, eax
|
2012-09-11 05:36:05 +08:00
|
|
|
; CHECK: .att_syntax
|
2012-09-11 06:04:54 +08:00
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
2012-09-11 05:10:49 +08:00
|
|
|
}
|
2012-09-12 03:09:56 +08:00
|
|
|
|
|
|
|
define void @t2() nounwind {
|
|
|
|
entry:
|
|
|
|
call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
|
|
|
|
ret void
|
|
|
|
; CHECK: t2
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2012-09-12 03:09:56 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
|
|
|
; CHECK: mov eax, 1
|
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
|
|
|
}
|
2012-10-04 06:06:44 +08:00
|
|
|
|
|
|
|
define void @t3(i32 %V) nounwind {
|
|
|
|
entry:
|
|
|
|
%V.addr = alloca i32, align 4
|
|
|
|
store i32 %V, i32* %V.addr, align 4
|
|
|
|
call void asm sideeffect inteldialect "mov eax, DWORD PTR [$0]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %V.addr) nounwind
|
|
|
|
ret void
|
|
|
|
; CHECK: t3
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2012-10-04 06:06:44 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
|
|
|
; CHECK: mov eax, DWORD PTR {{[[esp]}}
|
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
|
|
|
}
|
2012-10-25 07:10:28 +08:00
|
|
|
|
|
|
|
%struct.t18_type = type { i32, i32 }
|
|
|
|
|
|
|
|
define i32 @t18() nounwind {
|
|
|
|
entry:
|
|
|
|
%foo = alloca %struct.t18_type, align 4
|
|
|
|
%a = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 0
|
|
|
|
store i32 1, i32* %a, align 4
|
|
|
|
%b = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
|
|
|
|
store i32 2, i32* %b, align 4
|
|
|
|
call void asm sideeffect inteldialect "lea ebx, foo\0A\09mov eax, [ebx].0\0A\09mov [ebx].4, ecx", "~{eax},~{dirflag},~{fpsr},~{flags}"() nounwind
|
|
|
|
%b1 = getelementptr inbounds %struct.t18_type* %foo, i32 0, i32 1
|
|
|
|
%0 = load i32* %b1, align 4
|
|
|
|
ret i32 %0
|
|
|
|
; CHECK: t18
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2012-10-25 07:10:28 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
|
|
|
; CHECK: lea ebx, foo
|
|
|
|
; CHECK: mov eax, [ebx].0
|
|
|
|
; CHECK: mov [ebx].4, ecx
|
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
|
|
|
}
|
2013-01-11 06:10:27 +08:00
|
|
|
|
|
|
|
define void @t19_helper() nounwind {
|
|
|
|
entry:
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
define void @t19() nounwind {
|
|
|
|
entry:
|
|
|
|
call void asm sideeffect inteldialect "call $0", "r,~{dirflag},~{fpsr},~{flags}"(void ()* @t19_helper) nounwind
|
|
|
|
ret void
|
2013-01-11 07:02:48 +08:00
|
|
|
; CHECK: t19:
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2013-01-11 07:02:48 +08:00
|
|
|
; CHECK: movl ${{_?}}t19_helper, %eax
|
2013-01-11 06:10:27 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
|
|
|
; CHECK: call eax
|
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
|
|
|
}
|
2013-02-14 05:33:44 +08:00
|
|
|
|
|
|
|
@results = global [2 x i32] [i32 3, i32 2], align 4
|
|
|
|
|
|
|
|
define i32* @t30() nounwind ssp {
|
|
|
|
entry:
|
|
|
|
%res = alloca i32*, align 4
|
|
|
|
call void asm sideeffect inteldialect "lea edi, dword ptr $0", "*m,~{edi},~{dirflag},~{fpsr},~{flags}"([2 x i32]* @results) nounwind
|
|
|
|
call void asm sideeffect inteldialect "mov dword ptr $0, edi", "=*m,~{dirflag},~{fpsr},~{flags}"(i32** %res) nounwind
|
|
|
|
%0 = load i32** %res, align 4
|
|
|
|
ret i32* %0
|
|
|
|
; CHECK: t30:
|
2013-02-16 09:25:28 +08:00
|
|
|
; CHECK: movl %esp, %ebp
|
2013-02-14 05:33:44 +08:00
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
2013-02-14 05:41:58 +08:00
|
|
|
; CHECK: lea edi, dword ptr [{{_?}}results]
|
2013-02-14 05:33:44 +08:00
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
|
|
|
; CHECK: {{## InlineAsm Start|#APP}}
|
|
|
|
; CHECK: .intel_syntax
|
2013-02-20 07:50:45 +08:00
|
|
|
; CHECK: mov dword ptr [esi], edi
|
2013-02-14 05:33:44 +08:00
|
|
|
; CHECK: .att_syntax
|
|
|
|
; CHECK: {{## InlineAsm End|#NO_APP}}
|
2013-02-20 07:50:45 +08:00
|
|
|
; CHECK: movl (%esi), %eax
|
2013-02-14 05:33:44 +08:00
|
|
|
}
|