add bnot to peepmatic + transform rule
This commit is contained in:
@@ -237,6 +237,7 @@ impl Opcode {
|
|||||||
BandImm,
|
BandImm,
|
||||||
Bconst,
|
Bconst,
|
||||||
Bint,
|
Bint,
|
||||||
|
Bnot,
|
||||||
Bor,
|
Bor,
|
||||||
BorImm,
|
BorImm,
|
||||||
Brnz,
|
Brnz,
|
||||||
@@ -549,6 +550,11 @@ unsafe impl<'a, 'b> InstructionSet<'b> for &'a dyn TargetIsa {
|
|||||||
let val = pos.ins().bint(ty, a);
|
let val = pos.ins().bint(ty, a);
|
||||||
pos.func.dfg.value_def(val).unwrap_inst().into()
|
pos.func.dfg.value_def(val).unwrap_inst().into()
|
||||||
}
|
}
|
||||||
|
Operator::Bnot => {
|
||||||
|
let a = part_to_value(pos, root, a).unwrap();
|
||||||
|
let val = pos.ins().bnot(a);
|
||||||
|
pos.func.dfg.value_def(val).unwrap_inst().into()
|
||||||
|
}
|
||||||
Operator::Brnz => {
|
Operator::Brnz => {
|
||||||
let a = part_to_value(pos, root, a).unwrap();
|
let a = part_to_value(pos, root, a).unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,7 @@
|
|||||||
|
|
||||||
;; Replace with negative 1.
|
;; Replace with negative 1.
|
||||||
(=> (bor_imm -1 $x) -1)
|
(=> (bor_imm -1 $x) -1)
|
||||||
|
(=> (bxor_imm -1 $x) (bnot $x))
|
||||||
|
|
||||||
;; Transform `[(x << N) >> N]` into a (un)signed-extending move.
|
;; Transform `[(x << N) >> N]` into a (un)signed-extending move.
|
||||||
;;
|
;;
|
||||||
|
|||||||
Binary file not shown.
@@ -45,6 +45,10 @@ pub enum Operator {
|
|||||||
#[peepmatic(params(bNN), result(iNN))]
|
#[peepmatic(params(bNN), result(iNN))]
|
||||||
Bint,
|
Bint,
|
||||||
|
|
||||||
|
/// `bnot`
|
||||||
|
#[peepmatic(params(iNN), result(iNN))]
|
||||||
|
Bnot,
|
||||||
|
|
||||||
/// `bor`
|
/// `bor`
|
||||||
#[peepmatic(params(iNN, iNN), result(iNN))]
|
#[peepmatic(params(iNN, iNN), result(iNN))]
|
||||||
Bor,
|
Bor,
|
||||||
|
|||||||
Reference in New Issue
Block a user