diff --git a/cranelift/codegen/meta/src/shared/instructions.rs b/cranelift/codegen/meta/src/shared/instructions.rs index 482664dc60..1d126f4ee5 100644 --- a/cranelift/codegen/meta/src/shared/instructions.rs +++ b/cranelift/codegen/meta/src/shared/instructions.rs @@ -2159,7 +2159,7 @@ pub(crate) fn define( "irsub_imm", r#" Immediate reverse wrapping subtraction: `a := Y - x \pmod{2^B}`. - + The immediate operand is a sign extended 64 bit constant. Also works as integer negation when `Y = 0`. Use `iadd_imm` @@ -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",