Browse Source

Add XMM based manual tests for SSE shift instructions

Amaan Cheval 6 years ago
parent
commit
fef1b05f35
8 changed files with 244 additions and 75 deletions
  1. 31 9
      tests/nasm/pslld.asm
  2. 32 10
      tests/nasm/psllq.asm
  3. 29 8
      tests/nasm/psllw.asm
  4. 25 7
      tests/nasm/psrad.asm
  5. 28 10
      tests/nasm/psraw.asm
  6. 27 9
      tests/nasm/psrld.asm
  7. 39 11
      tests/nasm/psrlq.asm
  8. 33 11
      tests/nasm/psrlw.asm

+ 31 - 9
tests/nasm/pslld.asm

@@ -2,25 +2,47 @@ global _start
 
 section .data
 	align 16
-myquad:
+mydq0:
 	dq	0xad0000ceadad00ff
+	dq	0xff00dadaec0000da
+mydq1:
+	dq	0x0102030405060708
+	dq	0x090a0b0c0d0e0f10
 mydword:
 	dd	0xcafebac0
-shift1:
+shift0:
 	dq	0x07
+shift1:
+	dq	-0x22
+
+align 16
 shift2:
+	dq	0x07
+	dq	0
+shift3:
 	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [mydq0]
+	movq		mm1, [mydq0]
+	movq		mm2, [mydq1]
+	movq		mm6, [mydq1]
+
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq1]
+	movq		xmm6, [mydq1]
 
-	pslld		mm0, [shift1]
-	pslld		mm1, 0x20
-	pslld		mm2, [shift2]
+	pslld		mm0, [shift0]
+	pslld		mm1, 30
+	pslld		mm2, [shift1]
 	pslld		mm6, 0x5
 
+	pslld		xmm0, [shift2]
+	pslld		xmm1, 30
+	pslld		xmm2, [shift3]
+	pslld		xmm6, 0x5
+
 %include "footer.inc"

+ 32 - 10
tests/nasm/psllq.asm

@@ -2,30 +2,52 @@ global _start
 
 section .data
 	align 16
-myquad:
+dq0:
+	dq	0x0102030405060708
+	dq	0xffffaaaabbbbcccc
+dq1:
 	dq	0x8d0000ceadad00ff
+	dq	0x0123456789abcdef
 mydword:
 	dd	0xcafebac0
+
+align 16
 shift1:
 	dq	0x07
+	dq	0
 shift2:
 	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm3, [myquad]
-	movq		mm4, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [dq0]
+	movq		mm1, [dq0]
+	movq		mm2, [dq0]
+	movq		mm3, [dq1]
+	movq		mm4, [dq1]
+	movq		mm6, [dq1]
+
+	movq		xmm0, [dq0]
+	movq		xmm1, [dq0]
+	movq		xmm2, [dq0]
+	movq		xmm3, [dq1]
+	movq		xmm4, [dq1]
+	movq		xmm6, [dq1]
 
 	psllq		mm0, [shift1]
 	psllq		mm1, [shift2]
-	psllq		mm2, 0x65
-	psllq		mm3, 0x25
-	psllq		mm4, 0x1F
+	psllq		mm2, 50
+	psllq		mm3, 28
+	psllq		mm4, 68
 	psllq		mm6, 0x5
 
+	psllq		xmm0, [shift1]
+	psllq		xmm1, [shift2]
+	psllq		xmm2, 50
+	psllq		xmm3, 28
+	psllq		xmm4, 68
+	psllq		xmm6, 0x5
+
 %include "footer.inc"
 

+ 29 - 8
tests/nasm/psllw.asm

@@ -2,27 +2,41 @@ global _start
 
 section .data
 	align 16
-quad1:
+dq1:
 	dq	0xad0000ceadad00ff
-quad2:
+	dq	0xad0000ceadad00ff
+dq2:
+	dq	0x42ff88ff11aabbcc
 	dq	0x42ff88ff11aabbcc
 mydword:
 	dd	0xcafebac0
+
+align 16
 shift1:
 	dq	0x07
+	dq	0
 shift2:
 	dq	-0x22
+	dq	0
 shift3:
 	dq	8
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [quad1]
-	movq		mm1, [quad1]
-	movq		mm2, [quad1]
-	movq		mm3, [quad2]
-	movq		mm4, [quad2]
-	movq		mm6, [quad2]
+	movq		mm0, [dq1]
+	movq		mm1, [dq1]
+	movq		mm2, [dq1]
+	movq		mm3, [dq2]
+	movq		mm4, [dq2]
+	movq		mm6, [dq2]
+
+	movq		xmm0, [dq1]
+	movq		xmm1, [dq1]
+	movq		xmm2, [dq1]
+	movq		xmm3, [dq2]
+	movq		xmm4, [dq2]
+	movq		xmm6, [dq2]
 
 	psllw		mm0, [shift1]
 	psllw		mm1, 0xff
@@ -31,5 +45,12 @@ shift3:
 	psllw		mm4, [shift3]
 	psllw		mm6, 0x5
 
+	psllw		xmm0, [shift1]
+	psllw		xmm1, 0xff
+	psllw		xmm2, [shift2]
+	psllw		xmm3, 12
+	psllw		xmm4, [shift3]
+	psllw		xmm6, 0x5
+
 %include "footer.inc"
 

+ 25 - 7
tests/nasm/psrad.asm

@@ -2,25 +2,43 @@ global _start
 
 section .data
 	align 16
-myquad:
-	dq	0xad0000ceadad00ff
+dq0:
+	dq	0x0102030405060708
+	dq	0xffffaaaabbbbcccc
+dq1:
+	dq	0x8d0000ceadad00ff
+	dq	0x0123456789abcdef
 mydword:
 	dd	0xcafebac0
+
+align 16
 shift1:
 	dq	0x07
+	dq	0
 shift2:
 	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [dq0]
+	movq		mm1, [dq0]
+	movq		mm2, [dq1]
+	movq		mm6, [dq1]
+
+	movq		xmm0, [dq0]
+	movq		xmm1, [dq0]
+	movq		xmm2, [dq1]
+	movq		xmm6, [dq1]
 
 	psrad		mm0, [shift1]
-	psrad		mm1, 0x20
+	psrad		mm1, 0x18
 	psrad		mm2, [shift2]
 	psrad		mm6, 0x5
 
+	psrad		xmm0, [shift1]
+	psrad		xmm1, 0x18
+	psrad		xmm2, [shift2]
+	psrad		xmm6, 0x5
+
 %include "footer.inc"

+ 28 - 10
tests/nasm/psraw.asm

@@ -2,25 +2,43 @@ global _start
 
 section .data
 	align 16
-myquad:
+mydq0:
 	dq	0xad0000ceadad00ff
+	dq	0xff00dadaec0000da
+mydq1:
+	dq	0x0102030405060708
+	dq	0x090a0b0c0d0e0f10
 mydword:
 	dd	0xcafebac0
-shift1:
+
+align 16
+shift0:
 	dq	0x07
-shift2:
-	dq	-23
+	dq	0
+shift1:
+	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [mydq0]
+	movq		mm1, [mydq0]
+	movq		mm2, [mydq1]
+	movq		mm6, [mydq1]
+
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq1]
+	movq		xmm6, [mydq1]
 
 	psraw		mm0, [shift1]
-	psraw		mm1, 0xc
-	psraw		mm2, [shift2]
+	psraw		mm1, 18
+	psraw		mm2, [shift0]
 	psraw		mm6, 0x5
 
+	psraw		xmm0, [shift1]
+	psraw		xmm1, 18
+	psraw		xmm2, [shift0]
+	psraw		xmm6, 0x5
+
 %include "footer.inc"

+ 27 - 9
tests/nasm/psrld.asm

@@ -2,25 +2,43 @@ global _start
 
 section .data
 	align 16
-myquad:
-	dq	0x8d0000ceffffadad
+mydq0:
+	dq	0xad0000ceadad00ff
+	dq	0xff00dadaec0000da
+mydq1:
+	dq	0x0102030405060708
+	dq	0x090a0b0c0d0e0f10
 mydword:
 	dd	0xcafebac0
-shift1:
+
+align 16
+shift0:
 	dq	0x07
-shift2:
+	dq	0
+shift1:
 	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [mydq0]
+	movq		mm1, [mydq0]
+	movq		mm2, [mydq1]
+	movq		mm6, [mydq1]
+
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq1]
+	movq		xmm6, [mydq1]
 
 	psrld		mm0, [shift1]
 	psrld		mm1, 0xff
-	psrld		mm2, [shift2]
+	psrld		mm2, [shift0]
 	psrld		mm6, 0x5
 
+	psrld		xmm0, [shift1]
+	psrld		xmm1, 0xff
+	psrld		xmm2, [shift0]
+	psrld		xmm6, 0x5
+
 %include "footer.inc"

+ 39 - 11
tests/nasm/psrlq.asm

@@ -2,29 +2,57 @@ global _start
 
 section .data
 	align 16
-myquad:
-	dq	0x8d0000ceadad00ff
+mydq0:
+	dq	0xad0000ceadad00ff
+	dq	0xff00dadaec0000da
+mydq1:
+	dq	0x0102030405060708
+	dq	0x090a0b0c0d0e0f10
 mydword:
 	dd	0xcafebac0
-shift1:
+
+align 16
+shift0:
 	dq	0x07
-shift2:
+	dq	0
+shift1:
 	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm3, [myquad]
-	movq		mm4, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [mydq0]
+	movq		mm1, [mydq0]
+	movq		mm2, [mydq0]
+	movq		mm3, [mydq1]
+	movq		mm4, [mydq1]
+	movq		mm6, [mydq1]
+
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq0]
+	movq		xmm3, [mydq1]
+	movq		xmm4, [mydq1]
+	movq		xmm6, [mydq1]
 
 	psrlq		mm0, [shift1]
-	psrlq		mm1, [shift2]
+	psrlq		mm1, [shift0]
 	psrlq		mm2, 0x65
 	psrlq		mm3, 0x25
 	psrlq		mm4, 0x1F
 	psrlq		mm6, 0x5
 
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq1]
+	movq		xmm3, [mydq1]
+	movq		xmm6, [mydq1]
+
+	psrlq		xmm0, [shift1]
+	psrlq		xmm1, [shift0]
+	psrlq		xmm2, 0x65
+	psrlq		xmm3, 0x25
+	psrlq		xmm4, 0x1F
+	psrlq		xmm6, 0x5
+
 %include "footer.inc"

+ 33 - 11
tests/nasm/psrlw.asm

@@ -2,25 +2,47 @@ global _start
 
 section .data
 	align 16
-myquad:
-	dq	0xad0000ceffffadad
+mydq0:
+	dq	0xad0000ceadad00ff
+	dq	0xff00dadaec0000da
+mydq1:
+	dq	0x0102030405060708
+	dq	0x090a0b0c0d0e0f10
 mydword:
 	dd	0xcafebac0
-shift1:
+
+align 16
+shift0:
 	dq	0x07
-shift2:
-	dq	-4
+	dq	0
+shift1:
+	dq	-0x22
+	dq	0
 
 %include "header.inc"
 
-	movq		mm0, [myquad]
-	movq		mm1, [myquad]
-	movq		mm2, [myquad]
-	movq		mm6, [myquad]
+	movq		mm0, [mydq0]
+	movq		mm1, [mydq0]
+	movq		mm2, [mydq1]
+	movq		mm3, [mydq1]
+	movq		mm6, [mydq1]
+
+	movq		xmm0, [mydq0]
+	movq		xmm1, [mydq0]
+	movq		xmm2, [mydq1]
+	movq		xmm3, [mydq1]
+	movq		xmm6, [mydq1]
 
 	psrlw		mm0, [shift1]
-	psrlw		mm1, [mydword]
-	psrlw		mm2, [shift2]
+	psrlw		mm1, 30
+	psrlw		mm2, [shift0]
+	psrlw		mm3, 12
 	psrlw		mm6, 0x5
 
+	psrlw		xmm0, [shift1]
+	psrlw		xmm1, 30
+	psrlw		xmm2, [shift0]
+	psrlw		xmm3, 12
+	psrlw		xmm6, 0x5
+
 %include "footer.inc"