You copied the Doc URL to your clipboard.

Assembling SVE code

Use armclang with a suitable SVE-enabled target to assemble code containing SVE instructions.

The SVE architectural extension to the ARMv8-A architecture (armv8-a+sve) provides SVE instructions. Many of these SVE instructions make use of the new p and z register classes.


The legacy ARM assembler, armasm, does not support SVE instructions.

The following example shows a simple assembly program that includes SVE instructions.

// example1.s
    .global main     
    mov     x0, 0x90000000
    mov     x8, xzr
    ptrue   p0.s                        //SVE instruction
    fcpy    z0.s, p0/m, #5.00000000     //SVE instruction
    orr     w10, wzr, #0x400
    st1w    z0.s, p0, [x0, x8, lsl #2]  //SVE instruction
    incw    x8                          //SVE instruction
    whilelt p0.s, x8, x10               //SVE instruction
    b.any   loop                        //SVE instruction
    mov     w0, wzr

To assemble this source file into a binary object file, use armclang with an SVE-enabled target:

armclang -c --target=aarch64-arm-none-eabi -march=armv8-a+sve example1.s -o example1.o

The command-line options in this example are:


Standard armclang option. Instructs the compiler to perform the compilation step, but not the link step.


Standard armclang option. Instructs the compiler to generate A64 instructions for AArch64 state.


SVE is not supported with AArch32 state, so the --target=aarch64-arm-none-eabi option is mandatory.

New target argument for the standard armclang -march option. Specifies that the compiler targets the ARMv8-A architecture profile with the SVE target feature enabled.

The default for AArch64 is -march=armv8-a, that is the ARMv8-A architecture profile without the SVE extension. You must explicitly specify +sve to assemble SVE instructions.

Valid SVE-enabled targets are:

  • -march=armv8-a+sve
  • -march=armv8.1-a+sve
  • -march=armv8.2-a+sve
  • -march=armv8.3-a+sve

Standard armclang option. Input assembly language file.

-o example1.o

Standard armclang option. Output ELF object file.