Modifies fcvt_to_sint and fcvt_to_unit clif to make scalar only
Closes
@@ -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,
)
@@ -3869,35 +3873,37 @@ pub(crate) fn define(
ig.push(
Inst::new(
- "fcvt_to_uint_sat",
+ "fcvt_to_sint",
r#"
- Convert floating point to unsigned integer as fcvt_to_uint does, but
- saturates the input instead of trapping. NaN and negative values are
- converted to 0.
+ 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]),
+ .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_sint",
+ "fcvt_to_uint_sat",
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.
+ Convert floating point to unsigned integer as fcvt_to_uint does, but
+ saturates the input instead of trapping. NaN and negative values are
+ converted to 0.
"#,
&formats.unary,
)
.operands_in(vec![x])
- .operands_out(vec![a])
- .can_trap(true),
+ .operands_out(vec![a]),
);
ig.push(
