68 lines · plain
1# RUN: llvm-mc -triple i386-linux-gnu %s | FileCheck %s2 3# Checking that the '%' was evaluated as a string first4# In a fail scenario: The asmprint will print: addl $%(1+4), %eax5 6# CHECK: addl $5, %eax7# CHECK-NEXT: addl $5, %eax8.altmacro9.macro percent_expr arg10 addl $\arg, %eax11 addl $\arg&, %eax12.endm13 14percent_expr %(1+4)15 16 17# Checking that the second '%' acts as modulo operator18# The altmacro percent '%' must be located before the first argument19# If a percent is located in the middle of the estimated argument without any20# '%' in the beginning , error will be generated.21# The second percent '%' after the first altmacro percent '%' is a regular operator.22 23# CHECK: addl $1, %eax24.macro inner_percent arg25 addl $\arg, %eax26.endm27 28inner_percent %(1%4)29 30 31# Checking for nested macro32# The first argument use is for the calling function and the second use is for the evaluation.33 34# CHECK: addl $1, %eax35.macro macro_call_0 number36 addl $\number, %eax37.endm38 39.macro macro_call_1 number40 macro_call_\number %(\number + 1)41.endm42 43macro_call_1 %(1-1)44 45 46# Checking the ability to pass a number of arguments.47# The arguments can be separated by ',' or not.48 49# CHECK: label013:50# CHECK: addl $0, %eax51# CHECK: addl $1, %eax52# CHECK: addl $3, %eax53 54# CHECK: label014:55# CHECK: addl $0, %eax56# CHECK: addl $1, %eax57# CHECK: addl $4, %eax58 59.macro multi_args_macro arg1 arg2 arg360 label\arg1\arg2\arg3:61 addl $\arg1, %eax62 addl $\arg2, %eax63 addl $\arg3, %eax64.endm65 66multi_args_macro %(1+4-5) 1 %2+167multi_args_macro %(1+4-5),1,%4%1068