.align pseudo-op

Purpose

Advances the current location counter until a boundary specified by the Number parameter is reached.

Syntax

.align Number [, Number2]

Description

The .align pseudo-op is normally used in a control section (csect) that contains data or in a csect that contains prefixed instructions.

The Number parameter specifies the log base 2 (binary logarithm) for the required alignment of the location counter. For example, if you specify 2, the .align pseudo-op requests word alignment, and if you specify 3, the .align pseudo-op requests double word alignment.

If the Number2 parameter is specified, alignment occurs only if the location is within Number2 bytes of the required alignment boundary. This is most useful before a prefixed instruction to prevent the instruction from crossing a 64-byte boundary.

If the Number2 parameter is not specified, the assembler aligns the location counter by inserting bytes. In most cases, 0s are inserted, but if the current csect has a storage-mapping class of PR or GL, no-op instructions are inserted. For more information about storage-mapping classes, see the .csect pseudo-op.

Parameters

Item Description
Number Specifies an absolute expression that evaluates to an integer value from 0 to 12, inclusive. The value indicates the log base 2 of the desired alignment. For example, an alignment of 8 (a double word) would be represented by an integer value of 3; an alignment of 4096 (one page) would be represented by an integer value of 12.
Number2 Specifies an absolute expression that evaluates to a number. Alignment occurs only if the location counter is closer to the desired alignment boundary than Number2 bytes. If the value specified by the Number2 parameter is greater than 2Number, the Number2 parameter is ignored.

Examples

The following examples demonstrate the use of the .align pseudo-op:
  1. 
                    .csect   progdata[RW]
                    .byte    1
                             # Location counter now at odd number
                    .align   1
                             # Location counter is now at the next
                             # halfword boundary.
                    .byte    3,4
                    .
                    .
                    .
                    .align   2       # Insure that the label cont
                                     # and the .long pseudo-op are
                                     # aligned on a full word
                                     # boundary.
            cont:   .long    5004381
    
  2. 
                    .csect [PR]
                    …
                    .align 6,8	# Align the program counter if the 
                                     # current location counter is less 
                                     # than 8 bytes from a 64-bit byte  
                                     # boundary
                    plw r3,0x10000(r4)	# Load a word into r3