Skip to content

Commit

Permalink
changes according review
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGraey committed Jul 6, 2020
1 parent 2048278 commit 3056594
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cranelift/codegen/src/preopt.peepmatic
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@
(=> (when (urem_imm $C $x)
(is-power-of-two $C)
(fits-in-native-word $C))
(band_imm $(isub 1 $C) $x))
(band_imm $(isub $C 1) $x))
Binary file modified cranelift/codegen/src/preopt.serialized
Binary file not shown.
8 changes: 4 additions & 4 deletions cranelift/peepmatic/crates/runtime/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ pub enum UnquoteOperator {
#[peepmatic(params(iNN, iNN), result(iNN))]
Iadd,

/// Compile-time `isub` of two constant values.
#[peepmatic(params(iNN, iNN), result(iNN))]
Isub,

/// Compile-time `imul` of two constant values.
#[peepmatic(params(iNN, iNN), result(iNN))]
Imul,

/// Compile-time `isub` of two constant values.
#[peepmatic(params(iNN, iNN), result(iNN))]
Isub,

/// Take the base-2 log of a power of two integer.
#[peepmatic(params(iNN), result(iNN))]
Log2,
Expand Down
6 changes: 3 additions & 3 deletions cranelift/peepmatic/crates/runtime/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ where
| UnquoteOperator::Bor
| UnquoteOperator::Bxor
| UnquoteOperator::Iadd
| UnquoteOperator::Isub
| UnquoteOperator::Imul => unreachable!("not a unary unquote operator: {:?}", operator),
| UnquoteOperator::Imul
| UnquoteOperator::Isub => unreachable!("not a unary unquote operator: {:?}", operator),
}
}

Expand All @@ -99,8 +99,8 @@ 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::Isub => fold_ints!(a, b, |x, y| x.wrapping_sub(y)),
UnquoteOperator::Log2 | UnquoteOperator::Neg => {
unreachable!("not a binary unquote operator: {:?}", operator)
}
Expand Down

0 comments on commit 3056594

Please sign in to comment.