]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/gccint/machine-descriptions/when-the-order-of-patterns-matters.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / machine-descriptions / when-the-order-of-patterns-matters.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. index:: Pattern Ordering, Ordering of Patterns
7
8.. _pattern-ordering:
9
10When the Order of Patterns Matters
11**********************************
12
13Sometimes an insn can match more than one instruction pattern. Then the
14pattern that appears first in the machine description is the one used.
15Therefore, more specific patterns (patterns that will match fewer things)
16and faster instructions (those that will produce better code when they
17do match) should usually go first in the description.
18
19In some cases the effect of ordering the patterns can be used to hide
20a pattern when it is not valid. For example, the 68000 has an
21instruction for converting a fullword to floating point and another
22for converting a byte to floating point. An instruction converting
23an integer to floating point could match either one. We put the
24pattern to convert the fullword first to make sure that one will
25be used rather than the other. (Otherwise a large integer might
26be generated as a single-byte immediate quantity, which would not work.)
27Instead of using this pattern ordering it would be possible to make the
28pattern for convert-a-byte smart enough to deal properly with any
3ed1b4ce 29constant value.