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