1# RUN: llvm-mc -triple i386-linux-gnu  %s| FileCheck %s
2
3# This test checks the altmacro string delimiter '<' and '>'.
4
5.altmacro
6
7# Test #1:
8# You can delimit strings with matching angle brackets '<' '>'.
9# If an argument begins with '<' and ends with '>'.
10# The argument is considered as a string.
11
12# CHECK: simpleCheck:
13.macro simple_check_0 name
14    \name:
15   addl $5,%eax
16.endm
17
18simple_check_0 <simpleCheck>
19
20# Test #2:
21# Except adding new string marks '<..>', a regular macro behavior is expected.
22
23# CHECK:  simpleCheck0:
24# CHECK: addl    $0, %eax
25.macro concat string1 string2 string3
26   \string1\string2\string3:
27        addl $\string3, %eax
28.endm
29
30concat <simple>,<Check>,<0>
31
32# Test #3:
33# The altmacro cannot affect the regular less/greater behavior.
34
35# CHECK: addl $-1, %eax
36# CHECK: addl $0, %eax
37
38.macro fun3 arg1 arg2
39   addl $\arg1,%eax
40   addl $\arg2,%eax
41.endm
42
43fun3 5<6 , 5>8
44
45# Test #4:
46# If a comma is present inside an angle brackets,
47# the comma considered as a character and not as a separator.
48# This check checks the ability to split the string to different
49# arguments according to the use of the comma.
50# Fun2 sees the comma as a character.
51# Fun3 sees the comma as a separator.
52
53# CHECK: addl $5, %eax
54# CHECK: addl $6, %eax
55.macro fun2 arg
56   fun3 \arg
57.endm
58
59fun2 <5,6>
60
61# Test #5:
62# If argument begin with '<' and there is no '>' to close it.
63# A regular macro behavior is expected.
64
65# CHECK: addl $4, %eax
66.macro fun4 arg1 arg2
67   .if \arg2\arg1
68   addl $\arg2,%eax
69   .endif
70.endm
71
72fun4 <5,4
73.noaltmacro
74