1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s
6 // CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
13 // CHECK: call void asm sideeffect inteldialect "nop\0A\09nop\0A\09nop", "~{dirflag},~{fpsr},~{flags}"()
22 // CHECK: call void asm sideeffect inteldialect "nop\0A\09nop\0A\09nop", "~{dirflag},~{fpsr},~{flags}"()
24 __asm nop __asm nop __asm nop
29 // CHECK: call void asm sideeffect inteldialect "mov ebx, eax\0A\09mov ecx, ebx", "~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"()
37 // CHECK: call void asm sideeffect inteldialect "mov ebx, eax\0A\09mov ecx, ebx", "~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"()
39 __asm mov ebx
, eax __asm mov ecx
, ebx
45 // CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
50 int 0x2cU
; } asm comments are fun
! }{
54 int 0x2c ; } asm comments are fun
! }{
64 // CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
65 // CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
66 // CHECK: call void asm sideeffect inteldialect "mov eax, ebx", "~{eax},~{dirflag},~{fpsr},~{flags}"()
70 __asm
int 4 ; } comments
for single
-line
asm
80 // CHECK: call i32 asm sideeffect inteldialect "int $$4", "={eax},~{dirflag},~{fpsr},~{flags}"()
81 // CHECK: call i32 asm sideeffect inteldialect "", "={eax},~{dirflag},~{fpsr},~{flags}"()
82 // CHECK: call i32 asm sideeffect inteldialect "int $$5", "={eax},~{dirflag},~{fpsr},~{flags}"()
83 // CHECK: call i32 asm sideeffect inteldialect "int $$6\0A\09int $$7", "={eax},~{dirflag},~{fpsr},~{flags}"()
84 // CHECK: call i32 asm sideeffect inteldialect "int $$8", "={eax},~{dirflag},~{fpsr},~{flags}"()
95 // CHECK: call void asm sideeffect inteldialect
96 // CHECK-SAME: push ebx
97 // CHECK-SAME: mov ebx, $$7
98 // CHECK-SAME: pop ebx
99 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
110 // CHECK: [[r:%[a-zA-Z0-9]+]] = alloca i32, align 4
111 // CHECK: [[I:%[a-zA-Z0-9]+]] = alloca i32, align 4
112 // CHECK: [[J:%[a-zA-Z0-9]+]] = alloca i32, align 4
113 // CHECK: store i32 1, ptr [[I]], align 4
114 // CHECK: call i32 asm sideeffect inteldialect
115 // CHECK-SAME: mov eax, $2
116 // CHECK-SAME: mov $0, eax
117 // CHECK-SAME: "=*m,=&{eax},*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}})
118 // CHECK: [[RET:%[a-zA-Z0-9]+]] = load i32, ptr [[J]], align 4
119 // CHECK: ret i32 [[RET]]
125 // CHECK: call void asm sideeffect inteldialect "mov eax, $$1", "~{eax},~{dirflag},~{fpsr},~{flags}"()
129 unsigned i
= 1, j
, l
= 1, m
;
138 // CHECK: call i32 asm sideeffect inteldialect
139 // CHECK-SAME: mov eax, $3
140 // CHECK-SAME: mov $0, eax
141 // CHECK-SAME: mov eax, $4
142 // CHECK-SAME: mov $1, eax
143 // CHECK-SAME: "=*m,=*m,=&{eax},*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}})
151 // CHECK-LABEL: define{{.*}} void @t13()
152 // CHECK: call void asm sideeffect inteldialect
153 // CHECK-SAME: movzx eax, byte ptr $0
154 // CHECK-SAME: movzx eax, word ptr $1
155 // CHECK-SAME: "*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i8) %{{.*}}i, ptr elementtype(i16) %{{.*}}j)
158 void t13_brac(void) {
163 // CHECK-LABEL: define{{.*}} void @t13_brac()
164 // CHECK: call void asm sideeffect inteldialect
165 // CHECK-SAME: movzx eax, byte ptr $0
166 // CHECK-SAME: movzx eax, word ptr $1
167 // CHECK-SAME: "*m,*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i8) %{{.*}}i, ptr elementtype(i16) %{{.*}}j)
171 unsigned i
= 1, j
= 2;
180 // 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}"(ptr elementtype(i32) %{{.*}})
187 __asm mov eax
, lvar
; eax
= 10
188 // CHECK: mov eax, $0
189 __asm mov eax
, offset lvar
; eax
= address of lvar
190 // CHECK: mov eax, $1
191 __asm mov eax
, offset gvar
; eax
= address of gvar
192 // CHECK: mov eax, $2
193 __asm mov eax
, offset gvar
+1 ; eax
= 1 + address of gvar
194 // CHECK: mov eax, $3 + $$1
195 __asm mov eax
, 1+offset gvar
; eax
= 1 + address of gvar
196 // CHECK: mov eax, $4 + $$1
197 __asm mov eax
, 1+offset gvar
+1 ; eax
= 2 + address of gvar
198 // CHECK: mov eax, $5 + $$2
199 // CHECK: "*m,r,i,i,i,i,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr %{{.*}}, ptr @{{.*}}, ptr @{{.*}}, ptr @{{.*}}, ptr @{{.*}})
204 __asm mov dword ptr
[eax
], offset var
206 // CHECK: call void asm sideeffect inteldialect "mov dword ptr [eax], $0", "r,~{dirflag},~{fpsr},~{flags}"(ptr %{{.*}})
214 // CHECK: .byte 0x43L
219 // CHECK: "~{dirflag},~{fpsr},~{flags}"()
229 __asm mov eax
, LENGTH foo
230 // CHECK: mov eax, $$1
231 __asm mov eax
, LENGTH bar
232 // CHECK: mov eax, $$1
233 __asm mov eax
, LENGTH _foo
234 // CHECK: mov eax, $$4
235 __asm mov eax
, LENGTH _bar
236 // CHECK: mov eax, $$2
237 __asm mov eax
, [eax
+ LENGTH foo
* 4]
238 // CHECK: mov eax, [eax + $$4]
240 __asm mov eax
, TYPE foo
241 // CHECK: mov eax, $$4
242 __asm mov eax
, TYPE bar
243 // CHECK: mov eax, $$1
244 __asm mov eax
, TYPE _foo
245 // CHECK: mov eax, $$4
246 __asm mov eax
, TYPE _bar
247 // CHECK: mov eax, $$1
248 __asm mov eax
, [eax
+ TYPE foo
* 4]
249 // CHECK: mov eax, [eax + $$16]
251 __asm mov eax
, SIZE foo
252 // CHECK: mov eax, $$4
253 __asm mov eax
, SIZE bar
254 // CHECK: mov eax, $$1
255 __asm mov eax
, SIZE _foo
256 // CHECK: mov eax, $$16
257 __asm mov eax
, [eax
+ SIZE _foo
* 4]
258 // CHECK: mov eax, [eax + $$64]
259 __asm mov eax
, SIZE _bar
260 // CHECK: mov eax, $$2
261 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
272 // CHECK: call void asm sideeffect inteldialect
273 // CHECK-SAME: push ebx
274 // CHECK-SAME: mov ebx, $$7
275 // CHECK-SAME: pop ebx
276 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
279 extern void t22_helper(int x
);
292 // CHECK: call void asm sideeffect inteldialect
293 // CHECK-SAME: push ebx
294 // CHECK-SAME: mov ebx, esp
295 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
296 // CHECK: call void @t22_helper
297 // CHECK: call void asm sideeffect inteldialect
298 // CHECK-SAME: mov esp, ebx
299 // CHECK-SAME: pop ebx
300 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
308 // CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__the_label:", "~{dirflag},~{fpsr},~{flags}"()
311 void t24_helper(void) {}
313 __asm call t24_helper
315 // CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void ()) @t24_helper)
320 __asm mov eax
, 0ffffffffh
321 // CHECK: mov eax, $$4294967295
323 // CHECK: mov eax, $$15
325 // CHECK: mov eax, $$162
326 __asm mov eax
, 10100010b
327 // CHECK: mov eax, $$162
328 __asm mov eax
, 10100010BU
329 // CHECK: mov eax, $$162
330 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
338 // CHECK: mov eax, $$0
347 // CHECK: "~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"()
351 __asm mov eax
, fs
:[0h
]
353 // CHECK: call void asm sideeffect inteldialect "mov eax, fs:[$$0]", "~{eax},~{dirflag},~{fpsr},~{flags}"()
366 // CHECK: "~{dirflag},~{fpsr},~{flags}"()
372 int olen
= 0, osize
= 0, otype
= 0;
373 __asm mov olen
, LENGTH arr
374 // CHECK: mov dword ptr $0, $$2
375 __asm mov osize
, SIZE arr
376 // CHECK: mov dword ptr $1, $$8
377 __asm mov otype
, TYPE arr
378 // CHECK: mov dword ptr $2, $$4
379 // CHECK: "=*m,=*m,=*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}})
382 int results
[2] = {13, 37};
387 __asm lea edi
, results
388 // CHECK: lea edi, $2
390 // CHECK: mov $0, edi
392 // CHECK: "=*m,={eax},*m,~{edi},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(ptr) %{{.*}}, ptr elementtype([2 x i32]) @{{.*}})
401 // CHECK: "~{eax},~{ebp},~{ebx},~{ecx},~{edi},~{edx},~{esi},~{esp},~{dirflag},~{fpsr},~{flags}"()
408 // CHECK: mov eax, $0
409 __asm mov eax
, dword ptr i
410 // CHECK: mov eax, dword ptr $1
411 __asm mov ax
, word ptr i
412 // CHECK: mov ax, word ptr $2
413 __asm mov al
, byte ptr i
414 // CHECK: mov al, byte ptr $3
415 // CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}})
422 // CHECK: mov eax, $0
423 __asm mov eax
, dword ptr
[i
]
424 // CHECK: mov eax, dword ptr $1
425 __asm mov ax
, word ptr
[i
]
426 // CHECK: mov ax, word ptr $2
427 __asm mov al
, byte ptr
[i
]
428 // CHECK: mov al, byte ptr $3
429 // CHECK: "*m,*m,*m,*m,~{al},~{ax},~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}}, ptr elementtype(i32) %{{.*}})
434 __asm prefetchnta
64[eax
]
435 // CHECK: prefetchnta [eax + $$64]
436 __asm mov eax
, dword ptr
4[eax
]
437 // CHECK: mov eax, dword ptr [eax + $$4]
438 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
443 __asm prefetchnta
[eax
+ (200*64)]
444 // CHECK: prefetchnta [eax + $$12800]
445 __asm mov eax
, dword ptr
[eax
+ (200*64)]
446 // CHECK: mov eax, dword ptr [eax + $$12800]
447 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
453 // Work around PR20368: These should be single line blocks
454 __asm
{ mov eax
, 4[arr
] }
455 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
456 __asm
{ mov eax
, 4[arr
+ 4] }
457 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
458 __asm
{ mov eax
, 8[arr
+ 4 + 32*2 - 4] }
459 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$72]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
460 __asm
{ mov eax
, 12[4 + arr
] }
461 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$16]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
462 __asm
{ mov eax
, 4[4 + arr
+ 4] }
463 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
464 __asm
{ mov eax
, 4[64 + arr
+ (2*32)] }
465 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$132]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
466 __asm
{ mov eax
, 4[64 + arr
- 2*32] }
467 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
468 __asm
{ mov eax
, [arr
+ 4] }
469 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
470 __asm
{ mov eax
, [arr
+ 4 + 32*2 - 4] }
471 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$64]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
472 __asm
{ mov eax
, [4 + arr
] }
473 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
474 __asm
{ mov eax
, [4 + arr
+ 4] }
475 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
476 __asm
{ mov eax
, [64 + arr
+ (2*32)] }
477 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$128]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
478 __asm
{ mov eax
, [64 + arr
- 2*32] }
479 // CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
485 // CHECK: mov eax, $$12
486 __asm mov eax
, 4 + 8 * 16
487 // CHECK: mov eax, $$132
488 __asm mov eax
, -4 + 8 * 16
489 // CHECK: mov eax, $$124
490 __asm mov eax
, (4 + 4) * 16
491 // CHECK: mov eax, $$128
492 __asm mov eax
, 4 + 8 * -16
493 // CHECK: mov eax, $$-124
494 __asm mov eax
, 4 + 16 / -8
495 // CHECK: mov eax, $$2
496 __asm mov eax
, (16 + 16) / -8
497 // CHECK: mov eax, $$-4
499 // CHECK: mov eax, $$-16
501 // CHECK: mov eax, $$5
502 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
508 // Work around PR20368: These should be single line blocks
509 __asm
{ mov eax
, 4+4[arr
] }
510 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
511 __asm
{ mov eax
, (4+4)[arr
+ 4] }
512 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
513 __asm
{ mov eax
, 8*2[arr
+ 4 + 32*2 - 4] }
514 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$80]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
515 __asm
{ mov eax
, 12+20[4 + arr
] }
516 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$36]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
517 __asm
{ mov eax
, 4*16+4[4 + arr
+ 4] }
518 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$76]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
519 __asm
{ mov eax
, 4*4[64 + arr
+ (2*32)] }
520 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$144]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
521 __asm
{ mov eax
, 4*(4-2)[64 + arr
- 2*32] }
522 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
523 __asm
{ mov eax
, 32*(4-2)[arr
- 2*32] }
524 // CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype([4 x i32]) %{{.*}})
529 // CHECK-LABEL: define{{.*}} void @cpuid
530 // CHECK: call void asm sideeffect inteldialect "cpuid", "~{eax},~{ebx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"()
551 // CHECK-LABEL: define{{.*}} void @t39
552 __asm mov eax
, [eax
].A
.b
553 // CHECK: mov eax, [eax + $$4]
554 __asm mov eax
, [eax
] A
.b
555 // CHECK: mov eax, [eax + $$4]
556 __asm mov eax
, [eax
] pA
.b
557 // CHECK: mov eax, [eax + $$4]
558 __asm mov eax
, fs
:[0] A
.b
559 // CHECK: mov eax, fs:[$$4]
560 __asm mov eax
, [eax
].B
.b2
.a
561 // CHECK: mov eax, [eax + $$4]
562 __asm mov eax
, [eax
] B
.b2
.b
563 // CHECK: mov eax, [eax + $$8]
564 __asm mov eax
, fs
:[0] C
.c2
.b
565 // CHECK: mov eax, fs:[$$8]
566 __asm mov eax
, [eax
]C
.c4
.b2
.b
567 // CHECK: mov eax, [eax + $$24]
568 __asm mov eax
, [eax
]pC
.c4
.b2
.b
569 // CHECK: mov eax, [eax + $$24]
570 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
574 // CHECK-LABEL: define{{.*}} void @t40
577 // CHECK: fld dword ptr $1
579 // CHECK: fistp dword ptr $0
580 // CHECK: "=*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}}, ptr elementtype(float) %{{.*}})
583 void t41(unsigned short a
) {
584 // CHECK-LABEL: define{{.*}} void @t41(i16 noundef zeroext %a)
597 // CHECK: "*m,*m,*m,*m,*m,*m,~{dirflag},~{fpsr},~{flags}"(ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, ptr {{.*}}, ptr {{.*}})
601 // CHECK-LABEL: define{{.*}} void @t42(
604 // CHECK: mov $0, eax
605 // CHECK: "=*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %flags)
609 // CHECK-LABEL: define{{.*}} void @t42b(
612 // CHECK: mov $0, eax
613 // CHECK: "=*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %mxcsr)
617 // CHECK-LABEL: define{{.*}} void @t43
619 // Work around PR20368: These should be single line blocks
620 __asm
{ mov eax
, 4[strct
.c1
] }
621 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
622 __asm
{ mov eax
, 4[strct
.c3
+ 4] }
623 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
624 __asm
{ mov eax
, 8[strct
.c2
.a
+ 4 + 32*2 - 4] }
625 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$72]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
626 __asm
{ mov eax
, 12[4 + strct
.c2
.b
] }
627 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$16]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
628 __asm
{ mov eax
, 4[4 + strct
.c4
.b2
.b
+ 4] }
629 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$12]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
630 __asm
{ mov eax
, 4[64 + strct
.c1
+ (2*32)] }
631 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$132]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
632 __asm
{ mov eax
, 4[64 + strct
.c2
.a
- 2*32] }
633 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
634 __asm
{ mov eax
, [strct
.c4
.b1
+ 4] }
635 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
636 __asm
{ mov eax
, [strct
.c4
.b2
.a
+ 4 + 32*2 - 4] }
637 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$64]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
638 __asm
{ mov eax
, [4 + strct
.c1
] }
639 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$4]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
640 __asm
{ mov eax
, [4 + strct
.c2
.b
+ 4] }
641 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$8]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
642 __asm
{ mov eax
, [64 + strct
.c3
+ (2*32)] }
643 // CHECK: call void asm sideeffect inteldialect "mov eax, $0[$$128]", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
644 __asm
{ mov eax
, [64 + strct
.c4
.b2
.b
- 2*32] }
645 // CHECK: call void asm sideeffect inteldialect "mov eax, $0", "*m,~{eax},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) %{{.*}})
649 // CHECK-LABEL: define{{.*}} void @t44
656 // 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}"()
660 // CHECK-LABEL: define{{.*}} void @t45
669 // 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}"()
673 // CHECK-LABEL: define{{.*}} void @t46
674 __asm add eax
, -128[eax
]
675 // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", "~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"()
678 void dot_operator(void){
679 // CHECK-LABEL: define{{.*}} void @dot_operator
680 __asm
{ mov eax
, 3[ebx
]A
.b
}
681 // CHECK: call void asm sideeffect inteldialect "mov eax, [ebx + $$7]", "~{eax},~{dirflag},~{fpsr},~{flags}"
684 void call_clobber(void) {
686 // CHECK-LABEL: define{{.*}} void @call_clobber
687 // CHECK: call void asm sideeffect inteldialect "call dword ptr ${0:P}", "*m,~{dirflag},~{fpsr},~{flags}"(ptr elementtype(void (i16)) @t41)
693 // CHECK-LABEL: define{{.*}} void @xgetbv()
694 // CHECK: call void asm sideeffect inteldialect "xgetbv", "~{eax},~{edx},~{dirflag},~{fpsr},~{flags}"()
701 // CHECK-LABEL: define{{.*}} void @label1()
702 // CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09jmp {{.*}}__MSASMLABEL_.${:uid}__label", "~{dirflag},~{fpsr},~{flags}"() [[ATTR1:#[0-9]+]]
710 // CHECK-LABEL: define{{.*}} void @label2
711 // CHECK: call void asm sideeffect inteldialect "jmp {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:", "~{dirflag},~{fpsr},~{flags}"()
719 // CHECK-LABEL: define{{.*}} void @label3
720 // CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
728 // CHECK-LABEL: define{{.*}} void @label4
729 // CHECK: call void asm sideeffect inteldialect "{{.*}}__MSASMLABEL_.${:uid}__label:\0A\09mov eax, {{.*}}__MSASMLABEL_.${:uid}__label", "~{eax},~{dirflag},~{fpsr},~{flags}"()
737 // CHECK-LABEL: define{{.*}} void @label5
738 // CHECK: call void asm sideeffect inteldialect "jmp {{.*}}__MSASMLABEL_.${:uid}__dollar_label$$\0A\09{{.*}}__MSASMLABEL_.${:uid}__dollar_label$$:", "~{dirflag},~{fpsr},~{flags}"()
748 // CHECK-LABEL: define{{.*}} void @label6
749 // CHECK: jmp {{.*}}__MSASMLABEL_.${:uid}__label\0A\09jc {{.*}}__MSASMLABEL_.${:uid}__label\0A\09jz {{.*}}__MSASMLABEL_.${:uid}__label\0A\09{{.*}}__MSASMLABEL_.${:uid}__label:"
752 // Don't include mxcsr in the clobber list.
757 // CHECK-LABEL: define{{.*}} void @mxcsr
758 // CHECK: call void asm sideeffect inteldialect "fxrstor $0", "=*m,~{fpcr},~{dirflag},~{fpsr},~{flags}"
760 // Make sure we can find the register for the dirflag for popfd
764 // CHECK-LABEL: define{{.*}} void @dirflag
765 // CHECK: call void asm sideeffect inteldialect "popfd", "~{dirflag},~{flags},~{esp},~{dirflag},~{fpsr},~{flags}"
767 typedef union _LARGE_INTEGER
{
769 unsigned int LowPart
;
770 unsigned int HighPart
;
773 unsigned int LowPart
;
774 unsigned int HighPart
;
776 unsigned long long QuadPart
;
777 } LARGE_INTEGER
, *PLARGE_INTEGER
;
779 int test_indirect_field(LARGE_INTEGER LargeInteger
) {
780 __asm mov eax
, LargeInteger
.LowPart
782 // CHECK-LABEL: define{{.*}} i32 @test_indirect_field(
783 // CHECK: call i32 asm sideeffect inteldialect "mov eax, $1",
785 // MS ASM containing labels must not be duplicated (PR23715).
786 // CHECK: attributes [[ATTR1]] = {
787 // CHECK-NOT: noduplicate
788 // CHECK-SAME: }{{$}}