2012-08-09 05:15:52 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -O0 -fms-extensions -fenable-experimental-ms-inline-asm -w -emit-llvm -o - | FileCheck %s
|
2012-08-09 04:37:31 +08:00
|
|
|
|
|
|
|
void t1() {
|
|
|
|
// CHECK: @t1
|
2012-08-10 08:00:34 +08:00
|
|
|
// CHECK: call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-09 04:37:31 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm {}
|
|
|
|
}
|
2012-08-14 04:32:07 +08:00
|
|
|
|
|
|
|
void t2() {
|
|
|
|
// CHECK: @t2
|
2012-08-15 03:22:06 +08:00
|
|
|
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm nop
|
|
|
|
__asm nop
|
|
|
|
__asm nop
|
|
|
|
}
|
|
|
|
|
|
|
|
void t3() {
|
|
|
|
// CHECK: @t3
|
2012-08-16 05:03:27 +08:00
|
|
|
// CHECK: call void asm sideeffect "nop\0Anop\0Anop", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm nop __asm nop __asm nop
|
|
|
|
}
|
|
|
|
|
|
|
|
void t4(void) {
|
|
|
|
// CHECK: @t4
|
2012-08-16 02:12:36 +08:00
|
|
|
// CHECK: call void asm sideeffect "mov ebx, eax", "~{ebx},~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "mov ecx, ebx", "~{ecx},~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm mov ebx, eax
|
|
|
|
__asm mov ecx, ebx
|
|
|
|
}
|
|
|
|
|
|
|
|
void t5(void) {
|
|
|
|
// CHECK: @t5
|
2012-08-16 05:03:27 +08:00
|
|
|
// CHECK: call void asm sideeffect "mov ebx, eax\0Amov ecx, ebx", "~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm mov ebx, eax __asm mov ecx, ebx
|
|
|
|
}
|
2012-08-15 07:48:41 +08:00
|
|
|
|
|
|
|
void t6(void) {
|
|
|
|
__asm int 0x2c
|
|
|
|
// CHECK: t6
|
|
|
|
// CHECK: call void asm sideeffect "int 0x2c", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
}
|
|
|
|
|
|
|
|
void* t7(void) {
|
|
|
|
__asm mov eax, fs:[0x10]
|
|
|
|
// CHECK: t7
|
|
|
|
// CHECK: call void asm sideeffect "mov eax, fs:[0x10]", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
}
|
|
|
|
|
|
|
|
void t8() {
|
|
|
|
__asm {
|
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
|
|
|
__asm {}
|
|
|
|
// CHECK: t8
|
|
|
|
// CHECK: call void asm sideeffect "int 0x2c", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
}
|
|
|
|
int t9() {
|
|
|
|
__asm int 3 ; } comments for single-line asm
|
|
|
|
__asm {}
|
|
|
|
__asm int 4
|
|
|
|
return 10;
|
|
|
|
// CHECK: t9
|
|
|
|
// CHECK: call void asm sideeffect "int 3", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: call void asm sideeffect "int 4", "~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
|
|
|
// CHECK: ret i32 10
|
|
|
|
}
|
|
|
|
void t10() {
|
|
|
|
__asm {
|
|
|
|
push ebx
|
|
|
|
mov ebx, 0x07
|
|
|
|
pop ebx
|
|
|
|
}
|
|
|
|
// CHECK: t10
|
2012-08-16 05:55:19 +08:00
|
|
|
// CHECK: call void asm sideeffect "push ebx\0Amov ebx, 0x07\0Apop ebx", "~{ebx},~{dirflag},~{fpsr},~{flags}"() nounwind ia_nsdialect
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|