Add legalization helper instructions.
The isplit_lohi instruction breaks an integer into two halves. This will typically be used to get the two halves of an `i64` value on 32-bit CPUs. The iconcat_lohi is the reverse operation. It reconstructs the `i64` from the low and high bits.
This commit is contained in:
@@ -1105,4 +1105,42 @@ fcvt_from_sint = Instruction(
|
||||
""",
|
||||
ins=x, outs=a)
|
||||
|
||||
#
|
||||
# Legalization helper instructions.
|
||||
#
|
||||
|
||||
WideInt = TypeVar(
|
||||
'WideInt', 'A scalar integer type from `i16` upwards',
|
||||
ints=(16, 64))
|
||||
x = Operand('x', WideInt)
|
||||
lo = Operand(
|
||||
'lo', WideInt.half_width(), 'The low bits of `x`')
|
||||
hi = Operand(
|
||||
'hi', WideInt.half_width(), 'The high bits of `x`')
|
||||
|
||||
isplit_lohi = Instruction(
|
||||
'isplit_lohi', r"""
|
||||
Split a scalar integer into low and high parts.
|
||||
|
||||
Returns the low half of `x` and the high half of `x` as two independent
|
||||
values.
|
||||
""",
|
||||
ins=x, outs=(lo, hi))
|
||||
|
||||
|
||||
NarrowInt = TypeVar(
|
||||
'NarrowInt', 'A scalar integer type up to `i32`',
|
||||
ints=(8, 32))
|
||||
lo = Operand('lo', NarrowInt)
|
||||
hi = Operand('hi', NarrowInt)
|
||||
a = Operand(
|
||||
'a', NarrowInt.double_width(),
|
||||
doc='The concatenation of `lo` and `hi`')
|
||||
|
||||
iconcat_lohi = Instruction(
|
||||
'iconcat_lohi', r"""
|
||||
Concatenate low and high bits to form a larger integer type.
|
||||
""",
|
||||
ins=(lo, hi), outs=a)
|
||||
|
||||
instructions.close()
|
||||
|
||||
@@ -17,6 +17,7 @@ UnaryImm = InstructionFormat(imm64)
|
||||
UnaryIeee32 = InstructionFormat(ieee32)
|
||||
UnaryIeee64 = InstructionFormat(ieee64)
|
||||
UnaryImmVector = InstructionFormat(immvector)
|
||||
UnarySplit = InstructionFormat(value, multiple_results=True)
|
||||
|
||||
Binary = InstructionFormat(value, value)
|
||||
BinaryImm = InstructionFormat(value, imm64)
|
||||
|
||||
Reference in New Issue
Block a user