about summary refs log tree commit diff stats
path: root/test/arch/x86/unit/mn_pcmpeq.py
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2015-12-23 22:09:07 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-12-24 18:38:19 +0100
commite3d844ba60ef0ead63dd07317a6e28f7b38cf6cd (patch)
treea0b5f50d4f43d62fcd55d89e0dec245ffd45f8cb /test/arch/x86/unit/mn_pcmpeq.py
parent7dd9de865892837d275f0ef0a55f70d8df55fe43 (diff)
downloadmiasm-e3d844ba60ef0ead63dd07317a6e28f7b38cf6cd.tar.gz
miasm-e3d844ba60ef0ead63dd07317a6e28f7b38cf6cd.zip
Test: add x86 reg test
Diffstat (limited to 'test/arch/x86/unit/mn_pcmpeq.py')
-rw-r--r--test/arch/x86/unit/mn_pcmpeq.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_pcmpeq.py b/test/arch/x86/unit/mn_pcmpeq.py
new file mode 100644
index 00000000..a8774cbc
--- /dev/null
+++ b/test/arch/x86/unit/mn_pcmpeq.py
@@ -0,0 +1,64 @@
+#! /usr/bin/env python
+from asm_test import Asm_Test
+import sys
+
+class Test_PCMPEQB(Asm_Test):
+    TXT = '''
+    main:
+       CALL    next
+       .byte 0x88, 0x78, 0x66, 0x56, 0x44, 0x3F, 0xFF, 0x11
+       .byte 0x89, 0x77, 0x66, 0x55, 0xF9, 0x33, 0x22, 0x11
+    next:
+       POP     EBP
+       MOVQ    MM0, QWORD PTR [EBP]
+       MOVQ    MM1, MM0
+       PCMPEQB MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x11FF3F4456667888
+        assert self.myjit.cpu.MM1 == 0xFF00000000FF0000
+
+
+class Test_PCMPEQW(Asm_Test):
+    TXT = '''
+    main:
+       CALL    next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x3F, 0x22, 0x11
+       .byte 0x89, 0x77, 0x66, 0x55, 0xF9, 0x33, 0x22, 0x11
+    next:
+       POP     EBP
+       MOVQ    MM0, QWORD PTR [EBP]
+       MOVQ    MM1, MM0
+       PCMPEQW MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x11223F4455667788
+        assert self.myjit.cpu.MM1 == 0xFFFF0000FFFF0000
+
+
+
+class Test_PCMPEQD(Asm_Test):
+    TXT = '''
+    main:
+       CALL    next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x3F, 0x22, 0x11
+       .byte 0x88, 0x77, 0x66, 0x55, 0xF9, 0x33, 0x22, 0x11
+    next:
+       POP     EBP
+       MOVQ    MM0, QWORD PTR [EBP]
+       MOVQ    MM1, MM0
+       PCMPEQD MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x11223F4455667788
+        assert self.myjit.cpu.MM1 == 0x00000000FFFFFFFF
+
+
+if __name__ == "__main__":
+    [test()() for test in [Test_PCMPEQB, Test_PCMPEQW, Test_PCMPEQD]]