flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > macro irpv if error

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 13 Mar 2023, 11:09
Code:
macro used [pp] {
forward      
eq_used_ equ pp
      }
macro copy s,to,xr=xmm0 { 
      irpv v,eq_used_   \{ if v = xr ;fasm error invalid value if xmm0=xmm0
                        xr = xmm7 ;ideal must get next xmm3. xr = xmm3
                        end if
      \}
      
  movss xr,[s]
      movss [to],xr    
      }  
;data
c1 dd 4,4
c2 dd 0,0
;in code
used xmm0,xmm2
copy c1,c2   ;must changed xmm0 to xmm7
    
Post 13 Mar 2023, 11:09
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 13 Mar 2023, 12:06
I change if v = xr on if v eq xr
Now work fine.
Code:
macro copy s,to,xr=xmm0 { 
      irpv v,eq_used_   \{ if v eq xr ;fasm error invalid value if xmm0=xmm0
                        xr equ xmm7 ;ideal must get next xmm3. xr = xmm3
                        end if
      \}
      
  movss xr,[s]
      movss [to],xr    
      } 
    


Last edited by Roman on 13 Mar 2023, 12:08; edited 1 time in total
Post 13 Mar 2023, 12:06
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 670
Location: Ukraine
Overclick 13 Mar 2023, 12:08
Code:
macro copy s,to,xr {
        if xr eq
              define xr_used xmm0
        else
              define xr_used xr
        end if
      irpv v,eq_used_   \{
                if v eq xr_used
                        define xr_used xmm7
                end if
      \}
      movss xr_used,[s]
      movss [to],xr_used
      }      
Post 13 Mar 2023, 12:08
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 13 Mar 2023, 12:22
When I do used xmm0, all copy using xmm7
Even I do irpv v,eq_used_ { restore eq_used_ }
Code:
used xmm0
copy c1,c2 ;using xmm7
irpv v,eq_used_   { restore eq_used_    }
copy c1,c2  ;i expected xmm0, but get xmm7
    


I found solution.

Code:
macro copy s,to,xr=xmm0 { 
define xr xmm0
      irpv v,eq_used_   \{ if v eq xr 
                        define xr xmm7 
                        end if
      \}
      
  movss xr,[s]
      movss [to],xr    
      } 
    
Post 13 Mar 2023, 12:22
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1872
Roman 13 Mar 2023, 14:21
Strange if used xmm3,xmm2
Macro copy set xr as xmm7, but not xmm0

How I understood if eq_used_ have any value in macro copy do irpv and set anyways xr as xmm7.

I wanted xr set as xmm7 if only v(=xmm0)
If v = xmm2 or xmm5 , xr must be as xmm0
Post 13 Mar 2023, 14:21
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20486
Location: In your JS exploiting you and your system
revolution 14 Mar 2023, 00:44
If you need to compare non-numeric values use eq
Code:
if ax eq ax    
Post 14 Mar 2023, 00:44
View user's profile Send private message Visit poster's website 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.