Permit {s,u}{div,rem}_imm instructions to be potentially trapping.

The documentation for these instructions suggests that immediate values
which could lead to trapping should be invalid.

While it seems nice to have these instructions be always non-trapping,
it's also nice to say that the `_imm` forms of instructions are
interchangeable with the corresponding non-`_imm` forms accompanied
by `iconst` instructions.
This commit is contained in:
Dan Gohman
2018-07-02 22:38:29 -07:00
parent 112ae6df56
commit 632bbf2008

View File

@@ -1016,7 +1016,7 @@ udiv_imm = Instruction(
'udiv_imm', """ 'udiv_imm', """
Unsigned integer division by an immediate constant. Unsigned integer division by an immediate constant.
This instruction never traps because a divisor of zero is not allowed. This operation traps if the divisor is zero.
""", """,
ins=(x, Y), outs=a) ins=(x, Y), outs=a)
@@ -1024,15 +1024,17 @@ sdiv_imm = Instruction(
'sdiv_imm', """ 'sdiv_imm', """
Signed integer division by an immediate constant. Signed integer division by an immediate constant.
This instruction never traps because a divisor of -1 or 0 is not This operation traps if the divisor is zero, or if the result is not
allowed. """, representable in :math:`B` bits two's complement. This only happens
when :math:`x = -2^{B-1}, Y = -1`.
""",
ins=(x, Y), outs=a) ins=(x, Y), outs=a)
urem_imm = Instruction( urem_imm = Instruction(
'urem_imm', """ 'urem_imm', """
Unsigned integer remainder with immediate divisor. Unsigned integer remainder with immediate divisor.
This instruction never traps because a divisor of zero is not allowed. This operation traps if the divisor is zero.
""", """,
ins=(x, Y), outs=a) ins=(x, Y), outs=a)
@@ -1040,8 +1042,8 @@ srem_imm = Instruction(
'srem_imm', """ 'srem_imm', """
Signed integer remainder with immediate divisor. Signed integer remainder with immediate divisor.
This instruction never traps because a divisor of 0 or -1 is not This operation traps if the divisor is zero.
allowed. """, """,
ins=(x, Y), outs=a) ins=(x, Y), outs=a)
irsub_imm = Instruction( irsub_imm = Instruction(