2012-09-27 22:55:08 +08:00
|
|
|
// REQUIRES: x86-64-registered-target
|
2013-01-23 03:38:32 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -O0 -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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "nop", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "nop", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "nop", "~{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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ebx, eax", "~{ebx},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ecx, 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! }{
|
|
|
|
}
|
|
|
|
__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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$4", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$4", "~{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
|
|
|
|
mov ebx, 0x07
|
|
|
|
pop ebx
|
|
|
|
}
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t9
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{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
|
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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $1\0A\09mov dword ptr $0, eax", "=*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}}, i32* %{{.*}})
|
2012-08-17 01:10:59 +08:00
|
|
|
// CHECK: [[RET:%[a-zA-Z0-9]+]] = load i32* [[J]], align 4
|
|
|
|
// 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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $2\0A\09mov dword ptr $0, eax\0A\09mov eax, dword ptr $3\0A\09mov dword ptr $1, eax", "=*m,=*m,*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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "movzx eax, byte ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i8* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "movzx eax, word ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i16* %{{.*}})
|
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
|
|
|
|
mov eax, i
|
|
|
|
.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() {
|
2013-01-09 07:51:48 +08:00
|
|
|
int lvar = 10;
|
|
|
|
__asm mov eax, lvar ; eax = 10
|
|
|
|
__asm mov eax, offset lvar ; eax = address of lvar
|
|
|
|
__asm mov eax, offset gvar ; eax = address of gvar
|
2012-10-23 03:43:17 +08:00
|
|
|
// CHECK: t15
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "r,~{eax},~{dirflag},~{fpsr},~{flags}"(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() {
|
|
|
|
__asm _emit 0x4A
|
|
|
|
__asm _emit 0x43
|
|
|
|
__asm _emit 0x4B
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm _EMIT 0x4B
|
2012-10-25 01:48:01 +08:00
|
|
|
// CHECK: t17
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0x4A", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0x43", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0x4B", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0x4B", "~{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() {
|
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
|
|
|
|
__asm mov eax, LENGTH bar
|
|
|
|
__asm mov eax, LENGTH _foo
|
|
|
|
__asm mov eax, LENGTH _bar
|
2012-10-27 02:04:45 +08:00
|
|
|
// CHECK: t20
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$2", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-01-18 03:22:48 +08:00
|
|
|
|
|
|
|
__asm mov eax, TYPE foo
|
|
|
|
__asm mov eax, TYPE bar
|
|
|
|
__asm mov eax, TYPE _foo
|
|
|
|
__asm mov eax, TYPE _bar
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-01-18 03:22:48 +08:00
|
|
|
|
|
|
|
__asm mov eax, SIZE foo
|
|
|
|
__asm mov eax, SIZE bar
|
|
|
|
__asm mov eax, SIZE _foo
|
|
|
|
__asm mov eax, SIZE _bar
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$16", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$2", "~{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-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{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-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, esp", "~{ebx},~{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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "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
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "call $0", "r,~{dirflag},~{fpsr},~{flags}"(void ()* @t24_helper)
|
2013-01-11 06:11:28 +08:00
|
|
|
}
|
2013-02-13 02:45:21 +08:00
|
|
|
|
|
|
|
void t25() {
|
|
|
|
__asm mov eax, 0ffffffffh
|
|
|
|
__asm mov eax, 0fh
|
|
|
|
__asm mov eax, 0a2h
|
|
|
|
__asm mov eax, 0xa2h
|
|
|
|
__asm mov eax, 0xa2
|
|
|
|
// CHECK: t25
|
2013-04-17 08:12:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$4294967295", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$15", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$162", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$0xa2h", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$0xa2", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void t26() {
|
|
|
|
__asm pushad
|
|
|
|
__asm mov eax, 0
|
|
|
|
__asm __emit 0fh
|
|
|
|
__asm __emit 0a2h
|
2013-02-13 05:34:14 +08:00
|
|
|
__asm __EMIT 0a2h
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm popad
|
|
|
|
// CHECK: t26
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "pushad", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$0", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0fh", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0a2h", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".byte 0a2h", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "popad", "~{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() {
|
|
|
|
__asm align 8
|
|
|
|
__asm align 16;
|
|
|
|
__asm align 128;
|
|
|
|
__asm ALIGN 256;
|
|
|
|
// CHECK: t28
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect ".align 3", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".align 4", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".align 7", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect ".align 8", "~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 05:34:14 +08:00
|
|
|
}
|
2013-02-13 09:06:08 +08:00
|
|
|
|
|
|
|
void t29() {
|
|
|
|
int arr[2] = {0, 0};
|
|
|
|
int olen = 0, osize = 0, otype = 0;
|
|
|
|
__asm mov olen, LENGTH arr
|
|
|
|
__asm mov osize, SIZE arr
|
|
|
|
__asm mov otype, TYPE arr
|
|
|
|
// CHECK: t29
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, $$2", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, $$8", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, $$4", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2013-02-13 09:06:08 +08:00
|
|
|
}
|
2013-02-14 05:34:54 +08:00
|
|
|
|
|
|
|
int results[2] = {13, 37};
|
|
|
|
int *t30()
|
|
|
|
{
|
|
|
|
int *res;
|
|
|
|
__asm lea edi, results
|
|
|
|
__asm mov res, edi
|
|
|
|
return res;
|
|
|
|
// CHECK: t30
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "lea edi, dword ptr $0", "*m,~{edi},~{dirflag},~{fpsr},~{flags}"([2 x i32]* @{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dword ptr $0, edi", "=*m,~{dirflag},~{fpsr},~{flags}"(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() {
|
|
|
|
__asm pushad
|
|
|
|
__asm popad
|
|
|
|
// CHECK: t31
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "pushad", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "popad", "~{dirflag},~{fpsr},~{flags}"()
|
2013-02-26 03:13:23 +08:00
|
|
|
}
|
|
|
|
|
2013-03-19 07:32:33 +08:00
|
|
|
void t32() {
|
|
|
|
int i;
|
|
|
|
__asm mov eax, i
|
|
|
|
__asm mov eax, dword ptr i
|
|
|
|
__asm mov ax, word ptr i
|
|
|
|
__asm mov al, byte ptr i
|
|
|
|
// CHECK: t32
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ax, word ptr $0", "*m,~{ax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov al, byte ptr $0", "*m,~{al},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2013-03-19 07:32:33 +08:00
|
|
|
}
|
|
|
|
|
2013-03-20 05:12:57 +08:00
|
|
|
void t33() {
|
|
|
|
int i;
|
|
|
|
__asm mov eax, [i]
|
|
|
|
__asm mov eax, dword ptr [i]
|
|
|
|
__asm mov ax, word ptr [i]
|
|
|
|
__asm mov al, byte ptr [i]
|
|
|
|
// CHECK: t33
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov ax, word ptr $0", "*m,~{ax},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov al, byte ptr $0", "*m,~{al},~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2013-03-20 05:12:57 +08:00
|
|
|
}
|
|
|
|
|
2013-03-28 05:50:39 +08:00
|
|
|
void t34() {
|
|
|
|
__asm prefetchnta 64[eax]
|
|
|
|
__asm mov eax, dword ptr 4[eax]
|
|
|
|
// CHECK: t34
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "prefetchnta $$64[eax]", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4[eax]", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
2013-04-06 00:29:17 +08:00
|
|
|
|
|
|
|
void t35() {
|
|
|
|
__asm prefetchnta [eax + (200*64)]
|
|
|
|
__asm mov eax, dword ptr [eax + (200*64)]
|
|
|
|
// CHECK: t35
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "prefetchnta [eax + ($$200*$$64)]", "~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr [eax + ($$200*$$64)]", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
2013-04-09 01:44:05 +08:00
|
|
|
|
|
|
|
void t36() {
|
|
|
|
int arr[4];
|
|
|
|
__asm mov eax, 4[arr]
|
2013-04-13 03:52:07 +08:00
|
|
|
__asm mov eax, 4[arr + 4]
|
|
|
|
__asm mov eax, 8[arr + 4 + 32*2 - 4]
|
|
|
|
__asm mov eax, 12[4 + arr]
|
|
|
|
__asm mov eax, 4[4 + arr + 4]
|
|
|
|
__asm mov eax, 4[64 + arr + (2*32)]
|
|
|
|
__asm mov eax, 4[64 + arr - 2*32]
|
2013-04-11 00:33:34 +08:00
|
|
|
__asm mov eax, [arr + 4]
|
2013-04-13 02:54:40 +08:00
|
|
|
__asm mov eax, [arr + 4 + 32*2 - 4]
|
2013-04-11 00:33:34 +08:00
|
|
|
__asm mov eax, [4 + arr]
|
|
|
|
__asm mov eax, [4 + arr + 4]
|
2013-04-13 02:22:08 +08:00
|
|
|
__asm mov eax, [64 + arr + (2*32)]
|
|
|
|
__asm mov eax, [64 + arr - 2*32]
|
2013-04-09 01:44:05 +08:00
|
|
|
// CHECK: t36
|
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]* %{{.*}})
|
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]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$72$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$16$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$12$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$132$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$4$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
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]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$64$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
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]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$128$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// 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() {
|
|
|
|
__asm mov eax, 4 + 8
|
|
|
|
__asm mov eax, 4 + 8 * 16
|
|
|
|
__asm mov eax, -4 + 8 * 16
|
|
|
|
__asm mov eax, (4 + 4) * 16
|
|
|
|
// CHECK: t37
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$12", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$132", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$124", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $$128", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
|
|
|
|
|
|
|
void t38() {
|
|
|
|
int arr[4];
|
|
|
|
__asm mov eax, 4+4[arr]
|
|
|
|
__asm mov eax, (4+4)[arr + 4]
|
|
|
|
__asm mov eax, 8*2[arr + 4 + 32*2 - 4]
|
|
|
|
__asm mov eax, 12+20[4 + arr]
|
|
|
|
__asm mov eax, 4*16+4[4 + arr + 4]
|
|
|
|
__asm mov eax, 4*4[64 + arr + (2*32)]
|
|
|
|
__asm mov eax, 4*(4-2)[64 + arr - 2*32]
|
|
|
|
__asm mov eax, 32*(4-2)[arr - 2*32]
|
|
|
|
// CHECH: t38
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$12$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$80$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$36$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$76$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$144$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$8$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, dword ptr $$0$0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* %{{.*}})
|
|
|
|
}
|