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
7 # CHECK-NEXT: addl $5, %eax
9 .macro percent_expr arg
17 # Checking that the second '%' acts as modulo operator
18 # The altmacro percent '%' must be located before the first argument
19 # If a percent is located in the middle of the estimated argument without any
20 # '%' in the beginning , error will be generated.
21 # The second percent '%' after the first altmacro percent '%' is a regular operator.
23 # CHECK: addl $1, %eax
24 .macro inner_percent arg
31 # Checking for nested macro
32 # The first argument use is for the calling function and the second use is for the evaluation.
34 # CHECK: addl $1, %eax
35 .macro macro_call_0 number
39 .macro macro_call_1 number
40 macro_call_
\number
%(\number
+ 1)
46 # Checking the ability to pass a number of arguments.
47 # The arguments can be separated by ',' or not.
50 # CHECK: addl $0, %eax
51 # CHECK: addl $1, %eax
52 # CHECK: addl $3, %eax
55 # CHECK: addl $0, %eax
56 # CHECK: addl $1, %eax
57 # CHECK: addl $4, %eax
59 .macro multi_args_macro arg1 arg2 arg3
66 multi_args_macro
%(1+4-5) 1 %2+1
67 multi_args_macro
%(1+4-5),1,%4%10