Skip to content

Commit

Permalink
Comment the new rule for emit_cmp
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottt committed Aug 8, 2022
1 parent d909d2c commit bb4bbfb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cranelift/codegen/src/isa/x64/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -3181,6 +3181,9 @@
(let ((size OperandSize (raw_operand_size_of_type ty)))
(icmp_cond_result (x64_cmp size b a) cc)))

;; As a special case, reverse the arguments to the comparison when the LHS is a
;; constant. This ensures that we avoid moving the constant into a register when
;; performing the comparison.
(rule 1 (emit_cmp cc (and (simm32_from_value a) (value_type ty)) b)
(let ((size OperandSize (raw_operand_size_of_type ty)))
(icmp_cond_result (x64_cmp size a b) (intcc_reverse cc))))
Expand Down

0 comments on commit bb4bbfb

Please sign in to comment.