Author Topic: Dynamic LOCAL alignment for XMM registers.  (Read 1079 times)


  • Administrator
  • Member
  • ******
  • Posts: 7794
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Dynamic LOCAL alignment for XMM registers.
« on: September 15, 2018, 01:42:10 PM »
Seems to work OK and easy enough to set up.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\

    ssealign MACRO buffer
      lea rax, buffer
      memalign rax, 16
      EXITM <rax>


; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

 entry_point proc

    call testit

    conout lf,"  If you can see me, it worked.",lf,lf


 entry_point endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

 testit proc

    LOCAL pmem  :QWORD
    LOCAL buff[256]:BYTE

    mov pmem, ssealign(buff)

    mov r10, pmem                           ; load aligned address into register

    movdqa XMMWORD PTR [r10], xmm12
    movdqa XMMWORD PTR [r10+16], xmm13
    movdqa XMMWORD PTR [r10+32], xmm14
    movdqa XMMWORD PTR [r10+48], xmm15

    nop                                     ; your code goes here

    movntdqa xmm12, XMMWORD PTR [r10]
    movntdqa xmm13, XMMWORD PTR [r10+16]
    movntdqa xmm14, XMMWORD PTR [r10+32]
    movntdqa xmm15, XMMWORD PTR [r10+48]


 testit endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

hutch at movsd dot com    :biggrin:  :skrewy:


  • Member
  • *****
  • Posts: 10845
  • Assembler is fun ;-)
    • MasmBasic
Re: Dynamic LOCAL alignment for XMM registers.
« Reply #1 on: September 15, 2018, 06:10:33 PM »
Code: [Select]
  nop                                     ; your code goes herepush+pop not allowed here...