News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

SSE2 macros for ML 6.14 by Daydreamer

Started by hutch--, March 07, 2005, 11:04:04 PM

Previous topic - Next topic

hutch--

Magnus is doing some great work here as his work will make ML 6.14 viable until the end of 32 bit Windows. I have re-attached his latest version of the macros so they are easier to find.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Jimg

#1
I'm having a little trouble iincluding these macros.

This one doesn't look right:
ORPD MACRO M1,M2
    DB 066H
    ORPS MACRO M1,M2
ENDM


After fixing that, it hates these two:

CMPLTSD MACRO M1,M2
    DB 0F2H
    CMPLTPS M1,M2
END
andCMPSD MACRO M1,M2,M3
    DB 0F2H
    CMPPS M1,M2,M3
ENDM


The first one is missing then M on ENDM and CMPSD is reserved as a standard instruction.

daydreamer

#2
thanks for the feedback Jim, fixed those
I dont have 6.14 so I could check them

[attachment deleted by admin]

hutch--

Magnus,

Could you just get the 6.14 version of ML.EXE from MASM32 ? It would certainly make testing the macros a lot easier.

I keep a trick for different versions of ML, I have a couple of versions renamed and a batch file for each that overwrites the existing version with a copy of which ever one I choose to use.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

I wonder if there is an easy solution to the ambiguous names of a few of the SSE2 instructions. From memory MOVSD has been reused but there is no reliable way unless something tricky was done.

You can remove MOVSD as a keyword and redefine it as a macro of the same name and determine if there are arguments or not but I am not sure it would work after REP which is how MOVSD is usually used.

The macro would basically be if there are no arguments then its an integer string instruction where if it is  an SSE2 instruction it will have parameters. I think they are complicated macros to write though.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

AeroASM

Also in SSE and beyond, movdqa, movaps and movapd all do the same thing, yet they all have different encodings. Why?

daydreamer

Quote from: hutch-- on March 10, 2005, 11:15:01 AM
I wonder if there is an easy solution to the ambiguous names of a few of the SSE2 instructions. From memory MOVSD has been reused but there is no reliable way unless something tricky was done.

You can remove MOVSD as a keyword and redefine it as a macro of the same name and determine if there are arguments or not but I am not sure it would work after REP which is how MOVSD is usually used.

The macro would basically be if there are no arguments then its an integer string instruction where if it isĀ  an SSE2 instruction it will have parameters. I think they are complicated macros to write though.
OPTION NOKEYWORD:<CMPSD MOVSD etc

yes but how do I make MMX that takes .xmm regs instead of .mmx regs for SSE2 integer ones?

AeroASM

Just use the instruction: e.g. instead of paddd mm0,mm1 you would use paddd xmm0,xmm1.

If you need help look in the Intel IA-32 manuals

daydreamer

Quote from: AeroASM on March 22, 2005, 06:23:29 PM
Just use the instruction: e.g. instead of paddd mm0,mm1 you would use paddd xmm0,xmm1.

If you need help look in the Intel IA-32 manuals
no I need to look at masm macro capibilities=masm manuals
http://doc.ddart.net/asm/Microsoft_MASM_Programmers_Guide_v6.1/Chap_09.htm
if you are interested in learn macros

hutch--

Magnus,

I had a play with removing some of the ambiguous instructions and creating a macro that does both variations but I could not get it to work with REP. MOVSD is an example where you can detect the parameters which makes it an SSE instruction or without parameters its a string instruction and it worked by itself but not with REP.

I wonder if a macro with MOVS can do the job instead ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

daydreamer

Quote from: hutch-- on March 23, 2005, 01:49:17 AM
Magnus,

I had a play with removing some of the ambiguous instructions and creating a macro that does both variations but I could not get it to work with REP. MOVSD is an example where you can detect the parameters which makes it an SSE instruction or without parameters its a string instruction and it worked by itself but not with REP.

I wonder if a macro with MOVS can do the job instead ?
but do you really need REP MOVSD, when you choose to write SSE2 and includes the macros, when you have movdqa,movaps,movapd?


AeroASM

How about just learning the opcode sequence for rep movsd and inserting it with db?

daydreamer

could we have this sticky, so they are not forgotten Hutch?
some SSE/SSE2 doc also heree


[attachment deleted by admin]


Rockoon

Quote from: AeroASM on March 11, 2005, 07:51:25 PM
Also in SSE and beyond, movdqa, movaps and movapd all do the same thing, yet they all have different encodings. Why?

Because they do not necessarily "do the same thing" .. while current incarnations might perform the exact same work (I am not convinced), later on they may want to put in rounding control, floating point normalization, and other goodies on the floating point versions. In short, context may become important.

Use the one that addresses your datatype to avoid any nasty compatability issues in the future.
When C++ compilers can be coerced to emit rcl and rcr, I *might* consider using one.