|
|||||||||||
Technical Support On-Line Manuals Migration and Compatibility Guide ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Overview of differences between armasm and GNU syntax assembly code
5.2 Overview of differences between armasm and GNU syntax assembly codearmasm (for assembling legacy assembly code) uses armasm syntax assembly code. armclang aims to be compatible with GNU syntax assembly code (that is, the assembly code syntax supported by the GNU assembler, If you have legacy assembly code that you want to assemble with armclang, you must convert that assembly code from armasm syntax to GNU syntax. The specific instructions and order of operands in your UAL syntax assembly code do not change during this migration process. However, you need to make changes to the syntax of your assembly code. These changes include:
The following examples show simple, equivalent, assembly code in both armasm and GNU syntax. GNU syntax// Simple GNU syntax example [1] // // Iterate round a loop 10 times, adding 1 to a register each time. .section .text,"ax" // [2] .global main .balign 4 main: // [3] MOV w5,#0x64 // W5 = 100 [4] MOV w4,#0 // W4 = 0 B test_loop // branch to test_loop loop: ADD w5,w5,#1 // Add 1 to W5 ADD w4,w4,#1 // Add 1 to W4 test_loop: CMP w4,#0xa // if W4 < 10, branch back to loop BLT loop .end // [5] Example notes: [1] See Comments. [2] See Sections. [3] See Labels. [4] See Numeric literals. [5] See Miscellaneous directives. armasm syntax; Simple armasm syntax example ; ; Iterate round a loop 10 times, adding 1 to a register each time. AREA ||.text||, CODE, READONLY, ALIGN=2 ENTRY main PROC MOV w5,#0x64 ; W5 = 100 MOV w4,#0 ; W4 = 0 B test_loop ; branch to test_loop loop ADD w5,w5,#1 ; Add 1 to W5 ADD w4,w4,#1 ; Add 1 to W4 test_loop CMP w4,#0xa ; if W4 < 10, branch back to loop BLT loop ENDP END Related referencesRelated information | ||||||||||
|
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.