dpdk/buildtools/binutils-avx512-check.py
<<
>>
Prefs
   1#! /usr/bin/env python3
   2# SPDX-License-Identifier: BSD-3-Clause
   3# Copyright(c) 2020 Intel Corporation
   4
   5import subprocess
   6import sys
   7import tempfile
   8
   9objdump, *cc = sys.argv[1:]
  10with tempfile.NamedTemporaryFile() as obj:
  11    # On Windows, the file is opened exclusively and is not writable.
  12    obj.close()
  13    # from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028
  14    gather_params = '0x8(,%ymm1,1),%ymm0{%k2}'
  15    src = '__asm__("vpgatherqq {}");'.format(gather_params).encode('utf-8')
  16    subprocess.run(cc + ['-c', '-xc', '-o', obj.name, '-'], input=src, check=True)
  17    asm = subprocess.run([objdump, '-d', '--no-show-raw-insn', obj.name],
  18                         stdout=subprocess.PIPE, check=True).stdout.decode('utf-8')
  19    if gather_params not in asm:
  20            print('vpgatherqq displacement error with as')
  21            sys.exit(1)
  22