News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Re: PUSH & POP question

Started by daydreamer, May 06, 2018, 07:02:21 PM

Previous topic - Next topic

daydreamer

it would be nice to make use of the real stack, instead of a fake one when it comes to SIMD regs,so how do I change this code to make use of EBP to put it on real stack?
printing .xmm regs would be easy to "push" on stack and 4 unrolled calls to print that

.data?
    statestack  dd 0 dup (65536)
                dd 0 dup (65536)
.code
;ebx is initialized to make use of statestack



PUSHSTATE MACRO
    FXSAVE [ebx]
    add ebx,512
    ENDM
    POPSTATE MACRO
    sub ebx,512
    FXRSTOR [ebx]
   
    ENDM
;macro is on purpose written without spacebar to avoid conflict with keyword PUSH/POP
PUSHXMM1 MACRO
    movaps [ebx],xmm1
    add ebx,16
    ENDM
POPXMM1 MACRO
   movaps xmm1,[ebx]
   sub ebx,16
   ENDM

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

jj2007

Quote from: daydreamer on May 06, 2018, 07:02:21 PM
it would be nice to make use of the real stack, instead of a fake one when it comes to SIMD regs,so how do I change this code to make use of EBP to put it on real stack?

Your macros are nice, but you could simply declare local OWORD variables (you need a modern assembler like UAsm).

P.S.: I couldn't resist - Push & Pop xmm registers (thanks for the inspiration ;))

daydreamer

thats great idea for macros JJ
its old macros from 2006
you missed my earlier posting January
http://masm32.com/board/index.php?topic=6802.0


PUSHSTATE MACRO
    FXSAVE [ebx]
    add ebx,512
    ENDM
    POPSTATE MACRO
    sub ebx,512
    FXRSTOR [ebx]
   
    ENDM
;new versions of the original idea
POPSTATE2 MACRO
    movaps XMM0,[ebx]
    movaps XMM1,[ebx+16]
    movaps XMM2,[ebx+32]
    movaps XMM3,[ebx+48]
    movaps XMM4,[ebx+64]
    movaps XMM5,[ebx+80]
    movaps XMM6,[ebx+96]
    movaps XMM7,[ebx+112]
    sub ebx,128
    ENDM

PUSHSTATE2 MACRO
    movaps [ebx],XMM0
    movaps [ebx+16],XMM1
    movaps [ebx+32],XMM2
    movaps [ebx+48],XMM3
    movaps [ebx+64],XMM4
    movaps [ebx+80],XMM5
    movaps [ebx+96],XMM6
    movaps [ebx+112],XMM7
    add ebx,128
    ENDM
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding