Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Cranelift: Remove the `{band,bor,bxor}_not` instructions (#13590)

Nick Fitzgerald9028a48d15a3
diff --git a/cranelift/codegen/meta/src/gen_inst.rs b/cranelift/codegen/meta/src/gen_inst.rs
index c2780baf25..30dd6f4059 100644
--- a/cranelift/codegen/meta/src/gen_inst.rs
+++ b/cranelift/codegen/meta/src/gen_inst.rs
@@ -1565,6 +1565,34 @@ fn gen_stack_access_builders(fmt: &mut Formatter) {
);
}
+/// Emit the `band_not`, `bor_not`, and `bxor_not` `InstBuilder`
+/// backwards-compat/convenience methods.
+///
+/// These fused bitwise-plus-not instructions were removed; each one is
+/// equivalent to a `bnot` of the second operand followed by the corresponding
+/// `band`/`bor`/`bxor`.
+fn gen_bitwise_not_builders(fmt: &mut Formatter) {
+ for (method, op, doc) in [
+ ("band_not", "band", "Bitwise and not: computes `x & ~y`."),
+ ("bor_not", "bor", "Bitwise or not: computes `x | ~y`."),
+ ("bxor_not", "bxor", "Bitwise xor not: computes `x ^ ~y`."),
+ ] {
+ fmt.doc_comment(format!(
+ "{doc}\n\nThis emits a `bnot` of `y` followed by a `{op}`."
+ ));
+ fmt.add_block(
+ &format!("fn {method}(mut self, x: ir::Value, y: ir::Value) -> Value"),
+ |fmt| {
+ fmt.line("let ctrl_typevar = self.data_flow_graph().value_type(y);");
+ fmt.line("let neg = self.build_aux_inst(InstructionData::Unary { opcode: Opcode::Bnot, arg: y }, ctrl_typevar);");
+ fmt.line("let neg = self.data_flow_graph().first_result(neg);");
+ fmtln!(fmt, "self.{op}(x, neg)");
+ },
+ );
+ fmt.empty_line();
+ }
+}
+
/// Generate a Builder trait with methods for all instructions.
fn gen_builder(
instructions: &AllInstructions,
@@ -1602,6 +1630,7 @@ fn gen_builder(
}
gen_stack_access_builders(fmt);
fmt.empty_line();
+ gen_bitwise_not_builders(fmt);
for (i, format) in formats.iter().enumerate() {
gen_format_constructor(format, fmt);
if i + 1 != formats.len() {
diff --git a/cranelift/codegen/meta/src/shared/instructions.rs b/cranelift/codegen/meta/src/shared/instructions.rs
index f3eb5fe770..ccca27c7d2 100644
--- a/cranelift/codegen/meta/src/shared/instructions.rs
+++ b/cranelift/codegen/meta/src/shared/instructions.rs
@@ -2202,48 +2202,6 @@ pub(crate) fn define(
.operands_out(vec![Operand::new("a", bits)]),
);
- ig.push(
- Inst::new(
- "band_not",
- r#"
- Bitwise and not.
-
- Computes `x & ~y`.
- "#,
- &formats.binary,
- )
- .operands_in(vec![Operand::new("x", bits), Operand::new("y", bits)])
- .operands_out(vec![Operand::new("a", bits)]),
- );
-
- ig.push(
- Inst::new(
- "bor_not",
- r#"
- Bitwise or not.
-
- Computes `x | ~y`.
- "#,
- &formats.binary,
- )
- .operands_in(vec![Operand::new("x", bits), Operand::new("y", bits)])
- .operands_out(vec![Operand::new("a", bits)]),
- );
-
- ig.push(
- Inst::new(
- "bxor_not",
- r#"
- Bitwise xor not.
-
- Computes `x ^ ~y`.
- "#,
- &formats.binary,
- )
- .operands_in(vec![Operand::new("x", bits), Operand::new("y", bits)])
- .operands_out(vec![Operand::new("a", bits)]),
- );
-
ig.push(
Inst::new(
"rotl",
diff --git a/cranelift/codegen/src/inst_specs.isle b/cranelift/codegen/src/inst_specs.isle
index 83f703e451..14b435a153 100644
--- a/cranelift/codegen/src/inst_specs.isle
+++ b/cranelift/codegen/src/inst_specs.isle
@@ -138,10 +138,6 @@
(require (or (= (widthof x) 8) (= (widthof x) 16) (= (widthof x) 32) (= (widthof x) 64))))
(instantiate bnot bv_unary_8_to_64)
-(spec (band_not x y)
- (provide (= result (bvand x (bvnot y)))))
-(instantiate band_not bv_binary_8_to_64)
-
(spec (rotl x y)
(provide (= result (rotl x y))))
(instantiate rotl bv_binary_8_to_64)
diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs
index 636c549257..6b6e0e29c4 100644
--- a/cranelift/codegen/src/ir/instructions.rs
+++ b/cranelift/codegen/src/ir/instructions.rs
@@ -1173,12 +1173,12 @@ mod tests {
assert_eq!(x, y);
assert_eq!(x.format(), InstructionFormat::Binary);
- assert_eq!(format!("{:?}", Opcode::BandNot), "BandNot");
- assert_eq!(Opcode::BandNot.to_string(), "band_not");
+ assert_eq!(format!("{:?}", Opcode::StackAddr), "StackAddr");
+ assert_eq!(Opcode::StackAddr.to_string(), "stack_addr");
// Check the matcher.
assert_eq!("iadd".parse::<Opcode>(), Ok(Opcode::Iadd));
- assert_eq!("band_not".parse::<Opcode>(), Ok(Opcode::BandNot));
+ assert_eq!("stack_addr".parse::<Opcode>(), Ok(Opcode::StackAddr));
assert_eq!("iadd\0".parse::<Opcode>(), Err("Unknown opcode"));
assert_eq!("".parse::<Opcode>(), Err("Unknown opcode"));
assert_eq!("\0".parse::<Opcode>(), Err("Unknown opcode"));
diff --git a/cranelift/codegen/src/isa/aarch64/lower.isle b/cranelift/codegen/src/isa/aarch64/lower.isle
index 28eea60536..42659d4c32 100644
--- a/cranelift/codegen/src/isa/aarch64/lower.isle
+++ b/cranelift/codegen/src/isa/aarch64/lower.isle
@@ -1386,7 +1386,7 @@
(rule (lower (has_type $I128 (band _ x y))) (i128_alu_bitop (ALUOp.And) $I64 x y))
;; Specialized lowerings for `(band x (bnot y))` which is additionally produced
-;; by Cranelift's `band_not` instruction that is legalized into the simpler
+;; by Cranelift's `band_not` builder method, which emits the simpler
;; forms early on.
(rule band_not_right 1 (lower (has_type (fits_in_64 (ty_int ty)) (band _ x (bnot _ y))))
(alu_rs_imm_logic (ALUOp.AndNot) ty x y))
@@ -1423,7 +1423,7 @@
(rule (lower (has_type $I128 (bor _ x y))) (i128_alu_bitop (ALUOp.Orr) $I64 x y))
;; Specialized lowerings for `(bor x (bnot y))` which is additionally produced
-;; by Cranelift's `bor_not` instruction that is legalized into the simpler
+;; by Cranelift's `bor_not` builder method, which emits the simpler
;; forms early on.
(rule bor_not_right 1 (lower (has_type (fits_in_64 (ty_int ty)) (bor _ x (bnot _ y))))
(alu_rs_imm_logic (ALUOp.OrrNot) ty x y))
@@ -1490,7 +1490,7 @@
(rule (lower (has_type $I128 (bxor _ x y))) (i128_alu_bitop (ALUOp.Eor) $I64 x y))
;; Specialized lowerings for `(bxor x (bnot y))` which is additionally produced
-;; by Cranelift's `bxor_not` instruction that is legalized into the simpler
+;; by Cranelift's `bxor_not` builder method, which emits the simpler
;; forms early on.
(rule bxor_not_right 1 (lower (has_type (fits_in_64 (ty_int ty)) (bxor _ x (bnot _ y))))
diff --git a/cranelift/codegen/src/isa/riscv64/lower.isle b/cranelift/codegen/src/isa/riscv64/lower.isle
index a074c9f903..3f198de859 100644
--- a/cranelift/codegen/src/isa/riscv64/lower.isle
+++ b/cranelift/codegen/src/isa/riscv64/lower.isle
@@ -742,7 +742,7 @@
(lower_float_binary (AluOPRRR.And) x y $F32))
;; Specialized lowerings for `(band x (bnot y))` which is additionally produced
-;; by Cranelift's `band_not` instruction that is legalized into the simpler
+;; by Cranelift's `band_not` builder method, which emits the simpler
;; forms early on.
(rule 5 (lower (has_type (fits_in_64 (ty_int ty)) (band _ x (bnot _ y))))
@@ -877,7 +877,7 @@
(lower_float_binary (AluOPRRR.Or) x y $F32))
;; Specialized lowerings for `(bor x (bnot y))` which is additionally produced
-;; by Cranelift's `bor_not` instruction that is legalized into the simpler
+;; by Cranelift's `bor_not` builder method, which emits the simpler
;; forms early on.
(rule 5 (lower (has_type (fits_in_64 (ty_int ty)) (bor _ x (bnot _ y))))
diff --git a/cranelift/codegen/src/isa/s390x/lower.isle b/cranelift/codegen/src/isa/s390x/lower.isle
index 560ed86ddc..b13057466e 100644
--- a/cranelift/codegen/src/isa/s390x/lower.isle
+++ b/cranelift/codegen/src/isa/s390x/lower.isle
@@ -1183,7 +1183,7 @@
(vec_eval ty 0b00000001 x y z))
;; Specialized lowerings for `(band x (bnot y))` which is additionally produced
-;; by Cranelift's `band_not` instruction that is legalized into the simpler
+;; by Cranelift's `band_not` builder method, which emits the simpler
;; forms early on.
;; z15 version using a single instruction.
@@ -1307,7 +1307,7 @@
(vec_eval ty 0b01111111 x y z))
;; Specialized lowerings for `(bor x (bnot y))` which is additionally produced
-;; by Cranelift's `bor_not` instruction that is legalized into the simpler
+;; by Cranelift's `bor_not` builder method, which emits the simpler
;; forms early on.
;; z15 version using a single instruction.
@@ -1451,7 +1451,7 @@
(vec_xor $F64X2 x y))
;; Specialized lowerings for `(bxor x (bnot y))` which is additionally produced
-;; by Cranelift's `bxor_not` instruction that is legalized into the simpler
+;; by Cranelift's `bxor_not` builder method, which emits the simpler
;; forms early on.
;; z15 version using a single instruction.
diff --git a/cranelift/codegen/src/isa/x64/lower.isle b/cranelift/codegen/src/isa/x64/lower.isle
index 8bf69de5eb..6e337571c9 100644
--- a/cranelift/codegen/src/isa/x64/lower.isle
+++ b/cranelift/codegen/src/isa/x64/lower.isle
@@ -371,7 +371,7 @@
(and_i128 x y))
;; Specialized lowerings for `(band x (bnot y))` which is additionally produced
-;; by Cranelift's `band_not` instruction that is legalized into the simpler
+;; by Cranelift's `band_not` builder method, which emits the simpler
;; forms early on.
(decl sse_and_not (Type Xmm XmmMem128) Xmm)
diff --git a/cranelift/codegen/src/legalizer/mod.rs b/cranelift/codegen/src/legalizer/mod.rs
index 07fa679836..978b6832f3 100644
--- a/cranelift/codegen/src/legalizer/mod.rs
+++ b/cranelift/codegen/src/legalizer/mod.rs
@@ -98,42 +98,8 @@ pub fn simple_legalize(func: &mut ir::Function, isa: &dyn TargetIsa) {
global_value,
} => expand_global_value(inst, func, isa, global_value),
- InstructionData::Binary { opcode, args } => expand_binary(func, inst, opcode, args),
-
_ => WalkCommand::Continue,
});
trace!("Post-legalization function:\n{}", func.display());
}
-
-fn expand_binary(
- func: &mut ir::Function,
- inst: ir::Inst,
- opcode: ir::Opcode,
- args: [ir::Value; 2],
-) -> WalkCommand {
- let mut pos = FuncCursor::new(func);
- pos.goto_inst(inst);
-
- // Legalize the fused bitwise-plus-not instructions into simpler
- // instructions to assist with optimizations. Lowering will pattern match
- // this sequence regardless when architectures support the instruction
- // natively.
- match opcode {
- ir::Opcode::BandNot => {
- let neg = pos.ins().bnot(args[1]);
- pos.func.replace(inst).band(args[0], neg);
- }
- ir::Opcode::BorNot => {
- let neg = pos.ins().bnot(args[1]);
- pos.func.replace(inst).bor(args[0], neg);
- }
- ir::Opcode::BxorNot => {
- let neg = pos.ins().bnot(args[1]);
- pos.func.replace(inst).bxor(args[0], neg);
- }
- _ => {}
- }
-
- WalkCommand::Continue
-}
diff --git a/cranelift/filetests/filetests/egraph/bitops.clif b/cranelift/filetests/filetests/egraph/bitops.clif
index 7db5432685..7e27f20aef 100644
--- a/cranelift/filetests/filetests/egraph/bitops.clif
+++ b/cranelift/filetests/filetests/egraph/bitops.clif
@@ -206,7 +206,8 @@ block0(v0: i32x4):
function %issue_13229_band_not_f64(f64) {
block0(v0: f64):
- v1 = band_not v0, v0
+ v2 = bnot v0
+ v1 = band v0, v2
return
}
diff --git a/cranelift/filetests/filetests/egraph/icmp.clif b/cranelift/filetests/filetests/egraph/icmp.clif
index f1a025122a..3b1a2771f5 100644
--- a/cranelift/filetests/filetests/egraph/icmp.clif
+++ b/cranelift/filetests/filetests/egraph/icmp.clif
@@ -207,7 +207,8 @@ function %issue_10929_no_crash_on_icmp_vectors() -> i32x4 {
block0():
v1 = vconst.i32x4 const0
- v2 = bxor_not v1, v1
+ v4 = bnot v1
+ v2 = bxor v1, v4
v3 = icmp.i32x4 ne v1, v2
return v3
}
diff --git a/cranelift/filetests/filetests/isa/aarch64/arithmetic.clif b/cranelift/filetests/filetests/isa/aarch64/arithmetic.clif
index 9ee1a0b91a..3ca8f00984 100644
--- a/cranelift/filetests/filetests/isa/aarch64/arithmetic.clif
+++ b/cranelift/filetests/filetests/isa/aarch64/arithmetic.clif
@@ -382,7 +382,8 @@ block0(v0: i64, v1: i64):
function %f21(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -398,7 +399,8 @@ block0(v0: i64, v1: i64):
function %f22(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -414,7 +416,8 @@ block0(v0: i64, v1: i64):
function %f23(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/aarch64/bitops.clif b/cranelift/filetests/filetests/isa/aarch64/bitops.clif
index c7e22aa5a9..861bdb1fb3 100644
--- a/cranelift/filetests/filetests/isa/aarch64/bitops.clif
+++ b/cranelift/filetests/filetests/isa/aarch64/bitops.clif
@@ -1166,7 +1166,8 @@ block0(v0: i64, v1: i64):
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1182,7 +1183,8 @@ block0(v0: i32, v1: i32):
function %band_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1198,7 +1200,8 @@ block0(v0: i64, v1: i64):
function %band_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1216,7 +1219,8 @@ block0(v0: i128, v1: i128):
function %band_not_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1232,7 +1236,8 @@ block0(v0: i8x16, v1: i8x16):
function %band_not_i8x8(i8x8, i8x8) -> i8x8 {
block0(v0: i8x8, v1: i8x8):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1248,7 +1253,8 @@ block0(v0: i8x8, v1: i8x8):
function %band_not_i16x4(i16x4, i16x4) -> i16x4 {
block0(v0: i16x4, v1: i16x4):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1265,7 +1271,8 @@ block0(v0: i16x4, v1: i16x4):
function %band_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1283,7 +1290,8 @@ function %band_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = band_not v0, v3
+ v5 = bnot v3
+ v4 = band v0, v5
return v4
}
@@ -1299,7 +1307,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1315,7 +1324,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1331,7 +1341,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1349,7 +1360,8 @@ block0(v0: i128, v1: i128):
function %bor_not_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1365,7 +1377,8 @@ block0(v0: i8x16, v1: i8x16):
function %bor_not_i8x8(i8x8, i8x8) -> i8x8 {
block0(v0: i8x8, v1: i8x8):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1381,7 +1394,8 @@ block0(v0: i8x8, v1: i8x8):
function %bor_not_i16x4(i16x4, i16x4) -> i16x4 {
block0(v0: i16x4, v1: i16x4):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1398,7 +1412,8 @@ block0(v0: i16x4, v1: i16x4):
function %bor_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1416,7 +1431,8 @@ function %bor_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = bor_not v0, v3
+ v5 = bnot v3
+ v4 = bor v0, v5
return v4
}
@@ -1432,7 +1448,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1448,7 +1465,8 @@ block0(v0: i32, v1: i32):
function %bxor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1464,7 +1482,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1483,7 +1502,8 @@ block0(v0: i128, v1: i128):
function %bxor_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1501,7 +1521,8 @@ function %bxor_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = bxor_not v0, v3
+ v5 = bnot v3
+ v4 = bxor v0, v5
return v4
}
diff --git a/cranelift/filetests/filetests/isa/riscv64/arithmetic.clif b/cranelift/filetests/filetests/isa/riscv64/arithmetic.clif
index b78a72a7ae..edc15a30d8 100644
--- a/cranelift/filetests/filetests/isa/riscv64/arithmetic.clif
+++ b/cranelift/filetests/filetests/isa/riscv64/arithmetic.clif
@@ -398,7 +398,8 @@ block0(v0: i64, v1: i64):
function %f21(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -416,7 +417,8 @@ block0(v0: i64, v1: i64):
function %f22(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -434,7 +436,8 @@ block0(v0: i64, v1: i64):
function %f23(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/riscv64/bitops-optimized.clif b/cranelift/filetests/filetests/isa/riscv64/bitops-optimized.clif
index c7a428c706..e1876f8fe4 100644
--- a/cranelift/filetests/filetests/isa/riscv64/bitops-optimized.clif
+++ b/cranelift/filetests/filetests/isa/riscv64/bitops-optimized.clif
@@ -4,7 +4,8 @@ target riscv64 has_zbb
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -37,7 +38,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/riscv64/bitops.clif b/cranelift/filetests/filetests/isa/riscv64/bitops.clif
index f0f8b307f7..861cb38918 100644
--- a/cranelift/filetests/filetests/isa/riscv64/bitops.clif
+++ b/cranelift/filetests/filetests/isa/riscv64/bitops.clif
@@ -1456,7 +1456,8 @@ block0(v0: i64, v1: i64):
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1474,7 +1475,8 @@ block0(v0: i32, v1: i32):
function %band_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1492,7 +1494,8 @@ block0(v0: i64, v1: i64):
function %band_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1519,7 +1522,8 @@ block0(v0: i128, v1: i128):
function %band_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -1541,7 +1545,8 @@ function %band_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = band_not v0, v3
+ v5 = bnot v3
+ v4 = band v0, v5
return v4
}
@@ -1561,7 +1566,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1579,7 +1585,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1597,7 +1604,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1624,7 +1632,8 @@ block0(v0: i128, v1: i128):
function %bor_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -1646,7 +1655,8 @@ function %bor_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = bor_not v0, v3
+ v5 = bnot v3
+ v4 = bor v0, v5
return v4
}
@@ -1666,7 +1676,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1684,7 +1695,8 @@ block0(v0: i32, v1: i32):
function %bxor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1702,7 +1714,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1729,7 +1742,8 @@ block0(v0: i128, v1: i128):
function %bxor_not_i64_constant(i64) -> i64 {
block0(v0: i64):
v1 = iconst.i64 4
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -1751,7 +1765,8 @@ function %bxor_not_i64_constant_shift(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = iconst.i64 4
v3 = ishl.i64 v1, v2
- v4 = bxor_not v0, v3
+ v5 = bnot v3
+ v4 = bxor v0, v5
return v4
}
diff --git a/cranelift/filetests/filetests/isa/s390x/bitops-optimized.clif b/cranelift/filetests/filetests/isa/s390x/bitops-optimized.clif
index 4d73cba3bb..52cb4848c4 100644
--- a/cranelift/filetests/filetests/isa/s390x/bitops-optimized.clif
+++ b/cranelift/filetests/filetests/isa/s390x/bitops-optimized.clif
@@ -4,7 +4,8 @@ target s390x has_mie3
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -39,7 +40,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -74,7 +76,8 @@ block0(v0: i32, v1: i32):
function %bxor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bxor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/s390x/bitwise-arch13.clif b/cranelift/filetests/filetests/isa/s390x/bitwise-arch13.clif
index 465c697f2e..3e1611c2b3 100644
--- a/cranelift/filetests/filetests/isa/s390x/bitwise-arch13.clif
+++ b/cranelift/filetests/filetests/isa/s390x/bitwise-arch13.clif
@@ -8,7 +8,8 @@ target s390x arch13
function %band_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -25,7 +26,8 @@ block0(v0: i64, v1: i64):
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -42,7 +44,8 @@ block0(v0: i32, v1: i32):
function %band_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = band_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -59,7 +62,8 @@ block0(v0: i16, v1: i16):
function %band_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = band_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -76,7 +80,8 @@ block0(v0: i8, v1: i8):
function %bor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -93,7 +98,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -110,7 +116,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = bor_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -127,7 +134,8 @@ block0(v0: i16, v1: i16):
function %bor_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -144,7 +152,8 @@ block0(v0: i8, v1: i8):
function %bxor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -161,7 +170,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bxor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -178,7 +188,8 @@ block0(v0: i32, v1: i32):
function %bxor_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = bxor_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -195,7 +206,8 @@ block0(v0: i16, v1: i16):
function %bxor_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bxor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/s390x/bitwise.clif b/cranelift/filetests/filetests/isa/s390x/bitwise.clif
index aa617f1606..fa4b3069bc 100644
--- a/cranelift/filetests/filetests/isa/s390x/bitwise.clif
+++ b/cranelift/filetests/filetests/isa/s390x/bitwise.clif
@@ -531,7 +531,8 @@ block0(v0: i8, v1: i64):
function %band_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = band_not.i128 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -553,7 +554,8 @@ block0(v0: i128, v1: i128):
function %band_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = band_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -573,7 +575,8 @@ block0(v0: i64, v1: i64):
function %band_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = band_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -591,7 +594,8 @@ block0(v0: i32, v1: i32):
function %band_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = band_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -609,7 +613,8 @@ block0(v0: i16, v1: i16):
function %band_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = band_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -627,7 +632,8 @@ block0(v0: i8, v1: i8):
function %bor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bor_not.i128 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -649,7 +655,8 @@ block0(v0: i128, v1: i128):
function %bor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -669,7 +676,8 @@ block0(v0: i64, v1: i64):
function %bor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -687,7 +695,8 @@ block0(v0: i32, v1: i32):
function %bor_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = bor_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -705,7 +714,8 @@ block0(v0: i16, v1: i16):
function %bor_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -723,7 +733,8 @@ block0(v0: i8, v1: i8):
function %bxor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bxor_not.i128 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -745,7 +756,8 @@ block0(v0: i128, v1: i128):
function %bxor_not_i64(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
- v2 = bxor_not.i64 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -765,7 +777,8 @@ block0(v0: i64, v1: i64):
function %bxor_not_i32(i32, i32) -> i32 {
block0(v0: i32, v1: i32):
- v2 = bxor_not.i32 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -783,7 +796,8 @@ block0(v0: i32, v1: i32):
function %bxor_not_i16(i16, i16) -> i16 {
block0(v0: i16, v1: i16):
- v2 = bxor_not.i16 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -801,7 +815,8 @@ block0(v0: i16, v1: i16):
function %bxor_not_i8(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bxor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/s390x/vec-bitwise.clif b/cranelift/filetests/filetests/isa/s390x/vec-bitwise.clif
index ca440f87ed..e5e8b843bd 100644
--- a/cranelift/filetests/filetests/isa/s390x/vec-bitwise.clif
+++ b/cranelift/filetests/filetests/isa/s390x/vec-bitwise.clif
@@ -196,7 +196,8 @@ block0(v0: i8x16, v1: i8x16):
function %band_not_i64x2(i64x2, i64x2) -> i64x2 {
block0(v0: i64x2, v1: i64x2):
- v2 = band_not.i64x2 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -212,7 +213,8 @@ block0(v0: i64x2, v1: i64x2):
function %band_not_i32x4(i32x4, i32x4) -> i32x4 {
block0(v0: i32x4, v1: i32x4):
- v2 = band_not.i32x4 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -228,7 +230,8 @@ block0(v0: i32x4, v1: i32x4):
function %band_not_i16x8(i16x8, i16x8) -> i16x8 {
block0(v0: i16x8, v1: i16x8):
- v2 = band_not.i16x8 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -244,7 +247,8 @@ block0(v0: i16x8, v1: i16x8):
function %band_not_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
- v2 = band_not.i8x16 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -260,7 +264,8 @@ block0(v0: i8x16, v1: i8x16):
function %bor_not_i64x2(i64x2, i64x2) -> i64x2 {
block0(v0: i64x2, v1: i64x2):
- v2 = bor_not.i64x2 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -276,7 +281,8 @@ block0(v0: i64x2, v1: i64x2):
function %bor_not_i32x4(i32x4, i32x4) -> i32x4 {
block0(v0: i32x4, v1: i32x4):
- v2 = bor_not.i32x4 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -292,7 +298,8 @@ block0(v0: i32x4, v1: i32x4):
function %bor_not_i16x8(i16x8, i16x8) -> i16x8 {
block0(v0: i16x8, v1: i16x8):
- v2 = bor_not.i16x8 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -308,7 +315,8 @@ block0(v0: i16x8, v1: i16x8):
function %bor_not_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
- v2 = bor_not.i8x16 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -324,7 +332,8 @@ block0(v0: i8x16, v1: i8x16):
function %bxor_not_i64x2(i64x2, i64x2) -> i64x2 {
block0(v0: i64x2, v1: i64x2):
- v2 = bxor_not.i64x2 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -340,7 +349,8 @@ block0(v0: i64x2, v1: i64x2):
function %bxor_not_i32x4(i32x4, i32x4) -> i32x4 {
block0(v0: i32x4, v1: i32x4):
- v2 = bxor_not.i32x4 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -356,7 +366,8 @@ block0(v0: i32x4, v1: i32x4):
function %bxor_not_i16x8(i16x8, i16x8) -> i16x8 {
block0(v0: i16x8, v1: i16x8):
- v2 = bxor_not.i16x8 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
@@ -372,7 +383,8 @@ block0(v0: i16x8, v1: i16x8):
function %bxor_not_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
- v2 = bxor_not.i8x16 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/x64/band_not_bmi1.clif b/cranelift/filetests/filetests/isa/x64/band_not_bmi1.clif
index 64cbc385c8..60ead0da3d 100644
--- a/cranelift/filetests/filetests/isa/x64/band_not_bmi1.clif
+++ b/cranelift/filetests/filetests/isa/x64/band_not_bmi1.clif
@@ -4,7 +4,8 @@ target x86_64 has_bmi1
function %f1(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/x64/simd-bitwise-avx.clif b/cranelift/filetests/filetests/isa/x64/simd-bitwise-avx.clif
index bbb426694f..7003f66306 100644
--- a/cranelift/filetests/filetests/isa/x64/simd-bitwise-avx.clif
+++ b/cranelift/filetests/filetests/isa/x64/simd-bitwise-avx.clif
@@ -94,7 +94,8 @@ block0(v0: f32x4, v1: f32x4):
function %band_not_f32x4(f32x4, f32x4) -> f32x4 {
block0(v0: f32x4, v1: f32x4):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -119,7 +120,8 @@ block0(v0: f32x4, v1: f32x4):
function %band_not_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -144,7 +146,8 @@ block0(v0: f64x2, v1: f64x2):
function %band_not_i64x2(i64x2, i64x2) -> i64x2 {
block0(v0: i64x2, v1: i64x2):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/isa/x64/widen-narrow-load.clif b/cranelift/filetests/filetests/isa/x64/widen-narrow-load.clif
index 4589eaf550..c7705a09f2 100644
--- a/cranelift/filetests/filetests/isa/x64/widen-narrow-load.clif
+++ b/cranelift/filetests/filetests/isa/x64/widen-narrow-load.clif
@@ -5,7 +5,8 @@ target x86_64 has_bmi1
function %andn_i8_load(i64, i8) -> i8 {
block0(v0: i64, v1: i8):
v2 = load.i8 v0
- v3 = band_not v2, v1
+ v4 = bnot v1
+ v3 = band v2, v4
return v3
}
@@ -33,7 +34,8 @@ block0(v0: i64, v1: i8):
function %andn_i16_load(i64, i16) -> i16 {
block0(v0: i64, v1: i16):
v2 = load.i16 v0
- v3 = band_not v2, v1
+ v4 = bnot v1
+ v3 = band v2, v4
return v3
}
@@ -61,7 +63,8 @@ block0(v0: i64, v1: i16):
function %andn_i32_load(i64, i32) -> i32 {
block0(v0: i64, v1: i32):
v2 = load.i32 v0
- v3 = band_not v2, v1
+ v4 = bnot v1
+ v3 = band v2, v4
return v3
}
@@ -87,7 +90,8 @@ block0(v0: i64, v1: i32):
function %andn_i64_load(i64, i64) -> i64 {
block0(v0: i64, v1: i64):
v2 = load.i64 v0
- v3 = band_not v2, v1
+ v4 = bnot v1
+ v3 = band v2, v4
return v3
}
diff --git a/cranelift/filetests/filetests/runtests/bnot.clif b/cranelift/filetests/filetests/runtests/bnot.clif
index 1ad506248a..ac28dd5036 100644
--- a/cranelift/filetests/filetests/runtests/bnot.clif
+++ b/cranelift/filetests/filetests/runtests/bnot.clif
@@ -46,7 +46,8 @@ block0(v0: i64):
function %band_not(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = band_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
@@ -56,7 +57,8 @@ block0(v0: i8, v1: i8):
function %bor_not(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
@@ -66,7 +68,8 @@ block0(v0: i8, v1: i8):
function %bxor_not(i8, i8) -> i8 {
block0(v0: i8, v1: i8):
- v2 = bxor_not.i8 v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
diff --git a/cranelift/filetests/filetests/runtests/i128-bandnot.clif b/cranelift/filetests/filetests/runtests/i128-bandnot.clif
index f341b9680a..093b5b8277 100644
--- a/cranelift/filetests/filetests/runtests/i128-bandnot.clif
+++ b/cranelift/filetests/filetests/runtests/i128-bandnot.clif
@@ -7,7 +7,8 @@ target s390x
function %band_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
; run: %band_not_i128(0, 0) == 0
diff --git a/cranelift/filetests/filetests/runtests/i128-bornot.clif b/cranelift/filetests/filetests/runtests/i128-bornot.clif
index 7d7a484036..fde3d77046 100644
--- a/cranelift/filetests/filetests/runtests/i128-bornot.clif
+++ b/cranelift/filetests/filetests/runtests/i128-bornot.clif
@@ -7,7 +7,8 @@ target s390x
function %bor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
; run: %bor_not_i128(0, 0) == -1
diff --git a/cranelift/filetests/filetests/runtests/i128-bxornot.clif b/cranelift/filetests/filetests/runtests/i128-bxornot.clif
index e352073db6..fa35ab6024 100644
--- a/cranelift/filetests/filetests/runtests/i128-bxornot.clif
+++ b/cranelift/filetests/filetests/runtests/i128-bxornot.clif
@@ -7,7 +7,8 @@ target s390x
function %bxor_not_i128(i128, i128) -> i128 {
block0(v0: i128, v1: i128):
- v2 = bxor_not v0, v1
+ v3 = bnot v1
+ v2 = bxor v0, v3
return v2
}
; run: %bxor_not_i128(0, 0) == -1
diff --git a/cranelift/filetests/filetests/runtests/simd-bandnot-64bit.clif b/cranelift/filetests/filetests/runtests/simd-bandnot-64bit.clif
index 28ba165759..8e57d79d61 100644
--- a/cranelift/filetests/filetests/runtests/simd-bandnot-64bit.clif
+++ b/cranelift/filetests/filetests/runtests/simd-bandnot-64bit.clif
@@ -9,7 +9,8 @@ target riscv64 has_v has_c has_zcb
function %band_not_i8x8(i8x8, i8x8) -> i8x8 {
block0(v0:i8x8, v1:i8x8):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
; run: %band_not_i8x8([0xFE 0xDC 0xBA 0x98 0x76 0x54 0x32 0x10], [0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF]) == [0xFE 0xDC 0xBA 0x98 0x76 0x54 0x32 0x10]
@@ -18,7 +19,8 @@ block0(v0:i8x8, v1:i8x8):
function %band_not_i16x4(i16x4, i16x4) -> i16x4 {
block0(v0:i16x4, v1:i16x4):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
; run: %band_not_i16x4([0xFEDC 0xBA98 0x7654 0x3210], [0x0123 0x4567 0x89AB 0xCDEF]) == [0xFEDC 0xBA98 0x7654 0x3210]
@@ -27,7 +29,8 @@ block0(v0:i16x4, v1:i16x4):
function %band_not_i32x2(i32x2, i32x2) -> i32x2 {
block0(v0:i32x2, v1:i32x2):
- v2 = band_not v0, v1
+ v3 = bnot v1
+ v2 = band v0, v3
return v2
}
; run: %band_not_i32x2([0xFEDCBA98 0x76543210], [0x01234567 0x89ABCDEF]) == [0xFEDCBA98 0x76543210]
diff --git a/cranelift/filetests/filetests/runtests/simd-bornot-64bit.clif b/cranelift/filetests/filetests/runtests/simd-bornot-64bit.clif
index 651ae2b869..faef74c09a 100644
--- a/cranelift/filetests/filetests/runtests/simd-bornot-64bit.clif
+++ b/cranelift/filetests/filetests/runtests/simd-bornot-64bit.clif
@@ -9,7 +9,8 @@ target riscv64 has_v has_c has_zcb
function %bor_not_i8x8(i8x8, i8x8) -> i8x8 {
block0(v0:i8x8, v1:i8x8):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
; run: %bor_not_i8x8([0xFE 0xDC 0xBA 0x98 0x76 0x54 0x32 0x10], [0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF]) == [0xFE 0xDC 0xBA 0x98 0x76 0x54 0x32 0x10]
@@ -18,7 +19,8 @@ block0(v0:i8x8, v1:i8x8):
function %bor_not_i16x4(i16x4, i16x4) -> i16x4 {
block0(v0:i16x4, v1:i16x4):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
; run: %bor_not_i16x4([0xFEDC 0xBA98 0x7654 0x3210], [0x0123 0x4567 0x89AB 0xCDEF]) == [0xFEDC 0xBA98 0x7654 0x3210]
@@ -27,7 +29,8 @@ block0(v0:i16x4, v1:i16x4):
function %bor_not_i32x2(i32x2, i32x2) -> i32x2 {
block0(v0:i32x2, v1:i32x2):
- v2 = bor_not v0, v1
+ v3 = bnot v1
+ v2 = bor v0, v3
return v2
}
; run: %bor_not_i32x2([0xFEDCBA98 0x76543210], [0x01234567 0x89ABCDEF]) == [0xFEDCBA98 0x76543210]
diff --git a/cranelift/filetests/filetests/runtests/simd-logical.clif b/cranelift/filetests/filetests/runtests/simd-logical.clif
index 9dd6fdd16c..0f030a2aac 100644
--- a/cranelift/filetests/filetests/runtests/simd-logical.clif
+++ b/cranelift/filetests/filetests/runtests/simd-logical.clif
@@ -24,7 +24,8 @@ function %band_not() -> i8 {
block0:
v0 = vconst.i16x8 [1 0 0 0 0 0 0 0]
v1 = vconst.i16x8 [0 0 0 0 0 0 0 0]
- v2 = band_not v0, v1
+ v6 = bnot v1
+ v2 = band v0, v6
v3 = extractlane v2, 0
v5 = iconst.i16 1
v4 = icmp eq v3, v5
diff --git a/cranelift/fuzzgen/src/function_generator.rs b/cranelift/fuzzgen/src/function_generator.rs
index ba88971438..1de9371e51 100644
--- a/cranelift/fuzzgen/src/function_generator.rs
+++ b/cranelift/fuzzgen/src/function_generator.rs
@@ -580,12 +580,7 @@ fn valid_for_target(triple: &Triple, op: Opcode, args: &[Type], rets: &[Type]) -
// https://github.com/bytecodealliance/wasmtime/issues/4870
(Opcode::Bnot, &[F32 | F64]),
(
- Opcode::Band
- | Opcode::Bor
- | Opcode::Bxor
- | Opcode::BandNot
- | Opcode::BorNot
- | Opcode::BxorNot,
+ Opcode::Band | Opcode::Bor | Opcode::Bxor,
&([F32, F32] | [F64, F64])
),
// https://github.com/bytecodealliance/wasmtime/issues/5198
@@ -645,12 +640,7 @@ fn valid_for_target(triple: &Triple, op: Opcode, args: &[Type], rets: &[Type]) -
),
(Opcode::Bnot, &[F32 | F64]),
(
- Opcode::Band
- | Opcode::Bor
- | Opcode::Bxor
- | Opcode::BandNot
- | Opcode::BorNot
- | Opcode::BxorNot,
+ Opcode::Band | Opcode::Bor | Opcode::Bxor,
&([F32, F32] | [F64, F64])
),
(
diff --git a/cranelift/interpreter/src/step.rs b/cranelift/interpreter/src/step.rs
index 717cc48674..4f3e500cdf 100644
--- a/cranelift/interpreter/src/step.rs
+++ b/cranelift/interpreter/src/step.rs
@@ -763,9 +763,6 @@ where
Opcode::Bor => binary(DataValueExt::or, arg(0), arg(1))?,
Opcode::Bxor => binary(DataValueExt::xor, arg(0), arg(1))?,
Opcode::Bnot => unary(DataValueExt::not, arg(0))?,
- Opcode::BandNot => binary(DataValueExt::and, arg(0), DataValueExt::not(arg(1))?)?,
- Opcode::BorNot => binary(DataValueExt::or, arg(0), DataValueExt::not(arg(1))?)?,
- Opcode::BxorNot => binary(DataValueExt::xor, arg(0), DataValueExt::not(arg(1))?)?,
Opcode::Rotl => binary(DataValueExt::rotl, arg(0), shift_amt(ctrl_ty, arg(1))?)?,
Opcode::Rotr => binary(DataValueExt::rotr, arg(0), shift_amt(ctrl_ty, arg(1))?)?,
Opcode::Ishl => binary(DataValueExt::shl, arg(0), shift_amt(ctrl_ty, arg(1))?)?,