diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-23 23:03:58 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2015-12-24 18:38:19 +0100 |
| commit | d5029cf5db186414413fe45601f66b333b89599c (patch) | |
| tree | e5c8cee7aa00dde104f22ccb9248eab193025b3c /test | |
| parent | 20f23a90dfacfdfa17d764922d83ee99827ad799 (diff) | |
| download | miasm-d5029cf5db186414413fe45601f66b333b89599c.tar.gz miasm-d5029cf5db186414413fe45601f66b333b89599c.zip | |
Test: add x86 reg test
Diffstat (limited to 'test')
| -rw-r--r-- | test/arch/x86/unit/mn_punpck.py | 63 | ||||
| -rw-r--r-- | test/test_all.py | 1 |
2 files changed, 64 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..bf66b8ed --- /dev/null +++ b/test/arch/x86/unit/mn_punpck.py @@ -0,0 +1,63 @@ +#! /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 + +if __name__ == "__main__": + [test()() for test in [Test_PUNPCKHBW, Test_PUNPCKHWD, Test_PUNPCKHDQ]] diff --git a/test/test_all.py b/test/test_all.py index 16543b6c..2370ab18 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -45,6 +45,7 @@ for script in ["x86/sem.py", "x86/unit/mn_pmaxu.py", "x86/unit/mn_pminu.py", "x86/unit/mn_pcmpeq.py", + "x86/unit/mn_punpck.py", "arm/arch.py", "arm/sem.py", "aarch64/unit/mn_ubfm.py", |