about summary refs log tree commit diff stats
path: root/test/arch/x86/unit/mn_punpck.py
diff options
context:
space:
mode:
authorCamille Mougey <commial@gmail.com>2016-01-08 14:07:24 +0100
committerCamille Mougey <commial@gmail.com>2016-01-08 14:07:24 +0100
commitc86694812fcd935a7310e7ce96018d973c464f56 (patch)
tree9bb4d742967a9b1123ae586f2b4c26b0eff02e39 /test/arch/x86/unit/mn_punpck.py
parentee96ee5e19f6c6712a871a19c07eb89c35e3dce5 (diff)
parent55c24ef7ad982a700fcf1f3ae4296cf99019fbb5 (diff)
downloadmiasm-c86694812fcd935a7310e7ce96018d973c464f56.tar.gz
miasm-c86694812fcd935a7310e7ce96018d973c464f56.zip
Merge pull request #297 from serpilliere/add_sse_instr
Add sse instr
Diffstat (limited to 'test/arch/x86/unit/mn_punpck.py')
-rw-r--r--test/arch/x86/unit/mn_punpck.py124
1 files changed, 124 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_punpck.py b/test/arch/x86/unit/mn_punpck.py
new file mode 100644
index 00000000..84d86c32
--- /dev/null
+++ b/test/arch/x86/unit/mn_punpck.py
@@ -0,0 +1,124 @@
+#! /usr/bin/env python
+from asm_test import Asm_Test
+import sys
+
+class Test_PUNPCKHBW(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKHBW MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xAA11BB22CC33DD44
+
+
+class Test_PUNPCKHWD(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKHWD MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xAABB1122CCDD3344
+
+
+
+class Test_PUNPCKHDQ(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKHDQ MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xAABBCCDD11223344
+
+
+
+
+class Test_PUNPCKLBW(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKLBW MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xEE55FF6602770188
+
+
+class Test_PUNPCKLWD(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKLWD MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xEEFF556602017788
+
+
+
+class Test_PUNPCKLDQ(Asm_Test):
+    TXT = '''
+    main:
+       CALL      next
+       .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11
+       .byte 0x01, 0x02, 0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA
+    next:
+       POP       EBP
+       MOVQ      MM0, QWORD PTR [EBP]
+       MOVQ      MM1, MM0
+       PUNPCKLDQ MM1, QWORD PTR [EBP+0x8]
+       RET
+    '''
+
+    def check(self):
+        assert self.myjit.cpu.MM0 == 0x1122334455667788
+        assert self.myjit.cpu.MM1 == 0xEEFF020155667788
+
+if __name__ == "__main__":
+    [test()() for test in [Test_PUNPCKHBW, Test_PUNPCKHWD, Test_PUNPCKHDQ,
+                           Test_PUNPCKLBW, Test_PUNPCKLWD, Test_PUNPCKLDQ,]]