Remove IFLAGS/FFLAGS types (#5406)

All instructions using the CPU flags types (IFLAGS/FFLAGS) were already
removed.  This patch completes the cleanup by removing all remaining
instructions that define values of CPU flags types, as well as the
types themselves.

Specifically, the following features are removed:
- The IFLAGS and FFLAGS types and the SpecialType category.
- Special handling of IFLAGS and FFLAGS in machinst/isle.rs and
  machinst/lower.rs.
- The ifcmp, ifcmp_imm, ffcmp, iadd_ifcin, iadd_ifcout, iadd_ifcarry,
  isub_ifbin, isub_ifbout, and isub_ifborrow instructions.
- The writes_cpu_flags instruction property.
- The flags verifier pass.
- Flags handling in the interpreter.

All of these features are currently unused; no functional change
intended by this patch.

This addresses https://github.com/bytecodealliance/wasmtime/issues/3249.
This commit is contained in:
Ulrich Weigand
2022-12-09 22:42:03 +01:00
committed by GitHub
parent 6e0a029c35
commit e913cf3647
42 changed files with 55 additions and 1119 deletions

View File

@@ -571,9 +571,6 @@ pub(crate) fn define(
define_simd_arithmetic(&mut ig, formats, imm, entities);
// Operand kind shorthands.
let iflags: &TypeVar = &ValueType::Special(types::Flag::IFlags.into()).into();
let fflags: &TypeVar = &ValueType::Special(types::Flag::FFlags.into()).into();
let i8: &TypeVar = &ValueType::from(LaneType::from(types::Int::I8)).into();
let f32_: &TypeVar = &ValueType::from(LaneType::from(types::Float::F32)).into();
let f64_: &TypeVar = &ValueType::from(LaneType::from(types::Float::F64)).into();
@@ -1671,40 +1668,6 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
let f = &Operand::new("f", iflags);
let x = &Operand::new("x", iB);
let y = &Operand::new("y", iB);
ig.push(
Inst::new(
"ifcmp",
r#"
Compare scalar integers and return flags.
Compare two scalar integer values and return integer CPU flags
representing the result.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![f]),
);
ig.push(
Inst::new(
"ifcmp_imm",
r#"
Compare scalar integer to a constant and return flags.
Like `icmp_imm`, but returns integer CPU flags instead of testing
a specific condition code.
"#,
&formats.binary_imm64,
)
.operands_in(vec![x, Y])
.operands_out(vec![f]),
);
let a = &Operand::new("a", Int);
let x = &Operand::new("x", Int);
let y = &Operand::new("y", Int);
@@ -2043,11 +2006,6 @@ pub(crate) fn define(
let b_in = &Operand::new("b_in", i8).with_doc("Input borrow flag");
let b_out = &Operand::new("b_out", i8).with_doc("Output borrow flag");
let c_if_in = &Operand::new("c_in", iflags);
let c_if_out = &Operand::new("c_out", iflags);
let b_if_in = &Operand::new("b_in", iflags);
let b_if_out = &Operand::new("b_out", iflags);
ig.push(
Inst::new(
"iadd_cin",
@@ -2069,27 +2027,6 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
ig.push(
Inst::new(
"iadd_ifcin",
r#"
Add integers with carry in.
Same as `iadd` with an additional carry flag input. Computes:
```text
a = x + y + c_{in} \pmod 2^B
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.ternary,
)
.operands_in(vec![x, y, c_if_in])
.operands_out(vec![a]),
);
ig.push(
Inst::new(
"iadd_cout",
@@ -2112,28 +2049,6 @@ pub(crate) fn define(
.operands_out(vec![a, c_out]),
);
ig.push(
Inst::new(
"iadd_ifcout",
r#"
Add integers with carry out.
Same as `iadd` with an additional carry flag output.
```text
a &= x + y \pmod 2^B \\
c_{out} &= x+y >= 2^B
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![a, c_if_out]),
);
ig.push(
Inst::new(
"iadd_carry",
@@ -2156,28 +2071,6 @@ pub(crate) fn define(
.operands_out(vec![a, c_out]),
);
ig.push(
Inst::new(
"iadd_ifcarry",
r#"
Add integers with carry in and out.
Same as `iadd` with an additional carry flag input and output.
```text
a &= x + y + c_{in} \pmod 2^B \\
c_{out} &= x + y + c_{in} >= 2^B
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.ternary,
)
.operands_in(vec![x, y, c_if_in])
.operands_out(vec![a, c_if_out]),
);
{
let code = &Operand::new("code", &imm.trapcode);
@@ -2227,27 +2120,6 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
ig.push(
Inst::new(
"isub_ifbin",
r#"
Subtract integers with borrow in.
Same as `isub` with an additional borrow flag input. Computes:
```text
a = x - (y + b_{in}) \pmod 2^B
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.ternary,
)
.operands_in(vec![x, y, b_if_in])
.operands_out(vec![a]),
);
ig.push(
Inst::new(
"isub_bout",
@@ -2270,28 +2142,6 @@ pub(crate) fn define(
.operands_out(vec![a, b_out]),
);
ig.push(
Inst::new(
"isub_ifbout",
r#"
Subtract integers with borrow out.
Same as `isub` with an additional borrow flag output.
```text
a &= x - y \pmod 2^B \\
b_{out} &= x < y
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![a, b_if_out]),
);
ig.push(
Inst::new(
"isub_borrow",
@@ -2314,28 +2164,6 @@ pub(crate) fn define(
.operands_out(vec![a, b_out]),
);
ig.push(
Inst::new(
"isub_ifborrow",
r#"
Subtract integers with borrow in and out.
Same as `isub` with an additional borrow flag input and output.
```text
a &= x - (y + b_{in}) \pmod 2^B \\
b_{out} &= x < y + b_{in}
```
Polymorphic over all scalar integer types, but does not support vector
types.
"#,
&formats.ternary,
)
.operands_in(vec![x, y, b_if_in])
.operands_out(vec![a, b_if_out]),
);
let bits = &TypeVar::new(
"bits",
"Any integer, float, or vector type",
@@ -2848,23 +2676,6 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
let f = &Operand::new("f", fflags);
ig.push(
Inst::new(
"ffcmp",
r#"
Floating point comparison returning flags.
Compares two numbers like `fcmp`, but returns floating point CPU
flags instead of testing a specific condition.
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![f]),
);
let x = &Operand::new("x", Float);
let y = &Operand::new("y", Float);
let z = &Operand::new("z", Float);