flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > sse macro fmem.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 21 Jun 2022, 17:36
Fasmw 1.73
I want write this macro. How do this ?
Code:
outMem dd 0
inMem  dd 1.0
mem1   dd 2.0
mem2   dd 5.0
mem3   dd 3.0
....
mem22  dd 1.0

fmem outMem,inMem,+mem1,*mem2,-mem3,...,+mem22
    

fmem Get this code

Code:
movss xmm1,[inMem]
addss xmm1,[mem1] ;from mem1 macro get as [args] array
mulss xmm1,[mem2]
subss xmm1,[mem3]
addss xmm1,[mem22]
movss [outMem],xmm1
    
Post 21 Jun 2022, 17:36
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1052
Location: Russia
macomics 21 Jun 2022, 19:31
Try this:
Code:
macro fmem mOut*, mInp*, [args] { common movss xmm1, mInp
 if ~ args eq
forward
 match =+X, args \{ addss xmm1, X \}
 match =-X, args \{ subss xmm1, X \}
 match =*X, args \{ mulss xmm1, X \}
common end if
 movss [mOut], xmm1 }    
Post 21 Jun 2022, 19:31
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 21 Jun 2022, 19:44
Thanks work
Code:
macro fmem mOut*, mInp*, [args] { common movss xmm1, [mInp]
forward
 match =+X, args \{ addss xmm1, [X] \}
 match =-X, args \{ subss xmm1, [X] \}
 match =*X, args \{ mulss xmm1, [X] \}
common movss [mOut], xmm1 }

fmem outMem,inMem,+mem1,*mem2,-mem3+4

    
Post 21 Jun 2022, 19:44
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 21 Jun 2022, 20:03
I try this, but error movss xmm/2
Code:
macro fmem mOut*, mInp*, [args] { common movss xmm1, [mInp]
forward
 match =+X, args \{ addss xmm1, [X] \}
 match =-X, args \{ subss xmm1, [X] \}
 match =*X, args \{ mulss xmm1, [X] \}
 match =/X, args \{ divss xmm1, [X] \}
 match =|X, args \{ movss xmm/X,xmm1 \} ;this error
common movss [mOut], xmm1 }   

fmem outMem,inMem,+mem1,*mem2,-mem3,+mem1+8,|2
    


Last edited by Roman on 21 Jun 2022, 20:20; edited 1 time in total
Post 21 Jun 2022, 20:03
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 21 Jun 2022, 20:19
Now i do this. work fine
Code:
macro fmem mOut*, mInp*, [args] { common movss xmm1, [mInp]
forward
 match =+X, args \{ addss xmm1, [X] \}
 match =-X, args \{ subss xmm1, [X] \}
 match =*X, args \{ mulss xmm1, [X] \}
 match =/X, args \{ divss xmm1, [X] \}
 match =|X, args \{ movss X,xmm1 \}
 match =&+X, args \{ addss xmm1,X \}
 match =&-X, args \{ subss xmm1,X \}
 match =&*X, args \{ mulss xmm1,X \}
 match =&/X, args \{ divss xmm1,X \}
common movss [mOut], xmm1 } 

fmem outMem,inMem,+mem1,*mem2,-mem3,+mem1+8,|xmm2,/mem1,&+xmm2,&-xmm2,&/xmm2
    
Post 21 Jun 2022, 20:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.