1// RUN: llvm-mc -triple x86_64-linux-gnu %s | FileCheck %s
2.macro ifcc arg:vararg
3.if cc
4            \arg
5.endif
6.endm
7
8.macro ifcc2 arg0 arg1:vararg
9.if cc
10            movl \arg0, \arg1
11.endif
12.endm
13
14.macro ifcc3 arg0, arg1:vararg
15.if cc
16            movl \arg0, \arg1
17.endif
18.endm
19
20.macro ifcc4 arg0, arg1:vararg
21.if cc
22            movl \arg1, \arg0
23.endif
24.endm
25
26.text
27
28// CHECK: movl %esp, %ebp
29// CHECK: subl $0, %esp
30// CHECK: movl %eax, %ebx
31// CHECK: movl %ecx, %ebx
32// CHECK: movl %ecx, %eax
33// CHECK: movl %eax, %ecx
34// CHECK: movl %ecx, %eax
35// CHECK: movl %eax, %ecx
36.set cc,1
37  ifcc  movl    %esp, %ebp
38        subl $0, %esp
39
40  ifcc2 %eax %ebx
41  ifcc2 %ecx, %ebx
42  ifcc3 %ecx %eax
43  ifcc3 %eax, %ecx
44  ifcc4 %eax %ecx  ## test
45  ifcc4 %ecx, %eax ## test
46
47// CHECK-NOT: movl
48// CHECK: subl $1, %esp
49.set cc,0
50  ifcc  movl    %esp, %ebp
51        subl $1, %esp
52