[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / llvm / test / MC / AsmParser / altmacro_expression.s
blobcee0a6872541a95c63158935faa0ae0afbd91328
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
6 # CHECK: addl $5, %eax
7 # CHECK-NEXT: addl $5, %eax
8 .altmacro
9 .macro percent_expr arg
10 addl $\arg, %eax
11 addl $\arg&, %eax
12 .endm
14 percent_expr %(1+4)
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
25 addl $\arg, %eax
26 .endm
28 inner_percent %(1%4)
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
36 addl $\number, %eax
37 .endm
39 .macro macro_call_1 number
40 macro_call_\number %(\number + 1)
41 .endm
43 macro_call_1 %(1-1)
46 # Checking the ability to pass a number of arguments.
47 # The arguments can be separated by ',' or not.
49 # CHECK: label013:
50 # CHECK: addl $0, %eax
51 # CHECK: addl $1, %eax
52 # CHECK: addl $3, %eax
54 # CHECK: label014:
55 # CHECK: addl $0, %eax
56 # CHECK: addl $1, %eax
57 # CHECK: addl $4, %eax
59 .macro multi_args_macro arg1 arg2 arg3
60 label\arg1\arg2\arg3:
61 addl $\arg1, %eax
62 addl $\arg2, %eax
63 addl $\arg3, %eax
64 .endm
66 multi_args_macro %(1+4-5) 1 %2+1
67 multi_args_macro %(1+4-5),1,%4%10