]>
Commit | Line | Data |
---|---|---|
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 | ||
10 | When the Order of Patterns Matters | |
11 | ********************************** | |
12 | ||
13 | Sometimes an insn can match more than one instruction pattern. Then the | |
14 | pattern that appears first in the machine description is the one used. | |
15 | Therefore, more specific patterns (patterns that will match fewer things) | |
16 | and faster instructions (those that will produce better code when they | |
17 | do match) should usually go first in the description. | |
18 | ||
19 | In some cases the effect of ordering the patterns can be used to hide | |
20 | a pattern when it is not valid. For example, the 68000 has an | |
21 | instruction for converting a fullword to floating point and another | |
22 | for converting a byte to floating point. An instruction converting | |
23 | an integer to floating point could match either one. We put the | |
24 | pattern to convert the fullword first to make sure that one will | |
25 | be used rather than the other. (Otherwise a large integer might | |
26 | be generated as a single-byte immediate quantity, which would not work.) | |
27 | Instead of using this pattern ordering it would be possible to make the | |
28 | pattern for convert-a-byte smart enough to deal properly with any | |
3ed1b4ce | 29 | constant value. |