flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > If val match problem. |
Author |
|
revolution 11 Feb 2024, 09:57
There is no need for all the extra complication. Just directly use addss and forget about the mmmm and ppp stuff.
Code: macro aa h { if h#_typ eq int cvtsi2ss xmm0,[h] else if h#_typ eq flt movss xmm0,[h] addss xmm0,xmm1 else if h#_typ eq vc2 movsd xmm0,[h] addsd xmm0,xmm1 else if h#_typ eq vc4 movups xmm0,dqword [h] addps xmm0,xmm1 end if } val dd 10f,20f,30f,40f val_typ equ vc4 aa val ;display 3 mean vector4, but get fasm error undefined maaappp2 |
|||
11 Feb 2024, 09:57 |
|
Roman 11 Feb 2024, 10:05
I need my variant, because I have many operations(mul,sub,div,sqrt,rsqrt).
Not only add. I want do this: Code: If op eq add match ppp2,ppp \{ maaa\#\\ppp2 xmm0,xmm1 ;get error undefined maaappp2 \} End if If op eq mul match ppp2,ppp \{ muu\#\\ppp2 xmm0,xmm1 ;get error undefined maaappp2 \} End if If op eq sqr match ppp2,ppp \{ msqr\#\\ppp2 xmm0,xmm1 ;get error undefined maaappp2 \} End if Last edited by Roman on 11 Feb 2024, 10:09; edited 1 time in total |
|||
11 Feb 2024, 10:05 |
|
revolution 11 Feb 2024, 10:07
The you can use the macro instead.
Code: else if h#_typ eq flt movss xmm0,[h] maaa1 xmm0,xmm1 |
|||
11 Feb 2024, 10:07 |
|
macomics 11 Feb 2024, 11:45
Code: macro maaa1 a,b { addss a,b } macro maaa2 a,b { addsd a,b } macro maaa3 a,b { addps a,b } macro aa h { local ppp irpv mmmm,mm \{ restore mm \} match =flt, h#_typ \{ movss xmm0,[h] mmmm equ 1 \} match =mmmm, mmmm \{ match =vc2, h\#_typ \{ movsd xmm0,[h] mmmm equ 2 \} \} match =mmmm, mmmm \{ match =vc4, h\#_typ \\{ movups xmm0,dqword [h] mmmm equ 3 \\} \} match =mmmm, mmmm \{ match =int, h\#_typ \\{ cvtsi2ss xmm0,[h] mmmm equ \\} \} match any, mmmm \{ maaa\#any xmm0,xmm1 \} restore mmmm } val dd 10f,20f,30f,40f val_typ equ vc4 aa val |
|||
11 Feb 2024, 11:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.