dpdk-fm10k/buildtools/binutils-avx512-check.sh
Bruce Richardson 68b1f1cda5 build: check AVX512 rather than binutils version
Rather than checking the binutils version number, which can lead to
unnecessary disabling of AVX512 if fixes have been backported to distro
versions, we can instead check the output of "as" from binutils to see if
it is correct.

The check in the script uses the minimal assembly reproduction code posted
to the public bug tracker for gcc/binutils for those issues [1]. If the
binutils bug is present, the instruction parameters - specifically the
displacement parameter - will be different in the disassembled output
compared to the input. Therefore the check involves assembling a single
instruction and disassembling it again, checking that the two match.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
2020-07-05 21:32:40 +02:00

17 lines
514 B
Bash
Executable file

#! /bin/sh
# SPDX-License-Identifier: BSD-3-Clause
# Copyright(c) 2020 Intel Corporation
AS=${AS:-as}
OBJFILE=$(mktemp -t dpdk.binutils-check.XXXXXX.o)
trap 'rm -f "$OBJFILE"' EXIT
# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
GATHER_PARAMS='0x8(,%ymm1,1),%ymm0{%k2}'
# assemble vpgather to file and similarly check
echo "vpgatherqq $GATHER_PARAMS" | $AS --64 -o $OBJFILE -
objdump -d --no-show-raw-insn $OBJFILE | grep -q $GATHER_PARAMS || {
echo "vpgatherqq displacement error with as"
exit 1
}