The syntax for defining a mode macro is:
(define_mode_macro name [(mode1 "cond1") ... (moden "condn")])
This allows subsequent .md file constructs to use the mode suffix
:name. Every construct that does so will be expanded
n times, once with every use of
:name replaced by
:mode1, once with every use replaced by
and so on. In the expansion for a particular modei, every
C condition will also require that condi be true.
(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")])
defines a new mode suffix
:P. Every construct that uses
:P will be expanded twice, once with every
:SI and once with every
:P replaced by
:SI version will only apply if
Pmode == SImode and
:DI version will only apply if
Pmode == DImode.
As with other .md conditions, an empty string is treated
as “always true”.
"") can also be abbreviated
to mode. For example:
(define_mode_macro GPR [SI (DI "TARGET_64BIT")])
means that the
:DI expansion only applies if
but that the
:SI expansion has no such constraint.
Macros are applied in the order they are defined. This can be significant if two macros are used in a construct that requires substitutions. See Substitutions.