From 1033cf57488d1f79d4298d6bdc0d5aeb850635ff Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 3 Jul 2020 11:01:35 +0300 Subject: [PATCH] use (isub 1 $C) instead (iadd -1 $C) --- cranelift/codegen/src/preopt.peepmatic | 2 +- cranelift/codegen/src/preopt.serialized | Bin 5543 -> 5543 bytes .../peepmatic/crates/runtime/src/operator.rs | 4 ++++ .../peepmatic/crates/runtime/src/optimizer.rs | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cranelift/codegen/src/preopt.peepmatic b/cranelift/codegen/src/preopt.peepmatic index de9dc8342a..c6e18ec695 100644 --- a/cranelift/codegen/src/preopt.peepmatic +++ b/cranelift/codegen/src/preopt.peepmatic @@ -195,4 +195,4 @@ ;; 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)) \ No newline at end of file + (band_imm $(isub 1 $C) $x)) \ No newline at end of file diff --git a/cranelift/codegen/src/preopt.serialized b/cranelift/codegen/src/preopt.serialized index 9b9bc3f01f3a3aac7274b463d5c7dae78ef005b1..7ef6d1264230b7f91c82b8f861a5549f3fef6ea4 100644 GIT binary patch delta 49 wcmZ3kyaP%h+NW**0Hct7c+kpB%t>nUQs~3Rg2X0NqFllK=n! delta 49 xcmZ3ky unreachable!("not a unary unquote operator: {:?}", operator), } } @@ -98,6 +99,7 @@ where UnquoteOperator::Bor => fold_ints!(a, b, |x, y| x | y), UnquoteOperator::Bxor => fold_ints!(a, b, |x, y| x ^ y), UnquoteOperator::Iadd => fold_ints!(a, b, |x, y| x.wrapping_add(y)), + UnquoteOperator::Isub => fold_ints!(a, b, |x, y| x.wrapping_sub(y)), UnquoteOperator::Imul => fold_ints!(a, b, |x, y| x.wrapping_mul(y)), UnquoteOperator::Log2 | UnquoteOperator::Neg => { unreachable!("not a binary unquote operator: {:?}", operator)