[Cin] AVX512 asm instructions - idea for configure.ac

Andrew Randrianasulu randrianasulu at gmail.com
Fri Mar 20 08:26:30 CET 2020


Oh, i was looking at recent fail-out from libdav1d upgrade...

It seems proper course of action is to add configure.ac check for nasm 
supporting specific new instructions, and if not - disabling internal dav1d build
(or may be swicthed to old version of it?)

Right now there is already one check:

## arch dep tests
ARCH=[`uname -m`]
I86=[`expr "x$ARCH" : 'xi[346]86.*'`]
X86=[`expr "x$ARCH" : 'x..._64*'`]

if test "x$I86$X86" != "x00" ; then
  # Checks for ix86 programs.
  REQUIRE_PROG(NASM, [nasm])
  # libx264 nasm fix
  AC_MSG_CHECKING([nasm x264 compatible])
  echo "vmovdqa32 [[eax]]{k1}{z}, zmm0" > conftest.asm
  nasm conftest.asm -o conftest.o > /dev/null 2>&1
  if test $? != 0 ; then
   AC_MSG_RESULT([no])
   AC_MSG_WARN([libx264 built without assembly code])
   X264_CFG_PARAMS="$X264_CFG_PARAMS --disable-asm"
  else
   AC_MSG_RESULT([yes])
  fi
  rm -f conftest.asm conftest.o
  REQUIRE_PROG(YASM, [yasm])
fi

as side note I think AC_MSG_WARN([libx264 built without assembly code])
should be read as "[libx264 will be built without assembly code" ?

Now how to test all those other instructions..
I looked at https://repo.or.cz/nasm.git/blob/HEAD:/test/avx512pf.asm


and followed to
http://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gas/testsuite/gas/i386;h=616bd41d18e35d3db44ea290b90df16e3bfd7901;hb=HEAD

some of ..those?
http://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/testsuite/gas/i386/avx512pf.s;h=bfb7a6117bb3d2df9410bc9bd5b57ab60223252f;hb=HEAD

vgatherpf0dpd   1024(%ecx,%ymm7,4){%k1}.  ?

or may be
(note   .intel_syntax  remark! I tried intel2gas but of course it had no idea about those new instructions ...)
http://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gas/testsuite/gas/i386/avx512vbmi_vl.s;h=4e7c20b7c7b3fdd643c640918c603dbafb811b5e;hb=HEAD
vpermb  xmm6{k7}, xmm5, xmm4

this works on nasm 2.14.02:

echo "vpermb  xmm6{k7}, xmm5, xmm4" > test.nasm
nasm test.nasm

hexdump test
0000000 f262 0f55 f48d
0000006

vpermb seems to be new-ish AVX-512 instruction:
https://github.com/WojciechMula/base64simd/issues/5
https://en.wikipedia.org/wiki/Cannon_Lake_(microarchitecture)

oh, this avx-512 series of instructions is a big ...pool of them
Not all supported everywhere even on latest Intel, it seems ....


But we only need nasm check, no?



More information about the Cin mailing list