2 ## --------------------------------------------------------------------------
4 ## Copyright 1996-2017 The NASM Authors - All Rights Reserved
5 ## See the file AUTHORS included with the NASM distribution for
6 ## the specific copyright holders.
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted provided that the following
10 ## conditions are met:
12 ## * Redistributions of source code must retain the above copyright
13 ## notice, this list of conditions and the following disclaimer.
14 ## * Redistributions in binary form must reproduce the above
15 ## copyright notice, this list of conditions and the following
16 ## disclaimer in the documentation and/or other materials provided
17 ## with the distribution.
19 ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
20 ## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 ## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 ## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 ## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 ## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 ## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 ## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31 ## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 ## --------------------------------------------------------------------------
36 # inslist.pl produce inslist.src
39 print STDERR
"Reading insns.dat...\n";
43 foreach $arg ( @ARGV ) {
44 if ( $arg =~ /^\-/ ) {
45 if ( $arg =~ /^\-([adins])$/ ) {
48 die "$0: Unknown option: ${arg}\n";
55 $fname = "../insns.dat" unless $fname = $args[0];
56 open (F
, '<', $fname) || die "unable to open $fname";
57 print STDERR
"Writing inslist.src...\n";
58 open S
, '>', 'inslist.src';
63 next if (/^\s*$/); # blank lines
64 if ( /^\s*;/ ) # comments
66 if ( /^\s*;\#\s*(.+)/ ) # section subheader
68 print S
"\n\\S{} $1\n\n";
73 unless (/^\s*(\S+)\s+(\S+)\s+(\S+|\[.*\])\s+(\S+)\s*$/) {
74 warn "line $line does not contain four fields\n";
77 my @entry = ($1, $2, $3, $4);
79 $entry[1] =~ s/ignore//;
80 $entry[1] =~ s/void//;
82 my @flags = split(/,/, $entry[3]);
87 next if ($fl =~ /^(ignore|SB|SM|SM2|SQ|AR2|FUTURE)$/);
89 if ($fl =~ /^AVX512(.*)$/) {
91 push(@avx512fl, $1) unless ($1 eq '');
98 unshift(@nflags, "AVX512".join('/', @avx512fl));
101 printf S
"\\c %-16s %-24s %s\n",$entry[0],$entry[1], join(',', @nflags);
107 printf STDERR
"Done: %d instructions\n", $insns;