# This file is auto-generated by /codegen/x86_64_test_encoding.py
# Reference opcodes are generated by:
#     GNU assembler (GNU Binutils) 2.28.51.20170402

from peachpy.x86_64 import *
import unittest


class TestAESDEC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDE, 0xCE]), AESDEC(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDE, 0x4C, 0xC2, 0xB3]), AESDEC(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestAESDECLAST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDF, 0xCE]), AESDECLAST(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDF, 0x4C, 0xC2, 0xB3]), AESDECLAST(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestAESENC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDC, 0xCE]), AESENC(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDC, 0x4C, 0xC2, 0xB3]), AESENC(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestAESENCLAST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDD, 0xCE]), AESENCLAST(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDD, 0x4C, 0xC2, 0xB3]), AESENCLAST(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestAESIMC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDB, 0xCE]), AESIMC(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x38, 0xDB, 0x4C, 0xC2, 0xB3]), AESIMC(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestAESKEYGENASSIST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x3A, 0xDF, 0xCE, 0x02]), AESKEYGENASSIST(xmm1, xmm14, 2).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x3A, 0xDF, 0x4C, 0xC2, 0xB3, 0x02]), AESKEYGENASSIST(xmm1, oword[r10 + rax*8 - 77], 2).encode())


class TestVAESDEC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xE2, 0x09, 0xDE, 0xCB]), VAESDEC(xmm1, xmm14, xmm3).encode())
        self.assertEqual(bytearray([0xC4, 0xC2, 0x09, 0xDE, 0x4C, 0xC2, 0xB3]), VAESDEC(xmm1, xmm14, oword[r10 + rax*8 - 77]).encode())


class TestVAESDECLAST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xE2, 0x09, 0xDF, 0xCB]), VAESDECLAST(xmm1, xmm14, xmm3).encode())
        self.assertEqual(bytearray([0xC4, 0xC2, 0x09, 0xDF, 0x4C, 0xC2, 0xB3]), VAESDECLAST(xmm1, xmm14, oword[r10 + rax*8 - 77]).encode())


class TestVAESENC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xE2, 0x09, 0xDC, 0xCB]), VAESENC(xmm1, xmm14, xmm3).encode())
        self.assertEqual(bytearray([0xC4, 0xC2, 0x09, 0xDC, 0x4C, 0xC2, 0xB3]), VAESENC(xmm1, xmm14, oword[r10 + rax*8 - 77]).encode())


class TestVAESENCLAST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xE2, 0x09, 0xDD, 0xCB]), VAESENCLAST(xmm1, xmm14, xmm3).encode())
        self.assertEqual(bytearray([0xC4, 0xC2, 0x09, 0xDD, 0x4C, 0xC2, 0xB3]), VAESENCLAST(xmm1, xmm14, oword[r10 + rax*8 - 77]).encode())


class TestVAESIMC(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xC2, 0x79, 0xDB, 0xCE]), VAESIMC(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0xC4, 0xC2, 0x79, 0xDB, 0x4C, 0xC2, 0xB3]), VAESIMC(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestVAESKEYGENASSIST(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xC3, 0x79, 0xDF, 0xCE, 0x02]), VAESKEYGENASSIST(xmm1, xmm14, 2).encode())
        self.assertEqual(bytearray([0xC4, 0xC3, 0x79, 0xDF, 0x4C, 0xC2, 0xB3, 0x02]), VAESKEYGENASSIST(xmm1, oword[r10 + rax*8 - 77], 2).encode())


class TestSHA1MSG1(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xC9, 0xCE]), SHA1MSG1(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xC9, 0x4C, 0xC2, 0xB3]), SHA1MSG1(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestSHA1MSG2(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCA, 0xCE]), SHA1MSG2(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCA, 0x4C, 0xC2, 0xB3]), SHA1MSG2(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestSHA1NEXTE(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xC8, 0xCE]), SHA1NEXTE(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xC8, 0x4C, 0xC2, 0xB3]), SHA1NEXTE(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestSHA1RNDS4(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x3A, 0xCC, 0xCE, 0x02]), SHA1RNDS4(xmm1, xmm14, 2).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x3A, 0xCC, 0x4C, 0xC2, 0xB3, 0x02]), SHA1RNDS4(xmm1, oword[r10 + rax*8 - 77], 2).encode())


class TestSHA256MSG1(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCC, 0xCE]), SHA256MSG1(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCC, 0x4C, 0xC2, 0xB3]), SHA256MSG1(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestSHA256MSG2(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCD, 0xCE]), SHA256MSG2(xmm1, xmm14).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCD, 0x4C, 0xC2, 0xB3]), SHA256MSG2(xmm1, oword[r10 + rax*8 - 77]).encode())


class TestSHA256RNDS2(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCB, 0xCE]), SHA256RNDS2(xmm1, xmm14, xmm0).encode())
        self.assertEqual(bytearray([0x41, 0x0F, 0x38, 0xCB, 0x4C, 0xC2, 0xB3]), SHA256RNDS2(xmm1, oword[r10 + rax*8 - 77], xmm0).encode())


class TestPCLMULQDQ(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x3A, 0x44, 0xCE, 0x02]), PCLMULQDQ(xmm1, xmm14, 2).encode())
        self.assertEqual(bytearray([0x66, 0x41, 0x0F, 0x3A, 0x44, 0x4C, 0xC2, 0xB3, 0x02]), PCLMULQDQ(xmm1, oword[r10 + rax*8 - 77], 2).encode())


class TestVPCLMULQDQ(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0xC4, 0xE3, 0x09, 0x44, 0xCB, 0x02]), VPCLMULQDQ(xmm1, xmm14, xmm3, 2).encode())
        self.assertEqual(bytearray([0xC4, 0xC3, 0x09, 0x44, 0x4C, 0xC2, 0xB3, 0x02]), VPCLMULQDQ(xmm1, xmm14, oword[r10 + rax*8 - 77], 2).encode())


class TestRDRAND(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x0F, 0xC7, 0xF6]), RDRAND(si).encode())
        self.assertEqual(bytearray([0x0F, 0xC7, 0xF5]), RDRAND(ebp).encode())
        self.assertEqual(bytearray([0x48, 0x0F, 0xC7, 0xF1]), RDRAND(rcx).encode())


class TestRDSEED(unittest.TestCase):
    def runTest(self):
        self.assertEqual(bytearray([0x66, 0x0F, 0xC7, 0xFE]), RDSEED(si).encode())
        self.assertEqual(bytearray([0x0F, 0xC7, 0xFD]), RDSEED(ebp).encode())
        self.assertEqual(bytearray([0x48, 0x0F, 0xC7, 0xF9]), RDSEED(rcx).encode())


