cranelift: Sign extend immediates in instructions that embed them. (#4602)
* cranelift: Sign extend immediates in instructions that embed them. * cranelift: Clarify imm instruction behaviour * cranelift: Deduplicate imm_const * cranelift: zero extend logical imm ops
This commit is contained in:
@@ -1801,7 +1801,7 @@ pub(crate) fn define(
|
||||
Compare scalar integer to a constant.
|
||||
|
||||
This is the same as the `icmp` instruction, except one operand is
|
||||
an immediate constant.
|
||||
a sign extended 64 bit immediate constant.
|
||||
|
||||
This instruction can only compare scalars. Use `icmp` for
|
||||
lane-wise vector comparisons.
|
||||
@@ -2060,7 +2060,7 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Add immediate integer.
|
||||
|
||||
Same as `iadd`, but one operand is an immediate constant.
|
||||
Same as `iadd`, but one operand is a sign extended 64 bit immediate constant.
|
||||
|
||||
Polymorphic over all scalar integer types, but does not support vector
|
||||
types.
|
||||
@@ -2077,6 +2077,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Integer multiplication by immediate constant.
|
||||
|
||||
Same as `imul`, but one operand is a sign extended 64 bit immediate constant.
|
||||
|
||||
Polymorphic over all scalar integer types, but does not support vector
|
||||
types.
|
||||
"#,
|
||||
@@ -2092,6 +2094,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Unsigned integer division by an immediate constant.
|
||||
|
||||
Same as `udiv`, but one operand is a zero extended 64 bit immediate constant.
|
||||
|
||||
This operation traps if the divisor is zero.
|
||||
"#,
|
||||
&formats.binary_imm64,
|
||||
@@ -2106,6 +2110,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Signed integer division by an immediate constant.
|
||||
|
||||
Same as `sdiv`, but one operand is a sign extended 64 bit immediate constant.
|
||||
|
||||
This operation traps if the divisor is zero, or if the result is not
|
||||
representable in `B` bits two's complement. This only happens
|
||||
when `x = -2^{B-1}, Y = -1`.
|
||||
@@ -2122,6 +2128,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Unsigned integer remainder with immediate divisor.
|
||||
|
||||
Same as `urem`, but one operand is a zero extended 64 bit immediate constant.
|
||||
|
||||
This operation traps if the divisor is zero.
|
||||
"#,
|
||||
&formats.binary_imm64,
|
||||
@@ -2136,6 +2144,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Signed integer remainder with immediate divisor.
|
||||
|
||||
Same as `srem`, but one operand is a sign extended 64 bit immediate constant.
|
||||
|
||||
This operation traps if the divisor is zero.
|
||||
"#,
|
||||
&formats.binary_imm64,
|
||||
@@ -2149,6 +2159,8 @@ 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`
|
||||
with a negative immediate operand for the reverse immediate
|
||||
@@ -2552,7 +2564,7 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Bitwise and with immediate.
|
||||
|
||||
Same as `band`, but one operand is an immediate constant.
|
||||
Same as `band`, but one operand is a zero extended 64 bit immediate constant.
|
||||
|
||||
Polymorphic over all scalar integer types, but does not support vector
|
||||
types.
|
||||
@@ -2569,7 +2581,7 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Bitwise or with immediate.
|
||||
|
||||
Same as `bor`, but one operand is an immediate constant.
|
||||
Same as `bor`, but one operand is a zero extended 64 bit immediate constant.
|
||||
|
||||
Polymorphic over all scalar integer types, but does not support vector
|
||||
types.
|
||||
@@ -2586,7 +2598,7 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Bitwise xor with immediate.
|
||||
|
||||
Same as `bxor`, but one operand is an immediate constant.
|
||||
Same as `bxor`, but one operand is a zero extended 64 bit immediate constant.
|
||||
|
||||
Polymorphic over all scalar integer types, but does not support vector
|
||||
types.
|
||||
@@ -2635,6 +2647,8 @@ pub(crate) fn define(
|
||||
"rotl_imm",
|
||||
r#"
|
||||
Rotate left by immediate.
|
||||
|
||||
Same as `rotl`, but one operand is a zero extended 64 bit immediate constant.
|
||||
"#,
|
||||
&formats.binary_imm64,
|
||||
)
|
||||
@@ -2647,6 +2661,8 @@ pub(crate) fn define(
|
||||
"rotr_imm",
|
||||
r#"
|
||||
Rotate right by immediate.
|
||||
|
||||
Same as `rotr`, but one operand is a zero extended 64 bit immediate constant.
|
||||
"#,
|
||||
&formats.binary_imm64,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user