@c Copyright (C) 2012-2026 Free Software Foundation, Inc.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@ifset GENERIC
@page
@node XGATE-Dependent
@chapter XGATE Dependent Features
@end ifset
@ifclear GENERIC
@node Machine Dependencies
@chapter XGATE Dependent Features
@end ifclear

@cindex XGATE support
@menu
* XGATE-Opts::                   XGATE Options
* XGATE-Syntax::                 Syntax
* XGATE-Directives::             Assembler Directives
* XGATE-Float::                  Floating Point
* XGATE-opcodes::                Opcodes
@end menu

@node XGATE-Opts
@section XGATE Options

@cindex options, XGATE
@cindex XGATE options
The Freescale XGATE version of @code{@value{AS}} has a few machine
dependent options.

@table @code

@cindex @samp{-mshort}
@item -mshort
This option controls the ABI and indicates to use a 16-bit integer ABI.
It has no effect on the assembled instructions.
This is the default.

@cindex @samp{-mlong}
@item -mlong
This option controls the ABI and indicates to use a 32-bit integer ABI.

@cindex @samp{-mshort-double}
@item -mshort-double
This option controls the ABI and indicates to use a 32-bit float ABI.
This is the default.

@cindex @samp{-mlong-double}
@item -mlong-double
This option controls the ABI and indicates to use a 64-bit float ABI.

@cindex @samp{--print-insn-syntax}
@item --print-insn-syntax
You can use the @samp{--print-insn-syntax} option to obtain the
syntax description of the instruction when an error is detected.

@cindex @samp{--print-opcodes}
@item --print-opcodes
The @samp{--print-opcodes} option prints the list of all the
instructions with their syntax. Once the list is printed
@code{@value{AS}} exits.

@end table

@node XGATE-Syntax
@section Syntax

@cindex XGATE syntax
@cindex syntax, XGATE

In XGATE RISC syntax, the instruction name comes first and it may
be followed by up to three operands. Operands are separated by commas
(@samp{,}). @code{@value{AS}} will complain if too many operands are specified
for a given instruction. The same will happen if you specified too few
 operands.

@smallexample
nop
ldl  #23
CMP  R1, R2
@end smallexample

@cindex line comment character, XGATE
@cindex XGATE line comment character
The presence of a @samp{;} character or a @samp{!} character anywhere
on a line indicates the start of a comment that extends to the end of
that line.

A @samp{*} or a @samp{#} character at the start of a line also
introduces a line comment, but these characters do not work elsewhere
on the line.  If the first character of the line is a @samp{#} then as
well as starting a comment, the line could also be logical line number
directive (@pxref{Comments}) or a preprocessor control command
(@pxref{Preprocessing}).

@cindex line separator, XGATE
@cindex statement separator, XGATE
@cindex XGATE line separator
The XGATE assembler does not currently support a line separator
character.

@cindex XGATE addressing modes
@cindex addressing modes, XGATE
The following addressing modes are understood for XGATE:
@table @dfn
@item Inherent
@samp{}

@item Immediate 3 Bit Wide
@samp{#@var{number}}

@item Immediate 4 Bit Wide
@samp{#@var{number}}

@item Immediate 8 Bit Wide
@samp{#@var{number}}

@item Monadic Addressing
@samp{@var{reg}}

@item Dyadic Addressing
@samp{@var{reg}, @var{reg}}

@item Triadic Addressing
@samp{@var{reg}, @var{reg}, @var{reg}}

@item Relative Addressing 9 Bit Wide
@samp{*@var{symbol}}

@item Relative Addressing 10 Bit Wide
@samp{*@var{symbol}}

@item Index Register plus Immediate Offset
@samp{@var{reg}, (@var{reg}, #@var{number})}

@item Index Register plus Register Offset
@samp{@var{reg}, @var{reg}, @var{reg}}

@item Index Register plus Register Offset with Post-increment
@samp{@var{reg}, @var{reg}, @var{reg}+}

@item Index Register plus Register Offset with Pre-decrement
@samp{@var{reg}, @var{reg}, -@var{reg}}

The register can be either @samp{R0}, @samp{R1}, @samp{R2}, @samp{R3},
@samp{R4}, @samp{R5}, @samp{R6} or @samp{R7}.

@end table

Convene macro opcodes to deal with 16-bit values have been added.

@table @dfn

@item Immediate 16 Bit Wide
@samp{#@var{number}}, or @samp{*@var{symbol}}

For example:

@smallexample
ldw R1, #1024
ldw R3, timer
ldw R1, (R1, #0)
COM R1
stw R2, (R1, #0)
@end smallexample
@end table

@node XGATE-Directives
@section Assembler Directives

@cindex assembler directives, XGATE
@cindex XGATE assembler directives

The XGATE version of @code{@value{AS}} have the following
specific assembler directives:

@node XGATE-Float
@section Floating Point

@cindex floating point, XGATE
@cindex XGATE floating point
Packed decimal (P) format floating literals are not supported(yet).

The floating point formats generated by directives are these.

@table @code
@cindex @code{float} directive, XGATE
@item .float
@code{Single} precision floating point constants.

@cindex @code{double} directive, XGATE
@item .double
@code{Double} precision floating point constants.

@cindex @code{extend} directive XGATE
@cindex @code{ldouble} directive XGATE
@item .extend
@itemx .ldouble
@code{Extended} precision (@code{long double}) floating point constants.
@end table

@need 2000
@node XGATE-opcodes
@section Opcodes

@cindex XGATE opcodes
@cindex instruction set, XGATE

