bb9cd91095
buildtools/binutils-avx512-check.sh was Unix-only and could not be used in cross builds: 1) written in shell; 2) used the assembler binary that may be missing, e.g. when building on Windows with LLVM; 3) located the assembler as ${AS:-as} and referenced objdump, but those binaries may be overridden via --cross-file. Rewrite the script in Python. Use the C compiler for the check. Locate objdump and the C compiler using Meson. Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
22 lines
832 B
Python
22 lines
832 B
Python
#! /usr/bin/env python3
|
|
# SPDX-License-Identitifer: BSD-3-Clause
|
|
# Copyright(c) 2020 Intel Corporation
|
|
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
objdump, *cc = sys.argv[1:]
|
|
with tempfile.NamedTemporaryFile() as obj:
|
|
# On Windows, the file is opened exclusively and is not writable.
|
|
obj.close()
|
|
# from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
|
|
gather_params = '0x8(,%ymm1,1),%ymm0{%k2}'
|
|
src = '__asm__("vpgatherqq {}");'.format(gather_params).encode('utf-8')
|
|
subprocess.run(cc + ['-c', '-xc', '-o', obj.name, '-'], input=src, check=True)
|
|
asm = subprocess.run([objdump, '-d', '--no-show-raw-insn', obj.name],
|
|
capture_output=True, check=True).stdout.decode('utf-8')
|
|
if gather_params not in asm:
|
|
print('vpgatherqq displacement error with as')
|
|
sys.exit(1)
|