Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for padd* and pandn instructions #11

Open
ddash-ct opened this issue Sep 2, 2024 · 0 comments
Open

Add support for padd* and pandn instructions #11

ddash-ct opened this issue Sep 2, 2024 · 0 comments

Comments

@ddash-ct
Copy link
Contributor

ddash-ct commented Sep 2, 2024

Add support for PADD* - Add Packed Integers and PANDN - Logical AND NOT instructions.

Preliminary implementation looks like:

def paddb(ctx: ProcessorContext, instruction: Instruction):
    """
    Add packed integers

    :param ProcessorContext ctx: Processor context
    :param Instruction instruction: Instruction


    :return:
    """
    operands = instruction.operands
    opvalue1 = operands[-2].value
    opvalue2 = operands[-1].value
    result = (opvalue1 + opvalue2) & 0xffffffffffffffffffffffffffffffff
    logger.debug("0x%X + 0x%X = 0x%X", opvalue1, opvalue2, result)
    operands[0].value = result


def pandn(ctx: ProcessorContext, instruction: Instruction):
    """
    Logical AND NOT

    :param ProcessorContext ctx: Processor context
    :param Instruction instruction: Instruction


    :return:
    """
    operands = instruction.operands
    opvalue1 = operands[-2].value
    opvalue2 = operands[-1].value
    result = (~opvalue1 & opvalue2)
    logger.debug("~0x%X & 0x%X = 0x%X", opvalue1, opvalue2, result)
    operands[0].value = result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant