News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Which ml.exe is ... which?

Started by SnowCrash, August 11, 2020, 08:34:12 PM

Previous topic - Next topic

SnowCrash

Hello all,

I chose to copy as per I believe, the last masm32 installation dialog, the ml.exe executable from my VC install directory to the newly installed masm32 directory for updated functionality. After doing a search using Agent Ransack I came across the following:

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x86\ml.exe 627 KB Application
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx86\x86\ml.exe 478 KB Application

My question is, I assume the first executable is for 64 bit MASM code: is this assumption correct? Secondly, if so could I copy it to the masm directory and use it instead, or do I need to do something more involved to get 64 bit masm functionality?

Thanks.

hutch--

Use the smaller one, the other does not run that well.

Vortex

#2
QuoteWhen you install a C++ workload in the Visual Studio installer, it always installs 32-bit, x86-hosted, native and cross compiler tools to build x86 and x64 code. If you include the Universal Windows Platform workload, it also installs x86-hosted cross compiler tools to build ARM code. If you install these workloads on a 64-bit, x64 processor, you also get 64-bit native and cross compiler tools to build x86, x64, and ARM code. The 32-bit and 64-bit tools generate identical code, but the 64-bit tools support more memory for precompiled header symbols and the Whole Program Optimization (/GL and /LTCG) options. If you run into memory limits when you use the 32-bit tools, try the 64-bit tools.

https://docs.microsoft.com/en-us/cpp/build/how-to-enable-a-64-bit-visual-cpp-toolset-on-the-command-line?view=vs-2019

hutch--

There are a few things involved there, ML.EXE is the 32 bit assembler, ML64.EXE is the 64 bit version. In the VS distribution you have 32 bit hosts and 64 bit hosts, if you are writing assembler on your own PC use the host 32 files as the host 64 versions are bigger and slower.

If you use the 32 bit ML version to replace the very old one in the MASM32 SDK, it means you can use the AVX and AVX2 instruction sets that any of the old ones cannot handle as the instructions did not exist back then.

For your amusement, here is an AVX2 block copy using a YMM register built with the 32 bit version of ML.EXE.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE

aligned_block_copy proc

  ; src = eax
  ; dst = edx
  ; cnt = ecx

    shr ecx, 5                                           ; div by 32

  @@:
    vmovntdqa ymm0, YMMWORD PTR [eax]
    vmovntdq YMMWORD PTR [edx], ymm0

    add eax, 32
    add edx, 32
    sub ecx, 1
    jnz @B

    ret

aligned_block_copy endp

OPTION PROLOGUE:PrologueDef
OPTION EPILOGUE:EpilogueDef

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

SnowCrash

Thanx Hutch, thanx Vortex, for your time and your responses..