numam-dpdk/buildtools/binutils-avx512-check.py
Josh Soref 7be78d0279 fix spelling in comments and strings
The tool comes from https://github.com/jsoref

Signed-off-by: Josh Soref <jsoref@gmail.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2022-01-11 12:16:53 +01:00

22 lines
831 B
Python

#! /usr/bin/env python3
# SPDX-License-Identifier: 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)