Modifies fcvt_to_sint and fcvt_to_unit clif to make scalar only (#4794)

Closes #4693.
This commit is contained in:
Johnnie Birch
2022-08-29 08:40:39 -07:00
committed by GitHub
parent 573ae0c60b
commit 6368c6b188

View File

@@ -3845,20 +3845,24 @@ pub(crate) fn define(
.operands_out(vec![x]),
);
let x = &Operand::new("x", Float);
let FloatScalar = &TypeVar::new(
"FloatScalar",
"A scalar only floating point number",
TypeSetBuilder::new().floats(Interval::All).build(),
);
let x = &Operand::new("x", FloatScalar);
let a = &Operand::new("a", IntTo);
ig.push(
Inst::new(
"fcvt_to_uint",
r#"
Convert floating point to unsigned integer.
Converts floating point scalars to unsigned integer.
Each lane in `x` is converted to an unsigned integer by rounding
towards zero. If `x` is NaN or if the unsigned integral value cannot be
represented in the result type, this instruction traps.
Only operates on `x` if it is a scalar. If `x` is NaN or if
the unsigned integral value cannot be represented in the result
type, this instruction traps.
The result type must have the same number of vector lanes as the input.
"#,
&formats.unary,
)
@@ -3867,6 +3871,27 @@ pub(crate) fn define(
.can_trap(true),
);
ig.push(
Inst::new(
"fcvt_to_sint",
r#"
Converts floating point scalars to signed integer.
Only operates on `x` if it is a scalar. If `x` is NaN or if
the unsigned integral value cannot be represented in the result
type, this instruction traps.
"#,
&formats.unary,
)
.operands_in(vec![x])
.operands_out(vec![a])
.can_trap(true),
);
let x = &Operand::new("x", Float);
let a = &Operand::new("a", IntTo);
ig.push(
Inst::new(
"fcvt_to_uint_sat",
@@ -3881,25 +3906,6 @@ pub(crate) fn define(
.operands_out(vec![a]),
);
ig.push(
Inst::new(
"fcvt_to_sint",
r#"
Convert floating point to signed integer.
Each lane in `x` is converted to a signed integer by rounding towards
zero. If `x` is NaN or if the signed integral value cannot be
represented in the result type, this instruction traps.
The result type must have the same number of vector lanes as the input.
"#,
&formats.unary,
)
.operands_in(vec![x])
.operands_out(vec![a])
.can_trap(true),
);
ig.push(
Inst::new(
"fcvt_to_sint_sat",