Reference Guide

38 Chapter 2
Program Structure
Macro Processing
value, low-order bits are used until the value of the assigned-from bit
field becomes the same as the width of the assigned-to bit field. The
assigned-to bit field must always be specified.
No sign extension is provided by the macro assembler when bit fields are
generated.
The following macro definition defines the macro PACK with four formal
parameters.
PACK .MACRO BASE,GREG,SREG,OFFSET
{0..5}=0x3E{26..31}
{6..10}=BASE{27..31}
{11..15}=GREG{27..31}
{16..17}=SREG{30..31}
{18..31}=OFFSET{18..31}
.ENDM
The following explanation assumes that PACK is invoked with the
statement:
PACK %sp,%r19,%sr0,-52
Bit Field Description
{0..5} Contains the six low-order bits of the new opcode 0x3E,
or binary 111110, entered as a constant in the macro
definition.
{6..10} Contains general register 30, or binary 11110. These
are the five low-order bits of the argument BASE in the
macro definition.
{11..15} Contains general register 19, or binary 10011. These
are the five low-order bits of the argument GREG in the
macro definition.
{16..17} Contains space register 0 and represents the five
low-order bits of the argument SREG in the macro
definition.
{18..31} Contains binary 11111111001100, the OFFSET value
52, which was entered as an argument to the macro
definition.