2013-12-04 11:41:33 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2022-04-07 18:03:55 +08:00
|
|
|
// RUN: %clang_cc1 -no-opaque-pointers %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
|
2012-10-20 04:38:09 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t1(void) {
|
2012-08-09 04:37:31 +08:00
|
|
|
// 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
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t2(void) {
|
2012-08-14 04:32:07 +08:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t3(void) {
|
2012-08-14 04:32:07 +08:00
|
|
|
// 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
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t7(void) {
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {
|
2016-09-03 07:16:06 +08:00
|
|
|
int 0x2cU ; } asm comments are fun! }{
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
2014-07-06 13:26:54 +08:00
|
|
|
__asm {
|
|
|
|
{
|
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
|
|
|
}
|
2012-08-15 07:48:41 +08:00
|
|
|
__asm {}
|
2017-02-05 18:23:06 +08:00
|
|
|
__asm {
|
|
|
|
;
|
|
|
|
; label
|
|
|
|
mov eax, ebx
|
|
|
|
}
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t7
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
|
2013-03-28 05:54:09 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
|
2017-02-05 18:23:06 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, ebx", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
}
|
2012-10-03 04:55:30 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
int t8(void) {
|
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 {}
|
2016-02-23 16:53:45 +08:00
|
|
|
__asm { int 5}
|
|
|
|
__asm int 6
|
|
|
|
__asm int 7
|
|
|
|
__asm {
|
|
|
|
int 8
|
|
|
|
}
|
2012-08-15 07:48:41 +08:00
|
|
|
return 10;
|
2012-08-22 01:01:26 +08:00
|
|
|
// CHECK: t8
|
2016-02-23 16:53:45 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "int $$4", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "int $$5", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "int $$6\0A\09int $$7", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "int $$8", "={eax},~{dirflag},~{fpsr},~{flags}"()
|
2012-08-15 07:48:41 +08:00
|
|
|
// CHECK: ret i32 10
|
|
|
|
}
|
2012-10-03 04:55:30 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t9(void) {
|
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
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: push ebx
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK-SAME: mov ebx, $$7
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK-SAME: pop ebx
|
|
|
|
// CHECK-SAME: "~{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
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: mov eax, $2
|
|
|
|
// CHECK-SAME: mov $0, eax
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK-SAME: "=*m,=&{eax},*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* elementtype(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
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: mov eax, $3
|
|
|
|
// CHECK-SAME: mov $0, eax
|
|
|
|
// CHECK-SAME: mov eax, $4
|
|
|
|
// CHECK-SAME: mov $1, eax
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK-SAME: "=*m,=*m,=&{eax},*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}})
|
2012-10-20 04:57:37 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t13(void) {
|
2012-10-20 04:57:37 +08:00
|
|
|
char i = 1;
|
|
|
|
short j = 2;
|
|
|
|
__asm movzx eax, i
|
|
|
|
__asm movzx eax, j
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t13()
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: movzx eax, byte ptr $0
|
|
|
|
// CHECK-SAME: movzx eax, word ptr $1
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK-SAME: "*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %{{.*}}i, i16* elementtype(i16) %{{.*}}j)
|
2017-05-05 02:19:52 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t13_brac(void) {
|
2017-05-05 02:19:52 +08:00
|
|
|
char i = 1;
|
|
|
|
short j = 2;
|
|
|
|
__asm movzx eax, [i]
|
|
|
|
__asm movzx eax, [j]
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t13_brac()
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: movzx eax, byte ptr $0
|
|
|
|
// CHECK-SAME: movzx eax, word ptr $1
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK-SAME: "*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %{{.*}}i, i16* elementtype(i16) %{{.*}}j)
|
2012-09-13 08:06:55 +08:00
|
|
|
}
|
2012-10-20 07:16:17 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t14(void) {
|
2012-10-20 07:16:17 +08:00
|
|
|
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
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect ".if 1\0A\09mov eax, $0\0A\09.else\0A\09mov ebx, j\0A\09.endif", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(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;
|
2022-02-16 05:06:01 +08:00
|
|
|
void t15(void) {
|
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
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: mov eax, $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
|
2019-12-31 03:33:56 +08:00
|
|
|
__asm mov eax, offset gvar+1 ; eax = 1 + address of gvar
|
|
|
|
// CHECK: mov eax, $3 + $$1
|
|
|
|
__asm mov eax, 1+offset gvar ; eax = 1 + address of gvar
|
|
|
|
// CHECK: mov eax, $4 + $$1
|
|
|
|
__asm mov eax, 1+offset gvar+1 ; eax = 2 + address of gvar
|
|
|
|
// CHECK: mov eax, $5 + $$2
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "*m,r,i,i,i,i,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* %{{.*}}, i32* @{{.*}}, i32* @{{.*}}, i32* @{{.*}}, i32* @{{.*}})
|
2012-10-23 03:43:17 +08:00
|
|
|
}
|
2012-10-25 01:23:06 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t16(void) {
|
2012-10-25 01:23:06 +08:00
|
|
|
int var = 10;
|
2019-12-31 03:33:56 +08:00
|
|
|
__asm mov dword ptr [eax], offset var
|
2012-10-25 01:23:06 +08:00
|
|
|
// CHECK: t16
|
2019-12-31 03:33:56 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dword ptr [eax], $0", "r,~{dirflag},~{fpsr},~{flags}"(i32* %{{.*}})
|
2012-10-25 01:23:06 +08:00
|
|
|
}
|
2012-10-25 01:48:01 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t17(void) {
|
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
|
2016-09-03 07:16:06 +08:00
|
|
|
__asm _emit 0x43L
|
|
|
|
// CHECK: .byte 0x43L
|
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
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t20(void) {
|
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
|
2017-03-22 03:33:32 +08:00
|
|
|
__asm mov eax, [eax + LENGTH foo * 4]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$4]
|
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
|
2017-03-22 03:33:32 +08:00
|
|
|
__asm mov eax, [eax + TYPE foo * 4]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$16]
|
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
|
2017-03-22 03:33:32 +08:00
|
|
|
__asm mov eax, [eax + SIZE _foo * 4]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$64]
|
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}"()
|
2017-03-22 03:33:32 +08:00
|
|
|
|
2012-10-27 02:04:45 +08:00
|
|
|
}
|
2012-12-06 03:52:05 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t21(void) {
|
2012-12-06 03:52:05 +08:00
|
|
|
__asm {
|
|
|
|
__asm push ebx
|
2016-09-03 07:16:06 +08:00
|
|
|
__asm mov ebx, 07H
|
2012-12-06 03:52:05 +08:00
|
|
|
__asm pop ebx
|
|
|
|
}
|
|
|
|
// CHECK: t21
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: push ebx
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK-SAME: mov ebx, $$7
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK-SAME: pop ebx
|
|
|
|
// CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
extern void t22_helper(int x);
|
2022-02-16 05:06:01 +08:00
|
|
|
void t22(void) {
|
2012-12-06 03:52:05 +08:00
|
|
|
int x = 0;
|
|
|
|
__asm {
|
|
|
|
__asm push ebx
|
|
|
|
__asm mov ebx, esp
|
|
|
|
}
|
|
|
|
t22_helper(x);
|
|
|
|
__asm {
|
|
|
|
__asm mov esp, ebx
|
|
|
|
__asm pop ebx
|
|
|
|
}
|
|
|
|
// CHECK: t22
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: push ebx
|
|
|
|
// CHECK-SAME: mov ebx, esp
|
|
|
|
// CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
// CHECK: call void @t22_helper
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect
|
|
|
|
// CHECK-SAME: mov esp, ebx
|
|
|
|
// CHECK-SAME: pop ebx
|
|
|
|
// CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
|
2012-12-06 03:52:05 +08:00
|
|
|
}
|
2013-01-08 04:34:40 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t23(void) {
|
2013-01-08 04:34:40 +08:00
|
|
|
__asm {
|
|
|
|
the_label:
|
|
|
|
}
|
|
|
|
// CHECK: t23
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__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) {}
|
2022-02-16 05:06:01 +08:00
|
|
|
void t24(void) {
|
2013-01-11 06:11:28 +08:00
|
|
|
__asm call t24_helper
|
|
|
|
// CHECK: t24
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(void ()* elementtype(void ()) @t24_helper)
|
2013-01-11 06:11:28 +08:00
|
|
|
}
|
2013-02-13 02:45:21 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t25(void) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t25
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0ffffffffh
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, $$4294967295
|
2016-09-03 07:16:06 +08:00
|
|
|
__asm mov eax, 0fhU
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$15
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, 0a2h
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, $$162
|
2016-09-03 07:16:06 +08:00
|
|
|
__asm mov eax, 10100010b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, $$162
|
2016-09-03 07:16:06 +08:00
|
|
|
__asm mov eax, 10100010BU
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: mov eax, $$162
|
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t26(void) {
|
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
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t27(void) {
|
2013-02-13 02:45:21 +08:00
|
|
|
__asm mov eax, fs:[0h]
|
|
|
|
// CHECK: t27
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, fs:[$$0]", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-02-13 02:45:21 +08:00
|
|
|
}
|
2013-02-13 05:34:14 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t28(void) {
|
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
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t29(void) {
|
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
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "=*m,=*m,=*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}})
|
2013-02-13 09:06:08 +08:00
|
|
|
}
|
2013-02-14 05:34:54 +08:00
|
|
|
|
|
|
|
int results[2] = {13, 37};
|
2022-02-16 05:06:01 +08:00
|
|
|
int *t30(void)
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t30
|
2013-02-14 05:34:54 +08:00
|
|
|
{
|
|
|
|
int *res;
|
|
|
|
__asm lea edi, results
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: lea edi, $2
|
2013-02-14 05:34:54 +08:00
|
|
|
__asm mov res, edi
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: mov $0, edi
|
2013-02-14 05:34:54 +08:00
|
|
|
return res;
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "=*m,={eax},*m,~{edi},~{dirflag},~{fpsr},~{flags}"(i32** elementtype(i32*) %{{.*}}, [2 x i32]* elementtype([2 x i32]) @{{.*}})
|
2013-02-14 05:34:54 +08:00
|
|
|
}
|
2013-02-22 17:10:20 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t31(void) {
|
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
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t32(void) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t32
|
2013-03-19 07:32:33 +08:00
|
|
|
int i;
|
|
|
|
__asm mov eax, i
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: mov eax, $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
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}})
|
2013-03-19 07:32:33 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t33(void) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t33
|
2013-03-20 05:12:57 +08:00
|
|
|
int i;
|
|
|
|
__asm mov eax, [i]
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: mov eax, $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
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}}, i32* elementtype(i32) %{{.*}})
|
2013-03-20 05:12:57 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t34(void) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t34
|
2013-03-28 05:50:39 +08:00
|
|
|
__asm prefetchnta 64[eax]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: prefetchnta [eax + $$64]
|
2013-03-28 05:50:39 +08:00
|
|
|
__asm mov eax, dword ptr 4[eax]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, dword ptr [eax + $$4]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-03-28 05:50:39 +08:00
|
|
|
}
|
2013-04-06 00:29:17 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t35(void) {
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: t35
|
2013-04-06 00:29:17 +08:00
|
|
|
__asm prefetchnta [eax + (200*64)]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: prefetchnta [eax + $$12800]
|
2013-04-06 00:29:17 +08:00
|
|
|
__asm mov eax, dword ptr [eax + (200*64)]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, dword ptr [eax + $$12800]
|
2014-07-25 10:27:14 +08:00
|
|
|
// CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2013-04-06 00:29:17 +08:00
|
|
|
}
|
2013-04-09 01:44:05 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t36(void) {
|
2013-04-09 01:44:05 +08:00
|
|
|
// 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] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 8[arr + 4 + 32*2 - 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$72]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 12[4 + arr] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$16]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[4 + arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[64 + arr + (2*32)] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$132]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4[64 + arr - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [arr + 4 + 32*2 - 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$64]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [4 + arr] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [4 + arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [64 + arr + (2*32)] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$128]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, [64 + arr - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2013-04-09 01:44:05 +08:00
|
|
|
}
|
2013-04-17 08:12:09 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t37(void) {
|
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
|
2017-08-10 05:50:22 +08:00
|
|
|
// CHECK: mov eax, $$-124
|
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
|
2017-08-10 05:50:22 +08:00
|
|
|
// CHECK: mov eax, $$-4
|
2014-07-05 23:04:06 +08:00
|
|
|
__asm mov eax, ~15
|
2017-08-10 05:50:22 +08:00
|
|
|
// CHECK: mov eax, $$-16
|
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
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t38(void) {
|
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] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, (4+4)[arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 8*2[arr + 4 + 32*2 - 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$80]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 12+20[4 + arr] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$36]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*16+4[4 + arr + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$76]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*4[64 + arr + (2*32)] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$144]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 4*(4-2)[64 + arr - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2014-07-25 10:27:14 +08:00
|
|
|
__asm { mov eax, 32*(4-2)[arr - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"([4 x i32]* elementtype([4 x i32]) %{{.*}})
|
2013-04-17 08:12:09 +08:00
|
|
|
}
|
2014-01-28 10:09:28 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void cpuid(void) {
|
2014-01-28 10:09:28 +08:00
|
|
|
__asm cpuid
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @cpuid
|
2014-01-28 10:09:28 +08:00
|
|
|
// 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;
|
2017-08-09 21:31:41 +08:00
|
|
|
} A, *pA;
|
2014-03-07 03:19:36 +08:00
|
|
|
|
2015-12-17 20:51:51 +08:00
|
|
|
typedef struct {
|
|
|
|
int b1;
|
|
|
|
A b2;
|
|
|
|
} B;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int c1;
|
|
|
|
A c2;
|
|
|
|
int c3;
|
|
|
|
B c4;
|
2017-08-09 21:31:41 +08:00
|
|
|
} C, *pC;
|
2015-12-17 20:51:51 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t39(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t39
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, [eax].A.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$4]
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, [eax] A.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$4]
|
2017-08-09 21:31:41 +08:00
|
|
|
__asm mov eax, [eax] pA.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$4]
|
2014-03-07 03:19:36 +08:00
|
|
|
__asm mov eax, fs:[0] A.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, fs:[$$4]
|
2015-12-17 20:51:51 +08:00
|
|
|
__asm mov eax, [eax].B.b2.a
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$4]
|
2015-12-17 20:51:51 +08:00
|
|
|
__asm mov eax, [eax] B.b2.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$8]
|
2015-12-17 20:51:51 +08:00
|
|
|
__asm mov eax, fs:[0] C.c2.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, fs:[$$8]
|
2015-12-17 20:51:51 +08:00
|
|
|
__asm mov eax, [eax]C.c4.b2.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$24]
|
2017-08-09 21:31:41 +08:00
|
|
|
__asm mov eax, [eax]pC.c4.b2.b
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: mov eax, [eax + $$24]
|
2014-07-25 10:27:14 +08:00
|
|
|
// 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) {
|
2020-12-31 12:45:56 +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
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}}, float* elementtype(float) %{{.*}})
|
2014-03-27 08:00:03 +08:00
|
|
|
}
|
2014-07-18 04:25:36 +08:00
|
|
|
|
|
|
|
void t41(unsigned short a) {
|
2022-01-16 17:53:11 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t41(i16 noundef zeroext %a)
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov cs, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov cs, $0
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov ds, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov ds, $1
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov es, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov es, $2
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov fs, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov fs, $3
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov gs, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov gs, $4
|
2014-07-18 04:25:36 +08:00
|
|
|
__asm mov ss, a;
|
2017-11-22 03:28:13 +08:00
|
|
|
// CHECK: mov ss, $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
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t42(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t42(
|
2015-07-30 18:10:47 +08:00
|
|
|
int flags;
|
|
|
|
__asm mov flags, eax
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: mov $0, eax
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "=*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %flags)
|
2015-07-30 18:10:47 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t42b(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t42b(
|
2019-11-14 07:20:34 +08:00
|
|
|
int mxcsr;
|
|
|
|
__asm mov mxcsr, eax
|
|
|
|
// CHECK: mov $0, eax
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: "=*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %mxcsr)
|
2019-11-14 07:20:34 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t43(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t43
|
2015-12-24 20:11:40 +08:00
|
|
|
C strct;
|
|
|
|
// Work around PR20368: These should be single line blocks
|
|
|
|
__asm { mov eax, 4[strct.c1] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 4[strct.c3 + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 8[strct.c2.a + 4 + 32*2 - 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$72]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 12[4 + strct.c2.b] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$16]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 4[4 + strct.c4.b2.b + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 4[64 + strct.c1 + (2*32)] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$132]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, 4[64 + strct.c2.a - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [strct.c4.b1 + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [strct.c4.b2.a + 4 + 32*2 - 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$64]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [4 + strct.c1] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [4 + strct.c2.b + 4] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [64 + strct.c3 + (2*32)] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$128]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
__asm { mov eax, [64 + strct.c4.b2.b - 2*32] }
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %{{.*}})
|
2015-12-24 20:11:40 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t44(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t44
|
2017-07-30 18:19:10 +08:00
|
|
|
__asm {
|
|
|
|
mov cr0, eax
|
|
|
|
mov cr2, ebx
|
|
|
|
mov cr3, ecx
|
|
|
|
mov cr4, edx
|
|
|
|
}
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov cr0, eax\0A\09mov cr2, ebx\0A\09mov cr3, ecx\0A\09mov cr4, edx", "~{cr0},~{cr2},~{cr3},~{cr4},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t45(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t45
|
2017-08-01 18:51:09 +08:00
|
|
|
__asm {
|
|
|
|
mov dr0, eax
|
|
|
|
mov dr1, ebx
|
|
|
|
mov dr2, ebx
|
|
|
|
mov dr3, ecx
|
|
|
|
mov dr6, edx
|
|
|
|
mov dr7, ecx
|
|
|
|
}
|
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov dr0, eax\0A\09mov dr1, ebx\0A\09mov dr2, ebx\0A\09mov dr3, ecx\0A\09mov dr6, edx\0A\09mov dr7, ecx", "~{dr0},~{dr1},~{dr2},~{dr3},~{dr6},~{dr7},~{dirflag},~{fpsr},~{flags}"()
|
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void t46(void) {
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @t46
|
2017-08-10 05:50:22 +08:00
|
|
|
__asm add eax, -128[eax]
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", "~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"()
|
2017-08-10 05:50:22 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void dot_operator(void){
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @dot_operator
|
2017-06-27 00:09:55 +08:00
|
|
|
__asm { mov eax, 3[ebx]A.b}
|
2017-08-24 16:47:26 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "mov eax, [ebx + $$7]", "~{eax},~{dirflag},~{fpsr},~{flags}"
|
2017-06-27 00:09:55 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void call_clobber(void) {
|
2014-07-31 21:43:17 +08:00
|
|
|
__asm call t41
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @call_clobber
|
2022-01-05 22:16:24 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(void (i16)* elementtype(void (i16)) @t41)
|
2014-07-31 21:43:17 +08:00
|
|
|
}
|
2014-09-05 00:58:47 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void xgetbv(void) {
|
2014-09-05 00:58:47 +08:00
|
|
|
__asm xgetbv
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @xgetbv()
|
2014-09-05 00:58:47 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "xgetbv", "~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"()
|
2014-09-22 10:21:54 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label1(void) {
|
2014-09-22 10:21:54 +08:00
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
jmp label
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label1()
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09jmp {{.*}}__MSASMLABEL_.${:uid}__label", "~{dirflag},~{fpsr},~{flags}"() [[ATTR1:#[0-9]+]]
|
2014-09-22 10:21:54 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label2(void) {
|
2014-09-22 10:21:54 +08:00
|
|
|
__asm {
|
|
|
|
jmp label
|
|
|
|
label:
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label2
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "jmp {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:", "~{dirflag},~{fpsr},~{flags}"()
|
2014-09-22 10:21:54 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label3(void) {
|
2014-09-22 10:21:54 +08:00
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
mov eax, label
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label3
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2014-09-22 10:21:54 +08:00
|
|
|
}
|
2014-09-23 04:41:39 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label4(void) {
|
2014-09-23 04:41:39 +08:00
|
|
|
__asm {
|
|
|
|
label:
|
|
|
|
mov eax, [label]
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label4
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
|
2014-09-23 04:41:39 +08:00
|
|
|
}
|
2015-08-27 05:57:20 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label5(void) {
|
2015-12-29 16:49:34 +08:00
|
|
|
__asm {
|
|
|
|
jmp dollar_label$
|
|
|
|
dollar_label$:
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label5
|
2016-11-29 08:39:37 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "jmp {{.*}}__MSASMLABEL_.${:uid}__dollar_label$$\0A\09{{.*}}__MSASMLABEL_.${:uid}__dollar_label$$:", "~{dirflag},~{fpsr},~{flags}"()
|
2015-12-29 16:49:34 +08:00
|
|
|
}
|
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
void label6(void){
|
2016-10-14 16:13:27 +08:00
|
|
|
__asm {
|
|
|
|
jmp short label
|
2017-07-30 19:13:46 +08:00
|
|
|
jc short label
|
|
|
|
jz short label
|
2016-10-14 16:13:27 +08:00
|
|
|
label:
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @label6
|
2017-07-30 19:13:46 +08:00
|
|
|
// CHECK: jmp {{.*}}__MSASMLABEL_.${:uid}__label\0A\09jc {{.*}}__MSASMLABEL_.${:uid}__label\0A\09jz {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:"
|
2016-10-14 16:13:27 +08:00
|
|
|
}
|
|
|
|
|
2017-02-15 05:38:17 +08:00
|
|
|
// Don't include mxcsr in the clobber list.
|
2022-02-16 05:06:01 +08:00
|
|
|
void mxcsr(void) {
|
2017-02-15 05:38:17 +08:00
|
|
|
char buf[4096];
|
|
|
|
__asm fxrstor buf
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @mxcsr
|
[X86] add mayRaiseFPException flag and FPCW registers for X87 instructions
Summary:
This patch adds flag "mayRaiseFPException" , FPCW and FPSW for X87 instructions which could raise
float exception.
Reviewers: pengfei, RKSimon, andrew.w.kaylor, uweigand, kpn, spatel, cameron.mcinally, craig.topper
Reviewed By: craig.topper
Subscribers: thakis, hiraditya, llvm-commits
Patch by LiuChen.
Differential Revision: https://reviews.llvm.org/D68854
2019-11-01 14:17:07 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "fxrstor $0", "=*m,~{fpcr},~{dirflag},~{fpsr},~{flags}"
|
2017-02-15 05:38:17 +08:00
|
|
|
|
2018-04-11 02:43:44 +08:00
|
|
|
// Make sure we can find the register for the dirflag for popfd
|
2022-02-16 05:06:01 +08:00
|
|
|
void dirflag(void) {
|
2018-04-11 02:43:44 +08:00
|
|
|
__asm popfd
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @dirflag
|
2018-04-11 02:43:44 +08:00
|
|
|
// CHECK: call void asm sideeffect inteldialect "popfd", "~{dirflag},~{flags},~{esp},~{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
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32 @test_indirect_field(
|
2017-05-05 02:19:52 +08:00
|
|
|
// CHECK: call i32 asm sideeffect inteldialect "mov eax, $1",
|
2015-12-10 09:38:04 +08:00
|
|
|
|
|
|
|
// MS ASM containing labels must not be duplicated (PR23715).
|
2016-11-29 04:52:19 +08:00
|
|
|
// CHECK: attributes [[ATTR1]] = {
|
|
|
|
// CHECK-NOT: noduplicate
|
|
|
|
// CHECK-SAME: }{{$}}
|