diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/arch/x86/unit/mn_pshufb.py | 25 | ||||
| -rw-r--r-- | test/arch/x86/unit/mn_psrl_psll.py | 55 | ||||
| -rw-r--r-- | test/test_all.py | 2 |
3 files changed, 82 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_pshufb.py b/test/arch/x86/unit/mn_pshufb.py new file mode 100644 index 00000000..187b2f72 --- /dev/null +++ b/test/arch/x86/unit/mn_pshufb.py @@ -0,0 +1,25 @@ +#! /usr/bin/env python +from asm_test import Asm_Test +import sys + +class Test_PSHUFB(Asm_Test): + TXT = ''' + main: + CALL next + .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + .byte 0x7, 0x6, 0x5, 0x4, 0x3, 0x2, 0x1, 0x0 + next: + POP EBP + MOVQ MM0, QWORD PTR [EBP] + MOVQ MM1, MM0 + PSHUFB MM1, QWORD PTR [EBP+0x8] + RET + ''' + + def check(self): + assert self.myjit.cpu.MM0 == 0x1122334455667788L + assert self.myjit.cpu.MM1 == 0x8877665544332211L + + +if __name__ == "__main__": + [test()() for test in [Test_PSHUFB]] diff --git a/test/arch/x86/unit/mn_psrl_psll.py b/test/arch/x86/unit/mn_psrl_psll.py new file mode 100644 index 00000000..93a356f7 --- /dev/null +++ b/test/arch/x86/unit/mn_psrl_psll.py @@ -0,0 +1,55 @@ +#! /usr/bin/env python +from asm_test import Asm_Test +import sys + +class Test_PSRL(Asm_Test): + TXT = ''' + main: + CALL next + .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + .byte 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + next: + POP EBP + MOVQ MM0, QWORD PTR [EBP] + MOVQ MM1, MM0 + MOVQ MM2, MM0 + MOVQ MM3, MM0 + PSRLW MM1, QWORD PTR [EBP+0x8] + PSRLD MM2, QWORD PTR [EBP+0x8] + PSRLQ MM3, QWORD PTR [EBP+0x8] + RET + ''' + + def check(self): + assert self.myjit.cpu.MM0 == 0x1122334455667788L + assert self.myjit.cpu.MM1 == 0x0112033405560778L + assert self.myjit.cpu.MM2 == 0x0112233405566778L + assert self.myjit.cpu.MM3 == 0x0112233445566778L + +class Test_PSLL(Asm_Test): + TXT = ''' + main: + CALL next + .byte 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11 + .byte 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 + next: + POP EBP + MOVQ MM0, QWORD PTR [EBP] + MOVQ MM1, MM0 + MOVQ MM2, MM0 + MOVQ MM3, MM0 + PSLLW MM1, QWORD PTR [EBP+0x8] + PSLLD MM2, QWORD PTR [EBP+0x8] + PSLLQ MM3, QWORD PTR [EBP+0x8] + RET + ''' + + def check(self): + assert self.myjit.cpu.MM0 == 0x1122334455667788L + assert self.myjit.cpu.MM1 == 0x1220344056607880L + assert self.myjit.cpu.MM2 == 0x1223344056677880L + assert self.myjit.cpu.MM3 == 0x1223344556677880L + + +if __name__ == "__main__": + [test()() for test in [Test_PSRL, Test_PSLL]] diff --git a/test/test_all.py b/test/test_all.py index 71ea51a5..1be8d7e2 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -40,6 +40,8 @@ for script in ["x86/sem.py", "x86/unit/mn_daa.py", "x86/unit/mn_das.py", "x86/unit/mn_int.py", + "x86/unit/mn_pshufb.py", + "x86/unit/mn_psrl_psll.py", "arm/arch.py", "arm/sem.py", "aarch64/unit/mn_ubfm.py", |