Skip to main content

rucc_codegen/select/
x86_64.rs

1//! The x86-64 lowering table.
2//!
3//! Everything below the module comment is generated from `rules/x86-64.rules` by `rucc-rules`
4//! when this crate is built, and none of it is in the repository. The rule file is the only
5//! place the rules are written, which is what makes the table that is matched with and the
6//! table `rucc-verify` proves things about the same table.
7//!
8//! To read the rules, read the rule file. To read the automaton they compile into, build the
9//! crate and read `x86-64.rs` under the build directory, which is a file worth looking at once
10//! for the shape of it and never again.
11
12// A guard is emitted as the comparison the rule writes, so a rule saying a shift count is at
13// least zero and less than the width comes out as two comparisons rather than as a range. That
14// is deliberate: the generated line and the rule it came from should read the same, and the
15// suggestion to write it another way is advice for somebody editing code, which nobody here is.
16#![allow(clippy::manual_range_contains)]
17
18include!(concat!(env!("OUT_DIR"), "/x86-64.rs"));
19
20#[cfg(test)]
21mod tests {
22    use rucc_target::x86_64;
23
24    use super::TABLE;
25    use crate::select::Piece;
26
27    /// The prefix a rule file puts in front of a machine term, which is how it says which target
28    /// the term belongs to. It is not part of the opcode.
29    const PREFIX: &str = "x64.";
30
31    /// The two address constructors, which are not instructions. An addressing mode is an
32    /// argument to `lea` and to every memory operand after it, so it is written as a term in the
33    /// rule file and built by the selector into the instruction that takes it.
34    const AMODES: &[&str] =
35        &["amode_base_index_scale", "amode_index_scale", "amode_base", "amode_base_offset"];
36
37    /// Every head this table can write, in and under the replacements.
38    fn heads() -> Vec<&'static str> {
39        let mut found: Vec<&'static str> = TABLE
40            .rules
41            .iter()
42            .flat_map(|rule| rule.replacement.iter())
43            .filter_map(|piece| match piece {
44                Piece::App { head, .. } => Some(*head),
45                _ => None,
46            })
47            .collect();
48        found.sort_unstable();
49        found.dedup();
50        found
51    }
52
53    #[test]
54    fn every_instruction_the_table_writes_is_described() {
55        for head in heads() {
56            if AMODES.contains(&head) {
57                continue;
58            }
59            let opcode = head.strip_prefix(PREFIX).unwrap_or_else(|| {
60                panic!("{head} is neither an x86-64 term nor an addressing mode")
61            });
62            assert!(
63                x86_64::form(opcode).is_some(),
64                "{head} is selected by a rule and `rucc_target::x86_64` does not say what it \
65                 does with its operands"
66            );
67        }
68    }
69
70    /// The order the operands of a store are written in, which is the IR's and not a choice this
71    /// file makes.
72    ///
73    /// A pattern is matched against an instruction's operand list by position, so a rule that
74    /// names the address where the IR holds the value is a rule that stores to the value and
75    /// writes the address into memory. Nothing in a proof would catch it, because a proof is
76    /// about the rule file agreeing with itself, and both halves would be wrong in the same way.
77    /// `rucc_ir::Builder::store` takes the value first and the machine instruction takes it last,
78    /// which is why the two halves of one of these rules read in opposite orders.
79    #[test]
80    fn a_store_is_written_with_the_value_first_because_that_is_where_the_ir_keeps_it() {
81        let mut seen = 0;
82        for rule in TABLE.rules {
83            let Some(rest) = rule.pattern.strip_prefix("(store.") else { continue };
84            let (width, operands) = rest.split_once(' ').expect("a store takes operands");
85            assert!(
86                operands.starts_with(&format!("(value.{width} ")),
87                "line {}: {} binds something other than the value it is storing first",
88                rule.line,
89                rule.pattern
90            );
91            assert!(
92                operands.contains("(value.i64 "),
93                "line {}: {} reaches no address",
94                rule.line,
95                rule.pattern
96            );
97            seen += 1;
98        }
99        assert_eq!(seen, 16, "the store rules moved and this test did not follow them");
100    }
101
102    /// Every comparison can be made against a constant as well as against a register.
103    ///
104    /// Four comparisons in five in the corpus are against a constant, and without a rule for one
105    /// the constant is loaded into a register first, which is an instruction and a register the
106    /// machine never needed. A missing width or a missing condition would not fail anything else:
107    /// the register rule still matches, the output is still correct, and the only sign is code
108    /// that is one instruction longer in a place nobody is looking. So the two lists are counted
109    /// against each other here.
110    ///
111    /// What this cannot check is that the condition on the immediate rule is the right one, since
112    /// both halves of a wrong pair would be a consistent pair. That is what the `spec` clause is
113    /// for, and `rucc-verify` is what reads it.
114    #[test]
115    fn a_comparison_against_a_constant_is_written_for_every_one_against_a_register() {
116        let mut against_register = Vec::new();
117        let mut against_constant = Vec::new();
118        for rule in TABLE.rules {
119            let Some(rest) = rule.pattern.strip_prefix("(icmp_") else { continue };
120            let (condition, operands) = rest.split_once(".i1 ").expect("a comparison takes two");
121            let width = operands
122                .strip_prefix("(value.")
123                .and_then(|rest| rest.split_once(' '))
124                .map(|(width, _)| width)
125                .expect("a comparison reads a value first");
126            let named = format!("{condition}.{width}");
127            if operands.contains("(iconst.") {
128                // The constant is the second operand and never the first, because a comparison is
129                // not symmetric and the same condition on the other side means the opposite.
130                assert!(
131                    !operands.starts_with("(iconst."),
132                    "line {}: {} compares a constant against a value",
133                    rule.line,
134                    rule.pattern
135                );
136                against_constant.push(named);
137            } else {
138                against_register.push(named);
139            }
140        }
141        against_register.sort_unstable();
142        against_constant.sort_unstable();
143        assert_eq!(against_register, against_constant);
144        assert_eq!(against_register.len(), 40, "ten conditions at four widths");
145    }
146
147    /// The instructions the calling convention writes rather than a rule.
148    ///
149    /// Three kinds of them. Naming the register an argument arrived in, where an argument is
150    /// depends on its position in the signature and on the classification of every argument before
151    /// it, and a rule pattern sees one term and has no way to say any of that, so `crate::abi`
152    /// builds these from the convention instead. Calling a name is the same the other way round:
153    /// what its operands are is whatever the signature made them, and a call through an address is
154    /// the same instruction with one operand more.
155    ///
156    /// The second half of a value that comes back in two registers is the third. A return of one
157    /// value is a rule, because where that value goes depends on nothing but the value, which is
158    /// exactly what a rule can say. A return of two is not, because which register the second half
159    /// is in depends on the first half: the two register files are counted separately, so a
160    /// `double` and a `long` both come back at place zero and two `long`s do not.
161    const CONVENTION: &[&str] = &[
162        "arg_val_8",
163        "arg_val_16",
164        "arg_val_32",
165        "arg_val_64",
166        "arg_val_f32",
167        "arg_val_f64",
168        "arg_val_f128",
169        "ret_val2_8",
170        "ret_val2_16",
171        "ret_val2_32",
172        "ret_val2_64",
173        "ret_val2_f32",
174        "ret_val2_f64",
175        "ret_val2_f128",
176        "call",
177        "call_reg",
178    ];
179
180    /// The instructions the block layout writes rather than a rule.
181    ///
182    /// A rule sees one branch and the layout is about the order of every block in the function, so
183    /// which arm falls through is not something any pattern could say. That answer is what decides
184    /// whether the jump goes to the arm the condition is true for or the other one, and whether
185    /// there is a second jump after it, so all of these are written where the answer is.
186    ///
187    /// The comparisons are here for a second reason on top of that one. A branch on a comparison
188    /// is a comparison and a jump on the flags it set, and the flags are not a value: no pattern
189    /// could bind one and no `spec` clause could say anything about one. So the pair is put
190    /// together by the layout, out of a comparison a rule did select and the branch behind it,
191    /// which is the same argument `rucc_target::x86_64::Form::CmpSet` is one form rather than two
192    /// under.
193    const LAYOUT: &[&str] = &[
194        "test_rr_8",
195        "cmp_rr_8",
196        "cmp_rr_16",
197        "cmp_rr_32",
198        "cmp_rr_64",
199        "cmp_ri_8",
200        "cmp_ri_16",
201        "cmp_ri_32",
202        "cmp_ri_64",
203        "cmp_rm_8",
204        "cmp_rm_16",
205        "cmp_rm_32",
206        "cmp_rm_64",
207        "cmp_mi_8",
208        "cmp_mi_16",
209        "cmp_mi_32",
210        "cmp_mi_64",
211        "jcc_e",
212        "jcc_ne",
213        "jcc_l",
214        "jcc_le",
215        "jcc_g",
216        "jcc_ge",
217        "jcc_b",
218        "jcc_be",
219        "jcc_a",
220        "jcc_ae",
221        "jmp",
222    ];
223
224    /// The instructions the compare pass writes rather than a rule.
225    ///
226    /// The other half of the argument the comparisons above are here under. A rule selects a
227    /// comparison that keeps its answer in a byte, because that is the shape a value has. What is
228    /// left of one when the machine has already made the comparison is the byte with no comparison
229    /// in front of it, and there is no pattern for that: the term it would compute is the same term
230    /// the full comparison computes, and what makes the short one right is the instruction three
231    /// places back rather than anything about the value. So `crate::compare` writes them by name,
232    /// in place of a comparison it found was already made.
233    const COMPARE: &[&str] = &[
234        "set_e", "set_ne", "set_l", "set_le", "set_g", "set_ge", "set_b", "set_be", "set_a",
235        "set_ae",
236    ];
237
238    /// The instruction a computed `goto` is written as rather than a rule.
239    ///
240    /// The one branch `crate::lower` writes by name, and the one the block layout does not write
241    /// either. What it reads is the address, which a pattern could have bound, so it is not
242    /// exempt for the reason the branches above are. What no pattern can say is the rest of it:
243    /// how many arms the block has, which is every label of the function the program took the
244    /// address of, and a rule says what an instruction reads rather than where a block goes.
245    const LABELS: &[&str] = &["jmp_reg"];
246
247    /// The instruction the memory model writes rather than a rule.
248    ///
249    /// A barrier computes nothing, so there is no equality for the solver to discharge and no
250    /// pattern for a rule to be written as. What makes it the right answer is what the machine
251    /// promises about the order two other instructions become visible in, which is a claim about
252    /// the program around it rather than about any value. `crate::lower` writes it by name, at the
253    /// strongest ordering and nowhere else, and `crate::expand` says why the strongest is the only
254    /// one that costs anything here.
255    const BARRIER: &[&str] = &["mfence"];
256
257    /// The instruction a program stops on, which `crate::lower` writes rather than a rule.
258    ///
259    /// The first half of the barrier's reason and not the second. It computes nothing, so there is
260    /// no equality for the solver and no pattern for a rule. What makes it right is not a claim
261    /// about the order anything becomes visible in either: it is what the operating system does
262    /// with the fault, which is a fact about neither the values nor the program around it.
263    const STOP: &[&str] = &["ud2"];
264
265    /// The instructions that are a hint rather than a computation.
266    ///
267    /// The same shape of exemption the barrier gets and for a reason one step further out. A
268    /// barrier computes nothing and still has to be where it is, so there is at least a claim about
269    /// the program around it. A prefetch does not even have that: a machine that drops the whole
270    /// instruction runs the program correctly, because the only thing it can change is how long the
271    /// program takes.
272    ///
273    /// So there is no equality for the solver and no pattern for a rule, and which of the four a
274    /// program gets is decided by a number in the builtin's own arguments rather than by anything
275    /// about the value being prefetched. `crate::lower` writes them by name, out of the hint the IR
276    /// carries beside the instruction.
277    const HINT: &[&str] = &["prefetch_nta", "prefetch_t0", "prefetch_t1", "prefetch_t2"];
278
279    /// The instructions nothing but an `asm` statement asks for.
280    ///
281    /// One step further out again. A prefetch is a hint and is still something the compiler decides
282    /// to write, out of a builtin the program called. These are instructions the program wrote down
283    /// itself, by name, in a template, and nothing else in the language reaches them: there is no
284    /// builtin for either, no rule could match a term that produces one, and `crate::lower` writes
285    /// them only because [`rucc_target::x86_64::read`] found the name in a template and said which
286    /// opcode that is.
287    ///
288    /// `pause` is the hint a spin lock writes between two tries at the lock. `cpuid` is how a
289    /// program asks the processor what it can do, which there is no other way to ask, so every
290    /// program that takes a faster path on some machines than on others has one of these in it.
291    ///
292    /// The alignment is the third, and it is on this list rather than one of its own because it
293    /// meets the claim below outright: an instruction is exempt for this reason exactly when there
294    /// is nothing about it for a rule to name, and an opcode with no operands and no addressing mode
295    /// has nothing. It is not an instruction at all, which is more than the test asks and is the
296    /// reason no rule could have been written for it however the rule language grew.
297    const TEMPLATE: &[&str] = &["cpuid", "pause", "align"];
298
299    /// The instructions a template asks for that are right because of the line above them.
300    ///
301    /// These are exempt for the reason the ten bytes in [`COMPARE`] are, one step further out. A
302    /// rule selects a conditional move with its comparison in front of it, because that pair is the
303    /// shape a select has. The move on its own computes the same term and what makes it right is the
304    /// comparison somewhere behind it rather than anything about its own operands, so no pattern
305    /// could say what it means. The compare pass does not write one either, because it replaces a
306    /// comparison it found was already made and there is no earlier move here to replace: what
307    /// writes one is a program that put the comparison on one line of a template and the move on the
308    /// next, which is what zstd does to keep a bounds check from becoming a branch.
309    ///
310    /// So these have operands a rule could have named, unlike everything in [`TEMPLATE`], and they
311    /// are still not instructions a rule could have been written for.
312    /// The add with carry and the subtract with borrow, which read a bit off the instruction in
313    /// front of them.
314    ///
315    /// Exempt one step further out again than [`CONDITIONAL`]. A conditional move reads the
316    /// condition state and leaves it alone, so what is missing from a rule that named one is the
317    /// comparison. These read it and write it both, and what is missing is worse than a comparison:
318    /// the bit they read is the carry out of an addition, and an addition in the IR is an addition
319    /// of a width with no carry out at all, so there is no term a rule could match that the bit is
320    /// a part of. A program gets one by writing both halves itself in a template, which is what
321    /// `add_ssaaaa` and `sub_ddmmss` in libgmp's `longlong.h` are. The form against a constant is
322    /// here for the same reason and is the same instruction with a zero where the second source is,
323    /// which `add_sssaaaa` writes for the top word of a number three words wide.
324    ///
325    /// What keeps the two halves together once they are two instructions in a block is not here. It
326    /// is `rucc_target::FlagInsts`, which the scheduler reads for exactly this, and the test below
327    /// checks the entry is there rather than trusting that somebody remembered.
328    const CARRY: &[&str] = &[
329        "adc_rr_8",
330        "adc_rr_16",
331        "adc_rr_32",
332        "adc_rr_64",
333        "sbb_rr_8",
334        "sbb_rr_16",
335        "sbb_rr_32",
336        "sbb_rr_64",
337        "adc_ri_8",
338        "adc_ri_16",
339        "adc_ri_32",
340        "adc_ri_64",
341        "sbb_ri_8",
342        "sbb_ri_16",
343        "sbb_ri_32",
344        "sbb_ri_64",
345    ];
346
347    const CONDITIONAL: &[&str] = &[
348        "cmov_e_16",
349        "cmov_e_32",
350        "cmov_e_64",
351        "cmov_ne_16",
352        "cmov_ne_32",
353        "cmov_ne_64",
354        "cmov_l_16",
355        "cmov_l_32",
356        "cmov_l_64",
357        "cmov_le_16",
358        "cmov_le_32",
359        "cmov_le_64",
360        "cmov_g_16",
361        "cmov_g_32",
362        "cmov_g_64",
363        "cmov_ge_16",
364        "cmov_ge_32",
365        "cmov_ge_64",
366        "cmov_b_16",
367        "cmov_b_32",
368        "cmov_b_64",
369        "cmov_be_16",
370        "cmov_be_32",
371        "cmov_be_64",
372        "cmov_a_16",
373        "cmov_a_32",
374        "cmov_a_64",
375        "cmov_ae_16",
376        "cmov_ae_32",
377        "cmov_ae_64",
378    ];
379
380    /// The instructions that look for a set bit, which a template asks for and nothing else does.
381    ///
382    /// These have a source and a destination a rule could have named, the way the conditional moves
383    /// above do, and the reason no rule names them is a different one again. It is not that their
384    /// meaning comes from the line in front of them: each of these says on its own exactly what it
385    /// computes. It is that [`crate::expand`] already answers the question they answer, out of
386    /// arithmetic every machine has, and it does that because what these do when the source is zero
387    /// is four different things on four families of processor. A rule that selected one would be a
388    /// rule whose answer depends on which machine ran it.
389    ///
390    /// So the only thing that reaches one is a program that wrote the name in a template, which is
391    /// what the libraries that were counting bits before there was a builtin for it all do.
392    /// `crate::lower` writes them for the reason it writes the three in [`TEMPLATE`], and they are
393    /// not on that list because they are not bare: a rule could have named these operands and the
394    /// claim that list makes would be false of them.
395    const SEARCH: &[&str] = &[
396        "bsf_16", "bsf_32", "bsf_64", "bsr_16", "bsr_32", "bsr_64", "lzcnt_32", "lzcnt_64",
397        "tzcnt_32", "tzcnt_64",
398    ];
399
400    /// The instruction that turns a register round, which a template asks for and nothing else does.
401    ///
402    /// The list above, one step simpler. A search is unselected because what it does with a source
403    /// of zero is not the same on every processor, so a rule that chose one would depend on what ran
404    /// it. A byte reversal has no such case: it means exactly one thing everywhere. What keeps it
405    /// off the rule set is a choice made once, in [`crate::expand`], which builds a reversal out of
406    /// shifts and masks so that the answer is the same on every target this compiler has rather than
407    /// good on the one that happens to have the instruction. tamnd/rucc#310 is where that trade is
408    /// written down, and the day a target grows its own reversal is the day to reopen it.
409    ///
410    /// So the only thing that reaches one is a program that wrote the name in a template, which is
411    /// what libgmp does in `gmp-impl.h` to put a limb the other way round.
412    const SWAP: &[&str] = &["bswap_32", "bswap_64"];
413
414    /// The multiply that keeps both halves of its product and the division that reads both halves
415    /// of its dividend, which a template asks for and nothing else does.
416    ///
417    /// A third reason again, and the plainest of the three. A search is unselected because its
418    /// answer depends on the processor and a reversal because a choice was made to build one out of
419    /// arithmetic. This one is unselected because there is nothing in the IR to select it from: a
420    /// multiply in C takes two values of a type and produces a value of that type, so the term a
421    /// rule would match on is the narrow product, and the wide product is not a term at all. A rule
422    /// that fired on the narrow one and wrote this would be writing an instruction that computes
423    /// twice as much as was asked for and leaves the rest in a register nobody asked about.
424    ///
425    /// So the only thing that reaches one is a program that wrote the name in a template, which is
426    /// what `umul_ppmm` in libgmp's `longlong.h` does, and what every library that is building
427    /// arithmetic out of limbs does somewhere.
428    ///
429    /// The division is the same claim upside down and is on this list because the reason is the same
430    /// one. A division in C divides a number by a number of its own width, so the term a rule would
431    /// match is the narrow one, and this compiler already has two opcodes for that: each of them
432    /// fills the high half of the dividend itself and then throws one of the two answers away. A
433    /// dividend the program filled both halves of is not a term the IR has, and `udiv_qrnnd` beside
434    /// the multiply in the same header is how long division a limb at a time is written.
435    const WIDE: &[&str] = &[
436        "mul_wide_16",
437        "mul_wide_32",
438        "mul_wide_64",
439        "imul_wide_16",
440        "imul_wide_32",
441        "imul_wide_64",
442        "div_wide_16",
443        "div_wide_32",
444        "div_wide_64",
445        "idiv_wide_16",
446        "idiv_wide_32",
447        "idiv_wide_64",
448    ];
449
450    /// The instructions that produce two values, which is one more than a rule can name.
451    ///
452    /// A rule replaces a term with a term, and a term is the value one instruction computes. A
453    /// compare and exchange computes two: what it found at the address, and whether what it found
454    /// was what the program expected. There is no way to write the second one down in the rule
455    /// language, and inventing one would be inventing a language for a single instruction.
456    ///
457    /// So `crate::lower` writes it by name, the way it writes the barrier by name, and for a reason
458    /// that is about the rule language rather than about the machine. What the solver would have
459    /// been asked to prove about it is the easy half in any case: the arithmetic is a comparison
460    /// and a select, and what is hard is that the whole of it happens at once, which is the same
461    /// claim about the program around it that a barrier makes.
462    const ATOMIC: &[&str] = &["cmpxchg_8", "cmpxchg_16", "cmpxchg_32", "cmpxchg_64"];
463
464    /// The instructions whose operation is in the payload rather than in the head.
465    ///
466    /// A different exemption from the one above, on instructions that produce one value each and so
467    /// could be named by a rule if the rule had anything to match on. The head a pattern matches is
468    /// an opcode and a type, and every read modify write in the IR is the one opcode `atomic_rmw`.
469    /// Which of the thirteen operations it performs is carried beside the instruction rather than in
470    /// its name, so a pattern written for the exchange would match the add and the nand as well, and
471    /// the rule language has no way to look at what a rule matched to tell them apart.
472    ///
473    /// Giving each operation its own opcode is the other way out and is a worse trade: it is
474    /// thirteen opcodes at four widths where the IR wants one, and every pass that treats a read
475    /// modify write as one thing would then have a list of fifty two.
476    ///
477    /// So `crate::lower` writes these by name too. Three operations here, out of the thirteen: the
478    /// bitwise ones need a loop around a compare and exchange, which is control flow and so is built
479    /// before selection rather than during it, and they are the rest of `tamnd/rucc#311`.
480    const PAYLOAD: &[&str] =
481        &["xchg_8", "xchg_16", "xchg_32", "xchg_64", "xadd_8", "xadd_16", "xadd_32", "xadd_64"];
482
483    /// The instructions a frame writes rather than a rule.
484    ///
485    /// A prologue, an epilogue, a copy, a spill and a reload are not in the program. They are what
486    /// the allocator's answer costs, so they are written after it, by `crate::finish` reading
487    /// `x86_64::FRAME`. Six of the names that describes are already reachable from a rule, since a
488    /// prologue taking its frame is a subtraction and a spill is a store, and those are not here:
489    /// this is only the ones nothing else can reach.
490    const FRAME: &[&str] = &[
491        "push_64",
492        "pop_64",
493        "ret",
494        "mov_rr_64",
495        "movaps_rr",
496        // The touch a probing prologue puts on each page as it reaches it, the landing pad a
497        // prologue opens with, and the byte that does nothing which one reserves room with. All
498        // three are written by a frame and none on a command line that did not ask for it.
499        "or_mi_8",
500        "endbr64",
501        "nop",
502    ];
503
504    /// The instructions that reach the x87 stack, which are selected but not from here.
505    ///
506    /// A third kind of exemption, and the same reason all the way down the list.
507    ///
508    /// Every one of these is written by `crate::lower`, as part of a group rather than on its own.
509    /// What one of them leaves behind and the next picks up is the top of the x87 stack, which is
510    /// not a register anything allocates from and not a value a pattern could bind, so a rule
511    /// could neither match the middle of a group nor name what its replacement produced. And an
512    /// add here reads two addresses and writes a third, where one machine IR instruction carries
513    /// one addressing mode, so the group cannot be folded into a single opcode the way
514    /// `ucomisd_set_e` folds a comparison and a `setcc` either.
515    ///
516    /// So these are exempt for the reason `FRAME` is exempt rather than for the reason the list
517    /// below is, and they will stay exempt. Two of them are not reached by anything yet all the
518    /// same: `fsub_p` and `fdiv_p` are the other direction of the subtraction and the division,
519    /// which a code generator that pushed its operands the other way round would need and this one
520    /// does not. `fabs` is a third, since C spells that as a call to a library function.
521    const X87: &[&str] = &[
522        "fld_t",
523        "fstp_t",
524        "fld_s",
525        "fld_l",
526        "fild_l",
527        "fild_ll",
528        "fstp_s",
529        "fstp_l",
530        "fistp_l",
531        "fistp_ll",
532        "fnstcw",
533        "fldcw",
534        "fadd_p",
535        "fsub_p",
536        "fsubr_p",
537        "fmul_p",
538        "fdiv_p",
539        "fdivr_p",
540        "fchs",
541        "fabs",
542        "fucomip_set_a",
543        "fucomip_set_ae",
544        "fucomip_set_b",
545        "fucomip_set_be",
546        "fucomip_set_e",
547        "fucomip_set_ne",
548        "fucomip_set_p",
549        "fucomip_set_np",
550        "fucomip_set_e_and_np",
551        "fucomip_set_ne_or_p",
552    ];
553
554    /// The instructions no rule selects yet, because the rules that selected them were taken out.
555    ///
556    /// A different kind of exemption from the three above. Those say an instruction is written
557    /// somewhere a rule cannot reach and always will be. These say nobody reaches one at all right
558    /// now, and name the work that puts the rules back.
559    ///
560    /// The rules went out under `tamnd/rucc#368`. C promotes the operands of an arithmetic
561    /// operator to `int`, so a byte add and a two byte compare are things no C program asks the
562    /// back end for, and the rules at those widths sat proved and never selected over the whole
563    /// torture corpus at every optimization level. The width narrowing pass in `tamnd/rucc#375` is
564    /// what asks for them, and the rules come back with it.
565    ///
566    /// The descriptions stayed. A description says what an x86-64 instruction is, how long it is
567    /// and how it encodes, and that is true whether or not anything selects it. Taking them out
568    /// would be deleting a correct account of the machine to make a list shorter, and putting them
569    /// back is then a second thing to get right rather than a line of a rule file.
570    const NARROW: &[&str] = &[
571        // Three of the two address forms against an immediate. The `narrow` pass does write the
572        // shape, since `char c = a | 1;` narrows to a byte `or` against a byte constant, and no
573        // rule selects these yet: the constant goes into a register and the register with
574        // register rule takes it. Their `add`, `sub` and `and` siblings do have rules and are
575        // reached by the bitfield lowering, so this is six rules missing rather than a shape
576        // nothing writes.
577        "or_ri_8",
578        "or_ri_16",
579        "xor_ri_8",
580        "xor_ri_16",
581        "imul_ri_8",
582        "imul_ri_16",
583        // The divides, which are four instructions per width because the quotient and the
584        // remainder come out of one division in two different registers. `narrow` refuses these
585        // on purpose: the most negative byte over minus one is a defined hundred and twenty eight
586        // at four bytes and is the overflow that raises at one, so narrowing a division wants a
587        // range that rules the pair out and there is no range analysis yet.
588        "idiv_quo_8",
589        "idiv_quo_16",
590        "idiv_rem_8",
591        "idiv_rem_16",
592        "div_quo_8",
593        "div_quo_16",
594        "div_rem_8",
595        "div_rem_16",
596        // The shifts by a value, whose count is in `cl` whatever the width being shifted is. The
597        // same refusal for the same kind of reason: a count of twenty is a defined shift to zero
598        // at four bytes and is poison at one, so only a count that is a constant below the narrow
599        // width narrows, and that one selects the immediate forms which do have rules.
600        "shl_rcl_8",
601        "shl_rcl_16",
602        "shr_rcl_8",
603        "shr_rcl_16",
604        "sar_rcl_8",
605        "sar_rcl_16",
606    ];
607
608    /// The arithmetic that reaches memory, which [`crate::combine`] writes: the forms that read a
609    /// source out of it and the forms that leave the answer in it.
610    ///
611    /// A function rather than a list, for the reason the compare pass's exemption is taken from the
612    /// flag description rather than typed out: the pass already writes down which instructions it
613    /// can produce, and a second copy of that here would be a second opinion about one pass.
614    ///
615    /// No rule selects one of these because a rule matches a term and one of these is two terms, a
616    /// load and an arithmetic operation, put together, or three where the answer goes back to
617    /// memory. Whether they may be put together depends on what is written between them and on
618    /// whether anything else wants what the load read, and neither is a fact about any of the
619    /// terms. That is the whole reason the pass exists and the module documentation there says it
620    /// at length.
621    fn combine() -> Vec<&'static str> {
622        let loads = crate::combine::FOLDS.iter().map(|fold| fold.into);
623        // And the instruction a load on the other side comes to, which for most rows is the one
624        // above and for a comparison is the condition the other way round.
625        let swapped = crate::combine::FOLDS.iter().filter_map(|fold| fold.swapped);
626        let stores = crate::combine::UPDATES.iter().map(|update| update.into);
627        let constants = crate::combine::BUMPS.iter().map(|bump| bump.into);
628        loads.chain(swapped).chain(stores).chain(constants).collect()
629    }
630
631    #[test]
632    fn every_instruction_exempt_from_a_rule_is_one_a_frame_really_writes() {
633        // The same claim as the one about the convention, so that this list cannot grow an opcode
634        // that no frame asks for. In the order `x86_64::FRAME` names them, the copies after the
635        // return because there is one set of them per class the allocator may spill.
636        let frame = &x86_64::FRAME;
637        let mut written = vec![frame.push, frame.pop, frame.ret];
638        for class in frame.classes {
639            written.extend([class.mov, class.load, class.store]);
640        }
641        // And the touch a probing prologue puts on a page, which the target names as an option
642        // because a target with no instruction that writes an address without changing it takes
643        // every frame in one subtraction and has nothing to exempt.
644        written.extend(frame.probe.map(|probe| probe.inst));
645        // And the landing pad and the byte that does nothing, which are options for the same
646        // reason.
647        written.extend(frame.landing);
648        written.extend(frame.pad);
649        // What is left after the ones a rule already reaches, which are the loads and the stores of
650        // both register files, since those are the same instructions a program's own reads and
651        // writes of memory are. The vector pair joined them with the rules for a quad float, and a
652        // spill of one is now the same instruction as a program reading a `_Float128` variable.
653        written.retain(|opcode| !heads().contains(&format!("{PREFIX}{opcode}").as_str()));
654        assert_eq!(written, FRAME);
655    }
656
657    #[test]
658    fn every_instruction_exempt_from_a_rule_is_one_the_convention_really_writes() {
659        // An exemption list that nothing checks is a hole, since an opcode dropped into it stops
660        // being covered by either direction of the pinning. These are the ones `crate::abi` can
661        // name, at the four integer widths and the two float formats it has names for an
662        // argument in, and no others.
663        let strip = |head: &'static str| head.strip_prefix(PREFIX).expect("an x86-64 term");
664        let named = |ty| strip(crate::abi::head_of(ty).expect("every width the pseudos cover"));
665        // The second half of a pair at place one, which is the place a rule cannot name. The first
666        // half at place zero is `ret_val_*` and is reached by a rule, so it is not on this list.
667        let second = |ty| strip(crate::abi::ret_of(ty, 1).expect("every width the pseudos cover"));
668        let widths = || {
669            [8, 16, 32, 64].into_iter().map(rucc_ir::Type::int).chain(
670                [rucc_ir::Float::F32, rucc_ir::Float::F64, rucc_ir::Float::F128]
671                    .map(rucc_ir::Type::float),
672            )
673        };
674        let written: Vec<&str> = widths()
675            .map(named)
676            .chain(widths().map(second))
677            .chain([strip(crate::abi::CALL), strip(crate::abi::CALL_REG)])
678            .collect();
679        assert_eq!(written, CONVENTION);
680    }
681
682    /// The same claim about the block layout's list, which is longer than it looks.
683    ///
684    /// A name here that the layout does not write is an opcode exempted from needing a rule and
685    /// reached by nothing, and a name the layout writes that is not here is a failing test in
686    /// `every_described_instruction_is_reachable_from_a_rule` with a misleading message. Both are
687    /// avoided by taking the list from `rucc_target::x86_64::BRANCH` rather than believing it.
688    #[test]
689    fn every_instruction_exempt_from_a_rule_is_one_the_block_layout_really_writes() {
690        let branch = &x86_64::BRANCH;
691        // Eighty entries name sixteen instructions between them, so this is a set rather than a
692        // list and both sides are sorted before they are held against each other. What the order
693        // of the list itself is for is reading it.
694        let mut written: Vec<&str> = vec![branch.test, branch.jump];
695        written.extend(branch.fused.iter().map(|fusion| fusion.cmp));
696        written.extend(branch.fused.iter().flat_map(|fusion| [fusion.if_true, fusion.if_false]));
697        written.sort_unstable();
698        written.dedup();
699        let mut exempt = LAYOUT.to_vec();
700        exempt.sort_unstable();
701        assert_eq!(written, exempt);
702    }
703
704    /// The same claim about the compare pass. What it writes is what the flag description says is
705    /// left of a comparison, so the exemption is taken from that rather than typed out twice, and
706    /// an entry added there without a rule to go with it shows up here rather than in a build that
707    /// fails somewhere else.
708    #[test]
709    fn every_instruction_exempt_from_a_rule_is_one_the_compare_pass_really_writes() {
710        let mut written: Vec<&str> =
711            x86_64::FLAGS.compares.iter().filter_map(|entry| entry.kept).collect();
712        written.sort_unstable();
713        written.dedup();
714        let mut exempt = COMPARE.to_vec();
715        exempt.sort_unstable();
716        assert_eq!(written, exempt);
717    }
718
719    /// And the same claim about the one the lowering writes, held against the name the target gave
720    /// it rather than against the spelling written above.
721    #[test]
722    fn the_instruction_a_computed_goto_is_exempt_for_is_the_one_the_target_names() {
723        assert_eq!(LABELS, [x86_64::BRANCH.indirect]);
724    }
725
726    /// The rows of the constant table that take nothing yet are exactly the narrow ones waiting on
727    /// the width narrowing, so the day `NARROW` shrinks is the day this says so.
728    ///
729    /// `crate::combine::BUMPS` has a row per instruction this machine has, which is the whole five
730    /// operations at the whole four widths. Four of those instructions arrive out of a rule that is
731    /// not written yet, so four of the rows sit there taking nothing. That is a fact worth holding
732    /// rather than a thing to notice again later.
733    #[test]
734    fn the_constant_runs_that_take_nothing_are_the_ones_no_rule_selects_yet() {
735        let written = heads();
736        let mut waiting = Vec::new();
737        for bump in crate::combine::BUMPS {
738            if !written.contains(&format!("{PREFIX}{}", bump.from).as_str()) {
739                waiting.push(bump.from);
740            }
741        }
742        assert_eq!(waiting, ["or_ri_8", "or_ri_16", "xor_ri_8", "xor_ri_16"]);
743        for from in waiting {
744            assert!(NARROW.contains(&from), "{from} is unselected and is not on the list");
745        }
746    }
747
748    #[test]
749    fn every_described_instruction_is_reachable_from_a_rule() {
750        let written = heads();
751        let combine = combine();
752        for &(opcode, _) in x86_64::INSTS {
753            if combine.contains(&opcode) {
754                continue;
755            }
756            if CONVENTION.contains(&opcode) || LAYOUT.contains(&opcode) || FRAME.contains(&opcode) {
757                continue;
758            }
759            if NARROW.contains(&opcode) || BARRIER.contains(&opcode) || X87.contains(&opcode) {
760                continue;
761            }
762            if ATOMIC.contains(&opcode) || PAYLOAD.contains(&opcode) || HINT.contains(&opcode) {
763                continue;
764            }
765            if CONDITIONAL.contains(&opcode) {
766                continue;
767            }
768            if CARRY.contains(&opcode) {
769                continue;
770            }
771            if COMPARE.contains(&opcode) || TEMPLATE.contains(&opcode) {
772                continue;
773            }
774            if SEARCH.contains(&opcode) || SWAP.contains(&opcode) || WIDE.contains(&opcode) {
775                continue;
776            }
777            if LABELS.contains(&opcode) || STOP.contains(&opcode) {
778                continue;
779            }
780            let head = format!("{PREFIX}{opcode}");
781            assert!(
782                written.contains(&head.as_str()),
783                "{opcode} is described and no rule in {} selects it",
784                TABLE.source
785            );
786        }
787    }
788
789    /// The same claim about the barrier as the ones above make about the convention and the frame:
790    /// the list holds instructions this target really describes, and holds only the ones that have
791    /// no operands, since an instruction with an operand is one a rule could have been written for.
792    #[test]
793    fn every_instruction_exempt_from_a_rule_is_one_the_memory_model_really_writes() {
794        for &opcode in BARRIER {
795            let form = x86_64::form(opcode).expect("an instruction this target describes");
796            assert!(form.operands().is_empty(), "{opcode} has operands, so a rule could name it");
797        }
798    }
799
800    /// The same claim about the instruction a program stops on, which is the barrier's shape
801    /// exactly: no operands, because an instruction with one is an instruction a rule could have
802    /// been written for, and no addressing mode either, because it is given nothing at all.
803    #[test]
804    fn the_instruction_exempt_from_a_rule_because_it_stops_the_program_is_bare() {
805        for &opcode in STOP {
806            let form = x86_64::form(opcode).expect("an instruction this target describes");
807            assert!(form.operands().is_empty(), "{opcode} has operands, so a rule could name it");
808            assert!(!form.takes_mem(), "{opcode} is given an address and stopping needs none");
809        }
810    }
811
812    /// The same claim about the hints, with the one difference between them written down. A hint is
813    /// given an address and nothing else, so it has no operands for the reason a barrier has none
814    /// and it does carry an addressing mode, which is what a rule would have had to match on.
815    #[test]
816    fn every_instruction_exempt_from_a_rule_because_it_is_a_hint_is_given_only_an_address() {
817        for &opcode in HINT {
818            let form = x86_64::form(opcode).expect("an instruction this target describes");
819            assert!(form.operands().is_empty(), "{opcode} has operands, so a rule could name it");
820            assert!(form.takes_mem(), "{opcode} is a hint about an address and is given none");
821        }
822    }
823
824    /// The same claim about the template list. An instruction is exempt for this reason exactly
825    /// when there is nothing about it for a rule to name, and there are two ways to have nothing.
826    /// No operands and no address, which is the hint. Or every operand fixed to one register by the
827    /// description, which is the question put to the processor: a rule names the operands of a term
828    /// and binds them to the values underneath it, and an operand that can be nothing but `rax` is
829    /// not a place a value goes. Either way the whole of the claim holds, which is that there was
830    /// nowhere else for the instruction to come from.
831    #[test]
832    fn every_instruction_exempt_from_a_rule_because_only_a_template_asks_for_it_is_bare() {
833        for &opcode in TEMPLATE {
834            let form = x86_64::form(opcode).expect("an instruction this target describes");
835            let fixed = form
836                .operands()
837                .iter()
838                .all(|desc| matches!(desc.constraint, rucc_target::Constraint::Fixed(_)));
839            assert!(fixed, "{opcode} has an operand a rule could name");
840            assert!(!form.takes_mem(), "{opcode} is given an address, so a rule could name it");
841        }
842    }
843
844    /// The same claim about the bit searches, read off the description that put them there and read
845    /// both ways round. An instruction is exempt for this reason exactly when the machine describes
846    /// it as a search, so the list cannot grow an opcode that is something else, and a search this
847    /// target grows later cannot be left off the list and quietly go unselected with nobody saying
848    /// why. Nothing in the rule set selects one, which is the other half of the reason and is what
849    /// the check above would have caught in any case.
850    #[test]
851    fn every_instruction_exempt_from_a_rule_because_only_a_template_searches_for_a_bit_is_one() {
852        let written = heads();
853        for &opcode in SEARCH {
854            let form = x86_64::form(opcode).expect("an instruction this target describes");
855            assert_eq!(form, x86_64::Form::Search, "{opcode} is not a search");
856            assert!(
857                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
858                "a rule in {} selects {opcode}, which only a template asks for",
859                TABLE.source
860            );
861        }
862        for &(opcode, form) in x86_64::INSTS {
863            if form == x86_64::Form::Search {
864                assert!(SEARCH.contains(&opcode), "{opcode} is a search and is not on the list");
865            }
866        }
867    }
868
869    /// The same claim about the byte reversal, read both ways round the way the searches are, and
870    /// with the one thing that is different about it checked as well: this is the instruction of its
871    /// shape that leaves the condition state alone, which is the whole reason it has a form rather
872    /// than being a unary operation, so a description that stopped saying that would stop being the
873    /// reason this list exists.
874    #[test]
875    fn every_instruction_exempt_from_a_rule_because_only_a_template_turns_a_register_round_is_one()
876    {
877        let written = heads();
878        for &opcode in SWAP {
879            let form = x86_64::form(opcode).expect("an instruction this target describes");
880            assert_eq!(form, x86_64::Form::Swap, "{opcode} is not a byte reversal");
881            assert!(
882                !(x86_64::FLAGS.writes)(opcode),
883                "{opcode} writes the condition state, so it is a unary operation after all"
884            );
885            assert!(
886                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
887                "a rule in {} selects {opcode}, which only a template asks for",
888                TABLE.source
889            );
890        }
891        for &(opcode, form) in x86_64::INSTS {
892            if form == x86_64::Form::Swap {
893                assert!(SWAP.contains(&opcode), "{opcode} is a reversal and is not on the list");
894            }
895        }
896    }
897
898    /// The same claim about the two that work on a pair of registers, read both ways round and with
899    /// the thing that puts them out of reach of a rule checked rather than asserted in prose: each
900    /// writes two registers, and a rule replaces a term with a term, so there is no way to say the
901    /// second answer in the rule language at all. That is the same bar the compare and exchange is
902    /// exempt at, and this list is separate from that one because the reason it is nobody's to select
903    /// is different: an atomic is written by name where it is needed, and nothing in this compiler
904    /// needs one of these.
905    #[test]
906    fn every_instruction_exempt_from_a_rule_because_only_a_template_wants_both_halves_writes_two() {
907        let written = heads();
908        let both = [x86_64::Form::MulWide, x86_64::Form::DivWide];
909        for &opcode in WIDE {
910            let form = x86_64::form(opcode).expect("an instruction this target describes");
911            assert!(both.contains(&form), "{opcode} works on one register rather than on a pair");
912            let defs = form.operands().iter().filter(|desc| desc.role.is_def()).count();
913            assert_eq!(defs, 2, "{opcode} writes {defs} registers and a pair takes two");
914            assert!(
915                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
916                "a rule in {} selects {opcode}, which only a template asks for",
917                TABLE.source
918            );
919        }
920        for &(opcode, form) in x86_64::INSTS {
921            if both.contains(&form) {
922                assert!(WIDE.contains(&opcode), "{opcode} works on a pair and is not on the list");
923            }
924        }
925    }
926
927    /// The same claim about the carry pair, and the one thing that has to be true of them that is
928    /// not true of anything else on any of these lists. An instruction here reads the condition
929    /// state and writes it, which is what makes it half of a pair and not a rewrite of its own, and
930    /// the scheduler will only keep it behind the instruction that set the bit if the target says
931    /// it reads one.
932    #[test]
933    fn every_instruction_exempt_from_a_rule_because_it_reads_a_carry_says_it_reads_the_state() {
934        let written = heads();
935        for &opcode in CARRY {
936            let form = x86_64::form(opcode).expect("an instruction this target describes");
937            let pair = matches!(form, x86_64::Form::AluCarry | x86_64::Form::AluCarryI);
938            assert!(pair, "{opcode} is not one of the pair");
939            assert_eq!(
940                x86_64::FLAGS.reads(opcode),
941                Some(rucc_target::Reads::Carry),
942                "{opcode} does not say it reads the carry, so the scheduler may move it"
943            );
944            assert!(
945                (x86_64::FLAGS.writes)(opcode),
946                "{opcode} is said to leave the condition state alone"
947            );
948            assert!(
949                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
950                "a rule in {} selects {opcode}, which only a template asks for",
951                TABLE.source
952            );
953        }
954        for &(opcode, form) in x86_64::INSTS {
955            if matches!(form, x86_64::Form::AluCarry | x86_64::Form::AluCarryI) {
956                assert!(CARRY.contains(&opcode), "{opcode} reads a carry and is not on the list");
957            }
958        }
959    }
960
961    /// The same claim about the conditional moves, read off the flag description the way the compare
962    /// pass's list is taken from it rather than typed out twice. An instruction is exempt for this
963    /// reason exactly when it reads the condition state and leaves it as it found it, which is what
964    /// says the instruction in front of it is where its meaning comes from. One that wrote the state
965    /// as well would be one a pattern could match on its own.
966    #[test]
967    fn every_instruction_exempt_from_a_rule_because_a_comparison_gives_it_its_meaning_reads_one() {
968        for &opcode in CONDITIONAL {
969            x86_64::form(opcode).expect("an instruction this target describes");
970            assert!(
971                x86_64::FLAGS.reads(opcode).is_some(),
972                "{opcode} reads no comparison, so a rule could name it"
973            );
974            assert!(
975                !(x86_64::FLAGS.writes)(opcode),
976                "{opcode} writes the condition state, so a rule could name it"
977            );
978        }
979    }
980
981    /// The same claim about the atomic list, read off the thing that put the entry there: an
982    /// instruction is exempt for this reason exactly when it writes more than one value, and an
983    /// instruction that writes one is one a rule could have been written for.
984    #[test]
985    fn every_instruction_exempt_from_a_rule_is_one_that_writes_more_than_one_value() {
986        let written = heads();
987        for &opcode in ATOMIC {
988            let form = x86_64::form(opcode).expect("an instruction this target describes");
989            let writes = form.operands().iter().filter(|desc| desc.role.is_def()).count();
990            assert!(writes > 1, "{opcode} writes one value, so a rule could name it");
991            assert!(
992                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
993                "a rule in {} selects {opcode}, which `crate::lower` also writes by hand",
994                TABLE.source
995            );
996        }
997    }
998
999    /// The same claim about the payload list, read off the thing that puts an entry there.
1000    ///
1001    /// Two halves. Each of these writes one value, which is what says the reason above is not the
1002    /// reason here, so a list that grew to cover an instruction the atomic list should have had
1003    /// fails. And there really is more than one operation behind the one IR opcode, which is the
1004    /// whole of why a pattern cannot name any of them, and is a fact about the IR that would stop
1005    /// being true if the operations were ever given opcodes of their own.
1006    #[test]
1007    fn every_instruction_exempt_because_its_operation_is_beside_it_writes_one_value() {
1008        assert!(
1009            rucc_ir::RmwOp::all().count() > 1,
1010            "one operation per opcode would be a head a rule could match"
1011        );
1012        let written = heads();
1013        for &opcode in PAYLOAD {
1014            let form = x86_64::form(opcode).expect("an instruction this target describes");
1015            let writes = form.operands().iter().filter(|desc| desc.role.is_def()).count();
1016            assert_eq!(writes, 1, "{opcode} writes more than one value, so it is the other list's");
1017            assert!(
1018                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
1019                "a rule in {} selects {opcode}, which `crate::lower` also writes by hand",
1020                TABLE.source
1021            );
1022        }
1023    }
1024
1025    /// The staleness rule every list in this project is kept under, on the one list here whose
1026    /// entries are meant to leave. A rule that starts selecting one of these is `tamnd/rucc#375`
1027    /// arriving, and the entry goes with it. An entry naming an instruction nothing describes is a
1028    /// misspelling, and it would sit here exempting nothing.
1029    #[test]
1030    fn an_instruction_a_rule_now_selects_is_off_the_list_of_the_ones_left_for_later() {
1031        let written = heads();
1032        for &opcode in NARROW {
1033            let head = format!("{PREFIX}{opcode}");
1034            assert!(
1035                !written.contains(&head.as_str()),
1036                "a rule in {} selects {opcode} now, so it is not waiting on tamnd/rucc#375",
1037                TABLE.source
1038            );
1039            assert!(
1040                x86_64::INSTS.iter().any(|&(described, _)| described == opcode),
1041                "{opcode} is not an instruction anything describes"
1042            );
1043        }
1044    }
1045
1046    /// The same staleness rule on the x87 pair, and one thing more that is particular to them.
1047    ///
1048    /// They are a pair. An instruction that pushes onto the x87 stack and nothing that pops off it
1049    /// again would leave the stack one deeper than the function found it, which is not a mistake
1050    /// the allocator or the block layout could catch, since neither of them knows the stack is
1051    /// there. So the two arrive together and leave together, and that is what this says.
1052    #[test]
1053    fn the_x87_stack_is_reached_by_a_pair_and_by_nothing_else() {
1054        let written = heads();
1055        for &opcode in X87 {
1056            assert!(
1057                x86_64::INSTS.iter().any(|&(described, _)| described == opcode),
1058                "{opcode} is not an instruction anything describes"
1059            );
1060            assert!(
1061                !written.contains(&format!("{PREFIX}{opcode}").as_str()),
1062                "a rule in {} selects {opcode}, which `crate::lower` also writes by hand",
1063                TABLE.source
1064            );
1065        }
1066        // One way onto the stack per format a value can be read from, one way off it per format a
1067        // value can be written to, the control word pair that is neither, and the arithmetic. The
1068        // count is here as well as in the target description because this list is what says none
1069        // of them is reachable, and a name that arrived here without its partner would be a format
1070        // this target can convert in one direction and not the other.
1071        assert_eq!(X87.len(), 30, "twelve that move a value and eighteen that work on one");
1072    }
1073}