If an .md file construct uses mode macros, each version of the construct will often need slightly different strings. For example:
3patterns (see Standard Names), each expander will need to use the appropriate mode name for m.
define_insndefines several instruction patterns, each instruction will often use a different assembler mnemonic.
GCC supports such variations through a system of “mode attributes”.
There are two standard attributes:
mode, which is the name of
the mode in lower case, and
MODE, which is the same thing in
upper case. You can define other attributes using:
(define_mode_attr name [(mode1 "value1") ... (moden "valuen")])
where name is the name of the attribute and valuei is the value associated with modei.
When GCC replaces some :macro with :mode, it will
scan each string in the pattern for sequences of the form
>, where attr is the name of
a mode attribute. If the attribute is defined for mode, the
<...> sequence will be replaced by the appropriate
For example, suppose an .md file has:
(define_mode_macro P [(SI "Pmode == SImode") (DI "Pmode == DImode")]) (define_mode_attr load [(SI "lw") (DI "ld")])
If one of the patterns that uses
:P contains the string
SI version of that pattern
"lw\t%0,%1" and the
DI version will use
: prefix may be omitted, in which case the
substitution will be attempted for every macro expansion.