AVX-512: Add a feature to generate a raw bytecode file

From gas testsuite file, a text file containing raw bytecodes
is useful when verifying the output of NASM.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
Jin Kyu Song 2013-08-23 18:40:49 -07:00 committed by Cyrill Gorcunov
parent f9442f67d5
commit fe0ee08586

View File

@ -21,6 +21,9 @@ def setup():
parser.add_option('-b', dest='bits', action='store',
default="",
help='Bits for output ASM file.')
parser.add_option('-r', dest='raw_output', action='store',
default="",
help='Name for raw output bytes in text')
(options, args) = parser.parse_args()
return options
@ -77,11 +80,19 @@ def write(data, options):
outstr = outstrfmt % tuple(insn)
out.write(outstr)
def write_rawbytes(data, options):
if options.raw_output:
with open(options.raw_output, 'wb') as out:
for insn in data:
out.write(insn[0] + '\n')
if __name__ == "__main__":
options = setup()
recs = read(options)
print "AVX3.1 instructions"
write_rawbytes(recs, options)
recs = commas(recs)
write(recs, options)