GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
avr

AVR: Support [[len=nl]] in asm templates

Inline assembly templates for AVR now support [[len=nl]] to conveniently specify instruction size as half the default.

Inline assembly templates for the AVR architecture now support the [[len=nl]] specifier. This allows developers to specify that the length of an assembly instruction is half the default size, which is useful for the common case of 1-word instructions. This reduces boilerplate and improves readability when writing inline assembly for AVR.

In Details

This change adds support for [[len=nl]] in the avr_length_of_asm function within config/avr/avr.cc. This allows specifying the length of inline assembly instructions in terms of number of lines. Most AVR instructions are one word, hence nl (number of lines) is a convenient way to specify half the default instruction size. Extends the documentation in doc/extend.texi.

For Context

Inline assembly allows developers to embed assembly code directly within their C/C++ code. This is often used to access specific hardware features or to optimize performance-critical sections of code. The AVR architecture is commonly used in embedded systems. This commit introduces a new way to specify the length of assembly instructions within inline assembly templates for AVR, making it easier to write compact and efficient code.

Filed Under: avrinline assemblycode generationembedded systems