Add Intel encodings for popcnt.
Change the result type for the bit-counting instructions from a fixed i8 to the iB type variable which is the type of the input. This matches the convention in WebAssembly, and at least Intel's instructions will set a full register's worth of count result, even if it is always < 64. Duplicate the Intel 'ur' encoding recipe into 'umr' and 'urm' variants corresponding to the RM and MR encoding variants. The difference is which register is encoded as 'reg' and which is 'r/m' in the ModR/M byte. A 'mov' register copy uses the MR variant, a unary popcnt uses the RM variant.
This commit is contained in:
@@ -8,7 +8,7 @@ from __future__ import absolute_import
|
||||
from cdsl.operands import Operand, VARIABLE_ARGS
|
||||
from cdsl.typevar import TypeVar
|
||||
from cdsl.instructions import Instruction, InstructionGroup
|
||||
from base.types import i8, f32, f64, b1
|
||||
from base.types import f32, f64, b1
|
||||
from base.immediates import imm64, uimm8, ieee32, ieee64, offset32, uoffset32
|
||||
from base.immediates import intcc, floatcc, memflags, regunit
|
||||
from base import entities
|
||||
@@ -1050,7 +1050,7 @@ sshr_imm = Instruction(
|
||||
#
|
||||
|
||||
x = Operand('x', iB)
|
||||
a = Operand('a', i8)
|
||||
a = Operand('a', iB)
|
||||
|
||||
clz = Instruction(
|
||||
'clz', r"""
|
||||
|
||||
Reference in New Issue
Block a user