Browse Source

add reminder by a power of two peephole rule

pull/1975/head
MaxGraey 4 years ago
parent
commit
d839d83f7e
  1. 5
      cranelift/codegen/src/preopt.peepmatic
  2. BIN
      cranelift/codegen/src/preopt.serialized

5
cranelift/codegen/src/preopt.peepmatic

@ -191,3 +191,8 @@
(=> (when (udiv_imm $C $x)
(is-power-of-two $C))
(ushr_imm $(log2 $C) $x))
;; Reminder by a power of two -> bitwise and with decreased by one constant.
(=> (when (urem_imm $C $x)
(is-power-of-two $C))
(band_imm $(iadd -1 $C) $x))

BIN
cranelift/codegen/src/preopt.serialized

Binary file not shown.
Loading…
Cancel
Save