Please mention UASM in README file
A free file archiver for extremely high compression
Brought to you by:
ipavlov
Right now the README file mentions only asmc and JWasm.
But building 7z with ASM enabled works with UASM too:
git clone -b v2.57 --depth 1 https://github.com/Terraspace/UASM # master branch doesn't build
cd UASM
make -j4 -f Makefile-Linux-GCC-64.mak # lots of warnings
UASM="$PWD/GccUnixR/uasm"
cd "$HOME/Downloads/7z2408-src/CPP/7zip/Bundles/Alone2"
make -f makefile.gcc -j4 IS_X64=1 USE_ASM=1 MY_ASM="$UASM"
The advantage of uasm is that it's written in C (more portability, easier to modify, more likely to become included in a Linux distro, etc).
By the way, why isn't the x86 asm written in a NASM compatible dialect?
Some 7-zip's x86 asm code is old and it was developed for Windows / MSVS only that old time. And masm is part of MSVS. So it was simplest solution to use default primary Windows compilers: MSVC and masm.
NASM is some third-party program for Windows. It didn't provide any gain for 7-zip Windows that time.
When I developed the code for linux port of 7-zip, I just tried to reuse the working masm code from Windows version of 7-Zip. And only asmc provided full compatibility for all instructions that were used by 7-Zip's asm code.
JWASM didn't support some extensions (AES-NI as I remember).
Last edit: Igor Pavlov 2024-10-03
Thanks for the quick answer.
I understand that, use MASM if you develop for windows only. But UASM seems to work too, so if you can confirm that, shouldn't it be mentioned as an alternative to asmc and jwasm in the documentation?
by the way, can compiler-specific (gcc/clang) intrinsics be used as a fall-back method in case a masm-compatible assembler is missing?
Yes, I can include UASM in docs. But I didn't test UASM myself.
Intrinsics can't help for lzma decoding code now, because we need intrinsic for
cmov
instruction, but there is no intrinsic for that instruction as I suppose. It's possible to use inline GNU asm forcmov
in GCC/CLANG, but it will require some developing work. I suppose latest versions of xz utils use that way. Maybe I'll try that way too later.if we use GNU asm / C mix for lzma decoder, I suppose we can't get 100% of speed of asm version still, because smart register allocation also can be important for performance.
But we still will have performance improvement over c version, because
CMOV
is much faster than conditional jump for unpredictable branches.Last edit: Igor Pavlov 2024-10-05
Thanks! I've tested it again and it definitely works.
Get UASM-2.57r from https://github.com/Terraspace/UASM/releases
Compile with "make -f Makefile-Linux-GCC-64.mak -j4"
Copy GccUnixR/uasm into PATH and rename to asmc
Get 7z2408-src and compile: