xref: /llvm-project/clang/test/CodeGen/inline-asm-output-variant.c (revision 4a9da96dc68d878893399210888a03117b39b802)
1 // REQUIRES: x86-registered-target
2 /// AT&T input
3 // RUN: %clang_cc1 -triple x86_64 -S --output-asm-variant=0 %s -o - | FileCheck --check-prefix=ATT %s
4 // RUN: %clang_cc1 -triple x86_64 -S --output-asm-variant=1 %s -o - | FileCheck --check-prefix=INTEL %s
5 
6 /// Intel input
7 // RUN: %clang_cc1 -triple x86_64 -S -D INTEL -mllvm -x86-asm-syntax=intel -inline-asm=intel %s -o - | FileCheck --check-prefix=INTEL %s
8 // RUN: %clang_cc1 -triple x86_64 -S -D INTEL -mllvm -x86-asm-syntax=intel -inline-asm=intel --output-asm-variant=1 %s -o - | FileCheck --check-prefix=INTEL %s
9 
10 // ATT: movl $1, %eax
11 // ATT: movl $2, %eax
12 
13 // INTEL: mov eax, 1
14 // INTEL: mov eax, 2
15 
16 #ifdef INTEL
17 asm("mov eax, 1");
18 void foo() {
19   asm("mov eax, 2");
20 }
21 #else
22 asm("mov $1, %eax");
23 void foo() {
24   asm("mov $2, %eax");
25 }
26 #endif
27