1 # RUN: llvm-mc -triple i386-linux-gnu %s | FileCheck %s
3 # Checking that the '%' was evaluated as a string first
4 # In a fail scenario: The asmprint will print: addl $%(1+4), %eax
8 .macro percent_expr arg
15 # Checking that the second '%' acts as modulo operator
16 # The altmacro percent '%' must be located before the first argument
17 # If a percent is located in the middle of the estimated argument without any
18 # '%' in the beginning , error will be generated.
19 # The second percent '%' after the first altmacro percent '%' is a regular operator.
21 # CHECK: addl $1, %eax
22 .macro inner_percent arg
29 # Checking for nested macro
30 # The first argument use is for the calling function and the second use is for the evaluation.
32 # CHECK: addl $1, %eax
33 .macro macro_call_0 number
37 .macro macro_call_1 number
38 macro_call_
\number
%(\number
+ 1)
44 # Checking the ability to pass a number of arguments.
45 # The arguments can be separated by ',' or not.
48 # CHECK: addl $0, %eax
49 # CHECK: addl $1, %eax
50 # CHECK: addl $3, %eax
53 # CHECK: addl $0, %eax
54 # CHECK: addl $1, %eax
55 # CHECK: addl $4, %eax
57 .macro multi_args_macro arg1 arg2 arg3
64 multi_args_macro
%(1+4-5) 1 %2+1
65 multi_args_macro
%(1+4-5),1,%4%10