flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro sse math

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 23 Nov 2022, 14:16
Fasmw 1.73
I want write macro xmath
Code:
xmath a1,*,b1,+,[c1],*,e1
    

This generate code
Code:
a1 equ xmm0
b1 equ xmm1
e1 equ xmm2
mulss xmm0,xmm1
addss xmm0,[c1]
mulss xmm0,xmm2
    
Post 23 Nov 2022, 14:16
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 24 Nov 2022, 01:19
Post 24 Nov 2022, 01:19
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 24 Nov 2022, 07:24
Thanks.
But i want easy write code and human-readable in fasm without godbolt
Post 24 Nov 2022, 07:24
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1821
Roman 25 Nov 2022, 11:40
My first variant.
Code:
macro xstt [arg] {
      forward
      xstt_eq equ arg
      common
__c equ 0
irpv v,xstt_eq \{ rept 1 num:__c+1 \\{ v equ xmm\\#num
     movss v,[eax+\\#num*4-4]
                                __c equ num \\} \}
      }
macro xmov reg,[args]  {
                    forward
                    match =*X, args \{ mulss xmm#reg, X \}
                    match =+X, args \{ addss xmm#reg, X \}
                    match =-X, args \{ subss xmm#reg, X \}
                    match =/X, args \{ divss xmm#reg, X \}
                    match =~X, args \{ comiss xmm#reg, X \}
                    match =|X, args \{ movss X,xmm#reg \}
                 }
macro rstxs {
      irpv v,xstt_eq \{ restore xstt_eq
      \}
      } 
;data zkk dd 4.0,2.0,3.0,5.0
                mov eax,zkk
                xstt x1,y1,z1
                ttt equ +x1
                tt2 equ *y1
                ttz equ /xmm5
                ttr equ ~xmm5
                xmov 1,ttt,tt2,ttz,ttr,wtr
                xmov 0,+x1,*y1,/xmm5,*y1

                rstxs
                xstt r1,t1,w1
                movss t1,xmm0               
    
Post 25 Nov 2022, 11:40
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.