News:

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

Possible problems with SSE usage.

Started by KeepingRealBusy, July 07, 2010, 12:57:11 AM

Previous topic - Next topic

KeepingRealBusy

Is there any way to force PROC stack variables to be 16 byte aligned? The best I can do is:


    Local Var1OWORD
    Local Var2OWORD
    Local Var3OWORD

   movdqa OWORD PTR Var1,xmm0
   movdqa OWORD PTR Var2,xmm1
   movdqa OWORD PTR Var3,xmm2


This assembles and reserves space, but no attempt to align.

All I can see to do is:


    Local Var1[16]:DWORD    ; need 3 OWORDS or 12 BYTES

   lea edx,var1
   lea edx,[edx+15]
   and edx,-16
   movdqa OWORD PTR [edx], xmm0
   movdqa OWORD PTR [edx+16], xmm1
   movdqa OWORD PTR [edx+32], xmm2


Note: This takes 3 instructions just to set the address of the aligned variables, just to save doing an unaligned movdqu (and later the same for the restore).

Just one more question. I have been using the following command line option, "/Sg" which I found documented in Kip's book, 4th ed. This was for MASM 6.15. The option said "Turn on listing of assembly-generated code." MASM 9.0 and JWASM both accept the option. This is not documented in the current MSDN that came with MASM 9.0 Visual Studio 8.0), nor in the help file in MASM32 lib. Is this option just accepted and ignored, or is it just not documented? Does this option do anything?

dedndave

that's strange
i don't see /Sg in my list (6.14)
to generate assembler listings, i have been using /Fl  <--------- that's a lower case L
C:\ => ml /help
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

        ML [ /options ] filelist [ /link linkoptions ]

/AT Enable tiny model (.COM file)         /nologo Suppress copyright message
/Bl<linker> Use alternate linker          /Sa Maximize source listing
/c Assemble without linking               /Sc Generate timings in listing
/Cp Preserve case of user identifiers     /Sf Generate first pass listing
/Cu Map all identifiers to upper case     /Sl<width> Set line width
/Cx Preserve case in publics, externs     /Sn Suppress symbol-table listing
/coff generate COFF format object file    /Sp<length> Set page length
/D<name>[=text] Define text macro         /Ss<string> Set subtitle
/EP Output preprocessed listing to stdout /St<string> Set title
/F <hex> Set stack size (bytes)           /Sx List false conditionals
/Fe<file> Name executable                 /Ta<file> Assemble non-.ASM file
/Fl[file] Generate listing                /w Same as /W0 /WX
/Fm[file] Generate map                    /WX Treat warnings as errors
/Fo<file> Name object file                /W<number> Set warning level
/FPi Generate 80x87 emulator encoding     /X Ignore INCLUDE environment path
/Fr[file] Generate limited browser info   /Zd Add line number debug info
/FR[file] Generate full browser info      /Zf Make all symbols public
/G<c|d|z> Use Pascal, C, or Stdcall calls /Zi Add symbolic debug info
/H<number> Set max external name length   /Zm Enable MASM 5.10 compatibility
/I<name> Add include path                 /Zp[n] Set structure alignment
/link <linker options and libraries>      /Zs Perform syntax check only


wow - i am not using the version i thought i was   :lol
and i spent all that time patching it, too
now, i hafta go patch 6.15

KeepingRealBusy

Dave,

I think the difference is that /Fl produces a listing (if you have .list in the source), but if a macro is used, output of generated code could be suppressed, unless /Sg was used. I have not tried to use /Sg without .list (I just did - /Sg does not override a missing .list). I will check for macro expansion. Note: Still do not know whether /Sg is actually supported, or just tolerated.

Dave.

KeepingRealBusy

The reference in Kip's book said the information "came from the last printed documentation from the MASM 6.11 reference manual", ... "with updated from MASM 6.14 readme.txt file".

Dave

KeepingRealBusy

Dave,

Do you have any words of wisdom about stack alignment of OWORDS?

Dave.

GregL

It is listed in MASMREF.DOC that came with the Processor Pack for VC 6.0 that included ML.EXE 6.15.
Quote/Sg   Turns on listing of assembly-generated code.


Regarding alignment, how about using malloc_align().

dedndave

ok - patched 6.15 and put together a new ML615 package
it contains the document from VS6, as well as the ReadMe's and a few others

http://www.4shared.com/file/-QIUp-BF/ml615.html

be sure to read the ML_ver.txt file

dedndave

QuoteDo you have any words of wisdom about stack alignment of OWORDS?

it's nice to be wanted, but i am probably not the guy to ask - lol
i would think that Jochen, MichaelW, qWord and the other guys are far more qualified to help on this one
the probelm is - many of the guys that have experience writing alignment macros aren't using 64-bit machines   :P

but, i would think that a creatively designed macro could replace the INVOKE macro/functionality of ml32 in ml64
these guys are good at macros - i bet they could write one that would align the stack in and out

GregL

Well now I know where I stand.  :wink

I am not an expert at SSE, but what's wrong with ALIGN 16 to align the LOCALs?

dedndave

lol Greg - i meant nothing like that at all
i just happen to know those guys have played specifically with alignment macros   :P
and, i thought i covered my ass bases with...
Quote...and the other guys

Queue

dedndave, I'm confused by what the patch to /help does; /? and /help both show the list of switches for vanilla ML.EXE 6.15. Is /help meant to do something else? And does it do something else post-patch, because trying your patched ML.EXE, /? and /help still both show the list of switches.

Queue

dedndave

be careful that you are executing the right copy of ML   :bg
try ML615 /?
if you have ML in the path, you are looking at whatever version you have in the bin folder (probably)
i tested version 6.15.8803 and it fails for "/?", but works for "/help"
i didn't really patch any code on that
all i did was change the displayed string from
usage: ML [ options ] filelist [ /link linkoptions]
Run "ML /help" or "ML /?" for more info

to
usage: ML [ options ] filelist [ /link linkoptions]
Run "ML /help" for more info

for some reason, the parser sees "/?" as "/r"

the original (unpatched) 6.15.8803 displays the following...
C:\=> ml /?
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.

MASM : warning A4018: invalid command-line option : /R
MASM : fatal error A1017: missing source filename

"?" is a filenaming wildcard character, i guess - lol
i dunno
i looked at the code that parses it to see about fixing it
it was over-complicated, if you ask me - lol
so, i just changed the displayed string
that is a good way to verify you have the patched version, i suppose

sinsi


C:\Utils>ml /?
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.


        ML [ /options ] filelist [ /link linkoptions ]

/AT Enable tiny model (.COM file)         /omf generate OMF format object file
/Bl<linker> Use alternate linker          /Sa Maximize source listing
/c Assemble without linking               /Sc Generate timings in listing
/Cp Preserve case of user identifiers     /Sf Generate first pass listing
/Cu Map all identifiers to upper case     /Sl<width> Set line width
/Cx Preserve case in publics, externs     /Sn Suppress symbol-table listing
/coff generate COFF format object file    /Sp<length> Set page length
/D<name>[=text] Define text macro         /Ss<string> Set subtitle
/EP Output preprocessed listing to stdout /St<string> Set title
/F <hex> Set stack size (bytes)           /Sx List false conditionals
/Fe<file> Name executable                 /Ta<file> Assemble non-.ASM file
/Fl[file] Generate listing                /w Same as /W0 /WX
/Fm[file] Generate map                    /WX Treat warnings as errors
/Fo<file> Name object file                /W<number> Set warning level
/FPi Generate 80x87 emulator encoding     /X Ignore INCLUDE environment path
/Fr[file] Generate limited browser info   /Zd Add line number debug info
/FR[file] Generate full browser info      /Zf Make all symbols public
/G<c|d|z> Use Pascal, C, or Stdcall calls /Zi Add symbolic debug info
/H<number> Set max external name length   /Zm Enable MASM 5.10 compatibility
/I<name> Add include path                 /Zp[n] Set structure alignment
/link <linker options and libraries>      /Zs Perform syntax check only
/nologo Suppress copyright message

Light travels faster than sound, that's why some people seem bright until you hear them.

Queue

I double-checked, and even with your patched ML615.EXE, /? shows the switches, so I don't think I'm even encountering the problem you are. I have a vanilla 6.15 and a patched 6.15; the difference between my patched 6.15 and yours (ignoring the changes to the string you modified and the version number you tweaked) is a single byte at F6B8; in mine it's 0E, and in yours it's 7F. I'm mainly curious as to what that single byte difference is.

Queue

dedndave

ok - i downloaded the original file from

http://win32assembly.online.fr/download.html

it is version 6.15.8803
is that what you have ?

the byte at offset F6B8 is 0E

i renamed ml.exe to mx.exe and ml.err to mx.err to avoid confusion with the pathed copy...
C:\=> mx /?
Microsoft (R) Macro Assembler Version 6.15.8803
Copyright (C) Microsoft Corp 1981-2000.  All rights reserved.

MASM : warning A4018: invalid command-line option : /R
MASM : fatal error A1017: missing source filename


modifying that byte to 7F has no affect on the "/?" output