brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 475c8b5 Raw
123 lines · plain
1; RUN: llvm-ml -filetype=s %s /Fo - | FileCheck %s2 3.code4 5identity MACRO arg6  exitm <arg>7endm8 9argument_test PROC10; CHECK-LABEL: argument_test:11 12  mov eax, identity(2)13; CHECK: mov eax, 214 15  ret16argument_test ENDP17 18argument_with_parens_test PROC19; CHECK-LABEL: argument_with_parens_test:20 21  mov eax, identity((3))22; CHECK: mov eax, 323  mov eax, identity(((4-1)-1))24; CHECK: mov eax, 225 26  ret27argument_with_parens_test ENDP28 29offsetof MACRO structure, field30  EXITM <structure.&field>31ENDM32 33S1 STRUCT34  W byte 035  X byte 036  Y byte 037S1 ENDS38 39substitutions_test PROC40; CHECK-LABEL: substitutions_test:41 42  mov eax, offsetof(S1, X)43; CHECK: mov eax, 144  mov eax, offsetof(S1, Y)45; CHECK: mov eax, 246 47  ret48substitutions_test ENDP49 50repeated_invocations_test PROC51; CHECK-LABEL: repeated_invocations_test:52 53  mov eax, identity(identity(1))54; CHECK: mov eax, 155 56  ret57repeated_invocations_test ENDP58 59factorial MACRO n60  IF n LE 161    EXITM <(1)>62  ELSE63    EXITM <(n)*factorial(n-1)>64  ENDIF65ENDM66 67; NOTE: This version is more sensitive to unintentional end-of-statement tokens.68factorial2 MACRO n69  IF n LE 170    EXITM <(1)>71  ELSE72    EXITM <(n)*(factorial(n-1))>73  ENDIF74ENDM75 76string_recursive_test PROC77; CHECK-LABEL: string_recursive_test:78 79  mov eax, factorial(5)80; CHECK: mov eax, 12081  mov eax, factorial2(4)82; CHECK: mov eax, 2483  mov eax, 11 + factorial(6) - 1184; CHECK: mov eax, 72085 86  ret87string_recursive_test ENDP88 89fibonacci MACRO n90  IF n LE 291    EXITM %192  ELSE93    EXITM %fibonacci(n-1)+fibonacci(n-2)94  ENDIF95ENDM96 97expr_recursive_test PROC98; CHECK-LABEL: expr_recursive_test:99 100  mov eax, fibonacci(10)101; CHECK: mov eax, 55102 103  ret104expr_recursive_test ENDP105 106expand_as_directive_test @CatStr(P, RO, C)107; CHECK-LABEL: expand_as_directive_test:108 109  ret110expand_as_directive_test ENDP111 112custom_strcat MACRO arg1, arg2113  EXITM <arg1&arg2>114ENDM115 116expand_as_directive_custom_test custom_strcat(P, ROC)117; CHECK-LABEL: expand_as_directive_custom_test:118 119  ret120expand_as_directive_custom_test ENDP121 122end123