diff --git a/cranelift/codegen/src/isa/x64/lower.isle b/cranelift/codegen/src/isa/x64/lower.isle index deb4e32f74..b1ec08e48f 100644 --- a/cranelift/codegen/src/isa/x64/lower.isle +++ b/cranelift/codegen/src/isa/x64/lower.isle @@ -866,28 +866,28 @@ ;; `i64` and smaller. ;; Multiply two registers. -(rule -4 (lower (has_type (fits_in_64 ty) (imul x y))) +(rule -5 (lower (has_type (fits_in_64 ty) (imul x y))) (x64_mul ty x y)) ;; Multiply a register and an immediate. -(rule -2 (lower (has_type (fits_in_64 ty) +(rule -3 (lower (has_type (fits_in_64 ty) (imul x (simm32_from_value y)))) (x64_mul ty x y)) -(rule -3 (lower (has_type (fits_in_64 ty) +(rule -4 (lower (has_type (fits_in_64 ty) (imul (simm32_from_value x) y))) (x64_mul ty y x)) ;; Multiply a register and a memory load. -(rule -1 (lower (has_type (fits_in_64 ty) +(rule -2 (lower (has_type (fits_in_64 ty) (imul x (sinkable_load y)))) (x64_mul ty x (sink_load_to_gpr_mem_imm y))) -(rule 0 (lower (has_type (fits_in_64 ty) +(rule -1 (lower (has_type (fits_in_64 ty) (imul (sinkable_load x) y))) (x64_mul ty y (sink_load_to_gpr_mem_imm x))) diff --git a/cranelift/isle/isle/src/sema.rs b/cranelift/isle/isle/src/sema.rs index 7435623be9..2613d4bf14 100644 --- a/cranelift/isle/isle/src/sema.rs +++ b/cranelift/isle/isle/src/sema.rs @@ -431,8 +431,8 @@ pub struct Rule { /// The right-hand side expression that this rule evaluates upon successful /// match. pub rhs: Expr, - /// The priority of this rule, if any. - pub prio: Option, + /// The priority of this rule, defaulted to 0 if it was missing in the source. + pub prio: i64, /// The source position where this rule is defined. pub pos: Pos, } @@ -1394,7 +1394,7 @@ impl TermEnv { lhs, iflets, rhs, - prio: rule.prio, + prio: rule.prio.unwrap_or(0), pos, }); } diff --git a/cranelift/isle/isle/src/trie.rs b/cranelift/isle/isle/src/trie.rs index 02a183816e..6ac909b3f7 100644 --- a/cranelift/isle/isle/src/trie.rs +++ b/cranelift/isle/isle/src/trie.rs @@ -337,7 +337,7 @@ impl<'a> TermFunctionsBuilder<'a> { fn build(&mut self) { for rule in 0..self.termenv.rules.len() { let rule = RuleId(rule); - let prio = self.termenv.rules[rule.index()].prio.unwrap_or(0); + let prio = self.termenv.rules[rule.index()].prio; let (pattern, expr) = lower_rule(self.typeenv, self.termenv, rule); let root_term = self.termenv.rules[rule.index()].lhs.root_term().unwrap();