2013-12-04 11:41:33 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2013-09-04 12:12:25 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
|
2012-10-20 04:38:09 +08:00
|
|
|
|
2012-08-09 04:37:31 +08:00
|
|
|
void t1() {
|
|
|
|
// CHECK: @t1
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-09 04:37:31 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm {}
|
|
|
|
}
|
2012-08-14 04:32:07 +08:00
|
|
|
|
|
|
|
void t2() {
|
|
|
|
// CHECK: @t2
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "nop\0A\09nop\0A\09nop", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm nop
|
|
|
|
__asm nop
|
|
|
|
__asm nop
|
|
|
|
}
|
|
|
|
|
|
|
|
void t3() {
|
|
|
|
// CHECK: @t3
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "nop\0A\09nop\0A\09nop", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm nop __asm nop __asm nop
|
|
|
|
}
|
|
|
|
|
|
|
|
void t4(void) {
|
|
|
|
// CHECK: @t4
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ebx, eax\0A\09mov ecx, ebx", "~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"()
|
2012-08-14 04:32:07 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
__asm mov ebx, eax
|
|
|
|
__asm mov ecx, ebx
|
|
|
|
}
|
|
|
|
|
|
|
|
void t5(void) {
|
|
|
|
// CHECK: @t5
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ebx, eax\0A\09mov ecx, ebx", "~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"()
|
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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$0x2c", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
|
|
|
|
2012-08-22 01:01:26 +08:00
|
|
|
void t7() {
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {
|
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
2014-07-06 13:26:54 +08:00
|
|
|
__asm {
|
|
|
|
{
|
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
|
|
|
}
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {}
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t7
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$0x2c", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
2012-10-03 04:55:30 +08:00
|
|
|
|
2012-08-22 01:01:26 +08:00
|
|
|
int t8() {
|
2012-10-16 03:56:10 +08:00
|
|
|
__asm int 4 ; } comments for single-line asm
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {}
|
|
|
|
__asm int 4
|
|
|
|
return 10;
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t8
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "int $$4\0A\09int $$4", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
// CHECK: ret i32 10
|
|
|
|
}
|
2012-10-03 04:55:30 +08:00
|
|
|
|
2012-08-22 01:01:26 +08:00
|
|
|
void t9() {
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {
|
|
|
|
push ebx
|
2014-07-06 13:26:54 +08:00
|
|
|
{ mov ebx, 0x07 }
|
|
|
|
__asm { pop ebx }
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t9
|
2013-12-11 02:27:51 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
2012-08-17 01:10:59 +08:00
|
|
|
|
2012-08-22 01:01:26 +08:00
|
|
|
unsigned t10(void) {
|
2012-08-17 01:10:59 +08:00
|
|
|
unsigned i = 1, j;
|
|
|
|
__asm {
|
|
|
|
mov eax, i
|
|
|
|
mov j, eax
|
|
|
|
}
|
|
|
|
return j;
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t10
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: [[r:%[a-zA-Z0-9]+]] = alloca i32, align 4
|
2012-08-17 01:10:59 +08:00
|
|
|
// CHECK: [[I:%[a-zA-Z0-9]+]] = alloca i32, align 4
|
|
|
|
// CHECK: [[J:%[a-zA-Z0-9]+]] = alloca i32, align 4
|
|
|
|
// CHECK: store i32 1, i32* [[I]], align 4
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $2\0A\09mov dword ptr $0, eax", "=*m,={eax},*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}})
|
2015-02-28 05:19:58 +08:00
|
|
|
// CHECK: [[RET:%[a-zA-Z0-9]+]] = load i32, i32* [[J]], align 4
|
2012-08-17 01:10:59 +08:00
|
|
|
// CHECK: ret i32 [[RET]]
|
|
|
|
}
|
2012-08-17 06:25:38 +08:00
|
|
|
|
2012-08-22 01:01:26 +08:00
|
|
|
void t11(void) {
|
2012-09-11 08:51:28 +08:00
|
|
|
__asm mov eax, 1
|
2012-10-13 05:37:00 +08:00
|
|
|
// CHECK: t11
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2012-09-11 08:51:28 +08:00
|
|
|
}
|
2012-09-13 02:14:25 +08:00
|
|
|
|
2012-10-13 05:37:00 +08:00
|
|
|
unsigned t12(void) {
|
2012-09-13 08:06:55 +08:00
|
|
|
unsigned i = 1, j, l = 1, m;
|
|
|
|
__asm {
|
|
|
|
mov eax, i
|
|
|
|
mov j, eax
|
|
|
|
mov eax, l
|
|
|
|
mov m, eax
|
|
|
|
}
|
|
|
|
return j + m;
|
2012-10-13 05:37:00 +08:00
|
|
|
// CHECK: t12
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $3\0A\09mov dword ptr $0, eax\0A\09mov eax, dword ptr $4\0A\09mov dword ptr $1, eax", "=*m,=*m,={eax},*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}})
|
2012-10-20 04:57:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t13() {
|
|
|
|
char i = 1;
|
|
|
|
short j = 2;
|
|
|
|
__asm movzx eax, i
|
|
|
|
__asm movzx eax, j
|
|
|
|
// CHECK: t13
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "movzx eax, byte ptr $0\0A\09movzx eax, word ptr $1", "*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i8* %{{.*}}i, i16* %{{.*}}j)
|
2012-09-13 08:06:55 +08:00
|
|
|
}
|
2012-10-20 07:16:17 +08:00
|
|
|
|
|
|
|
void t14() {
|
|
|
|
unsigned i = 1, j = 2;
|
|
|
|
__asm {
|
|
|
|
.if 1
|
2014-07-06 13:26:54 +08:00
|
|
|
{ mov eax, i }
|
2012-10-20 07:16:17 +08:00
|
|
|
.else
|
|
|
|
mov ebx, j
|
|
|
|
.endif
|
|
|
|
}
|
|
|
|
// CHECK: t14
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect ".if 1\0A\09mov eax, dword ptr $0\0A\09.else\0A\09mov ebx, j\0A\09.endif", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2012-10-20 07:16:17 +08:00
|
|
|
}
|
2012-10-23 03:43:17 +08:00
|
|
|
|
2013-01-09 07:51:48 +08:00
|
|
|
int gvar = 10;
|
2012-10-23 03:43:17 +08:00
|
|
|
void t15() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t15
|
2013-01-09 07:51:48 +08:00
|
|
|
int lvar = 10;
|
|
|
|
__asm mov eax, lvar ; eax = 10
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $0
|
2013-01-09 07:51:48 +08:00
|
|
|
__asm mov eax, offset lvar ; eax = address of lvar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $1
|
2013-01-09 07:51:48 +08:00
|
|
|
__asm mov eax, offset gvar ; eax = address of gvar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $2
|
|
|
|
// CHECK: "*m,r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* @{{.*}})
|
2012-10-23 03:43:17 +08:00
|
|
|
}
|
2012-10-25 01:23:06 +08:00
|
|
|
|
|
|
|
void t16() {
|
|
|
|
int var = 10;
|
|
|
|
__asm mov [eax], offset var
|
|
|
|
// CHECK: t16
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov [eax], $0", "r,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2012-10-25 01:23:06 +08:00
|
|
|
}
|
2012-10-25 01:48:01 +08:00
|
|
|
|
|
|
|
void t17() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t17
|
2012-10-25 01:48:01 +08:00
|
|
|
__asm _emit 0x4A
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0x4A
|
2012-10-25 01:48:01 +08:00
|
|
|
__asm _emit 0x43
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0x43
|
2012-10-25 01:48:01 +08:00
|
|
|
__asm _emit 0x4B
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0x4B
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm _EMIT 0x4B
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0x4B
|
|
|
|
// CHECK: "~{dirflag},~{fpsr},~{flags}"()
|
2012-10-25 01:48:01 +08:00
|
|
|
}
|
2012-10-25 06:22:12 +08:00
|
|
|
|
2012-10-27 02:04:45 +08:00
|
|
|
void t20() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t20
|
2013-01-18 03:22:48 +08:00
|
|
|
char bar;
|
2012-10-27 02:04:45 +08:00
|
|
|
int foo;
|
2013-01-18 03:22:48 +08:00
|
|
|
char _bar[2];
|
|
|
|
int _foo[4];
|
|
|
|
|
|
|
|
__asm mov eax, LENGTH foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$1
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, LENGTH bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$1
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, LENGTH _foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, LENGTH _bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$2
|
2013-01-18 03:22:48 +08:00
|
|
|
|
|
|
|
__asm mov eax, TYPE foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, TYPE bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$1
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, TYPE _foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, TYPE _bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$1
|
2013-01-18 03:22:48 +08:00
|
|
|
|
|
|
|
__asm mov eax, SIZE foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, SIZE bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$1
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, SIZE _foo
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$16
|
2013-01-18 03:22:48 +08:00
|
|
|
__asm mov eax, SIZE _bar
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$2
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2012-10-27 02:04:45 +08:00
|
|
|
}
|
2012-12-06 03:52:05 +08:00
|
|
|
|
|
|
|
void t21() {
|
|
|
|
__asm {
|
|
|
|
__asm push ebx
|
|
|
|
__asm mov ebx, 0x07
|
|
|
|
__asm pop ebx
|
|
|
|
}
|
|
|
|
// CHECK: t21
|
2013-12-11 02:27:51 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
extern void t22_helper(int x);
|
|
|
|
void t22() {
|
|
|
|
int x = 0;
|
|
|
|
__asm {
|
|
|
|
__asm push ebx
|
|
|
|
__asm mov ebx, esp
|
|
|
|
}
|
|
|
|
t22_helper(x);
|
|
|
|
__asm {
|
|
|
|
__asm mov esp, ebx
|
|
|
|
__asm pop ebx
|
|
|
|
}
|
|
|
|
// CHECK: t22
|
2013-12-11 02:27:51 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, esp", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
// CHECK: call void @t22_helper
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov esp, ebx\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
}
|
2013-01-08 04:34:40 +08:00
|
|
|
|
|
|
|
void t23() {
|
|
|
|
__asm {
|
|
|
|
the_label:
|
|
|
|
}
|
|
|
|
// CHECK: t23
|
2014-09-22 10:21:54 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.0__the_label:", "~{dirflag},~{fpsr},~{flags}"()
|
2013-01-08 04:34:40 +08:00
|
|
|
}
|
2013-01-11 06:11:28 +08:00
|
|
|
|
|
|
|
void t24_helper(void) {}
|
|
|
|
void t24() {
|
|
|
|
__asm call t24_helper
|
|
|
|
// CHECK: t24
|
2014-08-02 04:23:29 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "call dword ptr $0", "*m,~{dirflag},~{fpsr},~{flags}"(void ()* @t24_helper)
|
2013-01-11 06:11:28 +08:00
|
|
|
}
|
2013-02-13 02:45:21 +08:00
|
|
|
|
|
|
|
void t25() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t25
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0ffffffffh
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4294967295
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0fh
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$15
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0a2h
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$162
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0xa2h
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$0xa2h
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0xa2
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$0xa2
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t26() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t26
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm pushad
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: pushad
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$0
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm __emit 0fh
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0fh
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm __emit 0a2h
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0a2h
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm __EMIT 0a2h
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .byte 0a2h
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm popad
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: popad
|
|
|
|
// CHECK: "~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t27() {
|
|
|
|
__asm mov eax, fs:[0h]
|
|
|
|
// CHECK: t27
|
2013-04-06 00:29:17 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, fs:[$$0h]", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
2013-02-13 05:34:14 +08:00
|
|
|
|
|
|
|
void t28() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t28
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm align 8
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .align 3
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm align 16;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .align 4
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm align 128;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .align 7
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm ALIGN 256;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: .align 8
|
|
|
|
// CHECK: "~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 05:34:14 +08:00
|
|
|
}
|
2013-02-13 09:06:08 +08:00
|
|
|
|
|
|
|
void t29() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t29
|
2013-02-13 09:06:08 +08:00
|
|
|
int arr[2] = {0, 0};
|
|
|
|
int olen = 0, osize = 0, otype = 0;
|
|
|
|
__asm mov olen, LENGTH arr
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov dword ptr $0, $$2
|
2013-02-13 09:06:08 +08:00
|
|
|
__asm mov osize, SIZE arr
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov dword ptr $1, $$8
|
2013-02-13 09:06:08 +08:00
|
|
|
__asm mov otype, TYPE arr
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov dword ptr $2, $$4
|
|
|
|
// CHECK: "=*m,=*m,=*m,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}})
|
2013-02-13 09:06:08 +08:00
|
|
|
}
|
2013-02-14 05:34:54 +08:00
|
|
|
|
|
|
|
int results[2] = {13, 37};
|
|
|
|
int *t30()
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t30
|
2013-02-14 05:34:54 +08:00
|
|
|
{
|
|
|
|
int *res;
|
|
|
|
__asm lea edi, results
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: lea edi, dword ptr $2
|
2013-02-14 05:34:54 +08:00
|
|
|
__asm mov res, edi
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov dword ptr $0, edi
|
2013-02-14 05:34:54 +08:00
|
|
|
return res;
|
2014-09-05 04:04:38 +08:00
|
|
|
// CHECK: "=*m,={eax},*m,~{edi},~{dirflag},~{fpsr},~{flags}"(i32** %{{.*}}, [2 x i32]* @{{.*}})
|
2013-02-14 05:34:54 +08:00
|
|
|
}
|
2013-02-22 17:10:20 +08:00
|
|
|
|
2013-02-26 03:13:23 +08:00
|
|
|
void t31() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t31
|
2013-02-26 03:13:23 +08:00
|
|
|
__asm pushad
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: pushad
|
2013-02-26 03:13:23 +08:00
|
|
|
__asm popad
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: popad
|
|
|
|
// CHECK: "~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-26 03:13:23 +08:00
|
|
|
}
|
|
|
|
|
2013-03-19 07:32:33 +08:00
|
|
|
void t32() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t32
|
2013-03-19 07:32:33 +08:00
|
|
|
int i;
|
|
|
|
__asm mov eax, i
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $0
|
2013-03-19 07:32:33 +08:00
|
|
|
__asm mov eax, dword ptr i
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $1
|
2013-03-19 07:32:33 +08:00
|
|
|
__asm mov ax, word ptr i
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov ax, word ptr $2
|
2013-03-19 07:32:33 +08:00
|
|
|
__asm mov al, byte ptr i
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov al, byte ptr $3
|
|
|
|
// CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}})
|
2013-03-19 07:32:33 +08:00
|
|
|
}
|
|
|
|
|
2013-03-20 05:12:57 +08:00
|
|
|
void t33() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t33
|
2013-03-20 05:12:57 +08:00
|
|
|
int i;
|
|
|
|
__asm mov eax, [i]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $0
|
2013-03-20 05:12:57 +08:00
|
|
|
__asm mov eax, dword ptr [i]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $1
|
2013-03-20 05:12:57 +08:00
|
|
|
__asm mov ax, word ptr [i]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov ax, word ptr $2
|
2013-03-20 05:12:57 +08:00
|
|
|
__asm mov al, byte ptr [i]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov al, byte ptr $3
|
|
|
|
// CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}}, i32* %{{.*}})
|
2013-03-20 05:12:57 +08:00
|
|
|
}
|
|
|
|
|
2013-03-28 05:50:39 +08:00
|
|
|
void t34() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t34
|
2013-03-28 05:50:39 +08:00
|
|
|
__asm prefetchnta 64[eax]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: prefetchnta $$64[eax]
|
2013-03-28 05:50:39 +08:00
|
|
|
__asm mov eax, dword ptr 4[eax]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr $$4[eax]
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-03-28 05:50:39 +08:00
|
|
|
}
|
2013-04-06 00:29:17 +08:00
|
|
|
|
|
|
|
void t35() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t35
|
2013-04-06 00:29:17 +08:00
|
|
|
__asm prefetchnta [eax + (200*64)]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: prefetchnta [eax + ($$200*$$64)]
|
2013-04-06 00:29:17 +08:00
|
|
|
__asm mov eax, dword ptr [eax + (200*64)]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, dword ptr [eax + ($$200*$$64)]
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-04-06 00:29:17 +08:00
|
|
|
}
|
2013-04-09 01:44:05 +08:00
|
|
|
|
|
|
|
void t36() {
|
|
|
|
// CHECK: t36
|
2014-07-25 10:27:14 +08:00
|
|
|
int arr[4];
|
|
|
|
// Work around PR20368: These should be single line blocks
|
|
|
|
__asm { mov eax, 4[arr] }
|
2013-04-13 02:22:08 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[arr + 4] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 8[arr + 4 + 32*2 - 4] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$72$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 12[4 + arr] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$16$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[4 + arr + 4] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$12$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[64 + arr + (2*32)] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$132$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[64 + arr - 2*32] }
|
2013-04-13 03:52:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [arr + 4] }
|
2013-04-13 02:54:40 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [arr + 4 + 32*2 - 4] }
|
2013-04-13 02:54:40 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$64$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [4 + arr] }
|
2013-04-13 02:22:08 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [4 + arr + 4] }
|
2013-04-13 02:22:08 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [64 + arr + (2*32)] }
|
2013-04-13 02:22:08 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$128$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [64 + arr - 2*32] }
|
2013-04-13 02:22:08 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2013-04-09 01:44:05 +08:00
|
|
|
}
|
2013-04-17 08:12:09 +08:00
|
|
|
|
|
|
|
void t37() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t37
|
2013-04-17 08:12:09 +08:00
|
|
|
__asm mov eax, 4 + 8
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$12
|
2013-04-17 08:12:09 +08:00
|
|
|
__asm mov eax, 4 + 8 * 16
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$132
|
2013-04-17 08:12:09 +08:00
|
|
|
__asm mov eax, -4 + 8 * 16
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$124
|
2013-04-17 08:12:09 +08:00
|
|
|
__asm mov eax, (4 + 4) * 16
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$128
|
2013-04-18 05:02:39 +08:00
|
|
|
__asm mov eax, 4 + 8 * -16
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4294967172
|
2013-04-18 05:02:39 +08:00
|
|
|
__asm mov eax, 4 + 16 / -8
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$2
|
2013-04-18 05:02:39 +08:00
|
|
|
__asm mov eax, (16 + 16) / -8
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4294967292
|
2014-07-05 23:04:06 +08:00
|
|
|
__asm mov eax, ~15
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$4294967280
|
2015-06-14 21:03:27 +08:00
|
|
|
__asm mov eax, 6 ^ 3
|
|
|
|
// CHECK: mov eax, $$5
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-04-17 08:12:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t38() {
|
2013-04-19 07:12:05 +08:00
|
|
|
// CHECK: t38
|
2014-07-25 10:27:14 +08:00
|
|
|
int arr[4];
|
|
|
|
// Work around PR20368: These should be single line blocks
|
|
|
|
__asm { mov eax, 4+4[arr] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, (4+4)[arr + 4] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$12$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 8*2[arr + 4 + 32*2 - 4] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$80$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 12+20[4 + arr] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$36$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*16+4[4 + arr + 4] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$76$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*4[64 + arr + (2*32)] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$144$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*(4-2)[64 + arr - 2*32] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 32*(4-2)[arr - 2*32] }
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$0$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
}
|
2014-01-28 10:09:28 +08:00
|
|
|
|
|
|
|
void cpuid() {
|
|
|
|
__asm cpuid
|
|
|
|
// CHECK-LABEL: define void @cpuid
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "cpuid", "~{eax},~{ebx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
2014-03-07 03:19:36 +08:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int a;
|
|
|
|
int b;
|
|
|
|
} A;
|
|
|
|
|
|
|
|
void t39() {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK-LABEL: define void @t39
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, [eax].A.b
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, [eax].4
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, [eax] A.b
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, [eax] .4
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, fs:[0] A.b
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, fs:[$$0] .4
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2014-03-07 03:19:36 +08:00
|
|
|
}
|
2014-03-27 08:00:03 +08:00
|
|
|
|
|
|
|
void t40(float a) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK-LABEL: define void @t40
|
2014-03-27 08:00:03 +08:00
|
|
|
int i;
|
|
|
|
__asm fld a
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: fld dword ptr $1
|
2014-03-27 08:00:03 +08:00
|
|
|
__asm fistp i
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: fistp dword ptr $0
|
|
|
|
// CHECK: "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, float* %{{.*}})
|
2014-03-27 08:00:03 +08:00
|
|
|
}
|
2014-07-18 04:25:36 +08:00
|
|
|
|
|
|
|
void t41(unsigned short a) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK-LABEL: define void @t41(i16 zeroext %a)
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov cs, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov cs, word ptr $0
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov ds, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov ds, word ptr $1
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov es, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov es, word ptr $2
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov fs, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov fs, word ptr $3
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov gs, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov gs, word ptr $4
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov ss, a;
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov ss, word ptr $5
|
2014-07-25 10:39:33 +08:00
|
|
|
// CHECK: "*m,*m,*m,*m,*m,*m,~{dirflag},~{fpsr},~{flags}"(i16* {{.*}}, i16* {{.*}}, i16* {{.*}}, i16* {{.*}}, i16* {{.*}}, i16* {{.*}})
|
2014-07-18 04:25:36 +08:00
|
|
|
}
|
2014-07-31 21:43:17 +08:00
|
|
|
|
2015-07-30 18:10:47 +08:00
|
|
|
void t42() {
|
|
|
|
// CHECK-LABEL: define void @t42
|
|
|
|
int flags;
|
|
|
|
__asm mov flags, eax
|
|
|
|
// CHECK: mov dword ptr $0, eax
|
|
|
|
// CHECK: "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %flags)
|
|
|
|
}
|
|
|
|
|
2014-07-31 21:43:17 +08:00
|
|
|
void call_clobber() {
|
|
|
|
__asm call t41
|
|
|
|
// CHECK-LABEL: define void @call_clobber
|
2014-08-02 04:23:29 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "call dword ptr $0", "*m,~{dirflag},~{fpsr},~{flags}"(void (i16)* @t41)
|
2014-07-31 21:43:17 +08:00
|
|
|
}
|
2014-09-05 00:58:47 +08:00
|
|
|
|
|
|
|
void xgetbv() {
|
|
|
|
__asm xgetbv
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: define void @xgetbv()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "xgetbv", "~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"()
|
2014-09-22 10:21:54 +08:00
|
|
|
|
|
|
|
void label1() {
|
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
jmp label
|
|
|
|
}
|
2015-12-10 09:38:04 +08:00
|
|
|
// CHECK-LABEL: define void @label1()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.1__label:\0A\09jmp {{.*}}__MSASMLABEL_.1__label", "~{dirflag},~{fpsr},~{flags}"() [[ATTR1:#[0-9]+]]
|
2014-09-22 10:21:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void label2() {
|
|
|
|
__asm {
|
|
|
|
jmp label
|
|
|
|
label:
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: define void @label2
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "jmp {{.*}}__MSASMLABEL_.2__label\0A\09{{.*}}__MSASMLABEL_.2__label:", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
|
|
|
|
|
|
|
void label3() {
|
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
mov eax, label
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: define void @label3
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.3__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.3__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
2014-09-23 04:41:39 +08:00
|
|
|
|
|
|
|
void label4() {
|
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
mov eax, [label]
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: define void @label4
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.4__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.4__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
2015-08-27 05:57:20 +08:00
|
|
|
|
|
|
|
typedef union _LARGE_INTEGER {
|
|
|
|
struct {
|
|
|
|
unsigned int LowPart;
|
|
|
|
unsigned int HighPart;
|
|
|
|
};
|
|
|
|
struct {
|
|
|
|
unsigned int LowPart;
|
|
|
|
unsigned int HighPart;
|
|
|
|
} u;
|
|
|
|
unsigned long long QuadPart;
|
|
|
|
} LARGE_INTEGER, *PLARGE_INTEGER;
|
|
|
|
|
|
|
|
int test_indirect_field(LARGE_INTEGER LargeInteger) {
|
|
|
|
__asm mov eax, LargeInteger.LowPart
|
|
|
|
}
|
|
|
|
// CHECK-LABEL: define i32 @test_indirect_field(
|
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "mov eax, dword ptr $1",
|
2015-12-10 09:38:04 +08:00
|
|
|
|
|
|
|
// MS ASM containing labels must not be duplicated (PR23715).
|
|
|
|
// CHECK: attributes [[ATTR1]] = { {{.*}}noduplicate{{.*}} }
|