2013-12-09 05:12:27 +08:00
|
|
|
// REQUIRES: x86-registered-target
|
2013-01-23 05:39:58 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
|
2015-01-17 07:05:28 +08:00
|
|
|
// Disabling gnu inline assembly should have no effect on this testcase
|
|
|
|
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks -fno-gnu-inline-asm
|
2011-09-30 09:13:51 +08:00
|
|
|
|
|
|
|
#define M __asm int 0x2c
|
|
|
|
#define M2 int
|
|
|
|
|
2013-01-23 02:18:22 +08:00
|
|
|
void t1(void) { M }
|
2016-09-03 07:16:06 +08:00
|
|
|
void t2(void) { __asm int 2ch }
|
|
|
|
void t3(void) { __asm M2 2ch }
|
|
|
|
void t4(void) { __asm mov eax, fs:[10h] }
|
2011-09-30 09:13:51 +08:00
|
|
|
void t5() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {
|
2011-09-30 09:13:51 +08:00
|
|
|
int 0x2c ; } asm comments are fun! }{
|
|
|
|
}
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {}
|
2011-09-30 09:13:51 +08:00
|
|
|
}
|
|
|
|
int t6() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm int 3 ; } comments for single-line asm
|
|
|
|
__asm {}
|
2011-09-30 09:13:51 +08:00
|
|
|
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm int 4
|
2011-09-30 09:13:51 +08:00
|
|
|
return 10;
|
|
|
|
}
|
2012-08-25 05:42:51 +08:00
|
|
|
void t7() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm {
|
2012-06-13 03:03:42 +08:00
|
|
|
push ebx
|
2016-09-03 07:16:06 +08:00
|
|
|
mov ebx, 07h
|
2012-06-13 03:03:42 +08:00
|
|
|
pop ebx
|
|
|
|
}
|
|
|
|
}
|
2012-06-13 04:30:26 +08:00
|
|
|
void t8() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm nop __asm nop __asm nop
|
2012-06-13 04:30:26 +08:00
|
|
|
}
|
|
|
|
void t9() {
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm nop __asm nop ; __asm nop
|
2012-06-13 04:30:26 +08:00
|
|
|
}
|
2014-07-06 13:26:54 +08:00
|
|
|
void t10() {
|
|
|
|
__asm {
|
|
|
|
mov eax, 0
|
|
|
|
__asm {
|
|
|
|
mov eax, 1
|
|
|
|
{
|
|
|
|
mov eax, 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-15 10:21:41 +08:00
|
|
|
void t11() {
|
|
|
|
do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
|
|
|
|
}
|
2014-09-22 10:21:54 +08:00
|
|
|
void t12() {
|
|
|
|
__asm jmp label // expected-error {{use of undeclared label 'label'}}
|
|
|
|
}
|
2016-03-08 02:10:25 +08:00
|
|
|
void t13() {
|
2016-08-03 01:58:14 +08:00
|
|
|
__asm m{o}v eax, ebx // expected-error {{unknown token in expression}}
|
2016-03-08 02:10:25 +08:00
|
|
|
}
|
|
|
|
|
2019-12-31 03:33:56 +08:00
|
|
|
void t14() {
|
|
|
|
enum { A = 1, B };
|
|
|
|
__asm mov eax, offset A // expected-error {{offset operator cannot yet handle constants}}
|
|
|
|
}
|
|
|
|
|
2012-06-13 03:03:42 +08:00
|
|
|
int t_fail() { // expected-note {{to match this}}
|
2013-01-23 02:18:22 +08:00
|
|
|
__asm
|
2016-02-23 16:53:45 +08:00
|
|
|
__asm { // expected-error 3 {{expected}} expected-note {{to match this}}
|