symm/salsa20-arm-neon.S: Indent some reordered instructions.
[catacomb] / symm / salsa20-x86ish-sse2.S
index a05cb4e..ccf912b 100644 (file)
 /// MA 02111-1307, USA.
 
 ///--------------------------------------------------------------------------
-/// External definitions.
+/// Preliminaries.
 
 #include "config.h"
 #include "asm-common.h"
 
+       .text
+
 ///--------------------------------------------------------------------------
 /// Main code.
 
-       .arch pentium4
-       .text
+FUNC(salsa20_core_x86ish_avx)
+       .arch   .avx
+       vzeroupper
+  endprologue
+       // drop through...
+ENDFUNC
+
+       .arch   pentium4
 
 FUNC(salsa20_core_x86ish_sse2)
 
@@ -42,12 +50,12 @@ FUNC(salsa20_core_x86ish_sse2)
 
 #if CPUFAM_X86
        // Arguments come in on the stack, and will need to be collected.  We
-       // we can get away with just the scratch registers for integer work,
-       // but we'll run out of XMM registers and will need some properly
-       // aligned space which we'll steal from the stack.  I don't trust the
-       // stack pointer's alignment, so I'll have to mask the stack pointer,
-       // which in turn means I'll need to keep track of the old value.
-       // Hence I'm making a full i386-style stack frame here.
+       // can get away with just the scratch registers for integer work, but
+       // we'll run out of XMM registers and will need some properly aligned
+       // space which we'll steal from the stack.  I don't trust the stack
+       // pointer's alignment, so I'll have to mask the stack pointer, which
+       // in turn means I'll need to keep track of the old value.  Hence I'm
+       // making a full i386-style stack frame here.
        //
        // The Windows and SysV ABIs are sufficiently similar that we don't
        // need to worry about the differences here.
@@ -57,16 +65,16 @@ FUNC(salsa20_core_x86ish_sse2)
 #  define OUT edx
 #  define SAVE0 xmm6
 #  define SAVE1 xmm7
-#  define SAVE2 [esp + 0]
-#  define SAVE3 [esp + 16]
-
-       push    ebp
-       mov     ebp, esp
-       sub     esp, 32
-       mov     IN, [ebp + 12]
-       mov     OUT, [ebp + 16]
-       and     esp, ~15
-       mov     NR, [ebp + 8]
+#  define SAVE2 [SP + 0]
+#  define SAVE3 [SP + 16]
+
+       pushreg BP
+       setfp
+       stalloc 32
+       mov     IN, [BP + 12]
+       mov     OUT, [BP + 16]
+       and     SP, ~15
+       mov     NR, [BP + 8]
 #endif
 
 #if CPUFAM_AMD64 && ABI_SYSV
@@ -99,18 +107,16 @@ FUNC(salsa20_core_x86ish_sse2)
 #  define OUT r8
 #  define SAVE0 xmm6
 #  define SAVE1 xmm7
-#  define SAVE2 [rsp + 32]
-#  define SAVE3 [rsp + 48]
-
-       sub     rsp, 64 + 8
-         .seh_stackalloc 64 + 8
-       movdqa  [rsp +  0], xmm6
-         .seh_savexmm xmm6, 0
-       movdqa  [rsp + 16], xmm7
-         .seh_savexmm xmm7, 16
-  .seh_endprologue
+#  define SAVE2 [SP + 32]
+#  define SAVE3 [SP + 48]
+
+       stalloc 64 + 8
+       savexmm xmm6, 0
+       savexmm xmm7, 16
 #endif
 
+  endprologue
+
        // First job is to slurp the matrix into XMM registers.  The words
        // have already been permuted conveniently to make them line up
        // better for SIMD processing.
@@ -294,13 +300,13 @@ FUNC(salsa20_core_x86ish_sse2)
 
        // Tidy things up.
 #if CPUFAM_X86
-       mov     esp, ebp
-       pop     ebp
+       dropfp
+       popreg  BP
 #endif
 #if CPUFAM_AMD64 && ABI_WIN
-       movdqa  xmm6, [rsp +  0]
-       movdqa  xmm7, [rsp + 16]
-       add     rsp, 64 + 8
+       rstrxmm xmm6, 0
+       rstrxmm xmm7, 16
+       stfree  64 + 8
 #endif
 
        // And with that, we're done.