ref: 18c01347a4bae8c2a8c7b4771691904850af825e
parent: 07c3fc899a4788187f52b99961c7ae1777201d5b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Dec 4 05:18:41 EST 2018
Big tree rework
--- a/.gitignore
+++ b/.gitignore
@@ -1,23 +1,6 @@
*.o
*.a
-root/libexec/scc/cc1-*
-root/libexec/scc/cc2-*
-root/libexec/scc/as-*
-root/bin/ld
-root/bin/scc
-root/bin/scpp
-root/bin/ar
-root/bin/nm
-root/bin/objdump
-test.log
-cc2/error.h
-instbl.c
-config.mk
-inc/ldflags.h
-inc/sysincludes.h
-inc/syslibs.h
-inc/syscrts.h
-driver/posix/config.h
-as/target/*/*tbl.c
-*.out
-config
+bin/
+lib/
+libexec/
+dirs
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,32 @@
-# scc - Suckless C Compiler
.POSIX:
PROJECTDIR = .
+include $(PROJECTDIR)/scripts/rules.mk
-include rules.mk
+DIRS = src include/scc/scc tests
-DIRS = inc cc1 cc2 driver lib as ar nm objdump ld
+all: src
-all: $(DIRS)
+src: dirs include/scc/scc
-$(DIRS): config FORCE
- +@cd $@ && $(MAKE) all
+dirs: $(SCRIPTDIR)/libc-proto
+ xargs mkdir -p < $(SCRIPTDIR)/libc-proto
+ touch dirs
-clean dep:
+$(DIRS): FORCE
+ +@cd $@ && $(MAKE)
+
+dep:
$(FORALL)
-distclean: unconfig
+clean:
$(FORALL)
- rm -f config
+ rm -rf lib bin libexec dirs
-tests: all
- +@cd tests && $(MAKE) -e all
+distclean: clean
+ +@cd include/scc/scc && $(MAKE) distclean
-unconfig:
- (echo '/^### Systems/,$$ v/^#/ s/^/#/' ; echo w) | ed -s config.mk
- rm -f config
-
-config:
- ./config.sh
- touch $@
+tests: all
install: all
mkdir -p $(DESTDIR)$(PREFIX)/
--- a/ar/Makefile
+++ /dev/null
@@ -1,22 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-OBJ = main.o $(DRIVER)/driver.o
-MORECFLAGS = -I$(DRIVER)
-STDCFLAGS =
-
-all: $(BINDIR)/ar
-
-$(BINDIR)/ar: $(OBJ) $(LIBDIR)/libscc.a
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f *.o $(DRIVER)/*.o $(BINDIR)/ar
-
-include deps.mk
--- a/ar/deps.mk
+++ /dev/null
@@ -1,7 +1,0 @@
-main.o: $(DRIVER)/driver.h
-
-#deps
-main.o: ../inc/ar.h
-main.o: ../inc/arg.h
-main.o: ../inc/scc.h
-posix/driver.o: posix/driver.h
--- a/ar/main.c
+++ /dev/null
@@ -1,643 +1,0 @@
-static char sccsid[] = "@(#) ./ar/main.c";
-
-#include <errno.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <driver.h>
-
-#include "../inc/ar.h"
-#include "../inc/arg.h"
-#include "../inc/scc.h"
-
-enum {
- BEFORE,
- INDOT,
- AFTER,
-};
-
-struct tmp {
- char *name;
- FILE *fp;
-} tmps[3];
-
-char *argv0;
-
-static int bflag, vflag, cflag, lflag, uflag, aflag;
-static char *arfile, *posname;
-
-struct member {
- FILE *src;
- struct ar_hdr hdr;
- int cur;
- char *fname;
- long size;
- long mode;
- long long date;
-};
-
-static void
-cleanup(void)
-{
- int i;
-
- for (i = 0; i < 3; i++) {
- if (tmps[i].name)
- remove(tmps[i].name);
- }
-}
-
-/*
- * I do know that you cannot call remove from a signal handler
- * but we only can use stdio function to deal with files
- * because we are C99 compliant, and it is very likely that
- * remove is going to work in this case
- */
-static void
-sigfun(int signum)
-{
- cleanup();
- _Exit(1);
-}
-
-static FILE *
-openar(void)
-{
- FILE *fp;
- char magic[SARMAG+1];
-
- if ((fp = fopen(arfile,"r+b")) == NULL) {
- if (!cflag)
- fprintf(stderr, "ar: creating %s\n", arfile);
- if ((fp = fopen(arfile, "w+b")) == NULL) {
- perror("ar:opening archive");
- exit(1);
- }
- fputs(ARMAG, fp);
- if (fflush(fp) == EOF) {
- perror("ar:writing magic number");
- exit(1);
- }
- } else {
- if (fgets(magic, sizeof(magic), fp) == NULL) {
- perror("ar:error reading magic number");
- exit(1);
- }
- if (strcmp(magic, ARMAG)) {
- fprintf(stderr,
- "ar:%s:invalid magic number '%s'\n",
- arfile,
- magic);
- exit(1);
- }
- }
- return fp;
-}
-
-static void
-archive(char *fname, FILE *to, char letter)
-{
- int c;
- size_t n;
- FILE *from;
- char mtime[13];
- struct stat st;
-
- if (vflag)
- printf("%c - %s\n", letter, fname);
- if (strlen(fname) > 16)
- fprintf(stderr, "ar:%s: too long name\n", fname);
- if ((from = fopen(fname, "rb")) == NULL) {
- fprintf(stderr,
- "ar:opening member '%s':%s\n",
- fname,
- strerror(errno));
- exit(1);
- }
- if (stat(fname, &st) < 0) {
- fprintf(stderr, "ar:error getting '%s' attributes\n", fname);
- exit(1);
- }
- strftime(mtime, sizeof(mtime), "%s", gmtime(&st.st_mtime));
- fprintf(to,
- "%-16.16s%-12s%-6u%-6u%-8o%-10llu`\n",
- fname,
- mtime,
- st.st_uid,
- st.st_gid,
- st.st_mode,
- (unsigned long long) st.st_size);
- for (n = 0; (c = getc(from)) != EOF; n++)
- putc(c, to);
- if (n & 1)
- putc('\n', to);
- if (ferror(from)) {
- fprintf(stderr,
- "ar:reading input '%s':%s\n",
- fname, strerror(errno));
- exit(1);
- }
- fclose(from);
-}
-
-static void
-append(FILE *fp, char *argv[])
-{
- char *fname;
-
- if (fseek(fp, 0, SEEK_END) == EOF) {
- perror("ar:seeking archive");
- exit(1);
- }
-
- for ( ; fname = *argv; ++argv) {
- *argv = NULL;
- archive(fname, fp, 'a');
- }
-
- if (fclose(fp) == EOF) {
- perror("ar:error writing archive");
- exit(1);
- }
-}
-
-static void
-copy(struct member *m, struct tmp *tmp)
-{
- int c;
- size_t siz = m->size;
- struct ar_hdr *hdr = &m->hdr;
-
- fwrite(hdr, sizeof(*hdr), 1, tmp->fp);
- if ((siz & 1) == 1)
- siz++;
- while (siz--) {
- if ((c = getc(m->src)) == EOF)
- break;
- fputc(c, tmp->fp);
- }
-}
-
-static void
-letters(unsigned long val, char *s)
-{
- *s++ = (val & 04) ? 'r' : '-';
- *s++ = (val & 02) ? 'w' : '-';
- *s++ = (val & 01) ? 'x' : '-';
-}
-
-static char *
-perms(struct member *m)
-{
- static char buf[10];
-
- letters(m->mode >> 6, buf);
- letters(m->mode >> 3, buf+3);
- letters(m->mode, buf +6);
- buf[9] = '\0';
-
- return buf;
-}
-
-static int
-inlist(char *fname, int argc, char *argv[])
-{
- for (; argc-- > 0; ++argv) {
- if (*argv && !strcmp(*argv, fname)) {
- *argv = NULL;
- return 1;
- }
- }
- return 0;
-}
-
-static void
-move(struct member *m, int argc, char *argv[])
-{
- int where;
-
- if (inlist(m->fname, argc, argv)) {
- if (vflag)
- printf("m - %s\n", m->fname);
- where = INDOT;
- } else if (posname && !strcmp(posname, m->fname)) {
- where = (bflag) ? AFTER : BEFORE;
- m->cur = AFTER;
- } else {
- where = m->cur;
- }
- copy(m, &tmps[where]);
-}
-
-static void
-insert(int argc, char *argv[])
-{
- for (; argc-- > 0; ++argv) {
- if (*argv) {
- archive(*argv, tmps[INDOT].fp, 'a');
- *argv = NULL;
- }
- }
-}
-
-static void
-update(struct member *m, int argc, char *argv[])
-{
- int where;
- FILE *fp = tmps[BEFORE].fp;
-
- if (inlist(m->fname, argc, argv)) {
- archive(m->fname, tmps[m->cur].fp, 'r');
- return;
- } else if (posname && !strcmp(posname, m->fname)) {
- where = (bflag) ? AFTER : BEFORE;
- m->cur = AFTER;
- } else {
- where = m->cur;
- }
- copy(m, &tmps[where]);
-}
-
-static void
-extract(struct member *m, int argc, char *argv[])
-{
- int c;
- long siz;
- FILE *fp;
-
- if (argc > 0 && !inlist(m->fname, argc, argv))
- return;
- if (vflag)
- printf("x - %s\n", m->fname);
- siz = m->size;
-
- if ((fp = fopen(m->fname, "wb")) == NULL)
- goto error_file;
- while (siz-- > 0 && (c = getc(m->src)) != EOF)
- putc(c, fp);
- fflush(fp);
- if (fclose(fp) == EOF)
- goto error_file;
-
- /* TODO: set attributes */
- return;
-
-
-error_file:
- perror("ar:error extracting file");
- exit(1);
-}
-
-static void
-print(struct member *m, int argc, char *argv[])
-{
- long siz;
- int c;
-
- if (argc > 0 && !inlist(m->fname, argc, argv))
- return;
- if (vflag)
- printf("\n<%s>\n\n", m->fname);
- siz = m->size;
- while (siz-- > 0 && (c = getc(m->src)) != EOF)
- putchar(c);
-}
-
-static void
-list(struct member *m, int argc, char *argv[])
-{
- time_t t;
- struct ar_hdr *hdr = &m->hdr;
- char mtime[30];
-
- if (argc > 0 && !inlist(m->fname, argc, argv))
- return;
- if (!vflag) {
- printf("%s\n", m->fname);
- } else {
- t = totime(m->date);
- strftime(mtime, sizeof(mtime), "%c", localtime(&t));
- printf("%s %ld/%ld\t%s %s\n",
- perms(m),
- atol(hdr->ar_uid),
- atol(hdr->ar_gid),
- mtime,
- m->fname);
- }
-}
-
-static void
-del(struct member *m, int argc, char *argv[])
-{
- if (inlist(m->fname, argc, argv)) {
- if (vflag)
- printf("d - %s\n", m->fname);
- return;
- }
- copy(m, &tmps[BEFORE]);
-}
-
-static char *
-getfname(struct ar_hdr *hdr)
-{
- static char fname[SARNAM+1];
- size_t i;
-
- memcpy(fname, hdr->ar_name, SARNAM);
- fname[SARNAM] = '\0';
-
- for (i = SARNAM-1; i >= 0; --i) {
- if (fname[i] != ' ' && fname[i] != '/')
- break;
- fname[i] = '\0';
- }
- return fname;
-}
-
-static long long
-getnum(char *s, int size, int base)
-{
- int c;
- long long val;
- char *p;
- static char digits[] = "0123456789";
-
- for (val = 0; size > 0; val += c) {
- --size;
- if ((c = *s++) == ' ')
- break;
- if ((p = strchr(digits, c)) == NULL)
- return -1;
- if ((c = p - digits) >= base)
- return -1;
- val *= base;
- }
-
- while (size > 0 && *s++ == ' ')
- --size;
- return (size == 0) ? val : -1;
-}
-
-static int
-valid(struct member *m)
-{
- struct ar_hdr *hdr = &m->hdr;
-
- m->fname = getfname(&m->hdr);
- m->size = getnum(hdr->ar_size, sizeof(hdr->ar_size), 10);
- m->mode = getnum(hdr->ar_mode, sizeof(hdr->ar_mode), 8);
- m->date = getnum(hdr->ar_date, sizeof(hdr->ar_date), 10);
-
- if (strncmp(hdr->ar_fmag, ARFMAG, sizeof(hdr->ar_fmag)) ||
- m->size < 0 || m->mode < 0 || m->date < 0) {
- return 0;
- }
- return 1;
-}
-
-static void
-run(FILE *fp, int argc, char *argv[],
- void (*fun)(struct member *, int argc, char *files[]))
-{
- struct member m;
-
- m.src = fp;
- m.cur = BEFORE;
-
- while (fread(&m.hdr, sizeof(m.hdr), 1, fp) == 1) {
- fpos_t pos;
-
- if (!valid(&m)) {
- fprintf(stderr,
- "ar:corrupted member '%s'\n",
- m.fname);
- exit(1);
- }
- fgetpos(fp, &pos);
- (*fun)(&m, argc, argv);
- fsetpos(fp, &pos);
- fseek(fp, m.size+1 & ~1, SEEK_CUR);
- }
- if (ferror(fp) || fclose(fp) == EOF) {
- perror("ar:reading members");
- exit(1);
- }
-}
-
-static void
-merge(void)
-{
- FILE *fp, *fi;
- int c, i;
-
-
- if ((fp = fopen(arfile, "wb")) == NULL) {
- perror("ar:reopening archive");
- exit(1);
- }
-
- fputs(ARMAG, fp);
-
- for (i = 0; i < 3; i++) {
- if ((fi = tmps[i].fp) == NULL)
- continue;
- fseek(fi, 0, SEEK_SET);
- while ((c = getc(fi)) != EOF)
- putc(c, fp);
- if (ferror(fi)) {
- perror("ar:error in temporary");
- exit(1);
- }
- }
-
- if (fclose(fp) == EOF) {
- perror("ar:writing archive file");
- exit(1);
- }
-}
-
-static void
-closetmp(int which)
-{
- struct tmp *tmp = &tmps[which];
-
- if (!tmp->fp)
- return;
- if (fclose(tmp->fp) == EOF) {
- perror("ar:closing temporaries");
- exit(1);
- }
-}
-
-static void
-opentmp(char *fname, int which)
-{
- struct tmp *tmp = &tmps[which];
-
- if (lflag) {
- tmp->name = fname;
- tmp->fp = fopen(fname, "w+b");
- } else {
- tmp->fp = tmpfile();
- }
-
- if (tmp->fp == NULL) {
- perror("ar:creating temporary");
- exit(1);
- }
-}
-
-static void
-doit(int key, char *argv[], int argc)
-{
- FILE *fp;
-
- fp = openar();
- if (argc == 0 &&
- (key == 'r' || key == 'd' || key == 'm' || key == 'q')) {
- if (fclose(fp) == EOF) {
- perror("ar:early close of archive file");
- exit(-1);
- }
- return;
- }
-
- if (key == 'r' || key == 'm' || key == 'd')
- opentmp("ar.tmp1", BEFORE);
- if (key == 'r' || key == 'm') {
- opentmp("ar.tmp2", INDOT);
- opentmp("ar.tmp3", AFTER);
- }
-
- switch (key) {
- case 'r':
- run(fp, argc, argv, update);
- insert(argc, argv);
- merge();
- break;
- case 'm':
- run(fp, argc, argv, move);
- merge();
- break;
- case 'd':
- run(fp, argc, argv, del);
- merge();
- break;
- case 't':
- run(fp, argc, argv, list);
- break;
- case 'p':
- run(fp, argc, argv, print);
- break;
- case 'x':
- run(fp, argc, argv, extract);
- break;
- case 'q':
- append(fp, argv);
- break;
- }
-
- closetmp(BEFORE);
- closetmp(INDOT);
- closetmp(AFTER);
-
- for ( ; argc-- > 0; ++argv) {
- if (*argv) {
- fprintf(stderr, "ar: No member named '%s'\n", *argv);
- exit(1);
- }
- }
-}
-
-static void
-usage(void)
-{
- fputs("ar [-drqtpmx][posname] [-vuaibcl] [posname] arfile name ...\n",
- stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- int key, nkey = 0, pos = 0;
-
- atexit(cleanup);
- ARGBEGIN {
- case 'd':
- nkey++;
- key = 'd';
- break;
- case 'r':
- nkey++;
- key = 'r';
- break;
- case 'q':
- nkey++;
- key = 'q';
- break;
- case 't':
- nkey++;
- key = 't';
- break;
- case 'p':
- nkey++;
- key = 'p';
- break;
- case 'm':
- nkey++;
- key = 'm';
- break;
- case 'x':
- nkey++;
- key = 'x';
- break;
- case 'a':
- aflag = 1;
- pos++;
- posname = EARGF(usage());
- break;
- case 'i':
- case 'b':
- bflag = 1;
- pos++;
- posname = EARGF(usage());
- break;
- case 'v':
- vflag = 1;
- break;
- case 'c':
- cflag = 1;
- break;
- case 'l':
- lflag = 1;
- break;
- case 'u':
- /* TODO */
- abort();
- uflag = 1;
- break;
- default:
- usage();
- } ARGEND
-
- if (nkey == 0 || nkey > 1 || pos > 1 || argc == 0)
- usage();
-
- signal(SIGINT, sigfun);
- signal(SIGQUIT, sigfun);
- signal(SIGTERM, sigfun);
-
- arfile = *argv;
- doit(key, ++argv, --argc);
-
- if (fflush(stdout) == EOF) {
- perror("ar:error writing to stdout");
- exit(1);
- }
-
- return 0;
-}
--- a/ar/posix/driver.c
+++ /dev/null
@@ -1,14 +1,0 @@
-static char sccsid[] = "@(#) ./ar/posix/driver.c";
-
-#include "driver.h"
-
-time_t
-totime(long long t)
-{
- return t;
-}
-
-int
-setattr()
-{
-}
--- a/ar/posix/driver.h
+++ /dev/null
@@ -1,5 +1,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-extern time_t totime(long long t);
--- a/as/Makefile
+++ /dev/null
@@ -1,29 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-OBJ = main.o symbol.o ins.o parser.o expr.o myro.o
-MORECFLAGS = -I$(INCLUDE)/$(STD)
-TARGETS = $(LIBEXEC)/as-amd64 $(LIBEXEC)/as-i386 \
- $(LIBEXEC)/as-i286 $(LIBEXEC)/as-z80
-
-all: $(TARGETS)
-
-$(TARGETS): $(LIBDIR)/libscc.a
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f *.o target/*/*.o
- rm -f target/*/*tbl.c
- rm -f as-*
- rm -f $(TARGETS)
-
-include target/amd64.mk
-include target/i386.mk
-include target/i286.mk
-include target/z80.mk
-include deps.mk
--- a/as/as.h
+++ /dev/null
@@ -1,216 +1,0 @@
-/*
- * First 3 bits of flags in segments and symbols are for the
- * type of segment
- */
-enum symflags {
- FREG = 1 << 0,
- FSECT = 1 << 1,
- FSYM = 1 << 2,
- FCOMMON = 1 << 3,
- FEXTERN = 1 << 4,
- FDEF = 1 << 5,
- FGLOBAL = 1 << 6,
- FABS = 1 << 7,
-};
-
-enum secflags {
- SREAD = 1 << 0,
- SWRITE = 1 << 1,
- SEXEC = 1 << 2,
- SLOAD = 1 << 3,
- SFILE = 1 << 4,
- SABS = 1 << 5,
-};
-
-enum endianess {
- BIG_ENDIAN = -1,
- LITTLE_ENDIAN = 1
-};
-
-enum common_args {
- AIMM = 1,
- ASTR,
- AREG,
- ANUMBER,
- AIMM8,
- AIMM16,
- AIMM32,
- AIMM64,
- AINDIR,
- AINDEX,
- ADIRECT,
- AREG_OFF,
- ASYM,
- AOPT,
- AREP,
- AMAX,
-};
-
-enum tokens {
- EOS = -1,
- IDEN = 1,
- NUMBER,
- REG,
- STRING,
- MINUS,
- SHL,
- SHR,
- GE,
- LE,
-};
-
-#define MAXSYM 63
-
-typedef struct reloc Reloc;
-typedef struct ins Ins;
-typedef struct op Op;
-typedef struct section Section;
-typedef struct symbol Symbol;
-typedef struct node Node;
-typedef struct string String;
-typedef void Format(Op *, Node **);
-
-struct string {
- char *buf;
- size_t offset;
-};
-
-struct line {
- char *label;
- char *op;
- char *args;
-};
-
-struct ins {
- int begin, end;
- char *str;
-};
-
-struct reloc {
- size_t offset;
- Symbol *sym;
- unsigned char flags;
- unsigned char size;
- unsigned char nbits;
- unsigned char shift;
-};
-
-struct op {
- unsigned char flags;
- unsigned char size;
- void (*format)(Op *, Node **);
- unsigned char *bytes;
- unsigned char *args;
-};
-
-struct section {
- Symbol *sym;
- char *mem;
- unsigned char flags;
- unsigned char fill;
- unsigned char aligment;
- unsigned id;
- TUINT base;
- TUINT max;
- TUINT curpc;
- TUINT pc;
- struct section *next;
-};
-
-struct symbol {
- String name;
- String type;
- unsigned char flags;
- unsigned char pass;
- TUINT value;
- TUINT size;
- Section *section;
- struct symbol *next;
- struct symbol *hash;
-};
-
-struct node {
- unsigned char op;
- unsigned char addr;
- struct symbol *sym;
- struct node *left;
- struct node *right;
-};
-
-union yylval {
- TUINT val;
- Symbol *sym;
-};
-
-
-/* symbol.c */
-extern void cleansecs(void);
-extern void isecs(void);
-extern void emit(char *bytes, int nbytes);
-extern Section *setsec(char *name, char *attr);
-extern Symbol *tmpsym(TUINT val);
-extern void killtmp(void);
-extern int toobig(Node *np, int type);
-extern void dumpstab(char *msg);
-extern String newstring(char *s);
-
-/* main.c */
-extern Symbol *lookup(char *name);
-extern Symbol *deflabel(char *name);
-
-/* parser.c */
-extern Node **getargs(char *s);
-extern void error(char *msg, ...);
-/* Avoid errors in files where stdio is not included */
-#ifdef stdin
-extern int nextline(FILE *fp, struct line *linep);
-#endif
-extern void unexpected(void);
-extern void expect(int token);
-int next(void);
-#define accept(t) (yytoken == (t) ? next() : 0)
-extern void regctx(int mode);
-extern Node *getreg(void);
-extern Node *operand(char **s);
-extern void addinput(char *fname);
-extern int delinput(void);
-
-/* expr.c */
-extern Node *expr(void);
-extern void deltree(Node *np);
-extern Node *node(int op, Node *l, Node *r);
-
-/* proc.c */
-extern void iarch(void);
-extern int match(Op *op, Node **args);
-extern Node *moperand(void);
-
-/* ins.c */
-extern char *tobytes(TUINT v, int n, int inc);
-
-/* format.c */
-extern void writeout(char *name);
-extern void reloc(Symbol *sym,
- unsigned flags,
- unsigned size,
- unsigned nbits,
- unsigned shift);
-
-
-/*
- * Definition of global variables
- */
-extern Section *cursec, *seclist;
-extern int nr_ins;
-extern Ins instab[];
-extern Op optab[];
-extern int pass;
-extern TUINT maxaddr;
-extern int endian;
-extern Symbol *linesym, *symlist;
-extern char *infile;
-extern int endpass;
-extern int yytoken;
-extern size_t yylen;
-extern union yylval yylval;
-extern char yytext[];
--- a/as/deps.mk
+++ /dev/null
@@ -1,46 +1,0 @@
-parser.o: $(PROJECTDIR)/inc/$(STD)/cstd.h
-
-#deps
-expr.o: ../inc/scc.h
-expr.o: as.h
-ins.o: ../inc/scc.h
-ins.o: as.h
-main.o: ../inc/arg.h
-main.o: ../inc/scc.h
-main.o: as.h
-myro.o: ../inc/myro.h
-myro.o: ../inc/scc.h
-myro.o: as.h
-parser.o: ../inc/scc.h
-parser.o: as.h
-symbol.o: ../inc/scc.h
-symbol.o: as.h
-target/x80/ins.o: target/x80/../../../inc/scc.h
-target/x80/ins.o: target/x80/../../as.h
-target/x80/ins.o: target/x80/proc.h
-target/x80/z80.o: target/x80/../../../inc/scc.h
-target/x80/z80.o: target/x80/../../as.h
-target/x80/z80.o: target/x80/../x80/proc.h
-target/x80/z80tbl.o: target/x80/../../../inc/scc.h
-target/x80/z80tbl.o: target/x80/../../as.h
-target/x80/z80tbl.o: target/x80/../x80/proc.h
-target/x86/amd64.o: target/x86/../../../inc/scc.h
-target/x86/amd64.o: target/x86/../../as.h
-target/x86/amd64tbl.o: target/x86/../../../inc/scc.h
-target/x86/amd64tbl.o: target/x86/../../as.h
-target/x86/amd64tbl.o: target/x86/../x86/proc.h
-target/x86/i286.o: target/x86/../../../inc/scc.h
-target/x86/i286.o: target/x86/../../as.h
-target/x86/i286.o: target/x86/../x86/proc.h
-target/x86/i286tbl.o: target/x86/../../../inc/scc.h
-target/x86/i286tbl.o: target/x86/../../as.h
-target/x86/i286tbl.o: target/x86/../x86/proc.h
-target/x86/i386.o: target/x86/../../../inc/scc.h
-target/x86/i386.o: target/x86/../../as.h
-target/x86/i386.o: target/x86/../x86/proc.h
-target/x86/i386tbl.o: target/x86/../../../inc/scc.h
-target/x86/i386tbl.o: target/x86/../../as.h
-target/x86/i386tbl.o: target/x86/../x86/proc.h
-target/x86/ins.o: target/x86/../../../inc/scc.h
-target/x86/ins.o: target/x86/../../as.h
-target/x86/ins.o: target/x86/proc.h
--- a/as/expr.c
+++ /dev/null
@@ -1,303 +1,0 @@
-static char sccsid[] = "@(#) ./as/expr.c";
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "as.h"
-
-#define NNODES 10
-
-static Alloc *arena;
-
-Node *
-node(int op, Node *l, Node *r)
-{
- struct arena *ap;
- Node *np;
-
- if (!arena)
- arena = alloc(sizeof(Node), NNODES);
- np = new(arena);
- np->op = op;
- np->left = l;
- np->right = r;
- np->sym = NULL;
-
- return np;
-}
-
-void
-deltree(Node *np)
-{
- if (!np)
- return;
- deltree(np->left);
- deltree(np->right);
- delete(arena, np);
-}
-
-static Node *
-fold(int op, Node *l, Node *r)
-{
- Node *np;
- TUINT val, lv, rv;
-
- lv = l->sym->value;
- rv = r->sym->value;
-
- /* TODO: check overflow */
-
- switch (op) {
- case '*':
- val = lv - rv;
- break;
- case '/':
- if (rv == 0)
- goto division_by_zero;
- val = lv / rv;
- break;
- case '%':
- if (rv == 0)
- goto division_by_zero;
- val = lv % rv;
- break;
- case SHL:
- val = lv << rv;
- break;
- case SHR:
- val = lv >> rv;
- break;
- case '+':
- val = lv + rv;
- break;
- case '-':
- val = lv - rv;
- break;
- case '<':
- val = lv < rv;
- break;
- case '>':
- val = lv > rv;
- break;
- case '=':
- val = lv == rv;
- break;
- case GE:
- val = lv >= rv;
- break;
- case LE:
- val = lv <= rv;
- break;
- case '|':
- val = lv | rv;
- break;
- case '^':
- val = lv ^ rv;
- break;
- default:
- abort();
- }
- deltree(l);
- deltree(r);
-
- np = node(NUMBER, NULL, NULL);
- np->sym = tmpsym(val);
- np->addr = ANUMBER;
- return np;
-
-division_by_zero:
- error("division by 0");
-}
-
-static Node *
-binary(int op, Node *l, Node *r)
-{
- int addr;
- Node *np;
-
- if (l->op == NUMBER && r->op == NUMBER)
- return fold(op, l, r);
- else
- abort();
- np = node(op, l, r);
- np->addr = addr;
-
- return np;
-}
-
-static Node *
-unaryop(int op, Node *np)
-{
- TUINT val;
-
- if (np->addr != ANUMBER)
- error("invalid argument for unary operator");
- if (np->op != NUMBER) {
- np = node(op, np, NULL);
- np->addr = ANUMBER;
- return np;
- }
-
- val = np->sym->value;
- switch (op) {
- case '!':
- val = !val;
- case '+':
- break;
- case '-':
- val = -val;
- break;
- default:
- abort();
- }
- np->sym->value = val;
-
- return np;
-}
-
-/*************************************************************************/
-/* grammar functions */
-/*************************************************************************/
-
-static Node *
-primary(void)
-{
- Node *np;
-
- switch (yytoken) {
- case IDEN:
- case NUMBER:
- np = node(yytoken, NULL, NULL);
- np->sym = yylval.sym;
- np->addr = ANUMBER;
- next();
- break;
- case '(':
- np = expr();
- expect(')');
- break;
- default:
- unexpected();
- }
-
- return np;
-}
-
-static Node *
-unary(void)
-{
- int op, tok;
- Node *np;
-
- switch (tok = yytoken) {
- case '!':
- case '-':
- case '+':
- next();
- return unaryop(tok, primary());
- default:
- return primary();
- }
-}
-
-static Node *
-mul(void)
-{
- int op;
- Node *np;
-
- np = unary();
- for (;;) {
- switch (op = yytoken) {
- case '*':
- case '/':
- case '%':
- case SHL:
- case SHR:
- next();
- binary(op, np, primary());
- break;
- default:
- return np;
- }
- }
-}
-
-static Node *
-add(void)
-{
- int op;
- Node *np;
-
- np = mul();
- for (;;) {
- switch (op = yytoken) {
- case '+':
- case '-':
- next();
- np = binary(op, np, mul());
- break;
- default:
- return np;
- }
- }
-}
-
-static Node *
-relational(void)
-{
- int op;
- Node *np;
-
- np = add();
- for (;;) {
- switch (op = yytoken) {
- case '<':
- case '>':
- case '=':
- case GE:
- case LE:
- next();
- np = binary(op, np, add());
- break;
- default:
- return np;
- }
- }
-}
-
-static Node *
-and(void)
-{
- int op;
- Node *np;
-
- np = relational();
- while (accept('&'))
- np = binary('&', np, relational());
- return np;
-}
-
-Node *
-expr(void)
-{
- int op;
- Node *np;
-
- regctx(0);
- np = and();
- for (;;) {
- switch (op = yytoken) {
- case '|':
- case '^':
- next();
- np = binary(op, np, and());
- break;
- default:
- regctx(1);
- return np;
- }
- }
-}
--- a/as/gentbl.awk
+++ /dev/null
@@ -1,112 +1,0 @@
-
-BEGIN {
- printf "#include \"../../../inc/scc.h\"\n"\
- "#include \"../../as.h\"\n"\
- "#include \"../" family "/proc.h\"\n"
-
- rules = "target/" family "/rules.dat"
- while (getline < rules > 0) {
- regex[++nregs] = $1
- value[nregs] = $2
- }
- close(rules)
-}
- {sub(/#.*/,"")}
-
-$7 !~ cpu {next}
-
-/^$/ {next}
-
- {
- if (opstart[$1] == 0) {
- opstart[$1] = nvar
- opnames[nop++] = $1
- }
- opcount[$1]++
- opargs[nvar] = $3
- opsize[nvar] = $4
- opbytes[nvar] = ($5 == "none") ? "" : $5
- opformat[nvar++] = $6
- formats[$6] = 1
-}
-
-END {
- for (i in formats)
- printf "Format %s;\n", i
-
- printf "int nr_ins = %d;\n\n", nop
- print "struct ins instab[] = {"
- for (i = 0; i < nop; i++) {
- n = opnames[i]
- start = opstart[n]
- end = start + opcount[n]
- printf "\t{.str = \"%s\", .begin = %d, .end = %d},\n",
- n, start, end | "sort"
- }
- close("sort")
- printf "};\n\n"
-
- print "struct op optab[] = {"
- for (i = 0; i < nvar; i++) {
- printf "\t/* %d */\n", i
- printf "\t{\n" \
- "\t\t.size = %d,\n"\
- "\t\t.format = %s,\n",
- opsize[i], opformat[i]
-
- if (opbytes[i] != "")
- printf "\t\t.bytes = (unsigned char [%d]) {%s},\n",
- opsize[i],
- opbytes[i]
-
- a = str2args(opargs[i])
- if (a != "")
- printf "\t\t.args = (unsigned char []) {%s}\n", a
-
- print "\t},"
- }
- print "};"
-}
-
-function str2args(s, args, i, j, out, n, found)
-{
- n = split(s, args, /,/)
- if (n == 0 || args[1] == "none")
- return ""
- for (i = 1; i <= n; i++) {
- a = args[i]
- found = 0
-
- if (a ~ /\?$/)
- out = out "AOPT ,"
- else if (a ~ /\+$/)
- out = out "AREP ,"
-
- for (j = 1; j <= nregs; j++) {
- if (match(a, "^" regex[j])) {
- out = out value[j]
- found = 1
- break
- }
- }
-
- if (!found) {
- print FILENAME ":" NR ":" \
- $0 ":wrong arg", a > "/dev/stderr"
- exit 1
- }
-
- a = substr(a, RLENGTH+1)
- sub(/\?$/, "", a)
- sub(/\+$/, "", a)
- if (a != "") {
- print FILENAME ":" NR ":" \
- $0 ": trailing chars: ", a > "/dev/stderr"
- exit 1
- }
- out = out ","
- }
- out = out "0"
-
- return out
-}
--- a/as/gentbl.sh
+++ /dev/null
@@ -1,33 +1,0 @@
-#!/bin/sh
-
-
-set -e
-
-while test $# -gt 0
-do
- case $1 in
- -c)
- cpu=$2
- shift
- ;;
- -f)
- family=$2
- shift
- ;;
- *)
- echo gen.sh:incorrect parameter:$1 >&2
- exit 1
- ;;
- esac
- shift
-done
-
-echo cpu=${cpu:=z80} family=${family:=x80}
-
-rm -f $$.c target/$family/${cpu}tbl.c
-trap "rm -f $$.c" 0 2 3
-
-awk '!/^$/ {print $1,NR,$2,$3,$4,$5,$6}' target/$family/$family.dat |
-LC_COLLATE=C sort -k1 -k2n |
-awk -v cpu=`echo $cpu | tr a-z A-Z` -v family=$family -f gentbl.awk > $$.c &&
-mv $$.c target/$family/${cpu}tbl.c
--- a/as/ins.c
+++ /dev/null
@@ -1,249 +1,0 @@
-static char sccsid[] = "@(#) ./as/ins.c";
-
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "as.h"
-
-extern Section *sabs, *sbss, *sdata, *stext;
-
-enum {
- EQU,
- COMMON,
- SIZE,
- XSTRING,
- ASCII,
- TYPE,
-};
-
-char *
-tobytes(TUINT v, int nbytes, int inc)
-{
- static char buf[sizeof(TUINT)];
- int idx;
-
- idx = (inc < 0) ? nbytes-1 : 0;
- while (nbytes--) {
- buf[idx] = v;
- idx += inc;
- v >>= 8;
- }
-
- if (v)
- error("overflow in immediate value");
- return buf;
-}
-
-void
-noargs(Op *op, Node **args)
-{
- emit(op->bytes, op->size);
-}
-
-static void
-xstring(int which, Node **args)
-{
- Node *np;
- char *s;
- size_t len;
-
- while (np = *args++) {
- s = np->sym->name.buf;
- len = strlen(s);
- len += which == XSTRING;
- emit(s, len);
- }
-}
-
-void
-string(Op *op, Node **args)
-{
- xstring(STRING, args);
-}
-
-void
-ascii(Op *op, Node **args)
-{
- xstring(STRING, args);
-}
-
-void
-def(Node **args, int siz)
-{
- Node *np;
-
- while (np = *args++) {
- Symbol *sym = np->sym;
-
- if ((sym->flags & FABS) == 0)
- reloc(sym, 0, siz, siz * 8, 0);
- emit(tobytes(sym->value, siz, endian), siz);
- }
-}
-
-void
-defb(Op *op, Node **args)
-{
- def(args, 1);
-}
-
-void
-defw(Op *op, Node **args)
-{
- def(args, 2);
-}
-
-void
-defd(Op *op, Node **args)
-{
- def(args, 4);
-}
-
-void
-defq(Op *op, Node **args)
-{
- def(args, 8);
-}
-
-static void
-symexp(int which, Op *op, Node **args)
-{
- Symbol *sym, *exp;
- static char *cmds[] = {
- [EQU] = "equ",
- [COMMON] = "common",
- [SIZE] = "size",
- };
- char *cmd = cmds[which];
-
- if (args[1]) {
- sym = args[0]->sym;
- exp = args[1]->sym;
- } else if (linesym) {
- sym = linesym;
- exp = args[0]->sym;
- } else {
- error("%s pseudo instruction lacks a label", cmd);
- }
-
- if ((exp->flags & FABS) == 0)
- error("%s expression is not an absolute expression", cmd);
-
- switch (which) {
- case EQU:
- if (pass == 1 && (sym->flags & FDEF))
- error("redefinition of symbol '%s'", sym->name.buf);
- sym->value = exp->value;
- sym->flags |= FDEF;
- break;
- case COMMON:
- sym->flags |= FCOMMON;
- case SIZE:
- sym->size = exp->value;
- break;
- case TYPE:
- sym->type.buf = xstrdup(exp->name.buf);
- break;
- }
-}
-
-void
-equ(Op *op, Node **args)
-{
- symexp(EQU, op, args);
-}
-
-void
-common(Op *op, Node **args)
-{
- symexp(COMMON, op, args);
-}
-
-void
-size(Op *op, Node **args)
-{
- symexp(SIZE, op, args);
-}
-
-void
-type(Op *op, Node **args)
-{
- symexp(TYPE, op, args);
-}
-
-void
-section(Op *op, Node **args)
-{
- Symbol *sym = args[0]->sym;
- char *attr = NULL;
-
- if (args[1])
- attr = args[1]->sym->name.buf;
-
- setsec(sym->name.buf, attr);
-}
-
-void
-text(Op *op, Node **args)
-{
- cursec = stext;
-}
-
-void
-data(Op *op, Node **args)
-{
- cursec = sdata;
-}
-
-void
-bss(Op *op, Node **args)
-{
- cursec = sbss;
-}
-
-void
-extrn(Op *op, Node **args)
-{
- Symbol *sym = args[0]->sym;
-
- sym->flags |= FEXTERN;
-}
-
-void
-global(Op *op, Node **args)
-{
- Symbol *sym = args[0]->sym;
-
- sym->flags |= FGLOBAL;
-}
-
-void
-align(Op *op, Node **args)
-{
- Symbol *sym = args[0]->sym;
- TUINT curpc, pc, al;
-
- if ((sym->flags & FABS) == 0)
- error("align expression is not an absolute expression");
- if ((al = sym->value) == 0)
- return;
-
- al--;
- curpc = cursec->curpc;
- pc = curpc+al & ~al;
-
- for (al = pc - curpc; al > 0; --al)
- emit((char []) {0}, 1);
-}
-
-void
-end(Op *op, Node **args)
-{
- endpass = 1;
-}
-
-void
-include(Op *op, Node **args)
-{
- addinput(args[0]->sym->name.buf);
-}
--- a/as/main.c
+++ /dev/null
@@ -1,138 +1,0 @@
-static char sccsid[] = "@(#) ./as/main.c";
-
-#include <ctype.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "../inc/arg.h"
-#include "as.h"
-
-char *argv0;
-char *outfile, *infile;
-int endpass;
-
-
-static void
-cleanup(void)
-{
- if (outfile)
- remove(outfile);
-}
-
-static int
-cmp(const void *f1, const void *f2)
-{
- const Ins *ins = f2;
- const char *s = f1;
- int d;
-
- if ((d = *s - *ins->str) != 0)
- return d;
-
- return strcmp(s, ins->str);
-}
-
-static void
-as(char *text, char *xargs)
-{
- int c;
- char *p;
- Ins *ins;
- Op *op, *lim;
- Node **args;
-
- for (p = text; c = *p; ++p)
- *p = toupper(c);
-
- ins = bsearch(text, instab, nr_ins, sizeof(Ins), cmp);
- if (!ins) {
- error("invalid instruction '%s'", text);
- return;
- }
-
- args = getargs(xargs);
- lim = &optab[ins->end];
- for (op = &optab[ins->begin]; op < lim; ++op) {
- if (match(op, args))
- break;
- }
- if (op == lim) {
- error("invalid operands for '%s'", text);
- return;
- }
- (*op->format)(op, args);
-}
-
-static int
-dopass(char *fname)
-{
- struct line line;
- FILE *fp;
- extern int nerrors;
- extern jmp_buf recover;
-
- addinput(fname);
- cleansecs();
-
- endpass = 0;
- setjmp(recover);
- while (!endpass && nextline(fp, &line)) {
- linesym = NULL;
-
- if (line.label)
- linesym = deflabel(line.label);
-
- if (line.op)
- as(line.op, line.args);
- else if (line.args)
- error("arguments without an opcode");
- }
-
- return nerrors == 0;
-}
-
-static void
-usage(void)
-{
- fputs("usage: as [-o outfile] filename ...\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- char **p;
-
- outfile = "a.out";
-
- ARGBEGIN {
- case 'o':
- outfile = EARGF(usage());
- break;
- default:
- usage();
- } ARGEND
-
- if (argc == 0)
- usage();
-
- atexit(cleanup);
- iarch();
- isecs();
-
- for (pass = 1; pass <= 2; pass++) {
- for (p = argv; infile = *p; ++p) {
- if (!dopass(infile))
- return 1;
- }
- if (pass == 1)
- killtmp();
- }
- writeout(outfile);
- outfile = NULL;
-
- return 0;
-}
--- a/as/myro.c
+++ /dev/null
@@ -1,204 +1,0 @@
-static char sccsid[] = "@(#) ./as/myro.c";
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "../inc/myro.h"
-#include "as.h"
-
-#define FORMAT "z80-scc"
-
-static Reloc *relocs;
-static size_t relcap, relsiz;
-
-static size_t
-writestrings(FILE *fp)
-{
- int type;
- size_t off = 0;
- size_t len;
- Symbol *sym;
- Section *sp;
- String *str;
-
- fwrite(FORMAT, sizeof(FORMAT), 1, fp);
- off = sizeof(FORMAT);
-
- for (sym = symlist; sym; sym = sym->next) {
- if (sym->flags & FREG)
- continue;
- str = &sym->name;
- len = strlen(str->buf) + 1;
- fwrite(str->buf, len, 1, fp);
- str->offset = off;
- off += len;
- }
-
- return off;
-}
-
-static unsigned
-getsecflags(Section *sp)
-{
- unsigned flags = 0;
-
- if (sp->flags & SREAD)
- flags |= MYROSEC_READ;
- if (sp->flags & SWRITE)
- flags |= MYROSEC_WRITE;
- if (sp->flags & SFILE)
- flags |= MYROSEC_FILE;
- if (sp->flags & SEXEC)
- flags |= MYROSEC_EXEC;
- if (sp->flags & SLOAD)
- flags |= MYROSEC_LOAD;
- if (sp->flags & SABS)
- flags |= MYROSEC_ABS;
- return flags;
-}
-
-static size_t
-writesections(FILE *fp)
-{
- Section *sp;
- size_t off = 0;
- struct myrosect sect;
- unsigned id = 0;;
-
- for (sp = seclist; sp; sp = sp->next) {
- if (id == MYROMAXSEC)
- die("too many sections for a myro file");
- sp->id = id++;
- sect.name = sp->sym->name.offset;
- sect.flags = getsecflags(sp);
- sect.fill = sp->fill;
- sect.aligment = sp->aligment;
- sect.offset = off;
- sect.len = sp->max - sp->base;
- off += wrmyrosec(fp, §);
- }
-
- return off;
-}
-
-static unsigned
-getsymflags(Symbol *sym)
-{
- unsigned flags = 0;
-
- if (sym->flags & FCOMMON)
- flags |= MYROSYM_COMMON;
- if (sym->flags & FEXTERN)
- flags |= MYROSYM_EXTERN;
- if (!(sym->flags & FDEF))
- flags |= MYROSYM_UNDEF;
- return flags;
-}
-
-static size_t
-writesymbols(FILE *fp)
-{
- Symbol *sym;
- size_t off = 0;
- struct myrosym symbol;
-
- for (sym = symlist; sym; sym = sym->next) {
- if (sym->flags & (FREG|FSECT))
- continue;
- symbol.name = sym->name.offset;
- symbol.type = -1;
- symbol.section = sym->section->id;
- symbol.flags = getsymflags(sym);
- symbol.offset = sym->value;
- symbol.len = sym->size;
- off += wrmyrosym(fp, &symbol);
- }
-
- return off;
-}
-
-static size_t
-writerelocs(FILE *fp)
-{
- Reloc *bp, *lim;
- size_t off = 0;
- struct myrorel reloc;
-
- lim = &relocs[relsiz];
- for (bp = relocs; bp < lim; ++bp) {
- reloc.id = 0;
- reloc.flags = bp->flags;
- reloc.size = bp->size;
- reloc.nbits = bp->nbits;
- reloc.shift = bp->shift;
- reloc.offset = bp->offset;
- off += wrmyrorel(fp, &reloc);
- }
- return off;
-}
-
-static void
-writedata(FILE *fp)
-{
- Section *sp;
-
- for (sp = seclist; sp; sp = sp->next) {
- if (!sp->mem)
- continue;
- fwrite(sp->mem, sp->max - sp->base, 1, fp);
- }
-}
-
-void
-writeout(char *name)
-{
- FILE *fp;
- struct myrohdr hdr = { .magic = MYROMAGIC };
-
- if ((fp = fopen(name, "wb")) == NULL)
- die("error opening output file '%s'\n", name);
-
- wrmyrohdr(fp, &hdr);
- hdr.strsize = writestrings(fp);
- hdr.secsize = writesections(fp);
- hdr.symsize = writesymbols(fp);
- hdr.relsize = writerelocs(fp);
- writedata(fp);
-
- fseek(fp, 0, SEEK_SET);
- wrmyrohdr(fp, &hdr);
-
- if (fclose(fp))
- die("error writing the output file");
-}
-
-void
-reloc(Symbol *sym,
- unsigned flags, unsigned size, unsigned nbits, unsigned shift)
-{
- size_t tmp;
- Reloc *p;
-
- if (pass == 1)
- return;
-
- if (relcap == relsiz) {
- tmp = ((relcap + 1) * 3) / 2;
- if ((p = realloc(relocs, tmp * sizeof(Reloc))) == NULL) {
- tmp = relcap + 1;
- p = xrealloc(relocs, tmp * sizeof(Reloc));
- }
- relcap = tmp;
- relocs = p;
- }
-
- p = &relocs[relsiz++];
- p->sym = sym;
- p->flags = flags;
- p->size = size;
- p->nbits = nbits;
- p->shift = shift;
- p->offset = cursec->pc - cursec->base;
-}
--- a/as/parser.c
+++ /dev/null
@@ -1,482 +1,0 @@
-static char sccsid[] = "@(#) ./as/parser.c";
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "as.h"
-
-#define NARGS 20
-#define NR_INPUTS 10
-#define MAXLINE 100
-
-struct input {
- char *fname;
- unsigned lineno;
- FILE *fp;
-};
-
-int nerrors;
-jmp_buf recover;
-char yytext[INTIDENTSIZ+1];
-int yytoken;
-size_t yylen;
-union yylval yylval;
-
-static char *textp, *endp;
-static int regmode;
-static unsigned lineno;
-static struct input inputs[NR_INPUTS], *isp = inputs;
-
-static int
-follow(int expect1, int expect2, int ifyes1, int ifyes2, int ifno)
-{
- int c;
-
- if ((c = *++textp) == expect1)
- return ifyes1;
- if (c == expect2)
- return ifyes2;
- --textp;
- return ifno;
-}
-
-static void
-tok2str(void)
-{
- if ((yylen = endp - textp) > INTIDENTSIZ) {
- error("token too big");
- yylen = INTIDENTSIZ;
- }
- memcpy(yytext, textp, yylen);
- yytext[yylen] = '\0';
- textp = endp;
-}
-
-static int
-iden(void)
-{
- int c;
- char *p;
-
- for ( ; c = *endp; ++endp) {
- if (isalnum(c))
- continue;
- switch (c) {
- case '\'':
- case '_':
- case '-':
- case '.':
- case '$':
- continue;
- default:
- goto out_loop;
- }
- }
-
-out_loop:
- tok2str();
- yylval.sym = lookup(yytext);
-
- return (yylval.sym->flags & FREG) ? REG : IDEN;
-}
-
-static int
-number(void)
-{
- int c, base = 10;
- char *p;
- TUINT n;
-
- if (*endp == '0') {
- base = 8;
- ++endp;
- if (*endp == 'x') {
- base = 16;
- ++endp;
- }
- }
- for (n = 0; (c = *endp) && isxdigit(c); n += c) {
- n *= base;
- c -= '0';
- if (n >= TUINT_MAX - c*base)
- error("overflow in number");
- endp++;
- }
- tok2str();
- yylval.sym = tmpsym(n);
-
- return NUMBER;
-}
-
-static int
-character(void)
-{
- int c;
- char *p;
-
- while (*endp != '\'')
- ++endp;
- return NUMBER;
-}
-
-static int
-string(void)
-{
- int c;
- size_t l;
- char *s;
- Symbol *sym = tmpsym(0);
-
- for (++endp; *endp != '"'; ++endp)
- ;
- ++endp;
- tok2str();
- yylval.sym = sym;
- /* FIXME: this memory is not freed ever */
- l = yylen-2;
- s = memcpy(xmalloc(l+1), yytext+1, l);
- s[l] = '\0';
- sym->name.buf = s;
-
- return STRING;
-}
-
-static int
-operator(void)
-{
- int c;
-
- ++endp;
- if ((c = *textp) == '>')
- c = follow('=', '>', LE, SHL, '>');
- else if (c == '<')
- c = follow('=', '<', GE, SHR, '>');
- tok2str();
-
- return c;
-}
-
-int
-next(void)
-{
- int c;
-
- while (isspace(*textp))
- ++textp;
-
- endp = textp;
-
- switch (c = *textp) {
- case '\0':
- strcpy(yytext, "EOS");
- yylen = 3;
- c = EOS;
- break;
- case '"':
- c = string();
- break;
- case '\'':
- c = character();
- break;
- case '%':
- c = (regmode ? iden : operator)();
- break;
- case '_':
- c = iden();
- break;
- default:
- if (isdigit(c))
- c = number();
- else if (isalpha(c))
- c = iden();
- else
- c = operator();
- break;
- }
- return yytoken = c;
-}
-
-void
-expect(int token)
-{
- if (yytoken != token)
- unexpected();
- next();
-}
-
-void
-unexpected(void)
-{
- error("unexpected '%s'", yytext);
-}
-
-void
-error(char *msg, ...)
-{
- va_list va;
- struct input *ip;
-
- assert(isp > inputs);
- ip = &isp[-1];
-
- va_start(va, msg);
- fprintf(stderr, "as:%s:%u: ", ip->fname, ip->lineno);
- vfprintf(stderr, msg, va);
- putc('\n', stderr);
- nerrors++;
- va_end(va);
-
- if (nerrors == 10)
- die("as: too many errors");
- longjmp(recover, 1);
-}
-
-Node *
-getreg(void)
-{
- Node *np;
-
- np = node(REG, NULL, NULL);
- np->sym = yylval.sym;
- np->addr = AREG;
- expect(REG);
- return np;
-}
-
-void
-regctx(int mode)
-{
- regmode = mode;
-}
-
-Node *
-operand(char **strp)
-{
- int imm = 0;
- Node *np;
-
- textp = *strp;
- regctx(1);
- switch (next()) {
- case EOS:
- np = NULL;
- break;
- case REG:
- np = getreg();
- break;
- case STRING:
- np = node(yytoken, NULL, NULL);
- np->sym = yylval.sym;
- np->addr = ASTR;
- next();
- break;
- case '$':
- next();
- imm = 1;
- default:
- if (!imm) {
- np = moperand();
- } else {
- np = expr();
- np->addr = AIMM;
- }
- }
- if (yytoken != ',' && yytoken != EOS)
- error("trailing characters in expression '%s'", textp);
- *strp = endp;
-
- return np;
-}
-
-Node **
-getargs(char *s)
-{
- Node **ap;
- static Node *args[NARGS];
-
- if (!s)
- return NULL;
-
- for (ap = args; ap < &args[NARGS-1]; ++ap) {
- if ((*ap = operand(&s)) == NULL)
- return args;
- }
- error("too many arguments in one instruction");
-}
-
-static char *
-field(char **oldp, size_t *siz)
-{
- char *s, *t, *begin;
- size_t n;
-
- if ((begin = *oldp) == NULL)
- return NULL;
-
- for (s = begin; isspace(*s) && *s != '\t'; ++s)
- ;
- if (*s == '\0' || *s == '/' || *s == ';') {
- *s = '\0';
- return *oldp = NULL;
- }
-
- for (t = s; *t && *t != '\t'; ++t)
- ;
- if (*t == '\t')
- *t++ = '\0';
- *siz -= begin - t;
- *oldp = t;
-
- while (t >= s && isspace(*t))
- *t-- = '\0';
- return (*s != '\0') ? s : NULL;
-}
-
-static int
-validlabel(char *name)
-{
- int c;
-
- while ((c = *name++) != '\0') {
- if (isalnum(c))
- continue;
- switch (c) {
- case '_':
- case '-':
- case '.':
- case '$':
- continue;
- case ':':
- if (*name != '\0')
- return 0;
- *--name = '\0';
- continue;
- default:
- return 0;
- }
- }
- return 1;
-}
-
-static int
-extract(char *s, size_t len, struct line *lp)
-{
- int r = 0;
-
- if (lp->label = field(&s, &len))
- r++;
- if (lp->op = field(&s, &len))
- r++;
- if (lp->args = field(&s, &len))
- r++;
-
- if (s && *s && *s != '/')
- error("trailing characters at the end of the line");
- if (lp->label && !validlabel(lp->label))
- error("incorrect label name '%s'", lp->label);
-
- return r;
-}
-
-static void
-comment(FILE *fp)
-{
- int c;
-
- while ((c = getc(fp)) != EOF) {
- if (c != '*')
- continue;
- if ((c = getc(fp)) == '/')
- return;
- ungetc(c, fp);
- }
-}
-
-static size_t
-getline(FILE *fp, char buff[MAXLINE])
-{
- int c;
- char *bp;
-
- for (bp = buff; (c = getc(fp)) != EOF; *bp++ = c) {
- if (c == '\n')
- break;
- if (c == '/') {
- if ((c = getc(fp)) != '*') {
- ungetc(c, fp);
- c = '/';
- } else {
- comment(fp);
- c = ' ';
- }
- } else if (c > UCHAR_MAX) {
- error("invalid character '%x'", c);
- }
- if (bp == &buff[MAXLINE-1])
- error("line too long");
- }
- *bp = '\0';
-
- return bp - buff;
-}
-
-int
-nextline(FILE *fp, struct line *lp)
-{
- struct input *ip;
- size_t n;
- static char buff[MAXLINE];
-
- assert(isp > inputs);
-repeat:
- if (isp == inputs)
- return 0;
- ip = &isp[-1];
- if (feof(ip->fp)) {
- delinput();
- goto repeat;
- }
- n = getline(ip->fp, buff);
- if (++ip->lineno == 0)
- die("as: %s: file too long", infile);
- if (n == 0)
- goto repeat;
- if (extract(buff, n, lp) == 0)
- goto repeat;
- return 1;
-}
-
-void
-addinput(char *fname)
-{
- FILE *fp;
-
- if (isp == &inputs[NR_INPUTS])
- die("as: too many included files");
- if ((fp = fopen(fname, "r")) == NULL)
- die("as: %s: %s", fname, strerror(errno));
- isp->fname = xstrdup(fname);
- isp->fp = fp;
- isp->lineno = 0;
- ++isp;
-}
-
-int
-delinput(void)
-{
- if (isp == inputs)
- return EOF;
- --isp;
- if (fclose(isp->fp) == EOF)
- die("as: %s: %s", isp->fname, strerror(errno));
- free(isp->fname);
- return 0;
-}
--- a/as/symbol.c
+++ /dev/null
@@ -1,291 +1,0 @@
-static char sccsid[] = "@(#) ./as/symbol.c";
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "as.h"
-
-#define HASHSIZ 64
-#define NALLOC 10
-
-Section *cursec, *seclist;
-Section *sabs, *sbss, *sdata, *stext;
-Symbol *linesym, *symlist;
-int pass;
-
-static Symbol *hashtbl[HASHSIZ], *symlast;
-static Alloc *tmpalloc;
-
-
-#ifndef NDEBUG
-void
-dumpstab(char *msg)
-{
- Symbol **bp, *sym;
-
- fprintf(stderr, "%s\n", msg);
- for (bp = hashtbl; bp < &hashtbl[HASHSIZ]; ++bp) {
- if (*bp == NULL)
- continue;
-
- fprintf(stderr, "[%d]", (int) (bp - hashtbl));
- for (sym = *bp; sym; sym = sym->hash) {
- fprintf(stderr, " -> %s:%0X:%0X",
- sym->name.buf, sym->flags, sym->value);
- }
- putc('\n', stderr);
- }
-}
-#endif
-
-Symbol *
-lookup(char *name)
-{
- unsigned h;
- Symbol *sym, **list;
- int c, symtype;
- char *t, *s;
-
- h = 0;
- for (s = name; c = *s; ++s)
- h = h*33 ^ c;
- h &= HASHSIZ-1;
-
- c = toupper(*name);
- list = &hashtbl[h];
- for (sym = *list; sym; sym = sym->hash) {
- t = sym->name.buf;
- if (c == toupper(*t) && !casecmp(t, name))
- return sym;
- }
-
- sym = xmalloc(sizeof(*sym));
- sym->name = newstring(name);
- sym->flags = 0;
- sym->size = sym->value = 0;
- sym->section = cursec;
- sym->hash = *list;
- sym->next = NULL;
-
- *list = sym;
- if (symlast)
- symlast->next = sym;
- symlast = sym;
- if (!symlist)
- symlist = sym;
-
- return sym;
-}
-
-Symbol *
-deflabel(char *name)
-{
- static Symbol *cursym;
- Symbol *sym;
- char label[MAXSYM+1];
-
- if (*name == '.') {
- int r;
-
- if (!cursym) {
- error("local label '%s' without global label", name);
- return NULL;
- }
- r = snprintf(label, sizeof(label),
- "%s%s",
- cursym->name.buf, name);
- if (r == sizeof(label)) {
- error("local label '%s' in '%s' produces too long symbol",
- name, cursym->name.buf);
- return NULL;
- }
- name = label;
- }
-
- sym = lookup(name);
- if (pass == 1 && (sym->flags & FDEF))
- error("redefinition of label '%s'", name);
- if (cursec->flags & SABS)
- sym->flags |= FABS;
- sym->flags |= FDEF;
- sym->value = cursec->curpc;
- sym->section = cursec;
-
- if (*name != '.')
- cursym = sym;
- return sym;
-}
-
-int
-toobig(Node *np, int type)
-{
- /* TODO */
- return 0;
-}
-
-static void
-incpc(int siz)
-{
- TUINT pc, curpc;
-
- pc = cursec->pc;
- curpc = cursec->curpc;
-
- cursec->curpc += siz;
- cursec->pc += siz;
-
- if (pass == 2)
- return;
-
- if (cursec->pc > cursec->max)
- cursec->max = cursec->pc;
-
- if (pc > cursec->pc ||
- curpc > cursec->curpc ||
- cursec->curpc > maxaddr ||
- cursec->pc > maxaddr) {
- die("as: address overflow in section '%s'");
- }
-}
-
-static int
-secflags(char *attr)
-{
- int c, flags;
-
- if (!attr)
- return 0;
-
- for (flags = 0; c = *attr++; ) {
- switch (c) {
- case 'w':
- flags |= SWRITE;
- break;
- case 'r':
- flags |= SREAD;
- break;
- case 'x':
- flags |= SEXEC;
- break;
- case 'f':
- flags |= SFILE;
- break;
- case 'l':
- flags |= SLOAD;
- break;
- case 'a':
- flags |= SABS;
- break;
- }
- }
-
- return flags;
-}
-
-Section *
-setsec(char *name, char *attr)
-{
- Section *sec;
- Symbol *sym;
-
- cursec = NULL;
- sym = lookup(name);
- if (sym->flags & ~FSECT)
- error("invalid section name '%s'", name);
-
- if ((sec = sym->section) == NULL) {
- sec = xmalloc(sizeof(*sec));
- sec->mem = NULL;
- sec->sym = sym;
- sec->base = sec->max = sec->pc = sec->curpc = 0;
- sec->next = seclist;
- sec->flags = 0;
- sec->fill = 0;
- sec->aligment = 0;
- sec->next = seclist;
- seclist = sec;
-
- sym->section = sec;
- sym->flags = FSECT;
- }
- sec->flags |= secflags(attr);
-
- return cursec = sec;
-}
-
-void
-isecs(void)
-{
- sabs = setsec(".abs", "rwx");
- sbss = setsec(".bss", "rwf");
- sdata = setsec(".data", "rw");
- stext = setsec(".text", "rx");
-}
-
-void
-cleansecs(void)
-{
- Section *sec;
- TUINT siz;
-
- for (sec = seclist; sec; sec = sec->next) {
- sec->curpc = sec->pc = sec->base;
- if (pass == 1 || sec->flags & SFILE)
- continue;
-
- siz = sec->max - sec->base;
- if (siz > SIZE_MAX)
- die("as: out of memory");
- sec->mem = xmalloc(sec->max - sec->base);
- }
- cursec = stext;
-}
-
-void
-emit(char *bytes, int n)
-{
- if (cursec->mem) {
- size_t len = cursec->pc - cursec->base;
- memcpy(&cursec->mem[len], bytes, n);
- }
- incpc(n);
-}
-
-Symbol *
-tmpsym(TUINT val)
-{
- Symbol *sym;
-
- if (!tmpalloc)
- tmpalloc = alloc(sizeof(*sym), NALLOC);
- sym = new(tmpalloc);
- sym->value = val;
- sym->section = NULL;
- sym->flags = FABS;
-
- return sym;
-}
-
-void
-killtmp(void)
-{
- if (!tmpalloc)
- return;
- dealloc(tmpalloc);
- tmpalloc = NULL;
-}
-
-String
-newstring(char *s)
-{
- size_t len = strlen(s) + 1;
- String str;
-
- str.offset = 0;
- str.buf = xmalloc(len);
- memcpy(str.buf, s, len);
- return str;
-}
--- a/as/target/amd64.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-
-AMD64_OBJ = $(OBJ) target/x86/amd64tbl.o target/x86/amd64.o target/x86/ins.o
-
-target/x86/amd64tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat
- ./gentbl.sh -f x86 -c amd64
-
-$(LIBEXEC)/as-amd64: $(AMD64_OBJ)
- $(CC) $(SCC_LDFLAGS) $(AMD64_OBJ) -lscc -o $@
--- a/as/target/i286.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-
-I286_OBJ = $(OBJ) target/x86/i286tbl.o target/x86/i286.o target/x86/ins.o
-
-target/x86/i286tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat
- ./gentbl.sh -f x86 -c i286
-
-$(LIBEXEC)/as-i286: $(I286_OBJ)
- $(CC) $(SCC_LDFLAGS) $(I286_OBJ) -lscc -o $@
--- a/as/target/i386.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-
-I386_OBJ = $(OBJ) target/x86/i386tbl.o target/x86/i386.o target/x86/ins.o
-
-target/x86/i386tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat
- ./gentbl.sh -f x86 -c i386
-
-$(LIBEXEC)/as-i386: $(I386_OBJ)
- $(CC) $(SCC_LDFLAGS) $(I386_OBJ) -lscc -o $@
--- a/as/target/x80/ins.c
+++ /dev/null
@@ -1,600 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x80/ins.c";
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-#include "proc.h"
-
-/*
- * This implementation is based in:
- * - Zilog Z80 CPU Specifications by Sean Young
- * - Decoding Z80 opcodes - of use to disassembler and emulator
- * writers - by Cristian Dinu.
- */
-
-static int
-getclass(Node *np)
-{
- if (np->addr != AREG)
- return 0;
-
- switch (np->sym->value) {
- case AREG_C:
- return RCLASS | PCLASS | QCLASS | CCCLASS | SSCLASS;
- case AREG_A:
- case AREG_B:
- case AREG_D:
- case AREG_E:
- return RCLASS | PCLASS | QCLASS;
- case AREG_H:
- case AREG_L:
- return RCLASS;
- case AREG_IXL:
- case AREG_IXH:
- return PCLASS;
- case AREG_IYL:
- case AREG_IYH:
- return QCLASS;
- case AREG_HL:
- return DDCLASS | QQCLASS;
- case AREG_BC:
- case AREG_DE:
- return DDCLASS | QQCLASS | PPCLASS | RRCLASS;
- case AREG_SP:
- return DDCLASS | PPCLASS | RRCLASS;
- case AREG_AF:
- return QQCLASS;
- case AREG_IX:
- return PPCLASS;
- case AREG_IY:
- return RRCLASS;
- case AREG_PO:
- case AREG_PE:
- case AREG_P:
- case AREG_M:
- return CCCLASS;
- case AREG_NZ:
- case AREG_Z:
- case AREG_NC:
- return CCCLASS | SSCLASS;
- default:
- return 0;
- }
-}
-
-int
-match(Op *op, Node **args)
-{
- unsigned char *p;
- int arg, class, rep, opt;
- Node *np;
-
- if (!op->args)
- return args == NULL;
-
- opt = rep = 0;
- for (p = op->args; arg = *p; ++p) {
- if (rep)
- --p;
- if ((np = *args++) == NULL)
- return (rep|opt) != 0;
-
- switch (arg) {
- case AOPT:
- opt = 1;
- break;
- case AREP:
- rep = 1;
- break;
- case AINDER_C:
- arg = AREG_C;
- goto indirect;
- case AINDER_HL:
- arg = AREG_HL;
- goto indirect;
- case AINDER_DE:
- arg = AREG_DE;
- goto indirect;
- case AINDER_BC:
- arg = AREG_BC;
- goto indirect;
- case AINDER_IX:
- arg = AREG_IX;
- goto indirect;
- case AINDER_IY:
- arg = AREG_IY;
- goto indirect;
- case AINDER_SP:
- arg = AREG_SP;
- indirect:
- if (np->addr != AINDIR)
- return 0;
- np = np->left;
- case AREG_A:
- case AREG_I:
- case AREG_R:
- case AREG_F:
- case AREG_HL:
- case AREG_BC:
- case AREG_DE:
- case AREG_IY:
- case AREG_IX:
- case AREG_SP:
- case AREG_AF:
- case AREG_AF_:
- if (np->addr != AREG || np->sym->value != arg)
- return 0;
- break;
- case AREG_RCLASS:
- class = RCLASS;
- goto check_class;
- case AREG_PCLASS:
- class = PCLASS;
- goto check_class;
- case AREG_QCLASS:
- class = QCLASS;
- goto check_class;
- case AREG_QQCLASS:
- class = QQCLASS;
- goto check_class;
- case AREG_PPCLASS:
- class = PPCLASS;
- goto check_class;
- case AREG_RRCLASS:
- class = RRCLASS;
- goto check_class;
- case AREG_CCCLASS:
- class = CCCLASS;
- goto check_class;
- case AREG_SSCLASS:
- class = SSCLASS;
- goto check_class;
- case AREG_DDCLASS:
- class = DDCLASS;
- check_class:
- if ((getclass(np) & class) == 0)
- return 0;
- break;
- case AINDEX_IY:
- arg = AREG_IY;
- goto index_address;
- case AINDEX_IX:
- arg = AREG_IX;
- index_address:
- if (np->addr != AINDEX)
- return 0;
- if (np->left->left->sym->value != arg)
- return 0;
- if (toobig(np, arg))
- error("overflow in index");
- break;
- case ARST:
- if (np->addr != AIMM)
- return 0;
- if ((np->sym->value & ~0x38) != 0)
- return 0;
- break;
- case AZERO:
- case AIMM3:
- case AIMM8:
- case AIMM16:
- case AIMM32:
- case AIMM64:
- if (np->addr != AIMM)
- return 0;
- if (toobig(np, arg))
- error("overflow in immediate operand");
- break;
- case ASYM:
- if (np->addr != AIMM || np->op != IDEN)
- return 0;
- break;
- case ADIRECT:
- case ASTR:
- if (np->addr != arg)
- return 0;
- break;
- default:
- abort();
- }
- }
-
- return *args == NULL;
-}
-
-/*
- * (expr) -> ADIRECT
- * (REG) -> AINDIR
- * (REG + expr) -> AINDEX
- * (REG - expr) -> AINDEX
- * expr (REG) -> AINDEX
- */
-Node *
-moperand(void)
-{
- int op;
- Node *np, *dir, *off, *reg;
-
- dir = off = reg = NULL;
- if (accept('(')) {
- if (yytoken != REG) {
- dir = expr();
- } else {
- reg = getreg();
- switch (yytoken) {
- case '+':
- case '-':
- off = expr();
- case ')':
- break;
- default:
- unexpected();
- }
- }
- } else {
- off = expr();
- expect('(');
- reg = getreg();
- }
- expect(')');
-
- if (dir) {
- op = ADIRECT;
- np = dir;
- } else if (off) {
- np = node(AREG_OFF, reg, off);
- op = AINDEX;
- } else {
- np = reg;
- op = AINDIR;
- }
- np = node(op, np, NULL);
- np->addr = op;
- return np;
-}
-
-static int
-reg2int(Node *np)
-{
- switch (np->sym->value) {
- case AREG_F:
- case AREG_B: return 0;
- case AREG_C: return 1;
- case AREG_D: return 2;
- case AREG_E: return 3;
- case AREG_IXH:
- case AREG_IYH:
- case AREG_H: return 4;
- case AREG_IXL:
- case AREG_IYL:
- case AREG_L: return 5;
- case AREG_A: return 7;
- case AREG_BC: return 0;
- case AREG_DE: return 1;
- case AREG_HL:
- case AREG_IX:
- case AREG_IY: return 2;
- case AREG_AF:
- case AREG_SP: return 3;
- default: abort();
- }
-}
-
-static int
-cc2int(Node *np)
-{
- switch (np->sym->value) {
- case AREG_NZ: return 0;
- case AREG_Z: return 1;
- case AREG_NC: return 2;
- case AREG_C: return 3;
- case AREG_PO: return 4;
- case AREG_PE: return 5;
- case AREG_P: return 6;
- case AREG_M: return 7;
- default: abort();
- }
-}
-
-static int
-ss2int(Node *np)
-{
- switch (np->sym->value) {
- case AREG_NZ: return 4;
- case AREG_Z: return 5;
- case AREG_NC: return 6;
- case AREG_C: return 7;
- default: abort();
- }
-}
-
-void
-dir(Op *op, Node **args)
-{
- Node *imm;
- unsigned char buf[4];
- unsigned val;
- int n = op->size;
-
- imm = (args[1]->addr == ADIRECT) ? args[1] : args[0];
- imm = imm->left;
- memcpy(buf, op->bytes, n);
- val = imm->sym->value;
- buf[n-1] = val >> 8;
- buf[n-2] = val;
- emit(buf, n);
-}
-
-void
-ld8(Op *op, Node **args)
-{
- Node *par1 = args[0], *par2 = args[1];
- int n = op->size, i = n;;
- unsigned regval = 0;
- unsigned char buf[4];
-
- memcpy(buf, op->bytes, n);
-
- if (par1->addr == AREG)
- regval |= reg2int(par1) << 3;
- if (par2->addr == AREG)
- regval |= reg2int(par2);
- else if (par2->addr == AIMM)
- buf[--i] = par2->sym->value;
-
- buf[--i] |= regval;
- emit(buf, n);
-}
-
-void
-alu16(Op *op, Node **args)
-{
- Node *par;
- int n = op->size;
- unsigned val;
- unsigned char buf[4];
-
- par = (args[1]) ? args[1] : args[0];
- val = reg2int(par);
- memcpy(buf, op->bytes, n);
- buf[n-1] |= val << 4;
- emit(buf, n);
-}
-
-void
-ld16(Op *op, Node **args)
-{
- Node *dst, *src, *tmp;
- int n = op->size;
- unsigned val;
- unsigned char buf[4];
-
- dst = args[0];
- src = args[1];
- if (!src) {
- alu16(op, args);
- return;
- }
-
- if (dst->addr != AREG) {
- tmp = src;
- src = dst;
- dst = tmp;
- }
-
- memcpy(buf, op->bytes, n);
- if (src->addr == ADIRECT)
- src = src->left;
- val = src->sym->value;
- buf[n-1] = val >> 8;
- buf[n-2] = val;
- buf[n-3] |= reg2int(dst) << 4;
- emit(buf, n);
-}
-
-void
-alu8(Op *op, Node **args)
-{
- Node *par = args[1];
- unsigned char buf[4];
- int n = op->size, shift;
- unsigned val;
-
- if (args[1]) {
- shift = 0;
- par = args[1];
- } else {
- shift = 3;
- par = args[0];
- }
-
- switch (par->addr) {
- case AIMM:
- val = par->sym->value;
- break;
- case AREG:
- val = reg2int(par) << shift;
- break;
- case AINDEX:
- val = par->left->right->sym->value;
- break;
- case AINDIR:
- val = 0;
- break;
- default:
- abort();
- }
-
- memcpy(buf, op->bytes, n);
- buf[n-1] |= val;
- emit(buf, n);
-}
-
-void
-idx(Op *op, Node **args)
-{
- Node *tmp, *idx, *imm, *reg;
- unsigned char buf[4];
- int n = op->size, i = n, shift = 0;
-
- imm = reg = NULL;
- if (args[0]->addr != AINDEX) {
- shift = 3;
- tmp = args[0];
- args[0] = args[1];
- args[1] = tmp;
- }
- idx = args[0]->left->right;
-
- if (args[1]->addr == AREG)
- reg = args[1];
- else
- imm = args[1];
-
- memcpy(buf, op->bytes, n);
-
- if (imm)
- buf[--i] = imm->sym->value;
- buf[--i] = idx->sym->value;
- if (reg)
- buf[--i] |= reg2int(reg) << shift;
-
- emit(buf, n);
-}
-
-void
-inout(Op *op, Node **args)
-{
- Node *port, *value;
- unsigned val;
- int n = op->size;
- unsigned char buf[5];
-
- port = args[0];
- value = args[1];
- if (port->addr != ADIRECT && port->addr != AINDIR) {
- value = port;
- port = args[1];
- }
-
- if (port->addr == ADIRECT)
- val = port->left->sym->value;
- else if (value->addr == AREG)
- val = reg2int(value) << 3;
- else
- val = 0;
-
- memcpy(buf, op->bytes, n);
- buf[n-1] |= val;
- emit(buf, n);
-}
-
-void
-rot_bit(Op *op, Node **args)
-{
- Node *par = args[0];
- unsigned char buf[5];
- int n = op->size;
- unsigned val, npar = 0;
-
- memcpy(buf, op->bytes, n);
-
- par = args[0];
- if (par->addr == AIMM) {
- buf[n-1] |= par->sym->value << 3;
- par = args[npar = 1];
- }
-
- switch (par->addr) {
- case AINDEX:
- val = par->left->right->sym->value;
- buf[n-2] = val;
- par = args[npar+1];
- if (!par)
- break;
- case AREG:
- val = reg2int(par);
- buf[n-1] |= val;
- case AINDIR:
- break;
- default:
- abort();
- }
-
- emit(buf, n);
-}
-
-void
-im(Op *op, Node **args)
-{
- unsigned val = args[0]->sym->value;
- unsigned char buf[4];
- int n = op->size;
-
- if (val > 0)
- ++val;
-
- memcpy(buf, op->bytes, n);
- buf[n-1] |= val << 3;
- emit(buf, n);
-}
-
-void
-branch(int relative, Op *op, Node **args)
-{
- unsigned char buf[4];
- Node *flag, *imm;
- int n = op->size, i = n;
- unsigned val;
- int (*fun)(Node *);
-
- flag = imm = NULL;
- if (args[0]->addr == AREG) {
- flag = args[0];
- imm = args[1];
- } else if (args[0]->addr == AIMM) {
- imm = args[0];
- }
- memcpy(buf, op->bytes, n);
-
- if (imm) {
- val = imm->sym->value;
- if (!relative)
- buf[--i] = val >> 8;
- else
- val -= cursec->curpc - 2;
- buf[--i] = val;
-
- }
- if (flag) {
- fun = (relative) ? ss2int : cc2int;
- buf[--i] |= (*fun)(flag) << 3;
- }
-
-
- emit(buf, n);
-}
-
-void
-jp(Op *op, Node **args)
-{
- branch(0, op, args);
-}
-
-void
-jr(Op *op, Node **args)
-{
- branch(1, op, args);
-}
-
-void
-rst(Op *op, Node **args)
-{
- unsigned char buf[1];
-
- buf[0] = op->bytes[0];
- buf[0] |= args[0]->sym->value;
- emit(buf, 1);
-}
--- a/as/target/x80/proc.h
+++ /dev/null
@@ -1,75 +1,0 @@
-enum args {
- AREG_AF = AMAX,
- AREG_A,
- AREG_F,
-
- AREG_BC,
- AREG_B,
- AREG_C,
-
- AREG_HL,
- AREG_H,
- AREG_L,
-
- AREG_DE,
- AREG_D,
- AREG_E,
-
- AREG_IX,
- AREG_IXL,
- AREG_IXH,
-
- AREG_IY,
- AREG_IYL,
- AREG_IYH,
-
- AREG_R,
- AREG_I,
- AREG_AF_,
- AREG_SP,
-
- AREG_NZ,
- AREG_Z,
- AREG_NC,
- AREG_PO,
- AREG_PE,
- AREG_P,
- AREG_M,
-
- AREG_RCLASS, /* register class for B, C, D, E, H, L and A */
- AREG_PCLASS, /* register class for B, C, D, E, IXH, IXL and A */
- AREG_QCLASS, /* register class for B, C, D, E, IYH, IYL and A */
- AREG_DDCLASS, /* register class for BC, DE, HL and SP */
- AREG_QQCLASS, /* register class for BC, DE, HL and AF */
- AREG_PPCLASS, /* register class for BC, DE, IX and SP */
- AREG_RRCLASS, /* register class for BC, DE, IY and SP */
- AREG_SSCLASS, /* flag class for C, NC, Z, NZ */
- AREG_CCCLASS, /* flag class for NZ, Z, NC, C, PO, PE, P, M */
-
- AINDEX_IX, /* (IX+d) */
- AINDEX_IY, /* (IX+d) */
-
- AINDER_HL, /* (HL) */
- AINDER_DE, /* (DE) */
- AINDER_BC, /* (BC) */
- AINDER_SP, /* (SP) */
- AINDER_C, /* (C) */
- AINDER_IX, /* (IX) */
- AINDER_IY, /* (IY) */
-
- AIMM3, /* 3 bit immediate */
- AZERO, /* a literal 0 */
- ARST, /* 0h, 08h, 10h, 18h, 20h, 28h, 30h, 38h */
-};
-
-enum class {
- RCLASS = 1 << 0,
- PCLASS = 1 << 1,
- QCLASS = 1 << 2,
- DDCLASS = 1 << 3,
- QQCLASS = 1 << 4,
- PPCLASS = 1 << 5,
- RRCLASS = 1 << 6,
- CCCLASS = 1 << 7,
- SSCLASS = 1 << 8,
-};
--- a/as/target/x80/rules.dat
+++ /dev/null
@@ -1,39 +1,0 @@
-imm8 AIMM8
-imm16 AIMM16
-imm32 AIMM32
-imm64 AIMM64
-imm3 AIMM3
-rst ARST
-\(IY\+n\) AINDEX_IY
-\(IX\+n\) AINDEX_IX
-ss AREG_SSCLASS
-cc AREG_CCCLASS
-dd AREG_DDCLASS
-qq AREG_QQCLASS
-rr AREG_RRCLASS
-pp AREG_PPCLASS
-p AREG_PCLASS
-q AREG_QCLASS
-r AREG_RCLASS
-R AREG_R
-\(DE\) AINDER_DE
-\(BC\) AINDER_BC
-\(HL\) AINDER_HL
-\(SP\) AINDER_SP
-\(C\) AINDER_C
-\(IX\) AINDER_IX
-\(IY\) AINDER_IY
-SP AREG_SP
-HL AREG_HL
-DE AREG_DE
-IX AREG_IX
-IY AREG_IY
-AF' AREG_AF_
-AF AREG_AF
-A AREG_A
-F AREG_F
-\(n\) ADIRECT
-I AREG_I
-0 AZERO
-sym ASYM
-string ASTR
--- a/as/target/x80/x80.dat
+++ /dev/null
@@ -1,374 +1,0 @@
-# Tab 18, tabs 18, :set ts=18
-# op args size bytes format cpu
-.SECTION sym,string? 0 none section Z80,R800,GB80
-.TEXT none 0 none text Z80,R800,GB80
-.DATA none 0 none data Z80,R800,GB80
-.BSS none 0 none bss Z80,R800,GB80
-.DB imm8+ 0 none defb Z80,R800,GB80
-.DEFB imm8+ 0 none defb Z80,R800,GB80
-.BYTE imm8+ 0 none defb Z80,R800,GB80
-.DW imm16+ 0 none defw Z80,R800,GB80
-.DEFW imm16+ 0 none defw Z80,R800,GB80
-.SHORT imm16+ 0 none defw Z80,R800,GB80
-.WORD imm16+ 0 none defw Z80,R800,GB80
-.DD imm32+ 0 none defd Z80,R800,GB80
-.DEFD imm32+ 0 none defd Z80,R800,GB80
-.LONG imm32+ 0 none defd Z80,R800,GB80
-.INT imm16+ 0 none defd Z80,R800,GB80
-.DQ imm64+ 0 none defq Z80,R800,GB80
-.DEFQ imm64+ 0 none defq Z80,R800,GB80
-.EQU sym,imm16 0 none equ Z80,R800,GB80
-.EQU imm16 0 none equ Z80,R800,GB80
-= imm16 0 none equ Z80,R800,GB80
-.SIZE sym,imm16 0 none size Z80,R800,GB80
-.SIZE imm16 0 none size Z80,R800,GB80
-.COMM sym,imm16 0 none common Z80,R800,GB80
-.COMM imm16 0 none common Z80,R800,GB80
-.TYPE sym,imm16 0 none type Z80,R800,GB80
-.TYPE imm16 0 none type Z80,R800,GB80
-.GLOBL sym+ 0 none global Z80,R800,GB80
-.PUBLIC sym+ 0 none global Z80,R800,GB80
-.EXTERN sym+ 0 none extrn Z80,R800,GB80
-.EXTRN sym+ 0 none extrn Z80,R800,GB80
-.STRING string+ 0 none string Z80,R800,GB80
-.ASCII string+ 0 none ascii Z80,R800,GB80
-.ALIGN imm16+ 0 none align Z80,R800,GB80
-.END none 0 none end Z80,R800,GB80
-.INCLUDE string 0 none include Z80,R800,GB80
-
-
-
-# p is any register from B, C, D, E, IXL, IXH, A
-# q is any register from B, C, D, E, IYL, IYH, A
-# r is any register from B, C, D, E, L, H, A
-# dd is any register from BC, DE, HL, SP
-# qq is any register from BC, DE, HL, AF
-# pp is any register from BC, DE, IX, SP
-# rr is any register from BC, DE, IY, SP
-# cc is any flag from NZ, Z, NC, C, PO, PE, P, M
-# ss is any flag from C, NC, Z, NZ
-
-# 8 bit load group
-LD r,imm8 2 0x06 ld8 Z80,R800,GB80
-LD p,imm8 3 0xdd,0x06 ld8 Z80,R800
-LD q,imm8 3 0xfd,0x06 ld8 Z80,R800
-LD (HL),imm8 2 0x36 ld8 Z80,R800,GB80
-
-LD r,r 1 0x40 ld8 Z80,R800,GB80
-LD p,p 2 0xdd,0x40 ld8 Z80,R800
-LD q,q 2 0xfd,0x40 ld8 Z80,R800
-LD (HL),r 1 0x70 ld8 Z80,R800,GB80
-LD r,(HL) 1 0x46 ld8 Z80,R800,GB80
-
-LD r,(IX+n) 3 0xdd,0x46 idx Z80,R800
-LD r,(IY+n) 3 0xfd,0x46 idx Z80,R800
-LD (IX+n),r 3 0xdd,0x70 idx Z80,R800
-LD (IY+n),r 3 0xfd,0x70 idx Z80,R800
-
-LD (HL),imm8 2 0x36 ld8 Z80,R800,GB80
-LD (IX+n),imm8 4 0xdd,0x36 idx Z80,R800
-LD (IY+n),imm8 4 0xfd,0x36 idx Z80,R800
-
-LD A,(BC) 1 0x0a noargs Z80,R800,GB80
-LD A,(DE) 1 0x1a noargs Z80,R800,GB80
-LD A,(n) 3 0x3a dir Z80,R800
-
-LD (BC),A 1 0x2 noargs Z80,R800,GB80
-LD (DE),A 1 0x12 noargs Z80,R800,GB80
-LD (n),A 3 0x32 dir Z80,R800
-
-LD A,(n) 3 0xfa dir GB80
-LD A,(HL+) 1 0x2a ld8 GB80 #TODO
-LD A,(HL-) 1 0x3a ld8 GB80 #TODO
-LD A,($FF00+n) 2 0xf0 dir GB80 #TODO
-LD A,($FF00+C) 2 0xf2 dir GB80 #TODO
-
-LD (n),A 3 0xea dir GB80
-LD (HL+),A 1 0x22 ld8 GB80 #TODO
-LD (HL-),A 1 0x32 ld8 GB80 #TODO
-LD ($FF00+n),A 2 0xe0 dir GB80 #TODO
-LD ($FF00+C),A 2 0xe2 dir GB80 #TODO
-
-LD A,I 2 0xed,0x57 noargs Z80,R800
-LD A,R 2 0xed,0x5f noargs Z80,R800
-LD I,A 2 0xed,0x47 noargs Z80,R800
-LD R,A 2 0xed,0x4f noargs Z80,R800
-
-# 16 bit load group
-LD dd,imm16 3 0x01 ld16 Z80,R800,GB80
-LD IX,imm16 4 0xdd,0x21 ld16 Z80,R800
-LD IY,imm16 4 0xfd,0x21 ld16 Z80,R800
-
-LD HL,(n) 3 0x2a ld16 Z80,R800,GB80
-LD dd,(n) 4 0xed,0x4b ld16 Z80,R800
-LD IX,(n) 4 0xdd,0x2a ld16 Z80,R800
-LD IY,(n) 4 0xfd,0x2a ld16 Z80,R800
-
-LD (n),HL 3 0x22 ld16 Z80,R800,GB80
-LD (n),dd 4 0xed,0x43 ld16 Z80,R800
-LD (n),IX 4 0xdd,0x22 ld16 Z80,R800
-LD (n),IY 4 0xfd,0x22 ld16 Z80,R800
-
-LD SP,HL 1 0xf9 noargs Z80,R800,GB80
-LD SP,IX 2 0xdd,0xf9 noargs Z80,R800
-LD SP,IY 2 0xfd,0xf9 noargs Z80,R800
-
-PUSH qq 1 0xc5 ld16 Z80,R800,GB80
-PUSH IX 2 0xdd,0xe5 ld16 Z80,R800
-PUSH IY 2 0xfd,0xe5 ld16 Z80,R800
-POP qq 1 0xc1 ld16 Z80,R800,GB80
-POP IX 2 0xdd,0xe1 ld16 Z80,R800
-POP IY 2 0xfd,0xe1 ld16 Z80,R800
-
-# 8 bit ALU group
-ADD A,r 1 0x80 alu8 Z80,R800,GB80
-ADD A,p 2 0xdd,0x80 alu8 Z80,R800
-ADD A,q 2 0xfd,0x80 alu8 Z80,R800
-ADD A,imm8 2 0xc6 alu8 Z80,R800,GB80
-ADD A,(HL) 1 0x86 alu8 Z80,R800,GB80
-ADD A,(IX+n) 3 0xdd,0x86 alu8 Z80,R800
-ADD A,(IY+n) 3 0xfd,0x86 alu8 Z80,R800
-
-ADC A,r 1 0x88 alu8 Z80,R800,GB80
-ADC A,p 2 0xdd,0x88 alu8 Z80,R800
-ADC A,q 2 0xfd,0x88 alu8 Z80,R800
-ADC A,imm8 2 0xce alu8 Z80,R800,GB80
-ADC A,(HL) 1 0x8e alu8 Z80,R800,GB80
-ADC A,(IX+n) 3 0xdd,0x8e alu8 Z80,R800
-ADC A,(IY+n) 3 0xfd,0x8e alu8 Z80,R800
-
-SUB A,r 1 0x90 alu8 Z80,R800,GB80
-SUB A,p 2 0xdd,0x90 alu8 Z80,R800
-SUB A,q 2 0xfd,0x90 alu8 Z80,R800
-SUB A,imm8 2 0xd6 alu8 Z80,R800,GB80
-SUB A,(HL) 1 0x96 alu8 Z80,R800,GB80
-SUB A,(IX+n) 3 0xdd,0x96 alu8 Z80,R800
-SUB A,(IY+n) 3 0xfd,0x96 alu8 Z80,R800
-
-SBC A,r 1 0x98 alu8 Z80,R800,GB80
-SBC A,p 2 0xdd,0x98 alu8 Z80,R800
-SBC A,q 2 0xfd,0x98 alu8 Z80,R800
-SBC A,imm8 2 0xde alu8 Z80,R800,GB80
-SBC A,(HL) 1 0x9e alu8 Z80,R800,GB80
-SBC A,(IX+n) 3 0xdd,0x9e alu8 Z80,R800
-SBC A,(IY+n) 3 0xfd,0x9e alu8 Z80,R800
-
-AND A,r 1 0xa0 alu8 Z80,R800,GB80
-AND A,p 2 0xdd,0xa0 alu8 Z80,R800
-AND A,q 2 0xfd,0xa0 alu8 Z80,R800
-AND A,imm8 2 0xe6 alu8 Z80,R800,GB80
-AND A,(HL) 1 0xa6 alu8 Z80,R800,GB80
-AND A,(IX+n) 3 0xdd,0xa6 alu8 Z80,R800
-AND A,(IY+n) 3 0xfd,0xa6 alu8 Z80,R800
-
-OR A,r 1 0xb0 alu8 Z80,R800,GB80
-OR A,p 2 0xdd,0xb0 alu8 Z80,R800
-OR A,q 2 0xfd,0xb0 alu8 Z80,R800
-OR A,imm8 2 0xf6 alu8 Z80,R800,GB80
-OR A,(HL) 1 0xb6 alu8 Z80,R800,GB80
-OR A,(IX+n) 3 0xdd,0xb6 alu8 Z80,R800
-OR A,(IY+n) 3 0xfd,0xb6 alu8 Z80,R800
-
-XOR A,r 1 0xa8 alu8 Z80,R800,GB80
-XOR A,p 2 0xdd,0xa8 alu8 Z80,R800
-XOR A,q 2 0xfd,0xa8 alu8 Z80,R800
-XOR A,imm8 2 0xee alu8 Z80,R800,GB80
-XOR A,(HL) 1 0xae alu8 Z80,R800,GB80
-XOR A,(IX+n) 3 0xdd,0xae alu8 Z80,R800
-XOR A,(IY+n) 3 0xfd,0xae alu8 Z80,R800
-
-CP A,r 1 0xb8 alu8 Z80,R800,GB80
-CP A,p 2 0xdd,0xb8 alu8 Z80,R800
-CP A,q 2 0xfd,0xb8 alu8 Z80,R800
-CP A,imm8 2 0xfe alu8 Z80,R800,GB80
-CP A,(HL) 1 0xbe alu8 Z80,R800,GB80
-CP A,(IX+n) 3 0xdd,0xbe alu8 Z80,R800
-CP A,(IY+n) 3 0xfd,0xbe alu8 Z80,R800
-
-INC r 1 0x04 alu8 Z80,R800,GB80
-INC p 2 0xdd,0x04 alu8 Z80,R800
-INC q 2 0xfd,0x04 alu8 Z80,R800
-INC (HL) 1 0x34 alu8 Z80,R800,GB80
-INC (IX+n) 3 0xdd,0x34 alu8 Z80,R800
-INC (IY+n) 3 0xfd,0x34 alu8 Z80,R800
-
-DEC r 1 0x05 alu8 Z80,R800,GB80
-DEC p 2 0xdd,0x05 alu8 Z80,R800
-DEC q 2 0xfd,0x05 alu8 Z80,R800
-DEC (HL) 1 0x35 alu8 Z80,R800,GB80
-DEC (IX+n) 3 0xdd,0x35 alu8 Z80,R800
-DEC (IY+n) 3 0xfd,0x35 alu8 Z80,R800
-
-ADD SP,dd 2 0xE8 alu8 GB80
-LD HL,SP+imm8 2 0xF8 alu8 GB80
-
-# 16 bit ALU group
-ADD HL,dd 1 0x09 alu16 Z80,R800,GB80
-ADC HL,dd 2 0xed,0x4a alu16 Z80,R800
-SBC HL,dd 2 0xed,0x42 alu16 Z80,R800
-ADD IX,pp 2 0xdd,0x09 alu16 Z80,R800
-ADD IY,rr 2 0xfd,0x09 alu16 Z80,R800
-
-INC dd 1 0x03 alu16 Z80,R800,GB80
-INC IX 2 0xdd,0x23 alu16 Z80,R800
-INC IY 2 0xfd,0x23 alu16 Z80,R800
-
-DEC dd 1 0x0b alu16 Z80,R800,GB80
-DEC IX 2 0xdd,0x2b alu16 Z80,R800
-DEC IY 2 0xfd,0x2b alu16 Z80,R800
-
-# General purpose arithmetic and CPU control group
-DAA none 1 0x27 noargs Z80,R800,GB80
-CPL none 1 0x2f noargs Z80,R800,GB80
-NEG none 2 0xed,0x44 noargs Z80,R800
-CCF none 1 0x3f noargs Z80,R800,GB80
-SCF none 1 0x37 noargs Z80,R800,GB80
-NOP none 1 0x00 noargs Z80,R800,GB80
-HALT none 1 0x76 noargs Z80,R800,GB80
-STOP none 2 0x10,0x00 noargs GB80
-DI none 1 0xf3 noargs Z80,R800,GB80
-EI none 1 0xfb noargs Z80,R800,GB80
-IM imm8 2 0xed,0x46 im Z80,R800
-
-# Exchange, block transfer and search groups
-EX DE,HL 1 0xeb noargs Z80,R800
-EX AF,AF' 1 0x08 noargs Z80,R800
-EXX none 1 0xd9 noargs Z80,R800
-EX (SP),HL 1 0xe3 noargs Z80,R800
-EX (SP),IX 2 0xdd,0xe3 noargs Z80,R800
-EX (SP),IY 2 0xfd,0xe3 noargs Z80,R800
-
-LDI none 2 0xed,0xa0 noargs Z80,R800
-LDIR none 2 0xed,0xb0 noargs Z80,R800
-LDD none 2 0xed,0xa8 noargs Z80,R800
-LDDR none 2 0xed,0xb8 noargs Z80,R800
-
-CPI none 2 0xed,0xa1 noargs Z80,R800
-CPIR none 2 0xed,0xb1 noargs Z80,R800
-CPD none 2 0xed,0xa9 noargs Z80,R800
-CPDR none 2 0xed,0xb9 noargs Z80,R800
-
-# Rotate and shift group
-RLCA none 1 0x07 noargs Z80,R800,GB80
-RLA none 1 0x17 noargs Z80,R800,GB80
-RRCA none 1 0x0f noargs Z80,R800,GB80
-RRA none 1 0x1f noargs Z80,R800,GB80
-
-RLD none 2 0xed,0x6f noargs Z80,R800
-RRD none 2 0xed,0x67 noargs Z80,R800
-
-RLC r 2 0xcb,0x00 rot_bit Z80,R800,GB80
-RLC (HL) 2 0xcb,0x06 rot_bit Z80,R800,GB80
-RLC (IX+n) 4 0xdd,0xcb,0,0x06 rot_bit Z80,R800
-RLC (IY+n) 4 0xfd,0xcb,0,0x06 rot_bit Z80,R800
-RLC (IX+n),r 4 0xdd,0xcb,0,0x00 rot_bit Z80,R800
-RLC (IY+n),r 4 0xfd,0xcb,0,0x00 rot_bit Z80,R800
-
-RL r 2 0xcb,0x10 rot_bit Z80,R800,GB80
-RL (HL) 2 0xcb,0x16 rot_bit Z80,R800,GB80
-RL (IX+n) 4 0xdd,0xcb,0,0x16 rot_bit Z80,R800
-RL (IY+n) 4 0xfd,0xcb,0,0x16 rot_bit Z80,R800
-RL (IX+n),r 4 0xdd,0xcb,0,0x10 rot_bit Z80,R800
-RL (IY+n),r 4 0xfd,0xcb,0,0x10 rot_bit Z80,R800
-
-RRC r 2 0xcb,0x08 rot_bit Z80,R800,GB80
-RRC (HL) 2 0xcb,0x0e rot_bit Z80,R800,GB80
-RRC (IX+n) 4 0xdd,0xcb,0,0x0e rot_bit Z80,R800
-RRC (IY+n) 4 0xfd,0xcb,0,0x0e rot_bit Z80,R800
-RRC (IX+n),r 4 0xdd,0xcb,0,0x08 rot_bit Z80,R800
-RRC (IY+n),r 4 0xfd,0xcb,0,0x08 rot_bit Z80,R800
-
-RR r 2 0xcb,0x18 rot_bit Z80,R800,GB80
-RR (HL) 2 0xcb,0x1e rot_bit Z80,R800,GB80
-RR (IX+n) 4 0xdd,0xcb,0,0x1e rot_bit Z80,R800
-RR (IY+n) 4 0xfd,0xcb,0,0x1e rot_bit Z80,R800
-RR (IX+n),r 4 0xdd,0xcb,0,0x18 rot_bit Z80,R800
-RR (IY+n),r 4 0xfd,0xcb,0,0x18 rot_bit Z80,R800
-
-SLA r 2 0xcb,0x20 rot_bit Z80,R800,GB80
-SLA (HL) 2 0xcb,0x26 rot_bit Z80,R800,GB80
-SLA (IX+n) 4 0xdd,0xcb,0,0x26 rot_bit Z80,R800
-SLA (IY+n) 4 0xfd,0xcb,0,0x26 rot_bit Z80,R800
-SLA (IX+n),r 4 0xdd,0xcb,0,0x20 rot_bit Z80,R800
-SLA (IY+n),r 4 0xfd,0xcb,0,0x20 rot_bit Z80,R800
-
-SWAP r 2 0xcb,0x30 rot_bit GB80
-SWAP (HL) 2 0xcb,0x36 rot_bit GB80
-
-SLL r 2 0xcb,0x30 rot_bit Z80
-SLL (HL) 2 0xcb,0x36 rot_bit Z80
-SLL (IX+n) 4 0xdd,0xcb,0,0x36 rot_bit Z80
-SLL (IY+n) 4 0xfd,0xcb,0,0x36 rot_bit Z80
-SLL (IX+n),r 4 0xdd,0xcb,0,0x30 rot_bit Z80
-SLL (IY+n),r 4 0xfd,0xcb,0,0x30 rot_bit Z80
-
-SRA r 2 0xcb,0x28 rot_bit Z80,R800,GB80
-SRA (HL) 2 0xcb,0x2e rot_bit Z80,R800,GB80
-SRA (IX+n) 4 0xdd,0xcb,0,0x2e rot_bit Z80,R800
-SRA (IY+n) 4 0xfd,0xcb,0,0x2e rot_bit Z80,R800
-SRA (IX+n),r 4 0xdd,0xcb,0,0x28 rot_bit Z80,R800
-SRA (IY+n),r 4 0xfd,0xcb,0,0x28 rot_bit Z80,R800
-
-SRL r 2 0xcb,0x38 rot_bit Z80,R800,GB80
-SRL (HL) 2 0xcb,0x3e rot_bit Z80,R800,GB80
-SRL (IX+n) 4 0xdd,0xcb,0,0x3e rot_bit Z80,R800
-SRL (IY+n) 4 0xfd,0xcb,0,0x3e rot_bit Z80,R800
-SRL (IX+n),r 4 0xdd,0xcb,0,0x38 rot_bit Z80,R800
-SRL (IY+n),r 4 0xfd,0xcb,0,0x38 rot_bit Z80,R800
-
-# Bit manipulation group
-BIT imm3,r 2 0xcb,0x40 rot_bit Z80,R800,GB80
-BIT imm3,(HL) 2 0xcb,0x46 rot_bit Z80,R800
-BIT imm3,(IX+n) 4 0xdd,0xcb,0,0x46 rot_bit Z80,R800
-BIT imm3,(IY+n) 4 0xfd,0xcb,0,0x46 rot_bit Z80,R800
-
-SET imm3,r 2 0xcb,0xc0 rot_bit Z80,R800,GB80
-SET imm3,(HL) 2 0xcb,0xc6 rot_bit Z80,R800,GB80
-SET imm3,(IX+n) 4 0xdd,0xcb,0,0xc6 rot_bit Z80,R800
-SET imm3,(IY+n) 4 0xfd,0xcb,0,0xc6 rot_bit Z80,R800
-SET imm3,(IX+n),r 4 0xdd,0xcb,0,0xc0 rot_bit Z80,R800
-SET imm3,(IY+n),r 4 0xfd,0xcb,0,0xc0 rot_bit Z80,R800
-
-RES imm3,r 2 0xcb,0x80 rot_bit Z80,R800,GB80
-RES imm3,(HL) 2 0xcb,0x86 rot_bit Z80,R800,GB80
-RES imm3,(IX+n) 4 0xdd,0xcb,0,0x86 rot_bit Z80,R800
-RES imm3,(IY+n) 4 0xfd,0xcb,0,0x86 rot_bit Z80,R800
-RES imm3,(IX+n),r 4 0xdd,0xcb,0,0x80 rot_bit Z80,R800
-RES imm3,(IY+n),r 4 0xfd,0xcb,0,0x80 rot_bit Z80,R800
-
-# Input and output group
-IN A,(n) 2 0xdb inout Z80,R800
-IN r,(C) 2 0xed,0x40 inout Z80,R800
-IN F,(C) 2 0xed,0x70 inout Z80,R800
-INI none 2 0xed,0xa2 noargs Z80,R800
-INIR none 2 0xed,0xb2 noargs Z80,R800
-IND none 2 0xed,0xaa noargs Z80,R800
-INDR none 2 0xed,0xba noargs Z80,R800
-
-OUT (n),A 2 0xd3 inout Z80,R800
-OUT (C),r 2 0xed,0x41 inout Z80,R800
-OUT (C),0 2 0xed,0x71 inout Z80,R800
-OUTI none 2 0xed,0xa3 noargs Z80,R800
-OTIR none 2 0xed,0xb3 noargs Z80,R800
-OUTD none 2 0xed,0xab noargs Z80,R800
-OTDR none 2 0xed,0xbb noargs Z80,R800
-
-# Jump group
-JP imm16 3 0xc3 jp Z80,R800,GB80
-JP cc,imm16 3 0xc2 jp Z80,R800,GB80
-JR imm16 2 0x18 jr Z80,R800,GB80
-JR ss,imm16 2 0x00 jr Z80,R800,GB80
-JP HL 1 0xe9 noargs Z80,R800,GB80
-JP IX 2 0xdd,0xe9 noargs Z80,R800
-JP IY 2 0xfd,0xe9 noargs Z80,R800
-DJNZ imm16 2 0x10 jr Z80,R800
-
-# Call and return group
-CALL imm16 3 0xcd jp Z80,R800,GB80
-CALL cc,imm16 3 0xc4 jp Z80,R800,GB80
-RET none 1 0xc9 noargs Z80,R800,GB80
-RET cc 1 0xc0 jp Z80,R800,GB80
-RETI none 2 0xed,0x4d noargs Z80,R800
-RETI none 1 0xd9 noargs GB80
-RETN none 2 0xed,0x45 noargs Z80,R800
-RST rst 1 0xc7 rst Z80,R800,GB80
--- a/as/target/x80/z80.c
+++ /dev/null
@@ -1,64 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x80/z80.c";
-
-#include <stdlib.h>
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-#include "../x80/proc.h"
-
-TUINT maxaddr = 0xFFFFFFFF;
-int endian = LITTLE_ENDIAN;
-
-void
-iarch(void)
-{
- static struct {
- char *name;
- char type;
- } regs[] = {
- "AF", AREG_AF,
- "A", AREG_A,
- "F", AREG_F,
-
- "BC", AREG_BC,
- "B", AREG_B,
- "C", AREG_C,
-
- "HL", AREG_HL,
- "H", AREG_H,
- "L", AREG_L,
-
- "DE", AREG_DE,
- "D", AREG_D,
- "E", AREG_E,
-
- "IX", AREG_IX,
- "IXL", AREG_IXL,
- "IXH", AREG_IXH,
-
- "IY", AREG_IY,
- "IYL", AREG_IYL,
- "IYH", AREG_IYH,
-
- "R", AREG_R,
- "I", AREG_I,
- "AF'", AREG_AF_,
- "SP", AREG_SP,
-
- "NZ", AREG_NZ,
- "Z", AREG_Z,
- "NC", AREG_NC,
- "PO", AREG_PO,
- "PE", AREG_PE,
- "P", AREG_P,
- "M", AREG_M,
-
- NULL,
- }, *bp;
-
- for (bp = regs; bp->name; ++bp) {
- Symbol *sym = lookup(bp->name);
- sym->flags = FREG;
- sym->value = bp->type;
- }
-}
--- a/as/target/x86/amd64.c
+++ /dev/null
@@ -1,12 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x86/amd64.c";
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-
-TUINT maxaddr = 0xFFFFFFFFFFFFFFFF;
-int endian = LITTLE_ENDIAN;
-
-void
-iarch(void)
-{
-}
--- a/as/target/x86/i286.c
+++ /dev/null
@@ -1,53 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x86/i286.c";
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-#include "../x86/proc.h"
-
-TUINT maxaddr = 0xFFFF;
-int endian = LITTLE_ENDIAN;
-int left2right = 0;
-
-void
-iarch(void)
-{
- static struct {
- char *name;
- char type;
- } regs[] = {
- "CS", AREG_CS,
- "DS", AREG_DS,
- "SS", AREG_SS,
- "ES", AREG_ES,
-
- "AX", AREG_AX,
- "AL", AREG_AL,
- "AH", AREG_AH,
-
- "BX", AREG_BX,
- "BL", AREG_BL,
- "BH", AREG_BH,
-
- "CX", AREG_CX,
- "CL", AREG_CL,
- "CH", AREG_CH,
-
- "DX", AREG_DX,
- "DL", AREG_DL,
- "DH", AREG_DH,
-
- "SI", AREG_SI,
- "DI", AREG_DI,
-
- "SP", AREG_SP,
- "BP", AREG_BP,
-
- NULL
- }, *bp;
-
- for (bp = regs; bp->name; ++bp) {
- Symbol *sym = lookup(bp->name);
- sym->flags = FREG;
- sym->value = bp->type;
- }
-}
--- a/as/target/x86/i386.c
+++ /dev/null
@@ -1,100 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x86/i386.c";
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-#include "../x86/proc.h"
-
-TUINT maxaddr = 0xFFFFFFFF;
-int endian = LITTLE_ENDIAN;
-
-void
-iarch(void)
-{
- static struct {
- char *name;
- char type;
- } regs[] = {
- "CS", AREG_CS,
- "DS", AREG_DS,
- "SS", AREG_SS,
- "ES", AREG_ES,
- "FS", AREG_FS,
- "GS", AREG_GS,
-
- "AX", AREG_AX,
- "AL", AREG_AL,
- "AH", AREG_AH,
- "EAX", AREG_EAX,
-
- "BC", AREG_BX,
- "BL", AREG_BL,
- "BH", AREG_BH,
- "EBX", AREG_EBX,
-
- "CX", AREG_CX,
- "CL", AREG_CL,
- "CH", AREG_CH,
- "ECX", AREG_ECX,
-
- "DX", AREG_DX,
- "DL", AREG_DL,
- "DH", AREG_DH,
- "EDX", AREG_EDX,
-
- "SI", AREG_SI,
- "ESI", AREG_ESI,
- "DI", AREG_DI,
- "EDI", AREG_EDI,
-
- "SP", AREG_SP,
- "ESP", AREG_ESP,
-
- "BP", AREG_BP,
- "EBP", AREG_EBP,
-
- "R0", AREG_R0,
- "MM0", AREG_MM0,
- "R1", AREG_R1,
- "MM1", AREG_MM1,
- "R2", AREG_R2,
- "MM2", AREG_MM2,
- "R3", AREG_R3,
- "MM3", AREG_MM3,
- "R4", AREG_R4,
- "MM4", AREG_MM4,
- "R5", AREG_R5,
- "MM5", AREG_MM5,
- "R6", AREG_R6,
- "MM6", AREG_MM6,
- "R7", AREG_R7,
- "MM7", AREG_MM7,
-
- "XMM0", AREG_XMM0,
- "XMM1", AREG_XMM1,
- "XMM2", AREG_XMM2,
- "XMM3", AREG_XMM3,
- "XMM4", AREG_XMM4,
- "XMM5", AREG_XMM5,
- "XMM6", AREG_XMM6,
- "XMM7", AREG_XMM7,
-
- "YMM0", AREG_YMM0,
- "YMM1", AREG_YMM1,
- "YMM2", AREG_YMM2,
- "YMM3", AREG_YMM3,
- "YMM4", AREG_YMM4,
- "YMM5", AREG_YMM5,
- "YMM6", AREG_YMM6,
- "YMM7", AREG_YMM7,
-
- "MXCSR", AREG_MXCSR,
-
- NULL
- }, *bp;
-
- for (bp = regs; bp->name; ++bp) {
- Symbol *sym = lookup(bp->name);
- sym->flags = FREG;
- sym->value = bp->type;
- }
-}
--- a/as/target/x86/ins.c
+++ /dev/null
@@ -1,301 +1,0 @@
-static char sccsid[] = "@(#) ./as/target/x86/ins.c";
-
-#include <stdlib.h>
-
-#include "../../../inc/scc.h"
-#include "../../as.h"
-#include "proc.h"
-
-#define addrbyte(mod, reg, rm) ((mod) << 6 | (reg) << 3 | (rm))
-
-enum addr_mode {
- MEM_MODE = 0,
- MEM8_MODE = 1,
- MEM16_MODE = 2,
- REG_MODE = 3,
-};
-
-static int
-getclass(Node *np)
-{
- if (np->addr != AREG)
- return 0;
-
- switch (np->sym->value) {
- case AREG_AL:
- case AREG_AH:
- case AREG_BL:
- case AREG_BH:
- case AREG_CL:
- case AREG_CH:
- case AREG_DL:
- case AREG_DH:
- return R8CLASS;
-
- case AREG_AX:
- case AREG_BX:
- case AREG_CX:
- case AREG_DX:
- case AREG_DI:
- case AREG_SI:
- case AREG_SP:
- case AREG_BP:
- return R16CLASS;
-
- case AREG_CS:
- case AREG_DS:
- case AREG_SS:
- case AREG_ES:
- case AREG_FS:
- case AREG_GS:
-
- case AREG_EFLAGS:
- case AREG_CF:
- case AREG_PF:
- case AREG_AF:
- case AREG_ZF:
- case AREG_SF:
- case AREG_TF:
- case AREG_IF:
- case AREG_DF:
- case AREG_OF:
- case AREG_IOPL:
- case AREG_NT:
- case AREG_RF:
- case AREG_VM:
- case AREG_AC:
- case AREG_VIF:
- case AREG_VIP:
- case AREG_ID:
-
- case AREG_EAX:
- case AREG_RAX:
-
- case AREG_EBX:
- case AREG_RBX:
-
- case AREG_ECX:
- case AREG_RCX:
-
- case AREG_EDX:
- case AREG_RDX:
-
- case AREG_SIL:
- case AREG_ESI:
- case AREG_RSI:
- case AREG_DIL:
- case AREG_EDI:
- case AREG_RDI:
-
- case AREG_SPL:
- case AREG_ESP:
- case AREG_RSP:
-
- case AREG_BPL:
- case AREG_EBP:
- case AREG_RBP:
-
- case AREG_R0:
- case AREG_MM0:
- case AREG_R1:
- case AREG_MM1:
- case AREG_R2:
- case AREG_MM2:
- case AREG_R3:
- case AREG_MM3:
- case AREG_R4:
- case AREG_MM4:
- case AREG_R5:
- case AREG_MM5:
- case AREG_R6:
- case AREG_MM6:
- case AREG_R7:
- case AREG_MM7:
-
- case AREG_R8:
- case AREG_R8L:
- case AREG_R8W:
- case AREG_R9:
- case AREG_R9L:
- case AREG_R9W:
- case AREG_R10:
- case AREG_R10L:
- case AREG_R10W:
- case AREG_R11:
- case AREG_R11L:
- case AREG_R11W:
- case AREG_R12:
- case AREG_R12L:
- case AREG_R12W:
- case AREG_R13:
- case AREG_R13L:
- case AREG_R13W:
- case AREG_R14:
- case AREG_R14L:
- case AREG_R14W:
- case AREG_R15:
- case AREG_R15L:
- case AREG_R15W:
-
- case AREG_XMM0:
- case AREG_XMM1:
- case AREG_XMM2:
- case AREG_XMM3:
- case AREG_XMM4:
- case AREG_XMM5:
- case AREG_XMM6:
- case AREG_XMM7:
- case AREG_XMM8:
- case AREG_XMM9:
- case AREG_XMM10:
- case AREG_XMM11:
- case AREG_XMM12:
- case AREG_XMM13:
- case AREG_XMM14:
- case AREG_XMM15:
-
- case AREG_YMM0:
- case AREG_YMM1:
- case AREG_YMM2:
- case AREG_YMM3:
- case AREG_YMM4:
- case AREG_YMM5:
- case AREG_YMM6:
- case AREG_YMM7:
- case AREG_YMM8:
- case AREG_YMM9:
- case AREG_YMM10:
- case AREG_YMM11:
- case AREG_YMM12:
- case AREG_YMM13:
- case AREG_YMM14:
- case AREG_YMM15:
-
- case AREG_MXCSR:
- return 0;
- default:
- abort();
- }
-}
-
-int
-match(Op *op, Node **args)
-{
- unsigned char *p;
- int arg, class, rep, opt;
- Node *np;
-
- if (!op->args)
- return args == NULL;
-
- opt = rep = 0;
- for (p = op->args; arg = *p; ++p) {
- if (rep)
- --p;
- if ((np = *args++) == NULL)
- return (rep|opt) != 0;
-
- switch (arg) {
- case AOPT:
- opt = 1;
- break;
- case AREP:
- rep = 1;
- break;
- case AREG_R8CLASS:
- class = R8CLASS;
- goto check_class;
- case AREG_R16CLASS:
- class = R16CLASS;
- check_class:
- if ((getclass(np) & class) == 0)
- return 0;
- break;
- case AIMM8:
- case AIMM16:
- case AIMM32:
- case AIMM64:
- if (np->addr != AIMM)
- return 0;
- if (toobig(np, arg))
- error("overflow in immediate operand");
- break;
- case ASYM:
- if (np->addr != AIMM || np->op != IDEN)
- return 0;
- break;
- case ADIRECT:
- case ASTR:
- if (np->addr != arg)
- return 0;
- break;
- default:
- abort();
- }
- }
-
- return *args == NULL;
-}
-
-Node *
-moperand(void)
-{
-}
-
-static int
-reg8toint(Node *np)
-{
- switch (np->sym->value) {
- case AREG_AL: return 0;
- case AREG_CL: return 1;
- case AREG_DL: return 2;
- case AREG_BL: return 3;
- case AREG_AH: return 4;
- case AREG_CH: return 5;
- case AREG_DH: return 6;
- case AREG_BH: return 7;
- default: abort();
- }
-}
-
-void
-reg8_reg8(Op *op, Node **args)
-{
- int src, dst;
- char buf[2];
-
- src = reg8toint(args[0]);
- dst = reg8toint(args[1]);
- buf[0] = op->bytes[0];
- buf[1] = addrbyte(REG_MODE, src, dst);
- emit(buf, 2);
-}
-
-static int
-reg16toint(Node *np)
-{
- switch (np->sym->value) {
- case AREG_AX: return 0;
- case AREG_CX: return 1;
- case AREG_DX: return 2;
- case AREG_BX: return 3;
- case AREG_SP: return 4;
- case AREG_BP: return 5;
- case AREG_SI: return 6;
- case AREG_DI: return 7;
- default: abort();
- }
-}
-
-void
-reg16_reg16(Op *op, Node **args)
-{
- int src, dst;
- char buf[2];
-
- src = reg16toint(args[0]);
- dst = reg16toint(args[1]);
- buf[0] = op->bytes[0];
- buf[1] = addrbyte(REG_MODE, src, dst);
- emit(buf, 2);
-}
--- a/as/target/x86/nasm.dat
+++ /dev/null
@@ -1,5313 +1,0 @@
-;; --------------------------------------------------------------------------
-;;
-;; Copyright 1996-2017 The NASM Authors - All Rights Reserved
-;; See the file AUTHORS included with the NASM distribution for
-;; the specific copyright holders.
-;;
-;; Redistribution and use in source and binary forms, with or without
-;; modification, are permitted provided that the following
-;; conditions are met:
-;;
-;; * Redistributions of source code must retain the above copyright
-;; notice, this list of conditions and the following disclaimer.
-;; * Redistributions in binary form must reproduce the above
-;; copyright notice, this list of conditions and the following
-;; disclaimer in the documentation and/or other materials provided
-;; with the distribution.
-;;
-;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-;; CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-;; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-;; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-;;
-;; --------------------------------------------------------------------------
-
-;
-; insns.dat table of instructions for the Netwide Assembler
-;
-; Format of file: All four fields must be present on every functional
-; line. Hence `void' for no-operand instructions, and `\0' for such
-; as EQU. If the last three fields are all `ignore', no action is
-; taken except to register the opcode as being present.
-;
-; For a detailed description of the code string (third field), please
-; see insns.pl and the comment at the top of assemble.c. For a detailed
-; description of the flags (fourth field), please see insns-iflags.ph.
-;
-; Comments with a pound sign after the semicolon generate section
-; subheaders in the NASM documentation.
-;
-
-;# Special instructions (pseudo-ops)
-; These MUST be first in this file and must maintain the pattern of
-; Dx by size, RESx by size, and INCBIN in that order.
-DT ignore ignore ignore
-DO ignore ignore ignore
-DY ignore ignore ignore
-DZ ignore ignore ignore
-RESB imm [ resb] 8086
-RESW ignore ignore ignore
-RESD ignore ignore ignore
-RESQ ignore ignore ignore
-REST ignore ignore ignore
-RESO ignore ignore ignore
-RESY ignore ignore ignore
-RESZ ignore ignore ignore
-INCBIN ignore ignore ignore
-
-;# Conventional instructions
-AAA void [ 37] 8086,NOLONG
-AAD void [ d5 0a] 8086,NOLONG
-AAD imm [i: d5 ib,u] 8086,SB,NOLONG
-AAM void [ d4 0a] 8086,NOLONG
-AAM imm [i: d4 ib,u] 8086,SB,NOLONG
-AAS void [ 3f] 8086,NOLONG
-ADC mem,reg8 [mr: hle 10 /r] 8086,SM,LOCK
-ADC reg8,reg8 [mr: 10 /r] 8086
-ADC mem,reg16 [mr: hle o16 11 /r] 8086,SM,LOCK
-ADC reg16,reg16 [mr: o16 11 /r] 8086
-ADC mem,reg32 [mr: hle o32 11 /r] 386,SM,LOCK
-ADC reg32,reg32 [mr: o32 11 /r] 386
-ADC mem,reg64 [mr: hle o64 11 /r] X64,SM,LOCK
-ADC reg64,reg64 [mr: o64 11 /r] X64
-ADC reg8,mem [rm: 12 /r] 8086,SM
-ADC reg8,reg8 [rm: 12 /r] 8086
-ADC reg16,mem [rm: o16 13 /r] 8086,SM
-ADC reg16,reg16 [rm: o16 13 /r] 8086
-ADC reg32,mem [rm: o32 13 /r] 386,SM
-ADC reg32,reg32 [rm: o32 13 /r] 386
-ADC reg64,mem [rm: o64 13 /r] X64,SM
-ADC reg64,reg64 [rm: o64 13 /r] X64
-ADC rm16,imm8 [mi: hle o16 83 /2 ib,s] 8086,LOCK
-ADC rm32,imm8 [mi: hle o32 83 /2 ib,s] 386,LOCK
-ADC rm64,imm8 [mi: hle o64 83 /2 ib,s] X64,LOCK
-ADC reg_al,imm [-i: 14 ib] 8086,SM
-ADC reg_ax,sbyteword [mi: o16 83 /2 ib,s] 8086,SM,ND
-ADC reg_ax,imm [-i: o16 15 iw] 8086,SM
-ADC reg_eax,sbytedword [mi: o32 83 /2 ib,s] 386,SM,ND
-ADC reg_eax,imm [-i: o32 15 id] 386,SM
-ADC reg_rax,sbytedword [mi: o64 83 /2 ib,s] X64,SM,ND
-ADC reg_rax,imm [-i: o64 15 id,s] X64,SM
-ADC rm8,imm [mi: hle 80 /2 ib] 8086,SM,LOCK
-ADC rm16,sbyteword [mi: hle o16 83 /2 ib,s] 8086,SM,LOCK,ND
-ADC rm16,imm [mi: hle o16 81 /2 iw] 8086,SM,LOCK
-ADC rm32,sbytedword [mi: hle o32 83 /2 ib,s] 386,SM,LOCK,ND
-ADC rm32,imm [mi: hle o32 81 /2 id] 386,SM,LOCK
-ADC rm64,sbytedword [mi: hle o64 83 /2 ib,s] X64,SM,LOCK,ND
-ADC rm64,imm [mi: hle o64 81 /2 id,s] X64,SM,LOCK
-ADC mem,imm8 [mi: hle 80 /2 ib] 8086,SM,LOCK,ND
-ADC mem,sbyteword16 [mi: hle o16 83 /2 ib,s] 8086,SM,LOCK,ND
-ADC mem,imm16 [mi: hle o16 81 /2 iw] 8086,SM,LOCK
-ADC mem,sbytedword32 [mi: hle o32 83 /2 ib,s] 386,SM,LOCK,ND
-ADC mem,imm32 [mi: hle o32 81 /2 id] 386,SM,LOCK
-ADC rm8,imm [mi: hle 82 /2 ib] 8086,SM,LOCK,ND,NOLONG
-ADD mem,reg8 [mr: hle 00 /r] 8086,SM,LOCK
-ADD reg8,reg8 [mr: 00 /r] 8086
-ADD mem,reg16 [mr: hle o16 01 /r] 8086,SM,LOCK
-ADD reg16,reg16 [mr: o16 01 /r] 8086
-ADD mem,reg32 [mr: hle o32 01 /r] 386,SM,LOCK
-ADD reg32,reg32 [mr: o32 01 /r] 386
-ADD mem,reg64 [mr: hle o64 01 /r] X64,SM,LOCK
-ADD reg64,reg64 [mr: o64 01 /r] X64
-ADD reg8,mem [rm: 02 /r] 8086,SM
-ADD reg8,reg8 [rm: 02 /r] 8086
-ADD reg16,mem [rm: o16 03 /r] 8086,SM
-ADD reg16,reg16 [rm: o16 03 /r] 8086
-ADD reg32,mem [rm: o32 03 /r] 386,SM
-ADD reg32,reg32 [rm: o32 03 /r] 386
-ADD reg64,mem [rm: o64 03 /r] X64,SM
-ADD reg64,reg64 [rm: o64 03 /r] X64
-ADD rm16,imm8 [mi: hle o16 83 /0 ib,s] 8086,LOCK
-ADD rm32,imm8 [mi: hle o32 83 /0 ib,s] 386,LOCK
-ADD rm64,imm8 [mi: hle o64 83 /0 ib,s] X64,LOCK
-ADD reg_al,imm [-i: 04 ib] 8086,SM
-ADD reg_ax,sbyteword [mi: o16 83 /0 ib,s] 8086,SM,ND
-ADD reg_ax,imm [-i: o16 05 iw] 8086,SM
-ADD reg_eax,sbytedword [mi: o32 83 /0 ib,s] 386,SM,ND
-ADD reg_eax,imm [-i: o32 05 id] 386,SM
-ADD reg_rax,sbytedword [mi: o64 83 /0 ib,s] X64,SM,ND
-ADD reg_rax,imm [-i: o64 05 id,s] X64,SM
-ADD rm8,imm [mi: hle 80 /0 ib] 8086,SM,LOCK
-ADD rm16,sbyteword [mi: hle o16 83 /0 ib,s] 8086,SM,LOCK,ND
-ADD rm16,imm [mi: hle o16 81 /0 iw] 8086,SM,LOCK
-ADD rm32,sbytedword [mi: hle o32 83 /0 ib,s] 386,SM,LOCK,ND
-ADD rm32,imm [mi: hle o32 81 /0 id] 386,SM,LOCK
-ADD rm64,sbytedword [mi: hle o64 83 /0 ib,s] X64,SM,LOCK,ND
-ADD rm64,imm [mi: hle o64 81 /0 id,s] X64,SM,LOCK
-ADD mem,imm8 [mi: hle 80 /0 ib] 8086,SM,LOCK
-ADD mem,sbyteword16 [mi: hle o16 83 /0 ib,s] 8086,SM,LOCK,ND
-ADD mem,imm16 [mi: hle o16 81 /0 iw] 8086,SM,LOCK
-ADD mem,sbytedword32 [mi: hle o32 83 /0 ib,s] 386,SM,LOCK,ND
-ADD mem,imm32 [mi: hle o32 81 /0 id] 386,SM,LOCK
-ADD rm8,imm [mi: hle 82 /0 ib] 8086,SM,LOCK,ND,NOLONG
-AND mem,reg8 [mr: hle 20 /r] 8086,SM,LOCK
-AND reg8,reg8 [mr: 20 /r] 8086
-AND mem,reg16 [mr: hle o16 21 /r] 8086,SM,LOCK
-AND reg16,reg16 [mr: o16 21 /r] 8086
-AND mem,reg32 [mr: hle o32 21 /r] 386,SM,LOCK
-AND reg32,reg32 [mr: o32 21 /r] 386
-AND mem,reg64 [mr: hle o64 21 /r] X64,SM,LOCK
-AND reg64,reg64 [mr: o64 21 /r] X64
-AND reg8,mem [rm: 22 /r] 8086,SM
-AND reg8,reg8 [rm: 22 /r] 8086
-AND reg16,mem [rm: o16 23 /r] 8086,SM
-AND reg16,reg16 [rm: o16 23 /r] 8086
-AND reg32,mem [rm: o32 23 /r] 386,SM
-AND reg32,reg32 [rm: o32 23 /r] 386
-AND reg64,mem [rm: o64 23 /r] X64,SM
-AND reg64,reg64 [rm: o64 23 /r] X64
-AND rm16,imm8 [mi: hle o16 83 /4 ib,s] 8086,LOCK
-AND rm32,imm8 [mi: hle o32 83 /4 ib,s] 386,LOCK
-AND rm64,imm8 [mi: hle o64 83 /4 ib,s] X64,LOCK
-AND reg_al,imm [-i: 24 ib] 8086,SM
-AND reg_ax,sbyteword [mi: o16 83 /4 ib,s] 8086,SM,ND
-AND reg_ax,imm [-i: o16 25 iw] 8086,SM
-AND reg_eax,sbytedword [mi: o32 83 /4 ib,s] 386,SM,ND
-AND reg_eax,imm [-i: o32 25 id] 386,SM
-AND reg_rax,sbytedword [mi: o64 83 /4 ib,s] X64,SM,ND
-AND reg_rax,imm [-i: o64 25 id,s] X64,SM
-AND rm8,imm [mi: hle 80 /4 ib] 8086,SM,LOCK
-AND rm16,sbyteword [mi: hle o16 83 /4 ib,s] 8086,SM,LOCK,ND
-AND rm16,imm [mi: hle o16 81 /4 iw] 8086,SM,LOCK
-AND rm32,sbytedword [mi: hle o32 83 /4 ib,s] 386,SM,LOCK,ND
-AND rm32,imm [mi: hle o32 81 /4 id] 386,SM,LOCK
-AND rm64,sbytedword [mi: hle o64 83 /4 ib,s] X64,SM,LOCK,ND
-AND rm64,imm [mi: hle o64 81 /4 id,s] X64,SM,LOCK
-AND mem,imm8 [mi: hle 80 /4 ib] 8086,SM,LOCK
-AND mem,sbyteword16 [mi: hle o16 83 /4 ib,s] 8086,SM,LOCK,ND
-AND mem,imm16 [mi: hle o16 81 /4 iw] 8086,SM,LOCK
-AND mem,sbytedword32 [mi: hle o32 83 /4 ib,s] 386,SM,LOCK,ND
-AND mem,imm32 [mi: hle o32 81 /4 id] 386,SM,LOCK
-AND rm8,imm [mi: hle 82 /4 ib] 8086,SM,LOCK,ND,NOLONG
-ARPL mem,reg16 [mr: 63 /r] 286,PROT,SM,NOLONG
-ARPL reg16,reg16 [mr: 63 /r] 286,PROT,NOLONG
-BB0_RESET void [ 0f 3a] PENT,CYRIX,ND,OBSOLETE
-BB1_RESET void [ 0f 3b] PENT,CYRIX,ND,OBSOLETE
-BOUND reg16,mem [rm: o16 62 /r] 186,NOLONG
-BOUND reg32,mem [rm: o32 62 /r] 386,NOLONG
-BSF reg16,mem [rm: o16 nof3 0f bc /r] 386,SM
-BSF reg16,reg16 [rm: o16 nof3 0f bc /r] 386
-BSF reg32,mem [rm: o32 nof3 0f bc /r] 386,SM
-BSF reg32,reg32 [rm: o32 nof3 0f bc /r] 386
-BSF reg64,mem [rm: o64 nof3 0f bc /r] X64,SM
-BSF reg64,reg64 [rm: o64 nof3 0f bc /r] X64
-BSR reg16,mem [rm: o16 nof3 0f bd /r] 386,SM
-BSR reg16,reg16 [rm: o16 nof3 0f bd /r] 386
-BSR reg32,mem [rm: o32 nof3 0f bd /r] 386,SM
-BSR reg32,reg32 [rm: o32 nof3 0f bd /r] 386
-BSR reg64,mem [rm: o64 nof3 0f bd /r] X64,SM
-BSR reg64,reg64 [rm: o64 nof3 0f bd /r] X64
-BSWAP reg32 [r: o32 0f c8+r] 486
-BSWAP reg64 [r: o64 0f c8+r] X64
-BT mem,reg16 [mr: o16 0f a3 /r] 386,SM
-BT reg16,reg16 [mr: o16 0f a3 /r] 386
-BT mem,reg32 [mr: o32 0f a3 /r] 386,SM
-BT reg32,reg32 [mr: o32 0f a3 /r] 386
-BT mem,reg64 [mr: o64 0f a3 /r] X64,SM
-BT reg64,reg64 [mr: o64 0f a3 /r] X64
-BT rm16,imm [mi: o16 0f ba /4 ib,u] 386,SB
-BT rm32,imm [mi: o32 0f ba /4 ib,u] 386,SB
-BT rm64,imm [mi: o64 0f ba /4 ib,u] X64,SB
-BTC mem,reg16 [mr: hle o16 0f bb /r] 386,SM,LOCK
-BTC reg16,reg16 [mr: o16 0f bb /r] 386
-BTC mem,reg32 [mr: hle o32 0f bb /r] 386,SM,LOCK
-BTC reg32,reg32 [mr: o32 0f bb /r] 386
-BTC mem,reg64 [mr: hle o64 0f bb /r] X64,SM,LOCK
-BTC reg64,reg64 [mr: o64 0f bb /r] X64
-BTC rm16,imm [mi: hle o16 0f ba /7 ib,u] 386,SB,LOCK
-BTC rm32,imm [mi: hle o32 0f ba /7 ib,u] 386,SB,LOCK
-BTC rm64,imm [mi: hle o64 0f ba /7 ib,u] X64,SB,LOCK
-BTR mem,reg16 [mr: hle o16 0f b3 /r] 386,SM,LOCK
-BTR reg16,reg16 [mr: o16 0f b3 /r] 386
-BTR mem,reg32 [mr: hle o32 0f b3 /r] 386,SM,LOCK
-BTR reg32,reg32 [mr: o32 0f b3 /r] 386
-BTR mem,reg64 [mr: hle o64 0f b3 /r] X64,SM,LOCK
-BTR reg64,reg64 [mr: o64 0f b3 /r] X64
-BTR rm16,imm [mi: hle o16 0f ba /6 ib,u] 386,SB,LOCK
-BTR rm32,imm [mi: hle o32 0f ba /6 ib,u] 386,SB,LOCK
-BTR rm64,imm [mi: hle o64 0f ba /6 ib,u] X64,SB,LOCK
-BTS mem,reg16 [mr: hle o16 0f ab /r] 386,SM,LOCK
-BTS reg16,reg16 [mr: o16 0f ab /r] 386
-BTS mem,reg32 [mr: hle o32 0f ab /r] 386,SM,LOCK
-BTS reg32,reg32 [mr: o32 0f ab /r] 386
-BTS mem,reg64 [mr: hle o64 0f ab /r] X64,SM,LOCK
-BTS reg64,reg64 [mr: o64 0f ab /r] X64
-BTS rm16,imm [mi: hle o16 0f ba /5 ib,u] 386,SB,LOCK
-BTS rm32,imm [mi: hle o32 0f ba /5 ib,u] 386,SB,LOCK
-BTS rm64,imm [mi: hle o64 0f ba /5 ib,u] X64,SB,LOCK
-CALL imm [i: odf e8 rel] 8086,BND
-CALL imm|near [i: odf e8 rel] 8086,ND,BND
-CALL imm|far [i: odf 9a iwd seg] 8086,ND,NOLONG
-; Call/jmp near imm/reg/mem is always 64-bit in long mode.
-CALL imm16 [i: o16 e8 rel] 8086,NOLONG,BND
-CALL imm16|near [i: o16 e8 rel] 8086,ND,NOLONG,BND
-CALL imm16|far [i: o16 9a iwd seg] 8086,ND,NOLONG
-CALL imm32 [i: o32 e8 rel] 386,NOLONG,BND
-CALL imm32|near [i: o32 e8 rel] 386,ND,NOLONG,BND
-CALL imm32|far [i: o32 9a iwd seg] 386,ND,NOLONG
-CALL imm64 [i: o64nw e8 rel] X64,BND
-CALL imm64|near [i: o64nw e8 rel] X64,ND,BND
-CALL imm:imm [ji: odf 9a iwd iw] 8086,NOLONG
-CALL imm16:imm [ji: o16 9a iw iw] 8086,NOLONG
-CALL imm:imm16 [ji: o16 9a iw iw] 8086,NOLONG
-CALL imm32:imm [ji: o32 9a id iw] 386,NOLONG
-CALL imm:imm32 [ji: o32 9a id iw] 386,NOLONG
-CALL mem|far [m: odf ff /3] 8086,NOLONG
-CALL mem|far [m: o64 ff /3] X64
-CALL mem16|far [m: o16 ff /3] 8086
-CALL mem32|far [m: o32 ff /3] 386
-CALL mem64|far [m: o64 ff /3] X64
-CALL mem|near [m: odf ff /2] 8086,ND,BND
-CALL rm16|near [m: o16 ff /2] 8086,NOLONG,ND,BND
-CALL rm32|near [m: o32 ff /2] 386,NOLONG,ND,BND
-CALL rm64|near [m: o64nw ff /2] X64,ND,BND
-CALL mem [m: odf ff /2] 8086,BND
-CALL rm16 [m: o16 ff /2] 8086,NOLONG,BND
-CALL rm32 [m: o32 ff /2] 386,NOLONG,BND
-CALL rm64 [m: o64nw ff /2] X64,BND
-
-CBW void [ o16 98] 8086
-CDQ void [ o32 99] 386
-CDQE void [ o64 98] X64
-CLC void [ f8] 8086
-CLD void [ fc] 8086
-CLI void [ fa] 8086
-CLTS void [ 0f 06] 286,PRIV
-CMC void [ f5] 8086
-CMP mem,reg8 [mr: 38 /r] 8086,SM
-CMP reg8,reg8 [mr: 38 /r] 8086
-CMP mem,reg16 [mr: o16 39 /r] 8086,SM
-CMP reg16,reg16 [mr: o16 39 /r] 8086
-CMP mem,reg32 [mr: o32 39 /r] 386,SM
-CMP reg32,reg32 [mr: o32 39 /r] 386
-CMP mem,reg64 [mr: o64 39 /r] X64,SM
-CMP reg64,reg64 [mr: o64 39 /r] X64
-CMP reg8,mem [rm: 3a /r] 8086,SM
-CMP reg8,reg8 [rm: 3a /r] 8086
-CMP reg16,mem [rm: o16 3b /r] 8086,SM
-CMP reg16,reg16 [rm: o16 3b /r] 8086
-CMP reg32,mem [rm: o32 3b /r] 386,SM
-CMP reg32,reg32 [rm: o32 3b /r] 386
-CMP reg64,mem [rm: o64 3b /r] X64,SM
-CMP reg64,reg64 [rm: o64 3b /r] X64
-CMP rm16,imm8 [mi: o16 83 /7 ib,s] 8086
-CMP rm32,imm8 [mi: o32 83 /7 ib,s] 386
-CMP rm64,imm8 [mi: o64 83 /7 ib,s] X64
-CMP reg_al,imm [-i: 3c ib] 8086,SM
-CMP reg_ax,sbyteword [mi: o16 83 /7 ib,s] 8086,SM,ND
-CMP reg_ax,imm [-i: o16 3d iw] 8086,SM
-CMP reg_eax,sbytedword [mi: o32 83 /7 ib,s] 386,SM,ND
-CMP reg_eax,imm [-i: o32 3d id] 386,SM
-CMP reg_rax,sbytedword [mi: o64 83 /7 ib,s] X64,SM,ND
-CMP reg_rax,imm [-i: o64 3d id,s] X64,SM
-CMP rm8,imm [mi: 80 /7 ib] 8086,SM
-CMP rm16,sbyteword [mi: o16 83 /7 ib,s] 8086,SM,ND
-CMP rm16,imm [mi: o16 81 /7 iw] 8086,SM
-CMP rm32,sbytedword [mi: o32 83 /7 ib,s] 386,SM,ND
-CMP rm32,imm [mi: o32 81 /7 id] 386,SM
-CMP rm64,sbytedword [mi: o64 83 /7 ib,s] X64,SM,ND
-CMP rm64,imm [mi: o64 81 /7 id,s] X64,SM
-CMP mem,imm8 [mi: 80 /7 ib] 8086,SM
-CMP mem,sbyteword16 [mi: o16 83 /7 ib,s] 8086,SM,ND
-CMP mem,imm16 [mi: o16 81 /7 iw] 8086,SM
-CMP mem,sbytedword32 [mi: o32 83 /7 ib,s] 386,SM,ND
-CMP mem,imm32 [mi: o32 81 /7 id] 386,SM
-CMP rm8,imm [mi: 82 /7 ib] 8086,SM,ND,NOLONG
-CMPSB void [ repe a6] 8086
-CMPSD void [ repe o32 a7] 386
-CMPSQ void [ repe o64 a7] X64
-CMPSW void [ repe o16 a7] 8086
-CMPXCHG mem,reg8 [mr: hle 0f b0 /r] PENT,SM,LOCK
-CMPXCHG reg8,reg8 [mr: 0f b0 /r] PENT
-CMPXCHG mem,reg16 [mr: hle o16 0f b1 /r] PENT,SM,LOCK
-CMPXCHG reg16,reg16 [mr: o16 0f b1 /r] PENT
-CMPXCHG mem,reg32 [mr: hle o32 0f b1 /r] PENT,SM,LOCK
-CMPXCHG reg32,reg32 [mr: o32 0f b1 /r] PENT
-CMPXCHG mem,reg64 [mr: hle o64 0f b1 /r] X64,SM,LOCK
-CMPXCHG reg64,reg64 [mr: o64 0f b1 /r] X64
-CMPXCHG486 mem,reg8 [mr: 0f a6 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
-CMPXCHG486 reg8,reg8 [mr: 0f a6 /r] 486,UNDOC,ND,OBSOLETE
-CMPXCHG486 mem,reg16 [mr: o16 0f a7 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
-CMPXCHG486 reg16,reg16 [mr: o16 0f a7 /r] 486,UNDOC,ND,OBSOLETE
-CMPXCHG486 mem,reg32 [mr: o32 0f a7 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
-CMPXCHG486 reg32,reg32 [mr: o32 0f a7 /r] 486,UNDOC,ND,OBSOLETE
-CMPXCHG8B mem [m: hle norexw 0f c7 /1] PENT,LOCK
-CMPXCHG16B mem [m: o64 0f c7 /1] X64,LOCK
-CPUID void [ 0f a2] PENT
-CPU_READ void [ 0f 3d] PENT,CYRIX
-CPU_WRITE void [ 0f 3c] PENT,CYRIX
-CQO void [ o64 99] X64
-CWD void [ o16 99] 8086
-CWDE void [ o32 98] 386
-DAA void [ 27] 8086,NOLONG
-DAS void [ 2f] 8086,NOLONG
-DEC reg16 [r: o16 48+r] 8086,NOLONG
-DEC reg32 [r: o32 48+r] 386,NOLONG
-DEC rm8 [m: hle fe /1] 8086,LOCK
-DEC rm16 [m: hle o16 ff /1] 8086,LOCK
-DEC rm32 [m: hle o32 ff /1] 386,LOCK
-DEC rm64 [m: hle o64 ff /1] X64,LOCK
-DIV rm8 [m: f6 /6] 8086
-DIV rm16 [m: o16 f7 /6] 8086
-DIV rm32 [m: o32 f7 /6] 386
-DIV rm64 [m: o64 f7 /6] X64
-DMINT void [ 0f 39] P6,CYRIX
-EMMS void [ 0f 77] PENT,MMX
-ENTER imm,imm [ij: c8 iw ib,u] 186
-EQU imm ignore 8086
-EQU imm:imm ignore 8086
-F2XM1 void [ d9 f0] 8086,FPU
-FABS void [ d9 e1] 8086,FPU
-FADD mem32 [m: d8 /0] 8086,FPU
-FADD mem64 [m: dc /0] 8086,FPU
-FADD fpureg|to [r: dc c0+r] 8086,FPU
-FADD fpureg [r: d8 c0+r] 8086,FPU
-FADD fpureg,fpu0 [r-: dc c0+r] 8086,FPU
-FADD fpu0,fpureg [-r: d8 c0+r] 8086,FPU
-FADD void [ de c1] 8086,FPU,ND
-FADDP fpureg [r: de c0+r] 8086,FPU
-FADDP fpureg,fpu0 [r-: de c0+r] 8086,FPU
-FADDP void [ de c1] 8086,FPU,ND
-FBLD mem80 [m: df /4] 8086,FPU
-FBLD mem [m: df /4] 8086,FPU
-FBSTP mem80 [m: df /6] 8086,FPU
-FBSTP mem [m: df /6] 8086,FPU
-FCHS void [ d9 e0] 8086,FPU
-FCLEX void [ wait db e2] 8086,FPU
-FCMOVB fpureg [r: da c0+r] P6,FPU
-FCMOVB fpu0,fpureg [-r: da c0+r] P6,FPU
-FCMOVB void [ da c1] P6,FPU,ND
-FCMOVBE fpureg [r: da d0+r] P6,FPU
-FCMOVBE fpu0,fpureg [-r: da d0+r] P6,FPU
-FCMOVBE void [ da d1] P6,FPU,ND
-FCMOVE fpureg [r: da c8+r] P6,FPU
-FCMOVE fpu0,fpureg [-r: da c8+r] P6,FPU
-FCMOVE void [ da c9] P6,FPU,ND
-FCMOVNB fpureg [r: db c0+r] P6,FPU
-FCMOVNB fpu0,fpureg [-r: db c0+r] P6,FPU
-FCMOVNB void [ db c1] P6,FPU,ND
-FCMOVNBE fpureg [r: db d0+r] P6,FPU
-FCMOVNBE fpu0,fpureg [-r: db d0+r] P6,FPU
-FCMOVNBE void [ db d1] P6,FPU,ND
-FCMOVNE fpureg [r: db c8+r] P6,FPU
-FCMOVNE fpu0,fpureg [-r: db c8+r] P6,FPU
-FCMOVNE void [ db c9] P6,FPU,ND
-FCMOVNU fpureg [r: db d8+r] P6,FPU
-FCMOVNU fpu0,fpureg [-r: db d8+r] P6,FPU
-FCMOVNU void [ db d9] P6,FPU,ND
-FCMOVU fpureg [r: da d8+r] P6,FPU
-FCMOVU fpu0,fpureg [-r: da d8+r] P6,FPU
-FCMOVU void [ da d9] P6,FPU,ND
-FCOM mem32 [m: d8 /2] 8086,FPU
-FCOM mem64 [m: dc /2] 8086,FPU
-FCOM fpureg [r: d8 d0+r] 8086,FPU
-FCOM fpu0,fpureg [-r: d8 d0+r] 8086,FPU
-FCOM void [ d8 d1] 8086,FPU,ND
-FCOMI fpureg [r: db f0+r] P6,FPU
-FCOMI fpu0,fpureg [-r: db f0+r] P6,FPU
-FCOMI void [ db f1] P6,FPU,ND
-FCOMIP fpureg [r: df f0+r] P6,FPU
-FCOMIP fpu0,fpureg [-r: df f0+r] P6,FPU
-FCOMIP void [ df f1] P6,FPU,ND
-FCOMP mem32 [m: d8 /3] 8086,FPU
-FCOMP mem64 [m: dc /3] 8086,FPU
-FCOMP fpureg [r: d8 d8+r] 8086,FPU
-FCOMP fpu0,fpureg [-r: d8 d8+r] 8086,FPU
-FCOMP void [ d8 d9] 8086,FPU,ND
-FCOMPP void [ de d9] 8086,FPU
-FCOS void [ d9 ff] 386,FPU
-FDECSTP void [ d9 f6] 8086,FPU
-FDISI void [ wait db e1] 8086,FPU
-FDIV mem32 [m: d8 /6] 8086,FPU
-FDIV mem64 [m: dc /6] 8086,FPU
-FDIV fpureg|to [r: dc f8+r] 8086,FPU
-FDIV fpureg [r: d8 f0+r] 8086,FPU
-FDIV fpureg,fpu0 [r-: dc f8+r] 8086,FPU
-FDIV fpu0,fpureg [-r: d8 f0+r] 8086,FPU
-FDIV void [ de f9] 8086,FPU,ND
-FDIVP fpureg [r: de f8+r] 8086,FPU
-FDIVP fpureg,fpu0 [r-: de f8+r] 8086,FPU
-FDIVP void [ de f9] 8086,FPU,ND
-FDIVR mem32 [m: d8 /7] 8086,FPU
-FDIVR mem64 [m: dc /7] 8086,FPU
-FDIVR fpureg|to [r: dc f0+r] 8086,FPU
-FDIVR fpureg,fpu0 [r-: dc f0+r] 8086,FPU
-FDIVR fpureg [r: d8 f8+r] 8086,FPU
-FDIVR fpu0,fpureg [-r: d8 f8+r] 8086,FPU
-FDIVR void [ de f1] 8086,FPU,ND
-FDIVRP fpureg [r: de f0+r] 8086,FPU
-FDIVRP fpureg,fpu0 [r-: de f0+r] 8086,FPU
-FDIVRP void [ de f1] 8086,FPU,ND
-FEMMS void [ 0f 0e] PENT,3DNOW
-FENI void [ wait db e0] 8086,FPU
-FFREE fpureg [r: dd c0+r] 8086,FPU
-FFREE void [ dd c1] 8086,FPU
-FFREEP fpureg [r: df c0+r] 286,FPU,UNDOC
-FFREEP void [ df c1] 286,FPU,UNDOC
-FIADD mem32 [m: da /0] 8086,FPU
-FIADD mem16 [m: de /0] 8086,FPU
-FICOM mem32 [m: da /2] 8086,FPU
-FICOM mem16 [m: de /2] 8086,FPU
-FICOMP mem32 [m: da /3] 8086,FPU
-FICOMP mem16 [m: de /3] 8086,FPU
-FIDIV mem32 [m: da /6] 8086,FPU
-FIDIV mem16 [m: de /6] 8086,FPU
-FIDIVR mem32 [m: da /7] 8086,FPU
-FIDIVR mem16 [m: de /7] 8086,FPU
-FILD mem32 [m: db /0] 8086,FPU
-FILD mem16 [m: df /0] 8086,FPU
-FILD mem64 [m: df /5] 8086,FPU
-FIMUL mem32 [m: da /1] 8086,FPU
-FIMUL mem16 [m: de /1] 8086,FPU
-FINCSTP void [ d9 f7] 8086,FPU
-FINIT void [ wait db e3] 8086,FPU
-FIST mem32 [m: db /2] 8086,FPU
-FIST mem16 [m: df /2] 8086,FPU
-FISTP mem32 [m: db /3] 8086,FPU
-FISTP mem16 [m: df /3] 8086,FPU
-FISTP mem64 [m: df /7] 8086,FPU
-FISTTP mem16 [m: df /1] PRESCOTT,FPU
-FISTTP mem32 [m: db /1] PRESCOTT,FPU
-FISTTP mem64 [m: dd /1] PRESCOTT,FPU
-FISUB mem32 [m: da /4] 8086,FPU
-FISUB mem16 [m: de /4] 8086,FPU
-FISUBR mem32 [m: da /5] 8086,FPU
-FISUBR mem16 [m: de /5] 8086,FPU
-FLD mem32 [m: d9 /0] 8086,FPU
-FLD mem64 [m: dd /0] 8086,FPU
-FLD mem80 [m: db /5] 8086,FPU
-FLD fpureg [r: d9 c0+r] 8086,FPU
-FLD void [ d9 c1] 8086,FPU,ND
-FLD1 void [ d9 e8] 8086,FPU
-FLDCW mem [m: d9 /5] 8086,FPU,SW
-FLDENV mem [m: d9 /4] 8086,FPU
-FLDL2E void [ d9 ea] 8086,FPU
-FLDL2T void [ d9 e9] 8086,FPU
-FLDLG2 void [ d9 ec] 8086,FPU
-FLDLN2 void [ d9 ed] 8086,FPU
-FLDPI void [ d9 eb] 8086,FPU
-FLDZ void [ d9 ee] 8086,FPU
-FMUL mem32 [m: d8 /1] 8086,FPU
-FMUL mem64 [m: dc /1] 8086,FPU
-FMUL fpureg|to [r: dc c8+r] 8086,FPU
-FMUL fpureg,fpu0 [r-: dc c8+r] 8086,FPU
-FMUL fpureg [r: d8 c8+r] 8086,FPU
-FMUL fpu0,fpureg [-r: d8 c8+r] 8086,FPU
-FMUL void [ de c9] 8086,FPU,ND
-FMULP fpureg [r: de c8+r] 8086,FPU
-FMULP fpureg,fpu0 [r-: de c8+r] 8086,FPU
-FMULP void [ de c9] 8086,FPU,ND
-FNCLEX void [ db e2] 8086,FPU
-FNDISI void [ db e1] 8086,FPU
-FNENI void [ db e0] 8086,FPU
-FNINIT void [ db e3] 8086,FPU
-FNOP void [ d9 d0] 8086,FPU
-FNSAVE mem [m: dd /6] 8086,FPU
-FNSTCW mem [m: d9 /7] 8086,FPU,SW
-FNSTENV mem [m: d9 /6] 8086,FPU
-FNSTSW mem [m: dd /7] 8086,FPU,SW
-FNSTSW reg_ax [-: df e0] 286,FPU
-FPATAN void [ d9 f3] 8086,FPU
-FPREM void [ d9 f8] 8086,FPU
-FPREM1 void [ d9 f5] 386,FPU
-FPTAN void [ d9 f2] 8086,FPU
-FRNDINT void [ d9 fc] 8086,FPU
-FRSTOR mem [m: dd /4] 8086,FPU
-FSAVE mem [m: wait dd /6] 8086,FPU
-FSCALE void [ d9 fd] 8086,FPU
-FSETPM void [ db e4] 286,FPU
-FSIN void [ d9 fe] 386,FPU
-FSINCOS void [ d9 fb] 386,FPU
-FSQRT void [ d9 fa] 8086,FPU
-FST mem32 [m: d9 /2] 8086,FPU
-FST mem64 [m: dd /2] 8086,FPU
-FST fpureg [r: dd d0+r] 8086,FPU
-FST void [ dd d1] 8086,FPU,ND
-FSTCW mem [m: wait d9 /7] 8086,FPU,SW
-FSTENV mem [m: wait d9 /6] 8086,FPU
-FSTP mem32 [m: d9 /3] 8086,FPU
-FSTP mem64 [m: dd /3] 8086,FPU
-FSTP mem80 [m: db /7] 8086,FPU
-FSTP fpureg [r: dd d8+r] 8086,FPU
-FSTP void [ dd d9] 8086,FPU,ND
-FSTSW mem [m: wait dd /7] 8086,FPU,SW
-FSTSW reg_ax [-: wait df e0] 286,FPU
-FSUB mem32 [m: d8 /4] 8086,FPU
-FSUB mem64 [m: dc /4] 8086,FPU
-FSUB fpureg|to [r: dc e8+r] 8086,FPU
-FSUB fpureg,fpu0 [r-: dc e8+r] 8086,FPU
-FSUB fpureg [r: d8 e0+r] 8086,FPU
-FSUB fpu0,fpureg [-r: d8 e0+r] 8086,FPU
-FSUB void [ de e9] 8086,FPU,ND
-FSUBP fpureg [r: de e8+r] 8086,FPU
-FSUBP fpureg,fpu0 [r-: de e8+r] 8086,FPU
-FSUBP void [ de e9] 8086,FPU,ND
-FSUBR mem32 [m: d8 /5] 8086,FPU
-FSUBR mem64 [m: dc /5] 8086,FPU
-FSUBR fpureg|to [r: dc e0+r] 8086,FPU
-FSUBR fpureg,fpu0 [r-: dc e0+r] 8086,FPU
-FSUBR fpureg [r: d8 e8+r] 8086,FPU
-FSUBR fpu0,fpureg [-r: d8 e8+r] 8086,FPU
-FSUBR void [ de e1] 8086,FPU,ND
-FSUBRP fpureg [r: de e0+r] 8086,FPU
-FSUBRP fpureg,fpu0 [r-: de e0+r] 8086,FPU
-FSUBRP void [ de e1] 8086,FPU,ND
-FTST void [ d9 e4] 8086,FPU
-FUCOM fpureg [r: dd e0+r] 386,FPU
-FUCOM fpu0,fpureg [-r: dd e0+r] 386,FPU
-FUCOM void [ dd e1] 386,FPU,ND
-FUCOMI fpureg [r: db e8+r] P6,FPU
-FUCOMI fpu0,fpureg [-r: db e8+r] P6,FPU
-FUCOMI void [ db e9] P6,FPU,ND
-FUCOMIP fpureg [r: df e8+r] P6,FPU
-FUCOMIP fpu0,fpureg [-r: df e8+r] P6,FPU
-FUCOMIP void [ df e9] P6,FPU,ND
-FUCOMP fpureg [r: dd e8+r] 386,FPU
-FUCOMP fpu0,fpureg [-r: dd e8+r] 386,FPU
-FUCOMP void [ dd e9] 386,FPU,ND
-FUCOMPP void [ da e9] 386,FPU
-FXAM void [ d9 e5] 8086,FPU
-FXCH fpureg [r: d9 c8+r] 8086,FPU
-FXCH fpureg,fpu0 [r-: d9 c8+r] 8086,FPU
-FXCH fpu0,fpureg [-r: d9 c8+r] 8086,FPU
-FXCH void [ d9 c9] 8086,FPU,ND
-FXTRACT void [ d9 f4] 8086,FPU
-FYL2X void [ d9 f1] 8086,FPU
-FYL2XP1 void [ d9 f9] 8086,FPU
-HLT void [ f4] 8086,PRIV
-IBTS mem,reg16 [mr: o16 0f a7 /r] 386,SW,UNDOC,ND,OBSOLETE
-IBTS reg16,reg16 [mr: o16 0f a7 /r] 386,UNDOC,ND,OBSOLETE
-IBTS mem,reg32 [mr: o32 0f a7 /r] 386,SD,UNDOC,ND,OBSOLETE
-IBTS reg32,reg32 [mr: o32 0f a7 /r] 386,UNDOC,ND,OBSOLETE
-ICEBP void [ f1] 386,ND
-IDIV rm8 [m: f6 /7] 8086
-IDIV rm16 [m: o16 f7 /7] 8086
-IDIV rm32 [m: o32 f7 /7] 386
-IDIV rm64 [m: o64 f7 /7] X64
-IMUL rm8 [m: f6 /5] 8086
-IMUL rm16 [m: o16 f7 /5] 8086
-IMUL rm32 [m: o32 f7 /5] 386
-IMUL rm64 [m: o64 f7 /5] X64
-IMUL reg16,mem [rm: o16 0f af /r] 386,SM
-IMUL reg16,reg16 [rm: o16 0f af /r] 386
-IMUL reg32,mem [rm: o32 0f af /r] 386,SM
-IMUL reg32,reg32 [rm: o32 0f af /r] 386
-IMUL reg64,mem [rm: o64 0f af /r] X64,SM
-IMUL reg64,reg64 [rm: o64 0f af /r] X64
-IMUL reg16,mem,imm8 [rmi: o16 6b /r ib,s] 186,SM
-IMUL reg16,mem,sbyteword [rmi: o16 6b /r ib,s] 186,SM,ND
-IMUL reg16,mem,imm16 [rmi: o16 69 /r iw] 186,SM
-IMUL reg16,mem,imm [rmi: o16 69 /r iw] 186,SM,ND
-IMUL reg16,reg16,imm8 [rmi: o16 6b /r ib,s] 186
-IMUL reg16,reg16,sbyteword [rmi: o16 6b /r ib,s] 186,SM,ND
-IMUL reg16,reg16,imm16 [rmi: o16 69 /r iw] 186
-IMUL reg16,reg16,imm [rmi: o16 69 /r iw] 186,SM,ND
-IMUL reg32,mem,imm8 [rmi: o32 6b /r ib,s] 386,SM
-IMUL reg32,mem,sbytedword [rmi: o32 6b /r ib,s] 386,SM,ND
-IMUL reg32,mem,imm32 [rmi: o32 69 /r id] 386,SM
-IMUL reg32,mem,imm [rmi: o32 69 /r id] 386,SM,ND
-IMUL reg32,reg32,imm8 [rmi: o32 6b /r ib,s] 386
-IMUL reg32,reg32,sbytedword [rmi: o32 6b /r ib,s] 386,SM,ND
-IMUL reg32,reg32,imm32 [rmi: o32 69 /r id] 386
-IMUL reg32,reg32,imm [rmi: o32 69 /r id] 386,SM,ND
-IMUL reg64,mem,imm8 [rmi: o64 6b /r ib,s] X64,SM
-IMUL reg64,mem,sbytedword [rmi: o64 6b /r ib,s] X64,SM,ND
-IMUL reg64,mem,imm32 [rmi: o64 69 /r id] X64,SM
-IMUL reg64,mem,imm [rmi: o64 69 /r id,s] X64,SM,ND
-IMUL reg64,reg64,imm8 [rmi: o64 6b /r ib,s] X64
-IMUL reg64,reg64,sbytedword [rmi: o64 6b /r ib,s] X64,SM,ND
-IMUL reg64,reg64,imm32 [rmi: o64 69 /r id] X64
-IMUL reg64,reg64,imm [rmi: o64 69 /r id,s] X64,SM,ND
-IMUL reg16,imm8 [r+mi: o16 6b /r ib,s] 186
-IMUL reg16,sbyteword [r+mi: o16 6b /r ib,s] 186,SM,ND
-IMUL reg16,imm16 [r+mi: o16 69 /r iw] 186
-IMUL reg16,imm [r+mi: o16 69 /r iw] 186,SM,ND
-IMUL reg32,imm8 [r+mi: o32 6b /r ib,s] 386
-IMUL reg32,sbytedword [r+mi: o32 6b /r ib,s] 386,SM,ND
-IMUL reg32,imm32 [r+mi: o32 69 /r id] 386
-IMUL reg32,imm [r+mi: o32 69 /r id] 386,SM,ND
-IMUL reg64,imm8 [r+mi: o64 6b /r ib,s] X64
-IMUL reg64,sbytedword [r+mi: o64 6b /r ib,s] X64,SM,ND
-IMUL reg64,imm32 [r+mi: o64 69 /r id,s] X64
-IMUL reg64,imm [r+mi: o64 69 /r id,s] X64,SM,ND
-IN reg_al,imm [-i: e4 ib,u] 8086,SB
-IN reg_ax,imm [-i: o16 e5 ib,u] 8086,SB
-IN reg_eax,imm [-i: o32 e5 ib,u] 386,SB
-IN reg_al,reg_dx [--: ec] 8086
-IN reg_ax,reg_dx [--: o16 ed] 8086
-IN reg_eax,reg_dx [--: o32 ed] 386
-INC reg16 [r: o16 40+r] 8086,NOLONG
-INC reg32 [r: o32 40+r] 386,NOLONG
-INC rm8 [m: hle fe /0] 8086,LOCK
-INC rm16 [m: hle o16 ff /0] 8086,LOCK
-INC rm32 [m: hle o32 ff /0] 386,LOCK
-INC rm64 [m: hle o64 ff /0] X64,LOCK
-INSB void [ 6c] 186
-INSD void [ o32 6d] 386
-INSW void [ o16 6d] 186
-INT imm [i: cd ib,u] 8086,SB
-INT01 void [ f1] 386,ND
-INT1 void [ f1] 386
-INT03 void [ cc] 8086,ND
-INT3 void [ cc] 8086
-INTO void [ ce] 8086,NOLONG
-INVD void [ 0f 08] 486,PRIV
-INVPCID reg32,mem128 [rm: 66 0f 38 82 /r] FUTURE,INVPCID,PRIV,NOLONG
-INVPCID reg64,mem128 [rm: 66 0f 38 82 /r] FUTURE,INVPCID,PRIV,LONG
-INVLPG mem [m: 0f 01 /7] 486,PRIV
-INVLPGA reg_ax,reg_ecx [--: a16 0f 01 df] X86_64,AMD,NOLONG
-INVLPGA reg_eax,reg_ecx [--: a32 0f 01 df] X86_64,AMD
-INVLPGA reg_rax,reg_ecx [--: o64nw a64 0f 01 df] X64,AMD
-INVLPGA void [ 0f 01 df] X86_64,AMD
-IRET void [ odf cf] 8086
-IRETD void [ o32 cf] 386
-IRETQ void [ o64 cf] X64
-IRETW void [ o16 cf] 8086
-JCXZ imm [i: a16 e3 rel8] 8086,NOLONG
-JECXZ imm [i: a32 e3 rel8] 386
-JRCXZ imm [i: a64 e3 rel8] X64
-JMP imm|short [i: eb rel8] 8086
-JMP imm [i: jmp8 eb rel8] 8086,ND
-JMP imm [i: odf e9 rel] 8086,BND
-JMP imm|near [i: odf e9 rel] 8086,ND,BND
-JMP imm|far [i: odf ea iwd seg] 8086,ND,NOLONG
-; Call/jmp near imm/reg/mem is always 64-bit in long mode.
-JMP imm16 [i: o16 e9 rel] 8086,NOLONG,BND
-JMP imm16|near [i: o16 e9 rel] 8086,ND,NOLONG,BND
-JMP imm16|far [i: o16 ea iwd seg] 8086,ND,NOLONG
-JMP imm32 [i: o32 e9 rel] 386,NOLONG,BND
-JMP imm32|near [i: o32 e9 rel] 386,ND,NOLONG,BND
-JMP imm32|far [i: o32 ea iwd seg] 386,ND,NOLONG
-JMP imm64 [i: o64nw e9 rel] X64,BND
-JMP imm64|near [i: o64nw e9 rel] X64,ND,BND
-JMP imm:imm [ji: odf ea iwd iw] 8086,NOLONG
-JMP imm16:imm [ji: o16 ea iw iw] 8086,NOLONG
-JMP imm:imm16 [ji: o16 ea iw iw] 8086,NOLONG
-JMP imm32:imm [ji: o32 ea id iw] 386,NOLONG
-JMP imm:imm32 [ji: o32 ea id iw] 386,NOLONG
-JMP mem|far [m: odf ff /5] 8086,NOLONG
-JMP mem|far [m: o64 ff /5] X64
-JMP mem16|far [m: o16 ff /5] 8086
-JMP mem32|far [m: o32 ff /5] 386
-JMP mem64|far [m: o64 ff /5] X64
-JMP mem|near [m: odf ff /4] 8086,ND,BND
-JMP rm16|near [m: o16 ff /4] 8086,NOLONG,ND,BND
-JMP rm32|near [m: o32 ff /4] 386,NOLONG,ND,BND
-JMP rm64|near [m: o64nw ff /4] X64,ND,BND
-JMP mem [m: odf ff /4] 8086,BND
-JMP rm16 [m: o16 ff /4] 8086,NOLONG,BND
-JMP rm32 [m: o32 ff /4] 386,NOLONG,BND
-JMP rm64 [m: o64nw ff /4] X64,BND
-
-JMPE imm [i: odf 0f b8 rel] IA64
-JMPE imm16 [i: o16 0f b8 rel] IA64
-JMPE imm32 [i: o32 0f b8 rel] IA64
-JMPE rm16 [m: o16 0f 00 /6] IA64
-JMPE rm32 [m: o32 0f 00 /6] IA64
-LAHF void [ 9f] 8086
-LAR reg16,mem [rm: o16 0f 02 /r] 286,PROT,SW
-LAR reg16,reg16 [rm: o16 0f 02 /r] 286,PROT
-LAR reg16,reg32 [rm: o16 0f 02 /r] 386,PROT
-LAR reg16,reg64 [rm: o16 o64nw 0f 02 /r] X64,PROT,ND
-LAR reg32,mem [rm: o32 0f 02 /r] 386,PROT,SW
-LAR reg32,reg16 [rm: o32 0f 02 /r] 386,PROT
-LAR reg32,reg32 [rm: o32 0f 02 /r] 386,PROT
-LAR reg32,reg64 [rm: o32 o64nw 0f 02 /r] X64,PROT,ND
-LAR reg64,mem [rm: o64 0f 02 /r] X64,PROT,SW
-LAR reg64,reg16 [rm: o64 0f 02 /r] X64,PROT
-LAR reg64,reg32 [rm: o64 0f 02 /r] X64,PROT
-LAR reg64,reg64 [rm: o64 0f 02 /r] X64,PROT
-LDS reg16,mem [rm: o16 c5 /r] 8086,NOLONG
-LDS reg32,mem [rm: o32 c5 /r] 386,NOLONG
-LEA reg16,mem [rm: o16 8d /r] 8086
-LEA reg32,mem [rm: o32 8d /r] 386
-LEA reg64,mem [rm: o64 8d /r] X64
-LEAVE void [ c9] 186
-LES reg16,mem [rm: o16 c4 /r] 8086,NOLONG
-LES reg32,mem [rm: o32 c4 /r] 386,NOLONG
-LFENCE void [ np 0f ae e8] X64,AMD
-LFS reg16,mem [rm: o16 0f b4 /r] 386
-LFS reg32,mem [rm: o32 0f b4 /r] 386
-LFS reg64,mem [rm: o64 0f b4 /r] X64
-LGDT mem [m: 0f 01 /2] 286,PRIV
-LGS reg16,mem [rm: o16 0f b5 /r] 386
-LGS reg32,mem [rm: o32 0f b5 /r] 386
-LGS reg64,mem [rm: o64 0f b5 /r] X64
-LIDT mem [m: 0f 01 /3] 286,PRIV
-LLDT mem [m: 0f 00 /2] 286,PROT,PRIV
-LLDT mem16 [m: 0f 00 /2] 286,PROT,PRIV
-LLDT reg16 [m: 0f 00 /2] 286,PROT,PRIV
-LMSW mem [m: 0f 01 /6] 286,PRIV
-LMSW mem16 [m: 0f 01 /6] 286,PRIV
-LMSW reg16 [m: 0f 01 /6] 286,PRIV
-LOADALL void [ 0f 07] 386,UNDOC,ND,OBSOLETE
-LOADALL286 void [ 0f 05] 286,UNDOC,ND,OBSOLETE
-LODSB void [ ac] 8086
-LODSD void [ o32 ad] 386
-LODSQ void [ o64 ad] X64
-LODSW void [ o16 ad] 8086
-LOOP imm [i: adf e2 rel8] 8086
-LOOP imm,reg_cx [i-: a16 e2 rel8] 8086,NOLONG
-LOOP imm,reg_ecx [i-: a32 e2 rel8] 386
-LOOP imm,reg_rcx [i-: a64 e2 rel8] X64
-LOOPE imm [i: adf e1 rel8] 8086
-LOOPE imm,reg_cx [i-: a16 e1 rel8] 8086,NOLONG
-LOOPE imm,reg_ecx [i-: a32 e1 rel8] 386
-LOOPE imm,reg_rcx [i-: a64 e1 rel8] X64
-LOOPNE imm [i: adf e0 rel8] 8086
-LOOPNE imm,reg_cx [i-: a16 e0 rel8] 8086,NOLONG
-LOOPNE imm,reg_ecx [i-: a32 e0 rel8] 386
-LOOPNE imm,reg_rcx [i-: a64 e0 rel8] X64
-LOOPNZ imm [i: adf e0 rel8] 8086
-LOOPNZ imm,reg_cx [i-: a16 e0 rel8] 8086,NOLONG
-LOOPNZ imm,reg_ecx [i-: a32 e0 rel8] 386
-LOOPNZ imm,reg_rcx [i-: a64 e0 rel8] X64
-LOOPZ imm [i: adf e1 rel8] 8086
-LOOPZ imm,reg_cx [i-: a16 e1 rel8] 8086,NOLONG
-LOOPZ imm,reg_ecx [i-: a32 e1 rel8] 386
-LOOPZ imm,reg_rcx [i-: a64 e1 rel8] X64
-LSL reg16,mem [rm: o16 0f 03 /r] 286,PROT,SW
-LSL reg16,reg16 [rm: o16 0f 03 /r] 286,PROT
-LSL reg16,reg32 [rm: o16 0f 03 /r] 386,PROT
-LSL reg16,reg64 [rm: o16 o64nw 0f 03 /r] X64,PROT,ND
-LSL reg32,mem [rm: o32 0f 03 /r] 386,PROT,SW
-LSL reg32,reg16 [rm: o32 0f 03 /r] 386,PROT
-LSL reg32,reg32 [rm: o32 0f 03 /r] 386,PROT
-LSL reg32,reg64 [rm: o32 o64nw 0f 03 /r] X64,PROT,ND
-LSL reg64,mem [rm: o64 0f 03 /r] X64,PROT,SW
-LSL reg64,reg16 [rm: o64 0f 03 /r] X64,PROT
-LSL reg64,reg32 [rm: o64 0f 03 /r] X64,PROT
-LSL reg64,reg64 [rm: o64 0f 03 /r] X64,PROT
-LSS reg16,mem [rm: o16 0f b2 /r] 386
-LSS reg32,mem [rm: o32 0f b2 /r] 386
-LSS reg64,mem [rm: o64 0f b2 /r] X64
-LTR mem [m: 0f 00 /3] 286,PROT,PRIV
-LTR mem16 [m: 0f 00 /3] 286,PROT,PRIV
-LTR reg16 [m: 0f 00 /3] 286,PROT,PRIV
-MFENCE void [ np 0f ae f0] X64,AMD
-MONITOR void [ 0f 01 c8] PRESCOTT
-MONITOR reg_eax,reg_ecx,reg_edx [---: 0f 01 c8] PRESCOTT,NOLONG,ND
-MONITOR reg_rax,reg_ecx,reg_edx [---: 0f 01 c8] X64,ND
-MONITORX void [ 0f 01 fa] AMD
-MONITORX reg_rax,reg_ecx,reg_edx [---: 0f 01 fa] X64,AMD,ND
-MONITORX reg_eax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
-MONITORX reg_ax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
-MOV mem,reg_sreg [mr: 8c /r] 8086,SW
-MOV reg16,reg_sreg [mr: o16 8c /r] 8086
-MOV reg32,reg_sreg [mr: o32 8c /r] 386
-MOV reg64,reg_sreg [mr: o64nw 8c /r] X64,OPT,ND
-MOV rm64,reg_sreg [mr: o64 8c /r] X64
-MOV reg_sreg,mem [rm: 8e /r] 8086,SW
-MOV reg_sreg,reg16 [rm: 8e /r] 8086,OPT,ND
-MOV reg_sreg,reg32 [rm: 8e /r] 386,OPT,ND
-MOV reg_sreg,reg64 [rm: o64nw 8e /r] X64,OPT,ND
-MOV reg_sreg,reg16 [rm: o16 8e /r] 8086
-MOV reg_sreg,reg32 [rm: o32 8e /r] 386
-MOV reg_sreg,rm64 [rm: o64 8e /r] X64
-MOV reg_al,mem_offs [-i: a0 iwdq] 8086,SM
-MOV reg_ax,mem_offs [-i: o16 a1 iwdq] 8086,SM
-MOV reg_eax,mem_offs [-i: o32 a1 iwdq] 386,SM
-MOV reg_rax,mem_offs [-i: o64 a1 iwdq] X64,SM
-MOV mem_offs,reg_al [i-: a2 iwdq] 8086,SM,NOHLE
-MOV mem_offs,reg_ax [i-: o16 a3 iwdq] 8086,SM,NOHLE
-MOV mem_offs,reg_eax [i-: o32 a3 iwdq] 386,SM,NOHLE
-MOV mem_offs,reg_rax [i-: o64 a3 iwdq] X64,SM,NOHLE
-MOV reg32,reg_creg [mr: rex.l 0f 20 /r] 386,PRIV,NOLONG
-MOV reg64,reg_creg [mr: o64nw 0f 20 /r] X64,PRIV
-MOV reg_creg,reg32 [rm: rex.l 0f 22 /r] 386,PRIV,NOLONG
-MOV reg_creg,reg64 [rm: o64nw 0f 22 /r] X64,PRIV
-MOV reg32,reg_dreg [mr: 0f 21 /r] 386,PRIV,NOLONG
-MOV reg64,reg_dreg [mr: o64nw 0f 21 /r] X64,PRIV
-MOV reg_dreg,reg32 [rm: 0f 23 /r] 386,PRIV,NOLONG
-MOV reg_dreg,reg64 [rm: o64nw 0f 23 /r] X64,PRIV
-MOV reg32,reg_treg [mr: 0f 24 /r] 386,NOLONG,ND
-MOV reg_treg,reg32 [rm: 0f 26 /r] 386,NOLONG,ND
-MOV mem,reg8 [mr: hlexr 88 /r] 8086,SM
-MOV reg8,reg8 [mr: 88 /r] 8086
-MOV mem,reg16 [mr: hlexr o16 89 /r] 8086,SM
-MOV reg16,reg16 [mr: o16 89 /r] 8086
-MOV mem,reg32 [mr: hlexr o32 89 /r] 386,SM
-MOV reg32,reg32 [mr: o32 89 /r] 386
-MOV mem,reg64 [mr: hlexr o64 89 /r] X64,SM
-MOV reg64,reg64 [mr: o64 89 /r] X64
-MOV reg8,mem [rm: 8a /r] 8086,SM
-MOV reg8,reg8 [rm: 8a /r] 8086
-MOV reg16,mem [rm: o16 8b /r] 8086,SM
-MOV reg16,reg16 [rm: o16 8b /r] 8086
-MOV reg32,mem [rm: o32 8b /r] 386,SM
-MOV reg32,reg32 [rm: o32 8b /r] 386
-MOV reg64,mem [rm: o64 8b /r] X64,SM
-MOV reg64,reg64 [rm: o64 8b /r] X64
-MOV reg8,imm [ri: b0+r ib] 8086,SM
-MOV reg16,imm [ri: o16 b8+r iw] 8086,SM
-MOV reg32,imm [ri: o32 b8+r id] 386,SM
-MOV reg64,udword [ri: o64nw b8+r id] X64,SM,OPT,ND
-MOV reg64,sdword [mi: o64 c7 /0 id,s] X64,SM,OPT,ND
-MOV reg64,imm [ri: o64 b8+r iq] X64,SM
-MOV rm8,imm [mi: hlexr c6 /0 ib] 8086,SM
-MOV rm16,imm [mi: hlexr o16 c7 /0 iw] 8086,SM
-MOV rm32,imm [mi: hlexr o32 c7 /0 id] 386,SM
-MOV rm64,imm [mi: hlexr o64 c7 /0 id,s] X64,SM
-MOV rm64,imm32 [mi: hlexr o64 c7 /0 id,s] X64
-MOV mem,imm8 [mi: hlexr c6 /0 ib] 8086,SM
-MOV mem,imm16 [mi: hlexr o16 c7 /0 iw] 8086,SM
-MOV mem,imm32 [mi: hlexr o32 c7 /0 id] 386,SM
-MOVD mmxreg,rm32 [rm: np 0f 6e /r] PENT,MMX,SD
-MOVD rm32,mmxreg [mr: np 0f 7e /r] PENT,MMX,SD
-MOVD mmxreg,rm64 [rm: np o64 0f 6e /r] X64,MMX,SX,ND
-MOVD rm64,mmxreg [mr: np o64 0f 7e /r] X64,MMX,SX,ND
-MOVQ mmxreg,mmxrm [rm: np 0f 6f /r] PENT,MMX,SQ
-MOVQ mmxrm,mmxreg [mr: np 0f 7f /r] PENT,MMX,SQ
-MOVQ mmxreg,rm64 [rm: np o64 0f 6e /r] X64,MMX
-MOVQ rm64,mmxreg [mr: np o64 0f 7e /r] X64,MMX
-MOVSB void [ a4] 8086
-MOVSD void [ o32 a5] 386
-MOVSQ void [ o64 a5] X64
-MOVSW void [ o16 a5] 8086
-MOVSX reg16,mem [rm: o16 0f be /r] 386,SB
-MOVSX reg16,reg8 [rm: o16 0f be /r] 386
-MOVSX reg32,rm8 [rm: o32 0f be /r] 386
-MOVSX reg32,rm16 [rm: o32 0f bf /r] 386
-MOVSX reg64,rm8 [rm: o64 0f be /r] X64
-MOVSX reg64,rm16 [rm: o64 0f bf /r] X64
-MOVSXD reg64,rm32 [rm: o64 63 /r] X64
-MOVSX reg64,rm32 [rm: o64 63 /r] X64,ND
-MOVZX reg16,mem [rm: o16 0f b6 /r] 386,SB
-MOVZX reg16,reg8 [rm: o16 0f b6 /r] 386
-MOVZX reg32,rm8 [rm: o32 0f b6 /r] 386
-MOVZX reg32,rm16 [rm: o32 0f b7 /r] 386
-MOVZX reg64,rm8 [rm: o64 0f b6 /r] X64
-MOVZX reg64,rm16 [rm: o64 0f b7 /r] X64
-MUL rm8 [m: f6 /4] 8086
-MUL rm16 [m: o16 f7 /4] 8086
-MUL rm32 [m: o32 f7 /4] 386
-MUL rm64 [m: o64 f7 /4] X64
-MWAIT void [ 0f 01 c9] PRESCOTT
-MWAIT reg_eax,reg_ecx [--: 0f 01 c9] PRESCOTT,ND
-MWAITX void [ 0f 01 fb] AMD
-MWAITX reg_eax,reg_ecx [--: 0f 01 fb] AMD,ND
-NEG rm8 [m: hle f6 /3] 8086,LOCK
-NEG rm16 [m: hle o16 f7 /3] 8086,LOCK
-NEG rm32 [m: hle o32 f7 /3] 386,LOCK
-NEG rm64 [m: hle o64 f7 /3] X64,LOCK
-NOP rm16 [m: o16 0f 1f /0] P6
-NOP rm32 [m: o32 0f 1f /0] P6
-NOP rm64 [m: o64 0f 1f /0] X64
-NOT rm8 [m: hle f6 /2] 8086,LOCK
-NOT rm16 [m: hle o16 f7 /2] 8086,LOCK
-NOT rm32 [m: hle o32 f7 /2] 386,LOCK
-NOT rm64 [m: hle o64 f7 /2] X64,LOCK
-OR mem,reg8 [mr: hle 08 /r] 8086,SM,LOCK
-OR reg8,reg8 [mr: 08 /r] 8086
-OR mem,reg16 [mr: hle o16 09 /r] 8086,SM,LOCK
-OR reg16,reg16 [mr: o16 09 /r] 8086
-OR mem,reg32 [mr: hle o32 09 /r] 386,SM,LOCK
-OR reg32,reg32 [mr: o32 09 /r] 386
-OR mem,reg64 [mr: hle o64 09 /r] X64,SM,LOCK
-OR reg64,reg64 [mr: o64 09 /r] X64
-OR reg8,mem [rm: 0a /r] 8086,SM
-OR reg8,reg8 [rm: 0a /r] 8086
-OR reg16,mem [rm: o16 0b /r] 8086,SM
-OR reg16,reg16 [rm: o16 0b /r] 8086
-OR reg32,mem [rm: o32 0b /r] 386,SM
-OR reg32,reg32 [rm: o32 0b /r] 386
-OR reg64,mem [rm: o64 0b /r] X64,SM
-OR reg64,reg64 [rm: o64 0b /r] X64
-OR rm16,imm8 [mi: hle o16 83 /1 ib,s] 8086,LOCK
-OR rm32,imm8 [mi: hle o32 83 /1 ib,s] 386,LOCK
-OR rm64,imm8 [mi: hle o64 83 /1 ib,s] X64,LOCK
-OR reg_al,imm [-i: 0c ib] 8086,SM
-OR reg_ax,sbyteword [mi: o16 83 /1 ib,s] 8086,SM,ND
-OR reg_ax,imm [-i: o16 0d iw] 8086,SM
-OR reg_eax,sbytedword [mi: o32 83 /1 ib,s] 386,SM,ND
-OR reg_eax,imm [-i: o32 0d id] 386,SM
-OR reg_rax,sbytedword [mi: o64 83 /1 ib,s] X64,SM,ND
-OR reg_rax,imm [-i: o64 0d id,s] X64,SM
-OR rm8,imm [mi: hle 80 /1 ib] 8086,SM,LOCK
-OR rm16,sbyteword [mi: hle o16 83 /1 ib,s] 8086,SM,LOCK,ND
-OR rm16,imm [mi: hle o16 81 /1 iw] 8086,SM,LOCK
-OR rm32,sbytedword [mi: hle o32 83 /1 ib,s] 386,SM,LOCK,ND
-OR rm32,imm [mi: hle o32 81 /1 id] 386,SM,LOCK
-OR rm64,sbytedword [mi: hle o64 83 /1 ib,s] X64,SM,LOCK,ND
-OR rm64,imm [mi: hle o64 81 /1 id,s] X64,SM,LOCK
-OR mem,imm8 [mi: hle 80 /1 ib] 8086,SM,LOCK
-OR mem,sbyteword16 [mi: hle o16 83 /1 ib,s] 8086,SM,LOCK,ND
-OR mem,imm16 [mi: hle o16 81 /1 iw] 8086,SM,LOCK
-OR mem,sbytedword32 [mi: hle o32 83 /1 ib,s] 386,SM,LOCK,ND
-OR mem,imm32 [mi: hle o32 81 /1 id] 386,SM,LOCK
-OR rm8,imm [mi: hle 82 /1 ib] 8086,SM,LOCK,ND,NOLONG
-OUT imm,reg_al [i-: e6 ib,u] 8086,SB
-OUT imm,reg_ax [i-: o16 e7 ib,u] 8086,SB
-OUT imm,reg_eax [i-: o32 e7 ib,u] 386,SB
-OUT reg_dx,reg_al [--: ee] 8086
-OUT reg_dx,reg_ax [--: o16 ef] 8086
-OUT reg_dx,reg_eax [--: o32 ef] 386
-OUTSB void [ 6e] 186
-OUTSD void [ o32 6f] 386
-OUTSW void [ o16 6f] 186
-PACKSSDW mmxreg,mmxrm [rm: np o64nw 0f 6b /r] PENT,MMX,SQ
-PACKSSWB mmxreg,mmxrm [rm: np o64nw 0f 63 /r] PENT,MMX,SQ
-PACKUSWB mmxreg,mmxrm [rm: np o64nw 0f 67 /r] PENT,MMX,SQ
-PADDB mmxreg,mmxrm [rm: np o64nw 0f fc /r] PENT,MMX,SQ
-PADDD mmxreg,mmxrm [rm: np o64nw 0f fe /r] PENT,MMX,SQ
-PADDSB mmxreg,mmxrm [rm: np o64nw 0f ec /r] PENT,MMX,SQ
-PADDSIW mmxreg,mmxrm [rm: o64nw 0f 51 /r] PENT,MMX,SQ,CYRIX
-PADDSW mmxreg,mmxrm [rm: np o64nw 0f ed /r] PENT,MMX,SQ
-PADDUSB mmxreg,mmxrm [rm: np o64nw 0f dc /r] PENT,MMX,SQ
-PADDUSW mmxreg,mmxrm [rm: np o64nw 0f dd /r] PENT,MMX,SQ
-PADDW mmxreg,mmxrm [rm: np o64nw 0f fd /r] PENT,MMX,SQ
-PAND mmxreg,mmxrm [rm: np o64nw 0f db /r] PENT,MMX,SQ
-PANDN mmxreg,mmxrm [rm: np o64nw 0f df /r] PENT,MMX,SQ
-PAUSE void [ f3i 90] 8086
-PAVEB mmxreg,mmxrm [rm: o64nw 0f 50 /r] PENT,MMX,SQ,CYRIX
-PAVGUSB mmxreg,mmxrm [rm: o64nw 0f 0f /r bf] PENT,3DNOW,SQ
-PCMPEQB mmxreg,mmxrm [rm: np o64nw 0f 74 /r] PENT,MMX,SQ
-PCMPEQD mmxreg,mmxrm [rm: np o64nw 0f 76 /r] PENT,MMX,SQ
-PCMPEQW mmxreg,mmxrm [rm: np o64nw 0f 75 /r] PENT,MMX,SQ
-PCMPGTB mmxreg,mmxrm [rm: np o64nw 0f 64 /r] PENT,MMX,SQ
-PCMPGTD mmxreg,mmxrm [rm: np o64nw 0f 66 /r] PENT,MMX,SQ
-PCMPGTW mmxreg,mmxrm [rm: np o64nw 0f 65 /r] PENT,MMX,SQ
-PDISTIB mmxreg,mem [rm: 0f 54 /r] PENT,MMX,SM,CYRIX
-PF2ID mmxreg,mmxrm [rm: o64nw 0f 0f /r 1d] PENT,3DNOW,SQ
-PFACC mmxreg,mmxrm [rm: o64nw 0f 0f /r ae] PENT,3DNOW,SQ
-PFADD mmxreg,mmxrm [rm: o64nw 0f 0f /r 9e] PENT,3DNOW,SQ
-PFCMPEQ mmxreg,mmxrm [rm: o64nw 0f 0f /r b0] PENT,3DNOW,SQ
-PFCMPGE mmxreg,mmxrm [rm: o64nw 0f 0f /r 90] PENT,3DNOW,SQ
-PFCMPGT mmxreg,mmxrm [rm: o64nw 0f 0f /r a0] PENT,3DNOW,SQ
-PFMAX mmxreg,mmxrm [rm: o64nw 0f 0f /r a4] PENT,3DNOW,SQ
-PFMIN mmxreg,mmxrm [rm: o64nw 0f 0f /r 94] PENT,3DNOW,SQ
-PFMUL mmxreg,mmxrm [rm: o64nw 0f 0f /r b4] PENT,3DNOW,SQ
-PFRCP mmxreg,mmxrm [rm: o64nw 0f 0f /r 96] PENT,3DNOW,SQ
-PFRCPIT1 mmxreg,mmxrm [rm: o64nw 0f 0f /r a6] PENT,3DNOW,SQ
-PFRCPIT2 mmxreg,mmxrm [rm: o64nw 0f 0f /r b6] PENT,3DNOW,SQ
-PFRSQIT1 mmxreg,mmxrm [rm: o64nw 0f 0f /r a7] PENT,3DNOW,SQ
-PFRSQRT mmxreg,mmxrm [rm: o64nw 0f 0f /r 97] PENT,3DNOW,SQ
-PFSUB mmxreg,mmxrm [rm: o64nw 0f 0f /r 9a] PENT,3DNOW,SQ
-PFSUBR mmxreg,mmxrm [rm: o64nw 0f 0f /r aa] PENT,3DNOW,SQ
-PI2FD mmxreg,mmxrm [rm: o64nw 0f 0f /r 0d] PENT,3DNOW,SQ
-PMACHRIW mmxreg,mem [rm: 0f 5e /r] PENT,MMX,SM,CYRIX
-PMADDWD mmxreg,mmxrm [rm: np o64nw 0f f5 /r] PENT,MMX,SQ
-PMAGW mmxreg,mmxrm [rm: o64nw 0f 52 /r] PENT,MMX,SQ,CYRIX
-PMULHRIW mmxreg,mmxrm [rm: o64nw 0f 5d /r] PENT,MMX,SQ,CYRIX
-PMULHRWA mmxreg,mmxrm [rm: o64nw 0f 0f /r b7] PENT,3DNOW,SQ
-PMULHRWC mmxreg,mmxrm [rm: o64nw 0f 59 /r] PENT,MMX,SQ,CYRIX
-PMULHW mmxreg,mmxrm [rm: np o64nw 0f e5 /r] PENT,MMX,SQ
-PMULLW mmxreg,mmxrm [rm: np o64nw 0f d5 /r] PENT,MMX,SQ
-PMVGEZB mmxreg,mem [rm: 0f 5c /r] PENT,MMX,SQ,CYRIX
-PMVLZB mmxreg,mem [rm: 0f 5b /r] PENT,MMX,SQ,CYRIX
-PMVNZB mmxreg,mem [rm: 0f 5a /r] PENT,MMX,SQ,CYRIX
-PMVZB mmxreg,mem [rm: 0f 58 /r] PENT,MMX,SQ,CYRIX
-POP reg16 [r: o16 58+r] 8086
-POP reg32 [r: o32 58+r] 386,NOLONG
-POP reg64 [r: o64nw 58+r] X64
-POP rm16 [m: o16 8f /0] 8086
-POP rm32 [m: o32 8f /0] 386,NOLONG
-POP rm64 [m: o64nw 8f /0] X64
-POP reg_es [-: 07] 8086,NOLONG
-POP reg_cs [-: 0f] 8086,UNDOC,ND,OBSOLETE
-POP reg_ss [-: 17] 8086,NOLONG
-POP reg_ds [-: 1f] 8086,NOLONG
-POP reg_fs [-: 0f a1] 386
-POP reg_gs [-: 0f a9] 386
-POPA void [ odf 61] 186,NOLONG
-POPAD void [ o32 61] 386,NOLONG
-POPAW void [ o16 61] 186,NOLONG
-POPF void [ odf 9d] 8086
-POPFD void [ o32 9d] 386,NOLONG
-POPFQ void [ o32 9d] X64
-POPFW void [ o16 9d] 8086
-POR mmxreg,mmxrm [rm: np o64nw 0f eb /r] PENT,MMX,SQ
-PREFETCH mem [m: 0f 0d /0] PENT,3DNOW,SQ
-PREFETCHW mem [m: 0f 0d /1] PENT,3DNOW,SQ
-PSLLD mmxreg,mmxrm [rm: np o64nw 0f f2 /r] PENT,MMX,SQ
-PSLLD mmxreg,imm [mi: np 0f 72 /6 ib,u] PENT,MMX
-PSLLQ mmxreg,mmxrm [rm: np o64nw 0f f3 /r] PENT,MMX,SQ
-PSLLQ mmxreg,imm [mi: np 0f 73 /6 ib,u] PENT,MMX
-PSLLW mmxreg,mmxrm [rm: np o64nw 0f f1 /r] PENT,MMX,SQ
-PSLLW mmxreg,imm [mi: np 0f 71 /6 ib,u] PENT,MMX
-PSRAD mmxreg,mmxrm [rm: np o64nw 0f e2 /r] PENT,MMX,SQ
-PSRAD mmxreg,imm [mi: np 0f 72 /4 ib,u] PENT,MMX
-PSRAW mmxreg,mmxrm [rm: np o64nw 0f e1 /r] PENT,MMX,SQ
-PSRAW mmxreg,imm [mi: np 0f 71 /4 ib,u] PENT,MMX
-PSRLD mmxreg,mmxrm [rm: np o64nw 0f d2 /r] PENT,MMX,SQ
-PSRLD mmxreg,imm [mi: np 0f 72 /2 ib,u] PENT,MMX
-PSRLQ mmxreg,mmxrm [rm: np o64nw 0f d3 /r] PENT,MMX,SQ
-PSRLQ mmxreg,imm [mi: np 0f 73 /2 ib,u] PENT,MMX
-PSRLW mmxreg,mmxrm [rm: np o64nw 0f d1 /r] PENT,MMX,SQ
-PSRLW mmxreg,imm [mi: np 0f 71 /2 ib,u] PENT,MMX
-PSUBB mmxreg,mmxrm [rm: np o64nw 0f f8 /r] PENT,MMX,SQ
-PSUBD mmxreg,mmxrm [rm: np o64nw 0f fa /r] PENT,MMX,SQ
-PSUBSB mmxreg,mmxrm [rm: np o64nw 0f e8 /r] PENT,MMX,SQ
-PSUBSIW mmxreg,mmxrm [rm: o64nw 0f 55 /r] PENT,MMX,SQ,CYRIX
-PSUBSW mmxreg,mmxrm [rm: np o64nw 0f e9 /r] PENT,MMX,SQ
-PSUBUSB mmxreg,mmxrm [rm: np o64nw 0f d8 /r] PENT,MMX,SQ
-PSUBUSW mmxreg,mmxrm [rm: np o64nw 0f d9 /r] PENT,MMX,SQ
-PSUBW mmxreg,mmxrm [rm: np o64nw 0f f9 /r] PENT,MMX,SQ
-PUNPCKHBW mmxreg,mmxrm [rm: np o64nw 0f 68 /r] PENT,MMX,SQ
-PUNPCKHDQ mmxreg,mmxrm [rm: np o64nw 0f 6a /r] PENT,MMX,SQ
-PUNPCKHWD mmxreg,mmxrm [rm: np o64nw 0f 69 /r] PENT,MMX,SQ
-PUNPCKLBW mmxreg,mmxrm [rm: np o64nw 0f 60 /r] PENT,MMX,SQ
-PUNPCKLDQ mmxreg,mmxrm [rm: np o64nw 0f 62 /r] PENT,MMX,SQ
-PUNPCKLWD mmxreg,mmxrm [rm: np o64nw 0f 61 /r] PENT,MMX,SQ
-PUSH reg16 [r: o16 50+r] 8086
-PUSH reg32 [r: o32 50+r] 386,NOLONG
-PUSH reg64 [r: o64nw 50+r] X64
-PUSH rm16 [m: o16 ff /6] 8086
-PUSH rm32 [m: o32 ff /6] 386,NOLONG
-PUSH rm64 [m: o64nw ff /6] X64
-PUSH reg_es [-: 06] 8086,NOLONG
-PUSH reg_cs [-: 0e] 8086,NOLONG
-PUSH reg_ss [-: 16] 8086,NOLONG
-PUSH reg_ds [-: 1e] 8086,NOLONG
-PUSH reg_fs [-: 0f a0] 386
-PUSH reg_gs [-: 0f a8] 386
-PUSH imm8 [i: 6a ib,s] 186
-PUSH sbyteword16 [i: o16 6a ib,s] 186,AR0,SIZE,ND
-PUSH imm16 [i: o16 68 iw] 186,AR0,SIZE
-PUSH sbytedword32 [i: o32 6a ib,s] 386,NOLONG,AR0,SIZE,ND
-PUSH imm32 [i: o32 68 id] 386,NOLONG,AR0,SIZE
-PUSH sbytedword32 [i: o32 6a ib,s] 386,NOLONG,SD,ND
-PUSH imm32 [i: o32 68 id] 386,NOLONG,SD
-PUSH sbytedword64 [i: o64nw 6a ib,s] X64,AR0,SIZE,ND
-PUSH imm64 [i: o64nw 68 id,s] X64,AR0,SIZE
-PUSH sbytedword32 [i: o64nw 6a ib,s] X64,AR0,SIZE,ND
-PUSH imm32 [i: o64nw 68 id,s] X64,AR0,SIZE
-PUSHA void [ odf 60] 186,NOLONG
-PUSHAD void [ o32 60] 386,NOLONG
-PUSHAW void [ o16 60] 186,NOLONG
-PUSHF void [ odf 9c] 8086
-PUSHFD void [ o32 9c] 386,NOLONG
-PUSHFQ void [ o32 9c] X64
-PUSHFW void [ o16 9c] 8086
-PXOR mmxreg,mmxrm [rm: np o64nw 0f ef /r] PENT,MMX,SQ
-RCL rm8,unity [m-: d0 /2] 8086
-RCL rm8,reg_cl [m-: d2 /2] 8086
-RCL rm8,imm8 [mi: c0 /2 ib,u] 186
-RCL rm16,unity [m-: o16 d1 /2] 8086
-RCL rm16,reg_cl [m-: o16 d3 /2] 8086
-RCL rm16,imm8 [mi: o16 c1 /2 ib,u] 186
-RCL rm32,unity [m-: o32 d1 /2] 386
-RCL rm32,reg_cl [m-: o32 d3 /2] 386
-RCL rm32,imm8 [mi: o32 c1 /2 ib,u] 386
-RCL rm64,unity [m-: o64 d1 /2] X64
-RCL rm64,reg_cl [m-: o64 d3 /2] X64
-RCL rm64,imm8 [mi: o64 c1 /2 ib,u] X64
-RCR rm8,unity [m-: d0 /3] 8086
-RCR rm8,reg_cl [m-: d2 /3] 8086
-RCR rm8,imm8 [mi: c0 /3 ib,u] 186
-RCR rm16,unity [m-: o16 d1 /3] 8086
-RCR rm16,reg_cl [m-: o16 d3 /3] 8086
-RCR rm16,imm8 [mi: o16 c1 /3 ib,u] 186
-RCR rm32,unity [m-: o32 d1 /3] 386
-RCR rm32,reg_cl [m-: o32 d3 /3] 386
-RCR rm32,imm8 [mi: o32 c1 /3 ib,u] 386
-RCR rm64,unity [m-: o64 d1 /3] X64
-RCR rm64,reg_cl [m-: o64 d3 /3] X64
-RCR rm64,imm8 [mi: o64 c1 /3 ib,u] X64
-RDSHR rm32 [m: o32 0f 36 /0] P6,CYRIX,SMM
-RDMSR void [ 0f 32] PENT,PRIV
-RDPMC void [ 0f 33] P6
-RDTSC void [ 0f 31] PENT
-RDTSCP void [ 0f 01 f9] X86_64
-RET imm [i: c2 iw] 8086,SW,BND
-RETF void [ cb] 8086
-RETF imm [i: ca iw] 8086,SW
-RETN void [ c3] 8086,BND
-RETN imm [i: c2 iw] 8086,SW,BND
-
-ROL rm8,unity [m-: d0 /0] 8086
-ROL rm8,reg_cl [m-: d2 /0] 8086
-ROL rm8,imm8 [mi: c0 /0 ib,u] 186
-ROL rm16,unity [m-: o16 d1 /0] 8086
-ROL rm16,reg_cl [m-: o16 d3 /0] 8086
-ROL rm16,imm8 [mi: o16 c1 /0 ib,u] 186
-ROL rm32,unity [m-: o32 d1 /0] 386
-ROL rm32,reg_cl [m-: o32 d3 /0] 386
-ROL rm32,imm8 [mi: o32 c1 /0 ib,u] 386
-ROL rm64,unity [m-: o64 d1 /0] X64
-ROL rm64,reg_cl [m-: o64 d3 /0] X64
-ROL rm64,imm8 [mi: o64 c1 /0 ib,u] X64
-ROR rm8,unity [m-: d0 /1] 8086
-ROR rm8,reg_cl [m-: d2 /1] 8086
-ROR rm8,imm8 [mi: c0 /1 ib,u] 186
-ROR rm16,unity [m-: o16 d1 /1] 8086
-ROR rm16,reg_cl [m-: o16 d3 /1] 8086
-ROR rm16,imm8 [mi: o16 c1 /1 ib,u] 186
-ROR rm32,unity [m-: o32 d1 /1] 386
-ROR rm32,reg_cl [m-: o32 d3 /1] 386
-ROR rm32,imm8 [mi: o32 c1 /1 ib,u] 386
-ROR rm64,unity [m-: o64 d1 /1] X64
-ROR rm64,reg_cl [m-: o64 d3 /1] X64
-ROR rm64,imm8 [mi: o64 c1 /1 ib,u] X64
-RDM void [ 0f 3a] P6,CYRIX,ND
-RSDC reg_sreg,mem80 [rm: 0f 79 /r] 486,CYRIX,SMM
-RSLDT mem80 [m: 0f 7b /0] 486,CYRIX,SMM
-RSM void [ 0f aa] PENT,SMM
-RSTS mem80 [m: 0f 7d /0] 486,CYRIX,SMM
-SAHF void [ 9e] 8086
-SAL rm8,unity [m-: d0 /4] 8086,ND
-SAL rm8,reg_cl [m-: d2 /4] 8086,ND
-SAL rm8,imm8 [mi: c0 /4 ib,u] 186,ND
-SAL rm16,unity [m-: o16 d1 /4] 8086,ND
-SAL rm16,reg_cl [m-: o16 d3 /4] 8086,ND
-SAL rm16,imm8 [mi: o16 c1 /4 ib,u] 186,ND
-SAL rm32,unity [m-: o32 d1 /4] 386,ND
-SAL rm32,reg_cl [m-: o32 d3 /4] 386,ND
-SAL rm32,imm8 [mi: o32 c1 /4 ib,u] 386,ND
-SAL rm64,unity [m-: o64 d1 /4] X64,ND
-SAL rm64,reg_cl [m-: o64 d3 /4] X64,ND
-SAL rm64,imm8 [mi: o64 c1 /4 ib,u] X64,ND
-SALC void [ d6] 8086,UNDOC
-SAR rm8,unity [m-: d0 /7] 8086
-SAR rm8,reg_cl [m-: d2 /7] 8086
-SAR rm8,imm8 [mi: c0 /7 ib,u] 186
-SAR rm16,unity [m-: o16 d1 /7] 8086
-SAR rm16,reg_cl [m-: o16 d3 /7] 8086
-SAR rm16,imm8 [mi: o16 c1 /7 ib,u] 186
-SAR rm32,unity [m-: o32 d1 /7] 386
-SAR rm32,reg_cl [m-: o32 d3 /7] 386
-SAR rm32,imm8 [mi: o32 c1 /7 ib,u] 386
-SAR rm64,unity [m-: o64 d1 /7] X64
-SAR rm64,reg_cl [m-: o64 d3 /7] X64
-SAR rm64,imm8 [mi: o64 c1 /7 ib,u] X64
-SBB mem,reg8 [mr: hle 18 /r] 8086,SM,LOCK
-SBB reg8,reg8 [mr: 18 /r] 8086
-SBB mem,reg16 [mr: hle o16 19 /r] 8086,SM,LOCK
-SBB reg16,reg16 [mr: o16 19 /r] 8086
-SBB mem,reg32 [mr: hle o32 19 /r] 386,SM,LOCK
-SBB reg32,reg32 [mr: o32 19 /r] 386
-SBB mem,reg64 [mr: hle o64 19 /r] X64,SM,LOCK
-SBB reg64,reg64 [mr: o64 19 /r] X64
-SBB reg8,mem [rm: 1a /r] 8086,SM
-SBB reg8,reg8 [rm: 1a /r] 8086
-SBB reg16,mem [rm: o16 1b /r] 8086,SM
-SBB reg16,reg16 [rm: o16 1b /r] 8086
-SBB reg32,mem [rm: o32 1b /r] 386,SM
-SBB reg32,reg32 [rm: o32 1b /r] 386
-SBB reg64,mem [rm: o64 1b /r] X64,SM
-SBB reg64,reg64 [rm: o64 1b /r] X64
-SBB rm16,imm8 [mi: hle o16 83 /3 ib,s] 8086,LOCK
-SBB rm32,imm8 [mi: hle o32 83 /3 ib,s] 386,LOCK
-SBB rm64,imm8 [mi: hle o64 83 /3 ib,s] X64,LOCK
-SBB reg_al,imm [-i: 1c ib] 8086,SM
-SBB reg_ax,sbyteword [mi: o16 83 /3 ib,s] 8086,SM,ND
-SBB reg_ax,imm [-i: o16 1d iw] 8086,SM
-SBB reg_eax,sbytedword [mi: o32 83 /3 ib,s] 386,SM,ND
-SBB reg_eax,imm [-i: o32 1d id] 386,SM
-SBB reg_rax,sbytedword [mi: o64 83 /3 ib,s] X64,SM,ND
-SBB reg_rax,imm [-i: o64 1d id,s] X64,SM
-SBB rm8,imm [mi: hle 80 /3 ib] 8086,SM,LOCK
-SBB rm16,sbyteword [mi: hle o16 83 /3 ib,s] 8086,SM,LOCK,ND
-SBB rm16,imm [mi: hle o16 81 /3 iw] 8086,SM,LOCK
-SBB rm32,sbytedword [mi: hle o32 83 /3 ib,s] 386,SM,LOCK,ND
-SBB rm32,imm [mi: hle o32 81 /3 id] 386,SM,LOCK
-SBB rm64,sbytedword [mi: hle o64 83 /3 ib,s] X64,SM,LOCK,ND
-SBB rm64,imm [mi: hle o64 81 /3 id,s] X64,SM,LOCK
-SBB mem,imm8 [mi: hle 80 /3 ib] 8086,SM,LOCK
-SBB mem,sbyteword16 [mi: hle o16 83 /3 ib,s] 8086,SM,LOCK,ND
-SBB mem,imm16 [mi: hle o16 81 /3 iw] 8086,SM,LOCK
-SBB mem,sbytedword32 [mi: hle o32 83 /3 ib,s] 386,SM,LOCK,ND
-SBB mem,imm32 [mi: hle o32 81 /3 id] 386,SM,LOCK
-SBB rm8,imm [mi: hle 82 /3 ib] 8086,SM,LOCK,ND,NOLONG
-SCASB void [ repe ae] 8086
-SCASD void [ repe o32 af] 386
-SCASQ void [ repe o64 af] X64
-SCASW void [ repe o16 af] 8086
-SFENCE void [ np 0f ae f8] X64,AMD
-SGDT mem [m: 0f 01 /0] 286
-SHL rm8,unity [m-: d0 /4] 8086
-SHL rm8,reg_cl [m-: d2 /4] 8086
-SHL rm8,imm8 [mi: c0 /4 ib,u] 186
-SHL rm16,unity [m-: o16 d1 /4] 8086
-SHL rm16,reg_cl [m-: o16 d3 /4] 8086
-SHL rm16,imm8 [mi: o16 c1 /4 ib,u] 186
-SHL rm32,unity [m-: o32 d1 /4] 386
-SHL rm32,reg_cl [m-: o32 d3 /4] 386
-SHL rm32,imm8 [mi: o32 c1 /4 ib,u] 386
-SHL rm64,unity [m-: o64 d1 /4] X64
-SHL rm64,reg_cl [m-: o64 d3 /4] X64
-SHL rm64,imm8 [mi: o64 c1 /4 ib,u] X64
-SHLD mem,reg16,imm [mri: o16 0f a4 /r ib,u] 386,SM2,SB,AR2
-SHLD reg16,reg16,imm [mri: o16 0f a4 /r ib,u] 386,SM2,SB,AR2
-SHLD mem,reg32,imm [mri: o32 0f a4 /r ib,u] 386,SM2,SB,AR2
-SHLD reg32,reg32,imm [mri: o32 0f a4 /r ib,u] 386,SM2,SB,AR2
-SHLD mem,reg64,imm [mri: o64 0f a4 /r ib,u] X64,SM2,SB,AR2
-SHLD reg64,reg64,imm [mri: o64 0f a4 /r ib,u] X64,SM2,SB,AR2
-SHLD mem,reg16,reg_cl [mr-: o16 0f a5 /r] 386,SM
-SHLD reg16,reg16,reg_cl [mr-: o16 0f a5 /r] 386
-SHLD mem,reg32,reg_cl [mr-: o32 0f a5 /r] 386,SM
-SHLD reg32,reg32,reg_cl [mr-: o32 0f a5 /r] 386
-SHLD mem,reg64,reg_cl [mr-: o64 0f a5 /r] X64,SM
-SHLD reg64,reg64,reg_cl [mr-: o64 0f a5 /r] X64
-SHR rm8,unity [m-: d0 /5] 8086
-SHR rm8,reg_cl [m-: d2 /5] 8086
-SHR rm8,imm8 [mi: c0 /5 ib,u] 186
-SHR rm16,unity [m-: o16 d1 /5] 8086
-SHR rm16,reg_cl [m-: o16 d3 /5] 8086
-SHR rm16,imm8 [mi: o16 c1 /5 ib,u] 186
-SHR rm32,unity [m-: o32 d1 /5] 386
-SHR rm32,reg_cl [m-: o32 d3 /5] 386
-SHR rm32,imm8 [mi: o32 c1 /5 ib,u] 386
-SHR rm64,unity [m-: o64 d1 /5] X64
-SHR rm64,reg_cl [m-: o64 d3 /5] X64
-SHR rm64,imm8 [mi: o64 c1 /5 ib,u] X64
-SHRD mem,reg16,imm [mri: o16 0f ac /r ib,u] 386,SM2,SB,AR2
-SHRD reg16,reg16,imm [mri: o16 0f ac /r ib,u] 386,SM2,SB,AR2
-SHRD mem,reg32,imm [mri: o32 0f ac /r ib,u] 386,SM2,SB,AR2
-SHRD reg32,reg32,imm [mri: o32 0f ac /r ib,u] 386,SM2,SB,AR2
-SHRD mem,reg64,imm [mri: o64 0f ac /r ib,u] X64,SM2,SB,AR2
-SHRD reg64,reg64,imm [mri: o64 0f ac /r ib,u] X64,SM2,SB,AR2
-SHRD mem,reg16,reg_cl [mr-: o16 0f ad /r] 386,SM
-SHRD reg16,reg16,reg_cl [mr-: o16 0f ad /r] 386
-SHRD mem,reg32,reg_cl [mr-: o32 0f ad /r] 386,SM
-SHRD reg32,reg32,reg_cl [mr-: o32 0f ad /r] 386
-SHRD mem,reg64,reg_cl [mr-: o64 0f ad /r] X64,SM
-SHRD reg64,reg64,reg_cl [mr-: o64 0f ad /r] X64
-SIDT mem [m: 0f 01 /1] 286
-SLDT mem [m: 0f 00 /0] 286
-SLDT mem16 [m: 0f 00 /0] 286
-SLDT reg16 [m: o16 0f 00 /0] 286
-SLDT reg32 [m: o32 0f 00 /0] 386
-SLDT reg64 [m: o64nw 0f 00 /0] X64,ND
-SLDT reg64 [m: o64 0f 00 /0] X64
-SKINIT void [ 0f 01 de] X64
-SMI void [ f1] 386,UNDOC
-SMINT void [ 0f 38] P6,CYRIX,ND
-; Older Cyrix chips had this; they had to move due to conflict with MMX
-SMINTOLD void [ 0f 7e] 486,CYRIX,ND,OBSOLETE
-SMSW mem [m: 0f 01 /4] 286
-SMSW mem16 [m: 0f 01 /4] 286
-SMSW reg16 [m: o16 0f 01 /4] 286
-SMSW reg32 [m: o32 0f 01 /4] 386
-SMSW reg64 [m: o64 0f 01 /4] X64
-STC void [ f9] 8086
-STD void [ fd] 8086
-STI void [ fb] 8086
-STOSB void [ aa] 8086
-STOSD void [ o32 ab] 386
-STOSQ void [ o64 ab] X64
-STOSW void [ o16 ab] 8086
-STR mem [m: 0f 00 /1] 286,PROT
-STR mem16 [m: 0f 00 /1] 286,PROT
-STR reg16 [m: o16 0f 00 /1] 286,PROT
-STR reg32 [m: o32 0f 00 /1] 386,PROT
-STR reg64 [m: o64 0f 00 /1] X64
-SUB mem,reg8 [mr: hle 28 /r] 8086,SM,LOCK
-SUB reg8,reg8 [mr: 28 /r] 8086
-SUB mem,reg16 [mr: hle o16 29 /r] 8086,SM,LOCK
-SUB reg16,reg16 [mr: o16 29 /r] 8086
-SUB mem,reg32 [mr: hle o32 29 /r] 386,SM,LOCK
-SUB reg32,reg32 [mr: o32 29 /r] 386
-SUB mem,reg64 [mr: hle o64 29 /r] X64,SM,LOCK
-SUB reg64,reg64 [mr: o64 29 /r] X64
-SUB reg8,mem [rm: 2a /r] 8086,SM
-SUB reg8,reg8 [rm: 2a /r] 8086
-SUB reg16,mem [rm: o16 2b /r] 8086,SM
-SUB reg16,reg16 [rm: o16 2b /r] 8086
-SUB reg32,mem [rm: o32 2b /r] 386,SM
-SUB reg32,reg32 [rm: o32 2b /r] 386
-SUB reg64,mem [rm: o64 2b /r] X64,SM
-SUB reg64,reg64 [rm: o64 2b /r] X64
-SUB rm16,imm8 [mi: hle o16 83 /5 ib,s] 8086,LOCK
-SUB rm32,imm8 [mi: hle o32 83 /5 ib,s] 386,LOCK
-SUB rm64,imm8 [mi: hle o64 83 /5 ib,s] X64,LOCK
-SUB reg_al,imm [-i: 2c ib] 8086,SM
-SUB reg_ax,sbyteword [mi: o16 83 /5 ib,s] 8086,SM,ND
-SUB reg_ax,imm [-i: o16 2d iw] 8086,SM
-SUB reg_eax,sbytedword [mi: o32 83 /5 ib,s] 386,SM,ND
-SUB reg_eax,imm [-i: o32 2d id] 386,SM
-SUB reg_rax,sbytedword [mi: o64 83 /5 ib,s] X64,SM,ND
-SUB reg_rax,imm [-i: o64 2d id,s] X64,SM
-SUB rm8,imm [mi: hle 80 /5 ib] 8086,SM,LOCK
-SUB rm16,sbyteword [mi: hle o16 83 /5 ib,s] 8086,SM,LOCK,ND
-SUB rm16,imm [mi: hle o16 81 /5 iw] 8086,SM,LOCK
-SUB rm32,sbytedword [mi: hle o32 83 /5 ib,s] 386,SM,LOCK,ND
-SUB rm32,imm [mi: hle o32 81 /5 id] 386,SM,LOCK
-SUB rm64,sbytedword [mi: hle o64 83 /5 ib,s] X64,SM,LOCK,ND
-SUB rm64,imm [mi: hle o64 81 /5 id,s] X64,SM,LOCK
-SUB mem,imm8 [mi: hle 80 /5 ib] 8086,SM,LOCK
-SUB mem,sbyteword16 [mi: hle o16 83 /5 ib,s] 8086,SM,LOCK,ND
-SUB mem,imm16 [mi: hle o16 81 /5 iw] 8086,SM,LOCK
-SUB mem,sbytedword32 [mi: hle o32 83 /5 ib,s] 386,SM,LOCK,ND
-SUB mem,imm32 [mi: hle o32 81 /5 id] 386,SM,LOCK
-SUB rm8,imm [mi: hle 82 /5 ib] 8086,SM,LOCK,ND,NOLONG
-SVDC mem80,reg_sreg [mr: 0f 78 /r] 486,CYRIX,SMM
-SVLDT mem80 [m: 0f 7a /0] 486,CYRIX,SMM,ND
-SVTS mem80 [m: 0f 7c /0] 486,CYRIX,SMM
-SWAPGS void [ 0f 01 f8] X64
-SYSCALL void [ 0f 05] P6,AMD
-SYSENTER void [ 0f 34] P6
-SYSEXIT void [ 0f 35] P6,PRIV
-SYSRET void [ 0f 07] P6,PRIV,AMD
-TEST mem,reg8 [mr: 84 /r] 8086,SM
-TEST reg8,reg8 [mr: 84 /r] 8086
-TEST mem,reg16 [mr: o16 85 /r] 8086,SM
-TEST reg16,reg16 [mr: o16 85 /r] 8086
-TEST mem,reg32 [mr: o32 85 /r] 386,SM
-TEST reg32,reg32 [mr: o32 85 /r] 386
-TEST mem,reg64 [mr: o64 85 /r] X64,SM
-TEST reg64,reg64 [mr: o64 85 /r] X64
-TEST reg8,mem [rm: 84 /r] 8086,SM
-TEST reg16,mem [rm: o16 85 /r] 8086,SM
-TEST reg32,mem [rm: o32 85 /r] 386,SM
-TEST reg64,mem [rm: o64 85 /r] X64,SM
-TEST reg_al,imm [-i: a8 ib] 8086,SM
-TEST reg_ax,imm [-i: o16 a9 iw] 8086,SM
-TEST reg_eax,imm [-i: o32 a9 id] 386,SM
-TEST reg_rax,imm [-i: o64 a9 id,s] X64,SM
-TEST rm8,imm [mi: f6 /0 ib] 8086,SM
-TEST rm16,imm [mi: o16 f7 /0 iw] 8086,SM
-TEST rm32,imm [mi: o32 f7 /0 id] 386,SM
-TEST rm64,imm [mi: o64 f7 /0 id,s] X64,SM
-TEST mem,imm8 [mi: f6 /0 ib] 8086,SM
-TEST mem,imm16 [mi: o16 f7 /0 iw] 8086,SM
-TEST mem,imm32 [mi: o32 f7 /0 id] 386,SM
-UD0 void [ 0f ff] 186
-UD1 reg,rm16 [rm: o16 0f b9 /r] 186
-UD1 reg,rm32 [rm: o32 0f b9 /r] 186
-UD1 reg,rm64 [rm: o64 0f b9 /r] 186
-UD1 void [ 0f b9] 186,ND
-UD2B void [ 0f b9] 186,ND
-UD2B reg,rm16 [rm: o16 0f b9 /r] 186,ND
-UD2B reg,rm32 [rm: o32 0f b9 /r] 186,ND
-UD2B reg,rm64 [rm: o64 0f b9 /r] 186,ND
-UD2 void [ 0f 0b] 186
-UD2A void [ 0f 0b] 186,ND
-UMOV mem,reg8 [mr: np 0f 10 /r] 386,UNDOC,SM,ND
-UMOV reg8,reg8 [mr: np 0f 10 /r] 386,UNDOC,ND
-UMOV mem,reg16 [mr: np o16 0f 11 /r] 386,UNDOC,SM,ND
-UMOV reg16,reg16 [mr: np o16 0f 11 /r] 386,UNDOC,ND
-UMOV mem,reg32 [mr: np o32 0f 11 /r] 386,UNDOC,SM,ND
-UMOV reg32,reg32 [mr: np o32 0f 11 /r] 386,UNDOC,ND
-UMOV reg8,mem [rm: np 0f 12 /r] 386,UNDOC,SM,ND
-UMOV reg8,reg8 [rm: np 0f 12 /r] 386,UNDOC,ND
-UMOV reg16,mem [rm: np o16 0f 13 /r] 386,UNDOC,SM,ND
-UMOV reg16,reg16 [rm: np o16 0f 13 /r] 386,UNDOC,ND
-UMOV reg32,mem [rm: np o32 0f 13 /r] 386,UNDOC,SM,ND
-UMOV reg32,reg32 [rm: np o32 0f 13 /r] 386,UNDOC,ND
-VERR mem [m: 0f 00 /4] 286,PROT
-VERR mem16 [m: 0f 00 /4] 286,PROT
-VERR reg16 [m: 0f 00 /4] 286,PROT
-VERW mem [m: 0f 00 /5] 286,PROT
-VERW mem16 [m: 0f 00 /5] 286,PROT
-VERW reg16 [m: 0f 00 /5] 286,PROT
-FWAIT void [ wait] 8086
-WBINVD void [ 0f 09] 486,PRIV
-WRSHR rm32 [m: o32 0f 37 /0] P6,CYRIX,SMM
-WRMSR void [ 0f 30] PENT,PRIV
-XADD mem,reg8 [mr: hle 0f c0 /r] 486,SM,LOCK
-XADD reg8,reg8 [mr: 0f c0 /r] 486
-XADD mem,reg16 [mr: hle o16 0f c1 /r] 486,SM,LOCK
-XADD reg16,reg16 [mr: o16 0f c1 /r] 486
-XADD mem,reg32 [mr: hle o32 0f c1 /r] 486,SM,LOCK
-XADD reg32,reg32 [mr: o32 0f c1 /r] 486
-XADD mem,reg64 [mr: hle o64 0f c1 /r] X64,SM,LOCK
-XADD reg64,reg64 [mr: o64 0f c1 /r] X64
-XBTS reg16,mem [rm: o16 0f a6 /r] 386,SW,UNDOC,ND
-XBTS reg16,reg16 [rm: o16 0f a6 /r] 386,UNDOC,ND
-XBTS reg32,mem [rm: o32 0f a6 /r] 386,SD,UNDOC,ND
-XBTS reg32,reg32 [rm: o32 0f a6 /r] 386,UNDOC,ND
-XCHG reg_ax,reg16 [-r: o16 90+r] 8086
-XCHG reg_eax,reg32na [-r: o32 90+r] 386
-XCHG reg_rax,reg64 [-r: o64 90+r] X64
-XCHG reg16,reg_ax [r-: o16 90+r] 8086
-XCHG reg32na,reg_eax [r-: o32 90+r] 386
-XCHG reg64,reg_rax [r-: o64 90+r] X64
-; This must be NOLONG since opcode 90 is NOP, and in 64-bit mode
-; "xchg eax,eax" is *not* a NOP.
-XCHG reg_eax,reg_eax [--: o32 90] 386,NOLONG
-XCHG reg8,mem [rm: hlenl 86 /r] 8086,SM,LOCK
-XCHG reg8,reg8 [rm: 86 /r] 8086
-XCHG reg16,mem [rm: hlenl o16 87 /r] 8086,SM,LOCK
-XCHG reg16,reg16 [rm: o16 87 /r] 8086
-XCHG reg32,mem [rm: hlenl o32 87 /r] 386,SM,LOCK
-XCHG reg32,reg32 [rm: o32 87 /r] 386
-XCHG reg64,mem [rm: hlenl o64 87 /r] X64,SM,LOCK
-XCHG reg64,reg64 [rm: o64 87 /r] X64
-XCHG mem,reg8 [mr: hlenl 86 /r] 8086,SM,LOCK
-XCHG reg8,reg8 [mr: 86 /r] 8086
-XCHG mem,reg16 [mr: hlenl o16 87 /r] 8086,SM,LOCK
-XCHG reg16,reg16 [mr: o16 87 /r] 8086
-XCHG mem,reg32 [mr: hlenl o32 87 /r] 386,SM,LOCK
-XCHG reg32,reg32 [mr: o32 87 /r] 386
-XCHG mem,reg64 [mr: hlenl o64 87 /r] X64,SM,LOCK
-XCHG reg64,reg64 [mr: o64 87 /r] X64
-XLATB void [ d7] 8086
-XLAT void [ d7] 8086
-XOR mem,reg8 [mr: hle 30 /r] 8086,SM,LOCK
-XOR reg8,reg8 [mr: 30 /r] 8086
-XOR mem,reg16 [mr: hle o16 31 /r] 8086,SM,LOCK
-XOR reg16,reg16 [mr: o16 31 /r] 8086
-XOR mem,reg32 [mr: hle o32 31 /r] 386,SM,LOCK
-XOR reg32,reg32 [mr: o32 31 /r] 386
-XOR mem,reg64 [mr: hle o64 31 /r] X64,SM,LOCK
-XOR reg64,reg64 [mr: o64 31 /r] X64
-XOR reg8,mem [rm: 32 /r] 8086,SM
-XOR reg8,reg8 [rm: 32 /r] 8086
-XOR reg16,mem [rm: o16 33 /r] 8086,SM
-XOR reg16,reg16 [rm: o16 33 /r] 8086
-XOR reg32,mem [rm: o32 33 /r] 386,SM
-XOR reg32,reg32 [rm: o32 33 /r] 386
-XOR reg64,mem [rm: o64 33 /r] X64,SM
-XOR reg64,reg64 [rm: o64 33 /r] X64
-XOR rm16,imm8 [mi: hle o16 83 /6 ib,s] 8086,LOCK
-XOR rm32,imm8 [mi: hle o32 83 /6 ib,s] 386,LOCK
-XOR rm64,imm8 [mi: hle o64 83 /6 ib,s] X64,LOCK
-XOR reg_al,imm [-i: 34 ib] 8086,SM
-XOR reg_ax,sbyteword [mi: o16 83 /6 ib,s] 8086,SM,ND
-XOR reg_ax,imm [-i: o16 35 iw] 8086,SM
-XOR reg_eax,sbytedword [mi: o32 83 /6 ib,s] 386,SM,ND
-XOR reg_eax,imm [-i: o32 35 id] 386,SM
-XOR reg_rax,sbytedword [mi: o64 83 /6 ib,s] X64,SM,ND
-XOR reg_rax,imm [-i: o64 35 id,s] X64,SM
-XOR rm8,imm [mi: hle 80 /6 ib] 8086,SM,LOCK
-XOR rm16,sbyteword [mi: hle o16 83 /6 ib,s] 8086,SM,LOCK,ND
-XOR rm16,imm [mi: hle o16 81 /6 iw] 8086,SM,LOCK
-XOR rm32,sbytedword [mi: hle o32 83 /6 ib,s] 386,SM,LOCK,ND
-XOR rm32,imm [mi: hle o32 81 /6 id] 386,SM,LOCK
-XOR rm64,sbytedword [mi: hle o64 83 /6 ib,s] X64,SM,LOCK,ND
-XOR rm64,imm [mi: hle o64 81 /6 id,s] X64,SM,LOCK
-XOR mem,imm8 [mi: hle 80 /6 ib] 8086,SM,LOCK
-XOR mem,sbyteword16 [mi: hle o16 83 /6 ib,s] 8086,SM,LOCK,ND
-XOR mem,imm16 [mi: hle o16 81 /6 iw] 8086,SM,LOCK
-XOR mem,sbytedword32 [mi: hle o32 83 /6 ib,s] 386,SM,LOCK,ND
-XOR mem,imm32 [mi: hle o32 81 /6 id] 386,SM,LOCK
-XOR rm8,imm [mi: hle 82 /6 ib] 8086,SM,LOCK,ND,NOLONG
-CMOVcc reg16,mem [rm: o16 0f 40+c /r] P6,SM
-CMOVcc reg16,reg16 [rm: o16 0f 40+c /r] P6
-CMOVcc reg32,mem [rm: o32 0f 40+c /r] P6,SM
-CMOVcc reg32,reg32 [rm: o32 0f 40+c /r] P6
-CMOVcc reg64,mem [rm: o64 0f 40+c /r] X64,SM
-CMOVcc reg64,reg64 [rm: o64 0f 40+c /r] X64
-Jcc imm|near [i: odf 0f 80+c rel] 386,BND
-Jcc imm16|near [i: o16 0f 80+c rel] 386,NOLONG,BND
-Jcc imm32|near [i: o32 0f 80+c rel] 386,NOLONG,BND
-Jcc imm64|near [i: o64nw 0f 80+c rel] X64,BND
-Jcc imm|short [i: 70+c rel8] 8086,ND,BND
-Jcc imm [i: jcc8 70+c rel8] 8086,ND,BND
-Jcc imm [i: 0f 80+c rel] 386,ND,BND
-Jcc imm [i: 71+c jlen e9 rel] 8086,ND,BND
-Jcc imm [i: 70+c rel8] 8086,BND
-
-SETcc mem [m: 0f 90+c /0] 386,SB
-SETcc reg8 [m: 0f 90+c /0] 386
-
-;# Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)
-ADDPS xmmreg,xmmrm128 [rm: np 0f 58 /r] KATMAI,SSE
-ADDSS xmmreg,xmmrm32 [rm: f3 0f 58 /r] KATMAI,SSE
-ANDNPS xmmreg,xmmrm128 [rm: np 0f 55 /r] KATMAI,SSE
-ANDPS xmmreg,xmmrm128 [rm: np 0f 54 /r] KATMAI,SSE
-CMPEQPS xmmreg,xmmrm128 [rm: np 0f c2 /r 00] KATMAI,SSE
-CMPEQSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 00] KATMAI,SSE
-CMPLEPS xmmreg,xmmrm128 [rm: np 0f c2 /r 02] KATMAI,SSE
-CMPLESS xmmreg,xmmrm32 [rm: f3 0f c2 /r 02] KATMAI,SSE
-CMPLTPS xmmreg,xmmrm128 [rm: np 0f c2 /r 01] KATMAI,SSE
-CMPLTSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 01] KATMAI,SSE
-CMPNEQPS xmmreg,xmmrm128 [rm: np 0f c2 /r 04] KATMAI,SSE
-CMPNEQSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 04] KATMAI,SSE
-CMPNLEPS xmmreg,xmmrm128 [rm: np 0f c2 /r 06] KATMAI,SSE
-CMPNLESS xmmreg,xmmrm32 [rm: f3 0f c2 /r 06] KATMAI,SSE
-CMPNLTPS xmmreg,xmmrm128 [rm: np 0f c2 /r 05] KATMAI,SSE
-CMPNLTSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 05] KATMAI,SSE
-CMPORDPS xmmreg,xmmrm128 [rm: np 0f c2 /r 07] KATMAI,SSE
-CMPORDSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 07] KATMAI,SSE
-CMPUNORDPS xmmreg,xmmrm128 [rm: np 0f c2 /r 03] KATMAI,SSE
-CMPUNORDSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 03] KATMAI,SSE
-; CMPPS/CMPSS must come after the specific ops; that way the disassembler will find the
-; specific ops first and only disassemble illegal ones as cmpps/cmpss.
-CMPPS xmmreg,mem,imm [rmi: np 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
-CMPPS xmmreg,xmmreg,imm [rmi: np 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
-CMPSS xmmreg,mem,imm [rmi: f3 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
-CMPSS xmmreg,xmmreg,imm [rmi: f3 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
-COMISS xmmreg,xmmrm32 [rm: np 0f 2f /r] KATMAI,SSE
-CVTPI2PS xmmreg,mmxrm64 [rm: np 0f 2a /r] KATMAI,SSE,MMX
-CVTPS2PI mmxreg,xmmrm64 [rm: np 0f 2d /r] KATMAI,SSE,MMX
-CVTSI2SS xmmreg,mem [rm: f3 0f 2a /r] KATMAI,SSE,SD,AR1,ND
-CVTSI2SS xmmreg,rm32 [rm: f3 0f 2a /r] KATMAI,SSE,SD,AR1
-CVTSI2SS xmmreg,rm64 [rm: o64 f3 0f 2a /r] X64,SSE,SQ,AR1
-CVTSS2SI reg32,xmmreg [rm: f3 0f 2d /r] KATMAI,SSE,SD,AR1
-CVTSS2SI reg32,mem [rm: f3 0f 2d /r] KATMAI,SSE,SD,AR1
-CVTSS2SI reg64,xmmreg [rm: o64 f3 0f 2d /r] X64,SSE,SD,AR1
-CVTSS2SI reg64,mem [rm: o64 f3 0f 2d /r] X64,SSE,SD,AR1
-CVTTPS2PI mmxreg,xmmrm [rm: np 0f 2c /r] KATMAI,SSE,MMX,SQ
-CVTTSS2SI reg32,xmmrm [rm: f3 0f 2c /r] KATMAI,SSE,SD,AR1
-CVTTSS2SI reg64,xmmrm [rm: o64 f3 0f 2c /r] X64,SSE,SD,AR1
-DIVPS xmmreg,xmmrm128 [rm: np 0f 5e /r] KATMAI,SSE
-DIVSS xmmreg,xmmrm32 [rm: f3 0f 5e /r] KATMAI,SSE
-LDMXCSR mem32 [m: np 0f ae /2] KATMAI,SSE
-MAXPS xmmreg,xmmrm128 [rm: np 0f 5f /r] KATMAI,SSE
-MAXSS xmmreg,xmmrm32 [rm: f3 0f 5f /r] KATMAI,SSE
-MINPS xmmreg,xmmrm128 [rm: np 0f 5d /r] KATMAI,SSE
-MINSS xmmreg,xmmrm32 [rm: f3 0f 5d /r] KATMAI,SSE
-MOVAPS xmmreg,xmmrm128 [rm: np 0f 28 /r] KATMAI,SSE
-MOVAPS xmmrm128,xmmreg [mr: np 0f 29 /r] KATMAI,SSE
-MOVHPS xmmreg,mem64 [rm: np 0f 16 /r] KATMAI,SSE
-MOVHPS mem64,xmmreg [mr: np 0f 17 /r] KATMAI,SSE
-MOVLHPS xmmreg,xmmreg [rm: np 0f 16 /r] KATMAI,SSE
-MOVLPS xmmreg,mem64 [rm: np 0f 12 /r] KATMAI,SSE
-MOVLPS mem64,xmmreg [mr: np 0f 13 /r] KATMAI,SSE
-MOVHLPS xmmreg,xmmreg [rm: np 0f 12 /r] KATMAI,SSE
-MOVMSKPS reg32,xmmreg [rm: np 0f 50 /r] KATMAI,SSE
-MOVMSKPS reg64,xmmreg [rm: np o64 0f 50 /r] X64,SSE
-MOVNTPS mem128,xmmreg [mr: np 0f 2b /r] KATMAI,SSE
-MOVSS xmmreg,xmmrm32 [rm: f3 0f 10 /r] KATMAI,SSE
-MOVSS mem32,xmmreg [mr: f3 0f 11 /r] KATMAI,SSE
-MOVSS xmmreg,xmmreg [rm: f3 0f 10 /r] KATMAI,SSE
-MOVUPS xmmreg,xmmrm128 [rm: np 0f 10 /r] KATMAI,SSE
-MOVUPS xmmrm128,xmmreg [mr: np 0f 11 /r] KATMAI,SSE
-MULPS xmmreg,xmmrm128 [rm: np 0f 59 /r] KATMAI,SSE
-MULSS xmmreg,xmmrm32 [rm: f3 0f 59 /r] KATMAI,SSE
-ORPS xmmreg,xmmrm128 [rm: np 0f 56 /r] KATMAI,SSE
-RCPPS xmmreg,xmmrm128 [rm: np 0f 53 /r] KATMAI,SSE
-RCPSS xmmreg,xmmrm32 [rm: f3 0f 53 /r] KATMAI,SSE
-RSQRTPS xmmreg,xmmrm128 [rm: np 0f 52 /r] KATMAI,SSE
-RSQRTSS xmmreg,xmmrm32 [rm: f3 0f 52 /r] KATMAI,SSE
-SHUFPS xmmreg,xmmrm128,imm8 [rmi: np 0f c6 /r ib,u] KATMAI,SSE
-SQRTPS xmmreg,xmmrm128 [rm: np 0f 51 /r] KATMAI,SSE
-SQRTSS xmmreg,xmmrm32 [rm: f3 0f 51 /r] KATMAI,SSE
-STMXCSR mem32 [m: np 0f ae /3] KATMAI,SSE
-SUBPS xmmreg,xmmrm128 [rm: np 0f 5c /r] KATMAI,SSE
-SUBSS xmmreg,xmmrm32 [rm: f3 0f 5c /r] KATMAI,SSE
-UCOMISS xmmreg,xmmrm32 [rm: np 0f 2e /r] KATMAI,SSE
-UNPCKHPS xmmreg,xmmrm128 [rm: np 0f 15 /r] KATMAI,SSE
-UNPCKLPS xmmreg,xmmrm128 [rm: np 0f 14 /r] KATMAI,SSE
-XORPS xmmreg,xmmrm128 [rm: np 0f 57 /r] KATMAI,SSE
-
-;# Introduced in Deschutes but necessary for SSE support
-FXRSTOR mem [m: np 0f ae /1] P6,SSE,FPU
-FXRSTOR64 mem [m: o64 np 0f ae /1] X64,SSE,FPU
-FXSAVE mem [m: np 0f ae /0] P6,SSE,FPU
-FXSAVE64 mem [m: o64 np 0f ae /0] X64,SSE,FPU
-
-;# XSAVE group (AVX and extended state)
-; Introduced in late Penryn ... we really need to clean up the handling
-; of CPU feature bits.
-XGETBV void [ 0f 01 d0] NEHALEM
-XSETBV void [ 0f 01 d1] NEHALEM,PRIV
-XSAVE mem [m: np 0f ae /4] NEHALEM
-XSAVE64 mem [m: o64 np 0f ae /4] LONG,NEHALEM
-XSAVEC mem [m: np 0f c7 /4] FUTURE
-XSAVEC64 mem [m: o64 np 0f c7 /4] LONG,FUTURE
-XSAVEOPT mem [m: np 0f ae /6] FUTURE
-XSAVEOPT64 mem [m: o64 np 0f ae /6] LONG,FUTURE
-XSAVES mem [m: np 0f c7 /5] FUTURE
-XSAVES64 mem [m: o64 np 0f c7 /5] LONG,FUTURE
-XRSTOR mem [m: np 0f ae /5] NEHALEM
-XRSTOR64 mem [m: o64 np 0f ae /5] LONG,NEHALEM
-XRSTORS mem [m: np 0f c7 /3] FUTURE
-XRSTORS64 mem [m: o64 np 0f c7 /3] LONG,FUTURE
-
-; These instructions are not SSE-specific; they are
-;# Generic memory operations
-; and work even if CR4.OSFXFR == 0
-PREFETCHNTA mem8 [m: 0f 18 /0] KATMAI
-PREFETCHT0 mem8 [m: 0f 18 /1] KATMAI
-PREFETCHT1 mem8 [m: 0f 18 /2] KATMAI
-PREFETCHT2 mem8 [m: 0f 18 /3] KATMAI
-SFENCE void [ np 0f ae f8] KATMAI
-
-;# New MMX instructions introduced in Katmai
-MASKMOVQ mmxreg,mmxreg [rm: np 0f f7 /r] KATMAI,MMX
-MOVNTQ mem,mmxreg [mr: np 0f e7 /r] KATMAI,MMX,SQ
-PAVGB mmxreg,mmxrm [rm: np o64nw 0f e0 /r] KATMAI,MMX,SQ
-PAVGW mmxreg,mmxrm [rm: np o64nw 0f e3 /r] KATMAI,MMX,SQ
-PEXTRW reg32,mmxreg,imm [rmi: np 0f c5 /r ib,u] KATMAI,MMX,SB,AR2
-; PINSRW is documented as using a reg32, but it's really using only 16 bit
-; -- accept either, but be truthful in disassembly
-PINSRW mmxreg,mem,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
-PINSRW mmxreg,rm16,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
-PINSRW mmxreg,reg32,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
-PMAXSW mmxreg,mmxrm [rm: np o64nw 0f ee /r] KATMAI,MMX,SQ
-PMAXUB mmxreg,mmxrm [rm: np o64nw 0f de /r] KATMAI,MMX,SQ
-PMINSW mmxreg,mmxrm [rm: np o64nw 0f ea /r] KATMAI,MMX,SQ
-PMINUB mmxreg,mmxrm [rm: np o64nw 0f da /r] KATMAI,MMX,SQ
-PMOVMSKB reg32,mmxreg [rm: np 0f d7 /r] KATMAI,MMX
-PMULHUW mmxreg,mmxrm [rm: np o64nw 0f e4 /r] KATMAI,MMX,SQ
-PSADBW mmxreg,mmxrm [rm: np o64nw 0f f6 /r] KATMAI,MMX,SQ
-PSHUFW mmxreg,mmxrm,imm [rmi: np o64nw 0f 70 /r ib] KATMAI,MMX,SM2,SB,AR2
-
-;# AMD Enhanced 3DNow! (Athlon) instructions
-PF2IW mmxreg,mmxrm [rm: o64nw 0f 0f /r 1c] PENT,3DNOW,SQ
-PFNACC mmxreg,mmxrm [rm: o64nw 0f 0f /r 8a] PENT,3DNOW,SQ
-PFPNACC mmxreg,mmxrm [rm: o64nw 0f 0f /r 8e] PENT,3DNOW,SQ
-PI2FW mmxreg,mmxrm [rm: o64nw 0f 0f /r 0c] PENT,3DNOW,SQ
-PSWAPD mmxreg,mmxrm [rm: o64nw 0f 0f /r bb] PENT,3DNOW,SQ
-
-;# Willamette SSE2 Cacheability Instructions
-MASKMOVDQU xmmreg,xmmreg [rm: 66 0f f7 /r] WILLAMETTE,SSE2
-; CLFLUSH needs its own feature flag implemented one day
-CLFLUSH mem [m: np 0f ae /7] WILLAMETTE,SSE2
-MOVNTDQ mem,xmmreg [mr: 66 0f e7 /r] WILLAMETTE,SSE2,SO
-MOVNTI mem,reg32 [mr: np 0f c3 /r] WILLAMETTE,SD
-MOVNTI mem,reg64 [mr: o64 np 0f c3 /r] X64,SQ
-MOVNTPD mem,xmmreg [mr: 66 0f 2b /r] WILLAMETTE,SSE2,SO
-LFENCE void [ np 0f ae e8] WILLAMETTE,SSE2
-MFENCE void [ np 0f ae f0] WILLAMETTE,SSE2
-
-;# Willamette MMX instructions (SSE2 SIMD Integer Instructions)
-MOVD mem,xmmreg [mr: 66 norexw 0f 7e /r] WILLAMETTE,SSE2,SD
-MOVD xmmreg,mem [rm: 66 norexw 0f 6e /r] WILLAMETTE,SSE2,SD
-MOVD xmmreg,rm32 [rm: 66 norexw 0f 6e /r] WILLAMETTE,SSE2
-MOVD rm32,xmmreg [mr: 66 norexw 0f 7e /r] WILLAMETTE,SSE2
-MOVDQA xmmreg,xmmreg [rm: 66 0f 6f /r] WILLAMETTE,SSE2
-MOVDQA mem,xmmreg [mr: 66 0f 7f /r] WILLAMETTE,SSE2,SO
-MOVDQA xmmreg,mem [rm: 66 0f 6f /r] WILLAMETTE,SSE2,SO
-MOVDQA xmmreg,xmmreg [mr: 66 0f 7f /r] WILLAMETTE,SSE2
-MOVDQU xmmreg,xmmreg [rm: f3 0f 6f /r] WILLAMETTE,SSE2
-MOVDQU mem,xmmreg [mr: f3 0f 7f /r] WILLAMETTE,SSE2,SO
-MOVDQU xmmreg,mem [rm: f3 0f 6f /r] WILLAMETTE,SSE2,SO
-MOVDQU xmmreg,xmmreg [mr: f3 0f 7f /r] WILLAMETTE,SSE2
-MOVDQ2Q mmxreg,xmmreg [rm: f2 0f d6 /r] WILLAMETTE,SSE2
-MOVQ xmmreg,xmmreg [rm: f3 0f 7e /r] WILLAMETTE,SSE2
-MOVQ xmmreg,xmmreg [mr: 66 0f d6 /r] WILLAMETTE,SSE2
-MOVQ mem,xmmreg [mr: 66 0f d6 /r] WILLAMETTE,SSE2,SQ
-MOVQ xmmreg,mem [rm: f3 0f 7e /r] WILLAMETTE,SSE2,SQ
-MOVQ xmmreg,rm64 [rm: 66 o64 0f 6e /r] X64,SSE2
-MOVQ rm64,xmmreg [mr: 66 o64 0f 7e /r] X64,SSE2
-MOVQ2DQ xmmreg,mmxreg [rm: f3 0f d6 /r] WILLAMETTE,SSE2
-PACKSSWB xmmreg,xmmrm [rm: 66 0f 63 /r] WILLAMETTE,SSE2,SO
-PACKSSDW xmmreg,xmmrm [rm: 66 0f 6b /r] WILLAMETTE,SSE2,SO
-PACKUSWB xmmreg,xmmrm [rm: 66 0f 67 /r] WILLAMETTE,SSE2,SO
-PADDB xmmreg,xmmrm [rm: 66 0f fc /r] WILLAMETTE,SSE2,SO
-PADDW xmmreg,xmmrm [rm: 66 0f fd /r] WILLAMETTE,SSE2,SO
-PADDD xmmreg,xmmrm [rm: 66 0f fe /r] WILLAMETTE,SSE2,SO
-PADDQ mmxreg,mmxrm [rm: np 0f d4 /r] WILLAMETTE,MMX,SQ
-PADDQ xmmreg,xmmrm [rm: 66 0f d4 /r] WILLAMETTE,SSE2,SO
-PADDSB xmmreg,xmmrm [rm: 66 0f ec /r] WILLAMETTE,SSE2,SO
-PADDSW xmmreg,xmmrm [rm: 66 0f ed /r] WILLAMETTE,SSE2,SO
-PADDUSB xmmreg,xmmrm [rm: 66 0f dc /r] WILLAMETTE,SSE2,SO
-PADDUSW xmmreg,xmmrm [rm: 66 0f dd /r] WILLAMETTE,SSE2,SO
-PAND xmmreg,xmmrm [rm: 66 0f db /r] WILLAMETTE,SSE2,SO
-PANDN xmmreg,xmmrm [rm: 66 0f df /r] WILLAMETTE,SSE2,SO
-PAVGB xmmreg,xmmrm [rm: 66 0f e0 /r] WILLAMETTE,SSE2,SO
-PAVGW xmmreg,xmmrm [rm: 66 0f e3 /r] WILLAMETTE,SSE2,SO
-PCMPEQB xmmreg,xmmrm [rm: 66 0f 74 /r] WILLAMETTE,SSE2,SO
-PCMPEQW xmmreg,xmmrm [rm: 66 0f 75 /r] WILLAMETTE,SSE2,SO
-PCMPEQD xmmreg,xmmrm [rm: 66 0f 76 /r] WILLAMETTE,SSE2,SO
-PCMPGTB xmmreg,xmmrm [rm: 66 0f 64 /r] WILLAMETTE,SSE2,SO
-PCMPGTW xmmreg,xmmrm [rm: 66 0f 65 /r] WILLAMETTE,SSE2,SO
-PCMPGTD xmmreg,xmmrm [rm: 66 0f 66 /r] WILLAMETTE,SSE2,SO
-PEXTRW reg32,xmmreg,imm [rmi: 66 0f c5 /r ib,u] WILLAMETTE,SSE2,SB,AR2
-PINSRW xmmreg,reg16,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
-PINSRW xmmreg,reg32,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2,ND
-PINSRW xmmreg,mem,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
-PINSRW xmmreg,mem16,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
-PMADDWD xmmreg,xmmrm [rm: 66 0f f5 /r] WILLAMETTE,SSE2,SO
-PMAXSW xmmreg,xmmrm [rm: 66 0f ee /r] WILLAMETTE,SSE2,SO
-PMAXUB xmmreg,xmmrm [rm: 66 0f de /r] WILLAMETTE,SSE2,SO
-PMINSW xmmreg,xmmrm [rm: 66 0f ea /r] WILLAMETTE,SSE2,SO
-PMINUB xmmreg,xmmrm [rm: 66 0f da /r] WILLAMETTE,SSE2,SO
-PMOVMSKB reg32,xmmreg [rm: 66 0f d7 /r] WILLAMETTE,SSE2
-PMULHUW xmmreg,xmmrm [rm: 66 0f e4 /r] WILLAMETTE,SSE2,SO
-PMULHW xmmreg,xmmrm [rm: 66 0f e5 /r] WILLAMETTE,SSE2,SO
-PMULLW xmmreg,xmmrm [rm: 66 0f d5 /r] WILLAMETTE,SSE2,SO
-PMULUDQ mmxreg,mmxrm [rm: np o64nw 0f f4 /r] WILLAMETTE,SSE2,SO
-PMULUDQ xmmreg,xmmrm [rm: 66 0f f4 /r] WILLAMETTE,SSE2,SO
-POR xmmreg,xmmrm [rm: 66 0f eb /r] WILLAMETTE,SSE2,SO
-PSADBW xmmreg,xmmrm [rm: 66 0f f6 /r] WILLAMETTE,SSE2,SO
-PSHUFD xmmreg,xmmreg,imm [rmi: 66 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
-PSHUFD xmmreg,mem,imm [rmi: 66 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
-PSHUFHW xmmreg,xmmreg,imm [rmi: f3 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
-PSHUFHW xmmreg,mem,imm [rmi: f3 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
-PSHUFLW xmmreg,xmmreg,imm [rmi: f2 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
-PSHUFLW xmmreg,mem,imm [rmi: f2 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
-PSLLDQ xmmreg,imm [mi: 66 0f 73 /7 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSLLW xmmreg,xmmrm [rm: 66 0f f1 /r] WILLAMETTE,SSE2,SO
-PSLLW xmmreg,imm [mi: 66 0f 71 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSLLD xmmreg,xmmrm [rm: 66 0f f2 /r] WILLAMETTE,SSE2,SO
-PSLLD xmmreg,imm [mi: 66 0f 72 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSLLQ xmmreg,xmmrm [rm: 66 0f f3 /r] WILLAMETTE,SSE2,SO
-PSLLQ xmmreg,imm [mi: 66 0f 73 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRAW xmmreg,xmmrm [rm: 66 0f e1 /r] WILLAMETTE,SSE2,SO
-PSRAW xmmreg,imm [mi: 66 0f 71 /4 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRAD xmmreg,xmmrm [rm: 66 0f e2 /r] WILLAMETTE,SSE2,SO
-PSRAD xmmreg,imm [mi: 66 0f 72 /4 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRLDQ xmmreg,imm [mi: 66 0f 73 /3 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRLW xmmreg,xmmrm [rm: 66 0f d1 /r] WILLAMETTE,SSE2,SO
-PSRLW xmmreg,imm [mi: 66 0f 71 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRLD xmmreg,xmmrm [rm: 66 0f d2 /r] WILLAMETTE,SSE2,SO
-PSRLD xmmreg,imm [mi: 66 0f 72 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSRLQ xmmreg,xmmrm [rm: 66 0f d3 /r] WILLAMETTE,SSE2,SO
-PSRLQ xmmreg,imm [mi: 66 0f 73 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
-PSUBB xmmreg,xmmrm [rm: 66 0f f8 /r] WILLAMETTE,SSE2,SO
-PSUBW xmmreg,xmmrm [rm: 66 0f f9 /r] WILLAMETTE,SSE2,SO
-PSUBD xmmreg,xmmrm [rm: 66 0f fa /r] WILLAMETTE,SSE2,SO
-PSUBQ mmxreg,mmxrm [rm: np o64nw 0f fb /r] WILLAMETTE,SSE2,SO
-PSUBQ xmmreg,xmmrm [rm: 66 0f fb /r] WILLAMETTE,SSE2,SO
-PSUBSB xmmreg,xmmrm [rm: 66 0f e8 /r] WILLAMETTE,SSE2,SO
-PSUBSW xmmreg,xmmrm [rm: 66 0f e9 /r] WILLAMETTE,SSE2,SO
-PSUBUSB xmmreg,xmmrm [rm: 66 0f d8 /r] WILLAMETTE,SSE2,SO
-PSUBUSW xmmreg,xmmrm [rm: 66 0f d9 /r] WILLAMETTE,SSE2,SO
-PUNPCKHBW xmmreg,xmmrm [rm: 66 0f 68 /r] WILLAMETTE,SSE2,SO
-PUNPCKHWD xmmreg,xmmrm [rm: 66 0f 69 /r] WILLAMETTE,SSE2,SO
-PUNPCKHDQ xmmreg,xmmrm [rm: 66 0f 6a /r] WILLAMETTE,SSE2,SO
-PUNPCKHQDQ xmmreg,xmmrm [rm: 66 0f 6d /r] WILLAMETTE,SSE2,SO
-PUNPCKLBW xmmreg,xmmrm [rm: 66 0f 60 /r] WILLAMETTE,SSE2,SO
-PUNPCKLWD xmmreg,xmmrm [rm: 66 0f 61 /r] WILLAMETTE,SSE2,SO
-PUNPCKLDQ xmmreg,xmmrm [rm: 66 0f 62 /r] WILLAMETTE,SSE2,SO
-PUNPCKLQDQ xmmreg,xmmrm [rm: 66 0f 6c /r] WILLAMETTE,SSE2,SO
-PXOR xmmreg,xmmrm [rm: 66 0f ef /r] WILLAMETTE,SSE2,SO
-
-;# Willamette Streaming SIMD instructions (SSE2)
-ADDPD xmmreg,xmmrm [rm: 66 0f 58 /r] WILLAMETTE,SSE2,SO
-ADDSD xmmreg,xmmrm [rm: f2 0f 58 /r] WILLAMETTE,SSE2,SQ
-ANDNPD xmmreg,xmmrm [rm: 66 0f 55 /r] WILLAMETTE,SSE2,SO
-ANDPD xmmreg,xmmrm [rm: 66 0f 54 /r] WILLAMETTE,SSE2,SO
-CMPEQPD xmmreg,xmmrm [rm: 66 0f c2 /r 00] WILLAMETTE,SSE2,SO
-CMPEQSD xmmreg,xmmrm [rm: f2 0f c2 /r 00] WILLAMETTE,SSE2
-CMPLEPD xmmreg,xmmrm [rm: 66 0f c2 /r 02] WILLAMETTE,SSE2,SO
-CMPLESD xmmreg,xmmrm [rm: f2 0f c2 /r 02] WILLAMETTE,SSE2
-CMPLTPD xmmreg,xmmrm [rm: 66 0f c2 /r 01] WILLAMETTE,SSE2,SO
-CMPLTSD xmmreg,xmmrm [rm: f2 0f c2 /r 01] WILLAMETTE,SSE2
-CMPNEQPD xmmreg,xmmrm [rm: 66 0f c2 /r 04] WILLAMETTE,SSE2,SO
-CMPNEQSD xmmreg,xmmrm [rm: f2 0f c2 /r 04] WILLAMETTE,SSE2
-CMPNLEPD xmmreg,xmmrm [rm: 66 0f c2 /r 06] WILLAMETTE,SSE2,SO
-CMPNLESD xmmreg,xmmrm [rm: f2 0f c2 /r 06] WILLAMETTE,SSE2
-CMPNLTPD xmmreg,xmmrm [rm: 66 0f c2 /r 05] WILLAMETTE,SSE2,SO
-CMPNLTSD xmmreg,xmmrm [rm: f2 0f c2 /r 05] WILLAMETTE,SSE2
-CMPORDPD xmmreg,xmmrm [rm: 66 0f c2 /r 07] WILLAMETTE,SSE2,SO
-CMPORDSD xmmreg,xmmrm [rm: f2 0f c2 /r 07] WILLAMETTE,SSE2
-CMPUNORDPD xmmreg,xmmrm [rm: 66 0f c2 /r 03] WILLAMETTE,SSE2,SO
-CMPUNORDSD xmmreg,xmmrm [rm: f2 0f c2 /r 03] WILLAMETTE,SSE2
-; CMPPD/CMPSD must come after the specific ops; that way the disassembler will find the
-; specific ops first and only disassemble illegal ones as cmppd/cmpsd.
-CMPPD xmmreg,xmmrm128,imm8 [rmi: 66 0f c2 /r ib,u] WILLAMETTE,SSE2
-CMPSD xmmreg,xmmrm128,imm8 [rmi: f2 0f c2 /r ib,u] WILLAMETTE,SSE2
-COMISD xmmreg,xmmrm [rm: 66 0f 2f /r] WILLAMETTE,SSE2
-CVTDQ2PD xmmreg,xmmrm [rm: f3 0f e6 /r] WILLAMETTE,SSE2,SQ
-CVTDQ2PS xmmreg,xmmrm [rm: np 0f 5b /r] WILLAMETTE,SSE2,SO
-CVTPD2DQ xmmreg,xmmrm [rm: f2 0f e6 /r] WILLAMETTE,SSE2,SO
-CVTPD2PI mmxreg,xmmrm [rm: 66 0f 2d /r] WILLAMETTE,SSE2,SO
-CVTPD2PS xmmreg,xmmrm [rm: 66 0f 5a /r] WILLAMETTE,SSE2,SO
-CVTPI2PD xmmreg,mmxrm [rm: 66 0f 2a /r] WILLAMETTE,SSE2,SQ
-CVTPS2DQ xmmreg,xmmrm [rm: 66 0f 5b /r] WILLAMETTE,SSE2,SO
-CVTPS2PD xmmreg,xmmrm [rm: np 0f 5a /r] WILLAMETTE,SSE2,SQ
-CVTSD2SI reg32,xmmreg [rm: norexw f2 0f 2d /r] WILLAMETTE,SSE2,SQ,AR1
-CVTSD2SI reg32,mem [rm: norexw f2 0f 2d /r] WILLAMETTE,SSE2,SQ,AR1
-CVTSD2SI reg64,xmmreg [rm: o64 f2 0f 2d /r] X64,SSE2,SQ,AR1
-CVTSD2SI reg64,mem [rm: o64 f2 0f 2d /r] X64,SSE2,SQ,AR1
-CVTSD2SS xmmreg,xmmrm [rm: f2 0f 5a /r] WILLAMETTE,SSE2,SQ
-CVTSI2SD xmmreg,mem [rm: f2 0f 2a /r] WILLAMETTE,SSE2,SD,AR1,ND
-CVTSI2SD xmmreg,rm32 [rm: norexw f2 0f 2a /r] WILLAMETTE,SSE2,SD,AR1
-CVTSI2SD xmmreg,rm64 [rm: o64 f2 0f 2a /r] X64,SSE2,SQ,AR1
-CVTSS2SD xmmreg,xmmrm [rm: f3 0f 5a /r] WILLAMETTE,SSE2,SD
-CVTTPD2PI mmxreg,xmmrm [rm: 66 0f 2c /r] WILLAMETTE,SSE2,SO
-CVTTPD2DQ xmmreg,xmmrm [rm: 66 0f e6 /r] WILLAMETTE,SSE2,SO
-CVTTPS2DQ xmmreg,xmmrm [rm: f3 0f 5b /r] WILLAMETTE,SSE2,SO
-CVTTSD2SI reg32,xmmreg [rm: norexw f2 0f 2c /r] WILLAMETTE,SSE2,SQ,AR1
-CVTTSD2SI reg32,mem [rm: norexw f2 0f 2c /r] WILLAMETTE,SSE2,SQ,AR1
-CVTTSD2SI reg64,xmmreg [rm: o64 f2 0f 2c /r] X64,SSE2,SQ,AR1
-CVTTSD2SI reg64,mem [rm: o64 f2 0f 2c /r] X64,SSE2,SQ,AR1
-DIVPD xmmreg,xmmrm [rm: 66 0f 5e /r] WILLAMETTE,SSE2,SO
-DIVSD xmmreg,xmmrm [rm: f2 0f 5e /r] WILLAMETTE,SSE2
-MAXPD xmmreg,xmmrm [rm: 66 0f 5f /r] WILLAMETTE,SSE2,SO
-MAXSD xmmreg,xmmrm [rm: f2 0f 5f /r] WILLAMETTE,SSE2
-MINPD xmmreg,xmmrm [rm: 66 0f 5d /r] WILLAMETTE,SSE2,SO
-MINSD xmmreg,xmmrm [rm: f2 0f 5d /r] WILLAMETTE,SSE2
-MOVAPD xmmreg,xmmreg [rm: 66 0f 28 /r] WILLAMETTE,SSE2
-MOVAPD xmmreg,xmmreg [mr: 66 0f 29 /r] WILLAMETTE,SSE2
-MOVAPD mem,xmmreg [mr: 66 0f 29 /r] WILLAMETTE,SSE2,SO
-MOVAPD xmmreg,mem [rm: 66 0f 28 /r] WILLAMETTE,SSE2,SO
-MOVHPD mem,xmmreg [mr: 66 0f 17 /r] WILLAMETTE,SSE2
-MOVHPD xmmreg,mem [rm: 66 0f 16 /r] WILLAMETTE,SSE2
-MOVLPD mem64,xmmreg [mr: 66 0f 13 /r] WILLAMETTE,SSE2
-MOVLPD xmmreg,mem64 [rm: 66 0f 12 /r] WILLAMETTE,SSE2
-MOVMSKPD reg32,xmmreg [rm: 66 0f 50 /r] WILLAMETTE,SSE2
-MOVMSKPD reg64,xmmreg [rm: 66 o64 0f 50 /r] X64,SSE2
-MOVSD xmmreg,xmmreg [rm: f2 0f 10 /r] WILLAMETTE,SSE2
-MOVSD xmmreg,xmmreg [mr: f2 0f 11 /r] WILLAMETTE,SSE2
-MOVSD mem64,xmmreg [mr: f2 0f 11 /r] WILLAMETTE,SSE2
-MOVSD xmmreg,mem64 [rm: f2 0f 10 /r] WILLAMETTE,SSE2
-MOVUPD xmmreg,xmmreg [rm: 66 0f 10 /r] WILLAMETTE,SSE2
-MOVUPD xmmreg,xmmreg [mr: 66 0f 11 /r] WILLAMETTE,SSE2
-MOVUPD mem,xmmreg [mr: 66 0f 11 /r] WILLAMETTE,SSE2,SO
-MOVUPD xmmreg,mem [rm: 66 0f 10 /r] WILLAMETTE,SSE2,SO
-MULPD xmmreg,xmmrm [rm: 66 0f 59 /r] WILLAMETTE,SSE2,SO
-MULSD xmmreg,xmmrm [rm: f2 0f 59 /r] WILLAMETTE,SSE2
-ORPD xmmreg,xmmrm [rm: 66 0f 56 /r] WILLAMETTE,SSE2,SO
-SHUFPD xmmreg,xmmreg,imm [rmi: 66 0f c6 /r ib,u] WILLAMETTE,SSE2,SB,AR2
-SHUFPD xmmreg,mem,imm [rmi: 66 0f c6 /r ib,u] WILLAMETTE,SSE2,SM,SB,AR2
-SQRTPD xmmreg,xmmrm [rm: 66 0f 51 /r] WILLAMETTE,SSE2,SO
-SQRTSD xmmreg,xmmrm [rm: f2 0f 51 /r] WILLAMETTE,SSE2
-SUBPD xmmreg,xmmrm [rm: 66 0f 5c /r] WILLAMETTE,SSE2,SO
-SUBSD xmmreg,xmmrm [rm: f2 0f 5c /r] WILLAMETTE,SSE2
-UCOMISD xmmreg,xmmrm [rm: 66 0f 2e /r] WILLAMETTE,SSE2
-UNPCKHPD xmmreg,xmmrm128 [rm: 66 0f 15 /r] WILLAMETTE,SSE2
-UNPCKLPD xmmreg,xmmrm128 [rm: 66 0f 14 /r] WILLAMETTE,SSE2
-XORPD xmmreg,xmmrm128 [rm: 66 0f 57 /r] WILLAMETTE,SSE2
-
-;# Prescott New Instructions (SSE3)
-ADDSUBPD xmmreg,xmmrm [rm: 66 0f d0 /r] PRESCOTT,SSE3,SO
-ADDSUBPS xmmreg,xmmrm [rm: f2 0f d0 /r] PRESCOTT,SSE3,SO
-HADDPD xmmreg,xmmrm [rm: 66 0f 7c /r] PRESCOTT,SSE3,SO
-HADDPS xmmreg,xmmrm [rm: f2 0f 7c /r] PRESCOTT,SSE3,SO
-HSUBPD xmmreg,xmmrm [rm: 66 0f 7d /r] PRESCOTT,SSE3,SO
-HSUBPS xmmreg,xmmrm [rm: f2 0f 7d /r] PRESCOTT,SSE3,SO
-LDDQU xmmreg,mem [rm: f2 0f f0 /r] PRESCOTT,SSE3,SO
-MOVDDUP xmmreg,xmmrm [rm: f2 0f 12 /r] PRESCOTT,SSE3
-MOVSHDUP xmmreg,xmmrm [rm: f3 0f 16 /r] PRESCOTT,SSE3
-MOVSLDUP xmmreg,xmmrm [rm: f3 0f 12 /r] PRESCOTT,SSE3
-
-;# VMX/SVM Instructions
-CLGI void [ 0f 01 dd] VMX,AMD
-STGI void [ 0f 01 dc] VMX,AMD
-VMCALL void [ 0f 01 c1] VMX
-VMCLEAR mem [m: 66 0f c7 /6] VMX
-VMFUNC void [ 0f 01 d4] VMX
-VMLAUNCH void [ 0f 01 c2] VMX
-VMLOAD void [ 0f 01 da] VMX,AMD
-VMMCALL void [ 0f 01 d9] VMX,AMD
-VMPTRLD mem [m: np 0f c7 /6] VMX
-VMPTRST mem [m: np 0f c7 /7] VMX
-VMREAD rm32,reg32 [mr: np 0f 78 /r] VMX,NOLONG,SD
-VMREAD rm64,reg64 [mr: o64nw np 0f 78 /r] X64,VMX,SQ
-VMRESUME void [ 0f 01 c3] VMX
-VMRUN void [ 0f 01 d8] VMX,AMD
-VMSAVE void [ 0f 01 db] VMX,AMD
-VMWRITE reg32,rm32 [rm: np 0f 79 /r] VMX,NOLONG,SD
-VMWRITE reg64,rm64 [rm: o64nw np 0f 79 /r] X64,VMX,SQ
-VMXOFF void [ 0f 01 c4] VMX
-VMXON mem [m: f3 0f c7 /6] VMX
-;# Extended Page Tables VMX instructions
-INVEPT reg32,mem [rm: 66 0f 38 80 /r] VMX,SO,NOLONG
-INVEPT reg64,mem [rm: o64nw 66 0f 38 80 /r] VMX,SO,LONG
-INVVPID reg32,mem [rm: 66 0f 38 81 /r] VMX,SO,NOLONG
-INVVPID reg64,mem [rm: o64nw 66 0f 38 81 /r] VMX,SO,LONG
-
-;# Tejas New Instructions (SSSE3)
-PABSB mmxreg,mmxrm [rm: np 0f 38 1c /r] SSSE3,MMX,SQ
-PABSB xmmreg,xmmrm [rm: 66 0f 38 1c /r] SSSE3
-PABSW mmxreg,mmxrm [rm: np 0f 38 1d /r] SSSE3,MMX,SQ
-PABSW xmmreg,xmmrm [rm: 66 0f 38 1d /r] SSSE3
-PABSD mmxreg,mmxrm [rm: np 0f 38 1e /r] SSSE3,MMX,SQ
-PABSD xmmreg,xmmrm [rm: 66 0f 38 1e /r] SSSE3
-PALIGNR mmxreg,mmxrm,imm [rmi: np 0f 3a 0f /r ib,u] SSSE3,MMX,SQ
-PALIGNR xmmreg,xmmrm,imm [rmi: 66 0f 3a 0f /r ib,u] SSSE3
-PHADDW mmxreg,mmxrm [rm: np 0f 38 01 /r] SSSE3,MMX,SQ
-PHADDW xmmreg,xmmrm [rm: 66 0f 38 01 /r] SSSE3
-PHADDD mmxreg,mmxrm [rm: np 0f 38 02 /r] SSSE3,MMX,SQ
-PHADDD xmmreg,xmmrm [rm: 66 0f 38 02 /r] SSSE3
-PHADDSW mmxreg,mmxrm [rm: np 0f 38 03 /r] SSSE3,MMX,SQ
-PHADDSW xmmreg,xmmrm [rm: 66 0f 38 03 /r] SSSE3
-PHSUBW mmxreg,mmxrm [rm: np 0f 38 05 /r] SSSE3,MMX,SQ
-PHSUBW xmmreg,xmmrm [rm: 66 0f 38 05 /r] SSSE3
-PHSUBD mmxreg,mmxrm [rm: np 0f 38 06 /r] SSSE3,MMX,SQ
-PHSUBD xmmreg,xmmrm [rm: 66 0f 38 06 /r] SSSE3
-PHSUBSW mmxreg,mmxrm [rm: np 0f 38 07 /r] SSSE3,MMX,SQ
-PHSUBSW xmmreg,xmmrm [rm: 66 0f 38 07 /r] SSSE3
-PMADDUBSW mmxreg,mmxrm [rm: np 0f 38 04 /r] SSSE3,MMX,SQ
-PMADDUBSW xmmreg,xmmrm [rm: 66 0f 38 04 /r] SSSE3
-PMULHRSW mmxreg,mmxrm [rm: np 0f 38 0b /r] SSSE3,MMX,SQ
-PMULHRSW xmmreg,xmmrm [rm: 66 0f 38 0b /r] SSSE3
-PSHUFB mmxreg,mmxrm [rm: np 0f 38 00 /r] SSSE3,MMX,SQ
-PSHUFB xmmreg,xmmrm [rm: 66 0f 38 00 /r] SSSE3
-PSIGNB mmxreg,mmxrm [rm: np 0f 38 08 /r] SSSE3,MMX,SQ
-PSIGNB xmmreg,xmmrm [rm: 66 0f 38 08 /r] SSSE3
-PSIGNW mmxreg,mmxrm [rm: np 0f 38 09 /r] SSSE3,MMX,SQ
-PSIGNW xmmreg,xmmrm [rm: 66 0f 38 09 /r] SSSE3
-PSIGND mmxreg,mmxrm [rm: np 0f 38 0a /r] SSSE3,MMX,SQ
-PSIGND xmmreg,xmmrm [rm: 66 0f 38 0a /r] SSSE3
-
-;# AMD SSE4A
-EXTRQ xmmreg,imm,imm [mij: 66 0f 78 /0 ib,u ib,u] SSE4A,AMD
-EXTRQ xmmreg,xmmreg [rm: 66 0f 79 /r] SSE4A,AMD
-INSERTQ xmmreg,xmmreg,imm,imm [rmij: f2 0f 78 /r ib,u ib,u] SSE4A,AMD
-INSERTQ xmmreg,xmmreg [rm: f2 0f 79 /r] SSE4A,AMD
-MOVNTSD mem,xmmreg [mr: f2 0f 2b /r] SSE4A,AMD,SQ
-MOVNTSS mem,xmmreg [mr: f3 0f 2b /r] SSE4A,AMD,SD
-
-;# New instructions in Barcelona
-LZCNT reg16,rm16 [rm: o16 f3i 0f bd /r] P6,AMD
-LZCNT reg32,rm32 [rm: o32 f3i 0f bd /r] P6,AMD
-LZCNT reg64,rm64 [rm: o64 f3i 0f bd /r] X64,AMD
-
-;# Penryn New Instructions (SSE4.1)
-BLENDPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 0d /r ib,u] SSE41
-BLENDPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 0c /r ib,u] SSE41
-BLENDVPD xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 15 /r] SSE41
-BLENDVPD xmmreg,xmmrm [rm: 66 0f 38 15 /r] SSE41
-BLENDVPS xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 14 /r] SSE41
-BLENDVPS xmmreg,xmmrm [rm: 66 0f 38 14 /r] SSE41
-DPPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 41 /r ib,u] SSE41
-DPPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 40 /r ib,u] SSE41
-EXTRACTPS rm32,xmmreg,imm [mri: 66 0f 3a 17 /r ib,u] SSE41
-EXTRACTPS reg64,xmmreg,imm [mri: o64 66 0f 3a 17 /r ib,u] SSE41,X64
-INSERTPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 21 /r ib,u] SSE41,SD
-MOVNTDQA xmmreg,mem128 [rm: 66 0f 38 2a /r] SSE41
-MPSADBW xmmreg,xmmrm,imm [rmi: 66 0f 3a 42 /r ib,u] SSE41
-PACKUSDW xmmreg,xmmrm [rm: 66 0f 38 2b /r] SSE41
-PBLENDVB xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 10 /r] SSE41
-PBLENDVB xmmreg,xmmrm [rm: 66 0f 38 10 /r] SSE41
-PBLENDW xmmreg,xmmrm,imm [rmi: 66 0f 3a 0e /r ib,u] SSE41
-PCMPEQQ xmmreg,xmmrm [rm: 66 0f 38 29 /r] SSE41
-PEXTRB reg32,xmmreg,imm [mri: 66 0f 3a 14 /r ib,u] SSE41
-PEXTRB mem8,xmmreg,imm [mri: 66 0f 3a 14 /r ib,u] SSE41
-PEXTRB reg64,xmmreg,imm [mri: o64 66 0f 3a 14 /r ib,u] SSE41,X64
-PEXTRD rm32,xmmreg,imm [mri: norexw 66 0f 3a 16 /r ib,u] SSE41
-PEXTRQ rm64,xmmreg,imm [mri: o64 66 0f 3a 16 /r ib,u] SSE41,X64
-PEXTRW reg32,xmmreg,imm [mri: 66 0f 3a 15 /r ib,u] SSE41
-PEXTRW mem16,xmmreg,imm [mri: 66 0f 3a 15 /r ib,u] SSE41
-PEXTRW reg64,xmmreg,imm [mri: o64 66 0f 3a 15 /r ib,u] SSE41,X64
-PHMINPOSUW xmmreg,xmmrm [rm: 66 0f 38 41 /r] SSE41
-PINSRB xmmreg,mem,imm [rmi: 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
-PINSRB xmmreg,rm8,imm [rmi: nohi 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
-PINSRB xmmreg,reg32,imm [rmi: 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
-PINSRD xmmreg,mem,imm [rmi: norexw 66 0f 3a 22 /r ib,u] SSE41,SB,AR2
-PINSRD xmmreg,rm32,imm [rmi: norexw 66 0f 3a 22 /r ib,u] SSE41,SB,AR2
-PINSRQ xmmreg,mem,imm [rmi: o64 66 0f 3a 22 /r ib,u] SSE41,X64,SB,AR2
-PINSRQ xmmreg,rm64,imm [rmi: o64 66 0f 3a 22 /r ib,u] SSE41,X64,SB,AR2
-PMAXSB xmmreg,xmmrm [rm: 66 0f 38 3c /r] SSE41
-PMAXSD xmmreg,xmmrm [rm: 66 0f 38 3d /r] SSE41
-PMAXUD xmmreg,xmmrm [rm: 66 0f 38 3f /r] SSE41
-PMAXUW xmmreg,xmmrm [rm: 66 0f 38 3e /r] SSE41
-PMINSB xmmreg,xmmrm [rm: 66 0f 38 38 /r] SSE41
-PMINSD xmmreg,xmmrm [rm: 66 0f 38 39 /r] SSE41
-PMINUD xmmreg,xmmrm [rm: 66 0f 38 3b /r] SSE41
-PMINUW xmmreg,xmmrm [rm: 66 0f 38 3a /r] SSE41
-PMOVSXBW xmmreg,xmmrm [rm: 66 0f 38 20 /r] SSE41,SQ
-PMOVSXBD xmmreg,xmmrm [rm: 66 0f 38 21 /r] SSE41,SD
-PMOVSXBQ xmmreg,xmmrm [rm: 66 0f 38 22 /r] SSE41,SW
-PMOVSXWD xmmreg,xmmrm [rm: 66 0f 38 23 /r] SSE41,SQ
-PMOVSXWQ xmmreg,xmmrm [rm: 66 0f 38 24 /r] SSE41,SD
-PMOVSXDQ xmmreg,xmmrm [rm: 66 0f 38 25 /r] SSE41,SQ
-PMOVZXBW xmmreg,xmmrm [rm: 66 0f 38 30 /r] SSE41,SQ
-PMOVZXBD xmmreg,xmmrm [rm: 66 0f 38 31 /r] SSE41,SD
-PMOVZXBQ xmmreg,xmmrm [rm: 66 0f 38 32 /r] SSE41,SW
-PMOVZXWD xmmreg,xmmrm [rm: 66 0f 38 33 /r] SSE41,SQ
-PMOVZXWQ xmmreg,xmmrm [rm: 66 0f 38 34 /r] SSE41,SD
-PMOVZXDQ xmmreg,xmmrm [rm: 66 0f 38 35 /r] SSE41,SQ
-PMULDQ xmmreg,xmmrm [rm: 66 0f 38 28 /r] SSE41
-PMULLD xmmreg,xmmrm [rm: 66 0f 38 40 /r] SSE41
-PTEST xmmreg,xmmrm [rm: 66 0f 38 17 /r] SSE41
-ROUNDPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 09 /r ib,u] SSE41
-ROUNDPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 08 /r ib,u] SSE41
-ROUNDSD xmmreg,xmmrm,imm [rmi: 66 0f 3a 0b /r ib,u] SSE41
-ROUNDSS xmmreg,xmmrm,imm [rmi: 66 0f 3a 0a /r ib,u] SSE41
-
-;# Nehalem New Instructions (SSE4.2)
-CRC32 reg32,rm8 [rm: f2i 0f 38 f0 /r] SSE42
-CRC32 reg32,rm16 [rm: o16 f2i 0f 38 f1 /r] SSE42
-CRC32 reg32,rm32 [rm: o32 f2i 0f 38 f1 /r] SSE42
-CRC32 reg64,rm8 [rm: o64 f2i 0f 38 f0 /r] SSE42,X64
-CRC32 reg64,rm64 [rm: o64 f2i 0f 38 f1 /r] SSE42,X64
-PCMPESTRI xmmreg,xmmrm,imm [rmi: 66 0f 3a 61 /r ib,u] SSE42
-PCMPESTRM xmmreg,xmmrm,imm [rmi: 66 0f 3a 60 /r ib,u] SSE42
-PCMPISTRI xmmreg,xmmrm,imm [rmi: 66 0f 3a 63 /r ib,u] SSE42
-PCMPISTRM xmmreg,xmmrm,imm [rmi: 66 0f 3a 62 /r ib,u] SSE42
-PCMPGTQ xmmreg,xmmrm [rm: 66 0f 38 37 /r] SSE42
-POPCNT reg16,rm16 [rm: o16 f3i 0f b8 /r] NEHALEM,SW
-POPCNT reg32,rm32 [rm: o32 f3i 0f b8 /r] NEHALEM,SD
-POPCNT reg64,rm64 [rm: o64 f3i 0f b8 /r] NEHALEM,SQ,X64
-
-;# Intel SMX
-GETSEC void [ 0f 37] KATMAI
-
-;# Geode (Cyrix) 3DNow! additions
-PFRCPV mmxreg,mmxrm [rm: o64nw 0f 0f /r 86] PENT,3DNOW,SQ,CYRIX
-PFRSQRTV mmxreg,mmxrm [rm: o64nw 0f 0f /r 87] PENT,3DNOW,SQ,CYRIX
-
-;# Intel new instructions in ???
-; Is NEHALEM right here?
-MOVBE reg16,mem16 [rm: o16 norep 0f 38 f0 /r] NEHALEM,SM
-MOVBE reg32,mem32 [rm: o32 norep 0f 38 f0 /r] NEHALEM,SM
-MOVBE reg64,mem64 [rm: o64 norep 0f 38 f0 /r] NEHALEM,SM
-MOVBE mem16,reg16 [mr: o16 norep 0f 38 f1 /r] NEHALEM,SM
-MOVBE mem32,reg32 [mr: o32 norep 0f 38 f1 /r] NEHALEM,SM
-MOVBE mem64,reg64 [mr: o64 norep 0f 38 f1 /r] NEHALEM,SM
-
-;# Intel AES instructions
-AESENC xmmreg,xmmrm128 [rm: 66 0f 38 dc /r] SSE,WESTMERE
-AESENCLAST xmmreg,xmmrm128 [rm: 66 0f 38 dd /r] SSE,WESTMERE
-AESDEC xmmreg,xmmrm128 [rm: 66 0f 38 de /r] SSE,WESTMERE
-AESDECLAST xmmreg,xmmrm128 [rm: 66 0f 38 df /r] SSE,WESTMERE
-AESIMC xmmreg,xmmrm128 [rm: 66 0f 38 db /r] SSE,WESTMERE
-AESKEYGENASSIST xmmreg,xmmrm128,imm8 [rmi: 66 0f 3a df /r ib] SSE,WESTMERE
-
-;# Intel AVX AES instructions
-VAESENC xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 dc /r] AVX,SANDYBRIDGE
-VAESENCLAST xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 dd /r] AVX,SANDYBRIDGE
-VAESDEC xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 de /r] AVX,SANDYBRIDGE
-VAESDECLAST xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 df /r] AVX,SANDYBRIDGE
-VAESIMC xmmreg,xmmrm128 [rm: vex.128.66.0f38 db /r] AVX,SANDYBRIDGE
-VAESKEYGENASSIST xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a df /r ib] AVX,SANDYBRIDGE
-
-;# Intel AVX instructions
-VADDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 58 /r] AVX,SANDYBRIDGE
-VADDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 58 /r] AVX,SANDYBRIDGE
-VADDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 58 /r] AVX,SANDYBRIDGE
-VADDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 58 /r] AVX,SANDYBRIDGE
-VADDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 58 /r] AVX,SANDYBRIDGE
-VADDSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 58 /r] AVX,SANDYBRIDGE
-VADDSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d0 /r] AVX,SANDYBRIDGE
-VADDSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d0 /r] AVX,SANDYBRIDGE
-VADDSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f d0 /r] AVX,SANDYBRIDGE
-VADDSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f d0 /r] AVX,SANDYBRIDGE
-VANDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 54 /r] AVX,SANDYBRIDGE
-VANDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 54 /r] AVX,SANDYBRIDGE
-VANDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 54 /r] AVX,SANDYBRIDGE
-VANDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 54 /r] AVX,SANDYBRIDGE
-VANDNPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 55 /r] AVX,SANDYBRIDGE
-VANDNPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 55 /r] AVX,SANDYBRIDGE
-VANDNPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 55 /r] AVX,SANDYBRIDGE
-VANDNPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 55 /r] AVX,SANDYBRIDGE
-VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0d /r ib] AVX,SANDYBRIDGE
-VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0d /r ib] AVX,SANDYBRIDGE
-VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0c /r ib] AVX,SANDYBRIDGE
-VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0c /r ib] AVX,SANDYBRIDGE
-VBLENDVPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4b /r /is4] AVX,SANDYBRIDGE
-VBLENDVPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a.w0 4b /r /is4] AVX,SANDYBRIDGE
-VBLENDVPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4a /r /is4] AVX,SANDYBRIDGE
-VBLENDVPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a.w0 4a /r /is4] AVX,SANDYBRIDGE
-VBROADCASTSS xmmreg,mem32 [rm: vex.128.66.0f38.w0 18 /r] AVX,SANDYBRIDGE
-VBROADCASTSS ymmreg,mem32 [rm: vex.256.66.0f38.w0 18 /r] AVX,SANDYBRIDGE
-VBROADCASTSD ymmreg,mem64 [rm: vex.256.66.0f38.w0 19 /r] AVX,SANDYBRIDGE
-VBROADCASTF128 ymmreg,mem128 [rm: vex.256.66.0f38.w0 1a /r] AVX,SANDYBRIDGE
-; Specific aliases first, then the generic version, to keep the disassembler happy...
-VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPEQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPLT_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLT_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPUNORD_QPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORD_QPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPNEQ_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQ_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNLT_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLT_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPORD_QPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORD_QPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPNGE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGT_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGT_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPFALSE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPGE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGT_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGT_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPTRUE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f c2 /r ib] AVX,SANDYBRIDGE
-VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f c2 /r ib] AVX,SANDYBRIDGE
-; Specific aliases first, then the generic version, to keep the disassembler happy...
-VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPEQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPLT_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLT_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPUNORD_QPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORD_QPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPNEQ_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQ_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNLT_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLT_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPORD_QPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORD_QPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPNGE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGT_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGT_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPFALSE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPGE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGT_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGT_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPTRUE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.0f c2 /r ib] AVX,SANDYBRIDGE
-VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.0f c2 /r ib] AVX,SANDYBRIDGE
-; Specific aliases first, then the generic version, to keep the disassembler happy...
-VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPLT_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPUNORD_QSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPNEQ_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNLT_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPORD_QSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPNGE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGT_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPFALSE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPGE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGT_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPTRUE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.lig.f2.0f c2 /r ib] AVX,SANDYBRIDGE
-; Specific aliases first, then the generic version, to keep the disassembler happy...
-VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPEQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 00] AVX,SANDYBRIDGE
-VCMPLT_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 01] AVX,SANDYBRIDGE
-VCMPLE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPLESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 02] AVX,SANDYBRIDGE
-VCMPUNORD_QSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPUNORDSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 03] AVX,SANDYBRIDGE
-VCMPNEQ_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNEQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 04] AVX,SANDYBRIDGE
-VCMPNLT_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 05] AVX,SANDYBRIDGE
-VCMPNLE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPNLESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 06] AVX,SANDYBRIDGE
-VCMPORD_QSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPORDSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 07] AVX,SANDYBRIDGE
-VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 08] AVX,SANDYBRIDGE
-VCMPNGE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 09] AVX,SANDYBRIDGE
-VCMPNGT_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPNGTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0a] AVX,SANDYBRIDGE
-VCMPFALSE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPFALSESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0b] AVX,SANDYBRIDGE
-VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0c] AVX,SANDYBRIDGE
-VCMPGE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0d] AVX,SANDYBRIDGE
-VCMPGT_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPGTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0e] AVX,SANDYBRIDGE
-VCMPTRUE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPTRUESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0f] AVX,SANDYBRIDGE
-VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 10] AVX,SANDYBRIDGE
-VCMPLT_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 11] AVX,SANDYBRIDGE
-VCMPLE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 12] AVX,SANDYBRIDGE
-VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 13] AVX,SANDYBRIDGE
-VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 14] AVX,SANDYBRIDGE
-VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 15] AVX,SANDYBRIDGE
-VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 16] AVX,SANDYBRIDGE
-VCMPORD_SSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 17] AVX,SANDYBRIDGE
-VCMPEQ_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 18] AVX,SANDYBRIDGE
-VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 19] AVX,SANDYBRIDGE
-VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1a] AVX,SANDYBRIDGE
-VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1b] AVX,SANDYBRIDGE
-VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1c] AVX,SANDYBRIDGE
-VCMPGE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1d] AVX,SANDYBRIDGE
-VCMPGT_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1e] AVX,SANDYBRIDGE
-VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1f] AVX,SANDYBRIDGE
-VCMPSS xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.lig.f3.0f c2 /r ib] AVX,SANDYBRIDGE
-VCOMISD xmmreg,xmmrm64 [rm: vex.lig.66.0f 2f /r] AVX,SANDYBRIDGE
-VCOMISS xmmreg,xmmrm32 [rm: vex.lig.0f 2f /r] AVX,SANDYBRIDGE
-VCVTDQ2PD xmmreg,xmmrm64 [rm: vex.128.f3.0f e6 /r] AVX,SANDYBRIDGE
-VCVTDQ2PD ymmreg,xmmrm128 [rm: vex.256.f3.0f e6 /r] AVX,SANDYBRIDGE
-VCVTDQ2PS xmmreg,xmmrm128 [rm: vex.128.0f 5b /r] AVX,SANDYBRIDGE
-VCVTDQ2PS ymmreg,ymmrm256 [rm: vex.256.0f 5b /r] AVX,SANDYBRIDGE
-VCVTPD2DQ xmmreg,xmmreg [rm: vex.128.f2.0f e6 /r] AVX,SANDYBRIDGE
-VCVTPD2DQ xmmreg,mem128 [rm: vex.128.f2.0f e6 /r] AVX,SANDYBRIDGE,SO
-VCVTPD2DQ xmmreg,ymmreg [rm: vex.256.f2.0f e6 /r] AVX,SANDYBRIDGE
-VCVTPD2DQ xmmreg,mem256 [rm: vex.256.f2.0f e6 /r] AVX,SANDYBRIDGE,SY
-VCVTPD2PS xmmreg,xmmreg [rm: vex.128.66.0f 5a /r] AVX,SANDYBRIDGE
-VCVTPD2PS xmmreg,mem128 [rm: vex.128.66.0f 5a /r] AVX,SANDYBRIDGE,SO
-VCVTPD2PS xmmreg,ymmreg [rm: vex.256.66.0f 5a /r] AVX,SANDYBRIDGE
-VCVTPD2PS xmmreg,mem256 [rm: vex.256.66.0f 5a /r] AVX,SANDYBRIDGE,SY
-VCVTPS2DQ xmmreg,xmmrm128 [rm: vex.128.66.0f 5b /r] AVX,SANDYBRIDGE
-VCVTPS2DQ ymmreg,ymmrm256 [rm: vex.256.66.0f 5b /r] AVX,SANDYBRIDGE
-VCVTPS2PD xmmreg,xmmrm64 [rm: vex.128.0f 5a /r] AVX,SANDYBRIDGE
-VCVTPS2PD ymmreg,xmmrm128 [rm: vex.256.0f 5a /r] AVX,SANDYBRIDGE
-VCVTSD2SI reg32,xmmrm64 [rm: vex.lig.f2.0f.w0 2d /r] AVX,SANDYBRIDGE
-VCVTSD2SI reg64,xmmrm64 [rm: vex.lig.f2.0f.w1 2d /r] AVX,SANDYBRIDGE,LONG
-VCVTSD2SS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5a /r] AVX,SANDYBRIDGE
-VCVTSI2SD xmmreg,xmmreg*,rm32 [rvm: vex.nds.lig.f2.0f.w0 2a /r] AVX,SANDYBRIDGE,SD
-VCVTSI2SD xmmreg,xmmreg*,mem32 [rvm: vex.nds.lig.f2.0f.w0 2a /r] AVX,SANDYBRIDGE,ND,SD
-VCVTSI2SD xmmreg,xmmreg*,rm64 [rvm: vex.nds.lig.f2.0f.w1 2a /r] AVX,SANDYBRIDGE,LONG,SQ
-VCVTSI2SS xmmreg,xmmreg*,rm32 [rvm: vex.nds.lig.f3.0f.w0 2a /r] AVX,SANDYBRIDGE,SD
-VCVTSI2SS xmmreg,xmmreg*,mem32 [rvm: vex.nds.lig.f3.0f.w0 2a /r] AVX,SANDYBRIDGE,ND,SD
-VCVTSI2SS xmmreg,xmmreg*,rm64 [rvm: vex.nds.lig.f3.0f.w1 2a /r] AVX,SANDYBRIDGE,LONG,SQ
-VCVTSS2SD xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5a /r] AVX,SANDYBRIDGE
-VCVTSS2SI reg32,xmmrm32 [rm: vex.lig.f3.0f.w0 2d /r] AVX,SANDYBRIDGE
-VCVTSS2SI reg64,xmmrm32 [rm: vex.lig.f3.0f.w1 2d /r] AVX,SANDYBRIDGE,LONG
-VCVTTPD2DQ xmmreg,xmmreg [rm: vex.128.66.0f e6 /r] AVX,SANDYBRIDGE
-VCVTTPD2DQ xmmreg,mem128 [rm: vex.128.66.0f e6 /r] AVX,SANDYBRIDGE,SO
-VCVTTPD2DQ xmmreg,ymmreg [rm: vex.256.66.0f e6 /r] AVX,SANDYBRIDGE
-VCVTTPD2DQ xmmreg,mem256 [rm: vex.256.66.0f e6 /r] AVX,SANDYBRIDGE,SY
-VCVTTPS2DQ xmmreg,xmmrm128 [rm: vex.128.f3.0f 5b /r] AVX,SANDYBRIDGE
-VCVTTPS2DQ ymmreg,ymmrm256 [rm: vex.256.f3.0f 5b /r] AVX,SANDYBRIDGE
-VCVTTSD2SI reg32,xmmrm64 [rm: vex.lig.f2.0f.w0 2c /r] AVX,SANDYBRIDGE
-VCVTTSD2SI reg64,xmmrm64 [rm: vex.lig.f2.0f.w1 2c /r] AVX,SANDYBRIDGE,LONG
-VCVTTSS2SI reg32,xmmrm32 [rm: vex.lig.f3.0f.w0 2c /r] AVX,SANDYBRIDGE
-VCVTTSS2SI reg64,xmmrm32 [rm: vex.lig.f3.0f.w1 2c /r] AVX,SANDYBRIDGE,LONG
-VDIVPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5e /r] AVX,SANDYBRIDGE
-VDIVPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5e /r] AVX,SANDYBRIDGE
-VDIVPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5e /r] AVX,SANDYBRIDGE
-VDIVPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5e /r] AVX,SANDYBRIDGE
-VDIVSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5e /r] AVX,SANDYBRIDGE
-VDIVSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5e /r] AVX,SANDYBRIDGE
-VDPPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 41 /r ib] AVX,SANDYBRIDGE
-VDPPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 40 /r ib] AVX,SANDYBRIDGE
-VDPPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 40 /r ib] AVX,SANDYBRIDGE
-VEXTRACTF128 xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 19 /r ib] AVX,SANDYBRIDGE
-VEXTRACTPS rm32,xmmreg,imm8 [mri: vex.128.66.0f3a 17 /r ib] AVX,SANDYBRIDGE
-VHADDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 7c /r] AVX,SANDYBRIDGE
-VHADDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 7c /r] AVX,SANDYBRIDGE
-VHADDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f 7c /r] AVX,SANDYBRIDGE
-VHADDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f 7c /r] AVX,SANDYBRIDGE
-VHSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 7d /r] AVX,SANDYBRIDGE
-VHSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 7d /r] AVX,SANDYBRIDGE
-VHSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f 7d /r] AVX,SANDYBRIDGE
-VHSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f 7d /r] AVX,SANDYBRIDGE
-VINSERTF128 ymmreg,ymmreg*,xmmrm128,imm8 [rvmi: vex.nds.256.66.0f3a.w0 18 /r ib] AVX,SANDYBRIDGE
-VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi: vex.nds.128.66.0f3a 21 /r ib] AVX,SANDYBRIDGE
-VLDDQU xmmreg,mem128 [rm: vex.128.f2.0f f0 /r] AVX,SANDYBRIDGE
-VLDQQU ymmreg,mem256 [rm: vex.256.f2.0f f0 /r] AVX,SANDYBRIDGE
-VLDDQU ymmreg,mem256 [rm: vex.256.f2.0f f0 /r] AVX,SANDYBRIDGE
-VLDMXCSR mem32 [m: vex.lz.0f ae /2] AVX,SANDYBRIDGE
-VMASKMOVDQU xmmreg,xmmreg [rm: vex.128.66.0f f7 /r] AVX,SANDYBRIDGE
-VMASKMOVPS xmmreg,xmmreg,mem128 [rvm: vex.nds.128.66.0f38.w0 2c /r] AVX,SANDYBRIDGE
-VMASKMOVPS ymmreg,ymmreg,mem256 [rvm: vex.nds.256.66.0f38.w0 2c /r] AVX,SANDYBRIDGE
-VMASKMOVPS mem128,xmmreg,xmmreg [mvr: vex.nds.128.66.0f38.w0 2e /r] AVX,SANDYBRIDGE,SO
-VMASKMOVPS mem256,ymmreg,ymmreg [mvr: vex.nds.256.66.0f38.w0 2e /r] AVX,SANDYBRIDGE,SY
-VMASKMOVPD xmmreg,xmmreg,mem128 [rvm: vex.nds.128.66.0f38.w0 2d /r] AVX,SANDYBRIDGE
-VMASKMOVPD ymmreg,ymmreg,mem256 [rvm: vex.nds.256.66.0f38.w0 2d /r] AVX,SANDYBRIDGE
-VMASKMOVPD mem128,xmmreg,xmmreg [mvr: vex.nds.128.66.0f38.w0 2f /r] AVX,SANDYBRIDGE
-VMASKMOVPD mem256,ymmreg,ymmreg [mvr: vex.nds.256.66.0f38.w0 2f /r] AVX,SANDYBRIDGE
-VMAXPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5f /r] AVX,SANDYBRIDGE
-VMAXPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5f /r] AVX,SANDYBRIDGE
-VMAXPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5f /r] AVX,SANDYBRIDGE
-VMAXPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5f /r] AVX,SANDYBRIDGE
-VMAXSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5f /r] AVX,SANDYBRIDGE
-VMAXSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5f /r] AVX,SANDYBRIDGE
-VMINPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5d /r] AVX,SANDYBRIDGE
-VMINPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5d /r] AVX,SANDYBRIDGE
-VMINPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5d /r] AVX,SANDYBRIDGE
-VMINPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5d /r] AVX,SANDYBRIDGE
-VMINSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5d /r] AVX,SANDYBRIDGE
-VMINSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5d /r] AVX,SANDYBRIDGE
-VMOVAPD xmmreg,xmmrm128 [rm: vex.128.66.0f 28 /r] AVX,SANDYBRIDGE
-VMOVAPD xmmrm128,xmmreg [mr: vex.128.66.0f 29 /r] AVX,SANDYBRIDGE
-VMOVAPD ymmreg,ymmrm256 [rm: vex.256.66.0f 28 /r] AVX,SANDYBRIDGE
-VMOVAPD ymmrm256,ymmreg [mr: vex.256.66.0f 29 /r] AVX,SANDYBRIDGE
-VMOVAPS xmmreg,xmmrm128 [rm: vex.128.0f 28 /r] AVX,SANDYBRIDGE
-VMOVAPS xmmrm128,xmmreg [mr: vex.128.0f 29 /r] AVX,SANDYBRIDGE
-VMOVAPS ymmreg,ymmrm256 [rm: vex.256.0f 28 /r] AVX,SANDYBRIDGE
-VMOVAPS ymmrm256,ymmreg [mr: vex.256.0f 29 /r] AVX,SANDYBRIDGE
-VMOVD xmmreg,rm32 [rm: vex.128.66.0f.w0 6e /r] AVX,SANDYBRIDGE
-VMOVD rm32,xmmreg [mr: vex.128.66.0f.w0 7e /r] AVX,SANDYBRIDGE
-VMOVQ xmmreg,xmmrm64 [rm: vex.128.f3.0f 7e /r] AVX,SANDYBRIDGE,SQ
-VMOVQ xmmrm64,xmmreg [mr: vex.128.66.0f d6 /r] AVX,SANDYBRIDGE,SQ
-VMOVQ xmmreg,rm64 [rm: vex.128.66.0f.w1 6e /r] AVX,SANDYBRIDGE,LONG,SQ
-VMOVQ rm64,xmmreg [mr: vex.128.66.0f.w1 7e /r] AVX,SANDYBRIDGE,LONG,SQ
-VMOVDDUP xmmreg,xmmrm64 [rm: vex.128.f2.0f 12 /r] AVX,SANDYBRIDGE
-VMOVDDUP ymmreg,ymmrm256 [rm: vex.256.f2.0f 12 /r] AVX,SANDYBRIDGE
-VMOVDQA xmmreg,xmmrm128 [rm: vex.128.66.0f 6f /r] AVX,SANDYBRIDGE
-VMOVDQA xmmrm128,xmmreg [mr: vex.128.66.0f 7f /r] AVX,SANDYBRIDGE
-; These are officially documented as VMOVDQA, but VMOVQQA seems more logical to me...
-VMOVQQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE
-VMOVQQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE
-VMOVDQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE
-VMOVDQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE
-VMOVDQU xmmreg,xmmrm128 [rm: vex.128.f3.0f 6f /r] AVX,SANDYBRIDGE
-VMOVDQU xmmrm128,xmmreg [mr: vex.128.f3.0f 7f /r] AVX,SANDYBRIDGE
-; These are officially documented as VMOVDQU, but VMOVQQU seems more logical to me...
-VMOVQQU ymmreg,ymmrm256 [rm: vex.256.f3.0f 6f /r] AVX,SANDYBRIDGE
-VMOVQQU ymmrm256,ymmreg [mr: vex.256.f3.0f 7f /r] AVX,SANDYBRIDGE
-VMOVDQU ymmreg,ymmrm256 [rm: vex.256.f3.0f 6f /r] AVX,SANDYBRIDGE
-VMOVDQU ymmrm256,ymmreg [mr: vex.256.f3.0f 7f /r] AVX,SANDYBRIDGE
-VMOVHLPS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.128.0f 12 /r] AVX,SANDYBRIDGE
-VMOVHPD xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.66.0f 16 /r] AVX,SANDYBRIDGE
-VMOVHPD mem64,xmmreg [mr: vex.128.66.0f 17 /r] AVX,SANDYBRIDGE
-VMOVHPS xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.0f 16 /r] AVX,SANDYBRIDGE
-VMOVHPS mem64,xmmreg [mr: vex.128.0f 17 /r] AVX,SANDYBRIDGE
-VMOVLHPS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.128.0f 16 /r] AVX,SANDYBRIDGE
-VMOVLPD xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.66.0f 12 /r] AVX,SANDYBRIDGE
-VMOVLPD mem64,xmmreg [mr: vex.128.66.0f 13 /r] AVX,SANDYBRIDGE
-VMOVLPS xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.0f 12 /r] AVX,SANDYBRIDGE
-VMOVLPS mem64,xmmreg [mr: vex.128.0f 13 /r] AVX,SANDYBRIDGE
-VMOVMSKPD reg64,xmmreg [rm: vex.128.66.0f 50 /r] AVX,SANDYBRIDGE,LONG
-VMOVMSKPD reg32,xmmreg [rm: vex.128.66.0f 50 /r] AVX,SANDYBRIDGE
-VMOVMSKPD reg64,ymmreg [rm: vex.256.66.0f 50 /r] AVX,SANDYBRIDGE,LONG
-VMOVMSKPD reg32,ymmreg [rm: vex.256.66.0f 50 /r] AVX,SANDYBRIDGE
-VMOVMSKPS reg64,xmmreg [rm: vex.128.0f 50 /r] AVX,SANDYBRIDGE,LONG
-VMOVMSKPS reg32,xmmreg [rm: vex.128.0f 50 /r] AVX,SANDYBRIDGE
-VMOVMSKPS reg64,ymmreg [rm: vex.256.0f 50 /r] AVX,SANDYBRIDGE,LONG
-VMOVMSKPS reg32,ymmreg [rm: vex.256.0f 50 /r] AVX,SANDYBRIDGE
-VMOVNTDQ mem128,xmmreg [mr: vex.128.66.0f e7 /r] AVX,SANDYBRIDGE
-; Officially VMOVNTDQ, but VMOVNTQQ seems more logical to me...
-VMOVNTQQ mem256,ymmreg [mr: vex.256.66.0f e7 /r] AVX,SANDYBRIDGE
-VMOVNTDQ mem256,ymmreg [mr: vex.256.66.0f e7 /r] AVX,SANDYBRIDGE
-VMOVNTDQA xmmreg,mem128 [rm: vex.128.66.0f38 2a /r] AVX,SANDYBRIDGE
-VMOVNTPD mem128,xmmreg [mr: vex.128.66.0f 2b /r] AVX,SANDYBRIDGE
-VMOVNTPD mem256,ymmreg [mr: vex.256.66.0f 2b /r] AVX,SANDYBRIDGE
-VMOVNTPS mem128,xmmreg [mr: vex.128.0f 2b /r] AVX,SANDYBRIDGE
-VMOVNTPS mem256,ymmreg [mr: vex.256.0f 2b /r] AVX,SANDYBRIDGE
-VMOVSD xmmreg,xmmreg*,xmmreg [rvm: vex.nds.lig.f2.0f 10 /r] AVX,SANDYBRIDGE
-VMOVSD xmmreg,mem64 [rm: vex.lig.f2.0f 10 /r] AVX,SANDYBRIDGE
-VMOVSD xmmreg,xmmreg*,xmmreg [mvr: vex.nds.lig.f2.0f 11 /r] AVX,SANDYBRIDGE
-VMOVSD mem64,xmmreg [mr: vex.lig.f2.0f 11 /r] AVX,SANDYBRIDGE
-VMOVSHDUP xmmreg,xmmrm128 [rm: vex.128.f3.0f 16 /r] AVX,SANDYBRIDGE
-VMOVSHDUP ymmreg,ymmrm256 [rm: vex.256.f3.0f 16 /r] AVX,SANDYBRIDGE
-VMOVSLDUP xmmreg,xmmrm128 [rm: vex.128.f3.0f 12 /r] AVX,SANDYBRIDGE
-VMOVSLDUP ymmreg,ymmrm256 [rm: vex.256.f3.0f 12 /r] AVX,SANDYBRIDGE
-VMOVSS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.lig.f3.0f 10 /r] AVX,SANDYBRIDGE
-VMOVSS xmmreg,mem32 [rm: vex.lig.f3.0f 10 /r] AVX,SANDYBRIDGE
-VMOVSS xmmreg,xmmreg*,xmmreg [mvr: vex.nds.lig.f3.0f 11 /r] AVX,SANDYBRIDGE
-VMOVSS mem32,xmmreg [mr: vex.lig.f3.0f 11 /r] AVX,SANDYBRIDGE
-VMOVUPD xmmreg,xmmrm128 [rm: vex.128.66.0f 10 /r] AVX,SANDYBRIDGE
-VMOVUPD xmmrm128,xmmreg [mr: vex.128.66.0f 11 /r] AVX,SANDYBRIDGE
-VMOVUPD ymmreg,ymmrm256 [rm: vex.256.66.0f 10 /r] AVX,SANDYBRIDGE
-VMOVUPD ymmrm256,ymmreg [mr: vex.256.66.0f 11 /r] AVX,SANDYBRIDGE
-VMOVUPS xmmreg,xmmrm128 [rm: vex.128.0f 10 /r] AVX,SANDYBRIDGE
-VMOVUPS xmmrm128,xmmreg [mr: vex.128.0f 11 /r] AVX,SANDYBRIDGE
-VMOVUPS ymmreg,ymmrm256 [rm: vex.256.0f 10 /r] AVX,SANDYBRIDGE
-VMOVUPS ymmrm256,ymmreg [mr: vex.256.0f 11 /r] AVX,SANDYBRIDGE
-VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 42 /r ib] AVX,SANDYBRIDGE
-VMULPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 59 /r] AVX,SANDYBRIDGE
-VMULPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 59 /r] AVX,SANDYBRIDGE
-VMULPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 59 /r] AVX,SANDYBRIDGE
-VMULPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 59 /r] AVX,SANDYBRIDGE
-VMULSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 59 /r] AVX,SANDYBRIDGE
-VMULSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 59 /r] AVX,SANDYBRIDGE
-VORPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 56 /r] AVX,SANDYBRIDGE
-VORPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 56 /r] AVX,SANDYBRIDGE
-VORPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 56 /r] AVX,SANDYBRIDGE
-VORPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 56 /r] AVX,SANDYBRIDGE
-VPABSB xmmreg,xmmrm128 [rm: vex.128.66.0f38 1c /r] AVX,SANDYBRIDGE
-VPABSW xmmreg,xmmrm128 [rm: vex.128.66.0f38 1d /r] AVX,SANDYBRIDGE
-VPABSD xmmreg,xmmrm128 [rm: vex.128.66.0f38 1e /r] AVX,SANDYBRIDGE
-VPACKSSWB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 63 /r] AVX,SANDYBRIDGE
-VPACKSSDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6b /r] AVX,SANDYBRIDGE
-VPACKUSWB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 67 /r] AVX,SANDYBRIDGE
-VPACKUSDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 2b /r] AVX,SANDYBRIDGE
-VPADDB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fc /r] AVX,SANDYBRIDGE
-VPADDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fd /r] AVX,SANDYBRIDGE
-VPADDD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fe /r] AVX,SANDYBRIDGE
-VPADDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d4 /r] AVX,SANDYBRIDGE
-VPADDSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ec /r] AVX,SANDYBRIDGE
-VPADDSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ed /r] AVX,SANDYBRIDGE
-VPADDUSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f dc /r] AVX,SANDYBRIDGE
-VPADDUSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f dd /r] AVX,SANDYBRIDGE
-VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0f /r ib] AVX,SANDYBRIDGE
-VPAND xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f db /r] AVX,SANDYBRIDGE
-VPANDN xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f df /r] AVX,SANDYBRIDGE
-VPAVGB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e0 /r] AVX,SANDYBRIDGE
-VPAVGW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e3 /r] AVX,SANDYBRIDGE
-VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4c /r /is4] AVX,SANDYBRIDGE
-VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0e /r ib] AVX,SANDYBRIDGE
-VPCMPESTRI xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 61 /r ib] AVX,SANDYBRIDGE
-VPCMPESTRM xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 60 /r ib] AVX,SANDYBRIDGE
-VPCMPISTRI xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 63 /r ib] AVX,SANDYBRIDGE
-VPCMPISTRM xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 62 /r ib] AVX,SANDYBRIDGE
-VPCMPEQB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 74 /r] AVX,SANDYBRIDGE
-VPCMPEQW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 75 /r] AVX,SANDYBRIDGE
-VPCMPEQD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 76 /r] AVX,SANDYBRIDGE
-VPCMPEQQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 29 /r] AVX,SANDYBRIDGE
-VPCMPGTB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 64 /r] AVX,SANDYBRIDGE
-VPCMPGTW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 65 /r] AVX,SANDYBRIDGE
-VPCMPGTD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 66 /r] AVX,SANDYBRIDGE
-VPCMPGTQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 37 /r] AVX,SANDYBRIDGE
-VPERMILPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 0d /r] AVX,SANDYBRIDGE
-VPERMILPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 0d /r] AVX,SANDYBRIDGE
-VPERMILPD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a.w0 05 /r ib] AVX,SANDYBRIDGE
-VPERMILPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w0 05 /r ib] AVX,SANDYBRIDGE
-VPERMILPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 0c /r] AVX,SANDYBRIDGE
-VPERMILPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 0c /r] AVX,SANDYBRIDGE
-VPERMILPS xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a.w0 04 /r ib] AVX,SANDYBRIDGE
-VPERMILPS ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w0 04 /r ib] AVX,SANDYBRIDGE
-VPERM2F128 ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 06 /r ib] AVX,SANDYBRIDGE
-VPEXTRB reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE,LONG
-VPEXTRB reg32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE
-VPEXTRB mem8,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE
-VPEXTRW reg64,xmmreg,imm8 [rmi: vex.128.66.0f.w0 c5 /r ib] AVX,SANDYBRIDGE,LONG
-VPEXTRW reg32,xmmreg,imm8 [rmi: vex.128.66.0f.w0 c5 /r ib] AVX,SANDYBRIDGE
-VPEXTRW reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE,LONG
-VPEXTRW reg32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE
-VPEXTRW mem16,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE
-VPEXTRD reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 16 /r ib] AVX,SANDYBRIDGE,LONG
-VPEXTRD rm32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 16 /r ib] AVX,SANDYBRIDGE
-VPEXTRQ rm64,xmmreg,imm8 [mri: vex.128.66.0f3a.w1 16 /r ib] AVX,SANDYBRIDGE,LONG
-VPHADDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 01 /r] AVX,SANDYBRIDGE
-VPHADDD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 02 /r] AVX,SANDYBRIDGE
-VPHADDSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 03 /r] AVX,SANDYBRIDGE
-VPHMINPOSUW xmmreg,xmmrm128 [rm: vex.128.66.0f38 41 /r] AVX,SANDYBRIDGE
-VPHSUBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 05 /r] AVX,SANDYBRIDGE
-VPHSUBD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 06 /r] AVX,SANDYBRIDGE
-VPHSUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 07 /r] AVX,SANDYBRIDGE
-VPINSRB xmmreg,xmmreg*,mem8,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
-VPINSRB xmmreg,xmmreg*,rm8,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
-VPINSRB xmmreg,xmmreg*,reg32,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
-VPINSRW xmmreg,xmmreg*,mem16,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
-VPINSRW xmmreg,xmmreg*,rm16,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
-VPINSRW xmmreg,xmmreg*,reg32,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
-VPINSRD xmmreg,xmmreg*,mem32,imm8 [rvmi: vex.nds.128.66.0f3a.w0 22 /r ib] AVX,SANDYBRIDGE
-VPINSRD xmmreg,xmmreg*,rm32,imm8 [rvmi: vex.nds.128.66.0f3a.w0 22 /r ib] AVX,SANDYBRIDGE
-VPINSRQ xmmreg,xmmreg*,mem64,imm8 [rvmi: vex.nds.128.66.0f3a.w1 22 /r ib] AVX,SANDYBRIDGE,LONG
-VPINSRQ xmmreg,xmmreg*,rm64,imm8 [rvmi: vex.nds.128.66.0f3a.w1 22 /r ib] AVX,SANDYBRIDGE,LONG
-VPMADDWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f5 /r] AVX,SANDYBRIDGE
-VPMADDUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 04 /r] AVX,SANDYBRIDGE
-VPMAXSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3c /r] AVX,SANDYBRIDGE
-VPMAXSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ee /r] AVX,SANDYBRIDGE
-VPMAXSD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3d /r] AVX,SANDYBRIDGE
-VPMAXUB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f de /r] AVX,SANDYBRIDGE
-VPMAXUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3e /r] AVX,SANDYBRIDGE
-VPMAXUD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3f /r] AVX,SANDYBRIDGE
-VPMINSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 38 /r] AVX,SANDYBRIDGE
-VPMINSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ea /r] AVX,SANDYBRIDGE
-VPMINSD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 39 /r] AVX,SANDYBRIDGE
-VPMINUB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f da /r] AVX,SANDYBRIDGE
-VPMINUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3a /r] AVX,SANDYBRIDGE
-VPMINUD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3b /r] AVX,SANDYBRIDGE
-VPMOVMSKB reg64,xmmreg [rm: vex.128.66.0f d7 /r] AVX,SANDYBRIDGE,LONG
-VPMOVMSKB reg32,xmmreg [rm: vex.128.66.0f d7 /r] AVX,SANDYBRIDGE
-VPMOVSXBW xmmreg,xmmrm64 [rm: vex.128.66.0f38 20 /r] AVX,SANDYBRIDGE
-VPMOVSXBD xmmreg,xmmrm32 [rm: vex.128.66.0f38 21 /r] AVX,SANDYBRIDGE
-VPMOVSXBQ xmmreg,xmmrm16 [rm: vex.128.66.0f38 22 /r] AVX,SANDYBRIDGE
-VPMOVSXWD xmmreg,xmmrm64 [rm: vex.128.66.0f38 23 /r] AVX,SANDYBRIDGE
-VPMOVSXWQ xmmreg,xmmrm32 [rm: vex.128.66.0f38 24 /r] AVX,SANDYBRIDGE
-VPMOVSXDQ xmmreg,xmmrm64 [rm: vex.128.66.0f38 25 /r] AVX,SANDYBRIDGE
-VPMOVZXBW xmmreg,xmmrm64 [rm: vex.128.66.0f38 30 /r] AVX,SANDYBRIDGE
-VPMOVZXBD xmmreg,xmmrm32 [rm: vex.128.66.0f38 31 /r] AVX,SANDYBRIDGE
-VPMOVZXBQ xmmreg,xmmrm16 [rm: vex.128.66.0f38 32 /r] AVX,SANDYBRIDGE
-VPMOVZXWD xmmreg,xmmrm64 [rm: vex.128.66.0f38 33 /r] AVX,SANDYBRIDGE
-VPMOVZXWQ xmmreg,xmmrm32 [rm: vex.128.66.0f38 34 /r] AVX,SANDYBRIDGE
-VPMOVZXDQ xmmreg,xmmrm64 [rm: vex.128.66.0f38 35 /r] AVX,SANDYBRIDGE
-VPMULHUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e4 /r] AVX,SANDYBRIDGE
-VPMULHRSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 0b /r] AVX,SANDYBRIDGE
-VPMULHW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e5 /r] AVX,SANDYBRIDGE
-VPMULLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d5 /r] AVX,SANDYBRIDGE
-VPMULLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 40 /r] AVX,SANDYBRIDGE
-VPMULUDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f4 /r] AVX,SANDYBRIDGE
-VPMULDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 28 /r] AVX,SANDYBRIDGE
-VPOR xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f eb /r] AVX,SANDYBRIDGE
-VPSADBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f6 /r] AVX,SANDYBRIDGE
-VPSHUFB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 00 /r] AVX,SANDYBRIDGE
-VPSHUFD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f 70 /r ib] AVX,SANDYBRIDGE
-VPSHUFHW xmmreg,xmmrm128,imm8 [rmi: vex.128.f3.0f 70 /r ib] AVX,SANDYBRIDGE
-VPSHUFLW xmmreg,xmmrm128,imm8 [rmi: vex.128.f2.0f 70 /r ib] AVX,SANDYBRIDGE
-VPSIGNB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 08 /r] AVX,SANDYBRIDGE
-VPSIGNW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 09 /r] AVX,SANDYBRIDGE
-VPSIGND xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 0a /r] AVX,SANDYBRIDGE
-VPSLLDQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /7 ib] AVX,SANDYBRIDGE
-VPSRLDQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /3 ib] AVX,SANDYBRIDGE
-VPSLLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f1 /r] AVX,SANDYBRIDGE
-VPSLLW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /6 ib] AVX,SANDYBRIDGE
-VPSLLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f2 /r] AVX,SANDYBRIDGE
-VPSLLD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /6 ib] AVX,SANDYBRIDGE
-VPSLLQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f3 /r] AVX,SANDYBRIDGE
-VPSLLQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /6 ib] AVX,SANDYBRIDGE
-VPSRAW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e1 /r] AVX,SANDYBRIDGE
-VPSRAW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /4 ib] AVX,SANDYBRIDGE
-VPSRAD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e2 /r] AVX,SANDYBRIDGE
-VPSRAD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /4 ib] AVX,SANDYBRIDGE
-VPSRLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d1 /r] AVX,SANDYBRIDGE
-VPSRLW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /2 ib] AVX,SANDYBRIDGE
-VPSRLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d2 /r] AVX,SANDYBRIDGE
-VPSRLD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /2 ib] AVX,SANDYBRIDGE
-VPSRLQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d3 /r] AVX,SANDYBRIDGE
-VPSRLQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /2 ib] AVX,SANDYBRIDGE
-VPTEST xmmreg,xmmrm128 [rm: vex.128.66.0f38 17 /r] AVX,SANDYBRIDGE
-VPTEST ymmreg,ymmrm256 [rm: vex.256.66.0f38 17 /r] AVX,SANDYBRIDGE
-VPSUBB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f8 /r] AVX,SANDYBRIDGE
-VPSUBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f9 /r] AVX,SANDYBRIDGE
-VPSUBD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fa /r] AVX,SANDYBRIDGE
-VPSUBQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fb /r] AVX,SANDYBRIDGE
-VPSUBSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e8 /r] AVX,SANDYBRIDGE
-VPSUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e9 /r] AVX,SANDYBRIDGE
-VPSUBUSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d8 /r] AVX,SANDYBRIDGE
-VPSUBUSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d9 /r] AVX,SANDYBRIDGE
-VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 68 /r] AVX,SANDYBRIDGE
-VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 69 /r] AVX,SANDYBRIDGE
-VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6a /r] AVX,SANDYBRIDGE
-VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6d /r] AVX,SANDYBRIDGE
-VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 60 /r] AVX,SANDYBRIDGE
-VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 61 /r] AVX,SANDYBRIDGE
-VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 62 /r] AVX,SANDYBRIDGE
-VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6c /r] AVX,SANDYBRIDGE
-VPXOR xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ef /r] AVX,SANDYBRIDGE
-VRCPPS xmmreg,xmmrm128 [rm: vex.128.0f 53 /r] AVX,SANDYBRIDGE
-VRCPPS ymmreg,ymmrm256 [rm: vex.256.0f 53 /r] AVX,SANDYBRIDGE
-VRCPSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 53 /r] AVX,SANDYBRIDGE
-VRSQRTPS xmmreg,xmmrm128 [rm: vex.128.0f 52 /r] AVX,SANDYBRIDGE
-VRSQRTPS ymmreg,ymmrm256 [rm: vex.256.0f 52 /r] AVX,SANDYBRIDGE
-VRSQRTSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 52 /r] AVX,SANDYBRIDGE
-VROUNDPD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 09 /r ib] AVX,SANDYBRIDGE
-VROUNDPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a 09 /r ib] AVX,SANDYBRIDGE
-VROUNDPS xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 08 /r ib] AVX,SANDYBRIDGE
-VROUNDPS ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a 08 /r ib] AVX,SANDYBRIDGE
-VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.128.66.0f3a 0b /r ib] AVX,SANDYBRIDGE
-VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi: vex.nds.128.66.0f3a 0a /r ib] AVX,SANDYBRIDGE
-VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f c6 /r ib] AVX,SANDYBRIDGE
-VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f c6 /r ib] AVX,SANDYBRIDGE
-VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.0f c6 /r ib] AVX,SANDYBRIDGE
-VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.0f c6 /r ib] AVX,SANDYBRIDGE
-VSQRTPD xmmreg,xmmrm128 [rm: vex.128.66.0f 51 /r] AVX,SANDYBRIDGE
-VSQRTPD ymmreg,ymmrm256 [rm: vex.256.66.0f 51 /r] AVX,SANDYBRIDGE
-VSQRTPS xmmreg,xmmrm128 [rm: vex.128.0f 51 /r] AVX,SANDYBRIDGE
-VSQRTPS ymmreg,ymmrm256 [rm: vex.256.0f 51 /r] AVX,SANDYBRIDGE
-VSQRTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 51 /r] AVX,SANDYBRIDGE
-VSQRTSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 51 /r] AVX,SANDYBRIDGE
-VSTMXCSR mem32 [m: vex.128.0f ae /3] AVX,SANDYBRIDGE
-VSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5c /r] AVX,SANDYBRIDGE
-VSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5c /r] AVX,SANDYBRIDGE
-VSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5c /r] AVX,SANDYBRIDGE
-VSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5c /r] AVX,SANDYBRIDGE
-VSUBSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5c /r] AVX,SANDYBRIDGE
-VSUBSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5c /r] AVX,SANDYBRIDGE
-VTESTPS xmmreg,xmmrm128 [rm: vex.128.66.0f38.w0 0e /r] AVX,SANDYBRIDGE
-VTESTPS ymmreg,ymmrm256 [rm: vex.256.66.0f38.w0 0e /r] AVX,SANDYBRIDGE
-VTESTPD xmmreg,xmmrm128 [rm: vex.128.66.0f38.w0 0f /r] AVX,SANDYBRIDGE
-VTESTPD ymmreg,ymmrm256 [rm: vex.256.66.0f38.w0 0f /r] AVX,SANDYBRIDGE
-VUCOMISD xmmreg,xmmrm64 [rm: vex.lig.66.0f 2e /r] AVX,SANDYBRIDGE
-VUCOMISS xmmreg,xmmrm32 [rm: vex.lig.0f 2e /r] AVX,SANDYBRIDGE
-VUNPCKHPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 15 /r] AVX,SANDYBRIDGE
-VUNPCKHPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 15 /r] AVX,SANDYBRIDGE
-VUNPCKHPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 15 /r] AVX,SANDYBRIDGE
-VUNPCKHPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 15 /r] AVX,SANDYBRIDGE
-VUNPCKLPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 14 /r] AVX,SANDYBRIDGE
-VUNPCKLPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 14 /r] AVX,SANDYBRIDGE
-VUNPCKLPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 14 /r] AVX,SANDYBRIDGE
-VUNPCKLPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 14 /r] AVX,SANDYBRIDGE
-VXORPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 57 /r] AVX,SANDYBRIDGE
-VXORPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 57 /r] AVX,SANDYBRIDGE
-VXORPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 57 /r] AVX,SANDYBRIDGE
-VXORPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 57 /r] AVX,SANDYBRIDGE
-VZEROALL void [ vex.256.0f.w0 77] AVX,SANDYBRIDGE
-VZEROUPPER void [ vex.128.0f.w0 77] AVX,SANDYBRIDGE
-
-;# Intel Carry-Less Multiplication instructions (CLMUL)
-PCLMULLQLQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 00] SSE,WESTMERE
-PCLMULHQLQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 01] SSE,WESTMERE
-PCLMULLQHQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 10] SSE,WESTMERE
-PCLMULHQHQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 11] SSE,WESTMERE
-PCLMULQDQ xmmreg,xmmrm128,imm8 [rmi: 66 0f 3a 44 /r ib] SSE,WESTMERE
-
-;# Intel AVX Carry-Less Multiplication instructions (CLMUL)
-VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 00] AVX,SANDYBRIDGE
-VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 01] AVX,SANDYBRIDGE
-VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 10] AVX,SANDYBRIDGE
-VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 11] AVX,SANDYBRIDGE
-VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 44 /r ib] AVX,SANDYBRIDGE
-
-;# Intel Fused Multiply-Add instructions (FMA)
-VFMADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 98 /r] FMA,FUTURE
-VFMADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 98 /r] FMA,FUTURE
-VFMADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 98 /r] FMA,FUTURE
-VFMADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 98 /r] FMA,FUTURE
-VFMADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 98 /r] FMA,FUTURE
-VFMADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 98 /r] FMA,FUTURE
-VFMADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 98 /r] FMA,FUTURE
-VFMADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 98 /r] FMA,FUTURE
-VFMADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a8 /r] FMA,FUTURE
-VFMADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a8 /r] FMA,FUTURE
-VFMADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a8 /r] FMA,FUTURE
-VFMADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a8 /r] FMA,FUTURE
-VFMADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a8 /r] FMA,FUTURE
-VFMADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a8 /r] FMA,FUTURE
-VFMADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a8 /r] FMA,FUTURE
-VFMADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a8 /r] FMA,FUTURE
-VFMADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b8 /r] FMA,FUTURE
-VFMADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b8 /r] FMA,FUTURE
-VFMADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b8 /r] FMA,FUTURE
-VFMADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b8 /r] FMA,FUTURE
-VFMADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b8 /r] FMA,FUTURE
-VFMADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b8 /r] FMA,FUTURE
-VFMADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b8 /r] FMA,FUTURE
-VFMADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b8 /r] FMA,FUTURE
-VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 96 /r] FMA,FUTURE
-VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 96 /r] FMA,FUTURE
-VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 96 /r] FMA,FUTURE
-VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 96 /r] FMA,FUTURE
-VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 96 /r] FMA,FUTURE
-VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 96 /r] FMA,FUTURE
-VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 96 /r] FMA,FUTURE
-VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 96 /r] FMA,FUTURE
-VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a6 /r] FMA,FUTURE
-VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a6 /r] FMA,FUTURE
-VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a6 /r] FMA,FUTURE
-VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a6 /r] FMA,FUTURE
-VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a6 /r] FMA,FUTURE
-VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a6 /r] FMA,FUTURE
-VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a6 /r] FMA,FUTURE
-VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a6 /r] FMA,FUTURE
-VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b6 /r] FMA,FUTURE
-VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b6 /r] FMA,FUTURE
-VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b6 /r] FMA,FUTURE
-VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b6 /r] FMA,FUTURE
-VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b6 /r] FMA,FUTURE
-VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b6 /r] FMA,FUTURE
-VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b6 /r] FMA,FUTURE
-VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b6 /r] FMA,FUTURE
-VFMSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9a /r] FMA,FUTURE
-VFMSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9a /r] FMA,FUTURE
-VFMSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9a /r] FMA,FUTURE
-VFMSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9a /r] FMA,FUTURE
-VFMSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9a /r] FMA,FUTURE
-VFMSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9a /r] FMA,FUTURE
-VFMSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9a /r] FMA,FUTURE
-VFMSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9a /r] FMA,FUTURE
-VFMSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 aa /r] FMA,FUTURE
-VFMSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 aa /r] FMA,FUTURE
-VFMSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 aa /r] FMA,FUTURE
-VFMSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 aa /r] FMA,FUTURE
-VFMSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 aa /r] FMA,FUTURE
-VFMSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 aa /r] FMA,FUTURE
-VFMSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 aa /r] FMA,FUTURE
-VFMSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 aa /r] FMA,FUTURE
-VFMSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ba /r] FMA,FUTURE
-VFMSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ba /r] FMA,FUTURE
-VFMSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ba /r] FMA,FUTURE
-VFMSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ba /r] FMA,FUTURE
-VFMSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ba /r] FMA,FUTURE
-VFMSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ba /r] FMA,FUTURE
-VFMSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ba /r] FMA,FUTURE
-VFMSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ba /r] FMA,FUTURE
-VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 97 /r] FMA,FUTURE
-VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 97 /r] FMA,FUTURE
-VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 97 /r] FMA,FUTURE
-VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 97 /r] FMA,FUTURE
-VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 97 /r] FMA,FUTURE
-VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 97 /r] FMA,FUTURE
-VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 97 /r] FMA,FUTURE
-VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 97 /r] FMA,FUTURE
-VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a7 /r] FMA,FUTURE
-VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a7 /r] FMA,FUTURE
-VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a7 /r] FMA,FUTURE
-VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a7 /r] FMA,FUTURE
-VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a7 /r] FMA,FUTURE
-VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a7 /r] FMA,FUTURE
-VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a7 /r] FMA,FUTURE
-VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a7 /r] FMA,FUTURE
-VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b7 /r] FMA,FUTURE
-VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b7 /r] FMA,FUTURE
-VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b7 /r] FMA,FUTURE
-VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b7 /r] FMA,FUTURE
-VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b7 /r] FMA,FUTURE
-VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b7 /r] FMA,FUTURE
-VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b7 /r] FMA,FUTURE
-VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b7 /r] FMA,FUTURE
-VFNMADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9c /r] FMA,FUTURE
-VFNMADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9c /r] FMA,FUTURE
-VFNMADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9c /r] FMA,FUTURE
-VFNMADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9c /r] FMA,FUTURE
-VFNMADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9c /r] FMA,FUTURE
-VFNMADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9c /r] FMA,FUTURE
-VFNMADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9c /r] FMA,FUTURE
-VFNMADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9c /r] FMA,FUTURE
-VFNMADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ac /r] FMA,FUTURE
-VFNMADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ac /r] FMA,FUTURE
-VFNMADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ac /r] FMA,FUTURE
-VFNMADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ac /r] FMA,FUTURE
-VFNMADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ac /r] FMA,FUTURE
-VFNMADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ac /r] FMA,FUTURE
-VFNMADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ac /r] FMA,FUTURE
-VFNMADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ac /r] FMA,FUTURE
-VFNMADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 bc /r] FMA,FUTURE
-VFNMADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 bc /r] FMA,FUTURE
-VFNMADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 bc /r] FMA,FUTURE
-VFNMADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 bc /r] FMA,FUTURE
-VFNMADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 bc /r] FMA,FUTURE
-VFNMADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 bc /r] FMA,FUTURE
-VFNMADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 bc /r] FMA,FUTURE
-VFNMADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 bc /r] FMA,FUTURE
-VFNMSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9e /r] FMA,FUTURE
-VFNMSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9e /r] FMA,FUTURE
-VFNMSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9e /r] FMA,FUTURE
-VFNMSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9e /r] FMA,FUTURE
-VFNMSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9e /r] FMA,FUTURE
-VFNMSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9e /r] FMA,FUTURE
-VFNMSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9e /r] FMA,FUTURE
-VFNMSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9e /r] FMA,FUTURE
-VFNMSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ae /r] FMA,FUTURE
-VFNMSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ae /r] FMA,FUTURE
-VFNMSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ae /r] FMA,FUTURE
-VFNMSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ae /r] FMA,FUTURE
-VFNMSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ae /r] FMA,FUTURE
-VFNMSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ae /r] FMA,FUTURE
-VFNMSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ae /r] FMA,FUTURE
-VFNMSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ae /r] FMA,FUTURE
-VFNMSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 be /r] FMA,FUTURE
-VFNMSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 be /r] FMA,FUTURE
-VFNMSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 be /r] FMA,FUTURE
-VFNMSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 be /r] FMA,FUTURE
-VFNMSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 be /r] FMA,FUTURE
-VFNMSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 be /r] FMA,FUTURE
-VFNMSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 be /r] FMA,FUTURE
-VFNMSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 be /r] FMA,FUTURE
-VFMADD132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 99 /r] FMA,FUTURE
-VFMADD132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 99 /r] FMA,FUTURE
-VFMADD312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 99 /r] FMA,FUTURE
-VFMADD312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 99 /r] FMA,FUTURE
-VFMADD213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 a9 /r] FMA,FUTURE
-VFMADD213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 a9 /r] FMA,FUTURE
-VFMADD123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 a9 /r] FMA,FUTURE
-VFMADD123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 a9 /r] FMA,FUTURE
-VFMADD231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 b9 /r] FMA,FUTURE
-VFMADD231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 b9 /r] FMA,FUTURE
-VFMADD321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 b9 /r] FMA,FUTURE
-VFMADD321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 b9 /r] FMA,FUTURE
-VFMSUB132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9b /r] FMA,FUTURE
-VFMSUB132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9b /r] FMA,FUTURE
-VFMSUB312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9b /r] FMA,FUTURE
-VFMSUB312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9b /r] FMA,FUTURE
-VFMSUB213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ab /r] FMA,FUTURE
-VFMSUB213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ab /r] FMA,FUTURE
-VFMSUB123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ab /r] FMA,FUTURE
-VFMSUB123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ab /r] FMA,FUTURE
-VFMSUB231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bb /r] FMA,FUTURE
-VFMSUB231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bb /r] FMA,FUTURE
-VFMSUB321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bb /r] FMA,FUTURE
-VFMSUB321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bb /r] FMA,FUTURE
-VFNMADD132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9d /r] FMA,FUTURE
-VFNMADD132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9d /r] FMA,FUTURE
-VFNMADD312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9d /r] FMA,FUTURE
-VFNMADD312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9d /r] FMA,FUTURE
-VFNMADD213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ad /r] FMA,FUTURE
-VFNMADD213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ad /r] FMA,FUTURE
-VFNMADD123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ad /r] FMA,FUTURE
-VFNMADD123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ad /r] FMA,FUTURE
-VFNMADD231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bd /r] FMA,FUTURE
-VFNMADD231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bd /r] FMA,FUTURE
-VFNMADD321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bd /r] FMA,FUTURE
-VFNMADD321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bd /r] FMA,FUTURE
-VFNMSUB132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9f /r] FMA,FUTURE
-VFNMSUB132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9f /r] FMA,FUTURE
-VFNMSUB312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9f /r] FMA,FUTURE
-VFNMSUB312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9f /r] FMA,FUTURE
-VFNMSUB213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 af /r] FMA,FUTURE
-VFNMSUB213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 af /r] FMA,FUTURE
-VFNMSUB123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 af /r] FMA,FUTURE
-VFNMSUB123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 af /r] FMA,FUTURE
-VFNMSUB231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bf /r] FMA,FUTURE
-VFNMSUB231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bf /r] FMA,FUTURE
-VFNMSUB321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bf /r] FMA,FUTURE
-VFNMSUB321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bf /r] FMA,FUTURE
-
-;# Intel post-32 nm processor instructions
-;
-; Per AVX spec revision 7, document 319433-007
-RDFSBASE reg32 [m: norexw f3 0f ae /0] LONG,FUTURE
-RDFSBASE reg64 [m: o64 f3 0f ae /0] LONG,FUTURE
-RDGSBASE reg32 [m: norexw f3 0f ae /1] LONG,FUTURE
-RDGSBASE reg64 [m: o64 f3 0f ae /1] LONG,FUTURE
-RDRAND reg16 [m: o16 0f c7 /6] FUTURE
-RDRAND reg32 [m: o32 0f c7 /6] FUTURE
-RDRAND reg64 [m: o64 0f c7 /6] LONG,FUTURE
-WRFSBASE reg32 [m: norexw f3 0f ae /2] LONG,FUTURE
-WRFSBASE reg64 [m: o64 f3 0f ae /2] LONG,FUTURE
-WRGSBASE reg32 [m: norexw f3 0f ae /3] LONG,FUTURE
-WRGSBASE reg64 [m: o64 f3 0f ae /3] LONG,FUTURE
-VCVTPH2PS ymmreg,xmmrm128 [rm: vex.256.66.0f38.w0 13 /r] AVX,FUTURE
-VCVTPH2PS xmmreg,xmmrm64 [rm: vex.128.66.0f38.w0 13 /r] AVX,FUTURE
-VCVTPS2PH xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 1d /r ib] AVX,FUTURE
-VCVTPS2PH xmmrm64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 1d /r ib] AVX,FUTURE
-
-; Per AVX spec revision 13, document 319433-013
-ADCX reg32,rm32 [rm: norexw 66 0f 38 f6 /r] FUTURE
-ADCX reg64,rm64 [rm: o64 66 0f 38 f6 /r] LONG,FUTURE
-ADOX reg32,rm32 [rm: norexw f3 0f 38 f6 /r] FUTURE
-ADOX reg64,rm64 [rm: o64 f3 0f 38 f6 /r] LONG,FUTURE
-RDSEED reg16 [m: o16 0f c7 /7] FUTURE
-RDSEED reg32 [m: o32 0f c7 /7] FUTURE
-RDSEED reg64 [m: o64 0f c7 /7] LONG,FUTURE
-
-; Per AVX spec revision 14, document 319433-014
-CLAC void [ 0f 01 ca] PRIV,FUTURE
-STAC void [ 0f 01 cb] PRIV,FUTURE
-
-;# VIA (Centaur) security instructions
-XSTORE void [ 0f a7 c0] PENT,CYRIX
-XCRYPTECB void [ mustrep 0f a7 c8] PENT,CYRIX
-XCRYPTCBC void [ mustrep 0f a7 d0] PENT,CYRIX
-XCRYPTCTR void [ mustrep 0f a7 d8] PENT,CYRIX
-XCRYPTCFB void [ mustrep 0f a7 e0] PENT,CYRIX
-XCRYPTOFB void [ mustrep 0f a7 e8] PENT,CYRIX
-MONTMUL void [ mustrep 0f a6 c0] PENT,CYRIX
-XSHA1 void [ mustrep 0f a6 c8] PENT,CYRIX
-XSHA256 void [ mustrep 0f a6 d0] PENT,CYRIX
-
-;# AMD Lightweight Profiling (LWP) instructions
-;
-; based on pub number 43724 revision 3.04 date August 2009
-;
-; updated to match draft from AMD developer (patch has been
-; sent to binutils
-; 2010-03-22 Quentin Neill <quentin.neill@amd.com>
-; Sebastian Pop <sebastian.pop@amd.com>
-;
-LLWPCB reg32 [m: xop.m9.w0.l0.p0 12 /0] AMD,386
-LLWPCB reg64 [m: xop.m9.w1.l0.p0 12 /0] AMD,X64
-
-SLWPCB reg32 [m: xop.m9.w0.l0.p0 12 /1] AMD,386
-SLWPCB reg64 [m: xop.m9.w1.l0.p0 12 /1] AMD,X64
-
-LWPVAL reg32,rm32,imm32 [vmi: xop.m10.w0.ndd.l0.p0 12 /1 id] AMD,386
-LWPVAL reg64,rm32,imm32 [vmi: xop.m10.w1.ndd.l0.p0 12 /1 id] AMD,X64
-
-LWPINS reg32,rm32,imm32 [vmi: xop.m10.w0.ndd.l0.p0 12 /0 id] AMD,386
-LWPINS reg64,rm32,imm32 [vmi: xop.m10.w1.ndd.l0.p0 12 /0 id] AMD,X64
-
-;# AMD XOP and FMA4 instructions (SSE5)
-;
-; based on pub number 43479 revision 3.04 dated November 2009
-;
-VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 69 /r /is4] AMD,SSE5
-VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 69 /r /is4] AMD,SSE5
-VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 69 /r /is4] AMD,SSE5
-VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 69 /r /is4] AMD,SSE5
-
-VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 68 /r /is4] AMD,SSE5
-VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 68 /r /is4] AMD,SSE5
-VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 68 /r /is4] AMD,SSE5
-VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 68 /r /is4] AMD,SSE5
-
-VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6b /r /is4] AMD,SSE5
-VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 6b /r /is4] AMD,SSE5
-
-VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6a /r /is4] AMD,SSE5
-VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 6a /r /is4] AMD,SSE5
-
-VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5d /r /is4] AMD,SSE5
-VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5d /r /is4] AMD,SSE5
-VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5d /r /is4] AMD,SSE5
-VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5d /r /is4] AMD,SSE5
-
-VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5c /r /is4] AMD,SSE5
-VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5c /r /is4] AMD,SSE5
-VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5c /r /is4] AMD,SSE5
-VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5c /r /is4] AMD,SSE5
-
-VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5f /r /is4] AMD,SSE5
-VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5f /r /is4] AMD,SSE5
-VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5f /r /is4] AMD,SSE5
-VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5f /r /is4] AMD,SSE5
-
-VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5e /r /is4] AMD,SSE5
-VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5e /r /is4] AMD,SSE5
-VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5e /r /is4] AMD,SSE5
-VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5e /r /is4] AMD,SSE5
-
-VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6d /r /is4] AMD,SSE5
-VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 6d /r /is4] AMD,SSE5
-VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 6d /r /is4] AMD,SSE5
-VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 6d /r /is4] AMD,SSE5
-
-VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6c /r /is4] AMD,SSE5
-VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 6c /r /is4] AMD,SSE5
-VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 6c /r /is4] AMD,SSE5
-VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 6c /r /is4] AMD,SSE5
-
-VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6f /r /is4] AMD,SSE5
-VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 6f /r /is4] AMD,SSE5
-
-VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6e /r /is4] AMD,SSE5
-VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 6e /r /is4] AMD,SSE5
-
-VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 79 /r /is4] AMD,SSE5
-VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 79 /r /is4] AMD,SSE5
-VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 79 /r /is4] AMD,SSE5
-VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 79 /r /is4] AMD,SSE5
-
-VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 78 /r /is4] AMD,SSE5
-VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 78 /r /is4] AMD,SSE5
-VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 78 /r /is4] AMD,SSE5
-VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 78 /r /is4] AMD,SSE5
-
-VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7b /r /is4] AMD,SSE5
-VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 7b /r /is4] AMD,SSE5
-
-VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7a /r /is4] AMD,SSE5
-VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 7a /r /is4] AMD,SSE5
-
-VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7d /r /is4] AMD,SSE5
-VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 7d /r /is4] AMD,SSE5
-VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 7d /r /is4] AMD,SSE5
-VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 7d /r /is4] AMD,SSE5
-
-VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7c /r /is4] AMD,SSE5
-VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 7c /r /is4] AMD,SSE5
-VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 7c /r /is4] AMD,SSE5
-VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 7c /r /is4] AMD,SSE5
-
-VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7f /r /is4] AMD,SSE5
-VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 7f /r /is4] AMD,SSE5
-
-VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7e /r /is4] AMD,SSE5
-VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 7e /r /is4] AMD,SSE5
-
-VFRCZPD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 81 /r] AMD,SSE5
-VFRCZPD ymmreg,ymmrm256* [rm: xop.m9.w0.l1.p0 81 /r] AMD,SSE5
-
-VFRCZPS xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 80 /r] AMD,SSE5
-VFRCZPS ymmreg,ymmrm256* [rm: xop.m9.w0.l1.p0 80 /r] AMD,SSE5
-
-VFRCZSD xmmreg,xmmrm64* [rm: xop.m9.w0.l0.p0 83 /r] AMD,SSE5
-
-VFRCZSS xmmreg,xmmrm32* [rm: xop.m9.w0.l0.p0 82 /r] AMD,SSE5
-;
-; fixed: spec mention imm[7:4] though it should be /is4 even in spec
-VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a2 /r /is4] AMD,SSE5
-VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: xop.m8.w0.nds.l1.p0 a2 /r /is4] AMD,SSE5
-VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: xop.m8.w1.nds.l0.p0 a2 /r /is4] AMD,SSE5
-VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: xop.m8.w1.nds.l1.p0 a2 /r /is4] AMD,SSE5
-
-VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cc /r ib] AMD,SSE5
-VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ce /r ib] AMD,SSE5
-VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cf /r ib] AMD,SSE5
-;
-; fixed: spec mention only 3 operands in mnemonics
-VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ec /r ib] AMD,SSE5
-VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ee /r ib] AMD,SSE5
-VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ef /r ib] AMD,SSE5
-;
-; fixed: spec point wrong VPCOMB in mnemonic
-VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ed /r ib] AMD,SSE5
-VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cd /r ib] AMD,SSE5
-
-VPHADDBD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c2 /r] AMD,SSE5
-VPHADDBQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c3 /r] AMD,SSE5
-VPHADDBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c1 /r] AMD,SSE5
-VPHADDDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 cb /r] AMD,SSE5
-;
-; fixed: spec has ymmreg for l0
-VPHADDUBD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d2 /r] AMD,SSE5
-VPHADDUBQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d3 /r] AMD,SSE5
-;
-; fixed: spec has VPHADDUBWD
-VPHADDUBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d1 /r] AMD,SSE5
-;
-; fixed: opcode db
-VPHADDUDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 db /r] AMD,SSE5
-VPHADDUWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d6 /r] AMD,SSE5
-VPHADDUWQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d7 /r] AMD,SSE5
-;
-; fixed: spec has ymmreg for l0
-VPHADDWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c6 /r] AMD,SSE5
-;
-; fixed: spec has d7 opcode
-VPHADDWQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c7 /r] AMD,SSE5
-
-VPHSUBBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e1 /r] AMD,SSE5
-VPHSUBDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e3 /r] AMD,SSE5
-VPHSUBWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e2 /r] AMD,SSE5
-
-VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 9e /r /is4] AMD,SSE5
-;
-; fixed: spec has 97,9f opcodes here
-VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 9f /r /is4] AMD,SSE5
-VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 97 /r /is4] AMD,SSE5
-VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 8e /r /is4] AMD,SSE5
-VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 8f /r /is4] AMD,SSE5
-VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 87 /r /is4] AMD,SSE5
-VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 86 /r /is4] AMD,SSE5
-VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 85 /r /is4] AMD,SSE5
-VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 96 /r /is4] AMD,SSE5
-VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 95 /r /is4] AMD,SSE5
-VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a6 /r /is4] AMD,SSE5
-VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 b6 /r /is4] AMD,SSE5
-
-VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: xop.m8.w1.nds.l0.p0 a3 /r /is4] AMD,SSE5
-VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a3 /r /is4] AMD,SSE5
-
-VPROTB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 90 /r] AMD,SSE5
-VPROTB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 90 /r] AMD,SSE5
-;
-; fixed: spec point xmmreg instead of reg/mem
-VPROTB xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c0 /r ib] AMD,SSE5
-
-VPROTD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 92 /r] AMD,SSE5
-VPROTD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 92 /r] AMD,SSE5
-;
-; fixed: spec error /r is needed
-VPROTD xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c2 /r ib] AMD,SSE5
-VPROTQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 93 /r] AMD,SSE5
-VPROTQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 93 /r] AMD,SSE5
-;
-; fixed: spec error /r is needed
-VPROTQ xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c3 /r ib] AMD,SSE5
-VPROTW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 91 /r] AMD,SSE5
-VPROTW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 91 /r] AMD,SSE5
-VPROTW xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c1 /r ib] AMD,SSE5
-
-VPSHAB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 98 /r] AMD,SSE5
-VPSHAB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 98 /r] AMD,SSE5
-
-VPSHAD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 9a /r] AMD,SSE5
-VPSHAD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 9a /r] AMD,SSE5
-
-VPSHAQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 9b /r] AMD,SSE5
-VPSHAQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 9b /r] AMD,SSE5
-
-VPSHAW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 99 /r] AMD,SSE5
-VPSHAW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 99 /r] AMD,SSE5
-
-VPSHLB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 94 /r] AMD,SSE5
-VPSHLB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 94 /r] AMD,SSE5
-
-;
-; fixed: spec has ymmreg for l0
-VPSHLD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 96 /r] AMD,SSE5
-VPSHLD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 96 /r] AMD,SSE5
-
-VPSHLQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 97 /r] AMD,SSE5
-VPSHLQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 97 /r] AMD,SSE5
-
-VPSHLW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 95 /r] AMD,SSE5
-VPSHLW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 95 /r] AMD,SSE5
-
-;# Intel AVX2 instructions
-;
-; based on pub number 319433-011 dated July 2011
-;
-VMPSADBW ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 42 /r ib] FUTURE,AVX2
-VPABSB ymmreg,ymmrm256 [rm: vex.256.66.0f38 1c /r] FUTURE,AVX2
-VPABSW ymmreg,ymmrm256 [rm: vex.256.66.0f38 1d /r] FUTURE,AVX2
-VPABSD ymmreg,ymmrm256 [rm: vex.256.66.0f38 1e /r] FUTURE,AVX2
-VPACKSSWB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 63 /r] FUTURE,AVX2
-VPACKSSDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6b /r] FUTURE,AVX2
-VPACKUSDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 2b /r] FUTURE,AVX2
-VPACKUSWB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 67 /r] FUTURE,AVX2
-VPADDB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fc /r] FUTURE,AVX2
-VPADDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fd /r] FUTURE,AVX2
-VPADDD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fe /r] FUTURE,AVX2
-VPADDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d4 /r] FUTURE,AVX2
-VPADDSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ec /r] FUTURE,AVX2
-VPADDSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ed /r] FUTURE,AVX2
-VPADDUSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f dc /r] FUTURE,AVX2
-VPADDUSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f dd /r] FUTURE,AVX2
-VPALIGNR ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0f /r ib] FUTURE,AVX2
-VPAND ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f db /r] FUTURE,AVX2
-VPANDN ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f df /r] FUTURE,AVX2
-VPAVGB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e0 /r] FUTURE,AVX2
-VPAVGW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e3 /r] FUTURE,AVX2
-VPBLENDVB ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a 4c /r /is4] FUTURE,AVX2
-VPBLENDW ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0e /r ib] FUTURE,AVX2
-VPCMPEQB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 74 /r] FUTURE,AVX2
-VPCMPEQW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 75 /r] FUTURE,AVX2
-VPCMPEQD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 76 /r] FUTURE,AVX2
-VPCMPEQQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 29 /r] FUTURE,AVX2
-VPCMPGTB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 64 /r] FUTURE,AVX2
-VPCMPGTW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 65 /r] FUTURE,AVX2
-VPCMPGTD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 66 /r] FUTURE,AVX2
-VPCMPGTQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 37 /r] FUTURE,AVX2
-VPHADDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 01 /r] FUTURE,AVX2
-VPHADDD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 02 /r] FUTURE,AVX2
-VPHADDSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 03 /r] FUTURE,AVX2
-VPHSUBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 05 /r] FUTURE,AVX2
-VPHSUBD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 06 /r] FUTURE,AVX2
-VPHSUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 07 /r] FUTURE,AVX2
-VPMADDUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 04 /r] FUTURE,AVX2
-VPMADDWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f5 /r] FUTURE,AVX2
-VPMAXSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3c /r] FUTURE,AVX2
-VPMAXSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ee /r] FUTURE,AVX2
-VPMAXSD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3d /r] FUTURE,AVX2
-VPMAXUB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f de /r] FUTURE,AVX2
-VPMAXUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3e /r] FUTURE,AVX2
-VPMAXUD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3f /r] FUTURE,AVX2
-VPMINSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 38 /r] FUTURE,AVX2
-VPMINSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ea /r] FUTURE,AVX2
-VPMINSD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 39 /r] FUTURE,AVX2
-VPMINUB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f da /r] FUTURE,AVX2
-VPMINUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3a /r] FUTURE,AVX2
-VPMINUD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3b /r] FUTURE,AVX2
-VPMOVMSKB reg32,ymmreg [rm: vex.256.66.0f d7 /r] FUTURE,AVX2
-VPMOVMSKB reg64,ymmreg [rm: vex.256.66.0f d7 /r] FUTURE,AVX2
-VPMOVSXBW ymmreg,xmmrm128 [rm: vex.256.66.0f38 20 /r] FUTURE,AVX2
-VPMOVSXBD ymmreg,mem64 [rm: vex.256.66.0f38 21 /r] FUTURE,AVX2
-VPMOVSXBD ymmreg,xmmreg [rm: vex.256.66.0f38 21 /r] FUTURE,AVX2
-VPMOVSXBQ ymmreg,mem32 [rm: vex.256.66.0f38 22 /r] FUTURE,AVX2
-VPMOVSXBQ ymmreg,xmmreg [rm: vex.256.66.0f38 22 /r] FUTURE,AVX2
-VPMOVSXWD ymmreg,xmmrm128 [rm: vex.256.66.0f38 23 /r] FUTURE,AVX2
-VPMOVSXWQ ymmreg,mem64 [rm: vex.256.66.0f38 24 /r] FUTURE,AVX2
-VPMOVSXWQ ymmreg,xmmreg [rm: vex.256.66.0f38 24 /r] FUTURE,AVX2
-VPMOVSXDQ ymmreg,xmmrm128 [rm: vex.256.66.0f38 25 /r] FUTURE,AVX2
-VPMOVZXBW ymmreg,xmmrm128 [rm: vex.256.66.0f38 30 /r] FUTURE,AVX2
-VPMOVZXBD ymmreg,mem64 [rm: vex.256.66.0f38 31 /r] FUTURE,AVX2
-VPMOVZXBD ymmreg,xmmreg [rm: vex.256.66.0f38 31 /r] FUTURE,AVX2
-VPMOVZXBQ ymmreg,mem32 [rm: vex.256.66.0f38 32 /r] FUTURE,AVX2
-VPMOVZXBQ ymmreg,xmmreg [rm: vex.256.66.0f38 32 /r] FUTURE,AVX2
-VPMOVZXWD ymmreg,xmmrm128 [rm: vex.256.66.0f38 33 /r] FUTURE,AVX2
-VPMOVZXWQ ymmreg,mem64 [rm: vex.256.66.0f38 34 /r] FUTURE,AVX2
-VPMOVZXWQ ymmreg,xmmreg [rm: vex.256.66.0f38 34 /r] FUTURE,AVX2
-VPMOVZXDQ ymmreg,xmmrm128 [rm: vex.256.66.0f38 35 /r] FUTURE,AVX2
-VPMULDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 28 /r] FUTURE,AVX2
-VPMULHRSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 0b /r] FUTURE,AVX2
-VPMULHUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e4 /r] FUTURE,AVX2
-VPMULHW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e5 /r] FUTURE,AVX2
-VPMULLW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d5 /r] FUTURE,AVX2
-VPMULLD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 40 /r] FUTURE,AVX2
-VPMULUDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f4 /r] FUTURE,AVX2
-VPOR ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f eb /r] FUTURE,AVX2
-VPSADBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f6 /r] FUTURE,AVX2
-VPSHUFB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 00 /r] FUTURE,AVX2
-VPSHUFD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f 70 /r ib] FUTURE,AVX2
-VPSHUFHW ymmreg,ymmrm256,imm8 [rmi: vex.256.f3.0f 70 /r ib] FUTURE,AVX2
-VPSHUFLW ymmreg,ymmrm256,imm8 [rmi: vex.256.f2.0f 70 /r ib] FUTURE,AVX2
-VPSIGNB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 08 /r] FUTURE,AVX2
-VPSIGNW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 09 /r] FUTURE,AVX2
-VPSIGND ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 0a /r] FUTURE,AVX2
-VPSLLDQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /7 ib] FUTURE,AVX2
-VPSLLW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f1 /r] FUTURE,AVX2
-VPSLLW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /6 ib] FUTURE,AVX2
-VPSLLD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f2 /r] FUTURE,AVX2
-VPSLLD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /6 ib] FUTURE,AVX2
-VPSLLQ ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f3 /r] FUTURE,AVX2
-VPSLLQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /6 ib] FUTURE,AVX2
-VPSRAW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f e1 /r] FUTURE,AVX2
-VPSRAW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /4 ib] FUTURE,AVX2
-VPSRAD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f e2 /r] FUTURE,AVX2
-VPSRAD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /4 ib] FUTURE,AVX2
-VPSRLDQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /3 ib] FUTURE,AVX2
-VPSRLW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d1 /r] FUTURE,AVX2
-VPSRLW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /2 ib] FUTURE,AVX2
-VPSRLD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d2 /r] FUTURE,AVX2
-VPSRLD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /2 ib] FUTURE,AVX2
-VPSRLQ ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d3 /r] FUTURE,AVX2
-VPSRLQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f.wig 73 /2 ib] FUTURE,AVX2
-VPSUBB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f8 /r] FUTURE,AVX2
-VPSUBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f9 /r] FUTURE,AVX2
-VPSUBD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fa /r] FUTURE,AVX2
-VPSUBQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fb /r] FUTURE,AVX2
-VPSUBSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e8 /r] FUTURE,AVX2
-VPSUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e9 /r] FUTURE,AVX2
-VPSUBUSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d8 /r] FUTURE,AVX2
-VPSUBUSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d9 /r] FUTURE,AVX2
-VPUNPCKHBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 68 /r] FUTURE,AVX2
-VPUNPCKHWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 69 /r] FUTURE,AVX2
-VPUNPCKHDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6a /r] FUTURE,AVX2
-VPUNPCKHQDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6d /r] FUTURE,AVX2
-VPUNPCKLBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 60 /r] FUTURE,AVX2
-VPUNPCKLWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 61 /r] FUTURE,AVX2
-VPUNPCKLDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 62 /r] FUTURE,AVX2
-VPUNPCKLQDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6c /r] FUTURE,AVX2
-VPXOR ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ef /r] FUTURE,AVX2
-VMOVNTDQA ymmreg,mem256 [rm: vex.256.66.0f38 2a /r] FUTURE,AVX2
-VBROADCASTSS xmmreg,xmmreg [rm: vex.128.66.0f38.w0 18 /r] FUTURE,AVX2
-VBROADCASTSS ymmreg,xmmreg [rm: vex.256.66.0f38.w0 18 /r] FUTURE,AVX2
-VBROADCASTSD ymmreg,xmmreg [rm: vex.256.66.0f38.w0 19 /r] FUTURE,AVX2
-VBROADCASTI128 ymmreg,mem128 [rm: vex.256.66.0f38.w0 5a /r] FUTURE,AVX2
-VPBLENDD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a.w0 02 /r ib] FUTURE,AVX2
-VPBLENDD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 02 /r ib] FUTURE,AVX2
-VPBROADCASTB xmmreg,mem8 [rm: vex.128.66.0f38.w0 78 /r] FUTURE,AVX2
-VPBROADCASTB xmmreg,xmmreg [rm: vex.128.66.0f38.w0 78 /r] FUTURE,AVX2
-VPBROADCASTB ymmreg,mem8 [rm: vex.256.66.0f38.w0 78 /r] FUTURE,AVX2
-VPBROADCASTB ymmreg,xmmreg [rm: vex.256.66.0f38.w0 78 /r] FUTURE,AVX2
-VPBROADCASTW xmmreg,mem16 [rm: vex.128.66.0f38.w0 79 /r] FUTURE,AVX2
-VPBROADCASTW xmmreg,xmmreg [rm: vex.128.66.0f38.w0 79 /r] FUTURE,AVX2
-VPBROADCASTW ymmreg,mem16 [rm: vex.256.66.0f38.w0 79 /r] FUTURE,AVX2
-VPBROADCASTW ymmreg,xmmreg [rm: vex.256.66.0f38.w0 79 /r] FUTURE,AVX2
-VPBROADCASTD xmmreg,mem32 [rm: vex.128.66.0f38.w0 58 /r] FUTURE,AVX2
-VPBROADCASTD xmmreg,xmmreg [rm: vex.128.66.0f38.w0 58 /r] FUTURE,AVX2
-VPBROADCASTD ymmreg,mem32 [rm: vex.256.66.0f38.w0 58 /r] FUTURE,AVX2
-VPBROADCASTD ymmreg,xmmreg [rm: vex.256.66.0f38.w0 58 /r] FUTURE,AVX2
-VPBROADCASTQ xmmreg,mem64 [rm: vex.128.66.0f38.w0 59 /r] FUTURE,AVX2
-VPBROADCASTQ xmmreg,xmmreg [rm: vex.128.66.0f38.w0 59 /r] FUTURE,AVX2
-VPBROADCASTQ ymmreg,mem64 [rm: vex.256.66.0f38.w0 59 /r] FUTURE,AVX2
-VPBROADCASTQ ymmreg,xmmreg [rm: vex.256.66.0f38.w0 59 /r] FUTURE,AVX2
-
-VPERMD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 36 /r] FUTURE,AVX2
-VPERMPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w1 01 /r ib] FUTURE,AVX2
-VPERMPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 16 /r] FUTURE,AVX2
-VPERMQ ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w1 00 /r ib] FUTURE,AVX2
-VPERM2I128 ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 46 /r ib] FUTURE,AVX2
-VEXTRACTI128 xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 39 /r ib] FUTURE,AVX2
-
-VINSERTI128 ymmreg,ymmreg*,xmmrm128,imm8 [rvmi: vex.nds.256.66.0f3a.w0 38 /r ib] FUTURE,AVX2
-VPMASKMOVD xmmreg,xmmreg*,mem128 [rvm: vex.nds.128.66.0f38.w0 8c /r] FUTURE,AVX2
-VPMASKMOVD ymmreg,ymmreg*,mem256 [rvm: vex.nds.256.66.0f38.w0 8c /r] FUTURE,AVX2
-VPMASKMOVQ xmmreg,xmmreg*,mem128 [rvm: vex.nds.128.66.0f38.w1 8c /r] FUTURE,AVX2
-VPMASKMOVQ ymmreg,ymmreg*,mem256 [rvm: vex.nds.256.66.0f38.w1 8c /r] FUTURE,AVX2
-
-VPMASKMOVD mem128,xmmreg*,xmmreg [mvr: vex.nds.128.66.0f38.w0 8e /r] FUTURE,AVX2
-VPMASKMOVD mem256,ymmreg*,ymmreg [mvr: vex.nds.256.66.0f38.w0 8e /r] FUTURE,AVX2
-VPMASKMOVQ mem128,xmmreg*,xmmreg [mvr: vex.nds.128.66.0f38.w1 8e /r] FUTURE,AVX2
-VPMASKMOVQ mem256,ymmreg*,ymmreg [mvr: vex.nds.256.66.0f38.w1 8e /r] FUTURE,AVX2
-
-VPSLLVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 47 /r] FUTURE,AVX2
-VPSLLVQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w1 47 /r] FUTURE,AVX2
-VPSLLVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 47 /r] FUTURE,AVX2
-VPSLLVQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w1 47 /r] FUTURE,AVX2
-
-VPSRAVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 46 /r] FUTURE,AVX2
-VPSRAVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 46 /r] FUTURE,AVX2
-
-VPSRLVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 45 /r] FUTURE,AVX2
-VPSRLVQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w1 45 /r] FUTURE,AVX2
-VPSRLVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 45 /r] FUTURE,AVX2
-VPSRLVQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w1 45 /r] FUTURE,AVX2
-
-VGATHERDPD xmmreg,xmem64,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w1 92 /r] FUTURE,AVX2
-VGATHERQPD xmmreg,xmem64,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w1 93 /r] FUTURE,AVX2
-VGATHERDPD ymmreg,xmem64,ymmreg [rmv: vm32x vex.dds.256.66.0f38.w1 92 /r] FUTURE,AVX2
-VGATHERQPD ymmreg,ymem64,ymmreg [rmv: vm64y vex.dds.256.66.0f38.w1 93 /r] FUTURE,AVX2
-
-VGATHERDPS xmmreg,xmem32,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w0 92 /r] FUTURE,AVX2
-VGATHERQPS xmmreg,xmem32,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w0 93 /r] FUTURE,AVX2
-VGATHERDPS ymmreg,ymem32,ymmreg [rmv: vm32y vex.dds.256.66.0f38.w0 92 /r] FUTURE,AVX2
-VGATHERQPS xmmreg,ymem32,xmmreg [rmv: vm64y vex.dds.256.66.0f38.w0 93 /r] FUTURE,AVX2
-
-VPGATHERDD xmmreg,xmem32,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w0 90 /r] FUTURE,AVX2
-VPGATHERQD xmmreg,xmem32,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w0 91 /r] FUTURE,AVX2
-VPGATHERDD ymmreg,ymem32,ymmreg [rmv: vm32y vex.dds.256.66.0f38.w0 90 /r] FUTURE,AVX2
-VPGATHERQD xmmreg,ymem32,xmmreg [rmv: vm64y vex.dds.256.66.0f38.w0 91 /r] FUTURE,AVX2
-
-VPGATHERDQ xmmreg,xmem64,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w1 90 /r] FUTURE,AVX2
-VPGATHERQQ xmmreg,xmem64,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w1 91 /r] FUTURE,AVX2
-VPGATHERDQ ymmreg,xmem64,ymmreg [rmv: vm32x vex.dds.256.66.0f38.w1 90 /r] FUTURE,AVX2
-VPGATHERQQ ymmreg,ymem64,ymmreg [rmv: vm64y vex.dds.256.66.0f38.w1 91 /r] FUTURE,AVX2
-
-;# Intel Transactional Synchronization Extensions (TSX)
-XABORT imm [i: c6 f8 ib] FUTURE,RTM
-XABORT imm8 [i: c6 f8 ib] FUTURE,RTM
-XBEGIN imm [i: odf c7 f8 rel] FUTURE,RTM
-XBEGIN imm|near [i: odf c7 f8 rel] FUTURE,RTM,ND
-XBEGIN imm16 [i: o16 c7 f8 rel] FUTURE,RTM,NOLONG
-XBEGIN imm16|near [i: o16 c7 f8 rel] FUTURE,RTM,NOLONG,ND
-XBEGIN imm32 [i: o32 c7 f8 rel] FUTURE,RTM,NOLONG
-XBEGIN imm32|near [i: o32 c7 f8 rel] FUTURE,RTM,NOLONG,ND
-XBEGIN imm64 [i: o64nw c7 f8 rel] FUTURE,RTM,LONG
-XBEGIN imm64|near [i: o64nw c7 f8 rel] FUTURE,RTM,LONG,ND
-XEND void [ 0f 01 d5] FUTURE,RTM
-XTEST void [ 0f 01 d6] FUTURE,HLE,RTM
-
-;# Intel BMI1 and BMI2 instructions, AMD TBM instructions
-;
-; based on pub number 319433-011 dated July 2011
-;
-ANDN reg32,reg32,rm32 [rvm: vex.nds.lz.0f38.w0 f2 /r] FUTURE,BMI1
-ANDN reg64,reg64,rm64 [rvm: vex.nds.lz.0f38.w1 f2 /r] LONG,FUTURE,BMI1
-BEXTR reg32,rm32,reg32 [rmv: vex.nds.lz.0f38.w0 f7 /r] FUTURE,BMI1
-BEXTR reg64,rm64,reg64 [rmv: vex.nds.lz.0f38.w1 f7 /r] LONG,FUTURE,BMI1
-BEXTR reg32,rm32,imm32 [rmi: xop.m10.lz.w0 10 /r id] FUTURE,TBM
-BEXTR reg64,rm64,imm32 [rmi: xop.m10.lz.w1 10 /r id] LONG,FUTURE,TBM
-BLCI reg32,rm32 [vm: xop.ndd.lz.m9.w0 02 /6] FUTURE,TBM
-BLCI reg64,rm64 [vm: xop.ndd.lz.m9.w1 02 /6] LONG,FUTURE,TBM
-BLCIC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /5] FUTURE,TBM
-BLCIC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /5] LONG,FUTURE,TBM
-BLSI reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /3] FUTURE,BMI1
-BLSI reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /3] LONG,FUTURE,BMI1
-BLSIC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /6] FUTURE,TBM
-BLSIC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /6] LONG,FUTURE,TBM
-BLCFILL reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /1] FUTURE,TBM
-BLCFILL reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /1] LONG,FUTURE,TBM
-BLSFILL reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /2] FUTURE,TBM
-BLSFILL reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /2] LONG,FUTURE,TBM
-BLCMSK reg32,rm32 [vm: xop.ndd.lz.m9.w0 02 /1] FUTURE,TBM
-BLCMSK reg64,rm64 [vm: xop.ndd.lz.m9.w1 02 /1] LONG,FUTURE,TBM
-BLSMSK reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /2] FUTURE,BMI1
-BLSMSK reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /2] LONG,FUTURE,BMI1
-BLSR reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /1] FUTURE,BMI1
-BLSR reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /1] LONG,FUTURE,BMI1
-BLCS reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /3] FUTURE,TBM
-BLCS reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /3] LONG,FUTURE,TBM
-BZHI reg32,rm32,reg32 [rmv: vex.nds.lz.0f38.w0 f5 /r] FUTURE,BMI2
-BZHI reg64,rm64,reg64 [rmv: vex.nds.lz.0f38.w1 f5 /r] LONG,FUTURE,BMI2
-MULX reg32,reg32,rm32 [rvm: vex.ndd.lz.f2.0f38.w0 f6 /r] FUTURE,BMI2
-MULX reg64,reg64,rm64 [rvm: vex.ndd.lz.f2.0f38.w1 f6 /r] LONG,FUTURE,BMI2
-PDEP reg32,reg32,rm32 [rvm: vex.nds.lz.f2.0f38.w0 f5 /r] FUTURE,BMI2
-PDEP reg64,reg64,rm64 [rvm: vex.nds.lz.f2.0f38.w1 f5 /r] LONG,FUTURE,BMI2
-PEXT reg32,reg32,rm32 [rvm: vex.nds.lz.f3.0f38.w0 f5 /r] FUTURE,BMI2
-PEXT reg64,reg64,rm64 [rvm: vex.nds.lz.f3.0f38.w1 f5 /r] LONG,FUTURE,BMI2
-RORX reg32,rm32,imm8 [rmi: vex.lz.f2.0f3a.w0 f0 /r ib] FUTURE,BMI2
-RORX reg64,rm64,imm8 [rmi: vex.lz.f2.0f3a.w1 f0 /r ib] LONG,FUTURE,BMI2
-SARX reg32,rm32,reg32 [rmv: vex.nds.lz.f3.0f38.w0 f7 /r] FUTURE,BMI2
-SARX reg64,rm64,reg64 [rmv: vex.nds.lz.f3.0f38.w1 f7 /r] LONG,FUTURE,BMI2
-SHLX reg32,rm32,reg32 [rmv: vex.nds.lz.66.0f38.w0 f7 /r] FUTURE,BMI2
-SHLX reg64,rm64,reg64 [rmv: vex.nds.lz.66.0f38.w1 f7 /r] LONG,FUTURE,BMI2
-SHRX reg32,rm32,reg32 [rmv: vex.nds.lz.f2.0f38.w0 f7 /r] FUTURE,BMI2
-SHRX reg64,rm64,reg64 [rmv: vex.nds.lz.f2.0f38.w1 f7 /r] LONG,FUTURE,BMI2
-TZCNT reg16,rm16 [rm: o16 f3i 0f bc /r] FUTURE,BMI1
-TZCNT reg32,rm32 [rm: o32 f3i 0f bc /r] FUTURE,BMI1
-TZCNT reg64,rm64 [rm: o64 f3i 0f bc /r] LONG,FUTURE,BMI1
-TZMSK reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /4] FUTURE,TBM
-TZMSK reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /4] LONG,FUTURE,TBM
-T1MSKC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /7] FUTURE,TBM
-T1MSKC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /7] LONG,FUTURE,TBM
-
-PREFETCHWT1 mem8 [m: 0f 0d /2 ] PREFETCHWT1,FUTURE
-
-;# Intel Memory Protection Extensions (MPX)
-BNDMK bndreg,mem [rm: f3 0f 1b /r ] MPX,MIB,FUTURE
-BNDCL bndreg,mem [rm: f3 0f 1a /r ] MPX,FUTURE
-BNDCL bndreg,reg32 [rm: f3 0f 1a /r ] MPX,NOLONG,FUTURE
-BNDCL bndreg,reg64 [rm: o64nw f3 0f 1a /r ] MPX,LONG,FUTURE
-BNDCU bndreg,mem [rm: f2 0f 1a /r ] MPX,FUTURE
-BNDCU bndreg,reg32 [rm: f2 0f 1a /r ] MPX,NOLONG,FUTURE
-BNDCU bndreg,reg64 [rm: o64nw f2 0f 1a /r ] MPX,LONG,FUTURE
-BNDCN bndreg,mem [rm: f2 0f 1b /r ] MPX,FUTURE
-BNDCN bndreg,reg32 [rm: f2 0f 1b /r ] MPX,NOLONG,FUTURE
-BNDCN bndreg,reg64 [rm: o64nw f2 0f 1b /r ] MPX,LONG,FUTURE
-BNDMOV bndreg,bndreg [rm: 66 0f 1a /r ] MPX,FUTURE
-BNDMOV bndreg,mem [rm: 66 0f 1a /r ] MPX,FUTURE
-BNDMOV bndreg,bndreg [mr: 66 0f 1b /r ] MPX,FUTURE
-BNDMOV mem,bndreg [mr: 66 0f 1b /r ] MPX,FUTURE
-BNDLDX bndreg,mem [rm: 0f 1a /r ] MPX,MIB,FUTURE
-BNDLDX bndreg,mem,reg32 [rmx: 0f 1a /r ] MPX,MIB,NOLONG,FUTURE
-BNDLDX bndreg,mem,reg64 [rmx: 0f 1a /r ] MPX,MIB,LONG,FUTURE
-BNDSTX mem,bndreg [mr: 0f 1b /r ] MPX,MIB,FUTURE
-BNDSTX mem,reg32,bndreg [mxr: 0f 1b /r ] MPX,MIB,NOLONG,FUTURE
-BNDSTX mem,reg64,bndreg [mxr: 0f 1b /r ] MPX,MIB,LONG,FUTURE
-BNDSTX mem,bndreg,reg32 [mrx: 0f 1b /r ] MPX,MIB,NOLONG,FUTURE
-BNDSTX mem,bndreg,reg64 [mrx: 0f 1b /r ] MPX,MIB,LONG,FUTURE
-
-;# Intel SHA acceleration instructions
-SHA1MSG1 xmmreg,xmmrm128 [rm: 0f 38 c9 /r ] SHA,FUTURE
-SHA1MSG2 xmmreg,xmmrm128 [rm: 0f 38 ca /r ] SHA,FUTURE
-SHA1NEXTE xmmreg,xmmrm128 [rm: 0f 38 c8 /r ] SHA,FUTURE
-SHA1RNDS4 xmmreg,xmmrm128,imm8 [rmi: 0f 3a cc /r ib ] SHA,FUTURE
-SHA256MSG1 xmmreg,xmmrm128 [rm: 0f 38 cc /r ] SHA,FUTURE
-SHA256MSG2 xmmreg,xmmrm128 [rm: 0f 38 cd /r ] SHA,FUTURE
-SHA256RNDS2 xmmreg,xmmrm128,xmm0 [rm-: 0f 38 cb /r ] SHA,FUTURE
-SHA256RNDS2 xmmreg,xmmrm128 [rm: 0f 38 cb /r ] SHA,FUTURE
-
-;# AVX-512 mask register instructions
-KADDB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 4a /r ] FUTURE
-KADDD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 4a /r ] FUTURE
-KADDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 4a /r ] FUTURE
-KADDW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 4a /r ] FUTURE
-KANDB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 41 /r ] FUTURE
-KANDD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 41 /r ] FUTURE
-KANDNB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 42 /r ] FUTURE
-KANDND kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 42 /r ] FUTURE
-KANDNQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 42 /r ] FUTURE
-KANDNW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 42 /r ] FUTURE
-KANDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 41 /r ] FUTURE
-KANDW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 41 /r ] FUTURE
-KMOVB kreg,krm8 [rm: vex.l0.66.0f.w0 90 /r ] FUTURE
-KMOVB mem8,kreg [mr: vex.l0.66.0f.w0 91 /r ] FUTURE
-KMOVB kreg,reg32 [rm: vex.l0.66.0f.w0 92 /r ] FUTURE
-KMOVB reg32,kreg [rm: vex.l0.66.0f.w0 93 /r ] FUTURE
-KMOVD kreg,krm32 [rm: vex.l0.66.0f.w1 90 /r ] FUTURE
-KMOVD mem32,kreg [mr: vex.l0.66.0f.w1 91 /r ] FUTURE
-KMOVD kreg,reg32 [rm: vex.l0.f2.0f.w0 92 /r ] FUTURE
-KMOVD reg32,kreg [rm: vex.l0.f2.0f.w0 93 /r ] FUTURE
-KMOVQ kreg,krm64 [rm: vex.l0.0f.w1 90 /r ] FUTURE
-KMOVQ mem64,kreg [mr: vex.l0.0f.w1 91 /r ] FUTURE
-KMOVQ kreg,reg64 [rm: vex.l0.f2.0f.w1 92 /r ] FUTURE
-KMOVQ reg64,kreg [rm: vex.l0.f2.0f.w1 93 /r ] FUTURE
-KMOVW kreg,krm16 [rm: vex.l0.0f.w0 90 /r ] FUTURE
-KMOVW mem16,kreg [mr: vex.l0.0f.w0 91 /r ] FUTURE
-KMOVW kreg,reg32 [rm: vex.l0.0f.w0 92 /r ] FUTURE
-KMOVW reg32,kreg [rm: vex.l0.0f.w0 93 /r ] FUTURE
-KNOTB kreg,kreg [rm: vex.l0.66.0f.w0 44 /r ] FUTURE
-KNOTD kreg,kreg [rm: vex.l0.66.0f.w1 44 /r ] FUTURE
-KNOTQ kreg,kreg [rm: vex.l0.0f.w1 44 /r ] FUTURE
-KNOTW kreg,kreg [rm: vex.l0.0f.w0 44 /r ] FUTURE
-KORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 45 /r ] FUTURE
-KORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 45 /r ] FUTURE
-KORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 45 /r ] FUTURE
-KORTESTB kreg,kreg [rm: vex.l0.66.0f.w0 98 /r ] FUTURE
-KORTESTD kreg,kreg [rm: vex.l0.66.0f.w1 98 /r ] FUTURE
-KORTESTQ kreg,kreg [rm: vex.l0.0f.w1 98 /r ] FUTURE
-KORTESTW kreg,kreg [rm: vex.l0.0f.w0 98 /r ] FUTURE
-KORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 45 /r ] FUTURE
-KSHIFTLB kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 32 /r ib ] FUTURE
-KSHIFTLD kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 33 /r ib ] FUTURE
-KSHIFTLQ kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 33 /r ib ] FUTURE
-KSHIFTLW kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 32 /r ib ] FUTURE
-KSHIFTRB kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 30 /r ib ] FUTURE
-KSHIFTRD kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 31 /r ib ] FUTURE
-KSHIFTRQ kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 31 /r ib ] FUTURE
-KSHIFTRW kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 30 /r ib ] FUTURE
-KTESTB kreg,kreg [rm: vex.l0.66.0f.w0 99 /r ] FUTURE
-KTESTD kreg,kreg [rm: vex.l0.66.0f.w1 99 /r ] FUTURE
-KTESTQ kreg,kreg [rm: vex.l0.0f.w1 99 /r ] FUTURE
-KTESTW kreg,kreg [rm: vex.l0.0f.w0 99 /r ] FUTURE
-KUNPCKBW kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 4b /r ] FUTURE
-KUNPCKDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 4b /r ] FUTURE
-KUNPCKWD kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 4b /r ] FUTURE
-KXNORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 46 /r ] FUTURE
-KXNORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 46 /r ] FUTURE
-KXNORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 46 /r ] FUTURE
-KXNORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 46 /r ] FUTURE
-KXORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 47 /r ] FUTURE
-KXORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 47 /r ] FUTURE
-KXORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 47 /r ] FUTURE
-KXORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 47 /r ] FUTURE
-
-;# AVX-512 instructions
-VADDPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE
-VADDPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE
-VADDPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 58 /r ] AVX512,FUTURE
-VADDPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VADDPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VADDPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 58 /r ] AVX512,FUTURE
-VADDSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 58 /r ] AVX512,FUTURE
-VADDSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 58 /r ] AVX512,FUTURE
-VALIGND xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 03 /r ib ] AVX512VL,AVX512,FUTURE
-VALIGND ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 03 /r ib ] AVX512VL,AVX512,FUTURE
-VALIGND zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 03 /r ib ] AVX512,FUTURE
-VALIGNQ xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 03 /r ib ] AVX512VL,AVX512,FUTURE
-VALIGNQ ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 03 /r ib ] AVX512VL,AVX512,FUTURE
-VALIGNQ zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 03 /r ib ] AVX512,FUTURE
-VANDNPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 55 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDNPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 55 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDNPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 55 /r ] AVX512DQ,FUTURE
-VANDNPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 55 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDNPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 55 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDNPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 55 /r ] AVX512DQ,FUTURE
-VANDPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 54 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 54 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 54 /r ] AVX512DQ,FUTURE
-VANDPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 54 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 54 /r ] AVX512VL,AVX512DQ,FUTURE
-VANDPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 54 /r ] AVX512DQ,FUTURE
-VBLENDMPD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 65 /r ] AVX512VL,AVX512,FUTURE
-VBLENDMPD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 65 /r ] AVX512VL,AVX512,FUTURE
-VBLENDMPD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 65 /r ] AVX512,FUTURE
-VBLENDMPS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 65 /r ] AVX512VL,AVX512,FUTURE
-VBLENDMPS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 65 /r ] AVX512VL,AVX512,FUTURE
-VBLENDMPS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 65 /r ] AVX512,FUTURE
-VBROADCASTF32X2 ymmreg|mask|z,xmmrm64 [rm:t2: evex.256.66.0f38.w0 19 /r ] AVX512VL,AVX512DQ,FUTURE
-VBROADCASTF32X2 zmmreg|mask|z,xmmrm64 [rm:t2: evex.512.66.0f38.w0 19 /r ] AVX512DQ,FUTURE
-VBROADCASTF32X4 ymmreg|mask|z,mem128 [rm:t4: evex.256.66.0f38.w0 1a /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTF32X4 zmmreg|mask|z,mem128 [rm:t4: evex.512.66.0f38.w0 1a /r ] AVX512,FUTURE
-VBROADCASTF32X8 zmmreg|mask|z,mem256 [rm:t8: evex.512.66.0f38.w0 1b /r ] AVX512DQ,FUTURE
-VBROADCASTF64X2 ymmreg|mask|z,mem128 [rm:t2: evex.256.66.0f38.w1 1a /r ] AVX512VL,AVX512DQ,FUTURE
-VBROADCASTF64X2 zmmreg|mask|z,mem128 [rm:t2: evex.512.66.0f38.w1 1a /r ] AVX512DQ,FUTURE
-VBROADCASTF64X4 zmmreg|mask|z,mem256 [rm:t4: evex.512.66.0f38.w1 1b /r ] AVX512,FUTURE
-VBROADCASTI32X2 xmmreg|mask|z,xmmrm64 [rm:t2: evex.128.66.0f38.w0 59 /r ] AVX512VL,AVX512DQ,FUTURE
-VBROADCASTI32X2 ymmreg|mask|z,xmmrm64 [rm:t2: evex.256.66.0f38.w0 59 /r ] AVX512VL,AVX512DQ,FUTURE
-VBROADCASTI32X2 zmmreg|mask|z,xmmrm64 [rm:t2: evex.512.66.0f38.w0 59 /r ] AVX512DQ,FUTURE
-VBROADCASTI32X4 ymmreg|mask|z,mem128 [rm:t4: evex.256.66.0f38.w0 5a /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTI32X4 zmmreg|mask|z,mem128 [rm:t4: evex.512.66.0f38.w0 5a /r ] AVX512,FUTURE
-VBROADCASTI32X8 zmmreg|mask|z,mem256 [rm:t8: evex.512.66.0f38.w0 5b /r ] AVX512DQ,FUTURE
-VBROADCASTI64X2 ymmreg|mask|z,mem128 [rm:t2: evex.256.66.0f38.w1 5a /r ] AVX512VL,AVX512DQ,FUTURE
-VBROADCASTI64X2 zmmreg|mask|z,mem128 [rm:t2: evex.512.66.0f38.w1 5a /r ] AVX512DQ,FUTURE
-VBROADCASTI64X4 zmmreg|mask|z,mem256 [rm:t4: evex.512.66.0f38.w1 5b /r ] AVX512,FUTURE
-VBROADCASTSD ymmreg|mask|z,mem64 [rm:t1s: evex.256.66.0f38.w1 19 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSD zmmreg|mask|z,mem64 [rm:t1s: evex.512.66.0f38.w1 19 /r ] AVX512,FUTURE
-VBROADCASTSD ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w1 19 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSD zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w1 19 /r ] AVX512,FUTURE
-VBROADCASTSS xmmreg|mask|z,mem32 [rm:t1s: evex.128.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSS ymmreg|mask|z,mem32 [rm:t1s: evex.256.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSS zmmreg|mask|z,mem32 [rm:t1s: evex.512.66.0f38.w0 18 /r ] AVX512,FUTURE
-VBROADCASTSS xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSS ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
-VBROADCASTSS zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w0 18 /r ] AVX512,FUTURE
-VCMPPD kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f.w1 c2 /r ib ] AVX512VL,AVX512,FUTURE
-VCMPPD kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f.w1 c2 /r ib ] AVX512VL,AVX512,FUTURE
-VCMPPD kreg|mask,zmmreg,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f.w1 c2 /r ib ] AVX512,FUTURE
-VCMPPS kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.0f.w0 c2 /r ib ] AVX512VL,AVX512,FUTURE
-VCMPPS kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.0f.w0 c2 /r ib ] AVX512VL,AVX512,FUTURE
-VCMPPS kreg|mask,zmmreg,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.0f.w0 c2 /r ib ] AVX512,FUTURE
-VCMPSD kreg|mask,xmmreg,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.f2.0f.w1 c2 /r ib ] AVX512,FUTURE
-VCMPSS kreg|mask,xmmreg,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.f3.0f.w0 c2 /r ib ] AVX512,FUTURE
-VCOMISD xmmreg,xmmrm64|sae [rm:t1s: evex.128.66.0f.w1 2f /r ] AVX512,FUTURE
-VCOMISS xmmreg,xmmrm32|sae [rm:t1s: evex.128.0f.w0 2f /r ] AVX512,FUTURE
-VCOMPRESSPD mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPD mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPD mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w1 8a /r ] AVX512,FUTURE
-VCOMPRESSPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w1 8a /r ] AVX512,FUTURE
-VCOMPRESSPS mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPS mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPS mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w0 8a /r ] AVX512,FUTURE
-VCOMPRESSPS xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPS ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
-VCOMPRESSPS zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w0 8a /r ] AVX512,FUTURE
-VCVTDQ2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.f3.0f.w0 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTDQ2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.f3.0f.w0 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTDQ2PD zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.f3.0f.w0 e6 /r ] AVX512,FUTURE
-VCVTDQ2PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTDQ2PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTDQ2PS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 5b /r ] AVX512,FUTURE
-VCVTPD2DQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f2.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2DQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f2.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2DQ ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f2.0f.w1 e6 /r ] AVX512,FUTURE
-VCVTPD2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 5a /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 5a /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 5a /r ] AVX512,FUTURE
-VCVTPD2QQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 7b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPD2QQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 7b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPD2QQ zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 7b /r ] AVX512DQ,FUTURE
-VCVTPD2UDQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 79 /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2UDQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 79 /r ] AVX512VL,AVX512,FUTURE
-VCVTPD2UDQ ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.0f.w1 79 /r ] AVX512,FUTURE
-VCVTPD2UQQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 79 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPD2UQQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 79 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPD2UQQ zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 79 /r ] AVX512DQ,FUTURE
-VCVTPH2PS xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VCVTPH2PS ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VCVTPH2PS zmmreg|mask|z,ymmrm256|sae [rm:hvm: evex.512.66.0f38.w0 13 /r ] AVX512,FUTURE
-VCVTPS2DQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2DQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2DQ zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.66.0f.w0 5b /r ] AVX512,FUTURE
-VCVTPS2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.0f.w0 5a /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.0f.w0 5a /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2PD zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.0f.w0 5a /r ] AVX512,FUTURE
-VCVTPS2PH xmmreg|mask|z,xmmreg,imm8 [mri:hvm: evex.128.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
-VCVTPS2PH xmmreg|mask|z,ymmreg,imm8 [mri:hvm: evex.256.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
-VCVTPS2PH ymmreg|mask|z,zmmreg|sae,imm8 [mri:hvm: evex.512.66.0f3a.w0 1d /r ib ] AVX512,FUTURE
-VCVTPS2PH mem64|mask,xmmreg,imm8 [mri:hvm: evex.128.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
-VCVTPS2PH mem128|mask,ymmreg,imm8 [mri:hvm: evex.256.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
-VCVTPS2PH mem256|mask,zmmreg|sae,imm8 [mri:hvm: evex.512.66.0f3a.w0 1d /r ib ] AVX512,FUTURE
-VCVTPS2QQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 7b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPS2QQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 7b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPS2QQ zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.66.0f.w0 7b /r ] AVX512DQ,FUTURE
-VCVTPS2UDQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 79 /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2UDQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 79 /r ] AVX512VL,AVX512,FUTURE
-VCVTPS2UDQ zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 79 /r ] AVX512,FUTURE
-VCVTPS2UQQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 79 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPS2UQQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 79 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTPS2UQQ zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.66.0f.w0 79 /r ] AVX512DQ,FUTURE
-VCVTQQ2PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f3.0f.w1 e6 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTQQ2PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f3.0f.w1 e6 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTQQ2PD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f3.0f.w1 e6 /r ] AVX512DQ,FUTURE
-VCVTQQ2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 5b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTQQ2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 5b /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTQQ2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.0f.w1 5b /r ] AVX512DQ,FUTURE
-VCVTSD2SI reg32,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w0 2d /r ] AVX512,FUTURE
-VCVTSD2SI reg64,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w1 2d /r ] AVX512,FUTURE
-VCVTSD2SS xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5a /r ] AVX512,FUTURE
-VCVTSD2USI reg32,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w0 79 /r ] AVX512,FUTURE
-VCVTSD2USI reg64,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w1 79 /r ] AVX512,FUTURE
-VCVTSI2SD xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f2.0f.w0 2a /r ] AVX512,FUTURE
-VCVTSI2SD xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f2.0f.w1 2a /r ] AVX512,FUTURE
-VCVTSI2SS xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f3.0f.w0 2a /r ] AVX512,FUTURE
-VCVTSI2SS xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f3.0f.w1 2a /r ] AVX512,FUTURE
-VCVTSS2SD xmmreg|mask|z,xmmreg,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5a /r ] AVX512,FUTURE
-VCVTSS2SI reg32,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w0 2d /r ] AVX512,FUTURE
-VCVTSS2SI reg64,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w1 2d /r ] AVX512,FUTURE
-VCVTSS2USI reg32,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w0 79 /r ] AVX512,FUTURE
-VCVTSS2USI reg64,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w1 79 /r ] AVX512,FUTURE
-VCVTTPD2DQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPD2DQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPD2DQ ymmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 e6 /r ] AVX512,FUTURE
-VCVTTPD2QQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPD2QQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPD2QQ zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 7a /r ] AVX512DQ,FUTURE
-VCVTTPD2UDQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 78 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPD2UDQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 78 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPD2UDQ ymmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.0f.w1 78 /r ] AVX512,FUTURE
-VCVTTPD2UQQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 78 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPD2UQQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 78 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPD2UQQ zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 78 /r ] AVX512DQ,FUTURE
-VCVTTPS2DQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.f3.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTTPS2DQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.f3.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
-VCVTTPS2DQ zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.f3.0f.w0 5b /r ] AVX512,FUTURE
-VCVTTPS2QQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPS2QQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPS2QQ zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.66.0f.w0 7a /r ] AVX512DQ,FUTURE
-VCVTTPS2UDQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 78 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPS2UDQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 78 /r ] AVX512VL,AVX512,FUTURE
-VCVTTPS2UDQ zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.0f.w0 78 /r ] AVX512,FUTURE
-VCVTTPS2UQQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 78 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPS2UQQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 78 /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTTPS2UQQ zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.66.0f.w0 78 /r ] AVX512DQ,FUTURE
-VCVTTSD2SI reg32,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w0 2c /r ] AVX512,FUTURE
-VCVTTSD2SI reg64,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w1 2c /r ] AVX512,FUTURE
-VCVTTSD2USI reg32,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w0 78 /r ] AVX512,FUTURE
-VCVTTSD2USI reg64,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w1 78 /r ] AVX512,FUTURE
-VCVTTSS2SI reg32,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w0 2c /r ] AVX512,FUTURE
-VCVTTSS2SI reg64,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w1 2c /r ] AVX512,FUTURE
-VCVTTSS2USI reg32,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w0 78 /r ] AVX512,FUTURE
-VCVTTSS2USI reg64,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w1 78 /r ] AVX512,FUTURE
-VCVTUDQ2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.f3.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
-VCVTUDQ2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.f3.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
-VCVTUDQ2PD zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.f3.0f.w0 7a /r ] AVX512,FUTURE
-VCVTUDQ2PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.f2.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
-VCVTUDQ2PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.f2.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
-VCVTUDQ2PS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.f2.0f.w0 7a /r ] AVX512,FUTURE
-VCVTUQQ2PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f3.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTUQQ2PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f3.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTUQQ2PD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f3.0f.w1 7a /r ] AVX512DQ,FUTURE
-VCVTUQQ2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f2.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTUQQ2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f2.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
-VCVTUQQ2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f2.0f.w1 7a /r ] AVX512DQ,FUTURE
-VCVTUSI2SD xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f2.0f.w0 7b /r ] AVX512,FUTURE
-VCVTUSI2SD xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f2.0f.w1 7b /r ] AVX512,FUTURE
-VCVTUSI2SS xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f3.0f.w0 7b /r ] AVX512,FUTURE
-VCVTUSI2SS xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f3.0f.w1 7b /r ] AVX512,FUTURE
-VDBPSADBW xmmreg|mask|z,xmmreg*,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 42 /r ib ] AVX512VL,AVX512BW,FUTURE
-VDBPSADBW ymmreg|mask|z,ymmreg*,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 42 /r ib ] AVX512VL,AVX512BW,FUTURE
-VDBPSADBW zmmreg|mask|z,zmmreg*,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 42 /r ib ] AVX512BW,FUTURE
-VDIVPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5e /r ] AVX512VL,AVX512,FUTURE
-VDIVPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5e /r ] AVX512VL,AVX512,FUTURE
-VDIVPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 5e /r ] AVX512,FUTURE
-VDIVPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5e /r ] AVX512VL,AVX512,FUTURE
-VDIVPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5e /r ] AVX512VL,AVX512,FUTURE
-VDIVPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 5e /r ] AVX512,FUTURE
-VDIVSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5e /r ] AVX512,FUTURE
-VDIVSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 5e /r ] AVX512,FUTURE
-VEXP2PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 c8 /r ] AVX512ER,FUTURE
-VEXP2PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 c8 /r ] AVX512ER,FUTURE
-VEXPANDPD xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPD ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPD zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w1 88 /r ] AVX512,FUTURE
-VEXPANDPD xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPD ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPD zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w1 88 /r ] AVX512,FUTURE
-VEXPANDPS xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPS ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPS zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w0 88 /r ] AVX512,FUTURE
-VEXPANDPS xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPS ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
-VEXPANDPS zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w0 88 /r ] AVX512,FUTURE
-VEXTRACTF32X4 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w0 19 /r ib ] AVX512VL,AVX512,FUTURE
-VEXTRACTF32X4 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 19 /r ib ] AVX512,FUTURE
-VEXTRACTF32X4 mem128|mask,ymmreg,imm8 [mri:t4: evex.256.66.0f3a.w0 19 /r ib ] AVX512VL,AVX512,FUTURE
-VEXTRACTF32X4 mem128|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w0 19 /r ib ] AVX512,FUTURE
-VEXTRACTF32X8 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 1b /r ib ] AVX512DQ,FUTURE
-VEXTRACTF32X8 mem256|mask,zmmreg,imm8 [mri:t8: evex.512.66.0f3a.w0 1b /r ib ] AVX512DQ,FUTURE
-VEXTRACTF64X2 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w1 19 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VEXTRACTF64X2 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 19 /r ib ] AVX512DQ,FUTURE
-VEXTRACTF64X2 mem128|mask,ymmreg,imm8 [mri:t2: evex.256.66.0f3a.w1 19 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VEXTRACTF64X2 mem128|mask,zmmreg,imm8 [mri:t2: evex.512.66.0f3a.w1 19 /r ib ] AVX512DQ,FUTURE
-VEXTRACTF64X4 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 1b /r ib ] AVX512,FUTURE
-VEXTRACTF64X4 mem256|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w1 1b /r ib ] AVX512,FUTURE
-VEXTRACTI32X4 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w0 39 /r ib ] AVX512VL,AVX512,FUTURE
-VEXTRACTI32X4 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 39 /r ib ] AVX512,FUTURE
-VEXTRACTI32X4 mem128|mask,ymmreg,imm8 [mri:t4: evex.256.66.0f3a.w0 39 /r ib ] AVX512VL,AVX512,FUTURE
-VEXTRACTI32X4 mem128|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w0 39 /r ib ] AVX512,FUTURE
-VEXTRACTI32X8 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 3b /r ib ] AVX512DQ,FUTURE
-VEXTRACTI32X8 mem256|mask,zmmreg,imm8 [mri:t8: evex.512.66.0f3a.w0 3b /r ib ] AVX512DQ,FUTURE
-VEXTRACTI64X2 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w1 39 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VEXTRACTI64X2 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 39 /r ib ] AVX512DQ,FUTURE
-VEXTRACTI64X2 mem128|mask,ymmreg,imm8 [mri:t2: evex.256.66.0f3a.w1 39 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VEXTRACTI64X2 mem128|mask,zmmreg,imm8 [mri:t2: evex.512.66.0f3a.w1 39 /r ib ] AVX512DQ,FUTURE
-VEXTRACTI64X4 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 3b /r ib ] AVX512,FUTURE
-VEXTRACTI64X4 mem256|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w1 3b /r ib ] AVX512,FUTURE
-VEXTRACTPS reg32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
-VEXTRACTPS reg64,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
-VEXTRACTPS mem32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
-VFIXUPIMMPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 54 /r ib ] AVX512VL,AVX512,FUTURE
-VFIXUPIMMPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 54 /r ib ] AVX512VL,AVX512,FUTURE
-VFIXUPIMMPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 54 /r ib ] AVX512,FUTURE
-VFIXUPIMMPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 54 /r ib ] AVX512VL,AVX512,FUTURE
-VFIXUPIMMPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 54 /r ib ] AVX512VL,AVX512,FUTURE
-VFIXUPIMMPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 54 /r ib ] AVX512,FUTURE
-VFIXUPIMMSD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 55 /r ib ] AVX512,FUTURE
-VFIXUPIMMSS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 55 /r ib ] AVX512,FUTURE
-VFMADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 98 /r ] AVX512VL,AVX512,FUTURE
-VFMADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 98 /r ] AVX512VL,AVX512,FUTURE
-VFMADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 98 /r ] AVX512,FUTURE
-VFMADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 98 /r ] AVX512VL,AVX512,FUTURE
-VFMADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 98 /r ] AVX512VL,AVX512,FUTURE
-VFMADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 98 /r ] AVX512,FUTURE
-VFMADD132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 99 /r ] AVX512,FUTURE
-VFMADD132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 99 /r ] AVX512,FUTURE
-VFMADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a8 /r ] AVX512,FUTURE
-VFMADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a8 /r ] AVX512,FUTURE
-VFMADD213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 a9 /r ] AVX512,FUTURE
-VFMADD213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 a9 /r ] AVX512,FUTURE
-VFMADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b8 /r ] AVX512,FUTURE
-VFMADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b8 /r ] AVX512VL,AVX512,FUTURE
-VFMADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b8 /r ] AVX512,FUTURE
-VFMADD231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 b9 /r ] AVX512,FUTURE
-VFMADD231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 b9 /r ] AVX512,FUTURE
-VFMADDSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 96 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 96 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 96 /r ] AVX512,FUTURE
-VFMADDSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 96 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 96 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 96 /r ] AVX512,FUTURE
-VFMADDSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a6 /r ] AVX512,FUTURE
-VFMADDSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a6 /r ] AVX512,FUTURE
-VFMADDSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b6 /r ] AVX512,FUTURE
-VFMADDSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b6 /r ] AVX512VL,AVX512,FUTURE
-VFMADDSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b6 /r ] AVX512,FUTURE
-VFMSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9a /r ] AVX512VL,AVX512,FUTURE
-VFMSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9a /r ] AVX512VL,AVX512,FUTURE
-VFMSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9a /r ] AVX512,FUTURE
-VFMSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9a /r ] AVX512VL,AVX512,FUTURE
-VFMSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9a /r ] AVX512VL,AVX512,FUTURE
-VFMSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9a /r ] AVX512,FUTURE
-VFMSUB132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9b /r ] AVX512,FUTURE
-VFMSUB132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9b /r ] AVX512,FUTURE
-VFMSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 aa /r ] AVX512VL,AVX512,FUTURE
-VFMSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 aa /r ] AVX512VL,AVX512,FUTURE
-VFMSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 aa /r ] AVX512,FUTURE
-VFMSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 aa /r ] AVX512VL,AVX512,FUTURE
-VFMSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 aa /r ] AVX512VL,AVX512,FUTURE
-VFMSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 aa /r ] AVX512,FUTURE
-VFMSUB213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 ab /r ] AVX512,FUTURE
-VFMSUB213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 ab /r ] AVX512,FUTURE
-VFMSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ba /r ] AVX512VL,AVX512,FUTURE
-VFMSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ba /r ] AVX512VL,AVX512,FUTURE
-VFMSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ba /r ] AVX512,FUTURE
-VFMSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ba /r ] AVX512VL,AVX512,FUTURE
-VFMSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ba /r ] AVX512VL,AVX512,FUTURE
-VFMSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ba /r ] AVX512,FUTURE
-VFMSUB231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bb /r ] AVX512,FUTURE
-VFMSUB231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bb /r ] AVX512,FUTURE
-VFMSUBADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 97 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 97 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 97 /r ] AVX512,FUTURE
-VFMSUBADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 97 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 97 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 97 /r ] AVX512,FUTURE
-VFMSUBADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a7 /r ] AVX512,FUTURE
-VFMSUBADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a7 /r ] AVX512,FUTURE
-VFMSUBADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b7 /r ] AVX512,FUTURE
-VFMSUBADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b7 /r ] AVX512VL,AVX512,FUTURE
-VFMSUBADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b7 /r ] AVX512,FUTURE
-VFNMADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9c /r ] AVX512VL,AVX512,FUTURE
-VFNMADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9c /r ] AVX512VL,AVX512,FUTURE
-VFNMADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9c /r ] AVX512,FUTURE
-VFNMADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9c /r ] AVX512VL,AVX512,FUTURE
-VFNMADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9c /r ] AVX512VL,AVX512,FUTURE
-VFNMADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9c /r ] AVX512,FUTURE
-VFNMADD132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9d /r ] AVX512,FUTURE
-VFNMADD132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9d /r ] AVX512,FUTURE
-VFNMADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ac /r ] AVX512VL,AVX512,FUTURE
-VFNMADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ac /r ] AVX512VL,AVX512,FUTURE
-VFNMADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ac /r ] AVX512,FUTURE
-VFNMADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ac /r ] AVX512VL,AVX512,FUTURE
-VFNMADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ac /r ] AVX512VL,AVX512,FUTURE
-VFNMADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ac /r ] AVX512,FUTURE
-VFNMADD213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 ad /r ] AVX512,FUTURE
-VFNMADD213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 ad /r ] AVX512,FUTURE
-VFNMADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 bc /r ] AVX512VL,AVX512,FUTURE
-VFNMADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 bc /r ] AVX512VL,AVX512,FUTURE
-VFNMADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 bc /r ] AVX512,FUTURE
-VFNMADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 bc /r ] AVX512VL,AVX512,FUTURE
-VFNMADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 bc /r ] AVX512VL,AVX512,FUTURE
-VFNMADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 bc /r ] AVX512,FUTURE
-VFNMADD231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bd /r ] AVX512,FUTURE
-VFNMADD231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bd /r ] AVX512,FUTURE
-VFNMSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9e /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9e /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9e /r ] AVX512,FUTURE
-VFNMSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9e /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9e /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9e /r ] AVX512,FUTURE
-VFNMSUB132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9f /r ] AVX512,FUTURE
-VFNMSUB132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9f /r ] AVX512,FUTURE
-VFNMSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ae /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ae /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ae /r ] AVX512,FUTURE
-VFNMSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ae /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ae /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ae /r ] AVX512,FUTURE
-VFNMSUB213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 af /r ] AVX512,FUTURE
-VFNMSUB213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 af /r ] AVX512,FUTURE
-VFNMSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 be /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 be /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 be /r ] AVX512,FUTURE
-VFNMSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 be /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 be /r ] AVX512VL,AVX512,FUTURE
-VFNMSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 be /r ] AVX512,FUTURE
-VFNMSUB231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bf /r ] AVX512,FUTURE
-VFNMSUB231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bf /r ] AVX512,FUTURE
-VFPCLASSPD kreg|mask,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VFPCLASSPD kreg|mask,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VFPCLASSPD kreg|mask,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 66 /r ib ] AVX512DQ,FUTURE
-VFPCLASSPS kreg|mask,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VFPCLASSPS kreg|mask,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VFPCLASSPS kreg|mask,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f3a.w0 66 /r ib ] AVX512DQ,FUTURE
-VFPCLASSSD kreg|mask,xmmrm64,imm8 [rmi:t1s: evex.128.66.0f3a.w1 67 /r ib ] AVX512DQ,FUTURE
-VFPCLASSSS kreg|mask,xmmrm32,imm8 [rmi:t1s: evex.128.66.0f3a.w0 67 /r ib ] AVX512DQ,FUTURE
-VGATHERDPD xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 92 /r ] AVX512VL,AVX512,FUTURE
-VGATHERDPD ymmreg|mask,xmem64 [rm:t1s: vsibx evex.256.66.0f38.w1 92 /r ] AVX512VL,AVX512,FUTURE
-VGATHERDPD zmmreg|mask,ymem64 [rm:t1s: vsiby evex.512.66.0f38.w1 92 /r ] AVX512,FUTURE
-VGATHERDPS xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 92 /r ] AVX512VL,AVX512,FUTURE
-VGATHERDPS ymmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 92 /r ] AVX512VL,AVX512,FUTURE
-VGATHERDPS zmmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 92 /r ] AVX512,FUTURE
-VGATHERPF0DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /1 ] AVX512PF,FUTURE
-VGATHERPF0DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /1 ] AVX512PF,FUTURE
-VGATHERPF0QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /1 ] AVX512PF,FUTURE
-VGATHERPF0QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /1 ] AVX512PF,FUTURE
-VGATHERPF1DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /2 ] AVX512PF,FUTURE
-VGATHERPF1DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /2 ] AVX512PF,FUTURE
-VGATHERPF1QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /2 ] AVX512PF,FUTURE
-VGATHERPF1QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /2 ] AVX512PF,FUTURE
-VGATHERQPD xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 93 /r ] AVX512VL,AVX512,FUTURE
-VGATHERQPD ymmreg|mask,ymem64 [rm:t1s: vsiby evex.256.66.0f38.w1 93 /r ] AVX512VL,AVX512,FUTURE
-VGATHERQPD zmmreg|mask,zmem64 [rm:t1s: vsibz evex.512.66.0f38.w1 93 /r ] AVX512,FUTURE
-VGATHERQPS xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 93 /r ] AVX512VL,AVX512,FUTURE
-VGATHERQPS xmmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 93 /r ] AVX512VL,AVX512,FUTURE
-VGATHERQPS ymmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 93 /r ] AVX512,FUTURE
-VGETEXPPD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 42 /r ] AVX512VL,AVX512,FUTURE
-VGETEXPPD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 42 /r ] AVX512VL,AVX512,FUTURE
-VGETEXPPD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 42 /r ] AVX512,FUTURE
-VGETEXPPS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 42 /r ] AVX512VL,AVX512,FUTURE
-VGETEXPPS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 42 /r ] AVX512VL,AVX512,FUTURE
-VGETEXPPS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 42 /r ] AVX512,FUTURE
-VGETEXPSD xmmreg|mask|z,xmmreg,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 43 /r ] AVX512,FUTURE
-VGETEXPSS xmmreg|mask|z,xmmreg,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 43 /r ] AVX512,FUTURE
-VGETMANTPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 26 /r ib ] AVX512VL,AVX512,FUTURE
-VGETMANTPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 26 /r ib ] AVX512VL,AVX512,FUTURE
-VGETMANTPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 26 /r ib ] AVX512,FUTURE
-VGETMANTPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 26 /r ib ] AVX512VL,AVX512,FUTURE
-VGETMANTPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 26 /r ib ] AVX512VL,AVX512,FUTURE
-VGETMANTPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 26 /r ib ] AVX512,FUTURE
-VGETMANTSD xmmreg|mask|z,xmmreg,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 27 /r ib ] AVX512,FUTURE
-VGETMANTSS xmmreg|mask|z,xmmreg,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 27 /r ib ] AVX512,FUTURE
-VINSERTF32X4 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.256.66.0f3a.w0 18 /r ib ] AVX512VL,AVX512,FUTURE
-VINSERTF32X4 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w0 18 /r ib ] AVX512,FUTURE
-VINSERTF32X8 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t8: evex.nds.512.66.0f3a.w0 1a /r ib ] AVX512DQ,FUTURE
-VINSERTF64X2 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.256.66.0f3a.w1 18 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VINSERTF64X2 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.512.66.0f3a.w1 18 /r ib ] AVX512DQ,FUTURE
-VINSERTF64X4 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w1 1a /r ib ] AVX512,FUTURE
-VINSERTI32X4 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.256.66.0f3a.w0 38 /r ib ] AVX512VL,AVX512,FUTURE
-VINSERTI32X4 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w0 38 /r ib ] AVX512,FUTURE
-VINSERTI32X8 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t8: evex.nds.512.66.0f3a.w0 3a /r ib ] AVX512DQ,FUTURE
-VINSERTI64X2 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.256.66.0f3a.w1 38 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VINSERTI64X2 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.512.66.0f3a.w1 38 /r ib ] AVX512DQ,FUTURE
-VINSERTI64X4 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w1 3a /r ib ] AVX512,FUTURE
-VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 21 /r ib ] AVX512,FUTURE
-VMAXPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5f /r ] AVX512VL,AVX512,FUTURE
-VMAXPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5f /r ] AVX512VL,AVX512,FUTURE
-VMAXPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae [rvm:fv: evex.nds.512.66.0f.w1 5f /r ] AVX512,FUTURE
-VMAXPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5f /r ] AVX512VL,AVX512,FUTURE
-VMAXPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5f /r ] AVX512VL,AVX512,FUTURE
-VMAXPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae [rvm:fv: evex.nds.512.0f.w0 5f /r ] AVX512,FUTURE
-VMAXSD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.f2.0f.w1 5f /r ] AVX512,FUTURE
-VMAXSS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5f /r ] AVX512,FUTURE
-VMINPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5d /r ] AVX512VL,AVX512,FUTURE
-VMINPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5d /r ] AVX512VL,AVX512,FUTURE
-VMINPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae [rvm:fv: evex.nds.512.66.0f.w1 5d /r ] AVX512,FUTURE
-VMINPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5d /r ] AVX512VL,AVX512,FUTURE
-VMINPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5d /r ] AVX512VL,AVX512,FUTURE
-VMINPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae [rvm:fv: evex.nds.512.0f.w0 5d /r ] AVX512,FUTURE
-VMINSD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.f2.0f.w1 5d /r ] AVX512,FUTURE
-VMINSS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5d /r ] AVX512,FUTURE
-VMOVAPD xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 28 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 28 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 28 /r ] AVX512,FUTURE
-VMOVAPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f.w1 29 /r ] AVX512,FUTURE
-VMOVAPD mem128|mask,xmmreg [mr:fvm: evex.128.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD mem256|mask,ymmreg [mr:fvm: evex.256.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPD mem512|mask,zmmreg [mr:fvm: evex.512.66.0f.w1 29 /r ] AVX512,FUTURE
-VMOVAPS xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.0f.w0 28 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.0f.w0 28 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.0f.w0 28 /r ] AVX512,FUTURE
-VMOVAPS xmmreg|mask|z,xmmreg [mr: evex.128.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS ymmreg|mask|z,ymmreg [mr: evex.256.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS zmmreg|mask|z,zmmreg [mr: evex.512.0f.w0 29 /r ] AVX512,FUTURE
-VMOVAPS mem128|mask,xmmreg [mr:fvm: evex.128.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS mem256|mask,ymmreg [mr:fvm: evex.256.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
-VMOVAPS mem512|mask,zmmreg [mr:fvm: evex.512.0f.w0 29 /r ] AVX512,FUTURE
-VMOVD xmmreg,rm32 [rm:t1s: evex.128.66.0f.w0 6e /r ] AVX512,FUTURE
-VMOVD rm32,xmmreg [mr:t1s: evex.128.66.0f.w0 7e /r ] AVX512,FUTURE
-VMOVDDUP xmmreg|mask|z,xmmrm64 [rm:dup: evex.128.f2.0f.w1 12 /r ] AVX512VL,AVX512,FUTURE
-VMOVDDUP ymmreg|mask|z,ymmrm256 [rm:dup: evex.256.f2.0f.w1 12 /r ] AVX512VL,AVX512,FUTURE
-VMOVDDUP zmmreg|mask|z,zmmrm512 [rm:dup: evex.512.f2.0f.w1 12 /r ] AVX512,FUTURE
-VMOVDQA32 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA32 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA32 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w0 6f /r ] AVX512,FUTURE
-VMOVDQA32 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.66.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA32 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.66.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA32 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.66.0f.w0 7f /r ] AVX512,FUTURE
-VMOVDQA64 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA64 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA64 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 6f /r ] AVX512,FUTURE
-VMOVDQA64 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.66.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA64 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.66.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQA64 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.66.0f.w1 7f /r ] AVX512,FUTURE
-VMOVDQU16 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f2.0f.w1 6f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU16 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f2.0f.w1 6f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU16 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f2.0f.w1 6f /r ] AVX512BW,FUTURE
-VMOVDQU16 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f2.0f.w1 7f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU16 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f2.0f.w1 7f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU16 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f2.0f.w1 7f /r ] AVX512BW,FUTURE
-VMOVDQU32 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU32 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU32 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 6f /r ] AVX512,FUTURE
-VMOVDQU32 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f3.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU32 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f3.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU32 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f3.0f.w0 7f /r ] AVX512,FUTURE
-VMOVDQU64 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU64 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU64 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w1 6f /r ] AVX512,FUTURE
-VMOVDQU64 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f3.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU64 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f3.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VMOVDQU64 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f3.0f.w1 7f /r ] AVX512,FUTURE
-VMOVDQU8 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f2.0f.w0 6f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU8 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f2.0f.w0 6f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU8 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f2.0f.w0 6f /r ] AVX512BW,FUTURE
-VMOVDQU8 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f2.0f.w0 7f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU8 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f2.0f.w0 7f /r ] AVX512VL,AVX512BW,FUTURE
-VMOVDQU8 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f2.0f.w0 7f /r ] AVX512BW,FUTURE
-VMOVHLPS xmmreg,xmmreg*,xmmreg [rvm: evex.nds.128.0f.w0 12 /r ] AVX512,FUTURE
-VMOVHPD xmmreg,xmmreg*,mem64 [rvm:t1s: evex.nds.128.66.0f.w1 16 /r ] AVX512,FUTURE
-VMOVHPD mem64,xmmreg [mr:t1s: evex.128.66.0f.w1 17 /r ] AVX512,FUTURE
-VMOVHPS xmmreg,xmmreg*,mem64 [rvm:t2: evex.nds.128.0f.w0 16 /r ] AVX512,FUTURE
-VMOVHPS mem64,xmmreg [mr:t2: evex.128.0f.w0 17 /r ] AVX512,FUTURE
-VMOVLHPS xmmreg,xmmreg*,xmmreg [rvm: evex.nds.128.0f.w0 16 /r ] AVX512,FUTURE
-VMOVLPD xmmreg,xmmreg*,mem64 [rvm:t1s: evex.nds.128.66.0f.w1 12 /r ] AVX512,FUTURE
-VMOVLPD mem64,xmmreg [mr:t1s: evex.128.66.0f.w1 13 /r ] AVX512,FUTURE
-VMOVLPS xmmreg,xmmreg*,mem64 [rvm:t2: evex.nds.128.0f.w0 12 /r ] AVX512,FUTURE
-VMOVLPS mem64,xmmreg [mr:t2: evex.128.0f.w0 13 /r ] AVX512,FUTURE
-VMOVNTDQ mem128,xmmreg [mr:fvm: evex.128.66.0f.w0 e7 /r ] AVX512VL,AVX512,FUTURE
-VMOVNTDQ mem256,ymmreg [mr:fvm: evex.256.66.0f.w0 e7 /r ] AVX512VL,AVX512,FUTURE
-VMOVNTDQ mem512,zmmreg [mr:fvm: evex.512.66.0f.w0 e7 /r ] AVX512,FUTURE
-VMOVNTDQA xmmreg,mem128 [rm:fvm: evex.128.66.0f38.w0 2a /r ] AVX512VL,AVX512,FUTURE
-VMOVNTDQA ymmreg,mem256 [rm:fvm: evex.256.66.0f38.w0 2a /r ] AVX512VL,AVX512,FUTURE
-VMOVNTDQA zmmreg,mem512 [rm:fvm: evex.512.66.0f38.w0 2a /r ] AVX512,FUTURE
-VMOVNTPD mem128,xmmreg [mr:fvm: evex.128.66.0f.w1 2b /r ] AVX512VL,AVX512,FUTURE
-VMOVNTPD mem256,ymmreg [mr:fvm: evex.256.66.0f.w1 2b /r ] AVX512VL,AVX512,FUTURE
-VMOVNTPD mem512,zmmreg [mr:fvm: evex.512.66.0f.w1 2b /r ] AVX512,FUTURE
-VMOVNTPS mem128,xmmreg [mr:fvm: evex.128.0f.w0 2b /r ] AVX512VL,AVX512,FUTURE
-VMOVNTPS mem256,ymmreg [mr:fvm: evex.256.0f.w0 2b /r ] AVX512VL,AVX512,FUTURE
-VMOVNTPS mem512,zmmreg [mr:fvm: evex.512.0f.w0 2b /r ] AVX512,FUTURE
-VMOVQ xmmreg,rm64 [rm:t1s: evex.128.66.0f.w1 6e /r ] AVX512,FUTURE
-VMOVQ rm64,xmmreg [mr:t1s: evex.128.66.0f.w1 7e /r ] AVX512,FUTURE
-VMOVQ xmmreg,xmmrm64 [rm:t1s: evex.128.f3.0f.w1 7e /r ] AVX512,FUTURE
-VMOVQ xmmrm64,xmmreg [mr:t1s: evex.128.66.0f.w1 d6 /r ] AVX512,FUTURE
-VMOVSD xmmreg|mask|z,mem64 [rm:t1s: evex.128.f2.0f.w1 10 /r ] AVX512,FUTURE
-VMOVSD mem64|mask,xmmreg [mr:t1s: evex.128.f2.0f.w1 11 /r ] AVX512,FUTURE
-VMOVSD xmmreg|mask|z,xmmreg*,xmmreg [rvm: evex.nds.128.f2.0f.w1 10 /r ] AVX512,FUTURE
-VMOVSD xmmreg|mask|z,xmmreg*,xmmreg [mvr: evex.nds.128.f2.0f.w1 11 /r ] AVX512,FUTURE
-VMOVSHDUP xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 16 /r ] AVX512VL,AVX512,FUTURE
-VMOVSHDUP ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 16 /r ] AVX512VL,AVX512,FUTURE
-VMOVSHDUP zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 16 /r ] AVX512,FUTURE
-VMOVSLDUP xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VMOVSLDUP ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VMOVSLDUP zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 12 /r ] AVX512,FUTURE
-VMOVSS xmmreg|mask|z,mem32 [rm:t1s: evex.128.f3.0f.w0 10 /r ] AVX512,FUTURE
-VMOVSS mem32|mask,xmmreg [mr:t1s: evex.128.f3.0f.w0 11 /r ] AVX512,FUTURE
-VMOVSS xmmreg|mask|z,xmmreg*,xmmreg [rvm: evex.nds.128.f3.0f.w0 10 /r ] AVX512,FUTURE
-VMOVSS xmmreg|mask|z,xmmreg*,xmmreg [mvr: evex.nds.128.f3.0f.w0 11 /r ] AVX512,FUTURE
-VMOVUPD xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 10 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 10 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 10 /r ] AVX512,FUTURE
-VMOVUPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f.w1 11 /r ] AVX512,FUTURE
-VMOVUPD mem128|mask,xmmreg [mr:fvm: evex.128.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD mem256|mask,ymmreg [mr:fvm: evex.256.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPD mem512|mask,zmmreg [mr:fvm: evex.512.66.0f.w1 11 /r ] AVX512,FUTURE
-VMOVUPS xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.0f.w0 10 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.0f.w0 10 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.0f.w0 10 /r ] AVX512,FUTURE
-VMOVUPS xmmreg|mask|z,xmmreg [mr: evex.128.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS ymmreg|mask|z,ymmreg [mr: evex.256.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS zmmreg|mask|z,zmmreg [mr: evex.512.0f.w0 11 /r ] AVX512,FUTURE
-VMOVUPS mem128|mask,xmmreg [mr:fvm: evex.128.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS mem256|mask,ymmreg [mr:fvm: evex.256.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VMOVUPS mem512|mask,zmmreg [mr:fvm: evex.512.0f.w0 11 /r ] AVX512,FUTURE
-VMULPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VMULPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VMULPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 59 /r ] AVX512,FUTURE
-VMULPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 59 /r ] AVX512VL,AVX512,FUTURE
-VMULPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 59 /r ] AVX512VL,AVX512,FUTURE
-VMULPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 59 /r ] AVX512,FUTURE
-VMULSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 59 /r ] AVX512,FUTURE
-VMULSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 59 /r ] AVX512,FUTURE
-VORPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 56 /r ] AVX512VL,AVX512DQ,FUTURE
-VORPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 56 /r ] AVX512VL,AVX512DQ,FUTURE
-VORPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 56 /r ] AVX512DQ,FUTURE
-VORPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 56 /r ] AVX512VL,AVX512DQ,FUTURE
-VORPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 56 /r ] AVX512VL,AVX512DQ,FUTURE
-VORPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 56 /r ] AVX512DQ,FUTURE
-VPABSB xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f38.wig 1c /r ] AVX512VL,AVX512BW,FUTURE
-VPABSB ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f38.wig 1c /r ] AVX512VL,AVX512BW,FUTURE
-VPABSB zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f38.wig 1c /r ] AVX512BW,FUTURE
-VPABSD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 1e /r ] AVX512VL,AVX512,FUTURE
-VPABSD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 1e /r ] AVX512VL,AVX512,FUTURE
-VPABSD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 1e /r ] AVX512,FUTURE
-VPABSQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 1f /r ] AVX512VL,AVX512,FUTURE
-VPABSQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 1f /r ] AVX512VL,AVX512,FUTURE
-VPABSQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 1f /r ] AVX512,FUTURE
-VPABSW xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f38.wig 1d /r ] AVX512VL,AVX512BW,FUTURE
-VPABSW ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f38.wig 1d /r ] AVX512VL,AVX512BW,FUTURE
-VPABSW zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f38.wig 1d /r ] AVX512BW,FUTURE
-VPACKSSDW xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 6b /r ] AVX512VL,AVX512BW,FUTURE
-VPACKSSDW ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 6b /r ] AVX512VL,AVX512BW,FUTURE
-VPACKSSDW zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 6b /r ] AVX512BW,FUTURE
-VPACKSSWB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 63 /r ] AVX512VL,AVX512BW,FUTURE
-VPACKSSWB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 63 /r ] AVX512VL,AVX512BW,FUTURE
-VPACKSSWB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 63 /r ] AVX512BW,FUTURE
-VPACKUSDW xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 2b /r ] AVX512VL,AVX512BW,FUTURE
-VPACKUSDW ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 2b /r ] AVX512VL,AVX512BW,FUTURE
-VPACKUSDW zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 2b /r ] AVX512BW,FUTURE
-VPACKUSWB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 67 /r ] AVX512VL,AVX512BW,FUTURE
-VPACKUSWB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 67 /r ] AVX512VL,AVX512BW,FUTURE
-VPACKUSWB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 67 /r ] AVX512BW,FUTURE
-VPADDB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig fc /r ] AVX512VL,AVX512BW,FUTURE
-VPADDB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig fc /r ] AVX512VL,AVX512BW,FUTURE
-VPADDB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig fc /r ] AVX512BW,FUTURE
-VPADDD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 fe /r ] AVX512VL,AVX512,FUTURE
-VPADDD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 fe /r ] AVX512VL,AVX512,FUTURE
-VPADDD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 fe /r ] AVX512,FUTURE
-VPADDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 d4 /r ] AVX512VL,AVX512,FUTURE
-VPADDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 d4 /r ] AVX512VL,AVX512,FUTURE
-VPADDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 d4 /r ] AVX512,FUTURE
-VPADDSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ec /r ] AVX512VL,AVX512BW,FUTURE
-VPADDSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ec /r ] AVX512VL,AVX512BW,FUTURE
-VPADDSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ec /r ] AVX512BW,FUTURE
-VPADDSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ed /r ] AVX512VL,AVX512BW,FUTURE
-VPADDSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ed /r ] AVX512VL,AVX512BW,FUTURE
-VPADDSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ed /r ] AVX512BW,FUTURE
-VPADDUSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig dc /r ] AVX512VL,AVX512BW,FUTURE
-VPADDUSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig dc /r ] AVX512VL,AVX512BW,FUTURE
-VPADDUSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig dc /r ] AVX512BW,FUTURE
-VPADDUSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig dd /r ] AVX512VL,AVX512BW,FUTURE
-VPADDUSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig dd /r ] AVX512VL,AVX512BW,FUTURE
-VPADDUSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig dd /r ] AVX512BW,FUTURE
-VPADDW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig fd /r ] AVX512VL,AVX512BW,FUTURE
-VPADDW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig fd /r ] AVX512VL,AVX512BW,FUTURE
-VPADDW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig fd /r ] AVX512BW,FUTURE
-VPALIGNR xmmreg|mask|z,xmmreg*,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.wig 0f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPALIGNR ymmreg|mask|z,ymmreg*,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.wig 0f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPALIGNR zmmreg|mask|z,zmmreg*,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.wig 0f /r ib ] AVX512BW,FUTURE
-VPANDD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 db /r ] AVX512VL,AVX512,FUTURE
-VPANDD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 db /r ] AVX512VL,AVX512,FUTURE
-VPANDD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 db /r ] AVX512,FUTURE
-VPANDND xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 df /r ] AVX512VL,AVX512,FUTURE
-VPANDND ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 df /r ] AVX512VL,AVX512,FUTURE
-VPANDND zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 df /r ] AVX512,FUTURE
-VPANDNQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 df /r ] AVX512VL,AVX512,FUTURE
-VPANDNQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 df /r ] AVX512VL,AVX512,FUTURE
-VPANDNQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 df /r ] AVX512,FUTURE
-VPANDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 db /r ] AVX512VL,AVX512,FUTURE
-VPANDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 db /r ] AVX512VL,AVX512,FUTURE
-VPANDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 db /r ] AVX512,FUTURE
-VPAVGB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e0 /r ] AVX512VL,AVX512BW,FUTURE
-VPAVGB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e0 /r ] AVX512VL,AVX512BW,FUTURE
-VPAVGB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e0 /r ] AVX512BW,FUTURE
-VPAVGW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e3 /r ] AVX512VL,AVX512BW,FUTURE
-VPAVGW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e3 /r ] AVX512VL,AVX512BW,FUTURE
-VPAVGW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e3 /r ] AVX512BW,FUTURE
-VPBLENDMB xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 66 /r ] AVX512VL,AVX512BW,FUTURE
-VPBLENDMB ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 66 /r ] AVX512VL,AVX512BW,FUTURE
-VPBLENDMB zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 66 /r ] AVX512BW,FUTURE
-VPBLENDMD xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 64 /r ] AVX512VL,AVX512,FUTURE
-VPBLENDMD ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 64 /r ] AVX512VL,AVX512,FUTURE
-VPBLENDMD zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 64 /r ] AVX512,FUTURE
-VPBLENDMQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 64 /r ] AVX512VL,AVX512,FUTURE
-VPBLENDMQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 64 /r ] AVX512VL,AVX512,FUTURE
-VPBLENDMQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 64 /r ] AVX512,FUTURE
-VPBLENDMW xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 66 /r ] AVX512VL,AVX512BW,FUTURE
-VPBLENDMW ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 66 /r ] AVX512VL,AVX512BW,FUTURE
-VPBLENDMW zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 66 /r ] AVX512BW,FUTURE
-VPBROADCASTB xmmreg|mask|z,xmmrm8 [rm:t1s8: evex.128.66.0f38.w0 78 /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB ymmreg|mask|z,xmmrm8 [rm:t1s8: evex.256.66.0f38.w0 78 /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB zmmreg|mask|z,xmmrm8 [rm:t1s8: evex.512.66.0f38.w0 78 /r ] AVX512BW,FUTURE
-VPBROADCASTB xmmreg|mask|z,reg8 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB xmmreg|mask|z,reg16 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB ymmreg|mask|z,reg8 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB ymmreg|mask|z,reg16 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTB zmmreg|mask|z,reg8 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
-VPBROADCASTB zmmreg|mask|z,reg16 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
-VPBROADCASTB zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
-VPBROADCASTB zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
-VPBROADCASTD xmmreg|mask|z,mem32 [rm:t1s: evex.128.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD ymmreg|mask|z,mem32 [rm:t1s: evex.256.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD zmmreg|mask|z,mem32 [rm:t1s: evex.512.66.0f38.w0 58 /r ] AVX512,FUTURE
-VPBROADCASTD xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w0 58 /r ] AVX512,FUTURE
-VPBROADCASTD xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7c /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7c /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTD zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7c /r ] AVX512,FUTURE
-VPBROADCASTMB2Q xmmreg,kreg [rm: evex.128.f3.0f38.w1 2a /r ] AVX512VL,AVX512CD,FUTURE
-VPBROADCASTMB2Q ymmreg,kreg [rm: evex.256.f3.0f38.w1 2a /r ] AVX512VL,AVX512CD,FUTURE
-VPBROADCASTMB2Q zmmreg,kreg [rm: evex.512.f3.0f38.w1 2a /r ] AVX512CD,FUTURE
-VPBROADCASTMW2D xmmreg,kreg [rm: evex.128.f3.0f38.w0 3a /r ] AVX512VL,AVX512CD,FUTURE
-VPBROADCASTMW2D ymmreg,kreg [rm: evex.256.f3.0f38.w0 3a /r ] AVX512VL,AVX512CD,FUTURE
-VPBROADCASTMW2D zmmreg,kreg [rm: evex.512.f3.0f38.w0 3a /r ] AVX512CD,FUTURE
-VPBROADCASTQ xmmreg|mask|z,mem64 [rm:t1s: evex.128.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ ymmreg|mask|z,mem64 [rm:t1s: evex.256.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ zmmreg|mask|z,mem64 [rm:t1s: evex.512.66.0f38.w1 59 /r ] AVX512,FUTURE
-VPBROADCASTQ xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w1 59 /r ] AVX512,FUTURE
-VPBROADCASTQ xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w1 7c /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w1 7c /r ] AVX512VL,AVX512,FUTURE
-VPBROADCASTQ zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w1 7c /r ] AVX512,FUTURE
-VPBROADCASTW xmmreg|mask|z,xmmrm16 [rm:t1s16: evex.128.66.0f38.w0 79 /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW ymmreg|mask|z,xmmrm16 [rm:t1s16: evex.256.66.0f38.w0 79 /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW zmmreg|mask|z,xmmrm16 [rm:t1s16: evex.512.66.0f38.w0 79 /r ] AVX512BW,FUTURE
-VPBROADCASTW xmmreg|mask|z,reg16 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW ymmreg|mask|z,reg16 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
-VPBROADCASTW zmmreg|mask|z,reg16 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
-VPBROADCASTW zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
-VPBROADCASTW zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
-VPCMPB kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 3f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPB kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 3f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPB kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 3f /r ib ] AVX512BW,FUTURE
-VPCMPD kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 1f /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPD kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 1f /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPD kreg|mask,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 1f /r ib ] AVX512,FUTURE
-VPCMPEQB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 74 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPEQB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 74 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPEQB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 74 /r ] AVX512BW,FUTURE
-VPCMPEQD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 76 /r ] AVX512VL,AVX512,FUTURE
-VPCMPEQD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 76 /r ] AVX512VL,AVX512,FUTURE
-VPCMPEQD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 76 /r ] AVX512,FUTURE
-VPCMPEQQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VPCMPEQQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 29 /r ] AVX512VL,AVX512,FUTURE
-VPCMPEQQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 29 /r ] AVX512,FUTURE
-VPCMPEQW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 75 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPEQW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 75 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPEQW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 75 /r ] AVX512BW,FUTURE
-VPCMPGTB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 64 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPGTB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 64 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPGTB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 64 /r ] AVX512BW,FUTURE
-VPCMPGTD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 66 /r ] AVX512VL,AVX512,FUTURE
-VPCMPGTD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 66 /r ] AVX512VL,AVX512,FUTURE
-VPCMPGTD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 66 /r ] AVX512,FUTURE
-VPCMPGTQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 37 /r ] AVX512VL,AVX512,FUTURE
-VPCMPGTQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 37 /r ] AVX512VL,AVX512,FUTURE
-VPCMPGTQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 37 /r ] AVX512,FUTURE
-VPCMPGTW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 65 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPGTW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 65 /r ] AVX512VL,AVX512BW,FUTURE
-VPCMPGTW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 65 /r ] AVX512BW,FUTURE
-VPCMPQ kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 1f /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPQ kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 1f /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPQ kreg|mask,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 1f /r ib ] AVX512,FUTURE
-VPCMPUB kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 3e /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPUB kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 3e /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPUB kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 3e /r ib ] AVX512BW,FUTURE
-VPCMPUD kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 1e /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPUD kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 1e /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPUD kreg|mask,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 1e /r ib ] AVX512,FUTURE
-VPCMPUQ kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 1e /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPUQ kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 1e /r ib ] AVX512VL,AVX512,FUTURE
-VPCMPUQ kreg|mask,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 1e /r ib ] AVX512,FUTURE
-VPCMPUW kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w1 3e /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPUW kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w1 3e /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPUW kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w1 3e /r ib ] AVX512BW,FUTURE
-VPCMPW kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w1 3f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPW kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w1 3f /r ib ] AVX512VL,AVX512BW,FUTURE
-VPCMPW kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w1 3f /r ib ] AVX512BW,FUTURE
-VPCOMPRESSD mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSD mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSD mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w0 8b /r ] AVX512,FUTURE
-VPCOMPRESSD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w0 8b /r ] AVX512,FUTURE
-VPCOMPRESSQ mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSQ mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSQ mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w1 8b /r ] AVX512,FUTURE
-VPCOMPRESSQ xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSQ ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
-VPCOMPRESSQ zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w1 8b /r ] AVX512,FUTURE
-VPCONFLICTD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 c4 /r ] AVX512VL,AVX512CD,FUTURE
-VPCONFLICTD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 c4 /r ] AVX512VL,AVX512CD,FUTURE
-VPCONFLICTD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 c4 /r ] AVX512CD,FUTURE
-VPCONFLICTQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 c4 /r ] AVX512VL,AVX512CD,FUTURE
-VPCONFLICTQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 c4 /r ] AVX512VL,AVX512CD,FUTURE
-VPCONFLICTQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 c4 /r ] AVX512CD,FUTURE
-VPERMB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 8d /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 8d /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 8d /r ] AVX512VBMI,FUTURE
-VPERMD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 36 /r ] AVX512VL,AVX512,FUTURE
-VPERMD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 36 /r ] AVX512,FUTURE
-VPERMI2B xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 75 /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMI2B ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 75 /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMI2B zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 75 /r ] AVX512VBMI,FUTURE
-VPERMI2D xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 76 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2D ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 76 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2D zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 76 /r ] AVX512,FUTURE
-VPERMI2PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 77 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 77 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2PD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 77 /r ] AVX512,FUTURE
-VPERMI2PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 77 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 77 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2PS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 77 /r ] AVX512,FUTURE
-VPERMI2Q xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 76 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2Q ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 76 /r ] AVX512VL,AVX512,FUTURE
-VPERMI2Q zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 76 /r ] AVX512,FUTURE
-VPERMI2W xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 75 /r ] AVX512VL,AVX512BW,FUTURE
-VPERMI2W ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 75 /r ] AVX512VL,AVX512BW,FUTURE
-VPERMI2W zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 75 /r ] AVX512BW,FUTURE
-VPERMILPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 05 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMILPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 05 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMILPD zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 05 /r ib ] AVX512,FUTURE
-VPERMILPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 0d /r ] AVX512VL,AVX512,FUTURE
-VPERMILPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 0d /r ] AVX512VL,AVX512,FUTURE
-VPERMILPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 0d /r ] AVX512,FUTURE
-VPERMILPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 04 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMILPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 04 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMILPS zmmreg|mask|z,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f3a.w0 04 /r ib ] AVX512,FUTURE
-VPERMILPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 0c /r ] AVX512VL,AVX512,FUTURE
-VPERMILPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 0c /r ] AVX512VL,AVX512,FUTURE
-VPERMILPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 0c /r ] AVX512,FUTURE
-VPERMPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 01 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMPD zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 01 /r ib ] AVX512,FUTURE
-VPERMPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 16 /r ] AVX512VL,AVX512,FUTURE
-VPERMPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 16 /r ] AVX512,FUTURE
-VPERMPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 16 /r ] AVX512VL,AVX512,FUTURE
-VPERMPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 16 /r ] AVX512,FUTURE
-VPERMQ ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 00 /r ib ] AVX512VL,AVX512,FUTURE
-VPERMQ zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 00 /r ib ] AVX512,FUTURE
-VPERMQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 36 /r ] AVX512VL,AVX512,FUTURE
-VPERMQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 36 /r ] AVX512,FUTURE
-VPERMT2B xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 7d /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMT2B ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 7d /r ] AVX512VL,AVX512VBMI,FUTURE
-VPERMT2B zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 7d /r ] AVX512VBMI,FUTURE
-VPERMT2D xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 7e /r ] AVX512VL,AVX512,FUTURE
-VPERMT2D ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 7e /r ] AVX512VL,AVX512,FUTURE
-VPERMT2D zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 7e /r ] AVX512,FUTURE
-VPERMT2PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VPERMT2PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 7f /r ] AVX512VL,AVX512,FUTURE
-VPERMT2PD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 7f /r ] AVX512,FUTURE
-VPERMT2PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VPERMT2PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 7f /r ] AVX512VL,AVX512,FUTURE
-VPERMT2PS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 7f /r ] AVX512,FUTURE
-VPERMT2Q xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 7e /r ] AVX512VL,AVX512,FUTURE
-VPERMT2Q ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 7e /r ] AVX512VL,AVX512,FUTURE
-VPERMT2Q zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 7e /r ] AVX512,FUTURE
-VPERMT2W xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 7d /r ] AVX512VL,AVX512BW,FUTURE
-VPERMT2W ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 7d /r ] AVX512VL,AVX512BW,FUTURE
-VPERMT2W zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 7d /r ] AVX512BW,FUTURE
-VPERMW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 8d /r ] AVX512VL,AVX512BW,FUTURE
-VPERMW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 8d /r ] AVX512VL,AVX512BW,FUTURE
-VPERMW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 8d /r ] AVX512BW,FUTURE
-VPEXPANDD xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDD ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDD zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w0 89 /r ] AVX512,FUTURE
-VPEXPANDD xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDD ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDD zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w0 89 /r ] AVX512,FUTURE
-VPEXPANDQ xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDQ ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDQ zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w1 89 /r ] AVX512,FUTURE
-VPEXPANDQ xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDQ ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
-VPEXPANDQ zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w1 89 /r ] AVX512,FUTURE
-VPEXTRB reg8,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
-VPEXTRB reg16,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
-VPEXTRB reg32,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
-VPEXTRB reg64,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
-VPEXTRB mem8,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
-VPEXTRD rm32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.w0 16 /r ib ] AVX512DQ,FUTURE
-VPEXTRQ rm64,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.w1 16 /r ib ] AVX512DQ,FUTURE
-VPEXTRW reg16,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
-VPEXTRW reg32,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
-VPEXTRW reg64,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
-VPEXTRW mem16,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
-VPEXTRW reg16,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
-VPEXTRW reg32,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
-VPEXTRW reg64,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
-VPGATHERDD xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 90 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERDD ymmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 90 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERDD zmmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 90 /r ] AVX512,FUTURE
-VPGATHERDQ xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 90 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERDQ ymmreg|mask,xmem64 [rm:t1s: vsibx evex.256.66.0f38.w1 90 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERDQ zmmreg|mask,ymem64 [rm:t1s: vsiby evex.512.66.0f38.w1 90 /r ] AVX512,FUTURE
-VPGATHERQD xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 91 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERQD xmmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 91 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERQD ymmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 91 /r ] AVX512,FUTURE
-VPGATHERQQ xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 91 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERQQ ymmreg|mask,ymem64 [rm:t1s: vsiby evex.256.66.0f38.w1 91 /r ] AVX512VL,AVX512,FUTURE
-VPGATHERQQ zmmreg|mask,zmem64 [rm:t1s: vsibz evex.512.66.0f38.w1 91 /r ] AVX512,FUTURE
-VPINSRB xmmreg,xmmreg*,reg32,imm8 [rvmi:t1s8: evex.nds.128.66.0f3a.wig 20 /r ib ] AVX512BW,FUTURE
-VPINSRB xmmreg,xmmreg*,mem8,imm8 [rvmi:t1s8: evex.nds.128.66.0f3a.wig 20 /r ib ] AVX512BW,FUTURE
-VPINSRD xmmreg,xmmreg*,rm32,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 22 /r ib ] AVX512DQ,FUTURE
-VPINSRQ xmmreg,xmmreg*,rm64,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 22 /r ib ] AVX512DQ,FUTURE
-VPINSRW xmmreg,xmmreg*,reg32,imm8 [rvmi:t1s16: evex.nds.128.66.0f.wig c4 /r ib ] AVX512BW,FUTURE
-VPINSRW xmmreg,xmmreg*,mem16,imm8 [rvmi:t1s16: evex.nds.128.66.0f.wig c4 /r ib ] AVX512BW,FUTURE
-VPLZCNTD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 44 /r ] AVX512VL,AVX512CD,FUTURE
-VPLZCNTD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 44 /r ] AVX512VL,AVX512CD,FUTURE
-VPLZCNTD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 44 /r ] AVX512CD,FUTURE
-VPLZCNTQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 44 /r ] AVX512VL,AVX512CD,FUTURE
-VPLZCNTQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 44 /r ] AVX512VL,AVX512CD,FUTURE
-VPLZCNTQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 44 /r ] AVX512CD,FUTURE
-VPMADD52HUQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b5 /r ] AVX512VL,AVX512IFMA,FUTURE
-VPMADD52HUQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b5 /r ] AVX512VL,AVX512IFMA,FUTURE
-VPMADD52HUQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 b5 /r ] AVX512IFMA,FUTURE
-VPMADD52LUQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b4 /r ] AVX512VL,AVX512IFMA,FUTURE
-VPMADD52LUQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b4 /r ] AVX512VL,AVX512IFMA,FUTURE
-VPMADD52LUQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 b4 /r ] AVX512IFMA,FUTURE
-VPMADDUBSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 04 /r ] AVX512VL,AVX512BW,FUTURE
-VPMADDUBSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 04 /r ] AVX512VL,AVX512BW,FUTURE
-VPMADDUBSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 04 /r ] AVX512BW,FUTURE
-VPMADDWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMADDWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMADDWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f5 /r ] AVX512BW,FUTURE
-VPMAXSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3c /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3c /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3c /r ] AVX512BW,FUTURE
-VPMAXSD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3d /r ] AVX512VL,AVX512,FUTURE
-VPMAXSD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3d /r ] AVX512VL,AVX512,FUTURE
-VPMAXSD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3d /r ] AVX512,FUTURE
-VPMAXSQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3d /r ] AVX512VL,AVX512,FUTURE
-VPMAXSQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3d /r ] AVX512VL,AVX512,FUTURE
-VPMAXSQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3d /r ] AVX512,FUTURE
-VPMAXSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ee /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ee /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ee /r ] AVX512BW,FUTURE
-VPMAXUB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig de /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXUB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig de /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXUB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig de /r ] AVX512BW,FUTURE
-VPMAXUD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3f /r ] AVX512VL,AVX512,FUTURE
-VPMAXUD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3f /r ] AVX512VL,AVX512,FUTURE
-VPMAXUD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3f /r ] AVX512,FUTURE
-VPMAXUQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3f /r ] AVX512VL,AVX512,FUTURE
-VPMAXUQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3f /r ] AVX512VL,AVX512,FUTURE
-VPMAXUQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3f /r ] AVX512,FUTURE
-VPMAXUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3e /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3e /r ] AVX512VL,AVX512BW,FUTURE
-VPMAXUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3e /r ] AVX512BW,FUTURE
-VPMINSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 38 /r ] AVX512VL,AVX512BW,FUTURE
-VPMINSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 38 /r ] AVX512VL,AVX512BW,FUTURE
-VPMINSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 38 /r ] AVX512BW,FUTURE
-VPMINSD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 39 /r ] AVX512VL,AVX512,FUTURE
-VPMINSD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 39 /r ] AVX512VL,AVX512,FUTURE
-VPMINSD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 39 /r ] AVX512,FUTURE
-VPMINSQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 39 /r ] AVX512VL,AVX512,FUTURE
-VPMINSQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 39 /r ] AVX512VL,AVX512,FUTURE
-VPMINSQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 39 /r ] AVX512,FUTURE
-VPMINSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ea /r ] AVX512VL,AVX512BW,FUTURE
-VPMINSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ea /r ] AVX512VL,AVX512BW,FUTURE
-VPMINSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ea /r ] AVX512BW,FUTURE
-VPMINUB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig da /r ] AVX512VL,AVX512BW,FUTURE
-VPMINUB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig da /r ] AVX512VL,AVX512BW,FUTURE
-VPMINUB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig da /r ] AVX512BW,FUTURE
-VPMINUD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3b /r ] AVX512VL,AVX512,FUTURE
-VPMINUD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3b /r ] AVX512VL,AVX512,FUTURE
-VPMINUD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3b /r ] AVX512,FUTURE
-VPMINUQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3b /r ] AVX512VL,AVX512,FUTURE
-VPMINUQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3b /r ] AVX512VL,AVX512,FUTURE
-VPMINUQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3b /r ] AVX512,FUTURE
-VPMINUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3a /r ] AVX512VL,AVX512BW,FUTURE
-VPMINUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3a /r ] AVX512VL,AVX512BW,FUTURE
-VPMINUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3a /r ] AVX512BW,FUTURE
-VPMOVB2M kreg,xmmreg [rm: evex.128.f3.0f38.w0 29 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVB2M kreg,ymmreg [rm: evex.256.f3.0f38.w0 29 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVB2M kreg,zmmreg [rm: evex.512.f3.0f38.w0 29 /r ] AVX512BW,FUTURE
-VPMOVD2M kreg,xmmreg [rm: evex.128.f3.0f38.w0 39 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVD2M kreg,ymmreg [rm: evex.256.f3.0f38.w0 39 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVD2M kreg,zmmreg [rm: evex.512.f3.0f38.w0 39 /r ] AVX512DQ,FUTURE
-VPMOVDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 31 /r ] AVX512,FUTURE
-VPMOVDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 31 /r ] AVX512,FUTURE
-VPMOVDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 33 /r ] AVX512,FUTURE
-VPMOVDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 33 /r ] AVX512,FUTURE
-VPMOVM2B xmmreg,kreg [rm: evex.128.f3.0f38.w0 28 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVM2B ymmreg,kreg [rm: evex.256.f3.0f38.w0 28 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVM2B zmmreg,kreg [rm: evex.512.f3.0f38.w0 28 /r ] AVX512BW,FUTURE
-VPMOVM2D xmmreg,kreg [rm: evex.128.f3.0f38.w0 38 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVM2D ymmreg,kreg [rm: evex.256.f3.0f38.w0 38 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVM2D zmmreg,kreg [rm: evex.512.f3.0f38.w0 38 /r ] AVX512DQ,FUTURE
-VPMOVM2Q xmmreg,kreg [rm: evex.128.f3.0f38.w1 38 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVM2Q ymmreg,kreg [rm: evex.256.f3.0f38.w1 38 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVM2Q zmmreg,kreg [rm: evex.512.f3.0f38.w1 38 /r ] AVX512DQ,FUTURE
-VPMOVM2W xmmreg,kreg [rm: evex.128.f3.0f38.w1 28 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVM2W ymmreg,kreg [rm: evex.256.f3.0f38.w1 28 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVM2W zmmreg,kreg [rm: evex.512.f3.0f38.w1 28 /r ] AVX512BW,FUTURE
-VPMOVQ2M kreg,xmmreg [rm: evex.128.f3.0f38.w1 39 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVQ2M kreg,ymmreg [rm: evex.256.f3.0f38.w1 39 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMOVQ2M kreg,zmmreg [rm: evex.512.f3.0f38.w1 39 /r ] AVX512DQ,FUTURE
-VPMOVQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 32 /r ] AVX512,FUTURE
-VPMOVQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 32 /r ] AVX512,FUTURE
-VPMOVQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 35 /r ] AVX512,FUTURE
-VPMOVQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 35 /r ] AVX512,FUTURE
-VPMOVQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 34 /r ] AVX512,FUTURE
-VPMOVQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 34 /r ] AVX512,FUTURE
-VPMOVSDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 21 /r ] AVX512,FUTURE
-VPMOVSDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 21 /r ] AVX512,FUTURE
-VPMOVSDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 23 /r ] AVX512,FUTURE
-VPMOVSDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 23 /r ] AVX512,FUTURE
-VPMOVSQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 22 /r ] AVX512,FUTURE
-VPMOVSQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 22 /r ] AVX512,FUTURE
-VPMOVSQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 25 /r ] AVX512,FUTURE
-VPMOVSQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 25 /r ] AVX512,FUTURE
-VPMOVSQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 24 /r ] AVX512,FUTURE
-VPMOVSQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 24 /r ] AVX512,FUTURE
-VPMOVSWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 20 /r ] AVX512BW,FUTURE
-VPMOVSWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 20 /r ] AVX512BW,FUTURE
-VPMOVSXBD xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXBD ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 21 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXBD zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 21 /r ] AVX512,FUTURE
-VPMOVSXBQ xmmreg|mask|z,xmmrm16 [rm:ovm: evex.128.66.0f38.wig 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXBQ ymmreg|mask|z,xmmrm32 [rm:ovm: evex.256.66.0f38.wig 22 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXBQ zmmreg|mask|z,xmmrm64 [rm:ovm: evex.512.66.0f38.wig 22 /r ] AVX512,FUTURE
-VPMOVSXBW xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSXBW ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 20 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVSXBW zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 20 /r ] AVX512BW,FUTURE
-VPMOVSXDQ xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXDQ ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXDQ zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.w0 25 /r ] AVX512,FUTURE
-VPMOVSXWD xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXWD ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 23 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXWD zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 23 /r ] AVX512,FUTURE
-VPMOVSXWQ xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXWQ ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 24 /r ] AVX512VL,AVX512,FUTURE
-VPMOVSXWQ zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 24 /r ] AVX512,FUTURE
-VPMOVUSDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 11 /r ] AVX512,FUTURE
-VPMOVUSDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 11 /r ] AVX512,FUTURE
-VPMOVUSDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 13 /r ] AVX512,FUTURE
-VPMOVUSDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 13 /r ] AVX512,FUTURE
-VPMOVUSQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 12 /r ] AVX512,FUTURE
-VPMOVUSQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 12 /r ] AVX512,FUTURE
-VPMOVUSQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 15 /r ] AVX512,FUTURE
-VPMOVUSQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 15 /r ] AVX512,FUTURE
-VPMOVUSQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 14 /r ] AVX512,FUTURE
-VPMOVUSQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPMOVUSQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 14 /r ] AVX512,FUTURE
-VPMOVUSWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVUSWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVUSWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 10 /r ] AVX512BW,FUTURE
-VPMOVUSWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVUSWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVUSWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 10 /r ] AVX512BW,FUTURE
-VPMOVW2M kreg,xmmreg [rm: evex.128.f3.0f38.w1 29 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVW2M kreg,ymmreg [rm: evex.256.f3.0f38.w1 29 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVW2M kreg,zmmreg [rm: evex.512.f3.0f38.w1 29 /r ] AVX512BW,FUTURE
-VPMOVWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 30 /r ] AVX512BW,FUTURE
-VPMOVWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 30 /r ] AVX512BW,FUTURE
-VPMOVZXBD xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXBD ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 31 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXBD zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 31 /r ] AVX512,FUTURE
-VPMOVZXBQ xmmreg|mask|z,xmmrm16 [rm:ovm: evex.128.66.0f38.wig 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXBQ ymmreg|mask|z,xmmrm32 [rm:ovm: evex.256.66.0f38.wig 32 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXBQ zmmreg|mask|z,xmmrm64 [rm:ovm: evex.512.66.0f38.wig 32 /r ] AVX512,FUTURE
-VPMOVZXBW xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVZXBW ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 30 /r ] AVX512VL,AVX512BW,FUTURE
-VPMOVZXBW zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 30 /r ] AVX512BW,FUTURE
-VPMOVZXDQ xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXDQ ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXDQ zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.w0 35 /r ] AVX512,FUTURE
-VPMOVZXWD xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXWD ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 33 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXWD zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 33 /r ] AVX512,FUTURE
-VPMOVZXWQ xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXWQ ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 34 /r ] AVX512VL,AVX512,FUTURE
-VPMOVZXWQ zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 34 /r ] AVX512,FUTURE
-VPMULDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 28 /r ] AVX512VL,AVX512,FUTURE
-VPMULDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 28 /r ] AVX512VL,AVX512,FUTURE
-VPMULDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 28 /r ] AVX512,FUTURE
-VPMULHRSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 0b /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHRSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 0b /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHRSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 0b /r ] AVX512BW,FUTURE
-VPMULHUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e4 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e4 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e4 /r ] AVX512BW,FUTURE
-VPMULHW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULHW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e5 /r ] AVX512BW,FUTURE
-VPMULLD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 40 /r ] AVX512VL,AVX512,FUTURE
-VPMULLD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 40 /r ] AVX512VL,AVX512,FUTURE
-VPMULLD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 40 /r ] AVX512,FUTURE
-VPMULLQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 40 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMULLQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 40 /r ] AVX512VL,AVX512DQ,FUTURE
-VPMULLQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 40 /r ] AVX512DQ,FUTURE
-VPMULLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULLW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d5 /r ] AVX512VL,AVX512BW,FUTURE
-VPMULLW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d5 /r ] AVX512BW,FUTURE
-VPMULTISHIFTQB xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 83 /r ] AVX512VL,AVX512VBMI,FUTURE
-VPMULTISHIFTQB ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 83 /r ] AVX512VL,AVX512VBMI,FUTURE
-VPMULTISHIFTQB zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 83 /r ] AVX512VBMI,FUTURE
-VPMULUDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 f4 /r ] AVX512VL,AVX512,FUTURE
-VPMULUDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 f4 /r ] AVX512VL,AVX512,FUTURE
-VPMULUDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 f4 /r ] AVX512,FUTURE
-VPORD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 eb /r ] AVX512VL,AVX512,FUTURE
-VPORD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 eb /r ] AVX512VL,AVX512,FUTURE
-VPORD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 eb /r ] AVX512,FUTURE
-VPORQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 eb /r ] AVX512VL,AVX512,FUTURE
-VPORQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 eb /r ] AVX512VL,AVX512,FUTURE
-VPORQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 eb /r ] AVX512,FUTURE
-VPROLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /1 ib ] AVX512VL,AVX512,FUTURE
-VPROLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /1 ib ] AVX512VL,AVX512,FUTURE
-VPROLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /1 ib ] AVX512,FUTURE
-VPROLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /1 ib ] AVX512VL,AVX512,FUTURE
-VPROLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /1 ib ] AVX512VL,AVX512,FUTURE
-VPROLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /1 ib ] AVX512,FUTURE
-VPROLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPROLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VPROLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 15 /r ] AVX512,FUTURE
-VPROLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 15 /r ] AVX512VL,AVX512,FUTURE
-VPROLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 15 /r ] AVX512VL,AVX512,FUTURE
-VPROLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 15 /r ] AVX512,FUTURE
-VPRORD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /0 ib ] AVX512VL,AVX512,FUTURE
-VPRORD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /0 ib ] AVX512VL,AVX512,FUTURE
-VPRORD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /0 ib ] AVX512,FUTURE
-VPRORQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /0 ib ] AVX512VL,AVX512,FUTURE
-VPRORQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /0 ib ] AVX512VL,AVX512,FUTURE
-VPRORQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /0 ib ] AVX512,FUTURE
-VPRORVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPRORVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VPRORVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 14 /r ] AVX512,FUTURE
-VPRORVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 14 /r ] AVX512VL,AVX512,FUTURE
-VPRORVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 14 /r ] AVX512VL,AVX512,FUTURE
-VPRORVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 14 /r ] AVX512,FUTURE
-VPSADBW xmmreg,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f6 /r ] AVX512VL,AVX512BW,FUTURE
-VPSADBW ymmreg,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f6 /r ] AVX512VL,AVX512BW,FUTURE
-VPSADBW zmmreg,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f6 /r ] AVX512BW,FUTURE
-VPSCATTERDD xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a0 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERDD ymem32|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a0 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERDD zmem32|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a0 /r ] AVX512,FUTURE
-VPSCATTERDQ xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a0 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERDQ xmem64|mask,ymmreg [mr:t1s: vsibx evex.256.66.0f38.w1 a0 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERDQ ymem64|mask,zmmreg [mr:t1s: vsiby evex.512.66.0f38.w1 a0 /r ] AVX512,FUTURE
-VPSCATTERQD xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a1 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERQD ymem32|mask,xmmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a1 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERQD zmem32|mask,ymmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a1 /r ] AVX512,FUTURE
-VPSCATTERQQ xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a1 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERQQ ymem64|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w1 a1 /r ] AVX512VL,AVX512,FUTURE
-VPSCATTERQQ zmem64|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w1 a1 /r ] AVX512,FUTURE
-VPSHUFB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 00 /r ] AVX512VL,AVX512BW,FUTURE
-VPSHUFB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 00 /r ] AVX512VL,AVX512BW,FUTURE
-VPSHUFB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 00 /r ] AVX512BW,FUTURE
-VPSHUFD xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f.w0 70 /r ib ] AVX512VL,AVX512,FUTURE
-VPSHUFD ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f.w0 70 /r ib ] AVX512VL,AVX512,FUTURE
-VPSHUFD zmmreg|mask|z,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f.w0 70 /r ib ] AVX512,FUTURE
-VPSHUFHW xmmreg|mask|z,xmmrm128,imm8 [rmi:fvm: evex.128.f3.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
-VPSHUFHW ymmreg|mask|z,ymmrm256,imm8 [rmi:fvm: evex.256.f3.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
-VPSHUFHW zmmreg|mask|z,zmmrm512,imm8 [rmi:fvm: evex.512.f3.0f.wig 70 /r ib ] AVX512BW,FUTURE
-VPSHUFLW xmmreg|mask|z,xmmrm128,imm8 [rmi:fvm: evex.128.f2.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
-VPSHUFLW ymmreg|mask|z,ymmrm256,imm8 [rmi:fvm: evex.256.f2.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
-VPSHUFLW zmmreg|mask|z,zmmrm512,imm8 [rmi:fvm: evex.512.f2.0f.wig 70 /r ib ] AVX512BW,FUTURE
-VPSLLD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 f2 /r ] AVX512VL,AVX512,FUTURE
-VPSLLD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 f2 /r ] AVX512VL,AVX512,FUTURE
-VPSLLD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 f2 /r ] AVX512,FUTURE
-VPSLLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /6 ib ] AVX512VL,AVX512,FUTURE
-VPSLLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /6 ib ] AVX512VL,AVX512,FUTURE
-VPSLLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /6 ib ] AVX512,FUTURE
-VPSLLDQ xmmreg,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 73 /7 ib ] AVX512VL,AVX512BW,FUTURE
-VPSLLDQ ymmreg,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 73 /7 ib ] AVX512VL,AVX512BW,FUTURE
-VPSLLDQ zmmreg,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 73 /7 ib ] AVX512BW,FUTURE
-VPSLLQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 f3 /r ] AVX512VL,AVX512,FUTURE
-VPSLLQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 f3 /r ] AVX512VL,AVX512,FUTURE
-VPSLLQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 f3 /r ] AVX512,FUTURE
-VPSLLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 73 /6 ib ] AVX512VL,AVX512,FUTURE
-VPSLLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 73 /6 ib ] AVX512VL,AVX512,FUTURE
-VPSLLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 73 /6 ib ] AVX512,FUTURE
-VPSLLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 47 /r ] AVX512VL,AVX512,FUTURE
-VPSLLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 47 /r ] AVX512VL,AVX512,FUTURE
-VPSLLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 47 /r ] AVX512,FUTURE
-VPSLLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 47 /r ] AVX512VL,AVX512,FUTURE
-VPSLLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 47 /r ] AVX512VL,AVX512,FUTURE
-VPSLLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 47 /r ] AVX512,FUTURE
-VPSLLVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 12 /r ] AVX512VL,AVX512BW,FUTURE
-VPSLLVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 12 /r ] AVX512VL,AVX512BW,FUTURE
-VPSLLVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 12 /r ] AVX512BW,FUTURE
-VPSLLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig f1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSLLW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig f1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSLLW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig f1 /r ] AVX512BW,FUTURE
-VPSLLW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /6 ib ] AVX512VL,AVX512BW,FUTURE
-VPSLLW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /6 ib ] AVX512VL,AVX512BW,FUTURE
-VPSLLW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /6 ib ] AVX512BW,FUTURE
-VPSRAD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 e2 /r ] AVX512VL,AVX512,FUTURE
-VPSRAD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 e2 /r ] AVX512VL,AVX512,FUTURE
-VPSRAD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 e2 /r ] AVX512,FUTURE
-VPSRAD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /4 ib ] AVX512VL,AVX512,FUTURE
-VPSRAD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /4 ib ] AVX512VL,AVX512,FUTURE
-VPSRAD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /4 ib ] AVX512,FUTURE
-VPSRAQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 e2 /r ] AVX512VL,AVX512,FUTURE
-VPSRAQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 e2 /r ] AVX512VL,AVX512,FUTURE
-VPSRAQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 e2 /r ] AVX512,FUTURE
-VPSRAQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /4 ib ] AVX512VL,AVX512,FUTURE
-VPSRAQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /4 ib ] AVX512VL,AVX512,FUTURE
-VPSRAQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /4 ib ] AVX512,FUTURE
-VPSRAVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 46 /r ] AVX512VL,AVX512,FUTURE
-VPSRAVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 46 /r ] AVX512VL,AVX512,FUTURE
-VPSRAVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 46 /r ] AVX512,FUTURE
-VPSRAVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 46 /r ] AVX512VL,AVX512,FUTURE
-VPSRAVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 46 /r ] AVX512VL,AVX512,FUTURE
-VPSRAVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 46 /r ] AVX512,FUTURE
-VPSRAVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 11 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRAVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 11 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRAVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 11 /r ] AVX512BW,FUTURE
-VPSRAW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig e1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRAW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig e1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRAW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig e1 /r ] AVX512BW,FUTURE
-VPSRAW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /4 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRAW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /4 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRAW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /4 ib ] AVX512BW,FUTURE
-VPSRLD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 d2 /r ] AVX512VL,AVX512,FUTURE
-VPSRLD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 d2 /r ] AVX512VL,AVX512,FUTURE
-VPSRLD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 d2 /r ] AVX512,FUTURE
-VPSRLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /2 ib ] AVX512VL,AVX512,FUTURE
-VPSRLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /2 ib ] AVX512VL,AVX512,FUTURE
-VPSRLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /2 ib ] AVX512,FUTURE
-VPSRLDQ xmmreg,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 73 /3 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRLDQ ymmreg,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 73 /3 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRLDQ zmmreg,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 73 /3 ib ] AVX512BW,FUTURE
-VPSRLQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 d3 /r ] AVX512VL,AVX512,FUTURE
-VPSRLQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 d3 /r ] AVX512VL,AVX512,FUTURE
-VPSRLQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 d3 /r ] AVX512,FUTURE
-VPSRLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 73 /2 ib ] AVX512VL,AVX512,FUTURE
-VPSRLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 73 /2 ib ] AVX512VL,AVX512,FUTURE
-VPSRLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 73 /2 ib ] AVX512,FUTURE
-VPSRLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 45 /r ] AVX512VL,AVX512,FUTURE
-VPSRLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 45 /r ] AVX512VL,AVX512,FUTURE
-VPSRLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 45 /r ] AVX512,FUTURE
-VPSRLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 45 /r ] AVX512VL,AVX512,FUTURE
-VPSRLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 45 /r ] AVX512VL,AVX512,FUTURE
-VPSRLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 45 /r ] AVX512,FUTURE
-VPSRLVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRLVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 10 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRLVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 10 /r ] AVX512BW,FUTURE
-VPSRLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig d1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRLW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig d1 /r ] AVX512VL,AVX512BW,FUTURE
-VPSRLW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig d1 /r ] AVX512BW,FUTURE
-VPSRLW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /2 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRLW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /2 ib ] AVX512VL,AVX512BW,FUTURE
-VPSRLW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /2 ib ] AVX512BW,FUTURE
-VPSUBB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f8 /r ] AVX512BW,FUTURE
-VPSUBD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 fa /r ] AVX512VL,AVX512,FUTURE
-VPSUBD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 fa /r ] AVX512VL,AVX512,FUTURE
-VPSUBD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 fa /r ] AVX512,FUTURE
-VPSUBQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 fb /r ] AVX512VL,AVX512,FUTURE
-VPSUBQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 fb /r ] AVX512VL,AVX512,FUTURE
-VPSUBQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 fb /r ] AVX512,FUTURE
-VPSUBSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e8 /r ] AVX512BW,FUTURE
-VPSUBSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e9 /r ] AVX512BW,FUTURE
-VPSUBUSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBUSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d8 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBUSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d8 /r ] AVX512BW,FUTURE
-VPSUBUSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBUSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBUSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d9 /r ] AVX512BW,FUTURE
-VPSUBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f9 /r ] AVX512VL,AVX512BW,FUTURE
-VPSUBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f9 /r ] AVX512BW,FUTURE
-VPTERNLOGD xmmreg|mask|z,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 25 /r ib ] AVX512VL,AVX512,FUTURE
-VPTERNLOGD ymmreg|mask|z,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 25 /r ib ] AVX512VL,AVX512,FUTURE
-VPTERNLOGD zmmreg|mask|z,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 25 /r ib ] AVX512,FUTURE
-VPTERNLOGQ xmmreg|mask|z,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 25 /r ib ] AVX512VL,AVX512,FUTURE
-VPTERNLOGQ ymmreg|mask|z,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 25 /r ib ] AVX512VL,AVX512,FUTURE
-VPTERNLOGQ zmmreg|mask|z,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 25 /r ib ] AVX512,FUTURE
-VPTESTMB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTMB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTMB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 26 /r ] AVX512BW,FUTURE
-VPTESTMD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTMD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTMD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 27 /r ] AVX512,FUTURE
-VPTESTMQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTMQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTMQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 27 /r ] AVX512,FUTURE
-VPTESTMW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTMW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTMW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 26 /r ] AVX512BW,FUTURE
-VPTESTNMB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.f3.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTNMB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.f3.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTNMB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.f3.0f38.w0 26 /r ] AVX512BW,FUTURE
-VPTESTNMD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.f3.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTNMD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.f3.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTNMD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.f3.0f38.w0 27 /r ] AVX512,FUTURE
-VPTESTNMQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.f3.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTNMQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.f3.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
-VPTESTNMQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.f3.0f38.w1 27 /r ] AVX512,FUTURE
-VPTESTNMW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.f3.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTNMW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.f3.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
-VPTESTNMW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.f3.0f38.w1 26 /r ] AVX512BW,FUTURE
-VPUNPCKHBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 68 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKHBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 68 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKHBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 68 /r ] AVX512BW,FUTURE
-VPUNPCKHDQ xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 6a /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKHDQ ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 6a /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKHDQ zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 6a /r ] AVX512,FUTURE
-VPUNPCKHQDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 6d /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKHQDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 6d /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKHQDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 6d /r ] AVX512,FUTURE
-VPUNPCKHWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 69 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKHWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 69 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKHWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 69 /r ] AVX512BW,FUTURE
-VPUNPCKLBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 60 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKLBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 60 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKLBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 60 /r ] AVX512BW,FUTURE
-VPUNPCKLDQ xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 62 /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKLDQ ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 62 /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKLDQ zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 62 /r ] AVX512,FUTURE
-VPUNPCKLQDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 6c /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKLQDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 6c /r ] AVX512VL,AVX512,FUTURE
-VPUNPCKLQDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 6c /r ] AVX512,FUTURE
-VPUNPCKLWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 61 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKLWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 61 /r ] AVX512VL,AVX512BW,FUTURE
-VPUNPCKLWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 61 /r ] AVX512BW,FUTURE
-VPXORD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 ef /r ] AVX512VL,AVX512,FUTURE
-VPXORD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 ef /r ] AVX512VL,AVX512,FUTURE
-VPXORD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 ef /r ] AVX512,FUTURE
-VPXORQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 ef /r ] AVX512VL,AVX512,FUTURE
-VPXORQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 ef /r ] AVX512VL,AVX512,FUTURE
-VPXORQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 ef /r ] AVX512,FUTURE
-VRANGEPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VRANGEPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VRANGEPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 50 /r ib ] AVX512DQ,FUTURE
-VRANGEPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VRANGEPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VRANGEPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 50 /r ib ] AVX512DQ,FUTURE
-VRANGESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 51 /r ib ] AVX512DQ,FUTURE
-VRANGESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 51 /r ib ] AVX512DQ,FUTURE
-VRCP14PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 4c /r ] AVX512VL,AVX512,FUTURE
-VRCP14PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 4c /r ] AVX512VL,AVX512,FUTURE
-VRCP14PD zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 4c /r ] AVX512,FUTURE
-VRCP14PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 4c /r ] AVX512VL,AVX512,FUTURE
-VRCP14PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 4c /r ] AVX512VL,AVX512,FUTURE
-VRCP14PS zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 4c /r ] AVX512,FUTURE
-VRCP14SD xmmreg|mask|z,xmmreg*,xmmrm64 [rvm:t1s: evex.nds.128.66.0f38.w1 4d /r ] AVX512,FUTURE
-VRCP14SS xmmreg|mask|z,xmmreg*,xmmrm32 [rvm:t1s: evex.nds.128.66.0f38.w0 4d /r ] AVX512,FUTURE
-VRCP28PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 ca /r ] AVX512ER,FUTURE
-VRCP28PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 ca /r ] AVX512ER,FUTURE
-VRCP28SD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 cb /r ] AVX512ER,FUTURE
-VRCP28SS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 cb /r ] AVX512ER,FUTURE
-VREDUCEPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VREDUCEPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VREDUCEPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 56 /r ib ] AVX512DQ,FUTURE
-VREDUCEPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VREDUCEPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
-VREDUCEPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 56 /r ib ] AVX512DQ,FUTURE
-VREDUCESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 57 /r ib ] AVX512DQ,FUTURE
-VREDUCESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 57 /r ib ] AVX512DQ,FUTURE
-VRNDSCALEPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 09 /r ib ] AVX512VL,AVX512,FUTURE
-VRNDSCALEPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 09 /r ib ] AVX512VL,AVX512,FUTURE
-VRNDSCALEPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 09 /r ib ] AVX512,FUTURE
-VRNDSCALEPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 08 /r ib ] AVX512VL,AVX512,FUTURE
-VRNDSCALEPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 08 /r ib ] AVX512VL,AVX512,FUTURE
-VRNDSCALEPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 08 /r ib ] AVX512,FUTURE
-VRNDSCALESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 0b /r ib ] AVX512,FUTURE
-VRNDSCALESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 0a /r ib ] AVX512,FUTURE
-VRSQRT14PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 4e /r ] AVX512VL,AVX512,FUTURE
-VRSQRT14PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 4e /r ] AVX512VL,AVX512,FUTURE
-VRSQRT14PD zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 4e /r ] AVX512,FUTURE
-VRSQRT14PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 4e /r ] AVX512VL,AVX512,FUTURE
-VRSQRT14PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 4e /r ] AVX512VL,AVX512,FUTURE
-VRSQRT14PS zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 4e /r ] AVX512,FUTURE
-VRSQRT14SD xmmreg|mask|z,xmmreg*,xmmrm64 [rvm:t1s: evex.nds.128.66.0f38.w1 4f /r ] AVX512,FUTURE
-VRSQRT14SS xmmreg|mask|z,xmmreg*,xmmrm32 [rvm:t1s: evex.nds.128.66.0f38.w0 4f /r ] AVX512,FUTURE
-VRSQRT28PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 cc /r ] AVX512ER,FUTURE
-VRSQRT28PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 cc /r ] AVX512ER,FUTURE
-VRSQRT28SD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 cd /r ] AVX512ER,FUTURE
-VRSQRT28SS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 cd /r ] AVX512ER,FUTURE
-VSCALEFPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 2c /r ] AVX512VL,AVX512,FUTURE
-VSCALEFPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 2c /r ] AVX512VL,AVX512,FUTURE
-VSCALEFPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 2c /r ] AVX512,FUTURE
-VSCALEFPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 2c /r ] AVX512VL,AVX512,FUTURE
-VSCALEFPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 2c /r ] AVX512VL,AVX512,FUTURE
-VSCALEFPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 2c /r ] AVX512,FUTURE
-VSCALEFSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 2d /r ] AVX512,FUTURE
-VSCALEFSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 2d /r ] AVX512,FUTURE
-VSCATTERDPD xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a2 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERDPD xmem64|mask,ymmreg [mr:t1s: vsibx evex.256.66.0f38.w1 a2 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERDPD ymem64|mask,zmmreg [mr:t1s: vsiby evex.512.66.0f38.w1 a2 /r ] AVX512,FUTURE
-VSCATTERDPS xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a2 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERDPS ymem32|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a2 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERDPS zmem32|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a2 /r ] AVX512,FUTURE
-VSCATTERPF0DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /5 ] AVX512PF,FUTURE
-VSCATTERPF0DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /5 ] AVX512PF,FUTURE
-VSCATTERPF0QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /5 ] AVX512PF,FUTURE
-VSCATTERPF0QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /5 ] AVX512PF,FUTURE
-VSCATTERPF1DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /6 ] AVX512PF,FUTURE
-VSCATTERPF1DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /6 ] AVX512PF,FUTURE
-VSCATTERPF1QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /6 ] AVX512PF,FUTURE
-VSCATTERPF1QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /6 ] AVX512PF,FUTURE
-VSCATTERQPD xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a3 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERQPD ymem64|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w1 a3 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERQPD zmem64|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w1 a3 /r ] AVX512,FUTURE
-VSCATTERQPS xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a3 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERQPS ymem32|mask,xmmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a3 /r ] AVX512VL,AVX512,FUTURE
-VSCATTERQPS zmem32|mask,ymmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a3 /r ] AVX512,FUTURE
-VSHUFF32X4 ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 23 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFF32X4 zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 23 /r ib ] AVX512,FUTURE
-VSHUFF64X2 ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 23 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFF64X2 zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 23 /r ib ] AVX512,FUTURE
-VSHUFI32X4 ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 43 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFI32X4 zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 43 /r ib ] AVX512,FUTURE
-VSHUFI64X2 ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 43 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFI64X2 zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 43 /r ib ] AVX512,FUTURE
-VSHUFPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f.w1 c6 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f.w1 c6 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFPD zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f.w1 c6 /r ib ] AVX512,FUTURE
-VSHUFPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.0f.w0 c6 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.0f.w0 c6 /r ib ] AVX512VL,AVX512,FUTURE
-VSHUFPS zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.0f.w0 c6 /r ib ] AVX512,FUTURE
-VSQRTPD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 51 /r ] AVX512VL,AVX512,FUTURE
-VSQRTPD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 51 /r ] AVX512VL,AVX512,FUTURE
-VSQRTPD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 51 /r ] AVX512,FUTURE
-VSQRTPS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 51 /r ] AVX512VL,AVX512,FUTURE
-VSQRTPS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 51 /r ] AVX512VL,AVX512,FUTURE
-VSQRTPS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 51 /r ] AVX512,FUTURE
-VSQRTSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 51 /r ] AVX512,FUTURE
-VSQRTSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 51 /r ] AVX512,FUTURE
-VSUBPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5c /r ] AVX512VL,AVX512,FUTURE
-VSUBPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5c /r ] AVX512VL,AVX512,FUTURE
-VSUBPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 5c /r ] AVX512,FUTURE
-VSUBPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5c /r ] AVX512VL,AVX512,FUTURE
-VSUBPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5c /r ] AVX512VL,AVX512,FUTURE
-VSUBPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 5c /r ] AVX512,FUTURE
-VSUBSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5c /r ] AVX512,FUTURE
-VSUBSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 5c /r ] AVX512,FUTURE
-VUCOMISD xmmreg,xmmrm64|sae [rm:t1s: evex.128.66.0f.w1 2e /r ] AVX512,FUTURE
-VUCOMISS xmmreg,xmmrm32|sae [rm:t1s: evex.128.0f.w0 2e /r ] AVX512,FUTURE
-VUNPCKHPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 15 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKHPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 15 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKHPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 15 /r ] AVX512,FUTURE
-VUNPCKHPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKHPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 15 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKHPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 15 /r ] AVX512,FUTURE
-VUNPCKLPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 14 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKLPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 14 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKLPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 14 /r ] AVX512,FUTURE
-VUNPCKLPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKLPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 14 /r ] AVX512VL,AVX512,FUTURE
-VUNPCKLPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 14 /r ] AVX512,FUTURE
-VXORPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 57 /r ] AVX512VL,AVX512DQ,FUTURE
-VXORPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 57 /r ] AVX512VL,AVX512DQ,FUTURE
-VXORPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 57 /r ] AVX512DQ,FUTURE
-VXORPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 57 /r ] AVX512VL,AVX512DQ,FUTURE
-VXORPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 57 /r ] AVX512VL,AVX512DQ,FUTURE
-VXORPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 57 /r ] AVX512DQ,FUTURE
-; MJC PUBLIC END
-
-;# Intel memory protection keys for userspace (PKU aka PKEYs)
-RDPKRU void [ 0f 01 ee] X64,FUTURE
-WRPKRU void [ 0f 01 ef] X64,FUTURE
-
-;# Read Processor ID
-RDPID reg32 [m: f3 0f c7 /7] NOLONG,FUTURE
-RDPID reg64 [m: o64nw f3 0f c7 /7] X64,FUTURE
-RDPID reg32 [m: f3 0f c7 /7] X64,UNDOC,FUTURE
-
-;# New memory instructions
-CLFLUSHOPT mem [m: 66 0f ae /7] FUTURE
-CLWB mem [m: 66 0f ae /6] FUTURE
-; This one was killed before it saw the light of day
-PCOMMIT void [ 66 0f ae f8] FUTURE,UNDOC,OBSOLETE
-
-; AMD Zen v1
-CLZERO void [ 0f 01 fc] FUTURE,AMD
-
-;# Systematic names for the hinting nop instructions
-; These should be last in the file
-HINT_NOP0 rm16 [m: o16 0f 18 /0] P6,UNDOC
-HINT_NOP0 rm32 [m: o32 0f 18 /0] P6,UNDOC
-HINT_NOP0 rm64 [m: o64 0f 18 /0] X64,UNDOC
-HINT_NOP1 rm16 [m: o16 0f 18 /1] P6,UNDOC
-HINT_NOP1 rm32 [m: o32 0f 18 /1] P6,UNDOC
-HINT_NOP1 rm64 [m: o64 0f 18 /1] X64,UNDOC
-HINT_NOP2 rm16 [m: o16 0f 18 /2] P6,UNDOC
-HINT_NOP2 rm32 [m: o32 0f 18 /2] P6,UNDOC
-HINT_NOP2 rm64 [m: o64 0f 18 /2] X64,UNDOC
-HINT_NOP3 rm16 [m: o16 0f 18 /3] P6,UNDOC
-HINT_NOP3 rm32 [m: o32 0f 18 /3] P6,UNDOC
-HINT_NOP3 rm64 [m: o64 0f 18 /3] X64,UNDOC
-HINT_NOP4 rm16 [m: o16 0f 18 /4] P6,UNDOC
-HINT_NOP4 rm32 [m: o32 0f 18 /4] P6,UNDOC
-HINT_NOP4 rm64 [m: o64 0f 18 /4] X64,UNDOC
-HINT_NOP5 rm16 [m: o16 0f 18 /5] P6,UNDOC
-HINT_NOP5 rm32 [m: o32 0f 18 /5] P6,UNDOC
-HINT_NOP5 rm64 [m: o64 0f 18 /5] X64,UNDOC
-HINT_NOP6 rm16 [m: o16 0f 18 /6] P6,UNDOC
-HINT_NOP6 rm32 [m: o32 0f 18 /6] P6,UNDOC
-HINT_NOP6 rm64 [m: o64 0f 18 /6] X64,UNDOC
-HINT_NOP7 rm16 [m: o16 0f 18 /7] P6,UNDOC
-HINT_NOP7 rm32 [m: o32 0f 18 /7] P6,UNDOC
-HINT_NOP7 rm64 [m: o64 0f 18 /7] X64,UNDOC
-HINT_NOP8 rm16 [m: o16 0f 19 /0] P6,UNDOC
-HINT_NOP8 rm32 [m: o32 0f 19 /0] P6,UNDOC
-HINT_NOP8 rm64 [m: o64 0f 19 /0] X64,UNDOC
-HINT_NOP9 rm16 [m: o16 0f 19 /1] P6,UNDOC
-HINT_NOP9 rm32 [m: o32 0f 19 /1] P6,UNDOC
-HINT_NOP9 rm64 [m: o64 0f 19 /1] X64,UNDOC
-HINT_NOP10 rm16 [m: o16 0f 19 /2] P6,UNDOC
-HINT_NOP10 rm32 [m: o32 0f 19 /2] P6,UNDOC
-HINT_NOP10 rm64 [m: o64 0f 19 /2] X64,UNDOC
-HINT_NOP11 rm16 [m: o16 0f 19 /3] P6,UNDOC
-HINT_NOP11 rm32 [m: o32 0f 19 /3] P6,UNDOC
-HINT_NOP11 rm64 [m: o64 0f 19 /3] X64,UNDOC
-HINT_NOP12 rm16 [m: o16 0f 19 /4] P6,UNDOC
-HINT_NOP12 rm32 [m: o32 0f 19 /4] P6,UNDOC
-HINT_NOP12 rm64 [m: o64 0f 19 /4] X64,UNDOC
-HINT_NOP13 rm16 [m: o16 0f 19 /5] P6,UNDOC
-HINT_NOP13 rm32 [m: o32 0f 19 /5] P6,UNDOC
-HINT_NOP13 rm64 [m: o64 0f 19 /5] X64,UNDOC
-HINT_NOP14 rm16 [m: o16 0f 19 /6] P6,UNDOC
-HINT_NOP14 rm32 [m: o32 0f 19 /6] P6,UNDOC
-HINT_NOP14 rm64 [m: o64 0f 19 /6] X64,UNDOC
-HINT_NOP15 rm16 [m: o16 0f 19 /7] P6,UNDOC
-HINT_NOP15 rm32 [m: o32 0f 19 /7] P6,UNDOC
-HINT_NOP15 rm64 [m: o64 0f 19 /7] X64,UNDOC
-HINT_NOP16 rm16 [m: o16 0f 1a /0] P6,UNDOC
-HINT_NOP16 rm32 [m: o32 0f 1a /0] P6,UNDOC
-HINT_NOP16 rm64 [m: o64 0f 1a /0] X64,UNDOC
-HINT_NOP17 rm16 [m: o16 0f 1a /1] P6,UNDOC
-HINT_NOP17 rm32 [m: o32 0f 1a /1] P6,UNDOC
-HINT_NOP17 rm64 [m: o64 0f 1a /1] X64,UNDOC
-HINT_NOP18 rm16 [m: o16 0f 1a /2] P6,UNDOC
-HINT_NOP18 rm32 [m: o32 0f 1a /2] P6,UNDOC
-HINT_NOP18 rm64 [m: o64 0f 1a /2] X64,UNDOC
-HINT_NOP19 rm16 [m: o16 0f 1a /3] P6,UNDOC
-HINT_NOP19 rm32 [m: o32 0f 1a /3] P6,UNDOC
-HINT_NOP19 rm64 [m: o64 0f 1a /3] X64,UNDOC
-HINT_NOP20 rm16 [m: o16 0f 1a /4] P6,UNDOC
-HINT_NOP20 rm32 [m: o32 0f 1a /4] P6,UNDOC
-HINT_NOP20 rm64 [m: o64 0f 1a /4] X64,UNDOC
-HINT_NOP21 rm16 [m: o16 0f 1a /5] P6,UNDOC
-HINT_NOP21 rm32 [m: o32 0f 1a /5] P6,UNDOC
-HINT_NOP21 rm64 [m: o64 0f 1a /5] X64,UNDOC
-HINT_NOP22 rm16 [m: o16 0f 1a /6] P6,UNDOC
-HINT_NOP22 rm32 [m: o32 0f 1a /6] P6,UNDOC
-HINT_NOP22 rm64 [m: o64 0f 1a /6] X64,UNDOC
-HINT_NOP23 rm16 [m: o16 0f 1a /7] P6,UNDOC
-HINT_NOP23 rm32 [m: o32 0f 1a /7] P6,UNDOC
-HINT_NOP23 rm64 [m: o64 0f 1a /7] X64,UNDOC
-HINT_NOP24 rm16 [m: o16 0f 1b /0] P6,UNDOC
-HINT_NOP24 rm32 [m: o32 0f 1b /0] P6,UNDOC
-HINT_NOP24 rm64 [m: o64 0f 1b /0] X64,UNDOC
-HINT_NOP25 rm16 [m: o16 0f 1b /1] P6,UNDOC
-HINT_NOP25 rm32 [m: o32 0f 1b /1] P6,UNDOC
-HINT_NOP25 rm64 [m: o64 0f 1b /1] X64,UNDOC
-HINT_NOP26 rm16 [m: o16 0f 1b /2] P6,UNDOC
-HINT_NOP26 rm32 [m: o32 0f 1b /2] P6,UNDOC
-HINT_NOP26 rm64 [m: o64 0f 1b /2] X64,UNDOC
-HINT_NOP27 rm16 [m: o16 0f 1b /3] P6,UNDOC
-HINT_NOP27 rm32 [m: o32 0f 1b /3] P6,UNDOC
-HINT_NOP27 rm64 [m: o64 0f 1b /3] X64,UNDOC
-HINT_NOP28 rm16 [m: o16 0f 1b /4] P6,UNDOC
-HINT_NOP28 rm32 [m: o32 0f 1b /4] P6,UNDOC
-HINT_NOP28 rm64 [m: o64 0f 1b /4] X64,UNDOC
-HINT_NOP29 rm16 [m: o16 0f 1b /5] P6,UNDOC
-HINT_NOP29 rm32 [m: o32 0f 1b /5] P6,UNDOC
-HINT_NOP29 rm64 [m: o64 0f 1b /5] X64,UNDOC
-HINT_NOP30 rm16 [m: o16 0f 1b /6] P6,UNDOC
-HINT_NOP30 rm32 [m: o32 0f 1b /6] P6,UNDOC
-HINT_NOP30 rm64 [m: o64 0f 1b /6] X64,UNDOC
-HINT_NOP31 rm16 [m: o16 0f 1b /7] P6,UNDOC
-HINT_NOP31 rm32 [m: o32 0f 1b /7] P6,UNDOC
-HINT_NOP31 rm64 [m: o64 0f 1b /7] X64,UNDOC
-HINT_NOP32 rm16 [m: o16 0f 1c /0] P6,UNDOC
-HINT_NOP32 rm32 [m: o32 0f 1c /0] P6,UNDOC
-HINT_NOP32 rm64 [m: o64 0f 1c /0] X64,UNDOC
-HINT_NOP33 rm16 [m: o16 0f 1c /1] P6,UNDOC
-HINT_NOP33 rm32 [m: o32 0f 1c /1] P6,UNDOC
-HINT_NOP33 rm64 [m: o64 0f 1c /1] X64,UNDOC
-HINT_NOP34 rm16 [m: o16 0f 1c /2] P6,UNDOC
-HINT_NOP34 rm32 [m: o32 0f 1c /2] P6,UNDOC
-HINT_NOP34 rm64 [m: o64 0f 1c /2] X64,UNDOC
-HINT_NOP35 rm16 [m: o16 0f 1c /3] P6,UNDOC
-HINT_NOP35 rm32 [m: o32 0f 1c /3] P6,UNDOC
-HINT_NOP35 rm64 [m: o64 0f 1c /3] X64,UNDOC
-HINT_NOP36 rm16 [m: o16 0f 1c /4] P6,UNDOC
-HINT_NOP36 rm32 [m: o32 0f 1c /4] P6,UNDOC
-HINT_NOP36 rm64 [m: o64 0f 1c /4] X64,UNDOC
-HINT_NOP37 rm16 [m: o16 0f 1c /5] P6,UNDOC
-HINT_NOP37 rm32 [m: o32 0f 1c /5] P6,UNDOC
-HINT_NOP37 rm64 [m: o64 0f 1c /5] X64,UNDOC
-HINT_NOP38 rm16 [m: o16 0f 1c /6] P6,UNDOC
-HINT_NOP38 rm32 [m: o32 0f 1c /6] P6,UNDOC
-HINT_NOP38 rm64 [m: o64 0f 1c /6] X64,UNDOC
-HINT_NOP39 rm16 [m: o16 0f 1c /7] P6,UNDOC
-HINT_NOP39 rm32 [m: o32 0f 1c /7] P6,UNDOC
-HINT_NOP39 rm64 [m: o64 0f 1c /7] X64,UNDOC
-HINT_NOP40 rm16 [m: o16 0f 1d /0] P6,UNDOC
-HINT_NOP40 rm32 [m: o32 0f 1d /0] P6,UNDOC
-HINT_NOP40 rm64 [m: o64 0f 1d /0] X64,UNDOC
-HINT_NOP41 rm16 [m: o16 0f 1d /1] P6,UNDOC
-HINT_NOP41 rm32 [m: o32 0f 1d /1] P6,UNDOC
-HINT_NOP41 rm64 [m: o64 0f 1d /1] X64,UNDOC
-HINT_NOP42 rm16 [m: o16 0f 1d /2] P6,UNDOC
-HINT_NOP42 rm32 [m: o32 0f 1d /2] P6,UNDOC
-HINT_NOP42 rm64 [m: o64 0f 1d /2] X64,UNDOC
-HINT_NOP43 rm16 [m: o16 0f 1d /3] P6,UNDOC
-HINT_NOP43 rm32 [m: o32 0f 1d /3] P6,UNDOC
-HINT_NOP43 rm64 [m: o64 0f 1d /3] X64,UNDOC
-HINT_NOP44 rm16 [m: o16 0f 1d /4] P6,UNDOC
-HINT_NOP44 rm32 [m: o32 0f 1d /4] P6,UNDOC
-HINT_NOP44 rm64 [m: o64 0f 1d /4] X64,UNDOC
-HINT_NOP45 rm16 [m: o16 0f 1d /5] P6,UNDOC
-HINT_NOP45 rm32 [m: o32 0f 1d /5] P6,UNDOC
-HINT_NOP45 rm64 [m: o64 0f 1d /5] X64,UNDOC
-HINT_NOP46 rm16 [m: o16 0f 1d /6] P6,UNDOC
-HINT_NOP46 rm32 [m: o32 0f 1d /6] P6,UNDOC
-HINT_NOP46 rm64 [m: o64 0f 1d /6] X64,UNDOC
-HINT_NOP47 rm16 [m: o16 0f 1d /7] P6,UNDOC
-HINT_NOP47 rm32 [m: o32 0f 1d /7] P6,UNDOC
-HINT_NOP47 rm64 [m: o64 0f 1d /7] X64,UNDOC
-HINT_NOP48 rm16 [m: o16 0f 1e /0] P6,UNDOC
-HINT_NOP48 rm32 [m: o32 0f 1e /0] P6,UNDOC
-HINT_NOP48 rm64 [m: o64 0f 1e /0] X64,UNDOC
-HINT_NOP49 rm16 [m: o16 0f 1e /1] P6,UNDOC
-HINT_NOP49 rm32 [m: o32 0f 1e /1] P6,UNDOC
-HINT_NOP49 rm64 [m: o64 0f 1e /1] X64,UNDOC
-HINT_NOP50 rm16 [m: o16 0f 1e /2] P6,UNDOC
-HINT_NOP50 rm32 [m: o32 0f 1e /2] P6,UNDOC
-HINT_NOP50 rm64 [m: o64 0f 1e /2] X64,UNDOC
-HINT_NOP51 rm16 [m: o16 0f 1e /3] P6,UNDOC
-HINT_NOP51 rm32 [m: o32 0f 1e /3] P6,UNDOC
-HINT_NOP51 rm64 [m: o64 0f 1e /3] X64,UNDOC
-HINT_NOP52 rm16 [m: o16 0f 1e /4] P6,UNDOC
-HINT_NOP52 rm32 [m: o32 0f 1e /4] P6,UNDOC
-HINT_NOP52 rm64 [m: o64 0f 1e /4] X64,UNDOC
-HINT_NOP53 rm16 [m: o16 0f 1e /5] P6,UNDOC
-HINT_NOP53 rm32 [m: o32 0f 1e /5] P6,UNDOC
-HINT_NOP53 rm64 [m: o64 0f 1e /5] X64,UNDOC
-HINT_NOP54 rm16 [m: o16 0f 1e /6] P6,UNDOC
-HINT_NOP54 rm32 [m: o32 0f 1e /6] P6,UNDOC
-HINT_NOP54 rm64 [m: o64 0f 1e /6] X64,UNDOC
-HINT_NOP55 rm16 [m: o16 0f 1e /7] P6,UNDOC
-HINT_NOP55 rm32 [m: o32 0f 1e /7] P6,UNDOC
-HINT_NOP55 rm64 [m: o64 0f 1e /7] X64,UNDOC
-HINT_NOP56 rm16 [m: o16 0f 1f /0] P6,UNDOC
-HINT_NOP56 rm32 [m: o32 0f 1f /0] P6,UNDOC
-HINT_NOP56 rm64 [m: o64 0f 1f /0] X64,UNDOC
-HINT_NOP57 rm16 [m: o16 0f 1f /1] P6,UNDOC
-HINT_NOP57 rm32 [m: o32 0f 1f /1] P6,UNDOC
-HINT_NOP57 rm64 [m: o64 0f 1f /1] X64,UNDOC
-HINT_NOP58 rm16 [m: o16 0f 1f /2] P6,UNDOC
-HINT_NOP58 rm32 [m: o32 0f 1f /2] P6,UNDOC
-HINT_NOP58 rm64 [m: o64 0f 1f /2] X64,UNDOC
-HINT_NOP59 rm16 [m: o16 0f 1f /3] P6,UNDOC
-HINT_NOP59 rm32 [m: o32 0f 1f /3] P6,UNDOC
-HINT_NOP59 rm64 [m: o64 0f 1f /3] X64,UNDOC
-HINT_NOP60 rm16 [m: o16 0f 1f /4] P6,UNDOC
-HINT_NOP60 rm32 [m: o32 0f 1f /4] P6,UNDOC
-HINT_NOP60 rm64 [m: o64 0f 1f /4] X64,UNDOC
-HINT_NOP61 rm16 [m: o16 0f 1f /5] P6,UNDOC
-HINT_NOP61 rm32 [m: o32 0f 1f /5] P6,UNDOC
-HINT_NOP61 rm64 [m: o64 0f 1f /5] X64,UNDOC
-HINT_NOP62 rm16 [m: o16 0f 1f /6] P6,UNDOC
-HINT_NOP62 rm32 [m: o32 0f 1f /6] P6,UNDOC
-HINT_NOP62 rm64 [m: o64 0f 1f /6] X64,UNDOC
-HINT_NOP63 rm16 [m: o16 0f 1f /7] P6,UNDOC
-HINT_NOP63 rm32 [m: o32 0f 1f /7] P6,UNDOC
-HINT_NOP63 rm64 [m: o64 0f 1f /7] X64,UNDOC
--- a/as/target/x86/proc.h
+++ /dev/null
@@ -1,156 +1,0 @@
-enum args {
- AREG_CS = AMAX,
- AREG_DS,
- AREG_SS,
- AREG_ES,
- AREG_FS,
- AREG_GS,
-
- AREG_EFLAGS,
- AREG_CF,
- AREG_PF,
- AREG_AF,
- AREG_ZF,
- AREG_SF,
- AREG_TF,
- AREG_IF,
- AREG_DF,
- AREG_OF,
- AREG_IOPL,
- AREG_NT,
- AREG_RF,
- AREG_VM,
- AREG_AC,
- AREG_VIF,
- AREG_VIP,
- AREG_ID,
-
- AREG_AX,
- AREG_AL,
- AREG_AH,
- AREG_EAX,
- AREG_RAX,
-
- AREG_BX,
- AREG_BL,
- AREG_BH,
- AREG_EBX,
- AREG_RBX,
-
- AREG_CX,
- AREG_CL,
- AREG_CH,
- AREG_ECX,
- AREG_RCX,
-
- AREG_DX,
- AREG_DL,
- AREG_DH,
- AREG_EDX,
- AREG_RDX,
-
- AREG_SI,
- AREG_SIL,
- AREG_ESI,
- AREG_RSI,
- AREG_DI,
- AREG_DIL,
- AREG_EDI,
- AREG_RDI,
-
- AREG_SP,
- AREG_SPL,
- AREG_ESP,
- AREG_RSP,
-
- AREG_BP,
- AREG_BPL,
- AREG_EBP,
- AREG_RBP,
-
- AREG_R0,
- AREG_MM0,
- AREG_R1,
- AREG_MM1,
- AREG_R2,
- AREG_MM2,
- AREG_R3,
- AREG_MM3,
- AREG_R4,
- AREG_MM4,
- AREG_R5,
- AREG_MM5,
- AREG_R6,
- AREG_MM6,
- AREG_R7,
- AREG_MM7,
-
- AREG_R8,
- AREG_R8L,
- AREG_R8W,
- AREG_R9,
- AREG_R9L,
- AREG_R9W,
- AREG_R10,
- AREG_R10L,
- AREG_R10W,
- AREG_R11,
- AREG_R11L,
- AREG_R11W,
- AREG_R12,
- AREG_R12L,
- AREG_R12W,
- AREG_R13,
- AREG_R13L,
- AREG_R13W,
- AREG_R14,
- AREG_R14L,
- AREG_R14W,
- AREG_R15,
- AREG_R15L,
- AREG_R15W,
-
- AREG_XMM0,
- AREG_XMM1,
- AREG_XMM2,
- AREG_XMM3,
- AREG_XMM4,
- AREG_XMM5,
- AREG_XMM6,
- AREG_XMM7,
- AREG_XMM8,
- AREG_XMM9,
- AREG_XMM10,
- AREG_XMM11,
- AREG_XMM12,
- AREG_XMM13,
- AREG_XMM14,
- AREG_XMM15,
-
- AREG_YMM0,
- AREG_YMM1,
- AREG_YMM2,
- AREG_YMM3,
- AREG_YMM4,
- AREG_YMM5,
- AREG_YMM6,
- AREG_YMM7,
- AREG_YMM8,
- AREG_YMM9,
- AREG_YMM10,
- AREG_YMM11,
- AREG_YMM12,
- AREG_YMM13,
- AREG_YMM14,
- AREG_YMM15,
-
- AREG_MXCSR,
-
- AREG_R8CLASS, /* register class for 8 bit registers in i286 */
- AREG_R16CLASS, /* register class for 16 bit registers in i286 */
-};
-
-enum class {
- R8CLASS = 1 << 0,
- R16CLASS = 1 << 1,
-};
--- a/as/target/x86/rules.dat
+++ /dev/null
@@ -1,9 +1,0 @@
-reg8 AREG_R8CLASS
-reg16 AREG_R16CLASS
-imm8 AIMM8
-imm16 AIMM16
-imm32 AIMM32
-imm64 AIMM64
-\(n\) ADIRECT
-sym ASYM
-string ASTR
--- a/as/target/x86/x86.dat
+++ /dev/null
@@ -1,28 +1,0 @@
-# Tab 16, tabs 16, :set ts=16
-# op args size bytes format cpu
-.DB imm8+ 0 none defb I286,I386,AMD64
-.DEFB imm8+ 0 none defb I286,I386,AMD64
-.BYTE imm8+ 0 none defb I286,I386,AMD64
-.DW imm16+ 0 none defw I286,I386,AMD64
-.DEFW imm16+ 0 none defw I286,I386,AMD64
-.SHORT imm16+ 0 none defw I286,I386,AMD64
-.WORD imm16+ 0 none defw I286
-.WORD imm32+ 0 none defd I386,AMD64
-.DD imm32+ 0 none defd I286,I386,AMD64
-.DEFD imm32+ 0 none defd I286,I386,AMD64
-.LONG imm32+ 0 none defd I286,I386
-.LONG imm64+ 0 none defq AMD64
-.INT imm32+ 0 none defd I386,AMD64
-.INT imm16+ 0 none defd I286
-.DQ imm64+ 0 none defq I286,I386,AMD64
-.DEFQ imm64+ 0 none defq I286,I386,AMD64
-.EQU imm16 0 none equ I286
-.EQU imm32 0 none equ I386
-.EQU imm64 0 none equ AMD64
-NOP none 1 0x90 noargs I286,I386,AMD64
-RET none 1 0xc3 noargs I286,I386,AMD64
-
-
-# 8 bit arithmetic operations
-ADDB reg8,reg8 2 0x00 reg8_reg8 I286,I386,AMD64
-ADDW reg16,reg16 2 0x01 reg16_reg16 I286,I386,AMD64
--- a/as/target/z80.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-
-Z80_OBJ = $(OBJ) target/x80/z80tbl.o target/x80/z80.o target/x80/ins.o
-
-target/x80/z80tbl.c: gentbl.awk target/x80/x80.dat target/x80/rules.dat
- ./gentbl.sh -f x80 -c z80
-
-$(LIBEXEC)/as-z80: $(OBJ) $(Z80_OBJ)
- $(CC) $(SCC_LDFLAGS) $(Z80_OBJ) -lscc -o $@
--- a/cc1/Makefile
+++ /dev/null
@@ -1,32 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-MORECFLAGS = -I$(INCLUDE)/$(STD)
-
-OBJ = types.o decl.o lex.o error.o symbol.o main.o expr.o \
- code.o stmt.o cpp.o fold.o init.o builtin.o
-
-TARGETS = $(LIBEXEC)/cc1-amd64-sysv $(LIBEXEC)/cc1-arm64-sysv \
- $(LIBEXEC)/cc1-i386-sysv $(LIBEXEC)/cc1-z80-scc
-
-all: $(TARGETS)
-
-$(TARGETS): $(LIBDIR)/libscc.a
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f *.o
- rm -f target/*/*.o
- rm -f $(TARGETS)
-
-include target/amd64-sysv/arch.mk
-include target/arm64-sysv/arch.mk
-include target/i386-sysv/arch.mk
-include target/z80-scc/arch.mk
-include deps.mk
--- a/cc1/TODO
+++ /dev/null
@@ -1,14 +1,0 @@
-* Implement bitfields
-* Rewrite error recovery code, and ensure correct state after recovery
-* Parse correctly all integer and float constants
-* Add C99 features (almost all the new features of C99 are missed)
-* Add correct emit for any kind of constant
-* Add warning when some ANSI limit is violated.
-* Free memory in emit after some error happened.
-* Rewrite initializers to deal with the idea of "current object"
-* Add some test about pointer airthmetic.
-* Merge all the definitions of the same string
-* Do not assign identifierss until symbols are emitted. This change will
- avoid identifiers that are not emitted.
-* Fix assignation abbreviations. They fail whe lhs type is smaller than
- the type in rhs
--- a/cc1/builtin.c
+++ /dev/null
@@ -1,121 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/builtin.c";
-
-#include <stdio.h>
-
-#include "../inc/scc.h"
-#include "cc1.h"
-
-static Node *
-builtin_va_arg(Symbol *sym)
-{
- Node *np, *ap;
- Type *tp;
-
- ap = assign();
- expect(',');
- tp = typename();
-
- if (!valid_va_list(ap->type)) {
- errorp("incorrect parameters for va_arg");
- goto error;
- }
- if (tp == booltype ||
- tp == chartype || tp == uchartype || tp == schartype ||
- tp == shortype || tp == ushortype) {
- warn("bool, char and short are promoted to int when passed through '...'");
- tp = (tp->prop & TSIGNED) ? inttype : uinttype;
- }
-
- np = node(OBUILTIN, tp, ap, NULL);
- np->sym = sym;
- return np;
-
-error:
- return constnode(zero);
-}
-
-static Node *
-builtin_va_copy(Symbol *sym)
-{
- Node *np, *src, *dst;
-
- dst = assign();
- expect(',');
- src = assign();
-
- if (!valid_va_list(dst->type) || !valid_va_list(src->type)) {
- errorp("incorrect parameters for va_copy");
- return constnode(zero);
- }
-
- np = node(OBUILTIN, voidtype, dst, src);
- np->sym = sym;
- return np;
-}
-
-static Node *
-builtin_va_start(Symbol *sym)
-{
- Node *np, *ap, *last;
- Symbol **p;
- Type *tp;
-
- ap = assign();
- expect(',');
- last = assign();
- if (last->op != OSYM)
- goto error;
-
- if (!valid_va_list(ap->type) || !(last->sym->flags&SDECLARED))
- goto error;
-
- for (p = curfun->u.pars; p && *p != last->sym; ++p)
- ;
- if (!p || *p == NULL || p[1] == NULL || p[1]->type != ellipsistype)
- warn("second parameter of 'va_start' not last named argument");
-
- tp = last->type;
- if (tp == booltype ||
- tp == chartype || tp == uchartype || tp == schartype ||
- tp == shortype || tp == ushortype) {
- warn("last parameter before '...' must not be bool, char or short");
- }
-
- np = node(OBUILTIN, voidtype, ap, last);
- np->sym = sym;
- return np;
-
-error:
- errorp("incorrect parameters for va_start");
- return constnode(zero);
-}
-
-static Node *
-builtin_va_end(Symbol *sym)
-{
- Node *ap, *np;
-
- ap = assign();
-
- if (!valid_va_list(ap->type)) {
- errorp("incorrect parameters for va_end");
- return constnode(zero);
- }
-
- np = node(OBUILTIN, voidtype, ap, NULL);
- np->sym = sym;
- return np;
-}
-
-void
-ibuilts(void)
-{
- struct builtin built[] = {
- {"__builtin_va_arg", builtin_va_arg},
- {"__builtin_va_copy", builtin_va_copy},
- {"__builtin_va_start", builtin_va_start},
- {"__builtin_va_end", builtin_va_end},
- {NULL}
- };
- builtins(built);
-}
--- a/cc1/cc1.h
+++ /dev/null
@@ -1,496 +1,0 @@
-#define INPUTSIZ LINESIZ
-
-#define GLOBALCTX 0
-#define PARAMCTX 1
-
-#define NR_USWITCHES 20
-
-/*
- * Definition of enumerations
- */
-enum {
- NOALLOC,
- ALLOC
-};
-
-enum typeprops {
- TDEFINED = 1 << 0, /* type defined */
- TSIGNED = 1 << 1, /* signedness of the type */
- TINTEGER = 1 << 2, /* the type is INT of enum */
- TARITH = 1 << 3, /* the type is INT, ENUM or FLOAT */
- TAGGREG = 1 << 4, /* the type is struct or union */
- TK_R = 1 << 5, /* this is a K&R-function */
- TELLIPSIS= 1 << 6, /* this function has an ellipsis par */
- TFUNDEF = 1 << 7, /* function definition */
-};
-
-enum inputtype {
- IMACRO = 1 << 0, /* macro expansion type */
- IFILE = 1 << 1, /* input file type */
- ISTDIN = 1 << 2, /* stdin type */
- IEOF = 1 << 3, /* EOF mark */
- ITYPE = IMACRO | IFILE | ISTDIN,
-};
-
-/* data type letters */
-enum ns {
- L_INT8 = 'C',
- L_INT16 = 'I',
- L_INT32 = 'W',
- L_INT64 = 'Q',
- L_UINT8 = 'K',
- L_UINT16 = 'N',
- L_UINT32 = 'Z',
- L_UINT64 = 'O',
- L_BOOL = 'B',
-
- L_FLOAT = 'J',
- L_DOUBLE = 'D',
- L_LDOUBLE = 'H',
-
- L_ELLIPSIS = 'E',
- L_VOID = '0',
- L_POINTER = 'P',
- L_FUNCTION = 'F',
- L_ARRAY = 'V',
- L_UNION = 'U',
- L_STRUCT = 'S',
- L_VA_ARG = '1',
-};
-
-/* recovery points */
-enum {
- END_DECL,
- END_LDECL,
- END_COMP,
- END_COND
-};
-
-/* type constructors */
-enum typeop {
- FTN = 1,
- PTR,
- ARY,
- KRFTN
-};
-
-/* namespaces */
-enum namespaces {
- NS_DUMMY,
- NS_IDEN,
- NS_TAG,
- NS_LABEL,
- NS_CPP,
- NS_KEYWORD,
- NS_CPPCLAUSES,
- NS_STRUCTS
-};
-
-/* symbol flags */
-enum {
- SAUTO = 1 << 0,
- SREGISTER = 1 << 1,
- SDECLARED = 1 << 2,
- SFIELD = 1 << 3,
- SEXTERN = 1 << 4,
- SUSED = 1 << 5,
- SCONSTANT = 1 << 6,
- SGLOBAL = 1 << 7,
- SPRIVATE = 1 << 8,
- SLOCAL = 1 << 9,
- SEMITTED = 1 << 10,
- SDEFINED = 1 << 11,
- SSTRING = 1 << 12,
- STYPEDEF = 1 << 13,
- SINITLST = 1 << 14,
- SHASINIT = 1 << 15
-};
-
-/* node flags */
-enum {
- NLVAL = 1 << 0,
- NCONST = 1 << 1,
- NEFFECT = 1 << 2
-};
-
-/* lexer mode, compiler or preprocessor directive */
-enum {
- CCMODE,
- CPPMODE
-};
-
-/* input tokens */
-enum tokens {
- CONST = 1 << 0, /* type qualifier tokens are used as flags */
- RESTRICT = 1 << 1,
- VOLATILE = 1 << 2,
- INLINE = 1 << 3,
- TQUALIFIER = 1 << 7, /* this value is picked outside of ASCII range */
- TYPE,
- IDEN,
- SCLASS,
- CONSTANT,
- STRING,
- SIZEOF,
- INDIR,
- INC,
- DEC,
- SHL,
- SHR,
- LE,
- GE,
- EQ,
- NE,
- AND,
- OR,
- MUL_EQ,
- DIV_EQ,
- MOD_EQ,
- ADD_EQ,
- SUB_EQ,
- AND_EQ,
- XOR_EQ,
- OR_EQ,
- SHL_EQ,
- SHR_EQ,
- ELLIPSIS,
- CASE,
- DEFAULT,
- IF,
- ELSE,
- SWITCH,
- WHILE,
- DO,
- FOR,
- GOTO,
- VOID,
- FLOAT,
- INT,
- BOOL,
- VA_LIST,
- STRUCT,
- UNION,
- CHAR,
- DOUBLE,
- SHORT,
- LONG,
- LLONG,
- COMPLEX,
- TYPEDEF,
- EXTERN,
- STATIC,
- AUTO,
- REGISTER,
- ENUM,
- TYPEIDEN,
- UNSIGNED,
- SIGNED,
- CONTINUE,
- BREAK,
- RETURN,
- DEFINE,
- INCLUDE,
- LINE,
- PRAGMA,
- ERROR,
- IFDEF,
- ELIF,
- IFNDEF,
- UNDEF,
- ENDIF,
- BUILTIN,
- EOFTOK
-};
-
-/* operations */
-enum op {
- OADD,
- OMUL,
- OSUB,
- OINC,
- ODEC,
- ODIV,
- OMOD,
- OSHL,
- OSHR,
- OBAND,
- OBXOR,
- OBOR,
- OSNEG,
- ONEG,
- OCPL,
- OAND,
- OOR,
- OEQ,
- ONE,
- OLT,
- OGE,
- OLE,
- OGT,
- OASSIGN,
- OA_MUL,
- OA_DIV,
- OA_MOD,
- OA_ADD,
- OA_SUB,
- OA_SHL,
- OA_SHR,
- OA_AND,
- OA_XOR,
- OA_OR,
- OADDR,
- OCOMMA,
- OCAST,
- OPTR,
- OSYM,
- OASK,
- OCOLON,
- OFIELD,
- OLABEL,
- ODEFAULT,
- OCASE,
- OJUMP,
- OBRANCH,
- OEXPR,
- OEFUN,
- OELOOP,
- OBLOOP,
- OFUN,
- OPAR,
- OCALL,
- OCALLE,
- ORET,
- ODECL,
- OBSWITCH,
- OESWITCH,
- OINIT,
- OBUILTIN,
- OTYP,
-};
-
-/*
- * Definition of structures
- */
-typedef struct type Type;
-typedef struct symbol Symbol;
-typedef struct swtch Switch;
-typedef struct node Node;
-typedef struct input Input;
-
-struct limits {
- union {
- TUINT i;
- TFLOAT f;
- } max;
- union {
- TUINT i;
- TFLOAT f;
- } min;
-};
-
-struct builtin {
- char *str;
- Node *(*fun)(Symbol *);
-};
-
-struct keyword {
- char *str;
- unsigned char token, value;
-};
-
-struct type {
- unsigned char op; /* type builder operator */
- unsigned char ns; /* namespace for struct members */
- short id; /* type id, used in dcls */
- char letter; /* letter of the type */
- unsigned char prop; /* type properties */
- unsigned char align; /* align of the type */
- unsigned long size; /* sizeof the type */
- Type *type; /* base type */
- Symbol *tag; /* symbol of the strug tag */
- union {
- Type **pars; /* Function type parameters */
- Symbol **fields; /* fields of aggregate type */
- } p;
- union {
- unsigned char rank; /* convertion rank */
- TINT elem; /* number of type parameters */
- } n;
- Type *next; /* local list pointer */
- Type *h_next; /* hash collision list */
-};
-
-struct symbol {
- unsigned char ctx;
- unsigned char hide;
- char ns;
- unsigned short id;
- unsigned short flags;
- char *name;
- Type *type;
- unsigned char token;
- union {
- TINT i;
- TUINT u;
- TFLOAT f;
- char *s;
- unsigned char token;
- Node **init;
- Symbol **pars;
- Node *(*fun)(Symbol *);
- } u;
- struct symbol *next;
- struct symbol *hash;
-};
-
-struct node {
- unsigned char op;
- unsigned char flags;
- Type *type;
- Symbol *sym;
- struct node *left, *right;
-};
-
-struct swtch {
- short nr;
- char hasdef;
-};
-
-struct yystype {
- Symbol *sym;
- unsigned char token;
-};
-
-#ifdef stdin
-struct input {
- char flags;
- unsigned lineno;
- char *filenam;
- FILE *fp;
- Symbol *hide;
- char *line, *begin, *p;
- struct input *next;
-};
-#endif
-
-/* error.c */
-extern void error(char *fmt, ...);
-extern void warn(char *fmt, ...);
-extern void unexpected(void);
-extern void errorp(char *fmt, ...);
-extern void cpperror(char *fmt, ...);
-extern Type *deftype(Type *tp);
-
-/* types.c */
-extern int eqtype(Type *tp1, Type *tp2, int eqflag);
-extern Type *ctype(int type, int sign, int size);
-extern Type *mktype(Type *tp, int op, TINT nelem, Type *data[]);
-extern Type *duptype(Type *base);
-extern struct limits *getlimits(Type *tp);
-extern void typesize(Type *tp);
-extern void flushtypes(void);
-
-/* symbol.c */
-extern void dumpstab(Symbol **tbl, char *msg);
-extern Symbol *lookup(int ns, char *name, int alloc);
-extern Symbol *nextsym(Symbol *sym, int ns);
-extern Symbol *install(int ns, Symbol *sym);
-extern Symbol *newsym(int ns, char *name);
-extern void pushctx(void), popctx(void);
-extern void killsym(Symbol *sym);
-extern Symbol *newlabel(void);
-extern void keywords(struct keyword *key, int ns);
-extern void builtins(struct builtin *builts);
-extern Symbol *newstring(char *s, size_t len);
-extern unsigned newid(void);
-
-/* stmt.c */
-extern void compound(Symbol *lbreak, Symbol *lcont, Switch *sw);
-
-/* decl.c */
-extern Type *typename(void);
-extern void decl(void);
-
-/* lex.c */
-extern int ahead(void);
-extern int next(void);
-extern void expect(int tok);
-extern void discard(void);
-extern void addinput(char *fname, Symbol *hide, char *buffer);
-extern void delinput(void);
-extern void setsafe(int type);
-extern void ilex(void);
-extern void setloc(char *fname, unsigned line);
-#define accept(t) ((yytoken == (t)) ? next() : 0)
-
-/* code.c */
-extern void prtree(Node *np);
-extern void emit(int, void *);
-extern Node *node(int op, Type *tp, Node *left, Node *rigth);
-extern Node *varnode(Symbol *sym);
-extern Node *constnode(Symbol *sym);
-extern Node *sizeofnode(Type *tp);
-extern void freetree(Node *np);
-extern void icode(void);
-#define BTYPE(np) ((np)->type->op)
-
-/* fold.c */
-extern Node *simplify(Node *np);
-extern TUINT ones(int nbytes);
-
-/* expr.c */
-extern Node *decay(Node *), *negate(Node *np), *assign(void);
-extern Node *convert(Node *np, Type *tp1, int iscast);
-extern Node *constexpr(void), *condexpr(int neg), *expr(void);
-extern int isnodecmp(int op);
-extern int negop(int op);
-extern int cmpnode(Node *np, TUINT val);
-
-/* init.c */
-extern void initializer(Symbol *sym, Type *tp);
-extern Node *initlist(Type *tp);
-
-/* cpp.c */
-extern void icpp(void);
-extern int cpp(void);
-extern int expand(char *begin, Symbol *sym);
-extern void incdir(char *dir);
-extern void outcpp(void);
-extern void defdefine(char *macro, char *val, char *source);
-extern void undefmacro(char *s);
-extern void ppragmaln(void);
-
-/* builtin.c */
-extern void ibuilts(void);
-
-/* arch.c */
-extern void iarch(void);
-extern int valid_va_list(Type *tp);
-
-/*
- * Definition of global variables
- */
-extern struct yystype yylval;
-extern char yytext[];
-extern int yytoken;
-extern unsigned short yylen;
-extern int disexpand;
-extern unsigned cppctx;
-extern Input *input;
-extern int lexmode, namespace;
-extern int onlycpp, onlyheader;
-extern unsigned curctx;
-extern Symbol *curfun, *zero, *one;
-extern char *infile;
-extern unsigned lineno;
-extern char filenam[];
-
-extern Type *voidtype, *pvoidtype, *booltype,
- *uchartype, *chartype, *schartype,
- *uinttype, *inttype,
- *sizettype, *pdifftype,
- *ushortype, *shortype,
- *longtype, *ulongtype,
- *ullongtype, *llongtype,
- *floattype, *doubletype, *ldoubletype,
- *ellipsistype, *va_list_type, *va_type;
--- a/cc1/code.c
+++ /dev/null
@@ -1,550 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/code.c";
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include "../inc/scc.h"
-#include "cc1.h"
-
-static void emitbin(int, void *),
- emitcast(int, void *),
- emitsym(int, void *),
- emitexp(int, void *),
- emitsymid(int, void *),
- emittext(int, void *),
- emitfun(int, void *),
- emitdcl(int, void *),
- emitinit(int, void *),
- emittype(int, void *),
- emitbuilt(int, void *);
-
-char *optxt[] = {
- [OADD] = "+",
- [OSUB] = "-",
- [OMUL] = "*",
- [OINC] = ":i",
- [ODEC] = ":d",
- [OPTR] = "@",
- [OMOD] = "%",
- [ODIV] = "/",
- [OSHL] = "l",
- [OSHR] = "r",
- [OLT] = "<",
- [OGT] = ">",
- [OGE] = "]",
- [OLE] = "[",
- [OEQ] = "=",
- [ONE] = "!",
- [OBAND] = "&",
- [OBXOR] = "^",
- [OBOR] = "|",
- [OASSIGN] = ":",
- [OA_MUL] = ":*",
- [OA_DIV] = ":/",
- [OA_MOD] = ":%",
- [OA_ADD] = ":+",
- [OA_SUB] = ":-",
- [OA_SHL] = ":l",
- [OA_SHR] = ":r",
- [OA_AND] = ":&",
- [OA_XOR] = ":^",
- [OA_OR] = ":|",
- [OADDR] = "'",
- [OSNEG] = "_",
- [ONEG] = "n",
- [OCPL] = "~",
- [OAND] = "a",
- [OOR] = "o",
- [OASK] = "?",
- [OCOMMA] = ",",
- [OLABEL] = "L%d\n",
- [ODEFAULT] = "\tf\tL%d\n",
- [OBSWITCH] = "\ts",
- [OESWITCH] = "\tt\tL%d\n",
- [OCASE] = "\tv\tL%d",
- [OJUMP] = "\tj\tL%d\n",
- [OBRANCH] = "\ty\tL%d",
- [OEFUN] = "}\n",
- [OELOOP] = "\tb\n",
- [OBLOOP] = "\te\n",
- [ORET] = "\th",
- [OPAR] = "p",
- [OCALL] = "c",
- [OCALLE] = "z",
- [OFIELD] = "."
-};
-
-void (*opcode[])(int, void *) = {
- [OADD] = emitbin,
- [OSUB] = emitbin,
- [OMUL] = emitbin,
- [OINC] = emitbin,
- [ODEC] = emitbin,
- [OPTR] = emitbin,
- [OMOD] = emitbin,
- [ODIV] = emitbin,
- [OSHL] = emitbin,
- [OSHR] = emitbin,
- [OLT] = emitbin,
- [OGT] = emitbin,
- [OGE] = emitbin,
- [OLE] = emitbin,
- [OEQ] = emitbin,
- [ONE] = emitbin,
- [OBAND] = emitbin,
- [OBXOR] = emitbin,
- [OBOR] = emitbin,
- [OASSIGN] = emitbin,
- [OA_MUL] = emitbin,
- [OA_DIV] = emitbin,
- [OA_MOD] = emitbin,
- [OA_ADD] = emitbin,
- [OA_SUB] = emitbin,
- [OA_SHL] = emitbin,
- [OA_SHR] = emitbin,
- [OA_AND] = emitbin,
- [OA_XOR] = emitbin,
- [OA_OR] = emitbin,
- [OADDR] = emitbin,
- [OSNEG] = emitbin,
- [ONEG] = emitbin,
- [OCPL] = emitbin,
- [OAND] = emitbin,
- [OOR] = emitbin,
- [OCOMMA] = emitbin,
- [OCAST] = emitcast,
- [OSYM] = emitsym,
- [OASK] = emitbin,
- [OCOLON] = emitbin,
- [OFIELD]= emitbin,
- [OEXPR] = emitexp,
- [OLABEL] = emitsymid,
- [ODEFAULT] = emitsymid,
- [OCASE] = emitsymid,
- [OJUMP] = emitsymid,
- [OBRANCH] = emitsymid,
- [OEFUN] = emittext,
- [OELOOP] = emittext,
- [OBLOOP] = emittext,
- [OFUN] = emitfun,
- [ORET] = emittext,
- [ODECL] = emitdcl,
- [OBSWITCH] = emittext,
- [OESWITCH] = emitsymid,
- [OPAR] = emitbin,
- [OCALL] = emitbin,
- [OCALLE] = emitbin,
- [OINIT] = emitinit,
- [OBUILTIN] = emitbuilt,
- [OTYP] = emittype,
-};
-
-static FILE *outfp;
-
-void
-icode(void)
-{
- outfp = stdout;
-}
-
-void
-freetree(Node *np)
-{
- if (!np)
- return;
- freetree(np->left);
- freetree(np->right);
- free(np);
-}
-
-static void
-emitnode(Node *np)
-{
- if (np)
- (*opcode[np->op])(np->op, np);
-}
-
-void
-prtree(Node *np)
-{
- outfp = stderr;
- fputs("DBG prtree", outfp);
- emitnode(np);
- putc('\n', outfp);
- outfp = stdout;
-}
-
-void
-emit(int op, void *arg)
-{
- extern int failure;
-
- if (failure || onlycpp || onlyheader)
- return;
- (*opcode[op])(op, arg);
-}
-
-static void
-emitvar(Symbol *sym)
-{
- int c;
- short flags = sym->flags;
-
- if (flags & SLOCAL)
- c = 'T';
- else if (flags & SPRIVATE)
- c = 'Y';
- else if (flags & SGLOBAL)
- c = 'G';
- else if (flags & SREGISTER)
- c = 'R';
- else if (flags & SFIELD)
- c = 'M';
- else if (flags & SEXTERN)
- c = 'X';
- else
- c = 'A';
- fprintf(outfp, "%c%u", c, sym->id);
-}
-
-static void
-emitconst(Node *np)
-{
- Symbol *sym = np->sym;
- Type *tp = np->type;
- TUINT u;
-
- switch (tp->op) {
- case PTR:
- case INT:
- case ENUM:
- u = (tp->prop & TSIGNED) ? (TUINT) sym->u.i : sym->u.u;
- fprintf(outfp,
- "#%c%llX",
- np->type->letter,
- (long long) u & ones(tp->size));
- break;
- default:
- abort();
- }
-}
-
-static void
-emitsym(int op, void *arg)
-{
- Node *np = arg;
-
- if ((np->sym->flags & SINITLST) == 0) {
- /*
- * When we have a compound literal we are going
- * to call to emitnode for every element of it,
- * and it means that we will have two '\t'
- * for the first element
- */
- putc('\t', outfp);
- }
- (np->flags & NCONST) ? emitconst(np) : emitvar(np->sym);
-}
-
-static void
-emitletter(Type *tp)
-{
- int letter;
-
- letter = (tp->prop&TELLIPSIS) ? 'E' : tp->letter;
- putc(letter, outfp);
- switch (tp->op) {
- case ARY:
- case STRUCT:
- case UNION:
- fprintf(outfp, "%u", tp->id);
- }
-}
-
-static void
-emittype(int op, void *arg)
-{
- TINT n;
- Symbol **sp;
- char *tag;
- Type *tp = arg;
-
- if (!(tp->prop & TDEFINED))
- return;
-
- switch (tp->op) {
- case ARY:
- emitletter(tp);
- putc('\t', outfp);
- emitletter(tp->type);
- fprintf(outfp,
- "\t#%c%llX\n",
- sizettype->letter, (long long) tp->n.elem);
- return;
- case UNION:
- case STRUCT:
- emitletter(tp);
- tag = tp->tag->name;
- fprintf(outfp,
- "\t\"%s\t#%c%lX\t#%c%X\n",
- (tag) ? tag : "",
- sizettype->letter,
- tp->size,
- sizettype->letter,
- tp->align);
- n = tp->n.elem;
- for (sp = tp->p.fields; n-- > 0; ++sp)
- emit(ODECL, *sp);
- break;
- case PTR:
- case FTN:
- case ENUM:
- return;
- default:
- abort();
- }
-}
-
-static void
-emitstring(Symbol *sym, Type *tp)
-{
- char *bp, *s, *lim;
- int n;
-
- bp = sym->u.s;
- lim = &sym->u.s[tp->n.elem];
- while (bp < lim) {
- s = bp;
- while (bp < lim && isprint(*bp))
- ++bp;
- if ((n = bp - s) > 1)
- fprintf(outfp, "\t#\"%.*s\n", n, s);
- else
- bp = s;
- if (bp == lim)
- break;
- do {
- fprintf(outfp,
- "\t#%c%02X\n",
- chartype->letter, (*bp++) & 0xFF);
- } while (bp < lim && !isprint(*bp));
- }
-}
-
-static void
-emitdesig(Node *np, Type *tp)
-{
- Symbol *sym;
- size_t n; /* TODO: This should be SIZET */
- Node *aux;
- Type *p;
-
- if (!np) {
- sym = NULL;
- } else {
- if (!np->sym)
- goto emit_expression;
- sym = np->sym;
- if (sym->flags & SSTRING) {
- emitstring(sym, tp);
- return;
- }
- if ((sym->flags & SINITLST) == 0)
- goto emit_expression;
- }
-
- switch (tp->op) {
- case PTR:
- case INT:
- case ENUM:
- aux = (sym) ? *sym->u.init : convert(constnode(zero), tp, 0);
- emitexp(OEXPR, aux);
- break;
- case UNION:
- n = tp->n.elem-1;
- aux = (sym) ? sym->u.init[0] : NULL;
- emitdesig(aux, aux->type);
- break;
- case STRUCT:
- case ARY:
- for (n = 0; n < tp->n.elem; ++n) {
- aux = (sym) ? sym->u.init[n] : NULL;
- p = (tp->op == ARY) ? tp->type : tp->p.fields[n]->type;
- emitdesig(aux, p);
- }
- break;
- default:
- abort();
- }
-
- if (sym) {
- free(sym->u.init);
- sym->u.init = NULL;
- }
- freetree(np);
- return;
-
-emit_expression:
- emitexp(OEXPR, np);
-}
-
-static void
-emitinit(int op, void *arg)
-{
- Node *np = arg;
-
- fputs("\t(\n", outfp);
- emitdesig(np, np->type);
- fputs(")\n", outfp);
-}
-
-static void
-emitdcl(int op, void *arg)
-{
- Symbol *sym = arg;
-
- if (sym->flags & SEMITTED)
- return;
- emitvar(sym);
- putc('\t', outfp);
- if (sym->type->op == FTN) {
- emitletter(sym->type->type);
- putc('\t', outfp);
- }
- emitletter(sym->type);
- fprintf(outfp, "\t\"%s", (sym->name) ? sym->name : "");
- if (sym->flags & SFIELD)
- fprintf(outfp, "\t#%c%llX", sizettype->letter, sym->u.i);
- sym->flags |= SEMITTED;
- if ((sym->flags & SHASINIT) == 0)
- putc('\n', outfp);
-}
-
-static void
-emitcast(int op, void *arg)
-{
- Node *np = arg, *lp = np->left;
-
- emitnode(lp);
- if (np->type != voidtype)
- fprintf(outfp, "\tg%c", np->type->letter);
-}
-
-static void
-emitbin(int op, void *arg)
-{
- Node *np = arg;
- char *s;
-
- emitnode(np->left);
- emitnode(np->right);
- if ((s = optxt[op]) != NULL) { /* do not print in OCOLON case */
- fprintf(outfp, "\t%s", s);
- emitletter(np->type);
- }
-}
-
-static void
-emitbuilt(int op, void *arg)
-{
- Node *np = arg;
-
- emitnode(np->left);
- emitnode(np->right);
- fprintf(outfp, "\t\"%s\tm", np->sym->name);
- emitletter(np->type);
-}
-
-
-static void
-emitexp(int op, void *arg)
-{
- Node *np = arg;
-
- emitnode(np);
- putc('\n', outfp);
- freetree(np);
-}
-
-static void
-emitfun(int op, void *arg)
-{
- Symbol *sym = arg, **sp;
-
- emitdcl(op, arg);
- fputs("{\n", outfp);
-
- for (sp = sym->u.pars; sp && *sp; ++sp)
- emit(ODECL, *sp);
- fputs("\\\n", outfp);
-}
-
-static void
-emittext(int op, void *arg)
-{
- fputs(optxt[op], outfp);
-}
-
-static void
-emitsymid(int op, void *arg)
-{
- Symbol *sym = arg;
- fprintf(outfp, optxt[op], sym->id);
-}
-
-Node *
-node(int op, Type *tp, Node *lp, Node *rp)
-{
- Node *np;
-
- np = xmalloc(sizeof(*np));
- np->op = op;
- np->type = tp;
- np->sym = NULL;
- np->flags = 0;
- np->left = lp;
- np->right = rp;
-
- if (lp)
- np->flags |= lp->flags & NEFFECT;
- if (rp)
- np->flags |= rp->flags & NEFFECT;
- return np;
-}
-
-Node *
-varnode(Symbol *sym)
-{
- Node *np;
- Type *tp = sym->type;
-
- np = node(OSYM, sym->type, NULL, NULL);
- np->type = sym->type;
- np->flags = (tp->op != FTN && tp->op != ARY) ? NLVAL : 0;
- np->sym = sym;
- return np;
-}
-
-Node *
-constnode(Symbol *sym)
-{
- Node *np;
-
- np = node(OSYM, sym->type, NULL, NULL);
- np->type = sym->type;
- np->flags = NCONST;
- np->sym = sym;
- return np;
-}
-
-Node *
-sizeofnode(Type *tp)
-{
- Symbol *sym;
-
- sym = newsym(NS_IDEN, NULL);
- sym->type = sizettype;
- sym->u.i = tp->size;
- return constnode(sym);
-}
--- a/cc1/cpp.c
+++ /dev/null
@@ -1,839 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/cpp.c";
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-static char *argp, *macroname;
-static unsigned arglen;
-static unsigned ncmdlines;
-static Symbol *symline, *symfile;
-static unsigned char ifstatus[NR_COND];
-static int cppoff;
-static struct items dirinclude;
-
-unsigned cppctx;
-int disexpand;
-
-void
-defdefine(char *macro, char *val, char *source)
-{
- char *def, *fmt = "#define %s %s\n";
- Symbol dummy = {.flags = SDECLARED};
-
- if (!val)
- val = "";
- def = xmalloc(strlen(fmt) + strlen(macro) + strlen(val));
-
- sprintf(def, fmt, macro, val);
- lineno = ++ncmdlines;
- addinput(source, &dummy, def);
- cpp();
- delinput();
-}
-
-void
-undefmacro(char *s)
-{
- killsym(lookup(NS_CPP, s, NOALLOC));
-}
-
-void
-icpp(void)
-{
- static char sdate[14], stime[11];
- struct tm *tm;
- time_t t;
- static char **bp, *list[] = {
- "__STDC__",
- "__STDC_HOSTED__",
- "__SCC__",
- NULL
- };
- static struct keyword keys[] = {
- {"define", DEFINE, DEFINE},
- {"include", INCLUDE, INCLUDE},
- {"line", LINE, LINE},
- {"ifdef", IFDEF, IFDEF},
- {"if", IF, IF},
- {"elif", ELIF, ELIF},
- {"else", ELSE, ELSE},
- {"ifndef", IFNDEF, IFNDEF},
- {"endif", ENDIF, ENDIF},
- {"undef", UNDEF, UNDEF},
- {"pragma", PRAGMA, PRAGMA},
- {"error", ERROR, ERROR},
- {NULL, 0, 0}
- };
-
- keywords(keys, NS_CPPCLAUSES);
-
- t = time(NULL);
- tm = localtime(&t);
- strftime(sdate, sizeof(sdate), "\"%b %d %Y\"", tm);
- strftime(stime, sizeof(stime), "\"%H:%M:%S\"", tm);
- defdefine("__DATE__", sdate, "built-in");
- defdefine("__TIME__", stime, "built-in");
- defdefine("__STDC_VERSION__", STDC_VERSION, "built-in");
- defdefine("__LINE__", NULL, "built-in");
- defdefine("__FILE__", NULL, "built-in");
-
- symline = lookup(NS_CPP, "__LINE__", ALLOC);
- symfile = lookup(NS_CPP, "__FILE__", ALLOC);
-
- for (bp = list; *bp; ++bp)
- defdefine(*bp, "1", "built-in");
-
- ncmdlines = 0;
-}
-
-static void
-nextcpp(void)
-{
- next();
- if (yytoken == EOFTOK)
- error("unterminated argument list invoking macro \"%s\"",
- macroname);
- if (yylen + 1 > arglen)
- error("argument overflow invoking macro \"%s\"",
- macroname);
- if (yytoken == IDEN)
- yylval.sym->flags |= SUSED;
- memcpy(argp, yytext, yylen);
- argp += yylen;
- *argp++ = ' ';
- arglen -= yylen + 1;
-}
-
-static void
-paren(void)
-{
- for (;;) {
- nextcpp();
- switch (yytoken) {
- case ')':
- return;
- case '(':
- paren();
- break;
- }
- }
-}
-
-static void
-parameter(void)
-{
- for (;;) {
- nextcpp();
- switch (yytoken) {
- case ')':
- case ',':
- argp -= 3; /* remove " , " or " ) "*/
- *argp++ = '\0';
- return;
- case '(':
- paren();
- break;
- }
- }
-}
-
-static int
-parsepars(char *buffer, char **listp, int nargs)
-{
- int n;
-
- if (nargs == -1)
- return -1;
- if (ahead() != '(' && nargs > 0)
- return 0;
-
- disexpand = 1;
- next();
- n = 0;
- argp = buffer;
- arglen = INPUTSIZ;
- if (ahead() == ')') {
- next();
- } else {
- do {
- *listp++ = argp;
- parameter();
- } while (++n < NR_MACROARG && yytoken == ',');
- }
- if (yytoken != ')')
- error("incorrect macro function-alike invocation");
- disexpand = 0;
-
- if (n == NR_MACROARG)
- error("too many parameters in macro \"%s\"", macroname);
- if (n != nargs) {
- error("macro \"%s\" received %d arguments, but it takes %d",
- macroname, n, nargs);
- }
-
- return 1;
-}
-
-static size_t
-copymacro(char *buffer, char *s, size_t bufsiz, char *arglist[])
-{
- int delim, prevc, c;
- char *p, *arg, *bp = buffer;
- size_t size;
-
- for (prevc = '\0'; c = *s; prevc = c, ++s) {
- switch (c) {
- case '$':
- while (bp[-1] == ' ')
- --bp, ++bufsiz;
- while (s[1] == ' ')
- ++s;
- case '#':
- break;
- case '\'':
- delim = '\'';
- goto search_delim;
- case '\"':
- delim = '"';
- search_delim:
- for (p = s; *++s != delim; )
- ;
- size = s - p + 1;
- if (size > bufsiz)
- goto expansion_too_long;
- memcpy(bp, p, size);
- bufsiz -= size;
- bp += size;
- break;
- case '@':
- if (prevc == '#')
- bufsiz -= 2;
- arg = arglist[atoi(++s)];
- size = strlen(arg);
- if (size > bufsiz)
- goto expansion_too_long;
- if (prevc == '#')
- *bp++ = '"';
- memcpy(bp, arg, size);
- bp += size;
- if (prevc == '#')
- *bp++ = '"';
- bufsiz -= size;
- s += 2;
- break;
- default:
- if (bufsiz-- == 0)
- goto expansion_too_long;
- *bp++ = c;
- break;
- }
- }
- *bp = '\0';
-
- return bp - buffer;
-
-expansion_too_long:
- error("macro expansion of \"%s\" too long", macroname);
-}
-
-int
-expand(char *begin, Symbol *sym)
-{
- size_t elen;
- int n, i;
- char *s = sym->u.s;
- char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[INPUTSIZ];
-
- macroname = sym->name;
- if (sym == symfile) {
- elen = sprintf(buffer, "\"%s\" ", filenam);
- goto substitute;
- }
- if (sym == symline) {
- elen = sprintf(buffer, "%d ", lineno);
- goto substitute;
- }
- if (!s)
- return 1;
-
- n = atoi(s);
- if (!parsepars(arguments, arglist, atoi(s)))
- return 0;
- for (i = 0; i < n; ++i)
- DBG("MACRO par%d:%s", i, arglist[i]);
-
- elen = copymacro(buffer, s+3, INPUTSIZ-1, arglist);
-
-substitute:
- DBG("MACRO '%s' expanded to :'%s'", macroname, buffer);
- buffer[elen] = '\0';
- addinput(filenam, sym, xstrdup(buffer));
-
- return 1;
-}
-
-static int
-getpars(Symbol *args[NR_MACROARG])
-{
- int n, c;
- Symbol *sym;
-
- c = *input->p;
- next();
- if (c != '(')
- return -1;
- next(); /* skip the '(' */
- if (accept(')'))
- return 0;
-
- n = 0;
- do {
- if (n == NR_MACROARG) {
- cpperror("too many parameters in macro");
- return NR_MACROARG;
- }
- if (accept(ELLIPSIS)) {
- args[n++] = NULL;
- break;
- }
- if (yytoken != IDEN) {
- cpperror("macro arguments must be identifiers");
- return NR_MACROARG;
- }
- sym = install(NS_IDEN, yylval.sym);
- sym->flags |= SUSED;
- args[n++] = sym;
- next();
- } while (accept(','));
- expect(')');
-
- return n;
-}
-
-static int
-getdefs(Symbol *args[NR_MACROARG], int nargs, char *bp, size_t bufsiz)
-{
- Symbol **argp;
- size_t len;
- int prevc = 0, ispar;
-
- if (yytoken == '$') {
- cpperror("'##' cannot appear at either ends of a macro expansion");
- return 0;
- }
-
- for (;;) {
- ispar = 0;
- if (yytoken == IDEN && nargs >= 0) {
- for (argp = args; argp < &args[nargs]; ++argp) {
- if (*argp == yylval.sym)
- break;
- }
- if (argp != &args[nargs]) {
- sprintf(yytext, "@%02d@", (int) (argp - args));
- ispar = 1;
- }
- }
- if (prevc == '#' && !ispar) {
- cpperror("'#' is not followed by a macro parameter");
- return 0;
- }
- if (yytoken == '\n')
- break;
-
- if ((len = strlen(yytext)) >= bufsiz) {
- cpperror("macro too long");
- return 0;
- }
- if (yytoken == '$') {
- *bp++ = '$';
- --bufsiz;
- } else {
- memcpy(bp, yytext, len);
- bp += len;
- bufsiz -= len;
- }
- if ((prevc = yytoken) != '#') {
- *bp++ = ' ';
- --bufsiz;
- }
- next();
- }
- *bp = '\0';
- return 1;
-}
-
-static void
-define(void)
-{
- Symbol *sym,*args[NR_MACROARG];
- char buff[LINESIZ+1];
- int n;
-
- if (cppoff)
- return;
-
- namespace = NS_CPP;
- next();
-
- if (yytoken != IDEN) {
- cpperror("macro names must be identifiers");
- return;
- }
- sym = yylval.sym;
- if (sym->flags & SDECLARED) {
- warn("'%s' redefined", yytext);
- free(sym->u.s);
- } else {
- sym = install(NS_CPP, sym);
- sym->flags |= SDECLARED|SSTRING;
- }
-
- namespace = NS_IDEN; /* Avoid polution in NS_CPP */
- if ((n = getpars(args)) == NR_MACROARG)
- goto delete;
- if (n > 0 && !args[n-1]) /* it is a variadic function */
- --n;
- sprintf(buff, "%02d#", n);
- if (!getdefs(args, n, buff+3, LINESIZ-3))
- goto delete;
- sym->u.s = xstrdup(buff);
- DBG("MACRO '%s' defined as '%s'", sym->name, buff);
- return;
-
-delete:
- killsym(sym);
-}
-
-void
-incdir(char *dir)
-{
- if (!dir || *dir == '\0')
- die("cc1: incorrect -I flag");
- newitem(&dirinclude, dir);
-}
-
-static int
-includefile(char *dir, char *file, size_t filelen)
-{
- size_t dirlen;
- char path[FILENAME_MAX];
-
- if (!dir) {
- dirlen = 0;
- if (filelen > FILENAME_MAX-1)
- return 0;
- } else {
- dirlen = strlen(dir);
- if (dirlen + filelen > FILENAME_MAX-2)
- return 0;
- memcpy(path, dir, dirlen);
- if (dir[dirlen-1] != '/')
- path[dirlen++] = '/';
- }
- memcpy(path+dirlen, file, filelen);
- path[dirlen + filelen] = '\0';
-
- addinput(path, NULL, NULL);
- return 1;
-}
-
-static char *
-cwd(char *buf)
-{
- char *p, *s = filenam;
- size_t len;
-
- if ((p = strrchr(s, '/')) == NULL)
- return NULL;
- if ((len = p - s) >= FILENAME_MAX)
- die("cc1: current work directory too long");
- memcpy(buf, s, len);
- buf[len] = '\0';
- return buf;
-}
-
-static void
-include(void)
-{
- char dir[FILENAME_MAX], file[FILENAME_MAX], *p, **bp;
- size_t filelen;
- int n;
-
- if (cppoff)
- return;
-
- namespace = NS_IDEN;
- next();
-
- switch (*yytext) {
- case '<':
- if ((p = strchr(input->begin, '>')) == NULL || p[-1] == '<')
- goto bad_include;
- filelen = p - input->begin;
- if (filelen >= FILENAME_MAX)
- goto too_long;
- memcpy(file, input->begin, filelen);
- file[filelen] = '\0';
-
- input->begin = input->p = p+1;
- if (next() != '\n')
- goto trailing_characters;
-
- break;
- case '"':
- if (yylen < 3)
- goto bad_include;
- filelen = yylen-2;
- if (filelen >= FILENAME_MAX)
- goto too_long;
- memcpy(file, yytext+1, filelen);
- file[filelen] = '\0';
-
- if (next() != '\n')
- goto trailing_characters;
-
- if (includefile(cwd(dir), file, filelen))
- goto its_done;
- break;
- default:
- goto bad_include;
- }
-
- n = dirinclude.n;
- for (bp = dirinclude.s; n--; ++bp) {
- if (includefile(*bp, file, filelen))
- goto its_done;
- }
- cpperror("included file '%s' not found", file);
-
-its_done:
- return;
-
-trailing_characters:
- cpperror("trailing characters after preprocessor directive");
- return;
-
-too_long:
- cpperror("too long file name in #include");
- return;
-
-bad_include:
- cpperror("#include expects \"FILENAME\" or <FILENAME>");
- return;
-}
-
-static void
-line(void)
-{
- long n;
- char *endp, *fname;
-
- if (cppoff)
- return;
-
- disexpand = 0;
- next();
- n = strtol(yytext, &endp, 10);
- if (n <= 0 || n > USHRT_MAX || *endp != '\0') {
- cpperror("first parameter of #line is not a positive integer");
- return;
- }
-
- next();
- if (yytoken == '\n') {
- fname = NULL;
- } else {
- if (*yytext != '\"' || yylen == 1) {
- cpperror("second parameter of #line is not a valid filename");
- return;
- }
- fname = yylval.sym->u.s;
- }
- setloc(fname, n - 1);
- if (yytoken != '\n')
- next();
-}
-
-static void
-pragma(void)
-{
- if (cppoff)
- return;
- next();
- warn("ignoring pragma '%s'", yytext);
- *input->p = '\0';
- next();
-}
-
-static void
-usererr(void)
-{
- if (cppoff)
- return;
- cpperror("#error %s", input->p);
- *input->p = '\0';
- next();
-}
-
-static void
-ifclause(int negate, int isifdef)
-{
- Symbol *sym;
- unsigned n;
- int status;
- Node *expr;
-
- if (cppctx == NR_COND-1)
- error("too many nesting levels of conditional inclusion");
-
- n = cppctx++;
- namespace = NS_CPP;
- next();
-
- if (isifdef) {
- if (yytoken != IDEN) {
- cpperror("no macro name given in #%s directive",
- (negate) ? "ifndef" : "ifdef");
- return;
- }
- sym = yylval.sym;
- next();
- status = (sym->flags & SDECLARED) != 0;
- if (!status)
- killsym(sym);
- } else {
- /* TODO: catch recovery here */
- if ((expr = constexpr()) == NULL) {
- cpperror("parameter of #if is not an integer constant expression");
- return;
- }
- status = expr->sym->u.i != 0;
- freetree(expr);
- }
-
- if (negate)
- status = !status;
- if ((ifstatus[n] = status) == 0)
- ++cppoff;
-}
-
-static void
-cppif(void)
-{
- disexpand = 0;
- ifclause(0, 0);
-}
-
-static void
-ifdef(void)
-{
- ifclause(0, 1);
-}
-
-static void
-ifndef(void)
-{
- ifclause(1, 1);
-}
-
-static void
-elseclause(void)
-{
- int status;
-
- if (cppctx == 0) {
- cpperror("#else without #ifdef/ifndef");
- return;
- }
-
- status = ifstatus[cppctx-1];
- ifstatus[cppctx-1] = !status;
- cppoff += (status) ? 1 : -1;
-}
-
-static void
-cppelse(void)
-{
- elseclause();
- next();
-}
-
-static void
-elif(void)
-{
- elseclause();
- if (ifstatus[cppctx-1]) {
- --cppctx;
- cppif();
- }
-}
-
-static void
-endif(void)
-{
- if (cppctx == 0)
- error("#endif without #if");
- if (!ifstatus[--cppctx])
- --cppoff;
- next();
-}
-
-static void
-undef(void)
-{
- if (cppoff)
- return;
-
- namespace = NS_CPP;
- next();
- if (yytoken != IDEN) {
- error("no macro name given in #undef directive");
- return;
- }
- killsym(yylval.sym);
- next();
-}
-
-int
-cpp(void)
-{
- static struct {
- unsigned char token;
- void (*fun)(void);
- } *bp, clauses [] = {
- {DEFINE, define},
- {INCLUDE, include},
- {LINE, line},
- {IFDEF, ifdef},
- {IF, cppif},
- {ELIF, elif},
- {IFNDEF, ifndef},
- {ELSE, cppelse},
- {ENDIF, endif},
- {UNDEF, undef},
- {PRAGMA, pragma},
- {ERROR, usererr},
- {0, NULL}
- };
- int ns;
- char *p;
-
- for (p = input->p; isspace(*p); ++p)
- ;
-
- if (*p != '#')
- return cppoff;
- input->p = p+1;
-
- disexpand = 1;
- lexmode = CPPMODE;
- ns = namespace;
- namespace = NS_CPPCLAUSES;
- next();
- namespace = NS_IDEN;
-
- for (bp = clauses; bp->token && bp->token != yytoken; ++bp)
- ;
- if (!bp->token) {
- errorp("incorrect preprocessor directive '%s'", yytext);
- goto error;
- }
-
- DBG("CPP %s", yytext);
-
- pushctx(); /* create a new context to avoid polish */
- (*bp->fun)(); /* the current context, and to get all */
- popctx(); /* the symbols freed at the end */
-
- /*
- * #include changes the content of input->line, so the correctness
- * of the line must be checked in the own include(), and we have
- * to skip this tests. For the same reason include() is the only
- * function which does not prepare the next token
- */
- if (yytoken != '\n' && !cppoff && bp->token != INCLUDE)
- errorp("trailing characters after preprocessor directive");
-
-error:
- disexpand = 0;
- lexmode = CCMODE;
- namespace = ns;
-
- return 1;
-}
-
-void
-ppragmaln(void)
-{
- static char file[FILENAME_MAX];
- static unsigned nline;
- char *s;
-
- putchar('\n');
- if (strcmp(file, filenam)) {
- strcpy(file, filenam);
- s = "#line %u \"%s\"\n";
- } else if (nline+1 != lineno) {
- s = "#line %u\n";
- } else {
- s = "";
- }
- nline = lineno;
- printf(s, nline, file);
-}
-
-void
-outcpp(void)
-{
- int c;
- char *s, *t;
-
- for (next(); yytoken != EOFTOK; next()) {
- if (onlyheader)
- continue;
- if (yytoken != STRING) {
- printf("%s ", yytext);
- continue;
- }
- for (s = yytext; c = *s; ++s) {
- switch (c) {
- case '\n':
- t = "\\n";
- goto print_str;
- case '\v':
- t = "\\v";
- goto print_str;
- case '\b':
- t = "\\b";
- goto print_str;
- case '\t':
- t = "\\t";
- goto print_str;
- case '\a':
- t = "\\a";
- print_str:
- fputs(t, stdout);
- break;
- case '\\':
- putchar('\\');
- default:
- if (!isprint(c))
- printf("\\x%x", c);
- else
- putchar(c);
- break;
- }
- }
- putchar(' ');
- }
- putchar('\n');
-}
-
--- a/cc1/decl.c
+++ /dev/null
@@ -1,967 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/decl.c";
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define NOSCLASS 0
-
-#define NOREP 0
-#define REP 1
-#define QUIET 1
-#define NOQUIET 0
-
-#define NR_DCL_TYP (NR_DECLARATORS+NR_FUNPARAM)
-#define NR_DCL_SYM (NR_DECLARATORS+NR_FUNPARAM+1)
-
-struct declarators {
- unsigned nr;
- unsigned ns;
- struct decl *dcl;
- unsigned nr_types;
- Type **tpars;
- Symbol **pars;
- struct declarator {
- unsigned char op;
- TINT nelem;
- Symbol *sym;
- Type **tpars;
- Symbol **pars;
- } d [NR_DECLARATORS];
-};
-
-struct decl {
- unsigned ns;
- int sclass;
- int qualifier;
- Symbol *sym;
- Type *type;
- Type *parent;
- Symbol **pars;
- Symbol *bufpars[NR_DCL_SYM];
- Type *buftpars[NR_DCL_TYP];
-};
-
-
-static void
-endfundcl(Type *tp, Symbol **pars)
-{
- if (tp->prop&TK_R && *pars)
- warn("parameter names (without types) in function declaration");
- /*
- * avoid non used warnings in prototypes
- */
- while (*pars)
- (*pars++)->flags |= SUSED;
- popctx();
-}
-
-static void
-push(struct declarators *dp, int op, ...)
-{
- va_list va;
- unsigned n;
- struct declarator *p;
-
- va_start(va, op);
- if ((n = dp->nr++) == NR_DECLARATORS)
- error("too many declarators");
-
- p = &dp->d[n];
- p->op = op;
- p->tpars = NULL;
-
- switch (op) {
- case ARY:
- p->nelem = va_arg(va, TINT);
- break;
- case KRFTN:
- case FTN:
- p->nelem = va_arg(va, unsigned);
- p->tpars = va_arg(va, Type **);
- p->pars = va_arg(va, Symbol **);
- break;
- case IDEN:
- p->sym = va_arg(va, Symbol *);
- break;
- }
- va_end(va);
-}
-
-static int
-pop(struct declarators *dp, struct decl *dcl)
-{
- struct declarator *p;
-
- if (dp->nr == 0)
- return 0;
-
- p = &dp->d[--dp->nr];
- if (p->op == IDEN) {
- dcl->sym = p->sym;
- return 1;
- }
-
- if (dcl->type->op == FTN)
- endfundcl(dcl->type, dcl->pars);
- dcl->pars = p->pars;
-
- dcl->type = mktype(dcl->type, p->op, p->nelem, p->tpars);
- return 1;
-}
-
-static void
-arydcl(struct declarators *dp)
-{
- Node *np = NULL;
- TINT n = 0;
-
- expect('[');
- if (yytoken != ']') {
- if ((np = constexpr()) == NULL) {
- errorp("invalid storage size");
- } else {
- if ((n = np->sym->u.i) <= 0) {
- errorp("array size is not a positive number");
- n = 1;
- }
- freetree(np);
- }
- }
- expect(']');
-
- push(dp, ARY, n);
-}
-
-static int
-empty(Symbol *sym, Type *tp, int param)
-{
- if (!sym->name) {
- sym->type = tp;
- switch (tp->op) {
- default:
- /* warn if it is not a parameter */
- if (!param)
- warn("empty declaration");
- case STRUCT:
- case UNION:
- case ENUM:
- return 1;
- }
- }
- return 0;
-}
-
-static void
-bad_storage(Type *tp, char *name)
-{
- if (tp->op != FTN)
- errorp("incorrect storage class for file-scope declaration");
- else
- errorp("invalid storage class for function '%s'", name);
-}
-
-static Symbol *
-redcl(Symbol *sym, Type *tp, int sclass)
-{
- int flags;
- char *name = sym->name;
-
- if (!eqtype(sym->type, tp, 1)) {
- errorp("conflicting types for '%s'", name);
- return sym;
- }
-
- if (sym->token == TYPEIDEN && sclass != TYPEDEF ||
- sym->token != TYPEIDEN && sclass == TYPEDEF) {
- goto redeclaration;
- }
- if (curctx != GLOBALCTX && tp->op != FTN) {
- /* is it the redeclaration of a local variable? */
- if ((sym->flags & SEXTERN) && sclass == EXTERN)
- return sym;
- goto redeclaration;
- }
-
- flags = sym->flags;
- switch (sclass) {
- case REGISTER:
- case AUTO:
- bad_storage(tp, name);
- break;
- case NOSCLASS:
- if ((flags & SPRIVATE) == 0) {
- if (flags & SEXTERN)
- flags &= ~(SEXTERN|SEMITTED);
- flags |= SGLOBAL;
- break;
- }
- errorp("non-static declaration of '%s' follows static declaration",
- name);
- break;
- case TYPEDEF:
- /* Only C11 allows multiple definitions of a typedef. */
- goto redeclaration;
- case EXTERN:
- break;
- case STATIC:
- if ((flags & (SGLOBAL|SEXTERN)) == 0) {
- flags |= SPRIVATE;
- break;
- }
- errorp("static declaration of '%s' follows non-static declaration",
- name);
- break;
- }
- sym->flags = flags;
-
- return sym;
-
-redeclaration:
- errorp("redeclaration of '%s'", name);
- return sym;
-}
-
-static Symbol *
-identifier(struct decl *dcl)
-{
- Symbol *sym = dcl->sym;
- Type *tp = dcl->type;
- int sclass = dcl->sclass;
- char *name = sym->name;
-
- if (empty(sym, tp, 0))
- return sym;
-
- /* TODO: Add warning about ANSI limits */
- if (!(tp->prop & TDEFINED) &&
- sclass != EXTERN && sclass != TYPEDEF &&
- !(tp->op == ARY && yytoken == '=')) {
- errorp("declared variable '%s' of incomplete type", name);
- }
-
- if (tp->op == FTN) {
- if (sclass == NOSCLASS)
- sclass = EXTERN;
- if (!strcmp(name, "main") && tp->type != inttype) {
- errorp("main shall be defined with a return type of int");
- errorp("please contact __20h__ on irc.freenode.net (#bitreich-en) via IRC");
- }
- }
-
- if (sym->flags & SDECLARED) {
- sym = redcl(dcl->sym, tp, sclass);
- } else {
- int flags = sym->flags | SDECLARED;
-
- sym->type = tp;
-
- switch (sclass) {
- case REGISTER:
- case AUTO:
- if (curctx != GLOBALCTX && tp->op != FTN) {
- flags |= (sclass == REGISTER) ? SREGISTER : SAUTO;
- break;
- }
- bad_storage(tp, name);
- case NOSCLASS:
- if (tp->op == FTN)
- flags |= SEXTERN;
- else
- flags |= (curctx == GLOBALCTX) ? SGLOBAL : SAUTO;
- break;
- case EXTERN:
- flags |= SEXTERN;
- break;
- case STATIC:
- flags |= (curctx == GLOBALCTX) ? SPRIVATE : SLOCAL;
- break;
- case TYPEDEF:
- flags |= STYPEDEF;
- sym->u.token = sym->token = TYPEIDEN;
- break;
- }
- sym->flags = flags;
- }
-
- if (accept('='))
- initializer(sym, sym->type);
- if (!(sym->flags & (SGLOBAL|SEXTERN)) && tp->op != FTN)
- sym->flags |= SDEFINED;
- if (sym->token == IDEN && tp->op != FTN)
- emit(ODECL, sym);
- return sym;
-}
-
-static Symbol *
-parameter(struct decl *dcl)
-{
- Symbol *sym = dcl->sym;
- Type *funtp = dcl->parent, *tp = dcl->type;
- char *name = sym->name;
- int flags;
-
- flags = 0;
- switch (dcl->sclass) {
- case STATIC:
- case EXTERN:
- case AUTO:
- errorp("bad storage class in function parameter");
- break;
- case REGISTER:
- flags |= SREGISTER;
- break;
- case NOSCLASS:
- flags |= SAUTO;
- break;
- }
-
- switch (tp->op) {
- case VOID:
- funtp->n.elem = 1;
- if (dcl->sclass)
- errorp("void as unique parameter may not be qualified");
- return NULL;
- case ARY:
- tp = mktype(tp->type, PTR, 0, NULL);
- break;
- case FTN:
- errorp("incorrect function type for a function parameter");
- return NULL;
- }
- if (!empty(sym, tp, 1)) {
- int isdcl = sym->flags&SDECLARED, isk_r = funtp->prop & TK_R;
- if (isdcl && !isk_r) {
- errorp("redefinition of parameter '%s'", name);
- return NULL;
- }
- if (!isdcl && isk_r) {
- errorp("declaration for parameter '%s' but no such parameter",
- sym->name);
- return NULL;
- }
- sym->flags |= SDECLARED;
- }
-
- sym->type = tp;
- sym->flags &= ~(SAUTO|SREGISTER);
- sym->flags |= flags;
- return sym;
-}
-
-static Symbol *dodcl(int rep,
- Symbol *(*fun)(struct decl *),
- unsigned ns,
- Type *type);
-
-static int
-krpars(struct declarators *dp)
-{
- Symbol *sym;
- int toomany = 0;
- unsigned npars = 0;
-
- do {
- sym = yylval.sym;
- expect(IDEN);
- sym->flags |= SAUTO;
- if ((sym = install(NS_IDEN, sym)) == NULL) {
- errorp("redefinition of parameter '%s'",
- yylval.sym->name);
- continue;
- }
- if (npars < NR_FUNPARAM) {
- ++npars;
- *dp->pars++ = sym;
- continue;
- }
- if (!toomany)
- toomany = 1;
- } while (accept(','));
-
- return toomany;
-}
-
-static unsigned
-krfun(struct declarators *dp)
-{
- int toomany = 0;
-
-
- if (yytoken != ')')
- toomany = krpars(dp);
-
- if (dp->nr_types == NR_DCL_TYP) {
- toomany = 1;
- } else {
- ++dp->nr_types;
- *dp->tpars++ = ellipsistype;
- }
-
- if (toomany)
- errorp("too many parameters in function definition");
- return 1;
-}
-
-static unsigned
-ansifun(struct declarators *dp)
-{
- Symbol *sym;
- unsigned npars, ntype, toomany, distoomany, voidpar;
- Type type, *tp;
-
- type.n.elem = 0;
- type.prop = 0;
- npars = ntype = toomany = distoomany = voidpar = 0;
-
- do {
- if (accept(ELLIPSIS)) {
- if (ntype < 1)
- errorp("a named argument is requiered before '...'");
- if (yytoken != ')')
- errorp("... must be the last parameter");
- sym = NULL;
- tp = ellipsistype;
- } else if ((sym = dodcl(NOREP, parameter, NS_IDEN, &type)) == NULL) {
- if (type.n.elem == 1 && ntype > 1)
- voidpar = 1;
- sym = NULL;
- tp = NULL;
- } else {
- tp = sym->type;
- }
-
- if (sym) {
- if (npars == NR_FUNPARAM) {
- toomany = 1;
- } else {
- npars++;
- *dp->pars++ = sym;
- }
- }
-
- if (tp) {
- if (dp->nr_types == NR_DCL_TYP) {
- toomany = 1;
- } else {
- ntype++;
- dp->nr_types++;
- *dp->tpars++ = tp;
- }
- }
-
- } while (accept(','));
-
- if (toomany == 1)
- errorp("too many parameters in function definition");
- if (voidpar && ntype > 1)
- errorp("'void' must be the only parameter");
- return ntype;
-}
-
-static int
-funbody(Symbol *sym, Symbol *pars[])
-{
- Type *tp;
- Symbol **bp, *p;
-
- if (!sym)
- return 0;
- tp = sym->type;
- if (tp->op != FTN)
- return 0;
-
- switch (yytoken) {
- case '{':
- case TYPE:
- case TYPEIDEN:
- if (curctx != PARAMCTX)
- errorp("nested function declaration");
- if (sym && sym->ns == NS_IDEN)
- break;
- default:
- emit(ODECL, sym);
- endfundcl(tp, pars);
- return 0;
- }
-
- tp->prop |= TFUNDEF;
- curfun = sym;
- if (sym->type->prop & TK_R) {
- while (yytoken != '{') {
- dodcl(REP, parameter, NS_IDEN, sym->type);
- expect(';');
- }
- for (bp = pars; p = *bp; ++bp) {
- if (p->type == NULL) {
- warn("type of '%s' defaults to int", p->name);
- p->type = inttype;
- }
- }
- }
- if (sym->flags & STYPEDEF)
- errorp("function definition declared 'typedef'");
- if (sym->flags & SDEFINED)
- errorp("redefinition of '%s'", sym->name);
- if (sym->flags & SEXTERN) {
- sym->flags &= ~SEXTERN;
- sym->flags |= SGLOBAL;
- }
- sym->flags |= SDEFINED;
- sym->flags &= ~SEMITTED;
- sym->u.pars = pars;
- emit(OFUN, sym);
- compound(NULL, NULL, NULL);
- emit(OEFUN, NULL);
- popctx();
- flushtypes();
- curfun = NULL;
- return 1;
-}
-
-static void
-fundcl(struct declarators *dp)
-{
- Type **types = dp->tpars;
- unsigned ntypes, typefun;
- Symbol **pars = dp->pars;
- unsigned (*fun)(struct declarators *);
-
- pushctx();
- expect('(');
- if (yytoken == ')' || yytoken == IDEN) {
- typefun = KRFTN;
- fun = krfun;
- } else {
- typefun = FTN;
- fun = ansifun;
- }
- ntypes = (*fun)(dp);
- *dp->pars++= NULL;
- expect(')');
-
- push(dp, typefun, ntypes, types, pars);
-}
-
-static void declarator(struct declarators *dp);
-
-static void
-directdcl(struct declarators *dp)
-{
- Symbol *p, *sym;
- static int nested;
-
- if (accept('(')) {
- if (nested == NR_SUBTYPE)
- error("too many declarators nested by parentheses");
- ++nested;
- declarator(dp);
- --nested;
- expect(')');
- } else {
- if (yytoken == IDEN || yytoken == TYPEIDEN) {
- sym = yylval.sym;
- if (p = install(dp->ns, sym)) {
- sym = p;
- sym->flags &= ~SDECLARED;
- }
- next();
- } else {
- sym = newsym(dp->ns, NULL);
- }
- push(dp, IDEN, sym);
- }
-
- for (;;) {
- switch (yytoken) {
- case '(': fundcl(dp); break;
- case '[': arydcl(dp); break;
- default: return;
- }
- }
-}
-
-static void
-declarator(struct declarators *dp)
-{
- unsigned n;
-
- for (n = 0; accept('*'); ++n) {
- while (accept(TQUALIFIER))
- ;
- }
-
- directdcl(dp);
-
- while (n--)
- push(dp, PTR);
-}
-
-static Type *structdcl(void), *enumdcl(void);
-
-static Type *
-specifier(int *sclass, int *qualifier)
-{
- Type *tp = NULL;
- unsigned spec, qlf, sign, type, cls, size;
-
- spec = qlf = sign = type = cls = size = 0;
-
- for (;;) {
- unsigned *p = NULL;
- Type *(*dcl)(void) = NULL;
-
- switch (yytoken) {
- case SCLASS:
- p = &cls;
- break;
- case TQUALIFIER:
- qlf |= yylval.token;
- next();
- continue;
- case TYPEIDEN:
- if (type)
- goto return_type;
- tp = yylval.sym->type;
- p = &type;
- break;
- case TYPE:
- switch (yylval.token) {
- case ENUM:
- dcl = enumdcl;
- p = &type;
- break;
- case STRUCT:
- case UNION:
- dcl = structdcl;
- p = &type;
- break;
- case VA_LIST:
- case VOID:
- case BOOL:
- case CHAR:
- case INT:
- case FLOAT:
- case DOUBLE:
- p = &type;
- break;
- case SIGNED:
- case UNSIGNED:
- p = &sign;
- break;
- case LONG:
- if (size == LONG) {
- yylval.token = LLONG;
- size = 0;
- }
- case SHORT:
- p = &size;
- break;
- }
- break;
- default:
- goto return_type;
- }
- if (*p)
- errorp("invalid type specification");
- *p = yylval.token;
- if (dcl) {
- if (size || sign)
- errorp("invalid type specification");
- tp = (*dcl)();
- goto return_type;
- } else {
- next();
- }
- spec = 1;
- }
-
-return_type:
- *sclass = cls;
- *qualifier = qlf;
- if (!tp) {
- if (spec) {
- tp = ctype(type, sign, size);
- } else {
- if (curctx != GLOBALCTX)
- unexpected();
- warn("type defaults to 'int' in declaration");
- tp = inttype;
- }
- }
- return tp;
-}
-
-static Symbol *
-newtag(void)
-{
- Symbol *sym;
- int ns, op, tag = yylval.token;
- static unsigned tpns = NS_STRUCTS;
-
- ns = namespace;
- namespace = NS_TAG;
- next();
- namespace = ns;
-
- switch (yytoken) {
- case IDEN:
- case TYPEIDEN:
- sym = yylval.sym;
- if ((sym->flags & SDECLARED) == 0)
- install(NS_TAG, yylval.sym);
- next();
- break;
- default:
- sym = newsym(NS_TAG, NULL);
- break;
- }
- if (!sym->type) {
- Type *tp;
-
- if (tpns == NS_STRUCTS + NR_MAXSTRUCTS)
- error("too many tags declared");
- tp = mktype(NULL, tag, 0, NULL);
- tp->ns = tpns++;
- sym->type = tp;
- tp->tag = sym;
- DBG("declared tag '%s' with ns = %d\n",
- (sym->name) ? sym->name : "anonymous", tp->ns);
- }
-
- if ((op = sym->type->op) != tag && op != INT)
- error("'%s' defined as wrong kind of tag", sym->name);
- return sym;
-}
-
-static void fieldlist(Type *tp);
-
-static Type *
-structdcl(void)
-{
- Symbol *sym;
- Type *tp;
- static int nested;
- int ns;
-
- sym = newtag();
- tp = sym->type;
-
- if (!accept('{'))
- return tp;
-
- ns = namespace;
- namespace = tp->ns;
-
- if (tp->prop & TDEFINED && sym->ctx == curctx)
- error("redefinition of struct/union '%s'", sym->name);
-
- if (nested == NR_STRUCT_LEVEL)
- error("too many levels of nested structure or union definitions");
-
- ++nested;
- while (yytoken != '}') {
- fieldlist(tp);
- }
- --nested;
-
- deftype(tp);
- namespace = ns;
- expect('}');
- return tp;
-}
-
-static Type *
-enumdcl(void)
-{
- Type *tp;
- Symbol *sym, *tagsym;
- int ns, val, toomany;
- unsigned nctes;
-
- ns = namespace;
- tagsym = newtag();
- tp = tagsym->type;
-
- if (!accept('{'))
- goto restore_name;
- if (tp->prop & TDEFINED)
- errorp("redefinition of enumeration '%s'", tagsym->name);
- deftype(tp);
- namespace = NS_IDEN;
-
- /* TODO: check incorrect values in val */
- for (nctes = val = 0; yytoken != '}'; ++nctes, ++val) {
- if (yytoken != IDEN)
- unexpected();
- sym = yylval.sym;
- next();
- if (nctes == NR_ENUM_CTES && !toomany) {
- errorp("too many enum constants in a single enum");
- toomany = 1;
- }
- if (accept('=')) {
- Node *np = constexpr();
-
- if (np == NULL)
- errorp("invalid enumeration value");
- else
- val = np->sym->u.i;
- freetree(np);
- }
- if ((sym = install(NS_IDEN, sym)) == NULL) {
- errorp("'%s' redeclared as different kind of symbol",
- yytext);
- } else {
- sym->u.i = val;
- sym->flags |= SCONSTANT;
- sym->type = inttype;
- }
- if (!accept(','))
- break;
- }
- expect('}');
-
-restore_name:
- namespace = ns;
- return tp;
-}
-
-static Symbol *
-type(struct decl *dcl)
-{
- Symbol *sym = dcl->sym;
-
- if (dcl->sclass)
- error("class storage in type name");
- if (sym->name)
- error("unexpected identifier in type name");
- sym->type = dcl->type;
-
- return sym;
-}
-
-static Symbol *
-field(struct decl *dcl)
-{
- static char *anon = "<anonymous>";
- Symbol *sym = dcl->sym;
- char *name = (sym->name) ? sym->name : anon;
- Type *structp = dcl->parent, *tp = dcl->type;
- TINT n = structp->n.elem;
- int err = 0;
-
- if (accept(':')) {
- Node *np;
- TINT n;
-
- if ((np = constexpr()) == NULL) {
- unexpected();
- n = 0;
- } else {
- n = np->sym->u.i;
- freetree(np);
- }
- if (n == 0 && name != anon)
- errorp("zero width for bit-field '%s'", name);
- if (tp != booltype && tp != inttype && tp != uinttype)
- errorp("bit-field '%s' has invalid type", name);
- if (n < 0)
- errorp("negative width in bit-field '%s'", name);
- else if (n > tp->size*8)
- errorp("width of '%s' exceeds its type", name);
- } else if (empty(sym, tp, 0)) {
- return sym;
- }
-
- if (tp->op == FTN) {
- errorp("invalid type '%s' in struct/union", name);
- err = 1;
- }
- if (dcl->sclass) {
- errorp("storage class in struct/union field '%s'", name);
- err = 1;
- }
- if (!(tp->prop & TDEFINED)) {
- error("field '%s' has incomplete type", name);
- err = 1;
- }
- if (err)
- return sym;
-
- if (sym->flags & SDECLARED)
- error("duplicated member '%s'", name);
- sym->flags |= SFIELD|SDECLARED;
- sym->type = tp;
-
- if (n == NR_FIELDS)
- error("too many fields in struct/union");
- DBG("New field '%s' in namespace %d\n", name, structp->ns);
- structp->p.fields = xrealloc(structp->p.fields, ++n * sizeof(*sym));
- structp->p.fields[n-1] = sym;
- structp->n.elem = n;
-
- return sym;
-}
-
-static Symbol *
-dodcl(int rep, Symbol *(*fun)(struct decl *), unsigned ns, Type *parent)
-{
- Symbol *sym;
- Type *base;
- struct decl dcl;
- struct declarators stack;
-
- dcl.ns = ns;
- dcl.parent = parent;
- base = specifier(&dcl.sclass, &dcl.qualifier);
-
- do {
- dcl.type = base;
- stack.nr_types = stack.nr = 0;
- stack.tpars = dcl.buftpars;
- stack.pars = dcl.bufpars;
- stack.dcl = &dcl;
- stack.ns = ns;
-
- declarator(&stack);
-
- while (pop(&stack, &dcl))
- ;
- sym = (*fun)(&dcl);
- if (funbody(sym, dcl.pars))
- return sym;
- } while (rep && accept(','));
-
- return sym;
-}
-
-void
-decl(void)
-{
- Symbol *sym;
-
- if (accept(';'))
- return;
- sym = dodcl(REP, identifier, NS_IDEN, NULL);
- if (sym->type->prop & TFUNDEF)
- return;
- expect(';');
-}
-
-static void
-fieldlist(Type *tp)
-{
- if (yytoken != ';')
- dodcl(REP, field, tp->ns, tp);
- expect(';');
-}
-
-Type *
-typename(void)
-{
- return dodcl(NOREP, type, NS_DUMMY, NULL)->type;
-}
--- a/cc1/deps.mk
+++ /dev/null
@@ -1,45 +1,0 @@
-cpp.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-decl.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-expr.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-init.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-lex.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-stmt.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-symbol.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-types.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-
-#deps
-builtin.o: ../inc/scc.h
-builtin.o: cc1.h
-code.o: ../inc/scc.h
-code.o: cc1.h
-cpp.o: ../inc/scc.h
-cpp.o: cc1.h
-decl.o: ../inc/scc.h
-decl.o: cc1.h
-error.o: ../inc/scc.h
-error.o: cc1.h
-expr.o: ../inc/scc.h
-expr.o: cc1.h
-fold.o: ../inc/scc.h
-fold.o: cc1.h
-init.o: ../inc/scc.h
-init.o: cc1.h
-lex.o: ../inc/scc.h
-lex.o: cc1.h
-main.o: ../inc/arg.h
-main.o: ../inc/scc.h
-main.o: cc1.h
-stmt.o: ../inc/scc.h
-stmt.o: cc1.h
-symbol.o: ../inc/scc.h
-symbol.o: cc1.h
-target/amd64-sysv/arch.o: target/amd64-sysv/../../../inc/scc.h
-target/amd64-sysv/arch.o: target/amd64-sysv/../../cc1.h
-target/arm64-sysv/arch.o: target/arm64-sysv/../../../inc/scc.h
-target/arm64-sysv/arch.o: target/arm64-sysv/../../cc1.h
-target/i386-sysv/arch.o: target/i386-sysv/../../../inc/scc.h
-target/i386-sysv/arch.o: target/i386-sysv/../../cc1.h
-target/z80-scc/arch.o: target/z80-scc/../../../inc/scc.h
-target/z80-scc/arch.o: target/z80-scc/../../cc1.h
-types.o: ../inc/scc.h
-types.o: cc1.h
--- a/cc1/error.c
+++ /dev/null
@@ -1,85 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/error.c";
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define MAXERRNUM 10
-
-extern int failure;
-static unsigned nerrors;
-
-static void
-warn_error(int flag, char *fmt, va_list va)
-{
- if (flag == 0)
- return;
- fprintf(stderr, "%s:%u: %s: ",
- filenam, lineno,
- (flag < 0) ? "error" : "warning");
- vfprintf(stderr, fmt, va);
- putc('\n', stderr);
-
- if (flag < 0) {
- if (!failure)
- fclose(stdout);
- failure = 1;
- if (++nerrors == MAXERRNUM) {
- fputs("too many errors\n", stderr);
- exit(1);
- }
- }
-}
-
-void
-warn(char *fmt, ...)
-{
- extern int warnings;
-
- va_list va;
- va_start(va, fmt);
- warn_error(warnings, fmt, va);
- va_end(va);
-}
-
-void
-error(char *fmt, ...)
-{
- va_list va;
-
- va_start(va, fmt);
- warn_error(-1, fmt, va);
- va_end(va);
- exit(1);
- discard();
-}
-
-void
-errorp(char *fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- warn_error(-1, fmt, va);
- va_end(va);
-}
-
-void
-cpperror(char *fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- warn_error(-1, fmt, va);
- va_end(va);
-
- /* discard input until the end of the line */
- *input->p = '\0';
- next();
-}
-
-void
-unexpected(void)
-{
- error("unexpected '%s'", yytext);
-}
--- a/cc1/expr.c
+++ /dev/null
@@ -1,1185 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/expr.c";
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define XCHG(lp, rp, np) (np = lp, lp = rp, rp = np)
-
-static Node *xexpr(void), *xassign(void);
-
-int
-cmpnode(Node *np, TUINT val)
-{
- Symbol *sym;
- Type *tp;
- TUINT mask, nodeval;
-
- if (!np || !(np->flags & NCONST) || !np->sym)
- return 0;
- sym = np->sym;
- tp = sym->type;
-
- switch (tp->op) {
- case PTR:
- case INT:
- mask = (val > 1) ? ones(np->type->size) : -1;
- nodeval = (tp->prop & TSIGNED) ? sym->u.i : sym->u.u;
- return (nodeval & mask) == (val & mask);
- case FLOAT:
- return sym->u.f == val;
- }
- return 0;
-}
-
-static Node *
-promote(Node *np)
-{
- Type *tp;
- Node *new;
- struct limits *lim, *ilim;
-
- tp = np->type;
-
- switch (tp->op) {
- case ENUM:
- case INT:
- if (tp->n.rank >= inttype->n.rank)
- return np;
- lim = getlimits(tp);
- ilim = getlimits(inttype);
- tp = (lim->max.i <= ilim->max.i) ? inttype : uinttype;
- break;
- case FLOAT:
- /* TODO: Add support for C99 float math */
- tp = doubletype;
- break;
- default:
- abort();
- }
- if ((new = convert(np, tp, 1)) != NULL)
- return new;
- return np;
-}
-
-static void
-arithconv(Node **p1, Node **p2)
-{
- int to = 0, s1, s2;
- unsigned r1, r2;
- Type *tp1, *tp2;
- Node *np1, *np2;
- struct limits *lp1, *lp2;
-
- np1 = promote(*p1);
- np2 = promote(*p2);
-
- tp1 = np1->type;
- tp2 = np2->type;
-
- if (tp1 == tp2)
- goto set_p1_p2;
-
- s1 = (tp1->prop & TSIGNED) != 0;
- r1 = tp1->n.rank;
- lp1 = getlimits(tp1);
-
- s2 = (tp2->prop & TSIGNED) != 0;
- r2 = tp2->n.rank;
- lp2 = getlimits(tp2);
-
- if (s1 == s2 || tp1->op == FLOAT || tp2->op == FLOAT) {
- to = r1 - r2;
- } else if (!s1) {
- if (r1 >= r2 || lp1->max.i >= lp2->max.i)
- to = 1;
- else
- to = -1;
- } else {
- if (r2 >= r1 || lp2->max.i >= lp1->max.i)
- to = -1;
- else
- to = 1;
- }
-
- if (to > 0)
- np2 = convert(np2, tp1, 1);
- else if (to < 0)
- np1 = convert(np1, tp2, 1);
-
-set_p1_p2:
- *p1 = np1;
- *p2 = np2;
-}
-
-static int
-null(Node *np)
-{
- if (np->type != pvoidtype || np->op != OCAST)
- return 0;
-
- np = np->left;
- if (np->type != inttype)
- return 0;
-
- return cmpnode(np, 0);
-}
-
-static Node *
-chkternary(Node *yes, Node *no)
-{
- /*
- * FIXME:
- * We are ignoring type qualifiers here,
- * but the standard has strong rules about this.
- * take a look to 6.5.15
- */
-
- if (!eqtype(yes->type, no->type, 1)) {
- if ((yes->type->prop & TARITH) && (no->type->prop & TARITH)) {
- arithconv(&yes, &no);
- } else if (yes->type->op != PTR && no->type->op != PTR) {
- goto wrong_type;
- } else {
- /* convert integer 0 to NULL */
- if ((yes->type->prop & TINTEGER) && cmpnode(yes, 0))
- yes = convert(yes, pvoidtype, 0);
- if ((no->type->prop & TINTEGER) && cmpnode(no, 0))
- no = convert(no, pvoidtype, 0);
- /*
- * At this point the type of both should be
- * a pointer to something, or we have don't
- * compatible types
- */
- if (yes->type->op != PTR || no->type->op != PTR)
- goto wrong_type;
- /*
- * If we have a null pointer constant then
- * convert to the another type
- */
- if (null(yes))
- yes = convert(yes, no->type, 0);
- if (null(no))
- no = convert(no, yes->type, 0);
-
- if (!eqtype(yes->type, no->type, 1))
- goto wrong_type;
- }
- }
- return node(OCOLON, yes->type, yes, no);
-
-wrong_type:
- errorp("type mismatch in conditional expression");
- freetree(yes);
- freetree(no);
- return constnode(zero);
-}
-
-static void
-chklvalue(Node *np)
-{
- if (!(np->flags & NLVAL))
- errorp("lvalue required in operation");
- if (np->type == voidtype)
- errorp("invalid use of void expression");
-}
-
-Node *
-decay(Node *np)
-{
- Node *new;
- Type *tp = np->type;
-
- switch (tp->op) {
- case ARY:
- tp = tp->type;
- if (np->op == OPTR) {
- new = np->left;
- free(np);
- new->type = mktype(tp, PTR, 0, NULL);
- return new;
- }
- case FTN:
- new = node(OADDR, mktype(tp, PTR, 0, NULL), np, NULL);
- if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
- new->flags |= NCONST;
- return new;
- default:
- return np;
- }
-}
-
-static Node *
-integerop(int op, Node *lp, Node *rp)
-{
- if (!(lp->type->prop & TINTEGER) || !(rp->type->prop & TINTEGER))
- error("operator requires integer operands");
- arithconv(&lp, &rp);
- return node(op, lp->type, lp, rp);
-}
-
-static Node *
-integeruop(int op, Node *np)
-{
- if (!(np->type->prop & TINTEGER))
- error("unary operator requires integer operand");
- np = promote(np);
- return node(op, np->type, np, NULL);
-}
-
-static Node *
-numericaluop(int op, Node *np)
-{
- if (!(np->type->prop & TARITH))
- error("unary operator requires numerical operand");
- np = promote(np);
- return node(op, np->type, np, NULL);
-}
-
-Node *
-convert(Node *np, Type *newtp, int iscast)
-{
- Type *oldtp = np->type;
-
- if (eqtype(newtp, oldtp, 0))
- return np;
-
- switch (oldtp->op) {
- case ENUM:
- case INT:
- case FLOAT:
- switch (newtp->op) {
- case PTR:
- if (oldtp->op == FLOAT || !cmpnode(np, 0) && !iscast)
- return NULL;
- case INT:
- case FLOAT:
- case ENUM:
- break;
- default:
- return NULL;
- }
- break;
- case PTR:
- switch (newtp->op) {
- case ENUM:
- case INT:
- case VOID:
- if (!iscast)
- return NULL;
- break;
- case PTR:
- if (eqtype(newtp, oldtp, 1) ||
- iscast ||
- newtp == pvoidtype || oldtp == pvoidtype) {
- np->type = newtp;
- return np;
- }
- default:
- return NULL;
- }
- break;
- default:
- return NULL;
- }
- return node(OCAST, newtp, np, NULL);
-}
-
-static Node *
-parithmetic(int op, Node *lp, Node *rp)
-{
- Type *tp;
- Node *size, *np;
-
- if (lp->type->op != PTR)
- XCHG(lp, rp, np);
-
- tp = rp->type;
- if (tp->op == PTR && !(tp->type->prop & TDEFINED))
- goto incomplete;
- tp = lp->type;
- if (!(tp->type->prop & TDEFINED))
- goto incomplete;
- size = sizeofnode(tp->type);
-
- if (op == OSUB && BTYPE(rp) == PTR) {
- if ((rp = convert(rp, lp->type, 0)) == NULL)
- goto incorrect;
- lp = node(OSUB, pdifftype, lp, rp);
- return node(ODIV, inttype, lp, size);
- }
- if (!(rp->type->prop & TINTEGER))
- goto incorrect;
-
- rp = convert(promote(rp), sizettype, 0);
- rp = node(OMUL, sizettype, rp, size);
- rp = convert(rp, tp, 1);
-
- return node(op, tp, lp, rp);
-
-incomplete:
- errorp("invalid use of undefined type");
- return lp;
-incorrect:
- errorp("incorrect arithmetic operands");
- return lp;
-
-}
-
-static Node *
-arithmetic(int op, Node *lp, Node *rp)
-{
- Type *ltp = lp->type, *rtp = rp->type;
-
- if ((ltp->prop & TARITH) && (rtp->prop & TARITH)) {
- arithconv(&lp, &rp);
- return node(op, lp->type, lp, rp);
- } else if ((ltp->op == PTR || rtp->op == PTR)) {
- switch (op) {
- case OADD:
- case OSUB:
- case OA_ADD:
- case OA_SUB:
- case OINC:
- case ODEC:
- return parithmetic(op, lp, rp);
- }
- }
- errorp("incorrect arithmetic operands");
-}
-
-static Node *
-pcompare(int op, Node *lp, Node *rp)
-{
- Node *np;
-
- if (lp->type->prop & TINTEGER)
- XCHG(lp, rp, np);
- else if (eqtype(lp->type, pvoidtype, 1))
- XCHG(lp, rp, np);
-
- if ((np = convert(rp, lp->type, 0)) != NULL)
- rp = np;
- else
- errorp("incompatible types in comparison");
- return convert(node(op, pvoidtype, lp, rp), inttype, 1);
-}
-
-static Node *
-compare(int op, Node *lp, Node *rp)
-{
- Type *ltp, *rtp;
-
- ltp = lp->type;
- rtp = rp->type;
-
- if (ltp->op == PTR || rtp->op == PTR) {
- return pcompare(op, rp, lp);
- } else if ((ltp->prop & TARITH) && (rtp->prop & TARITH)) {
- arithconv(&lp, &rp);
- return convert(node(op, lp->type, lp, rp), inttype, 1);;
- } else {
- errorp("incompatible types in comparison");
- freetree(lp);
- freetree(rp);
- return constnode(zero);
- }
-}
-
-int
-negop(int op)
-{
- switch (op) {
- case OEQ: return ONE;
- case ONE: return OEQ;
- case OLT: return OGE;
- case OGE: return OLT;
- case OLE: return OGT;
- case OGT: return OLE;
- default: abort();
- }
- return op;
-}
-
-static Node *
-exp2cond(Node *np, int neg)
-{
- if (np->type->prop & TAGGREG) {
- errorp("used struct/union type value where scalar is required");
- return constnode(zero);
- }
- switch (np->op) {
- case ONEG:
- case OOR:
- case OAND:
- return (neg) ? node(ONEG, inttype, np, NULL) : np;
- case OEQ:
- case ONE:
- case OLT:
- case OGE:
- case OLE:
- case OGT:
- if (neg)
- np->op = negop(np->op);
- return np;
- default:
- return compare((neg) ? OEQ : ONE, np, constnode(zero));
- }
-}
-
-static Node *
-logic(int op, Node *lp, Node *rp)
-{
- lp = exp2cond(lp, 0);
- rp = exp2cond(rp, 0);
- return node(op, inttype, lp, rp);
-}
-
-static Node *
-field(Node *np)
-{
- Symbol *sym;
-
- namespace = np->type->ns;
- next();
- namespace = NS_IDEN;
-
- sym = yylval.sym;
- if (yytoken != IDEN)
- unexpected();
- next();
-
- if (!(np->type->prop & TAGGREG)) {
- errorp("request for member '%s' in something not a structure or union",
- yylval.sym->name);
- goto free_np;
- }
- if ((sym->flags & SDECLARED) == 0) {
- errorp("incorrect field in struct/union");
- goto free_np;
- }
- np = node(OFIELD, sym->type, np, varnode(sym));
- np->flags |= NLVAL;
- return np;
-
-free_np:
- freetree(np);
- return constnode(zero);
-}
-
-static Node *
-content(int op, Node *np)
-{
- if (BTYPE(np) != PTR) {
- errorp("invalid argument of memory indirection");
- } else {
- if (np->op == OADDR) {
- Node *new = np->left;
- new->type = np->type->type;
- free(np);
- np = new;
- } else {
- np = node(op, np->type->type, np, NULL);
- }
- np->flags |= NLVAL;
- }
- return np;
-}
-
-static Node *
-array(Node *lp, Node *rp)
-{
- Type *tp;
- Node *np;
-
- if (!(lp->type->prop & TINTEGER) && !(rp->type->prop & TINTEGER))
- error("array subscript is not an integer");
- np = arithmetic(OADD, lp, rp);
- tp = np->type;
- if (tp->op != PTR)
- errorp("subscripted value is neither array nor pointer");
- return content(OPTR, np);
-}
-
-static Node *
-assignop(int op, Node *lp, Node *rp)
-{
- if ((rp = convert(rp, lp->type, 0)) == NULL) {
- errorp("incompatible types when assigning");
- return lp;
- }
-
- return node(op, lp->type, lp, rp);
-}
-
-static Node *
-incdec(Node *np, int op)
-{
- Type *tp = np->type;
- Node *inc;
-
- chklvalue(np);
- np->flags |= NEFFECT;
-
- if (!(tp->prop & TDEFINED)) {
- errorp("invalid use of undefined type");
- return np;
- } else if (tp->op == PTR && !(tp->type->prop & TDEFINED)) {
- errorp("%s of pointer to an incomplete type",
- (op == OINC || op == OA_ADD) ? "increment" : "decrement");
- return np;
- } else if (tp->op == PTR || (tp->prop & TARITH)) {
- inc = constnode(one);
- } else {
- errorp("wrong type argument to increment or decrement");
- return np;
- }
- return arithmetic(op, np, inc);
-}
-
-static Node *
-address(int op, Node *np)
-{
- Node *new;
-
- /*
- * ansi c accepts & applied to a function name, and it generates
- * a function pointer
- */
- if (np->op == OSYM) {
- if (np->type->op == FTN)
- return decay(np);
- if (np->type->op == ARY)
- goto dont_check_lvalue;
- }
- chklvalue(np);
-
-dont_check_lvalue:
- if (np->sym && (np->sym->flags & SREGISTER))
- errorp("address of register variable '%s' requested", yytext);
- new = node(op, mktype(np->type, PTR, 0, NULL), np, NULL);
- if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
- new->flags |= NCONST;
- return new;
-}
-
-static Node *
-negation(int op, Node *np)
-{
- if (!(np->type->prop & TARITH) && np->type->op != PTR) {
- errorp("invalid argument of unary '!'");
- return constnode(zero);
- }
- return exp2cond(np, 1);
-}
-
-static Symbol *
-notdefined(Symbol *sym)
-{
- int isdef;
-
- if (namespace == NS_CPP && !strcmp(sym->name, "defined")) {
- disexpand = 1;
- next();
- expect('(');
- sym = yylval.sym;
- expect(IDEN);
- expect(')');
-
- isdef = (sym->flags & SDECLARED) != 0;
- sym = newsym(NS_IDEN, NULL);
- sym->type = inttype;
- sym->flags |= SCONSTANT;
- sym->u.i = isdef;
- disexpand = 0;
- return sym;
- }
- errorp("'%s' undeclared", yytext);
- sym->type = inttype;
- return install(sym->ns, yylval.sym);
-}
-
-static Symbol *
-adjstrings(Symbol *sym)
-{
- char *s, *t;
- size_t len, n;
- Type *tp;
-
- tp = sym->type;
- s = sym->u.s;
- for (len = strlen(s);; len += n) {
- next();
- if (yytoken != STRING)
- break;
- t = yylval.sym->u.s;
- n = strlen(t);
- s = xrealloc(s, len + n + 1);
- memcpy(s+len, t, n);
- s[len + n] = '\0';
- killsym(yylval.sym);
- }
- ++len;
- if (tp->n.elem != len) {
- sym->type = mktype(chartype, ARY, len, NULL);
- sym->u.s = s;
- }
- return sym;
-}
-
-/*************************************************************
- * grammar functions *
- *************************************************************/
-static Node *
-primary(void)
-{
- Node *np;
- Symbol *sym;
- Node *(*fun)(Symbol *);
-
- sym = yylval.sym;
- switch (yytoken) {
- case STRING:
- np = constnode(adjstrings(sym));
- sym->flags |= SHASINIT;
- emit(ODECL, sym);
- emit(OINIT, np);
- return varnode(sym);
- case BUILTIN:
- fun = sym->u.fun;
- next();
- expect('(');
- np = (*fun)(sym);
- expect(')');
-
- /* do not call to next */
- return np;
- case CONSTANT:
- np = constnode(sym);
- break;
- case IDEN:
- assert((sym->flags & SCONSTANT) == 0);
- if ((sym->flags & SDECLARED) == 0) {
- if (namespace == NS_CPP) {
- np = constnode(zero);
- break;
- }
- sym = notdefined(sym);
- }
- sym->flags |= SUSED;
- np = varnode(sym);
- break;
- default:
- unexpected();
- }
- next();
-
- return np;
-}
-
-static Node *
-arguments(Node *np)
-{
- int toomany, n, op;
- Node *par = NULL, *arg;
- Type *argtype, **targs, *tp = np->type, *rettype;
-
- if (tp->op == PTR && tp->type->op == FTN) {
- np = content(OPTR, np);
- tp = np->type;
- }
- if (tp->op != FTN) {
- targs = (Type *[]) {ellipsistype};
- n = 1;
- rettype = inttype;
- errorp("function or function pointer expected");
- } else {
- targs = tp->p.pars;
- n = tp->n.elem;
- rettype = tp->type;
- }
-
- expect('(');
- if (yytoken == ')')
- goto no_pars;
- toomany = 0;
-
- do {
- arg = xassign();
- argtype = *targs;
- if (argtype == ellipsistype) {
- n = 0;
- switch (arg->type->op) {
- case INT:
- arg = promote(arg);
- break;
- case FLOAT:
- if (arg->type == floattype)
- arg = convert(arg, doubletype, 1);
- break;
- }
- par = node(OPAR, arg->type, par, arg);
- continue;
- }
- if (--n < 0) {
- if (!toomany)
- errorp("too many arguments in function call");
- toomany = 1;
- continue;
- }
- ++targs;
- if ((arg = convert(arg, argtype, 0)) != NULL) {
- par = node(OPAR, arg->type, par, arg);
- continue;
- }
- errorp("incompatible type for argument %d in function call",
- tp->n.elem - n + 1);
- } while (accept(','));
-
-no_pars:
- expect(')');
- if (n > 0 && *targs != ellipsistype)
- errorp("too few arguments in function call");
-
- op = (tp->prop&TELLIPSIS) ? OCALLE : OCALL;
- return node(op, rettype, np, par);
-}
-
-static Node *unary(int);
-
-static Type *
-typeof(Node *np)
-{
- Type *tp;
-
- if (np == NULL)
- unexpected();
- tp = np->type;
- freetree(np);
- return tp;
-}
-
-static Type *
-sizeexp(void)
-{
- Type *tp;
-
- expect('(');
- switch (yytoken) {
- case TYPE:
- case TYPEIDEN:
- tp = typename();
- break;
- default:
- tp = typeof(unary(0));
- break;
- }
- expect(')');
- return tp;
-}
-
-static Node *
-postfix(Node *lp)
-{
- Node *rp;
-
- for (;;) {
- switch (yytoken) {
- case '[':
- case DEC:
- case INC:
- case INDIR:
- case '.':
- case '(':
- lp = decay(lp);
- switch (yytoken) {
- case '[':
- next();
- rp = xexpr();
- expect(']');
- lp = array(lp, rp);
- break;
- case DEC:
- case INC:
- lp = incdec(lp, (yytoken == INC) ? OINC : ODEC);
- next();
- break;
- case INDIR:
- lp = content(OPTR, lp);
- case '.':
- lp = field(lp);
- break;
- case '(':
- lp = arguments(lp);
- lp->flags |= NEFFECT;
- break;
- }
- break;
- default:
- return lp;
- }
- }
-}
-
-static Node *
-defined(void)
-{
- Symbol *sym;
- int paren;
-
- disexpand = 1;
- next();
- paren = accept('(');
- if (yytoken != IDEN && yytoken != TYPEIDEN)
- cpperror("operator 'defined' requires an identifier");
- if (yytoken == TYPEIDEN || !(yylval.sym->flags & SDECLARED))
- sym = zero;
- else
- sym = one;
- disexpand = 0;
- next();
- if (paren)
- expect(')');
- return constnode(sym);
-}
-
-static Node *cast(int);
-
-static Node *
-unary(int needdecay)
-{
- Node *(*fun)(int, Node *), *np;
- int op;
- Type *tp;
-
- switch (yytoken) {
- case '!': op = 0; fun = negation; break;
- case '+': op = OADD; fun = numericaluop; break;
- case '-': op = OSNEG; fun = numericaluop; break;
- case '~': op = OCPL; fun = integeruop; break;
- case '&': op = OADDR; fun = address; break;
- case '*': op = OPTR; fun = content; break;
- case SIZEOF:
- next();
- tp = (yytoken == '(') ? sizeexp() : typeof(unary(0));
- if (!(tp->prop & TDEFINED))
- errorp("sizeof applied to an incomplete type");
- return sizeofnode(tp);
- case INC:
- case DEC:
- op = (yytoken == INC) ? OA_ADD : OA_SUB;
- next();
- np = incdec(unary(1), op);
- goto chk_decay;
- case IDEN:
- case TYPEIDEN:
- if (lexmode == CPPMODE && !strcmp(yylval.sym->name, "defined"))
- return defined();
- default:
- np = postfix(primary());
- goto chk_decay;
- }
-
- next();
- np = (*fun)(op, cast(op != OADDR));
-
-chk_decay:
- if (needdecay)
- np = decay(np);
- return np;
-}
-
-static Node *
-cast(int needdecay)
-{
- Node *lp, *rp;
- Type *tp;
- static int nested;
-
- if (!accept('('))
- return unary(needdecay);
-
- switch (yytoken) {
- case TQUALIFIER:
- case TYPE:
- case TYPEIDEN:
- tp = typename();
- expect(')');
-
- if (yytoken == '{')
- return initlist(tp);
-
- switch (tp->op) {
- case ARY:
- error("cast specifies an array type");
- default:
- lp = cast(needdecay);
- if ((rp = convert(lp, tp, 1)) == NULL)
- error("bad type conversion requested");
- rp->flags &= ~NLVAL;
- rp->flags |= lp->flags & NLVAL;
- }
- break;
- default:
- if (nested == NR_SUBEXPR)
- error("too many expressions nested by parentheses");
- ++nested;
- rp = xexpr();
- --nested;
- expect(')');
- rp = postfix(rp);
- break;
- }
-
- return rp;
-}
-
-static Node *
-mul(void)
-{
- Node *np, *(*fun)(int, Node *, Node *);
- int op;
-
- np = cast(1);
- for (;;) {
- switch (yytoken) {
- case '*': op = OMUL; fun = arithmetic; break;
- case '/': op = ODIV; fun = arithmetic; break;
- case '%': op = OMOD; fun = integerop; break;
- default: return np;
- }
- next();
- np = (*fun)(op, np, cast(1));
- }
-}
-
-static Node *
-add(void)
-{
- int op;
- Node *np;
-
- np = mul();
- for (;;) {
- switch (yytoken) {
- case '+': op = OADD; break;
- case '-': op = OSUB; break;
- default: return np;
- }
- next();
- np = arithmetic(op, np, mul());
- }
-}
-
-static Node *
-shift(void)
-{
- int op;
- Node *np;
-
- np = add();
- for (;;) {
- switch (yytoken) {
- case SHL: op = OSHL; break;
- case SHR: op = OSHR; break;
- default: return np;
- }
- next();
- np = integerop(op, np, add());
- }
-}
-
-static Node *
-relational(void)
-{
- int op;
- Node *np;
-
- np = shift();
- for (;;) {
- switch (yytoken) {
- case '<': op = OLT; break;
- case '>': op = OGT; break;
- case GE: op = OGE; break;
- case LE: op = OLE; break;
- default: return np;
- }
- next();
- np = compare(op, np, shift());
- }
-}
-
-static Node *
-eq(void)
-{
- int op;
- Node *np;
-
- np = relational();
- for (;;) {
- switch (yytoken) {
- case EQ: op = OEQ; break;
- case NE: op = ONE; break;
- default: return np;
- }
- next();
- np = compare(op, np, relational());
- }
-}
-
-static Node *
-bit_and(void)
-{
- Node *np;
-
- np = eq();
- while (accept('&'))
- np = integerop(OBAND, np, eq());
- return np;
-}
-
-static Node *
-bit_xor(void)
-{
- Node *np;
-
- np = bit_and();
- while (accept('^'))
- np = integerop(OBXOR, np, bit_and());
- return np;
-}
-
-static Node *
-bit_or(void)
-{
- Node *np;
-
- np = bit_xor();
- while (accept('|'))
- np = integerop(OBOR, np, bit_xor());
- return np;
-}
-
-static Node *
-and(void)
-{
- Node *np;
-
- np = bit_or();
- while (accept(AND))
- np = logic(OAND, np, bit_or());
- return np;
-}
-
-static Node *
-or(void)
-{
- Node *np;
-
- np = and();
- while (accept(OR))
- np = logic(OOR, np, and());
- return np;
-}
-
-static Node *
-ternary(void)
-{
- Node *cond;
-
- cond = or();
- while (accept('?')) {
- Node *ifyes, *ifno, *np;
-
- cond = exp2cond(cond, 0);
- ifyes = xexpr();
- expect(':');
- ifno = ternary();
- np = chkternary(ifyes, ifno);
- cond = node(OASK, np->type, cond, np);
- }
- return cond;
-}
-
-static Node *
-xassign(void)
-{
- Node *np, *(*fun)(int , Node *, Node *);
- int op;
-
- np = ternary();
- for (;;) {
- switch (yytoken) {
- case '=': op = OASSIGN; fun = assignop; break;
- case MUL_EQ: op = OA_MUL; fun = arithmetic; break;
- case DIV_EQ: op = OA_DIV; fun = arithmetic; break;
- case MOD_EQ: op = OA_MOD; fun = integerop; break;
- case ADD_EQ: op = OA_ADD; fun = arithmetic; break;
- case SUB_EQ: op = OA_SUB; fun = arithmetic; break;
- case SHL_EQ: op = OA_SHL; fun = integerop; break;
- case SHR_EQ: op = OA_SHR; fun = integerop; break;
- case AND_EQ: op = OA_AND; fun = integerop; break;
- case XOR_EQ: op = OA_XOR; fun = integerop; break;
- case OR_EQ: op = OA_OR; fun = integerop; break;
- default: return np;
- }
- chklvalue(np);
- np->flags |= NEFFECT;
- next();
- np = (fun)(op, np, assign());
- }
-}
-
-static Node *
-xexpr(void)
-{
- Node *lp, *rp;
-
- lp = xassign();
- while (accept(',')) {
- rp = xassign();
- lp = node(OCOMMA, rp->type, lp, rp);
- }
- return lp;
-}
-
-Node *
-assign(void)
-{
- return simplify(xassign());
-}
-
-Node *
-constexpr(void)
-{
- Node *np;
-
- np = ternary();
- if (np && np->type->op == INT) {
- np = simplify(convert(np, inttype, 0));
- if (np->flags & NCONST)
- return np;
- }
- freetree(np);
- return NULL;
-}
-
-Node *
-expr(void)
-{
- return simplify(xexpr());
-}
-
-Node *
-condexpr(int neg)
-{
- Node *np;
-
- np = exp2cond(xexpr(), neg);
- if (np->flags & NCONST)
- warn("conditional expression is constant");
- return simplify(np);
-}
--- a/cc1/fold.c
+++ /dev/null
@@ -1,685 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/fold.c";
-#include <assert.h>
-#include <stdlib.h>
-
-#include "../inc/scc.h"
-#include "cc1.h"
-
-
-TUINT
-ones(int nbytes)
-{
- return (nbytes == 8) ? -1 : ~(-1ull << nbytes * 8);
-}
-
-static int
-addi(TINT l, TINT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
- TINT max = lim->max.i, min = -lim->min.i;
-
- if (l < 0 && r < 0 && l >= min - r ||
- l == 0 ||
- r == 0 ||
- l < 0 && r > 0 ||
- l > 0 && r < 0 ||
- l > 0 && r > 0 && l <= max - r) {
- return 1;
- }
- warn("overflow in constant expression");
- return 0;
-}
-
-static int
-addf(TFLOAT l, TFLOAT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
- TFLOAT max = lim->max.f, min = lim->min.f;
-
- if (l < 0 && r < 0 && l >= min - r ||
- l == 0 ||
- r == 0 ||
- l < 0 && r > 0 ||
- l > 0 && r < 0 ||
- l > 0 && r > 0 && l <= max - r) {
- return 1;
- }
- warn("overflow in constant expression");
- return 0;
-}
-
-static int
-subi(TINT l, TINT r, Type *tp)
-{
- return addi(l, -r, tp);
-}
-
-static int
-subf(TFLOAT l, TFLOAT r, Type *tp)
-{
- return addf(l, -r, tp);
-}
-
-static int
-muli(TINT l, TINT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
- TINT max = lim->max.i, min = -lim->min.i;
-
- if (l > -1 && l <= 1 ||
- r > -1 && r <= 1 ||
- l < 0 && r < 0 && -l <= max/-r ||
- l < 0 && r > 0 && l >= min/r ||
- l > 0 && r < 0 && r >= min/l ||
- l > 0 && r > 0 && l <= max/r) {
- return 1;
- }
- warn("overflow in constant expression");
- return 0;
-}
-
-static int
-mulf(TFLOAT l, TFLOAT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
- TFLOAT max = lim->max.f, min = lim->min.f;
-
- if (l > -1 && l <= 1 ||
- r > -1 && r <= 1 ||
- l < 0 && r < 0 && -l <= max/-r ||
- l < 0 && r > 0 && l >= min/r ||
- l > 0 && r < 0 && r >= min/l ||
- l > 0 && r > 0 && l <= max/r) {
- return 1;
- }
- warn("overflow in constant expression");
- return 0;
-}
-
-static int
-divi(TINT l, TINT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
-
- if (r == 0 || l == -lim->min.i && r == -1) {
- warn("overflow in constant expression");
- return 0;
- }
- return 1;
-}
-
-static int
-divf(TFLOAT l, TFLOAT r, Type *tp)
-{
- struct limits *lim = getlimits(tp);
-
- if (l < 0) l = -l;
- if (r < 0) r = -r;
-
- if (r == 0.0 || r < 1.0 && l > lim->max.f * r) {
- warn("overflow in constant expression");
- return 0;
- }
- return 1;
-}
-
-static int
-lshi(TINT l, TINT r, Type *tp)
-{
- if (r < 0 || r >= tp->size * 8) {
- warn("shifting %d bits is undefined", r);
- return 0;
- }
- return muli(l, 1 << r, tp);
-}
-
-static int
-rshi(TINT l, TINT r, Type *tp)
-{
- if (r < 0 || r >= tp->size * 8) {
- warn("shifting %d bits is undefined", r);
- return 0;
- }
- return 1;
-}
-
-static int
-foldint(int op, Symbol *res, TINT l, TINT r)
-{
- TINT i;
- Type *tp = res->type;
- int (*validate)(TINT, TINT, Type *tp);
-
- switch (op) {
- case OADD: validate = addi; break;
- case OSUB: validate = subi; break;
- case OMUL: validate = muli; break;
- case ODIV: validate = divi; break;
- case OSHL: validate = lshi; break;
- case OSHR: validate = rshi; break;
- case OMOD: validate = divi; break;
- default: validate = NULL; break;
- }
-
- if (validate && !(*validate)(l, r, tp))
- return 0;
-
- switch (op) {
- case OADD: i = l + r; break;
- case OSUB: i = l - r; break;
- case OMUL: i = l * r; break;
- case ODIV: i = l / r; break;
- case OMOD: i = l % r; break;
- case OSHL: i = l << r; break;
- case OSHR: i = l >> r; break;
- case OBAND: i = l & r; break;
- case OBXOR: i = l ^ r; break;
- case OBOR: i = l | r; break;
- case OAND: i = l && r; break;
- case OOR: i = l || r; break;
- case OLT: i = l < r; break;
- case OGT: i = l > r; break;
- case OGE: i = l >= r; break;
- case OLE: i = l <= r; break;
- case OEQ: i = l == r; break;
- case ONE: i = l != r; break;
- case ONEG: i = !l; break;
- case OSNEG: i = -l; break;
- case OCPL: i = ~l; break;
- default: return 0;
- }
- res->u.i = i;
-
- DBG("FOLD i l=%lld %d r=%lld = %lld", l, op, r, i);
- return 1;
-}
-
-static int
-folduint(int op, Symbol *res, TUINT l, TUINT r)
-{
- TINT i;
- TUINT u;
-
- switch (op) {
- case OADD: u = l + r; break;
- case OSUB: u = l - r; break;
- case OMUL: u = l * r; break;
- case ODIV: u = l / r; break;
- case OMOD: u = l % r; break;
- case OSHL: u = l << r; break;
- case OSHR: u = l >> r; break;
- case OBAND: u = l & r; break;
- case OBXOR: u = l ^ r; break;
- case OBOR: u = l | r; break;
- case ONEG: u = !l; break;
- case OSNEG: u = -l; break;
- case OCPL: u = ~l; break;
- case OAND: i = l && r; goto sign;
- case OOR: i = l || r; goto sign;
- case OLT: i = l < r; goto sign;
- case OGT: i = l > r; goto sign;
- case OGE: i = l >= r; goto sign;
- case OLE: i = l <= r; goto sign;
- case OEQ: i = l == r; goto sign;
- case ONE: i = l != r; goto sign;
- default: return 0;
- }
- res->u.u = u & ones(res->type->size);
-
- DBG("FOLD ui l=%llu %d r=%llu = %llu", l, op, r, u);
- return 1;
-
-sign:
- res->u.i = i;
-
- DBG("FOLD sui %llu %d %llu = %llu", l, op, r, i);
- return 1;
-}
-
-static int
-foldfloat(int op, Symbol *res, TFLOAT l, TFLOAT r)
-{
- TFLOAT f;
- TINT i;
- int (*validate)(TFLOAT, TFLOAT, Type *tp);
-
- switch (op) {
- case OADD: validate = addf; break;
- case OSUB: validate = subf; break;
- case OMUL: validate = mulf; break;
- case ODIV: validate = divf; break;
- default: validate = NULL; break;
- }
-
- if (validate && !(*validate)(l, r, res->type))
- return 0;
-
- switch (op) {
- case OADD: f = l + r; break;
- case OSUB: f = l - r; break;
- case OMUL: f = l * r; break;
- case ODIV: f = l / r; break;
- case OLT: i = l < r; goto comparison;
- case OGT: i = l > r; goto comparison;
- case OGE: i = l >= r; goto comparison;
- case OLE: i = l <= r; goto comparison;
- case OEQ: i = l == r; goto comparison;
- case ONE: i = l != r; goto comparison;
- default: return 0;
- }
- res->u.f = f;
-
- DBG("FOLD f l=%lf %d r=%lf = %lf", l, op, r, f);
- return 1;
-
-comparison:
- res->u.i = i;
-
- DBG("FOLD if l=%lf %d r=%lf = %lld", l, op, r, i);
- return 1;
-}
-
-static Node *
-foldconst(int type, int op, Type *tp, Symbol *ls, Symbol *rs)
-{
- Symbol *sym, aux;
- TINT i;
- TUINT u;
- TFLOAT f;
-
- aux.type = tp;
- switch (type) {
- case INT:
- i = (rs) ? rs->u.i : 0;
- if (!foldint(op, &aux, ls->u.i, i))
- return NULL;
- break;
- case UNSIGNED:
- u = (rs) ? rs->u.u : 0u;
- if (!folduint(op, &aux, ls->u.u, u))
- return NULL;
- break;
- case FLOAT:
- f = (rs) ? rs->u.f : 0.0;
- if (!foldfloat(op, &aux, ls->u.f, f))
- return NULL;
- break;
- }
- sym = newsym(NS_IDEN, NULL);
- sym->flags |= SCONSTANT;
- sym->type = tp;
- sym->u = aux.u;
- return constnode(sym);
-}
-
-static Node *
-foldcast(Node *np, Node *l)
-{
- TUINT negmask, mask, u;
- Type *newtp = np->type, *oldtp = l->type;
- Symbol aux, *sym, *osym = l->sym;
-
- if (!(l->flags & NCONST))
- return np;
-
- switch (newtp->op) {
- case PTR:
- case INT:
- case ENUM:
- switch (oldtp->op) {
- case PTR:
- case INT:
- case ENUM:
- u = (oldtp->prop & TSIGNED) ? osym->u.i : osym->u.u;
- break;
- case FLOAT:
- oldtp = newtp;
- u = osym->u.f;
- break;
- default:
- return np;
- }
- mask = ones(newtp->size);
- if (newtp->prop & TSIGNED) {
- negmask = ~mask;
- if (u & (negmask >> 1) & mask)
- u |= negmask;
- aux.u.i = u;
- } else {
- aux.u.u = u & mask;
- }
- break;
- case FLOAT:
- /* FIXME: The cast can be from another float type */
- aux.u.f = (oldtp->prop & TSIGNED) ? osym->u.i : osym->u.u;
- break;
- default:
- return np;
- }
- DBG("FOLD cast %c->%c", oldtp->letter, newtp->letter);
- freetree(np);
- sym = newsym(NS_IDEN, NULL);
- sym->flags |= SCONSTANT;
- sym->type = newtp;
- sym->u = aux.u;
- return constnode(sym);
-}
-
-static Node *
-foldunary(Node *np, Node *l)
-{
- int op = l->op;
- Node *aux;
-
- switch (np->op) {
- case ONEG:
- if (l->op == ONEG)
- break;
- return NULL;
- case OADD:
- DBG("FOLD unary delete %d", np->op);
- np->left = NULL;
- freetree(np);
- return l;
- case OCAST:
- if (op != OCAST)
- return foldcast(np, l);
- /* TODO: This is wrong: (float)(int) 7.2 */
- DBG("FOLD unary collapse %d", np->op);
- np->left = l->left;
- l->left = NULL;
- freetree(l);
- return np;
- case OSNEG:
- case OCPL:
- if (op != np->op)
- return NULL;
- break;
- case OPTR:
- if (op != OADDR || np->type != l->left->type)
- return NULL;
- break;
- case OADDR:
- if (op != OPTR)
- return NULL;
- break;
- default:
- return NULL;
- }
- DBG("FOLD unary cancel %d", np->op);
- aux = l->left;
- l->left = NULL;
- freetree(np);
- return aux;
-}
-
-static Node *
-fold(Node *np)
-{
- Symbol *rs, *ls;
- Type *optype;
- int type;
- int op = np->op;
- Node *p, *lp = np->left, *rp = np->right;
- Type *tp = np->type;
-
- assert(lp && rp);
- if ((op == ODIV || op == OMOD) && cmpnode(rp, 0)) {
- warn("division by 0");
- return NULL;
- }
- /*
- * Return if any of the children is no constant,
- * or it is a constant generated when
- * the address of a static variable is taken
- * (when we don't know the physical address so
- * we cannot fold it)
- */
- if (!rp) {
- rs = NULL;
- } else {
- if (!(rp->flags & NCONST) || !rp->sym)
- return NULL;
- rs = rp->sym;
- }
-
- if (!(lp->flags & NCONST) || !lp->sym)
- return NULL;
- optype = lp->type;
- ls = lp->sym;
-
- switch (type = optype->op) {
- case ENUM:
- case INT:
- if (!(optype->prop & TSIGNED))
- type = UNSIGNED;
- case PTR:
- case FLOAT:
- if ((p = foldconst(type, op, tp, ls, rs)) == NULL)
- return NULL;
- freetree(np);
- return p;
- default:
- return NULL;
- }
-}
-
-static void
-commutative(Node *np, Node *l, Node *r)
-{
- int op = np->op;
-
- if (r == NULL || r->flags&NCONST || !(l->flags&NCONST))
- return;
-
- switch (op) {
- case OLT:
- case OGT:
- case OGE:
- case OLE:
- DBG("FOLD neg commutative %d", np->op);
- np->op = negop(op);
- case OEQ:
- case ONE:
- case OADD:
- case OMUL:
- case OBAND:
- case OBXOR:
- case OBOR:
- DBG("FOLD commutative %d", np->op);
- np->left = r;
- np->right = l;
- break;
- }
-}
-
-static Node *
-identity(Node *np)
-{
- int iszeror, isoner;
- int iszerol, isonel;
- Node *lp = np->left, *rp = np->right;
-
- if (!rp)
- return NULL;
-
- iszeror = cmpnode(rp, 0);
- isoner = cmpnode(rp, 1),
- iszerol = cmpnode(lp, 0);
- isonel = cmpnode(lp, 1);
-
- switch (np->op) {
- case OOR:
- /*
- * 1 || i => 1 (free right)
- * i || 0 => i (free right)
- * 0 || i => i (free left)
- * i || 1 => i,1 (comma)
- */
- if (isonel | iszeror)
- goto free_right;
- if (iszerol)
- goto free_left;
- if (isoner)
- goto change_to_comma;
- return NULL;
- case OAND:
- /*
- * 0 && i => 0 (free right)
- * i && 1 => i (free right)
- * 1 && i => i (free left)
- * i && 0 => i,0 (comma)
- */
- if (iszerol | isoner)
- goto free_right;
- if (isonel)
- goto free_left;
- if (iszeror)
- goto change_to_comma;
- return NULL;
- case OSHL:
- case OSHR:
- /*
- * i >> 0 => i (free right)
- * i << 0 => i (free right)
- * 0 >> i => 0 (free right)
- * 0 << i => 0 (free right)
- */
- if (iszeror | iszerol)
- goto free_right;
- return NULL;
- case OBXOR:
- case OADD:
- case OBOR:
- case OSUB:
- /*
- * i + 0 => i
- * i - 0 => i
- * i | 0 => i
- * i ^ 0 => i
- */
- if (iszeror)
- goto free_right;
- return NULL;
- case OMUL:
- /*
- * i * 0 => i,0
- * i * 1 => i
- */
- if (iszeror)
- goto change_to_comma;
- if (isoner)
- goto free_right;
- return NULL;
- case ODIV:
- /* i / 1 => i */
- if (isoner)
- goto free_right;
- return NULL;
- case OBAND:
- /* i & ~0 => i */
- if (cmpnode(rp, -1))
- goto free_right;
- return NULL;
- case OMOD:
- /* i % 1 => i,1 */
- /* TODO: i % 2^n => i & n-1 */
- if (isoner)
- goto change_to_comma;
- default:
- return NULL;
- }
-
-free_right:
- DBG("FOLD identity %d", np->op);
- np->left = NULL;
- freetree(np);
- return lp;
-
-free_left:
- DBG("FOLD identity %d", np->op);
- np->right = NULL;
- freetree(np);
- return rp;
-
-change_to_comma:
- DBG("FOLD identity %d", np->op);
- np->op = OCOMMA;
- return np;
-}
-
-static Node *
-foldternary(Node *np, Node *cond, Node *body)
-{
- if (!(cond->flags & NCONST))
- return np;
- if (cmpnode(cond, 0)) {
- np = body->right;
- freetree(body->left);
- } else {
- np = body->left;
- freetree(body->right);
- }
-
- DBG("FOLD ternary");
- body->left = NULL;
- body->right = NULL;
- freetree(cond);
- free(body);
- return np;
-}
-
-/* TODO: fold OCOMMA */
-
-Node *
-simplify(Node *np)
-{
- Node *p, *l, *r;
-
- if (!np)
- return NULL;
- if (debug)
- prtree(np);
-
- l = np->left = simplify(np->left);
- r = np->right = simplify(np->right);
-
- switch (np->op) {
- case OASK:
- return foldternary(np, l, r);
- case OCALL:
- case OPAR:
- case OSYM:
- case OASSIGN:
- case OA_MUL:
- case OA_DIV:
- case OA_MOD:
- case OA_ADD:
- case OA_SUB:
- case OA_SHL:
- case OA_SHR:
- case OA_AND:
- case OA_XOR:
- case OA_OR:
- return np;
- case OSNEG:
- case OCPL:
- case OADDR:
- case OPTR:
- case INC:
- case DEC:
- case OCAST:
- case ONEG:
- assert(!r);
- if ((p = foldunary(np, l)) != NULL)
- return p;
- return np;
- default:
- commutative(np, l, r);
- if ((p = fold(np)) != NULL)
- return p;
- if ((p = identity(np)) != NULL)
- return p;
- return np;
- }
-}
--- a/cc1/init.c
+++ /dev/null
@@ -1,378 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/init.c";
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-
-typedef struct init Init;
-
-struct designator {
- TINT pos;
- Node *expr;
- struct designator *next;
-};
-
-struct init {
- TUINT pos;
- TUINT max;
- struct designator *tail;
- struct designator *head;
-};
-
-static TINT
-arydesig(Type *tp, Init *ip)
-{
- TINT npos;
- Node *np;
-
- if (tp->op != ARY)
- errorp("array index in non-array initializer");
- next();
- np = constexpr();
- npos = np->sym->u.i;
- if (npos < 0 || (tp->prop & TDEFINED) && npos >= tp->n.elem) {
- errorp("array index in initializer exceeds array bounds");
- npos = 0;
- }
- freetree(np);
- expect(']');
- return npos;
-}
-
-static TINT
-fielddesig(Type *tp, Init *ip)
-{
- int ons;
- Symbol *sym, **p;
-
- if (!(tp->prop & TAGGREG))
- errorp("field name not in record or union initializer");
- ons = namespace;
- namespace = tp->ns;
- next();
- namespace = ons;
- if (yytoken != IDEN)
- unexpected();
- sym = yylval.sym;
- next();
- if ((sym->flags & SDECLARED) == 0) {
- errorp("unknown field '%s' specified in initializer",
- sym->name);
- return 0;
- }
- for (p = tp->p.fields; *p != sym; ++p)
- ;
- return p - tp->p.fields;
-}
-
-static Init *
-init(Init *ip)
-{
- ip->tail = ip->head = NULL;
- ip->pos = ip->max = 0;
- return ip;
-}
-
-static Node *
-str2ary(Type *tp)
-{
- Node *np;
- Type *btp = tp->type;;
- Symbol *sym;
- size_t len;
- char *s;
-
- np = assign();
- sym = np->left->sym;
- if (btp != chartype && btp != uchartype && btp != schartype) {
- errorp("array of inappropriate type initialized from string constant");
- return constnode(zero);
- }
-
- len = sym->type->n.elem-1;
- if (!(tp->prop & TDEFINED)) {
- tp->n.elem = len+1;
- deftype(tp);
- } else if (tp->n.elem < len) {
- warn("initializer-string for array of chars is too long");
- }
-
- len = tp->n.elem;
- s = sym->u.s;
- sym = newstring(NULL, len);
- strncpy(sym->u.s, s, len);
- np->sym = sym;
- np->type = sym->type;
-
- return np;
-}
-
-static Node *
-initialize(Type *tp)
-{
- Node *np;
- Symbol *sym;
-
- if (tp->op == ARY && yytoken == STRING)
- return str2ary(tp);
-
- if (yytoken == '{' || tp->op == STRUCT || tp->op == ARY)
- return initlist(tp);
-
- np = assign();
- if (eqtype(tp, np->type, 1))
- return np;
-
- np = convert(decay(np), tp, 0);
- if (!np) {
- errorp("incorrect initializer");
- return constnode(zero);
- }
-
- return simplify(np);
-}
-
-static Node *
-mkcompound(Init *ip, Type *tp)
-{
- Node **v, **p;
- size_t n;
- struct designator *dp, *next;
- Symbol *sym;
-
- if (tp->op == UNION) {
- Node *np = NULL;
-
- v = xmalloc(sizeof(*v));
- for (dp = ip->head; dp; dp = next) {
- freetree(np);
- np = dp->expr;
- next = dp->next;
- free(dp);
- }
- *v = np;
- } else {
- n = (tp->prop&TDEFINED) ? tp->n.elem : ip->max;
- if (n == 0) {
- v = NULL;
- } else if (n > SIZE_MAX / sizeof(*v)) {
- errorp("compound literal too big");
- return constnode(zero);
- } else {
- n *= sizeof(*v);
- v = memset(xmalloc(n), 0, n);
-
- for (dp = ip->head; dp; dp = next) {
- p = &v[dp->pos];
- freetree(*p);
- *p = dp->expr;
- next = dp->next;
- free(dp);
- }
- }
- }
-
- sym = newsym(NS_IDEN, NULL);
- sym->u.init = v;
- sym->type = tp;
- sym->flags |= SINITLST;
-
- return constnode(sym);
-}
-
-static void
-newdesig(Init *ip, Node *np)
-{
- struct designator *dp;
-
- dp = xmalloc(sizeof(*dp));
- dp->pos = ip->pos;
- dp->expr = np;
- dp->next = NULL;
-
- if (ip->head == NULL) {
- ip->head = ip->tail = dp;
- } else {
- ip->tail->next = dp;
- ip->tail = dp;
- }
-
- if (ip->pos+1 > ip->max)
- ip->max = ip->pos+1;
-}
-
-Node *
-initlist(Type *tp)
-{
- Init in;
- Node *np;
- Type *curtp;
- int braces, scalar, toomany, outbound;
- TINT nelem = tp->n.elem;
- static int depth;
-
- if (depth == NR_SUBTYPE)
- error("too many nested initializers");
- ++depth;
- init(&in);
- braces = scalar = toomany = 0;
-
- if (accept('{'))
- braces = 1;
-
- do {
- curtp = inttype;
- switch (yytoken) {
- case '[':
- in.pos = arydesig(tp, &in);
- curtp = tp->type;
- goto desig_list;
- case '.':
- in.pos = fielddesig(tp, &in);
- if (in.pos < nelem)
- curtp = tp->p.fields[in.pos]->type;
- desig_list:
- if (yytoken == '[' || yytoken == '.') {
- np = initlist(curtp);
- goto new_desig;
- }
- expect('=');
- default:
- outbound = 0;
-
- switch (tp->op) {
- case ARY:
- curtp = tp->type;
- if (!(tp->prop & TDEFINED) || in.pos < tp->n.elem)
- break;
- if (!toomany)
- warn("excess elements in array initializer");
- toomany = 1;
- outbound = 1;
- break;
- case UNION:
- case STRUCT:
- if (in.pos < nelem) {
- curtp = tp->p.fields[in.pos]->type;
- break;
- }
- if (!toomany)
- warn("excess elements in struct initializer");
- toomany = 1;
- outbound = 1;
- break;
- default:
- curtp = tp;
- if (!scalar)
- warn("braces around scalar initializer");
- scalar = 1;
- if (in.pos == 0)
- break;
- if (!toomany)
- warn("excess elements in scalar initializer");
- toomany = 1;
- outbound = 1;
- break;
- }
- np = initialize(curtp);
- if (outbound) {
- freetree(np);
- np = NULL;
- }
- }
-
-new_desig:
- if (np)
- newdesig(&in, np);
- if (++in.pos == 0)
- errorp("compound literal too big");
- if (nelem == in.pos && !braces)
- break;
- } while (accept(','));
-
- if (braces)
- expect('}');
-
-
- if (tp->op == ARY && !(tp->prop & TDEFINED)) {
- tp->n.elem = in.max;
- deftype(tp);
- }
- if (in.max == 0) {
- errorp("empty braced initializer");
- return constnode(zero);
- }
-
- return mkcompound(&in, tp);
-}
-
-static void
-autoinit(Symbol *sym, Node *np)
-{
- Symbol *hidden;
- Type *tp = sym->type;
- size_t n; /* FIXME: It should be SIZET */
-
-repeat:
- switch (tp->op) {
- case UNION:
- np = np->sym->u.init[0];
- tp = np->type;
- goto repeat;
- case ARY:
- case STRUCT:
- if (!(np->flags & NCONST))
- abort(); /* TODO */
- hidden = newsym(NS_IDEN, NULL);
- hidden->type = sym->type;
- hidden->flags |= SLOCAL | SHASINIT;
- emit(ODECL, hidden);
- emit(OINIT, np);
- emit(ODECL, sym);
- emit(OEXPR,
- node(OASSIGN, tp, varnode(sym), varnode(hidden)));
- break;
- default:
- emit(ODECL, sym);
- np = node(OASSIGN, tp, varnode(sym), np);
- emit(OEXPR, np);
- break;
- }
-}
-
-void
-initializer(Symbol *sym, Type *tp)
-{
- Node *np;
- int flags = sym->flags;
-
- if (tp->op == FTN) {
- errorp("function '%s' initialized like a variable",
- sym->name);
- tp = inttype;
- }
- np = initialize(tp);
-
- if (flags & SDEFINED) {
- errorp("redeclaration of '%s'", sym->name);
- } else if ((flags & (SGLOBAL|SLOCAL|SPRIVATE)) != 0) {
- if (!(np->flags & NCONST)) {
- errorp("initializer element is not constant");
- return;
- }
- sym->flags |= SHASINIT;
- sym->flags &= ~SEMITTED;
- emit(ODECL, sym);
- emit(OINIT, np);
- sym->flags |= SDEFINED;
- } else if ((flags & (SEXTERN|STYPEDEF)) != 0) {
- errorp("'%s' has both '%s' and initializer",
- sym->name, (flags&SEXTERN) ? "extern" : "typedef");
- } else {
- autoinit(sym, np);
- }
-}
--- a/cc1/ir.md
+++ /dev/null
@@ -1,443 +1,0 @@
-# scc intermediate representation #
-
-The scc IR tries to be be a simple and easily parseable intermediate
-representation, and it makes it a bit terse and cryptic. The main
-characteristic of the IR is that all the types and operations are
-represented with only one letter, so parsing tables can be used
-to parse it.
-
-The language is composed of lines, representing statements.
-Each statement is composed of tab-separated fields.
-Declaration statements begin in column 0, expressions and
-control flow begin with a tabulator.
-When the frontend detects an error, it closes the output stream.
-
-## Types ##
-
-Types are represented with uppercase letters:
-
-* C -- signed 8-Bit integer
-* I -- signed 16-Bit integer
-* W -- signed 32-Bit integer
-* Q -- signed 64-Bit integer
-* K -- unsigned 8-Bit integer
-* N -- unsigned 16-Bit integer
-* Z -- unsigned 32-Bit integer
-* O -- unsigned 64-Bit integer
-* 0 -- void
-* P -- pointer
-* F -- function
-* V -- vector
-* U -- union
-* S -- struct
-* B -- bool
-* J -- float
-* D -- double
-* H -- long double
-
-This list has been built for the original Z80 backend, where 'int'
-has the same size as 'short'. Several types (S, F, V, U and others) need
-an identifier after the type letter for better differentiation
-between multiple structs, functions, vectors and unions (S1, V12 ...)
-naturally occuring in a C-program.
-
-## Storage classes ##
-
-The storage classes are represented using uppercase letters:
-
-* A -- automatic
-* R -- register
-* G -- public (global variable declared in the module)
-* X -- extern (global variable declared in another module)
-* Y -- private (variable in file-scope)
-* T -- local (static variable in function-scope)
-* M -- member (struct/union member)
-* L -- label
-
-## Declarations/definitions ##
-
-Variable names are composed of a storage class and an identifier
-(e.g. A1, R2, T3).
-Declarations and definitions are composed of a variable
-name, a type and the name of the variable:
-
- A1 I maxweight
- R2 C flag
- A3 S4 statstruct
-
-### Type declarations ###
-
-Some declarations (e.g. structs) involve the declaration of member
-variables.
-Struct members are declared normally after the type declaration in
-parentheses.
-
-For example the struct declaration
-
- struct foo {
- int i;
- long c;
- } var1;
-
-generates
-
- S2 foo (
- M3 I i
- M4 W c
- )
- G5 S2 var1
-
-## Functions ##
-
-A function prototype
-
- int printf(char *cmd, int flag, void *data);
-
-will generate a type declaration and a variable declaration
-
- F5 P I P
- X1 F5 printf
-
-The first line gives the function-type specification 'F' with
-an identifier '5' and subsequently lists the types of the
-function parameters.
-The second line declares the 'printf' function as a publicly
-scoped variable.
-
-Analogously, a statically declared function in file scope
-
- static int printf(char *cmd, int flag, void *data);
-
-generates
-
- F5 P I P
- T1 F5 printf
-
-Thus, the 'printf' variable went into local scope ('T').
-
-A '{' in the first column starts the body of the previously
-declared function:
-
- int printf(char *cmd, int flag, void *data) {}
-
-generates
-
- F5 P I P
- G1 F5 printf
- {
- A2 P cmd
- A3 I flag
- A4 P data
- -
- }
-
-Again, the frontend must ensure that '{' appears only after the
-declaration of a function. The character '-' marks the separation
-between parameters and local variables:
-
- int printf(register char *cmd, int flag, void *data) {int i;};
-
-generates
-
- F5 P I P
- G1 F5 printf
- {
- R2 P cmd
- A3 I flag
- A4 P data
- -
- A6 I i
- }
-
-### Expressions ###
-
-Expressions are emitted in reverse polish notation, simplifying
-parsing and converting into a tree representation.
-
-#### Operators ####
-
-Operators allowed in expressions are:
-
-* \+ -- addition
-* \- -- substraction
-* \* -- multiplication
-* % -- modulo
-* / -- division
-* l -- left shift
-* r -- right shift
-* < -- less than
-* > -- greather than
-* ] -- greather or equal than
-* [ -- less or equal than
-* = -- equal than
-* ! -- different than
-* & -- bitwise and
-* | -- bitwise or
-* ^ -- bitwise xor
-* ~ -- bitwise complement
-* : -- asignation
-* _ -- unary negation
-* c -- function call
-* p -- parameter
-* . -- field
-* , -- comma operator
-* ? -- ternary operator
-* ' -- take address
-* a -- logical shortcut and
-* o -- logical shortcut or
-* @ -- content of pointer
-
-Assignation has some suboperators:
-
-* :/ -- divide and assign
-* :% -- modulo and assign
-* :+ -- addition and assign
-* :- -- substraction and assign
-* :l -- left shift and assign
-* :r -- right shift and assign
-* :& -- bitwise and and assign
-* :^ -- bitwise xor and assign
-* :| -- bitwise or and assign
-* :i -- post increment
-* :d -- post decrement
-
-Every operator in an expression has a type descriptor.
-
-#### Constants ####
-
-Constants are introduced with the character '#'. For instance, 10 is
-translated to #IA (all constants are emitted in hexadecimal),
-where I indicates that it is an integer constant.
-Strings are a special case because they are represented with
-the " character.
-The constant "hello" is emitted as "68656C6C6F. For example
-
- int
- main(void)
- {
- int i, j;
-
- i = j+2*3;
- }
-
-generates
-
- F1
- G1 F1 main
- {
- -
- A2 I i
- A3 I j
- A2 A3 #I6 +I :I
- }
-
-Type casts are expressed with a tuple denoting the
-type conversion
-
- int
- main(void)
- {
- int i;
- long j;
-
- j = (long)i;
- }
-
-generates
-
- F1
- G1 F1 main
- {
- -
- A2 I i
- A3 W j
- A2 A3 WI :I
- }
-
-### Statements ###
-#### Jumps #####
-
-Jumps have the following form:
-
- j L# [expression]
-
-the optional expression field indicates some condition which
-must be satisfied to jump. Example:
-
- int
- main(void)
- {
- int i;
-
- goto label;
- label:
- i -= i;
- }
-
-generates
-
- F1
- G1 F1 main
- {
- -
- A2 I i
- j L3
- L3
- A2 A2 :-I
- }
-
-Another form of jump is the return statement, which uses the
-letter 'y' followed by a type identifier.
-Depending on the type, an optional expression follows.
-
- int
- main(void)
- {
- return 16;
- }
-
-generates
-
- F1
- G1 F1 main
- {
- -
- yI #I10
- }
-
-
-#### Loops ####
-
-There are two special characters that are used to indicate
-to the backend that the following statements are part of
-a loop body.
-
-* b -- beginning of loop
-* e -- end of loop
-
-#### Switch statement ####
-
-Switches are represented using a table, in which the labels
-where to jump for each case are indicated. Common cases are
-represented with 'v' and default with 'f'.
-The switch statement itself is represented with 's' followed
-by the label where the jump table is located, and the
-expression of the switch:
-
- int
- func(int n)
- {
- switch (n+1) {
- case 1:
- case 2:
- case 3:
- default:
- ++n;
- }
- }
-
-generates
-
- F2 I
- G1 F2 func
- {
- A1 I n
- -
- s L4 A1 #I1 +I
- L5
- L6
- L7
- L8
- A1 #I1 :+I
- j L3
- L4
- t #4
- v L7 #I3
- v L6 #I2
- v L5 #I1
- f L8
- L3
- }
-
-The beginning of the jump table is indicated by the the letter 't',
-followed by the number of cases (including default case) of the
-switch.
-
-## Resumen ##
-
-* C -- signed 8-Bit integer
-* I -- signed 16-Bit integer
-* W -- signed 32-Bit integer
-* O -- signed 64-Bit integer
-* M -- unsigned 8-Bit integer
-* N -- unsigned 16-Bit integer
-* Z -- unsigned 32-Bit integer
-* Q -- unsigned 64-Bit integer
-* 0 -- void
-* P -- pointer
-* F -- function
-* V -- vector
-* U -- union
-* S -- struct
-* B -- bool
-* J -- float
-* D -- double
-* H -- long double
-* A -- automatic
-* R -- register
-* G -- public (global variable declared in the module)
-* X -- extern (global variable declared in another module)
-* Y -- private (variable in file-scope)
-* T -- local (static variable in function-scope)
-* M -- member (struct/union member)
-* L -- label
-* { -- beginning of function body
-* } -- end of function body
-* \\ -- end of function parameters
-* \+ -- addition
-* \- -- substraction
-* \* -- multiplication
-* % -- modulo
-* / -- division
-* l -- left shift
-* r -- right shift
-* < -- less than
-* > -- greather than
-* ] -- greather or equal than
-* [ -- less or equal than
-* = -- equal than
-* ! -- different than
-* & -- bitwise and
-* | -- bitwise or
-* ^ -- bitwise xor
-* ~ -- bitwise complement
-* : -- asignation
-* _ -- unary negation
-* c -- function call
-* p -- parameter
-* . -- field
-* , -- comma operator
-* ? -- ternary operator
-* ' -- take address
-* a -- logical shortcut and
-* o -- logical shortcut or
-* @ -- content of pointer
-* :/ -- divide and assign
-* :% -- modulo and assign
-* :+ -- addition and assign
-* :- -- substraction and assign
-* :l -- left shift and assign
-* :r -- right shift and assign
-* :& -- bitwise and and assign
-* :^ -- bitwise xor and assign
-* :| -- bitwise or and assign
-* ;+ -- post increment
-* ;- -- post decrement
-* j -- jump
-* y -- return
-* b -- begin of loop
-* d -- end of loop
-* s -- switch statement
-* t -- switch table
-* v -- case entry in switch table
-* f -- default entry in switch table
--- a/cc1/lex.c
+++ /dev/null
@@ -1,801 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/lex.c";
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-int yytoken;
-struct yystype yylval;
-char yytext[STRINGSIZ+3];
-unsigned short yylen;
-int lexmode = CCMODE;
-unsigned lineno;
-char filenam[FILENAME_MAX];
-
-int namespace = NS_IDEN;
-static int safe;
-Input *input;
-
-void
-ilex(void)
-{
- static struct keyword keys[] = {
- {"auto", SCLASS, AUTO},
- {"break", BREAK, BREAK},
- {"_Bool", TYPE, BOOL},
- {"__builtin_va_list", TYPE, VA_LIST},
- {"case", CASE, CASE},
- {"char", TYPE, CHAR},
- {"const", TQUALIFIER, CONST},
- {"continue", CONTINUE, CONTINUE},
- {"default", DEFAULT, DEFAULT},
- {"do", DO, DO},
- {"double", TYPE, DOUBLE},
- {"else", ELSE, ELSE},
- {"enum", TYPE, ENUM},
- {"extern", SCLASS, EXTERN},
- {"float", TYPE, FLOAT},
- {"for", FOR, FOR},
- {"goto", GOTO, GOTO},
- {"if", IF, IF},
- {"inline", TQUALIFIER, INLINE},
- {"int", TYPE, INT},
- {"long", TYPE, LONG},
- {"register", SCLASS, REGISTER},
- {"restrict", TQUALIFIER, RESTRICT},
- {"return", RETURN, RETURN},
- {"short", TYPE, SHORT},
- {"signed", TYPE, SIGNED},
- {"sizeof", SIZEOF, SIZEOF},
- {"static", SCLASS, STATIC},
- {"struct", TYPE, STRUCT},
- {"switch", SWITCH, SWITCH},
- {"typedef", SCLASS, TYPEDEF},
- {"union", TYPE, UNION},
- {"unsigned", TYPE, UNSIGNED},
- {"void", TYPE, VOID},
- {"volatile", TQUALIFIER, VOLATILE},
- {"while", WHILE, WHILE},
- {NULL, 0, 0},
- };
- keywords(keys, NS_KEYWORD);
-}
-
-void
-setloc(char *fname, unsigned line)
-{
- size_t len;
-
- if ((len = strlen(fname)) >= FILENAME_MAX)
- die("cc1: %s: file name too long", fname);
- memmove(filenam, fname, len);
- filenam[len] = '\0';
-
- free(input->filenam);
- input->filenam = xstrdup(fname);
- lineno = input->lineno = line;
-}
-
-void
-addinput(char *fname, Symbol *hide, char *buffer)
-{
- FILE *fp;
- char *extp;
- unsigned flags;
- int infileln;
- Input *newip, *curip = input;
-
- if (hide) {
- /* this is a macro expansion */
- fp = NULL;
- if (hide->hide == UCHAR_MAX)
- die("cc1: too many macro expansions");
- ++hide->hide;
- flags = IMACRO;
- } else if (fname) {
- /* a new file */
- if ((fp = fopen(fname, "r")) == NULL)
- die("cc1: %s: %s", fname, strerror(errno));
- flags = IFILE;
- if (curip && onlyheader) {
- infileln = strlen(infile);
- if (extp = strrchr(infile, '.'))
- infileln -= strlen(extp);
- printf("%.*s.o: %s %s\n",
- infileln, infile, infile, fname);
- }
- } else {
- /* reading from stdin */
- fp = stdin;
- fname = "<stdin>";
- flags = ISTDIN;
- }
-
- newip = xmalloc(sizeof(*newip));
-
- if (!buffer) {
- buffer = xmalloc(INPUTSIZ);
- buffer[0] = '\0';
- }
-
- if (curip)
- curip->lineno = lineno;
-
- newip->p = newip->begin = newip->line = buffer;
- newip->filenam = NULL;
- newip->lineno = 0;
- newip->next = curip;
- newip->fp = fp;
- newip->hide = hide;
- newip->flags = flags;
- input = newip;
-
- setloc(fname, (curip) ? curip->lineno : newip->lineno);
-}
-
-void
-delinput(void)
-{
- Input *ip = input;
- Symbol *hide = ip->hide;
-
- switch (ip->flags & ITYPE) {
- case IFILE:
- if (fclose(ip->fp))
- die("cc1: %s: %s", ip->filenam, strerror(errno));
- break;
- case IMACRO:
- assert(hide->hide == 1);
- --hide->hide;
- break;
- }
- input = ip->next;
- free(ip->filenam);
- free(ip->line);
- if (input) {
- lineno = input->lineno;
- strcpy(filenam, input->filenam);
- }
-}
-
-static void
-newline(void)
-{
- if (++lineno == 0)
- die("cc1: %s: file too long", filenam);
-}
-
-/*
- * Read the next character from the input file, counting number of lines
- * and joining lines escaped with \
- */
-static int
-readchar(void)
-{
- FILE *fp = input->fp;
- int c;
-
-repeat:
- switch (c = getc(fp)) {
- case '\\':
- if ((c = getc(fp)) == '\n') {
- newline();
- goto repeat;
- }
- ungetc(c, fp);
- c = '\\';
- break;
- case '\n':
- newline();
- break;
- default:
- if (!isprint(c) && !ispunct(c) && !isspace(c))
- warn("invalid input character. The shame of UB is yours");
- break;
- }
-
- return c;
-}
-
-/*
- * discard a C comment. This function is only called from readline
- * because it is impossible to have a comment in a macro, because
- * comments are always discarded before processing any cpp directive
- */
-static void
-comment(int type)
-{
- int c;
-
-repeat:
- while ((c = readchar()) != EOF && c != type)
- ;
-
- if (c == EOF) {
- errorp("unterminated comment");
- return;
- }
-
- if (type == '*' && (c = readchar()) != '/')
- goto repeat;
-}
-
-/*
- * readline is used to read a full logic line from a file.
- * It discards comments and check that the line fits in
- * the input buffer
- */
-static int
-readline(void)
-{
- char *bp, *lim;
- int c, peekc = 0;
-
- if (feof(input->fp)) {
- input->flags |= IEOF;
- return 0;
- }
-
- *input->line = '\0';
- lim = &input->line[INPUTSIZ-1];
- for (bp = input->line; bp < lim-1; *bp++ = c) {
- c = (peekc) ? peekc : readchar();
- peekc = 0;
- if (c == '\n' || c == EOF)
- break;
- if (c != '/')
- continue;
-
- /* check for /* or // */
- peekc = readchar();
- if (peekc != '*' && peekc != '/')
- continue;
- comment((peekc == '/') ? '\n' : '*');
- peekc = 0;
- c = ' ';
- }
-
- input->begin = input->p = input->line;
- if (bp == lim-1) {
- errorp("line too long");
- --bp;
- }
- *bp++ = '\n';
- *bp = '\0';
-
- return 1;
-}
-
-/*
- * moreinput gets more bytes to be passed to the lexer.
- * It can take more bytes from macro expansions or
- * directly reading from files. When a cpp directive
- * is processed the line is discarded because it must not
- * be passed to the lexer
- */
-static int
-moreinput(void)
-{
- int wasexpand = 0;
-
-repeat:
- if (!input)
- return 0;
-
- if (*input->p == '\0') {
- if ((input->flags&ITYPE) == IMACRO) {
- wasexpand = 1;
- input->flags |= IEOF;
- }
- if (input->flags & IEOF) {
- delinput();
- goto repeat;
- }
- if (!readline() || cpp()) {
- *input->p = '\0';
- goto repeat;
- }
- }
-
- if (onlycpp && !wasexpand)
- ppragmaln();
- return 1;
-}
-
-static void
-tok2str(void)
-{
- if ((yylen = input->p - input->begin) > INTIDENTSIZ)
- error("token too big");
- memcpy(yytext, input->begin, yylen);
- yytext[yylen] = '\0';
- input->begin = input->p;
-}
-
-static Symbol *
-readint(char *s, int base, int sign, Symbol *sym)
-{
- Type *tp = sym->type;
- struct limits *lim;
- TUINT u, val, max;
- int c;
-
- lim = getlimits(tp);
- max = lim->max.i;
- if (*s == '0')
- ++s;
- if (toupper(*s) == 'X')
- ++s;
-
- for (u = 0; isxdigit(c = *s++); u = u*base + val) {
- static char letters[] = "0123456789ABCDEF";
- val = strchr(letters, toupper(c)) - letters;
- repeat:
- if (u <= max/base && u*base <= max - val)
- continue;
- if (tp->prop & TSIGNED) {
- if (tp == inttype)
- tp = (base==10) ? longtype : uinttype;
- else if (tp == longtype)
- tp = (base==10) ? llongtype : ulongtype;
- else
- goto overflow;
- } else {
- if (tp == uinttype)
- tp = (sign==UNSIGNED) ? ulongtype : longtype;
- else if (tp == ulongtype)
- tp = (sign==UNSIGNED) ? ullongtype : llongtype;
- else
- goto overflow;
- }
- sym->type = tp;
- lim = getlimits(tp);
- max = lim->max.i;
- goto repeat;
- }
-
- if (tp->prop & TSIGNED)
- sym->u.i = u;
- else
- sym->u.u = u;
-
- return sym;
-
-overflow:
- errorp("overflow in integer constant");
- return sym;
-}
-
-static int
-integer(char *s, int base)
-{
- Type *tp;
- Symbol *sym;
- unsigned size, sign;
-
- for (size = sign = 0; ; ++input->p) {
- switch (toupper(*input->p)) {
- case 'L':
- if (size == LLONG)
- goto wrong_type;
- size = (size == LONG) ? LLONG : LONG;
- continue;
- case 'U':
- if (sign == UNSIGNED)
- goto wrong_type;
- sign = UNSIGNED;
- continue;
- default:
- goto convert;
- wrong_type:
- error("invalid suffix in integer constant");
- }
- }
-
-convert:
- tp = ctype(INT, sign, size);
- sym = newsym(NS_IDEN, NULL);
- sym->type = tp;
- sym->flags |= SCONSTANT;
- yylval.sym = readint(s, base, sign, sym);
- return CONSTANT;
-}
-
-static char *
-digits(int base)
-{
- char *p;
- int c;
-
- for (p = input->p; c = *p; ++p) {
- switch (base) {
- case 8:
- if (!strchr("01234567", c))
- goto end;
- break;
- case 10:
- if (!isdigit(c))
- goto end;
- break;
- case 16:
- if (!isxdigit(c))
- goto end;
- break;
- }
- }
-end:
- input->p = p;
- tok2str();
- return yytext;
-}
-
-static int
-number(void)
-{
- int base;
-
- if (*input->p != '0') {
- base = 10;
- } else {
- if (toupper(*++input->p) == 'X') {
- ++input->p;
- base = 16;
- } else {
- base = 8;
- }
- }
-
- return integer(digits(base), base);
-}
-
-static int
-escape(void)
-{
- int c, base;
-
- switch (*++input->p) {
- case 'a': return '\a';
- case 'f': return '\f';
- case 'n': return '\n';
- case 'r': return '\r';
- case 't': return '\t';
- case 'v': return '\v';
- case '"': return '"';
- case '\'': return '\'';
- case '\\': return '\\';
- case '\?': return '\?';
- case 'u':
- /*
- * FIXME: universal constants are not correctly handled
- */
- if (!isdigit(*++input->p))
- warn("incorrect digit for numerical character constant");
- base = 10;
- break;
- case 'x':
- if (!isxdigit(*++input->p))
- warn("\\x used with no following hex digits");
- base = 16;
- break;
- case '0':
- if (!strchr("01234567", *++input->p))
- warn("\\0 used with no following octal digits");
- base = 8;
- break;
- default:
- warn("unknown escape sequence");
- return ' ';
- }
- errno = 0;
- c = strtoul(input->p, &input->p, base);
- if (errno || c > 255)
- warn("character constant out of range");
- --input->p;
- return c;
-}
-
-static int
-character(void)
-{
- int c;
- Symbol *sym;
-
- if ((c = *++input->p) == '\\')
- c = escape();
- else
- c = *input->p;
- ++input->p;
- if (*input->p != '\'')
- errorp("invalid character constant");
- else
- ++input->p;
-
- sym = newsym(NS_IDEN, NULL);
- sym->u.i = c;
- sym->type = inttype;
- yylval.sym = sym;
- tok2str();
- return CONSTANT;
-}
-
-static int
-string(void)
-{
- char *bp = yytext;
- int c;
-
- *bp++ = '"';
- for (++input->p; (c = *input->p) != '"'; ++input->p) {
- if (c == '\0') {
- errorp("missing terminating '\"' character");
- break;
- }
- if (c == '\\')
- c = escape();
- if (bp == &yytext[STRINGSIZ+1]) {
- /* TODO: proper error handling here */
- error("string too long");
- }
- *bp++ = c;
- }
-
- input->begin = ++input->p;
- *bp = '\0';
-
- yylen = bp - yytext + 1;
- yylval.sym = newstring(yytext+1, yylen-1);
- *bp++ = '"';
- *bp = '\0';
- return STRING;
-}
-
-static int
-iden(void)
-{
- Symbol *sym;
- char *p, *begin;
-
- begin = input->p;
- for (p = begin; isalnum(*p) || *p == '_'; ++p)
- ;
- input->p = p;
- tok2str();
- if ((sym = lookup(NS_CPP, yytext, NOALLOC)) != NULL) {
- if (!disexpand && !sym->hide && expand(begin, sym))
- return next();
- }
- sym = lookup(namespace, yytext, ALLOC);
- yylval.sym = sym;
- if (sym->flags & SCONSTANT)
- return CONSTANT;
- if (sym->token != IDEN)
- yylval.token = sym->u.token;
- return sym->token;
-}
-
-static int
-follow(int expect, int ifyes, int ifno)
-{
- if (*input->p++ == expect)
- return ifyes;
- --input->p;
- return ifno;
-}
-
-static int
-minus(void)
-{
- switch (*input->p++) {
- case '-': return DEC;
- case '>': return INDIR;
- case '=': return SUB_EQ;
- default: --input->p; return '-';
- }
-}
-
-static int
-plus(void)
-{
- switch (*input->p++) {
- case '+': return INC;
- case '=': return ADD_EQ;
- default: --input->p; return '+';
- }
-}
-
-static int
-relational(int op, int equal, int shift, int assig)
-{
- int c;
-
- if ((c = *input->p++) == '=')
- return equal;
- if (c == op)
- return follow('=', assig, shift);
- --input->p;
- return op;
-}
-
-static int
-logic(int op, int equal, int logic)
-{
- int c;
-
- if ((c = *input->p++) == '=')
- return equal;
- if (c == op)
- return logic;
- --input->p;
- return op;
-}
-
-static int
-dot(void)
-{
- int c;
-
- if ((c = *input->p) != '.')
- return '.';
- if ((c = *++input->p) != '.')
- error("incorrect token '..'");
- ++input->p;
- return ELLIPSIS;
-}
-
-static int
-operator(void)
-{
- int t;
-
- switch (t = *input->p++) {
- case '<': t = relational('<', LE, SHL, SHL_EQ); break;
- case '>': t = relational('>', GE, SHR, SHR_EQ); break;
- case '&': t = logic('&', AND_EQ, AND); break;
- case '|': t = logic('|', OR_EQ, OR); break;
- case '=': t = follow('=', EQ, '='); break;
- case '^': t = follow('=', XOR_EQ, '^'); break;
- case '*': t = follow('=', MUL_EQ, '*'); break;
- case '/': t = follow('=', DIV_EQ, '/'); break;
- case '!': t = follow('=', NE, '!'); break;
- case '#': t = follow('#', '$', '#'); break;
- case '-': t = minus(); break;
- case '+': t = plus(); break;
- case '.': t = dot(); break;
- }
- tok2str();
- return t;
-}
-
-/* TODO: Ensure that namespace is NS_IDEN after a recovery */
-
-/*
- * skip all the spaces until the next token. When we are in
- * CPPMODE \n is not considered a whitespace
- */
-static int
-skipspaces(void)
-{
- int c;
-
- for (;;) {
- switch (c = *input->p) {
- case '\n':
- if (lexmode == CPPMODE)
- goto return_byte;
- ++input->p;
- case '\0':
- if (!moreinput())
- return EOF;
- break;
- case ' ':
- case '\t':
- case '\v':
- case '\r':
- case '\f':
- ++input->p;
- break;
- default:
- goto return_byte;
- }
- }
-
-return_byte:
- input->begin = input->p;
- return c;
-}
-
-int
-next(void)
-{
- int c;
-
- if ((c = skipspaces()) == EOF)
- yytoken = EOFTOK;
- else if (isalpha(c) || c == '_')
- yytoken = iden();
- else if (isdigit(c))
- yytoken = number();
- else if (c == '"')
- yytoken = string();
- else if (c == '\'')
- yytoken = character();
- else
- yytoken = operator();
-
- if (yytoken == EOF) {
- strcpy(yytext, "<EOF>");
- if (cppctx)
- errorp("#endif expected");
- }
-
- DBG("TOKEN %s", yytext);
- return yytoken;
-}
-
-void
-expect(int tok)
-{
- if (yytoken != tok) {
- if (isgraph(tok))
- errorp("expected '%c' before '%s'", tok, yytext);
- else
- errorp("unexpected '%s'", yytext);
- } else {
- next();
- }
-}
-
-int
-ahead(void)
-{
- skipspaces();
- return *input->begin;
-}
-
-void
-setsafe(int type)
-{
- safe = type;
-}
-
-void
-discard(void)
-{
- extern jmp_buf recover;
- int c;
-
- input->begin = input->p;
- for (c = yytoken; ; c = *input->begin++) {
- switch (safe) {
- case END_COMP:
- if (c == '}')
- goto jump;
- goto semicolon;
- case END_COND:
- if (c == ')')
- goto jump;
- break;
- case END_LDECL:
- if (c == ',')
- goto jump;
- case END_DECL:
- semicolon:
- if (c == ';')
- goto jump;
- break;
- }
- if (c == '\0' && !moreinput())
- exit(1);
- }
-jump:
- yytoken = c;
- longjmp(recover, 1);
-}
--- a/cc1/main.c
+++ /dev/null
@@ -1,102 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/main.c";
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "../inc/arg.h"
-#include "../inc/scc.h"
-#include "cc1.h"
-
-char *argv0, *infile;
-
-int warnings;
-jmp_buf recover;
-
-static struct items uflags;
-int onlycpp, onlyheader;
-
-
-extern int failure;
-
-static void
-defmacro(char *macro)
-{
- char *p = strchr(macro, '=');
-
- if (p)
- *p++ = '\0';
- else
- p = "1";
-
- defdefine(macro, p, "command-line");
-}
-
-static void
-usage(void)
-{
- fputs("usage: cc1 [-Ewd] [-D def[=val]]... [-U def]... "
- "[-I dir]... [-o output] [input]\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- int i;
-
- ilex();
- icpp();
- icode();
- ibuilts();
-
- ARGBEGIN {
- case 'D':
- defmacro(EARGF(usage()));
- break;
- case 'M':
- onlyheader = 1;
- break;
- case 'E':
- onlycpp = 1;
- break;
- case 'I':
- incdir(EARGF(usage()));
- break;
- case 'U':
- newitem(&uflags, EARGF(usage()));
- break;
- case 'd':
- DBGON();
- break;
- case 'w':
- warnings = 1;
- break;
- default:
- usage();
- } ARGEND
-
- if (argc > 1)
- usage();
-
- for (i = 0; i < uflags.n; ++i)
- undefmacro(uflags.s[i]);
-
- infile = (*argv) ? *argv : "<stdin>";
- addinput(*argv, NULL, NULL);
-
- /*
- * we cannot initialize arch until we have an
- * output stream, because we maybe want to emit new types
- */
- iarch();
- if (onlycpp || onlyheader) {
- outcpp();
- } else {
- for (next(); yytoken != EOFTOK; decl())
- ;
- }
-
- return failure;
-}
--- a/cc1/stmt.c
+++ /dev/null
@@ -1,386 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/stmt.c";
-#include <stddef.h>
-#include <setjmp.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define NEGATE 1
-#define NONEGATE 0
-
-Symbol *curfun;
-
-static void stmt(Symbol *lbreak, Symbol *lcont, Switch *lswitch);
-
-static void
-label(void)
-{
- Symbol *sym;
-
- switch (yytoken) {
- case IDEN:
- case TYPEIDEN:
- sym = lookup(NS_LABEL, yytext, ALLOC);
- if (sym->flags & SDEFINED)
- error("label '%s' already defined", yytext);
- if ((sym->flags & SDECLARED) == 0)
- sym = install(NS_LABEL, sym);
- sym->flags |= SDEFINED;
- emit(OLABEL, sym);
- next();
- expect(':');
- break;
- default:
- unexpected();
- }
-}
-
-static void
-stmtexp(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Node *np;
-
- if (accept(';'))
- return;
- if (yytoken == IDEN && ahead() == ':') {
- label();
- stmt(lbreak, lcont, lswitch);
- return;
- }
- np = expr();
- if ((np->flags & NEFFECT) == 0)
- warn("expression without side effects");
- emit(OEXPR, np);
- expect(';');
-}
-
-static Node *
-condition(int neg)
-{
- Node *np;
-
- expect('(');
- np = condexpr(neg);
- expect(')');
-
- return np;
-}
-
-static void
-While(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Symbol *begin;
- Node *np;
-
- begin = newlabel();
- lcont = newlabel();
- lbreak = newlabel();
-
- expect(WHILE);
- np = condition(NONEGATE);
-
- emit(OJUMP, lcont);
-
- emit(OBLOOP, NULL);
- emit(OLABEL, begin);
- stmt(lbreak, lcont, lswitch);
- emit(OLABEL, lcont);
- emit(OBRANCH, begin);
- emit(OEXPR, np);
- emit(OELOOP, NULL);
-
- emit(OLABEL, lbreak);
-}
-
-static void
-For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Symbol *begin, *cond;
- Node *econd, *einc;
-
- begin = newlabel();
- lcont = newlabel();
- cond = newlabel();
- lbreak = newlabel();
-
- pushctx();
-
- expect(FOR);
- expect('(');
- switch (yytoken) {
- case TYPE:
- case TYPEIDEN:
- case TQUALIFIER:
- case SCLASS:
- decl();
- break;
- default:
- emit(OEXPR, expr());
- case ';':
- expect(';');
- break;
- }
- econd = (yytoken != ';') ? condexpr(NONEGATE) : NULL;
- expect(';');
- einc = (yytoken != ')') ? expr() : NULL;
- expect(')');
-
- emit(OJUMP, cond);
-
- emit(OBLOOP, NULL);
- emit(OLABEL, begin);
- stmt(lbreak, lcont, lswitch);
- emit(OLABEL, lcont);
- emit(OEXPR, einc);
- emit(OLABEL, cond);
- emit((econd) ? OBRANCH : OJUMP, begin);
- emit(OEXPR, econd);
- emit(OELOOP, NULL);
-
- emit(OLABEL, lbreak);
-
- popctx();
-}
-
-static void
-Dowhile(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Symbol *begin;
- Node *np;
-
- begin = newlabel();
- lcont = newlabel();
- lbreak = newlabel();
-
- expect(DO);
-
- emit(OBLOOP, NULL);
- emit(OLABEL, begin);
- stmt(lbreak, lcont, lswitch);
- expect(WHILE);
- np = condition(NONEGATE);
- emit(OLABEL, lcont);
- emit(OBRANCH, begin);
- emit(OEXPR, np);
- emit(OELOOP, NULL);
-
- emit(OLABEL, lbreak);
-}
-
-static void
-Return(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Node *np;
- Type *tp = curfun->type->type;
-
- expect(RETURN);
- np = (yytoken != ';') ? decay(expr()) : NULL;
- expect(';');
- if (!np) {
- if (tp != voidtype)
- warn("function returning non void returns no value");
- tp = voidtype;
- } else if (np->type != tp) {
- if (tp == voidtype)
- warn("function returning void returns a value");
- else if ((np = convert(np, tp, 0)) == NULL)
- errorp("incorrect type in return");
- }
- emit(ORET, NULL);
- emit(OEXPR, np);
-}
-
-static void
-Break(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- expect(BREAK);
- if (!lbreak) {
- errorp("break statement not within loop or switch");
- } else {
- emit(OJUMP, lbreak);
- expect(';');
- }
-}
-
-static void
-Continue(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- expect(CONTINUE);
- if (!lcont) {
- errorp("continue statement not within loop");
- } else {
- emit(OJUMP, lcont);
- expect(';');
- }
-}
-
-static void
-Goto(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Symbol *sym;
-
- namespace = NS_LABEL;
- next();
- namespace = NS_IDEN;
-
- if (yytoken != IDEN)
- unexpected();
- sym = yylval.sym;
- if ((sym->flags & SDECLARED) == 0)
- sym = install(NS_LABEL, sym);
- sym->flags |= SUSED;
- emit(OJUMP, sym);
- next();
- expect(';');
-}
-
-static void
-Swtch(Symbol *obr, Symbol *lcont, Switch *osw)
-{
- Switch sw = {0};
- Node *cond;
- Symbol *lbreak;
-
- expect(SWITCH);
-
- expect ('(');
- if ((cond = convert(expr(), inttype, 0)) == NULL) {
- errorp("incorrect type in switch statement");
- cond = constnode(zero);
- }
- expect (')');
-
- lbreak = newlabel();
- emit(OBSWITCH, NULL);
- emit(OEXPR, cond);
- stmt(lbreak, lcont, &sw);
- emit(OESWITCH, lbreak);
- emit(OLABEL, lbreak);
-}
-
-static void
-Case(Symbol *lbreak, Symbol *lcont, Switch *sw)
-{
- Node *np;
- Symbol *label;
-
- expect(CASE);
- if ((np = constexpr()) == NULL)
- errorp("case label does not reduce to an integer constant");
- if (!sw) {
- errorp("case label not within a switch statement");
- } else if (sw->nr >= 0 && ++sw->nr == NR_SWITCH) {
- errorp("too many case labels for a switch statement");
- sw->nr = -1;
- }
- expect(':');
-
- label = newlabel();
- emit(OCASE, label);
- emit(OEXPR, np);
- emit(OLABEL, label);
- stmt(lbreak, lcont, sw);
-}
-
-static void
-Default(Symbol *lbreak, Symbol *lcont, Switch *sw)
-{
- Symbol *label = newlabel();
-
- if (sw->hasdef)
- errorp("multiple default labels in one switch");
- sw->hasdef = 1;
- expect(DEFAULT);
- expect(':');
- emit(ODEFAULT, label);
- emit(OLABEL, label);
- stmt(lbreak, lcont, sw);
-}
-
-static void
-If(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- Symbol *end, *lelse;
- Node *np;
-
- lelse = newlabel();
- expect(IF);
- np = condition(NEGATE);
- emit(OBRANCH, lelse);
- emit(OEXPR, np);
- stmt(lbreak, lcont, lswitch);
- if (accept(ELSE)) {
- end = newlabel();
- emit(OJUMP, end);
- emit(OLABEL, lelse);
- stmt(lbreak, lcont, lswitch);
- emit(OLABEL, end);
- } else {
- emit(OLABEL, lelse);
- }
-}
-
-static void
-blockit(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- switch (yytoken) {
- case TYPEIDEN:
- if (ahead() == ':')
- goto parse_stmt;
- case TYPE:
- case TQUALIFIER:
- case SCLASS:
- decl();
- return;
- default:
- parse_stmt:
- stmt(lbreak, lcont, lswitch);
- }
-}
-
-void
-compound(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- static int nested;
-
- pushctx();
- expect('{');
-
- if (nested == NR_BLOCK)
- error("too many nesting levels of compound statements");
-
- ++nested;
- for (;;) {
- if (yytoken == '}')
- break;
- blockit(lbreak, lcont, lswitch);
- }
- --nested;
-
- popctx();
- expect('}');
-}
-
-static void
-stmt(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
-{
- void (*fun)(Symbol *, Symbol *, Switch *);
-
- switch (yytoken) {
- case '{': fun = compound; break;
- case RETURN: fun = Return; break;
- case WHILE: fun = While; break;
- case FOR: fun = For; break;
- case DO: fun = Dowhile; break;
- case IF: fun = If; break;
- case BREAK: fun = Break; break;
- case CONTINUE: fun = Continue; break;
- case GOTO: fun = Goto; break;
- case SWITCH: fun = Swtch; break;
- case CASE: fun = Case; break;
- case DEFAULT: fun = Default; break;
- default: fun = stmtexp; break;
- }
- (*fun)(lbreak, lcont, lswitch);
-}
--- a/cc1/symbol.c
+++ /dev/null
@@ -1,353 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/symbol.c";
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define NR_SYM_HASH 64
-#define NR_CPP_HASH 32
-#define NR_LBL_HASH 16
-
-unsigned curctx;
-static unsigned short counterid;
-
-static Symbol *head, *labels;
-static Symbol *htab[NR_SYM_HASH];
-static Symbol *htabcpp[NR_CPP_HASH];
-static Symbol *htablbl[NR_LBL_HASH];
-
-#ifndef NDEBUG
-void
-dumpstab(Symbol **tbl, char *msg)
-{
- Symbol **bp, *sym;
- unsigned size;
-
- fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
- if (tbl == htab)
- size = NR_SYM_HASH;
- else if (tbl == htabcpp)
- size = NR_CPP_HASH;
- else if (tbl == htablbl)
- size = NR_LBL_HASH;
- else
- abort();
-
- for (bp = tbl; bp < &tbl[size]; ++bp) {
- if (*bp == NULL)
- continue;
- fprintf(stderr, "%d", (int) (bp - htab));
- for (sym = *bp; sym; sym = sym->hash)
- fprintf(stderr, "->[%d,%d:'%s'=%p]",
- sym->ns, sym->ctx, sym->name, (void *) sym);
- putc('\n', stderr);
- }
- fputs("head:", stderr);
- for (sym = head; sym; sym = sym->next) {
- fprintf(stderr, "->[%d,%d:'%s'=%p]",
- sym->ns, sym->ctx,
- (sym->name) ? sym->name : "", (void *) sym);
- }
- fputs("\nlabels:", stderr);
- for (sym = labels; sym; sym = sym->next) {
- fprintf(stderr, "->[%d,%d:'%s'=%p]",
- sym->ns, sym->ctx,
- (sym->name) ? sym->name : "", (void *) sym);
- }
- putc('\n', stderr);
-}
-#endif
-
-static Symbol **
-hash(char *s, int ns)
-{
- unsigned c, h, size;
- Symbol **tab;
-
- for (h = 0; c = *s; ++s)
- h = h*33 ^ c;
-
- switch (ns) {
- case NS_CPP:
- tab = htabcpp;
- size = NR_CPP_HASH-1;
- break;
- case NS_LABEL:
- tab = htablbl;
- size = NR_LBL_HASH-1;
- break;
- default:
- tab = htab;
- size = NR_SYM_HASH-1;
- break;
- }
- return &tab[h & size];
-}
-
-static void
-unlinkhash(Symbol *sym)
-{
- Symbol **h;
-
- if ((sym->flags & SDECLARED) == 0)
- return;
- h = hash(sym->name, sym->ns);
- assert(sym->ns == NS_CPP || *h == sym);
- while (*h != sym)
- h = &(*h)->hash;
- *h = sym->hash;
-}
-
-void
-pushctx(void)
-{
- DBG("SYM: pushed context %d", curctx+1);
- if (++curctx == NR_BLOCK+1)
- error("too many nested blocks");
-}
-
-void
-killsym(Symbol *sym)
-{
- short f;
- char *name;
-
- if (!sym)
- return;
- f = sym->flags;
- if (f & SSTRING)
- free(sym->u.s);
- if (sym->ns == NS_TAG)
- sym->type->prop &= ~TDEFINED;
- unlinkhash(sym);
- if ((name = sym->name) != NULL) {
- switch (sym->ns) {
- case NS_LABEL:
- if ((f & SDEFINED) == 0)
- errorp("label '%s' is not defined", name);
- case NS_IDEN:
- if ((f & (SUSED|SGLOBAL|SDECLARED)) == SDECLARED)
- warn("'%s' defined but not used", name);
- break;
- }
- }
- free(name);
- free(sym);
-}
-
-void
-popctx(void)
-{
- Symbol *next, *sym;
- int ns, dangling = 0;
-
- DBG("SYM: poped context %d", curctx);
- /*
- * we have to be careful before popping the current
- * context, because since the parser is one token
- * ahead it may already have read an identifier at
- * this point, and yylval.sym is a pointer to
- * the symbol associated to such token. If that
- * symbol is from the context that we are popping
- * then we are going to generate a dangling pointer.
- * We can detect this situation and call again to
- * lookup.
- */
- if ((yytoken == IDEN || yytoken == TYPEIDEN) &&
- yylval.sym->ctx == curctx) {
- ns = yylval.sym->ns;
- dangling = 1;
- }
-
- for (sym = head; sym && sym->ctx == curctx; sym = next) {
- /*
- * Since we are unlinking them in the inverse order
- * we do know that sym is always the head of the
- * collision list
- */
- next = sym->next;
- killsym(sym);
- }
- head = sym;
-
- if (--curctx == GLOBALCTX) {
- for (sym = labels; sym; sym = next) {
- next = sym->next;
- killsym(sym);
- }
- labels = NULL;
- }
-
- if (dangling) {
- yylval.sym = lookup(ns, yytext, ALLOC);
- yytoken = yylval.sym->token;
- }
-}
-
-unsigned
-newid(void)
-{
- unsigned short id;
-
- if (lexmode == CPPMODE)
- return 0;
- id = ++counterid;
- if (id == 0) {
- die("cc1: overflow in %s identifiers",
- (curctx) ? "internal" : "external");
- }
- return id;
-}
-
-Symbol *
-newsym(int ns, char *name)
-{
- Symbol *sym;
-
- sym = xmalloc(sizeof(*sym));
- if (name)
- name = xstrdup(name);
- sym->name = name;
- sym->id = 0;
- sym->hide = 0;
- sym->ns = ns;
- sym->ctx = curctx;
- sym->token = IDEN;
- sym->flags = 0;
- sym->u.s = NULL;
- sym->type = NULL;
- sym->hash = NULL;
-
- if (ns == NS_LABEL) {
- sym->next = labels;
- labels = sym;
- } else if (ns != NS_CPP) {
- sym->next = head;
- head = sym;
- }
- return sym;
-}
-
-static Symbol *
-linkhash(Symbol *sym)
-{
- Symbol **h;
-
- h = hash(sym->name, sym->ns);
- sym->hash = *h;
- *h = sym;
-
- if (sym->ns != NS_CPP)
- sym->id = newid();
- sym->flags |= SDECLARED;
- return sym;
-}
-
-Symbol *
-newstring(char *s, size_t len)
-{
- Symbol *sym = newsym(NS_IDEN, NULL);
-
- if (lexmode != CPPMODE)
- sym->type = mktype(chartype, ARY, len, NULL);
- sym->id = newid();
- sym->flags |= SSTRING | SCONSTANT | SPRIVATE;
- sym->u.s = xmalloc(len);
- if (s)
- memcpy(sym->u.s, s, len);
-
- return sym;
-}
-
-Symbol *
-newlabel(void)
-{
- Symbol *sym = newsym(NS_LABEL, NULL);
- sym->id = newid();
- return sym;
-}
-
-Symbol *
-lookup(int ns, char *name, int alloc)
-{
- Symbol *sym;
- int sns, c;
- char *t;
-
- c = *name;
- for (sym = *hash(name, ns); sym; sym = sym->hash) {
- t = sym->name;
- if (*t != c || strcmp(t, name))
- continue;
- sns = sym->ns;
- if (sns == ns)
- return sym;
- /*
- * When a lookup is done in a namespace associated
- * to a struct we also want symbols of NS_IDEN which
- * are typedef, because in other case we cannot declare
- * fields of such types.
- * TODO: Remove this trick
- */
- if (sns == NS_KEYWORD ||
- (sym->flags & STYPEDEF) && ns >= NS_STRUCTS) {
- return sym;
- }
- }
- return (alloc == ALLOC) ? newsym(ns, name) : NULL;
-}
-
-Symbol *
-install(int ns, Symbol *sym)
-{
- if (sym->flags & SDECLARED || sym->ctx != curctx) {
- if (sym->ctx == curctx && ns == sym->ns)
- return NULL;
- sym = newsym(ns, sym->name);
- }
- return linkhash(sym);
-}
-
-void
-keywords(struct keyword *key, int ns)
-{
- Symbol *sym;
-
- for ( ; key->str; ++key) {
- sym = linkhash(newsym(ns, key->str));
- sym->token = key->token;
- sym->u.token = key->value;
- }
- /*
- * Remove all the predefined symbols from * the symbol list. It
- * will make faster some operations. There is no problem of memory
- * leakeage because this memory is not ever freed
- */
- counterid = 0;
- head = NULL;
-}
-
-void
-builtins(struct builtin *built)
-{
- Symbol *sym;
- struct builtin *bp;
-
- for (bp = built; bp->str; ++bp) {
- sym = linkhash(newsym(NS_KEYWORD, bp->str));
- sym->token = BUILTIN;
- sym->u.fun = bp->fun;
- }
- /*
- * Remove all the predefined symbols from * the symbol list. It
- * will make faster some operations. There is no problem of memory
- * leakeage because this memory is not ever freed
- */
- counterid = 0;
- head = NULL;
-}
--- a/cc1/target/amd64-sysv/arch.c
+++ /dev/null
@@ -1,220 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/arch/amd64-sysv/arch.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc1.h"
-
-#define RANK_BOOL 0
-#define RANK_SCHAR 1
-#define RANK_UCHAR 1
-#define RANK_CHAR 1
-#define RANK_SHORT 2
-#define RANK_USHORT 2
-#define RANK_INT 3
-#define RANK_UINT 3
-#define RANK_LONG 4
-#define RANK_ULONG 4
-#define RANK_LLONG 5
-#define RANK_ULLONG 5
-#define RANK_FLOAT 6
-#define RANK_DOUBLE 7
-#define RANK_LDOUBLE 8
-
-/*
- * Initializaion of type pointers were done with
- * a C99 initilizator '... = &(Type) {...', but
- * c compiler in Plan9 gives error with this
- * syntax, so I have switched it to this ugly form
- * I hope I will change it again in the future
- */
-
-static Type types[] = {
- { /* 0 = voidtype */
- .op = VOID,
- .letter = L_VOID,
- },
- { /* 1 = pvoidtype */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .type = &types[5], /* chartype */
- .size = 8,
- .align = 8,
- },
- { /* 2 = booltype */
- .op = INT,
- .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_BOOL,
- },
- { /* 3 = schartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_SCHAR,
- },
- { /* 4 = uchartype */
- .op = INT,
- .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_UCHAR,
- },
- { /* 5 = chartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_CHAR,
- },
- { /* 6 = ushortype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 2,
- .n.rank = RANK_USHORT,
- },
- { /* 7 = shortype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 2,
- .n.rank = RANK_SHORT,
- },
- { /* 8 = uinttype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_UINT,
- },
- { /* 9 = inttype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 4,
- .n.rank = RANK_INT,
- },
- { /* 10 = longtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LONG,
- },
- { /* 11 = ulongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_ULONG,
- },
- { /* 12 = ullongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_ULLONG,
- },
- { /* 13 = llongtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LLONG,
- },
- { /* 14 = floattype */
- .op = FLOAT,
- .letter = L_FLOAT,
- .prop = TDEFINED | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_FLOAT,
- },
- { /* 15 = doubletype */
- .op = FLOAT,
- .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_DOUBLE,
- },
- { /* 16 = ldoubletype */
- .op = FLOAT,
- .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 16,
- .align = 16,
- .n.rank = RANK_LDOUBLE,
- },
- { /* 17 = sizettype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_UINT,
- },
- { /* 18 = ellipsis */
- .op = ELLIPSIS,
- .letter = L_ELLIPSIS,
- .prop = TDEFINED,
- },
- { /* 19 = pdifftype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LONG,
- },
- { /* 20 = va_type */
- .op = STRUCT,
- .letter = L_VA_ARG,
- .prop = TDEFINED,
- .size = 24,
- .align = 8,
- },
-};
-
-Type *voidtype = &types[0], *pvoidtype = &types[1],
- *booltype = &types[2], *schartype = &types[3],
- *uchartype = &types[4], *chartype = &types[5],
- *ushortype = &types[6], *shortype = &types[7],
- *uinttype = &types[8], *inttype = &types[9],
- *longtype = &types[10], *ulongtype = &types[11],
- *ullongtype = &types[12], *llongtype = &types[13],
- *floattype = &types[14], *doubletype = &types[15],
- *ldoubletype = &types[16],
- *sizettype = &types[17], *pdifftype = &types[19],
- *ellipsistype = &types[18], *va_type = &types[20],
- *va_list_type;
-
-static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
- dummy1 = {.u.i = 1, .type = &types[9]};
-Symbol *zero = &dummy0, *one = &dummy1;
-
-void
-iarch(void)
-{
- va_list_type = mktype(va_type, ARY, 1, NULL);
-}
-
-int
-valid_va_list(Type *tp)
-{
- return tp->op == PTR && eqtype(tp->type, va_type, 1);
-}
--- a/cc1/target/amd64-sysv/arch.mk
+++ /dev/null
@@ -1,5 +1,0 @@
-
-OBJ-amd64-sysv= $(OBJ) target/amd64-sysv/arch.o
-
-$(LIBEXEC)/cc1-amd64-sysv: $(OBJ-amd64-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-amd64-sysv) -lscc -o $@
--- a/cc1/target/arm64-sysv/arch.c
+++ /dev/null
@@ -1,220 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/arch/arm64-sysv/arch.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc1.h"
-
-#define RANK_BOOL 0
-#define RANK_SCHAR 1
-#define RANK_UCHAR 1
-#define RANK_CHAR 1
-#define RANK_SHORT 2
-#define RANK_USHORT 2
-#define RANK_INT 3
-#define RANK_UINT 3
-#define RANK_LONG 4
-#define RANK_ULONG 4
-#define RANK_LLONG 5
-#define RANK_ULLONG 5
-#define RANK_FLOAT 6
-#define RANK_DOUBLE 7
-#define RANK_LDOUBLE 8
-
-/*
- * Initializaion of type pointers were done with
- * a C99 initilizator '... = &(Type) {...', but
- * c compiler in Plan9 gives error with this
- * syntax, so I have switched it to this ugly form
- * I hope I will change it again in the future
- */
-
-static Type types[] = {
- { /* 0 = voidtype */
- .op = VOID,
- .letter = L_VOID,
- },
- { /* 1 = pvoidtype */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .type = &types[5], /* chartype */
- .size = 8,
- .align = 8,
- },
- { /* 2 = booltype */
- .op = INT,
- .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_BOOL,
- },
- { /* 3 = schartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_SCHAR,
- },
- { /* 4 = uchartype */
- .op = INT,
- .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_UCHAR,
- },
- { /* 5 = chartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_CHAR,
- },
- { /* 6 = ushortype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 2,
- .n.rank = RANK_USHORT,
- },
- { /* 7 = shortype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 2,
- .n.rank = RANK_SHORT,
- },
- { /* 8 = uinttype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_UINT,
- },
- { /* 9 = inttype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 4,
- .n.rank = RANK_INT,
- },
- { /* 10 = longtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LONG,
- },
- { /* 11 = ulongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_ULONG,
- },
- { /* 12 = ullongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_ULLONG,
- },
- { /* 13 = llongtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LLONG,
- },
- { /* 14 = floattype */
- .op = FLOAT,
- .letter = L_FLOAT,
- .prop = TDEFINED | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_FLOAT,
- },
- { /* 15 = doubletype */
- .op = FLOAT,
- .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_DOUBLE,
- },
- { /* 16 = ldoubletype */
- .op = FLOAT,
- .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 16,
- .align = 16,
- .n.rank = RANK_LDOUBLE,
- },
- { /* 17 = sizettype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 8,
- .n.rank = RANK_UINT,
- },
- { /* 18 = ellipsis */
- .op = ELLIPSIS,
- .letter = L_ELLIPSIS,
- .prop = TDEFINED,
- },
- { /* 19 = pdifftype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 8,
- .n.rank = RANK_LONG,
- },
- { /* 20 = va_type */
- .op = STRUCT,
- .letter = L_VA_ARG,
- .prop = TDEFINED,
- .size = 24,
- .align = 8,
- },
-};
-
-Type *voidtype = &types[0], *pvoidtype = &types[1],
- *booltype = &types[2], *schartype = &types[3],
- *uchartype = &types[4], *chartype = &types[5],
- *ushortype = &types[6], *shortype = &types[7],
- *uinttype = &types[8], *inttype = &types[9],
- *longtype = &types[10], *ulongtype = &types[11],
- *ullongtype = &types[12], *llongtype = &types[13],
- *floattype = &types[14], *doubletype = &types[15],
- *ldoubletype = &types[16],
- *sizettype = &types[17], *pdifftype = &types[19],
- *ellipsistype = &types[18], *va_type = &types[20],
- *va_list_type;
-
-static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
- dummy1 = {.u.i = 1, .type = &types[9]};
-Symbol *zero = &dummy0, *one = &dummy1;
-
-void
-iarch(void)
-{
- va_list_type = mktype(va_type, ARY, 1, NULL);
-}
-
-int
-valid_va_list(Type *tp)
-{
- return tp->op == PTR && eqtype(tp->type, va_type, 1);
-}
--- a/cc1/target/arm64-sysv/arch.mk
+++ /dev/null
@@ -1,5 +1,0 @@
-
-OBJ-arm64-sysv= $(OBJ) target/arm64-sysv/arch.o
-
-$(LIBEXEC)/cc1-arm64-sysv: $(OBJ-arm64-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-arm64-sysv) -lscc -o $@
--- a/cc1/target/i386-sysv/arch.c
+++ /dev/null
@@ -1,221 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc1.h"
-
-#define RANK_BOOL 0
-#define RANK_SCHAR 1
-#define RANK_UCHAR 1
-#define RANK_CHAR 1
-#define RANK_SHORT 2
-#define RANK_USHORT 2
-#define RANK_INT 3
-#define RANK_UINT 3
-#define RANK_LONG 4
-#define RANK_ULONG 4
-#define RANK_LLONG 5
-#define RANK_ULLONG 5
-#define RANK_FLOAT 6
-#define RANK_DOUBLE 7
-#define RANK_LDOUBLE 8
-
-/*
- * Initializaion of type pointers were done with
- * a C99 initilizator '... = &(Type) {...', but
- * c compiler in Plan9 gives error with this
- * syntax, so I have switched it to this ugly form
- * I hope I will change it again in the future
- */
-
-static Type types[] = {
- { /* 0 = voidtype */
- .op = VOID,
- .letter = L_VOID,
- },
- { /* 1 = pvoidtype */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .type = &types[5], /* chartype */
- .size = 4,
- .align = 4,
- },
- { /* 2 = booltype */
- .op = INT,
- .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_BOOL,
- },
- { /* 3 = schartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_SCHAR,
- },
- { /* 4 = uchartype */
- .op = INT,
- .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_UCHAR,
- },
- { /* 5 = chartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_CHAR,
- },
- { /* 6 = ushortype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 2,
- .n.rank = RANK_USHORT,
- },
- { /* 7 = shortype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 2,
- .n.rank = RANK_SHORT,
- },
- { /* 8 = uinttype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_UINT,
- },
- { /* 9 = inttype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 4,
- .n.rank = RANK_INT,
- },
- { /* 10 = longtype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 4,
- .n.rank = RANK_LONG,
- },
- { /* 11 = ulongtype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_ULONG,
- },
- { /* 12 = ullongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 4,
- .n.rank = RANK_ULLONG,
- },
- { /* 13 = llongtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 4,
- .n.rank = RANK_LLONG,
- },
- { /* 14 = floattype */
- .op = FLOAT,
- .letter = L_FLOAT,
- .prop = TDEFINED | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_FLOAT,
- },
- { /* 15 = doubletype */
- .op = FLOAT,
- .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 8,
- .align = 4,
- .n.rank = RANK_DOUBLE,
- },
- { /* 16 = ldoubletype */
- .op = FLOAT,
- .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 12,
- .align = 4,
- .n.rank = RANK_LDOUBLE,
- },
- { /* 17 = sizettype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 4,
- .n.rank = RANK_UINT,
- },
- { /* 18 = ellipsis */
- .op = ELLIPSIS,
- .letter = L_ELLIPSIS,
- .prop = TDEFINED,
- },
- { /* 19 = pdifftype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 4,
- .n.rank = RANK_INT,
- },
- { /* 20 = va_list_type */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .size = 4,
- .align = 4,
- },
-};
-
-
-Type *voidtype = &types[0], *pvoidtype = &types[1],
- *booltype = &types[2], *schartype = &types[3],
- *uchartype = &types[4], *chartype = &types[5],
- *ushortype = &types[6], *shortype = &types[7],
- *uinttype = &types[8], *inttype = &types[9],
- *longtype = &types[10], *ulongtype = &types[11],
- *ullongtype = &types[12], *llongtype = &types[13],
- *floattype = &types[14], *doubletype = &types[15],
- *ldoubletype = &types[16],
- *sizettype = &types[17], *pdifftype = &types[19],
- *ellipsistype = &types[18], *va_list_type = &types[20];
-
-
-
-static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
- dummy1 = {.u.i = 1, .type = &types[9]};
-Symbol *zero = &dummy0, *one = &dummy1;
-
-void
-iarch(void)
-{
-}
-
-int
-valid_va_list(Type *tp)
-{
- return eqtype(tp, va_list_type, 1);
-}
--- a/cc1/target/i386-sysv/arch.mk
+++ /dev/null
@@ -1,5 +1,0 @@
-
-OBJ-i386-sysv= $(OBJ) target/i386-sysv/arch.o
-
-$(LIBEXEC)/cc1-i386-sysv: $(OBJ-i386-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-i386-sysv) -lscc -o $@
--- a/cc1/target/z80-scc/arch.c
+++ /dev/null
@@ -1,219 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/arch/z80/arch.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc1.h"
-
-#define RANK_BOOL 0
-#define RANK_SCHAR 1
-#define RANK_UCHAR 1
-#define RANK_CHAR 1
-#define RANK_SHORT 2
-#define RANK_USHORT 2
-#define RANK_INT 3
-#define RANK_UINT 3
-#define RANK_LONG 4
-#define RANK_ULONG 4
-#define RANK_LLONG 5
-#define RANK_ULLONG 5
-#define RANK_FLOAT 6
-#define RANK_DOUBLE 7
-#define RANK_LDOUBLE 8
-
-/*
- * Initializaion of type pointers were done with
- * a C99 initilizator '... = &(Type) {...', but
- * c compiler in Plan9 gives error with this
- * syntax, so I have switched it to this ugly form
- * I hope I will change it again in the future
- */
-
-static Type types[] = {
- { /* 0 = voidtype */
- .op = VOID,
- .letter = L_VOID,
- },
- { /* 1 = pvoidtype */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .type = &types[5], /* char type */
- .size = 2,
- .align = 2,
- },
- { /* 2 = booltype */
- .op = INT,
- .letter = L_BOOL,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_BOOL,
- },
- { /* 3 = schartype */
- .op = INT,
- .letter = L_INT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_SCHAR,
- },
- { /* 4 = uchartype */
- .op = INT,
- .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 1,
- .align = 1,
- .n.rank = RANK_UCHAR,
- },
- { /* 5 = chartype */
- .op = INT,
- .letter = L_UINT8,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 1,
- .align = 1,
- .n.rank = RANK_CHAR,
- },
- { /* 6 = ushortype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 1,
- .n.rank = RANK_USHORT,
- },
- { /* 7 = shortype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 1,
- .n.rank = RANK_SHORT,
- },
- { /* 8 = uinttype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 1,
- .n.rank = RANK_UINT,
- },
- { /* 9 = inttype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 1,
- .n.rank = RANK_INT,
- },
- { /* 10 = longtype */
- .op = INT,
- .letter = L_INT32,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 4,
- .align = 1,
- .n.rank = RANK_LONG,
- },
- { /* 11 = ulongtype */
- .op = INT,
- .letter = L_UINT32,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 4,
- .align = 1,
- .n.rank = RANK_ULONG,
- },
- { /* 12 = ullongtype */
- .op = INT,
- .letter = L_UINT64,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 8,
- .align = 1,
- .n.rank = RANK_ULLONG,
- },
- { /* 13 = llongtype */
- .op = INT,
- .letter = L_INT64,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 8,
- .align = 1,
- .n.rank = RANK_LLONG,
- },
- { /* 14 = floattype */
- .op = FLOAT,
- .letter = L_FLOAT,
- .prop = TDEFINED | TARITH,
- .size = 4,
- .align = 1,
- .n.rank = RANK_FLOAT,
- },
- { /* 15 = doubletype */
- .op = FLOAT,
- .letter = L_DOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 8,
- .align = 1,
- .n.rank = RANK_DOUBLE,
- },
- { /* 16 = ldoubletype */
- .op = FLOAT,
- .letter = L_LDOUBLE,
- .prop = TDEFINED | TARITH,
- .size = 16,
- .align = 1,
- .n.rank = RANK_LDOUBLE,
- },
- { /* 17 = sizettype */
- .op = INT,
- .letter = L_UINT16,
- .prop = TDEFINED | TINTEGER | TARITH,
- .size = 2,
- .align = 1,
- .n.rank = RANK_UINT,
- },
- { /* 18 = ellipsis */
- .op = ELLIPSIS,
- .letter = L_ELLIPSIS,
- .prop = TDEFINED,
- },
- { /* 7 = pdifftype */
- .op = INT,
- .letter = L_INT16,
- .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
- .size = 2,
- .align = 1,
- .n.rank = RANK_SHORT,
- },
- { /* 20 = va_list_type */
- .op = PTR,
- .letter = L_POINTER,
- .prop = TDEFINED,
- .size = 2,
- .align = 1,
- }
-};
-
-Type *voidtype = &types[0], *pvoidtype = &types[1],
- *booltype = &types[2], *schartype = &types[3],
- *uchartype = &types[4], *chartype = &types[5],
- *ushortype = &types[6], *shortype = &types[7],
- *uinttype = &types[8], *inttype = &types[9],
- *longtype = &types[10], *ulongtype = &types[11],
- *ullongtype = &types[12], *llongtype = &types[13],
- *floattype = &types[14], *doubletype = &types[15],
- *ldoubletype = &types[16],
- *sizettype = &types[17], *pdifftype = &types[19],
- *ellipsistype = &types[18], *va_list_type = &types[20];
-
-
-static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
- dummy1 = {.u.i = 1, .type = &types[9]};
-Symbol *zero = &dummy0, *one = &dummy1;
-
-void
-iarch(void)
-{
-}
-
-int
-valid_va_list(Type *tp)
-{
- return eqtype(tp, va_list_type, 1);
-}
--- a/cc1/target/z80-scc/arch.mk
+++ /dev/null
@@ -1,5 +1,0 @@
-
-OBJ-z80-scc= $(OBJ) target/z80-scc/arch.o
-
-$(LIBEXEC)/cc1-z80-scc: $(OBJ-z80-scc)
- $(CC) $(SCC_LDFLAGS) $(OBJ-z80-scc) -lscc -o $@
--- a/cc1/types.c
+++ /dev/null
@@ -1,438 +1,0 @@
-static char sccsid[] = "@(#) ./cc1/types.c";
-#include <assert.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-#include "cc1.h"
-
-#define NR_TYPE_HASH 16
-#define HASH(t) (((t)->op ^ (uintptr_t) (t)->type>>3) & NR_TYPE_HASH-1)
-
-static Type *typetab[NR_TYPE_HASH], *localtypes;
-
-/* FIXME:
- * Compiler can generate warnings here if the ranges of TINT,
- * TUINT and TFLOAT are smaller than any of the constants in this
- * array. Ignore them if you know that the target types are correct
- */
-static struct limits limits[][4] = {
- {
- { /* 0 = unsigned 1 byte */
- .min.i = 0,
- .max.i = 0xff
- },
- { /* 1 = unsigned 2 bytes */
- .min.i = 0,
- .max.i = 0xffff
- },
- { /* 2 = unsigned 4 bytes */
- .min.i = 0,
- .max.i = 0xffffffff
- },
- { /* 3 = unsigned 8 bytes */
- .min.i = 0,
- .max.i = 0xffffffffffffffff
- }
- },
- {
- { /* 0 = signed 1 byte */
- .min.i = -0x7f-1,
- .max.i = 0x7f
- },
- { /* 1 = signed 2 byte */
- .min.i = -0x7fff-1,
- .max.i = 0x7fff
- },
- { /* 2 = signed 4 byte */
- .min.i = -0x7fffffff-1,
- .max.i = 0x7fffffff
- },
- { /* 3 = signed 8 byte */
- .min.i = -0x7fffffffffffffff-1,
- .max.i = 0x7fffffffffffffff,
- }
- },
- {
- {
- /* 0 = float 4 bytes */
- .min.f = -1,
- .max.f = 2
- },
- {
- /* 1 = float 8 bytes */
- .min.f = -1,
- .max.f = 2,
- },
- {
- /* 2 = float 16 bytes */
- .min.f = -1,
- .max.f = 2,
- }
- }
-};
-
-struct limits *
-getlimits(Type *tp)
-{
- int ntable, ntype;
-
- switch (tp->op) {
- case ENUM:
- case INT:
- ntable = ((tp->prop & TSIGNED) != 0);
- switch (tp->size) {
- case 1: ntype = 0; break;
- case 2: ntype = 1; break;
- case 4: ntype = 2; break;
- case 8: ntype = 3; break;
- }
- break;
- case FLOAT:
- ntable = 2;
- switch (tp->size) {
- case 4: ntype = 0; break;
- case 8: ntype = 1; break;
- case 16: ntype = 2; break;
- }
- break;
- default:
- abort();
- }
-
- return &limits[ntable][ntype];
-}
-
-Type *
-ctype(int type, int sign, int size)
-{
- switch (type) {
- case CHAR:
- if (size)
- goto invalid_type;
- switch (sign) {
- case 0:
- return chartype;
- case SIGNED:
- return schartype;
- case UNSIGNED:
- return uchartype;
- }
- break;
- case VA_LIST:
- if (size || sign)
- goto invalid_type;
- return va_list_type;
- case VOID:
- if (size || sign)
- goto invalid_type;
- return voidtype;
- case BOOL:
- if (size || sign)
- goto invalid_type;
- return booltype;
- case 0:
- case INT:
- switch (size) {
- case 0:
- return (sign == UNSIGNED) ? uinttype : inttype;
- case SHORT:
- return (sign == UNSIGNED) ? ushortype : shortype;
- case LONG:
- return (sign == UNSIGNED) ? ulongtype : longtype;
- case LLONG:
- return (sign == UNSIGNED) ? ullongtype : llongtype;
- }
- break;
- case DOUBLE:
- if (size == LLONG)
- goto invalid_type;
- if (size == LONG)
- size = LLONG;
- else
- size = LONG;
- goto floating;
- case FLOAT:
- if (size == LLONG)
- goto invalid_type;
- floating:
- if (sign)
- goto invalid_type;
- switch (size) {
- case 0:
- return floattype;
- case LONG:
- return doubletype;
- case LLONG:
- return ldoubletype;
- }
- break;
- }
-
-invalid_type:
- error("invalid type specification");
-}
-
-void
-typesize(Type *tp)
-{
- Symbol **sp;
- Type *type;
- unsigned long size, offset;
- int align, a;
- TINT n;
-
- switch (tp->op) {
- case ARY:
- /* FIXME: Control overflow */
- tp->size = tp->n.elem * tp->type->size;
- tp->align = tp->type->align;
- return;
- case PTR:
- tp->size = pvoidtype->size;
- tp->align = pvoidtype->align;
- return;
- case STRUCT:
- case UNION:
- /* FIXME: Control overflow */
- /*
- * The alignment of the struct/union is
- * he alignment of the largest included type.
- * The size of an union is the size of the largest
- * field, and the size of a struct is the sum
- * of the size of every field plus padding bits.
- */
- offset = align = size = 0;
- n = tp->n.elem;
- for (sp = tp->p.fields; n--; ++sp) {
- (*sp)->u.i = offset;
- type = (*sp)->type;
- a = type->align;
- if (a > align)
- align = a;
- if (tp->op == STRUCT) {
- if (--a != 0)
- size = (size + a) & ~a;
- size += type->size;
- offset = size;
- } else {
- if (type->size > size)
- size = type->size;
- }
- }
-
- tp->align = align;
- /*
- * We have to add the padding bits to
- * ensure next struct in an array is well
- * alignment.
- */
- if (tp->op == STRUCT && align-- > 1)
- size += size+align & ~align;
- tp->size = size;
- return;
- case ENUM:
- tp->size = inttype->size;
- tp->align = inttype->align;
- return;
- case FTN:
- return;
- default:
- abort();
- }
-}
-
-Type *
-deftype(Type *tp)
-{
- tp->prop |= TDEFINED;
- typesize(tp);
- emit(OTYP, tp);
- return tp;
-}
-
-static Type *
-newtype(Type *base)
-{
- Type *tp;
- size_t siz;
-
- tp = xmalloc(sizeof(*tp));
- *tp = *base;
- tp->id = newid();
-
- if (tp->op == FTN) {
- siz = tp->n.elem * sizeof(Type *);
- tp->p.pars = memcpy(xmalloc(siz), tp->p.pars, siz);
- }
-
- if (curfun) {
- /* it is a type defined in the body of a function */
- tp->next = localtypes;
- localtypes = tp;
- }
- if (tp->prop & TDEFINED)
- deftype(tp);
- return tp;
-}
-
-Type *
-mktype(Type *tp, int op, TINT nelem, Type *pars[])
-{
- Type **tbl, type;
- Type *bp;
-
- if (op == PTR && tp == voidtype)
- return pvoidtype;
-
- memset(&type, 0, sizeof(type));
- type.type = tp;
- type.op = op;
- type.p.pars = pars;
- type.n.elem = nelem;
-
- switch (op) {
- case ARY:
- if (tp == voidtype) {
- errorp("declaration of array of voids type");
- tp = inttype;
- }
- type.letter = L_ARRAY;
- if (nelem != 0)
- type.prop |= TDEFINED;
- break;
- case KRFTN:
- type.prop |= TDEFINED | TK_R;
- type.op = FTN;
- type.letter = L_FUNCTION;
- break;
- case FTN:
- if (nelem > 0 && pars[nelem-1] == ellipsistype)
- type.prop |= TELLIPSIS;
- type.letter = L_FUNCTION;
- type.prop |= TDEFINED;
- break;
- case PTR:
- type.letter = L_POINTER;
- type.prop |= TDEFINED;
- break;
- case ENUM:
- type.letter = inttype->letter;
- type.prop |= TINTEGER | TARITH;
- type.n.rank = inttype->n.rank;
- goto create_type;
- case STRUCT:
- type.letter = L_STRUCT;
- type.prop |= TAGGREG;
- goto create_type;
- case UNION:
- type.letter = L_UNION;
- type.prop |= TAGGREG;
- create_type:
- return newtype(&type);
- default:
- abort();
- }
-
- tbl = &typetab[HASH(&type)];
- for (bp = *tbl; bp; bp = bp->h_next) {
- if (eqtype(bp, &type, 0))
- return bp;
- }
-
- bp = newtype(&type);
- bp->h_next = *tbl;
- *tbl = bp;
-
- return bp;
-}
-
-int
-eqtype(Type *tp1, Type *tp2, int equiv)
-{
- TINT n;
- Type **p1, **p2;
- Symbol **s1, **s2;
-
- if (tp1 == tp2)
- return 1;
- if (!tp1 || !tp2)
- return 0;
- if (tp1->op != tp2->op)
- return 0;
-
- switch (tp1->op) {
- case UNION:
- case STRUCT:
- if (tp1->letter != tp2->letter)
- return 0;
- if (tp1->tag->name || tp2->tag->name)
- return tp1->tag == tp2->tag;
- if (tp1->n.elem != tp2->n.elem)
- return 0;
- s1 = tp1->p.fields, s2 = tp2->p.fields;
- for (n = tp1->n.elem; n > 0; --n, ++s1, ++s2) {
- if (strcmp((*s1)->name, (*s2)->name))
- return 0;
- if (!eqtype((*s1)->type, (*s2)->type, equiv))
- return 0;
- }
- return 1;
- case FTN:
- if (tp1->n.elem != tp2->n.elem)
- return 0;
- p1 = tp1->p.pars, p2 = tp2->p.pars;
- for (n = tp1->n.elem; n > 0; --n) {
- if (!eqtype(*p1++, *p2++, equiv))
- return 0;
- }
- goto check_base;
- case ARY:
- if (equiv && (tp1->n.elem == 0 || tp2->n.elem == 0))
- goto check_base;
- if (tp1->n.elem != tp2->n.elem)
- return 0;
- case PTR:
- check_base:
- return eqtype(tp1->type, tp2->type, equiv);
- case VOID:
- case ENUM:
- return 0;
- case INT:
- case FLOAT:
- return tp1->letter == tp2->letter;
- default:
- abort();
- }
-}
-
-void
-flushtypes(void)
-{
- Type *tp, *next, **h;
-
- for (tp = localtypes; tp; tp = next) {
- next = tp->next;
- switch (tp->op) {
- default:
- /*
- * All the local types are linked after
- * global types, and since we are
- * unlinking them in the inverse order
- * we do know that tp is always the head
- * of the collision list
- */
- h = &typetab[HASH(tp)];
- assert(*h == tp);
- *h = tp->h_next;
- case STRUCT:
- case UNION:
- case ENUM:
- free(tp);
- break;
- }
- }
- localtypes = NULL;
-}
--- a/cc2/Makefile
+++ /dev/null
@@ -1,35 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-MORECFLAGS = -I$(PROJECTDIR)/inc/$(STD)
-
-OBJ = main.o parser.o peep.o symbol.o node.o code.o optm.o
-
-TARGETS = $(LIBEXEC)/cc2-amd64-sysv $(LIBEXEC)/cc2-i386-sysv \
- $(LIBEXEC)/cc2-qbe_amd64-sysv $(LIBEXEC)/cc2-z80-scc
-
-all: $(TARGETS)
-
-$(TARGETS): $(LIBDIR)/libscc.a
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-error.h: cc2.h
- rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT ;\
- awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@
-
-clean:
- rm -f *.o error.h
- rm -f target/*/*.o
- rm -f $(TARGETS)
-
-include target/amd64-sysv/target.mk
-include target/i386-sysv/target.mk
-include target/qbe_amd64-sysv/target.mk
-include target/qbe_arm64-sysv/target.mk
-include target/z80-scc/target.mk
-include deps.mk
--- a/cc2/cc2.h
+++ /dev/null
@@ -1,256 +1,0 @@
-enum iflags {
- BBENTRY = 1, /* basic block entry */
-};
-
-enum tflags {
- SIGNF = 1 << 0, /* Signed type */
- INTF = 1 << 1, /* integer type */
- FLOATF = 1 << 2, /* float type */
- STRF = 1 << 3, /* string */
- AGGRF = 1 << 4, /* aggregate */
- FUNF = 1 << 5, /* function */
- PARF = 1 << 6, /* parameter */
- INITF = 1 << 7, /* initializer flag */
- ELLIPS = 1 << 8, /* vararg function */
-};
-
-enum sclass {
- SAUTO = 'A',
- SREG = 'R',
- SLABEL = 'L',
- SINDEX = 'I',
- STMP = 'N',
- SGLOB = 'G',
- SEXTRN = 'X',
- SPRIV = 'Y',
- SLOCAL = 'T',
- SMEMB = 'M',
- SCONST = '#',
- STRING = '"',
- SNONE = 0 /* cc2 relies on SNONE being 0 in nextpc() */
-};
-
-enum types {
- ELLIPSIS = 'E',
- INT8 = 'C',
- INT16 = 'I',
- INT32 = 'W',
- INT64 = 'Q',
- UINT8 = 'K',
- UINT16 = 'N',
- UINT32 = 'Z',
- UINT64 = 'O',
- POINTER = 'P',
- FUNCTION = 'F',
- VECTOR = 'V',
- UNION = 'U',
- STRUCT = 'S',
- BOOL = 'B',
- FLOAT = 'J',
- DOUBLE = 'D',
- LDOUBLE = 'H',
- VOID = '0'
-};
-
-enum op {
- /* kind of operand */
- /* operands */
- OMEM = 'M',
- OTMP = 'N',
- OAUTO = 'A',
- OREG = 'R',
- OCONST = '#',
- OSTRING = '"',
- OLOAD = 'D',
- OLABEL = 'L',
- OADD = '+',
- OSUB = '-',
- OMUL = '*',
- OMOD = '%',
- ODIV = '/',
- OSHL = 'l',
- OSHR = 'r',
- OLT = '<',
- OGT = '>',
- OLE = '[',
- OGE = ']',
- OEQ = '=',
- ONE = '!',
- OBAND = '&',
- OBOR = '|',
- OBXOR = '^',
- OCPL = '~',
- OASSIG = ':',
- OSNEG = '_',
- OCALL = 'c',
- OCALLE = 'z',
- OPAR = 'p',
- OFIELD = '.',
- OCOMMA = ',',
- OASK = '?',
- OCOLON = ' ',
- OADDR = '\'',
- OAND = 'a',
- OOR = 'o',
- ONEG = 'n',
- OPTR = '@',
- OCAST = 'g',
- OINC = 'i',
- ODEC = 'd',
- OBUILTIN = 'm',
- /*statements */
- ONOP = 'q',
- OJMP = 'j',
- OBRANCH = 'y',
- ORET = 'h',
- OBLOOP = 'b',
- OELOOP = 'e',
- OCASE = 'v',
- ODEFAULT = 'f',
- OBSWITCH = 's',
- OESWITCH = 't',
- OBFUN = 'x',
- OEFUN = 'k',
-};
-
-enum builtins {
- BVA_START = 's',
- BVA_END = 'e',
- BVA_ARG = 'a',
- BVA_COPY = 'c',
-};
-
-enum nerrors {
- EEOFFUN, /* EOF while parsing function */
- ENLABEL, /* label without statement */
- EIDOVER, /* identifier overflow */
- EOUTPAR, /* out pf params */
- ESYNTAX, /* syntax error */
- ESTACKA, /* stack unaligned */
- ESTACKO, /* stack overflow */
- ESTACKU, /* stack underflow */
- ELNLINE, /* line too long */
- ELNBLNE, /* line without new line */
- EFERROR, /* error reading from file:%s */
- EBADID, /* incorrect symbol id */
- EWTACKO, /* switch stack overflow */
- EWTACKU, /* switch stack underflow */
- ENOSWTC, /* Out of switch statement */
- EBBUILT, /* Unknown builtin */
- ENUMERR
-};
-
-typedef struct node Node;
-typedef struct type Type;
-typedef struct symbol Symbol;
-typedef struct addr Addr;
-typedef struct inst Inst;
-
-struct type {
- unsigned long size;
- unsigned long align;
- short flags;
-};
-
-struct symbol {
- Type type;
- Type rtype;
- unsigned short id;
- unsigned short numid;
- char *name;
- char kind;
- union {
- unsigned long off;
- Node *stmt;
- Inst *inst;
- } u;
- Symbol *next;
- Symbol *h_next;
-};
-
-struct node {
- char op;
- Type type;
- char complex;
- char address;
- unsigned char flags;
- union {
- TUINT i;
- TFLOAT f;
- char reg;
- char *s;
- Symbol *sym;
- char subop;
- } u;
- Symbol *label;
- Node *left, *right;
- Node *next, *prev;
-};
-
-struct addr {
- char kind;
- union {
- char reg;
- TUINT i;
- Symbol *sym;
- } u;
-};
-
-struct inst {
- unsigned char op;
- unsigned char flags;
- Symbol *label;
- Inst *next, *prev;
- Addr from1, from2, to;
-};
-
-/* main.c */
-extern void error(unsigned nerror, ...);
-
-/* parse.c */
-extern void parse(void);
-
-/* optm.c */
-extern Node *optm_dep(Node *np), *optm_ind(Node *np);
-
-/* cgen.c */
-extern Node *sethi(Node *np);
-extern Node *cgen(Node *np);
-
-/* peep.c */
-extern void peephole(void);
-
-/* code.c */
-extern void data(Node *np);
-extern void writeout(void), endinit(void), newfun(void);
-extern void code(int op, Node *to, Node *from1, Node *from2);
-extern void defvar(Symbol *), defpar(Symbol *), defglobal(Symbol *);
-extern void setlabel(Symbol *sym), getbblocks(void);
-extern Node *label2node(Node *np, Symbol *sym);
-extern Node *constnode(Node *np, TUINT n, Type *tp);
-extern Symbol *newlabel(void);
-
-/* node.c */
-#define SETCUR 1
-#define KEEPCUR 0
-extern void apply(Node *(*fun)(Node *));
-extern void cleannodes(void);
-extern void delnode(Node *np);
-extern void deltree(Node *np);
-extern void prtree(Node *np), prforest(char *msg);
-extern Node *node(int op);
-extern Node *addstmt(Node *np, int flags);
-extern Node *delstmt(void);
-extern Node *nextstmt(void);
-
-/* symbol.c */
-#define TMPSYM 0
-extern Symbol *getsym(unsigned id);
-extern void popctx(void);
-extern void pushctx(void);
-extern void freesym(Symbol *sym);
-
-/* globals */
-extern Symbol *curfun;
-extern Symbol *locals;
-extern Inst *pc, *prog;
--- a/cc2/code.c
+++ /dev/null
@@ -1,133 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/code.c";
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "cc2.h"
-
-Inst *pc, *prog;
-
-static void
-nextpc(void)
-{
- Inst *new;
-
- new = xcalloc(1, sizeof(*new)); /* TODO: create an arena */
-
- if (!pc) {
- prog = new;
- } else {
- new->next = pc->next;
- pc->next = new;
- }
-
- /* SNONE being 0, calloc initialized {from1,from2,to}.kind for us */
- new->prev = pc;
- pc = new;
-}
-
-static void
-addr(Node *np, Addr *addr)
-{
- Symbol *sym;
-
- switch (np->op) {
- case OREG:
- /* TODO:
- * At this moment this op is used also for register variables
- */
- addr->kind = SREG;
- addr->u.reg = np->u.reg;
- break;
- case OCONST:
- addr->kind = SCONST;
- /* TODO: Add support for more type of constants */
- addr->u.i = np->u.i;
- break;
- case OTMP:
- case OLABEL:
- case OAUTO:
- case OMEM:
- sym = np->u.sym;
- addr->kind = sym->kind;
- addr->u.sym = sym;
- break;
- default:
- abort();
- }
-}
-
-Symbol *
-newlabel(void)
-{
- Symbol *sym = getsym(TMPSYM);
-
- sym->kind = SLABEL;
- return sym;
-}
-
-Node *
-label2node(Node *np, Symbol *sym)
-{
- if(!sym)
- sym = newlabel();
- if (!np)
- np = node(OLABEL);
- np->op = OLABEL;
- np->u.sym = sym;
-
- return np;
-}
-
-Node *
-constnode(Node *np, TUINT n, Type *tp)
-{
- if (!np)
- np = node(OCONST);
- np->op = OCONST;
- np->left = NULL;
- np->right = NULL;
- np->type = *tp;
- np->u.i = n;
- return np;
-}
-
-void
-setlabel(Symbol *sym)
-{
- if (!sym)
- return;
- code(0, NULL, NULL, NULL);
- pc->label = sym;
- sym->u.inst = pc;
-}
-
-void
-code(int op, Node *to, Node *from1, Node *from2)
-{
- nextpc();
- if (from1)
- addr(from1, &pc->from1);
- if (from2)
- addr(from2, &pc->from2);
- if (to)
- addr(to, &pc->to);
- pc->op = op;
-}
-
-void
-delcode(void)
-{
- Inst *prev = pc->prev, *next = pc->next;
-
- free(pc);
- if (!prev) {
- pc = next;
- prog = NULL;
- } else {
- pc = prev;
- prev->next = next;
- if (next)
- next->prev = prev;
- }
-}
--- a/cc2/deps.mk
+++ /dev/null
@@ -1,61 +1,0 @@
-parser.c: $(PROJECTDIR)/inc/$(STD)/cstd.h
-target/amd64-sysv/code.o: $(INCLUDE)/$(STD)/cstd.h
-target/i386-sysv/code.o: $(INCLUDE)/$(STD)/cstd.h
-target/qbe/cgen.o: $(INCLUDE)/$(STD)/cstd.h
-target/z80-scc/code.o: $(INCLUDE)/$(STD)/cstd.h
-
-#deps
-code.o: ../inc/scc.h
-code.o: cc2.h
-main.o: ../inc/arg.h
-main.o: ../inc/scc.h
-main.o: cc2.h
-main.o: error.h
-node.o: ../inc/scc.h
-node.o: cc2.h
-optm.o: ../inc/scc.h
-optm.o: cc2.h
-parser.o: ../inc/scc.h
-parser.o: cc2.h
-peep.o: ../inc/scc.h
-peep.o: cc2.h
-symbol.o: ../inc/scc.h
-symbol.o: cc2.h
-target/amd64-sysv/cgen.o: target/amd64-sysv/../../../inc/scc.h
-target/amd64-sysv/cgen.o: target/amd64-sysv/../../cc2.h
-target/amd64-sysv/cgen.o: target/amd64-sysv/arch.h
-target/amd64-sysv/code.o: target/amd64-sysv/../../../inc/scc.h
-target/amd64-sysv/code.o: target/amd64-sysv/../../cc2.h
-target/amd64-sysv/code.o: target/amd64-sysv/arch.h
-target/amd64-sysv/optm.o: target/amd64-sysv/../../../inc/scc.h
-target/amd64-sysv/optm.o: target/amd64-sysv/../../cc2.h
-target/amd64-sysv/types.o: target/amd64-sysv/../../../inc/scc.h
-target/amd64-sysv/types.o: target/amd64-sysv/../../cc2.h
-target/i386-sysv/cgen.o: target/i386-sysv/../../../inc/scc.h
-target/i386-sysv/cgen.o: target/i386-sysv/../../cc2.h
-target/i386-sysv/cgen.o: target/i386-sysv/arch.h
-target/i386-sysv/code.o: target/i386-sysv/../../../inc/scc.h
-target/i386-sysv/code.o: target/i386-sysv/../../cc2.h
-target/i386-sysv/code.o: target/i386-sysv/arch.h
-target/i386-sysv/optm.o: target/i386-sysv/../../../inc/scc.h
-target/i386-sysv/optm.o: target/i386-sysv/../../cc2.h
-target/i386-sysv/types.o: target/i386-sysv/../../../inc/scc.h
-target/i386-sysv/types.o: target/i386-sysv/../../cc2.h
-target/qbe/cgen.o: target/qbe/../../../inc/scc.h
-target/qbe/cgen.o: target/qbe/../../cc2.h
-target/qbe/cgen.o: target/qbe/arch.h
-target/qbe/code.o: target/qbe/../../../inc/scc.h
-target/qbe/code.o: target/qbe/../../cc2.h
-target/qbe/code.o: target/qbe/arch.h
-target/qbe/optm.o: target/qbe/../../../inc/scc.h
-target/qbe/optm.o: target/qbe/../../cc2.h
-target/z80-scc/cgen.o: target/z80-scc/../../../inc/scc.h
-target/z80-scc/cgen.o: target/z80-scc/../../cc2.h
-target/z80-scc/cgen.o: target/z80-scc/arch.h
-target/z80-scc/code.o: target/z80-scc/../../../inc/scc.h
-target/z80-scc/code.o: target/z80-scc/../../cc2.h
-target/z80-scc/code.o: target/z80-scc/arch.h
-target/z80-scc/optm.o: target/z80-scc/../../../inc/scc.h
-target/z80-scc/optm.o: target/z80-scc/../../cc2.h
-target/z80-scc/types.o: target/z80-scc/../../../inc/scc.h
-target/z80-scc/types.o: target/z80-scc/../../cc2.h
--- a/cc2/generror.awk
+++ /dev/null
@@ -1,9 +1,0 @@
-/^enum nerrors \{/ {print "char *errlist[] = {"; inhome = 1}
-
-inhome && /E[A-Z]*, / {sub(/,/, "", $1)
- printf("\t[%s] = \"", $1)
- for (i = 3; i <= NF-1; ++i)
- printf("%s%s", $i, (i == NF-1) ? "\"" : " ")
- print ","}
-
-inhome && /^}/ {print "};" ; inhome = 0}
--- a/cc2/main.c
+++ /dev/null
@@ -1,70 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/main.c";
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/arg.h"
-#include "../inc/scc.h"
-#include "cc2.h"
-#include "error.h"
-
-char *argv0;
-
-void
-error(unsigned nerror, ...)
-{
- va_list va;
- va_start(va, nerror);
- vfprintf(stderr, errlist[nerror], va);
- va_end(va);
- putc('\n', stderr);
- exit(1);
-}
-
-static int
-moreinput(void)
-{
- int c;
-
-repeat:
- if (feof(stdin))
- return 0;
- if ((c = getchar()) == '\n' || c == EOF)
- goto repeat;
- ungetc(c, stdin);
- return 1;
-}
-
-static void
-usage(void)
-{
- fputs("usage: cc2 [irfile]\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- ARGBEGIN {
- default:
- usage();
- } ARGEND
-
- if (argv[0] && !freopen(argv[0], "r", stdin))
- die("cc2: %s: %s", argv[0], strerror(errno));
-
- while (moreinput()) {
- parse();
- apply(optm_ind);
- apply(optm_dep);
- apply(sethi);
- apply(cgen);
- getbblocks(); /* TODO: run apply over asm ins too */
- peephole();
- writeout();
- }
- return 0;
-}
--- a/cc2/node.c
+++ /dev/null
@@ -1,142 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/node.c";
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-
-#include "cc2.h"
-
-#define NNODES 32
-
-Node *curstmt;
-Symbol *curfun;
-
-static Alloc *arena;
-
-
-Node *
-node(int op)
-{
- struct arena *ap;
- Node *np;
-
- if (!arena)
- arena = alloc(sizeof(Node), NNODES);
- np = memset(new(arena), 0, sizeof(*np));
- np->op = op;
-
- return np;
-}
-
-#ifndef NDEBUG
-#include <stdio.h>
-
-static void
-prnode(Node *np)
-{
- if (np->left)
- prnode(np->left);
- if (np->right)
- prnode(np->right);
- fprintf(stderr, "\t%c%lu", np->op, np->type.size);
-}
-
-void
-prtree(Node *np)
-{
- prnode(np);
- putc('\n', stderr);
-}
-
-void
-prforest(char *msg)
-{
- Node *np;
-
- if (!curfun)
- return;
-
- fprintf(stderr, "%s {\n", msg);
- for (np = curfun->u.stmt; np; np = np->next)
- prtree(np);
- fputs("}\n", stderr);
-}
-#endif
-
-Node *
-addstmt(Node *np, int flag)
-{
- if (curstmt)
- np->next = curstmt->next;
- np->prev = curstmt;
-
- if (!curfun->u.stmt)
- curfun->u.stmt = np;
- else
- curstmt->next = np;
-
- if (flag == SETCUR)
- curstmt = np;
-
- return np;
-}
-
-Node *
-delstmt(void)
-{
- Node *next, *prev;
-
- next = curstmt->next;
- prev = curstmt->prev;
- if (next)
- next->prev = prev;
- if (prev)
- prev->next = next;
- else
- curfun->u.stmt = next;
- deltree(curstmt);
-
- return curstmt = next;
-}
-
-Node *
-nextstmt(void)
-{
- return curstmt = curstmt->next;
-}
-
-void
-delnode(Node *np)
-{
- delete(arena, np);
-}
-
-void
-deltree(Node *np)
-{
- if (!np)
- return;
- deltree(np->left);
- deltree(np->right);
- delnode(np);
-}
-
-void
-cleannodes(void)
-{
- if (arena) {
- dealloc(arena);
- arena = NULL;
- }
- curstmt = NULL;
-}
-
-void
-apply(Node *(*fun)(Node *))
-{
- if (!curfun)
- return;
- curstmt = curfun->u.stmt;
- while (curstmt)
- (*fun)(curstmt) ? nextstmt() : delstmt();
-}
--- a/cc2/optm.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#include "../inc/scc.h"
-#include "cc2.h"
-
-Node *
-optm_ind(Node *np)
-{
- return np;
-}
-
--- a/cc2/parser.c
+++ /dev/null
@@ -1,722 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/parser.c";
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "../inc/scc.h"
-
-#include "cc2.h"
-
-#define STACKSIZ 50
-
-extern Type int8type, int16type, int32type, int64type,
- uint8type, uint16type, uint32type, uint64type,
- float32type, float64type, float80type,
- booltype,
- ptrtype,
- voidtype,
- arg_type;
-
-Type funetype = {
- .flags = FUNF | ELLIPS
-};
-
-Type funtype = {
- .flags = FUNF
-};
-
-union tokenop {
- void *arg;
- unsigned op;
-};
-
-struct swtch {
- int nr;
- Node *first;
- Node *last;
-};
-
-static struct swtch swtbl[NR_BLOCK], *swp = swtbl;
-static Symbol *lastfun;
-
-typedef void parsefun(char *, union tokenop);
-static parsefun type, symbol, getname, unary, binary, ternary, call,
- constant, composed, binit, einit,
- jump, oreturn, loop, assign,
- ocase, bswitch, eswitch, builtin;
-
-typedef void evalfun(void);
-static evalfun vardecl, beginfun, endfun, endpars, stmt,
- array, aggregate, flddecl, labeldcl;
-
-static struct decoc {
- void (*eval)(void);
- void (*parse)(char *token, union tokenop);
- union tokenop u;
-} optbl[] = { /* eval parse args */
- ['A'] = { vardecl, symbol, .u.op = SAUTO<<8 | OAUTO},
- ['R'] = { vardecl, symbol, .u.op = SREG<<8 | OREG},
- ['G'] = { vardecl, symbol, .u.op = SGLOB<<8 | OMEM},
- ['X'] = { vardecl, symbol, .u.op = SEXTRN<<8 | OMEM},
- ['Y'] = { vardecl, symbol, .u.op = SPRIV<<8 | OMEM},
- ['T'] = { vardecl, symbol, .u.op = SLOCAL<<8 | OMEM},
- ['M'] = { flddecl, symbol, .u.op = SMEMB<<8 | OMEM},
- ['L'] = { labeldcl, symbol, .u.op = SLABEL<<8 | OLABEL},
-
- ['C'] = { NULL, type, .u.arg = &int8type},
- ['I'] = { NULL, type, .u.arg = &int16type},
- ['W'] = { NULL, type, .u.arg = &int32type},
- ['Q'] = { NULL, type, .u.arg = &int64type},
- ['K'] = { NULL, type, .u.arg = &uint8type},
- ['N'] = { NULL, type, .u.arg = &uint16type},
- ['Z'] = { NULL, type, .u.arg = &uint32type},
- ['O'] = { NULL, type, .u.arg = &uint64type},
- ['J'] = { NULL, type, .u.arg = &float32type},
- ['D'] = { NULL, type, .u.arg = &float64type},
- ['H'] = { NULL, type, .u.arg = &float80type},
- ['0'] = { NULL, type, .u.arg = &voidtype},
- ['B'] = { NULL, type, .u.arg = &booltype},
- ['P'] = { NULL, type, .u.arg = &ptrtype},
- ['E'] = { NULL, type, .u.arg = &funetype},
- ['1'] = { NULL, type, .u.arg = &arg_type},
-
- ['F'] = { NULL, type, .u.arg = &funtype},
- ['V'] = { array,composed, 0},
- ['U'] = {aggregate,composed, 0},
- ['S'] = {aggregate,composed, 0},
-
- ['"'] = { NULL, getname, 0},
- ['{'] = { beginfun, NULL, 0},
- ['}'] = { endfun, NULL, 0},
- ['('] = { NULL, binit, 0},
- [')'] = { NULL, einit, 0},
- ['\\'] = { endpars, NULL, 0},
- ['\t'] = { stmt, NULL, 0},
-
- ['~'] = { NULL, unary, .u.op = OCPL},
- ['_'] = { NULL, unary, .u.op = OSNEG},
- ['\''] = { NULL, unary, .u.op = OADDR},
- ['@'] = { NULL, unary, .u.op = OPTR},
- ['g'] = { NULL, unary, .u.op = OCAST},
- ['p'] = { NULL, unary, .u.op = OPAR},
- ['n'] = { NULL, unary, .u.op = ONEG},
-
- ['a'] = { NULL, binary, .u.op = OAND},
- ['o'] = { NULL, binary, .u.op = OOR},
- ['.'] = { NULL, binary, .u.op = OFIELD},
- ['+'] = { NULL, binary, .u.op = OADD},
- ['-'] = { NULL, binary, .u.op = OSUB},
- ['*'] = { NULL, binary, .u.op = OMUL},
- ['%'] = { NULL, binary, .u.op = OMOD},
- ['/'] = { NULL, binary, .u.op = ODIV},
- ['l'] = { NULL, binary, .u.op = OSHL},
- ['r'] = { NULL, binary, .u.op = OSHR},
- ['<'] = { NULL, binary, .u.op = OLT},
- ['>'] = { NULL, binary, .u.op = OGT},
- ['['] = { NULL, binary, .u.op = OLE},
- [']'] = { NULL, binary, .u.op = OGE},
- ['='] = { NULL, binary, .u.op = OEQ},
- ['!'] = { NULL, binary, .u.op = ONE},
- ['&'] = { NULL, binary, .u.op = OBAND},
- ['|'] = { NULL, binary, .u.op = OBOR},
- ['^'] = { NULL, binary, .u.op = OBXOR},
- [','] = { NULL, binary, .u.op = OCOMMA},
- ['m'] = { NULL, builtin,.u.op = OBUILTIN},
-
- [':'] = { NULL, assign, .u.op = OASSIG},
- ['?'] = { NULL, ternary, .u.op = OASK},
- ['c'] = { NULL, call, .u.op = OCALL},
- ['z'] = { NULL, call, .u.op = OCALLE},
-
- ['#'] = { NULL,constant, .u.op = OCONST},
-
- ['j'] = { NULL, jump, .u.op = OJMP},
- ['y'] = { NULL, jump, .u.op = OBRANCH},
- ['h'] = { NULL, oreturn, .u.op = ORET},
- ['i'] = { NULL, NULL, .u.op = OINC},
- ['d'] = { NULL, NULL, .u.op = ODEC},
-
- ['b'] = { NULL, loop, .u.op = OBLOOP},
- ['e'] = { NULL, loop, .u.op = OELOOP},
-
- ['v'] = { NULL, ocase, .u.op = OCASE},
- ['f'] = { NULL, ocase, .u.op = ODEFAULT},
- ['t'] = { NULL, eswitch, .u.op = OESWITCH},
- ['s'] = { NULL, bswitch, .u.op = OBSWITCH},
-};
-
-static int sclass, inpars, ininit, endf, lineno;
-static void *stack[STACKSIZ], **sp = stack;
-
-static Node *
-push(void *elem)
-{
- if (sp == &stack[STACKSIZ])
- error(ESTACKO);
- return *sp++ = elem;
-}
-
-static void *
-pop(void)
-{
- if (sp == stack)
- error(ESTACKU);
- return *--sp;
-}
-
-static int
-empty(void)
-{
- return sp == stack;
-}
-
-static void
-type(char *token, union tokenop u)
-{
- push(u.arg);
-}
-
-static void
-composed(char *token, union tokenop u)
-{
- Symbol *sym;
-
- sym = getsym(atoi(token+1));
- push(&sym->type);
-}
-
-static void
-getname(char *t, union tokenop u)
-{
- push((*++t) ? xstrdup(t) : NULL);
-}
-
-static void
-symbol(char *token, union tokenop u)
-{
- Node *np = node(u.op & 0xFF);
- Symbol *sym = getsym(atoi(token+1));
-
- sclass = u.op >> 8;
- np->u.sym = sym;
- np->type = sym->type;
- push(np);
-}
-
-static Type *
-gettype(char *token)
-{
- struct decoc *dp;
-
- dp = &optbl[*token];
- if (!dp->parse)
- error(ESYNTAX);
- (*dp->parse)(token, dp->u);
- return pop();
-}
-
-static void
-constant(char *token, union tokenop u)
-{
- static char letters[] = "0123456789ABCDEF";
- Node *np;
- TUINT v;
- unsigned c;
-
- ++token;
- if (*token == '"') {
- ++token;
- np = node(OSTRING);
- np->type.flags = STRF;
- np->type.size = strlen(token);
- np->type.align = int8type.align;
- np->u.s = xstrdup(token);
- } else {
- np = node(OCONST);
- np->type = *gettype(token++);
- for (v = 0; c = *token++; v += c) {
- v <<= 4;
- c = strchr(letters, c) - letters;
- }
- np->u.i = v;
- }
- push(np);
-}
-
-static void
-assign(char *token, union tokenop u)
-{
- int subop;
- Node *np = node(u.op);
-
- switch (subop = *++token) {
- case '+':
- case '-':
- case '*':
- case '%':
- case '/':
- case 'l':
- case 'r':
- case '&':
- case '|':
- case '^':
- case 'i':
- case 'd':
- ++token;
- subop = optbl[subop].u.op;
- break;
- default:
- subop = 0;
- break;
- }
-
- np->u.subop = subop;
- np->type = *gettype(token);
- np->right = pop();
- np->left = pop();
- push(np);
-}
-
-static void
-ternary(char *token, union tokenop u)
-{
- Node *ask = node(OASK), *colon = node(OCOLON);
- Type *tp = gettype(token+1);
-
- colon->right = pop();
- colon->left = pop();
-
- ask->type = *tp;
- ask->left = pop();
- ask->right = colon;
- push(ask);
-}
-
-static void
-eval(char *tok)
-{
- struct decoc *dp;
-
- do {
- dp = &optbl[*tok];
- if (!dp->parse)
- break;
- (*dp->parse)(tok, dp->u);
- } while (tok = strtok(NULL, "\t\n"));
-}
-
-static int
-nextline(void)
-{
- static char line[LINESIZ];
- size_t len;
- int c;
- void (*fun)(void);
-
-repeat:
- ++lineno;
- if (!fgets(line, sizeof(line), stdin))
- return 0;
- if ((len = strlen(line)) == 0 || line[0] == '\n')
- goto repeat;
- if (line[len-1] != '\n')
- error(len < sizeof(line)-1 ? ELNBLNE : ELNLINE);
- line[len-1] = '\0';
-
- c = *line;
- eval(strtok(line, "\t\n"));
- if ((fun = *optbl[c].eval) != NULL)
- (*fun)();
- if (sp != stack)
- error(ESTACKA);
- return 1;
-}
-
-static void
-oreturn(char *token, union tokenop u)
-{
- Node *np = node(u.op);
-
- if (token = strtok(NULL, "\t\n"))
- eval(token);
- if (!empty())
- np->left = pop();
- push(np);
-}
-
-/*
- * Move np (which is a OCASE/ODEFAULT/OESWITCH) to be contigous with
- * the last switch table. It is a bit ugly to touch directly curstmt
- * here, but moving this function to node.c is worse, because we are
- * putting knowledge of how the text is parsed into the node
- * represtation module.
- */
-static void
-waft(Node *np)
-{
- Node *lastcase, *next;;
- struct swtch *cur;
- extern Node *curstmt;
-
- if (swp == swtbl)
- error(EWTACKU);
-
- cur = swp - 1;
- lastcase = cur->last;
- next = lastcase->next;
-
- np->next = next;
- np->prev = lastcase;
-
- if (next)
- next->prev = np;
- lastcase->next = np;
-
- if (curstmt == cur->last)
- curstmt = np;
- cur->last = np;
- cur->nr++;
-}
-
-static void
-bswitch(char *token, union tokenop u)
-{
- struct swtch *cur;
- Node *np = node(u.op);
-
- if (swp == &swtbl[NR_BLOCK])
- error(EWTACKO);
- cur = swp++;
- cur->nr = 0;
-
- eval(strtok(NULL, "\t\n"));
- np->left = pop();
-
- push(cur->first = cur->last = np);
-}
-
-static void
-eswitch(char *token, union tokenop u)
-{
- struct swtch *cur;
-
- if (swp == swtbl)
- error(EWTACKU);
- jump(token, u);
- waft(pop());
- cur = --swp;
- cur->first->u.i = cur->nr;
-}
-
-static void
-ocase(char *token, union tokenop u)
-{
- jump(token, u);
- waft(pop());
-}
-
-static void
-jump(char *token, union tokenop u)
-{
- Node *aux, *np = node(u.op);
-
- eval(strtok(NULL, "\t\n"));
-
- if (u.op == OBRANCH || u.op == OCASE)
- np->left = pop();
- aux = pop();
- np->u.sym = aux->u.sym;
- delnode(aux);
- push(np);
-}
-
-static void
-loop(char *token, union tokenop u)
-{
- push(node(u.op));
-}
-
-static void
-unary(char *token, union tokenop u)
-{
- Node *np = node(u.op);
-
- np->type = *gettype(token+1);
- np->left = pop();
- np->right = NULL;
- push(np);
-}
-
-static void
-call(char *token, union tokenop u)
-{
- Node *np, *par, *fun = node(u.op);
-
- for (par = NULL;; par = np) {
- np = pop();
- if (np->op != OPAR)
- break;
- np->right = par;
- }
-
- fun->type = *gettype(token+1);
- fun->left = np;
- fun->right = par;
- push(fun);
-}
-
-static void
-builtin(char *token, union tokenop u)
-{
- Node *np = node(u.op);
- char *name;
- unsigned subop, nchilds;
-
- np->type = *gettype(token+1);
- name = pop();
-
- if (!strcmp("__builtin_va_arg", name)) {
- nchilds = 1;
- subop = BVA_ARG;
- } else if (!strcmp("__builtin_va_start", name)) {
- nchilds = 2;
- subop = BVA_START;
- } else if (!strcmp("__builtin_va_end", name)) {
- nchilds = 1;
- subop = BVA_END;
- } else if (!strcmp("__builtin_va_copy", name)) {
- nchilds = 2;
- subop = BVA_COPY;
- } else {
- error(EBBUILT);;
- }
-
- np->u.subop = subop;
- np->right = (nchilds == 2) ? pop() : NULL;
- np->left = (nchilds != 0) ? pop() : NULL;
-
- free(name);
- push(np);
-}
-
-static void
-binary(char *token, union tokenop u)
-{
- Node *np = node(u.op);
-
- np->type = *gettype(token+1);
- np->right = pop();
- np->left = pop();
- push(np);
-}
-
-static void
-binit(char *token, union tokenop u)
-{
- ininit = 1;
-}
-
-static void
-einit(char *token, union tokenop u)
-{
- ininit = 0;
- endinit();
-}
-
-static void
-endpars(void)
-{
- if (!curfun || !inpars)
- error(ESYNTAX);
- inpars = 0;
-}
-
-static void
-aggregate(void)
-{
- Node *align, *size;
- char *name;
- Type *tp;
- Symbol *sym;
-
- align = pop();
- size = pop();
- name = pop();
- tp = pop();
-
- tp->size = size->u.i;
- tp->align = align->u.i;
- tp->flags = AGGRF;
- /*
- * type is the first field of Symbol so we can obtain the
- * address of the symbol from the address of the type.
- * We have to do this because composed returns the pointer
- * to the type, but in this function we also need the
- * symbol to store the name.
- */
- sym = (Symbol *) tp;
- sym->name = name;
-
- delnode(align);
- delnode(size);
-}
-
-static void
-array(void)
-{
- Type *tp, *base;
- Node *size;
-
- size = pop();
- base = pop();
- tp = pop();
- tp->size = size->u.i * base->size; /* FIXME check for overflow */
- tp->align = base->align;
-
- delnode(size);
-}
-
-static void
-decl(Symbol *sym)
-{
- Type *tp = &sym->type;
-
- if (tp->flags & FUNF) {
- lastfun = sym;
- } else {
- switch (sym->kind) {
- case SEXTRN:
- case SGLOB:
- case SPRIV:
- case SLOCAL:
- defglobal(sym);
- break;
- case SAUTO:
- case SREG:
- if (!curfun)
- error(ESYNTAX);
- ((inpars) ? defpar : defvar)(sym);
- break;
- default:
- abort();
- }
- }
-}
-
-static void
-vardecl(void)
-{
- Type *tp, *rp;
- Node *np;
- Symbol *sym;
- char *name;
-
- name = pop();
- tp = pop();
- if (tp->flags & FUNF)
- rp = pop();
- np = pop();
-
- sym = np->u.sym;
- /*
- * We have to free sym->name because in tentative declarations
- * we can have multiple declarations of the same symbol, and in
- * this case our parser will allocate twice the memory
- */
- free(sym->name);
- sym->name = name;
- sym->type = *tp;
- if (tp->flags & FUNF)
- sym->rtype = *rp;
- sym->kind = sclass;
-
- if (ininit)
- sym->type.flags |= INITF;
- decl(sym);
- delnode(np);
-}
-
-static void
-flddecl(void)
-{
- Node *off, *np;
- char *name;
- Type *tp;
- Symbol *sym;
-
- off = pop();
- name = pop();
- tp = pop();
- np = pop();
-
- sym = np->u.sym;
- sym->u.off = off->u.i;
- sym->name = name;
- sym->type = *tp;
-
- delnode(np);
- delnode(off);
-}
-
-static void
-labeldcl(void)
-{
- Node *np;
- Symbol *sym;
-
- np = pop();
- np->op = ONOP;
- sym = np->u.sym;
- sym->kind = SLABEL;
- sym->u.stmt = np;
- np->label = sym;
- addstmt(np, SETCUR);
-}
-
-static void
-stmt(void)
-{
- Node *np;
-
- if (empty())
- return;
- np = pop();
- if (ininit) {
- data(np);
- deltree(np);
- return;
- }
- addstmt(np, SETCUR);
-}
-
-static void
-beginfun(void)
-{
- curfun = lastfun;
- inpars = 1;
- pushctx();
- addstmt(node(OBFUN), SETCUR);
-}
-
-static void
-endfun(void)
-{
- endf = 1;
- addstmt(node(OEFUN), SETCUR);
-}
-
-void
-parse(void)
-{
- cleannodes(); /* remove code of previous function */
- popctx(); /* remove context of previous function */
- curfun = NULL;
- endf = 0;
-
- while (!endf && nextline())
- ;
- if (ferror(stdin))
- error(EFERROR, strerror(errno));
-}
--- a/cc2/peep.c
+++ /dev/null
@@ -1,8 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/peep.c";
-#include "../inc/scc.h"
-#include "cc2.h"
-
-void
-peephole(void)
-{
-}
--- a/cc2/symbol.c
+++ /dev/null
@@ -1,92 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/symbol.c";
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-
-#include "cc2.h"
-
-#define NR_SYMHASH 64
-
-Symbol *locals;
-
-static Symbol *symtab[NR_SYMHASH], *curlocal;
-static int infunction;
-
-
-void
-freesym(Symbol *sym)
-{
- free(sym->name);
- free(sym);
-}
-
-void
-pushctx(void)
-{
- infunction = 1;
-}
-
-void
-popctx(void)
-{
- Symbol *sym, *next;
-
- infunction = 0;
- for (sym = locals; sym; sym = next) {
- next = sym->next;
- /*
- * Symbols are inserted in the hash in the inverted
- * order they are found in locals and it is impossible
- * to have a global over a local, because a local is
- * any symbol defined in the body of a function,
- * even if it has extern linkage.
- * For this reason when we reach a symbol in the
- * locals list we know that it is the head of it
- * collision list and we can remove it assigning
- * it h_next to the hash table position
- */
- if (sym->id != TMPSYM)
- symtab[sym->id & NR_SYMHASH-1] = sym->h_next;
- freesym(sym);
- }
- curlocal = locals = NULL;
-}
-
-Symbol *
-getsym(unsigned id)
-{
- Symbol **htab, *sym;
- static unsigned short num;
-
- if (id >= USHRT_MAX)
- error(EBADID);
-
- if (id != TMPSYM) {
- htab = &symtab[id & NR_SYMHASH-1];
- for (sym = *htab; sym; sym = sym->h_next) {
- if (sym->id == id)
- return sym;
- }
- }
-
- sym = xcalloc(1, sizeof(*sym));
- sym->id = id;
- if (infunction) {
- if (!locals)
- locals = sym;
- if (curlocal)
- curlocal->next = sym;
- curlocal = sym;
- }
- if (id != TMPSYM) {
- sym->h_next = *htab;
- *htab = sym;
- }
- if ((sym->numid = ++num) == 0)
- error(EIDOVER);
-
- return sym;
-}
--- a/cc2/target/amd64-sysv/cgen.c
+++ /dev/null
@@ -1,15 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/cgen.c";
-
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-cgen(Node *np)
-{
-}
-
-Node *
-sethi(Node *np)
-{
-}
--- a/cc2/target/amd64-sysv/code.c
+++ /dev/null
@@ -1,210 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/code.c";
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <cstd.h>
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-enum segment {
- CODESEG,
- DATASEG,
- BSSSEG,
- NOSEG
-};
-
-static int curseg = NOSEG;
-
-static void
-segment(int seg)
-{
- static char *txt[] = {
- [CODESEG] = "\t.text\n",
- [DATASEG] = "\t.data\n",
- [BSSSEG] = "\t.bss\n",
- };
-
- if (seg == curseg)
- return;
- fputs(txt[seg], stdout);
- curseg = seg;
-}
-
-static char *
-symname(Symbol *sym)
-{
- static char name[INTIDENTSIZ+1];
-
- if (sym->name) {
- switch (sym->kind) {
- case SEXTRN:
- case SGLOB:
- case SPRIV:
- return sym->name;
- }
- }
-
- sprintf(name, ".L%d", sym->numid);
-
- return name;
-}
-
-static void
-emitconst(Node *np)
-{
- switch (np->type.size) {
- case 1:
- printf("%d", (int) np->u.i & 0xFF);
- break;
- case 2:
- printf("%d", (int) np->u.i & 0xFFFF);
- break;
- case 4:
- printf("%ld", (long) np->u.i & 0xFFFFFFFF);
- break;
- case 8:
- printf("%lld", (long long) np->u.i & 0xFFFFFFFF);
- break;
- default:
- abort();
- }
-}
-
-static void
-emittree(Node *np)
-{
- if (!np)
- return;
-
- switch (np->op) {
- case OSTRING:
- printf("\"%s\"", np->u.s);
- free(np->u.s);
- np->u.s = NULL;
- break;
- case OCONST:
- emitconst(np);
- break;
- case OADDR:
- emittree(np->left);
- break;
- case OMEM:
- fputs(symname(np->u.sym), stdout);
- break;
- default:
- emittree(np->left);
- printf(" %c ", np->op);
- emittree(np->right);
- break;
- }
-}
-static void
-size2asm(Type *tp)
-{
- char *s;
-
- if (tp->flags & STRF) {
- s = "\t.ascii\t";
- } else {
- switch (tp->size) {
- case 1:
- s = "\t.byte\t";
- break;
- case 2:
- s = "\t.short\t";
- break;
- case 4:
- s = "\t.long\t";
- break;
- case 8:
- s = "\t.quad\t";
- break;
- default:
- s = "\t.space\t%lu,";
- break;
- }
- }
- printf(s, tp->size);
-}
-
-
-void
-data(Node *np)
-{
- size2asm(&np->type);
- emittree(np);
- putchar('\n');
-}
-
-static void
-label(Symbol *sym)
-{
- int seg;
- char *name = symname(sym);
- Type *tp = &sym->type;
-
- if (sym->type.flags & FUNF)
- seg = CODESEG;
- else if (sym->type.flags & INITF)
- seg = DATASEG;
- else
- seg = BSSSEG;
- segment(seg);
-
- switch (sym->kind) {
- case SEXTRN:
- printf("\t.extern\t%s\n", name);
- case SLOCAL:
- return;
- case SGLOB:
- printf("\t.global\t%s\n", name);
- if (seg == BSSSEG)
- printf("\t.comm\t%s,%lu\n", name, tp->size);
- break;
- }
- if (sym->type.align != 1)
- printf("\t.align\t%lu\n", sym->type.align );
- printf("%s:\n", name);
-}
-
-void
-defglobal(Symbol *sym)
-{
- label(sym);
- if (sym->kind == SEXTRN || (sym->type.flags & INITF))
- return;
- size2asm(&sym->type);
- puts("0");
-}
-
-void
-defvar(Symbol *sym)
-{
-}
-
-void
-defpar(Symbol *sym)
-{
-}
-
-void
-newfun(void)
-{
-}
-
-void
-writeout(void)
-{
-}
-
-void
-endinit(void)
-{
-}
-
-void
-getbblocks(void)
-{
-}
--- a/cc2/target/amd64-sysv/optm.c
+++ /dev/null
@@ -1,10 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/optm.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-optm_dep(Node *np)
-{
- return np;
-}
--- a/cc2/target/amd64-sysv/target.mk
+++ /dev/null
@@ -1,9 +1,0 @@
-
-OBJ-amd64-sysv = $(OBJ) \
- target/amd64-sysv/cgen.o \
- target/amd64-sysv/optm.o \
- target/amd64-sysv/code.o \
- target/amd64-sysv/types.o
-
-$(LIBEXEC)/cc2-amd64-sysv: $(OBJ-amd64-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-amd64-sysv) -lscc -o $@
--- a/cc2/target/amd64-sysv/types.c
+++ /dev/null
@@ -1,93 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/types.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-
-Type int8type = {
- .flags = SIGNF | INTF,
- .size = 1,
- .align = 1
-};
-
-Type int16type = {
- .flags = SIGNF | INTF,
- .size = 2,
- .align = 2
-};
-
-Type int32type = {
- .flags = SIGNF | INTF,
- .size = 4,
- .align = 4
-};
-
-Type int64type = {
- .flags = SIGNF | INTF,
- .size = 8,
- .align = 8
-};
-
-Type uint8type = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type uint16type = {
- .flags = INTF,
- .size = 2,
- .align = 2
-};
-
-Type uint32type = {
- .flags = INTF,
- .size = 4,
- .align = 4
-};
-
-Type uint64type = {
- .flags = INTF,
- .size = 8,
- .align = 2
-};
-
-Type ptrtype = {
- .flags = INTF,
- .size = 8,
- .align = 8
-};
-
-Type booltype = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type float32type = {
- .flags = FLOATF,
- .size = 4,
- .align = 4
-};
-
-Type float64type = {
- .flags = FLOATF,
- .size = 8,
- .align = 8
-};
-
-Type float80type = {
- .flags = FLOATF,
- .size = 16,
- .align = 16
-};
-
-Type voidtype = {
- .size = 0,
- .align = 0
-};
-
-Type arg_type = {
- .size = 24,
- .align = 8
-};
--- a/cc2/target/i386-sysv/cgen.c
+++ /dev/null
@@ -1,15 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/cgen.c";
-
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-cgen(Node *np)
-{
-}
-
-Node *
-sethi(Node *np)
-{
-}
--- a/cc2/target/i386-sysv/code.c
+++ /dev/null
@@ -1,208 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/code.c";
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <cstd.h>
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-enum segment {
- CODESEG,
- DATASEG,
- BSSSEG,
- NOSEG
-};
-
-static int curseg = NOSEG;
-
-static void
-segment(int seg)
-{
- static char *txt[] = {
- [CODESEG] = "\t.text\n",
- [DATASEG] = "\t.data\n",
- [BSSSEG] = "\t.bss\n",
- };
-
- if (seg == curseg)
- return;
- fputs(txt[seg], stdout);
- curseg = seg;
-}
-
-static char *
-symname(Symbol *sym)
-{
- static char name[INTIDENTSIZ+1];
-
- if (sym->name) {
- switch (sym->kind) {
- case SEXTRN:
- case SGLOB:
- case SPRIV:
- return sym->name;
- }
- }
-
- sprintf(name, ".L%d", sym->numid);
-
- return name;
-}
-
-static void
-emitconst(Node *np)
-{
- switch (np->type.size) {
- case 1:
- printf("%d", (int) np->u.i & 0xFF);
- break;
- case 2:
- printf("%d", (int) np->u.i & 0xFFFF);
- break;
- case 4:
- printf("%ld", (long) np->u.i & 0xFFFFFFFF);
- break;
- case 8:
- printf("%lld", (long long) np->u.i & 0xFFFFFFFF);
- break;
- default:
- abort();
- }
-}
-
-static void
-emittree(Node *np)
-{
- if (!np)
- return;
-
- switch (np->op) {
- case OSTRING:
- printf("\"%s\"", np->u.s);
- free(np->u.s);
- np->u.s = NULL;
- break;
- case OCONST:
- emitconst(np);
- break;
- case OADDR:
- emittree(np->left);
- break;
- case OMEM:
- fputs(symname(np->u.sym), stdout);
- break;
- default:
- emittree(np->left);
- printf(" %c ", np->op);
- emittree(np->right);
- break;
- }
-}
-static void
-size2asm(Type *tp)
-{
- char *s;
-
- if (tp->flags & STRF) {
- s = "\t.ascii\t";
- } else {
- switch (tp->size) {
- case 1:
- s = "\t.byte\t";
- break;
- case 2:
- s = "\t.short\t";
- break;
- case 4:
- s = "\t.long\t";
- break;
- case 8:
- s = "\t.quad\t";
- break;
- default:
- s = "\t.space\t%lu,";
- break;
- }
- }
- printf(s, tp->size);
-}
-
-void
-data(Node *np)
-{
- size2asm(&np->type);
- emittree(np);
- putchar('\n');
-}
-
-static void
-label(Symbol *sym)
-{
- int seg;
- char *name = symname(sym);
- Type *tp = &sym->type;
-
- if (sym->type.flags & FUNF)
- seg = CODESEG;
- else if (sym->type.flags & INITF)
- seg = DATASEG;
- else
- seg = BSSSEG;
- segment(seg);
-
- switch (sym->kind) {
- case SEXTRN:
- printf("\t.extern\t%s\n", name);
- case SLOCAL:
- return;
- case SGLOB:
- printf("\t.global\t%s\n", name);
- if (seg == BSSSEG)
- printf("\t.comm\t%s,%lu\n", name, tp->size);
- break;
- }
- if (sym->type.align != 1)
- printf("\t.align\t%lu\n", sym->type.align );
- printf("%s:\n", name);
-}
-
-void
-defglobal(Symbol *sym)
-{
- label(sym);
- if (sym->kind == SEXTRN || (sym->type.flags & INITF))
- return;
- size2asm(&sym->type);
- puts("0");
-}
-
-void
-defpar(Symbol *sym)
-{
-}
-
-void
-defvar(Symbol *sym)
-{
-}
-
-void
-newfun(void)
-{
-}
-
-void
-writeout(void)
-{
-}
-
-void
-endinit(void)
-{
-}
-
-void
-getbblocks(void)
-{
-}
--- a/cc2/target/i386-sysv/optm.c
+++ /dev/null
@@ -1,10 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/optm.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-optm_dep(Node *np)
-{
- return np;
-}
--- a/cc2/target/i386-sysv/target.mk
+++ /dev/null
@@ -1,9 +1,0 @@
-
-OBJ-i386-sysv = $(OBJ) \
- target/i386-sysv/cgen.o \
- target/i386-sysv/optm.o \
- target/i386-sysv/code.o \
- target/i386-sysv/types.o
-
-$(LIBEXEC)/cc2-i386-sysv: $(OBJ-i386-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-i386-sysv) -lscc -o $@
--- a/cc2/target/i386-sysv/types.c
+++ /dev/null
@@ -1,94 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/types.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-
-Type int8type = {
- .flags = SIGNF | INTF,
- .size = 1,
- .align = 1
-};
-
-Type int16type = {
- .flags = SIGNF | INTF,
- .size = 2,
- .align = 2
-};
-
-Type int32type = {
- .flags = SIGNF | INTF,
- .size = 4,
- .align = 4
-};
-
-Type int64type = {
- .flags = SIGNF | INTF,
- .size = 8,
- .align = 4
-};
-
-Type uint8type = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type uint16type = {
- .flags = INTF,
- .size = 2,
- .align = 2
-};
-
-Type uint32type = {
- .flags = INTF,
- .size = 4,
- .align = 2
-};
-
-Type uint64type = {
- .flags = INTF,
- .size = 8,
- .align = 4
-};
-
-Type ptrtype = {
- .flags = INTF,
- .size = 4,
- .align = 4
-};
-
-Type booltype = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type float32type = {
- .flags = FLOATF,
- .size = 4,
- .align = 4
-};
-
-Type float64type = {
- .flags = FLOATF,
- .size = 8,
- .align = 4
-};
-
-Type float80type = {
- .flags = FLOATF,
- .size = 12,
- .align = 4
-};
-
-Type voidtype = {
- .size = 0,
- .align = 0
-};
-
-/* this type is not used in this architecture */
-Type arg_type = {
- .size = 0,
- .align = 0
-};
--- a/cc2/target/qbe/arch.h
+++ /dev/null
@@ -1,135 +1,0 @@
-enum asmop {
- ASNOP = 0,
- ASSTB,
- ASSTH,
- ASSTW,
- ASSTL,
- ASSTM,
- ASSTS,
- ASSTD,
-
- ASLDSB,
- ASLDUB,
- ASLDSH,
- ASLDUH,
- ASLDSW,
- ASLDUW,
- ASLDL,
- ASLDS,
- ASLDD,
-
- ASADDW,
- ASSUBW,
- ASMULW,
- ASMODW,
- ASUMODW,
- ASDIVW,
- ASUDIVW,
- ASSHLW,
- ASSHRW,
- ASUSHRW,
- ASLTW,
- ASULTW,
- ASGTW,
- ASUGTW,
- ASLEW,
- ASULEW,
- ASGEW,
- ASUGEW,
- ASEQW,
- ASNEW,
- ASBANDW,
- ASBORW,
- ASBXORW,
-
- ASADDL,
- ASSUBL,
- ASMULL,
- ASMODL,
- ASUMODL,
- ASDIVL,
- ASUDIVL,
- ASSHLL,
- ASSHRL,
- ASUSHRL,
- ASLTL,
- ASULTL,
- ASGTL,
- ASUGTL,
- ASLEL,
- ASULEL,
- ASGEL,
- ASUGEL,
- ASEQL,
- ASNEL,
- ASBANDL,
- ASBORL,
- ASBXORL,
-
- ASADDS,
- ASSUBS,
- ASMULS,
- ASDIVS,
- ASLTS,
- ASGTS,
- ASLES,
- ASGES,
- ASEQS,
- ASNES,
-
- ASADDD,
- ASSUBD,
- ASMULD,
- ASDIVD,
- ASLTD,
- ASGTD,
- ASLED,
- ASGED,
- ASEQD,
- ASNED,
-
- ASEXTBW,
- ASUEXTBW,
- ASEXTBL,
- ASUEXTBL,
- ASEXTHW,
- ASUEXTHW,
- ASEXTHL,
- ASUEXTHL,
- ASEXTWL,
- ASUEXTWL,
-
- ASSTOL,
- ASSTOW,
- ASDTOL,
- ASDTOW,
-
- ASSWTOD,
- ASSWTOS,
- ASSLTOD,
- ASSLTOS,
-
- ASEXTS,
- ASTRUNCD,
-
- ASJMP,
- ASBRANCH,
- ASRET,
- ASCALL,
- ASCALLE,
- ASCALLEX,
- ASPAR,
- ASPARE,
- ASALLOC,
- ASFORM,
-
- ASCOPYB,
- ASCOPYH,
- ASCOPYW,
- ASCOPYL,
- ASCOPYS,
- ASCOPYD,
-
- ASVSTAR,
- ASVARG,
-};
--- a/cc2/target/qbe/cgen.c
+++ /dev/null
@@ -1,728 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/qbe/cgen.c";
-
-#include <assert.h>
-#include <stdlib.h>
-
-#include <cstd.h>
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-enum sflags {
- ISTMP = 1,
- ISCONS = 2
-};
-
-static char opasmw[] = {
- [OADD] = ASADDW,
- [OSUB] = ASSUBW,
- [OMUL] = ASMULW,
- [OMOD] = ASMODW,
- [ODIV] = ASDIVW,
- [OSHL] = ASSHLW,
- [OSHR] = ASSHRW,
- [OLT] = ASLTW,
- [OGT] = ASGTW,
- [OLE] = ASLEW,
- [OGE] = ASGEW,
- [OEQ] = ASEQW,
- [ONE] = ASNEW,
- [OBAND] = ASBANDW,
- [OBOR] = ASBORW,
- [OBXOR] = ASBXORW,
-};
-
-static char opasml[] = {
- [OADD] = ASADDL,
- [OSUB] = ASSUBL,
- [OMUL] = ASMULL,
- [OMOD] = ASMODL,
- [ODIV] = ASDIVL,
- [OSHL] = ASSHLL,
- [OSHR] = ASSHRL,
- [OLT] = ASLTL,
- [OGT] = ASGTL,
- [OLE] = ASLEL,
- [OGE] = ASGEL,
- [OEQ] = ASEQL,
- [ONE] = ASNEL,
- [OBAND] = ASBANDL,
- [OBOR] = ASBORL,
- [OBXOR] = ASBXORL,
-};
-
-static char opasms[] = {
- [OADD] = ASADDS,
- [OSUB] = ASSUBS,
- [OMUL] = ASMULS,
- [ODIV] = ASDIVS,
- [OLT] = ASLTS,
- [OGT] = ASGTS,
- [OLE] = ASLES,
- [OGE] = ASGES,
- [OEQ] = ASEQS,
- [ONE] = ASNES,
-};
-static char opasmd[] = {
- [OADD] = ASADDD,
- [OSUB] = ASSUBD,
- [OMUL] = ASMULD,
- [ODIV] = ASDIVD,
- [OLT] = ASLTD,
- [OGT] = ASGTD,
- [OLE] = ASLED,
- [OGE] = ASGED,
- [OEQ] = ASEQD,
- [ONE] = ASNED,
-};
-
-extern Type int32type, uint32type, ptrtype;
-
-static Node *
-tmpnode(Node *np, Type *tp)
-{
- char flags;
- Symbol *sym;
-
- if (!np)
- np = node(OTMP);
- sym = getsym(TMPSYM);
- sym->type = np->type = *tp;
- flags = tp->flags & ~(PARF|INITF);
- sym->type.flags = np->type.flags = flags;
- sym->kind = STMP;
- np->left = np->right = NULL;
- np->u.sym = sym;
- np->op = OTMP;
- np->flags |= ISTMP;
- return np;
-}
-
-static Node *
-load(Type *tp, Node *np, Node *new)
-{
- int op;
- int flags = tp->flags;
-
- if (flags & (AGGRF|FUNF)) {
- *new = *np;
- return new;
- }
- switch (tp->size) {
- case 1:
- op = ASLDSB;
- break;
- case 2:
- op = ASLDSH;
- break;
- case 4:
- op = (flags & FLOATF) ? ASLDS : ASLDSW;
- break;
- case 8:
- op = (flags & FLOATF) ? ASLDD : ASLDL;
- break;
- default:
- abort();
- }
- /*
- * unsigned version of operations are always +1 the
- * signed version
- */
- if ((flags & (INTF|SIGNF)) == INTF && tp->size < 8)
- ++op;
-
- code(op, tmpnode(new, tp), np, NULL);
-
- return new;
-}
-
-static Node *rhs(Node *np, Node *new);
-
-static Node *
-cast(Type *td, Node *ns, Node *nd)
-{
- Type *ts;
- Node aux1, aux2;
- int op, d_isint, s_isint;
-
- ts = &ns->type;
- d_isint = (td->flags & INTF) != 0;
- s_isint = (ts->flags & INTF) != 0;
-
- if (d_isint && s_isint) {
- if (td->size <= ts->size) {
- *nd = *ns;
- return nd;
- }
- assert(td->size == 4 || td->size == 8);
- switch (ts->size) {
- case 1:
- op = (td->size == 4) ? ASEXTBW : ASEXTBL;
- break;
- case 2:
- op = (td->size == 4) ? ASEXTHW : ASEXTHL;
- break;
- case 4:
- op = ASEXTWL;
- break;
- default:
- abort();
- }
- /*
- * unsigned version of operations are always +1 the
- * signed version
- */
- op += (ts->flags & SIGNF) == 0;
- } else if (d_isint) {
- /* conversion from float to int */
- switch (ts->size) {
- case 4:
- op = (td->size == 8) ? ASSTOL : ASSTOW;
- break;
- case 8:
- op = (td->size == 8) ? ASDTOL : ASDTOW;
- break;
- default:
- abort();
- }
- /* TODO: Add signess */
- } else if (s_isint) {
- /* conversion from int to float */
- switch (ts->size) {
- case 1:
- case 2:
- ts = (ts->flags&SIGNF) ? &int32type : &uint32type;
- ns = cast(ts, ns, tmpnode(&aux2, ts));
- case 4:
- op = (td->size == 8) ? ASSWTOD : ASSWTOS;
- break;
- case 8:
- op = (td->size == 8) ? ASSLTOD : ASSLTOS;
- break;
- default:
- abort();
- }
- /* TODO: Add signess */
- } else {
- /* conversion from float to float */
- op = (td->size == 4) ? ASEXTS : ASTRUNCD;
- }
-
- code(op, tmpnode(nd, td), ns, NULL);
- return nd;
-}
-
-static Node *
-call(Node *np, Node *fun, Node *ret)
-{
- int n, op;
- Type *tp;
- Node aux, **q, *p, *pars[NR_FUNPARAM];
-
- for (n = 0, p = np->right; p; p = p->right)
- pars[n++] = rhs(p->left, node(OTMP));
-
- tp = &np->type;
- code(ASCALL, tmpnode(ret, tp), fun, NULL);
-
- for (q = pars; q < &pars[n]; ++q) {
- op = (q == &pars[n-1]) ? ASPARE : ASPAR;
- tmpnode(&aux, &(*q)->type);
- code(op, NULL, *q, &aux);
- }
- code((np->op == OCALL) ? ASCALLE : ASCALLEX, NULL, NULL, NULL);
-
- return ret;
-}
-
-static Node *
-assign(Type *tp, Node *to, Node *from)
-{
- int op;
-
- switch (tp->size) {
- case 1:
- op = ASSTB;
- break;
- case 2:
- op = ASSTH;
- break;
- case 4:
- op = (tp->flags & FLOATF) ? ASSTS : ASSTW;
- break;
- case 8:
- op = (tp->flags & FLOATF) ? ASSTD : ASSTL;
- break;
- default:
- op = ASSTM;
- break;
- }
- code(op, to, from, NULL);
- return from;
-}
-
-static Node *
-copy(Type *tp, Node *to, Node *from)
-{
- int op;
-
- switch (tp->size) {
- case 1:
- op = ASCOPYB;
- break;
- case 2:
- op = ASCOPYH;
- break;
- case 4:
- op = (tp->flags & FLOATF) ? ASCOPYS : ASCOPYW;
- break;
- case 8:
- op = (tp->flags & FLOATF) ? ASCOPYD : ASCOPYL;
- break;
- default:
- /* TODO: Need to handle the general case */
- abort();
- }
- code(op, to, from, NULL);
- return from;
-}
-
-/* TODO: Do field() transformation in sethi */
-
-static Node *
-field(Node *np, Node *ret, int islhs)
-{
- Node base, node, off, add, *addr;
- TUINT offset = np->right->u.sym->u.off;
-
- addr = rhs(np->left, &base);
-
- if (offset != 0) {
- node.op = OADD;
- node.type = ptrtype;
- node.left = addr;
- node.right = constnode(&off, offset, &ptrtype);
- addr = rhs(&node, &add);
- }
-
- if (islhs)
- *ret = *addr;
- else
- load(&np->type, addr, ret);
-
- return ret;
-}
-
-static Node *
-lhs(Node *np, Node *new)
-{
- switch (np->op) {
- case OMEM:
- case OAUTO:
- *new = *np;
- return new;
- case OPTR:
- return rhs(np->left, new);
- case OFIELD:
- return field(np, new, 1);
- default:
- abort();
- }
-}
-
-static void
-bool(Node *np, Symbol *true, Symbol *false)
-{
- Node *l = np->left, *r = np->right;
- Node ret, ifyes, ifno;
- Symbol *label;
-
- switch (np->op) {
- case ONEG:
- bool(l, false, true);
- break;
- case OAND:
- label = newlabel();
- bool(l, label, false);
- setlabel(label);
- bool(r, true, false);
- break;
- case OOR:
- label = newlabel();
- bool(l, true, label);
- setlabel(label);
- bool(r, true, false);
- break;
- default:
- label2node(&ifyes, true);
- label2node(&ifno, false);
- code(ASBRANCH, rhs(np, &ret), &ifyes, &ifno);
- break;
- }
-}
-
-static Node *
-ternary(Node *np, Node *ret)
-{
- Node ifyes, ifno, phi, *colon, aux1, aux2, aux3;
-
- tmpnode(ret, &np->type);
- label2node(&ifyes, NULL);
- label2node(&ifno, NULL);
- label2node(&phi, NULL);
-
- colon = np->right;
- code(ASBRANCH, rhs(np->left, &aux1), &ifyes, &ifno);
-
- setlabel(ifyes.u.sym);
- copy(&ret->type, ret, rhs(colon->left, &aux2));
- code(ASJMP, NULL, &phi, NULL);
-
- setlabel(ifno.u.sym);
- copy(&ret->type, ret, rhs(colon->right, &aux3));
- setlabel(phi.u.sym);
-
- return ret;
-}
-
-static Node *
-function(void)
-{
- Node aux;
- Symbol *p;
-
- /* allocate stack space for parameters */
- for (p = locals; p && (p->type.flags & PARF) != 0; p = p->next)
- code(ASALLOC, label2node(&aux, p), NULL, NULL);
-
- /* allocate stack space for local variables) */
- for ( ; p && p->id != TMPSYM; p = p->next) {
- if (p->kind != SAUTO)
- continue;
- code(ASALLOC, label2node(&aux, p), NULL, NULL);
- }
- /* store formal parameters in parameters */
- for (p = locals; p; p = p->next) {
- if ((p->type.flags & PARF) == 0)
- break;
- code(ASFORM, label2node(&aux, p), NULL, NULL);
- }
- return NULL;
-}
-
-static void
-swtch_if(Node *idx)
-{
- Node aux1, aux2, *np;
- Symbol *deflabel = NULL;
-
- for (;;) {
- np = delstmt();
- setlabel(np->label);
-
- switch (np->op) {
- case OESWITCH:
- if (!deflabel)
- deflabel = np->u.sym;
- aux1.op = OJMP;
- aux1.label = NULL;
- aux1.u.sym = deflabel;
- cgen(&aux1);
- return;
- case OCASE:
- aux1 = *np;
- aux1.op = OBRANCH;
- aux1.label = NULL;
- aux1.left = &aux2;
-
- aux2.op = OEQ;
- aux2.type = idx->type;
- aux2.left = np->left;
- aux2.right = idx;
-
- cgen(&aux1);
- break;
- case ODEFAULT:
- deflabel = np->u.sym;
- break;
- default:
- abort();
- }
- }
-}
-
-static Node *
-rhs(Node *np, Node *ret)
-{
- Node aux1, aux2, *phi, *l = np->left, *r = np->right;
- Type *tp;
- int off, op;
- char *tbl;
- Symbol *true, *false;
-
- tp = &np->type;
-
- switch (np->op) {
- case OBFUN:
- return function();
- case ONOP:
- case OBLOOP:
- case OELOOP:
- case OEFUN:
- return NULL;
- case OTMP:
- case OCONST:
- *ret = *np;
- return np;
- case OMEM:
- case OAUTO:
- return load(tp, np, ret);
- case ONEG:
- case OAND:
- case OOR:
- true = newlabel();
- false = newlabel();
- phi = label2node(&aux1, NULL);
- tmpnode(ret, &int32type);
-
- bool(np, true, false);
-
- setlabel(true);
- code(ASCOPYW, ret, constnode(&aux2, 1, &int32type), NULL);
- code(ASJMP, NULL, phi, NULL);
-
- setlabel(false);
- code(ASCOPYW, ret, constnode(&aux2, 0, &int32type), NULL);
-
- setlabel(phi->u.sym);
- return ret;
- case OMOD:
- case OSHR:
- assert(tp->flags & INTF);
- case ODIV:
- case OLT:
- case OGT:
- case OLE:
- case OGE:
- /*
- * unsigned version of operations are always +1 the
- * signed version
- */
- off = (tp->flags & SIGNF) == 0;
- goto binary;
- case OSHL:
- case OBAND:
- case OBOR:
- case OBXOR:
- assert(tp->flags & INTF);
- case OADD:
- case OSUB:
- case OMUL:
- case OEQ:
- case ONE:
- off = 0;
- binary:
- if (l->complex >= r->complex) {
- rhs(l, &aux1);
- rhs(r, &aux2);
- } else {
- rhs(r, &aux2);
- rhs(l, &aux1);
- }
- switch (tp->size) {
- case 4:
- tbl = (tp->flags & FLOATF) ? opasms : opasmw;
- break;
- case 8:
- tbl = (tp->flags & FLOATF) ? opasmd : opasml;
- break;
- default:
- abort();
- }
- op = tbl[np->op] + off;
- tmpnode(ret, tp);
- code(op, ret, &aux1, &aux2);
- return ret;
- case OCALL:
- case OCALLE:
- if (l->op == OPTR)
- l = rhs(l, &aux1);
- return call(np, l, ret);
- case OCAST:
- return cast(tp, rhs(l, &aux1), ret);
- case OASSIG:
- /* TODO: Do this transformations in sethi */
- switch (np->u.subop) {
- case OINC:
- op = OADD;
- goto post_oper;
- case ODEC:
- op = OSUB;
- post_oper:
- aux1.op = op;
- aux1.left = rhs(l, ret);
- aux1.right = r;
- aux1.type = np->type;
- rhs(&aux1, &aux2);
- lhs(l, &aux1);
- assign(tp, &aux1, &aux2);
- break;
- default:
- aux2.type = np->type;
- aux2.op = np->u.subop;
- aux2.right = np->right;
- aux2.left = np->left;
- r = rhs(&aux2, &aux1);
- Node aux3;
- if (l->op == OCAST) {
- aux3.type = l->left->type;
- aux3.op = OCAST;
- aux3.left = r;
- aux3.right = NULL;
- r = &aux3;
- l = l->left;
- }
- case 0:
- /* TODO: see what is the most difficult */
- lhs(l, &aux2);
- rhs(r, ret);
- return assign(tp, &aux2, ret);
- }
- return ret;
- case OASK:
- return ternary(np, ret);
- case OCOMMA:
- rhs(l, &aux1);
- return rhs(r, ret);
- case OPTR:
- return load(tp, rhs(l, &aux1), ret);
- case OADDR:
- lhs(l, ret);
- ret->type = *tp;
- return ret;
- case OFIELD:
- return field(np, ret, 0);
- case OBUILTIN:
- switch (np->u.subop) {
- case BVA_START:
- l = rhs(l, &aux1);
- code(ASVSTAR, NULL, l, NULL);
- return NULL;
- case BVA_END:
- return NULL;
- case BVA_ARG:
- l = rhs(l, &aux1);
- code(ASVARG, tmpnode(ret, tp), l, NULL);
- return ret;
- case BVA_COPY:
- /* TODO */
- default:
- abort();
- }
- default:
- abort();
- }
- abort();
-}
-
-Node *
-cgen(Node *np)
-{
- Node aux, *p, *next;
-
- setlabel(np->label);
- switch (np->op) {
- case OJMP:
- label2node(&aux, np->u.sym);
- code(ASJMP, NULL, &aux, NULL);
- break;
- case OBRANCH:
- next = np->next;
- if (!next->label)
- next->label = newlabel();
- bool(np->left, np->u.sym, next->label);
- break;
- case ORET:
- p = (np->left) ? rhs(np->left, &aux) : NULL;
- code(ASRET, NULL, p, NULL);
- break;
- case OBSWITCH:
- p = rhs(np->left, &aux);
- swtch_if(p);
- break;
- default:
- rhs(np, &aux);
- break;
- }
- return NULL;
-}
-
-/*
- * This is strongly influenced by
- * http://plan9.bell-labs.com/sys/doc/compiler.ps (/sys/doc/compiler.ps)
- * calculate addresability as follows
- * AUTO => 11 value+fp
- * REG => 11 reg
- * STATIC => 11 (value)
- * CONST => 11 $value
- * These values of addressability are not used in the code generation.
- * They are only used to calculate the Sethi-Ullman numbers. Since
- * QBE is AMD64 targered we could do a better job there, and try to
- * detect some of the complex addressing modes of these processors.
- */
-Node *
-sethi(Node *np)
-{
- Node *lp, *rp;
-
- if (!np)
- return np;
-
- np->complex = 0;
- np->address = 0;
- lp = np->left;
- rp = np->right;
-
- switch (np->op) {
- case OAUTO:
- case OREG:
- case OMEM:
- case OCONST:
- np->address = 11;
- break;
- case OCPL:
- assert(np->type.flags & INTF);
- np->op = OBXOR;
- rp = constnode(NULL, ~(TUINT) 0, &np->type);
- goto binary;
- case OSNEG:
- np->op = OSUB;
- rp = lp;
- lp = constnode(NULL, 0, &np->type);
- if ((np->type.flags & INTF) == 0)
- lp->u.f = 0.0;
- default:
- binary:
- lp = sethi(lp);
- rp = sethi(rp);
- break;
- }
- np->left = lp;
- np->right = rp;
-
- if (np->address > 10)
- return np;
- if (lp)
- np->complex = lp->complex;
- if (rp) {
- int d = np->complex - rp->complex;
-
- if (d == 0)
- ++np->complex;
- else if (d < 0)
- np->complex = rp->complex;
- }
- if (np->complex == 0)
- ++np->complex;
- return np;
-}
--- a/cc2/target/qbe/code.c
+++ /dev/null
@@ -1,568 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/qbe/code.c";
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cstd.h>
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-#define ADDR_LEN (INTIDENTSIZ+64)
-
-static void binary(void), unary(void), store(void), jmp(void), ret(void),
- branch(void), call(void), ecall(void), param(void),
- asalloc(void), form2local(void), ldir(void), vastart(void),
- vaarg(void);
-
-static struct opdata {
- void (*fun)(void);
- char *txt;
- char letter;
-} optbl [] = {
- [ASLDSB] = {.fun = unary, .txt = "loadsb", .letter = 'w'},
- [ASLDUB] = {.fun = unary, .txt = "loadub", .letter = 'w'},
- [ASLDSH] = {.fun = unary, .txt = "loadsh", .letter = 'w'},
- [ASLDUH] = {.fun = unary, .txt = "loaduh", .letter = 'w'},
- [ASLDSW] = {.fun = unary, .txt = "loadsw", .letter = 'w'},
- [ASLDUW] = {.fun = unary, .txt = "loaduw", .letter = 'w'},
- [ASLDL] = {.fun = unary, .txt = "loadl", .letter = 'l'},
- [ASLDS] = {.fun = unary, .txt = "loads", .letter = 's'},
- [ASLDD] = {.fun = unary, .txt = "loadd", .letter = 'd'},
-
- [ASCOPYB] = {.fun = unary, .txt = "copy", .letter = 'b'},
- [ASCOPYH] = {.fun = unary, .txt = "copy", .letter = 'h'},
- [ASCOPYW] = {.fun = unary, .txt = "copy", .letter = 'w'},
- [ASCOPYL] = {.fun = unary, .txt = "copy", .letter = 'l'},
- [ASCOPYS] = {.fun = unary, .txt = "copy", .letter = 's'},
- [ASCOPYD] = {.fun = unary, .txt = "copy", .letter = 'd'},
-
- [ASSTB] = {.fun = store, .txt = "store", .letter = 'b'},
- [ASSTH] = {.fun = store, .txt = "store", .letter = 'h'},
- [ASSTW] = {.fun = store, .txt = "store", .letter = 'w'},
- [ASSTL] = {.fun = store, .txt = "store", .letter = 'l'},
- [ASSTM] = {.fun = ldir},
- [ASSTS] = {.fun = store, .txt = "store", .letter = 's'},
- [ASSTD] = {.fun = store, .txt = "store", .letter = 'd'},
-
- [ASADDW] = {.fun = binary, .txt = "add", .letter = 'w'},
- [ASSUBW] = {.fun = binary, .txt = "sub", .letter = 'w'},
- [ASMULW] = {.fun = binary, .txt = "mul", .letter = 'w'},
- [ASMODW] = {.fun = binary, .txt = "rem", .letter = 'w'},
- [ASUMODW] = {.fun = binary, .txt = "urem", .letter = 'w'},
- [ASDIVW] = {.fun = binary, .txt = "div", .letter = 'w'},
- [ASUDIVW] = {.fun = binary, .txt = "udiv", .letter = 'w'},
- [ASSHLW] = {.fun = binary, .txt = "shl", .letter = 'w'},
- [ASSHRW] = {.fun = binary, .txt = "sar", .letter = 'w'},
- [ASUSHRW] = {.fun = binary, .txt = "shr", .letter = 'w'},
- [ASLTW] = {.fun = binary, .txt = "csltw", .letter = 'w'},
- [ASULTW] = {.fun = binary, .txt = "cultw", .letter = 'w'},
- [ASGTW] = {.fun = binary, .txt = "csgtw", .letter = 'w'},
- [ASUGTW] = {.fun = binary, .txt = "cugtw", .letter = 'w'},
- [ASLEW] = {.fun = binary, .txt = "cslew", .letter = 'w'},
- [ASULEW] = {.fun = binary, .txt = "culew", .letter = 'w'},
- [ASGEW] = {.fun = binary, .txt = "csgew", .letter = 'w'},
- [ASUGEW] = {.fun = binary, .txt = "cugew", .letter = 'w'},
- [ASEQW] = {.fun = binary, .txt = "ceqw", .letter = 'w'},
- [ASNEW] = {.fun = binary, .txt = "cnew", .letter = 'w'},
- [ASBANDW] = {.fun = binary, .txt = "and", .letter = 'w'},
- [ASBORW] = {.fun = binary, .txt = "or", .letter = 'w'},
- [ASBXORW] = {.fun = binary, .txt = "xor", .letter = 'w'},
-
- [ASADDL] = {.fun = binary, .txt = "add", .letter = 'l'},
- [ASSUBL] = {.fun = binary, .txt = "sub", .letter = 'l'},
- [ASMULL] = {.fun = binary, .txt = "mul", .letter = 'l'},
- [ASMODL] = {.fun = binary, .txt = "rem", .letter = 'l'},
- [ASUMODL] = {.fun = binary, .txt = "urem", .letter = 'l'},
- [ASDIVL] = {.fun = binary, .txt = "div", .letter = 'l'},
- [ASUDIVL] = {.fun = binary, .txt = "udiv", .letter = 'l'},
- [ASSHLL] = {.fun = binary, .txt = "shl", .letter = 'l'},
- [ASSHRL] = {.fun = binary, .txt = "sar", .letter = 'l'},
- [ASUSHRL] = {.fun = binary, .txt = "shr", .letter = 'l'},
- [ASLTL] = {.fun = binary, .txt = "csltl", .letter = 'w'},
- [ASULTL] = {.fun = binary, .txt = "cultl", .letter = 'w'},
- [ASGTL] = {.fun = binary, .txt = "csgtl", .letter = 'w'},
- [ASUGTL] = {.fun = binary, .txt = "cugtl", .letter = 'w'},
- [ASLEL] = {.fun = binary, .txt = "cslel", .letter = 'w'},
- [ASULEL] = {.fun = binary, .txt = "culel", .letter = 'w'},
- [ASGEL] = {.fun = binary, .txt = "csgel", .letter = 'w'},
- [ASUGEL] = {.fun = binary, .txt = "cugel", .letter = 'w'},
- [ASEQL] = {.fun = binary, .txt = "ceql", .letter = 'w'},
- [ASNEL] = {.fun = binary, .txt = "cnel", .letter = 'w'},
- [ASBANDL] = {.fun = binary, .txt = "and", .letter = 'l'},
- [ASBORL] = {.fun = binary, .txt = "or", .letter = 'l'},
- [ASBXORL] = {.fun = binary, .txt = "xor", .letter = 'l'},
-
- [ASADDS] = {.fun = binary, .txt = "add", .letter = 's'},
- [ASSUBS] = {.fun = binary, .txt = "sub", .letter = 's'},
- [ASMULS] = {.fun = binary, .txt = "mul", .letter = 's'},
- [ASDIVS] = {.fun = binary, .txt = "div", .letter = 's'},
- [ASLTS] = {.fun = binary, .txt = "clts", .letter = 'w'},
- [ASGTS] = {.fun = binary, .txt = "cgts", .letter = 'w'},
- [ASLES] = {.fun = binary, .txt = "cles", .letter = 'w'},
- [ASGES] = {.fun = binary, .txt = "cges", .letter = 'w'},
- [ASEQS] = {.fun = binary, .txt = "ceqs", .letter = 'w'},
- [ASNES] = {.fun = binary, .txt = "cnes", .letter = 'w'},
-
- [ASADDD] = {.fun = binary, .txt = "add", .letter = 'd'},
- [ASSUBD] = {.fun = binary, .txt = "sub", .letter = 'd'},
- [ASMULD] = {.fun = binary, .txt = "mul", .letter = 'd'},
- [ASDIVD] = {.fun = binary, .txt = "div", .letter = 'd'},
- [ASLTD] = {.fun = binary, .txt = "cltd", .letter = 'w'},
- [ASGTD] = {.fun = binary, .txt = "cgtd", .letter = 'w'},
- [ASLED] = {.fun = binary, .txt = "cled", .letter = 'w'},
- [ASGED] = {.fun = binary, .txt = "cged", .letter = 'w'},
- [ASEQD] = {.fun = binary, .txt = "ceqd", .letter = 'w'},
- [ASNED] = {.fun = binary, .txt = "cned", .letter = 'w'},
-
- [ASEXTBW] = {.fun = unary, .txt = "extsb", .letter = 'w'},
- [ASUEXTBW]= {.fun = unary, .txt = "extub", .letter = 'w'},
- [ASEXTBL] = {.fun = unary, .txt = "extsb", .letter = 'l'},
- [ASUEXTBL]= {.fun = unary, .txt = "extub", .letter = 'l'},
- [ASEXTHW] = {.fun = unary, .txt = "extsh", .letter = 'w'},
- [ASUEXTHW]= {.fun = unary, .txt = "extuh", .letter = 'w'},
- [ASEXTWL] = {.fun = unary, .txt = "extsw", .letter = 'l'},
- [ASUEXTWL]= {.fun = unary, .txt = "extuw", .letter = 'l'},
-
- [ASSTOL] = {.fun = unary, .txt = "stosi", .letter = 'l'},
- [ASSTOW] = {.fun = unary, .txt = "stosi", .letter = 'w'},
- [ASDTOL] = {.fun = unary, .txt = "dtosi", .letter = 'l'},
- [ASDTOW] = {.fun = unary, .txt = "dtosi", .letter = 'w'},
-
- [ASSWTOD] = {.fun = unary, .txt = "swtof", .letter = 'd'},
- [ASSWTOS] = {.fun = unary, .txt = "swtof", .letter = 's'},
- [ASSLTOD] = {.fun = unary, .txt = "sltof", .letter = 'd'},
- [ASSLTOS] = {.fun = unary, .txt = "sltof", .letter = 's'},
-
- [ASEXTS] = {.fun = unary, .txt = "exts", .letter = 'd'},
- [ASTRUNCD] = {.fun = unary, .txt = "truncd", .letter = 's'},
-
- [ASBRANCH] = {.fun = branch},
- [ASJMP] = {.fun = jmp},
- [ASRET] = {.fun = ret},
- [ASCALL] = {.fun = call},
- [ASCALLE] = {.fun = ecall, .txt = ")"},
- [ASCALLEX] = {.fun = ecall, .txt = ", ...)"},
- [ASPAR] = {.fun = param, .txt = "%s %s, "},
- [ASPARE] = {.fun = param, .txt = "%s %s"},
- [ASALLOC] = {.fun = asalloc},
- [ASFORM] = {.fun = form2local},
-
- [ASVSTAR] = {.fun = vastart},
- [ASVARG] = {.fun = vaarg},
-};
-
-static char buff[ADDR_LEN];
-/*
- * : is for user-defined Aggregate Types
- * $ is for globals (represented by a pointer)
- * % is for function-scope temporaries
- * @ is for block labels
- */
-static char
-sigil(Symbol *sym)
-{
- switch (sym->kind) {
- case SEXTRN:
- case SGLOB:
- case SPRIV:
- case SLOCAL:
- return '$';
- case SAUTO:
- case STMP:
- return '%';
- case SLABEL:
- return '@';
- default:
- abort();
- }
-}
-
-static char *
-symname(Symbol *sym)
-{
- char c = sigil(sym);
-
- if (sym->name) {
- switch (sym->kind) {
- case SEXTRN:
- case SGLOB:
- sprintf(buff, "%c%s", c, sym->name);
- return buff;
- case SLOCAL:
- case SPRIV:
- case SAUTO:
- sprintf(buff, "%c%s.%u", c, sym->name, sym->id);
- return buff;
- default:
- abort();
- }
- }
- sprintf(buff, "%c.%u", c, sym->numid);
-
- return buff;
-}
-
-static void
-emitconst(Node *np)
-{
- switch (np->type.size) {
- case 1:
- printf("%d", (int) np->u.i & 0xFF);
- break;
- case 2:
- printf("%d", (int) np->u.i & 0xFFFF);
- break;
- case 4:
- printf("%ld", (long) np->u.i & 0xFFFFFFFF);
- break;
- case 8:
- printf("%lld", (long long) np->u.i);
- break;
- default:
- abort();
- }
-}
-
-static void
-emittree(Node *np)
-{
- if (!np)
- return;
-
- switch (np->op) {
- case OSTRING:
- printf("\"%s\"", np->u.s);
- free(np->u.s);
- np->u.s = NULL;
- break;
- case OCONST:
- emitconst(np);
- break;
- case OADDR:
- emittree(np->left);
- break;
- case OMEM:
- fputs(symname(np->u.sym), stdout);
- break;
- default:
- emittree(np->left);
- printf(" %c ", np->op);
- emittree(np->right);
- break;
- }
-}
-
-static char *
-size2asm(Type *tp)
-{
- if (tp->flags & STRF) {
- return "b";
- } else if (tp->flags & INTF) {
- switch (tp->size) {
- case 1:
- return "b";
- case 2:
- return "h";
- case 4:
- return "w";
- case 8:
- return "l";
- }
- } else if (tp->flags & FLOATF) {
- if (tp->size == 4)
- return "s";
- else if (tp->size == 8)
- return "d";
- }
- abort();
-}
-
-void
-defglobal(Symbol *sym)
-{
- if (sym->kind == SEXTRN)
- return;
- if (sym->kind == SGLOB)
- fputs("export ", stdout);
- printf("data %s = {\n", symname(sym));
- if (sym->type.flags & INITF)
- return;
- printf("\tz\t%lu\n}\n", sym->type.size);
-}
-
-void
-defpar(Symbol *sym)
-{
- sym->type.flags |= PARF;
-}
-
-void
-defvar(Symbol *sym)
-{
- if (sym->kind == SREG)
- sym->kind = SAUTO;
-}
-
-void
-data(Node *np)
-{
- printf("\t%s\t", size2asm(&np->type));
- emittree(np);
- putchar(',');
- putchar('\n');
-}
-
-static char *
-size2stack(Type *tp)
-{
- if (tp->flags & INTF) {
- switch (tp->size) {
- case 1:
- case 2:
- case 4:
- return "w";
- case 8:
- return "l";
- }
- } else if (tp->flags & FLOATF) {
- if (tp->size == 4)
- return "s";
- else if (tp->size == 8)
- return "d";
- } else if (tp->size == 0) {
- return "w";
- }
- abort();
-}
-
-void
-writeout(void)
-{
- Symbol *p;
- Type *tp;
- char *sep, *name;
- int haslabel = 0;
-
- if (!curfun)
- return;
- if (curfun->kind == SGLOB)
- fputs("export ", stdout);
- printf("function %s %s(", size2stack(&curfun->rtype), symname(curfun));
-
- /* declare formal parameters */
- for (sep = "", p = locals; p; p = p->next, sep = ",") {
- if ((p->type.flags & PARF) == 0)
- break;
- printf("%s%s %s.val", sep, size2stack(&p->type), symname(p));
- }
- printf("%s)\n{\n", (curfun->type.flags&ELLIPS) ? ", ..." : "");
-
- /* emit assembler instructions */
- for (pc = prog; pc; pc = pc->next) {
- if (pc->label) {
- haslabel = 1;
- printf("%s\n", symname(pc->label));
- }
- if (!pc->op)
- continue;
- if (pc->flags&BBENTRY && !haslabel)
- printf("%s\n", symname(newlabel()));
- (*optbl[pc->op].fun)();
- if (!pc->label)
- haslabel = 0;
- }
-
- puts("}");
-}
-
-static char *
-addr2txt(Addr *a)
-{
- switch (a->kind) {
- case SCONST:
- sprintf(buff, "%llu", (unsigned long long) a->u.i);
- return buff;
- case SAUTO:
- case SLABEL:
- case STMP:
- case SGLOB:
- case SEXTRN:
- case SPRIV:
- case SLOCAL:
- return symname(a->u.sym);
- default:
- abort();
- }
-}
-
-static void
-binary(void)
-{
- struct opdata *p = &optbl[pc->op];
- char to[ADDR_LEN], from1[ADDR_LEN], from2[ADDR_LEN];
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from1, addr2txt(&pc->from1));
- strcpy(from2, addr2txt(&pc->from2));
- printf("\t%s =%c\t%s\t%s,%s\n", to, p->letter, p->txt, from1, from2);
-}
-
-static void
-ldir(void)
-{
- struct opdata *p = &optbl[pc->op];
- char to[ADDR_LEN], from[ADDR_LEN];
- /* TODO: what type do we use for the size? */
-
- /* TODO: it is pending */
-}
-
-static void
-store(void)
-{
- struct opdata *p = &optbl[pc->op];
- char to[ADDR_LEN], from[ADDR_LEN];
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from, addr2txt(&pc->from1));
- printf("\t\t%s%c\t%s,%s\n", p->txt, p->letter, from, to);
-}
-
-static void
-unary(void)
-{
- struct opdata *p = &optbl[pc->op];
- char to[ADDR_LEN], from[ADDR_LEN];
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from, addr2txt(&pc->from1));
- printf("\t%s =%c\t%s\t%s\n", to, p->letter, p->txt, from);
-}
-
-static void
-call(void)
-{
- struct opdata *p = &optbl[pc->op];
- char to[ADDR_LEN], from[ADDR_LEN];
- Symbol *sym = pc->to.u.sym;
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from, addr2txt(&pc->from1));
- printf("\t%s =%s\tcall\t%s(",
- to, size2stack(&sym->type), from);
-}
-
-static void
-param(void)
-{
- Symbol *sym = pc->from2.u.sym;
-
- printf(optbl[pc->op].txt,
- size2stack(&sym->type), addr2txt(&pc->from1));
-}
-
-static void
-ecall(void)
-{
- struct opdata *p = &optbl[pc->op];
-
- puts(p->txt);
-}
-
-static void
-ret(void)
-{
- if (pc->from1.kind == SNONE)
- puts("\t\tret");
- else
- printf("\t\tret\t%s\n", addr2txt(&pc->from1));
-}
-
-static void
-jmp(void)
-{
- printf("\t\tjmp\t%s\n", addr2txt(&pc->from1));
-}
-
-static void
-branch(void)
-{
- char to[ADDR_LEN], from1[ADDR_LEN], from2[ADDR_LEN];
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from1, addr2txt(&pc->from1));
- strcpy(from2, addr2txt(&pc->from2));
- printf("\t\tjnz\t%s,%s,%s\n", to, from1, from2);
-}
-
-static void
-vastart(void)
-{
- printf("\t\tvastart %s\n", addr2txt(&pc->from1));
-}
-
-static void
-vaarg(void)
-{
- Symbol *sym = pc->to.u.sym;
- Type *tp = &sym->type;
- char to[ADDR_LEN], from[ADDR_LEN];
-
- strcpy(to, addr2txt(&pc->to));
- strcpy(from, addr2txt(&pc->from1));
- printf("\t\t%s =%s vaarg %s\n", to, size2asm(tp), from);
-}
-
-static void
-asalloc(void)
-{
- Symbol *sym = pc->to.u.sym;
- Type *tp = &sym->type;
- extern Type ptrtype;
-
- printf("\t%s =%s\talloc%lu\t%lu\n",
- symname(sym), size2asm(&ptrtype), tp->align+3 & ~3, tp->size);
-}
-
-static void
-form2local(void)
-{
- Symbol *sym = pc->to.u.sym;
- Type *tp = &sym->type;
- char *name = symname(sym);
-
- printf("\t\tstore%s\t%s.val,%s\n", size2asm(tp), name, name);
-}
-
-void
-endinit(void)
-{
- puts("}");
-}
-
-void
-getbblocks(void)
-{
- Inst *i;
-
- if (!prog)
- return;
-
- prog->flags |= BBENTRY;
- for (pc = prog; pc; pc = pc->next) {
- switch (pc->op) {
- case ASBRANCH:
- i = pc->from2.u.sym->u.inst;
- i->flags |= BBENTRY;
- case ASJMP:
- i = pc->from1.u.sym->u.inst;
- i->flags |= BBENTRY;
- case ASRET:
- if (pc->next)
- pc->next->flags |= BBENTRY;
- break;
- }
- }
-}
--- a/cc2/target/qbe/optm.c
+++ /dev/null
@@ -1,57 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/qbe/optm.c";
-
-#include <stddef.h>
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-optm_dep(Node *np)
-{
- int op = np->op;
- Node *p, *dst, *next = np->next;
- Symbol *sym, *osym;
-
- switch (op) {
- case OEFUN:
- /*
- * In QBE we need at the end of a basic block
- * a jump, so we have to ensure that the last
- * statement of the function is a ret, a jmp
- * or a branch. In the same way, QBE does
- * not accept labels at the end of a function
- * (ONOP is used for labels) so we have to add
- * a ret there, and in the case of branches
- * we need a label for the next statement
- */
- op = (np->prev) ? np->prev->op : 0;
- if (!op || op == ONOP || op == OBRANCH || (op != ORET && op != OJMP))
- addstmt(node(ORET), KEEPCUR);
- break;
- case OBRANCH:
- if (!next->label) {
- sym = getsym(TMPSYM);
- sym->kind = SLABEL;
- next->label = sym;
- }
- case OJMP:
- for (;;) {
- dst = np->u.sym->u.stmt;
- if (dst->op != OJMP)
- break;
- np->u.sym = dst->u.sym;
- }
- for (p = np->next; p; p = p->next) {
- if (p == dst)
- return NULL;
- if (p->op == ONOP ||
- p->op == OBLOOP ||
- p->op == OELOOP) {
- continue;
- }
- break;
- }
- break;
- }
- return np;
-}
--- a/cc2/target/qbe_amd64-sysv/target.mk
+++ /dev/null
@@ -1,9 +1,0 @@
-
-OBJ-qbe_amd64-sysv = $(OBJ) \
- target/qbe/cgen.o \
- target/qbe/optm.o \
- target/qbe/code.o \
- target/amd64-sysv/types.o
-
-$(LIBEXEC)/cc2-qbe_amd64-sysv: $(OBJ-qbe_amd64-sysv)
- $(CC) $(SCC_LDFLAGS) $(OBJ-qbe_amd64-sysv) -lscc -o $@
--- a/cc2/target/qbe_arm64-sysv/target.mk
+++ /dev/null
@@ -1,5 +1,0 @@
-OBJ-qbe_arm64-sysv = $(OBJ) \
- target/qbe/cgen.o \
- target/qbe/optm.o \
- target/qbe/code.o \
- target/arm64-sysv/types.o
--- a/cc2/target/z80-scc/arch.h
+++ /dev/null
@@ -1,5 +1,0 @@
-enum asmop {
- ASJMP = 0,
- ASRET,
- ASBRANCH,
-};
--- a/cc2/target/z80-scc/cgen.c
+++ /dev/null
@@ -1,160 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/z80/cgen.c";
-
-#include <stdlib.h>
-
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-static void
-swtch(Node *idx)
-{
-}
-
-static Node *
-rhs(Node *np, Node *ret)
-{
-}
-
-static Node *
-field(Node *np, Node *ret, int islhs)
-{
-}
-
-static Node *
-lhs(Node *np, Node *new)
-{
- switch (np->op) {
- case OMEM:
- case OAUTO:
- *new = *np;
- return new;
- case OPTR:
- return rhs(np->left, new);
- case OFIELD:
- return field(np, new, 1);
- default:
- abort();
- }
-}
-
-static void
-bool(Node *np, Symbol *true, Symbol *false)
-{
- Node *l = np->left, *r = np->right;
- Node ret, ifyes, ifno;
- Symbol *label;
-
- switch (np->op) {
- case ONEG:
- bool(l, false, true);
- break;
- case OAND:
- label = newlabel();
- bool(l, label, false);
- setlabel(label);
- bool(r, true, false);
- break;
- case OOR:
- label = newlabel();
- bool(l, true, label);
- setlabel(label);
- bool(r, true, false);
- break;
- default:
- label2node(&ifyes, true);
- label2node(&ifno, false);
- code(ASBRANCH, rhs(np, &ret), &ifyes, &ifno);
- break;
- }
-}
-
-Node *
-cgen(Node *np)
-{
- Node aux, *p, *next;
-
- setlabel(np->label);
- switch (np->op) {
- case OJMP:
- label2node(&aux, np->u.sym);
- code(ASJMP, NULL, &aux, NULL);
- break;
- case OBRANCH:
- next = np->next;
- if (!next->label)
- next->label = newlabel();
- bool(np->left, np->u.sym, next->label);
- break;
- case ORET:
- p = np->left;
- if (p)
- p = rhs(np->left, &aux);
- code(ASRET, NULL, p, NULL);
- break;
- case OBSWITCH:
- swtch(rhs(np->left, &aux));
- break;
- default:
- rhs(np, &aux);
- break;
- }
- return NULL;
-}
-
-/*
- * This is strongly influenced by
- * http://plan9.bell-labs.com/sys/doc/compiler.ps (/sys/doc/compiler.ps)
- * calculate addresability as follows
- * AUTO => 11 value+fp
- * REG => 13 reg
- * STATIC => 12 (value)
- * CONST => 20 $value
- */
-Node *
-sethi(Node *np)
-{
- Node *lp, *rp;
-
- if (!np)
- return np;
-
- np->complex = 0;
- np->address = 0;
- lp = np->left;
- rp = np->right;
- switch (np->op) {
- case OAUTO:
- np->address = 11;
- break;
- case OREG:
- np->address = 13;
- break;
- case OMEM:
- np->address = 12;
- break;
- case OCONST:
- np->address = 20;
- break;
- default:
- sethi(lp);
- sethi(rp);
- break;
- }
-
- if (np->address > 10)
- return np;
- if (lp)
- np->complex = lp->complex;
- if (rp) {
- int d = np->complex - rp->complex;
-
- if (d == 0)
- ++np->complex;
- else if (d < 0)
- np->complex = rp->complex;
- }
- if (np->complex == 0)
- ++np->complex;
- return np;
-}
--- a/cc2/target/z80-scc/code.c
+++ /dev/null
@@ -1,228 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/z80/code.c";
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <cstd.h>
-#include "arch.h"
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-enum segment {
- CODESEG,
- DATASEG,
- BSSSEG,
- NOSEG
-};
-
-static int curseg = NOSEG;
-static unsigned long offpar, offvar;
-
-static void
-segment(int seg)
-{
- static char *txt[] = {
- [CODESEG] = "\tCSEG\n",
- [DATASEG] = "\tDSEG\n",
- [BSSSEG] = "\tASEG\n",
- };
-
- if (seg == curseg)
- return;
- fputs(txt[seg], stdout);
- curseg = seg;
-}
-
-static char *
-symname(Symbol *sym)
-{
- static char name[INTIDENTSIZ+1];
-
- if (sym->name) {
- switch (sym->kind) {
- case SGLOB:
- case SEXTRN:
- snprintf(name, sizeof(name), "_%s", sym->name);
- return name;
- case SPRIV:
- return sym->name;
- }
- }
-
- sprintf(name, ".%d", sym->numid);
-
- return name;
-}
-
-static void
-label(Symbol *sym)
-{
- int seg;
- char *name = symname(sym);
-
- if (sym->type.flags & FUNF)
- seg = CODESEG;
- else if (sym->type.flags & INITF)
- seg = DATASEG;
- else
- seg = BSSSEG;
- segment(seg);
-
- switch (sym->kind) {
- case SEXTRN:
- printf("\tEXTRN\t%s\n", name);
- return;
- case SGLOB:
- printf("\tPUBLIC\t%s\n", name);
- break;
- }
-
- printf("%s:\n", name);
-}
-
-static void
-emitconst(Node *np)
-{
- switch (np->type.size) {
- case 1:
- printf("%d", (int) np->u.i & 0xFF);
- break;
- case 2:
- printf("%d", (int) np->u.i & 0xFFFF);
- break;
- case 4:
- printf("%ld", (long) np->u.i & 0xFFFFFFFF);
- break;
- default:
- abort();
- }
-}
-
-static void
-emittree(Node *np)
-{
- if (!np)
- return;
-
- switch (np->op) {
- case OSTRING:
- printf("\"%s\"", np->u.s);
- free(np->u.s);
- np->u.s = NULL;
- break;
- case OCONST:
- emitconst(np);
- break;
- case OADDR:
- emittree(np->left);
- break;
- case OMEM:
- fputs(symname(np->u.sym), stdout);
- break;
- default:
- emittree(np->left);
- printf(" %c ", np->op);
- emittree(np->right);
- break;
- }
-}
-
-static void
-size2asm(Type *tp)
-{
- char *s;
-
- /*
- * In z80 we can ignore the alignment
- */
- if (tp->flags & STRF) {
- s = "\tDB\t";
- } else {
- switch (tp->size) {
- case 1:
- s = "\tDB\t";
- break;
- case 2:
- s = "\tDW\t";
- break;
- case 4:
- s = "\tDD\t";
- break;
- default:
- s = "\tDS\t%lu,";
- break;
- }
- }
- printf(s, tp->size);
-}
-
-void
-newfun()
-{
- offpar = offvar = 0;
-}
-
-void
-defpar(Symbol *sym)
-{
- unsigned long align, size;
-
- if (sym->kind != SREG && sym->kind != SAUTO)
- return;
- align = sym->type.align;
- size = sym->type.size;
-
- offpar -= align-1 & ~align;
- sym->u.off = offpar;
- offpar -= size;
- sym->kind = SAUTO;
-}
-
-void
-defvar(Symbol *sym)
-{
- unsigned long align, size;
-
- if (sym->kind != SREG && sym->kind != SAUTO)
- return;
- align = sym->type.align;
- size = sym->type.size;
-
- offvar += align-1 & ~align;
- sym->u.off = offvar;
- offvar += size;
- sym->kind = SAUTO;
-}
-
-void
-defglobal(Symbol *sym)
-{
- label(sym);
- if (sym->kind == SEXTRN || (sym->type.flags & INITF))
- return;
- size2asm(&sym->type);
- puts("0");
-}
-
-void
-data(Node *np)
-{
- size2asm(&np->type);
- emittree(np);
- putchar('\n');
-}
-
-void
-writeout(void)
-{
-}
-
-void
-endinit(void)
-{
-}
-
-void
-getbblocks(void)
-{
-}
--- a/cc2/target/z80-scc/optm.c
+++ /dev/null
@@ -1,10 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/z80/optm.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-Node *
-optm_dep(Node *np)
-{
- return np;
-}
--- a/cc2/target/z80-scc/target.mk
+++ /dev/null
@@ -1,9 +1,0 @@
-
-OBJ-z80-scc = $(OBJ) \
- target/z80-scc/cgen.o \
- target/z80-scc/optm.o \
- target/z80-scc/code.o \
- target/z80-scc/types.o
-
-$(LIBEXEC)/cc2-z80-scc: $(OBJ-z80-scc)
- $(CC) $(SCC_LDFLAGS) $(OBJ-z80-scc) -lscc -o $@
--- a/cc2/target/z80-scc/types.c
+++ /dev/null
@@ -1,94 +1,0 @@
-static char sccsid[] = "@(#) ./cc2/arch/z80/types.c";
-
-#include "../../../inc/scc.h"
-#include "../../cc2.h"
-
-
-Type int8type = {
- .flags = SIGNF | INTF,
- .size = 1,
- .align = 1
-};
-
-Type int16type = {
- .flags = SIGNF | INTF,
- .size = 2,
- .align = 1
-};
-
-Type int32type = {
- .flags = SIGNF | INTF,
- .size = 4,
- .align = 1
-};
-
-Type int64type = {
- .flags = SIGNF | INTF,
- .size = 8,
- .align = 1
-};
-
-Type uint8type = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type uint16type = {
- .flags = INTF,
- .size = 2,
- .align = 1
-};
-
-Type uint32type = {
- .flags = INTF,
- .size = 4,
- .align = 1
-};
-
-Type uint64type = {
- .flags = INTF,
- .size = 8,
- .align = 1
-};
-
-Type ptrtype = {
- .flags = INTF,
- .size = 2,
- .align = 1
-};
-
-Type booltype = {
- .flags = INTF,
- .size = 1,
- .align = 1
-};
-
-Type float32type = {
- .flags = FLOATF,
- .size = 4,
- .align = 1
-};
-
-Type float64type = {
- .flags = FLOATF,
- .size = 4,
- .align = 1
-};
-
-Type float80type = {
- .flags = FLOATF,
- .size = 4,
- .align = 1
-};
-
-Type voidtype = {
- .size = 0,
- .align = 0
-};
-
-/* this types is not going to be used in this arch */
-Type arg_type = {
- .size = 0,
- .align = 0
-};
--- a/config.mk
+++ /dev/null
@@ -1,30 +1,0 @@
-# scc version
-VERSION = 0.1
-
-## Customize below to fit your system
-DRIVER = posix
-
-# Can be c89 or c99
-STD = c99
-
-# paths
-PREFIX = $(PWD)/$(PROJECTDIR)/root
-MANPREFIX = $(PREFIX)/share/man
-
-# scc expects to be built by a C99 compiler
-# if your system is not at least POSIX 2004 compatible, adjust CC
-# CC = c99
-# AR = ar
-AS = as
-
-### Systems
-# Plan9
-#SYSCFLAGS = -D_SUSV2_SOURCE
-#SYSLDCFLAGS =
-#STDCFLAGS =
-###
-# BSD
-#SYSCFLAGS =
-#SYSLDCFLAGS =
-#STDCFLAGS = -D_ISOC99_SOURCE -D_ANSI_SOURCE
-###
--- a/config.sh
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/sh
-
-case `uname` in
-*BSD)
- sys=BSD
- ;;
-*Plan9)
- sys=Plan9
- ;;
-*)
- exit
- ;;
-esac
-
-
-(echo '/^# '$sys'/+;/^###$/- s/^#//'; echo w) | ed -s config.mk
--- /dev/null
+++ b/config/amd64-linux.mk
@@ -1,0 +1,8 @@
+ARCH = amd64
+SYS = linux
+ABI = amd64-posix
+DRIVER = posix
+STD = c99
+PREFIX = $(PWD)/$(PROJECTDIR)/root
+MANPREFIX = $(PREFIX)/share/man
+AS = as
--- /dev/null
+++ b/config/i386-linux.mk
@@ -1,0 +1,5 @@
+DRIVER = posix
+STD = c99
+PREFIX = $(PWD)/$(PROJECTDIR)/root
+MANPREFIX = $(PREFIX)/share/man
+AS = as
--- a/driver/Makefile
+++ /dev/null
@@ -1,10 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-# fallback case if DRIVER isn't defined
-DRIVER = posix
-
-include $(PROJECTDIR)/rules.mk
-
-all dep clean distclean:
- +@cd $(DRIVER) && $(MAKE) $@
--- a/driver/posix/Makefile
+++ /dev/null
@@ -1,42 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-include $(INCLUDE)/incdep.mk
-
-# SYSLST is a list of backend-arch-abi-sys. First
-# element of the list becomes the default target
-
-SYSLST = amd64-sysv-linux-elf z80-scc-none-none \
- i386-sysv-linux-elf amd64-sysv-openbsd-elf
-
-STDCFLAGS =
-
-TARGETS = $(BINDIR)/scc $(BINDIR)/scpp
-
-all: $(TARGETS)
-
-$(BINDIR)/scc: scc.o $(LIBDIR)/libscc.a
- $(CC) $(SCC_LDFLAGS) scc.o -lscc -o $@
-
-$(BINDIR)/scpp: cpp.sh config.h
- set -x ;\
- trap "rm -f $$$$.sh" 0 2 3;\
- rm -f $@ ;\
- sed "s%@PREFIX@%$(PREFIX)%" < cpp.sh > $$$$.sh && \
- chmod +x $$$$.sh && \
- mv $$$$.sh $@
-
-config.h:
- PREFIX=$(PREFIX) ./config.sh $(SYSLST)
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f scc scpp *.o
- rm -f $(TARGETS)
- rm -f config.h
-
-include deps.mk
--- a/driver/posix/config.sh
+++ /dev/null
@@ -1,16 +1,0 @@
-#!/bin/sh
-
-set -e
-
-rm -f config.h
-trap "rm -f $$.h" 0 2 3
-
-PREFIX=${PREFIX-$HOME}
-
-echo $@ |
-(IFS='- ' read arch abi sys format r
-echo \#define PREFIX \"$PREFIX\"
-echo \#define ARCH \"$arch\"
-echo \#define SYS \"$sys\"
-echo \#define ABI \"$abi\"
-echo \#define FORMAT \"$format\") > $$.h && mv $$.h config.h
--- a/driver/posix/cpp.sh
+++ /dev/null
@@ -1,4 +1,0 @@
-#!/bin/sh
-
-SCCPREFIX=${SCCPREFIX:-@PREFIX@}
-${SCCPREFIX}/bin/scc -E $@
--- a/driver/posix/deps.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-#deps
-scc.o: ../../inc/arg.h
-scc.o: ../../inc/ldflags.h
-scc.o: ../../inc/scc.h
-scc.o: ../../inc/syscrts.h
-scc.o: ../../inc/sysincludes.h
-scc.o: ../../inc/syslibs.h
-scc.o: config.h
--- a/driver/posix/scc.c
+++ /dev/null
@@ -1,617 +1,0 @@
-static char sccsid[] = "@(#) ./driver/posix/scc.c";
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE 500
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "../../inc/arg.h"
-#include "../../inc/scc.h"
-#include "../../inc/syscrts.h"
-#include "../../inc/sysincludes.h"
-#include "../../inc/syslibs.h"
-#include "../../inc/ldflags.h"
-
-enum {
- CC1,
- TEEIR,
- CC2,
- TEEQBE,
- QBE,
- TEEAS,
- AS,
- LD,
- STRIP,
- LAST_TOOL,
-};
-
-static struct tool {
- char cmd[PATH_MAX];
- char bin[32];
- char *outfile;
- struct items args;
- unsigned nparams;
- int in, out, init;
- pid_t pid;
-} tools[] = {
- [CC1] = { .cmd = "cc1" },
- [TEEIR] = { .bin = "tee", .cmd = "tee", },
- [CC2] = { .cmd = "cc2" },
- [TEEQBE] = { .bin = "tee", .cmd = "tee", },
- [QBE] = { .bin = "qbe", .cmd = "qbe", },
- [TEEAS] = { .bin = "tee", .cmd = "tee", },
- [AS] = { .bin = "as", .cmd = "as", },
- [LD] = { .bin = "ld", .cmd = "ld", },
- [STRIP] = { .bin = "strip", .cmd = "strip", },
-};
-
-char *argv0;
-static char *arch, *sys, *abi, *format;
-static char *prefix, *objfile, *outfile;
-static char *tmpdir;
-static size_t tmpdirln;
-static struct items objtmp, objout;
-static int Mflag, Eflag, Sflag, cflag, dflag, kflag, sflag, Qflag = 1; /* TODO: Remove Qflag */
-static int devnullfd = -1;
-
-extern int failure;
-
-static void
-terminate(void)
-{
- unsigned i;
-
- if (!kflag) {
- for (i = 0; i < objtmp.n; ++i)
- unlink(objtmp.s[i]);
- }
-}
-
-static void
-addarg(int tool, char *arg)
-{
- struct tool *t = &tools[tool];
-
- if (t->args.n < 1)
- t->args.n = 1;
-
- newitem(&t->args, arg);
-}
-
-static void
-setargv0(int tool, char *arg)
-{
- struct tool *t = &tools[tool];
-
- if (t->args.n > 0)
- t->args.s[0] = arg;
- else
- newitem(&t->args, arg);
-}
-
-static int
-qbe(int tool)
-{
- if (tool != CC2 || !Qflag)
- return 0;
- if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv"))
- return 1;
- return 0;
-}
-
-static int
-inittool(int tool)
-{
- struct tool *t = &tools[tool];
- char *crt, *fmt;
- int n;
-
- if (t->init)
- return tool;
-
- switch (tool) {
- case CC1:
- for (n = 0; sysincludes[n]; ++n) {
- addarg(tool, "-I");
- addarg(tool, sysincludes[n]);
- }
- case CC2:
- fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s";
- n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi);
- if (n < 0 || n >= sizeof(t->bin))
- die("scc: target tool name too long");
-
- n = snprintf(t->cmd, sizeof(t->cmd),
- "%s/libexec/scc/%s", prefix, t->bin);
- if (n < 0 || n >= sizeof(t->cmd))
- die("scc: target tool path too long");
- break;
- case LD:
- for (n = 0; ldflags[n]; ++n)
- addarg(tool, ldflags[n]);
- addarg(tool, "-o");
- t->outfile = outfile ? outfile : xstrdup("a.out");
- addarg(tool, t->outfile);
- for (n = 0; syslibs[n]; ++n) {
- addarg(tool, "-L");
- addarg(tool, syslibs[n]);
- }
- if (syscrts[0]) {
- for (n = 0; syscrts[n]; ++n)
- addarg(tool, syscrts[n]);
- break;
- }
- n = snprintf(NULL, 0,
- "%s/lib/scc/%s-%s-%s/crt.o",
- prefix, arch, abi, sys);
- if (n < 0)
- die("scc: wrong crt file name");
- crt = xmalloc(++n);
- sprintf(crt,
- "%s/lib/scc/%s-%s-%s/crt.o",
- prefix, arch, abi, sys);
- addarg(tool, crt);
- break;
- case AS:
- addarg(tool, "-o");
- break;
- default:
- break;
- }
-
- setargv0(tool, t->bin);
- t->nparams = t->args.n;
- t->init = 1;
-
- return tool;
-}
-
-static char *
-outfname(char *path, char *type)
-{
- char *new, sep, *p;
- size_t newsz, pathln;
- int tmpfd, n;
-
- if (path) {
- sep = '.';
- if (p = strrchr(path, '/'))
- path = p + 1;
- pathln = strlen(path);
- if (p = strrchr(path, '.'))
- pathln -= strlen(p);
- } else {
- sep = '/';
- type = "scc-XXXXXX";
- path = tmpdir;
- pathln = tmpdirln;
- }
-
- newsz = pathln + 1 + strlen(type) + 1;
- new = xmalloc(newsz);
- n = snprintf(new, newsz, "%.*s%c%s", (int)pathln, path, sep, type);
- if (n < 0 || n >= newsz)
- die("scc: wrong output filename");
- if (sep == '/') {
- if ((tmpfd = mkstemp(new)) < 0)
- die("scc: could not create output file '%s': %s",
- new, strerror(errno));
- close(tmpfd);
- }
-
- return new;
-}
-
-static int
-settool(int tool, char *infile, int nexttool)
-{
- struct tool *t = &tools[tool];
- unsigned i;
- int fds[2];
- static int fdin = -1;
-
- switch (tool) {
- case TEEIR:
- t->outfile = outfname(infile, "ir");
- addarg(tool, t->outfile);
- break;
- case TEEQBE:
- t->outfile = outfname(infile, "qbe");
- addarg(tool, t->outfile);
- break;
- case TEEAS:
- t->outfile = outfname(infile, "s");
- addarg(tool, t->outfile);
- break;
- case AS:
- if (cflag && outfile) {
- objfile = outfile;
- } else {
- objfile = (cflag || kflag) ? infile : NULL;
- objfile = outfname(objfile, "o");
- }
- t->outfile = xstrdup(objfile);
- addarg(tool, t->outfile);
- break;
- case STRIP:
- if (cflag || kflag) {
- for (i = 0; i < objout.n; ++i)
- addarg(tool, xstrdup(objout.s[i]));
- }
- if (!cflag && tools[LD].outfile)
- addarg(tool, tools[LD].outfile);
- break;
- default:
- break;
- }
-
- if (fdin > -1) {
- t->in = fdin;
- fdin = -1;
- } else {
- t->in = -1;
- if (infile)
- addarg(tool, xstrdup(infile));
- }
-
- if (nexttool < LAST_TOOL) {
- if (pipe(fds))
- die("scc: pipe: %s", strerror(errno));
- t->out = fds[1];
- fdin = fds[0];
- } else {
- t->out = -1;
- }
-
- addarg(tool, NULL);
-
- return tool;
-}
-
-static void
-spawn(int tool)
-{
- struct tool *t = &tools[tool];
-
- switch (t->pid = fork()) {
- case -1:
- die("scc: %s: %s", t->bin, strerror(errno));
- case 0:
- if (t->out > -1)
- dup2(t->out, 1);
- if (t->in > -1)
- dup2(t->in, 0);
- if (!dflag && tool != CC1 && tool != LD)
- dup2(devnullfd, 2);
- execvp(t->cmd, t->args.s);
- if (dflag) {
- fprintf(stderr,
- "scc: execvp %s: %s\n",
- t->cmd,
- strerror(errno));
- }
- abort();
- default:
- if (t->in > -1)
- close(t->in);
- if (t->out > -1)
- close(t->out);
- break;
- }
-}
-
-static int
-toolfor(char *file)
-{
- char *dot = strrchr(file, '.');
-
- if (dot) {
- if (!strcmp(dot, ".c"))
- return CC1;
- if (!strcmp(dot, ".ir"))
- return CC2;
- if (!strcmp(dot, ".qbe"))
- return QBE;
- if (!strcmp(dot, ".s"))
- return AS;
- if (!strcmp(dot, ".o"))
- return LD;
- if (!strcmp(dot, ".a"))
- return LD;
- } else if (!strcmp(file, "-")) {
- return CC1;
- }
-
- die("scc: do not recognize filetype of %s", file);
-}
-
-static int
-valid(int tool, struct tool *t)
-{
- int st;
-
- if (waitpid(t->pid, &st, 0) == -1 || WIFSIGNALED(st))
- goto internal;
- if (WIFEXITED(st) && WEXITSTATUS(st) == 0)
- return 1;
- if (!failure && (tool == CC1 || tool == LD))
- goto fail;
-
-internal:
- fprintf(stderr, "scc:%s: internal error\n", t->bin);
-fail:
- failure = 1;
- return 0;
-}
-
-static int
-validatetools(void)
-{
- struct tool *t;
- unsigned i;
- int tool, st, failed = LAST_TOOL;
-
- for (tool = 0; tool < LAST_TOOL; ++tool) {
- t = &tools[tool];
- if (!t->pid)
- continue;
- if (!valid(tool, t))
- failed = tool;
- if (tool >= failed && t->outfile)
- unlink(t->outfile);
- for (i = t->nparams; i < t->args.n; ++i)
- free(t->args.s[i]);
- t->args.n = t->nparams;
- t->pid = 0;
- }
- if (failed < LAST_TOOL) {
- unlink(objfile);
- free(objfile);
- objfile = NULL;
- return 0;
- }
-
- return 1;
-}
-
-static int
-buildfile(char *file, int tool)
-{
- int nexttool;
-
- for (; tool < LAST_TOOL; tool = nexttool) {
- switch (tool) {
- case CC1:
- if (Eflag || Mflag)
- nexttool = LAST_TOOL;
- else
- nexttool = kflag ? TEEIR : CC2;
- break;
- case TEEIR:
- nexttool = CC2;
- break;
- case CC2:
- if (Qflag)
- nexttool = kflag ? TEEQBE : QBE;
- else
- nexttool = (Sflag || kflag) ? TEEAS : AS;
- break;
- case TEEQBE:
- nexttool = QBE;
- break;
- case QBE:
- nexttool = (Sflag || kflag) ? TEEAS : AS;
- break;
- case TEEAS:
- nexttool = Sflag ? LAST_TOOL : AS;
- break;
- case AS:
- nexttool = LAST_TOOL;
- break;
- default:
- nexttool = LAST_TOOL;
- continue;
- }
-
- spawn(settool(inittool(tool), file, nexttool));
- }
-
- return validatetools();
-}
-
-static void
-build(struct items *chain, int link)
-{
- int i, tool;
-
- if (link)
- inittool(LD);
-
- for (i = 0; i < chain->n; ++i) {
- if (!strcmp(chain->s[i], "-l")) {
- if (link) {
- addarg(LD, xstrdup(chain->s[i++]));
- addarg(LD, xstrdup(chain->s[i]));
- } else {
- ++i;
- }
- continue;
- }
- tool = toolfor(chain->s[i]);
- if (tool == LD) {
- if (link)
- addarg(LD, xstrdup(chain->s[i]));
- continue;
- }
- if (buildfile(chain->s[i], tool)) {
- if (link)
- addarg(LD, xstrdup(objfile));
- newitem((!link || kflag) ? &objout : &objtmp, objfile);
- }
- }
-}
-
-static void
-usage(void)
-{
- fputs("usage: scc [-D def[=val]]... [-U def]... [-I dir]... "
- "[-L dir]... [-l dir]...\n"
- " [-dgksw] [-m arch] [-M|-E|-S] [-o outfile] file...\n"
- " scc [-D def[=val]]... [-U def]... [-I dir]... "
- "[-L dir]... [-l dir]...\n"
- " [-dgksw] [-m arch] [-M|-E|-S] -c file...\n"
- " scc [-D def[=val]]... [-U def]... [-I dir]... "
- "[-L dir]... [-l dir]...\n"
- " [-dgksw] [-m arch] -c -o outfile file\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- struct items linkchain = { .n = 0, };
- int link;
-
- atexit(terminate);
-
- if (!(arch = getenv("ARCH")))
- arch = ARCH;
- if (!(sys = getenv("SYS")))
- sys = SYS;
- if (!(abi = getenv("ABI")))
- abi = ABI;
- if (!(format = getenv("FORMAT")))
- format = FORMAT;
- if (!(prefix = getenv("SCCPREFIX")))
- prefix = PREFIX;
-
- ARGBEGIN {
- case 'D':
- addarg(CC1, "-D");
- addarg(CC1, EARGF(usage()));
- break;
- case 'M':
- Mflag = 1;
- addarg(CC1, "-M");
- break;
- case 'E':
- Eflag = 1;
- addarg(CC1, "-E");
- break;
- case 'I':
- addarg(CC1, "-I");
- addarg(CC1, EARGF(usage()));
- break;
- case 'L':
- addarg(LD, "-L");
- addarg(LD, EARGF(usage()));
- break;
- case 'O':
- EARGF(usage());
- break;
- case 'S':
- Sflag = 1;
- break;
- case 'U':
- addarg(CC1, "-U");
- addarg(CC1, EARGF(usage()));
- break;
- case 'c':
- cflag = 1;
- break;
- case 'd':
- dflag = 1;
- break;
- case 'g':
- addarg(AS, "-g");
- addarg(LD, "-g");
- break;
- case 'k':
- kflag = 1;
- break;
- case 'l':
- newitem(&linkchain, "-l");
- newitem(&linkchain, EARGF(usage()));
- break;
- case 'm':
- arch = EARGF(usage());
- break;
- case 'o':
- outfile = xstrdup(EARGF(usage()));
- break;
- case 's':
- sflag = 1;
- break;
- case 't':
- sys = EARGF(usage());
- break;
- case 'W':
- EARGF(usage());
- case 'w':
- addarg(CC1, "-w");
- break;
- case 'q':
- Qflag = 0;
- break;
- case 'Q':
- Qflag = 1;
- break;
- case '-':
- fprintf(stderr,
- "scc: ignored parameter --%s\n", EARGF(usage()));
- break;
- default:
- usage();
- } ARGOPERAND {
-operand:
- newitem(&linkchain, ARGOP());
- } ARGEND
-
- for (; *argv; --argc, ++argv)
- goto operand;
-
- if (Eflag && linkchain.n == 0)
- newitem(&linkchain, "-");
-
- if (Eflag && Mflag ||
- (Eflag || Mflag) && (Sflag || kflag) ||
- linkchain.n == 0 ||
- linkchain.n > 1 && cflag && outfile)
- usage();
-
- if (!dflag) {
- if ((devnullfd = open("/dev/null", O_WRONLY)) < 0)
- fputs("scc: could not open /dev/null\n", stderr);
- }
-
- if (!(tmpdir = getenv("TMPDIR")) || !tmpdir[0])
- tmpdir = ".";
- tmpdirln = strlen(tmpdir);
-
- build(&linkchain, (link = !(Mflag || Eflag || Sflag || cflag)));
-
- if (!(link || cflag))
- return failure;
-
- if (link && !failure) {
- addarg(LD, xstrdup("-lc"));
- spawn(settool(LD, NULL, LAST_TOOL));
- validatetools();
- }
-
- if (sflag) {
- spawn(settool(inittool(STRIP), NULL, LAST_TOOL));
- validatetools();
- }
-
- return failure;
-}
--- a/inc/Makefile
+++ /dev/null
@@ -1,37 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-
-include $(PROJECTDIR)/rules.mk
-include inclst.mk
-
-all: config
-
-config: $(SYSHDR)
-
-$(INCLUDE)/ldflags.h:
- rm -f $@ ; \
- trap "rm -f $$$$.h" 0 2 3; \
- cat < ldflags.def.h > $$$$.h; \
- mv $$$$.h $@
-
-$(INCLUDE)/syscrts.h:
- rm -f $@ ; \
- trap "rm -f $$$$.h" 0 2 3; \
- sed 's,PREFIX,"$(PREFIX)",g' < syscrts.def.h > $$$$.h && \
- mv $$$$.h $@
-
-$(INCLUDE)/sysincludes.h:
- rm -f $@ ; \
- trap "rm -f $$$$.h" 0 2 3; \
- sed 's,PREFIX,"$(PREFIX)",g' < sysincludes.def.h > $$$$.h && \
- mv $$$$.h $@
-
-$(INCLUDE)/syslibs.h:
- rm -f $@ ; \
- trap "rm -f $$$$.h" 0 2 3; \
- sed 's,PREFIX,"$(PREFIX)",g' < syslibs.def.h > $$$$.h && \
- mv $$$$.h $@
-
-distclean:
- rm -f $(SYSHDR)
--- a/inc/ar.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#define ARMAG "!<arch>\n" /* ar "magic number" */
-#define SARMAG 8 /* strlen(ARMAG); */
-#define ARFMAG "`\n"
-#define SARNAM 16
-
-
-struct ar_hdr {
- char ar_name[SARNAM]; /* name */
- char ar_date[12]; /* modification time */
- char ar_uid[6]; /* user id */
- char ar_gid[6]; /* group id */
- char ar_mode[8]; /* octal file permissions */
- char ar_size[10]; /* size in bytes */
- char ar_fmag[2]; /* consistency check */
-};
--- a/inc/arg.h
+++ /dev/null
@@ -1,67 +1,0 @@
-/*
- * Copy me if you can.
- * by 20h
- */
-
-#ifndef ARG_H__
-#define ARG_H__
-
-extern char *argv0;
-
-/* use main(int argc, char *argv[]) */
-#define ARGBEGIN \
-for (argv0 = *argv, argv++, argc--;\
- argv[0];\
- argc--, argv++) {\
- if (argv[0][0] == '-') {\
- char argc_;\
- char **argv_;\
- int brk_;\
- if (argv[0][1] == '-' && argv[0][2] == '\0') {\
- argv++;\
- argc--;\
- break;\
- }\
- for (brk_ = 0, argv[0]++, argv_ = argv;\
- argv[0][0] && !brk_;\
- argv[0]++) {\
- if (argv_ != argv)\
- break;\
- argc_ = argv[0][0];\
- switch (argc_)
-
-#define ARGOPERAND \
- }\
- } else if (argv[0][0] != '\0') {\
- {
-
-#define ARGEND \
- }\
- } else {\
- break;\
- }\
-}
-
-#define ARGC() argc_
-
-#define ARGOP() argv[0]
-
-#define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX))
-
-#define EARGF(x) \
-((argv[0][1] == '\0' && argv[1] == NULL) ?\
- ((x), abort(), (char *)0) :\
- (brk_ = 1, (argv[0][1] != '\0') ?\
- (&argv[0][1]) :\
- (argc--, argv++, argv[0])))
-
-#define ARGF() \
-((argv[0][1] == '\0' && argv[1] == NULL)?\
- (char *)0 :\
- (brk_ = 1, (argv[0][1] != '\0')?\
- (&argv[0][1]) :\
- (argc--, argv++, argv[0])))
-
-#define LNGARG() &argv[0][0]
-
-#endif
--- a/inc/c89/cstd.h
+++ /dev/null
@@ -1,103 +1,0 @@
-#define STDC_VERSION "199409L"
-
-/* Translation limits */
-/*
- * 15 nesting levels of compound statements, iteration control
- * structures, and selection control structures
- */
-#define NR_BLOCK 15
-/*
- * 8 nesting levels of conditional inclusion
- */
-#define NR_COND 8
-/*
- * 12 pointer, array, and function declarators (in any combinations)
- * modifying an arithmetic, a structure, a union, or an incomplete type
- * in a declaration
- */
-#define NR_DECLARATORS 12
-/*
- * 31 declarators nested by parentheses within a full declarator
- */
-#define NR_SUBTYPE 31
-/*
- * 32 expressions nested by parentheses within a full expression
- */
-#define NR_SUBEXPR 32
-/*
- * 31 significant initial characters in an internal identifier or a
- * macro name
- */
-#define INTIDENTSIZ 31
-/*
- * 6 significant initial characters in an external identifier
- */
-#define EXTIDENTSIZ 6
-/*
- * 511 external identifiers in one translation unit
- */
-#define NR_EXT_IDENT 511
-/*
- * 127 identifiers with block scope declared in one block
- */
-#define NR_INT_IDENT 127
-/*
- * 1024 macro identifiers simultaneously defined in one translation
- * unit
- */
-#define NR_MACROIDENT 1024
-/*
- * 31 parameters in one function definition
- */
-#define NR_FUNPARAM 31
-/*
- * 31 arguments in one function call
- */
-#define NR_FUNARG 31
-/*
- * 31 parameters in one macro definition
- */
-#define NR_MACROPARAM 31
-/*
- * 31 arguments in one macro invocation
- */
-#define NR_MACROARG 31
-/*
- * 509 characters in a logical source line
- */
-#define LINESIZ 509
-/*
- * 509 characters in a character string literal or wide string literal
- * (after concatenation)
- */
-#define STRINGSIZ 509
-/*
- * 32767 bytes in an object (in a hosted environment only)
- */
-#define OBJECTSIZ 32767
-/*
- * 8 nesting levels for #include'd files
- */
-#define NR_INCLUDE 8
-/*
- * 257 case labels for a switch statement (excluding those for any
- * nested switch statements)
- */
-#define NR_SWITCH 257
-/*
- * 127 members in a single structure or union
- */
-#define NR_FIELDS 127
-/*
- * 127 enumeration constants in a single enumeration
- */
-#define NR_ENUM_CTES 127
-/*
- * 15 levels of nested structure or union definitions in a single
- * struct-declaration-list
- */
-#define NR_STRUCT_LEVEL 15
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
--- a/inc/c99/cstd.h
+++ /dev/null
@@ -1,111 +1,0 @@
-#define STDC_VERSION "199901L"
-
-/* Translation limits */
-/*
- * 127 nesting levels of blocks
- */
-#define NR_BLOCK 127
-/*
- * 63 nesting levels of conditional inclusion
- */
-#define NR_COND 63
-/*
- * 12 pointer, array, and function declarators (in any combinations)
- * modifying an arithmetic, a structure, a union, or an incomplete type
- * in a declaration
- */
-#define NR_DECLARATORS 12
-/*
- * 63 nesting levels of parenthesized declarators within a full
- * declarator
- */
-#define NR_SUBTYPE 63
-/*
- * 63 nesting levels of parenthesized expressions within a full
- * expression
- */
-#define NR_SUBEXPR 63
-/*
- * 63 significant initial characters in an internal identifier or a
- * macro name (each universal character name or extended source
- * character is considered a single character)
- */
-#define INTIDENTSIZ 63
-/*
- * 31 significant initial characters in an external identifier (each
- * universal character name specifying a short identifier of 0000FFFF
- * or less is considered 6 characters, each universal character name
- * specifying a short identifier of 00010000 or more is considered 10
- * characters, and each extended source character is considered the
- * same number of characters as the corresponding universal character
- * name, if any)
- */
-#define EXTIDENTSIZ 31
-/*
- * 4095 external identifiers in one translation unit
- */
-#define NR_EXT_IDENT 4095
-/*
- * 511 identifiers with block scope declared in one block
- */
-#define NR_INT_IDENT 511
-/*
- * 4096 macro identifiers simultaneously defined in one preprocessing
- * translation unit
- */
-#define NR_MACROIDENT 4096
-/*
- * 127 parameters in one function definition
- */
-#define NR_FUNPARAM 127
-/*
- * 127 arguments in one function call
- */
-#define NR_FUNARG 127
-/*
- * 127 parameters in one macro definition
- */
-#define NR_MACROPARAM 127
-/*
- * 127 arguments in one macro invocation
- */
-#define NR_MACROARG 127
-/*
- * 4095 characters in a logical source line
- */
-#define LINESIZ 4095
-/*
- * 4095 characters in a character string literal or wide string literal
- * (after concatenation)
- */
-#define STRINGSIZ 4095
-/*
- * 65535 bytes in an object (in a hosted environment only)
- */
-#define OBJECTSIZ 65535
-/*
- * 15 nesting levels for #include'd files
- */
-#define NR_INCLUDE 15
-/*
- * 1023 case labels for a switch statement (excluding those for any
- * nested switch statements)
- */
-#define NR_SWITCH 1023
-/*
- * 1023 members in a single structure or union
- */
-#define NR_FIELDS 1023
-/*
- * 1023 enumeration constants in a single enumeration
- */
-#define NR_ENUM_CTES 1023
-/*
- * 63 levels of nested structure or union definitions in a single
- * struct-declaration-list
- */
-#define NR_STRUCT_LEVEL 63
-/*
- * number of defined structs/unions in one translation unit
- */
-#define NR_MAXSTRUCTS 127
--- a/inc/coff32/aouthdr.h
+++ /dev/null
@@ -1,22 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-struct aouthdr {
- short magic; /* magic number */
- short vstamp; /* version stamp */
- long tsize; /* text size in bytes */
- long dsize; /* initialized data size */
- long bsize; /* uinitialized data size */
- long entry; /* entry point */
- long text_start; /* base of text segment */
- long data_start; /* base of data segment */
-};
-
-#define AOUTHDR struct aouthdr
-#define AOUTSZ sizeof(AOUTHDR)
-
-#define QMAGIC 0314
-#define STMAGIC 0401
-#define OMAGIC 0404
-#define JMAGIC 0407
-#define DMAGIC 0410
-#define ZMAGIC 0413
--- a/inc/coff32/coff32.h
+++ /dev/null
@@ -1,21 +1,0 @@
-typedef int (*packfun)(unsigned char *, char *, ...);
-
-#ifdef AOUTHDR
-extern void coff32_pack_aout(packfun fun, unsigned char *buff, AOUTHDR *aout);
-extern void coff32_unpack_aout(packfun fun, unsigned char *buff, AOUTHDR *ent);
-#endif
-
-#ifdef SYMENT
-extern void coff32_pack_ent(packfun fun, unsigned char *buff, SYMENT *ent);
-extern void coff32_unpack_ent(packfun fun, unsigned char *buff, SYMENT *ent);
-#endif
-
-#ifdef FILHDR
-extern void coff32_pack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr);
-extern void coff32_unpack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr);
-#endif
-
-#ifdef SCNHDR
-extern void coff32_pack_scn(packfun fun, unsigned char *buff, SCNHDR *scn);
-extern void coff32_unpack_scn(packfun fun, unsigned char *buff, SCNHDR *scn);
-#endif
--- a/inc/coff32/filehdr.h
+++ /dev/null
@@ -1,30 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-struct filehdr {
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- long f_timdat; /* time stamp */
- long f_symptr; /* file pointer to symbols */
- long f_nsyms; /* number of symbols */
- unsigned short f_opthdr; /* size of optional header */
- unsigned short f_flags; /* file flags */
-};
-
-#define FILHDR struct filehdr
-#define FILHSZ 20
-
-#define F_RELFLG 0000001
-#define F_EXEC 0000002
-#define F_LMNO 0000004
-#define F_SYMS 0000010
-#define F_MINMAL 0000020
-#define F_UPDATE 0000040
-#define F_SWADB 0000100
-#define F_AR16WR 0000200
-#define F_AR32WR 0000400
-#define F_A32WR 0001000
-#define F_PATCH 0002000
-#define F_NODF 0002000
-
-#define COFF_I386MAGIC 0x014c
-#define COFF_Z80MAGIC 0x805a
--- a/inc/coff32/linenum.h
+++ /dev/null
@@ -1,10 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-struct lineno {
- long l_symndx; /* index in table symbol if l_lnno == 0 */
- long l_paddr; /* Break pointable address if l_lnno > 0 */
- unsigned short l_lnno; /* Line number */
-};
-
-#define LINENO struct lineno
-#define LINESZ 6
--- a/inc/coff32/reloc.h
+++ /dev/null
@@ -1,7 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-struct reloc {
- long r_vaddr; /* address of reference */
- long r_symndx; /* index into symbol table */
- unsignedd short r_type; /* relocation type */
-};
--- a/inc/coff32/scnhdr.h
+++ /dev/null
@@ -1,35 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-#define SCNNMLEN 8
-
-struct scnhdr {
- char s_name[SCNNMLEN]; /* section name */
- long s_paddr; /* physical address */
- long s_vaddr; /* virtual address */
- long s_size; /* section size */
- long s_scnptr; /* file ptr to raw data */
- long s_relptr; /* file ptr to relo info */
- long s_lnnoptr; /* file ptr to line number */
- unsigned short s_nrelloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of lines entries */
- long s_flags; /* type and content flags */
-};
-
-#define SCNHDR struct scnhdr
-#define SCNHSZ 40
-
-#define STYP_REG 0
-#define STYP_DSECT (1 << 0)
-#define STYP_NOLOAD (1 << 1)
-#define STYP_GROUP (1 << 2)
-#define STYP_PAD (1 << 3)
-#define STYP_COPY (1 << 4)
-#define STYP_TEXT (1 << 5)
-#define STYP_DATA (1 << 6)
-#define STYP_BSS (1 << 7)
-#define STYP_INFO (1 << 9)
-#define STYP_OVER (1 << 11)
-#define STYP_LIB (1 << 12)
-#define STYP_MERGE (1 << 13)
-#define STYP_REVERSE_PAD (1 << 14)
-#define STYP_LIT 0x8020
--- a/inc/coff32/syms.h
+++ /dev/null
@@ -1,88 +1,0 @@
-/* This file is inspired in the book "Understanding and using COFF" */
-
-#define E_SYMNMLEN 8
-
-struct syment {
- union {
- char _n_name[8]; /* symbol name */
- struct {
- long _n_zeroes; /* if _n_name[0-3] == 0 */
- long _n_offset; /* offset into string table */
- } _n_n;
- } _n;
- long n_value; /* value of symbol */
- short n_scnum; /* section number */
- unsigned short n_type; /* type and derived type */
- char n_sclass; /* storage class */
- char n_numaux; /* number of aux. entries */
-};
-
-#define SYMENT struct syment
-#define SYMESZ 18
-
-#define n_name _n._n_name
-#define n_zeroes _n._n_n._n_zeroes
-#define n_offset _n._n_n._n_offset
-
-/* Special n_scnum values */
-#define N_DEBUG -2
-#define N_ABS -1
-#define N_UNDEF 0
-#define N_SCNUM(x) ((x) > 0)
-
-/* basic types */
-#define T_NULL 0
-#define T_VOID 1
-#define T_CHAR 2
-#define T_SHORT 3
-#define T_INT 4
-#define T_LONG 5
-#define T_FLOAT 6
-#define T_DOUBLE 7
-#define T_STRUCT 8
-#define T_UNION 9
-#define T_ENUM 10
-#define T_MOE 11
-#define T_UCHAR 12
-#define T_USHORT 13
-#define T_UINT 14
-#define T_ULONG 15
-#define T_LNGDBL 16
-
-/* derivated types */
-#define DT_NON 0
-#define DT_PTR 1
-#define DT_FCN 2
-#define DT_ARY 3
-
-/* storage class */
-#define C_NULL 0
-#define C_AUTO 1
-#define C_EXT 2
-#define C_STAT 3
-#define C_REG 4
-#define C_EXTDEF 5
-#define C_LABEL 6
-#define C_ULABEL 7
-#define C_MOS 8
-#define C_ARG 9
-#define C_STRTAG 10
-#define C_MOU 11
-#define C_UNTAG 12
-#define C_TPDEF 13
-#define C_USTATIC 14
-#define C_ENTAG 15
-#define C_MOE 16
-#define C_REGPARM 17
-#define C_FIELD 18
-#define C_AUTOARG 19
-#define C_LASTENT 20
-#define C_BLOCK 100
-#define C_FCN 101
-#define C_EOS 102
-#define C_FILE 103
-#define C_LINE 104
-#define C_ALIAS 105
-#define C_HIDDEN 106
-#define C_WEAKEXT 127
-#define C_EFCN 255
--- a/inc/incdep.mk
+++ /dev/null
@@ -1,7 +1,0 @@
-include $(INCLUDE)/inclst.mk
-
-debug:
- echo $(SYSHDR)
-
-$(SYSHDR):
- +@cd $(INCLUDE) && $(MAKE)
--- a/inc/inclst.mk
+++ /dev/null
@@ -1,4 +1,0 @@
-SYSHDR = $(INCLUDE)/ldflags.h\
- $(INCLUDE)/syscrts.h\
- $(INCLUDE)/sysincludes.h\
- $(INCLUDE)/syslibs.h
--- a/inc/ldflags.def.h
+++ /dev/null
@@ -1,5 +1,0 @@
-char *ldflags[] = {
- "-static",
- "-z","nodefaultlib",
- NULL
-};
--- a/inc/myro.h
+++ /dev/null
@@ -1,79 +1,0 @@
-#define MYROHDR_SIZ 48
-#define MYROSECT_SIZ 24
-#define MYROSYM_SIZ 26
-#define MYROREL_SIZ 16
-
-#define MYROMAGIC_SIZ 4
-#define MYROMAGIC "uobj"
-
-#define MYROMAXSEC 254
-
-struct myrohdr {
- char magic[4];
- unsigned long format;
- unsigned long long entry;
- unsigned long long strsize;
- unsigned long long secsize;
- unsigned long long symsize;
- unsigned long long relsize;
-};
-
-struct myrosect {
- unsigned long name;
- unsigned short flags;
- unsigned char fill;
- unsigned char aligment;
- unsigned long long offset;
- unsigned long long len;
-};
-
-struct myrosym {
- unsigned long name;
- unsigned long type;
- unsigned char section;
- unsigned char flags;
- unsigned long long offset;
- unsigned long long len;
-};
-
-struct myrorel {
- unsigned long id;
- unsigned char flags;
- unsigned char size;
- unsigned char nbits;
- unsigned char shift;
- unsigned long long offset;
-};
-
-enum myrosecflg {
- MYROSEC_READ = 1 << 0,
- MYROSEC_WRITE = 1 << 1,
- MYROSEC_EXEC = 1 << 2,
- MYROSEC_LOAD = 1 << 3,
- MYROSEC_FILE = 1 << 4,
- MYROSEC_ABS = 1 << 5,
-};
-
-enum myrosymflg {
- MYROSYM_COMMON = 1 << 0,
- MYROSYM_EXTERN = 1 << 1,
- MYROSYM_GLOBAL = 1 << 2,
- MYROSYM_UNDEF = 1 << 3,
- MYROSYM_ABS = 1 << 4,
-};
-
-enum myrosectnames {
- MYRO_TEXT = 0,
- MYRO_DATA = 1,
- MYRO_BSS = 2,
- MYRO_ABS = 3,
-};
-
-extern int wrmyrohdr(FILE *fp, struct myrohdr *hdr);
-extern int wrmyrosec(FILE *fp, struct myrosect *sect);
-extern int wrmyrosym(FILE *fp, struct myrosym *sym);
-extern int wrmyrorel(FILE *fp, struct myrorel *rel);
-extern int rdmyrohdr(FILE *fp, struct myrohdr *hdr);
-extern int rdmyrosec(FILE *fp, struct myrosect *sect);
-extern int rdmyrosym(FILE *fp, struct myrosym *sym);
-extern int rdmyrorel(FILE *fp, struct myrorel *rel);
--- a/inc/scc.h
+++ /dev/null
@@ -1,41 +1,0 @@
-#include <stddef.h>
-
-extern int debug;
-
-#ifndef NDEBUG
-#define DBG(...) dbg(__VA_ARGS__)
-#define DBGON() (debug = 1)
-#else
-#define DBG(...)
-#define DBGON()
-#endif
-
-#define TINT long long
-#define TUINT unsigned long long
-#define TUINT_MAX ULLONG_MAX
-#define TINT_MAX LLONG_MAX
-#define TFLOAT double
-
-struct items {
- char **s;
- unsigned n;
-};
-
-typedef struct alloc Alloc;
-
-extern void die(const char *fmt, ...);
-extern void dbg(const char *fmt, ...);
-extern void newitem(struct items *items, char *item);
-extern void *xmalloc(size_t size);
-extern void *xcalloc(size_t nmemb, size_t size);
-extern char *xstrdup(const char *s);
-extern void *xrealloc(void *buff, register size_t size);
-extern Alloc *alloc(size_t size, size_t nmemb);
-extern void dealloc(Alloc *allocp);
-extern void *new(Alloc *allocp);
-extern void delete(Alloc *allocp, void *p);
-extern int casecmp(const char *s1, const char *s2);
-extern int lpack(unsigned char *dst, char *fmt, ...);
-extern int lunpack(unsigned char *src, char *fmt, ...);
-extern int bpack(unsigned char *dst, char *fmt, ...);
-extern int bunpack(unsigned char *src, char *fmt, ...);
--- a/inc/syscrts.def.h
+++ /dev/null
@@ -1,5 +1,0 @@
-char *syscrts[] = {
- /* configure below your system crts */
- /* PREFIX "/lib/scc/crt.o", */
- NULL
-};
--- a/inc/sysincludes.def.h
+++ /dev/null
@@ -1,8 +1,0 @@
-char *sysincludes[] = {
- PREFIX "/include/scc/" ,
- PREFIX "/include/scc/bits/" ARCH "-" ABI "/",
- /* configure below your standard sys include paths */
- PREFIX "/include/",
- PREFIX "/local/include/",
- NULL
-};
--- a/inc/syslibs.def.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#define MAX_LIB_PATHS 32
-
-char *syslibs[MAX_LIB_PATHS + 1] = {
- PREFIX "/lib/scc/" ,
- /* configure below your standard sys include paths */
- PREFIX "/lib/",
- PREFIX "/local/lib/",
- NULL
-};
--- /dev/null
+++ b/include/assert.h
@@ -1,0 +1,8 @@
+extern void __assert(char *exp, char *file, long line);
+
+#undef assert
+#ifndef NDEBUG
+# define assert(exp) ((exp) ? (void) 0 : __assert(#exp, __FILE__, __LINE__))
+#else
+# define assert(exp) ((void)0)
+#endif
--- /dev/null
+++ b/include/bits/.gitignore
@@ -1,0 +1,1 @@
+errno.h
--- /dev/null
+++ b/include/bits/amd64/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MIN-1)
+#define CHAR_MAX 0x7F
+#define CHAR_MIN (-CHAR_MAX-1)
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX-1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFFFFFF
+#define INT_MIN (-INT_MAX-1)
+#define UINT_MAX 0xFFFFFFFF
+#define LONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LONG_MIN (-LONG_MAX-1)
+#define ULONG_MAX 0xFFFFFFFFFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX-1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/amd64/arch/setjmp.h
@@ -1,0 +1,1 @@
+typedef unsigned long long jmp_buf[8];
--- /dev/null
+++ b/include/bits/amd64/arch/stddef.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef int wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
--- /dev/null
+++ b/include/bits/amd64/arch/stdint.h
@@ -1,0 +1,102 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX-1)
+#define UINT8_MAX 0xFF
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX-1)
+#define UINT16_MAX 0xFFFF
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX-1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX-1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT32_MIN
+#define INT_FAST8_MAX INT32_MAX
+#define UINT_FAST8_MAX UINT32_MAX
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+
+#define SIG_ATOMIC_MIN INT32_MIN
+#define SIG_ATOMIC_MAX INT32_MAX
+
+#define SIZE_MAX UINT64_MAX
+
+#define WCHAR_MIN INT32_MIN
+#define WCHAR_MAX INT32_MAX
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned uint32_t;
+typedef unsigned long uint64_t;
+
+typedef signed char int8_least_t;
+typedef short int16_least_t;
+typedef int int32_least_t;
+typedef long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned short uint16_least_t;
+typedef unsigned uint32_least_t;
+typedef unsigned long uint64_least_t;
+
+typedef int int8_fast_t;
+typedef int int16_fast_t;
+typedef int int32_fast_t;
+typedef long int64_fast_t;
+
+typedef unsigned uint8_fast_t;
+typedef unsigned uint16_fast_t;
+typedef unsigned uint32_fast_t;
+typedef unsigned long uint64_fast_t;
+
+typedef long intptr_t;
+typedef unsigned long uintptr_t;
+
+typedef long intmax_t;
+typedef unsigned long uintmax_t;
--- /dev/null
+++ b/include/bits/amd64/arch/stdio.h
@@ -1,0 +1,15 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "/tmp/tmp.0000000"
+
+typedef int fpos_t;
--- /dev/null
+++ b/include/bits/amd64/arch/stdlib.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#ifndef _WCHAR_T
+typedef int wchar_t;
+#define _WCHAR_T
+#endif
+
+#define _ALIGNTYPE long double
--- /dev/null
+++ b/include/bits/amd64/arch/string.h
@@ -1,0 +1,5 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#endif
+
+#define __NUMCHARS 128
\ No newline at end of file
--- /dev/null
+++ b/include/bits/amd64/arch/time.h
@@ -1,0 +1,8 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define _MAXYEAR 9999
+
+typedef long int time_t;
--- /dev/null
+++ b/include/bits/arm32/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MIN - 1)
+#define CHAR_MAX 0x7F
+#define CHAR_MIN (-CHAR_MAX - 1)
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFFFFFF
+#define INT_MIN (-INT_MAX - 1)
+#define UINT_MAX 0xFFFFFFFF
+#define LONG_MAX 0x7FFFFFFF
+#define LONG_MIN (-LONG_MAX - 1)
+#define ULONG_MAX 0xFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX - 1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/arm32/arch/setjmp.h
@@ -1,0 +1,1 @@
+typedef unsigned long jmp_buf[10];
--- /dev/null
+++ b/include/bits/arm32/arch/stddef.h
@@ -1,0 +1,9 @@
+#ifndef SIZET_
+typedef unsigned int size_t;
+#define SIZET_
+#endif
+
+#ifndef _PTRDIFF_T
+typedef long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
--- /dev/null
+++ b/include/bits/arm32/arch/stdint.h
@@ -1,0 +1,96 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX - 1)
+#define UINT8_MAX 0xFF
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX - 1)
+#define UINT16_MAX 0xFFFF
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX - 1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX - 1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT32_MIN
+#define INT_FAST8_MAX INT32_MAX
+#define UINT_FAST8_MAX UINT32_MAX
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+
+#define SIZE_MAX UINT32_MAX
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_least_t;
+typedef short int16_least_t;
+typedef int int32_least_t;
+typedef long long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned short uint16_least_t;
+typedef unsigned int uint32_least_t;
+typedef unsigned long long uint64_least_t;
+
+typedef int int8_fast_t;
+typedef int int16_fast_t;
+typedef int int32_fast_t;
+typedef long long int64_fast_t;
+
+typedef unsigned int uint8_fast_t;
+typedef unsigned int uint16_fast_t;
+typedef unsigned int uint32_fast_t;
+typedef unsigned long long uint64_fast_t;
+
+typedef long intptr_t;
+typedef unsigned long uintptr_t;
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
--- /dev/null
+++ b/include/bits/arm32/arch/stdio.h
@@ -1,0 +1,15 @@
+#ifndef _SIZET
+typedef unsigned int size_t;
+#define _SIZET
+#endif
+
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "/tmp/tmp.0000000"
+
+typedef int fpos_t;
--- /dev/null
+++ b/include/bits/arm32/arch/stdlib.h
@@ -1,0 +1,14 @@
+#ifndef SIZET_
+typedef unsigned int size_t;
+#define SIZET_
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#ifndef _WCHAR_T
+typedef int wchar_t; // TODO
+#define _WCHAR_T
+#endif
+
+#define _ALIGNTYPE long double
--- /dev/null
+++ b/include/bits/arm32/arch/string.h
@@ -1,0 +1,6 @@
+#ifndef SIZET_
+typedef unsigned int size_t;
+#define SIZET_
+#endif
+
+#define __NUMCHARS 128
--- /dev/null
+++ b/include/bits/arm32/arch/time.h
@@ -1,0 +1,8 @@
+#ifndef _SIZET
+typedef unsigned int size_t;
+#define _SIZET
+#endif
+
+#define _MAXYEAR 9999
+
+typedef long int time_t;
--- /dev/null
+++ b/include/bits/arm64/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MIN - 1)
+#define CHAR_MAX 0x7F
+#define CHAR_MIN (-CHAR_MAX - 1)
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX - 1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFFFFFF
+#define INT_MIN (-INT_MAX - 1)
+#define UINT_MAX 0xFFFFFFFF
+#define LONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LONG_MIN (-LONG_MAX - 1)
+#define ULONG_MAX 0xFFFFFFFFFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX - 1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/arm64/arch/setjmp.h
@@ -1,0 +1,1 @@
+typedef unsigned long long jmp_buf[22];
--- /dev/null
+++ b/include/bits/arm64/arch/stddef.h
@@ -1,0 +1,9 @@
+#ifndef SIZET_
+typedef unsigned long size_t;
+#define SIZET_
+#endif
+
+#ifndef _PTRDIFF_T
+typedef long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
--- /dev/null
+++ b/include/bits/arm64/arch/stdint.h
@@ -1,0 +1,96 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX - 1)
+#define UINT8_MAX 0xFFU
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX - 1)
+#define UINT16_MAX 0xFFFFU
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX - 1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX - 1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT32_MIN
+#define INT_FAST8_MAX INT32_MAX
+#define UINT_FAST8_MAX UINT32_MAX
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT64_MIN
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT64_MIN
+#define PTRDIFF_MAX INT64_MAX
+
+#define SIZE_MAX UINT64_MAX
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_least_t;
+typedef short int16_least_t;
+typedef int int32_least_t;
+typedef long long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned short uint16_least_t;
+typedef unsigned int uint32_least_t;
+typedef unsigned long long uint64_least_t;
+
+typedef int int8_fast_t;
+typedef int int16_fast_t;
+typedef int int32_fast_t;
+typedef long long int64_fast_t;
+
+typedef unsigned int uint8_fast_t;
+typedef unsigned int uint16_fast_t;
+typedef unsigned int uint32_fast_t;
+typedef unsigned long long uint64_fast_t;
+
+typedef long intptr_t;
+typedef unsigned long uintptr_t;
+
+typedef long intmax_t;
+typedef unsigned long uintmax_t;
--- /dev/null
+++ b/include/bits/arm64/arch/stdio.h
@@ -1,0 +1,15 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "/tmp/tmp.0000000"
+
+typedef int fpos_t;
--- /dev/null
+++ b/include/bits/arm64/arch/stdlib.h
@@ -1,0 +1,14 @@
+#ifndef SIZET_
+typedef unsigned long size_t;
+#define SIZET_
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#ifndef _WCHAR_T
+typedef int wchar_t;
+#define _WCHAR_T
+#endif
+
+#define _ALIGNTYPE long double
--- /dev/null
+++ b/include/bits/arm64/arch/string.h
@@ -1,0 +1,6 @@
+#ifndef SIZET_
+typedef unsigned long size_t;
+#define SIZET_
+#endif
+
+#define __NUMCHARS 128
--- /dev/null
+++ b/include/bits/arm64/arch/time.h
@@ -1,0 +1,8 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define _MAXYEAR 9999
+
+typedef long int time_t;
--- /dev/null
+++ b/include/bits/dragonfly/sys.h
@@ -1,0 +1,19 @@
+#define O_RDONLY 0x00000000
+#define O_WRONLY 0x00000001
+#define O_RDWR 0x00000002
+
+#define O_TRUNC 0x00000400
+#define O_APPEND 0x00000008
+#define O_CREAT 0x00000200
+
+typedef int pid_t;
+
+struct sigaction {
+ void (*sa_handler)(int);
+ char sa_mask[8];
+ int sa_flags;
+};
+
+extern pid_t _getpid(void);
+extern int _kill(pid_t pid, int signum);
+extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- /dev/null
+++ b/include/bits/dragonfly/sys/signal.h
@@ -1,0 +1,27 @@
+typedef int sig_atomic_t;
+
+#define SIG_ERR ((void (*)(int))-1)
+#define SIG_DFL ((void (*)(int)) 0)
+#define SIG_IGN ((void (*)(int)) 1)
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGABRT 6
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGSEGV 11
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGSTOP 17
+#define SIGTSTP 18
+#define SIGCONT 19
+#define SIGCHLD 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGUSR1 30
+#define SIGUSR2 31
+
+#define __NR_SIGNALS 32
--- /dev/null
+++ b/include/bits/i386/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MIN-1)
+#define CHAR_MAX 0x7F
+#define CHAR_MIN (-CHAR_MAX-1)
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX-1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFFFFFF
+#define INT_MIN (-INT_MAX-1)
+#define UINT_MAX 0xFFFFFFFF
+#define LONG_MAX 0x7FFFFFFF
+#define LONG_MIN (-LONG_MAX-1)
+#define ULONG_MAX 0xFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX-1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/i386/arch/stddef.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef int wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef long ptrdiff_t;
+#define _PTRDIFF_T
+#endif
--- /dev/null
+++ b/include/bits/i386/arch/stdint.h
@@ -1,0 +1,115 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX-1)
+#define UINT8_MAX 0xFF
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX-1)
+#define UINT16_MAX 0xFFFF
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX-1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX-1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT32_MIN
+#define INT_FAST8_MAX INT32_MAX
+#define UINT_FAST8_MAX UINT32_MAX
+
+#define INT_FAST16_MIN INT32_MIN
+#define INT_FAST16_MAX INT32_MAX
+#define UINT_FAST16_MAX UINT32_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT32_MIN
+#define INTPTR_MAX INT32_MAX
+#define UINTPTR_MAX UINT32_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT32_MIN
+#define PTRDIFF_MAX INT32_MAX
+
+#define SIG_ATOMIC_MIN INT32_MIN
+#define SIG_ATOMIC_MAX INT32_MAX
+
+#define SIZE_MAX UINT32_MAX
+
+#define WCHAR_MIN INT32_MIN
+#define WCHAR_MAX INT32_MAX
+
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x
+#define INT64_C(x) x ## LL
+
+#define UINT8_C(x) x
+#define UINT16_C(x) x
+#define UINT32_C(x) x ## U
+#define UINT64_C(x) x ## ULL
+
+#define INTMAX_C(x) x ## LL
+#define UINTMAX_C(x) x ## ULL
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef long long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_least_t;
+typedef short int16_least_t;
+typedef int int32_least_t;
+typedef long long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned short uint16_least_t;
+typedef unsigned uint32_least_t;
+typedef unsigned long long uint64_least_t;
+
+typedef int int8_fast_t;
+typedef int int16_fast_t;
+typedef int int32_fast_t;
+typedef long long int64_fast_t;
+
+typedef unsigned uint8_fast_t;
+typedef unsigned uint16_fast_t;
+typedef unsigned uint32_fast_t;
+typedef unsigned long long uint64_fast_t;
+
+typedef int intptr_t;
+typedef unsigned uintptr_t;
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
--- /dev/null
+++ b/include/bits/i386/arch/stdio.h
@@ -1,0 +1,15 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "/tmp/tmp.0000000"
+
+typedef long fpos_t;
--- /dev/null
+++ b/include/bits/i386/arch/stdlib.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#ifndef _WCHAR_T
+typedef int wchar_t;
+#define _WCHAR_T
+#endif
+
+#define _ALIGNTYPE long double
--- /dev/null
+++ b/include/bits/i386/arch/string.h
@@ -1,0 +1,5 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#endif
+
+#define __NUMCHARS 128
--- /dev/null
+++ b/include/bits/i386/arch/time.h
@@ -1,0 +1,8 @@
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+#define _MAXYEAR 2037
+
+typedef long int time_t;
--- /dev/null
+++ b/include/bits/linux/sys.h
@@ -1,0 +1,19 @@
+#define O_RDONLY 0x00000000
+#define O_WRONLY 0x00000001
+#define O_RDWR 0x00000002
+
+#define O_TRUNC 0x00000400
+#define O_APPEND 0x00000008
+#define O_CREAT 0x00000200
+
+typedef int pid_t;
+
+struct sigaction {
+ void (*sa_handler)(int);
+ int sa_mask;
+ int sa_flags;
+};
+
+extern pid_t _getpid(void);
+extern int _kill(pid_t pid, int signum);
+extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- /dev/null
+++ b/include/bits/linux/sys/signal.h
@@ -1,0 +1,27 @@
+typedef int sig_atomic_t;
+
+#define SIG_ERR ((void (*)(int))-1)
+#define SIG_DFL ((void (*)(int)) 0)
+#define SIG_IGN ((void (*)(int)) 1)
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGABRT 6
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGUSR1 10
+#define SIGSEGV 11
+#define SIGUSR2 12
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGCHLD 17
+#define SIGCONT 18
+#define SIGSTOP 19
+#define SIGTSTP 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+
+#define __NR_SIGNALS 23
--- /dev/null
+++ b/include/bits/netbsd/sys.h
@@ -1,0 +1,19 @@
+#define O_RDONLY 0x00000000
+#define O_WRONLY 0x00000001
+#define O_RDWR 0x00000002
+
+#define O_TRUNC 0x00000400
+#define O_APPEND 0x00000008
+#define O_CREAT 0x00000200
+
+typedef int pid_t;
+
+struct sigaction {
+ void (*sa_handler)(int);
+ char sa_mask[8];
+ int sa_flags;
+};
+
+extern pid_t _getpid(void);
+extern int _kill(pid_t pid, int signum);
+extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- /dev/null
+++ b/include/bits/netbsd/sys/signal.h
@@ -1,0 +1,27 @@
+typedef int sig_atomic_t;
+
+#define SIG_ERR ((void (*)(int))-1)
+#define SIG_DFL ((void (*)(int)) 0)
+#define SIG_IGN ((void (*)(int)) 1)
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGABRT 6
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGSEGV 11
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGSTOP 17
+#define SIGTSTP 18
+#define SIGCONT 19
+#define SIGCHLD 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGUSR1 30
+#define SIGUSR2 31
+
+#define __NR_SIGNALS 32
--- /dev/null
+++ b/include/bits/openbsd/sys.h
@@ -1,0 +1,19 @@
+#define O_RDONLY 0x00000000
+#define O_WRONLY 0x00000001
+#define O_RDWR 0x00000002
+
+#define O_TRUNC 0x00000400
+#define O_APPEND 0x00000008
+#define O_CREAT 0x00000200
+
+typedef int pid_t;
+
+struct sigaction {
+ void (*sa_handler)(int);
+ int sa_mask;
+ int sa_flags;
+};
+
+extern pid_t _getpid(void);
+extern int _kill(pid_t pid, int signum);
+extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- /dev/null
+++ b/include/bits/openbsd/sys/signal.h
@@ -1,0 +1,27 @@
+typedef int sig_atomic_t;
+
+#define SIG_ERR ((void (*)(int))-1)
+#define SIG_DFL ((void (*)(int)) 0)
+#define SIG_IGN ((void (*)(int)) 1)
+
+#define SIGHUP 1
+#define SIGINT 2
+#define SIGQUIT 3
+#define SIGILL 4
+#define SIGABRT 6
+#define SIGFPE 8
+#define SIGKILL 9
+#define SIGSEGV 11
+#define SIGPIPE 13
+#define SIGALRM 14
+#define SIGTERM 15
+#define SIGSTOP 17
+#define SIGTSTP 18
+#define SIGCONT 19
+#define SIGCHLD 20
+#define SIGTTIN 21
+#define SIGTTOU 22
+#define SIGUSR1 30
+#define SIGUSR2 31
+
+#define __NR_SIGNALS 32
--- /dev/null
+++ b/include/bits/z80/arch/limits.h
@@ -1,0 +1,18 @@
+#define CHAR_BIT 8
+#define SCHAR_MAX 0x7F
+#define SCHAR_MIN (-SCHAR_MIN-1)
+#define CHAR_MAX 0xFF
+#define CHAR_MIN 0
+#define UCHAR_MAX 0xFF
+#define SHRT_MAX 0x7FFF
+#define SHRT_MIN (-SHRT_MAX-1)
+#define USHRT_MAX 0xFFFF
+#define INT_MAX 0x7FFF
+#define INT_MIN (-INT_MAX-1)
+#define UINT_MAX 0xFFFF
+#define LONG_MAX 0x7FFFFFFF
+#define LONG_MIN (-LONG_MAX-1)
+#define ULONG_MAX 0xFFFFFFFF
+#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
+#define LLONG_MIN (-LLONG_MAX-1)
+#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- /dev/null
+++ b/include/bits/z80/arch/stddef.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned size_t;
+#define _SIZET
+#endif
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#ifndef _PTRDIFF_T
+typedef short ptrdiff_t;
+#define _PTRDIFF_T
+#endif
--- /dev/null
+++ b/include/bits/z80/arch/stdint.h
@@ -1,0 +1,115 @@
+#define INT8_MAX 0x7F
+#define INT8_MIN (-INT8_MAX-1)
+#define UINT8_MAX 0xFF
+
+#define INT16_MAX 0x7FFF
+#define INT16_MIN (-INT16_MAX-1)
+#define UINT16_MAX 0xFFFF
+
+#define INT32_MAX 0x7FFFFFFF
+#define INT32_MIN (-INT32_MAX-1)
+#define UINT32_MAX 0xFFFFFFFF
+
+#define INT64_MAX 0x7FFFFFFFFFFFFFFF
+#define INT64_MIN (-INT64_MAX-1)
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST8_MAX INT8_MAX
+#define UINT_LEAST8_MAX UINT8_MAX
+
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST16_MAX INT16_MAX
+#define UINT_LEAST16_MAX UINT16_MAX
+
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST32_MAX INT32_MAX
+#define UINT_LEAST32_MAX UINT32_MAX
+
+#define INT_LEAST64_MIN INT64_MIN
+#define INT_LEAST64_MAX INT64_MAX
+#define UINT_LEAST64_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT16_MIN
+#define INT_FAST8_MAX INT16_MAX
+#define UINT_FAST8_MAX UINT16_MAX
+
+#define INT_FAST16_MIN INT16_MIN
+#define INT_FAST16_MAX INT16_MAX
+#define UINT_FAST16_MAX UINT16_MAX
+
+#define INT_FAST32_MIN INT32_MIN
+#define INT_FAST32_MAX INT32_MAX
+#define UINT_FAST32_MAX UINT32_MAX
+
+#define INT_FAST64_MIN INT64_MIN
+#define INT_FAST64_MAX INT64_MAX
+#define UINT_FAST64_MAX UINT64_MAX
+
+#define INTPTR_MIN INT16_MIN
+#define INTPTR_MAX INT16_MAX
+#define UINTPTR_MAX UINT16_MAX
+
+#define INTMAX_MIN INT64_MIN
+#define INTMAX_MAX INT64_MAX
+#define UINTMAX_MAX UINT64_MAX
+
+#define PTRDIFF_MIN INT16_MIN
+#define PTRDIFF_MAX INT16_MAX
+
+#define SIG_ATOMIC_MIN INT16_MIN
+#define SIG_ATOMIC_MAX INT16_MAX
+
+#define SIZE_MAX UINT64_MAX
+
+#define WCHAR_MIN INT16_MIN
+#define WCHAR_MAX INT16_MAX
+
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x ## L
+#define INT64_C(x) x ## LL
+
+#define UINT8_C(x) x
+#define UINT16_C(x) x ## U
+#define UINT32_C(x) x ## UL
+#define UINT64_C(x) x ## ULL
+
+#define INTMAX_C(x) x ## LL
+#define UINTMAX_C(x) x ## ULL
+
+typedef signed char int8_t;
+typedef int int16_t;
+typedef long int32_t;
+typedef long long int64_t;
+
+typedef unsigned char uint8_t;
+typedef unsigned uint16_t;
+typedef unsigned long uint32_t;
+typedef unsigned long long uint64_t;
+
+typedef signed char int8_least_t;
+typedef int int16_least_t;
+typedef long int32_least_t;
+typedef long long int64_least_t;
+
+typedef unsigned char uint8_least_t;
+typedef unsigned uint16_least_t;
+typedef unsigned long uint32_least_t;
+typedef unsigned long long uint64_least_t;
+
+typedef signed char int8_fast_t;
+typedef int int16_fast_t;
+typedef long int32_fast_t;
+typedef long long int64_fast_t;
+
+typedef unsigned char uint8_fast_t;
+typedef unsigned uint16_fast_t;
+typedef unsigned long uint32_fast_t;
+typedef unsigned long long uint64_fast_t;
+
+typedef int intptr_t;
+typedef unsigned uintptr_t;
+
+typedef long long intmax_t;
+typedef unsigned long long uintmax_t;
--- /dev/null
+++ b/include/bits/z80/arch/stdio.h
@@ -1,0 +1,15 @@
+#ifndef _SIZET
+typedef unsigned size_t;
+#define _SIZET
+#endif
+
+#define BUFSIZ 512
+#define FILENAME_MAX 256
+#define FOPEN_MAX 16
+
+#define TMP_MAX 25
+#define L_tmpnam 256
+
+#define _TMPNAME "TMP.000"
+
+typedef long fpos_t;
--- /dev/null
+++ b/include/bits/z80/arch/stdlib.h
@@ -1,0 +1,14 @@
+#ifndef _SIZET
+typedef unsigned size_t;
+#define _SIZET
+#endif
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+#ifndef _WCHAR_T
+typedef short wchar_t;
+#define _WCHAR_T
+#endif
+
+#define _ALIGNTYPE int
--- /dev/null
+++ b/include/bits/z80/arch/string.h
@@ -1,0 +1,5 @@
+#ifndef _SIZET
+typedef unsigned size_t;
+#endif
+
+#define __NUMCHARS 128
--- /dev/null
+++ b/include/bits/z80/arch/time.h
@@ -1,0 +1,8 @@
+#ifndef _SIZET
+typedef unsigned size_t;
+#define _SIZET
+#endif
+
+#define _MAXYEAR 2037
+
+typedef long time_t;
--- /dev/null
+++ b/include/ctype.h
@@ -1,0 +1,45 @@
+#ifndef _CTYPE_H
+#define _CTYPE_H
+
+extern int isalnum(int c);
+extern int isalpha(int c);
+extern int islower(int c);
+extern int isupper(int c);
+extern int isdigit(int c);
+extern int isxdigit(int c);
+extern int iscntrl(int c);
+extern int isgraph(int c);
+extern int isspace(int c);
+extern int isblank(int c);
+extern int isprint(int c);
+extern int ispunct(int c);
+extern int tolower(int c);
+extern int toupper(int c);
+
+
+#define _U 0x01 /* upper */
+#define _L 0x02 /* lower */
+#define _D 0x04 /* digit */
+#define _C 0x08 /* cntrl */
+#define _P 0x10 /* punct */
+#define _S 0x20 /* white space (space/lf/tab) */
+#define _X 0x40 /* hex char */
+#define _SP 0x80 /* hard space (0x20) */
+
+extern const unsigned char __ctype[];
+
+#define isalnum(c) ((__ctype+1)[c] & (_U|_L|_D))
+#define isalpha(c) ((__ctype+1)[c] & (_U|_L))
+#define iscntrl(c) ((__ctype+1)[c] & (_C))
+#define isdigit(c) ((__ctype+1)[c] & (_D))
+#define isgraph(c) ((__ctype+1)[c] & (_P|_U|_L|_D))
+#define islower(c) ((__ctype+1)[c] & (_L))
+#define isprint(c) ((__ctype+1)[c] & (_P|_U|_L|_D|_SP))
+#define ispunct(c) ((__ctype+1)[c] & (_P))
+#define isspace(c) ((__ctype+1)[c] & (_S))
+#define isupper(c) ((__ctype+1)[c] & (_U))
+#define isxdigit(c) ((__ctype+1)[c] & (_D|_X))
+
+#define isascii(c) ((unsigned)(c)<=0x7f)
+
+#endif
--- /dev/null
+++ b/include/errno.h
@@ -1,0 +1,6 @@
+#ifndef _ERRNO_H
+#define _ERRNO_H
+
+#include <sys/errno.h>
+
+#endif
--- /dev/null
+++ b/include/float.h
@@ -1,0 +1,1 @@
+/* TODO: Placeholder for compatibility with libraries that need to include it */
--- /dev/null
+++ b/include/limits.h
@@ -1,0 +1,8 @@
+#ifndef _LIMITS_H
+#define _LIMITS_H
+
+#include <arch/limits.h>
+
+#define MB_LEN_MAX 1
+
+#endif
--- /dev/null
+++ b/include/locale.h
@@ -1,0 +1,39 @@
+#ifndef _LOCALE_H
+#define _LOCALE_H
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define LC_ALL 0
+#define LC_COLLATE 1
+#define LC_CTYPE 2
+#define LC_MONETARY 3
+#define LC_NUMERIC 4
+#define LC_TIME 5
+
+struct lconv {
+ char *decimal_point;
+ char *thousands_sep;
+ char *grouping;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
+ char *currency_symbol;
+ char *int_curr_symbol;
+ char frac_digits;
+ char p_cs_precedes;
+ char n_cs_precedes;
+ char p_sep_by_space;
+ char n_sep_by_space;
+ char p_sign_posn;
+ char n_sign_posn;
+ char int_frac_digits;
+};
+
+extern char *setlocale(int category, const char *locale);
+extern struct lconv *localeconv(void);
+
+#endif
--- /dev/null
+++ b/include/math.h
@@ -1,0 +1,4 @@
+#ifndef _MATH_H
+#define _MATH_H
+#error math.h is not supported yet
+#endif
--- /dev/null
+++ b/include/scc/scc/.gitignore
@@ -1,0 +1,5 @@
+cstd.h
+ldflags.h
+syscrts.h
+sysincludes.h
+syslibs.h
--- /dev/null
+++ b/include/scc/scc/Makefile
@@ -1,0 +1,42 @@
+.POSIX:
+
+PROJECTDIR = ../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+SYSHDR = ldflags.h\
+ syscrts.h\
+ sysincludes.h\
+ syslibs.h \
+ cstd.h \
+
+all: $(SYSHDR)
+
+cstd.h: cstd-$(STD).h
+ cp cstd-$(STD).h $@
+
+ldflags.h:
+ rm -f $@ ; \
+ trap "rm -f $$$$.h" 0 2 3; \
+ cat < ldflags.def.h > $$$$.h; \
+ mv $$$$.h $@
+
+syscrts.h:
+ rm -f $@ ; \
+ trap "rm -f $$$$.h" 0 2 3; \
+ sed 's,PREFIX,"$(PREFIX)",g' < syscrts.def.h > $$$$.h && \
+ mv $$$$.h $@
+
+sysincludes.h:
+ rm -f $@ ; \
+ trap "rm -f $$$$.h" 0 2 3; \
+ sed 's,PREFIX,"$(PREFIX)",g' < sysincludes.def.h > $$$$.h && \
+ mv $$$$.h $@
+
+syslibs.h:
+ rm -f $@ ; \
+ trap "rm -f $$$$.h" 0 2 3; \
+ sed 's,PREFIX,"$(PREFIX)",g' < syslibs.def.h > $$$$.h && \
+ mv $$$$.h $@
+
+distclean:
+ rm -f $(SYSHDR)
--- /dev/null
+++ b/include/scc/scc/ar.h
@@ -1,0 +1,15 @@
+#define ARMAG "!<arch>\n" /* ar "magic number" */
+#define SARMAG 8 /* strlen(ARMAG); */
+#define ARFMAG "`\n"
+#define SARNAM 16
+
+
+struct ar_hdr {
+ char ar_name[SARNAM]; /* name */
+ char ar_date[12]; /* modification time */
+ char ar_uid[6]; /* user id */
+ char ar_gid[6]; /* group id */
+ char ar_mode[8]; /* octal file permissions */
+ char ar_size[10]; /* size in bytes */
+ char ar_fmag[2]; /* consistency check */
+};
--- /dev/null
+++ b/include/scc/scc/arg.h
@@ -1,0 +1,67 @@
+/*
+ * Copy me if you can.
+ * by 20h
+ */
+
+#ifndef ARG_H__
+#define ARG_H__
+
+extern char *argv0;
+
+/* use main(int argc, char *argv[]) */
+#define ARGBEGIN \
+for (argv0 = *argv, argv++, argc--;\
+ argv[0];\
+ argc--, argv++) {\
+ if (argv[0][0] == '-') {\
+ char argc_;\
+ char **argv_;\
+ int brk_;\
+ if (argv[0][1] == '-' && argv[0][2] == '\0') {\
+ argv++;\
+ argc--;\
+ break;\
+ }\
+ for (brk_ = 0, argv[0]++, argv_ = argv;\
+ argv[0][0] && !brk_;\
+ argv[0]++) {\
+ if (argv_ != argv)\
+ break;\
+ argc_ = argv[0][0];\
+ switch (argc_)
+
+#define ARGOPERAND \
+ }\
+ } else if (argv[0][0] != '\0') {\
+ {
+
+#define ARGEND \
+ }\
+ } else {\
+ break;\
+ }\
+}
+
+#define ARGC() argc_
+
+#define ARGOP() argv[0]
+
+#define ARGNUMF() (brk_ = 1, estrtonum(argv[0], 0, INT_MAX))
+
+#define EARGF(x) \
+((argv[0][1] == '\0' && argv[1] == NULL) ?\
+ ((x), abort(), (char *)0) :\
+ (brk_ = 1, (argv[0][1] != '\0') ?\
+ (&argv[0][1]) :\
+ (argc--, argv++, argv[0])))
+
+#define ARGF() \
+((argv[0][1] == '\0' && argv[1] == NULL)?\
+ (char *)0 :\
+ (brk_ = 1, (argv[0][1] != '\0')?\
+ (&argv[0][1]) :\
+ (argc--, argv++, argv[0])))
+
+#define LNGARG() &argv[0][0]
+
+#endif
--- /dev/null
+++ b/include/scc/scc/coff32/aouthdr.h
@@ -1,0 +1,22 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct aouthdr {
+ short magic; /* magic number */
+ short vstamp; /* version stamp */
+ long tsize; /* text size in bytes */
+ long dsize; /* initialized data size */
+ long bsize; /* uinitialized data size */
+ long entry; /* entry point */
+ long text_start; /* base of text segment */
+ long data_start; /* base of data segment */
+};
+
+#define AOUTHDR struct aouthdr
+#define AOUTSZ sizeof(AOUTHDR)
+
+#define QMAGIC 0314
+#define STMAGIC 0401
+#define OMAGIC 0404
+#define JMAGIC 0407
+#define DMAGIC 0410
+#define ZMAGIC 0413
--- /dev/null
+++ b/include/scc/scc/coff32/coff32.h
@@ -1,0 +1,21 @@
+typedef int (*packfun)(unsigned char *, char *, ...);
+
+#ifdef AOUTHDR
+extern void coff32_pack_aout(packfun fun, unsigned char *buff, AOUTHDR *aout);
+extern void coff32_unpack_aout(packfun fun, unsigned char *buff, AOUTHDR *ent);
+#endif
+
+#ifdef SYMENT
+extern void coff32_pack_ent(packfun fun, unsigned char *buff, SYMENT *ent);
+extern void coff32_unpack_ent(packfun fun, unsigned char *buff, SYMENT *ent);
+#endif
+
+#ifdef FILHDR
+extern void coff32_pack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr);
+extern void coff32_unpack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr);
+#endif
+
+#ifdef SCNHDR
+extern void coff32_pack_scn(packfun fun, unsigned char *buff, SCNHDR *scn);
+extern void coff32_unpack_scn(packfun fun, unsigned char *buff, SCNHDR *scn);
+#endif
--- /dev/null
+++ b/include/scc/scc/coff32/filehdr.h
@@ -1,0 +1,30 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct filehdr {
+ unsigned short f_magic; /* magic number */
+ unsigned short f_nscns; /* number of sections */
+ long f_timdat; /* time stamp */
+ long f_symptr; /* file pointer to symbols */
+ long f_nsyms; /* number of symbols */
+ unsigned short f_opthdr; /* size of optional header */
+ unsigned short f_flags; /* file flags */
+};
+
+#define FILHDR struct filehdr
+#define FILHSZ 20
+
+#define F_RELFLG 0000001
+#define F_EXEC 0000002
+#define F_LMNO 0000004
+#define F_SYMS 0000010
+#define F_MINMAL 0000020
+#define F_UPDATE 0000040
+#define F_SWADB 0000100
+#define F_AR16WR 0000200
+#define F_AR32WR 0000400
+#define F_A32WR 0001000
+#define F_PATCH 0002000
+#define F_NODF 0002000
+
+#define COFF_I386MAGIC 0x014c
+#define COFF_Z80MAGIC 0x805a
--- /dev/null
+++ b/include/scc/scc/coff32/linenum.h
@@ -1,0 +1,10 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct lineno {
+ long l_symndx; /* index in table symbol if l_lnno == 0 */
+ long l_paddr; /* Break pointable address if l_lnno > 0 */
+ unsigned short l_lnno; /* Line number */
+};
+
+#define LINENO struct lineno
+#define LINESZ 6
--- /dev/null
+++ b/include/scc/scc/coff32/reloc.h
@@ -1,0 +1,7 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+struct reloc {
+ long r_vaddr; /* address of reference */
+ long r_symndx; /* index into symbol table */
+ unsignedd short r_type; /* relocation type */
+};
--- /dev/null
+++ b/include/scc/scc/coff32/scnhdr.h
@@ -1,0 +1,35 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+#define SCNNMLEN 8
+
+struct scnhdr {
+ char s_name[SCNNMLEN]; /* section name */
+ long s_paddr; /* physical address */
+ long s_vaddr; /* virtual address */
+ long s_size; /* section size */
+ long s_scnptr; /* file ptr to raw data */
+ long s_relptr; /* file ptr to relo info */
+ long s_lnnoptr; /* file ptr to line number */
+ unsigned short s_nrelloc; /* number of relocation entries */
+ unsigned short s_nlnno; /* number of lines entries */
+ long s_flags; /* type and content flags */
+};
+
+#define SCNHDR struct scnhdr
+#define SCNHSZ 40
+
+#define STYP_REG 0
+#define STYP_DSECT (1 << 0)
+#define STYP_NOLOAD (1 << 1)
+#define STYP_GROUP (1 << 2)
+#define STYP_PAD (1 << 3)
+#define STYP_COPY (1 << 4)
+#define STYP_TEXT (1 << 5)
+#define STYP_DATA (1 << 6)
+#define STYP_BSS (1 << 7)
+#define STYP_INFO (1 << 9)
+#define STYP_OVER (1 << 11)
+#define STYP_LIB (1 << 12)
+#define STYP_MERGE (1 << 13)
+#define STYP_REVERSE_PAD (1 << 14)
+#define STYP_LIT 0x8020
--- /dev/null
+++ b/include/scc/scc/coff32/syms.h
@@ -1,0 +1,88 @@
+/* This file is inspired in the book "Understanding and using COFF" */
+
+#define E_SYMNMLEN 8
+
+struct syment {
+ union {
+ char _n_name[8]; /* symbol name */
+ struct {
+ long _n_zeroes; /* if _n_name[0-3] == 0 */
+ long _n_offset; /* offset into string table */
+ } _n_n;
+ } _n;
+ long n_value; /* value of symbol */
+ short n_scnum; /* section number */
+ unsigned short n_type; /* type and derived type */
+ char n_sclass; /* storage class */
+ char n_numaux; /* number of aux. entries */
+};
+
+#define SYMENT struct syment
+#define SYMESZ 18
+
+#define n_name _n._n_name
+#define n_zeroes _n._n_n._n_zeroes
+#define n_offset _n._n_n._n_offset
+
+/* Special n_scnum values */
+#define N_DEBUG -2
+#define N_ABS -1
+#define N_UNDEF 0
+#define N_SCNUM(x) ((x) > 0)
+
+/* basic types */
+#define T_NULL 0
+#define T_VOID 1
+#define T_CHAR 2
+#define T_SHORT 3
+#define T_INT 4
+#define T_LONG 5
+#define T_FLOAT 6
+#define T_DOUBLE 7
+#define T_STRUCT 8
+#define T_UNION 9
+#define T_ENUM 10
+#define T_MOE 11
+#define T_UCHAR 12
+#define T_USHORT 13
+#define T_UINT 14
+#define T_ULONG 15
+#define T_LNGDBL 16
+
+/* derivated types */
+#define DT_NON 0
+#define DT_PTR 1
+#define DT_FCN 2
+#define DT_ARY 3
+
+/* storage class */
+#define C_NULL 0
+#define C_AUTO 1
+#define C_EXT 2
+#define C_STAT 3
+#define C_REG 4
+#define C_EXTDEF 5
+#define C_LABEL 6
+#define C_ULABEL 7
+#define C_MOS 8
+#define C_ARG 9
+#define C_STRTAG 10
+#define C_MOU 11
+#define C_UNTAG 12
+#define C_TPDEF 13
+#define C_USTATIC 14
+#define C_ENTAG 15
+#define C_MOE 16
+#define C_REGPARM 17
+#define C_FIELD 18
+#define C_AUTOARG 19
+#define C_LASTENT 20
+#define C_BLOCK 100
+#define C_FCN 101
+#define C_EOS 102
+#define C_FILE 103
+#define C_LINE 104
+#define C_ALIAS 105
+#define C_HIDDEN 106
+#define C_WEAKEXT 127
+#define C_EFCN 255
--- /dev/null
+++ b/include/scc/scc/cstd-c89.h
@@ -1,0 +1,103 @@
+#define STDC_VERSION "199409L"
+
+/* Translation limits */
+/*
+ * 15 nesting levels of compound statements, iteration control
+ * structures, and selection control structures
+ */
+#define NR_BLOCK 15
+/*
+ * 8 nesting levels of conditional inclusion
+ */
+#define NR_COND 8
+/*
+ * 12 pointer, array, and function declarators (in any combinations)
+ * modifying an arithmetic, a structure, a union, or an incomplete type
+ * in a declaration
+ */
+#define NR_DECLARATORS 12
+/*
+ * 31 declarators nested by parentheses within a full declarator
+ */
+#define NR_SUBTYPE 31
+/*
+ * 32 expressions nested by parentheses within a full expression
+ */
+#define NR_SUBEXPR 32
+/*
+ * 31 significant initial characters in an internal identifier or a
+ * macro name
+ */
+#define INTIDENTSIZ 31
+/*
+ * 6 significant initial characters in an external identifier
+ */
+#define EXTIDENTSIZ 6
+/*
+ * 511 external identifiers in one translation unit
+ */
+#define NR_EXT_IDENT 511
+/*
+ * 127 identifiers with block scope declared in one block
+ */
+#define NR_INT_IDENT 127
+/*
+ * 1024 macro identifiers simultaneously defined in one translation
+ * unit
+ */
+#define NR_MACROIDENT 1024
+/*
+ * 31 parameters in one function definition
+ */
+#define NR_FUNPARAM 31
+/*
+ * 31 arguments in one function call
+ */
+#define NR_FUNARG 31
+/*
+ * 31 parameters in one macro definition
+ */
+#define NR_MACROPARAM 31
+/*
+ * 31 arguments in one macro invocation
+ */
+#define NR_MACROARG 31
+/*
+ * 509 characters in a logical source line
+ */
+#define LINESIZ 509
+/*
+ * 509 characters in a character string literal or wide string literal
+ * (after concatenation)
+ */
+#define STRINGSIZ 509
+/*
+ * 32767 bytes in an object (in a hosted environment only)
+ */
+#define OBJECTSIZ 32767
+/*
+ * 8 nesting levels for #include'd files
+ */
+#define NR_INCLUDE 8
+/*
+ * 257 case labels for a switch statement (excluding those for any
+ * nested switch statements)
+ */
+#define NR_SWITCH 257
+/*
+ * 127 members in a single structure or union
+ */
+#define NR_FIELDS 127
+/*
+ * 127 enumeration constants in a single enumeration
+ */
+#define NR_ENUM_CTES 127
+/*
+ * 15 levels of nested structure or union definitions in a single
+ * struct-declaration-list
+ */
+#define NR_STRUCT_LEVEL 15
+/*
+ * number of defined structs/unions in one translation unit
+ */
+#define NR_MAXSTRUCTS 127
--- /dev/null
+++ b/include/scc/scc/cstd-c99.h
@@ -1,0 +1,111 @@
+#define STDC_VERSION "199901L"
+
+/* Translation limits */
+/*
+ * 127 nesting levels of blocks
+ */
+#define NR_BLOCK 127
+/*
+ * 63 nesting levels of conditional inclusion
+ */
+#define NR_COND 63
+/*
+ * 12 pointer, array, and function declarators (in any combinations)
+ * modifying an arithmetic, a structure, a union, or an incomplete type
+ * in a declaration
+ */
+#define NR_DECLARATORS 12
+/*
+ * 63 nesting levels of parenthesized declarators within a full
+ * declarator
+ */
+#define NR_SUBTYPE 63
+/*
+ * 63 nesting levels of parenthesized expressions within a full
+ * expression
+ */
+#define NR_SUBEXPR 63
+/*
+ * 63 significant initial characters in an internal identifier or a
+ * macro name (each universal character name or extended source
+ * character is considered a single character)
+ */
+#define INTIDENTSIZ 63
+/*
+ * 31 significant initial characters in an external identifier (each
+ * universal character name specifying a short identifier of 0000FFFF
+ * or less is considered 6 characters, each universal character name
+ * specifying a short identifier of 00010000 or more is considered 10
+ * characters, and each extended source character is considered the
+ * same number of characters as the corresponding universal character
+ * name, if any)
+ */
+#define EXTIDENTSIZ 31
+/*
+ * 4095 external identifiers in one translation unit
+ */
+#define NR_EXT_IDENT 4095
+/*
+ * 511 identifiers with block scope declared in one block
+ */
+#define NR_INT_IDENT 511
+/*
+ * 4096 macro identifiers simultaneously defined in one preprocessing
+ * translation unit
+ */
+#define NR_MACROIDENT 4096
+/*
+ * 127 parameters in one function definition
+ */
+#define NR_FUNPARAM 127
+/*
+ * 127 arguments in one function call
+ */
+#define NR_FUNARG 127
+/*
+ * 127 parameters in one macro definition
+ */
+#define NR_MACROPARAM 127
+/*
+ * 127 arguments in one macro invocation
+ */
+#define NR_MACROARG 127
+/*
+ * 4095 characters in a logical source line
+ */
+#define LINESIZ 4095
+/*
+ * 4095 characters in a character string literal or wide string literal
+ * (after concatenation)
+ */
+#define STRINGSIZ 4095
+/*
+ * 65535 bytes in an object (in a hosted environment only)
+ */
+#define OBJECTSIZ 65535
+/*
+ * 15 nesting levels for #include'd files
+ */
+#define NR_INCLUDE 15
+/*
+ * 1023 case labels for a switch statement (excluding those for any
+ * nested switch statements)
+ */
+#define NR_SWITCH 1023
+/*
+ * 1023 members in a single structure or union
+ */
+#define NR_FIELDS 1023
+/*
+ * 1023 enumeration constants in a single enumeration
+ */
+#define NR_ENUM_CTES 1023
+/*
+ * 63 levels of nested structure or union definitions in a single
+ * struct-declaration-list
+ */
+#define NR_STRUCT_LEVEL 63
+/*
+ * number of defined structs/unions in one translation unit
+ */
+#define NR_MAXSTRUCTS 127
--- /dev/null
+++ b/include/scc/scc/ldflags.def.h
@@ -1,0 +1,5 @@
+char *ldflags[] = {
+ "-static",
+ "-z","nodefaultlib",
+ NULL
+};
--- /dev/null
+++ b/include/scc/scc/myro.h
@@ -1,0 +1,79 @@
+#define MYROHDR_SIZ 48
+#define MYROSECT_SIZ 24
+#define MYROSYM_SIZ 26
+#define MYROREL_SIZ 16
+
+#define MYROMAGIC_SIZ 4
+#define MYROMAGIC "uobj"
+
+#define MYROMAXSEC 254
+
+struct myrohdr {
+ char magic[4];
+ unsigned long format;
+ unsigned long long entry;
+ unsigned long long strsize;
+ unsigned long long secsize;
+ unsigned long long symsize;
+ unsigned long long relsize;
+};
+
+struct myrosect {
+ unsigned long name;
+ unsigned short flags;
+ unsigned char fill;
+ unsigned char aligment;
+ unsigned long long offset;
+ unsigned long long len;
+};
+
+struct myrosym {
+ unsigned long name;
+ unsigned long type;
+ unsigned char section;
+ unsigned char flags;
+ unsigned long long offset;
+ unsigned long long len;
+};
+
+struct myrorel {
+ unsigned long id;
+ unsigned char flags;
+ unsigned char size;
+ unsigned char nbits;
+ unsigned char shift;
+ unsigned long long offset;
+};
+
+enum myrosecflg {
+ MYROSEC_READ = 1 << 0,
+ MYROSEC_WRITE = 1 << 1,
+ MYROSEC_EXEC = 1 << 2,
+ MYROSEC_LOAD = 1 << 3,
+ MYROSEC_FILE = 1 << 4,
+ MYROSEC_ABS = 1 << 5,
+};
+
+enum myrosymflg {
+ MYROSYM_COMMON = 1 << 0,
+ MYROSYM_EXTERN = 1 << 1,
+ MYROSYM_GLOBAL = 1 << 2,
+ MYROSYM_UNDEF = 1 << 3,
+ MYROSYM_ABS = 1 << 4,
+};
+
+enum myrosectnames {
+ MYRO_TEXT = 0,
+ MYRO_DATA = 1,
+ MYRO_BSS = 2,
+ MYRO_ABS = 3,
+};
+
+extern int wrmyrohdr(FILE *fp, struct myrohdr *hdr);
+extern int wrmyrosec(FILE *fp, struct myrosect *sect);
+extern int wrmyrosym(FILE *fp, struct myrosym *sym);
+extern int wrmyrorel(FILE *fp, struct myrorel *rel);
+extern int rdmyrohdr(FILE *fp, struct myrohdr *hdr);
+extern int rdmyrosec(FILE *fp, struct myrosect *sect);
+extern int rdmyrosym(FILE *fp, struct myrosym *sym);
+extern int rdmyrorel(FILE *fp, struct myrorel *rel);
--- /dev/null
+++ b/include/scc/scc/scc.h
@@ -1,0 +1,41 @@
+#include <stddef.h>
+
+extern int debug;
+
+#ifndef NDEBUG
+#define DBG(...) dbg(__VA_ARGS__)
+#define DBGON() (debug = 1)
+#else
+#define DBG(...)
+#define DBGON()
+#endif
+
+#define TINT long long
+#define TUINT unsigned long long
+#define TUINT_MAX ULLONG_MAX
+#define TINT_MAX LLONG_MAX
+#define TFLOAT double
+
+struct items {
+ char **s;
+ unsigned n;
+};
+
+typedef struct alloc Alloc;
+
+extern void die(const char *fmt, ...);
+extern void dbg(const char *fmt, ...);
+extern void newitem(struct items *items, char *item);
+extern void *xmalloc(size_t size);
+extern void *xcalloc(size_t nmemb, size_t size);
+extern char *xstrdup(const char *s);
+extern void *xrealloc(void *buff, register size_t size);
+extern Alloc *alloc(size_t size, size_t nmemb);
+extern void dealloc(Alloc *allocp);
+extern void *new(Alloc *allocp);
+extern void delete(Alloc *allocp, void *p);
+extern int casecmp(const char *s1, const char *s2);
+extern int lpack(unsigned char *dst, char *fmt, ...);
+extern int lunpack(unsigned char *src, char *fmt, ...);
+extern int bpack(unsigned char *dst, char *fmt, ...);
+extern int bunpack(unsigned char *src, char *fmt, ...);
--- /dev/null
+++ b/include/scc/scc/syscrts.def.h
@@ -1,0 +1,5 @@
+char *syscrts[] = {
+ /* configure below your system crts */
+ /* PREFIX "/lib/scc/crt.o", */
+ NULL
+};
--- /dev/null
+++ b/include/scc/scc/sysincludes.def.h
@@ -1,0 +1,8 @@
+char *sysincludes[] = {
+ PREFIX "/include/scc/" ,
+ PREFIX "/include/scc/bits/" ARCH "-" ABI "/",
+ /* configure below your standard sys include paths */
+ PREFIX "/include/",
+ PREFIX "/local/include/",
+ NULL
+};
--- /dev/null
+++ b/include/scc/scc/syslibs.def.h
@@ -1,0 +1,9 @@
+#define MAX_LIB_PATHS 32
+
+char *syslibs[MAX_LIB_PATHS + 1] = {
+ PREFIX "/lib/scc/" ,
+ /* configure below your standard sys include paths */
+ PREFIX "/lib/",
+ PREFIX "/local/lib/",
+ NULL
+};
--- /dev/null
+++ b/include/setjmp.h
@@ -1,0 +1,11 @@
+#ifndef _SETJMP_H
+#define _SETJMP_H
+
+#include <arch/setjmp.h>
+
+extern int setjmp(jmp_buf env);
+extern void longjmp(jmp_buf env, int val);
+
+#define setjmp setjmp
+
+#endif
--- /dev/null
+++ b/include/signal.h
@@ -1,0 +1,9 @@
+#ifndef _SIGNAL_H
+#define _SIGNAL_H
+
+#include <sys/signal.h>
+
+void ( *signal(int signum, void (*handler)(int)) ) (int);
+int raise(int sig);
+
+#endif
--- /dev/null
+++ b/include/stdarg.h
@@ -1,0 +1,10 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+typedef __builtin_va_list va_list;
+#define va_start(ap, last) __builtin_va_start(ap, last)
+#define va_end(ap) __builtin_va_end(ap)
+#define va_copy(to, from) __builtin_va_copy(to, from)
+#define va_arg(to, type) __builtin_va_arg(to, type)
+
+#endif
--- /dev/null
+++ b/include/stdbool.h
@@ -1,0 +1,9 @@
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#define bool _Bool
+#define true 1
+#define false 0
+#define __bool_true_false_are_defined 1
+
+#endif
--- /dev/null
+++ b/include/stddef.h
@@ -1,0 +1,12 @@
+#ifndef _STDDEF_H
+#define _STDDEF_H
+
+#include <arch/stddef.h>
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define offsetof(st, m) ((size_t)&(((st *)0)->m))
+
+#endif
--- /dev/null
+++ b/include/stdint.h
@@ -1,0 +1,6 @@
+#ifndef _STDINT_H_
+#define _STDINT_H_
+
+#include <arch/stdint.h>
+
+#endif
--- /dev/null
+++ b/include/stdio.h
@@ -1,0 +1,123 @@
+#ifndef _STDIO_H
+#define _STDIO_H
+
+#include <arch/stdio.h>
+
+#ifndef FOPEN_MAX
+#define FOPEN_MAX 12
+#endif
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define EOF -1
+#define SEEK_CUR 0
+#define SEEK_END 1
+#define SEEK_SET 2
+
+
+#define _IOWRITE (1 << 0)
+#define _IOREAD (1 << 1)
+#define _IORW (1 << 2)
+#define _IOEOF (1 << 3)
+#define _IOERR (1 << 4)
+#define _IOSTRG (1 << 5)
+#define _IOTXT (1 << 6)
+#define _IOFBF (1 << 7)
+#define _IOLBF (1 << 8)
+#define _IONBF (1 << 9)
+#define _IOALLOC (1 <<10)
+
+typedef struct {
+ int fd; /* file descriptor */
+ unsigned char *buf; /* pointer to i/o buffer */
+ unsigned char *rp; /* read pointer */
+ unsigned char *wp; /* write pointer */
+ unsigned char *lp; /* write pointer used when line-buffering */
+ size_t len; /* actual length of buffer */
+ unsigned short flags;
+ unsigned char unbuf[1]; /* tiny buffer for unbuffered io */
+} FILE;
+
+extern FILE __iob[FOPEN_MAX];
+
+#define stdin (&__iob[0])
+#define stdout (&__iob[1])
+#define stderr (&__iob[2])
+
+extern int remove(const char *filename);
+extern int rename(const char *old, const char *new);
+extern FILE *tmpfile(void);
+extern char *tmpnam(char *s);
+extern int fclose(FILE *fp);
+extern int fflush(FILE *fp);
+extern FILE *fopen(const char * restrict fname, const char * restrict mode);
+extern FILE *freopen(const char * restrict fname, const char * restrict mode,
+ FILE * restrict fp);
+extern void setbuf(FILE * restrict fp, char * restrict buf);
+extern int setvbuf(FILE * restrict fp,
+ char * restrict buf, int mode, size_t size);
+extern int fprintf(FILE * restrict fp, const char * restrict fmt, ...);
+extern int fscanf(FILE * restrict fp, const char * restrict fmt, ...);
+extern int printf(const char * restrict fmt, ...);
+extern int scanf(const char * restrict fmt, ...);
+extern int snprintf(char * restrict s,
+ size_t n, const char * restrict fmt, ...);
+extern int sprintf(char * restrict s, const char * restrict fmt, ...);
+extern int sscanf(const char * restrict s, const char * restrict fmt, ...);
+
+#ifdef _STDARG_H
+extern int vfprintf(FILE * restrict fp,
+ const char * restrict fmt, va_list arg);
+extern int vfscanf(FILE * restrict fp,
+ const char * restrict fmt, va_list arg);
+extern int vprintf(const char * restrict fmt, va_list arg);
+extern int vscanf(const char * restrict fmt, va_list arg);
+extern int vsnprintf(char * restrict s, size_t n, const char * restrict fmt,
+ va_list arg);
+extern int vsprintf(char * restrict s,
+ const char * restrict fmt, va_list arg);
+extern int vsscanf(const char * restrict s,
+ const char * restrict fmt, va_list arg);
+#endif
+
+extern int fgetc(FILE *fp);
+extern char *fgets(char * restrict s, int n, FILE * restrict fp);
+extern int fputc(int c, FILE *fp);
+extern int fputs(const char * restrict s, FILE * restrict fp);
+extern int getc(FILE *fp);
+extern int getchar(void);
+extern char *gets(char *s);
+extern int putc(int c, FILE *fp);
+extern int putchar(int c);
+extern int puts(const char *s);
+extern int ungetc(int c, FILE *fp);
+extern size_t fread(void * restrict ptr, size_t size, size_t nmemb,
+ FILE * restrict fp);
+extern size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb,
+ FILE * restrict fp);
+extern int fgetpos(FILE * restrict fp, fpos_t * restrict pos);
+extern int fseek(FILE *fp, long int offset, int whence);
+extern int fsetpos(FILE *fp, const fpos_t *pos);
+extern long int ftell(FILE *fp);
+extern void rewind(FILE *fp);
+extern void clearerr(FILE *fp);
+extern int feof(FILE *fp);
+extern int ferror(FILE *fp);
+extern void perror(const char *s);
+
+extern int __getc(FILE *fp);
+extern int __putc(int, FILE *fp);
+
+#define getc(fp) ((fp)->rp >= (fp)->wp ? __getc(fp) : *(fp)->rp++)
+#define putc(c, fp) ((fp)->wp >= (fp)->rp ? __putc(c,fp) : (*(fp)->wp++ = c))
+
+#define ferror(fp) ((fp)->flags & _IOERR)
+#define feof(fp) ((fp)->flags & _IOEOF)
+#define clearerr(fp) (void) ((fp)->flags &= ~(_IOERR|_IOEOF))
+#define getchar() getc(stdin)
+#define putchar(c) putc((c), stdout)
+#define setbuf(fp, b) (void) setvbuf(fp, b, b ? _IOFBF:_IONBF, BUFSIZ)
+
+#endif
--- /dev/null
+++ b/include/stdlib.h
@@ -1,0 +1,69 @@
+#ifndef _STDLIB_H
+#define _STDLIB_H
+
+#include <arch/stdlib.h>
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define _ATEXIT_MAX 32
+
+#define MB_CUR_MAX 1
+#define RAND_MAX 32767
+
+typedef struct {
+ int quot, rem;
+} div_t;
+
+typedef struct {
+ long quot, rem;
+} ldiv_t;
+
+typedef struct {
+ long long quot, rem;
+} lldiv_t;
+
+extern double atof(const char *nptr);
+extern int atoi(const char *nptr);
+extern long int atol(const char *nptr);
+extern long long int atoll(const char *nptr);
+extern double strtod(const char * restrict nptr, char ** restrict endptr);
+extern float strtof(const char * restrict nptr, char ** restrict endptr);
+extern long double strtold(const char * restrict nptr, char ** restrict endptr);
+extern long int strtol(const char * restrict nptr, char ** restrict endptr, int base);
+extern long long int strtoll(const char * restrict nptr, char ** restrict endptr,
+ int base);
+extern unsigned long int strtoul(const char * restrict nptr, char ** restrict endptr,
+ int base);
+extern unsigned long long int strtoull(const char * restrict nptr,
+ char ** restrict endptr, int base);
+extern int rand(void);
+extern void srand(unsigned int seed);
+extern void *calloc(size_t nmemb, size_t size);
+extern void free(void *ptr);
+extern void *malloc(size_t size);
+extern void *realloc(void *ptr, size_t size);
+extern void abort(void);
+extern int atexit(void (*func)(void));
+extern void exit(int status);
+extern void _Exit(int status);
+extern char *getenv(const char *name);
+extern int system(const char *string);
+extern void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+extern void qsort(void *base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+extern int abs(int j);
+extern long int labs(long int j);
+extern long long int llabs(long long int j);
+extern div_t div(int numer, int denom);
+extern ldiv_t ldiv(long int numer, long int denom);
+extern lldiv_t lldiv(long long int numer, long long int denom);
+extern int mblen(const char *s, size_t n);
+extern int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n);
+extern int wctomb(char *s, wchar_t wchar);
+extern size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n);
+extern size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n);
+
+#endif
--- /dev/null
+++ b/include/string.h
@@ -1,0 +1,34 @@
+#ifndef _STRING_H
+#define _STRING_H
+
+#include <arch/string.h>
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+extern void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
+extern void *memmove(void *s1, const void *s2, size_t n);
+extern char *strcpy(char * restrict s1, const char * restrict s2);
+extern char *strncpy(char * restrict s1, const char * restrict s2, size_t n);
+extern char *strcat(char * restrict s1, const char * restrict s2);
+extern char *strncat(char * restrict s1, const char * restrict s2, size_t n);
+extern int memcmp(const void *s1, const void *s2, size_t n);
+extern int strcmp(const char *s1, const char *s2);
+extern int strcoll(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, size_t n);
+extern size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n);
+extern void *memchr(const void *s, int c, size_t n);
+extern char *strchr(const char *s, int c);
+extern size_t strcspn(const char *s1, const char *s2);
+extern char *strpbrk(const char *s1, const char *s2);
+extern char *strrchr(const char *s, int c);
+extern size_t strspn(const char *s1, const char *s2);
+extern char *strstr(const char *s1, const char *s2);
+extern char *strtok(char * restrict s1, const char * restrict s2);
+extern void *memset(void *s, int c, size_t n);
+extern char *strerror(int errnum);
+extern size_t strlen(const char *s);
+extern size_t strnlen(const char *s, size_t maxlen);
+
+#endif
--- /dev/null
+++ b/include/time.h
@@ -1,0 +1,43 @@
+#ifndef _TIME_H
+#define _TIME_H
+
+#include <arch/time.h>
+
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#define CLOCKS_PER_SEC 1000000
+
+typedef long int clock_t;
+
+struct tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+
+ /* fields used internally */
+
+ char *tm_zone;
+ long tm_gmtoff;
+};
+
+extern clock_t clock(void);
+extern double difftime(time_t time1, time_t time0);
+extern time_t mktime(struct tm *timeptr);
+extern time_t time(time_t *timer);
+extern char *asctime(const struct tm *timeptr);
+extern char *ctime(const time_t *timer);
+extern struct tm *gmtime(const time_t *timer);
+extern struct tm *localtime(const time_t *timer);
+extern size_t strftime(char * restrict s, size_t maxsize,
+ const char * restrict format,
+ const struct tm * restrict timeptr);
+
+#endif
--- /dev/null
+++ b/include/wchar.h
@@ -1,0 +1,92 @@
+#ifndef _WCHAR_H
+#define _WCHAR_H
+
+/* TODO: This is only a placeholder */
+typedef long wchar_t;
+/* typedef long size_t; */
+typedef long mbstate_t;
+typedef long wint_t;
+struct tm;
+
+/* #define WCHAR_MAX 1 */
+/* #define WCHAR_MIN 1 */
+/* #define WEOF -1 */
+/* #define NULL 0 */
+
+#ifdef _STDARG_H
+extern int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg);
+extern int vwprintf(const wchar_t * restrict format, va_list arg);
+extern int vwscanf(const wchar_t * restrict format, va_list arg);
+#endif
+
+#ifdef _STDIO_H
+extern int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...);
+extern int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...);
+
+#ifdef _STDARG_H
+extern int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
+extern int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
+extern int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg);
+#endif
+
+extern wint_t fgetwc(FILE *stream);
+extern wint_t fputwc(wchar_t c, FILE *stream);
+extern wint_t getwc(FILE *stream);
+extern wint_t putwc(wchar_t c, FILE *stream);
+extern int fwide(FILE *stream, int mode);
+extern wint_t ungetwc(wint_t c, FILE *stream);
+extern wchar_t *fgetws(wchar_t * restrict s, int n, FILE * restrict stream);
+extern int fputws(const wchar_t * restrict s, FILE * restrict stream);
+#endif
+
+extern int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...);
+extern int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...);
+extern int wprintf(const wchar_t * restrict format, ...);
+extern int wscanf(const wchar_t * restrict format, ...);
+
+extern wint_t getwchar(void);
+extern wint_t putwchar(wchar_t c);
+
+extern double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
+extern float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
+extern long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
+
+extern long int wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+extern long long int wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+extern unsigned long int wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+extern unsigned long long int wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
+
+extern wchar_t *wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2);
+extern wchar_t *wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
+
+extern wchar_t *wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
+extern wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n);
+extern wchar_t *wcscat(wchar_t * restrict s1, const wchar_t * restrict s2);
+extern wchar_t *wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
+extern int wcscmp(const wchar_t *s1, const wchar_t *s2);
+extern int wcscoll(const wchar_t *s1, const wchar_t *s2);
+extern int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
+extern size_t wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
+extern int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n);
+extern wchar_t *wcschr(const wchar_t *s, wchar_t c);
+extern size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
+extern wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
+extern wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
+extern size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
+extern wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
+extern wchar_t *wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr);
+extern wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
+extern size_t wcslen(const wchar_t *s);
+extern wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
+extern size_t wcsftime(wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr);
+extern wint_t btowc(int c);
+extern int wctob(wint_t c);
+extern int mbsinit(const mbstate_t *ps);
+extern size_t mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps);
+extern size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps);
+extern size_t wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps);
+extern size_t mbsrtowcs(wchar_t * restrict dst, const char ** restrict src, size_t len, mbstate_t * restrict ps);
+extern size_t wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps);
+
+
+#endif
--- /dev/null
+++ b/include/wctype.h
@@ -1,0 +1,30 @@
+#ifndef _WCTYPE_H
+#define _WCTYPE_H
+
+/* TODO: This is only a placeholder */
+typedef int wint_t;
+typedef int wctrans_t;
+typedef int wctype_t;
+
+#define WEOF -1
+
+extern int iswalnum(wint_t wc);
+extern int iswalpha(wint_t wc);
+extern int iswblank(wint_t wc);
+extern int iswcntrl(wint_t wc);
+extern int iswdigit(wint_t wc);
+extern int iswgraph(wint_t wc);
+extern int iswlower(wint_t wc);
+extern int iswprint(wint_t wc);
+extern int iswpunct(wint_t wc);
+extern int iswspace(wint_t wc);
+extern int iswupper(wint_t wc);
+extern int iswxdigit(wint_t wc);
+extern int iswctype(wint_t wc, wctype_t desc);
+extern wctype_t wctype(const char *property);
+extern wint_t towlower(wint_t wc);
+extern wint_t towupper(wint_t wc);
+extern wint_t towctrans(wint_t wc, wctrans_t desc);
+extern wctrans_t wctrans(const char *property);
+
+#endif
--- a/ld/Makefile
+++ /dev/null
@@ -1,23 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-include $(LIBCOFF32)/libdep.mk
-
-OBJ = main.o coff32.o obj.o
-LIB = $(LIBDIR)/libscc.a $(LIBDIR)/libcoff32.a
-TARGET = ld
-
-all: $(TARGET)
-
-$(TARGET): $(OBJ) $(LIB)
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lcoff32 -lscc -o $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f $(BINDIR)/ld *.o
-
-include deps.mk
--- a/ld/coff32.c
+++ /dev/null
@@ -1,403 +1,0 @@
-static char sccsid[] = "@(#) ./ld/coff32.c";
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/coff32/aouthdr.h"
-#include "../inc/coff32/filehdr.h"
-#include "../inc/coff32/scnhdr.h"
-#include "../inc/coff32/syms.h"
-#include "../inc/coff32/coff32.h"
-#include "../inc/scc.h"
-#include "ld.h"
-
-#define NUMSCN_MAX 65536
-#define NUMENT_MAX 2147483648
-
-static long textpc = 0x1000;
-
-/*
- * check overflow in: off + ptr + nitem*size
- */
-static char *
-symname(Obj *obj, SYMENT *ent)
-{
- long off;
-
- if (ent->n_zeroes != 0)
- return ent->n_name;
-
- off = ent->n_offset;
- if (off >= obj->strsiz) {
- fprintf(stderr,
- "ld: invalid offset in symbol table: %zd\n", off);
- return "";
- }
-
- return &obj->strtbl[off];
-}
-
-static int
-readstr(Obj *obj, long off)
-{
- unsigned char buff[4];
- char *str;
- size_t siz;
-
- if (fseek(obj->fp, off, SEEK_SET) == EOF)
- return -1;
-
- if (fread(buff, 4, 1, obj->fp) != 1)
- return -1;
-
- (*obj->unpack)(buff, "l", &siz);
-
- siz -= 4;
- if (siz == 0) {
- obj->strtbl = NULL;
- obj->strsiz = 0;
- return 0;
- }
-
- if (siz > SIZE_MAX || (str = malloc(siz)) == NULL)
- outmem();
-
- if (fread(str, siz, 1, obj->fp) != 1)
- return -1;
-
- obj->strtbl = str;
- obj->strsiz = siz;
-
- return 0;
-}
-
-static int
-readsects(Obj *obj, long off)
-{
- unsigned a, nsec, i;
- unsigned char buff[SCNHSZ];
- SCNHDR *scns, *p;
- FILHDR *hdr;
- Symbol *sym;
- Section *sp;
-
- hdr = obj->filhdr;
- nsec = hdr->f_nscns;
-
- scns = NULL;
- if (nsec <= SIZE_MAX / sizeof(*scns))
- scns = malloc(nsec * sizeof(*scns));
- if (!scns)
- outmem();
- obj->scnhdr = scns;
-
- if (fseek(obj->fp, off, SEEK_SET) == EOF)
- return -1;
-
- a = obj->align - 1;
- for (i = 0; i < nsec; ++i) {
- p = &scns[i];
- if (fread(buff, SCNHSZ, 1, obj->fp) != 1)
- return -1;
- coff32_unpack_scn(obj->unpack, buff, p);
- sp = slookup(p->s_name);
- p->s_vaddr = sp->base + sp->size;
- sp->size += p->s_size;
- }
-
- return 0;
-}
-
-static int
-readents(Obj *obj, long off)
-{
- SYMENT *ent, *ents;
- SCNHDR *scn, *scns = obj->scnhdr;
- FILHDR *hdr = obj->filhdr;;
- long nsyms = hdr->f_nsyms;
- unsigned nsect;
- unsigned char buff[SYMESZ];
- char *s;
- int aux;
- Symbol *sym;
-
-
- if (fseek(obj->fp, off, SEEK_SET) == EOF)
- return -1;
-
- ents = NULL;
- if (nsyms <= SIZE_MAX/sizeof(SYMENT))
- ents = malloc((nsyms * sizeof(SYMENT)));
- if (!ents)
- outmem();
- obj->enthdr = ents;
-
- aux = 0;
- for (ent = ents; ent < &ents[nsyms]; ++ent) {
- if (fread(buff, SYMESZ, 1, obj->fp) != 1)
- return -1;
- coff32_unpack_ent(obj->unpack, buff, ent);
- s = ent->n_name;
- if (!s[0] && !s[1] && !s[2] && !s[3])
- (*obj->unpack)(buff, "ll", &ent->n_zeroes, &ent->n_offset);
-
- if (aux > 0) {
- aux--;
- continue;
- }
- aux = ent->n_numaux;
-
- scn = NULL;
- switch (ent->n_scnum) {
- case N_DEBUG:
- continue;
- case N_ABS:
- break;
- case N_UNDEF:
- /* TODO: deal wth common blocks */
- break;
- default:
- nsect = ent->n_scnum-1;
- if (nsect >= hdr->f_nscns)
- corrupted(obj->fname, obj->member);
- scn = &scns[nsect];
- ent->n_value += scn->s_vaddr;
- }
-
- if (ent->n_sclass == C_EXT && ent->n_scnum != N_UNDEF) {
- Symbol *sym = lookup(symname(obj, ent), INSTALL);
-
- if (sym->flags & SDEFINED) {
- redefined(obj, sym);
- } else {
- sym->flags |= SDEFINED;
- sym->where = obj;
- if (scn)
- sym->section = slookup(scn->s_name);
- }
- }
- }
-
- return 0;
-}
-
-static long
-fileptr(long off, long ptr, long nitem, long size)
-{
- if (off < 0 || ptr < 0 || nitem < 0 || size < 0)
- return -1;
-
- if (off > LONG_MAX - ptr)
- return -1;
- off += ptr;
-
- if (size > 0) {
- if (nitem > LONG_MAX / size)
- return -1;
- size *= nitem;
- }
-
- if (off > LONG_MAX - size)
- return -1;
- off += size;
-
- return off;
-}
-
-Obj *
-load(Obj *obj)
-{
- unsigned char buff[FILHSZ];
- FILHDR *hdr;
- char *strtbl;
- long symoff, secoff, stroff, pos;
-
- pos = ftell(obj->fp);
- if (fread(buff, FILHSZ, 1, obj->fp) != 1)
- goto bad_file;
-
- if ((hdr = malloc(sizeof(*hdr))) == NULL)
- outmem();
- coff32_unpack_hdr(obj->unpack, buff, hdr);
- obj->filhdr = hdr;
-
- stroff = fileptr(pos, hdr->f_symptr, hdr->f_nsyms, SYMESZ);
- symoff = fileptr(pos, hdr->f_symptr, 0, 0);
- secoff = fileptr(pos, hdr->f_opthdr, 1, FILHSZ);
-
- if (stroff < 0 || symoff < 0 || secoff < 0)
- goto bad_file;
-
- if (readstr(obj, stroff) < 0)
- goto bad_file;
- if (readsects(obj, secoff) < 0)
- goto bad_file;
- if (readents(obj, symoff) < 0)
- goto bad_file;
- return add(obj);
-
-bad_file:
- fprintf(stderr,
- "ld: %s: %s\n",
- obj->fname,
- (ferror(obj->fp)) ? strerror(errno) : "corrupted file");
- exit(EXIT_FAILURE);
-}
-
-Obj *
-probe(char *fname, char *member, FILE *fp)
-{
- int c;
- int c1, c2;
- long pos;
- unsigned short magic;
- unsigned align;
- int (*unpack)(unsigned char *, char *, ...);
- int (*pack)(unsigned char *, char *, ...);
- Obj *obj;
-
- pos = ftell(fp);
- c1 = getc(fp);
- c2 = getc(fp);
- fseek(fp, pos, SEEK_SET);
-
- if (ferror(fp))
- die("ld: %s: %s", fname, strerror(errno));
-
- if (c1 == EOF || c2 == EOF)
- return 0;
- magic = c1 | c2 << 8;
-
- switch (magic) {
- case COFF_I386MAGIC:
- case COFF_Z80MAGIC:
- unpack = lunpack;
- pack = lpack;
- align = 2;
- break;
- default:
- return NULL;
- }
-
- obj = newobj(fname, member, fp);
- obj->unpack = unpack;
- obj->align = align;
- obj->offset = pos;
-
- return obj;
-}
-
-static void
-wrhdr(FILE *fp)
-{
- FILHDR hdr;
- Section *sp;
- unsigned char buff[FILHSZ];
-
- if (numsects > NUMSCN_MAX || numsymbols > NUMENT_MAX) {
- fprintf(stderr, "ld: too many symbols or sections\n");
- exit(EXIT_FAILURE);
- }
-
- /*
- * we set the timestamp to 0 to make the output
- * reproductible and to avoid a not standard use
- * of time()
- */
- hdr.f_symptr = 0;
- hdr.f_magic = COFF_Z80MAGIC;
- hdr.f_nscns = numsects;
- hdr.f_symptr = 0;
- hdr.f_timdat = 0;
- hdr.f_nsyms = 0;
- hdr.f_opthdr = AOUTSZ;
- hdr.f_flags = F_EXEC | F_AR32WR; /* TODO: set the correct endianess */
-
- if (!sflag) {
- hdr.f_symptr = 0; /* TODO: set correct value here */
- hdr.f_flags |= F_SYMS;
- hdr.f_nsyms = numsymbols;
- }
-
- coff32_pack_hdr(lpack, buff, &hdr);
- fwrite(buff, FILHSZ, 1, fp);
-}
-
-static void
-wraout(FILE *fp)
-{
- AOUTHDR aout;
- unsigned char buff[AOUTSZ];
- Symbol *sym;
- long addr;
-
- if ((sym = lookup(entry, NOINSTALL)) != NULL) {
- addr = sym->value;
- } else {
- fprintf(stderr,
- "ld: warning: cannot find entry symbol '%s'; defaulting to 0\n",
- entry);
- addr = 0;
- }
-
- aout.magic = ZMAGIC;
- aout.vstamp = 0;
- aout.entry = addr;
- aout.tsize = tsize;
- aout.dsize = dsize;
- aout.bsize = bsize;
- aout.text_start = textpc;
- aout.data_start = textpc + dsize;
-
- coff32_pack_aout(lpack, buff, &aout);
- fwrite(buff, AOUTSZ, 1, fp);
-}
-
-static void
-wrscn(FILE *fp, Section *sp, long pc)
-{
- SCNHDR scn;
- unsigned char buff[SCNHSZ];
-
- strcpy(scn.s_name, sp->name);
- scn.s_paddr = pc;
- scn.s_vaddr = pc;
- scn.s_size = sp->size;
- scn.s_scnptr = 0; /* TODO: file ptr */
- scn.s_relptr = 0;
- scn.s_lnnoptr = 0;
- scn.s_nrelloc = 0;
- scn.s_nlnno = 0;
- scn.s_flags = 0; /* TODO: Add flags */
-
- coff32_pack_scn(lpack, buff, &scn);
- fwrite(buff, SCNHSZ, 1, fp);
-}
-
-void
-writeout(FILE *fp)
-{
- Section *sp;
- long pc = textpc;
-
- wrhdr(fp);
- wraout(fp);
-
- for (sp = sectlst; sp; sp = sp->next) {
- wrscn(fp, sp, pc);
- pc += sp->size;
- }
-
- /* TODO: run over all the files */
-
- if (fflush(fp) == EOF) {
- perror("ld: error writing output file");
- exit(EXIT_FAILURE);
- }
-}
--- a/ld/deps.mk
+++ /dev/null
@@ -1,15 +1,0 @@
-
-#deps
-coff32.o: ../inc/coff32/aouthdr.h
-coff32.o: ../inc/coff32/coff32.h
-coff32.o: ../inc/coff32/filehdr.h
-coff32.o: ../inc/coff32/scnhdr.h
-coff32.o: ../inc/coff32/syms.h
-coff32.o: ../inc/scc.h
-coff32.o: ld.h
-main.o: ../inc/ar.h
-main.o: ../inc/scc.h
-main.o: ../inc/syslibs.h
-main.o: ld.h
-obj.o: ../inc/scc.h
-obj.o: ld.h
--- a/ld/ld.h
+++ /dev/null
@@ -1,84 +1,0 @@
-#define INSTALL 1
-#define NOINSTALL 0
-
-typedef struct obj Obj;
-typedef struct symbol Symbol;
-typedef struct section Section;
-
-struct obj {
- char *fname;
- char *member;
- FILE *fp;
- long offset;
-
- void *filhdr;
- void *scnhdr;
- void *enthdr;
-
- char *strtbl;
- size_t strsiz;
-
- int (*unpack)(unsigned char *, char *, ...);
- int align;
-
- struct obj *next;
-};
-
-enum symflg {
- SDEFINED = 1 << 1,
-};
-
-struct symbol {
- char *name;
- unsigned char flags;
- long size;
- TUINT base;
- TUINT value;
- Section *section;
- Obj *where;
- struct symbol *hash, *next;
-};
-
-struct section {
- char *name;
- TUINT base;
- TUINT size;
- struct section *next;
-};
-
-/* obj.c */
-extern Obj *newobj(char *fname, char *member, FILE *fp);
-extern Obj *add(Obj *obj);
-extern void delobj(Obj *obj);
-extern Section *slookup(char *name);
-extern Symbol *lookup(char *name, int install);
-
-/* main.c */
-extern void outmem(void);
-extern void corrupted(char *fname, char *member);
-extern void redefined(Obj *obj, Symbol *sym);
-
-/* object format */
-extern Obj *probe(char *fname, char *member, FILE *fp);
-extern Obj *load(Obj *obj);
-extern void writeout(FILE *fp);
-
-
-/*
- * Definition of globals variables
- */
-extern int pass;
-extern int sflag;
-extern int xflag;
-extern int Xflag;
-extern int rflag;
-extern int dflag;
-extern int gflag;
-extern Obj *objlst;
-extern Section *sectlst;
-extern long numsects;
-extern long numsymbols;
-extern TUINT tsize, dsize, bsize;
-extern char *output;
-extern char *entry;
-extern char *datasiz;
--- a/ld/main.c
+++ /dev/null
@@ -1,288 +1,0 @@
-static char sccsid[] = "@(#) ./ld/main.c";
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "../inc/ar.h"
-#include "../inc/syslibs.h"
-#include "ld.h"
-
-char *output = "a.out", *entry = "start", *datasiz;
-int pass;
-int sflag; /* discard all the symbols */
-int xflag; /* discard local symbols */
-int Xflag; /* discard locals starting with 'L' */
-int rflag; /* preserve relocation bits */
-int dflag; /* define common even with rflag */
-int gflag; /* preserve debug symbols */
-
-static int done;
-
-void
-redefined(Obj *obj, Symbol *sym)
-{
- /* TODO: add infotmation about where it is defined */
- fprintf(stderr,
- "ld: %s: redifinition of symbol '%s'\n",
- obj->fname, sym->name);
-}
-
-void
-corrupted(char *fname, char *member)
-{
- char *fmt;
-
- fmt = (member) ?
- "ld: %s(%s): corrupted file\n" : "ld: %s: corrupted file\n";
- fprintf(stderr, fmt, fname, member);
- exit(EXIT_FAILURE);
-}
-
-void
-outmem(void)
-{
- fputs("ld: out of memory\n", stderr);
- exit(EXIT_FAILURE);
-}
-
-static void
-cleanup(void)
-{
- if (!done)
- remove(output);
-}
-
-static int
-object(char *fname, char *member, FILE *fp)
-{
- Obj *obj;
-
- obj = probe(fname, member, fp);
- if (!obj)
- return 0;
- load(obj);
-
- return 1;
-}
-
-static char *
-getfname(struct ar_hdr *hdr, char *dst)
-{
- char *p;
- int i;
-
- memcpy(dst, hdr->ar_name, SARNAM);
- dst[SARNAM] = '\0';
-
- for (i = SARNAM-1; i >= 0; i--) {
- if (dst[i] != ' ' && dst[i] != '/')
- break;
- dst[i] = '\0';
- }
- return dst;
-}
-
-static void
-ar(char *fname, FILE *fp)
-{
- struct ar_hdr hdr;
- long pos, siz;
- char member[SARNAM+1];
-
- if (fseek(fp, SARMAG, SEEK_SET) == EOF)
- goto file_error;
-
- while (fread(&hdr, sizeof(hdr), 1, fp) == 1) {
- if (strncmp(hdr.ar_fmag, ARFMAG, sizeof(hdr.ar_fmag)))
- corrupted(fname, NULL);
-
- siz = 0;
- sscanf(hdr.ar_size, "%10ld", &siz);
- if (siz & 1)
- siz++;
- if (siz == 0)
- corrupted(fname, NULL);
-
- pos = ftell(fp);
- if (pos == -1 || pos > LONG_MAX - siz) {
- fprintf(stderr,
- "ld: %s(%s): overflow in size of archive",
- fname, member);
- exit(EXIT_FAILURE);
- }
- pos += siz;
-
- getfname(&hdr, member);
- object(fname, member, fp);
- if (fseek(fp, pos, SEEK_SET) == EOF)
- break;
- }
-
-file_error:
- if (ferror(fp)) {
- fprintf(stderr, "ld: %s: %s\n", fname, strerror(errno));
- exit(EXIT_FAILURE);
- }
-}
-
-static int
-archive(char *fname, FILE *fp)
-{
- char magic[SARMAG];
- fpos_t pos;
-
- fgetpos(fp, &pos);
- fread(magic, SARMAG, 1, fp);
- fsetpos(fp, &pos);
-
- if (ferror(fp))
- return 0;
- if (strncmp(magic, ARMAG, SARMAG) != 0)
- return 0;
-
- ar(fname, fp);
- return 1;
-}
-
-static void
-pass1(int argc, char *argv[])
-{
- FILE *fp;
- char *s;
-
- while ((s = *argv++) != NULL) {
- if ((fp = fopen(s, "rb")) == NULL) {
- fprintf(stderr, "ld: %s: %s\n", s, strerror(errno));
- exit(EXIT_FAILURE);
- }
- if (!object(s, NULL, fp) && !archive(s, fp)) {
- fprintf(stderr, "ld: %s: File format not recognized\n", s);
- exit(EXIT_FAILURE);
- }
- fclose(fp);
- }
-}
-
-static void
-pass2(int argc, char *argv[])
-{
- FILE *fp;
-
- if ((fp = fopen(output, "wb")) != NULL) {
- writeout(fp);
- if (fclose(fp) != EOF)
- return;
- }
-
- fprintf(stderr, "ld: %s: %s\n", output, strerror(errno));
- exit(EXIT_FAILURE);
-}
-
-static void
-usage(void)
-{
- fputs("usage: ld [options] file ...\n", stderr);
- exit(1);
-}
-
-static void
-Lpath(char *path)
-{
- char **bp;
-
- for (bp = syslibs; bp < &syslibs[MAX_LIB_PATHS] && *bp; ++bp)
- ;
- if (bp == &syslibs[MAX_LIB_PATHS]) {
- fputs("ld: too many -L options\n", stderr);
- exit(1);
- }
- *bp = path;
-}
-
-int
-main(int argc, char *argv[])
-{
- char *cp, **p;
-
- for (--argc; *++argv; --argc) {
- if (argv[0][0] != '-' || argv[0][1] == 'l')
- break;
- if (argv[0][1] == '-') {
- --argc, ++argv;
- break;
- }
- for (cp = &argv[0][1]; *cp; ++cp) {
- switch (*cp) {
- case 's':
- sflag = 1;
- break;
- case 'x':
- xflag = 1;
- break;
- case 'X':
- Xflag = 1;
- break;
- case 'r':
- rflag = 1;
- break;
- case 'd':
- dflag = 1;
- break;
- case 'i':
- case 'n':
- /* TODO */
- break;
- case 'L':
- if (argc == 0)
- goto usage;
- ++argv, --argc;
- Lpath(*argv);
- break;
- case 'u':
- if (argc == 0)
- goto usage;
- ++argv, --argc;
- lookup(*argv, INSTALL);
- break;
- case 'o':
- if (argc == 0)
- goto usage;
- ++argv, --argc;
- output = *argv;
- break;
- case 'e':
- if (argc == 0)
- goto usage;
- ++argv, --argc;
- entry = *argv;
- break;
- case 'D':
- if (argc == 0)
- goto usage;
- ++argv, --argc;
- datasiz = *argv;
- break;
- default:
- usage:
- usage();
- }
- }
- }
-
- if (argc == 0)
- usage();
-
- atexit(cleanup);
-
- pass1(argc, argv);
- pass2(argc, argv);
-
- done = 1;
-
- return 0;
-}
--- a/ld/obj.c
+++ /dev/null
@@ -1,153 +1,0 @@
-static char sccsid[] = "@(#) ./ld/obj.c";
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/scc.h"
-#include "ld.h"
-
-#define NR_SYM_HASH 64
-
-TUINT tsize, dsize, bsize;
-
-Obj *objlst;
-static Obj *objtail;
-
-long numsects, numsymbols;
-static Symbol *secttail;
-static Symbol *symtbl[NR_SYM_HASH];
-
-Section *sectlst;
-
-Obj *
-add(Obj *obj)
-{
- obj->next = NULL;
-
- if (!objlst) {
- objtail = objlst = obj;
- } else {
- objtail->next = obj;
- objtail = obj;
- }
-}
-
-void
-delobj(Obj *obj)
-{
- free(obj->strtbl);
- free(obj->scnhdr);
- free(obj->filhdr);
- free(obj->fname);
- free(obj->member);
- free(obj);
-}
-
-Obj *
-newobj(char *fname, char *member, FILE *fp)
-{
- Obj *obj;
- char *s, *t;
- size_t len;
-
- len = strlen(fname);
- obj = malloc(sizeof(*obj));
- s = malloc(len) + 1;
- if (!obj || !s)
- outmem();
- memset(obj, 0, sizeof(*obj));
- obj->fname = memcpy(s, fname, len);
-
- if (!member) {
- obj->member = NULL;
- } else {
- len = strlen(member) + 1;
- if ((s = malloc(len)) == NULL)
- outmem();
- obj->member = memcpy(s, member, len);
- }
-
- obj->fp = fp;
- if ((obj->offset = ftell(fp)) == EOF) {
- fprintf(stderr, "ld: %s: %s\n", fname, strerror(errno));
- exit(1);
- }
-
- return obj;
-}
-
-Section *
-slookup(char *name)
-{
- char *s;
- Section *prev, *sp;
- size_t len = strlen(name);
-
- for (prev = sp = sectlst; sp; prev = sp, sp = sp->next) {
- if (!memcmp(sp->name, name, len))
- return sp;
- }
-
- sp = malloc(sizeof(*sp));
- s = malloc(len);
- if (!sp || !s)
- outmem();
- sp->name = s;
- sp->base = 0;
- sp->size = 0;
- sp->next = NULL;
-
- if (!prev)
- sectlst = sp;
- else
- prev->next = sp;
- numsects++;
-
- return sp;
-}
-
-static unsigned
-hash(char *s)
-{
- unsigned h, c;
-
- for (h = 0; c = *s; ++s)
- h = h*33 ^ c;
- return h & NR_SYM_HASH-1;
-}
-
-Symbol *
-lookup(char *name, int install)
-{
- unsigned h;
- char *s;
- size_t len;
- Symbol *sym;
-
- h = hash(name);
- for (sym = symtbl[h]; sym; sym = sym->hash) {
- s = sym->name;
- if (*name == *s && !strcmp(name, s))
- return sym;
- }
-
- if (!install)
- return NULL;
-
- len = strlen(name) + 1;
- sym = malloc(sizeof(*sym));
- s = malloc(len);
- if (!sym || !s)
- outmem();
- memset(sym, 0, sizeof(*sym));
- memcpy(s, name, len);
-
- sym->hash = symtbl[h];
- symtbl[h] = sym;
- sym->name = s;
- numsymbols++;
-
- return sym;
-}
--- a/lib/Makefile
+++ /dev/null
@@ -1,15 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-
-include $(PROJECTDIR)/rules.mk
-
-DIRS = scc coff32 crt c
-
-all: $(DIRS)
-
-$(DIRS): FORCE
- +@cd $@ && $(MAKE)
-
-dep clean distclean:
- $(FORALL)
--- a/lib/c/.gitignore
+++ /dev/null
@@ -1,1 +1,0 @@
-objlst
--- a/lib/c/Makefile
+++ /dev/null
@@ -1,29 +1,0 @@
-.POSIX:
-PROJECTDIR =../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-TARGET = $(PROJECTDIR)/lib/libc.a
-DIRS = arch\
- assert\
- ctype\
- locale\
- stdio\
- stdlib\
- string\
- time\
-
-all: $(DIRS)
- +@$(MAKE) $(TARGET)
-
-$(DIRS): FORCE
- +@cd $@ && $(MAKE)
-
-objlst: FORCE
- ./mklst $(TARGET)
-
-$(TARGET): objlst
- xargs $(AR) $(ARFLAGS) $@ < objlst
-
-clean:
- $(FORALL)
- rm -f objlst
--- a/lib/c/arch/.gitignore
+++ /dev/null
@@ -1,1 +1,0 @@
-syscall
--- a/lib/c/arch/Makefile
+++ /dev/null
@@ -1,11 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-DIRS = amd64 arm32 arm64
-
-all:
- +@cd $(ARCH) && $(MAKE)
-
-clean:
- $(FORALL)
--- a/lib/c/arch/amd64/Makefile
+++ /dev/null
@@ -1,14 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-OBJS = longjmp.o setjmp.o
-DIRS = netbsd openbsd dragonfly linux
-
-all: $(OBJS) $(SYS)
-
-$(SYS): FORCE
- +@cd $@ && $(MAKE)
-
-clean:
- $(FORALL)
--- a/lib/c/arch/amd64/dragonfly/.gitignore
+++ /dev/null
@@ -1,10 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_kill.s
-_lseek.s
-_open.s
-_read.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/amd64/dragonfly/Makefile
+++ /dev/null
@@ -1,35 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _open.o \
- _read.o \
- _write.o \
- _brk.o \
- _getheap.o \
- _sigaction.o\
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/amd64/dragonfly/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- movq $end,%rax
- retq
--- a/lib/c/arch/amd64/dragonfly/_sigaction.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
- struct sigaction *new, struct sigaction *old,
- int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
- extern int _setcontext[];
-
- return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/arch/amd64/dragonfly/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/amd64/dragonfly/gensys.sh
+++ /dev/null
@@ -1,26 +1,0 @@
-#!/bin/sh
-
-#
-# This job is very easy because app and kernel ABI are identical
-# until the 4th parameter, so we only have to set the syscall
-# number in rax
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
-$name:
- movq \$$num,%rax
- syscall
- jb 1f
- retq
-
-1: movl %eax,(errno)
- movl \$-1,%eax
- retq
-EOF
-done
--- a/lib/c/arch/amd64/dragonfly/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/amd64/dragonfly/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/amd64/dragonfly/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/amd64/dragonfly/syscall.lst
+++ /dev/null
@@ -1,10 +1,0 @@
-#number name
-1 _Exit
-3 _read
-4 _write
-5 _open
-6 _close
-17 _brk
-20 _getpid
-37 _kill
-199 _lseek
--- a/lib/c/arch/amd64/dragonfly/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/amd64/linux/.gitignore
+++ /dev/null
@@ -1,11 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_kill.s
-_lseek.s
-_open.s
-_read.s
-_sigaction.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/amd64/linux/Makefile
+++ /dev/null
@@ -1,37 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _open.o \
- _sigaction.o \
- _read.o \
- _write.o \
- _brk.o \
- _getheap.o \
- _cerrno.o \
- _sigaction.o \
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/amd64/linux/_cerrno.s
+++ /dev/null
@@ -1,12 +1,0 @@
- .file "_cerrno.s"
- .globl _cerrno
-
-_cerrno:
- cmpq $0,%rax
- js 1f
- retq
-
-1: neg %rax
- mov %eax,(errno)
- mov $-1,%eax
- retq
--- a/lib/c/arch/amd64/linux/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- movq $0,%rax
- jmp _brk
--- a/lib/c/arch/amd64/linux/_sigaction.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
- struct sigaction *new, struct sigaction *old,
- int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
- extern int _setcontext[];
-
- return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/arch/amd64/linux/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/amd64/linux/errno.lst
+++ /dev/null
@@ -1,131 +1,0 @@
-EPERM 1 Operation not permitted
-ENOENT 2 No such file or directory
-ESRCH 3 No such process
-EINTR 4 Interrupted system call
-EIO 5 I/O error
-ENXIO 6 No such device or address
-E2BIG 7 Argument list too long
-ENOEXEC 8 Exec format error
-EBADF 9 Bad file number
-ECHILD 10 No child processes
-EAGAIN 11 Try again
-ENOMEM 12 Out of memory
-EACCES 13 Permission denied
-EFAULT 14 Bad address
-ENOTBLK 15 Block device required
-EBUSY 16 Device or resource busy
-EEXIST 17 File exists
-EXDEV 18 Cross-device link
-ENODEV 19 No such device
-ENOTDIR 20 Not a directory
-EISDIR 21 Is a directory
-EINVAL 22 Invalid argument
-ENFILE 23 File table overflow
-EMFILE 24 Too many open files
-ENOTTY 25 Not a typewriter
-ETXTBSY 26 Text file busy
-EFBIG 27 File too large
-ENOSPC 28 No space left on device
-ESPIPE 29 Illegal seek
-EROFS 30 Read-only file system
-EMLINK 31 Too many links
-EPIPE 32 Broken pipe
-EDOM 33 Math argument out of domain of func
-ERANGE 34 Math result not representable
-EDEADLK 35 Resource deadlock would occur
-ENAMETOOLONG 36 File name too long
-ENOLCK 37 No record locks available
-ENOSYS 38 Invalid system call number
-ENOTEMPTY 39 Directory not empty
-ELOOP 40 Too many symbolic links encountered
-ENOMSG 42 No message of desired type
-EIDRM 43 Identifier removed
-ECHRNG 44 Channel number out of range
-EL2NSYNC 45 Level 2 not synchronized
-EL3HLT 46 Level 3 halted
-EL3RST 47 Level 3 reset
-ELNRNG 48 Link number out of range
-EUNATCH 49 Protocol driver not attached
-ENOCSI 50 No CSI structure available
-EL2HLT 51 Level 2 halted
-EBADE 52 Invalid exchange
-EBADR 53 Invalid request descriptor
-EXFULL 54 Exchange full
-ENOANO 55 No anode
-EBADRQC 56 Invalid request code
-EBADSLT 57 Invalid slot
-EBFONT 59 Bad font file format
-ENOSTR 60 Device not a stream
-ENODATA 61 No data available
-ETIME 62 Timer expired
-ENOSR 63 Out of streams resources
-ENONET 64 Machine is not on the network
-ENOPKG 65 Package not installed
-EREMOTE 66 Object is remote
-ENOLINK 67 Link has been severed
-EADV 68 Advertise error
-ESRMNT 69 Srmount error
-ECOMM 70 Communication error on send
-EPROTO 71 Protocol error
-EMULTIHOP 72 Multihop attempted
-EDOTDOT 73 RFS specific error
-EBADMSG 74 Not a data message
-EOVERFLOW 75 Value too large for defined data type
-ENOTUNIQ 76 Name not unique on network
-EBADFD 77 File descriptor in bad state
-EREMCHG 78 Remote address changed
-ELIBACC 79 Can not access a needed shared library
-ELIBBAD 80 Accessing a corrupted shared library
-ELIBSCN 81 .lib section in a.out corrupted
-ELIBMAX 82 Attempting to link in too many shared libraries
-ELIBEXEC 83 Cannot exec a shared library directly
-EILSEQ 84 Illegal byte sequence
-ERESTART 85 Interrupted system call should be restarted
-ESTRPIPE 86 Streams pipe error
-EUSERS 87 Too many users
-ENOTSOCK 88 Socket operation on non-socket
-EDESTADDRREQ 89 Destination address required
-EMSGSIZE 90 Message too long
-EPROTOTYPE 91 Protocol wrong type for socket
-ENOPROTOOPT 92 Protocol not available
-EPROTONOSUPPORT 93 Protocol not supported
-ESOCKTNOSUPPORT 94 Socket type not supported
-EOPNOTSUPP 95 Operation not supported on transport endpoint
-EPFNOSUPPORT 96 Protocol family not supported
-EAFNOSUPPORT 97 Address family not supported by protocol
-EADDRINUSE 98 Address already in use
-EADDRNOTAVAIL 99 Cannot assign requested address
-ENETDOWN 100 Network is down
-ENETUNREACH 101 Network is unreachable
-ENETRESET 102 Network dropped connection because of reset
-ECONNABORTED 103 Software caused connection abort
-ECONNRESET 104 Connection reset by peer
-ENOBUFS 105 No buffer space available
-EISCONN 106 Transport endpoint is already connected
-ENOTCONN 107 Transport endpoint is not connected
-ESHUTDOWN 108 Cannot send after transport endpoint shutdown
-ETOOMANYREFS 109 Too many references: cannot splice
-ETIMEDOUT 110 Connection timed out
-ECONNREFUSED 111 Connection refused
-EHOSTDOWN 112 Host is down
-EHOSTUNREACH 113 No route to host
-EALREADY 114 Operation already in progress
-EINPROGRESS 115 Operation now in progress
-ESTALE 116 Stale file handle
-EUCLEAN 117 Structure needs cleaning
-ENOTNAM 118 Not a XENIX named type file
-ENAVAIL 119 No XENIX semaphores available
-EISNAM 120 Is a named type file
-EREMOTEIO 121 Remote I/O error
-EDQUOT 122 Quota exceeded
-ENOMEDIUM 123 No medium found
-EMEDIUMTYPE 124 Wrong medium type
-ECANCELED 125 Operation Canceled
-ENOKEY 126 Required key not available
-EKEYEXPIRED 127 Key has expired
-EKEYREVOKED 128 Key has been revoked
-EKEYREJECTED 129 Key was rejected by service
-EOWNERDEAD 130 Owner died
-ENOTRECOVERABLE 131 State not recoverable
-ERFKILL 132 Operation not possible due to RF-kill
-EHWPOISON 133 Memory page has hardware error
--- a/lib/c/arch/amd64/linux/gensys.sh
+++ /dev/null
@@ -1,21 +1,0 @@
-#!/bin/sh
-
-#
-# This job is very easy because app and kernel ABI are identical
-# until the 4th parameter, so we only have to set the syscall
-# number in rax
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
-$name:
- movq \$$num,%rax
- syscall
- jmp _cerrno
-EOF
-done
--- a/lib/c/arch/amd64/linux/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/amd64/linux/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/amd64/linux/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/amd64/linux/syscall.lst
+++ /dev/null
@@ -1,11 +1,0 @@
-#number name
-0 _read
-1 _write
-2 _open
-3 _close
-8 _lseek
-12 _brk
-13 _sigaction
-39 _getpid
-60 _Exit
-62 _kill
--- a/lib/c/arch/amd64/linux/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/amd64/longjmp.s
+++ /dev/null
@@ -1,20 +1,0 @@
- .file "longjmp"
-
- .text
- .globl longjmp
-longjmp:
- mov %rsi,%rax
- test %rax,%rax
- jnz 1f
- inc %rax
-1:
- mov (%rdi),%rbx
- mov 8(%rdi),%rbp
- mov 16(%rdi),%r12
- mov 24(%rdi),%r13
- mov 32(%rdi),%r14
- mov 40(%rdi),%r15
- mov 48(%rdi),%rdx
- mov %rdx,%rsp
- mov 56(%rdi),%rdx
- jmp *%rdx
--- a/lib/c/arch/amd64/netbsd/.gitignore
+++ /dev/null
@@ -1,11 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_gettimeofday.s
-_kill.s
-_lseek.s
-_open.s
-_read.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/amd64/netbsd/Makefile
+++ /dev/null
@@ -1,38 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _open.o \
- _read.o \
- _write.o \
- _brk.o \
- _getheap.o \
- _setcontext.o \
- _sigaction.o \
- _sigaction2.o \
- _sigaction.o\
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/amd64/netbsd/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- movq $end,%rax
- retq
--- a/lib/c/arch/amd64/netbsd/_setcontext.s
+++ /dev/null
@@ -1,14 +1,0 @@
-
- .text
- .globl _Exit
- .globl _setcontext
-
-_setcontext:
- movq %r15,%rdi
- movq $0x134,%rax
- syscall
-
- # Something was wrong, finish the program. We can't call
- # abort here because it could generate a loop
- movq $-1,%rdi
- jmp _Exit
--- a/lib/c/arch/amd64/netbsd/_sigaction.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
- struct sigaction *new, struct sigaction *old,
- int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
- extern int _setcontext[];
-
- return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/arch/amd64/netbsd/_sigaction2.s
+++ /dev/null
@@ -1,12 +1,0 @@
-
-# This syscall cannot be autogenerated because it receives more than
-# 4 arguments
-
- .text
- .globl _sigaction2
-
-_sigaction2:
- mov $0x154,%eax
- mov %rcx,%r10
- syscall
- retq
--- a/lib/c/arch/amd64/netbsd/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/amd64/netbsd/errno.lst
+++ /dev/null
@@ -1,97 +1,0 @@
-EPERM 1 Operation not permitted
-ENOENT 2 No such file or directory
-ESRCH 3 No such process
-EINTR 4 Interrupted system call
-EIO 5 Input/output error
-ENXIO 6 Device not configured
-E2BIG 7 Argument list too long
-ENOEXEC 8 Exec format error
-EBADF 9 Bad file descriptor
-ECHILD 10 No child processes
-EDEADLK 11 Resource deadlock avoided
-ENOMEM 12 Cannot allocate memory
-EACCES 13 Permission denied
-EFAULT 14 Bad address
-ENOTBLK 15 Block device required
-EBUSY 16 Device busy
-EEXIST 17 File exists
-EXDEV 18 Cross-device link
-ENODEV 19 Operation not supported by device
-ENOTDIR 20 Not a directory
-EISDIR 21 Is a directory
-EINVAL 22 Invalid argument
-ENFILE 23 Too many open files in system
-EMFILE 24 Too many open files
-ENOTTY 25 Inappropriate ioctl for device
-ETXTBSY 26 Text file busy
-EFBIG 27 File too large
-ENOSPC 28 No space left on device
-ESPIPE 29 Illegal seek
-EROFS 30 Read-only file system
-EMLINK 31 Too many links
-EPIPE 32 Broken pipe
-EDOM 33 Numerical argument out of domain
-ERANGE 34 Result too large or too small
-EAGAIN 35 Resource temporarily unavailable
-EINPROGRESS 36 Operation now in progress
-EALREADY 37 Operation already in progress
-ENOTSOCK 38 Socket operation on non-socket
-EDESTADDRREQ 39 Destination address required
-EMSGSIZE 40 Message too long
-EPROTOTYPE 41 Protocol wrong type for socket
-ENOPROTOOPT 42 Protocol option not available
-EPROTONOSUPPORT 43 Protocol not supported
-ESOCKTNOSUPPORT 44 Socket type not supported
-EOPNOTSUPP 45 Operation not supported
-EPFNOSUPPORT 46 Protocol family not supported
-EAFNOSUPPORT 47 Address family not supported by protocol family
-EADDRINUSE 48 Address already in use
-EADDRNOTAVAIL 49 Can't assign requested address
-ENETDOWN 50 Network is down
-ENETUNREACH 51 Network is unreachable
-ENETRESET 52 Network dropped connection on reset
-ECONNABORTED 53 Software caused connection abort
-ECONNRESET 54 Connection reset by peer
-ENOBUFS 55 No buffer space available
-EISCONN 56 Socket is already connected
-ENOTCONN 57 Socket is not connected
-ESHUTDOWN 58 Can't send after socket shutdown
-ETOOMANYREFS 59 Too many references: can't splice
-ETIMEDOUT 60 Operation timed out
-ECONNREFUSED 61 Connection refused
-ELOOP 62 Too many levels of symbolic links
-ENAMETOOLONG 63 File name too long
-EHOSTDOWN 64 Host is down
-EHOSTUNREACH 65 No route to host
-ENOTEMPTY 66 Directory not empty
-EPROCLIM 67 Too many processes
-EUSERS 68 Too many users
-EDQUOT 69 Disc quota exceeded
-ESTALE 70 Stale NFS file handle
-EREMOTE 71 Too many levels of remote in path
-EBADRPC 72 RPC struct is bad
-ERPCMISMATCH 73 RPC version wrong
-EPROGUNAVAIL 74 RPC prog. not avail
-EPROGMISMATCH 75 Program version wrong
-EPROCUNAVAIL 76 Bad procedure for program
-ENOLCK 77 No locks available
-ENOSYS 78 Function not implemented
-EFTYPE 79 Inappropriate file type or format
-EAUTH 80 Authentication error
-ENEEDAUTH 81 Need authenticator
-EIDRM 82 Identifier removed
-ENOMSG 83 No message of desired type
-EOVERFLOW 84 Value too large to be stored in data type
-EILSEQ 85 Illegal byte sequence
-ENOTSUP 86 Not supported
-ECANCELED 87 Operation canceled
-EBADMSG 88 Bad or Corrupt message
-ENODATA 89 No message available
-ENOSR 90 No STREAM resources
-ENOSTR 91 Not a STREAM
-ETIME 92 STREAM ioctl timeout
-ENOATTR 93 Attribute not found
-EMULTIHOP 94 Multihop attempted
-ENOLINK 95 Link has been severed
-EPROTO 96 Protocol error
-ELAST 96 Must equal largest errno
--- a/lib/c/arch/amd64/netbsd/gensys.sh
+++ /dev/null
@@ -1,26 +1,0 @@
-#!/bin/sh
-
-#
-# This job is very easy because app and kernel ABI are identical
-# until the 4th parameter, so we only have to set the syscall
-# number in rax
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
-$name:
- movq \$$num,%rax
- syscall
- jb 1f
- retq
-
-1: movl %eax,(errno)
- movl \$-1,%eax
- retq
-EOF
-done
--- a/lib/c/arch/amd64/netbsd/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/amd64/netbsd/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/amd64/netbsd/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/amd64/netbsd/syscall.lst
+++ /dev/null
@@ -1,11 +1,0 @@
-#number name
-1 _Exit
-3 _read
-4 _write
-5 _open
-6 _close
-17 _brk
-20 _getpid
-37 _kill
-199 _lseek
-418 _gettimeofday
--- a/lib/c/arch/amd64/netbsd/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/amd64/openbsd/.gitignore
+++ /dev/null
@@ -1,11 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_kill.s
-_lseek.s
-_open.s
-_read.s
-_sigaction.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/amd64/openbsd/Makefile
+++ /dev/null
@@ -1,35 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _open.o \
- _read.o \
- _write.o \
- _brk.o \
- _getheap.o \
- _sigaction.o\
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/amd64/openbsd/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- movq $end,%rax
- retq
--- a/lib/c/arch/amd64/openbsd/_sigaction.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
- struct sigaction *new, struct sigaction *old,
- int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
- extern int _setcontext[];
-
- return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/arch/amd64/openbsd/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/amd64/openbsd/errno.lst
+++ /dev/null
@@ -1,96 +1,0 @@
-EPERM 1 Operation not permitted
-ENOENT 2 No such file or directory
-ESRCH 3 No such process
-EINTR 4 Interrupted system call
-EIO 5 Input/output error
-ENXIO 6 Device not configured
-E2BIG 7 Argument list too long
-ENOEXEC 8 Exec format error
-EBADF 9 Bad file descriptor
-ECHILD 10 No child processes
-EDEADLK 11 Resource deadlock avoided
-ENOMEM 12 Cannot allocate memory
-EACCES 13 Permission denied
-EFAULT 14 Bad address
-ENOTBLK 15 Block device required
-EBUSY 16 Device busy
-EEXIST 17 File exists
-EXDEV 18 Cross-device link
-ENODEV 19 Operation not supported by device
-ENOTDIR 20 Not a directory
-EISDIR 21 Is a directory
-EINVAL 22 Invalid argument
-ENFILE 23 Too many open files in system
-EMFILE 24 Too many open files
-ENOTTY 25 Inappropriate ioctl for device
-ETXTBSY 26 Text file busy
-EFBIG 27 File too large
-ENOSPC 28 No space left on device
-ESPIPE 29 Illegal seek
-EROFS 30 Read-only file system
-EMLINK 31 Too many links
-EPIPE 32 Broken pipe
-EDOM 33 Numerical argument out of domain
-ERANGE 34 Result too large
-EAGAIN 35 Resource temporarily unavailable
-EINPROGRESS 36 Operation now in progress
-EALREADY 37 Operation already in progress
-ENOTSOCK 38 Socket operation on non-socket
-EDESTADDRREQ 39 Destination address required
-EMSGSIZE 40 Message too long
-EPROTOTYPE 41 Protocol wrong type for socket
-ENOPROTOOPT 42 Protocol not available
-EPROTONOSUPPORT 43 Protocol not supported
-ESOCKTNOSUPPORT 44 Socket type not supported
-EOPNOTSUPP 45 Operation not supported
-EPFNOSUPPORT 46 Protocol family not supported
-EAFNOSUPPORT 47 Address family not supported by protocol family
-EADDRINUSE 48 Address already in use
-EADDRNOTAVAIL 49 Can't assign requested address
-ENETDOWN 50 Network is down
-ENETUNREACH 51 Network is unreachable
-ENETRESET 52 Network dropped connection on reset
-ECONNABORTED 53 Software caused connection abort
-ECONNRESET 54 Connection reset by peer
-ENOBUFS 55 No buffer space available
-EISCONN 56 Socket is already connected
-ENOTCONN 57 Socket is not connected
-ESHUTDOWN 58 Can't send after socket shutdown
-ETOOMANYREFS 59 Too many references: can't splice
-ETIMEDOUT 60 Operation timed out
-ECONNREFUSED 61 Connection refused
-ELOOP 62 Too many levels of symbolic links
-ENAMETOOLONG 63 File name too long
-EHOSTDOWN 64 Host is down
-EHOSTUNREACH 65 No route to host
-ENOTEMPTY 66 Directory not empty
-EPROCLIM 67 Too many processes
-EUSERS 68 Too many users
-EDQUOT 69 Disk quota exceeded
-ESTALE 70 Stale NFS file handle
-EREMOTE 71 Too many levels of remote in path
-EBADRPC 72 RPC struct is bad
-ERPCMISMATCH 73 RPC version wrong
-EPROGUNAVAIL 74 RPC program not available
-EPROGMISMATCH 75 Program version wrong
-EPROCUNAVAIL 76 Bad procedure for program
-ENOLCK 77 No locks available
-ENOSYS 78 Function not implemented
-EFTYPE 79 Inappropriate file type or format
-EAUTH 80 Authentication error
-ENEEDAUTH 81 Need authenticator
-EIPSEC 82 IPsec processing failure
-ENOATTR 83 Attribute not found
-EILSEQ 84 Illegal byte sequence
-ENOMEDIUM 85 No medium found
-EMEDIUMTYPE 86 Wrong medium type
-EOVERFLOW 87 Value too large to be stored in data type
-ECANCELED 88 Operation canceled
-EIDRM 89 Identifier removed
-ENOMSG 90 No message of desired type
-ENOTSUP 91 Not supported
-EBADMSG 92 Bad message
-ENOTRECOVERABLE 93 State not recoverable
-EOWNERDEAD 94 Previous owner died
-EPROTO 95 Protocol error
-ELAST 95 Must be equal largest errno
--- a/lib/c/arch/amd64/openbsd/gensys.sh
+++ /dev/null
@@ -1,26 +1,0 @@
-#!/bin/sh
-
-#
-# This job is very easy because app and kernel ABI are identical
-# until the 4th parameter, so we only have to set the syscall
-# number in rax
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
-$name:
- movq \$$num,%rax
- syscall
- jb 1f
- retq
-
-1: movl %eax,(errno)
- movl \$-1,%eax
- retq
-EOF
-done
--- a/lib/c/arch/amd64/openbsd/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/amd64/openbsd/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/amd64/openbsd/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/amd64/openbsd/syscall.lst
+++ /dev/null
@@ -1,11 +1,0 @@
-#number name
-1 _Exit
-3 _read
-4 _write
-5 _open
-6 _close
-17 _brk
-20 _getpid
-46 _sigaction
-122 _kill
-198 _lseek
--- a/lib/c/arch/amd64/openbsd/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/amd64/setjmp.s
+++ /dev/null
@@ -1,17 +1,0 @@
- .file "setjmp.s"
-
- .text
- .globl setjmp
-setjmp:
- mov %rbx,(%rdi)
- mov %rbp,8(%rdi)
- mov %r12,16(%rdi)
- mov %r13,24(%rdi)
- mov %r14,32(%rdi)
- mov %r15,40(%rdi)
- lea 8(%rsp),%rdx
- mov %rdx,48(%rdi)
- mov (%rsp),%rdx
- mov %rdx,56(%rdi)
- xor %rax,%rax
- ret
--- a/lib/c/arch/arm32/Makefile
+++ /dev/null
@@ -1,14 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-OBJS = longjmp.o setjmp.o
-DIRS = linux
-
-all: $(OBJS) $(SYS)
-
-$(SYS): FORCE
- +@cd $@ && $(MAKE)
-
-clean:
- $(FORALL)
--- a/lib/c/arch/arm32/linux/.gitignore
+++ /dev/null
@@ -1,10 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_kill.s
-_lseek.s
-_openat.s
-_read.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/arm32/linux/Makefile
+++ /dev/null
@@ -1,37 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _brk.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _openat.o \
- _read.o \
- _write.o \
- _getheap.o \
- _cerrno.o \
- _open.o \
- _sigaction.o \
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/arm32/linux/_cerrno.s
+++ /dev/null
@@ -1,14 +1,0 @@
- .file "_cerrno.s"
- .globl _cerrno
-
-_cerrno:
- cmp r0,#0
- blt 1f
- bx lr
-
-1:
- neg r0,r0
- ldr r1,=errno
- str r0,[r1]
- mov r0,#-1
- bx lr
--- a/lib/c/arch/arm32/linux/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- mov r0,#0
- b _brk
--- a/lib/c/arch/arm32/linux/_open.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <stddef.h>
-
-#include "../../../syscall.h"
-
-#define AT_FDCWD -100
-
-extern int _openat(int fd, const char *fname, int flags);
-
-int
-_open(const char *fname, int flags)
-{
- return _openat(AT_FDCWD, fname, flags);
-}
--- a/lib/c/arch/arm32/linux/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/arm32/linux/gensys.sh
+++ /dev/null
@@ -1,19 +1,0 @@
-#!/bin/sh
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
- .arm
-$name:
- push {r7,lr}
- ldr r7,=$num
- swi 0
- pop {r7,lr}
- b _cerrno
-EOF
-done
--- a/lib/c/arch/arm32/linux/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/arm32/linux/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/arm32/linux/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/arm32/linux/syscall.lst
+++ /dev/null
@@ -1,11 +1,0 @@
-#number name
-322 _openat
-6 _close
-3 _read
-4 _write
-1 _Exit
-20 _getpid
-37 _kill
-19 _lseek
-45 _brk
-134 _sigaction
--- a/lib/c/arch/arm32/linux/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/arm32/longjmp.s
+++ /dev/null
@@ -1,11 +1,0 @@
- .file "longjmp.s"
-
- .text
- .globl longjmp
-longjmp:
- ldmia r0, {r4-r11, sp, lr}
-
- // If r1 is 0 return 1 instead
- movs r0, r1
- moveq r0, #1
- bx lr
--- a/lib/c/arch/arm32/setjmp.s
+++ /dev/null
@@ -1,9 +1,0 @@
- .file "setjmp.s"
-
- .text
- .globl setjmp
-setjmp:
- // IHI0042F_aapcs.pdf 5.1.1 callee saved registers
- stmia r0, {r4-r11, sp, lr}
- mov r0, #0
- bx lr
--- a/lib/c/arch/arm64/Makefile
+++ /dev/null
@@ -1,14 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-OBJS = longjmp.o setjmp.o
-DIRS = linux
-
-all: $(OBJS) $(SYS)
-
-$(SYS): FORCE
- +@cd $@ && $(MAKE)
-
-clean:
- $(FORALL)
--- a/lib/c/arch/arm64/linux/.gitignore
+++ /dev/null
@@ -1,10 +1,0 @@
-_Exit.s
-_brk.s
-_close.s
-_getpid.s
-_kill.s
-_lseek.s
-_openat.s
-_read.s
-_sys_errlist.c
-_write.s
--- a/lib/c/arch/arm64/linux/Makefile
+++ /dev/null
@@ -1,37 +1,0 @@
-.POSIX:
-PROJECTDIR =../../../../..
-include $(PROJECTDIR)/scripts/rules.mk
-include ../../rules.mk
-
-OBJS = _Exit.o \
- _close.o \
- _brk.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _openat.o \
- _read.o \
- _write.o \
- _getheap.o \
- _cerrno.o \
- _open.o \
- _sigaction.o \
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
-
-all: syscall
- $(MAKE) objs
-
-objs: $(OBJS)
-
-syscall: syscall.lst
- ./gensys.sh syscall.lst
- touch syscall
-
-clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
- rm -f syscall _sys_errlist.c
--- a/lib/c/arch/arm64/linux/_cerrno.s
+++ /dev/null
@@ -1,13 +1,0 @@
- .file "_cerrno.s"
- .globl _cerrno
-
-_cerrno:
- cmp x0,#0
- b.lt 1f
- ret
-
-1: neg x0,x0
- adr x1,errno
- str w0,[x1]
- mov x0,#-1
- ret
--- a/lib/c/arch/arm64/linux/_getheap.s
+++ /dev/null
@@ -1,6 +1,0 @@
- .file "_getheap.s"
-
- .globl _getheap
-_getheap:
- mov x0,#0
- b _brk
--- a/lib/c/arch/arm64/linux/_open.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <stddef.h>
-
-#include "../../../syscall.h"
-
-#define AT_FDCWD -100
-
-extern int _openat(int fd, const char *fname, int flags);
-
-int
-_open(const char *fname, int flags)
-{
- return _openat(AT_FDCWD, fname, flags);
-}
--- a/lib/c/arch/arm64/linux/_sigaction.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
- struct sigaction *new, struct sigaction *old,
- int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
- extern int _setcontext[];
-
- return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/arch/arm64/linux/_tzone.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/_tzone.c"
--- a/lib/c/arch/arm64/linux/gensys.sh
+++ /dev/null
@@ -1,21 +1,0 @@
-#!/bin/sh
-
-#
-# This job is very easy because app and kernel ABI are identical
-# until the 4th parameter, so we only have to set the syscall
-# number in rax
-
-sed 's/[ ]*#.*//
- /^$/d' syscall.lst |
-while read num name
-do
-cat <<EOF > $name.s
- .file "$name.s"
-
- .globl $name
-$name:
- mov x8,#$num
- svc 0
- b _cerrno
-EOF
-done
--- a/lib/c/arch/arm64/linux/getenv.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/getenv.c"
--- a/lib/c/arch/arm64/linux/raise.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/raise.c"
--- a/lib/c/arch/arm64/linux/signal.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/signal.c"
--- a/lib/c/arch/arm64/linux/syscall.lst
+++ /dev/null
@@ -1,11 +1,0 @@
-#number name
-56 _openat
-57 _close
-63 _read
-64 _write
-93 _Exit
-172 _getpid
-129 _kill
-62 _lseek
-134 _sigaction
-214 _brk
--- a/lib/c/arch/arm64/linux/time.c
+++ /dev/null
@@ -1,1 +1,0 @@
-#include "../../posix/time.c"
--- a/lib/c/arch/arm64/longjmp.s
+++ /dev/null
@@ -1,22 +1,0 @@
- .file "longjmp.s"
-
- .text
- .globl longjmp
-longjmp:
- ldp x19, x20, [x0,#0]
- ldp x21, x22, [x0,#16]
- ldp x23, x24, [x0,#32]
- ldp x25, x26, [x0,#48]
- ldp x27, x28, [x0,#64]
- ldp x29, x30, [x0,#80]
- ldr x2, [x0,#104]
- mov sp, x2
- ldp d8 , d9, [x0,#112]
- ldp d10, d11, [x0,#128]
- ldp d12, d13, [x0,#144]
- ldp d14, d15, [x0,#160]
-
- mov x0, x1
- cbnz x1, 1f
- mov x0, #1
-1: br x30
--- a/lib/c/arch/arm64/setjmp.s
+++ /dev/null
@@ -1,20 +1,0 @@
- .file "setjmp.s"
-
- .text
- .globl setjmp
-setjmp:
- // IHI0055B_aapcs64.pdf 5.1.1, 5.1.2 callee saved registers
- stp x19, x20, [x0,#0]
- stp x21, x22, [x0,#16]
- stp x23, x24, [x0,#32]
- stp x25, x26, [x0,#48]
- stp x27, x28, [x0,#64]
- stp x29, x30, [x0,#80]
- mov x2, sp
- str x2, [x0,#104]
- stp d8, d9, [x0,#112]
- stp d10, d11, [x0,#128]
- stp d12, d13, [x0,#144]
- stp d14, d15, [x0,#160]
- mov x0, #0
- ret
--- a/lib/c/arch/generrno.sh
+++ /dev/null
@@ -1,35 +1,0 @@
-#!/bin/sh
-
-trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP QUIT INT TERM
-
-for i
-do
- case $i in
- -o)
- out=$2
- shift 2
- ;;
- --)
- shift
- break
- ;;
- -*)
- echo usage: generrno.sh [-o output] file ...
- exit 1
- ;;
- *)
- break
- ;;
- esac
-done
-
-awk '
-/^E/ && $2 > 0 {
- errno[$1] = $2
-}
-
-END {
- for (i in errno)
- print "#define", i, errno[i] | "sort -n -k3"
- close("sort -n -k3")
-}' $@ > $$.tmp && mv $$.tmp ${out:-errno.h}
--- a/lib/c/arch/generrstr.sh
+++ /dev/null
@@ -1,23 +1,0 @@
-#!/bin/sh
-
-trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM
-
-awk '
-/^E/ && $2 > 0 {
- str = ""
- for (i = 3; i <= NF; i++)
- str = str " " $i
- sub(/^ /, "", str)
- errstr[$1] = str
- if ($2 > max)
- max = $2;
-}
-
-END {
- print "#include <errno.h>\n"
- print "char *_sys_errlist[] = {"
- for (i in errstr)
- printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]
- print "};"
- print "int _sys_nerr =", $2 + 1 ";"
-}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c
--- a/lib/c/arch/mkerrstr
+++ /dev/null
@@ -1,24 +1,0 @@
-#!/bin/sh
-
-trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM
-
-awk '
-/^#define[ \t]*E/{
- str = ""
- for (i = 5; i < NF; i++)
- str = str " " $i
- sub(/^ /, "", str)
- errstr[$2] = str
- if ($3 > max)
- max = $3;
-}
-
-END {
- print "#include <errno.h>\n"
- print "char *const _sys_errlist[] = {"
- for (i in errstr)
- printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]
-
- print "};"
- print "const int _sys_nerr =", max";"
-}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c
--- a/lib/c/arch/posix/_tzone.c
+++ /dev/null
@@ -1,27 +1,0 @@
-#include <stdlib.h>
-#include <time.h>
-#include "../../libc.h"
-
-struct tzone *
-_tzone(struct tm *tm)
-{
- static struct tzone tz;
- static int first = 1;
-
- if (!first)
- return &tz;
-
- tz.name = getenv("TZ");
- if (!tz.name || *tz.name == '\0') {
- tz.name = NULL;
- tz.gmtoff = 0;
- tz.isdst = 0;
- } else {
- /* TODO: parse TZ string */
- tz.gmtoff = 0;
- tz.isdst = 0;
- }
- first = 0;
-
- return &tz;
-}
--- a/lib/c/arch/posix/getenv.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include <stdlib.h>
-#include <string.h>
-#undef getenv
-
-extern char **_environ;
-
-char *
-getenv(const char *name)
-{
- char **p, *s;
- size_t len = strlen(name);
-
- for (p = _environ; s = *p; ++p) {
- if (!strncmp(name, s, len) && s[len] == '=')
- return s + len + 1;
- }
- return NULL;
-}
--- a/lib/c/arch/posix/geterrno.sh
+++ /dev/null
@@ -1,8 +1,0 @@
-#!/bin/sh
-
-awk '/define[ ]*E/ && $3 ~ /[0-9]+/ && $3 > 0 {
- sub(/\#define[ ]*/, "")
- sub(/\/\*/, "")
- sub(/\*\//, "")
-}' /usr/include/sys/errno.h
--- a/lib/c/arch/posix/raise.c
+++ /dev/null
@@ -1,11 +1,0 @@
-#include <stddef.h>
-#include <signal.h>
-#include <sys.h>
-
-#undef raise
-
-int
-raise(int signum)
-{
- return _kill(_getpid(), signum);
-}
--- a/lib/c/arch/posix/signal.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#include <stddef.h>
-#include <signal.h>
-#include <sys.h>
-#undef signal
-
-void
-(*signal(int signum, void (*func)(int)))(int)
-{
- struct sigaction sa = {
- .sa_handler = func,
- };
-
- if (_sigaction(signum, &sa, &sa) < 0)
- return SIG_ERR;
-
- return sa.sa_handler;
-}
--- a/lib/c/arch/posix/time.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <time.h>
-
-struct timeval {
- time_t tv_sec;
- int tv_usec; /* TODO use a arch type */
-};
-
-int
-_gettimeofday(struct timeval * restrict tp, void * restrict tzp);
-
-time_t
-time(time_t *t)
-{
- struct timeval tv;
-
- if (_gettimeofday(&tv, NULL) == -1)
- return -1;
- if (t)
- *t =tv.tv_sec;
- return tv.tv_sec;
-}
--- a/lib/c/arch/rules.mk
+++ /dev/null
@@ -1,4 +1,0 @@
-SYSERRNO = $(INCDIR)/bits/$(SYS)/sys/errno.h
-
-_sys_errlist.c: $(SYSERRNO)
- ../../mkerrstr $(SYSERRNO)
--- a/lib/c/assert/Makefile
+++ /dev/null
@@ -1,10 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = __assert.o\
- assert.o\
-
-all: $(OBJS)
--- a/lib/c/assert/__assert.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-void __assert(char *exp, char *file, long line)
-{
- fprintf(stderr, "%s:%ld: assertion failed '%s'\n", file, line, exp);
- abort();
-}
--- a/lib/c/assert/assert.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#undef assert
-
-void
-assert(int exp)
-{
- if (exp)
- return;
- fputs("assert failed\n", stderr);
- abort();
-}
--- a/lib/c/ctype/Makefile
+++ /dev/null
@@ -1,24 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = ctype.o\
- isalnum.o\
- isalpha.o\
- isascii.o\
- isblank.o\
- iscntrl.o\
- isdigit.o\
- isgraph.o\
- islower.o\
- isprint.o\
- ispunct.o\
- isspace.o\
- isupper.o\
- isxdigit.o\
- tolower.o\
- toupper.o\
-
-all: $(OBJS)
--- a/lib/c/ctype/ctype.c
+++ /dev/null
@@ -1,22 +1,0 @@
-#include <ctype.h>
-
-/* __ctype is shifted by one to match EOF */
-const unsigned char __ctype[257] = {
- 0, /* EOF */
- _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
- _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
- _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
- _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
- _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
- _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
- _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
- _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
- _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
- _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
- _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
- _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
- _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
- _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
- _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
- _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
-};
--- a/lib/c/ctype/isalnum.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isalnum
-
-int
-isalnum(int c)
-{
- return (__ctype+1)[c] & (_U|_L|_D);
-}
--- a/lib/c/ctype/isalpha.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isalpha
-
-int
-isalpha(int c)
-{
- return (__ctype+1)[c] & (_U|_L);
-}
--- a/lib/c/ctype/isascii.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isascii
-
-int
-isascii(int c)
-{
- return c <= 0x7f;
-}
--- a/lib/c/ctype/isblank.c
+++ /dev/null
@@ -1,7 +1,0 @@
-#include <ctype.h>
-
-int
-isblank(int c)
-{
- return (c == ' ') || (c == '\t');
-}
--- a/lib/c/ctype/iscntrl.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef iscntrl
-
-int
-iscntrl(int c)
-{
- return (__ctype+1)[c] & (_C);
-}
--- a/lib/c/ctype/isdigit.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isdigit
-
-int
-isdigit(int c)
-{
- return (__ctype+1)[c] & (_D);
-}
--- a/lib/c/ctype/isgraph.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isgraph
-
-int
-isgraph(int c)
-{
- return (__ctype+1)[c] & (_P|_U|_L|_D);
-}
--- a/lib/c/ctype/islower.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef islower
-
-int
-islower(int c)
-{
- return (__ctype+1)[c] & _L;
-}
--- a/lib/c/ctype/isprint.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isprint
-
-int
-isprint(int c)
-{
- return (__ctype+1)[c] & (_P|_U|_L|_D|_SP);
-}
--- a/lib/c/ctype/ispunct.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef ispunct
-
-int
-ispunct(int c)
-{
- return (__ctype+1)[c] & (_P);
-}
--- a/lib/c/ctype/isspace.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isspace
-
-int
-isspace(int c)
-{
- return (__ctype+1)[c] & _S;
-}
--- a/lib/c/ctype/isupper.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isupper
-
-int
-isupper(int c)
-{
- return (__ctype+1)[c] & _U;
-}
--- a/lib/c/ctype/isxdigit.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef isxdigit
-
-int
-isxdigit(int c)
-{
- return (__ctype+1)[c] & (_D|_X);
-}
--- a/lib/c/ctype/tolower.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#define __USE_MACROS
-#include <ctype.h>
-#undef tolower
-
-int
-tolower(int c)
-{
- return (isupper(c)) ? c | 0x20 : c;
-}
--- a/lib/c/ctype/toupper.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <ctype.h>
-#undef toupper
-
-int
-toupper(int c)
-{
- return (islower(c)) ? c & ~0x20 : c;
-}
--- a/lib/c/libc.h
+++ /dev/null
@@ -1,42 +1,0 @@
-#define SUN 0
-#define MON 1
-#define TUE 2
-#define WED 3
-#define THU 4
-#define FRI 5
-#define SAT 6
-
-#define JAN 0
-#define FEB 1
-#define DEC 11
-
-#define EPOCH 1970
-#define FEBDAYS(y) ((_daysyear(y) == 366) ? 29 : 28)
-#define SECMIN 60
-#define SECHOUR (60 * SECMIN) /* 3600 */
-#define SECDAY (24 * SECHOUR) /* 86400 */
-
-#ifdef stdin
-extern FILE *_fpopen(const char * restrict fname,
- const char * restrict mode,
- FILE * restrict fp);
-#endif
-
-struct tzone {
- char *name;
- int gmtoff;
- int isdst;
-};
-
-struct tm;
-
-extern struct tzone *_tzone(struct tm *tm);
-extern int _daysyear(int year);
-extern int _newyear(int year);
-extern void *_getheap(void);
-#ifdef FILE
-extern int _flsbuf(FILE *fp);
-extern void _allocbuf(FILE *fp);
-#endif
-
-extern int _daysmon[12];
--- a/lib/c/locale/Makefile
+++ /dev/null
@@ -1,10 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = localeconv.o\
- setlocale.o\
-
-all: $(OBJS)
--- a/lib/c/locale/localeconv.c
+++ /dev/null
@@ -1,29 +1,0 @@
-#include <locale.h>
-#include <limits.h>
-#undef localeconv
-
-struct lconv *
-localeconv(void)
-{
- static struct lconv lc = {
- .decimal_point = ".",
- .thousands_sep = "",
- .grouping = "",
- .mon_decimal_point = "",
- .mon_thousands_sep = "",
- .mon_grouping = "",
- .positive_sign = "",
- .negative_sign = "",
- .currency_symbol = "",
- .int_curr_symbol = "",
- .frac_digits = CHAR_MAX,
- .p_cs_precedes = CHAR_MAX,
- .n_cs_precedes = CHAR_MAX,
- .p_sep_by_space = CHAR_MAX,
- .p_sign_posn = CHAR_MAX,
- .n_sep_by_space = CHAR_MAX,
- .n_sign_posn = CHAR_MAX,
- .int_frac_digits = CHAR_MAX,
- };
- return &lc;
-}
--- a/lib/c/locale/setlocale.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <locale.h>
-#include <stddef.h>
-#undef setlocale
-
-char *
-setlocale(int category, const char *locale)
-{
- if (category > LC_TIME || category < LC_ALL)
- return NULL;
- if (!locale ||
- locale[0] == '\0' ||
- locale[0] == 'C' && locale[1] == '\0') {
- return "C";
- }
- return NULL;
-}
--- a/lib/c/mklst
+++ /dev/null
@@ -1,12 +1,0 @@
-#!/bin/sh
-
-set -e
-trap 'r=$?;rm -f $$.tmp;exit $r' EXIT HUP QUIT INT TERM
-archive=${1?'First parameter must be the archive name'}
-
-if test -f $archive
-then
- newer="-newer $archive"
-fi
-
-find . -name '*.o' $newer > $$.tmp && mv $$.tmp objlst
--- a/lib/c/stdio/Makefile
+++ /dev/null
@@ -1,47 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = __getc.o\
- __putc.o\
- _flsbuf.o\
- _fpopen.o\
- clearerr.o\
- fclose.o\
- feof.o\
- ferror.o\
- fgetc.o\
- fgets.o\
- fopen.o\
- fprintf.o\
- fputc.o\
- fputs.o\
- fread.o\
- freopen.o\
- fseek.o\
- ftell.o\
- fwrite.o\
- getc.o\
- getchar.o\
- gets.o\
- perror.o\
- printf.o\
- putc.o\
- putchar.o\
- puts.o\
- rewind.o\
- setbuf.o\
- setvbuf.o\
- snprintf.o\
- sprintf.o\
- __iob.o\
- tmpnam.o\
- vfprintf.o\
- vsnprintf.o\
- vsprintf.o\
- vprintf.o\
- _allocbuf.o\
-
-all: $(OBJS)
--- a/lib/c/stdio/__getc.c
+++ /dev/null
@@ -1,39 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../libc.h"
-#include "../syscall.h"
-
-int
-__getc(FILE *fp)
-{
- int cnt;
-
- if (fp->flags & (_IOEOF | _IOERR))
- return EOF;
-
- if ((fp->flags & (_IOREAD | _IORW)) == 0) {
- fp->flags |= _IOERR;
- errno = EBADF;
- return EOF;
- }
-
- if (fp->flags & _IOSTRG) {
- fp->flags |= _IOEOF;
- return EOF;
- }
-
- if (fp->buf == NULL && _allocbuf(fp))
- return EOF;
-
- if ((cnt = _read(fp->fd, fp->buf, fp->len)) <= 0) {
- fp->flags |= (cnt == 0) ? _IOEOF : _IOERR;
- return EOF;
- }
-
- fp->flags |= _IOREAD;
- fp->rp = fp->buf;
- fp->wp = fp->buf + cnt;
-
- return *fp->rp++;
-}
--- a/lib/c/stdio/__iob.c
+++ /dev/null
@@ -1,20 +1,0 @@
-#include <stdio.h>
-
-FILE __iob[FOPEN_MAX] = {
- {
- .fd = 0,
- .flags = _IOREAD,
- },
- {
- .fd = 1,
- .flags = _IOWRITE | _IOLBF,
- },
- {
- .fd = 2,
- .buf = stderr->unbuf,
- .len = sizeof(stderr->unbuf),
- .flags = _IOWRITE | _IONBF,
- .rp = stderr->unbuf,
- .wp = stderr->unbuf,
- },
-};
--- a/lib/c/stdio/__putc.c
+++ /dev/null
@@ -1,78 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../libc.h"
-
-int
-fflush(FILE *fp)
-{
- int err;
-
- if (fp)
- return _flsbuf(fp);
-
- err = 0;
- for (fp = __iob; fp < &__iob[FOPEN_MAX]; ++fp) {
- if ((fp->flags & _IOWRITE) == 0 && _flsbuf(fp))
- err = EOF;
- }
- return err;
-}
-
-static void
-cleanup(void)
-{
- fflush(NULL);
-}
-
-int
-__putc(int ch, FILE *fp)
-{
- static int first = 1;
-
- if (fp->flags & _IOERR)
- return EOF;
-
- if (fp->flags & _IOREAD) {
- fp->flags |= _IOERR;
- errno = EBADF;
- return EOF;
- }
-
- if (fp->flags & _IOSTRG) {
- fp->flags |= _IOERR;
- return EOF;
- }
-
- if (fp->buf == NULL && _allocbuf(fp))
- return EOF;
-
- if (first) {
- if (atexit(cleanup)) {
- fp->flags |= _IOERR;
- errno = ENOMEM;
- return EOF;
- }
- first = 0;
- }
-
- if (fp->flags & _IOLBF) {
- if (fp->wp == fp->lp && _flsbuf(fp))
- return EOF;
- *fp->wp++ = ch;
- if (ch == '\n' && _flsbuf(fp))
- return EOF;
- } else if (fp->flags & _IOFBF) {
- if (_flsbuf(fp))
- return EOF;
- *fp->wp++ = ch;
- fp->rp = fp->buf + fp->len;
- } else {
- *fp->wp++ = ch;
- if (_flsbuf(fp))
- return EOF;
- }
-
- fp->flags |= _IOWRITE;
- return ch & 0xFF;
-}
--- a/lib/c/stdio/_allocbuf.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "../libc.h"
-
-int
-_allocbuf(FILE *fp)
-{
- char *bp;
-
- if ((bp = malloc(BUFSIZ)) == NULL) {
- fp->flags |= _IOERR;
- errno = ENOMEM;
- return EOF;
- }
- fp->len = BUFSIZ;
- fp->rp = fp->wp = fp->buf = bp;
- fp->lp = bp + BUFSIZ;
-
- return 0;
-}
--- a/lib/c/stdio/_flsbuf.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-
-#include "../libc.h"
-#include "../syscall.h"
-
-int
-_flsbuf(FILE *fp)
-{
- size_t cnt;
-
- if (fp->flags&_IOREAD)
- return 0;
-
- cnt = fp->wp - fp->buf;
- if (cnt > 0 && _write(fp->fd, fp->buf, cnt) != cnt) {
- fp->flags |= _IOERR;
- return EOF;
- }
- fp->wp = fp->buf;
-
- return 0;
-}
--- a/lib/c/stdio/_fpopen.c
+++ /dev/null
@@ -1,75 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys.h>
-#include "../syscall.h"
-#include "../libc.h"
-#undef fopen
-
-FILE *
-_fpopen(const char * restrict fname,
- const char * restrict mode,
- FILE * restrict fp)
-{
- int i, flags, fd, rw, bin;
-
- flags = rw = bin = 0;
-
- if (mode[0] == '\0')
- goto einval;
-
- for (i = 1; mode[i]; ++i) {
- switch (mode[i]) {
- case '+':
- if (rw)
- goto einval;
- rw = 1;
- break;
- case 'b':
- if (bin)
- goto einval;
- bin = 1;
- break;
- default:
- goto einval;
- }
- }
-
- switch (mode[0]) {
- case 'a':
- flags |= O_APPEND | O_CREAT;
- goto wrflags;
- case 'w':
- flags |= O_TRUNC | O_CREAT;
- wrflags:
- flags |= (rw) ? O_RDWR : O_WRONLY;
- break;
- case 'r':
- flags = (rw) ? O_RDWR : O_RDONLY;
- break;
- default:
- einval:
- errno = EINVAL;
- return NULL;
- }
-
- if ((fd = _open(fname, flags)) < 0)
- return NULL;
-
- fp->buf = NULL;
- fp->fd = fd;
-
- if (!bin)
- fp->flags |= _IOTXT;
-
- if (flags & O_RDWR)
- fp->flags |= _IORW;
- else if (flags & O_RDONLY)
- fp->flags |= _IOREAD;
- else
- fp->flags |= _IOWRITE;
-
- fp->lp = fp->rp = fp->wp = NULL;
-
- return fp;
-}
--- a/lib/c/stdio/clearerr.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef clearerr
-
-void
-clearerr(FILE *fp)
-{
- fp->flags &= ~(_IOERR | _IOEOF);
-}
--- a/lib/c/stdio/fclose.c
+++ /dev/null
@@ -1,32 +1,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "../syscall.h"
-#undef fclose
-
-int
-fclose(FILE *fp)
-{
- int r = EOF;
-
- if ((fp->flags & _IOSTRG) == 0 &&
- fp->flags & (_IOWRITE | _IOREAD | _IORW)) {
- r = 0;
- if (_flsbuf(fp) == EOF)
- r = EOF;
- if (_close(fp->fd) < 0)
- r = EOF;
- }
-
- if (fp->flags & _IOALLOC) {
- free(fp->buf);
- fp->buf = NULL;
- }
-
- fp->flags &= ~(_IOWRITE | _IOREAD | _IORW |
- _IOERR | _IOEOF |
- _IOALLOC |
- _IOTXT |
- _IOSTRG);
-
- return r;
-}
--- a/lib/c/stdio/feof.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef feof
-
-int
-feof(FILE *fp)
-{
- return fp->flags & _IOEOF;
-}
--- a/lib/c/stdio/ferror.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef ferror
-
-int
-ferror(FILE *fp)
-{
- return fp->flags & _IOERR;
-}
--- a/lib/c/stdio/fgetc.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef fgetc
-
-int
-fgetc(FILE *fp)
-{
- return getc(fp);
-}
--- a/lib/c/stdio/fgets.c
+++ /dev/null
@@ -1,19 +1,0 @@
-#include <stdio.h>
-#undef fgets
-
-char *
-fgets(char *s, int n, FILE *fp)
-{
- int ch = 0;
- char *t = s;
-
- while (--n > 0 && (ch = getc(fp)) != EOF) {
- if ((*t++ = ch) == '\n')
- break;
- }
- if (ch == EOF && s == t)
- return NULL;
- *t = '\0';
-
- return s;
-}
--- a/lib/c/stdio/fopen.c
+++ /dev/null
@@ -1,23 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-
-#include "../syscall.h"
-#include "../libc.h"
-#undef fopen
-
-
-FILE *
-fopen(const char * restrict name, const char * restrict mode)
-{
- FILE *fp;
-
- for (fp = __iob; fp < &__iob[FOPEN_MAX]; ++fp) {
- if ((fp->flags & (_IOREAD | _IOWRITE | _IORW)) == 0)
- break;
- }
- if (fp == &__iob[FOPEN_MAX]) {
- errno = ENOMEM;
- return NULL;
- }
- return _fpopen(name, mode, fp);
-}
--- a/lib/c/stdio/fprintf.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef fprintf
-
-int
-fprintf(FILE * restrict fp, const char * restrict fmt, ...)
-{
- va_list va;
- int cnt;
-
- va_start(va, fmt);
- cnt = vfprintf(fp, fmt, va);
- va_end(va);
- return cnt;
-}
--- a/lib/c/stdio/fputc.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef fputc
-
-int
-fputc(int c, FILE *fp)
-{
- return putc(c, fp);
-}
--- a/lib/c/stdio/fputs.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <stdio.h>
-#undef fputs
-
-int
-fputs(const char * restrict bp, FILE * restrict fp)
-{
- int r, ch;
-
- while (ch = *bp++)
- r = putc(ch, fp);
- return r;
-}
--- a/lib/c/stdio/fread.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include <stdio.h>
-#undef fread
-
-size_t
-fread(void * restrict ptr, size_t size, size_t nmemb,
- FILE * restrict fp)
-{
- unsigned char *bp = ptr;
- size_t n, i;
- int c;
-
- if (size == 0)
- return 0;
-
- for (n = 0; n < nmemb; n++) {
- i = size;
- do {
- if ((c = getc(fp)) == EOF)
- return n;
- *bp++ = c;
- } while (--i);
- }
-
- return n;
-}
--- a/lib/c/stdio/freopen.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <stdio.h>
-
-#include "../syscall.h"
-#include "../libc.h"
-#undef freopen
-
-FILE *
-freopen(const char * restrict name, const char * restrict mode,
- FILE * restrict fp)
-{
- if (fclose(fp) == EOF)
- return NULL;
- return _fpopen(name, mode, fp);
-}
--- a/lib/c/stdio/fseek.c
+++ /dev/null
@@ -1,26 +1,0 @@
-#include <stdio.h>
-#include "../syscall.h"
-#undef fseek
-
-int
-fseek(FILE *fp, long off, int whence)
-{
- if (fp->flags & _IOERR)
- return EOF;
-
- if ((fp->flags & _IOWRITE) && _flsbuf(fp))
- return -1;
- else if (whence == SEEK_CUR && (fp->flags & _IOREAD))
- off -= fp->wp - fp->rp;
-
- if (_lseek(fp->fd, off, whence) < 0) {
- fp->flags |= _IOERR;
- return EOF;
- }
-
- if (fp->flags & _IORW)
- fp->flags &= ~(_IOREAD | _IOWRITE);
- fp->flags &= ~_IOEOF;
-
- return 0;
-}
--- a/lib/c/stdio/ftell.c
+++ /dev/null
@@ -1,27 +1,0 @@
-#include <stdio.h>
-#include "../syscall.h"
-#undef ftell
-
-long
-ftell(FILE *fp)
-{
- long off;
- unsigned char *p;
-
- if (fp->flags & _IOERR)
- return EOF;
-
- if ((off = _lseek(fp->fd, 0, SEEK_CUR)) < 0) {
- fp->flags |= _IOERR;
- return EOF;
- }
-
- if (fp->flags & _IOREAD)
- return off - (fp->wp - fp->rp);
-
- if (fp->flags & _IOWRITE) {
- p = (fp->flags & _IOLBF) ? fp->lp : fp->wp;
- return off + (p - fp->buf);
- }
- return off;
-}
--- a/lib/c/stdio/fwrite.c
+++ /dev/null
@@ -1,24 +1,0 @@
-#include <stdio.h>
-#undef fwrite
-
-size_t
-fwrite(const void * restrict ptr, size_t size, size_t nmemb,
- FILE * restrict fp)
-{
- const unsigned char *bp = ptr;
- size_t n, i;
-
- if (size == 0)
- return 0;
-
- for (n = 0; n < nmemb; n++) {
- i = size;
- do
- putc(*bp++, fp);
- while (--i);
- if (ferror(fp))
- break;
- }
-
- return n;
-}
--- a/lib/c/stdio/getc.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef getc
-
-int
-getc(FILE *fp)
-{
- return (fp->rp >= fp->wp) ? __getc(fp) : *fp->rp++;
-}
--- a/lib/c/stdio/getchar.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef getchar
-
-int
-getchar(void)
-{
- return getc(stdin);
-}
--- a/lib/c/stdio/gets.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#include <stdio.h>
-#undef gets
-
-char *
-gets(char *s)
-{
- int ch;
- char *t = s;
-
- while ((ch = getc(stdin)) != EOF && ch != '\n')
- *t++ = ch;
- if (ch == EOF && s == t)
- return NULL;
- *t = '\0';
-
- return s;
-}
--- a/lib/c/stdio/perror.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#undef perror
-
-void
-perror(const char *msg)
-{
- if (msg && *msg) {
- fputs(msg, stderr);
- putc(':', stderr);
- putc(' ', stderr);
- }
- fputs(strerror(errno), stderr);
- putc('\n', stderr);
-}
--- a/lib/c/stdio/printf.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef printf
-
-int
-printf(const char * restrict fmt, ...)
-{
- int cnt;
- va_list va;
-
- va_start(va, fmt);
- cnt = vfprintf(stdout, fmt, va);
- va_end(va);
- return cnt;
-}
--- a/lib/c/stdio/putc.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef putc
-
-int
-putc(int ch, FILE *fp)
-{
- return (fp->wp >= fp->rp) ? __putc(ch,fp) : (*fp->wp++ = ch);
-}
--- a/lib/c/stdio/putchar.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef putchar
-
-int
-putchar(int ch)
-{
- return putc(ch, stdout);
-}
--- a/lib/c/stdio/puts.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <stdio.h>
-#undef puts
-
-int
-puts(const char *str)
-{
- int ch;
-
- while (ch = *str++)
- putchar(ch);
- return putchar('\n');
-}
--- a/lib/c/stdio/rewind.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <stdio.h>
-#undef rewind
-
-void
-rewind(FILE *fp)
-{
- fp->flags &= ~_IOERR;
- fseek(fp, 0, SEEK_SET);
- clearerr(fp);
-}
--- a/lib/c/stdio/setbuf.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdio.h>
-#undef setbuf
-
-void
-setbuf(FILE * restrict fp, char * restrict buf)
-{
- setvbuf(fp, buf, (buf) ? _IOFBF : _IONBF, BUFSIZ);
-}
--- a/lib/c/stdio/setvbuf.c
+++ /dev/null
@@ -1,48 +1,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#undef setvbuf
-
-int
-setvbuf(FILE * restrict fp, char * restrict buf, int mode, size_t size)
-{
- int flags;
- char *p;
- size_t l;
-
- if (_flsbuf(fp) == EOF)
- return EOF;
-
- if (buf)
- p = buf, l = size;
- else
- p = fp->buf, l = fp->len;
-
- switch (mode) {
- case _IONBF:
- l = sizeof(fp->unbuf);
- p = fp->unbuf;
- case _IOLBF:
- case _IOFBF:
- fp->rp = fp->wp = p;
- fp->lp = p + l;
- break;
- default:
- errno = EINVAL;
- return EOF;
- }
-
- flags = fp->flags;
- if (flags&_IOALLOC && (buf || mode == _IONBF)) {
- free(fp->buf);
- flags &= ~_IOALLOC;
- }
-
- fp->buf = p;
- fp->len = l;
- flags &= ~(_IONBF | _IOLBF | _IOFBF);
- flags |= mode;
- fp->flags = flags;
-
- return 0;
-}
--- a/lib/c/stdio/snprintf.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef snprintf
-
-int
-snprintf(char * restrict s, size_t siz, const char * restrict fmt, ...)
-{
- int r;
- va_list va;
-
- va_start(va, fmt);
- r = vsnprintf(s, siz, fmt, va);
- va_end(va);
-
- return r;
-}
--- a/lib/c/stdio/sprintf.c
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef sprintf
-
-int
-sprintf(char * restrict s, const char * restrict fmt, ...)
-{
- int r;
-
- va_list va;
- va_start(va, fmt);
- r = vsprintf(s, fmt, va);
- va_end(va);
-
- return r;
-}
--- a/lib/c/stdio/tmpnam.c
+++ /dev/null
@@ -1,31 +1,0 @@
-#include <stdio.h>
-#include <string.h>
-#include "../syscall.h"
-#undef tmpnam
-
-char *
-tmpnam(char *s)
-{
- static char *tmpl, buf[L_tmpnam];
- char *p;
-
- if (*buf == '\0') {
- for (tmpl = buf, p = _TMPNAME; *tmpl++ = *p++; )
- ;
- for (p = tmpl; p < &buf[L_tmpnam-1]; ++p)
- *p = '0';
- *p = '\0';
- }
- for (;;) {
- for (p = tmpl; *p && *p != '9'; ++p)
- ;
- if (*p == '\0')
- return NULL;
- ++*p;
- if (_access(buf, 0) != 0)
- break;
- }
- if (s)
- strcpy(s, buf);
- return buf;
-}
--- a/lib/c/stdio/vfprintf.c
+++ /dev/null
@@ -1,362 +1,0 @@
-#include <ctype.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <wchar.h>
-#undef vfprintf
-
-enum {
- LONG = 1 << 0,
- LLONG = 1 << 1,
- SHORT = 1 << 2,
- CHAR = 1 << 3,
- SIZET = 1 << 4,
- PTRDIFF = 1 << 5,
- INTMAX = 1 << 6,
- VOIDPTR = 1 << 7,
- UNSIGNED = 1 << 8,
- ALTFORM = 1 << 9,
-};
-
-#define MAXPREC 50
-
-struct conv {
- int sign;
- int prec;
- char *digs;
- int base;
-};
-
-static uintmax_t
-getnum(va_list *va, int flags, int *sign)
-{
- uintmax_t uval;
- intmax_t val;
-
- if (flags & CHAR) {
- val = va_arg(*va, int);
- uval = (unsigned char) val;
- } else if (flags & SHORT) {
- val = va_arg(*va, int);
- uval = (unsigned short) val;
- } else if (flags & LONG) {
- val = va_arg(*va, long);
- uval = (unsigned long) val;
- } else if (flags & LLONG) {
- val = va_arg(*va, long long);
- uval = (unsigned long long) val;
- } else if (flags & SIZET) {
- uval = va_arg(*va, size_t);
- } else if (flags & INTMAX) {
- val = va_arg(*va, intmax_t);
- uval = (uintmax_t) val;
- } else if (flags & VOIDPTR) {
- uval = (uintmax_t) va_arg(*va, void *);
- } else {
- val = va_arg(*va, int);
- uval = (unsigned) val;
- }
-
- if ((flags & UNSIGNED) == 0 && val < 0) {
- *sign = '-';
- uval = -uval;
- }
- return uval;
-}
-
-static char *
-numtostr(uintmax_t val, int flags, struct conv *conv, char *buf)
-{
- char *buf0 = buf;
- int base = conv->base, prec = conv->prec;
- uintmax_t oval = val;
-
- if (prec == -1)
- prec = 1;
-
- for (*buf = '\0'; val > 0; val /= base)
- *--buf = conv->digs[val % base];
- while (buf0 - buf < prec)
- *--buf = '0';
-
- if (flags & ALTFORM) {
- if (base == 8 && *buf != '0') {
- *--buf = '0';
- } else if (base == 16 && oval != 0) {
- *--buf = conv->digs[16];
- *--buf = '0';
- }
- }
- if (conv->sign)
- *--buf = conv->sign;
-
- return buf;
-}
-
-static void
-savecnt(va_list *va, int flags, int cnt)
-{
- if (flags & CHAR)
- *va_arg(*va, char*) = cnt;
- else if (flags & SHORT)
- *va_arg(*va, short*) = cnt;
- else if (flags & LONG)
- *va_arg(*va, long*) = cnt;
- else if (flags & LLONG)
- *va_arg(*va, long long*) = cnt;
- else if (flags & SIZET)
- *va_arg(*va, size_t*) = cnt;
- else if (flags & INTMAX)
- *va_arg(*va, intmax_t*) = cnt;
- else
- *va_arg(*va, int*) = cnt;
-}
-
-static size_t
-wstrout(wchar_t *ws, size_t len, int width, int fill, FILE * restrict fp)
-{
- int left = 0, adjust;
- size_t cnt = 0;
- wchar_t wc;
-#if 0
-
- if (width < 0) {
- left = 1;
- width = -width;
- }
-
- len *= sizeof(wchar_t);
- adjust = (len < width) ? width - len : 0;
- cnt = adjust + len;
- if (left)
- adjust = -adjust;
-
- for ( ; adjust > 0; adjust++)
- putc(fill, fp);
-
- while (wc = *ws++)
- putwc(wc, fp);
-
- for ( ; adjust < 0; adjust--)
- putc(' ', fp);
-#endif
- return cnt;
-}
-
-static size_t
-strout(char *s, size_t len, int width, int fill, FILE * restrict fp)
-{
- int left = 0, adjust, ch, prefix;
- size_t cnt = 0;
-
- if (width < 0) {
- left = 1;
- width = -width;
- }
-
- adjust = (len < width) ? width - len : 0;
- cnt = adjust + len;
- if (left)
- adjust = -adjust;
-
- if (fill == '0') {
- if (*s == '-' || *s == '+')
- prefix = 1;
- else if (*s == '0' && toupper(s[1]) == 'X')
- prefix = 2;
- else
- prefix = 0;
- while (prefix--) {
- putc(*s++, fp);
- --len;
- }
- }
-
- for ( ; adjust > 0; adjust--)
- putc(fill, fp);
-
- while (ch = *s++)
- putc(ch, fp);
-
- for ( ; adjust < 0; adjust++)
- putc(' ', fp);
-
- return cnt;
-}
-
-int
-vfprintf(FILE * restrict fp, const char *fmt, va_list va)
-{
- int ch, n, flags, width, left, fill, cnt = 0;
- size_t inc, len;
- char *s;
- wchar_t *ws;
- struct conv conv;
- char buf[MAXPREC+1];
- wchar_t wbuf[2];
- va_list va2;
-
- va_copy(va2, va);
- for (cnt = 0; ch = *fmt++; cnt += inc) {
- if (ch != '%') {
- putc(ch, fp);
- inc = 1;
- continue;
- }
-
- fill = ' ';
- left = flags = width = 0;
- conv.prec = -1;
- conv.base = 10;
- conv.sign = '\0';
- conv.digs = "0123456789ABCDEFX";
-
-flags:
- switch (*fmt++) {
- case ' ':
- if (conv.sign == '\0')
- conv.sign = ' ';
- goto flags;
- case '+':
- conv.sign = '+';
- goto flags;
- case '#':
- flags |= ALTFORM;
- goto flags;
- case '.':
- if (*fmt == '*') {
- fmt++;
- n = va_arg(va2, int);
- } else {
- for (n = 0; isdigit(ch = *fmt); fmt++)
- n = n * 10 + ch - '0';
- }
- if (n > MAXPREC)
- n = MAXPREC;
- if (n > 0)
- conv.prec = n;
- goto flags;
- case '*':
- width = va_arg(va2, int);
- goto flags;
- case '-':
- left = 1;
- ++fmt;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- --fmt;
- for (n = 0; isdigit(ch = *fmt); ++fmt)
- n = n * 10 + ch - '0';
- if (left)
- n = -n;
- width = n;
- goto flags;
- case '0':
- fill = '0';
- goto flags;
- case 'l':
- flags += LONG;
- goto flags;
- case 'h':
- flags += SHORT;
- goto flags;
- case '%':
- ch = '%';
- goto cout;
- case 'c':
- if (flags & LONG) {
- wbuf[0] = va_arg(va2, wint_t);
- wbuf[1] = L'\0';
- ws = wbuf;
- len = 1;
- goto wstrout;
- }
- ch = va_arg(va2, int);
- cout:
- buf[0] = ch;
- buf[1] = '\0';
- s = buf;
- len = 1;
- goto strout;
- case 'j':
- flags |= INTMAX;
- goto flags;
- case 't':
- flags |= PTRDIFF;
- goto flags;
- case 'z':
- flags |= SIZET;
- goto flags;
- case 'u':
- flags |= UNSIGNED;
- case 'i':
- case 'd':
- conv.base = 10;
- goto numeric;
- case 'p':
- flags |= VOIDPTR | ALTFORM;
- goto numeric16;
- case 'x':
- conv.digs = "0123456789abcdefx";
- case 'X':
- numeric16:
- conv.base = 16;
- flags |= UNSIGNED;
- goto numeric;
- case 'o':
- conv.base = 8;
- flags |= UNSIGNED;
- numeric:
- if (conv.prec != -1)
- fill = ' ';
- s = numtostr(getnum(&va2, flags, &conv.sign),
- flags,
- &conv,
- &buf[MAXPREC]);
- len = &buf[MAXPREC] - s;
- goto strout;
- case 'L':
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- /* TODO */
- case 's':
- if (flags & LONG) {
- ws = va_arg(va2, wchar_t *);
- /* len = wcsnlen(ws, conv.prec); */
- goto wstrout;
- } else {
- s = va_arg(va2, char *);
- len = strnlen(s, conv.prec);
- goto strout;
- }
- wstrout:
- inc = wstrout(ws, len, width, fill, fp);
- break;
- strout:
- inc = strout(s, len, width, fill, fp);
- break;
- case 'n':
- savecnt(&va2, flags, cnt);
- break;
- case '\0':
- goto out_loop;
- }
- }
-
-out_loop:
- return (ferror(fp)) ? EOF : cnt;
-}
--- a/lib/c/stdio/vprintf.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef vprintf
-
-int
-vprintf(const char *fmt, va_list ap)
-{
- va_list ap2;
-
- va_copy(ap2, ap);
- return vfprintf(stdout, fmt, ap2);
-}
--- a/lib/c/stdio/vsnprintf.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#undef vsnprintf
-
-int
-vsnprintf(char * restrict s, size_t siz, const char * restrict fmt, va_list ap)
-{
- FILE f;
- int r;
-
- f.flags = _IORW | _IOSTRG;
- f.len = siz;
- f.buf = s;
- f.wp = s;
- f.rp = s + siz;
-
- r = vfprintf(&f, fmt, ap);
- if (s) {
- if (f.wp == f.rp)
- --f.wp;
- *f.wp = '\0';
- }
-
- return r;
-}
--- a/lib/c/stdio/vsprintf.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <limits.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#undef vsprintf
-
-
-int
-vsprintf(char * restrict s, const char * restrict fmt, va_list va)
-{
- return vsnprintf(s, SIZE_MAX, fmt, va);
-}
--- a/lib/c/stdlib/Makefile
+++ /dev/null
@@ -1,25 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = abort.o\
- abs.o\
- atexit.o\
- atoi.o\
- atol.o\
- atoll.o\
- bsearch.o\
- calloc.o\
- errno.o\
- exit.o\
- labs.o\
- llabs.o\
- malloc.o\
- qsort.o\
- rand.o\
- realloc.o\
- strtoull.o\
-
-all: $(OBJS)
--- a/lib/c/stdlib/abort.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <signal.h>
-#include <stdlib.h>
-#undef abort
-
-void
-abort(void)
-{
- raise(SIGABRT);
- _Exit(127);
-}
--- a/lib/c/stdlib/abs.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdlib.h>
-#undef abs
-
-int
-abs(int n)
-{
- return (n < 0) ? -n : n;
-}
--- a/lib/c/stdlib/atexit.c
+++ /dev/null
@@ -1,17 +1,0 @@
-#include <stdlib.h>
-#include <errno.h>
-#undef atexit
-
-extern void (*_exitf[_ATEXIT_MAX])(void);
-extern unsigned _exitn;
-
-int
-atexit(void (*fun)(void))
-{
- if (_exitn == _ATEXIT_MAX) {
- errno = ENOMEM;
- return -1;
- }
- _exitf[_exitn++] = fun;
- return 0;
-}
--- a/lib/c/stdlib/atoi.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include <ctype.h>
-#include <stdlib.h>
-#undef atoi
-
-int
-atoi(const char *s)
-{
- int n, sign = -1;
-
- while (isspace(*s))
- ++s;
-
- switch (*s) {
- case '-':
- sign = 1;
- case '+':
- ++s;
- }
-
- /* Compute n as a negative number to avoid overflow on INT_MIN */
- for (n = 0; isdigit(*s); ++s)
- n = 10*n - (*s - '0');
-
- return sign * n;
-}
--- a/lib/c/stdlib/atol.c
+++ /dev/null
@@ -1,26 +1,0 @@
-#include <ctype.h>
-#include <stdlib.h>
-#undef atol
-
-long
-atol(const char *s)
-{
- int sign = -1;
- long n;
-
- while (isspace(*s))
- ++s;
-
- switch (*s) {
- case '-':
- sign = 1;
- case '+':
- ++s;
- }
-
- /* Compute n as a negative number to avoid overflow on LONG_MIN */
- for (n = 0; isdigit(*s); ++s)
- n = 10*n - (*s - '0');
-
- return sign * n;
-}
--- a/lib/c/stdlib/atoll.c
+++ /dev/null
@@ -1,26 +1,0 @@
-#include <ctype.h>
-#include <stdlib.h>
-#undef atoll
-
-long long
-atoll(const char *s)
-{
- int sign = -1;
- long long n;
-
- while (isspace(*s))
- ++s;
-
- switch (*s) {
- case '-':
- sign = 1;
- case '+':
- ++s;
- }
-
- /* Compute n as a negative number to avoid overflow on LLONG_MIN */
- for (n = 0; isdigit(*s); ++s)
- n = 10*n - (*s - '0');
-
- return sign * n;
-}
--- a/lib/c/stdlib/bsearch.c
+++ /dev/null
@@ -1,26 +1,0 @@
-#include <stdlib.h>
-
-void *
-bsearch(const void *key, const void *ary, size_t n, size_t size,
- int (*cmp)(const void *, const void *))
-{
- int t;
- size_t mid, low, high;
- char *cur, *base = ary;
-
- low = 0;
- high = n - 1;
- while (low <= high) {
- mid = low + (high - low) / 2;
- cur = base + mid*size;
-
- if ((t = (*cmp)(key, cur)) == 0)
- return cur;
- else if (t > 0)
- low = mid + 1;
- else
- high = mid - 1;
- }
-
- return NULL;
-}
--- a/lib/c/stdlib/calloc.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include <stdlib.h>
-#include <string.h>
-#undef calloc
-
-void *
-calloc(size_t nmemb, size_t size)
-{
- size_t nbytes;
- void *mem;
-
- if (!nmemb || !size || nmemb > (size_t)-1/size)
- return NULL;
-
- nbytes = nmemb * size;
- if ((mem = malloc(nbytes)) == NULL)
- return NULL;
- return memset(mem, 0, nbytes);
-}
--- a/lib/c/stdlib/errno.c
+++ /dev/null
@@ -1,1 +1,0 @@
-int errno;
--- a/lib/c/stdlib/exit.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <stdlib.h>
-#undef exit
-
-void (*_exitf[_ATEXIT_MAX])(void);
-unsigned _exitn;
-
-void
-exit(int status)
-{
- while (_exitn > 0)
- (*_exitf[--_exitn])();
- _Exit(status);
-}
--- a/lib/c/stdlib/labs.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdlib.h>
-#undef labs
-
-long
-labs(long n)
-{
- return (n < 0) ? -n : n;
-}
--- a/lib/c/stdlib/llabs.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <stdlib.h>
-#undef llabs
-
-long long
-llabs(long long n)
-{
- return (n < 0) ? -n : n;
-}
--- a/lib/c/stdlib/malloc.c
+++ /dev/null
@@ -1,158 +1,0 @@
-#include <errno.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "malloc.h"
-#include "../syscall.h"
-
-#define MAXADDR ((char *)-1)
-#define ERRADDR ((char *)-1)
-
-static Header base = { .h.next = &base };
-static Header *freep = &base;
-
-/*
- * Run over the free list looking for the nearest previous
- * block. There are two possible results: end of the list
- * or an intermediary block.
- */
-void *
-_prevchunk(Header *hp)
-{
- Header *p;
-
- for (p = freep; ;p = p->h.next) {
- /* hp between p and p->h.next? */
- if (p < hp && hp < p->h.next)
- break;
- /* p before hp and hp at the end of list? */
- if (p->h.next <= p && (hp < p->h.next || hp > p))
- break;
- }
- return p;
-}
-
-/*
- * Get the previous block and try to merge
- * with next and previous blocks
- */
-void
-free(void *mem)
-{
- Header *hp, *prev;
-
- if (!mem)
- return;
-
- hp = (Header *) mem - 1;
- prev = _prevchunk(hp);
-
- /* join to next */
- if (hp + hp->h.size == prev->h.next) {
- hp->h.size += prev->h.next->h.size;
- hp->h.next = prev->h.next->h.next;
- } else {
- hp->h.next = prev->h.next;
- }
-
- /* join to previous */
- if (prev + prev->h.size == hp) {
- prev->h.size += hp->h.size;
- prev->h.next = hp->h.next;
- } else {
- prev->h.next = hp;
- }
-
- freep = prev;
-}
-
-static void *
-sbrk(uintptr_t inc)
-{
- char *new, *old;
- void *p;
- static void *heap;
-
- if (!heap)
- heap = _getheap();
- old = heap;
- if (old >= MAXADDR - inc)
- return ERRADDR;
- new = old + inc;
- p = _brk(new);
- if (p == old || p < 0)
- return ERRADDR;
- heap = new;
-
- return old;
-}
-
-static Header *
-morecore(size_t nunits)
-{
- char *rawmem;
- Header *hp;
-
- if (nunits < NALLOC)
- nunits = NALLOC;
-
- rawmem = sbrk(nunits * sizeof(Header));
- if (rawmem == ERRADDR)
- return NULL;
-
- hp = (Header*)rawmem;
- hp->h.size = nunits;
-
- /* integrate new memory into the list */
- free(hp + 1);
-
- return freep;
-}
-
-/*
- * Run over the list of free blocks trying to find a block
- * big enough for nbytes. If the block fit perfectly with
- * the required size then we only have to unlink
- * the block. Otherwise we have to split the block and
- * return the right part. If we run over the full list
- * without a fit then we have to require more memory
- *
- * ______________________________________
- * ___________./______________________________________\_____
- * ...| in | | | in | |.....| in | | | |....
- * ...| use | | | use | |.....| use | | | |....
- * ___|______|___|.____|_____|._|_____|______|._|.___|.|____
- * \__/ \_________/ \_____________/ \/ \__/
- */
-void *
-malloc(size_t nbytes)
-{
- Header *cur, *prev;
- size_t nunits;
-
- /* 1 unit for header plus enough units to fit nbytes */
- nunits = (nbytes+sizeof(Header)-1) / sizeof(Header) + 1;
-
- for (prev = freep; ; prev = cur) {
- cur = prev->h.next;
- if (cur->h.size >= nunits) {
- if (cur->h.size == nunits) {
- prev->h.next = cur->h.next;
- } else {
- cur->h.size -= nunits;
- cur += cur->h.size;
- cur->h.size = nunits;
- }
- freep = prev;
- return cur + 1;
- }
-
- if (cur == freep) {
- if ((cur = morecore(nunits)) == NULL) {
- errno = ENOMEM;
- return NULL;
- }
- }
- }
-}
--- a/lib/c/stdlib/malloc.h
+++ /dev/null
@@ -1,16 +1,0 @@
-#include <stdlib.h>
-
-/* minimum amount of required units */
-#define NALLOC 10000
-
-typedef union header Header;
-union header {
- struct hdr {
- Header *next;
- size_t size;
- } h;
- /* most restrictive type fixes the union size for alignment */
- _ALIGNTYPE most;
-};
-
-extern void *_prevchunk(Header *hp);
--- a/lib/c/stdlib/qsort.c
+++ /dev/null
@@ -1,68 +1,0 @@
-#include <stdlib.h>
-#include <string.h>
-#undef qsort
-
-/*
- * This implementation of qsort is based in the paper
- * "Engineering a Sort Function", by Jon L.Bentley and M. Douglas McIlroy.
- * A lot of different optimizations were removed to make the code simpler.
- */
-
-struct qsort {
- size_t es;
- int (*cmp)(const void *, const void *);
-};
-
-static void
-swap(char *i, char *j, size_t n)
-{
- do {
- char c = *i;
- *i++ = *j;
- *j++ = c;
- } while (--n > 0);
-}
-
-static void
-xqsort(char *a, size_t n, struct qsort *qs)
-{
- size_t j, es = qs->es;
- char *pi, *pj, *pn;
-
- if (n <= 1)
- return;
-
- pi = a;
- pn = pj = a + n*es;
-
- swap(a, a + n/2 * es, es);
- for (;;) {
- do {
- pi += es;
- } while (pi < pn && qs->cmp(pi, a) < 0);
-
- do {
- pj -= es;
- } while (pj > a && qs->cmp(pj, a) > 0);
-
- if (pj < pi)
- break;
- swap(pi, pj, es);
- }
- swap(a, pj, es);
-
- j = (pj - a) / es;
- xqsort(a, j, qs);
- xqsort(a + (j+1)*es, n-j-1, qs);
-}
-
-void
-qsort(void *base, size_t nmemb, size_t size,
- int (*f)(const void *, const void *))
-{
- struct qsort qs;
-
- qs.cmp = f;
- qs.es = size;
- xqsort(base, nmemb, &qs);
-}
--- a/lib/c/stdlib/rand.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include <stdlib.h>
-#undef rand
-#undef srand
-
-static unsigned long next;
-
-void
-srand(unsigned seed)
-{
- next = seed;
-}
-
-int
-rand(void) /* RAND_MAX assumed to be 32767. */
-{
- next = next * 1103515245 + 12345;
- return (unsigned)(next/65536) % 32768;
-}
--- a/lib/c/stdlib/realloc.c
+++ /dev/null
@@ -1,68 +1,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-#include "malloc.h"
-#undef realloc
-
-void *
-realloc(void *ptr, size_t nbytes)
-{
- Header *oh, *prev, *next, *new;
- size_t nunits, avail, onbytes, n;
-
- if (!nbytes)
- return NULL;
-
- if (!ptr)
- return malloc(nbytes);
-
- nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1;
- oh = (Header*)ptr - 1;
-
- if (oh->h.size == nunits)
- return ptr;
-
- new = oh + nunits;
-
- if (nunits < oh->h.size - 1) {
- new->h.size = oh->h.size - nunits;
- oh->h.size = nunits;
- free(new + 1);
- return oh;
- }
-
- prev = _prevchunk(oh);
-
- if (oh + oh->h.size == prev->h.next) {
- /*
- * if there is free space adjacent
- * to the current memory
- */
- next = prev->h.next;
- avail = oh->h.size + next->h.size;
-
- if (avail == nunits) {
- oh->h.size = nunits;
- prev->h.next = next->h.next;
- return oh;
- }
-
- if (avail > nunits) {
- oh->h.size = nunits;
- prev->h.next = new;
- new->h.next = next;
- new->h.size = avail - nunits;
- return oh;
- }
- }
-
- onbytes = (oh->h.size - 1) * sizeof(Header);
- if ((new = malloc(nbytes)) == NULL)
- return NULL;
-
- n = (onbytes > nbytes) ? nbytes : onbytes;
- memcpy(new, ptr, n);
- free(ptr);
-
- return new;
-}
--- a/lib/c/stdlib/strtoull.c
+++ /dev/null
@@ -1,64 +1,0 @@
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-
-#undef strtoull
-
-unsigned long long
-strtoull(const char *s, char **end, int base)
-{
- int d, sign = 1;
- unsigned long long n;
- static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- const char *t, *p;
-
- while (isspace(*s))
- ++s;
-
- switch (*s) {
- case '-':
- sign = -1;
- case '+':
- ++s;
- }
-
- if (base == 0) {
- if (*s == '0' && toupper(s[1]) == 'X')
- base = 16;
- else if (*s == '0')
- base = 8;
- else
- base = 10;
- }
-
- if (base == 16 && *s == '0' && toupper(s[1]) == 'X')
- s += 2;
-
- n = 0;
- for (t = s; p = strchr(digits, toupper(*t)); ++t) {
- if ((d = p - digits) >= base)
- break;
- if (n > ULLONG_MAX/base)
- goto overflow;
- n *= base;
- if (d > ULLONG_MAX - n)
- goto overflow;
- n += d;
- }
-
-
- if (end)
- *end = t;
- if (n == 0 && s == t)
- errno = EINVAL;
- return n*sign;
-
-overflow:
- if (end)
- *end = t;
- errno = ERANGE;
-
- return ULLONG_MAX;
-}
--- a/lib/c/string/Makefile
+++ /dev/null
@@ -1,31 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = memchr.o\
- memcmp.o\
- memcpy.o\
- memmove.o\
- memset.o\
- strcat.o\
- strchr.o\
- strcmp.o\
- strcoll.o\
- strcpy.o\
- strcspn.o\
- strerror.o\
- strlen.o\
- strncat.o\
- strncmp.o\
- strncpy.o\
- strnlen.o\
- strpbrk.o\
- strrchr.o\
- strspn.o\
- strstr.o\
- strtok.o\
- strxfrm.o\
-
-all: $(OBJS)
--- a/lib/c/string/memchr.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <string.h>
-#undef memchr
-
-void *
-memchr(const void *s, int c, size_t n)
-{
- const unsigned char *bp = s;
-
- while (n > 0 && *bp++ != c)
- --n;
- return (n == 0) ? NULL : bp-1;
-}
--- a/lib/c/string/memcmp.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <string.h>
-#undef memcmp
-
-int
-memcmp(const void *s1, const void *s2, size_t n)
-{
- const char *s = s1;
- const char *t = s2;
-
- for ( ; n > 0 && *s == *t; --n)
- ++s, ++t;
-
- return (n > 0) ? *(unsigned char *) s - *(unsigned char *) t : 0;
-}
--- a/lib/c/string/memcpy.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <string.h>
-#undef memcpy
-
-void *
-memcpy(void * restrict dst, const void * restrict src, size_t n)
-{
- char *s1 = dst;
- const char *s2 = src;
-
- while (n-- > 0)
- *s1++ = *s2++;
- return dst;
-}
--- a/lib/c/string/memmove.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include <string.h>
-#undef memmove
-
-void *
-memmove(void *dst, const void *src, size_t n)
-{
- char *d = dst, *s = (char *) src;
-
- if (d < s) {
- while (n-- > 0)
- *d++ = *s++;
- } else {
- s += n-1, d += n-1;
- while (n-- > 0)
- *d-- = *s--;
- }
- return dst;
-}
--- a/lib/c/string/memset.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <string.h>
-#undef memset
-
-void *
-memset(void *s, int c, size_t n)
-{
- char *m = s;
-
- while (n-- > 0)
- *m++ = c;
- return s;
-}
--- a/lib/c/string/strcat.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <string.h>
-#undef strcat
-
-char *
-strcat(char * restrict dst, const char * restrict src)
-{
- char *ret = dst;
-
- while (*dst)
- ++dst;
- while (*dst++ = *src++)
- ;
- return ret;
-}
--- a/lib/c/string/strchr.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <string.h>
-#undef strchr
-
-char *
-strchr(const char *s, int c)
-{
- while (*s && *s != c)
- ++s;
- return (*s == c) ? (char *)s : NULL;
-}
--- a/lib/c/string/strcmp.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <string.h>
-#undef strcmp
-
-int
-strcmp(const char *s1, const char *s2)
-{
- while (*s1 && *s2 && *s1 == *s2)
- ++s1, ++s2;
- return *(unsigned char *)s1 - *(unsigned char *)s2;
-}
--- a/lib/c/string/strcoll.c
+++ /dev/null
@@ -1,10 +1,0 @@
-#include <string.h>
-#undef strcoll
-
-int
-strcoll(const char *s1, const char *s2)
-{
- while (*s1 && *s2 && *s1 == *s2)
- ++s1, ++s2;
- return *(unsigned char *) s1 - *(unsigned char *) s2;
-}
--- a/lib/c/string/strcpy.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <string.h>
-#undef strcpy
-
-char *
-strcpy(char * restrict dst, const char * restrict src)
-{
- char *ret = dst;
-
- while (*dst++ = *src++)
- ;
- return ret;
-}
--- a/lib/c/string/strcspn.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <string.h>
-#undef strcspn
-
-size_t
-strcspn(const char *s1, const char *s2)
-{
- const unsigned char *s = s1;
- const unsigned char *accept = s2;
- unsigned ch;
- size_t n;
- char buf[__NUMCHARS];
-
- memset(buf, 0, sizeof(buf));
- while (ch = *accept++)
- buf[ch] = 1;
-
- for (n = 0; (ch = *s++) && !buf[ch]; ++n)
- ;
-
- return n;
-}
--- a/lib/c/string/strerror.c
+++ /dev/null
@@ -1,11 +1,0 @@
-#include <errno.h>
-#include <string.h>
-#undef strerror
-
-char *
-strerror(int errnum)
-{
- if (errnum > _sys_nerr)
- errnum = EUNKNOWN;
- return _sys_errlist[errnum];
-}
--- a/lib/c/string/strlen.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <string.h>
-#undef strlen
-
-size_t
-strlen(const char *s)
-{
- const char *t;
-
- for (t = s; *t; ++t)
- ;
- return t - s;
-}
--- a/lib/c/string/strncat.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#include <string.h>
-#undef strncat
-
-char *
-strncat(char * restrict dst, const char * restrict src, size_t n)
-{
- char *ret = dst;
-
- while (*dst)
- ++dst;
- while (n-- > 0 && *src)
- *dst++ = *src++;
- *dst = '\0';
- return ret;
-}
--- a/lib/c/string/strncmp.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <string.h>
-#undef strncmp
-
-int
-strncmp(const char *s1, const char *s2, size_t n)
-{
- int c;
-
- for ( ; n > 0 && (c = *s1) && c == *s2; --n)
- ++s1, ++s2;
- if (n == 0)
- return 0;
- return *(unsigned char *) s1 - *(unsigned char *) s2;
-}
--- a/lib/c/string/strncpy.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <string.h>
-#undef strncpy
-
-char *
-strncpy(char * restrict dst, const char * restrict src, size_t n)
-{
- char *ret = dst;
-
- for (; n > 0 && *src; --n)
- *dst++ = *src++;
- while (n-- > 0)
- *dst++ = '\0';
- return ret;
-}
--- a/lib/c/string/strnlen.c
+++ /dev/null
@@ -1,13 +1,0 @@
-#include <string.h>
-
-#undef strnlen
-
-size_t
-strnlen(const char *s, size_t maxlen)
-{
- size_t n;
-
- for (n = 0; n < maxlen && *s++; ++n)
- ;
- return n;
-}
--- a/lib/c/string/strpbrk.c
+++ /dev/null
@@ -1,20 +1,0 @@
-#include <string.h>
-#undef strpbrk
-
-char *
-strpbrk(const char *s1, const char *s2)
-{
- const unsigned char *s = s1;
- const unsigned char *accept = s2;
- unsigned ch;
- char buf[__NUMCHARS];
-
- memset(buf, 0, sizeof(buf));
- while (ch = *accept++)
- buf[ch] = 1;
-
- while ((ch = *s) && !buf[ch])
- s++;
-
- return (ch == '\0') ? NULL : (char *) s;
-}
--- a/lib/c/string/strrchr.c
+++ /dev/null
@@ -1,14 +1,0 @@
-#include <string.h>
-#undef strrchr
-
-char *
-strrchr(const char *s, int c)
-{
- const char *t = s;
-
- while (*t)
- ++t;
- while (t > s && *t != c)
- --t;
- return (*t == c) ? (char *)t : NULL;
-}
--- a/lib/c/string/strspn.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <string.h>
-#undef strspn
-
-size_t
-strspn(const char *s1, const char *s2)
-{
- const unsigned char *s = s1;
- const unsigned char *accept = s2;
- unsigned ch;
- size_t n;
- char buf[__NUMCHARS];
-
- memset(buf, 0, sizeof(buf));
- while (ch = *accept++)
- buf[ch] = 1;
-
- for (n = 0; (ch = *s++) && buf[ch]; ++n)
- ;
-
- return n;
-}
--- a/lib/c/string/strstr.c
+++ /dev/null
@@ -1,18 +1,0 @@
-#include <stddef.h>
-#include <string.h>
-#undef strstr
-
-char *
-strstr(const char *s1, const char *s2)
-{
- const char *p;
- int c = *s2;
-
- if (c == '\0')
- return NULL;
- for (p = s1; p = strchr(p, c); ++p) {
- if (!strcmp(p, s2))
- return (char *) p;
- }
- return NULL;
-}
--- a/lib/c/string/strtok.c
+++ /dev/null
@@ -1,25 +1,0 @@
-#include <string.h>
-#undef strtok
-
-char *
-strtok(char * restrict s, const char * restrict delim)
-{
- static char *line;
-
- if (s)
- line = s;
- if (!s && !line)
- return NULL;
-
- s = line + strspn(line, delim);
- if (*s == '\0')
- return line = NULL;
-
- line = s + strcspn(s, delim);
- if (*line != '\0')
- *line++ = '\0';
- else
- line = NULL;
-
- return s;
-}
--- a/lib/c/string/strxfrm.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <string.h>
-#undef strxfrm
-
-size_t
-strxfrm(char * restrict dst, const char * restrict src, size_t n)
-{
- size_t len = strlen(src);
-
- if (len < n)
- strcpy(dst, src);
- return len;
-}
--- a/lib/c/syscall.h
+++ /dev/null
@@ -1,8 +1,0 @@
-extern void *_brk(void *addr);
-extern int _open(const char *path, int flags);
-extern int _close(int fd);
-extern int _read(int fd, void *buf, size_t n);
-extern int _write(int fd, void *buf, size_t n);
-extern int _lseek(int fd, long off, int whence);
-extern void _Exit(int status);
-extern int _access(char *path, int mode);
--- a/lib/c/time/Makefile
+++ /dev/null
@@ -1,16 +1,0 @@
-.POSIX:
-PROJECTDIR =../../..
-include $(PROJECTDIR)/scripts/rules.mk
-
-MORECFLAGS = -w
-
-OBJS = _daysyear.o\
- asctime.o\
- ctime.o\
- difftime.o\
- gmtime.o\
- localtime.o\
- mktime.o\
- strftime.o\
-
-all: $(OBJS)
--- a/lib/c/time/_daysyear.c
+++ /dev/null
@@ -1,30 +1,0 @@
-#include <time.h>
-#include "../libc.h"
-
-int _daysmon[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-int
-_daysyear(int year)
-{
- if (year%4 != 0)
- return 365;
- if (year%100 == 0 && year%400 != 0)
- return 365;
- return 366;
-}
-
-/*
- * Happy New Year!!!!
- */
-int
-_newyear(int year)
-{
- int day;
-
- year += 1900 - 1;
- day = 1 + year + year/4;
- day -= year/100;
- day += year/400;
-
- return day % 7;
-}
--- a/lib/c/time/asctime.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include <time.h>
-#undef asctime
-
-#include <stdio.h> // TODO: remove me!
-char *
-asctime(const struct tm *tm)
-{
- static char buf[30];
-
- strftime(buf, sizeof(buf), "%c\n", tm);
- return buf;
-}
--- a/lib/c/time/ctime.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <time.h>
-#undef ctime
-
-char *
-ctime(const time_t *t)
-{
- return asctime(localtime(t));
-}
--- a/lib/c/time/difftime.c
+++ /dev/null
@@ -1,8 +1,0 @@
-#include <time.h>
-#undef difftime
-
-double
-difftime(time_t t1, time_t t2)
-{
- return (double) (t1 - t2);
-}
--- a/lib/c/time/gmtime.c
+++ /dev/null
@@ -1,35 +1,0 @@
-#include <time.h>
-#include "libc.h"
-#undef gmtime
-
-struct tm *
-gmtime(const time_t *t)
-{
- static struct tm tm;
- time_t sec, min, hour, year, day;
- int i;
-
- tm.tm_sec = *t % SECDAY;
- tm.tm_min = tm.tm_sec / 60;
- tm.tm_sec %= 60;
- tm.tm_hour = tm.tm_min / 60;
- tm.tm_min %= 60;
- day = *t / SECDAY;
-
- tm.tm_wday = (day + THU) % 7; /* 1/1/1970 was Thursday */
-
- for (i = EPOCH; day >= _daysyear(i); ++i)
- day -= _daysyear(i);
- tm.tm_year = i - 1900;
- tm.tm_yday = day;
-
- _daysmon[FEB] = FEBDAYS(tm.tm_year);
- for (i = JAN; day > _daysmon[i]; i++)
- day -= _daysmon[i];
- tm.tm_mon = i;
- tm.tm_mday = day + 1;
-
- tm.tm_isdst = 0;
-
- return &tm;
-}
--- a/lib/c/time/localtime.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <time.h>
-#include "libc.h"
-#undef localtime
-
-struct tm *
-localtime(const time_t *timep)
-{
- struct tzone *tz;
- struct tm *tm;
- time_t t = *timep;
-
- t += tz->gmtoff * 60;
- t += tz->isdst * 60;
- tm = gmtime(&t);
- tz = _tzone(tm);
- tm->tm_zone = tz->name;
- tm->tm_isdst = tz->isdst;
- tm->tm_gmtoff = tz->gmtoff;
-
- return tm;
-}
--- a/lib/c/time/mktime.c
+++ /dev/null
@@ -1,112 +1,0 @@
-#include <limits.h>
-#include <time.h>
-#include "libc.h"
-#undef mktime
-
-static int
-norm(int *val, int *next, int qty)
-{
- int v = *val, n = *next, d;
-
- if (v < 0) {
- d = -v / qty + 1;
- v += d * qty;
- if (n > INT_MAX - d)
- return 0;
- n += d;
- }
- if (v >= qty) {
- d = v / qty;
- v -= d * qty;
- if (n < INT_MIN + d)
- return 0;
- n -= d;
- }
-
- *val = v;
- *next = n;
- return 1;
-}
-
-static int
-normalize(struct tm *tm)
-{
- int mon, day, year;
- struct tm aux = *tm;
-
- if (!norm(&tm->tm_sec, &tm->tm_min, 60) ||
- !norm(&tm->tm_min, &tm->tm_hour, 60) ||
- !norm(&tm->tm_hour, &tm->tm_mday, 24) ||
- !norm(&tm->tm_mon, &tm->tm_year, 12)) {
- return 0;
- }
-
- day = tm->tm_mday;
- year = EPOCH + tm->tm_year;
- _daysmon[FEB] = FEBDAYS(year);
-
- for (mon = tm->tm_mon; day < 1; --mon) {
- day += _daysmon[mon];
- if (mon == JAN) {
- if (year == EPOCH)
- return -1;
- year--;
- _daysmon[FEB] = FEBDAYS(year);
- mon = DEC+1;
- }
- }
-
- for (; day > _daysmon[mon]; ++mon) {
- day -= _daysmon[mon];
- if (mon == DEC) {
- if (year == _MAXYEAR)
- return -1;
- year++;
- _daysmon[FEB] = FEBDAYS(year);
- mon = JAN-1;
- }
- }
-
- tm->tm_mon = mon;
- tm->tm_year = year - EPOCH;
- tm->tm_mday = day;
- tm->tm_wday = (_newyear(tm->tm_year) + tm->tm_yday) % 7;
-
- return 1;
-}
-
-time_t
-mktime(struct tm *tm)
-{
- int i, year, dst;
- time_t t;
- struct tm *aux;
-
- if (!normalize(tm))
- return -1;
-
- t = 0;
- year = tm->tm_year + 1900;
- for (i = EPOCH; i < year; i++)
- t += _daysyear(i) * SECDAY;
-
- for (i = 0; i < tm->tm_mon; i++)
- t += _daysmon[i] * SECDAY;
-
- t += tm->tm_sec;
- t += tm->tm_min * SECMIN;
- t += tm->tm_hour * SECHOUR;
- t += (tm->tm_mday-1) * SECDAY;
-
- aux = localtime(&t);
-
- dst = 0;
- if (tm->tm_isdst == 0 && aux->tm_isdst == 1)
- dst = -SECHOUR;
- else if (tm->tm_isdst == 1 && aux->tm_isdst == 0)
- dst = +SECHOUR;
-
- t += aux->tm_gmtoff + dst;
-
- return t;
-}
--- a/lib/c/time/strftime.c
+++ /dev/null
@@ -1,246 +1,0 @@
-#include <time.h>
-#include <string.h>
-#include "libc.h"
-#undef strftime
-
-static char *days[] = {
- "Sunday", "Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday",
-};
-
-static char *months[] = {
- "January", "February", "March", "April",
- "May", "June", "July", "August",
- "September", "October", "November", "December"
-};
-
-static char *am_pm[] = {"AM", "PM"};
-
-static size_t
-sval(char *s, size_t siz, char **strs, int abrev, int idx, int max)
-{
- char *str;
- size_t len;
-
- if (idx < 0 && idx >= max)
- goto wrong;
-
- str = strs[idx];
- len = (!abrev) ? strlen(str) : 3;
- if (len > siz)
- goto wrong;
-
- memcpy(s, str, len);
- return len;
-
-wrong:
- *s = '?';
- return 1;
-}
-
-static size_t
-dval(char *s, size_t siz, int prec, int fill, int val)
-{
- char *t;
- int n;
- static char digits[] = "0123456789";
-
- if (prec > siz || val < 0) {
- *s = '?';
- return 1;
- }
-
- n = prec;
- do {
- s[--n] = digits[val % 10];
- val /= 10;
- } while (n > 0 && val > 0);
-
- while (n > 0)
- s[--n] = fill;
-
- return prec;
-}
-
-static size_t
-timezone(char *s, size_t prec, const struct tm * restrict tm)
-{
- long off = tm->tm_gmtoff;
-
- if (prec < 5) {
- *s = '?';
- return 1;
- }
-
- if (off >= 0) {
- *s++ = '+';
- } else {
- *s++ = '-';
- off = -off;
- }
-
- dval(s, 2, 2, '0', off / 3600);
- dval(s, 2, 2, '0', (off % 3600) / 60);
-
- return 5;
-}
-
-size_t
-strftime(char * restrict s, size_t siz,
- const char * restrict fmt,
- const struct tm * restrict tm)
-{
- int ch, abrev, val, fill, width;
- size_t n, inc;
- char *tfmt;
-
- for (n = siz-1; (ch = *fmt++) && n > 0; s += inc, n -= inc) {
- if (ch != '%') {
- *s = ch;
- inc = 1;
- continue;
- }
-
- abrev = 0;
- fill = '0';
- width = 2;
-
- switch (*fmt++) {
- case 'Z':
- if (!tm->tm_zone)
- break;
- inc = sval(s, n, &tm->tm_zone, 0, 0, 1);
- break;
- case 'a':
- abrev = 1;
- case 'A':
- inc = sval(s, n, days, abrev, tm->tm_wday, 7);
- break;
- case 'h':
- case 'b':
- abrev = 1;
- case 'B':
- inc = sval(s, n, months, abrev, tm->tm_mon, 12);
- break;
- case 'p':
- inc = sval(s, n, am_pm, 0, tm->tm_hour > 12, 2);
- break;
- case 'c':
- tfmt = "%a %b %e %T %Y";
- goto recursive;
- case 'D':
- tfmt = "%m/%d/%y";
- goto recursive;
- case 'F':
- tfmt = "%Y-%m-%d";
- goto recursive;
- case 'R':
- tfmt = "%H:%M";
- goto recursive;
- case 'X':
- case 'T':
- tfmt = "%H:%M:%S";
- goto recursive;
- case 'r':
- tfmt = "%I:%M:%S %p";
- goto recursive;
- case 'x':
- tfmt = "%m/%d/%y";
- goto recursive;
- recursive:
- inc = strftime(s, n+1, tfmt, tm) - 1;
- break;
- case 'n':
- val = '\n';
- goto character;
- case 't':
- val = '\t';
- goto character;
- case '%':
- val = '%';
- character:
- *s = val;
- inc = 1;
- break;
- case 'e':
- fill = ' ';
- val = tm->tm_mday;
- goto number;
- case 'd':
- val = tm->tm_mday;
- goto number;
- case 'V':
- case 'g':
- case 'G':
- /* TODO */
- break;
- case 'C':
- val = tm->tm_year / 100;
- goto number;
- case 'H':
- val = tm->tm_hour;
- goto number;
- case 'I':
- val = tm->tm_hour;
- if (val == 0)
- val = 12;
- if (val > 12)
- val -= 12;
- goto number;
- case 'j':
- width = 3;
- val = tm->tm_yday+1;
- goto number;
- case 'm':
- val = tm->tm_mon+1;
- goto number;
- case 'M':
- val = tm->tm_min;
- goto number;
- case 'S':
- val = tm->tm_sec;
- goto number;
- case 'u':
- width = 1;
- val = tm->tm_wday+1;
- goto number;
- case 'U':
- val = tm->tm_yday / 7;
- if (_newyear(tm->tm_year) == SAT)
- val++;
- goto number;
- case 'W':
- val = tm->tm_yday / 7;
- if (_newyear(tm->tm_year) == MON)
- val++;
- goto number;
- case 'w':
- width = 1;
- val = tm->tm_wday;
- goto number;
- case 'y':
- val = tm->tm_year%100;
- goto number;
- case 'Y':
- width = 4;
- val = 1900 + tm->tm_year;
- number:
- inc = dval(s, n, width, fill, val);
- break;
- case 'z':
- inc = timezone(s, n, tm);
- break;
- case 'E':
- case 'O':
- if (*fmt != '\0')
- fmt += 2;;
- case '\0':
- inc = 0;
- --fmt;
- break;
- }
- }
- *s = '\0';
-
- return siz - n;
-}
--- a/lib/coff32/Makefile
+++ /dev/null
@@ -1,22 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../..
-LIBCOFF32 = .
-include $(PROJECTDIR)/rules.mk
-include objlst.mk
-
-TARGET = $(LIBDIR)/libcoff32.a
-
-all: $(TARGET)
-
-$(TARGET): $(LIBCOFF32-OBJ)
- $(AR) $(ARFLAGS) $@ $?
- ranlib $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f *.o $(TARGET)
-
-include deps.mk
--- a/lib/coff32/coff32_pack_aout.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/aouthdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_pack_aout(packfun fun, unsigned char *buff, AOUTHDR *aout)
-{
-}
--- a/lib/coff32/coff32_pack_ent.c
+++ /dev/null
@@ -1,20 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/syms.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_pack_ent(packfun fun, unsigned char *buff, SYMENT *ent)
-{
- int n;
-
- n = (*fun)(buff,
- "'8lsscc",
- &ent->n_name,
- &ent->n_value,
- &ent->n_scnum,
- &ent->n_type,
- &ent->n_sclass,
- &ent->n_numaux);
- assert(n == SYMESZ);
-}
--- a/lib/coff32/coff32_pack_hdr.c
+++ /dev/null
@@ -1,21 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/filehdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_pack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr)
-{
- int n;
-
- n = (*fun)(buff,
- "sslllss",
- hdr->f_magic,
- hdr->f_nscns,
- hdr->f_timdat,
- hdr->f_symptr,
- hdr->f_nsyms,
- hdr->f_opthdr,
- hdr->f_flags);
- assert(n == FILHSZ);
-}
--- a/lib/coff32/coff32_pack_scn.c
+++ /dev/null
@@ -1,24 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/scnhdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_pack_scn(packfun fun, unsigned char *buff, SCNHDR *scn)
-{
- int n;
-
- n = (*fun)(buff,
- "'8llllllssl",
- scn->s_name,
- scn->s_paddr,
- scn->s_vaddr,
- scn->s_size,
- scn->s_scnptr,
- scn->s_relptr,
- scn->s_lnnoptr,
- scn->s_nrelloc,
- scn->s_nlnno,
- scn->s_flags);
- assert(n == SCNHSZ);
-}
--- a/lib/coff32/coff32_unpack_aout.c
+++ /dev/null
@@ -1,9 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/aouthdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_unpack_aout(packfun fun, unsigned char *buff, AOUTHDR *ent)
-{
-}
--- a/lib/coff32/coff32_unpack_ent.c
+++ /dev/null
@@ -1,20 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/syms.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_unpack_ent(packfun fun, unsigned char *buff, SYMENT *ent)
-{
- int n;
-
- n = (*fun)(buff,
- "'8lsscc",
- &ent->n_name,
- &ent->n_value,
- &ent->n_scnum,
- &ent->n_type,
- &ent->n_sclass,
- &ent->n_numaux);
- assert(n == SYMESZ);
-}
--- a/lib/coff32/coff32_unpack_hdr.c
+++ /dev/null
@@ -1,22 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/filehdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_unpack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr)
-{
- int n;
-
- n = (*fun)(buff,
- "sslllss",
- &hdr->f_magic,
- &hdr->f_nscns,
- &hdr->f_timdat,
- &hdr->f_symptr,
- &hdr->f_nsyms,
- &hdr->f_opthdr,
- &hdr->f_flags);
- assert(n == FILHSZ);
-}
-
--- a/lib/coff32/coff32_unpack_scn.c
+++ /dev/null
@@ -1,24 +1,0 @@
-#include <assert.h>
-
-#include "../../inc/coff32/scnhdr.h"
-#include "../../inc/coff32/coff32.h"
-
-void
-coff32_unpack_scn(packfun fun, unsigned char *buff, SCNHDR *scn)
-{
- int n;
-
- n = (*fun)(buff,
- "'8llllllssl",
- scn->s_name,
- &scn->s_paddr,
- &scn->s_vaddr,
- &scn->s_size,
- &scn->s_scnptr,
- &scn->s_relptr,
- &scn->s_lnnoptr,
- &scn->s_nrelloc,
- &scn->s_nlnno,
- &scn->s_flags);
- assert(n == SCNHSZ);
-}
--- a/lib/coff32/deps.mk
+++ /dev/null
@@ -1,17 +1,0 @@
-#deps
-coff32_pack_aout.o: ../../inc/coff32/aouthdr.h
-coff32_pack_aout.o: ../../inc/coff32/coff32.h
-coff32_pack_ent.o: ../../inc/coff32/coff32.h
-coff32_pack_ent.o: ../../inc/coff32/syms.h
-coff32_pack_hdr.o: ../../inc/coff32/coff32.h
-coff32_pack_hdr.o: ../../inc/coff32/filehdr.h
-coff32_pack_scn.o: ../../inc/coff32/coff32.h
-coff32_pack_scn.o: ../../inc/coff32/scnhdr.h
-coff32_unpack_aout.o: ../../inc/coff32/aouthdr.h
-coff32_unpack_aout.o: ../../inc/coff32/coff32.h
-coff32_unpack_ent.o: ../../inc/coff32/coff32.h
-coff32_unpack_ent.o: ../../inc/coff32/syms.h
-coff32_unpack_hdr.o: ../../inc/coff32/coff32.h
-coff32_unpack_hdr.o: ../../inc/coff32/filehdr.h
-coff32_unpack_scn.o: ../../inc/coff32/coff32.h
-coff32_unpack_scn.o: ../../inc/coff32/scnhdr.h
--- a/lib/coff32/libdep.mk
+++ /dev/null
@@ -1,4 +1,0 @@
-include $(LIBCOFF32)/objlst.mk
-
-$(LIBDIR)/libcoff32.a: $(LIBCOFF32-OBJ)
- +cd $(LIBCOFF32) && $(MAKE)
--- a/lib/coff32/objlst.mk
+++ /dev/null
@@ -1,9 +1,0 @@
-
-LIBCOFF32-OBJ = $(LIBCOFF32)/coff32_pack_hdr.o \
- $(LIBCOFF32)/coff32_unpack_hdr.o \
- $(LIBCOFF32)/coff32_pack_scn.o \
- $(LIBCOFF32)/coff32_unpack_scn.o \
- $(LIBCOFF32)/coff32_pack_aout.o \
- $(LIBCOFF32)/coff32_unpack_aout.o \
- $(LIBCOFF32)/coff32_pack_ent.o \
- $(LIBCOFF32)/coff32_unpack_ent.o
--- a/lib/crt/Makefile
+++ /dev/null
@@ -1,14 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../..
-include $(PROJECTDIR)/rules.mk
-
-DIRS = amd64-sysv-linux amd64-sysv-openbsd amd64-sysv-netbsd
-
-all: $(DIRS)
-
-$(DIRS): FORCE
- @cd $@ && $(MAKE)
-
-clean:
- $(FORALL)
--- a/lib/crt/amd64-sysv-linux/Makefile
+++ /dev/null
@@ -1,9 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../../..
-include $(PROJECTDIR)/rules.mk
-
-CRT = $(LIBDIR)/amd64-sysv-linux/crt.o
-TARGETS = $(CRT)
-
-include ../common.mk
--- a/lib/crt/amd64-sysv-linux/crt.s
+++ /dev/null
@@ -1,8 +1,0 @@
- .file "crt.s"
-
- .text
- .global _start
-_start:
- call main
- movl %eax, %edi
- jmp exit
--- a/lib/crt/amd64-sysv-netbsd/Makefile
+++ /dev/null
@@ -1,9 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../../..
-include $(PROJECTDIR)/rules.mk
-
-CRT = $(LIBDIR)/amd64-sysv-netbsd/crt.o
-TARGETS = $(CRT)
-
-include ../common.mk
--- a/lib/crt/amd64-sysv-netbsd/crt.s
+++ /dev/null
@@ -1,30 +1,0 @@
- .file "crt.s"
-
- .section .note.netbsd.ident
- .long 7
- .long 4
- .long 1
- .ascii "NetBSD\0"
- .p2align 2
- .long 200000000
-
- .bss
- .globl _environ
-_environ:
- .quad 0
-
- .text
- .align 8
- .global _start
-_start:
- andq $-16,%rsp
- movq %rsp,%rbp
-
- movq (%rbp),%rdi # rdi = argc
- leaq 8(%rbp),%rsi # rsi = argv
- leaq 16(%rbp,%rdi,8),%rdx # rdx = envp = argv +8*argc + 8
- movq %rdx,_environ
-
- call main
- movl %eax,%edi
- jmp exit
--- a/lib/crt/amd64-sysv-openbsd/Makefile
+++ /dev/null
@@ -1,9 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ../../..
-include $(PROJECTDIR)/rules.mk
-
-CRT = $(LIBDIR)/amd64-sysv-openbsd/crt.o
-TARGETS = $(CRT)
-
-include ../common.mk
--- a/lib/crt/amd64-sysv-openbsd/crt.s
+++ /dev/null
@@ -1,18 +1,0 @@
- .file "crt.s"
-
- .section ".note.openbsd.ident", "a"
- .p2align 2
- .long 8
- .long 4
- .long 1
- .ascii "OpenBSD\0"
- .long 0
- .p2align 2
-
- .text
- .align 8
- .global _start
-_start:
- call main
- movl %eax, %edi
- jmp exit
--- a/lib/crt/common.mk
+++ /dev/null
@@ -1,8 +1,0 @@
-all: $(TARGETS)
-
-$(CRT): crt.o
- cp crt.o $@
-
-clean:
- rm -f *.o
- rm -f $(TARGETS)
--- a/lib/crt/i386-sysv-linux/crt.s
+++ /dev/null
@@ -1,1 +1,0 @@
-/* TODO */
--- a/lib/crt/i386-sysv-openbsd/crt.s
+++ /dev/null
@@ -1,1 +1,0 @@
-/* TODO */
--- a/lib/crt/z80-scc-none/crt.s
+++ /dev/null
@@ -1,8 +1,0 @@
- .file "crt.s"
-
- .text
- .global _start
-_start:
- call main
-# ex %de,%hl
- call exit
--- a/lib/scc/Makefile
+++ /dev/null
@@ -1,21 +1,0 @@
-
-PROJECTDIR = ../..
-LIBSCC = .
-include $(PROJECTDIR)/rules.mk
-include objlst.mk
-
-TARGET = $(LIBDIR)/libscc.a
-
-all: $(TARGET)
-
-$(TARGET): $(LIBSCC-OBJ)
- $(AR) $(ARFLAGS) $@ $?
- ranlib $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f *.o $(LIBDIR)/libscc.a
-
-include deps.mk
--- a/lib/scc/alloc.c
+++ /dev/null
@@ -1,112 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/alloc.c";
-#include <stdlib.h>
-#include "../../inc/scc.h"
-
-/*
- * This is the most pedantic piece of code that I have written
- * in my life. The next union is used to enforce the aligmnet
- * of the address returned by new(). A union has the aligment
- * of the field with the biggest aligment. This union has all
- * the types that we use in scc, and we round all the address
- * to the aligment of this struct, so we can be sure that any
- * pointer using that address will be safe. The field ap is
- * in the union to be sure that struct pointers are included
- * in the list, although they will have the same aligment or
- * smaller than void *, but I wanted to be pedantic.
- */
-union hdr {
- union hdr *next;
- struct arena *ap;
- char c;
- unsigned char uc;
- int i;
- short s;
- long l;
- long long ll;
- float f;
- double d;
- long double ld;
- void *vp;
-};
-
-struct arena {
- struct arena *next;
- union hdr *array;
-};
-
-struct alloc {
- size_t size;
- size_t nmemb;
- size_t padding;
- struct arena *arena;
- union hdr *freep;
-};
-
-static void
-newarena(Alloc *allocp)
-{
- struct arena *ap;
- union hdr *bp, *lim;
- size_t unit, n = allocp->nmemb;
-
- unit = (allocp->size-1) / sizeof(union hdr) + 1;
- ap = xmalloc(sizeof(struct arena));
- ap->array = xmalloc(unit * sizeof(union hdr) * n);
-
- bp = ap->array;
- for (lim = &bp[unit * (n-1)]; bp < lim; bp += unit)
- bp->next = bp + unit;
- bp->next = NULL;
-
- ap->next = allocp->arena;
- allocp->arena = ap;
- allocp->freep = ap->array;
-}
-
-Alloc *
-alloc(size_t size, size_t nmemb)
-{
- Alloc *allocp = xmalloc(sizeof(*allocp));
-
- allocp->size = size;
- allocp->nmemb = nmemb;
- allocp->arena = NULL;
- allocp->freep = NULL;
-
- return allocp;
-}
-
-void
-dealloc(Alloc *allocp)
-{
- struct arena *ap, *next;
-
- for (ap = allocp->arena; ap; ap = next) {
- next = ap->next;
- free(ap->array);
- free(ap);
- }
- free(allocp);
-}
-
-void *
-new(Alloc *allocp)
-{
- union hdr *bp;
-
- if (!allocp->freep)
- newarena(allocp);
- bp = allocp->freep;
- allocp->freep = bp->next;
-
- return bp;
-}
-
-void
-delete(Alloc *allocp, void *p)
-{
- union hdr *bp = p;
-
- bp->next = allocp->freep;
- allocp->freep = bp;
-}
--- a/lib/scc/bpack.c
+++ /dev/null
@@ -1,64 +1,0 @@
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "../../inc/scc.h"
-
-int
-bpack(unsigned char *dst, char *fmt, ...)
-{
- unsigned char *bp, *cp;
- unsigned s;
- unsigned long l;
- unsigned long long q;
- size_t n;
- int d;
- va_list va;
-
- bp = dst;
- va_start(va, fmt);
- while (*fmt) {
- switch (*fmt++) {
- case '\'':
- for (n = 0; isdigit(*fmt); n += d) {
- n *= 10;
- d = *fmt++ - '0';
- }
- cp = va_arg(va, unsigned char *);
- while (n--)
- *bp++ = *cp++;
- break;
- case 'c':
- *bp++ = va_arg(va, unsigned);
- break;
- case 's':
- s = va_arg(va, unsigned);
- *bp++ = s >> 8;
- *bp++ = s;
- break;
- case 'l':
- l = va_arg(va, unsigned long);
- *bp++ = l >> 24;
- *bp++ = l >> 16;
- *bp++ = l >> 8;
- *bp++ = l;
- break;
- case 'q':
- q = va_arg(va, unsigned long long);
- *bp++ = q >> 56;
- *bp++ = q >> 48;
- *bp++ = q >> 40;
- *bp++ = q >> 32;
- *bp++ = q >> 24;
- *bp++ = q >> 16;
- *bp++ = q >> 8;
- *bp++ = q;
- break;
- default:
- va_end(va);
- return -1;
- }
- }
- va_end(va);
-
- return bp - dst;
-}
--- a/lib/scc/bunpack.c
+++ /dev/null
@@ -1,71 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/lunpack.c";
-
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "../../inc/scc.h"
-
-int
-lunpack(unsigned char *src, char *fmt, ...)
-{
- unsigned char *bp, *cp;
- unsigned short *sp;
- unsigned s;
- unsigned long *lp, l;
- unsigned long long *qp, q;
- va_list va;
- size_t n;
- int d;
-
- bp = src;
- va_start(va, fmt);
- while (*fmt) {
- switch (*fmt++) {
- case '\'':
- for (n = 0; isdigit(*fmt); n += d) {
- n *= 10;
- d = *fmt++ - '0';
- }
- cp = va_arg(va, unsigned char *);
- while (n--)
- *cp++ = *bp++;
- break;
- case 'c':
- cp = va_arg(va, unsigned char *);
- *cp = *bp++;
- break;
- case 's':
- sp = va_arg(va, unsigned short *);
- s = (unsigned) *bp++ << 8;
- s |= (unsigned) *bp++;
- *sp = s;
- break;
- case 'l':
- lp = va_arg(va, unsigned long *);
- l = (unsigned long) *bp++ << 24;
- l |= (unsigned long) *bp++ << 16;
- l |= (unsigned long) *bp++ << 8;
- l |= (unsigned long) *bp++;
- *lp = l;
- break;
- case 'q':
- qp = va_arg(va, unsigned long long *);
- q = (unsigned long long) *bp++ << 56;
- q |= (unsigned long long) *bp++ << 48;
- q |= (unsigned long long) *bp++ << 40;
- q |= (unsigned long long) *bp++ << 32;
- q |= (unsigned long long) *bp++ << 24;
- q |= (unsigned long long) *bp++ << 16;
- q |= (unsigned long long) *bp++ << 8;
- q |= (unsigned long long) *bp++;
- *qp = q;
- break;
- default:
- va_end(va);
- return -1;
- }
- }
- va_end(va);
-
- return bp - src;
-}
--- a/lib/scc/casecmp.c
+++ /dev/null
@@ -1,11 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/casecmp.c";
-#include <ctype.h>
-#include "../../inc/scc.h"
-
-int
-casecmp(const char *s1, const char *s2)
-{
- while (*s1 && toupper(*s1) == toupper(*s2))
- ++s1, ++s2;
- return *s1 - *s2;
-}
--- a/lib/scc/debug.c
+++ /dev/null
@@ -1,20 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/debug.c";
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "../../inc/scc.h"
-
-int debug;
-
-void
-dbg(const char *fmt, ...)
-{
- if (!debug)
- return;
- va_list va;
- va_start(va, fmt);
- vfprintf(stderr, fmt, va);
- putc('\n', stderr);
- va_end(va);
- return;
-}
--- a/lib/scc/deps.mk
+++ /dev/null
@@ -1,18 +1,0 @@
-#deps
-alloc.o: ../../inc/scc.h
-bpack.o: ../../inc/scc.h
-bunpack.o: ../../inc/scc.h
-casecmp.o: ../../inc/scc.h
-debug.o: ../../inc/scc.h
-die.o: ../../inc/scc.h
-lpack.o: ../../inc/scc.h
-lunpack.o: ../../inc/scc.h
-newitem.o: ../../inc/scc.h
-rmyro.o: ../../inc/myro.h
-rmyro.o: ../../inc/scc.h
-wmyro.o: ../../inc/myro.h
-wmyro.o: ../../inc/scc.h
-xcalloc.o: ../../inc/scc.h
-xmalloc.o: ../../inc/scc.h
-xrealloc.o: ../../inc/scc.h
-xstrdup.o: ../../inc/scc.h
--- a/lib/scc/die.c
+++ /dev/null
@@ -1,20 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/die.c";
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "../../inc/scc.h"
-
-int failure;
-
-void
-die(const char *fmt, ...)
-{
- failure = 1;
- va_list va;
- va_start(va, fmt);
- vfprintf(stderr, fmt, va);
- putc('\n', stderr);
- va_end(va);
- exit(1);
-}
--- a/lib/scc/libdep.mk
+++ /dev/null
@@ -1,4 +1,0 @@
-include $(LIBSCC)/objlst.mk
-
-$(LIBDIR)/libscc.a: $(LIBSCC-OBJ)
- +@cd $(LIBSCC) && $(MAKE)
--- a/lib/scc/lpack.c
+++ /dev/null
@@ -1,64 +1,0 @@
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "../../inc/scc.h"
-
-int
-lpack(unsigned char *dst, char *fmt, ...)
-{
- unsigned char *bp, *cp;
- unsigned s;
- unsigned long l;
- unsigned long long q;
- size_t n;
- int d;
- va_list va;
-
- bp = dst;
- va_start(va, fmt);
- while (*fmt) {
- switch (*fmt++) {
- case '\'':
- for (n = 0; isdigit(*fmt); n += d) {
- n *= 10;
- d = *fmt++ - '0';
- }
- cp = va_arg(va, unsigned char *);
- while (n--)
- *bp++ = *cp++;
- break;
- case 'c':
- *bp++ = va_arg(va, unsigned);
- break;
- case 's':
- s = va_arg(va, unsigned);
- *bp++ = s;
- *bp++ = s >> 8;
- break;
- case 'l':
- l = va_arg(va, unsigned long);
- *bp++ = l;
- *bp++ = l >> 8;
- *bp++ = l >> 16;
- *bp++ = l >> 24;
- break;
- case 'q':
- q = va_arg(va, unsigned long long);
- *bp++ = q;
- *bp++ = q >> 8;
- *bp++ = q >> 16;
- *bp++ = q >> 24;
- *bp++ = q >> 32;
- *bp++ = q >> 40;
- *bp++ = q >> 48;
- *bp++ = q >> 56;
- break;
- default:
- va_end(va);
- return -1;
- }
- }
- va_end(va);
-
- return bp - dst;
-}
--- a/lib/scc/lunpack.c
+++ /dev/null
@@ -1,71 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/lunpack.c";
-
-#include <ctype.h>
-#include <stdarg.h>
-
-#include "../../inc/scc.h"
-
-int
-lunpack(unsigned char *src, char *fmt, ...)
-{
- unsigned char *bp, *cp;
- unsigned short *sp;
- unsigned s;
- unsigned long *lp, l;
- unsigned long long *qp, q;
- va_list va;
- size_t n;
- int d;
-
- bp = src;
- va_start(va, fmt);
- while (*fmt) {
- switch (*fmt++) {
- case '\'':
- for (n = 0; isdigit(*fmt); n += d) {
- n *= 10;
- d = *fmt++ - '0';
- }
- cp = va_arg(va, unsigned char *);
- while (n--)
- *cp++ = *bp++;
- break;
- case 'c':
- cp = va_arg(va, unsigned char *);
- *cp = *bp++;
- break;
- case 's':
- sp = va_arg(va, unsigned short *);
- s = (unsigned) *bp++;
- s |= (unsigned) *bp++ << 8;
- *sp = s;
- break;
- case 'l':
- lp = va_arg(va, unsigned long *);
- l = (unsigned long) *bp++;
- l |= (unsigned long) *bp++ << 8;
- l |= (unsigned long) *bp++ << 16;
- l |= (unsigned long) *bp++ << 24;
- *lp = l;
- break;
- case 'q':
- qp = va_arg(va, unsigned long long *);
- q = (unsigned long long) *bp++;
- q |= (unsigned long long) *bp++ << 8;
- q |= (unsigned long long) *bp++ << 16;
- q |= (unsigned long long) *bp++ << 24;
- q |= (unsigned long long) *bp++ << 32;
- q |= (unsigned long long) *bp++ << 40;
- q |= (unsigned long long) *bp++ << 48;
- q |= (unsigned long long) *bp++ << 56;
- *qp = q;
- break;
- default:
- va_end(va);
- return -1;
- }
- }
- va_end(va);
-
- return bp - src;
-}
--- a/lib/scc/newitem.c
+++ /dev/null
@@ -1,12 +1,0 @@
-#include "../../inc/scc.h"
-
-void
-newitem(struct items *items, char *item)
-{
- if ((items->n + 1) < items->n)
- die("overflow in newitem (%u + 1)", items->n);
-
- items->s = xrealloc(items->s, (items->n + 1) * sizeof(char **));
- items->s[items->n++] = item;
-}
-
--- a/lib/scc/objlst.mk
+++ /dev/null
@@ -1,16 +1,0 @@
-
-LIBSCC-OBJ = $(LIBSCC)/debug.o \
- $(LIBSCC)/die.o \
- $(LIBSCC)/newitem.o \
- $(LIBSCC)/xcalloc.o \
- $(LIBSCC)/xmalloc.o \
- $(LIBSCC)/xrealloc.o \
- $(LIBSCC)/xstrdup.o \
- $(LIBSCC)/alloc.o \
- $(LIBSCC)/casecmp.o \
- $(LIBSCC)/lunpack.o \
- $(LIBSCC)/lpack.o \
- $(LIBSCC)/bunpack.o \
- $(LIBSCC)/bpack.o \
- $(LIBSCC)/wmyro.o \
- $(LIBSCC)/rmyro.o \
--- a/lib/scc/rmyro.c
+++ /dev/null
@@ -1,94 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/rmyro.c";
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "../../inc/scc.h"
-#include "../../inc/myro.h"
-
-int
-rdmyrohdr(FILE *fp, struct myrohdr *hdr)
-{
- unsigned char buf[MYROHDR_SIZ];
- int len;
-
- fread(buf, sizeof(buf), 1, fp);
- if (ferror(fp))
- return EOF;
- len = lunpack(buf, "cccclqqqqq",
- hdr->magic+0, hdr->magic+1,
- hdr->magic+2, hdr->magic+3,
- &hdr->format,
- &hdr->entry,
- &hdr->strsize,
- &hdr->secsize,
- &hdr->symsize,
- &hdr->relsize);
- assert(len == MYROHDR_SIZ);
-
- return len;
-}
-
-int
-rdmyrosec(FILE *fp, struct myrosect *sect)
-{
- unsigned char buf[MYROSECT_SIZ];
- int len;
-
- fread(buf, sizeof(buf), 1, fp);
- if (ferror(fp))
- return EOF;
- len = lunpack(buf, "lsccqq",
- §->name,
- §->flags,
- §->fill,
- §->aligment,
- §->offset,
- §->len);
- assert(len == MYROSECT_SIZ);
-
- return len;
-}
-
-int
-rdmyrosym(FILE *fp, struct myrosym *sym)
-{
- unsigned char buf[MYROSYM_SIZ];
- int len;
-
- fread(buf, sizeof(buf), 1, fp);
- if (ferror(fp))
- return EOF;
- len = lunpack(buf, "llccqq",
- &sym->name,
- &sym->type,
- &sym->section,
- &sym->flags,
- &sym->offset,
- &sym->len);
- assert(len == MYROSYM_SIZ);
-
- return len;
-}
-
-int
-rdmyrorel(FILE *fp, struct myrorel *rel)
-{
- unsigned char buf[MYROREL_SIZ];
- int len;
-
- fread(buf, sizeof(buf), 1, fp);
- if (ferror(fp))
- return EOF;
- len = lunpack(buf, "lccccq",
- &rel->id,
- &rel->flags,
- &rel->size,
- &rel->nbits,
- &rel->shift,
- &rel->offset);
- assert(len == MYROREL_SIZ);
-
- return len;
-}
--- a/lib/scc/wmyro.c
+++ /dev/null
@@ -1,86 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/wmyro.c";
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "../../inc/scc.h"
-#include "../../inc/myro.h"
-
-int
-wrmyrohdr(FILE *fp, struct myrohdr *hdr)
-{
- unsigned char buf[MYROHDR_SIZ];
- int len;
-
- len = lpack(buf, "cccclqqqqq",
- hdr->magic[0], hdr->magic[1],
- hdr->magic[2], hdr->magic[3],
- hdr->format,
- hdr->entry,
- hdr->strsize,
- hdr->secsize,
- hdr->symsize,
- hdr->relsize);
- assert(MYROHDR_SIZ == len);
- fwrite(buf, len, 1, fp);
-
- return (ferror(fp)) ? EOF : len;
-}
-
-int
-wrmyrosec(FILE *fp, struct myrosect *sect)
-{
- unsigned char buf[MYROSECT_SIZ];
- int len;
-
- len = lpack(buf, "lsccqq",
- sect->name,
- sect->flags,
- sect->fill,
- sect->aligment,
- sect->offset,
- sect->len);
- assert(MYROSECT_SIZ == len);
- fwrite(buf, len, 1, fp);
-
- return (ferror(fp)) ? EOF : len;
-}
-
-int
-wrmyrosym(FILE *fp, struct myrosym *sym)
-{
- unsigned char buf[MYROSYM_SIZ];
- int len;
-
- len = lpack(buf, "llccqq",
- sym->name,
- sym->type,
- sym->section,
- sym->flags,
- sym->offset,
- sym->len);
- assert(MYROSYM_SIZ == len);
- fwrite(buf, len, 1, fp);
-
- return (ferror(fp)) ? EOF : len;
-}
-
-int
-wrmyrorel(FILE *fp, struct myrorel *rel)
-{
- unsigned char buf[MYROREL_SIZ];
- int len;
-
- len = lpack(buf, "lccccq",
- rel->id,
- rel->flags,
- rel->size,
- rel->nbits,
- rel->shift,
- rel->offset);
- assert(MYROREL_SIZ == len);
- fwrite(buf, len, 1, fp);
-
- return (ferror(fp)) ? EOF : len;
-}
--- a/lib/scc/xcalloc.c
+++ /dev/null
@@ -1,13 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/xcalloc.c";
-#include <stdlib.h>
-#include "../../inc/scc.h"
-
-void *
-xcalloc(size_t n, size_t size)
-{
- void *p = calloc(n, size);
-
- if (!p)
- die("out of memory");
- return p;
-}
--- a/lib/scc/xmalloc.c
+++ /dev/null
@@ -1,13 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/xmalloc.c";
-#include <stdlib.h>
-#include "../../inc/scc.h"
-
-void *
-xmalloc(size_t size)
-{
- void *p = malloc(size);
-
- if (!p)
- die("out of memory");
- return p;
-}
--- a/lib/scc/xrealloc.c
+++ /dev/null
@@ -1,13 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/xrealloc.c";
-#include <stdlib.h>
-#include "../../inc/scc.h"
-
-void *
-xrealloc(void *buff, size_t size)
-{
- void *p = realloc(buff, size);
-
- if (!p)
- die("out of memory");
- return p;
-}
--- a/lib/scc/xstrdup.c
+++ /dev/null
@@ -1,12 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/xstrdup.c";
-#include <string.h>
-#include "../../inc/scc.h"
-
-char *
-xstrdup(const char *s)
-{
- size_t len = strlen(s) + 1;
- char *p = xmalloc(len);
-
- return memcpy(p, s, len);
-}
--- a/mkdep.sh
+++ /dev/null
@@ -1,19 +1,0 @@
-#!/bin/sh
-
-set -e
-
-(echo '/^#deps/+;$c'
-
-for i in `find . -name '*.c'`
-do
- file=`basename $i | sed 's/\.c$/.o/'`
-
- dir=`dirname $i |
- sed -e 's,^\./,,' -e 's,^\.$,,' -e 's,...*[^/],&/,'`
-
- sed -n "/#include \"/ s,#include \"\(.*\)\",$dir$file: $dir\1,p" $i
-done |
-LC_ALL=C sort -s
-
-echo .
-echo w) | ed -s deps.mk
--- a/nm/Makefile
+++ /dev/null
@@ -1,22 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-OBJ = main.o coff32.o formats.o
-
-all: $(BINDIR)/nm
-
-$(BINDIR)/nm: $(OBJ) $(LIBDIR)/libscc.a
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f $(BINDIR)/nm *.o
-
-distclean: clean
-
-include deps.mk
--- a/nm/coff32.c
+++ /dev/null
@@ -1,312 +1,0 @@
-static char sccsid[] = "@(#) ./nm/coff.c";
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/coff32/filehdr.h"
-#include "../inc/coff32/scnhdr.h"
-#include "../inc/coff32/syms.h"
-#include "../inc/scc.h"
-#include "nm.h"
-
-static int (*unpack)(unsigned char *, char *, ...);
-static long strtbl, symtbl, sectbl;
-static SCNHDR *sections;
-static struct symbol *syms;
-static size_t nsect, nsyms;
-
-static char
-typeof(SYMENT *ent)
-{
- SCNHDR *sec;
- int c;
- long flags;
-
- switch (ent->n_scnum) {
- case N_DEBUG:
- c = 'n';
- break;
- case N_ABS:
- c = 'a';
- break;
- case N_UNDEF:
- c = (ent->n_value != 0) ? 'C' : 'U';
- break;
- default:
- if (ent->n_scnum > nsect)
- die("nm: incorrect section index");
- sec = §ions[ent->n_scnum-1];
- flags = sec->s_flags;
- if (flags & STYP_TEXT)
- c = 't';
- else if (flags & STYP_DATA)
- c = 'd';
- else if (flags & STYP_BSS)
- c = 'b';
- else
- c = '?';
- break;
- }
-
- if (ent->n_sclass == C_EXT)
- c = toupper(c);
-
- return c;
-}
-
-static char *
-getsname(char *fname, FILE *fp, SYMENT *ent)
-{
- int c;
- size_t len;
- char *s, *err;
- fpos_t pos;
-
- if (ent->n_zeroes != 0) {
- for (len = 0; len < E_SYMNMLEN && ent->n_name[len]; ++len)
- ;
- s = xmalloc(len+1);
- s[len] = '\0';
- return memcpy(s, ent->n_name, len);
- }
-
- /* TODO: read the string table in memory before reading symbols */
- fgetpos(fp, &pos);
- fseek(fp, strtbl, SEEK_SET);
- fseek(fp, ent->n_offset, SEEK_CUR);
-
- if (ferror(fp))
- goto error;
-
- s = NULL;
- for (len = 1; (c = getc(fp)) != EOF; len++) {
- s = xrealloc(s, len);
- if ((s[len-1] = c) == '\0')
- break;
- }
- if (c == EOF)
- goto error;
- fsetpos(fp, &pos);
- return s;
-
-error:
- err = (!ferror(fp)) ?
- "EOF before reading strings" : strerror(errno);
- die("nm: %s: %s", fname, err);
-}
-
-static void
-getfsym(unsigned char *buff, SYMENT *ent)
-{
- int n;
-
- n = (*unpack)(buff,
- "'8lsscc",
- &ent->n_name,
- &ent->n_value,
- &ent->n_scnum,
- &ent->n_type,
- &ent->n_sclass,
- &ent->n_numaux);
- assert(n == SYMESZ);
-}
-
-static void
-getsymbol(char *fname, FILE *fp,
- unsigned char *buff, SYMENT *ent, struct symbol *sym)
-{
- char *nam;
-
- getfsym(buff, ent);
- nam = ent->n_name;
- if (nam[0] == 0 && nam[1] == 0 && nam[2] == 0 && nam[3] == 0) {
- long zero, offset;
-
- (*unpack)(nam, "ll", &zero, &offset);
- ent->n_zeroes = zero;
- ent->n_offset = offset;
- }
- sym->name = getsname(fname, fp, ent);
- sym->type = typeof(ent);
- sym->value = ent->n_value;
- sym->size = (sym->type == 'C') ? ent->n_value : 0;
-}
-
-static void
-getsyms(char *fname, char *member, FILE *fp, FILHDR *hdr)
-{
- size_t n, i;
- unsigned aux;
- unsigned char buff[SYMESZ];
- SYMENT ent;
-
- if (hdr->f_nsyms > SIZE_MAX)
- die("nm: %s:Too many symbols\n", member);
-
- n = hdr->f_nsyms;
- syms = xcalloc(sizeof(*syms), n);
-
- if (fseek(fp, symtbl, SEEK_SET) == EOF)
- die("nm: %s:%s", fname, strerror(errno));
-
- aux = nsyms = 0;
- for (i = 0; i < n; i++) {
- if (fread(buff, SYMESZ, 1, fp) != 1)
- break;
- if (aux > 0) {
- aux--;
- continue;
- }
- getsymbol(member, fp, buff, &ent, &syms[nsyms++]);
- aux = ent.n_numaux;
- }
- if (n != i) {
- char *err;
-
- err = (!ferror(fp)) ?
- "EOF before reading symbols" : strerror(errno);
- die("nm: %s: %s", fname, err);
- }
-}
-
-static void
-getfsec(unsigned char *buff, SCNHDR *sec)
-{
- int n;
-
- n = (*unpack)(buff,
- "'8llllllssl",
- sec->s_name,
- &sec->s_paddr,
- &sec->s_vaddr,
- &sec->s_size,
- &sec->s_scnptr,
- &sec->s_relptr,
- &sec->s_lnnoptr,
- &sec->s_nrelloc,
- &sec->s_nlnno,
- &sec->s_flags);
- assert(n == SCNHSZ);
-}
-
-static void
-getsects(char *fname, char *member, FILE *fp, FILHDR *hdr)
-{
- size_t i;
- char buff[SCNHSZ];
-
- nsect = hdr->f_nscns;
- if (nsect == 0)
- return;
-
- if (nsect > SIZE_MAX)
- die("nm: %s:Too many sections\n", member);
-
- if (fseek(fp, sectbl, SEEK_SET) == EOF)
- die("nm: %s:%s", member, strerror(errno));
-
- sections = xcalloc(sizeof(*sections), nsect);
- for (i = 0; i < nsect; i++) {
- if (fread(buff, SCNHSZ, 1, fp) != 1)
- break;
- getfsec(buff, §ions[i]);
- }
- if (i != nsect) {
- char *err;
-
- err = (!ferror(fp)) ?
- "EOF before reading sections" : strerror(errno);
- die("nm: %s: %s", fname, err);
- }
-}
-
-static void
-getfhdr(unsigned char *buff, FILHDR *hdr)
-{
- int n;
-
- n = (*unpack)(buff,
- "sslllss",
- &hdr->f_magic,
- &hdr->f_nscns,
- &hdr->f_timdat,
- &hdr->f_symptr,
- &hdr->f_nsyms,
- &hdr->f_opthdr,
- &hdr->f_flags);
- assert(n == FILHSZ);
-}
-
-static int
-nm(char *fname, char *member, FILE *fp)
-{
- unsigned char buff[FILHSZ];
- FILHDR hdr;
- long pos = ftell(fp);
-
- if (fread(buff, FILHSZ, 1, fp) != 1) {
- if (!ferror(fp))
- return 0;
- die("nm: %s: %s", fname, strerror(errno));
- }
-
- getfhdr(buff, &hdr);
- if ((hdr.f_flags & F_SYMS) != 0 || hdr.f_nsyms == 0) {
- fprintf(stderr, "nm: %s: no symbols\n", member);
- return 1;
- }
-
- /* TODO: Check overflow */
- strtbl = pos + hdr.f_symptr + hdr.f_nsyms* SYMESZ;
- symtbl = pos + hdr.f_symptr;
- sectbl = pos + FILHSZ + hdr.f_opthdr;
-
- getsects(fname, member, fp, &hdr);
- getsyms(fname, member, fp, &hdr);
- printsyms(fname, member, syms, nsyms);
-
- free(sections);
- free(syms);
- return 1;
-}
-
-static int
-probe(char *fname, char *member, FILE *fp)
-{
- int c;
- int c1, c2;
- fpos_t pos;
- unsigned short magic;
-
- fgetpos(fp, &pos);
- c1 = getc(fp);
- c2 = getc(fp);
- fsetpos(fp, &pos);
-
- if (ferror(fp))
- die("nm: %s: %s", fname, strerror(errno));
-
- if (c1 == EOF || c2 == EOF)
- return 0;
- magic = c1 | c2 << 8;
-
- switch (magic) {
- case COFF_I386MAGIC:
- case COFF_Z80MAGIC:
- unpack = lunpack;
- return 1;
- default:
- unpack = NULL;
- return 0;
- }
-}
-
-struct objfile coff32 = {
- .probe = probe,
- .nm = nm,
-};
--- a/nm/deps.mk
+++ /dev/null
@@ -1,12 +1,0 @@
-
-#deps
-coff32.o: ../inc/coff32/filehdr.h
-coff32.o: ../inc/coff32/scnhdr.h
-coff32.o: ../inc/coff32/syms.h
-coff32.o: ../inc/scc.h
-coff32.o: nm.h
-formats.o: nm.h
-main.o: ../inc/ar.h
-main.o: ../inc/arg.h
-main.o: ../inc/scc.h
-main.o: nm.h
--- a/nm/formats.c
+++ /dev/null
@@ -1,13 +1,0 @@
-static char sccsid[] = "@(#) ./nm/probe.c";
-
-#include <stdio.h>
-
-#include "nm.h"
-
-/* TODO: Autogenerate this file */
-struct objfile coff32;
-
-struct objfile *formats[] = {
- &coff32,
- NULL,
-};
--- a/nm/main.c
+++ /dev/null
@@ -1,272 +1,0 @@
-static char sccsid[] = "@(#) ./nm/main.c";
-
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/arg.h"
-#include "../inc/scc.h"
-#include "../inc/ar.h"
-#include "nm.h"
-
-char *argv0;
-static int radix = 16;
-static int Pflag;
-static int Aflag;
-static int vflag;
-static int gflag;
-static int uflag;
-static int arflag;
-
-static int
-object(char *fname, char *member, FILE *fp)
-{
- extern struct objfile *formats[];
- struct objfile **p, *obj;
- void *data;
-
- for (p = formats; *p; ++p) {
- obj = *p;
- if ((*obj->probe)(fname, member, fp))
- break;
- }
- if (*p == NULL)
- return 0;
- return (*obj->nm)(fname, member, fp);
-}
-
-static char *
-getfname(struct ar_hdr *hdr, char *dst)
-{
- char *p;
- int i;
-
- memcpy(dst, hdr->ar_name, SARNAM);
- dst[SARNAM] = '\0';
-
- for (i = SARNAM-1; i >= 0; i--) {
- if (dst[i] != ' ' && dst[i] != '/')
- break;
- dst[i] = '\0';
- }
- return dst;
-}
-
-static void
-ar(char *fname, FILE *fp)
-{
- struct ar_hdr hdr;
- long pos, siz;
- char member[SARNAM+1];
-
- arflag = 1;
- if (fseek(fp, SARMAG, SEEK_SET) == EOF)
- goto file_error;
-
- while (fread(&hdr, sizeof(hdr), 1, fp) == 1) {
- pos = ftell(fp);
- if (strncmp(hdr.ar_fmag, ARFMAG, sizeof(hdr.ar_fmag)))
- goto corrupted;
-
- siz = 0;
- sscanf(hdr.ar_size, "%10ld", &siz);
- if (siz == 0)
- goto corrupted;
-
- if (siz & 1)
- siz++;
- if (pos == -1 || pos > LONG_MAX - siz)
- die("nm: %s: overflow in size of archive", fname);
- pos += siz;
-
- getfname(&hdr, member);
- if (!object(fname, member, fp)) {
- fprintf(stderr,
- "nm: skipping member %s in archive %s\n",
- member, fname);
- }
- if (fseek(fp, pos, SEEK_SET) == EOF)
- goto file_error;
- }
- if (ferror(fp))
- goto file_error;
- return;
-
-corrupted:
- die("nm: %s: corrupted archive", fname);
-file_error:
- die("nm: %s: %s", fname, strerror(errno));
-}
-
-static int
-archive(char *fname, FILE *fp)
-{
- char magic[SARMAG];
- fpos_t pos;
-
- fgetpos(fp, &pos);
- fread(magic, SARMAG, 1, fp);
- fsetpos(fp, &pos);
-
- if (ferror(fp))
- die("nm: %s: %s", fname, strerror(errno));
- if (strncmp(magic, ARMAG, SARMAG) != 0)
- return 0;
-
- ar(fname, fp);
- return 1;
-}
-
-static void
-printsym(char *file, char *member, struct symbol *sym)
-{
- char *fmt;
- int type = sym->type;
-
- if (type == '?')
- return;
-
- if (uflag && type != 'U')
- return;
-
- if (gflag && !isupper(type))
- return;
-
- if (Aflag)
- printf((arflag) ? "%s[%s]: " : "%s: ", file, member);
- if (Pflag) {
- printf("%s %c", sym->name, sym->type);
- if (type != 'U') {
- if (radix == 8)
- fmt = " %016.16llo %lo";
- else if (radix == 10)
- fmt = " %016.16llu %lu";
- else
- fmt = " %016.16llx %lx";
- printf(fmt, sym->value, sym->size);
- }
- } else {
- if (type == 'U')
- fmt = " ";
- else if (radix == 8)
- fmt = "%016.16llo";
- else if (radix == 10)
- fmt = "%016.16lld";
- else
- fmt = "%016.16llx";
- printf(fmt, sym->value);
- printf(" %c %s", sym->type, sym->name);
- }
- putchar('\n');
-}
-
-static int
-cmp(const void *p1, const void *p2)
-{
- const struct symbol *s1 = p1, *s2 = p2;
-
- if (vflag) {
- if (s1->value > s2->value)
- return 1;
- if (s1->value < s2->value)
- return -1;
- if (s1->type == 'U' && s2->type == 'U')
- return 0;
- if (s1->type == 'U')
- return -1;
- if (s2->type == 'U')
- return 1;
- return 0;
- } else {
- return strcmp(s1->name, s2->name);
- }
-}
-
-void
-printsyms(char *file, char *member, struct symbol *syms, size_t nsyms)
-{
- qsort(syms, nsyms, sizeof(*syms), cmp);
-
- while (nsyms--)
- printsym(file, member, syms++);
-}
-
-static void
-doit(char *fname)
-{
- FILE *fp;
-
- arflag = 0;
-
- if ((fp = fopen(fname, "rb")) == NULL)
- die("nm: %s: %s", fname, strerror(errno));
-
- if (!object(fname, fname, fp) && !archive(fname, fp))
- die("nm: %s: File format not recognized", fname);
-
- if (ferror(fp))
- die("nm: %s: %s", fname, strerror(errno));
-
- fclose(fp);
-}
-
-static void
-usage(void)
-{
- fputs("nm [-APv][ -g| -u][-t format] [file...]\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- char *t;
-
- ARGBEGIN {
- case 'P':
- Pflag = 1;
- break;
- case 'A':
- Aflag = 1;
- break;
- case 'g':
- gflag = 1;
- break;
- case 'u':
- uflag = 1;
- break;
- case 'v':
- vflag = 1;
- break;
- case 't':
- t = EARGF(usage());
- if (!strcmp(t, "o"))
- radix = 8;
- else if (!strcmp(t, "d"))
- radix = 10;
- else if (!strcmp(t, "x"))
- radix = 16;
- else
- usage();
- break;
- default:
- usage();
- } ARGEND
-
- if (argc == 0) {
- doit("a.out");
- } else {
- for ( ; *argv; ++argv)
- doit(*argv);
- }
-
- fflush(stdout);
- if (ferror(stdout))
- die("nm: error writing in output");
-
- return 0;
-}
--- a/nm/nm.h
+++ /dev/null
@@ -1,14 +1,0 @@
-struct symbol {
- char *name;
- int type;
- unsigned long long value;
- unsigned long size;
-};
-
-struct objfile {
- int (*probe)(char *fname, char *member, FILE *fp);
- int (*nm)(char *fname, char *member, FILE *fp);
-};
-
-/* main.c */
-extern void printsyms(char *, char *, struct symbol *, size_t );
--- a/objdump/Makefile
+++ /dev/null
@@ -1,20 +1,0 @@
-.POSIX:
-
-PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
-include $(LIBSCC)/libdep.mk
-
-OBJ = main.o
-
-all: $(BINDIR)/objdump
-
-$(BINDIR)/objdump: $(OBJ) $(LIBDIR)/libscc.a
- $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
-dep:
- $(PROJECTDIR)/mkdep.sh
-
-clean:
- rm -f $(BINDIR)/objdump *.o
-
-include deps.mk
--- a/objdump/deps.mk
+++ /dev/null
@@ -1,4 +1,0 @@
-#deps
-main.o: ../inc/arg.h
-main.o: ../inc/myro.h
-main.o: ../inc/scc.h
--- a/objdump/main.c
+++ /dev/null
@@ -1,333 +1,0 @@
-#include <errno.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "../inc/arg.h"
-#include "../inc/scc.h"
-#include "../inc/myro.h"
-
-char *argv0;
-static char *strings;
-static size_t strsiz;
-
-struct obj_info {
- char *fname;
- FILE *fp;
- struct myrohdr hdr;
- fpos_t strpos;
- fpos_t secpos;
- fpos_t sympos;
- fpos_t relpos;
- fpos_t datapos;
-};
-
-static char *
-getstring(unsigned long off)
-{
- size_t n;
-
- if ((int32_t) off == -1)
- return "";
- if (off < SIZE_MAX) {
- for (n = off; n < strsiz && strings[n]; ++n)
- ;
- if (n < strsiz)
- return &strings[off];
- }
- fprintf(stderr, "objdump: wrong string offset %lu\n", off);
- return "";
-}
-
-static int
-printhdr(struct obj_info *obj)
-{
- struct myrohdr *hdr = &obj->hdr;
-
- printf("header:\n"
- " magic: %02x %02x %02x %02x \"%4.4s\"\n"
- " format: %lu (\"%s\")\n"
- " entry: %llu\n"
- " string table size: %llu\n"
- " section table size: %llu\n"
- " symbol table size: %llu\n"
- " relocation table size: %llu\n",
- hdr->magic[0], hdr->magic[1],
- hdr->magic[2], hdr->magic[3],
- hdr->magic,
- hdr->format, getstring(hdr->format),
- hdr->entry,
- hdr->strsize,
- hdr->secsize,
- hdr->symsize,
- hdr->relsize);
- return 0;
-}
-
-static int
-printstrings(struct obj_info *obj)
-{
- size_t off, begin;;
- char *s = NULL;
-
- puts("strings:");
- for (off = 0; off < strsiz; off++) {
- if (s == NULL) {
- s = &strings[off];
- begin = off;
- }
- if (strings[off] == '\0') {
- printf(" [%zd] \"%s\"\n", begin, s);
- s = NULL;
- }
- }
- return 0;
-}
-
-static char *
-sectflags(struct myrosect *sec)
-{
- static char flags[10];
- char *s = flags + sizeof(flags);
-
- if (sec->flags & MYROSEC_LOAD)
- *--s = 'L';
- if (sec->flags & MYROSEC_FILE)
- *--s = 'F';
- if (sec->flags & MYROSEC_ABS)
- *--s = 'A';
- if (sec->flags & MYROSEC_EXEC)
- *--s = 'X';
- if (sec->flags & MYROSEC_WRITE)
- *--s = 'W';
- if (sec->flags & MYROSEC_READ)
- *--s = 'R';
- return s;
-}
-
-static int
-printsections(struct obj_info *obj)
-{
- unsigned long long n, i;
- struct myrosect sect;
- struct myrohdr *hdr = &obj->hdr;
-
- printf("sections:\n"
- " [Nr]\t%s\t%-16s\t%-16s\t%s\t%s\t%s\n",
- "Name",
- "Offset",
- "Size",
- "Fill",
- "Align",
- "Flags");
-
- n = hdr->secsize / MYROSECT_SIZ;
- for (i = 0; i < n; ++i) {
- if (rdmyrosec(obj->fp, §) < 0)
- return -1;
- printf(" [%2llu]\t%s\t%016llX\t%016llX\t%02X\t%u\t%s\n",
- i,
- getstring(sect.name),
- sect.offset,
- sect.len,
- sect.fill,
- sect.aligment,
- sectflags(§));
- }
- return 0;
-}
-
-static char *
-symflags(struct myrosym *sym)
-{
- static char flags[10];
- char *s = flags + sizeof(flags);
-
- if (sym->flags & MYROSYM_COMMON)
- *--s = 'C';
- if (sym->flags & MYROSYM_EXTERN)
- *--s = 'G';
- if (sym->flags & MYROSYM_UNDEF)
- *s-- = 'U';
- return s;
-}
-
-static int
-printsymbols(struct obj_info *obj)
-{
- unsigned long long n, i;
- struct myrosym sym;
- struct myrohdr *hdr = &obj->hdr;
-
- printf("symbols:\n"
- " [Nr]\t%s\t%-16s\t%s\t%s\t%s\t%s\n",
- "Name",
- "Value",
- "Section",
- "Flags",
- "Size",
- "Type");
- n = hdr->symsize / MYROSYM_SIZ;
- for (i = 0; i < n; ++i) {
- if (rdmyrosym(obj->fp, &sym) < 0)
- return -1;
- printf(" [%2llu]\t%s\t%016llX\t%u\t%s\t%llu\t%s\n",
- i,
- getstring(sym.name),
- sym.offset,
- sym.section,
- symflags(&sym),
- sym.len,
- getstring(sym.type));
- }
- return 0;
-}
-
-static int
-printrelocs(struct obj_info *obj)
-{
- unsigned long long n, i;
- struct myrorel rel;
- struct myrohdr *hdr = &obj->hdr;
-
- printf("relocs:\n"
- " [Nr]\t%-16s\tType\tId\tSize\tNbits\tShift\n",
- "Offset");
- n = hdr->relsize / MYROREL_SIZ;
- for (i = 0; i < n; ++i) {
- if (rdmyrorel(obj->fp, &rel) < 0)
- return -1;
- printf(" [%2llu]\t%016llX\t%s\t%lu\t%u\t%u\t%u\n",
- i,
- rel.offset,
- (rel.id & 1<<31) ? "section" : "symbol",
- rel.id & ~(1<<31),
- rel.size,
- rel.nbits,
- rel.shift);
- }
- return 0;
-}
-
-static int
-printdata(struct obj_info *obj)
-{
- unsigned long long off;
- int c, i, j;
-
- puts("data:");
- for (off = 0; ; off += 32) {
- printf(" %016llX:", off);
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 8; j++) {
- if ((c = getc(obj->fp)) == EOF)
- goto exit_loop;
- printf(" %02X", c);
- }
- putchar('\t');
- }
- putchar('\n');
- }
-
-exit_loop:
- putchar('\n');
- return (ferror(obj->fp)) ? -1 : 0;
-}
-
-void
-dump(char *fname, FILE *fp)
-{
- struct obj_info obj;
- struct myrohdr *hdr;
-
- obj.fname = fname;
- obj.fp = fp;
- hdr = &obj.hdr;
-
- if (rdmyrohdr(obj.fp, hdr) < 0)
- goto wrong_file;
- if (strncmp(hdr->magic, MYROMAGIC, MYROMAGIC_SIZ)) {
- fprintf(stderr,
- "objdump: %s: File format not recognized\n",
- fname);
- return;
- }
- puts(fname);
- if (hdr->strsize > SIZE_MAX) {
- fprintf(stderr,
- "objdump: %s: overflow in header\n",
- fname);
- return;
- }
- strsiz = hdr->strsize;
-
- if (strsiz > 0) {
- strings = xmalloc(strsiz);
- fread(strings, strsiz, 1, fp);
- if (feof(fp))
- goto wrong_file;
- }
-
- if (printhdr(&obj) < 0)
- goto wrong_file;
- if (printstrings(&obj) < 0)
- goto wrong_file;
- if (printsections(&obj) < 0)
- goto wrong_file;
- if (printsymbols(&obj) < 0)
- goto wrong_file;
- if (printrelocs(&obj) < 0)
- goto wrong_file;
- if (printdata(&obj) < 0)
- goto wrong_file;
- return;
-
-wrong_file:
- fprintf(stderr,
- "objdump: %s: %s\n",
- fname, strerror(errno));
-}
-
-void
-doit(char *fname)
-{
- FILE *fp;
-
- if ((fp = fopen(fname, "rb")) == NULL) {
- fprintf(stderr, "objdump: %s: %s\n", fname, strerror(errno));
- return;
- }
- dump(fname, fp);
- fclose(fp);
-}
-
-void
-usage(void)
-{
- fputs("usage: objdump file ...\n", stderr);
- exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
- ARGBEGIN {
- default:
- usage();
- } ARGEND
-
- if (argc == 0)
- doit("a.out");
- else while (*argv) {
- free(strings);
- strings = NULL;
- doit(*argv++);
- }
-
- if (fclose(stdout) == EOF)
- die("objdump: stdout: %s", strerror(errno));
-
- return 0;
-}
--- a/root/bin/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/include/scc/assert.h
+++ /dev/null
@@ -1,8 +1,0 @@
-extern void __assert(char *exp, char *file, long line);
-
-#undef assert
-#ifndef NDEBUG
-# define assert(exp) ((exp) ? (void) 0 : __assert(#exp, __FILE__, __LINE__))
-#else
-# define assert(exp) ((void)0)
-#endif
--- a/root/include/scc/bits/.gitignore
+++ /dev/null
@@ -1,1 +1,0 @@
-errno.h
--- a/root/include/scc/bits/amd64/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MIN-1)
-#define CHAR_MAX 0x7F
-#define CHAR_MIN (-CHAR_MAX-1)
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX-1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-INT_MAX-1)
-#define UINT_MAX 0xFFFFFFFF
-#define LONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LONG_MIN (-LONG_MAX-1)
-#define ULONG_MAX 0xFFFFFFFFFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX-1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/root/include/scc/bits/amd64/arch/setjmp.h
+++ /dev/null
@@ -1,1 +1,0 @@
-typedef unsigned long long jmp_buf[8];
--- a/root/include/scc/bits/amd64/arch/stddef.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#ifndef _WCHAR_T
-typedef int wchar_t;
-#define _WCHAR_T
-#endif
-
-#ifndef _PTRDIFF_T
-typedef long ptrdiff_t;
-#define _PTRDIFF_T
-#endif
--- a/root/include/scc/bits/amd64/arch/stdint.h
+++ /dev/null
@@ -1,102 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX-1)
-#define UINT8_MAX 0xFF
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX-1)
-#define UINT16_MAX 0xFFFF
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX-1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX-1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT32_MIN
-#define INT_FAST8_MAX INT32_MAX
-#define UINT_FAST8_MAX UINT32_MAX
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST16_MAX INT32_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-#define UINTPTR_MAX UINT64_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT64_MIN
-#define PTRDIFF_MAX INT64_MAX
-
-#define SIG_ATOMIC_MIN INT32_MIN
-#define SIG_ATOMIC_MAX INT32_MAX
-
-#define SIZE_MAX UINT64_MAX
-
-#define WCHAR_MIN INT32_MIN
-#define WCHAR_MAX INT32_MAX
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned uint32_t;
-typedef unsigned long uint64_t;
-
-typedef signed char int8_least_t;
-typedef short int16_least_t;
-typedef int int32_least_t;
-typedef long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned short uint16_least_t;
-typedef unsigned uint32_least_t;
-typedef unsigned long uint64_least_t;
-
-typedef int int8_fast_t;
-typedef int int16_fast_t;
-typedef int int32_fast_t;
-typedef long int64_fast_t;
-
-typedef unsigned uint8_fast_t;
-typedef unsigned uint16_fast_t;
-typedef unsigned uint32_fast_t;
-typedef unsigned long uint64_fast_t;
-
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-typedef long intmax_t;
-typedef unsigned long uintmax_t;
--- a/root/include/scc/bits/amd64/arch/stdio.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "/tmp/tmp.0000000"
-
-typedef int fpos_t;
--- a/root/include/scc/bits/amd64/arch/stdlib.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#ifndef _WCHAR_T
-typedef int wchar_t;
-#define _WCHAR_T
-#endif
-
-#define _ALIGNTYPE long double
--- a/root/include/scc/bits/amd64/arch/string.h
+++ /dev/null
@@ -1,5 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#endif
-
-#define __NUMCHARS 128
\ No newline at end of file
--- a/root/include/scc/bits/amd64/arch/time.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define _MAXYEAR 9999
-
-typedef long int time_t;
--- a/root/include/scc/bits/arm32/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MIN - 1)
-#define CHAR_MAX 0x7F
-#define CHAR_MIN (-CHAR_MAX - 1)
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-INT_MAX - 1)
-#define UINT_MAX 0xFFFFFFFF
-#define LONG_MAX 0x7FFFFFFF
-#define LONG_MIN (-LONG_MAX - 1)
-#define ULONG_MAX 0xFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX - 1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/root/include/scc/bits/arm32/arch/setjmp.h
+++ /dev/null
@@ -1,1 +1,0 @@
-typedef unsigned long jmp_buf[10];
--- a/root/include/scc/bits/arm32/arch/stddef.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef SIZET_
-typedef unsigned int size_t;
-#define SIZET_
-#endif
-
-#ifndef _PTRDIFF_T
-typedef long ptrdiff_t;
-#define _PTRDIFF_T
-#endif
--- a/root/include/scc/bits/arm32/arch/stdint.h
+++ /dev/null
@@ -1,96 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX - 1)
-#define UINT8_MAX 0xFF
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX - 1)
-#define UINT16_MAX 0xFFFF
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX - 1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX - 1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT32_MIN
-#define INT_FAST8_MAX INT32_MAX
-#define UINT_FAST8_MAX UINT32_MAX
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST16_MAX INT32_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
-
-#define SIZE_MAX UINT32_MAX
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_least_t;
-typedef short int16_least_t;
-typedef int int32_least_t;
-typedef long long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned short uint16_least_t;
-typedef unsigned int uint32_least_t;
-typedef unsigned long long uint64_least_t;
-
-typedef int int8_fast_t;
-typedef int int16_fast_t;
-typedef int int32_fast_t;
-typedef long long int64_fast_t;
-
-typedef unsigned int uint8_fast_t;
-typedef unsigned int uint16_fast_t;
-typedef unsigned int uint32_fast_t;
-typedef unsigned long long uint64_fast_t;
-
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
--- a/root/include/scc/bits/arm32/arch/stdio.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef _SIZET
-typedef unsigned int size_t;
-#define _SIZET
-#endif
-
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "/tmp/tmp.0000000"
-
-typedef int fpos_t;
--- a/root/include/scc/bits/arm32/arch/stdlib.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef SIZET_
-typedef unsigned int size_t;
-#define SIZET_
-#endif
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#ifndef _WCHAR_T
-typedef int wchar_t; // TODO
-#define _WCHAR_T
-#endif
-
-#define _ALIGNTYPE long double
--- a/root/include/scc/bits/arm32/arch/string.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef SIZET_
-typedef unsigned int size_t;
-#define SIZET_
-#endif
-
-#define __NUMCHARS 128
--- a/root/include/scc/bits/arm32/arch/time.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _SIZET
-typedef unsigned int size_t;
-#define _SIZET
-#endif
-
-#define _MAXYEAR 9999
-
-typedef long int time_t;
--- a/root/include/scc/bits/arm64/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MIN - 1)
-#define CHAR_MAX 0x7F
-#define CHAR_MIN (-CHAR_MAX - 1)
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX - 1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-INT_MAX - 1)
-#define UINT_MAX 0xFFFFFFFF
-#define LONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LONG_MIN (-LONG_MAX - 1)
-#define ULONG_MAX 0xFFFFFFFFFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX - 1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/root/include/scc/bits/arm64/arch/setjmp.h
+++ /dev/null
@@ -1,1 +1,0 @@
-typedef unsigned long long jmp_buf[22];
--- a/root/include/scc/bits/arm64/arch/stddef.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef SIZET_
-typedef unsigned long size_t;
-#define SIZET_
-#endif
-
-#ifndef _PTRDIFF_T
-typedef long ptrdiff_t;
-#define _PTRDIFF_T
-#endif
--- a/root/include/scc/bits/arm64/arch/stdint.h
+++ /dev/null
@@ -1,96 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX - 1)
-#define UINT8_MAX 0xFFU
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX - 1)
-#define UINT16_MAX 0xFFFFU
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX - 1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX - 1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT32_MIN
-#define INT_FAST8_MAX INT32_MAX
-#define UINT_FAST8_MAX UINT32_MAX
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST16_MAX INT32_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT64_MIN
-#define INTPTR_MAX INT64_MAX
-#define UINTPTR_MAX UINT64_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT64_MIN
-#define PTRDIFF_MAX INT64_MAX
-
-#define SIZE_MAX UINT64_MAX
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_least_t;
-typedef short int16_least_t;
-typedef int int32_least_t;
-typedef long long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned short uint16_least_t;
-typedef unsigned int uint32_least_t;
-typedef unsigned long long uint64_least_t;
-
-typedef int int8_fast_t;
-typedef int int16_fast_t;
-typedef int int32_fast_t;
-typedef long long int64_fast_t;
-
-typedef unsigned int uint8_fast_t;
-typedef unsigned int uint16_fast_t;
-typedef unsigned int uint32_fast_t;
-typedef unsigned long long uint64_fast_t;
-
-typedef long intptr_t;
-typedef unsigned long uintptr_t;
-
-typedef long intmax_t;
-typedef unsigned long uintmax_t;
--- a/root/include/scc/bits/arm64/arch/stdio.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "/tmp/tmp.0000000"
-
-typedef int fpos_t;
--- a/root/include/scc/bits/arm64/arch/stdlib.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef SIZET_
-typedef unsigned long size_t;
-#define SIZET_
-#endif
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#ifndef _WCHAR_T
-typedef int wchar_t;
-#define _WCHAR_T
-#endif
-
-#define _ALIGNTYPE long double
--- a/root/include/scc/bits/arm64/arch/string.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef SIZET_
-typedef unsigned long size_t;
-#define SIZET_
-#endif
-
-#define __NUMCHARS 128
--- a/root/include/scc/bits/arm64/arch/time.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define _MAXYEAR 9999
-
-typedef long int time_t;
--- a/root/include/scc/bits/dragonfly/sys.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#define O_RDONLY 0x00000000
-#define O_WRONLY 0x00000001
-#define O_RDWR 0x00000002
-
-#define O_TRUNC 0x00000400
-#define O_APPEND 0x00000008
-#define O_CREAT 0x00000200
-
-typedef int pid_t;
-
-struct sigaction {
- void (*sa_handler)(int);
- char sa_mask[8];
- int sa_flags;
-};
-
-extern pid_t _getpid(void);
-extern int _kill(pid_t pid, int signum);
-extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- a/root/include/scc/bits/dragonfly/sys/signal.h
+++ /dev/null
@@ -1,27 +1,0 @@
-typedef int sig_atomic_t;
-
-#define SIG_ERR ((void (*)(int))-1)
-#define SIG_DFL ((void (*)(int)) 0)
-#define SIG_IGN ((void (*)(int)) 1)
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGABRT 6
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGSEGV 11
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGSTOP 17
-#define SIGTSTP 18
-#define SIGCONT 19
-#define SIGCHLD 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGUSR1 30
-#define SIGUSR2 31
-
-#define __NR_SIGNALS 32
--- a/root/include/scc/bits/i386/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MIN-1)
-#define CHAR_MAX 0x7F
-#define CHAR_MIN (-CHAR_MAX-1)
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX-1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFFFFFF
-#define INT_MIN (-INT_MAX-1)
-#define UINT_MAX 0xFFFFFFFF
-#define LONG_MAX 0x7FFFFFFF
-#define LONG_MIN (-LONG_MAX-1)
-#define ULONG_MAX 0xFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX-1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/root/include/scc/bits/i386/arch/stddef.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#ifndef _WCHAR_T
-typedef int wchar_t;
-#define _WCHAR_T
-#endif
-
-#ifndef _PTRDIFF_T
-typedef long ptrdiff_t;
-#define _PTRDIFF_T
-#endif
--- a/root/include/scc/bits/i386/arch/stdint.h
+++ /dev/null
@@ -1,115 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX-1)
-#define UINT8_MAX 0xFF
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX-1)
-#define UINT16_MAX 0xFFFF
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX-1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX-1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT32_MIN
-#define INT_FAST8_MAX INT32_MAX
-#define UINT_FAST8_MAX UINT32_MAX
-
-#define INT_FAST16_MIN INT32_MIN
-#define INT_FAST16_MAX INT32_MAX
-#define UINT_FAST16_MAX UINT32_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT32_MIN
-#define INTPTR_MAX INT32_MAX
-#define UINTPTR_MAX UINT32_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT32_MIN
-#define PTRDIFF_MAX INT32_MAX
-
-#define SIG_ATOMIC_MIN INT32_MIN
-#define SIG_ATOMIC_MAX INT32_MAX
-
-#define SIZE_MAX UINT32_MAX
-
-#define WCHAR_MIN INT32_MIN
-#define WCHAR_MAX INT32_MAX
-
-#define INT8_C(x) x
-#define INT16_C(x) x
-#define INT32_C(x) x
-#define INT64_C(x) x ## LL
-
-#define UINT8_C(x) x
-#define UINT16_C(x) x
-#define UINT32_C(x) x ## U
-#define UINT64_C(x) x ## ULL
-
-#define INTMAX_C(x) x ## LL
-#define UINTMAX_C(x) x ## ULL
-
-typedef signed char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_least_t;
-typedef short int16_least_t;
-typedef int int32_least_t;
-typedef long long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned short uint16_least_t;
-typedef unsigned uint32_least_t;
-typedef unsigned long long uint64_least_t;
-
-typedef int int8_fast_t;
-typedef int int16_fast_t;
-typedef int int32_fast_t;
-typedef long long int64_fast_t;
-
-typedef unsigned uint8_fast_t;
-typedef unsigned uint16_fast_t;
-typedef unsigned uint32_fast_t;
-typedef unsigned long long uint64_fast_t;
-
-typedef int intptr_t;
-typedef unsigned uintptr_t;
-
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
--- a/root/include/scc/bits/i386/arch/stdio.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "/tmp/tmp.0000000"
-
-typedef long fpos_t;
--- a/root/include/scc/bits/i386/arch/stdlib.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#ifndef _WCHAR_T
-typedef int wchar_t;
-#define _WCHAR_T
-#endif
-
-#define _ALIGNTYPE long double
--- a/root/include/scc/bits/i386/arch/string.h
+++ /dev/null
@@ -1,5 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#endif
-
-#define __NUMCHARS 128
--- a/root/include/scc/bits/i386/arch/time.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _SIZET
-typedef unsigned long size_t;
-#define _SIZET
-#endif
-
-#define _MAXYEAR 2037
-
-typedef long int time_t;
--- a/root/include/scc/bits/linux/sys.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#define O_RDONLY 0x00000000
-#define O_WRONLY 0x00000001
-#define O_RDWR 0x00000002
-
-#define O_TRUNC 0x00000400
-#define O_APPEND 0x00000008
-#define O_CREAT 0x00000200
-
-typedef int pid_t;
-
-struct sigaction {
- void (*sa_handler)(int);
- int sa_mask;
- int sa_flags;
-};
-
-extern pid_t _getpid(void);
-extern int _kill(pid_t pid, int signum);
-extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- a/root/include/scc/bits/linux/sys/signal.h
+++ /dev/null
@@ -1,27 +1,0 @@
-typedef int sig_atomic_t;
-
-#define SIG_ERR ((void (*)(int))-1)
-#define SIG_DFL ((void (*)(int)) 0)
-#define SIG_IGN ((void (*)(int)) 1)
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGABRT 6
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGUSR1 10
-#define SIGSEGV 11
-#define SIGUSR2 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGCHLD 17
-#define SIGCONT 18
-#define SIGSTOP 19
-#define SIGTSTP 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-
-#define __NR_SIGNALS 23
--- a/root/include/scc/bits/netbsd/sys.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#define O_RDONLY 0x00000000
-#define O_WRONLY 0x00000001
-#define O_RDWR 0x00000002
-
-#define O_TRUNC 0x00000400
-#define O_APPEND 0x00000008
-#define O_CREAT 0x00000200
-
-typedef int pid_t;
-
-struct sigaction {
- void (*sa_handler)(int);
- char sa_mask[8];
- int sa_flags;
-};
-
-extern pid_t _getpid(void);
-extern int _kill(pid_t pid, int signum);
-extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- a/root/include/scc/bits/netbsd/sys/signal.h
+++ /dev/null
@@ -1,27 +1,0 @@
-typedef int sig_atomic_t;
-
-#define SIG_ERR ((void (*)(int))-1)
-#define SIG_DFL ((void (*)(int)) 0)
-#define SIG_IGN ((void (*)(int)) 1)
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGABRT 6
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGSEGV 11
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGSTOP 17
-#define SIGTSTP 18
-#define SIGCONT 19
-#define SIGCHLD 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGUSR1 30
-#define SIGUSR2 31
-
-#define __NR_SIGNALS 32
--- a/root/include/scc/bits/openbsd/sys.h
+++ /dev/null
@@ -1,19 +1,0 @@
-#define O_RDONLY 0x00000000
-#define O_WRONLY 0x00000001
-#define O_RDWR 0x00000002
-
-#define O_TRUNC 0x00000400
-#define O_APPEND 0x00000008
-#define O_CREAT 0x00000200
-
-typedef int pid_t;
-
-struct sigaction {
- void (*sa_handler)(int);
- int sa_mask;
- int sa_flags;
-};
-
-extern pid_t _getpid(void);
-extern int _kill(pid_t pid, int signum);
-extern int _sigaction(int sig, struct sigaction *new, struct sigaction *old);
--- a/root/include/scc/bits/openbsd/sys/signal.h
+++ /dev/null
@@ -1,27 +1,0 @@
-typedef int sig_atomic_t;
-
-#define SIG_ERR ((void (*)(int))-1)
-#define SIG_DFL ((void (*)(int)) 0)
-#define SIG_IGN ((void (*)(int)) 1)
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGABRT 6
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGSEGV 11
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGSTOP 17
-#define SIGTSTP 18
-#define SIGCONT 19
-#define SIGCHLD 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGUSR1 30
-#define SIGUSR2 31
-
-#define __NR_SIGNALS 32
--- a/root/include/scc/bits/z80/arch/limits.h
+++ /dev/null
@@ -1,18 +1,0 @@
-#define CHAR_BIT 8
-#define SCHAR_MAX 0x7F
-#define SCHAR_MIN (-SCHAR_MIN-1)
-#define CHAR_MAX 0xFF
-#define CHAR_MIN 0
-#define UCHAR_MAX 0xFF
-#define SHRT_MAX 0x7FFF
-#define SHRT_MIN (-SHRT_MAX-1)
-#define USHRT_MAX 0xFFFF
-#define INT_MAX 0x7FFF
-#define INT_MIN (-INT_MAX-1)
-#define UINT_MAX 0xFFFF
-#define LONG_MAX 0x7FFFFFFF
-#define LONG_MIN (-LONG_MAX-1)
-#define ULONG_MAX 0xFFFFFFFF
-#define LLONG_MAX 0x7FFFFFFFFFFFFFFF
-#define LLONG_MIN (-LLONG_MAX-1)
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFF
--- a/root/include/scc/bits/z80/arch/stddef.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned size_t;
-#define _SIZET
-#endif
-
-#ifndef _WCHAR_T
-typedef short wchar_t;
-#define _WCHAR_T
-#endif
-
-#ifndef _PTRDIFF_T
-typedef short ptrdiff_t;
-#define _PTRDIFF_T
-#endif
--- a/root/include/scc/bits/z80/arch/stdint.h
+++ /dev/null
@@ -1,115 +1,0 @@
-#define INT8_MAX 0x7F
-#define INT8_MIN (-INT8_MAX-1)
-#define UINT8_MAX 0xFF
-
-#define INT16_MAX 0x7FFF
-#define INT16_MIN (-INT16_MAX-1)
-#define UINT16_MAX 0xFFFF
-
-#define INT32_MAX 0x7FFFFFFF
-#define INT32_MIN (-INT32_MAX-1)
-#define UINT32_MAX 0xFFFFFFFF
-
-#define INT64_MAX 0x7FFFFFFFFFFFFFFF
-#define INT64_MIN (-INT64_MAX-1)
-#define UINT64_MAX 0xFFFFFFFFFFFFFFFF
-
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-#define INT_FAST8_MIN INT16_MIN
-#define INT_FAST8_MAX INT16_MAX
-#define UINT_FAST8_MAX UINT16_MAX
-
-#define INT_FAST16_MIN INT16_MIN
-#define INT_FAST16_MAX INT16_MAX
-#define UINT_FAST16_MAX UINT16_MAX
-
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-#define INTPTR_MIN INT16_MIN
-#define INTPTR_MAX INT16_MAX
-#define UINTPTR_MAX UINT16_MAX
-
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-#define PTRDIFF_MIN INT16_MIN
-#define PTRDIFF_MAX INT16_MAX
-
-#define SIG_ATOMIC_MIN INT16_MIN
-#define SIG_ATOMIC_MAX INT16_MAX
-
-#define SIZE_MAX UINT64_MAX
-
-#define WCHAR_MIN INT16_MIN
-#define WCHAR_MAX INT16_MAX
-
-#define INT8_C(x) x
-#define INT16_C(x) x
-#define INT32_C(x) x ## L
-#define INT64_C(x) x ## LL
-
-#define UINT8_C(x) x
-#define UINT16_C(x) x ## U
-#define UINT32_C(x) x ## UL
-#define UINT64_C(x) x ## ULL
-
-#define INTMAX_C(x) x ## LL
-#define UINTMAX_C(x) x ## ULL
-
-typedef signed char int8_t;
-typedef int int16_t;
-typedef long int32_t;
-typedef long long int64_t;
-
-typedef unsigned char uint8_t;
-typedef unsigned uint16_t;
-typedef unsigned long uint32_t;
-typedef unsigned long long uint64_t;
-
-typedef signed char int8_least_t;
-typedef int int16_least_t;
-typedef long int32_least_t;
-typedef long long int64_least_t;
-
-typedef unsigned char uint8_least_t;
-typedef unsigned uint16_least_t;
-typedef unsigned long uint32_least_t;
-typedef unsigned long long uint64_least_t;
-
-typedef signed char int8_fast_t;
-typedef int int16_fast_t;
-typedef long int32_fast_t;
-typedef long long int64_fast_t;
-
-typedef unsigned char uint8_fast_t;
-typedef unsigned uint16_fast_t;
-typedef unsigned long uint32_fast_t;
-typedef unsigned long long uint64_fast_t;
-
-typedef int intptr_t;
-typedef unsigned uintptr_t;
-
-typedef long long intmax_t;
-typedef unsigned long long uintmax_t;
--- a/root/include/scc/bits/z80/arch/stdio.h
+++ /dev/null
@@ -1,15 +1,0 @@
-#ifndef _SIZET
-typedef unsigned size_t;
-#define _SIZET
-#endif
-
-#define BUFSIZ 512
-#define FILENAME_MAX 256
-#define FOPEN_MAX 16
-
-#define TMP_MAX 25
-#define L_tmpnam 256
-
-#define _TMPNAME "TMP.000"
-
-typedef long fpos_t;
--- a/root/include/scc/bits/z80/arch/stdlib.h
+++ /dev/null
@@ -1,14 +1,0 @@
-#ifndef _SIZET
-typedef unsigned size_t;
-#define _SIZET
-#endif
-
-#define EXIT_FAILURE 1
-#define EXIT_SUCCESS 0
-
-#ifndef _WCHAR_T
-typedef short wchar_t;
-#define _WCHAR_T
-#endif
-
-#define _ALIGNTYPE int
--- a/root/include/scc/bits/z80/arch/string.h
+++ /dev/null
@@ -1,5 +1,0 @@
-#ifndef _SIZET
-typedef unsigned size_t;
-#endif
-
-#define __NUMCHARS 128
--- a/root/include/scc/bits/z80/arch/time.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _SIZET
-typedef unsigned size_t;
-#define _SIZET
-#endif
-
-#define _MAXYEAR 2037
-
-typedef long time_t;
--- a/root/include/scc/ctype.h
+++ /dev/null
@@ -1,45 +1,0 @@
-#ifndef _CTYPE_H
-#define _CTYPE_H
-
-extern int isalnum(int c);
-extern int isalpha(int c);
-extern int islower(int c);
-extern int isupper(int c);
-extern int isdigit(int c);
-extern int isxdigit(int c);
-extern int iscntrl(int c);
-extern int isgraph(int c);
-extern int isspace(int c);
-extern int isblank(int c);
-extern int isprint(int c);
-extern int ispunct(int c);
-extern int tolower(int c);
-extern int toupper(int c);
-
-
-#define _U 0x01 /* upper */
-#define _L 0x02 /* lower */
-#define _D 0x04 /* digit */
-#define _C 0x08 /* cntrl */
-#define _P 0x10 /* punct */
-#define _S 0x20 /* white space (space/lf/tab) */
-#define _X 0x40 /* hex char */
-#define _SP 0x80 /* hard space (0x20) */
-
-extern const unsigned char __ctype[];
-
-#define isalnum(c) ((__ctype+1)[c] & (_U|_L|_D))
-#define isalpha(c) ((__ctype+1)[c] & (_U|_L))
-#define iscntrl(c) ((__ctype+1)[c] & (_C))
-#define isdigit(c) ((__ctype+1)[c] & (_D))
-#define isgraph(c) ((__ctype+1)[c] & (_P|_U|_L|_D))
-#define islower(c) ((__ctype+1)[c] & (_L))
-#define isprint(c) ((__ctype+1)[c] & (_P|_U|_L|_D|_SP))
-#define ispunct(c) ((__ctype+1)[c] & (_P))
-#define isspace(c) ((__ctype+1)[c] & (_S))
-#define isupper(c) ((__ctype+1)[c] & (_U))
-#define isxdigit(c) ((__ctype+1)[c] & (_D|_X))
-
-#define isascii(c) ((unsigned)(c)<=0x7f)
-
-#endif
--- a/root/include/scc/errno.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef _ERRNO_H
-#define _ERRNO_H
-
-#include <sys/errno.h>
-
-#endif
--- a/root/include/scc/float.h
+++ /dev/null
@@ -1,1 +1,0 @@
-/* TODO: Placeholder for compatibility with libraries that need to include it */
--- a/root/include/scc/limits.h
+++ /dev/null
@@ -1,8 +1,0 @@
-#ifndef _LIMITS_H
-#define _LIMITS_H
-
-#include <arch/limits.h>
-
-#define MB_LEN_MAX 1
-
-#endif
--- a/root/include/scc/locale.h
+++ /dev/null
@@ -1,39 +1,0 @@
-#ifndef _LOCALE_H
-#define _LOCALE_H
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define LC_ALL 0
-#define LC_COLLATE 1
-#define LC_CTYPE 2
-#define LC_MONETARY 3
-#define LC_NUMERIC 4
-#define LC_TIME 5
-
-struct lconv {
- char *decimal_point;
- char *thousands_sep;
- char *grouping;
- char *mon_decimal_point;
- char *mon_thousands_sep;
- char *mon_grouping;
- char *positive_sign;
- char *negative_sign;
- char *currency_symbol;
- char *int_curr_symbol;
- char frac_digits;
- char p_cs_precedes;
- char n_cs_precedes;
- char p_sep_by_space;
- char n_sep_by_space;
- char p_sign_posn;
- char n_sign_posn;
- char int_frac_digits;
-};
-
-extern char *setlocale(int category, const char *locale);
-extern struct lconv *localeconv(void);
-
-#endif
--- a/root/include/scc/math.h
+++ /dev/null
@@ -1,4 +1,0 @@
-#ifndef _MATH_H
-#define _MATH_H
-#error math.h is not supported yet
-#endif
--- a/root/include/scc/setjmp.h
+++ /dev/null
@@ -1,11 +1,0 @@
-#ifndef _SETJMP_H
-#define _SETJMP_H
-
-#include <arch/setjmp.h>
-
-extern int setjmp(jmp_buf env);
-extern void longjmp(jmp_buf env, int val);
-
-#define setjmp setjmp
-
-#endif
--- a/root/include/scc/signal.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef _SIGNAL_H
-#define _SIGNAL_H
-
-#include <sys/signal.h>
-
-void ( *signal(int signum, void (*handler)(int)) ) (int);
-int raise(int sig);
-
-#endif
--- a/root/include/scc/stdarg.h
+++ /dev/null
@@ -1,10 +1,0 @@
-#ifndef _STDARG_H
-#define _STDARG_H
-
-typedef __builtin_va_list va_list;
-#define va_start(ap, last) __builtin_va_start(ap, last)
-#define va_end(ap) __builtin_va_end(ap)
-#define va_copy(to, from) __builtin_va_copy(to, from)
-#define va_arg(to, type) __builtin_va_arg(to, type)
-
-#endif
--- a/root/include/scc/stdbool.h
+++ /dev/null
@@ -1,9 +1,0 @@
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
-
-#define bool _Bool
-#define true 1
-#define false 0
-#define __bool_true_false_are_defined 1
-
-#endif
--- a/root/include/scc/stddef.h
+++ /dev/null
@@ -1,12 +1,0 @@
-#ifndef _STDDEF_H
-#define _STDDEF_H
-
-#include <arch/stddef.h>
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define offsetof(st, m) ((size_t)&(((st *)0)->m))
-
-#endif
--- a/root/include/scc/stdint.h
+++ /dev/null
@@ -1,6 +1,0 @@
-#ifndef _STDINT_H_
-#define _STDINT_H_
-
-#include <arch/stdint.h>
-
-#endif
--- a/root/include/scc/stdio.h
+++ /dev/null
@@ -1,123 +1,0 @@
-#ifndef _STDIO_H
-#define _STDIO_H
-
-#include <arch/stdio.h>
-
-#ifndef FOPEN_MAX
-#define FOPEN_MAX 12
-#endif
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define EOF -1
-#define SEEK_CUR 0
-#define SEEK_END 1
-#define SEEK_SET 2
-
-
-#define _IOWRITE (1 << 0)
-#define _IOREAD (1 << 1)
-#define _IORW (1 << 2)
-#define _IOEOF (1 << 3)
-#define _IOERR (1 << 4)
-#define _IOSTRG (1 << 5)
-#define _IOTXT (1 << 6)
-#define _IOFBF (1 << 7)
-#define _IOLBF (1 << 8)
-#define _IONBF (1 << 9)
-#define _IOALLOC (1 <<10)
-
-typedef struct {
- int fd; /* file descriptor */
- unsigned char *buf; /* pointer to i/o buffer */
- unsigned char *rp; /* read pointer */
- unsigned char *wp; /* write pointer */
- unsigned char *lp; /* write pointer used when line-buffering */
- size_t len; /* actual length of buffer */
- unsigned short flags;
- unsigned char unbuf[1]; /* tiny buffer for unbuffered io */
-} FILE;
-
-extern FILE __iob[FOPEN_MAX];
-
-#define stdin (&__iob[0])
-#define stdout (&__iob[1])
-#define stderr (&__iob[2])
-
-extern int remove(const char *filename);
-extern int rename(const char *old, const char *new);
-extern FILE *tmpfile(void);
-extern char *tmpnam(char *s);
-extern int fclose(FILE *fp);
-extern int fflush(FILE *fp);
-extern FILE *fopen(const char * restrict fname, const char * restrict mode);
-extern FILE *freopen(const char * restrict fname, const char * restrict mode,
- FILE * restrict fp);
-extern void setbuf(FILE * restrict fp, char * restrict buf);
-extern int setvbuf(FILE * restrict fp,
- char * restrict buf, int mode, size_t size);
-extern int fprintf(FILE * restrict fp, const char * restrict fmt, ...);
-extern int fscanf(FILE * restrict fp, const char * restrict fmt, ...);
-extern int printf(const char * restrict fmt, ...);
-extern int scanf(const char * restrict fmt, ...);
-extern int snprintf(char * restrict s,
- size_t n, const char * restrict fmt, ...);
-extern int sprintf(char * restrict s, const char * restrict fmt, ...);
-extern int sscanf(const char * restrict s, const char * restrict fmt, ...);
-
-#ifdef _STDARG_H
-extern int vfprintf(FILE * restrict fp,
- const char * restrict fmt, va_list arg);
-extern int vfscanf(FILE * restrict fp,
- const char * restrict fmt, va_list arg);
-extern int vprintf(const char * restrict fmt, va_list arg);
-extern int vscanf(const char * restrict fmt, va_list arg);
-extern int vsnprintf(char * restrict s, size_t n, const char * restrict fmt,
- va_list arg);
-extern int vsprintf(char * restrict s,
- const char * restrict fmt, va_list arg);
-extern int vsscanf(const char * restrict s,
- const char * restrict fmt, va_list arg);
-#endif
-
-extern int fgetc(FILE *fp);
-extern char *fgets(char * restrict s, int n, FILE * restrict fp);
-extern int fputc(int c, FILE *fp);
-extern int fputs(const char * restrict s, FILE * restrict fp);
-extern int getc(FILE *fp);
-extern int getchar(void);
-extern char *gets(char *s);
-extern int putc(int c, FILE *fp);
-extern int putchar(int c);
-extern int puts(const char *s);
-extern int ungetc(int c, FILE *fp);
-extern size_t fread(void * restrict ptr, size_t size, size_t nmemb,
- FILE * restrict fp);
-extern size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb,
- FILE * restrict fp);
-extern int fgetpos(FILE * restrict fp, fpos_t * restrict pos);
-extern int fseek(FILE *fp, long int offset, int whence);
-extern int fsetpos(FILE *fp, const fpos_t *pos);
-extern long int ftell(FILE *fp);
-extern void rewind(FILE *fp);
-extern void clearerr(FILE *fp);
-extern int feof(FILE *fp);
-extern int ferror(FILE *fp);
-extern void perror(const char *s);
-
-extern int __getc(FILE *fp);
-extern int __putc(int, FILE *fp);
-
-#define getc(fp) ((fp)->rp >= (fp)->wp ? __getc(fp) : *(fp)->rp++)
-#define putc(c, fp) ((fp)->wp >= (fp)->rp ? __putc(c,fp) : (*(fp)->wp++ = c))
-
-#define ferror(fp) ((fp)->flags & _IOERR)
-#define feof(fp) ((fp)->flags & _IOEOF)
-#define clearerr(fp) (void) ((fp)->flags &= ~(_IOERR|_IOEOF))
-#define getchar() getc(stdin)
-#define putchar(c) putc((c), stdout)
-#define setbuf(fp, b) (void) setvbuf(fp, b, b ? _IOFBF:_IONBF, BUFSIZ)
-
-#endif
--- a/root/include/scc/stdlib.h
+++ /dev/null
@@ -1,69 +1,0 @@
-#ifndef _STDLIB_H
-#define _STDLIB_H
-
-#include <arch/stdlib.h>
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define _ATEXIT_MAX 32
-
-#define MB_CUR_MAX 1
-#define RAND_MAX 32767
-
-typedef struct {
- int quot, rem;
-} div_t;
-
-typedef struct {
- long quot, rem;
-} ldiv_t;
-
-typedef struct {
- long long quot, rem;
-} lldiv_t;
-
-extern double atof(const char *nptr);
-extern int atoi(const char *nptr);
-extern long int atol(const char *nptr);
-extern long long int atoll(const char *nptr);
-extern double strtod(const char * restrict nptr, char ** restrict endptr);
-extern float strtof(const char * restrict nptr, char ** restrict endptr);
-extern long double strtold(const char * restrict nptr, char ** restrict endptr);
-extern long int strtol(const char * restrict nptr, char ** restrict endptr, int base);
-extern long long int strtoll(const char * restrict nptr, char ** restrict endptr,
- int base);
-extern unsigned long int strtoul(const char * restrict nptr, char ** restrict endptr,
- int base);
-extern unsigned long long int strtoull(const char * restrict nptr,
- char ** restrict endptr, int base);
-extern int rand(void);
-extern void srand(unsigned int seed);
-extern void *calloc(size_t nmemb, size_t size);
-extern void free(void *ptr);
-extern void *malloc(size_t size);
-extern void *realloc(void *ptr, size_t size);
-extern void abort(void);
-extern int atexit(void (*func)(void));
-extern void exit(int status);
-extern void _Exit(int status);
-extern char *getenv(const char *name);
-extern int system(const char *string);
-extern void *bsearch(const void *key, const void *base, size_t nmemb, size_t size,
- int (*compar)(const void *, const void *));
-extern void qsort(void *base, size_t nmemb, size_t size,
- int (*compar)(const void *, const void *));
-extern int abs(int j);
-extern long int labs(long int j);
-extern long long int llabs(long long int j);
-extern div_t div(int numer, int denom);
-extern ldiv_t ldiv(long int numer, long int denom);
-extern lldiv_t lldiv(long long int numer, long long int denom);
-extern int mblen(const char *s, size_t n);
-extern int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n);
-extern int wctomb(char *s, wchar_t wchar);
-extern size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n);
-extern size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n);
-
-#endif
--- a/root/include/scc/string.h
+++ /dev/null
@@ -1,34 +1,0 @@
-#ifndef _STRING_H
-#define _STRING_H
-
-#include <arch/string.h>
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-extern void *memcpy(void * restrict s1, const void * restrict s2, size_t n);
-extern void *memmove(void *s1, const void *s2, size_t n);
-extern char *strcpy(char * restrict s1, const char * restrict s2);
-extern char *strncpy(char * restrict s1, const char * restrict s2, size_t n);
-extern char *strcat(char * restrict s1, const char * restrict s2);
-extern char *strncat(char * restrict s1, const char * restrict s2, size_t n);
-extern int memcmp(const void *s1, const void *s2, size_t n);
-extern int strcmp(const char *s1, const char *s2);
-extern int strcoll(const char *s1, const char *s2);
-extern int strncmp(const char *s1, const char *s2, size_t n);
-extern size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n);
-extern void *memchr(const void *s, int c, size_t n);
-extern char *strchr(const char *s, int c);
-extern size_t strcspn(const char *s1, const char *s2);
-extern char *strpbrk(const char *s1, const char *s2);
-extern char *strrchr(const char *s, int c);
-extern size_t strspn(const char *s1, const char *s2);
-extern char *strstr(const char *s1, const char *s2);
-extern char *strtok(char * restrict s1, const char * restrict s2);
-extern void *memset(void *s, int c, size_t n);
-extern char *strerror(int errnum);
-extern size_t strlen(const char *s);
-extern size_t strnlen(const char *s, size_t maxlen);
-
-#endif
--- a/root/include/scc/time.h
+++ /dev/null
@@ -1,43 +1,0 @@
-#ifndef _TIME_H
-#define _TIME_H
-
-#include <arch/time.h>
-
-#ifndef NULL
-#define NULL ((void *) 0)
-#endif
-
-#define CLOCKS_PER_SEC 1000000
-
-typedef long int clock_t;
-
-struct tm {
- int tm_sec;
- int tm_min;
- int tm_hour;
- int tm_mday;
- int tm_mon;
- int tm_year;
- int tm_wday;
- int tm_yday;
- int tm_isdst;
-
- /* fields used internally */
-
- char *tm_zone;
- long tm_gmtoff;
-};
-
-extern clock_t clock(void);
-extern double difftime(time_t time1, time_t time0);
-extern time_t mktime(struct tm *timeptr);
-extern time_t time(time_t *timer);
-extern char *asctime(const struct tm *timeptr);
-extern char *ctime(const time_t *timer);
-extern struct tm *gmtime(const time_t *timer);
-extern struct tm *localtime(const time_t *timer);
-extern size_t strftime(char * restrict s, size_t maxsize,
- const char * restrict format,
- const struct tm * restrict timeptr);
-
-#endif
--- a/root/include/scc/wchar.h
+++ /dev/null
@@ -1,92 +1,0 @@
-#ifndef _WCHAR_H
-#define _WCHAR_H
-
-/* TODO: This is only a placeholder */
-typedef long wchar_t;
-/* typedef long size_t; */
-typedef long mbstate_t;
-typedef long wint_t;
-struct tm;
-
-/* #define WCHAR_MAX 1 */
-/* #define WCHAR_MIN 1 */
-/* #define WEOF -1 */
-/* #define NULL 0 */
-
-#ifdef _STDARG_H
-extern int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg);
-extern int vwprintf(const wchar_t * restrict format, va_list arg);
-extern int vwscanf(const wchar_t * restrict format, va_list arg);
-#endif
-
-#ifdef _STDIO_H
-extern int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...);
-extern int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...);
-
-#ifdef _STDARG_H
-extern int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
-extern int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg);
-extern int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg);
-#endif
-
-extern wint_t fgetwc(FILE *stream);
-extern wint_t fputwc(wchar_t c, FILE *stream);
-extern wint_t getwc(FILE *stream);
-extern wint_t putwc(wchar_t c, FILE *stream);
-extern int fwide(FILE *stream, int mode);
-extern wint_t ungetwc(wint_t c, FILE *stream);
-extern wchar_t *fgetws(wchar_t * restrict s, int n, FILE * restrict stream);
-extern int fputws(const wchar_t * restrict s, FILE * restrict stream);
-#endif
-
-extern int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...);
-extern int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...);
-extern int wprintf(const wchar_t * restrict format, ...);
-extern int wscanf(const wchar_t * restrict format, ...);
-
-extern wint_t getwchar(void);
-extern wint_t putwchar(wchar_t c);
-
-extern double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
-extern float wcstof(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
-extern long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr);
-
-extern long int wcstol(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
-extern long long int wcstoll(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
-extern unsigned long int wcstoul(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
-extern unsigned long long int wcstoull(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
-
-extern wchar_t *wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2);
-extern wchar_t *wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
-
-extern wchar_t *wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
-extern wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n);
-extern wchar_t *wcscat(wchar_t * restrict s1, const wchar_t * restrict s2);
-extern wchar_t *wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
-extern int wcscmp(const wchar_t *s1, const wchar_t *s2);
-extern int wcscoll(const wchar_t *s1, const wchar_t *s2);
-extern int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n);
-extern size_t wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n);
-extern int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n);
-extern wchar_t *wcschr(const wchar_t *s, wchar_t c);
-extern size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
-extern wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
-extern wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
-extern size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
-extern wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
-extern wchar_t *wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr);
-extern wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
-extern size_t wcslen(const wchar_t *s);
-extern wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
-extern size_t wcsftime(wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr);
-extern wint_t btowc(int c);
-extern int wctob(wint_t c);
-extern int mbsinit(const mbstate_t *ps);
-extern size_t mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps);
-extern size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps);
-extern size_t wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps);
-extern size_t mbsrtowcs(wchar_t * restrict dst, const char ** restrict src, size_t len, mbstate_t * restrict ps);
-extern size_t wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps);
-
-
-#endif
--- a/root/include/scc/wctype.h
+++ /dev/null
@@ -1,30 +1,0 @@
-#ifndef _WCTYPE_H
-#define _WCTYPE_H
-
-/* TODO: This is only a placeholder */
-typedef int wint_t;
-typedef int wctrans_t;
-typedef int wctype_t;
-
-#define WEOF -1
-
-extern int iswalnum(wint_t wc);
-extern int iswalpha(wint_t wc);
-extern int iswblank(wint_t wc);
-extern int iswcntrl(wint_t wc);
-extern int iswdigit(wint_t wc);
-extern int iswgraph(wint_t wc);
-extern int iswlower(wint_t wc);
-extern int iswprint(wint_t wc);
-extern int iswpunct(wint_t wc);
-extern int iswspace(wint_t wc);
-extern int iswupper(wint_t wc);
-extern int iswxdigit(wint_t wc);
-extern int iswctype(wint_t wc, wctype_t desc);
-extern wctype_t wctype(const char *property);
-extern wint_t towlower(wint_t wc);
-extern wint_t towupper(wint_t wc);
-extern wint_t towctrans(wint_t wc, wctrans_t desc);
-extern wctrans_t wctrans(const char *property);
-
-#endif
--- a/root/lib/scc/amd64-sysv-linux/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/lib/scc/amd64-sysv-netbsd/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/lib/scc/amd64-sysv-openbsd/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/lib/scc/i386-sysv-linux/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/lib/scc/i386-sysv-openbsd/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/lib/scc/z80-scc-none/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/root/libexec/scc/README
+++ /dev/null
@@ -1,1 +1,0 @@
-This is a placeholder for VCS
--- a/rules.mk
+++ /dev/null
@@ -1,37 +1,0 @@
-include $(PROJECTDIR)/config.mk
-
-INCLUDE = $(PROJECTDIR)/inc
-
-BINDIR = $(PROJECTDIR)/root/bin
-INCDIR = $(PROJECTDIR)/root/include/scc
-LIBDIR = $(PROJECTDIR)/root/lib/scc
-LIBEXEC = $(PROJECTDIR)/root/libexec/scc
-
-LIBSCC = $(PROJECTDIR)/lib/scc
-LIBCOFF32 = $(PROJECTDIR)/lib/coff32
-
-SCC_CFLAGS = $(MORECFLAGS) $(SYSCFLAGS) $(STDCFLAGS) -g $(CFLAGS)
-
-SCC_LDFLAGS = $(MORELFLAGS) $(SYSLDFLAGS) -L$(LIBDIR) -g $(LDFLAGS)
-
-# helper macro to run over all the directories
-FORALL = +@set -e ;\
- pwd=$$PWD; \
- for i in $(DIRS); \
- do \
- cd $$i; \
- $(MAKE) $@; \
- cd $$pwd; \
- done
-
-.s.o:
- $(AS) $< -o $@
-
-.c.o:
- $(CC) $(SCC_CFLAGS) -o $@ -c $<
-
-all:
-dep:
-clean:
-distclean: clean
-FORCE:
--- /dev/null
+++ b/scripts/libc-proto
@@ -1,0 +1,10 @@
+bin
+include/scc
+libexec/scc
+lib
+lib/scc
+lib/scc/i386-linux
+lib/scc/amd64-netbsd
+lib/scc/amd64-linux
+lib/scc/amd64-openbsd
+lib/scc/i386-openbsd
--- /dev/null
+++ b/scripts/mkdep
@@ -1,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+(echo '/^#deps/+;$c'
+
+for i in `find . -name '*.c'`
+do
+ file=`basename $i | sed 's/\.c$/.o/'`
+
+ dir=`dirname $i |
+ sed -e 's,^\./,,' -e 's,^\.$,,' -e 's,...*[^/],&/,'`
+
+ sed -n "/^#include / {
+ s///
+ s@\"\(.*\)\"@$dir$file: $dir\1@p
+ s@<\(scc/.*\)>@$dir$file: \$(INCDIR)/scc/\1@p
+ }" $i
+done | LC_ALL=C sort -s
+
+echo .
+echo w) | ed -s deps.mk
--- /dev/null
+++ b/scripts/rules.mk
@@ -1,0 +1,52 @@
+CONF=amd64-linux
+include $(PROJECTDIR)/config/$(CONF).mk
+
+LIBDIR = $(PROJECTDIR)/lib/scc
+SCRIPTDIR = $(PROJECTDIR)/scripts
+INCDIR = $(PROJECTDIR)/include
+
+BINDIR = $(PROJECTDIR)/bin
+LIBEXEC = $(PROJECTDIR)/libexec/scc
+CRTDIR = $(PROJECTDIR)/lib/scc
+
+SCC_CFLAGS = $(MORECFLAGS) \
+ $(SYSCFLAGS) \
+ -I$(INCDIR)/scc \
+ -g \
+ $(CFLAGS)
+
+SCC_LDFLAGS = $(MORELFLAGS) \
+ $(SYSLDFLAGS) \
+ -L$(LIBDIR) \
+ -g \
+ $(LDFLAGS)
+
+# helper macro to run over all the directories
+FORALL = +@set -e ;\
+ pwd=$$PWD; \
+ for i in $(DIRS); \
+ do \
+ cd $$i; \
+ $(MAKE) $@; \
+ cd $$pwd; \
+ done
+
+.s.o:
+ $(AS) $< -o $@
+
+.c.o:
+ $(CC) $(SCC_CFLAGS) -o $@ -c $<
+
+all:
+
+dep:
+
+inc-dep: FORCE
+ $(SCRIPTDIR)/mkdep
+
+clean: clean-helper
+
+clean-helper:
+ rm -f *.o $(OBJS) $(TARGET)
+
+FORCE:
--- /dev/null
+++ b/src/Makefile
@@ -1,0 +1,20 @@
+.POSIX:
+
+PROJECTDIR = ..
+include $(PROJECTDIR)/scripts/rules.mk
+
+TOOLS = cc1 cc2 ld as nm objdump
+LIBS = libscc libcoff32
+DIRS = $(TOOLS) $(LIBS) libc libcrt
+
+all: $(TOOLS) crt
+
+crt: libcrt libc $(TOOLS)
+
+$(TOOLS): $(LIBS)
+
+$(DIRS): FORCE
+ +@cd $@ && $(MAKE)
+
+dep clean:
+ $(FORALL)
--- /dev/null
+++ b/src/ar/Makefile
@@ -1,0 +1,22 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -I$(DRIVER)
+
+OBJS = main.o \
+ $(DRIVER)/driver.o \
+
+TARGET = $(BINDIR)/ar
+
+all: $(TARGET)
+
+$(TARGET): $(LIBDIR)/libscc.a
+
+$(TARGET): $(OBJS)
+ $(CC) $(SCC_LDFLAGS) $(OBJS) -lscc -o $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/ar/deps.mk
@@ -1,0 +1,5 @@
+#deps
+main.o: $(INCDIR)/scc/ar.h
+main.o: $(INCDIR)/scc/arg.h
+main.o: $(INCDIR)/scc/scc.h
+posix/driver.o: posix/driver.h
--- /dev/null
+++ b/src/ar/main.c
@@ -1,0 +1,643 @@
+static char sccsid[] = "@(#) ./ar/main.c";
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <driver.h>
+
+#include <scc/ar.h>
+#include <scc/arg.h>
+#include <scc/scc.h>
+
+enum {
+ BEFORE,
+ INDOT,
+ AFTER,
+};
+
+struct tmp {
+ char *name;
+ FILE *fp;
+} tmps[3];
+
+char *argv0;
+
+static int bflag, vflag, cflag, lflag, uflag, aflag;
+static char *arfile, *posname;
+
+struct member {
+ FILE *src;
+ struct ar_hdr hdr;
+ int cur;
+ char *fname;
+ long size;
+ long mode;
+ long long date;
+};
+
+static void
+cleanup(void)
+{
+ int i;
+
+ for (i = 0; i < 3; i++) {
+ if (tmps[i].name)
+ remove(tmps[i].name);
+ }
+}
+
+/*
+ * I do know that you cannot call remove from a signal handler
+ * but we only can use stdio function to deal with files
+ * because we are C99 compliant, and it is very likely that
+ * remove is going to work in this case
+ */
+static void
+sigfun(int signum)
+{
+ cleanup();
+ _Exit(1);
+}
+
+static FILE *
+openar(void)
+{
+ FILE *fp;
+ char magic[SARMAG+1];
+
+ if ((fp = fopen(arfile,"r+b")) == NULL) {
+ if (!cflag)
+ fprintf(stderr, "ar: creating %s\n", arfile);
+ if ((fp = fopen(arfile, "w+b")) == NULL) {
+ perror("ar:opening archive");
+ exit(1);
+ }
+ fputs(ARMAG, fp);
+ if (fflush(fp) == EOF) {
+ perror("ar:writing magic number");
+ exit(1);
+ }
+ } else {
+ if (fgets(magic, sizeof(magic), fp) == NULL) {
+ perror("ar:error reading magic number");
+ exit(1);
+ }
+ if (strcmp(magic, ARMAG)) {
+ fprintf(stderr,
+ "ar:%s:invalid magic number '%s'\n",
+ arfile,
+ magic);
+ exit(1);
+ }
+ }
+ return fp;
+}
+
+static void
+archive(char *fname, FILE *to, char letter)
+{
+ int c;
+ size_t n;
+ FILE *from;
+ char mtime[13];
+ struct stat st;
+
+ if (vflag)
+ printf("%c - %s\n", letter, fname);
+ if (strlen(fname) > 16)
+ fprintf(stderr, "ar:%s: too long name\n", fname);
+ if ((from = fopen(fname, "rb")) == NULL) {
+ fprintf(stderr,
+ "ar:opening member '%s':%s\n",
+ fname,
+ strerror(errno));
+ exit(1);
+ }
+ if (stat(fname, &st) < 0) {
+ fprintf(stderr, "ar:error getting '%s' attributes\n", fname);
+ exit(1);
+ }
+ strftime(mtime, sizeof(mtime), "%s", gmtime(&st.st_mtime));
+ fprintf(to,
+ "%-16.16s%-12s%-6u%-6u%-8o%-10llu`\n",
+ fname,
+ mtime,
+ st.st_uid,
+ st.st_gid,
+ st.st_mode,
+ (unsigned long long) st.st_size);
+ for (n = 0; (c = getc(from)) != EOF; n++)
+ putc(c, to);
+ if (n & 1)
+ putc('\n', to);
+ if (ferror(from)) {
+ fprintf(stderr,
+ "ar:reading input '%s':%s\n",
+ fname, strerror(errno));
+ exit(1);
+ }
+ fclose(from);
+}
+
+static void
+append(FILE *fp, char *argv[])
+{
+ char *fname;
+
+ if (fseek(fp, 0, SEEK_END) == EOF) {
+ perror("ar:seeking archive");
+ exit(1);
+ }
+
+ for ( ; fname = *argv; ++argv) {
+ *argv = NULL;
+ archive(fname, fp, 'a');
+ }
+
+ if (fclose(fp) == EOF) {
+ perror("ar:error writing archive");
+ exit(1);
+ }
+}
+
+static void
+copy(struct member *m, struct tmp *tmp)
+{
+ int c;
+ size_t siz = m->size;
+ struct ar_hdr *hdr = &m->hdr;
+
+ fwrite(hdr, sizeof(*hdr), 1, tmp->fp);
+ if ((siz & 1) == 1)
+ siz++;
+ while (siz--) {
+ if ((c = getc(m->src)) == EOF)
+ break;
+ fputc(c, tmp->fp);
+ }
+}
+
+static void
+letters(unsigned long val, char *s)
+{
+ *s++ = (val & 04) ? 'r' : '-';
+ *s++ = (val & 02) ? 'w' : '-';
+ *s++ = (val & 01) ? 'x' : '-';
+}
+
+static char *
+perms(struct member *m)
+{
+ static char buf[10];
+
+ letters(m->mode >> 6, buf);
+ letters(m->mode >> 3, buf+3);
+ letters(m->mode, buf +6);
+ buf[9] = '\0';
+
+ return buf;
+}
+
+static int
+inlist(char *fname, int argc, char *argv[])
+{
+ for (; argc-- > 0; ++argv) {
+ if (*argv && !strcmp(*argv, fname)) {
+ *argv = NULL;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static void
+move(struct member *m, int argc, char *argv[])
+{
+ int where;
+
+ if (inlist(m->fname, argc, argv)) {
+ if (vflag)
+ printf("m - %s\n", m->fname);
+ where = INDOT;
+ } else if (posname && !strcmp(posname, m->fname)) {
+ where = (bflag) ? AFTER : BEFORE;
+ m->cur = AFTER;
+ } else {
+ where = m->cur;
+ }
+ copy(m, &tmps[where]);
+}
+
+static void
+insert(int argc, char *argv[])
+{
+ for (; argc-- > 0; ++argv) {
+ if (*argv) {
+ archive(*argv, tmps[INDOT].fp, 'a');
+ *argv = NULL;
+ }
+ }
+}
+
+static void
+update(struct member *m, int argc, char *argv[])
+{
+ int where;
+ FILE *fp = tmps[BEFORE].fp;
+
+ if (inlist(m->fname, argc, argv)) {
+ archive(m->fname, tmps[m->cur].fp, 'r');
+ return;
+ } else if (posname && !strcmp(posname, m->fname)) {
+ where = (bflag) ? AFTER : BEFORE;
+ m->cur = AFTER;
+ } else {
+ where = m->cur;
+ }
+ copy(m, &tmps[where]);
+}
+
+static void
+extract(struct member *m, int argc, char *argv[])
+{
+ int c;
+ long siz;
+ FILE *fp;
+
+ if (argc > 0 && !inlist(m->fname, argc, argv))
+ return;
+ if (vflag)
+ printf("x - %s\n", m->fname);
+ siz = m->size;
+
+ if ((fp = fopen(m->fname, "wb")) == NULL)
+ goto error_file;
+ while (siz-- > 0 && (c = getc(m->src)) != EOF)
+ putc(c, fp);
+ fflush(fp);
+ if (fclose(fp) == EOF)
+ goto error_file;
+
+ /* TODO: set attributes */
+ return;
+
+
+error_file:
+ perror("ar:error extracting file");
+ exit(1);
+}
+
+static void
+print(struct member *m, int argc, char *argv[])
+{
+ long siz;
+ int c;
+
+ if (argc > 0 && !inlist(m->fname, argc, argv))
+ return;
+ if (vflag)
+ printf("\n<%s>\n\n", m->fname);
+ siz = m->size;
+ while (siz-- > 0 && (c = getc(m->src)) != EOF)
+ putchar(c);
+}
+
+static void
+list(struct member *m, int argc, char *argv[])
+{
+ time_t t;
+ struct ar_hdr *hdr = &m->hdr;
+ char mtime[30];
+
+ if (argc > 0 && !inlist(m->fname, argc, argv))
+ return;
+ if (!vflag) {
+ printf("%s\n", m->fname);
+ } else {
+ t = totime(m->date);
+ strftime(mtime, sizeof(mtime), "%c", localtime(&t));
+ printf("%s %ld/%ld\t%s %s\n",
+ perms(m),
+ atol(hdr->ar_uid),
+ atol(hdr->ar_gid),
+ mtime,
+ m->fname);
+ }
+}
+
+static void
+del(struct member *m, int argc, char *argv[])
+{
+ if (inlist(m->fname, argc, argv)) {
+ if (vflag)
+ printf("d - %s\n", m->fname);
+ return;
+ }
+ copy(m, &tmps[BEFORE]);
+}
+
+static char *
+getfname(struct ar_hdr *hdr)
+{
+ static char fname[SARNAM+1];
+ size_t i;
+
+ memcpy(fname, hdr->ar_name, SARNAM);
+ fname[SARNAM] = '\0';
+
+ for (i = SARNAM-1; i >= 0; --i) {
+ if (fname[i] != ' ' && fname[i] != '/')
+ break;
+ fname[i] = '\0';
+ }
+ return fname;
+}
+
+static long long
+getnum(char *s, int size, int base)
+{
+ int c;
+ long long val;
+ char *p;
+ static char digits[] = "0123456789";
+
+ for (val = 0; size > 0; val += c) {
+ --size;
+ if ((c = *s++) == ' ')
+ break;
+ if ((p = strchr(digits, c)) == NULL)
+ return -1;
+ if ((c = p - digits) >= base)
+ return -1;
+ val *= base;
+ }
+
+ while (size > 0 && *s++ == ' ')
+ --size;
+ return (size == 0) ? val : -1;
+}
+
+static int
+valid(struct member *m)
+{
+ struct ar_hdr *hdr = &m->hdr;
+
+ m->fname = getfname(&m->hdr);
+ m->size = getnum(hdr->ar_size, sizeof(hdr->ar_size), 10);
+ m->mode = getnum(hdr->ar_mode, sizeof(hdr->ar_mode), 8);
+ m->date = getnum(hdr->ar_date, sizeof(hdr->ar_date), 10);
+
+ if (strncmp(hdr->ar_fmag, ARFMAG, sizeof(hdr->ar_fmag)) ||
+ m->size < 0 || m->mode < 0 || m->date < 0) {
+ return 0;
+ }
+ return 1;
+}
+
+static void
+run(FILE *fp, int argc, char *argv[],
+ void (*fun)(struct member *, int argc, char *files[]))
+{
+ struct member m;
+
+ m.src = fp;
+ m.cur = BEFORE;
+
+ while (fread(&m.hdr, sizeof(m.hdr), 1, fp) == 1) {
+ fpos_t pos;
+
+ if (!valid(&m)) {
+ fprintf(stderr,
+ "ar:corrupted member '%s'\n",
+ m.fname);
+ exit(1);
+ }
+ fgetpos(fp, &pos);
+ (*fun)(&m, argc, argv);
+ fsetpos(fp, &pos);
+ fseek(fp, m.size+1 & ~1, SEEK_CUR);
+ }
+ if (ferror(fp) || fclose(fp) == EOF) {
+ perror("ar:reading members");
+ exit(1);
+ }
+}
+
+static void
+merge(void)
+{
+ FILE *fp, *fi;
+ int c, i;
+
+
+ if ((fp = fopen(arfile, "wb")) == NULL) {
+ perror("ar:reopening archive");
+ exit(1);
+ }
+
+ fputs(ARMAG, fp);
+
+ for (i = 0; i < 3; i++) {
+ if ((fi = tmps[i].fp) == NULL)
+ continue;
+ fseek(fi, 0, SEEK_SET);
+ while ((c = getc(fi)) != EOF)
+ putc(c, fp);
+ if (ferror(fi)) {
+ perror("ar:error in temporary");
+ exit(1);
+ }
+ }
+
+ if (fclose(fp) == EOF) {
+ perror("ar:writing archive file");
+ exit(1);
+ }
+}
+
+static void
+closetmp(int which)
+{
+ struct tmp *tmp = &tmps[which];
+
+ if (!tmp->fp)
+ return;
+ if (fclose(tmp->fp) == EOF) {
+ perror("ar:closing temporaries");
+ exit(1);
+ }
+}
+
+static void
+opentmp(char *fname, int which)
+{
+ struct tmp *tmp = &tmps[which];
+
+ if (lflag) {
+ tmp->name = fname;
+ tmp->fp = fopen(fname, "w+b");
+ } else {
+ tmp->fp = tmpfile();
+ }
+
+ if (tmp->fp == NULL) {
+ perror("ar:creating temporary");
+ exit(1);
+ }
+}
+
+static void
+doit(int key, char *argv[], int argc)
+{
+ FILE *fp;
+
+ fp = openar();
+ if (argc == 0 &&
+ (key == 'r' || key == 'd' || key == 'm' || key == 'q')) {
+ if (fclose(fp) == EOF) {
+ perror("ar:early close of archive file");
+ exit(-1);
+ }
+ return;
+ }
+
+ if (key == 'r' || key == 'm' || key == 'd')
+ opentmp("ar.tmp1", BEFORE);
+ if (key == 'r' || key == 'm') {
+ opentmp("ar.tmp2", INDOT);
+ opentmp("ar.tmp3", AFTER);
+ }
+
+ switch (key) {
+ case 'r':
+ run(fp, argc, argv, update);
+ insert(argc, argv);
+ merge();
+ break;
+ case 'm':
+ run(fp, argc, argv, move);
+ merge();
+ break;
+ case 'd':
+ run(fp, argc, argv, del);
+ merge();
+ break;
+ case 't':
+ run(fp, argc, argv, list);
+ break;
+ case 'p':
+ run(fp, argc, argv, print);
+ break;
+ case 'x':
+ run(fp, argc, argv, extract);
+ break;
+ case 'q':
+ append(fp, argv);
+ break;
+ }
+
+ closetmp(BEFORE);
+ closetmp(INDOT);
+ closetmp(AFTER);
+
+ for ( ; argc-- > 0; ++argv) {
+ if (*argv) {
+ fprintf(stderr, "ar: No member named '%s'\n", *argv);
+ exit(1);
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ fputs("ar [-drqtpmx][posname] [-vuaibcl] [posname] arfile name ...\n",
+ stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int key, nkey = 0, pos = 0;
+
+ atexit(cleanup);
+ ARGBEGIN {
+ case 'd':
+ nkey++;
+ key = 'd';
+ break;
+ case 'r':
+ nkey++;
+ key = 'r';
+ break;
+ case 'q':
+ nkey++;
+ key = 'q';
+ break;
+ case 't':
+ nkey++;
+ key = 't';
+ break;
+ case 'p':
+ nkey++;
+ key = 'p';
+ break;
+ case 'm':
+ nkey++;
+ key = 'm';
+ break;
+ case 'x':
+ nkey++;
+ key = 'x';
+ break;
+ case 'a':
+ aflag = 1;
+ pos++;
+ posname = EARGF(usage());
+ break;
+ case 'i':
+ case 'b':
+ bflag = 1;
+ pos++;
+ posname = EARGF(usage());
+ break;
+ case 'v':
+ vflag = 1;
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'l':
+ lflag = 1;
+ break;
+ case 'u':
+ /* TODO */
+ abort();
+ uflag = 1;
+ break;
+ default:
+ usage();
+ } ARGEND
+
+ if (nkey == 0 || nkey > 1 || pos > 1 || argc == 0)
+ usage();
+
+ signal(SIGINT, sigfun);
+ signal(SIGQUIT, sigfun);
+ signal(SIGTERM, sigfun);
+
+ arfile = *argv;
+ doit(key, ++argv, --argc);
+
+ if (fflush(stdout) == EOF) {
+ perror("ar:error writing to stdout");
+ exit(1);
+ }
+
+ return 0;
+}
--- /dev/null
+++ b/src/ar/posix/driver.c
@@ -1,0 +1,14 @@
+static char sccsid[] = "@(#) ./ar/posix/driver.c";
+
+#include "driver.h"
+
+time_t
+totime(long long t)
+{
+ return t;
+}
+
+int
+setattr()
+{
+}
--- /dev/null
+++ b/src/ar/posix/driver.h
@@ -1,0 +1,5 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+extern time_t totime(long long t);
--- /dev/null
+++ b/src/as/Makefile
@@ -1,0 +1,33 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -I$(INCDIR)/$(STD)
+
+OBJS = main.o \
+ symbol.o \
+ ins.o \
+ parser.o \
+ expr.o \
+ myro.o \
+
+TARGET = $(LIBEXEC)/as-amd64 \
+ $(LIBEXEC)/as-i386 \
+ $(LIBEXEC)/as-i286 \
+ $(LIBEXEC)/as-z80 \
+
+all: $(TARGET)
+
+$(TARGET): $(LIBDIR)/libscc.a
+
+dep: inc-dep
+
+clean:
+ rm -f target/*/*.o target/*/*tbl.c
+
+include target/amd64.mk
+include target/i386.mk
+include target/i286.mk
+include target/z80.mk
+include deps.mk
--- /dev/null
+++ b/src/as/as.h
@@ -1,0 +1,216 @@
+/*
+ * First 3 bits of flags in segments and symbols are for the
+ * type of segment
+ */
+enum symflags {
+ FREG = 1 << 0,
+ FSECT = 1 << 1,
+ FSYM = 1 << 2,
+ FCOMMON = 1 << 3,
+ FEXTERN = 1 << 4,
+ FDEF = 1 << 5,
+ FGLOBAL = 1 << 6,
+ FABS = 1 << 7,
+};
+
+enum secflags {
+ SREAD = 1 << 0,
+ SWRITE = 1 << 1,
+ SEXEC = 1 << 2,
+ SLOAD = 1 << 3,
+ SFILE = 1 << 4,
+ SABS = 1 << 5,
+};
+
+enum endianess {
+ BIG_ENDIAN = -1,
+ LITTLE_ENDIAN = 1
+};
+
+enum common_args {
+ AIMM = 1,
+ ASTR,
+ AREG,
+ ANUMBER,
+ AIMM8,
+ AIMM16,
+ AIMM32,
+ AIMM64,
+ AINDIR,
+ AINDEX,
+ ADIRECT,
+ AREG_OFF,
+ ASYM,
+ AOPT,
+ AREP,
+ AMAX,
+};
+
+enum tokens {
+ EOS = -1,
+ IDEN = 1,
+ NUMBER,
+ REG,
+ STRING,
+ MINUS,
+ SHL,
+ SHR,
+ GE,
+ LE,
+};
+
+#define MAXSYM 63
+
+typedef struct reloc Reloc;
+typedef struct ins Ins;
+typedef struct op Op;
+typedef struct section Section;
+typedef struct symbol Symbol;
+typedef struct node Node;
+typedef struct string String;
+typedef void Format(Op *, Node **);
+
+struct string {
+ char *buf;
+ size_t offset;
+};
+
+struct line {
+ char *label;
+ char *op;
+ char *args;
+};
+
+struct ins {
+ int begin, end;
+ char *str;
+};
+
+struct reloc {
+ size_t offset;
+ Symbol *sym;
+ unsigned char flags;
+ unsigned char size;
+ unsigned char nbits;
+ unsigned char shift;
+};
+
+struct op {
+ unsigned char flags;
+ unsigned char size;
+ void (*format)(Op *, Node **);
+ unsigned char *bytes;
+ unsigned char *args;
+};
+
+struct section {
+ Symbol *sym;
+ char *mem;
+ unsigned char flags;
+ unsigned char fill;
+ unsigned char aligment;
+ unsigned id;
+ TUINT base;
+ TUINT max;
+ TUINT curpc;
+ TUINT pc;
+ struct section *next;
+};
+
+struct symbol {
+ String name;
+ String type;
+ unsigned char flags;
+ unsigned char pass;
+ TUINT value;
+ TUINT size;
+ Section *section;
+ struct symbol *next;
+ struct symbol *hash;
+};
+
+struct node {
+ unsigned char op;
+ unsigned char addr;
+ struct symbol *sym;
+ struct node *left;
+ struct node *right;
+};
+
+union yylval {
+ TUINT val;
+ Symbol *sym;
+};
+
+
+/* symbol.c */
+extern void cleansecs(void);
+extern void isecs(void);
+extern void emit(char *bytes, int nbytes);
+extern Section *setsec(char *name, char *attr);
+extern Symbol *tmpsym(TUINT val);
+extern void killtmp(void);
+extern int toobig(Node *np, int type);
+extern void dumpstab(char *msg);
+extern String newstring(char *s);
+
+/* main.c */
+extern Symbol *lookup(char *name);
+extern Symbol *deflabel(char *name);
+
+/* parser.c */
+extern Node **getargs(char *s);
+extern void error(char *msg, ...);
+/* Avoid errors in files where stdio is not included */
+#ifdef stdin
+extern int nextline(FILE *fp, struct line *linep);
+#endif
+extern void unexpected(void);
+extern void expect(int token);
+int next(void);
+#define accept(t) (yytoken == (t) ? next() : 0)
+extern void regctx(int mode);
+extern Node *getreg(void);
+extern Node *operand(char **s);
+extern void addinput(char *fname);
+extern int delinput(void);
+
+/* expr.c */
+extern Node *expr(void);
+extern void deltree(Node *np);
+extern Node *node(int op, Node *l, Node *r);
+
+/* proc.c */
+extern void iarch(void);
+extern int match(Op *op, Node **args);
+extern Node *moperand(void);
+
+/* ins.c */
+extern char *tobytes(TUINT v, int n, int inc);
+
+/* format.c */
+extern void writeout(char *name);
+extern void reloc(Symbol *sym,
+ unsigned flags,
+ unsigned size,
+ unsigned nbits,
+ unsigned shift);
+
+
+/*
+ * Definition of global variables
+ */
+extern Section *cursec, *seclist;
+extern int nr_ins;
+extern Ins instab[];
+extern Op optab[];
+extern int pass;
+extern TUINT maxaddr;
+extern int endian;
+extern Symbol *linesym, *symlist;
+extern char *infile;
+extern int endpass;
+extern int yytoken;
+extern size_t yylen;
+extern union yylval yylval;
+extern char yytext[];
--- /dev/null
+++ b/src/as/deps.mk
@@ -1,0 +1,33 @@
+#deps
+expr.o: $(INCDIR)/scc/scc/scc.h
+expr.o: as.h
+ins.o: $(INCDIR)/scc/scc/scc.h
+ins.o: as.h
+main.o: $(INCDIR)/scc/scc/arg.h
+main.o: $(INCDIR)/scc/scc/scc.h
+main.o: as.h
+myro.o: $(INCDIR)/scc/scc/myro.h
+myro.o: $(INCDIR)/scc/scc/scc.h
+myro.o: as.h
+parser.o: $(INCDIR)/scc/scc/cstd.h
+parser.o: $(INCDIR)/scc/scc/scc.h
+parser.o: as.h
+symbol.o: $(INCDIR)/scc/scc/scc.h
+symbol.o: as.h
+target/x80/ins.o: $(INCDIR)/scc/scc/scc.h
+target/x80/ins.o: target/x80/../../as.h
+target/x80/ins.o: target/x80/proc.h
+target/x80/z80.o: $(INCDIR)/scc/scc/scc.h
+target/x80/z80.o: target/x80/../../as.h
+target/x80/z80.o: target/x80/../x80/proc.h
+target/x86/amd64.o: $(INCDIR)/scc/scc/scc.h
+target/x86/amd64.o: target/x86/../../as.h
+target/x86/i286.o: $(INCDIR)/scc/scc/scc.h
+target/x86/i286.o: target/x86/../../as.h
+target/x86/i286.o: target/x86/../x86/proc.h
+target/x86/i386.o: $(INCDIR)/scc/scc/scc.h
+target/x86/i386.o: target/x86/../../as.h
+target/x86/i386.o: target/x86/../x86/proc.h
+target/x86/ins.o: $(INCDIR)/scc/scc/scc.h
+target/x86/ins.o: target/x86/../../as.h
+target/x86/ins.o: target/x86/proc.h
--- /dev/null
+++ b/src/as/expr.c
@@ -1,0 +1,303 @@
+static char sccsid[] = "@(#) ./as/expr.c";
+
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include "as.h"
+
+#define NNODES 10
+
+static Alloc *arena;
+
+Node *
+node(int op, Node *l, Node *r)
+{
+ struct arena *ap;
+ Node *np;
+
+ if (!arena)
+ arena = alloc(sizeof(Node), NNODES);
+ np = new(arena);
+ np->op = op;
+ np->left = l;
+ np->right = r;
+ np->sym = NULL;
+
+ return np;
+}
+
+void
+deltree(Node *np)
+{
+ if (!np)
+ return;
+ deltree(np->left);
+ deltree(np->right);
+ delete(arena, np);
+}
+
+static Node *
+fold(int op, Node *l, Node *r)
+{
+ Node *np;
+ TUINT val, lv, rv;
+
+ lv = l->sym->value;
+ rv = r->sym->value;
+
+ /* TODO: check overflow */
+
+ switch (op) {
+ case '*':
+ val = lv - rv;
+ break;
+ case '/':
+ if (rv == 0)
+ goto division_by_zero;
+ val = lv / rv;
+ break;
+ case '%':
+ if (rv == 0)
+ goto division_by_zero;
+ val = lv % rv;
+ break;
+ case SHL:
+ val = lv << rv;
+ break;
+ case SHR:
+ val = lv >> rv;
+ break;
+ case '+':
+ val = lv + rv;
+ break;
+ case '-':
+ val = lv - rv;
+ break;
+ case '<':
+ val = lv < rv;
+ break;
+ case '>':
+ val = lv > rv;
+ break;
+ case '=':
+ val = lv == rv;
+ break;
+ case GE:
+ val = lv >= rv;
+ break;
+ case LE:
+ val = lv <= rv;
+ break;
+ case '|':
+ val = lv | rv;
+ break;
+ case '^':
+ val = lv ^ rv;
+ break;
+ default:
+ abort();
+ }
+ deltree(l);
+ deltree(r);
+
+ np = node(NUMBER, NULL, NULL);
+ np->sym = tmpsym(val);
+ np->addr = ANUMBER;
+ return np;
+
+division_by_zero:
+ error("division by 0");
+}
+
+static Node *
+binary(int op, Node *l, Node *r)
+{
+ int addr;
+ Node *np;
+
+ if (l->op == NUMBER && r->op == NUMBER)
+ return fold(op, l, r);
+ else
+ abort();
+ np = node(op, l, r);
+ np->addr = addr;
+
+ return np;
+}
+
+static Node *
+unaryop(int op, Node *np)
+{
+ TUINT val;
+
+ if (np->addr != ANUMBER)
+ error("invalid argument for unary operator");
+ if (np->op != NUMBER) {
+ np = node(op, np, NULL);
+ np->addr = ANUMBER;
+ return np;
+ }
+
+ val = np->sym->value;
+ switch (op) {
+ case '!':
+ val = !val;
+ case '+':
+ break;
+ case '-':
+ val = -val;
+ break;
+ default:
+ abort();
+ }
+ np->sym->value = val;
+
+ return np;
+}
+
+/*************************************************************************/
+/* grammar functions */
+/*************************************************************************/
+
+static Node *
+primary(void)
+{
+ Node *np;
+
+ switch (yytoken) {
+ case IDEN:
+ case NUMBER:
+ np = node(yytoken, NULL, NULL);
+ np->sym = yylval.sym;
+ np->addr = ANUMBER;
+ next();
+ break;
+ case '(':
+ np = expr();
+ expect(')');
+ break;
+ default:
+ unexpected();
+ }
+
+ return np;
+}
+
+static Node *
+unary(void)
+{
+ int op, tok;
+ Node *np;
+
+ switch (tok = yytoken) {
+ case '!':
+ case '-':
+ case '+':
+ next();
+ return unaryop(tok, primary());
+ default:
+ return primary();
+ }
+}
+
+static Node *
+mul(void)
+{
+ int op;
+ Node *np;
+
+ np = unary();
+ for (;;) {
+ switch (op = yytoken) {
+ case '*':
+ case '/':
+ case '%':
+ case SHL:
+ case SHR:
+ next();
+ binary(op, np, primary());
+ break;
+ default:
+ return np;
+ }
+ }
+}
+
+static Node *
+add(void)
+{
+ int op;
+ Node *np;
+
+ np = mul();
+ for (;;) {
+ switch (op = yytoken) {
+ case '+':
+ case '-':
+ next();
+ np = binary(op, np, mul());
+ break;
+ default:
+ return np;
+ }
+ }
+}
+
+static Node *
+relational(void)
+{
+ int op;
+ Node *np;
+
+ np = add();
+ for (;;) {
+ switch (op = yytoken) {
+ case '<':
+ case '>':
+ case '=':
+ case GE:
+ case LE:
+ next();
+ np = binary(op, np, add());
+ break;
+ default:
+ return np;
+ }
+ }
+}
+
+static Node *
+and(void)
+{
+ int op;
+ Node *np;
+
+ np = relational();
+ while (accept('&'))
+ np = binary('&', np, relational());
+ return np;
+}
+
+Node *
+expr(void)
+{
+ int op;
+ Node *np;
+
+ regctx(0);
+ np = and();
+ for (;;) {
+ switch (op = yytoken) {
+ case '|':
+ case '^':
+ next();
+ np = binary(op, np, and());
+ break;
+ default:
+ regctx(1);
+ return np;
+ }
+ }
+}
--- /dev/null
+++ b/src/as/ins.c
@@ -1,0 +1,249 @@
+static char sccsid[] = "@(#) ./as/ins.c";
+
+#include <string.h>
+
+#include <scc/scc.h>
+#include "as.h"
+
+extern Section *sabs, *sbss, *sdata, *stext;
+
+enum {
+ EQU,
+ COMMON,
+ SIZE,
+ XSTRING,
+ ASCII,
+ TYPE,
+};
+
+char *
+tobytes(TUINT v, int nbytes, int inc)
+{
+ static char buf[sizeof(TUINT)];
+ int idx;
+
+ idx = (inc < 0) ? nbytes-1 : 0;
+ while (nbytes--) {
+ buf[idx] = v;
+ idx += inc;
+ v >>= 8;
+ }
+
+ if (v)
+ error("overflow in immediate value");
+ return buf;
+}
+
+void
+noargs(Op *op, Node **args)
+{
+ emit(op->bytes, op->size);
+}
+
+static void
+xstring(int which, Node **args)
+{
+ Node *np;
+ char *s;
+ size_t len;
+
+ while (np = *args++) {
+ s = np->sym->name.buf;
+ len = strlen(s);
+ len += which == XSTRING;
+ emit(s, len);
+ }
+}
+
+void
+string(Op *op, Node **args)
+{
+ xstring(STRING, args);
+}
+
+void
+ascii(Op *op, Node **args)
+{
+ xstring(STRING, args);
+}
+
+void
+def(Node **args, int siz)
+{
+ Node *np;
+
+ while (np = *args++) {
+ Symbol *sym = np->sym;
+
+ if ((sym->flags & FABS) == 0)
+ reloc(sym, 0, siz, siz * 8, 0);
+ emit(tobytes(sym->value, siz, endian), siz);
+ }
+}
+
+void
+defb(Op *op, Node **args)
+{
+ def(args, 1);
+}
+
+void
+defw(Op *op, Node **args)
+{
+ def(args, 2);
+}
+
+void
+defd(Op *op, Node **args)
+{
+ def(args, 4);
+}
+
+void
+defq(Op *op, Node **args)
+{
+ def(args, 8);
+}
+
+static void
+symexp(int which, Op *op, Node **args)
+{
+ Symbol *sym, *exp;
+ static char *cmds[] = {
+ [EQU] = "equ",
+ [COMMON] = "common",
+ [SIZE] = "size",
+ };
+ char *cmd = cmds[which];
+
+ if (args[1]) {
+ sym = args[0]->sym;
+ exp = args[1]->sym;
+ } else if (linesym) {
+ sym = linesym;
+ exp = args[0]->sym;
+ } else {
+ error("%s pseudo instruction lacks a label", cmd);
+ }
+
+ if ((exp->flags & FABS) == 0)
+ error("%s expression is not an absolute expression", cmd);
+
+ switch (which) {
+ case EQU:
+ if (pass == 1 && (sym->flags & FDEF))
+ error("redefinition of symbol '%s'", sym->name.buf);
+ sym->value = exp->value;
+ sym->flags |= FDEF;
+ break;
+ case COMMON:
+ sym->flags |= FCOMMON;
+ case SIZE:
+ sym->size = exp->value;
+ break;
+ case TYPE:
+ sym->type.buf = xstrdup(exp->name.buf);
+ break;
+ }
+}
+
+void
+equ(Op *op, Node **args)
+{
+ symexp(EQU, op, args);
+}
+
+void
+common(Op *op, Node **args)
+{
+ symexp(COMMON, op, args);
+}
+
+void
+size(Op *op, Node **args)
+{
+ symexp(SIZE, op, args);
+}
+
+void
+type(Op *op, Node **args)
+{
+ symexp(TYPE, op, args);
+}
+
+void
+section(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+ char *attr = NULL;
+
+ if (args[1])
+ attr = args[1]->sym->name.buf;
+
+ setsec(sym->name.buf, attr);
+}
+
+void
+text(Op *op, Node **args)
+{
+ cursec = stext;
+}
+
+void
+data(Op *op, Node **args)
+{
+ cursec = sdata;
+}
+
+void
+bss(Op *op, Node **args)
+{
+ cursec = sbss;
+}
+
+void
+extrn(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+
+ sym->flags |= FEXTERN;
+}
+
+void
+global(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+
+ sym->flags |= FGLOBAL;
+}
+
+void
+align(Op *op, Node **args)
+{
+ Symbol *sym = args[0]->sym;
+ TUINT curpc, pc, al;
+
+ if ((sym->flags & FABS) == 0)
+ error("align expression is not an absolute expression");
+ if ((al = sym->value) == 0)
+ return;
+
+ al--;
+ curpc = cursec->curpc;
+ pc = curpc+al & ~al;
+
+ for (al = pc - curpc; al > 0; --al)
+ emit((char []) {0}, 1);
+}
+
+void
+end(Op *op, Node **args)
+{
+ endpass = 1;
+}
+
+void
+include(Op *op, Node **args)
+{
+ addinput(args[0]->sym->name.buf);
+}
--- /dev/null
+++ b/src/as/main.c
@@ -1,0 +1,138 @@
+static char sccsid[] = "@(#) ./as/main.c";
+
+#include <ctype.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include <scc/arg.h>
+#include "as.h"
+
+char *argv0;
+char *outfile, *infile;
+int endpass;
+
+
+static void
+cleanup(void)
+{
+ if (outfile)
+ remove(outfile);
+}
+
+static int
+cmp(const void *f1, const void *f2)
+{
+ const Ins *ins = f2;
+ const char *s = f1;
+ int d;
+
+ if ((d = *s - *ins->str) != 0)
+ return d;
+
+ return strcmp(s, ins->str);
+}
+
+static void
+as(char *text, char *xargs)
+{
+ int c;
+ char *p;
+ Ins *ins;
+ Op *op, *lim;
+ Node **args;
+
+ for (p = text; c = *p; ++p)
+ *p = toupper(c);
+
+ ins = bsearch(text, instab, nr_ins, sizeof(Ins), cmp);
+ if (!ins) {
+ error("invalid instruction '%s'", text);
+ return;
+ }
+
+ args = getargs(xargs);
+ lim = &optab[ins->end];
+ for (op = &optab[ins->begin]; op < lim; ++op) {
+ if (match(op, args))
+ break;
+ }
+ if (op == lim) {
+ error("invalid operands for '%s'", text);
+ return;
+ }
+ (*op->format)(op, args);
+}
+
+static int
+dopass(char *fname)
+{
+ struct line line;
+ FILE *fp;
+ extern int nerrors;
+ extern jmp_buf recover;
+
+ addinput(fname);
+ cleansecs();
+
+ endpass = 0;
+ setjmp(recover);
+ while (!endpass && nextline(fp, &line)) {
+ linesym = NULL;
+
+ if (line.label)
+ linesym = deflabel(line.label);
+
+ if (line.op)
+ as(line.op, line.args);
+ else if (line.args)
+ error("arguments without an opcode");
+ }
+
+ return nerrors == 0;
+}
+
+static void
+usage(void)
+{
+ fputs("usage: as [-o outfile] filename ...\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char **p;
+
+ outfile = "a.out";
+
+ ARGBEGIN {
+ case 'o':
+ outfile = EARGF(usage());
+ break;
+ default:
+ usage();
+ } ARGEND
+
+ if (argc == 0)
+ usage();
+
+ atexit(cleanup);
+ iarch();
+ isecs();
+
+ for (pass = 1; pass <= 2; pass++) {
+ for (p = argv; infile = *p; ++p) {
+ if (!dopass(infile))
+ return 1;
+ }
+ if (pass == 1)
+ killtmp();
+ }
+ writeout(outfile);
+ outfile = NULL;
+
+ return 0;
+}
--- /dev/null
+++ b/src/as/mktbl
@@ -1,0 +1,32 @@
+#!/bin/sh
+
+
+set -e
+
+for i
+do
+ case $i in
+ -c)
+ cpu=$2
+ shift 2
+ ;;
+ -f)
+ family=$2
+ shift 2
+ ;;
+ -*)
+ echo mktbl: incorrect parameter:$i >&2
+ exit 1
+ ;;
+ esac
+done
+
+echo cpu=${cpu:=z80} family=${family:=x80}
+
+rm -f $$.c target/$family/${cpu}tbl.c
+trap "rm -f $$.c" 0 2 3
+
+awk '!/^$/ {print $1,NR,$2,$3,$4,$5,$6}' target/$family/$family.dat |
+LC_COLLATE=C sort -k1 -k2n |
+awk -v cpu=`echo $cpu | tr a-z A-Z` -v family=$family -f mktbl.awk > $$.c &&
+mv $$.c target/$family/${cpu}tbl.c
--- /dev/null
+++ b/src/as/mktbl.awk
@@ -1,0 +1,112 @@
+
+BEGIN {
+ printf "#include <scc/scc.h>\n"\
+ "#include \"../../as.h\"\n"\
+ "#include \"../" family "/proc.h\"\n"
+
+ rules = "target/" family "/rules.dat"
+ while (getline < rules > 0) {
+ regex[++nregs] = $1
+ value[nregs] = $2
+ }
+ close(rules)
+}
+ {sub(/#.*/,"")}
+
+$7 !~ cpu {next}
+
+/^$/ {next}
+
+ {
+ if (opstart[$1] == 0) {
+ opstart[$1] = nvar
+ opnames[nop++] = $1
+ }
+ opcount[$1]++
+ opargs[nvar] = $3
+ opsize[nvar] = $4
+ opbytes[nvar] = ($5 == "none") ? "" : $5
+ opformat[nvar++] = $6
+ formats[$6] = 1
+}
+
+END {
+ for (i in formats)
+ printf "Format %s;\n", i
+
+ printf "int nr_ins = %d;\n\n", nop
+ print "struct ins instab[] = {"
+ for (i = 0; i < nop; i++) {
+ n = opnames[i]
+ start = opstart[n]
+ end = start + opcount[n]
+ printf "\t{.str = \"%s\", .begin = %d, .end = %d},\n",
+ n, start, end | "sort"
+ }
+ close("sort")
+ printf "};\n\n"
+
+ print "struct op optab[] = {"
+ for (i = 0; i < nvar; i++) {
+ printf "\t/* %d */\n", i
+ printf "\t{\n" \
+ "\t\t.size = %d,\n"\
+ "\t\t.format = %s,\n",
+ opsize[i], opformat[i]
+
+ if (opbytes[i] != "")
+ printf "\t\t.bytes = (unsigned char [%d]) {%s},\n",
+ opsize[i],
+ opbytes[i]
+
+ a = str2args(opargs[i])
+ if (a != "")
+ printf "\t\t.args = (unsigned char []) {%s}\n", a
+
+ print "\t},"
+ }
+ print "};"
+}
+
+function str2args(s, args, i, j, out, n, found)
+{
+ n = split(s, args, /,/)
+ if (n == 0 || args[1] == "none")
+ return ""
+ for (i = 1; i <= n; i++) {
+ a = args[i]
+ found = 0
+
+ if (a ~ /\?$/)
+ out = out "AOPT ,"
+ else if (a ~ /\+$/)
+ out = out "AREP ,"
+
+ for (j = 1; j <= nregs; j++) {
+ if (match(a, "^" regex[j])) {
+ out = out value[j]
+ found = 1
+ break
+ }
+ }
+
+ if (!found) {
+ print FILENAME ":" NR ":" \
+ $0 ":wrong arg", a > "/dev/stderr"
+ exit 1
+ }
+
+ a = substr(a, RLENGTH+1)
+ sub(/\?$/, "", a)
+ sub(/\+$/, "", a)
+ if (a != "") {
+ print FILENAME ":" NR ":" \
+ $0 ": trailing chars: ", a > "/dev/stderr"
+ exit 1
+ }
+ out = out ","
+ }
+ out = out "0"
+
+ return out
+}
--- /dev/null
+++ b/src/as/myro.c
@@ -1,0 +1,204 @@
+static char sccsid[] = "@(#) ./as/myro.c";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include <scc/myro.h>
+#include "as.h"
+
+#define FORMAT "z80-scc"
+
+static Reloc *relocs;
+static size_t relcap, relsiz;
+
+static size_t
+writestrings(FILE *fp)
+{
+ int type;
+ size_t off = 0;
+ size_t len;
+ Symbol *sym;
+ Section *sp;
+ String *str;
+
+ fwrite(FORMAT, sizeof(FORMAT), 1, fp);
+ off = sizeof(FORMAT);
+
+ for (sym = symlist; sym; sym = sym->next) {
+ if (sym->flags & FREG)
+ continue;
+ str = &sym->name;
+ len = strlen(str->buf) + 1;
+ fwrite(str->buf, len, 1, fp);
+ str->offset = off;
+ off += len;
+ }
+
+ return off;
+}
+
+static unsigned
+getsecflags(Section *sp)
+{
+ unsigned flags = 0;
+
+ if (sp->flags & SREAD)
+ flags |= MYROSEC_READ;
+ if (sp->flags & SWRITE)
+ flags |= MYROSEC_WRITE;
+ if (sp->flags & SFILE)
+ flags |= MYROSEC_FILE;
+ if (sp->flags & SEXEC)
+ flags |= MYROSEC_EXEC;
+ if (sp->flags & SLOAD)
+ flags |= MYROSEC_LOAD;
+ if (sp->flags & SABS)
+ flags |= MYROSEC_ABS;
+ return flags;
+}
+
+static size_t
+writesections(FILE *fp)
+{
+ Section *sp;
+ size_t off = 0;
+ struct myrosect sect;
+ unsigned id = 0;;
+
+ for (sp = seclist; sp; sp = sp->next) {
+ if (id == MYROMAXSEC)
+ die("too many sections for a myro file");
+ sp->id = id++;
+ sect.name = sp->sym->name.offset;
+ sect.flags = getsecflags(sp);
+ sect.fill = sp->fill;
+ sect.aligment = sp->aligment;
+ sect.offset = off;
+ sect.len = sp->max - sp->base;
+ off += wrmyrosec(fp, §);
+ }
+
+ return off;
+}
+
+static unsigned
+getsymflags(Symbol *sym)
+{
+ unsigned flags = 0;
+
+ if (sym->flags & FCOMMON)
+ flags |= MYROSYM_COMMON;
+ if (sym->flags & FEXTERN)
+ flags |= MYROSYM_EXTERN;
+ if (!(sym->flags & FDEF))
+ flags |= MYROSYM_UNDEF;
+ return flags;
+}
+
+static size_t
+writesymbols(FILE *fp)
+{
+ Symbol *sym;
+ size_t off = 0;
+ struct myrosym symbol;
+
+ for (sym = symlist; sym; sym = sym->next) {
+ if (sym->flags & (FREG|FSECT))
+ continue;
+ symbol.name = sym->name.offset;
+ symbol.type = -1;
+ symbol.section = sym->section->id;
+ symbol.flags = getsymflags(sym);
+ symbol.offset = sym->value;
+ symbol.len = sym->size;
+ off += wrmyrosym(fp, &symbol);
+ }
+
+ return off;
+}
+
+static size_t
+writerelocs(FILE *fp)
+{
+ Reloc *bp, *lim;
+ size_t off = 0;
+ struct myrorel reloc;
+
+ lim = &relocs[relsiz];
+ for (bp = relocs; bp < lim; ++bp) {
+ reloc.id = 0;
+ reloc.flags = bp->flags;
+ reloc.size = bp->size;
+ reloc.nbits = bp->nbits;
+ reloc.shift = bp->shift;
+ reloc.offset = bp->offset;
+ off += wrmyrorel(fp, &reloc);
+ }
+ return off;
+}
+
+static void
+writedata(FILE *fp)
+{
+ Section *sp;
+
+ for (sp = seclist; sp; sp = sp->next) {
+ if (!sp->mem)
+ continue;
+ fwrite(sp->mem, sp->max - sp->base, 1, fp);
+ }
+}
+
+void
+writeout(char *name)
+{
+ FILE *fp;
+ struct myrohdr hdr = { .magic = MYROMAGIC };
+
+ if ((fp = fopen(name, "wb")) == NULL)
+ die("error opening output file '%s'\n", name);
+
+ wrmyrohdr(fp, &hdr);
+ hdr.strsize = writestrings(fp);
+ hdr.secsize = writesections(fp);
+ hdr.symsize = writesymbols(fp);
+ hdr.relsize = writerelocs(fp);
+ writedata(fp);
+
+ fseek(fp, 0, SEEK_SET);
+ wrmyrohdr(fp, &hdr);
+
+ if (fclose(fp))
+ die("error writing the output file");
+}
+
+void
+reloc(Symbol *sym,
+ unsigned flags, unsigned size, unsigned nbits, unsigned shift)
+{
+ size_t tmp;
+ Reloc *p;
+
+ if (pass == 1)
+ return;
+
+ if (relcap == relsiz) {
+ tmp = ((relcap + 1) * 3) / 2;
+ if ((p = realloc(relocs, tmp * sizeof(Reloc))) == NULL) {
+ tmp = relcap + 1;
+ p = xrealloc(relocs, tmp * sizeof(Reloc));
+ }
+ relcap = tmp;
+ relocs = p;
+ }
+
+ p = &relocs[relsiz++];
+ p->sym = sym;
+ p->flags = flags;
+ p->size = size;
+ p->nbits = nbits;
+ p->shift = shift;
+ p->offset = cursec->pc - cursec->base;
+}
--- /dev/null
+++ b/src/as/parser.c
@@ -1,0 +1,482 @@
+static char sccsid[] = "@(#) ./as/parser.c";
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "as.h"
+
+#define NARGS 20
+#define NR_INPUTS 10
+#define MAXLINE 100
+
+struct input {
+ char *fname;
+ unsigned lineno;
+ FILE *fp;
+};
+
+int nerrors;
+jmp_buf recover;
+char yytext[INTIDENTSIZ+1];
+int yytoken;
+size_t yylen;
+union yylval yylval;
+
+static char *textp, *endp;
+static int regmode;
+static unsigned lineno;
+static struct input inputs[NR_INPUTS], *isp = inputs;
+
+static int
+follow(int expect1, int expect2, int ifyes1, int ifyes2, int ifno)
+{
+ int c;
+
+ if ((c = *++textp) == expect1)
+ return ifyes1;
+ if (c == expect2)
+ return ifyes2;
+ --textp;
+ return ifno;
+}
+
+static void
+tok2str(void)
+{
+ if ((yylen = endp - textp) > INTIDENTSIZ) {
+ error("token too big");
+ yylen = INTIDENTSIZ;
+ }
+ memcpy(yytext, textp, yylen);
+ yytext[yylen] = '\0';
+ textp = endp;
+}
+
+static int
+iden(void)
+{
+ int c;
+ char *p;
+
+ for ( ; c = *endp; ++endp) {
+ if (isalnum(c))
+ continue;
+ switch (c) {
+ case '\'':
+ case '_':
+ case '-':
+ case '.':
+ case '$':
+ continue;
+ default:
+ goto out_loop;
+ }
+ }
+
+out_loop:
+ tok2str();
+ yylval.sym = lookup(yytext);
+
+ return (yylval.sym->flags & FREG) ? REG : IDEN;
+}
+
+static int
+number(void)
+{
+ int c, base = 10;
+ char *p;
+ TUINT n;
+
+ if (*endp == '0') {
+ base = 8;
+ ++endp;
+ if (*endp == 'x') {
+ base = 16;
+ ++endp;
+ }
+ }
+ for (n = 0; (c = *endp) && isxdigit(c); n += c) {
+ n *= base;
+ c -= '0';
+ if (n >= TUINT_MAX - c*base)
+ error("overflow in number");
+ endp++;
+ }
+ tok2str();
+ yylval.sym = tmpsym(n);
+
+ return NUMBER;
+}
+
+static int
+character(void)
+{
+ int c;
+ char *p;
+
+ while (*endp != '\'')
+ ++endp;
+ return NUMBER;
+}
+
+static int
+string(void)
+{
+ int c;
+ size_t l;
+ char *s;
+ Symbol *sym = tmpsym(0);
+
+ for (++endp; *endp != '"'; ++endp)
+ ;
+ ++endp;
+ tok2str();
+ yylval.sym = sym;
+ /* FIXME: this memory is not freed ever */
+ l = yylen-2;
+ s = memcpy(xmalloc(l+1), yytext+1, l);
+ s[l] = '\0';
+ sym->name.buf = s;
+
+ return STRING;
+}
+
+static int
+operator(void)
+{
+ int c;
+
+ ++endp;
+ if ((c = *textp) == '>')
+ c = follow('=', '>', LE, SHL, '>');
+ else if (c == '<')
+ c = follow('=', '<', GE, SHR, '>');
+ tok2str();
+
+ return c;
+}
+
+int
+next(void)
+{
+ int c;
+
+ while (isspace(*textp))
+ ++textp;
+
+ endp = textp;
+
+ switch (c = *textp) {
+ case '\0':
+ strcpy(yytext, "EOS");
+ yylen = 3;
+ c = EOS;
+ break;
+ case '"':
+ c = string();
+ break;
+ case '\'':
+ c = character();
+ break;
+ case '%':
+ c = (regmode ? iden : operator)();
+ break;
+ case '_':
+ c = iden();
+ break;
+ default:
+ if (isdigit(c))
+ c = number();
+ else if (isalpha(c))
+ c = iden();
+ else
+ c = operator();
+ break;
+ }
+ return yytoken = c;
+}
+
+void
+expect(int token)
+{
+ if (yytoken != token)
+ unexpected();
+ next();
+}
+
+void
+unexpected(void)
+{
+ error("unexpected '%s'", yytext);
+}
+
+void
+error(char *msg, ...)
+{
+ va_list va;
+ struct input *ip;
+
+ assert(isp > inputs);
+ ip = &isp[-1];
+
+ va_start(va, msg);
+ fprintf(stderr, "as:%s:%u: ", ip->fname, ip->lineno);
+ vfprintf(stderr, msg, va);
+ putc('\n', stderr);
+ nerrors++;
+ va_end(va);
+
+ if (nerrors == 10)
+ die("as: too many errors");
+ longjmp(recover, 1);
+}
+
+Node *
+getreg(void)
+{
+ Node *np;
+
+ np = node(REG, NULL, NULL);
+ np->sym = yylval.sym;
+ np->addr = AREG;
+ expect(REG);
+ return np;
+}
+
+void
+regctx(int mode)
+{
+ regmode = mode;
+}
+
+Node *
+operand(char **strp)
+{
+ int imm = 0;
+ Node *np;
+
+ textp = *strp;
+ regctx(1);
+ switch (next()) {
+ case EOS:
+ np = NULL;
+ break;
+ case REG:
+ np = getreg();
+ break;
+ case STRING:
+ np = node(yytoken, NULL, NULL);
+ np->sym = yylval.sym;
+ np->addr = ASTR;
+ next();
+ break;
+ case '$':
+ next();
+ imm = 1;
+ default:
+ if (!imm) {
+ np = moperand();
+ } else {
+ np = expr();
+ np->addr = AIMM;
+ }
+ }
+ if (yytoken != ',' && yytoken != EOS)
+ error("trailing characters in expression '%s'", textp);
+ *strp = endp;
+
+ return np;
+}
+
+Node **
+getargs(char *s)
+{
+ Node **ap;
+ static Node *args[NARGS];
+
+ if (!s)
+ return NULL;
+
+ for (ap = args; ap < &args[NARGS-1]; ++ap) {
+ if ((*ap = operand(&s)) == NULL)
+ return args;
+ }
+ error("too many arguments in one instruction");
+}
+
+static char *
+field(char **oldp, size_t *siz)
+{
+ char *s, *t, *begin;
+ size_t n;
+
+ if ((begin = *oldp) == NULL)
+ return NULL;
+
+ for (s = begin; isspace(*s) && *s != '\t'; ++s)
+ ;
+ if (*s == '\0' || *s == '/' || *s == ';') {
+ *s = '\0';
+ return *oldp = NULL;
+ }
+
+ for (t = s; *t && *t != '\t'; ++t)
+ ;
+ if (*t == '\t')
+ *t++ = '\0';
+ *siz -= begin - t;
+ *oldp = t;
+
+ while (t >= s && isspace(*t))
+ *t-- = '\0';
+ return (*s != '\0') ? s : NULL;
+}
+
+static int
+validlabel(char *name)
+{
+ int c;
+
+ while ((c = *name++) != '\0') {
+ if (isalnum(c))
+ continue;
+ switch (c) {
+ case '_':
+ case '-':
+ case '.':
+ case '$':
+ continue;
+ case ':':
+ if (*name != '\0')
+ return 0;
+ *--name = '\0';
+ continue;
+ default:
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static int
+extract(char *s, size_t len, struct line *lp)
+{
+ int r = 0;
+
+ if (lp->label = field(&s, &len))
+ r++;
+ if (lp->op = field(&s, &len))
+ r++;
+ if (lp->args = field(&s, &len))
+ r++;
+
+ if (s && *s && *s != '/')
+ error("trailing characters at the end of the line");
+ if (lp->label && !validlabel(lp->label))
+ error("incorrect label name '%s'", lp->label);
+
+ return r;
+}
+
+static void
+comment(FILE *fp)
+{
+ int c;
+
+ while ((c = getc(fp)) != EOF) {
+ if (c != '*')
+ continue;
+ if ((c = getc(fp)) == '/')
+ return;
+ ungetc(c, fp);
+ }
+}
+
+static size_t
+getline(FILE *fp, char buff[MAXLINE])
+{
+ int c;
+ char *bp;
+
+ for (bp = buff; (c = getc(fp)) != EOF; *bp++ = c) {
+ if (c == '\n')
+ break;
+ if (c == '/') {
+ if ((c = getc(fp)) != '*') {
+ ungetc(c, fp);
+ c = '/';
+ } else {
+ comment(fp);
+ c = ' ';
+ }
+ } else if (c > UCHAR_MAX) {
+ error("invalid character '%x'", c);
+ }
+ if (bp == &buff[MAXLINE-1])
+ error("line too long");
+ }
+ *bp = '\0';
+
+ return bp - buff;
+}
+
+int
+nextline(FILE *fp, struct line *lp)
+{
+ struct input *ip;
+ size_t n;
+ static char buff[MAXLINE];
+
+ assert(isp > inputs);
+repeat:
+ if (isp == inputs)
+ return 0;
+ ip = &isp[-1];
+ if (feof(ip->fp)) {
+ delinput();
+ goto repeat;
+ }
+ n = getline(ip->fp, buff);
+ if (++ip->lineno == 0)
+ die("as: %s: file too long", infile);
+ if (n == 0)
+ goto repeat;
+ if (extract(buff, n, lp) == 0)
+ goto repeat;
+ return 1;
+}
+
+void
+addinput(char *fname)
+{
+ FILE *fp;
+
+ if (isp == &inputs[NR_INPUTS])
+ die("as: too many included files");
+ if ((fp = fopen(fname, "r")) == NULL)
+ die("as: %s: %s", fname, strerror(errno));
+ isp->fname = xstrdup(fname);
+ isp->fp = fp;
+ isp->lineno = 0;
+ ++isp;
+}
+
+int
+delinput(void)
+{
+ if (isp == inputs)
+ return EOF;
+ --isp;
+ if (fclose(isp->fp) == EOF)
+ die("as: %s: %s", isp->fname, strerror(errno));
+ free(isp->fname);
+ return 0;
+}
--- /dev/null
+++ b/src/as/symbol.c
@@ -1,0 +1,291 @@
+static char sccsid[] = "@(#) ./as/symbol.c";
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include "as.h"
+
+#define HASHSIZ 64
+#define NALLOC 10
+
+Section *cursec, *seclist;
+Section *sabs, *sbss, *sdata, *stext;
+Symbol *linesym, *symlist;
+int pass;
+
+static Symbol *hashtbl[HASHSIZ], *symlast;
+static Alloc *tmpalloc;
+
+
+#ifndef NDEBUG
+void
+dumpstab(char *msg)
+{
+ Symbol **bp, *sym;
+
+ fprintf(stderr, "%s\n", msg);
+ for (bp = hashtbl; bp < &hashtbl[HASHSIZ]; ++bp) {
+ if (*bp == NULL)
+ continue;
+
+ fprintf(stderr, "[%d]", (int) (bp - hashtbl));
+ for (sym = *bp; sym; sym = sym->hash) {
+ fprintf(stderr, " -> %s:%0X:%0X",
+ sym->name.buf, sym->flags, sym->value);
+ }
+ putc('\n', stderr);
+ }
+}
+#endif
+
+Symbol *
+lookup(char *name)
+{
+ unsigned h;
+ Symbol *sym, **list;
+ int c, symtype;
+ char *t, *s;
+
+ h = 0;
+ for (s = name; c = *s; ++s)
+ h = h*33 ^ c;
+ h &= HASHSIZ-1;
+
+ c = toupper(*name);
+ list = &hashtbl[h];
+ for (sym = *list; sym; sym = sym->hash) {
+ t = sym->name.buf;
+ if (c == toupper(*t) && !casecmp(t, name))
+ return sym;
+ }
+
+ sym = xmalloc(sizeof(*sym));
+ sym->name = newstring(name);
+ sym->flags = 0;
+ sym->size = sym->value = 0;
+ sym->section = cursec;
+ sym->hash = *list;
+ sym->next = NULL;
+
+ *list = sym;
+ if (symlast)
+ symlast->next = sym;
+ symlast = sym;
+ if (!symlist)
+ symlist = sym;
+
+ return sym;
+}
+
+Symbol *
+deflabel(char *name)
+{
+ static Symbol *cursym;
+ Symbol *sym;
+ char label[MAXSYM+1];
+
+ if (*name == '.') {
+ int r;
+
+ if (!cursym) {
+ error("local label '%s' without global label", name);
+ return NULL;
+ }
+ r = snprintf(label, sizeof(label),
+ "%s%s",
+ cursym->name.buf, name);
+ if (r == sizeof(label)) {
+ error("local label '%s' in '%s' produces too long symbol",
+ name, cursym->name.buf);
+ return NULL;
+ }
+ name = label;
+ }
+
+ sym = lookup(name);
+ if (pass == 1 && (sym->flags & FDEF))
+ error("redefinition of label '%s'", name);
+ if (cursec->flags & SABS)
+ sym->flags |= FABS;
+ sym->flags |= FDEF;
+ sym->value = cursec->curpc;
+ sym->section = cursec;
+
+ if (*name != '.')
+ cursym = sym;
+ return sym;
+}
+
+int
+toobig(Node *np, int type)
+{
+ /* TODO */
+ return 0;
+}
+
+static void
+incpc(int siz)
+{
+ TUINT pc, curpc;
+
+ pc = cursec->pc;
+ curpc = cursec->curpc;
+
+ cursec->curpc += siz;
+ cursec->pc += siz;
+
+ if (pass == 2)
+ return;
+
+ if (cursec->pc > cursec->max)
+ cursec->max = cursec->pc;
+
+ if (pc > cursec->pc ||
+ curpc > cursec->curpc ||
+ cursec->curpc > maxaddr ||
+ cursec->pc > maxaddr) {
+ die("as: address overflow in section '%s'");
+ }
+}
+
+static int
+secflags(char *attr)
+{
+ int c, flags;
+
+ if (!attr)
+ return 0;
+
+ for (flags = 0; c = *attr++; ) {
+ switch (c) {
+ case 'w':
+ flags |= SWRITE;
+ break;
+ case 'r':
+ flags |= SREAD;
+ break;
+ case 'x':
+ flags |= SEXEC;
+ break;
+ case 'f':
+ flags |= SFILE;
+ break;
+ case 'l':
+ flags |= SLOAD;
+ break;
+ case 'a':
+ flags |= SABS;
+ break;
+ }
+ }
+
+ return flags;
+}
+
+Section *
+setsec(char *name, char *attr)
+{
+ Section *sec;
+ Symbol *sym;
+
+ cursec = NULL;
+ sym = lookup(name);
+ if (sym->flags & ~FSECT)
+ error("invalid section name '%s'", name);
+
+ if ((sec = sym->section) == NULL) {
+ sec = xmalloc(sizeof(*sec));
+ sec->mem = NULL;
+ sec->sym = sym;
+ sec->base = sec->max = sec->pc = sec->curpc = 0;
+ sec->next = seclist;
+ sec->flags = 0;
+ sec->fill = 0;
+ sec->aligment = 0;
+ sec->next = seclist;
+ seclist = sec;
+
+ sym->section = sec;
+ sym->flags = FSECT;
+ }
+ sec->flags |= secflags(attr);
+
+ return cursec = sec;
+}
+
+void
+isecs(void)
+{
+ sabs = setsec(".abs", "rwx");
+ sbss = setsec(".bss", "rwf");
+ sdata = setsec(".data", "rw");
+ stext = setsec(".text", "rx");
+}
+
+void
+cleansecs(void)
+{
+ Section *sec;
+ TUINT siz;
+
+ for (sec = seclist; sec; sec = sec->next) {
+ sec->curpc = sec->pc = sec->base;
+ if (pass == 1 || sec->flags & SFILE)
+ continue;
+
+ siz = sec->max - sec->base;
+ if (siz > SIZE_MAX)
+ die("as: out of memory");
+ sec->mem = xmalloc(sec->max - sec->base);
+ }
+ cursec = stext;
+}
+
+void
+emit(char *bytes, int n)
+{
+ if (cursec->mem) {
+ size_t len = cursec->pc - cursec->base;
+ memcpy(&cursec->mem[len], bytes, n);
+ }
+ incpc(n);
+}
+
+Symbol *
+tmpsym(TUINT val)
+{
+ Symbol *sym;
+
+ if (!tmpalloc)
+ tmpalloc = alloc(sizeof(*sym), NALLOC);
+ sym = new(tmpalloc);
+ sym->value = val;
+ sym->section = NULL;
+ sym->flags = FABS;
+
+ return sym;
+}
+
+void
+killtmp(void)
+{
+ if (!tmpalloc)
+ return;
+ dealloc(tmpalloc);
+ tmpalloc = NULL;
+}
+
+String
+newstring(char *s)
+{
+ size_t len = strlen(s) + 1;
+ String str;
+
+ str.offset = 0;
+ str.buf = xmalloc(len);
+ memcpy(str.buf, s, len);
+ return str;
+}
--- /dev/null
+++ b/src/as/target/amd64.mk
@@ -1,0 +1,10 @@
+AMD64_OBJ = $(OBJS) \
+ target/x86/amd64tbl.o \
+ target/x86/amd64.o \
+ target/x86/ins.o \
+
+target/x86/amd64tbl.c: target/x86/x86.dat target/x86/rules.dat
+ ./mktbl -f x86 -c amd64
+
+$(LIBEXEC)/as-amd64: $(AMD64_OBJ)
+ $(CC) $(SCC_LDFLAGS) $(AMD64_OBJ) -lscc -o $@
--- /dev/null
+++ b/src/as/target/i286.mk
@@ -1,0 +1,10 @@
+I286_OBJ = $(OBJS) \
+ target/x86/i286tbl.o \
+ target/x86/i286.o \
+ target/x86/ins.o \
+
+target/x86/i286tbl.c: target/x86/x86.dat target/x86/rules.dat
+ ./mktbl -f x86 -c i286
+
+$(LIBEXEC)/as-i286: $(I286_OBJ)
+ $(CC) $(SCC_LDFLAGS) $(I286_OBJ) -lscc -o $@
--- /dev/null
+++ b/src/as/target/i386.mk
@@ -1,0 +1,10 @@
+I386_OBJ = $(OBJS) \
+ target/x86/i386tbl.o \
+ target/x86/i386.o \
+ target/x86/ins.o \
+
+target/x86/i386tbl.c: target/x86/x86.dat target/x86/rules.dat
+ ./mktbl -f x86 -c i386
+
+$(LIBEXEC)/as-i386: $(I386_OBJ)
+ $(CC) $(SCC_LDFLAGS) $(I386_OBJ) -lscc -o $@
--- /dev/null
+++ b/src/as/target/x80/.gitignore
@@ -1,0 +1,1 @@
+z80tbl.c
--- /dev/null
+++ b/src/as/target/x80/ins.c
@@ -1,0 +1,601 @@
+static char sccsid[] = "@(#) ./as/target/x80/ins.c";
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+#include "proc.h"
+
+/*
+ * This implementation is based in:
+ * - Zilog Z80 CPU Specifications by Sean Young
+ * - Decoding Z80 opcodes - of use to disassembler and emulator
+ * writers - by Cristian Dinu.
+ */
+
+static int
+getclass(Node *np)
+{
+ if (np->addr != AREG)
+ return 0;
+
+ switch (np->sym->value) {
+ case AREG_C:
+ return RCLASS | PCLASS | QCLASS | CCCLASS | SSCLASS;
+ case AREG_A:
+ case AREG_B:
+ case AREG_D:
+ case AREG_E:
+ return RCLASS | PCLASS | QCLASS;
+ case AREG_H:
+ case AREG_L:
+ return RCLASS;
+ case AREG_IXL:
+ case AREG_IXH:
+ return PCLASS;
+ case AREG_IYL:
+ case AREG_IYH:
+ return QCLASS;
+ case AREG_HL:
+ return DDCLASS | QQCLASS;
+ case AREG_BC:
+ case AREG_DE:
+ return DDCLASS | QQCLASS | PPCLASS | RRCLASS;
+ case AREG_SP:
+ return DDCLASS | PPCLASS | RRCLASS;
+ case AREG_AF:
+ return QQCLASS;
+ case AREG_IX:
+ return PPCLASS;
+ case AREG_IY:
+ return RRCLASS;
+ case AREG_PO:
+ case AREG_PE:
+ case AREG_P:
+ case AREG_M:
+ return CCCLASS;
+ case AREG_NZ:
+ case AREG_Z:
+ case AREG_NC:
+ return CCCLASS | SSCLASS;
+ default:
+ return 0;
+ }
+}
+
+int
+match(Op *op, Node **args)
+{
+ unsigned char *p;
+ int arg, class, rep, opt;
+ Node *np;
+
+ if (!op->args)
+ return args == NULL;
+
+ opt = rep = 0;
+ for (p = op->args; arg = *p; ++p) {
+ if (rep)
+ --p;
+ if ((np = *args++) == NULL)
+ return (rep|opt) != 0;
+
+ switch (arg) {
+ case AOPT:
+ opt = 1;
+ break;
+ case AREP:
+ rep = 1;
+ break;
+ case AINDER_C:
+ arg = AREG_C;
+ goto indirect;
+ case AINDER_HL:
+ arg = AREG_HL;
+ goto indirect;
+ case AINDER_DE:
+ arg = AREG_DE;
+ goto indirect;
+ case AINDER_BC:
+ arg = AREG_BC;
+ goto indirect;
+ case AINDER_IX:
+ arg = AREG_IX;
+ goto indirect;
+ case AINDER_IY:
+ arg = AREG_IY;
+ goto indirect;
+ case AINDER_SP:
+ arg = AREG_SP;
+ indirect:
+ if (np->addr != AINDIR)
+ return 0;
+ np = np->left;
+ case AREG_A:
+ case AREG_I:
+ case AREG_R:
+ case AREG_F:
+ case AREG_HL:
+ case AREG_BC:
+ case AREG_DE:
+ case AREG_IY:
+ case AREG_IX:
+ case AREG_SP:
+ case AREG_AF:
+ case AREG_AF_:
+ if (np->addr != AREG || np->sym->value != arg)
+ return 0;
+ break;
+ case AREG_RCLASS:
+ class = RCLASS;
+ goto check_class;
+ case AREG_PCLASS:
+ class = PCLASS;
+ goto check_class;
+ case AREG_QCLASS:
+ class = QCLASS;
+ goto check_class;
+ case AREG_QQCLASS:
+ class = QQCLASS;
+ goto check_class;
+ case AREG_PPCLASS:
+ class = PPCLASS;
+ goto check_class;
+ case AREG_RRCLASS:
+ class = RRCLASS;
+ goto check_class;
+ case AREG_CCCLASS:
+ class = CCCLASS;
+ goto check_class;
+ case AREG_SSCLASS:
+ class = SSCLASS;
+ goto check_class;
+ case AREG_DDCLASS:
+ class = DDCLASS;
+ check_class:
+ if ((getclass(np) & class) == 0)
+ return 0;
+ break;
+ case AINDEX_IY:
+ arg = AREG_IY;
+ goto index_address;
+ case AINDEX_IX:
+ arg = AREG_IX;
+ index_address:
+ if (np->addr != AINDEX)
+ return 0;
+ if (np->left->left->sym->value != arg)
+ return 0;
+ if (toobig(np, arg))
+ error("overflow in index");
+ break;
+ case ARST:
+ if (np->addr != AIMM)
+ return 0;
+ if ((np->sym->value & ~0x38) != 0)
+ return 0;
+ break;
+ case AZERO:
+ case AIMM3:
+ case AIMM8:
+ case AIMM16:
+ case AIMM32:
+ case AIMM64:
+ if (np->addr != AIMM)
+ return 0;
+ if (toobig(np, arg))
+ error("overflow in immediate operand");
+ break;
+ case ASYM:
+ if (np->addr != AIMM || np->op != IDEN)
+ return 0;
+ break;
+ case ADIRECT:
+ case ASTR:
+ if (np->addr != arg)
+ return 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ return *args == NULL;
+}
+
+/*
+ * (expr) -> ADIRECT
+ * (REG) -> AINDIR
+ * (REG + expr) -> AINDEX
+ * (REG - expr) -> AINDEX
+ * expr (REG) -> AINDEX
+ */
+Node *
+moperand(void)
+{
+ int op;
+ Node *np, *dir, *off, *reg;
+
+ dir = off = reg = NULL;
+ if (accept('(')) {
+ if (yytoken != REG) {
+ dir = expr();
+ } else {
+ reg = getreg();
+ switch (yytoken) {
+ case '+':
+ case '-':
+ off = expr();
+ case ')':
+ break;
+ default:
+ unexpected();
+ }
+ }
+ } else {
+ off = expr();
+ expect('(');
+ reg = getreg();
+ }
+ expect(')');
+
+ if (dir) {
+ op = ADIRECT;
+ np = dir;
+ } else if (off) {
+ np = node(AREG_OFF, reg, off);
+ op = AINDEX;
+ } else {
+ np = reg;
+ op = AINDIR;
+ }
+ np = node(op, np, NULL);
+ np->addr = op;
+ return np;
+}
+
+static int
+reg2int(Node *np)
+{
+ switch (np->sym->value) {
+ case AREG_F:
+ case AREG_B: return 0;
+ case AREG_C: return 1;
+ case AREG_D: return 2;
+ case AREG_E: return 3;
+ case AREG_IXH:
+ case AREG_IYH:
+ case AREG_H: return 4;
+ case AREG_IXL:
+ case AREG_IYL:
+ case AREG_L: return 5;
+ case AREG_A: return 7;
+ case AREG_BC: return 0;
+ case AREG_DE: return 1;
+ case AREG_HL:
+ case AREG_IX:
+ case AREG_IY: return 2;
+ case AREG_AF:
+ case AREG_SP: return 3;
+ default: abort();
+ }
+}
+
+static int
+cc2int(Node *np)
+{
+ switch (np->sym->value) {
+ case AREG_NZ: return 0;
+ case AREG_Z: return 1;
+ case AREG_NC: return 2;
+ case AREG_C: return 3;
+ case AREG_PO: return 4;
+ case AREG_PE: return 5;
+ case AREG_P: return 6;
+ case AREG_M: return 7;
+ default: abort();
+ }
+}
+
+static int
+ss2int(Node *np)
+{
+ switch (np->sym->value) {
+ case AREG_NZ: return 4;
+ case AREG_Z: return 5;
+ case AREG_NC: return 6;
+ case AREG_C: return 7;
+ default: abort();
+ }
+}
+
+void
+dir(Op *op, Node **args)
+{
+ Node *imm;
+ unsigned char buf[4];
+ unsigned val;
+ int n = op->size;
+
+ imm = (args[1]->addr == ADIRECT) ? args[1] : args[0];
+ imm = imm->left;
+ memcpy(buf, op->bytes, n);
+ val = imm->sym->value;
+ buf[n-1] = val >> 8;
+ buf[n-2] = val;
+ emit(buf, n);
+}
+
+void
+ld8(Op *op, Node **args)
+{
+ Node *par1 = args[0], *par2 = args[1];
+ int n = op->size, i = n;;
+ unsigned regval = 0;
+ unsigned char buf[4];
+
+ memcpy(buf, op->bytes, n);
+
+ if (par1->addr == AREG)
+ regval |= reg2int(par1) << 3;
+ if (par2->addr == AREG)
+ regval |= reg2int(par2);
+ else if (par2->addr == AIMM)
+ buf[--i] = par2->sym->value;
+
+ buf[--i] |= regval;
+ emit(buf, n);
+}
+
+void
+alu16(Op *op, Node **args)
+{
+ Node *par;
+ int n = op->size;
+ unsigned val;
+ unsigned char buf[4];
+
+ par = (args[1]) ? args[1] : args[0];
+ val = reg2int(par);
+ memcpy(buf, op->bytes, n);
+ buf[n-1] |= val << 4;
+ emit(buf, n);
+}
+
+void
+ld16(Op *op, Node **args)
+{
+ Node *dst, *src, *tmp;
+ int n = op->size;
+ unsigned val;
+ unsigned char buf[4];
+
+ dst = args[0];
+ src = args[1];
+ if (!src) {
+ alu16(op, args);
+ return;
+ }
+
+ if (dst->addr != AREG) {
+ tmp = src;
+ src = dst;
+ dst = tmp;
+ }
+
+ memcpy(buf, op->bytes, n);
+ if (src->addr == ADIRECT)
+ src = src->left;
+ val = src->sym->value;
+ buf[n-1] = val >> 8;
+ buf[n-2] = val;
+ buf[n-3] |= reg2int(dst) << 4;
+ emit(buf, n);
+}
+
+void
+alu8(Op *op, Node **args)
+{
+ Node *par = args[1];
+ unsigned char buf[4];
+ int n = op->size, shift;
+ unsigned val;
+
+ if (args[1]) {
+ shift = 0;
+ par = args[1];
+ } else {
+ shift = 3;
+ par = args[0];
+ }
+
+ switch (par->addr) {
+ case AIMM:
+ val = par->sym->value;
+ break;
+ case AREG:
+ val = reg2int(par) << shift;
+ break;
+ case AINDEX:
+ val = par->left->right->sym->value;
+ break;
+ case AINDIR:
+ val = 0;
+ break;
+ default:
+ abort();
+ }
+
+ memcpy(buf, op->bytes, n);
+ buf[n-1] |= val;
+ emit(buf, n);
+}
+
+void
+idx(Op *op, Node **args)
+{
+ Node *tmp, *idx, *imm, *reg;
+ unsigned char buf[4];
+ int n = op->size, i = n, shift = 0;
+
+ imm = reg = NULL;
+ if (args[0]->addr != AINDEX) {
+ shift = 3;
+ tmp = args[0];
+ args[0] = args[1];
+ args[1] = tmp;
+ }
+ idx = args[0]->left->right;
+
+ if (args[1]->addr == AREG)
+ reg = args[1];
+ else
+ imm = args[1];
+
+ memcpy(buf, op->bytes, n);
+
+ if (imm)
+ buf[--i] = imm->sym->value;
+ buf[--i] = idx->sym->value;
+ if (reg)
+ buf[--i] |= reg2int(reg) << shift;
+
+ emit(buf, n);
+}
+
+void
+inout(Op *op, Node **args)
+{
+ Node *port, *value;
+ unsigned val;
+ int n = op->size;
+ unsigned char buf[5];
+
+ port = args[0];
+ value = args[1];
+ if (port->addr != ADIRECT && port->addr != AINDIR) {
+ value = port;
+ port = args[1];
+ }
+
+ if (port->addr == ADIRECT)
+ val = port->left->sym->value;
+ else if (value->addr == AREG)
+ val = reg2int(value) << 3;
+ else
+ val = 0;
+
+ memcpy(buf, op->bytes, n);
+ buf[n-1] |= val;
+ emit(buf, n);
+}
+
+void
+rot_bit(Op *op, Node **args)
+{
+ Node *par = args[0];
+ unsigned char buf[5];
+ int n = op->size;
+ unsigned val, npar = 0;
+
+ memcpy(buf, op->bytes, n);
+
+ par = args[0];
+ if (par->addr == AIMM) {
+ buf[n-1] |= par->sym->value << 3;
+ par = args[npar = 1];
+ }
+
+ switch (par->addr) {
+ case AINDEX:
+ val = par->left->right->sym->value;
+ buf[n-2] = val;
+ par = args[npar+1];
+ if (!par)
+ break;
+ case AREG:
+ val = reg2int(par);
+ buf[n-1] |= val;
+ case AINDIR:
+ break;
+ default:
+ abort();
+ }
+
+ emit(buf, n);
+}
+
+void
+im(Op *op, Node **args)
+{
+ unsigned val = args[0]->sym->value;
+ unsigned char buf[4];
+ int n = op->size;
+
+ if (val > 0)
+ ++val;
+
+ memcpy(buf, op->bytes, n);
+ buf[n-1] |= val << 3;
+ emit(buf, n);
+}
+
+void
+branch(int relative, Op *op, Node **args)
+{
+ unsigned char buf[4];
+ Node *flag, *imm;
+ int n = op->size, i = n;
+ unsigned val;
+ int (*fun)(Node *);
+
+ flag = imm = NULL;
+ if (args[0]->addr == AREG) {
+ flag = args[0];
+ imm = args[1];
+ } else if (args[0]->addr == AIMM) {
+ imm = args[0];
+ }
+ memcpy(buf, op->bytes, n);
+
+ if (imm) {
+ val = imm->sym->value;
+ if (!relative)
+ buf[--i] = val >> 8;
+ else
+ val -= cursec->curpc - 2;
+ buf[--i] = val;
+
+ }
+ if (flag) {
+ fun = (relative) ? ss2int : cc2int;
+ buf[--i] |= (*fun)(flag) << 3;
+ }
+
+
+ emit(buf, n);
+}
+
+void
+jp(Op *op, Node **args)
+{
+ branch(0, op, args);
+}
+
+void
+jr(Op *op, Node **args)
+{
+ branch(1, op, args);
+}
+
+void
+rst(Op *op, Node **args)
+{
+ unsigned char buf[1];
+
+ buf[0] = op->bytes[0];
+ buf[0] |= args[0]->sym->value;
+ emit(buf, 1);
+}
--- /dev/null
+++ b/src/as/target/x80/proc.h
@@ -1,0 +1,75 @@
+enum args {
+ AREG_AF = AMAX,
+ AREG_A,
+ AREG_F,
+
+ AREG_BC,
+ AREG_B,
+ AREG_C,
+
+ AREG_HL,
+ AREG_H,
+ AREG_L,
+
+ AREG_DE,
+ AREG_D,
+ AREG_E,
+
+ AREG_IX,
+ AREG_IXL,
+ AREG_IXH,
+
+ AREG_IY,
+ AREG_IYL,
+ AREG_IYH,
+
+ AREG_R,
+ AREG_I,
+ AREG_AF_,
+ AREG_SP,
+
+ AREG_NZ,
+ AREG_Z,
+ AREG_NC,
+ AREG_PO,
+ AREG_PE,
+ AREG_P,
+ AREG_M,
+
+ AREG_RCLASS, /* register class for B, C, D, E, H, L and A */
+ AREG_PCLASS, /* register class for B, C, D, E, IXH, IXL and A */
+ AREG_QCLASS, /* register class for B, C, D, E, IYH, IYL and A */
+ AREG_DDCLASS, /* register class for BC, DE, HL and SP */
+ AREG_QQCLASS, /* register class for BC, DE, HL and AF */
+ AREG_PPCLASS, /* register class for BC, DE, IX and SP */
+ AREG_RRCLASS, /* register class for BC, DE, IY and SP */
+ AREG_SSCLASS, /* flag class for C, NC, Z, NZ */
+ AREG_CCCLASS, /* flag class for NZ, Z, NC, C, PO, PE, P, M */
+
+ AINDEX_IX, /* (IX+d) */
+ AINDEX_IY, /* (IX+d) */
+
+ AINDER_HL, /* (HL) */
+ AINDER_DE, /* (DE) */
+ AINDER_BC, /* (BC) */
+ AINDER_SP, /* (SP) */
+ AINDER_C, /* (C) */
+ AINDER_IX, /* (IX) */
+ AINDER_IY, /* (IY) */
+
+ AIMM3, /* 3 bit immediate */
+ AZERO, /* a literal 0 */
+ ARST, /* 0h, 08h, 10h, 18h, 20h, 28h, 30h, 38h */
+};
+
+enum class {
+ RCLASS = 1 << 0,
+ PCLASS = 1 << 1,
+ QCLASS = 1 << 2,
+ DDCLASS = 1 << 3,
+ QQCLASS = 1 << 4,
+ PPCLASS = 1 << 5,
+ RRCLASS = 1 << 6,
+ CCCLASS = 1 << 7,
+ SSCLASS = 1 << 8,
+};
--- /dev/null
+++ b/src/as/target/x80/rules.dat
@@ -1,0 +1,39 @@
+imm8 AIMM8
+imm16 AIMM16
+imm32 AIMM32
+imm64 AIMM64
+imm3 AIMM3
+rst ARST
+\(IY\+n\) AINDEX_IY
+\(IX\+n\) AINDEX_IX
+ss AREG_SSCLASS
+cc AREG_CCCLASS
+dd AREG_DDCLASS
+qq AREG_QQCLASS
+rr AREG_RRCLASS
+pp AREG_PPCLASS
+p AREG_PCLASS
+q AREG_QCLASS
+r AREG_RCLASS
+R AREG_R
+\(DE\) AINDER_DE
+\(BC\) AINDER_BC
+\(HL\) AINDER_HL
+\(SP\) AINDER_SP
+\(C\) AINDER_C
+\(IX\) AINDER_IX
+\(IY\) AINDER_IY
+SP AREG_SP
+HL AREG_HL
+DE AREG_DE
+IX AREG_IX
+IY AREG_IY
+AF' AREG_AF_
+AF AREG_AF
+A AREG_A
+F AREG_F
+\(n\) ADIRECT
+I AREG_I
+0 AZERO
+sym ASYM
+string ASTR
--- /dev/null
+++ b/src/as/target/x80/x80.dat
@@ -1,0 +1,374 @@
+# Tab 18, tabs 18, :set ts=18
+# op args size bytes format cpu
+.SECTION sym,string? 0 none section Z80,R800,GB80
+.TEXT none 0 none text Z80,R800,GB80
+.DATA none 0 none data Z80,R800,GB80
+.BSS none 0 none bss Z80,R800,GB80
+.DB imm8+ 0 none defb Z80,R800,GB80
+.DEFB imm8+ 0 none defb Z80,R800,GB80
+.BYTE imm8+ 0 none defb Z80,R800,GB80
+.DW imm16+ 0 none defw Z80,R800,GB80
+.DEFW imm16+ 0 none defw Z80,R800,GB80
+.SHORT imm16+ 0 none defw Z80,R800,GB80
+.WORD imm16+ 0 none defw Z80,R800,GB80
+.DD imm32+ 0 none defd Z80,R800,GB80
+.DEFD imm32+ 0 none defd Z80,R800,GB80
+.LONG imm32+ 0 none defd Z80,R800,GB80
+.INT imm16+ 0 none defd Z80,R800,GB80
+.DQ imm64+ 0 none defq Z80,R800,GB80
+.DEFQ imm64+ 0 none defq Z80,R800,GB80
+.EQU sym,imm16 0 none equ Z80,R800,GB80
+.EQU imm16 0 none equ Z80,R800,GB80
+= imm16 0 none equ Z80,R800,GB80
+.SIZE sym,imm16 0 none size Z80,R800,GB80
+.SIZE imm16 0 none size Z80,R800,GB80
+.COMM sym,imm16 0 none common Z80,R800,GB80
+.COMM imm16 0 none common Z80,R800,GB80
+.TYPE sym,imm16 0 none type Z80,R800,GB80
+.TYPE imm16 0 none type Z80,R800,GB80
+.GLOBL sym+ 0 none global Z80,R800,GB80
+.PUBLIC sym+ 0 none global Z80,R800,GB80
+.EXTERN sym+ 0 none extrn Z80,R800,GB80
+.EXTRN sym+ 0 none extrn Z80,R800,GB80
+.STRING string+ 0 none string Z80,R800,GB80
+.ASCII string+ 0 none ascii Z80,R800,GB80
+.ALIGN imm16+ 0 none align Z80,R800,GB80
+.END none 0 none end Z80,R800,GB80
+.INCLUDE string 0 none include Z80,R800,GB80
+
+
+
+# p is any register from B, C, D, E, IXL, IXH, A
+# q is any register from B, C, D, E, IYL, IYH, A
+# r is any register from B, C, D, E, L, H, A
+# dd is any register from BC, DE, HL, SP
+# qq is any register from BC, DE, HL, AF
+# pp is any register from BC, DE, IX, SP
+# rr is any register from BC, DE, IY, SP
+# cc is any flag from NZ, Z, NC, C, PO, PE, P, M
+# ss is any flag from C, NC, Z, NZ
+
+# 8 bit load group
+LD r,imm8 2 0x06 ld8 Z80,R800,GB80
+LD p,imm8 3 0xdd,0x06 ld8 Z80,R800
+LD q,imm8 3 0xfd,0x06 ld8 Z80,R800
+LD (HL),imm8 2 0x36 ld8 Z80,R800,GB80
+
+LD r,r 1 0x40 ld8 Z80,R800,GB80
+LD p,p 2 0xdd,0x40 ld8 Z80,R800
+LD q,q 2 0xfd,0x40 ld8 Z80,R800
+LD (HL),r 1 0x70 ld8 Z80,R800,GB80
+LD r,(HL) 1 0x46 ld8 Z80,R800,GB80
+
+LD r,(IX+n) 3 0xdd,0x46 idx Z80,R800
+LD r,(IY+n) 3 0xfd,0x46 idx Z80,R800
+LD (IX+n),r 3 0xdd,0x70 idx Z80,R800
+LD (IY+n),r 3 0xfd,0x70 idx Z80,R800
+
+LD (HL),imm8 2 0x36 ld8 Z80,R800,GB80
+LD (IX+n),imm8 4 0xdd,0x36 idx Z80,R800
+LD (IY+n),imm8 4 0xfd,0x36 idx Z80,R800
+
+LD A,(BC) 1 0x0a noargs Z80,R800,GB80
+LD A,(DE) 1 0x1a noargs Z80,R800,GB80
+LD A,(n) 3 0x3a dir Z80,R800
+
+LD (BC),A 1 0x2 noargs Z80,R800,GB80
+LD (DE),A 1 0x12 noargs Z80,R800,GB80
+LD (n),A 3 0x32 dir Z80,R800
+
+LD A,(n) 3 0xfa dir GB80
+LD A,(HL+) 1 0x2a ld8 GB80 #TODO
+LD A,(HL-) 1 0x3a ld8 GB80 #TODO
+LD A,($FF00+n) 2 0xf0 dir GB80 #TODO
+LD A,($FF00+C) 2 0xf2 dir GB80 #TODO
+
+LD (n),A 3 0xea dir GB80
+LD (HL+),A 1 0x22 ld8 GB80 #TODO
+LD (HL-),A 1 0x32 ld8 GB80 #TODO
+LD ($FF00+n),A 2 0xe0 dir GB80 #TODO
+LD ($FF00+C),A 2 0xe2 dir GB80 #TODO
+
+LD A,I 2 0xed,0x57 noargs Z80,R800
+LD A,R 2 0xed,0x5f noargs Z80,R800
+LD I,A 2 0xed,0x47 noargs Z80,R800
+LD R,A 2 0xed,0x4f noargs Z80,R800
+
+# 16 bit load group
+LD dd,imm16 3 0x01 ld16 Z80,R800,GB80
+LD IX,imm16 4 0xdd,0x21 ld16 Z80,R800
+LD IY,imm16 4 0xfd,0x21 ld16 Z80,R800
+
+LD HL,(n) 3 0x2a ld16 Z80,R800,GB80
+LD dd,(n) 4 0xed,0x4b ld16 Z80,R800
+LD IX,(n) 4 0xdd,0x2a ld16 Z80,R800
+LD IY,(n) 4 0xfd,0x2a ld16 Z80,R800
+
+LD (n),HL 3 0x22 ld16 Z80,R800,GB80
+LD (n),dd 4 0xed,0x43 ld16 Z80,R800
+LD (n),IX 4 0xdd,0x22 ld16 Z80,R800
+LD (n),IY 4 0xfd,0x22 ld16 Z80,R800
+
+LD SP,HL 1 0xf9 noargs Z80,R800,GB80
+LD SP,IX 2 0xdd,0xf9 noargs Z80,R800
+LD SP,IY 2 0xfd,0xf9 noargs Z80,R800
+
+PUSH qq 1 0xc5 ld16 Z80,R800,GB80
+PUSH IX 2 0xdd,0xe5 ld16 Z80,R800
+PUSH IY 2 0xfd,0xe5 ld16 Z80,R800
+POP qq 1 0xc1 ld16 Z80,R800,GB80
+POP IX 2 0xdd,0xe1 ld16 Z80,R800
+POP IY 2 0xfd,0xe1 ld16 Z80,R800
+
+# 8 bit ALU group
+ADD A,r 1 0x80 alu8 Z80,R800,GB80
+ADD A,p 2 0xdd,0x80 alu8 Z80,R800
+ADD A,q 2 0xfd,0x80 alu8 Z80,R800
+ADD A,imm8 2 0xc6 alu8 Z80,R800,GB80
+ADD A,(HL) 1 0x86 alu8 Z80,R800,GB80
+ADD A,(IX+n) 3 0xdd,0x86 alu8 Z80,R800
+ADD A,(IY+n) 3 0xfd,0x86 alu8 Z80,R800
+
+ADC A,r 1 0x88 alu8 Z80,R800,GB80
+ADC A,p 2 0xdd,0x88 alu8 Z80,R800
+ADC A,q 2 0xfd,0x88 alu8 Z80,R800
+ADC A,imm8 2 0xce alu8 Z80,R800,GB80
+ADC A,(HL) 1 0x8e alu8 Z80,R800,GB80
+ADC A,(IX+n) 3 0xdd,0x8e alu8 Z80,R800
+ADC A,(IY+n) 3 0xfd,0x8e alu8 Z80,R800
+
+SUB A,r 1 0x90 alu8 Z80,R800,GB80
+SUB A,p 2 0xdd,0x90 alu8 Z80,R800
+SUB A,q 2 0xfd,0x90 alu8 Z80,R800
+SUB A,imm8 2 0xd6 alu8 Z80,R800,GB80
+SUB A,(HL) 1 0x96 alu8 Z80,R800,GB80
+SUB A,(IX+n) 3 0xdd,0x96 alu8 Z80,R800
+SUB A,(IY+n) 3 0xfd,0x96 alu8 Z80,R800
+
+SBC A,r 1 0x98 alu8 Z80,R800,GB80
+SBC A,p 2 0xdd,0x98 alu8 Z80,R800
+SBC A,q 2 0xfd,0x98 alu8 Z80,R800
+SBC A,imm8 2 0xde alu8 Z80,R800,GB80
+SBC A,(HL) 1 0x9e alu8 Z80,R800,GB80
+SBC A,(IX+n) 3 0xdd,0x9e alu8 Z80,R800
+SBC A,(IY+n) 3 0xfd,0x9e alu8 Z80,R800
+
+AND A,r 1 0xa0 alu8 Z80,R800,GB80
+AND A,p 2 0xdd,0xa0 alu8 Z80,R800
+AND A,q 2 0xfd,0xa0 alu8 Z80,R800
+AND A,imm8 2 0xe6 alu8 Z80,R800,GB80
+AND A,(HL) 1 0xa6 alu8 Z80,R800,GB80
+AND A,(IX+n) 3 0xdd,0xa6 alu8 Z80,R800
+AND A,(IY+n) 3 0xfd,0xa6 alu8 Z80,R800
+
+OR A,r 1 0xb0 alu8 Z80,R800,GB80
+OR A,p 2 0xdd,0xb0 alu8 Z80,R800
+OR A,q 2 0xfd,0xb0 alu8 Z80,R800
+OR A,imm8 2 0xf6 alu8 Z80,R800,GB80
+OR A,(HL) 1 0xb6 alu8 Z80,R800,GB80
+OR A,(IX+n) 3 0xdd,0xb6 alu8 Z80,R800
+OR A,(IY+n) 3 0xfd,0xb6 alu8 Z80,R800
+
+XOR A,r 1 0xa8 alu8 Z80,R800,GB80
+XOR A,p 2 0xdd,0xa8 alu8 Z80,R800
+XOR A,q 2 0xfd,0xa8 alu8 Z80,R800
+XOR A,imm8 2 0xee alu8 Z80,R800,GB80
+XOR A,(HL) 1 0xae alu8 Z80,R800,GB80
+XOR A,(IX+n) 3 0xdd,0xae alu8 Z80,R800
+XOR A,(IY+n) 3 0xfd,0xae alu8 Z80,R800
+
+CP A,r 1 0xb8 alu8 Z80,R800,GB80
+CP A,p 2 0xdd,0xb8 alu8 Z80,R800
+CP A,q 2 0xfd,0xb8 alu8 Z80,R800
+CP A,imm8 2 0xfe alu8 Z80,R800,GB80
+CP A,(HL) 1 0xbe alu8 Z80,R800,GB80
+CP A,(IX+n) 3 0xdd,0xbe alu8 Z80,R800
+CP A,(IY+n) 3 0xfd,0xbe alu8 Z80,R800
+
+INC r 1 0x04 alu8 Z80,R800,GB80
+INC p 2 0xdd,0x04 alu8 Z80,R800
+INC q 2 0xfd,0x04 alu8 Z80,R800
+INC (HL) 1 0x34 alu8 Z80,R800,GB80
+INC (IX+n) 3 0xdd,0x34 alu8 Z80,R800
+INC (IY+n) 3 0xfd,0x34 alu8 Z80,R800
+
+DEC r 1 0x05 alu8 Z80,R800,GB80
+DEC p 2 0xdd,0x05 alu8 Z80,R800
+DEC q 2 0xfd,0x05 alu8 Z80,R800
+DEC (HL) 1 0x35 alu8 Z80,R800,GB80
+DEC (IX+n) 3 0xdd,0x35 alu8 Z80,R800
+DEC (IY+n) 3 0xfd,0x35 alu8 Z80,R800
+
+ADD SP,dd 2 0xE8 alu8 GB80
+LD HL,SP+imm8 2 0xF8 alu8 GB80
+
+# 16 bit ALU group
+ADD HL,dd 1 0x09 alu16 Z80,R800,GB80
+ADC HL,dd 2 0xed,0x4a alu16 Z80,R800
+SBC HL,dd 2 0xed,0x42 alu16 Z80,R800
+ADD IX,pp 2 0xdd,0x09 alu16 Z80,R800
+ADD IY,rr 2 0xfd,0x09 alu16 Z80,R800
+
+INC dd 1 0x03 alu16 Z80,R800,GB80
+INC IX 2 0xdd,0x23 alu16 Z80,R800
+INC IY 2 0xfd,0x23 alu16 Z80,R800
+
+DEC dd 1 0x0b alu16 Z80,R800,GB80
+DEC IX 2 0xdd,0x2b alu16 Z80,R800
+DEC IY 2 0xfd,0x2b alu16 Z80,R800
+
+# General purpose arithmetic and CPU control group
+DAA none 1 0x27 noargs Z80,R800,GB80
+CPL none 1 0x2f noargs Z80,R800,GB80
+NEG none 2 0xed,0x44 noargs Z80,R800
+CCF none 1 0x3f noargs Z80,R800,GB80
+SCF none 1 0x37 noargs Z80,R800,GB80
+NOP none 1 0x00 noargs Z80,R800,GB80
+HALT none 1 0x76 noargs Z80,R800,GB80
+STOP none 2 0x10,0x00 noargs GB80
+DI none 1 0xf3 noargs Z80,R800,GB80
+EI none 1 0xfb noargs Z80,R800,GB80
+IM imm8 2 0xed,0x46 im Z80,R800
+
+# Exchange, block transfer and search groups
+EX DE,HL 1 0xeb noargs Z80,R800
+EX AF,AF' 1 0x08 noargs Z80,R800
+EXX none 1 0xd9 noargs Z80,R800
+EX (SP),HL 1 0xe3 noargs Z80,R800
+EX (SP),IX 2 0xdd,0xe3 noargs Z80,R800
+EX (SP),IY 2 0xfd,0xe3 noargs Z80,R800
+
+LDI none 2 0xed,0xa0 noargs Z80,R800
+LDIR none 2 0xed,0xb0 noargs Z80,R800
+LDD none 2 0xed,0xa8 noargs Z80,R800
+LDDR none 2 0xed,0xb8 noargs Z80,R800
+
+CPI none 2 0xed,0xa1 noargs Z80,R800
+CPIR none 2 0xed,0xb1 noargs Z80,R800
+CPD none 2 0xed,0xa9 noargs Z80,R800
+CPDR none 2 0xed,0xb9 noargs Z80,R800
+
+# Rotate and shift group
+RLCA none 1 0x07 noargs Z80,R800,GB80
+RLA none 1 0x17 noargs Z80,R800,GB80
+RRCA none 1 0x0f noargs Z80,R800,GB80
+RRA none 1 0x1f noargs Z80,R800,GB80
+
+RLD none 2 0xed,0x6f noargs Z80,R800
+RRD none 2 0xed,0x67 noargs Z80,R800
+
+RLC r 2 0xcb,0x00 rot_bit Z80,R800,GB80
+RLC (HL) 2 0xcb,0x06 rot_bit Z80,R800,GB80
+RLC (IX+n) 4 0xdd,0xcb,0,0x06 rot_bit Z80,R800
+RLC (IY+n) 4 0xfd,0xcb,0,0x06 rot_bit Z80,R800
+RLC (IX+n),r 4 0xdd,0xcb,0,0x00 rot_bit Z80,R800
+RLC (IY+n),r 4 0xfd,0xcb,0,0x00 rot_bit Z80,R800
+
+RL r 2 0xcb,0x10 rot_bit Z80,R800,GB80
+RL (HL) 2 0xcb,0x16 rot_bit Z80,R800,GB80
+RL (IX+n) 4 0xdd,0xcb,0,0x16 rot_bit Z80,R800
+RL (IY+n) 4 0xfd,0xcb,0,0x16 rot_bit Z80,R800
+RL (IX+n),r 4 0xdd,0xcb,0,0x10 rot_bit Z80,R800
+RL (IY+n),r 4 0xfd,0xcb,0,0x10 rot_bit Z80,R800
+
+RRC r 2 0xcb,0x08 rot_bit Z80,R800,GB80
+RRC (HL) 2 0xcb,0x0e rot_bit Z80,R800,GB80
+RRC (IX+n) 4 0xdd,0xcb,0,0x0e rot_bit Z80,R800
+RRC (IY+n) 4 0xfd,0xcb,0,0x0e rot_bit Z80,R800
+RRC (IX+n),r 4 0xdd,0xcb,0,0x08 rot_bit Z80,R800
+RRC (IY+n),r 4 0xfd,0xcb,0,0x08 rot_bit Z80,R800
+
+RR r 2 0xcb,0x18 rot_bit Z80,R800,GB80
+RR (HL) 2 0xcb,0x1e rot_bit Z80,R800,GB80
+RR (IX+n) 4 0xdd,0xcb,0,0x1e rot_bit Z80,R800
+RR (IY+n) 4 0xfd,0xcb,0,0x1e rot_bit Z80,R800
+RR (IX+n),r 4 0xdd,0xcb,0,0x18 rot_bit Z80,R800
+RR (IY+n),r 4 0xfd,0xcb,0,0x18 rot_bit Z80,R800
+
+SLA r 2 0xcb,0x20 rot_bit Z80,R800,GB80
+SLA (HL) 2 0xcb,0x26 rot_bit Z80,R800,GB80
+SLA (IX+n) 4 0xdd,0xcb,0,0x26 rot_bit Z80,R800
+SLA (IY+n) 4 0xfd,0xcb,0,0x26 rot_bit Z80,R800
+SLA (IX+n),r 4 0xdd,0xcb,0,0x20 rot_bit Z80,R800
+SLA (IY+n),r 4 0xfd,0xcb,0,0x20 rot_bit Z80,R800
+
+SWAP r 2 0xcb,0x30 rot_bit GB80
+SWAP (HL) 2 0xcb,0x36 rot_bit GB80
+
+SLL r 2 0xcb,0x30 rot_bit Z80
+SLL (HL) 2 0xcb,0x36 rot_bit Z80
+SLL (IX+n) 4 0xdd,0xcb,0,0x36 rot_bit Z80
+SLL (IY+n) 4 0xfd,0xcb,0,0x36 rot_bit Z80
+SLL (IX+n),r 4 0xdd,0xcb,0,0x30 rot_bit Z80
+SLL (IY+n),r 4 0xfd,0xcb,0,0x30 rot_bit Z80
+
+SRA r 2 0xcb,0x28 rot_bit Z80,R800,GB80
+SRA (HL) 2 0xcb,0x2e rot_bit Z80,R800,GB80
+SRA (IX+n) 4 0xdd,0xcb,0,0x2e rot_bit Z80,R800
+SRA (IY+n) 4 0xfd,0xcb,0,0x2e rot_bit Z80,R800
+SRA (IX+n),r 4 0xdd,0xcb,0,0x28 rot_bit Z80,R800
+SRA (IY+n),r 4 0xfd,0xcb,0,0x28 rot_bit Z80,R800
+
+SRL r 2 0xcb,0x38 rot_bit Z80,R800,GB80
+SRL (HL) 2 0xcb,0x3e rot_bit Z80,R800,GB80
+SRL (IX+n) 4 0xdd,0xcb,0,0x3e rot_bit Z80,R800
+SRL (IY+n) 4 0xfd,0xcb,0,0x3e rot_bit Z80,R800
+SRL (IX+n),r 4 0xdd,0xcb,0,0x38 rot_bit Z80,R800
+SRL (IY+n),r 4 0xfd,0xcb,0,0x38 rot_bit Z80,R800
+
+# Bit manipulation group
+BIT imm3,r 2 0xcb,0x40 rot_bit Z80,R800,GB80
+BIT imm3,(HL) 2 0xcb,0x46 rot_bit Z80,R800
+BIT imm3,(IX+n) 4 0xdd,0xcb,0,0x46 rot_bit Z80,R800
+BIT imm3,(IY+n) 4 0xfd,0xcb,0,0x46 rot_bit Z80,R800
+
+SET imm3,r 2 0xcb,0xc0 rot_bit Z80,R800,GB80
+SET imm3,(HL) 2 0xcb,0xc6 rot_bit Z80,R800,GB80
+SET imm3,(IX+n) 4 0xdd,0xcb,0,0xc6 rot_bit Z80,R800
+SET imm3,(IY+n) 4 0xfd,0xcb,0,0xc6 rot_bit Z80,R800
+SET imm3,(IX+n),r 4 0xdd,0xcb,0,0xc0 rot_bit Z80,R800
+SET imm3,(IY+n),r 4 0xfd,0xcb,0,0xc0 rot_bit Z80,R800
+
+RES imm3,r 2 0xcb,0x80 rot_bit Z80,R800,GB80
+RES imm3,(HL) 2 0xcb,0x86 rot_bit Z80,R800,GB80
+RES imm3,(IX+n) 4 0xdd,0xcb,0,0x86 rot_bit Z80,R800
+RES imm3,(IY+n) 4 0xfd,0xcb,0,0x86 rot_bit Z80,R800
+RES imm3,(IX+n),r 4 0xdd,0xcb,0,0x80 rot_bit Z80,R800
+RES imm3,(IY+n),r 4 0xfd,0xcb,0,0x80 rot_bit Z80,R800
+
+# Input and output group
+IN A,(n) 2 0xdb inout Z80,R800
+IN r,(C) 2 0xed,0x40 inout Z80,R800
+IN F,(C) 2 0xed,0x70 inout Z80,R800
+INI none 2 0xed,0xa2 noargs Z80,R800
+INIR none 2 0xed,0xb2 noargs Z80,R800
+IND none 2 0xed,0xaa noargs Z80,R800
+INDR none 2 0xed,0xba noargs Z80,R800
+
+OUT (n),A 2 0xd3 inout Z80,R800
+OUT (C),r 2 0xed,0x41 inout Z80,R800
+OUT (C),0 2 0xed,0x71 inout Z80,R800
+OUTI none 2 0xed,0xa3 noargs Z80,R800
+OTIR none 2 0xed,0xb3 noargs Z80,R800
+OUTD none 2 0xed,0xab noargs Z80,R800
+OTDR none 2 0xed,0xbb noargs Z80,R800
+
+# Jump group
+JP imm16 3 0xc3 jp Z80,R800,GB80
+JP cc,imm16 3 0xc2 jp Z80,R800,GB80
+JR imm16 2 0x18 jr Z80,R800,GB80
+JR ss,imm16 2 0x00 jr Z80,R800,GB80
+JP HL 1 0xe9 noargs Z80,R800,GB80
+JP IX 2 0xdd,0xe9 noargs Z80,R800
+JP IY 2 0xfd,0xe9 noargs Z80,R800
+DJNZ imm16 2 0x10 jr Z80,R800
+
+# Call and return group
+CALL imm16 3 0xcd jp Z80,R800,GB80
+CALL cc,imm16 3 0xc4 jp Z80,R800,GB80
+RET none 1 0xc9 noargs Z80,R800,GB80
+RET cc 1 0xc0 jp Z80,R800,GB80
+RETI none 2 0xed,0x4d noargs Z80,R800
+RETI none 1 0xd9 noargs GB80
+RETN none 2 0xed,0x45 noargs Z80,R800
+RST rst 1 0xc7 rst Z80,R800,GB80
--- /dev/null
+++ b/src/as/target/x80/z80.c
@@ -1,0 +1,65 @@
+static char sccsid[] = "@(#) ./as/target/x80/z80.c";
+
+#include <stdlib.h>
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+#include "../x80/proc.h"
+
+TUINT maxaddr = 0xFFFFFFFF;
+int endian = LITTLE_ENDIAN;
+
+void
+iarch(void)
+{
+ static struct {
+ char *name;
+ char type;
+ } regs[] = {
+ "AF", AREG_AF,
+ "A", AREG_A,
+ "F", AREG_F,
+
+ "BC", AREG_BC,
+ "B", AREG_B,
+ "C", AREG_C,
+
+ "HL", AREG_HL,
+ "H", AREG_H,
+ "L", AREG_L,
+
+ "DE", AREG_DE,
+ "D", AREG_D,
+ "E", AREG_E,
+
+ "IX", AREG_IX,
+ "IXL", AREG_IXL,
+ "IXH", AREG_IXH,
+
+ "IY", AREG_IY,
+ "IYL", AREG_IYL,
+ "IYH", AREG_IYH,
+
+ "R", AREG_R,
+ "I", AREG_I,
+ "AF'", AREG_AF_,
+ "SP", AREG_SP,
+
+ "NZ", AREG_NZ,
+ "Z", AREG_Z,
+ "NC", AREG_NC,
+ "PO", AREG_PO,
+ "PE", AREG_PE,
+ "P", AREG_P,
+ "M", AREG_M,
+
+ NULL,
+ }, *bp;
+
+ for (bp = regs; bp->name; ++bp) {
+ Symbol *sym = lookup(bp->name);
+ sym->flags = FREG;
+ sym->value = bp->type;
+ }
+}
--- /dev/null
+++ b/src/as/target/x86/.gitignore
@@ -1,0 +1,3 @@
+amd64tbl.c
+i286tbl.c
+i386tbl.c
--- /dev/null
+++ b/src/as/target/x86/amd64.c
@@ -1,0 +1,13 @@
+static char sccsid[] = "@(#) ./as/target/x86/amd64.c";
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+
+TUINT maxaddr = 0xFFFFFFFFFFFFFFFF;
+int endian = LITTLE_ENDIAN;
+
+void
+iarch(void)
+{
+}
--- /dev/null
+++ b/src/as/target/x86/i286.c
@@ -1,0 +1,54 @@
+static char sccsid[] = "@(#) ./as/target/x86/i286.c";
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+#include "../x86/proc.h"
+
+TUINT maxaddr = 0xFFFF;
+int endian = LITTLE_ENDIAN;
+int left2right = 0;
+
+void
+iarch(void)
+{
+ static struct {
+ char *name;
+ char type;
+ } regs[] = {
+ "CS", AREG_CS,
+ "DS", AREG_DS,
+ "SS", AREG_SS,
+ "ES", AREG_ES,
+
+ "AX", AREG_AX,
+ "AL", AREG_AL,
+ "AH", AREG_AH,
+
+ "BX", AREG_BX,
+ "BL", AREG_BL,
+ "BH", AREG_BH,
+
+ "CX", AREG_CX,
+ "CL", AREG_CL,
+ "CH", AREG_CH,
+
+ "DX", AREG_DX,
+ "DL", AREG_DL,
+ "DH", AREG_DH,
+
+ "SI", AREG_SI,
+ "DI", AREG_DI,
+
+ "SP", AREG_SP,
+ "BP", AREG_BP,
+
+ NULL
+ }, *bp;
+
+ for (bp = regs; bp->name; ++bp) {
+ Symbol *sym = lookup(bp->name);
+ sym->flags = FREG;
+ sym->value = bp->type;
+ }
+}
--- /dev/null
+++ b/src/as/target/x86/i386.c
@@ -1,0 +1,101 @@
+static char sccsid[] = "@(#) ./as/target/x86/i386.c";
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+#include "../x86/proc.h"
+
+TUINT maxaddr = 0xFFFFFFFF;
+int endian = LITTLE_ENDIAN;
+
+void
+iarch(void)
+{
+ static struct {
+ char *name;
+ char type;
+ } regs[] = {
+ "CS", AREG_CS,
+ "DS", AREG_DS,
+ "SS", AREG_SS,
+ "ES", AREG_ES,
+ "FS", AREG_FS,
+ "GS", AREG_GS,
+
+ "AX", AREG_AX,
+ "AL", AREG_AL,
+ "AH", AREG_AH,
+ "EAX", AREG_EAX,
+
+ "BC", AREG_BX,
+ "BL", AREG_BL,
+ "BH", AREG_BH,
+ "EBX", AREG_EBX,
+
+ "CX", AREG_CX,
+ "CL", AREG_CL,
+ "CH", AREG_CH,
+ "ECX", AREG_ECX,
+
+ "DX", AREG_DX,
+ "DL", AREG_DL,
+ "DH", AREG_DH,
+ "EDX", AREG_EDX,
+
+ "SI", AREG_SI,
+ "ESI", AREG_ESI,
+ "DI", AREG_DI,
+ "EDI", AREG_EDI,
+
+ "SP", AREG_SP,
+ "ESP", AREG_ESP,
+
+ "BP", AREG_BP,
+ "EBP", AREG_EBP,
+
+ "R0", AREG_R0,
+ "MM0", AREG_MM0,
+ "R1", AREG_R1,
+ "MM1", AREG_MM1,
+ "R2", AREG_R2,
+ "MM2", AREG_MM2,
+ "R3", AREG_R3,
+ "MM3", AREG_MM3,
+ "R4", AREG_R4,
+ "MM4", AREG_MM4,
+ "R5", AREG_R5,
+ "MM5", AREG_MM5,
+ "R6", AREG_R6,
+ "MM6", AREG_MM6,
+ "R7", AREG_R7,
+ "MM7", AREG_MM7,
+
+ "XMM0", AREG_XMM0,
+ "XMM1", AREG_XMM1,
+ "XMM2", AREG_XMM2,
+ "XMM3", AREG_XMM3,
+ "XMM4", AREG_XMM4,
+ "XMM5", AREG_XMM5,
+ "XMM6", AREG_XMM6,
+ "XMM7", AREG_XMM7,
+
+ "YMM0", AREG_YMM0,
+ "YMM1", AREG_YMM1,
+ "YMM2", AREG_YMM2,
+ "YMM3", AREG_YMM3,
+ "YMM4", AREG_YMM4,
+ "YMM5", AREG_YMM5,
+ "YMM6", AREG_YMM6,
+ "YMM7", AREG_YMM7,
+
+ "MXCSR", AREG_MXCSR,
+
+ NULL
+ }, *bp;
+
+ for (bp = regs; bp->name; ++bp) {
+ Symbol *sym = lookup(bp->name);
+ sym->flags = FREG;
+ sym->value = bp->type;
+ }
+}
--- /dev/null
+++ b/src/as/target/x86/ins.c
@@ -1,0 +1,302 @@
+static char sccsid[] = "@(#) ./as/target/x86/ins.c";
+
+#include <stdlib.h>
+
+#include <scc/scc.h>
+
+#include "../../as.h"
+#include "proc.h"
+
+#define addrbyte(mod, reg, rm) ((mod) << 6 | (reg) << 3 | (rm))
+
+enum addr_mode {
+ MEM_MODE = 0,
+ MEM8_MODE = 1,
+ MEM16_MODE = 2,
+ REG_MODE = 3,
+};
+
+static int
+getclass(Node *np)
+{
+ if (np->addr != AREG)
+ return 0;
+
+ switch (np->sym->value) {
+ case AREG_AL:
+ case AREG_AH:
+ case AREG_BL:
+ case AREG_BH:
+ case AREG_CL:
+ case AREG_CH:
+ case AREG_DL:
+ case AREG_DH:
+ return R8CLASS;
+
+ case AREG_AX:
+ case AREG_BX:
+ case AREG_CX:
+ case AREG_DX:
+ case AREG_DI:
+ case AREG_SI:
+ case AREG_SP:
+ case AREG_BP:
+ return R16CLASS;
+
+ case AREG_CS:
+ case AREG_DS:
+ case AREG_SS:
+ case AREG_ES:
+ case AREG_FS:
+ case AREG_GS:
+
+ case AREG_EFLAGS:
+ case AREG_CF:
+ case AREG_PF:
+ case AREG_AF:
+ case AREG_ZF:
+ case AREG_SF:
+ case AREG_TF:
+ case AREG_IF:
+ case AREG_DF:
+ case AREG_OF:
+ case AREG_IOPL:
+ case AREG_NT:
+ case AREG_RF:
+ case AREG_VM:
+ case AREG_AC:
+ case AREG_VIF:
+ case AREG_VIP:
+ case AREG_ID:
+
+ case AREG_EAX:
+ case AREG_RAX:
+
+ case AREG_EBX:
+ case AREG_RBX:
+
+ case AREG_ECX:
+ case AREG_RCX:
+
+ case AREG_EDX:
+ case AREG_RDX:
+
+ case AREG_SIL:
+ case AREG_ESI:
+ case AREG_RSI:
+ case AREG_DIL:
+ case AREG_EDI:
+ case AREG_RDI:
+
+ case AREG_SPL:
+ case AREG_ESP:
+ case AREG_RSP:
+
+ case AREG_BPL:
+ case AREG_EBP:
+ case AREG_RBP:
+
+ case AREG_R0:
+ case AREG_MM0:
+ case AREG_R1:
+ case AREG_MM1:
+ case AREG_R2:
+ case AREG_MM2:
+ case AREG_R3:
+ case AREG_MM3:
+ case AREG_R4:
+ case AREG_MM4:
+ case AREG_R5:
+ case AREG_MM5:
+ case AREG_R6:
+ case AREG_MM6:
+ case AREG_R7:
+ case AREG_MM7:
+
+ case AREG_R8:
+ case AREG_R8L:
+ case AREG_R8W:
+ case AREG_R9:
+ case AREG_R9L:
+ case AREG_R9W:
+ case AREG_R10:
+ case AREG_R10L:
+ case AREG_R10W:
+ case AREG_R11:
+ case AREG_R11L:
+ case AREG_R11W:
+ case AREG_R12:
+ case AREG_R12L:
+ case AREG_R12W:
+ case AREG_R13:
+ case AREG_R13L:
+ case AREG_R13W:
+ case AREG_R14:
+ case AREG_R14L:
+ case AREG_R14W:
+ case AREG_R15:
+ case AREG_R15L:
+ case AREG_R15W:
+
+ case AREG_XMM0:
+ case AREG_XMM1:
+ case AREG_XMM2:
+ case AREG_XMM3:
+ case AREG_XMM4:
+ case AREG_XMM5:
+ case AREG_XMM6:
+ case AREG_XMM7:
+ case AREG_XMM8:
+ case AREG_XMM9:
+ case AREG_XMM10:
+ case AREG_XMM11:
+ case AREG_XMM12:
+ case AREG_XMM13:
+ case AREG_XMM14:
+ case AREG_XMM15:
+
+ case AREG_YMM0:
+ case AREG_YMM1:
+ case AREG_YMM2:
+ case AREG_YMM3:
+ case AREG_YMM4:
+ case AREG_YMM5:
+ case AREG_YMM6:
+ case AREG_YMM7:
+ case AREG_YMM8:
+ case AREG_YMM9:
+ case AREG_YMM10:
+ case AREG_YMM11:
+ case AREG_YMM12:
+ case AREG_YMM13:
+ case AREG_YMM14:
+ case AREG_YMM15:
+
+ case AREG_MXCSR:
+ return 0;
+ default:
+ abort();
+ }
+}
+
+int
+match(Op *op, Node **args)
+{
+ unsigned char *p;
+ int arg, class, rep, opt;
+ Node *np;
+
+ if (!op->args)
+ return args == NULL;
+
+ opt = rep = 0;
+ for (p = op->args; arg = *p; ++p) {
+ if (rep)
+ --p;
+ if ((np = *args++) == NULL)
+ return (rep|opt) != 0;
+
+ switch (arg) {
+ case AOPT:
+ opt = 1;
+ break;
+ case AREP:
+ rep = 1;
+ break;
+ case AREG_R8CLASS:
+ class = R8CLASS;
+ goto check_class;
+ case AREG_R16CLASS:
+ class = R16CLASS;
+ check_class:
+ if ((getclass(np) & class) == 0)
+ return 0;
+ break;
+ case AIMM8:
+ case AIMM16:
+ case AIMM32:
+ case AIMM64:
+ if (np->addr != AIMM)
+ return 0;
+ if (toobig(np, arg))
+ error("overflow in immediate operand");
+ break;
+ case ASYM:
+ if (np->addr != AIMM || np->op != IDEN)
+ return 0;
+ break;
+ case ADIRECT:
+ case ASTR:
+ if (np->addr != arg)
+ return 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ return *args == NULL;
+}
+
+Node *
+moperand(void)
+{
+}
+
+static int
+reg8toint(Node *np)
+{
+ switch (np->sym->value) {
+ case AREG_AL: return 0;
+ case AREG_CL: return 1;
+ case AREG_DL: return 2;
+ case AREG_BL: return 3;
+ case AREG_AH: return 4;
+ case AREG_CH: return 5;
+ case AREG_DH: return 6;
+ case AREG_BH: return 7;
+ default: abort();
+ }
+}
+
+void
+reg8_reg8(Op *op, Node **args)
+{
+ int src, dst;
+ char buf[2];
+
+ src = reg8toint(args[0]);
+ dst = reg8toint(args[1]);
+ buf[0] = op->bytes[0];
+ buf[1] = addrbyte(REG_MODE, src, dst);
+ emit(buf, 2);
+}
+
+static int
+reg16toint(Node *np)
+{
+ switch (np->sym->value) {
+ case AREG_AX: return 0;
+ case AREG_CX: return 1;
+ case AREG_DX: return 2;
+ case AREG_BX: return 3;
+ case AREG_SP: return 4;
+ case AREG_BP: return 5;
+ case AREG_SI: return 6;
+ case AREG_DI: return 7;
+ default: abort();
+ }
+}
+
+void
+reg16_reg16(Op *op, Node **args)
+{
+ int src, dst;
+ char buf[2];
+
+ src = reg16toint(args[0]);
+ dst = reg16toint(args[1]);
+ buf[0] = op->bytes[0];
+ buf[1] = addrbyte(REG_MODE, src, dst);
+ emit(buf, 2);
+}
--- /dev/null
+++ b/src/as/target/x86/nasm.dat
@@ -1,0 +1,5313 @@
+;; --------------------------------------------------------------------------
+;;
+;; Copyright 1996-2017 The NASM Authors - All Rights Reserved
+;; See the file AUTHORS included with the NASM distribution for
+;; the specific copyright holders.
+;;
+;; Redistribution and use in source and binary forms, with or without
+;; modification, are permitted provided that the following
+;; conditions are met:
+;;
+;; * Redistributions of source code must retain the above copyright
+;; notice, this list of conditions and the following disclaimer.
+;; * Redistributions in binary form must reproduce the above
+;; copyright notice, this list of conditions and the following
+;; disclaimer in the documentation and/or other materials provided
+;; with the distribution.
+;;
+;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+;; CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+;; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+;; NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+;; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+;; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+;; EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;
+;; --------------------------------------------------------------------------
+
+;
+; insns.dat table of instructions for the Netwide Assembler
+;
+; Format of file: All four fields must be present on every functional
+; line. Hence `void' for no-operand instructions, and `\0' for such
+; as EQU. If the last three fields are all `ignore', no action is
+; taken except to register the opcode as being present.
+;
+; For a detailed description of the code string (third field), please
+; see insns.pl and the comment at the top of assemble.c. For a detailed
+; description of the flags (fourth field), please see insns-iflags.ph.
+;
+; Comments with a pound sign after the semicolon generate section
+; subheaders in the NASM documentation.
+;
+
+;# Special instructions (pseudo-ops)
+; These MUST be first in this file and must maintain the pattern of
+; Dx by size, RESx by size, and INCBIN in that order.
+DT ignore ignore ignore
+DO ignore ignore ignore
+DY ignore ignore ignore
+DZ ignore ignore ignore
+RESB imm [ resb] 8086
+RESW ignore ignore ignore
+RESD ignore ignore ignore
+RESQ ignore ignore ignore
+REST ignore ignore ignore
+RESO ignore ignore ignore
+RESY ignore ignore ignore
+RESZ ignore ignore ignore
+INCBIN ignore ignore ignore
+
+;# Conventional instructions
+AAA void [ 37] 8086,NOLONG
+AAD void [ d5 0a] 8086,NOLONG
+AAD imm [i: d5 ib,u] 8086,SB,NOLONG
+AAM void [ d4 0a] 8086,NOLONG
+AAM imm [i: d4 ib,u] 8086,SB,NOLONG
+AAS void [ 3f] 8086,NOLONG
+ADC mem,reg8 [mr: hle 10 /r] 8086,SM,LOCK
+ADC reg8,reg8 [mr: 10 /r] 8086
+ADC mem,reg16 [mr: hle o16 11 /r] 8086,SM,LOCK
+ADC reg16,reg16 [mr: o16 11 /r] 8086
+ADC mem,reg32 [mr: hle o32 11 /r] 386,SM,LOCK
+ADC reg32,reg32 [mr: o32 11 /r] 386
+ADC mem,reg64 [mr: hle o64 11 /r] X64,SM,LOCK
+ADC reg64,reg64 [mr: o64 11 /r] X64
+ADC reg8,mem [rm: 12 /r] 8086,SM
+ADC reg8,reg8 [rm: 12 /r] 8086
+ADC reg16,mem [rm: o16 13 /r] 8086,SM
+ADC reg16,reg16 [rm: o16 13 /r] 8086
+ADC reg32,mem [rm: o32 13 /r] 386,SM
+ADC reg32,reg32 [rm: o32 13 /r] 386
+ADC reg64,mem [rm: o64 13 /r] X64,SM
+ADC reg64,reg64 [rm: o64 13 /r] X64
+ADC rm16,imm8 [mi: hle o16 83 /2 ib,s] 8086,LOCK
+ADC rm32,imm8 [mi: hle o32 83 /2 ib,s] 386,LOCK
+ADC rm64,imm8 [mi: hle o64 83 /2 ib,s] X64,LOCK
+ADC reg_al,imm [-i: 14 ib] 8086,SM
+ADC reg_ax,sbyteword [mi: o16 83 /2 ib,s] 8086,SM,ND
+ADC reg_ax,imm [-i: o16 15 iw] 8086,SM
+ADC reg_eax,sbytedword [mi: o32 83 /2 ib,s] 386,SM,ND
+ADC reg_eax,imm [-i: o32 15 id] 386,SM
+ADC reg_rax,sbytedword [mi: o64 83 /2 ib,s] X64,SM,ND
+ADC reg_rax,imm [-i: o64 15 id,s] X64,SM
+ADC rm8,imm [mi: hle 80 /2 ib] 8086,SM,LOCK
+ADC rm16,sbyteword [mi: hle o16 83 /2 ib,s] 8086,SM,LOCK,ND
+ADC rm16,imm [mi: hle o16 81 /2 iw] 8086,SM,LOCK
+ADC rm32,sbytedword [mi: hle o32 83 /2 ib,s] 386,SM,LOCK,ND
+ADC rm32,imm [mi: hle o32 81 /2 id] 386,SM,LOCK
+ADC rm64,sbytedword [mi: hle o64 83 /2 ib,s] X64,SM,LOCK,ND
+ADC rm64,imm [mi: hle o64 81 /2 id,s] X64,SM,LOCK
+ADC mem,imm8 [mi: hle 80 /2 ib] 8086,SM,LOCK,ND
+ADC mem,sbyteword16 [mi: hle o16 83 /2 ib,s] 8086,SM,LOCK,ND
+ADC mem,imm16 [mi: hle o16 81 /2 iw] 8086,SM,LOCK
+ADC mem,sbytedword32 [mi: hle o32 83 /2 ib,s] 386,SM,LOCK,ND
+ADC mem,imm32 [mi: hle o32 81 /2 id] 386,SM,LOCK
+ADC rm8,imm [mi: hle 82 /2 ib] 8086,SM,LOCK,ND,NOLONG
+ADD mem,reg8 [mr: hle 00 /r] 8086,SM,LOCK
+ADD reg8,reg8 [mr: 00 /r] 8086
+ADD mem,reg16 [mr: hle o16 01 /r] 8086,SM,LOCK
+ADD reg16,reg16 [mr: o16 01 /r] 8086
+ADD mem,reg32 [mr: hle o32 01 /r] 386,SM,LOCK
+ADD reg32,reg32 [mr: o32 01 /r] 386
+ADD mem,reg64 [mr: hle o64 01 /r] X64,SM,LOCK
+ADD reg64,reg64 [mr: o64 01 /r] X64
+ADD reg8,mem [rm: 02 /r] 8086,SM
+ADD reg8,reg8 [rm: 02 /r] 8086
+ADD reg16,mem [rm: o16 03 /r] 8086,SM
+ADD reg16,reg16 [rm: o16 03 /r] 8086
+ADD reg32,mem [rm: o32 03 /r] 386,SM
+ADD reg32,reg32 [rm: o32 03 /r] 386
+ADD reg64,mem [rm: o64 03 /r] X64,SM
+ADD reg64,reg64 [rm: o64 03 /r] X64
+ADD rm16,imm8 [mi: hle o16 83 /0 ib,s] 8086,LOCK
+ADD rm32,imm8 [mi: hle o32 83 /0 ib,s] 386,LOCK
+ADD rm64,imm8 [mi: hle o64 83 /0 ib,s] X64,LOCK
+ADD reg_al,imm [-i: 04 ib] 8086,SM
+ADD reg_ax,sbyteword [mi: o16 83 /0 ib,s] 8086,SM,ND
+ADD reg_ax,imm [-i: o16 05 iw] 8086,SM
+ADD reg_eax,sbytedword [mi: o32 83 /0 ib,s] 386,SM,ND
+ADD reg_eax,imm [-i: o32 05 id] 386,SM
+ADD reg_rax,sbytedword [mi: o64 83 /0 ib,s] X64,SM,ND
+ADD reg_rax,imm [-i: o64 05 id,s] X64,SM
+ADD rm8,imm [mi: hle 80 /0 ib] 8086,SM,LOCK
+ADD rm16,sbyteword [mi: hle o16 83 /0 ib,s] 8086,SM,LOCK,ND
+ADD rm16,imm [mi: hle o16 81 /0 iw] 8086,SM,LOCK
+ADD rm32,sbytedword [mi: hle o32 83 /0 ib,s] 386,SM,LOCK,ND
+ADD rm32,imm [mi: hle o32 81 /0 id] 386,SM,LOCK
+ADD rm64,sbytedword [mi: hle o64 83 /0 ib,s] X64,SM,LOCK,ND
+ADD rm64,imm [mi: hle o64 81 /0 id,s] X64,SM,LOCK
+ADD mem,imm8 [mi: hle 80 /0 ib] 8086,SM,LOCK
+ADD mem,sbyteword16 [mi: hle o16 83 /0 ib,s] 8086,SM,LOCK,ND
+ADD mem,imm16 [mi: hle o16 81 /0 iw] 8086,SM,LOCK
+ADD mem,sbytedword32 [mi: hle o32 83 /0 ib,s] 386,SM,LOCK,ND
+ADD mem,imm32 [mi: hle o32 81 /0 id] 386,SM,LOCK
+ADD rm8,imm [mi: hle 82 /0 ib] 8086,SM,LOCK,ND,NOLONG
+AND mem,reg8 [mr: hle 20 /r] 8086,SM,LOCK
+AND reg8,reg8 [mr: 20 /r] 8086
+AND mem,reg16 [mr: hle o16 21 /r] 8086,SM,LOCK
+AND reg16,reg16 [mr: o16 21 /r] 8086
+AND mem,reg32 [mr: hle o32 21 /r] 386,SM,LOCK
+AND reg32,reg32 [mr: o32 21 /r] 386
+AND mem,reg64 [mr: hle o64 21 /r] X64,SM,LOCK
+AND reg64,reg64 [mr: o64 21 /r] X64
+AND reg8,mem [rm: 22 /r] 8086,SM
+AND reg8,reg8 [rm: 22 /r] 8086
+AND reg16,mem [rm: o16 23 /r] 8086,SM
+AND reg16,reg16 [rm: o16 23 /r] 8086
+AND reg32,mem [rm: o32 23 /r] 386,SM
+AND reg32,reg32 [rm: o32 23 /r] 386
+AND reg64,mem [rm: o64 23 /r] X64,SM
+AND reg64,reg64 [rm: o64 23 /r] X64
+AND rm16,imm8 [mi: hle o16 83 /4 ib,s] 8086,LOCK
+AND rm32,imm8 [mi: hle o32 83 /4 ib,s] 386,LOCK
+AND rm64,imm8 [mi: hle o64 83 /4 ib,s] X64,LOCK
+AND reg_al,imm [-i: 24 ib] 8086,SM
+AND reg_ax,sbyteword [mi: o16 83 /4 ib,s] 8086,SM,ND
+AND reg_ax,imm [-i: o16 25 iw] 8086,SM
+AND reg_eax,sbytedword [mi: o32 83 /4 ib,s] 386,SM,ND
+AND reg_eax,imm [-i: o32 25 id] 386,SM
+AND reg_rax,sbytedword [mi: o64 83 /4 ib,s] X64,SM,ND
+AND reg_rax,imm [-i: o64 25 id,s] X64,SM
+AND rm8,imm [mi: hle 80 /4 ib] 8086,SM,LOCK
+AND rm16,sbyteword [mi: hle o16 83 /4 ib,s] 8086,SM,LOCK,ND
+AND rm16,imm [mi: hle o16 81 /4 iw] 8086,SM,LOCK
+AND rm32,sbytedword [mi: hle o32 83 /4 ib,s] 386,SM,LOCK,ND
+AND rm32,imm [mi: hle o32 81 /4 id] 386,SM,LOCK
+AND rm64,sbytedword [mi: hle o64 83 /4 ib,s] X64,SM,LOCK,ND
+AND rm64,imm [mi: hle o64 81 /4 id,s] X64,SM,LOCK
+AND mem,imm8 [mi: hle 80 /4 ib] 8086,SM,LOCK
+AND mem,sbyteword16 [mi: hle o16 83 /4 ib,s] 8086,SM,LOCK,ND
+AND mem,imm16 [mi: hle o16 81 /4 iw] 8086,SM,LOCK
+AND mem,sbytedword32 [mi: hle o32 83 /4 ib,s] 386,SM,LOCK,ND
+AND mem,imm32 [mi: hle o32 81 /4 id] 386,SM,LOCK
+AND rm8,imm [mi: hle 82 /4 ib] 8086,SM,LOCK,ND,NOLONG
+ARPL mem,reg16 [mr: 63 /r] 286,PROT,SM,NOLONG
+ARPL reg16,reg16 [mr: 63 /r] 286,PROT,NOLONG
+BB0_RESET void [ 0f 3a] PENT,CYRIX,ND,OBSOLETE
+BB1_RESET void [ 0f 3b] PENT,CYRIX,ND,OBSOLETE
+BOUND reg16,mem [rm: o16 62 /r] 186,NOLONG
+BOUND reg32,mem [rm: o32 62 /r] 386,NOLONG
+BSF reg16,mem [rm: o16 nof3 0f bc /r] 386,SM
+BSF reg16,reg16 [rm: o16 nof3 0f bc /r] 386
+BSF reg32,mem [rm: o32 nof3 0f bc /r] 386,SM
+BSF reg32,reg32 [rm: o32 nof3 0f bc /r] 386
+BSF reg64,mem [rm: o64 nof3 0f bc /r] X64,SM
+BSF reg64,reg64 [rm: o64 nof3 0f bc /r] X64
+BSR reg16,mem [rm: o16 nof3 0f bd /r] 386,SM
+BSR reg16,reg16 [rm: o16 nof3 0f bd /r] 386
+BSR reg32,mem [rm: o32 nof3 0f bd /r] 386,SM
+BSR reg32,reg32 [rm: o32 nof3 0f bd /r] 386
+BSR reg64,mem [rm: o64 nof3 0f bd /r] X64,SM
+BSR reg64,reg64 [rm: o64 nof3 0f bd /r] X64
+BSWAP reg32 [r: o32 0f c8+r] 486
+BSWAP reg64 [r: o64 0f c8+r] X64
+BT mem,reg16 [mr: o16 0f a3 /r] 386,SM
+BT reg16,reg16 [mr: o16 0f a3 /r] 386
+BT mem,reg32 [mr: o32 0f a3 /r] 386,SM
+BT reg32,reg32 [mr: o32 0f a3 /r] 386
+BT mem,reg64 [mr: o64 0f a3 /r] X64,SM
+BT reg64,reg64 [mr: o64 0f a3 /r] X64
+BT rm16,imm [mi: o16 0f ba /4 ib,u] 386,SB
+BT rm32,imm [mi: o32 0f ba /4 ib,u] 386,SB
+BT rm64,imm [mi: o64 0f ba /4 ib,u] X64,SB
+BTC mem,reg16 [mr: hle o16 0f bb /r] 386,SM,LOCK
+BTC reg16,reg16 [mr: o16 0f bb /r] 386
+BTC mem,reg32 [mr: hle o32 0f bb /r] 386,SM,LOCK
+BTC reg32,reg32 [mr: o32 0f bb /r] 386
+BTC mem,reg64 [mr: hle o64 0f bb /r] X64,SM,LOCK
+BTC reg64,reg64 [mr: o64 0f bb /r] X64
+BTC rm16,imm [mi: hle o16 0f ba /7 ib,u] 386,SB,LOCK
+BTC rm32,imm [mi: hle o32 0f ba /7 ib,u] 386,SB,LOCK
+BTC rm64,imm [mi: hle o64 0f ba /7 ib,u] X64,SB,LOCK
+BTR mem,reg16 [mr: hle o16 0f b3 /r] 386,SM,LOCK
+BTR reg16,reg16 [mr: o16 0f b3 /r] 386
+BTR mem,reg32 [mr: hle o32 0f b3 /r] 386,SM,LOCK
+BTR reg32,reg32 [mr: o32 0f b3 /r] 386
+BTR mem,reg64 [mr: hle o64 0f b3 /r] X64,SM,LOCK
+BTR reg64,reg64 [mr: o64 0f b3 /r] X64
+BTR rm16,imm [mi: hle o16 0f ba /6 ib,u] 386,SB,LOCK
+BTR rm32,imm [mi: hle o32 0f ba /6 ib,u] 386,SB,LOCK
+BTR rm64,imm [mi: hle o64 0f ba /6 ib,u] X64,SB,LOCK
+BTS mem,reg16 [mr: hle o16 0f ab /r] 386,SM,LOCK
+BTS reg16,reg16 [mr: o16 0f ab /r] 386
+BTS mem,reg32 [mr: hle o32 0f ab /r] 386,SM,LOCK
+BTS reg32,reg32 [mr: o32 0f ab /r] 386
+BTS mem,reg64 [mr: hle o64 0f ab /r] X64,SM,LOCK
+BTS reg64,reg64 [mr: o64 0f ab /r] X64
+BTS rm16,imm [mi: hle o16 0f ba /5 ib,u] 386,SB,LOCK
+BTS rm32,imm [mi: hle o32 0f ba /5 ib,u] 386,SB,LOCK
+BTS rm64,imm [mi: hle o64 0f ba /5 ib,u] X64,SB,LOCK
+CALL imm [i: odf e8 rel] 8086,BND
+CALL imm|near [i: odf e8 rel] 8086,ND,BND
+CALL imm|far [i: odf 9a iwd seg] 8086,ND,NOLONG
+; Call/jmp near imm/reg/mem is always 64-bit in long mode.
+CALL imm16 [i: o16 e8 rel] 8086,NOLONG,BND
+CALL imm16|near [i: o16 e8 rel] 8086,ND,NOLONG,BND
+CALL imm16|far [i: o16 9a iwd seg] 8086,ND,NOLONG
+CALL imm32 [i: o32 e8 rel] 386,NOLONG,BND
+CALL imm32|near [i: o32 e8 rel] 386,ND,NOLONG,BND
+CALL imm32|far [i: o32 9a iwd seg] 386,ND,NOLONG
+CALL imm64 [i: o64nw e8 rel] X64,BND
+CALL imm64|near [i: o64nw e8 rel] X64,ND,BND
+CALL imm:imm [ji: odf 9a iwd iw] 8086,NOLONG
+CALL imm16:imm [ji: o16 9a iw iw] 8086,NOLONG
+CALL imm:imm16 [ji: o16 9a iw iw] 8086,NOLONG
+CALL imm32:imm [ji: o32 9a id iw] 386,NOLONG
+CALL imm:imm32 [ji: o32 9a id iw] 386,NOLONG
+CALL mem|far [m: odf ff /3] 8086,NOLONG
+CALL mem|far [m: o64 ff /3] X64
+CALL mem16|far [m: o16 ff /3] 8086
+CALL mem32|far [m: o32 ff /3] 386
+CALL mem64|far [m: o64 ff /3] X64
+CALL mem|near [m: odf ff /2] 8086,ND,BND
+CALL rm16|near [m: o16 ff /2] 8086,NOLONG,ND,BND
+CALL rm32|near [m: o32 ff /2] 386,NOLONG,ND,BND
+CALL rm64|near [m: o64nw ff /2] X64,ND,BND
+CALL mem [m: odf ff /2] 8086,BND
+CALL rm16 [m: o16 ff /2] 8086,NOLONG,BND
+CALL rm32 [m: o32 ff /2] 386,NOLONG,BND
+CALL rm64 [m: o64nw ff /2] X64,BND
+
+CBW void [ o16 98] 8086
+CDQ void [ o32 99] 386
+CDQE void [ o64 98] X64
+CLC void [ f8] 8086
+CLD void [ fc] 8086
+CLI void [ fa] 8086
+CLTS void [ 0f 06] 286,PRIV
+CMC void [ f5] 8086
+CMP mem,reg8 [mr: 38 /r] 8086,SM
+CMP reg8,reg8 [mr: 38 /r] 8086
+CMP mem,reg16 [mr: o16 39 /r] 8086,SM
+CMP reg16,reg16 [mr: o16 39 /r] 8086
+CMP mem,reg32 [mr: o32 39 /r] 386,SM
+CMP reg32,reg32 [mr: o32 39 /r] 386
+CMP mem,reg64 [mr: o64 39 /r] X64,SM
+CMP reg64,reg64 [mr: o64 39 /r] X64
+CMP reg8,mem [rm: 3a /r] 8086,SM
+CMP reg8,reg8 [rm: 3a /r] 8086
+CMP reg16,mem [rm: o16 3b /r] 8086,SM
+CMP reg16,reg16 [rm: o16 3b /r] 8086
+CMP reg32,mem [rm: o32 3b /r] 386,SM
+CMP reg32,reg32 [rm: o32 3b /r] 386
+CMP reg64,mem [rm: o64 3b /r] X64,SM
+CMP reg64,reg64 [rm: o64 3b /r] X64
+CMP rm16,imm8 [mi: o16 83 /7 ib,s] 8086
+CMP rm32,imm8 [mi: o32 83 /7 ib,s] 386
+CMP rm64,imm8 [mi: o64 83 /7 ib,s] X64
+CMP reg_al,imm [-i: 3c ib] 8086,SM
+CMP reg_ax,sbyteword [mi: o16 83 /7 ib,s] 8086,SM,ND
+CMP reg_ax,imm [-i: o16 3d iw] 8086,SM
+CMP reg_eax,sbytedword [mi: o32 83 /7 ib,s] 386,SM,ND
+CMP reg_eax,imm [-i: o32 3d id] 386,SM
+CMP reg_rax,sbytedword [mi: o64 83 /7 ib,s] X64,SM,ND
+CMP reg_rax,imm [-i: o64 3d id,s] X64,SM
+CMP rm8,imm [mi: 80 /7 ib] 8086,SM
+CMP rm16,sbyteword [mi: o16 83 /7 ib,s] 8086,SM,ND
+CMP rm16,imm [mi: o16 81 /7 iw] 8086,SM
+CMP rm32,sbytedword [mi: o32 83 /7 ib,s] 386,SM,ND
+CMP rm32,imm [mi: o32 81 /7 id] 386,SM
+CMP rm64,sbytedword [mi: o64 83 /7 ib,s] X64,SM,ND
+CMP rm64,imm [mi: o64 81 /7 id,s] X64,SM
+CMP mem,imm8 [mi: 80 /7 ib] 8086,SM
+CMP mem,sbyteword16 [mi: o16 83 /7 ib,s] 8086,SM,ND
+CMP mem,imm16 [mi: o16 81 /7 iw] 8086,SM
+CMP mem,sbytedword32 [mi: o32 83 /7 ib,s] 386,SM,ND
+CMP mem,imm32 [mi: o32 81 /7 id] 386,SM
+CMP rm8,imm [mi: 82 /7 ib] 8086,SM,ND,NOLONG
+CMPSB void [ repe a6] 8086
+CMPSD void [ repe o32 a7] 386
+CMPSQ void [ repe o64 a7] X64
+CMPSW void [ repe o16 a7] 8086
+CMPXCHG mem,reg8 [mr: hle 0f b0 /r] PENT,SM,LOCK
+CMPXCHG reg8,reg8 [mr: 0f b0 /r] PENT
+CMPXCHG mem,reg16 [mr: hle o16 0f b1 /r] PENT,SM,LOCK
+CMPXCHG reg16,reg16 [mr: o16 0f b1 /r] PENT
+CMPXCHG mem,reg32 [mr: hle o32 0f b1 /r] PENT,SM,LOCK
+CMPXCHG reg32,reg32 [mr: o32 0f b1 /r] PENT
+CMPXCHG mem,reg64 [mr: hle o64 0f b1 /r] X64,SM,LOCK
+CMPXCHG reg64,reg64 [mr: o64 0f b1 /r] X64
+CMPXCHG486 mem,reg8 [mr: 0f a6 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
+CMPXCHG486 reg8,reg8 [mr: 0f a6 /r] 486,UNDOC,ND,OBSOLETE
+CMPXCHG486 mem,reg16 [mr: o16 0f a7 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
+CMPXCHG486 reg16,reg16 [mr: o16 0f a7 /r] 486,UNDOC,ND,OBSOLETE
+CMPXCHG486 mem,reg32 [mr: o32 0f a7 /r] 486,SM,UNDOC,ND,LOCK,OBSOLETE
+CMPXCHG486 reg32,reg32 [mr: o32 0f a7 /r] 486,UNDOC,ND,OBSOLETE
+CMPXCHG8B mem [m: hle norexw 0f c7 /1] PENT,LOCK
+CMPXCHG16B mem [m: o64 0f c7 /1] X64,LOCK
+CPUID void [ 0f a2] PENT
+CPU_READ void [ 0f 3d] PENT,CYRIX
+CPU_WRITE void [ 0f 3c] PENT,CYRIX
+CQO void [ o64 99] X64
+CWD void [ o16 99] 8086
+CWDE void [ o32 98] 386
+DAA void [ 27] 8086,NOLONG
+DAS void [ 2f] 8086,NOLONG
+DEC reg16 [r: o16 48+r] 8086,NOLONG
+DEC reg32 [r: o32 48+r] 386,NOLONG
+DEC rm8 [m: hle fe /1] 8086,LOCK
+DEC rm16 [m: hle o16 ff /1] 8086,LOCK
+DEC rm32 [m: hle o32 ff /1] 386,LOCK
+DEC rm64 [m: hle o64 ff /1] X64,LOCK
+DIV rm8 [m: f6 /6] 8086
+DIV rm16 [m: o16 f7 /6] 8086
+DIV rm32 [m: o32 f7 /6] 386
+DIV rm64 [m: o64 f7 /6] X64
+DMINT void [ 0f 39] P6,CYRIX
+EMMS void [ 0f 77] PENT,MMX
+ENTER imm,imm [ij: c8 iw ib,u] 186
+EQU imm ignore 8086
+EQU imm:imm ignore 8086
+F2XM1 void [ d9 f0] 8086,FPU
+FABS void [ d9 e1] 8086,FPU
+FADD mem32 [m: d8 /0] 8086,FPU
+FADD mem64 [m: dc /0] 8086,FPU
+FADD fpureg|to [r: dc c0+r] 8086,FPU
+FADD fpureg [r: d8 c0+r] 8086,FPU
+FADD fpureg,fpu0 [r-: dc c0+r] 8086,FPU
+FADD fpu0,fpureg [-r: d8 c0+r] 8086,FPU
+FADD void [ de c1] 8086,FPU,ND
+FADDP fpureg [r: de c0+r] 8086,FPU
+FADDP fpureg,fpu0 [r-: de c0+r] 8086,FPU
+FADDP void [ de c1] 8086,FPU,ND
+FBLD mem80 [m: df /4] 8086,FPU
+FBLD mem [m: df /4] 8086,FPU
+FBSTP mem80 [m: df /6] 8086,FPU
+FBSTP mem [m: df /6] 8086,FPU
+FCHS void [ d9 e0] 8086,FPU
+FCLEX void [ wait db e2] 8086,FPU
+FCMOVB fpureg [r: da c0+r] P6,FPU
+FCMOVB fpu0,fpureg [-r: da c0+r] P6,FPU
+FCMOVB void [ da c1] P6,FPU,ND
+FCMOVBE fpureg [r: da d0+r] P6,FPU
+FCMOVBE fpu0,fpureg [-r: da d0+r] P6,FPU
+FCMOVBE void [ da d1] P6,FPU,ND
+FCMOVE fpureg [r: da c8+r] P6,FPU
+FCMOVE fpu0,fpureg [-r: da c8+r] P6,FPU
+FCMOVE void [ da c9] P6,FPU,ND
+FCMOVNB fpureg [r: db c0+r] P6,FPU
+FCMOVNB fpu0,fpureg [-r: db c0+r] P6,FPU
+FCMOVNB void [ db c1] P6,FPU,ND
+FCMOVNBE fpureg [r: db d0+r] P6,FPU
+FCMOVNBE fpu0,fpureg [-r: db d0+r] P6,FPU
+FCMOVNBE void [ db d1] P6,FPU,ND
+FCMOVNE fpureg [r: db c8+r] P6,FPU
+FCMOVNE fpu0,fpureg [-r: db c8+r] P6,FPU
+FCMOVNE void [ db c9] P6,FPU,ND
+FCMOVNU fpureg [r: db d8+r] P6,FPU
+FCMOVNU fpu0,fpureg [-r: db d8+r] P6,FPU
+FCMOVNU void [ db d9] P6,FPU,ND
+FCMOVU fpureg [r: da d8+r] P6,FPU
+FCMOVU fpu0,fpureg [-r: da d8+r] P6,FPU
+FCMOVU void [ da d9] P6,FPU,ND
+FCOM mem32 [m: d8 /2] 8086,FPU
+FCOM mem64 [m: dc /2] 8086,FPU
+FCOM fpureg [r: d8 d0+r] 8086,FPU
+FCOM fpu0,fpureg [-r: d8 d0+r] 8086,FPU
+FCOM void [ d8 d1] 8086,FPU,ND
+FCOMI fpureg [r: db f0+r] P6,FPU
+FCOMI fpu0,fpureg [-r: db f0+r] P6,FPU
+FCOMI void [ db f1] P6,FPU,ND
+FCOMIP fpureg [r: df f0+r] P6,FPU
+FCOMIP fpu0,fpureg [-r: df f0+r] P6,FPU
+FCOMIP void [ df f1] P6,FPU,ND
+FCOMP mem32 [m: d8 /3] 8086,FPU
+FCOMP mem64 [m: dc /3] 8086,FPU
+FCOMP fpureg [r: d8 d8+r] 8086,FPU
+FCOMP fpu0,fpureg [-r: d8 d8+r] 8086,FPU
+FCOMP void [ d8 d9] 8086,FPU,ND
+FCOMPP void [ de d9] 8086,FPU
+FCOS void [ d9 ff] 386,FPU
+FDECSTP void [ d9 f6] 8086,FPU
+FDISI void [ wait db e1] 8086,FPU
+FDIV mem32 [m: d8 /6] 8086,FPU
+FDIV mem64 [m: dc /6] 8086,FPU
+FDIV fpureg|to [r: dc f8+r] 8086,FPU
+FDIV fpureg [r: d8 f0+r] 8086,FPU
+FDIV fpureg,fpu0 [r-: dc f8+r] 8086,FPU
+FDIV fpu0,fpureg [-r: d8 f0+r] 8086,FPU
+FDIV void [ de f9] 8086,FPU,ND
+FDIVP fpureg [r: de f8+r] 8086,FPU
+FDIVP fpureg,fpu0 [r-: de f8+r] 8086,FPU
+FDIVP void [ de f9] 8086,FPU,ND
+FDIVR mem32 [m: d8 /7] 8086,FPU
+FDIVR mem64 [m: dc /7] 8086,FPU
+FDIVR fpureg|to [r: dc f0+r] 8086,FPU
+FDIVR fpureg,fpu0 [r-: dc f0+r] 8086,FPU
+FDIVR fpureg [r: d8 f8+r] 8086,FPU
+FDIVR fpu0,fpureg [-r: d8 f8+r] 8086,FPU
+FDIVR void [ de f1] 8086,FPU,ND
+FDIVRP fpureg [r: de f0+r] 8086,FPU
+FDIVRP fpureg,fpu0 [r-: de f0+r] 8086,FPU
+FDIVRP void [ de f1] 8086,FPU,ND
+FEMMS void [ 0f 0e] PENT,3DNOW
+FENI void [ wait db e0] 8086,FPU
+FFREE fpureg [r: dd c0+r] 8086,FPU
+FFREE void [ dd c1] 8086,FPU
+FFREEP fpureg [r: df c0+r] 286,FPU,UNDOC
+FFREEP void [ df c1] 286,FPU,UNDOC
+FIADD mem32 [m: da /0] 8086,FPU
+FIADD mem16 [m: de /0] 8086,FPU
+FICOM mem32 [m: da /2] 8086,FPU
+FICOM mem16 [m: de /2] 8086,FPU
+FICOMP mem32 [m: da /3] 8086,FPU
+FICOMP mem16 [m: de /3] 8086,FPU
+FIDIV mem32 [m: da /6] 8086,FPU
+FIDIV mem16 [m: de /6] 8086,FPU
+FIDIVR mem32 [m: da /7] 8086,FPU
+FIDIVR mem16 [m: de /7] 8086,FPU
+FILD mem32 [m: db /0] 8086,FPU
+FILD mem16 [m: df /0] 8086,FPU
+FILD mem64 [m: df /5] 8086,FPU
+FIMUL mem32 [m: da /1] 8086,FPU
+FIMUL mem16 [m: de /1] 8086,FPU
+FINCSTP void [ d9 f7] 8086,FPU
+FINIT void [ wait db e3] 8086,FPU
+FIST mem32 [m: db /2] 8086,FPU
+FIST mem16 [m: df /2] 8086,FPU
+FISTP mem32 [m: db /3] 8086,FPU
+FISTP mem16 [m: df /3] 8086,FPU
+FISTP mem64 [m: df /7] 8086,FPU
+FISTTP mem16 [m: df /1] PRESCOTT,FPU
+FISTTP mem32 [m: db /1] PRESCOTT,FPU
+FISTTP mem64 [m: dd /1] PRESCOTT,FPU
+FISUB mem32 [m: da /4] 8086,FPU
+FISUB mem16 [m: de /4] 8086,FPU
+FISUBR mem32 [m: da /5] 8086,FPU
+FISUBR mem16 [m: de /5] 8086,FPU
+FLD mem32 [m: d9 /0] 8086,FPU
+FLD mem64 [m: dd /0] 8086,FPU
+FLD mem80 [m: db /5] 8086,FPU
+FLD fpureg [r: d9 c0+r] 8086,FPU
+FLD void [ d9 c1] 8086,FPU,ND
+FLD1 void [ d9 e8] 8086,FPU
+FLDCW mem [m: d9 /5] 8086,FPU,SW
+FLDENV mem [m: d9 /4] 8086,FPU
+FLDL2E void [ d9 ea] 8086,FPU
+FLDL2T void [ d9 e9] 8086,FPU
+FLDLG2 void [ d9 ec] 8086,FPU
+FLDLN2 void [ d9 ed] 8086,FPU
+FLDPI void [ d9 eb] 8086,FPU
+FLDZ void [ d9 ee] 8086,FPU
+FMUL mem32 [m: d8 /1] 8086,FPU
+FMUL mem64 [m: dc /1] 8086,FPU
+FMUL fpureg|to [r: dc c8+r] 8086,FPU
+FMUL fpureg,fpu0 [r-: dc c8+r] 8086,FPU
+FMUL fpureg [r: d8 c8+r] 8086,FPU
+FMUL fpu0,fpureg [-r: d8 c8+r] 8086,FPU
+FMUL void [ de c9] 8086,FPU,ND
+FMULP fpureg [r: de c8+r] 8086,FPU
+FMULP fpureg,fpu0 [r-: de c8+r] 8086,FPU
+FMULP void [ de c9] 8086,FPU,ND
+FNCLEX void [ db e2] 8086,FPU
+FNDISI void [ db e1] 8086,FPU
+FNENI void [ db e0] 8086,FPU
+FNINIT void [ db e3] 8086,FPU
+FNOP void [ d9 d0] 8086,FPU
+FNSAVE mem [m: dd /6] 8086,FPU
+FNSTCW mem [m: d9 /7] 8086,FPU,SW
+FNSTENV mem [m: d9 /6] 8086,FPU
+FNSTSW mem [m: dd /7] 8086,FPU,SW
+FNSTSW reg_ax [-: df e0] 286,FPU
+FPATAN void [ d9 f3] 8086,FPU
+FPREM void [ d9 f8] 8086,FPU
+FPREM1 void [ d9 f5] 386,FPU
+FPTAN void [ d9 f2] 8086,FPU
+FRNDINT void [ d9 fc] 8086,FPU
+FRSTOR mem [m: dd /4] 8086,FPU
+FSAVE mem [m: wait dd /6] 8086,FPU
+FSCALE void [ d9 fd] 8086,FPU
+FSETPM void [ db e4] 286,FPU
+FSIN void [ d9 fe] 386,FPU
+FSINCOS void [ d9 fb] 386,FPU
+FSQRT void [ d9 fa] 8086,FPU
+FST mem32 [m: d9 /2] 8086,FPU
+FST mem64 [m: dd /2] 8086,FPU
+FST fpureg [r: dd d0+r] 8086,FPU
+FST void [ dd d1] 8086,FPU,ND
+FSTCW mem [m: wait d9 /7] 8086,FPU,SW
+FSTENV mem [m: wait d9 /6] 8086,FPU
+FSTP mem32 [m: d9 /3] 8086,FPU
+FSTP mem64 [m: dd /3] 8086,FPU
+FSTP mem80 [m: db /7] 8086,FPU
+FSTP fpureg [r: dd d8+r] 8086,FPU
+FSTP void [ dd d9] 8086,FPU,ND
+FSTSW mem [m: wait dd /7] 8086,FPU,SW
+FSTSW reg_ax [-: wait df e0] 286,FPU
+FSUB mem32 [m: d8 /4] 8086,FPU
+FSUB mem64 [m: dc /4] 8086,FPU
+FSUB fpureg|to [r: dc e8+r] 8086,FPU
+FSUB fpureg,fpu0 [r-: dc e8+r] 8086,FPU
+FSUB fpureg [r: d8 e0+r] 8086,FPU
+FSUB fpu0,fpureg [-r: d8 e0+r] 8086,FPU
+FSUB void [ de e9] 8086,FPU,ND
+FSUBP fpureg [r: de e8+r] 8086,FPU
+FSUBP fpureg,fpu0 [r-: de e8+r] 8086,FPU
+FSUBP void [ de e9] 8086,FPU,ND
+FSUBR mem32 [m: d8 /5] 8086,FPU
+FSUBR mem64 [m: dc /5] 8086,FPU
+FSUBR fpureg|to [r: dc e0+r] 8086,FPU
+FSUBR fpureg,fpu0 [r-: dc e0+r] 8086,FPU
+FSUBR fpureg [r: d8 e8+r] 8086,FPU
+FSUBR fpu0,fpureg [-r: d8 e8+r] 8086,FPU
+FSUBR void [ de e1] 8086,FPU,ND
+FSUBRP fpureg [r: de e0+r] 8086,FPU
+FSUBRP fpureg,fpu0 [r-: de e0+r] 8086,FPU
+FSUBRP void [ de e1] 8086,FPU,ND
+FTST void [ d9 e4] 8086,FPU
+FUCOM fpureg [r: dd e0+r] 386,FPU
+FUCOM fpu0,fpureg [-r: dd e0+r] 386,FPU
+FUCOM void [ dd e1] 386,FPU,ND
+FUCOMI fpureg [r: db e8+r] P6,FPU
+FUCOMI fpu0,fpureg [-r: db e8+r] P6,FPU
+FUCOMI void [ db e9] P6,FPU,ND
+FUCOMIP fpureg [r: df e8+r] P6,FPU
+FUCOMIP fpu0,fpureg [-r: df e8+r] P6,FPU
+FUCOMIP void [ df e9] P6,FPU,ND
+FUCOMP fpureg [r: dd e8+r] 386,FPU
+FUCOMP fpu0,fpureg [-r: dd e8+r] 386,FPU
+FUCOMP void [ dd e9] 386,FPU,ND
+FUCOMPP void [ da e9] 386,FPU
+FXAM void [ d9 e5] 8086,FPU
+FXCH fpureg [r: d9 c8+r] 8086,FPU
+FXCH fpureg,fpu0 [r-: d9 c8+r] 8086,FPU
+FXCH fpu0,fpureg [-r: d9 c8+r] 8086,FPU
+FXCH void [ d9 c9] 8086,FPU,ND
+FXTRACT void [ d9 f4] 8086,FPU
+FYL2X void [ d9 f1] 8086,FPU
+FYL2XP1 void [ d9 f9] 8086,FPU
+HLT void [ f4] 8086,PRIV
+IBTS mem,reg16 [mr: o16 0f a7 /r] 386,SW,UNDOC,ND,OBSOLETE
+IBTS reg16,reg16 [mr: o16 0f a7 /r] 386,UNDOC,ND,OBSOLETE
+IBTS mem,reg32 [mr: o32 0f a7 /r] 386,SD,UNDOC,ND,OBSOLETE
+IBTS reg32,reg32 [mr: o32 0f a7 /r] 386,UNDOC,ND,OBSOLETE
+ICEBP void [ f1] 386,ND
+IDIV rm8 [m: f6 /7] 8086
+IDIV rm16 [m: o16 f7 /7] 8086
+IDIV rm32 [m: o32 f7 /7] 386
+IDIV rm64 [m: o64 f7 /7] X64
+IMUL rm8 [m: f6 /5] 8086
+IMUL rm16 [m: o16 f7 /5] 8086
+IMUL rm32 [m: o32 f7 /5] 386
+IMUL rm64 [m: o64 f7 /5] X64
+IMUL reg16,mem [rm: o16 0f af /r] 386,SM
+IMUL reg16,reg16 [rm: o16 0f af /r] 386
+IMUL reg32,mem [rm: o32 0f af /r] 386,SM
+IMUL reg32,reg32 [rm: o32 0f af /r] 386
+IMUL reg64,mem [rm: o64 0f af /r] X64,SM
+IMUL reg64,reg64 [rm: o64 0f af /r] X64
+IMUL reg16,mem,imm8 [rmi: o16 6b /r ib,s] 186,SM
+IMUL reg16,mem,sbyteword [rmi: o16 6b /r ib,s] 186,SM,ND
+IMUL reg16,mem,imm16 [rmi: o16 69 /r iw] 186,SM
+IMUL reg16,mem,imm [rmi: o16 69 /r iw] 186,SM,ND
+IMUL reg16,reg16,imm8 [rmi: o16 6b /r ib,s] 186
+IMUL reg16,reg16,sbyteword [rmi: o16 6b /r ib,s] 186,SM,ND
+IMUL reg16,reg16,imm16 [rmi: o16 69 /r iw] 186
+IMUL reg16,reg16,imm [rmi: o16 69 /r iw] 186,SM,ND
+IMUL reg32,mem,imm8 [rmi: o32 6b /r ib,s] 386,SM
+IMUL reg32,mem,sbytedword [rmi: o32 6b /r ib,s] 386,SM,ND
+IMUL reg32,mem,imm32 [rmi: o32 69 /r id] 386,SM
+IMUL reg32,mem,imm [rmi: o32 69 /r id] 386,SM,ND
+IMUL reg32,reg32,imm8 [rmi: o32 6b /r ib,s] 386
+IMUL reg32,reg32,sbytedword [rmi: o32 6b /r ib,s] 386,SM,ND
+IMUL reg32,reg32,imm32 [rmi: o32 69 /r id] 386
+IMUL reg32,reg32,imm [rmi: o32 69 /r id] 386,SM,ND
+IMUL reg64,mem,imm8 [rmi: o64 6b /r ib,s] X64,SM
+IMUL reg64,mem,sbytedword [rmi: o64 6b /r ib,s] X64,SM,ND
+IMUL reg64,mem,imm32 [rmi: o64 69 /r id] X64,SM
+IMUL reg64,mem,imm [rmi: o64 69 /r id,s] X64,SM,ND
+IMUL reg64,reg64,imm8 [rmi: o64 6b /r ib,s] X64
+IMUL reg64,reg64,sbytedword [rmi: o64 6b /r ib,s] X64,SM,ND
+IMUL reg64,reg64,imm32 [rmi: o64 69 /r id] X64
+IMUL reg64,reg64,imm [rmi: o64 69 /r id,s] X64,SM,ND
+IMUL reg16,imm8 [r+mi: o16 6b /r ib,s] 186
+IMUL reg16,sbyteword [r+mi: o16 6b /r ib,s] 186,SM,ND
+IMUL reg16,imm16 [r+mi: o16 69 /r iw] 186
+IMUL reg16,imm [r+mi: o16 69 /r iw] 186,SM,ND
+IMUL reg32,imm8 [r+mi: o32 6b /r ib,s] 386
+IMUL reg32,sbytedword [r+mi: o32 6b /r ib,s] 386,SM,ND
+IMUL reg32,imm32 [r+mi: o32 69 /r id] 386
+IMUL reg32,imm [r+mi: o32 69 /r id] 386,SM,ND
+IMUL reg64,imm8 [r+mi: o64 6b /r ib,s] X64
+IMUL reg64,sbytedword [r+mi: o64 6b /r ib,s] X64,SM,ND
+IMUL reg64,imm32 [r+mi: o64 69 /r id,s] X64
+IMUL reg64,imm [r+mi: o64 69 /r id,s] X64,SM,ND
+IN reg_al,imm [-i: e4 ib,u] 8086,SB
+IN reg_ax,imm [-i: o16 e5 ib,u] 8086,SB
+IN reg_eax,imm [-i: o32 e5 ib,u] 386,SB
+IN reg_al,reg_dx [--: ec] 8086
+IN reg_ax,reg_dx [--: o16 ed] 8086
+IN reg_eax,reg_dx [--: o32 ed] 386
+INC reg16 [r: o16 40+r] 8086,NOLONG
+INC reg32 [r: o32 40+r] 386,NOLONG
+INC rm8 [m: hle fe /0] 8086,LOCK
+INC rm16 [m: hle o16 ff /0] 8086,LOCK
+INC rm32 [m: hle o32 ff /0] 386,LOCK
+INC rm64 [m: hle o64 ff /0] X64,LOCK
+INSB void [ 6c] 186
+INSD void [ o32 6d] 386
+INSW void [ o16 6d] 186
+INT imm [i: cd ib,u] 8086,SB
+INT01 void [ f1] 386,ND
+INT1 void [ f1] 386
+INT03 void [ cc] 8086,ND
+INT3 void [ cc] 8086
+INTO void [ ce] 8086,NOLONG
+INVD void [ 0f 08] 486,PRIV
+INVPCID reg32,mem128 [rm: 66 0f 38 82 /r] FUTURE,INVPCID,PRIV,NOLONG
+INVPCID reg64,mem128 [rm: 66 0f 38 82 /r] FUTURE,INVPCID,PRIV,LONG
+INVLPG mem [m: 0f 01 /7] 486,PRIV
+INVLPGA reg_ax,reg_ecx [--: a16 0f 01 df] X86_64,AMD,NOLONG
+INVLPGA reg_eax,reg_ecx [--: a32 0f 01 df] X86_64,AMD
+INVLPGA reg_rax,reg_ecx [--: o64nw a64 0f 01 df] X64,AMD
+INVLPGA void [ 0f 01 df] X86_64,AMD
+IRET void [ odf cf] 8086
+IRETD void [ o32 cf] 386
+IRETQ void [ o64 cf] X64
+IRETW void [ o16 cf] 8086
+JCXZ imm [i: a16 e3 rel8] 8086,NOLONG
+JECXZ imm [i: a32 e3 rel8] 386
+JRCXZ imm [i: a64 e3 rel8] X64
+JMP imm|short [i: eb rel8] 8086
+JMP imm [i: jmp8 eb rel8] 8086,ND
+JMP imm [i: odf e9 rel] 8086,BND
+JMP imm|near [i: odf e9 rel] 8086,ND,BND
+JMP imm|far [i: odf ea iwd seg] 8086,ND,NOLONG
+; Call/jmp near imm/reg/mem is always 64-bit in long mode.
+JMP imm16 [i: o16 e9 rel] 8086,NOLONG,BND
+JMP imm16|near [i: o16 e9 rel] 8086,ND,NOLONG,BND
+JMP imm16|far [i: o16 ea iwd seg] 8086,ND,NOLONG
+JMP imm32 [i: o32 e9 rel] 386,NOLONG,BND
+JMP imm32|near [i: o32 e9 rel] 386,ND,NOLONG,BND
+JMP imm32|far [i: o32 ea iwd seg] 386,ND,NOLONG
+JMP imm64 [i: o64nw e9 rel] X64,BND
+JMP imm64|near [i: o64nw e9 rel] X64,ND,BND
+JMP imm:imm [ji: odf ea iwd iw] 8086,NOLONG
+JMP imm16:imm [ji: o16 ea iw iw] 8086,NOLONG
+JMP imm:imm16 [ji: o16 ea iw iw] 8086,NOLONG
+JMP imm32:imm [ji: o32 ea id iw] 386,NOLONG
+JMP imm:imm32 [ji: o32 ea id iw] 386,NOLONG
+JMP mem|far [m: odf ff /5] 8086,NOLONG
+JMP mem|far [m: o64 ff /5] X64
+JMP mem16|far [m: o16 ff /5] 8086
+JMP mem32|far [m: o32 ff /5] 386
+JMP mem64|far [m: o64 ff /5] X64
+JMP mem|near [m: odf ff /4] 8086,ND,BND
+JMP rm16|near [m: o16 ff /4] 8086,NOLONG,ND,BND
+JMP rm32|near [m: o32 ff /4] 386,NOLONG,ND,BND
+JMP rm64|near [m: o64nw ff /4] X64,ND,BND
+JMP mem [m: odf ff /4] 8086,BND
+JMP rm16 [m: o16 ff /4] 8086,NOLONG,BND
+JMP rm32 [m: o32 ff /4] 386,NOLONG,BND
+JMP rm64 [m: o64nw ff /4] X64,BND
+
+JMPE imm [i: odf 0f b8 rel] IA64
+JMPE imm16 [i: o16 0f b8 rel] IA64
+JMPE imm32 [i: o32 0f b8 rel] IA64
+JMPE rm16 [m: o16 0f 00 /6] IA64
+JMPE rm32 [m: o32 0f 00 /6] IA64
+LAHF void [ 9f] 8086
+LAR reg16,mem [rm: o16 0f 02 /r] 286,PROT,SW
+LAR reg16,reg16 [rm: o16 0f 02 /r] 286,PROT
+LAR reg16,reg32 [rm: o16 0f 02 /r] 386,PROT
+LAR reg16,reg64 [rm: o16 o64nw 0f 02 /r] X64,PROT,ND
+LAR reg32,mem [rm: o32 0f 02 /r] 386,PROT,SW
+LAR reg32,reg16 [rm: o32 0f 02 /r] 386,PROT
+LAR reg32,reg32 [rm: o32 0f 02 /r] 386,PROT
+LAR reg32,reg64 [rm: o32 o64nw 0f 02 /r] X64,PROT,ND
+LAR reg64,mem [rm: o64 0f 02 /r] X64,PROT,SW
+LAR reg64,reg16 [rm: o64 0f 02 /r] X64,PROT
+LAR reg64,reg32 [rm: o64 0f 02 /r] X64,PROT
+LAR reg64,reg64 [rm: o64 0f 02 /r] X64,PROT
+LDS reg16,mem [rm: o16 c5 /r] 8086,NOLONG
+LDS reg32,mem [rm: o32 c5 /r] 386,NOLONG
+LEA reg16,mem [rm: o16 8d /r] 8086
+LEA reg32,mem [rm: o32 8d /r] 386
+LEA reg64,mem [rm: o64 8d /r] X64
+LEAVE void [ c9] 186
+LES reg16,mem [rm: o16 c4 /r] 8086,NOLONG
+LES reg32,mem [rm: o32 c4 /r] 386,NOLONG
+LFENCE void [ np 0f ae e8] X64,AMD
+LFS reg16,mem [rm: o16 0f b4 /r] 386
+LFS reg32,mem [rm: o32 0f b4 /r] 386
+LFS reg64,mem [rm: o64 0f b4 /r] X64
+LGDT mem [m: 0f 01 /2] 286,PRIV
+LGS reg16,mem [rm: o16 0f b5 /r] 386
+LGS reg32,mem [rm: o32 0f b5 /r] 386
+LGS reg64,mem [rm: o64 0f b5 /r] X64
+LIDT mem [m: 0f 01 /3] 286,PRIV
+LLDT mem [m: 0f 00 /2] 286,PROT,PRIV
+LLDT mem16 [m: 0f 00 /2] 286,PROT,PRIV
+LLDT reg16 [m: 0f 00 /2] 286,PROT,PRIV
+LMSW mem [m: 0f 01 /6] 286,PRIV
+LMSW mem16 [m: 0f 01 /6] 286,PRIV
+LMSW reg16 [m: 0f 01 /6] 286,PRIV
+LOADALL void [ 0f 07] 386,UNDOC,ND,OBSOLETE
+LOADALL286 void [ 0f 05] 286,UNDOC,ND,OBSOLETE
+LODSB void [ ac] 8086
+LODSD void [ o32 ad] 386
+LODSQ void [ o64 ad] X64
+LODSW void [ o16 ad] 8086
+LOOP imm [i: adf e2 rel8] 8086
+LOOP imm,reg_cx [i-: a16 e2 rel8] 8086,NOLONG
+LOOP imm,reg_ecx [i-: a32 e2 rel8] 386
+LOOP imm,reg_rcx [i-: a64 e2 rel8] X64
+LOOPE imm [i: adf e1 rel8] 8086
+LOOPE imm,reg_cx [i-: a16 e1 rel8] 8086,NOLONG
+LOOPE imm,reg_ecx [i-: a32 e1 rel8] 386
+LOOPE imm,reg_rcx [i-: a64 e1 rel8] X64
+LOOPNE imm [i: adf e0 rel8] 8086
+LOOPNE imm,reg_cx [i-: a16 e0 rel8] 8086,NOLONG
+LOOPNE imm,reg_ecx [i-: a32 e0 rel8] 386
+LOOPNE imm,reg_rcx [i-: a64 e0 rel8] X64
+LOOPNZ imm [i: adf e0 rel8] 8086
+LOOPNZ imm,reg_cx [i-: a16 e0 rel8] 8086,NOLONG
+LOOPNZ imm,reg_ecx [i-: a32 e0 rel8] 386
+LOOPNZ imm,reg_rcx [i-: a64 e0 rel8] X64
+LOOPZ imm [i: adf e1 rel8] 8086
+LOOPZ imm,reg_cx [i-: a16 e1 rel8] 8086,NOLONG
+LOOPZ imm,reg_ecx [i-: a32 e1 rel8] 386
+LOOPZ imm,reg_rcx [i-: a64 e1 rel8] X64
+LSL reg16,mem [rm: o16 0f 03 /r] 286,PROT,SW
+LSL reg16,reg16 [rm: o16 0f 03 /r] 286,PROT
+LSL reg16,reg32 [rm: o16 0f 03 /r] 386,PROT
+LSL reg16,reg64 [rm: o16 o64nw 0f 03 /r] X64,PROT,ND
+LSL reg32,mem [rm: o32 0f 03 /r] 386,PROT,SW
+LSL reg32,reg16 [rm: o32 0f 03 /r] 386,PROT
+LSL reg32,reg32 [rm: o32 0f 03 /r] 386,PROT
+LSL reg32,reg64 [rm: o32 o64nw 0f 03 /r] X64,PROT,ND
+LSL reg64,mem [rm: o64 0f 03 /r] X64,PROT,SW
+LSL reg64,reg16 [rm: o64 0f 03 /r] X64,PROT
+LSL reg64,reg32 [rm: o64 0f 03 /r] X64,PROT
+LSL reg64,reg64 [rm: o64 0f 03 /r] X64,PROT
+LSS reg16,mem [rm: o16 0f b2 /r] 386
+LSS reg32,mem [rm: o32 0f b2 /r] 386
+LSS reg64,mem [rm: o64 0f b2 /r] X64
+LTR mem [m: 0f 00 /3] 286,PROT,PRIV
+LTR mem16 [m: 0f 00 /3] 286,PROT,PRIV
+LTR reg16 [m: 0f 00 /3] 286,PROT,PRIV
+MFENCE void [ np 0f ae f0] X64,AMD
+MONITOR void [ 0f 01 c8] PRESCOTT
+MONITOR reg_eax,reg_ecx,reg_edx [---: 0f 01 c8] PRESCOTT,NOLONG,ND
+MONITOR reg_rax,reg_ecx,reg_edx [---: 0f 01 c8] X64,ND
+MONITORX void [ 0f 01 fa] AMD
+MONITORX reg_rax,reg_ecx,reg_edx [---: 0f 01 fa] X64,AMD,ND
+MONITORX reg_eax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
+MONITORX reg_ax,reg_ecx,reg_edx [---: 0f 01 fa] AMD,ND
+MOV mem,reg_sreg [mr: 8c /r] 8086,SW
+MOV reg16,reg_sreg [mr: o16 8c /r] 8086
+MOV reg32,reg_sreg [mr: o32 8c /r] 386
+MOV reg64,reg_sreg [mr: o64nw 8c /r] X64,OPT,ND
+MOV rm64,reg_sreg [mr: o64 8c /r] X64
+MOV reg_sreg,mem [rm: 8e /r] 8086,SW
+MOV reg_sreg,reg16 [rm: 8e /r] 8086,OPT,ND
+MOV reg_sreg,reg32 [rm: 8e /r] 386,OPT,ND
+MOV reg_sreg,reg64 [rm: o64nw 8e /r] X64,OPT,ND
+MOV reg_sreg,reg16 [rm: o16 8e /r] 8086
+MOV reg_sreg,reg32 [rm: o32 8e /r] 386
+MOV reg_sreg,rm64 [rm: o64 8e /r] X64
+MOV reg_al,mem_offs [-i: a0 iwdq] 8086,SM
+MOV reg_ax,mem_offs [-i: o16 a1 iwdq] 8086,SM
+MOV reg_eax,mem_offs [-i: o32 a1 iwdq] 386,SM
+MOV reg_rax,mem_offs [-i: o64 a1 iwdq] X64,SM
+MOV mem_offs,reg_al [i-: a2 iwdq] 8086,SM,NOHLE
+MOV mem_offs,reg_ax [i-: o16 a3 iwdq] 8086,SM,NOHLE
+MOV mem_offs,reg_eax [i-: o32 a3 iwdq] 386,SM,NOHLE
+MOV mem_offs,reg_rax [i-: o64 a3 iwdq] X64,SM,NOHLE
+MOV reg32,reg_creg [mr: rex.l 0f 20 /r] 386,PRIV,NOLONG
+MOV reg64,reg_creg [mr: o64nw 0f 20 /r] X64,PRIV
+MOV reg_creg,reg32 [rm: rex.l 0f 22 /r] 386,PRIV,NOLONG
+MOV reg_creg,reg64 [rm: o64nw 0f 22 /r] X64,PRIV
+MOV reg32,reg_dreg [mr: 0f 21 /r] 386,PRIV,NOLONG
+MOV reg64,reg_dreg [mr: o64nw 0f 21 /r] X64,PRIV
+MOV reg_dreg,reg32 [rm: 0f 23 /r] 386,PRIV,NOLONG
+MOV reg_dreg,reg64 [rm: o64nw 0f 23 /r] X64,PRIV
+MOV reg32,reg_treg [mr: 0f 24 /r] 386,NOLONG,ND
+MOV reg_treg,reg32 [rm: 0f 26 /r] 386,NOLONG,ND
+MOV mem,reg8 [mr: hlexr 88 /r] 8086,SM
+MOV reg8,reg8 [mr: 88 /r] 8086
+MOV mem,reg16 [mr: hlexr o16 89 /r] 8086,SM
+MOV reg16,reg16 [mr: o16 89 /r] 8086
+MOV mem,reg32 [mr: hlexr o32 89 /r] 386,SM
+MOV reg32,reg32 [mr: o32 89 /r] 386
+MOV mem,reg64 [mr: hlexr o64 89 /r] X64,SM
+MOV reg64,reg64 [mr: o64 89 /r] X64
+MOV reg8,mem [rm: 8a /r] 8086,SM
+MOV reg8,reg8 [rm: 8a /r] 8086
+MOV reg16,mem [rm: o16 8b /r] 8086,SM
+MOV reg16,reg16 [rm: o16 8b /r] 8086
+MOV reg32,mem [rm: o32 8b /r] 386,SM
+MOV reg32,reg32 [rm: o32 8b /r] 386
+MOV reg64,mem [rm: o64 8b /r] X64,SM
+MOV reg64,reg64 [rm: o64 8b /r] X64
+MOV reg8,imm [ri: b0+r ib] 8086,SM
+MOV reg16,imm [ri: o16 b8+r iw] 8086,SM
+MOV reg32,imm [ri: o32 b8+r id] 386,SM
+MOV reg64,udword [ri: o64nw b8+r id] X64,SM,OPT,ND
+MOV reg64,sdword [mi: o64 c7 /0 id,s] X64,SM,OPT,ND
+MOV reg64,imm [ri: o64 b8+r iq] X64,SM
+MOV rm8,imm [mi: hlexr c6 /0 ib] 8086,SM
+MOV rm16,imm [mi: hlexr o16 c7 /0 iw] 8086,SM
+MOV rm32,imm [mi: hlexr o32 c7 /0 id] 386,SM
+MOV rm64,imm [mi: hlexr o64 c7 /0 id,s] X64,SM
+MOV rm64,imm32 [mi: hlexr o64 c7 /0 id,s] X64
+MOV mem,imm8 [mi: hlexr c6 /0 ib] 8086,SM
+MOV mem,imm16 [mi: hlexr o16 c7 /0 iw] 8086,SM
+MOV mem,imm32 [mi: hlexr o32 c7 /0 id] 386,SM
+MOVD mmxreg,rm32 [rm: np 0f 6e /r] PENT,MMX,SD
+MOVD rm32,mmxreg [mr: np 0f 7e /r] PENT,MMX,SD
+MOVD mmxreg,rm64 [rm: np o64 0f 6e /r] X64,MMX,SX,ND
+MOVD rm64,mmxreg [mr: np o64 0f 7e /r] X64,MMX,SX,ND
+MOVQ mmxreg,mmxrm [rm: np 0f 6f /r] PENT,MMX,SQ
+MOVQ mmxrm,mmxreg [mr: np 0f 7f /r] PENT,MMX,SQ
+MOVQ mmxreg,rm64 [rm: np o64 0f 6e /r] X64,MMX
+MOVQ rm64,mmxreg [mr: np o64 0f 7e /r] X64,MMX
+MOVSB void [ a4] 8086
+MOVSD void [ o32 a5] 386
+MOVSQ void [ o64 a5] X64
+MOVSW void [ o16 a5] 8086
+MOVSX reg16,mem [rm: o16 0f be /r] 386,SB
+MOVSX reg16,reg8 [rm: o16 0f be /r] 386
+MOVSX reg32,rm8 [rm: o32 0f be /r] 386
+MOVSX reg32,rm16 [rm: o32 0f bf /r] 386
+MOVSX reg64,rm8 [rm: o64 0f be /r] X64
+MOVSX reg64,rm16 [rm: o64 0f bf /r] X64
+MOVSXD reg64,rm32 [rm: o64 63 /r] X64
+MOVSX reg64,rm32 [rm: o64 63 /r] X64,ND
+MOVZX reg16,mem [rm: o16 0f b6 /r] 386,SB
+MOVZX reg16,reg8 [rm: o16 0f b6 /r] 386
+MOVZX reg32,rm8 [rm: o32 0f b6 /r] 386
+MOVZX reg32,rm16 [rm: o32 0f b7 /r] 386
+MOVZX reg64,rm8 [rm: o64 0f b6 /r] X64
+MOVZX reg64,rm16 [rm: o64 0f b7 /r] X64
+MUL rm8 [m: f6 /4] 8086
+MUL rm16 [m: o16 f7 /4] 8086
+MUL rm32 [m: o32 f7 /4] 386
+MUL rm64 [m: o64 f7 /4] X64
+MWAIT void [ 0f 01 c9] PRESCOTT
+MWAIT reg_eax,reg_ecx [--: 0f 01 c9] PRESCOTT,ND
+MWAITX void [ 0f 01 fb] AMD
+MWAITX reg_eax,reg_ecx [--: 0f 01 fb] AMD,ND
+NEG rm8 [m: hle f6 /3] 8086,LOCK
+NEG rm16 [m: hle o16 f7 /3] 8086,LOCK
+NEG rm32 [m: hle o32 f7 /3] 386,LOCK
+NEG rm64 [m: hle o64 f7 /3] X64,LOCK
+NOP rm16 [m: o16 0f 1f /0] P6
+NOP rm32 [m: o32 0f 1f /0] P6
+NOP rm64 [m: o64 0f 1f /0] X64
+NOT rm8 [m: hle f6 /2] 8086,LOCK
+NOT rm16 [m: hle o16 f7 /2] 8086,LOCK
+NOT rm32 [m: hle o32 f7 /2] 386,LOCK
+NOT rm64 [m: hle o64 f7 /2] X64,LOCK
+OR mem,reg8 [mr: hle 08 /r] 8086,SM,LOCK
+OR reg8,reg8 [mr: 08 /r] 8086
+OR mem,reg16 [mr: hle o16 09 /r] 8086,SM,LOCK
+OR reg16,reg16 [mr: o16 09 /r] 8086
+OR mem,reg32 [mr: hle o32 09 /r] 386,SM,LOCK
+OR reg32,reg32 [mr: o32 09 /r] 386
+OR mem,reg64 [mr: hle o64 09 /r] X64,SM,LOCK
+OR reg64,reg64 [mr: o64 09 /r] X64
+OR reg8,mem [rm: 0a /r] 8086,SM
+OR reg8,reg8 [rm: 0a /r] 8086
+OR reg16,mem [rm: o16 0b /r] 8086,SM
+OR reg16,reg16 [rm: o16 0b /r] 8086
+OR reg32,mem [rm: o32 0b /r] 386,SM
+OR reg32,reg32 [rm: o32 0b /r] 386
+OR reg64,mem [rm: o64 0b /r] X64,SM
+OR reg64,reg64 [rm: o64 0b /r] X64
+OR rm16,imm8 [mi: hle o16 83 /1 ib,s] 8086,LOCK
+OR rm32,imm8 [mi: hle o32 83 /1 ib,s] 386,LOCK
+OR rm64,imm8 [mi: hle o64 83 /1 ib,s] X64,LOCK
+OR reg_al,imm [-i: 0c ib] 8086,SM
+OR reg_ax,sbyteword [mi: o16 83 /1 ib,s] 8086,SM,ND
+OR reg_ax,imm [-i: o16 0d iw] 8086,SM
+OR reg_eax,sbytedword [mi: o32 83 /1 ib,s] 386,SM,ND
+OR reg_eax,imm [-i: o32 0d id] 386,SM
+OR reg_rax,sbytedword [mi: o64 83 /1 ib,s] X64,SM,ND
+OR reg_rax,imm [-i: o64 0d id,s] X64,SM
+OR rm8,imm [mi: hle 80 /1 ib] 8086,SM,LOCK
+OR rm16,sbyteword [mi: hle o16 83 /1 ib,s] 8086,SM,LOCK,ND
+OR rm16,imm [mi: hle o16 81 /1 iw] 8086,SM,LOCK
+OR rm32,sbytedword [mi: hle o32 83 /1 ib,s] 386,SM,LOCK,ND
+OR rm32,imm [mi: hle o32 81 /1 id] 386,SM,LOCK
+OR rm64,sbytedword [mi: hle o64 83 /1 ib,s] X64,SM,LOCK,ND
+OR rm64,imm [mi: hle o64 81 /1 id,s] X64,SM,LOCK
+OR mem,imm8 [mi: hle 80 /1 ib] 8086,SM,LOCK
+OR mem,sbyteword16 [mi: hle o16 83 /1 ib,s] 8086,SM,LOCK,ND
+OR mem,imm16 [mi: hle o16 81 /1 iw] 8086,SM,LOCK
+OR mem,sbytedword32 [mi: hle o32 83 /1 ib,s] 386,SM,LOCK,ND
+OR mem,imm32 [mi: hle o32 81 /1 id] 386,SM,LOCK
+OR rm8,imm [mi: hle 82 /1 ib] 8086,SM,LOCK,ND,NOLONG
+OUT imm,reg_al [i-: e6 ib,u] 8086,SB
+OUT imm,reg_ax [i-: o16 e7 ib,u] 8086,SB
+OUT imm,reg_eax [i-: o32 e7 ib,u] 386,SB
+OUT reg_dx,reg_al [--: ee] 8086
+OUT reg_dx,reg_ax [--: o16 ef] 8086
+OUT reg_dx,reg_eax [--: o32 ef] 386
+OUTSB void [ 6e] 186
+OUTSD void [ o32 6f] 386
+OUTSW void [ o16 6f] 186
+PACKSSDW mmxreg,mmxrm [rm: np o64nw 0f 6b /r] PENT,MMX,SQ
+PACKSSWB mmxreg,mmxrm [rm: np o64nw 0f 63 /r] PENT,MMX,SQ
+PACKUSWB mmxreg,mmxrm [rm: np o64nw 0f 67 /r] PENT,MMX,SQ
+PADDB mmxreg,mmxrm [rm: np o64nw 0f fc /r] PENT,MMX,SQ
+PADDD mmxreg,mmxrm [rm: np o64nw 0f fe /r] PENT,MMX,SQ
+PADDSB mmxreg,mmxrm [rm: np o64nw 0f ec /r] PENT,MMX,SQ
+PADDSIW mmxreg,mmxrm [rm: o64nw 0f 51 /r] PENT,MMX,SQ,CYRIX
+PADDSW mmxreg,mmxrm [rm: np o64nw 0f ed /r] PENT,MMX,SQ
+PADDUSB mmxreg,mmxrm [rm: np o64nw 0f dc /r] PENT,MMX,SQ
+PADDUSW mmxreg,mmxrm [rm: np o64nw 0f dd /r] PENT,MMX,SQ
+PADDW mmxreg,mmxrm [rm: np o64nw 0f fd /r] PENT,MMX,SQ
+PAND mmxreg,mmxrm [rm: np o64nw 0f db /r] PENT,MMX,SQ
+PANDN mmxreg,mmxrm [rm: np o64nw 0f df /r] PENT,MMX,SQ
+PAUSE void [ f3i 90] 8086
+PAVEB mmxreg,mmxrm [rm: o64nw 0f 50 /r] PENT,MMX,SQ,CYRIX
+PAVGUSB mmxreg,mmxrm [rm: o64nw 0f 0f /r bf] PENT,3DNOW,SQ
+PCMPEQB mmxreg,mmxrm [rm: np o64nw 0f 74 /r] PENT,MMX,SQ
+PCMPEQD mmxreg,mmxrm [rm: np o64nw 0f 76 /r] PENT,MMX,SQ
+PCMPEQW mmxreg,mmxrm [rm: np o64nw 0f 75 /r] PENT,MMX,SQ
+PCMPGTB mmxreg,mmxrm [rm: np o64nw 0f 64 /r] PENT,MMX,SQ
+PCMPGTD mmxreg,mmxrm [rm: np o64nw 0f 66 /r] PENT,MMX,SQ
+PCMPGTW mmxreg,mmxrm [rm: np o64nw 0f 65 /r] PENT,MMX,SQ
+PDISTIB mmxreg,mem [rm: 0f 54 /r] PENT,MMX,SM,CYRIX
+PF2ID mmxreg,mmxrm [rm: o64nw 0f 0f /r 1d] PENT,3DNOW,SQ
+PFACC mmxreg,mmxrm [rm: o64nw 0f 0f /r ae] PENT,3DNOW,SQ
+PFADD mmxreg,mmxrm [rm: o64nw 0f 0f /r 9e] PENT,3DNOW,SQ
+PFCMPEQ mmxreg,mmxrm [rm: o64nw 0f 0f /r b0] PENT,3DNOW,SQ
+PFCMPGE mmxreg,mmxrm [rm: o64nw 0f 0f /r 90] PENT,3DNOW,SQ
+PFCMPGT mmxreg,mmxrm [rm: o64nw 0f 0f /r a0] PENT,3DNOW,SQ
+PFMAX mmxreg,mmxrm [rm: o64nw 0f 0f /r a4] PENT,3DNOW,SQ
+PFMIN mmxreg,mmxrm [rm: o64nw 0f 0f /r 94] PENT,3DNOW,SQ
+PFMUL mmxreg,mmxrm [rm: o64nw 0f 0f /r b4] PENT,3DNOW,SQ
+PFRCP mmxreg,mmxrm [rm: o64nw 0f 0f /r 96] PENT,3DNOW,SQ
+PFRCPIT1 mmxreg,mmxrm [rm: o64nw 0f 0f /r a6] PENT,3DNOW,SQ
+PFRCPIT2 mmxreg,mmxrm [rm: o64nw 0f 0f /r b6] PENT,3DNOW,SQ
+PFRSQIT1 mmxreg,mmxrm [rm: o64nw 0f 0f /r a7] PENT,3DNOW,SQ
+PFRSQRT mmxreg,mmxrm [rm: o64nw 0f 0f /r 97] PENT,3DNOW,SQ
+PFSUB mmxreg,mmxrm [rm: o64nw 0f 0f /r 9a] PENT,3DNOW,SQ
+PFSUBR mmxreg,mmxrm [rm: o64nw 0f 0f /r aa] PENT,3DNOW,SQ
+PI2FD mmxreg,mmxrm [rm: o64nw 0f 0f /r 0d] PENT,3DNOW,SQ
+PMACHRIW mmxreg,mem [rm: 0f 5e /r] PENT,MMX,SM,CYRIX
+PMADDWD mmxreg,mmxrm [rm: np o64nw 0f f5 /r] PENT,MMX,SQ
+PMAGW mmxreg,mmxrm [rm: o64nw 0f 52 /r] PENT,MMX,SQ,CYRIX
+PMULHRIW mmxreg,mmxrm [rm: o64nw 0f 5d /r] PENT,MMX,SQ,CYRIX
+PMULHRWA mmxreg,mmxrm [rm: o64nw 0f 0f /r b7] PENT,3DNOW,SQ
+PMULHRWC mmxreg,mmxrm [rm: o64nw 0f 59 /r] PENT,MMX,SQ,CYRIX
+PMULHW mmxreg,mmxrm [rm: np o64nw 0f e5 /r] PENT,MMX,SQ
+PMULLW mmxreg,mmxrm [rm: np o64nw 0f d5 /r] PENT,MMX,SQ
+PMVGEZB mmxreg,mem [rm: 0f 5c /r] PENT,MMX,SQ,CYRIX
+PMVLZB mmxreg,mem [rm: 0f 5b /r] PENT,MMX,SQ,CYRIX
+PMVNZB mmxreg,mem [rm: 0f 5a /r] PENT,MMX,SQ,CYRIX
+PMVZB mmxreg,mem [rm: 0f 58 /r] PENT,MMX,SQ,CYRIX
+POP reg16 [r: o16 58+r] 8086
+POP reg32 [r: o32 58+r] 386,NOLONG
+POP reg64 [r: o64nw 58+r] X64
+POP rm16 [m: o16 8f /0] 8086
+POP rm32 [m: o32 8f /0] 386,NOLONG
+POP rm64 [m: o64nw 8f /0] X64
+POP reg_es [-: 07] 8086,NOLONG
+POP reg_cs [-: 0f] 8086,UNDOC,ND,OBSOLETE
+POP reg_ss [-: 17] 8086,NOLONG
+POP reg_ds [-: 1f] 8086,NOLONG
+POP reg_fs [-: 0f a1] 386
+POP reg_gs [-: 0f a9] 386
+POPA void [ odf 61] 186,NOLONG
+POPAD void [ o32 61] 386,NOLONG
+POPAW void [ o16 61] 186,NOLONG
+POPF void [ odf 9d] 8086
+POPFD void [ o32 9d] 386,NOLONG
+POPFQ void [ o32 9d] X64
+POPFW void [ o16 9d] 8086
+POR mmxreg,mmxrm [rm: np o64nw 0f eb /r] PENT,MMX,SQ
+PREFETCH mem [m: 0f 0d /0] PENT,3DNOW,SQ
+PREFETCHW mem [m: 0f 0d /1] PENT,3DNOW,SQ
+PSLLD mmxreg,mmxrm [rm: np o64nw 0f f2 /r] PENT,MMX,SQ
+PSLLD mmxreg,imm [mi: np 0f 72 /6 ib,u] PENT,MMX
+PSLLQ mmxreg,mmxrm [rm: np o64nw 0f f3 /r] PENT,MMX,SQ
+PSLLQ mmxreg,imm [mi: np 0f 73 /6 ib,u] PENT,MMX
+PSLLW mmxreg,mmxrm [rm: np o64nw 0f f1 /r] PENT,MMX,SQ
+PSLLW mmxreg,imm [mi: np 0f 71 /6 ib,u] PENT,MMX
+PSRAD mmxreg,mmxrm [rm: np o64nw 0f e2 /r] PENT,MMX,SQ
+PSRAD mmxreg,imm [mi: np 0f 72 /4 ib,u] PENT,MMX
+PSRAW mmxreg,mmxrm [rm: np o64nw 0f e1 /r] PENT,MMX,SQ
+PSRAW mmxreg,imm [mi: np 0f 71 /4 ib,u] PENT,MMX
+PSRLD mmxreg,mmxrm [rm: np o64nw 0f d2 /r] PENT,MMX,SQ
+PSRLD mmxreg,imm [mi: np 0f 72 /2 ib,u] PENT,MMX
+PSRLQ mmxreg,mmxrm [rm: np o64nw 0f d3 /r] PENT,MMX,SQ
+PSRLQ mmxreg,imm [mi: np 0f 73 /2 ib,u] PENT,MMX
+PSRLW mmxreg,mmxrm [rm: np o64nw 0f d1 /r] PENT,MMX,SQ
+PSRLW mmxreg,imm [mi: np 0f 71 /2 ib,u] PENT,MMX
+PSUBB mmxreg,mmxrm [rm: np o64nw 0f f8 /r] PENT,MMX,SQ
+PSUBD mmxreg,mmxrm [rm: np o64nw 0f fa /r] PENT,MMX,SQ
+PSUBSB mmxreg,mmxrm [rm: np o64nw 0f e8 /r] PENT,MMX,SQ
+PSUBSIW mmxreg,mmxrm [rm: o64nw 0f 55 /r] PENT,MMX,SQ,CYRIX
+PSUBSW mmxreg,mmxrm [rm: np o64nw 0f e9 /r] PENT,MMX,SQ
+PSUBUSB mmxreg,mmxrm [rm: np o64nw 0f d8 /r] PENT,MMX,SQ
+PSUBUSW mmxreg,mmxrm [rm: np o64nw 0f d9 /r] PENT,MMX,SQ
+PSUBW mmxreg,mmxrm [rm: np o64nw 0f f9 /r] PENT,MMX,SQ
+PUNPCKHBW mmxreg,mmxrm [rm: np o64nw 0f 68 /r] PENT,MMX,SQ
+PUNPCKHDQ mmxreg,mmxrm [rm: np o64nw 0f 6a /r] PENT,MMX,SQ
+PUNPCKHWD mmxreg,mmxrm [rm: np o64nw 0f 69 /r] PENT,MMX,SQ
+PUNPCKLBW mmxreg,mmxrm [rm: np o64nw 0f 60 /r] PENT,MMX,SQ
+PUNPCKLDQ mmxreg,mmxrm [rm: np o64nw 0f 62 /r] PENT,MMX,SQ
+PUNPCKLWD mmxreg,mmxrm [rm: np o64nw 0f 61 /r] PENT,MMX,SQ
+PUSH reg16 [r: o16 50+r] 8086
+PUSH reg32 [r: o32 50+r] 386,NOLONG
+PUSH reg64 [r: o64nw 50+r] X64
+PUSH rm16 [m: o16 ff /6] 8086
+PUSH rm32 [m: o32 ff /6] 386,NOLONG
+PUSH rm64 [m: o64nw ff /6] X64
+PUSH reg_es [-: 06] 8086,NOLONG
+PUSH reg_cs [-: 0e] 8086,NOLONG
+PUSH reg_ss [-: 16] 8086,NOLONG
+PUSH reg_ds [-: 1e] 8086,NOLONG
+PUSH reg_fs [-: 0f a0] 386
+PUSH reg_gs [-: 0f a8] 386
+PUSH imm8 [i: 6a ib,s] 186
+PUSH sbyteword16 [i: o16 6a ib,s] 186,AR0,SIZE,ND
+PUSH imm16 [i: o16 68 iw] 186,AR0,SIZE
+PUSH sbytedword32 [i: o32 6a ib,s] 386,NOLONG,AR0,SIZE,ND
+PUSH imm32 [i: o32 68 id] 386,NOLONG,AR0,SIZE
+PUSH sbytedword32 [i: o32 6a ib,s] 386,NOLONG,SD,ND
+PUSH imm32 [i: o32 68 id] 386,NOLONG,SD
+PUSH sbytedword64 [i: o64nw 6a ib,s] X64,AR0,SIZE,ND
+PUSH imm64 [i: o64nw 68 id,s] X64,AR0,SIZE
+PUSH sbytedword32 [i: o64nw 6a ib,s] X64,AR0,SIZE,ND
+PUSH imm32 [i: o64nw 68 id,s] X64,AR0,SIZE
+PUSHA void [ odf 60] 186,NOLONG
+PUSHAD void [ o32 60] 386,NOLONG
+PUSHAW void [ o16 60] 186,NOLONG
+PUSHF void [ odf 9c] 8086
+PUSHFD void [ o32 9c] 386,NOLONG
+PUSHFQ void [ o32 9c] X64
+PUSHFW void [ o16 9c] 8086
+PXOR mmxreg,mmxrm [rm: np o64nw 0f ef /r] PENT,MMX,SQ
+RCL rm8,unity [m-: d0 /2] 8086
+RCL rm8,reg_cl [m-: d2 /2] 8086
+RCL rm8,imm8 [mi: c0 /2 ib,u] 186
+RCL rm16,unity [m-: o16 d1 /2] 8086
+RCL rm16,reg_cl [m-: o16 d3 /2] 8086
+RCL rm16,imm8 [mi: o16 c1 /2 ib,u] 186
+RCL rm32,unity [m-: o32 d1 /2] 386
+RCL rm32,reg_cl [m-: o32 d3 /2] 386
+RCL rm32,imm8 [mi: o32 c1 /2 ib,u] 386
+RCL rm64,unity [m-: o64 d1 /2] X64
+RCL rm64,reg_cl [m-: o64 d3 /2] X64
+RCL rm64,imm8 [mi: o64 c1 /2 ib,u] X64
+RCR rm8,unity [m-: d0 /3] 8086
+RCR rm8,reg_cl [m-: d2 /3] 8086
+RCR rm8,imm8 [mi: c0 /3 ib,u] 186
+RCR rm16,unity [m-: o16 d1 /3] 8086
+RCR rm16,reg_cl [m-: o16 d3 /3] 8086
+RCR rm16,imm8 [mi: o16 c1 /3 ib,u] 186
+RCR rm32,unity [m-: o32 d1 /3] 386
+RCR rm32,reg_cl [m-: o32 d3 /3] 386
+RCR rm32,imm8 [mi: o32 c1 /3 ib,u] 386
+RCR rm64,unity [m-: o64 d1 /3] X64
+RCR rm64,reg_cl [m-: o64 d3 /3] X64
+RCR rm64,imm8 [mi: o64 c1 /3 ib,u] X64
+RDSHR rm32 [m: o32 0f 36 /0] P6,CYRIX,SMM
+RDMSR void [ 0f 32] PENT,PRIV
+RDPMC void [ 0f 33] P6
+RDTSC void [ 0f 31] PENT
+RDTSCP void [ 0f 01 f9] X86_64
+RET imm [i: c2 iw] 8086,SW,BND
+RETF void [ cb] 8086
+RETF imm [i: ca iw] 8086,SW
+RETN void [ c3] 8086,BND
+RETN imm [i: c2 iw] 8086,SW,BND
+
+ROL rm8,unity [m-: d0 /0] 8086
+ROL rm8,reg_cl [m-: d2 /0] 8086
+ROL rm8,imm8 [mi: c0 /0 ib,u] 186
+ROL rm16,unity [m-: o16 d1 /0] 8086
+ROL rm16,reg_cl [m-: o16 d3 /0] 8086
+ROL rm16,imm8 [mi: o16 c1 /0 ib,u] 186
+ROL rm32,unity [m-: o32 d1 /0] 386
+ROL rm32,reg_cl [m-: o32 d3 /0] 386
+ROL rm32,imm8 [mi: o32 c1 /0 ib,u] 386
+ROL rm64,unity [m-: o64 d1 /0] X64
+ROL rm64,reg_cl [m-: o64 d3 /0] X64
+ROL rm64,imm8 [mi: o64 c1 /0 ib,u] X64
+ROR rm8,unity [m-: d0 /1] 8086
+ROR rm8,reg_cl [m-: d2 /1] 8086
+ROR rm8,imm8 [mi: c0 /1 ib,u] 186
+ROR rm16,unity [m-: o16 d1 /1] 8086
+ROR rm16,reg_cl [m-: o16 d3 /1] 8086
+ROR rm16,imm8 [mi: o16 c1 /1 ib,u] 186
+ROR rm32,unity [m-: o32 d1 /1] 386
+ROR rm32,reg_cl [m-: o32 d3 /1] 386
+ROR rm32,imm8 [mi: o32 c1 /1 ib,u] 386
+ROR rm64,unity [m-: o64 d1 /1] X64
+ROR rm64,reg_cl [m-: o64 d3 /1] X64
+ROR rm64,imm8 [mi: o64 c1 /1 ib,u] X64
+RDM void [ 0f 3a] P6,CYRIX,ND
+RSDC reg_sreg,mem80 [rm: 0f 79 /r] 486,CYRIX,SMM
+RSLDT mem80 [m: 0f 7b /0] 486,CYRIX,SMM
+RSM void [ 0f aa] PENT,SMM
+RSTS mem80 [m: 0f 7d /0] 486,CYRIX,SMM
+SAHF void [ 9e] 8086
+SAL rm8,unity [m-: d0 /4] 8086,ND
+SAL rm8,reg_cl [m-: d2 /4] 8086,ND
+SAL rm8,imm8 [mi: c0 /4 ib,u] 186,ND
+SAL rm16,unity [m-: o16 d1 /4] 8086,ND
+SAL rm16,reg_cl [m-: o16 d3 /4] 8086,ND
+SAL rm16,imm8 [mi: o16 c1 /4 ib,u] 186,ND
+SAL rm32,unity [m-: o32 d1 /4] 386,ND
+SAL rm32,reg_cl [m-: o32 d3 /4] 386,ND
+SAL rm32,imm8 [mi: o32 c1 /4 ib,u] 386,ND
+SAL rm64,unity [m-: o64 d1 /4] X64,ND
+SAL rm64,reg_cl [m-: o64 d3 /4] X64,ND
+SAL rm64,imm8 [mi: o64 c1 /4 ib,u] X64,ND
+SALC void [ d6] 8086,UNDOC
+SAR rm8,unity [m-: d0 /7] 8086
+SAR rm8,reg_cl [m-: d2 /7] 8086
+SAR rm8,imm8 [mi: c0 /7 ib,u] 186
+SAR rm16,unity [m-: o16 d1 /7] 8086
+SAR rm16,reg_cl [m-: o16 d3 /7] 8086
+SAR rm16,imm8 [mi: o16 c1 /7 ib,u] 186
+SAR rm32,unity [m-: o32 d1 /7] 386
+SAR rm32,reg_cl [m-: o32 d3 /7] 386
+SAR rm32,imm8 [mi: o32 c1 /7 ib,u] 386
+SAR rm64,unity [m-: o64 d1 /7] X64
+SAR rm64,reg_cl [m-: o64 d3 /7] X64
+SAR rm64,imm8 [mi: o64 c1 /7 ib,u] X64
+SBB mem,reg8 [mr: hle 18 /r] 8086,SM,LOCK
+SBB reg8,reg8 [mr: 18 /r] 8086
+SBB mem,reg16 [mr: hle o16 19 /r] 8086,SM,LOCK
+SBB reg16,reg16 [mr: o16 19 /r] 8086
+SBB mem,reg32 [mr: hle o32 19 /r] 386,SM,LOCK
+SBB reg32,reg32 [mr: o32 19 /r] 386
+SBB mem,reg64 [mr: hle o64 19 /r] X64,SM,LOCK
+SBB reg64,reg64 [mr: o64 19 /r] X64
+SBB reg8,mem [rm: 1a /r] 8086,SM
+SBB reg8,reg8 [rm: 1a /r] 8086
+SBB reg16,mem [rm: o16 1b /r] 8086,SM
+SBB reg16,reg16 [rm: o16 1b /r] 8086
+SBB reg32,mem [rm: o32 1b /r] 386,SM
+SBB reg32,reg32 [rm: o32 1b /r] 386
+SBB reg64,mem [rm: o64 1b /r] X64,SM
+SBB reg64,reg64 [rm: o64 1b /r] X64
+SBB rm16,imm8 [mi: hle o16 83 /3 ib,s] 8086,LOCK
+SBB rm32,imm8 [mi: hle o32 83 /3 ib,s] 386,LOCK
+SBB rm64,imm8 [mi: hle o64 83 /3 ib,s] X64,LOCK
+SBB reg_al,imm [-i: 1c ib] 8086,SM
+SBB reg_ax,sbyteword [mi: o16 83 /3 ib,s] 8086,SM,ND
+SBB reg_ax,imm [-i: o16 1d iw] 8086,SM
+SBB reg_eax,sbytedword [mi: o32 83 /3 ib,s] 386,SM,ND
+SBB reg_eax,imm [-i: o32 1d id] 386,SM
+SBB reg_rax,sbytedword [mi: o64 83 /3 ib,s] X64,SM,ND
+SBB reg_rax,imm [-i: o64 1d id,s] X64,SM
+SBB rm8,imm [mi: hle 80 /3 ib] 8086,SM,LOCK
+SBB rm16,sbyteword [mi: hle o16 83 /3 ib,s] 8086,SM,LOCK,ND
+SBB rm16,imm [mi: hle o16 81 /3 iw] 8086,SM,LOCK
+SBB rm32,sbytedword [mi: hle o32 83 /3 ib,s] 386,SM,LOCK,ND
+SBB rm32,imm [mi: hle o32 81 /3 id] 386,SM,LOCK
+SBB rm64,sbytedword [mi: hle o64 83 /3 ib,s] X64,SM,LOCK,ND
+SBB rm64,imm [mi: hle o64 81 /3 id,s] X64,SM,LOCK
+SBB mem,imm8 [mi: hle 80 /3 ib] 8086,SM,LOCK
+SBB mem,sbyteword16 [mi: hle o16 83 /3 ib,s] 8086,SM,LOCK,ND
+SBB mem,imm16 [mi: hle o16 81 /3 iw] 8086,SM,LOCK
+SBB mem,sbytedword32 [mi: hle o32 83 /3 ib,s] 386,SM,LOCK,ND
+SBB mem,imm32 [mi: hle o32 81 /3 id] 386,SM,LOCK
+SBB rm8,imm [mi: hle 82 /3 ib] 8086,SM,LOCK,ND,NOLONG
+SCASB void [ repe ae] 8086
+SCASD void [ repe o32 af] 386
+SCASQ void [ repe o64 af] X64
+SCASW void [ repe o16 af] 8086
+SFENCE void [ np 0f ae f8] X64,AMD
+SGDT mem [m: 0f 01 /0] 286
+SHL rm8,unity [m-: d0 /4] 8086
+SHL rm8,reg_cl [m-: d2 /4] 8086
+SHL rm8,imm8 [mi: c0 /4 ib,u] 186
+SHL rm16,unity [m-: o16 d1 /4] 8086
+SHL rm16,reg_cl [m-: o16 d3 /4] 8086
+SHL rm16,imm8 [mi: o16 c1 /4 ib,u] 186
+SHL rm32,unity [m-: o32 d1 /4] 386
+SHL rm32,reg_cl [m-: o32 d3 /4] 386
+SHL rm32,imm8 [mi: o32 c1 /4 ib,u] 386
+SHL rm64,unity [m-: o64 d1 /4] X64
+SHL rm64,reg_cl [m-: o64 d3 /4] X64
+SHL rm64,imm8 [mi: o64 c1 /4 ib,u] X64
+SHLD mem,reg16,imm [mri: o16 0f a4 /r ib,u] 386,SM2,SB,AR2
+SHLD reg16,reg16,imm [mri: o16 0f a4 /r ib,u] 386,SM2,SB,AR2
+SHLD mem,reg32,imm [mri: o32 0f a4 /r ib,u] 386,SM2,SB,AR2
+SHLD reg32,reg32,imm [mri: o32 0f a4 /r ib,u] 386,SM2,SB,AR2
+SHLD mem,reg64,imm [mri: o64 0f a4 /r ib,u] X64,SM2,SB,AR2
+SHLD reg64,reg64,imm [mri: o64 0f a4 /r ib,u] X64,SM2,SB,AR2
+SHLD mem,reg16,reg_cl [mr-: o16 0f a5 /r] 386,SM
+SHLD reg16,reg16,reg_cl [mr-: o16 0f a5 /r] 386
+SHLD mem,reg32,reg_cl [mr-: o32 0f a5 /r] 386,SM
+SHLD reg32,reg32,reg_cl [mr-: o32 0f a5 /r] 386
+SHLD mem,reg64,reg_cl [mr-: o64 0f a5 /r] X64,SM
+SHLD reg64,reg64,reg_cl [mr-: o64 0f a5 /r] X64
+SHR rm8,unity [m-: d0 /5] 8086
+SHR rm8,reg_cl [m-: d2 /5] 8086
+SHR rm8,imm8 [mi: c0 /5 ib,u] 186
+SHR rm16,unity [m-: o16 d1 /5] 8086
+SHR rm16,reg_cl [m-: o16 d3 /5] 8086
+SHR rm16,imm8 [mi: o16 c1 /5 ib,u] 186
+SHR rm32,unity [m-: o32 d1 /5] 386
+SHR rm32,reg_cl [m-: o32 d3 /5] 386
+SHR rm32,imm8 [mi: o32 c1 /5 ib,u] 386
+SHR rm64,unity [m-: o64 d1 /5] X64
+SHR rm64,reg_cl [m-: o64 d3 /5] X64
+SHR rm64,imm8 [mi: o64 c1 /5 ib,u] X64
+SHRD mem,reg16,imm [mri: o16 0f ac /r ib,u] 386,SM2,SB,AR2
+SHRD reg16,reg16,imm [mri: o16 0f ac /r ib,u] 386,SM2,SB,AR2
+SHRD mem,reg32,imm [mri: o32 0f ac /r ib,u] 386,SM2,SB,AR2
+SHRD reg32,reg32,imm [mri: o32 0f ac /r ib,u] 386,SM2,SB,AR2
+SHRD mem,reg64,imm [mri: o64 0f ac /r ib,u] X64,SM2,SB,AR2
+SHRD reg64,reg64,imm [mri: o64 0f ac /r ib,u] X64,SM2,SB,AR2
+SHRD mem,reg16,reg_cl [mr-: o16 0f ad /r] 386,SM
+SHRD reg16,reg16,reg_cl [mr-: o16 0f ad /r] 386
+SHRD mem,reg32,reg_cl [mr-: o32 0f ad /r] 386,SM
+SHRD reg32,reg32,reg_cl [mr-: o32 0f ad /r] 386
+SHRD mem,reg64,reg_cl [mr-: o64 0f ad /r] X64,SM
+SHRD reg64,reg64,reg_cl [mr-: o64 0f ad /r] X64
+SIDT mem [m: 0f 01 /1] 286
+SLDT mem [m: 0f 00 /0] 286
+SLDT mem16 [m: 0f 00 /0] 286
+SLDT reg16 [m: o16 0f 00 /0] 286
+SLDT reg32 [m: o32 0f 00 /0] 386
+SLDT reg64 [m: o64nw 0f 00 /0] X64,ND
+SLDT reg64 [m: o64 0f 00 /0] X64
+SKINIT void [ 0f 01 de] X64
+SMI void [ f1] 386,UNDOC
+SMINT void [ 0f 38] P6,CYRIX,ND
+; Older Cyrix chips had this; they had to move due to conflict with MMX
+SMINTOLD void [ 0f 7e] 486,CYRIX,ND,OBSOLETE
+SMSW mem [m: 0f 01 /4] 286
+SMSW mem16 [m: 0f 01 /4] 286
+SMSW reg16 [m: o16 0f 01 /4] 286
+SMSW reg32 [m: o32 0f 01 /4] 386
+SMSW reg64 [m: o64 0f 01 /4] X64
+STC void [ f9] 8086
+STD void [ fd] 8086
+STI void [ fb] 8086
+STOSB void [ aa] 8086
+STOSD void [ o32 ab] 386
+STOSQ void [ o64 ab] X64
+STOSW void [ o16 ab] 8086
+STR mem [m: 0f 00 /1] 286,PROT
+STR mem16 [m: 0f 00 /1] 286,PROT
+STR reg16 [m: o16 0f 00 /1] 286,PROT
+STR reg32 [m: o32 0f 00 /1] 386,PROT
+STR reg64 [m: o64 0f 00 /1] X64
+SUB mem,reg8 [mr: hle 28 /r] 8086,SM,LOCK
+SUB reg8,reg8 [mr: 28 /r] 8086
+SUB mem,reg16 [mr: hle o16 29 /r] 8086,SM,LOCK
+SUB reg16,reg16 [mr: o16 29 /r] 8086
+SUB mem,reg32 [mr: hle o32 29 /r] 386,SM,LOCK
+SUB reg32,reg32 [mr: o32 29 /r] 386
+SUB mem,reg64 [mr: hle o64 29 /r] X64,SM,LOCK
+SUB reg64,reg64 [mr: o64 29 /r] X64
+SUB reg8,mem [rm: 2a /r] 8086,SM
+SUB reg8,reg8 [rm: 2a /r] 8086
+SUB reg16,mem [rm: o16 2b /r] 8086,SM
+SUB reg16,reg16 [rm: o16 2b /r] 8086
+SUB reg32,mem [rm: o32 2b /r] 386,SM
+SUB reg32,reg32 [rm: o32 2b /r] 386
+SUB reg64,mem [rm: o64 2b /r] X64,SM
+SUB reg64,reg64 [rm: o64 2b /r] X64
+SUB rm16,imm8 [mi: hle o16 83 /5 ib,s] 8086,LOCK
+SUB rm32,imm8 [mi: hle o32 83 /5 ib,s] 386,LOCK
+SUB rm64,imm8 [mi: hle o64 83 /5 ib,s] X64,LOCK
+SUB reg_al,imm [-i: 2c ib] 8086,SM
+SUB reg_ax,sbyteword [mi: o16 83 /5 ib,s] 8086,SM,ND
+SUB reg_ax,imm [-i: o16 2d iw] 8086,SM
+SUB reg_eax,sbytedword [mi: o32 83 /5 ib,s] 386,SM,ND
+SUB reg_eax,imm [-i: o32 2d id] 386,SM
+SUB reg_rax,sbytedword [mi: o64 83 /5 ib,s] X64,SM,ND
+SUB reg_rax,imm [-i: o64 2d id,s] X64,SM
+SUB rm8,imm [mi: hle 80 /5 ib] 8086,SM,LOCK
+SUB rm16,sbyteword [mi: hle o16 83 /5 ib,s] 8086,SM,LOCK,ND
+SUB rm16,imm [mi: hle o16 81 /5 iw] 8086,SM,LOCK
+SUB rm32,sbytedword [mi: hle o32 83 /5 ib,s] 386,SM,LOCK,ND
+SUB rm32,imm [mi: hle o32 81 /5 id] 386,SM,LOCK
+SUB rm64,sbytedword [mi: hle o64 83 /5 ib,s] X64,SM,LOCK,ND
+SUB rm64,imm [mi: hle o64 81 /5 id,s] X64,SM,LOCK
+SUB mem,imm8 [mi: hle 80 /5 ib] 8086,SM,LOCK
+SUB mem,sbyteword16 [mi: hle o16 83 /5 ib,s] 8086,SM,LOCK,ND
+SUB mem,imm16 [mi: hle o16 81 /5 iw] 8086,SM,LOCK
+SUB mem,sbytedword32 [mi: hle o32 83 /5 ib,s] 386,SM,LOCK,ND
+SUB mem,imm32 [mi: hle o32 81 /5 id] 386,SM,LOCK
+SUB rm8,imm [mi: hle 82 /5 ib] 8086,SM,LOCK,ND,NOLONG
+SVDC mem80,reg_sreg [mr: 0f 78 /r] 486,CYRIX,SMM
+SVLDT mem80 [m: 0f 7a /0] 486,CYRIX,SMM,ND
+SVTS mem80 [m: 0f 7c /0] 486,CYRIX,SMM
+SWAPGS void [ 0f 01 f8] X64
+SYSCALL void [ 0f 05] P6,AMD
+SYSENTER void [ 0f 34] P6
+SYSEXIT void [ 0f 35] P6,PRIV
+SYSRET void [ 0f 07] P6,PRIV,AMD
+TEST mem,reg8 [mr: 84 /r] 8086,SM
+TEST reg8,reg8 [mr: 84 /r] 8086
+TEST mem,reg16 [mr: o16 85 /r] 8086,SM
+TEST reg16,reg16 [mr: o16 85 /r] 8086
+TEST mem,reg32 [mr: o32 85 /r] 386,SM
+TEST reg32,reg32 [mr: o32 85 /r] 386
+TEST mem,reg64 [mr: o64 85 /r] X64,SM
+TEST reg64,reg64 [mr: o64 85 /r] X64
+TEST reg8,mem [rm: 84 /r] 8086,SM
+TEST reg16,mem [rm: o16 85 /r] 8086,SM
+TEST reg32,mem [rm: o32 85 /r] 386,SM
+TEST reg64,mem [rm: o64 85 /r] X64,SM
+TEST reg_al,imm [-i: a8 ib] 8086,SM
+TEST reg_ax,imm [-i: o16 a9 iw] 8086,SM
+TEST reg_eax,imm [-i: o32 a9 id] 386,SM
+TEST reg_rax,imm [-i: o64 a9 id,s] X64,SM
+TEST rm8,imm [mi: f6 /0 ib] 8086,SM
+TEST rm16,imm [mi: o16 f7 /0 iw] 8086,SM
+TEST rm32,imm [mi: o32 f7 /0 id] 386,SM
+TEST rm64,imm [mi: o64 f7 /0 id,s] X64,SM
+TEST mem,imm8 [mi: f6 /0 ib] 8086,SM
+TEST mem,imm16 [mi: o16 f7 /0 iw] 8086,SM
+TEST mem,imm32 [mi: o32 f7 /0 id] 386,SM
+UD0 void [ 0f ff] 186
+UD1 reg,rm16 [rm: o16 0f b9 /r] 186
+UD1 reg,rm32 [rm: o32 0f b9 /r] 186
+UD1 reg,rm64 [rm: o64 0f b9 /r] 186
+UD1 void [ 0f b9] 186,ND
+UD2B void [ 0f b9] 186,ND
+UD2B reg,rm16 [rm: o16 0f b9 /r] 186,ND
+UD2B reg,rm32 [rm: o32 0f b9 /r] 186,ND
+UD2B reg,rm64 [rm: o64 0f b9 /r] 186,ND
+UD2 void [ 0f 0b] 186
+UD2A void [ 0f 0b] 186,ND
+UMOV mem,reg8 [mr: np 0f 10 /r] 386,UNDOC,SM,ND
+UMOV reg8,reg8 [mr: np 0f 10 /r] 386,UNDOC,ND
+UMOV mem,reg16 [mr: np o16 0f 11 /r] 386,UNDOC,SM,ND
+UMOV reg16,reg16 [mr: np o16 0f 11 /r] 386,UNDOC,ND
+UMOV mem,reg32 [mr: np o32 0f 11 /r] 386,UNDOC,SM,ND
+UMOV reg32,reg32 [mr: np o32 0f 11 /r] 386,UNDOC,ND
+UMOV reg8,mem [rm: np 0f 12 /r] 386,UNDOC,SM,ND
+UMOV reg8,reg8 [rm: np 0f 12 /r] 386,UNDOC,ND
+UMOV reg16,mem [rm: np o16 0f 13 /r] 386,UNDOC,SM,ND
+UMOV reg16,reg16 [rm: np o16 0f 13 /r] 386,UNDOC,ND
+UMOV reg32,mem [rm: np o32 0f 13 /r] 386,UNDOC,SM,ND
+UMOV reg32,reg32 [rm: np o32 0f 13 /r] 386,UNDOC,ND
+VERR mem [m: 0f 00 /4] 286,PROT
+VERR mem16 [m: 0f 00 /4] 286,PROT
+VERR reg16 [m: 0f 00 /4] 286,PROT
+VERW mem [m: 0f 00 /5] 286,PROT
+VERW mem16 [m: 0f 00 /5] 286,PROT
+VERW reg16 [m: 0f 00 /5] 286,PROT
+FWAIT void [ wait] 8086
+WBINVD void [ 0f 09] 486,PRIV
+WRSHR rm32 [m: o32 0f 37 /0] P6,CYRIX,SMM
+WRMSR void [ 0f 30] PENT,PRIV
+XADD mem,reg8 [mr: hle 0f c0 /r] 486,SM,LOCK
+XADD reg8,reg8 [mr: 0f c0 /r] 486
+XADD mem,reg16 [mr: hle o16 0f c1 /r] 486,SM,LOCK
+XADD reg16,reg16 [mr: o16 0f c1 /r] 486
+XADD mem,reg32 [mr: hle o32 0f c1 /r] 486,SM,LOCK
+XADD reg32,reg32 [mr: o32 0f c1 /r] 486
+XADD mem,reg64 [mr: hle o64 0f c1 /r] X64,SM,LOCK
+XADD reg64,reg64 [mr: o64 0f c1 /r] X64
+XBTS reg16,mem [rm: o16 0f a6 /r] 386,SW,UNDOC,ND
+XBTS reg16,reg16 [rm: o16 0f a6 /r] 386,UNDOC,ND
+XBTS reg32,mem [rm: o32 0f a6 /r] 386,SD,UNDOC,ND
+XBTS reg32,reg32 [rm: o32 0f a6 /r] 386,UNDOC,ND
+XCHG reg_ax,reg16 [-r: o16 90+r] 8086
+XCHG reg_eax,reg32na [-r: o32 90+r] 386
+XCHG reg_rax,reg64 [-r: o64 90+r] X64
+XCHG reg16,reg_ax [r-: o16 90+r] 8086
+XCHG reg32na,reg_eax [r-: o32 90+r] 386
+XCHG reg64,reg_rax [r-: o64 90+r] X64
+; This must be NOLONG since opcode 90 is NOP, and in 64-bit mode
+; "xchg eax,eax" is *not* a NOP.
+XCHG reg_eax,reg_eax [--: o32 90] 386,NOLONG
+XCHG reg8,mem [rm: hlenl 86 /r] 8086,SM,LOCK
+XCHG reg8,reg8 [rm: 86 /r] 8086
+XCHG reg16,mem [rm: hlenl o16 87 /r] 8086,SM,LOCK
+XCHG reg16,reg16 [rm: o16 87 /r] 8086
+XCHG reg32,mem [rm: hlenl o32 87 /r] 386,SM,LOCK
+XCHG reg32,reg32 [rm: o32 87 /r] 386
+XCHG reg64,mem [rm: hlenl o64 87 /r] X64,SM,LOCK
+XCHG reg64,reg64 [rm: o64 87 /r] X64
+XCHG mem,reg8 [mr: hlenl 86 /r] 8086,SM,LOCK
+XCHG reg8,reg8 [mr: 86 /r] 8086
+XCHG mem,reg16 [mr: hlenl o16 87 /r] 8086,SM,LOCK
+XCHG reg16,reg16 [mr: o16 87 /r] 8086
+XCHG mem,reg32 [mr: hlenl o32 87 /r] 386,SM,LOCK
+XCHG reg32,reg32 [mr: o32 87 /r] 386
+XCHG mem,reg64 [mr: hlenl o64 87 /r] X64,SM,LOCK
+XCHG reg64,reg64 [mr: o64 87 /r] X64
+XLATB void [ d7] 8086
+XLAT void [ d7] 8086
+XOR mem,reg8 [mr: hle 30 /r] 8086,SM,LOCK
+XOR reg8,reg8 [mr: 30 /r] 8086
+XOR mem,reg16 [mr: hle o16 31 /r] 8086,SM,LOCK
+XOR reg16,reg16 [mr: o16 31 /r] 8086
+XOR mem,reg32 [mr: hle o32 31 /r] 386,SM,LOCK
+XOR reg32,reg32 [mr: o32 31 /r] 386
+XOR mem,reg64 [mr: hle o64 31 /r] X64,SM,LOCK
+XOR reg64,reg64 [mr: o64 31 /r] X64
+XOR reg8,mem [rm: 32 /r] 8086,SM
+XOR reg8,reg8 [rm: 32 /r] 8086
+XOR reg16,mem [rm: o16 33 /r] 8086,SM
+XOR reg16,reg16 [rm: o16 33 /r] 8086
+XOR reg32,mem [rm: o32 33 /r] 386,SM
+XOR reg32,reg32 [rm: o32 33 /r] 386
+XOR reg64,mem [rm: o64 33 /r] X64,SM
+XOR reg64,reg64 [rm: o64 33 /r] X64
+XOR rm16,imm8 [mi: hle o16 83 /6 ib,s] 8086,LOCK
+XOR rm32,imm8 [mi: hle o32 83 /6 ib,s] 386,LOCK
+XOR rm64,imm8 [mi: hle o64 83 /6 ib,s] X64,LOCK
+XOR reg_al,imm [-i: 34 ib] 8086,SM
+XOR reg_ax,sbyteword [mi: o16 83 /6 ib,s] 8086,SM,ND
+XOR reg_ax,imm [-i: o16 35 iw] 8086,SM
+XOR reg_eax,sbytedword [mi: o32 83 /6 ib,s] 386,SM,ND
+XOR reg_eax,imm [-i: o32 35 id] 386,SM
+XOR reg_rax,sbytedword [mi: o64 83 /6 ib,s] X64,SM,ND
+XOR reg_rax,imm [-i: o64 35 id,s] X64,SM
+XOR rm8,imm [mi: hle 80 /6 ib] 8086,SM,LOCK
+XOR rm16,sbyteword [mi: hle o16 83 /6 ib,s] 8086,SM,LOCK,ND
+XOR rm16,imm [mi: hle o16 81 /6 iw] 8086,SM,LOCK
+XOR rm32,sbytedword [mi: hle o32 83 /6 ib,s] 386,SM,LOCK,ND
+XOR rm32,imm [mi: hle o32 81 /6 id] 386,SM,LOCK
+XOR rm64,sbytedword [mi: hle o64 83 /6 ib,s] X64,SM,LOCK,ND
+XOR rm64,imm [mi: hle o64 81 /6 id,s] X64,SM,LOCK
+XOR mem,imm8 [mi: hle 80 /6 ib] 8086,SM,LOCK
+XOR mem,sbyteword16 [mi: hle o16 83 /6 ib,s] 8086,SM,LOCK,ND
+XOR mem,imm16 [mi: hle o16 81 /6 iw] 8086,SM,LOCK
+XOR mem,sbytedword32 [mi: hle o32 83 /6 ib,s] 386,SM,LOCK,ND
+XOR mem,imm32 [mi: hle o32 81 /6 id] 386,SM,LOCK
+XOR rm8,imm [mi: hle 82 /6 ib] 8086,SM,LOCK,ND,NOLONG
+CMOVcc reg16,mem [rm: o16 0f 40+c /r] P6,SM
+CMOVcc reg16,reg16 [rm: o16 0f 40+c /r] P6
+CMOVcc reg32,mem [rm: o32 0f 40+c /r] P6,SM
+CMOVcc reg32,reg32 [rm: o32 0f 40+c /r] P6
+CMOVcc reg64,mem [rm: o64 0f 40+c /r] X64,SM
+CMOVcc reg64,reg64 [rm: o64 0f 40+c /r] X64
+Jcc imm|near [i: odf 0f 80+c rel] 386,BND
+Jcc imm16|near [i: o16 0f 80+c rel] 386,NOLONG,BND
+Jcc imm32|near [i: o32 0f 80+c rel] 386,NOLONG,BND
+Jcc imm64|near [i: o64nw 0f 80+c rel] X64,BND
+Jcc imm|short [i: 70+c rel8] 8086,ND,BND
+Jcc imm [i: jcc8 70+c rel8] 8086,ND,BND
+Jcc imm [i: 0f 80+c rel] 386,ND,BND
+Jcc imm [i: 71+c jlen e9 rel] 8086,ND,BND
+Jcc imm [i: 70+c rel8] 8086,BND
+
+SETcc mem [m: 0f 90+c /0] 386,SB
+SETcc reg8 [m: 0f 90+c /0] 386
+
+;# Katmai Streaming SIMD instructions (SSE -- a.k.a. KNI, XMM, MMX2)
+ADDPS xmmreg,xmmrm128 [rm: np 0f 58 /r] KATMAI,SSE
+ADDSS xmmreg,xmmrm32 [rm: f3 0f 58 /r] KATMAI,SSE
+ANDNPS xmmreg,xmmrm128 [rm: np 0f 55 /r] KATMAI,SSE
+ANDPS xmmreg,xmmrm128 [rm: np 0f 54 /r] KATMAI,SSE
+CMPEQPS xmmreg,xmmrm128 [rm: np 0f c2 /r 00] KATMAI,SSE
+CMPEQSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 00] KATMAI,SSE
+CMPLEPS xmmreg,xmmrm128 [rm: np 0f c2 /r 02] KATMAI,SSE
+CMPLESS xmmreg,xmmrm32 [rm: f3 0f c2 /r 02] KATMAI,SSE
+CMPLTPS xmmreg,xmmrm128 [rm: np 0f c2 /r 01] KATMAI,SSE
+CMPLTSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 01] KATMAI,SSE
+CMPNEQPS xmmreg,xmmrm128 [rm: np 0f c2 /r 04] KATMAI,SSE
+CMPNEQSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 04] KATMAI,SSE
+CMPNLEPS xmmreg,xmmrm128 [rm: np 0f c2 /r 06] KATMAI,SSE
+CMPNLESS xmmreg,xmmrm32 [rm: f3 0f c2 /r 06] KATMAI,SSE
+CMPNLTPS xmmreg,xmmrm128 [rm: np 0f c2 /r 05] KATMAI,SSE
+CMPNLTSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 05] KATMAI,SSE
+CMPORDPS xmmreg,xmmrm128 [rm: np 0f c2 /r 07] KATMAI,SSE
+CMPORDSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 07] KATMAI,SSE
+CMPUNORDPS xmmreg,xmmrm128 [rm: np 0f c2 /r 03] KATMAI,SSE
+CMPUNORDSS xmmreg,xmmrm32 [rm: f3 0f c2 /r 03] KATMAI,SSE
+; CMPPS/CMPSS must come after the specific ops; that way the disassembler will find the
+; specific ops first and only disassemble illegal ones as cmpps/cmpss.
+CMPPS xmmreg,mem,imm [rmi: np 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
+CMPPS xmmreg,xmmreg,imm [rmi: np 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
+CMPSS xmmreg,mem,imm [rmi: f3 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
+CMPSS xmmreg,xmmreg,imm [rmi: f3 0f c2 /r ib,u] KATMAI,SSE,SB,AR2
+COMISS xmmreg,xmmrm32 [rm: np 0f 2f /r] KATMAI,SSE
+CVTPI2PS xmmreg,mmxrm64 [rm: np 0f 2a /r] KATMAI,SSE,MMX
+CVTPS2PI mmxreg,xmmrm64 [rm: np 0f 2d /r] KATMAI,SSE,MMX
+CVTSI2SS xmmreg,mem [rm: f3 0f 2a /r] KATMAI,SSE,SD,AR1,ND
+CVTSI2SS xmmreg,rm32 [rm: f3 0f 2a /r] KATMAI,SSE,SD,AR1
+CVTSI2SS xmmreg,rm64 [rm: o64 f3 0f 2a /r] X64,SSE,SQ,AR1
+CVTSS2SI reg32,xmmreg [rm: f3 0f 2d /r] KATMAI,SSE,SD,AR1
+CVTSS2SI reg32,mem [rm: f3 0f 2d /r] KATMAI,SSE,SD,AR1
+CVTSS2SI reg64,xmmreg [rm: o64 f3 0f 2d /r] X64,SSE,SD,AR1
+CVTSS2SI reg64,mem [rm: o64 f3 0f 2d /r] X64,SSE,SD,AR1
+CVTTPS2PI mmxreg,xmmrm [rm: np 0f 2c /r] KATMAI,SSE,MMX,SQ
+CVTTSS2SI reg32,xmmrm [rm: f3 0f 2c /r] KATMAI,SSE,SD,AR1
+CVTTSS2SI reg64,xmmrm [rm: o64 f3 0f 2c /r] X64,SSE,SD,AR1
+DIVPS xmmreg,xmmrm128 [rm: np 0f 5e /r] KATMAI,SSE
+DIVSS xmmreg,xmmrm32 [rm: f3 0f 5e /r] KATMAI,SSE
+LDMXCSR mem32 [m: np 0f ae /2] KATMAI,SSE
+MAXPS xmmreg,xmmrm128 [rm: np 0f 5f /r] KATMAI,SSE
+MAXSS xmmreg,xmmrm32 [rm: f3 0f 5f /r] KATMAI,SSE
+MINPS xmmreg,xmmrm128 [rm: np 0f 5d /r] KATMAI,SSE
+MINSS xmmreg,xmmrm32 [rm: f3 0f 5d /r] KATMAI,SSE
+MOVAPS xmmreg,xmmrm128 [rm: np 0f 28 /r] KATMAI,SSE
+MOVAPS xmmrm128,xmmreg [mr: np 0f 29 /r] KATMAI,SSE
+MOVHPS xmmreg,mem64 [rm: np 0f 16 /r] KATMAI,SSE
+MOVHPS mem64,xmmreg [mr: np 0f 17 /r] KATMAI,SSE
+MOVLHPS xmmreg,xmmreg [rm: np 0f 16 /r] KATMAI,SSE
+MOVLPS xmmreg,mem64 [rm: np 0f 12 /r] KATMAI,SSE
+MOVLPS mem64,xmmreg [mr: np 0f 13 /r] KATMAI,SSE
+MOVHLPS xmmreg,xmmreg [rm: np 0f 12 /r] KATMAI,SSE
+MOVMSKPS reg32,xmmreg [rm: np 0f 50 /r] KATMAI,SSE
+MOVMSKPS reg64,xmmreg [rm: np o64 0f 50 /r] X64,SSE
+MOVNTPS mem128,xmmreg [mr: np 0f 2b /r] KATMAI,SSE
+MOVSS xmmreg,xmmrm32 [rm: f3 0f 10 /r] KATMAI,SSE
+MOVSS mem32,xmmreg [mr: f3 0f 11 /r] KATMAI,SSE
+MOVSS xmmreg,xmmreg [rm: f3 0f 10 /r] KATMAI,SSE
+MOVUPS xmmreg,xmmrm128 [rm: np 0f 10 /r] KATMAI,SSE
+MOVUPS xmmrm128,xmmreg [mr: np 0f 11 /r] KATMAI,SSE
+MULPS xmmreg,xmmrm128 [rm: np 0f 59 /r] KATMAI,SSE
+MULSS xmmreg,xmmrm32 [rm: f3 0f 59 /r] KATMAI,SSE
+ORPS xmmreg,xmmrm128 [rm: np 0f 56 /r] KATMAI,SSE
+RCPPS xmmreg,xmmrm128 [rm: np 0f 53 /r] KATMAI,SSE
+RCPSS xmmreg,xmmrm32 [rm: f3 0f 53 /r] KATMAI,SSE
+RSQRTPS xmmreg,xmmrm128 [rm: np 0f 52 /r] KATMAI,SSE
+RSQRTSS xmmreg,xmmrm32 [rm: f3 0f 52 /r] KATMAI,SSE
+SHUFPS xmmreg,xmmrm128,imm8 [rmi: np 0f c6 /r ib,u] KATMAI,SSE
+SQRTPS xmmreg,xmmrm128 [rm: np 0f 51 /r] KATMAI,SSE
+SQRTSS xmmreg,xmmrm32 [rm: f3 0f 51 /r] KATMAI,SSE
+STMXCSR mem32 [m: np 0f ae /3] KATMAI,SSE
+SUBPS xmmreg,xmmrm128 [rm: np 0f 5c /r] KATMAI,SSE
+SUBSS xmmreg,xmmrm32 [rm: f3 0f 5c /r] KATMAI,SSE
+UCOMISS xmmreg,xmmrm32 [rm: np 0f 2e /r] KATMAI,SSE
+UNPCKHPS xmmreg,xmmrm128 [rm: np 0f 15 /r] KATMAI,SSE
+UNPCKLPS xmmreg,xmmrm128 [rm: np 0f 14 /r] KATMAI,SSE
+XORPS xmmreg,xmmrm128 [rm: np 0f 57 /r] KATMAI,SSE
+
+;# Introduced in Deschutes but necessary for SSE support
+FXRSTOR mem [m: np 0f ae /1] P6,SSE,FPU
+FXRSTOR64 mem [m: o64 np 0f ae /1] X64,SSE,FPU
+FXSAVE mem [m: np 0f ae /0] P6,SSE,FPU
+FXSAVE64 mem [m: o64 np 0f ae /0] X64,SSE,FPU
+
+;# XSAVE group (AVX and extended state)
+; Introduced in late Penryn ... we really need to clean up the handling
+; of CPU feature bits.
+XGETBV void [ 0f 01 d0] NEHALEM
+XSETBV void [ 0f 01 d1] NEHALEM,PRIV
+XSAVE mem [m: np 0f ae /4] NEHALEM
+XSAVE64 mem [m: o64 np 0f ae /4] LONG,NEHALEM
+XSAVEC mem [m: np 0f c7 /4] FUTURE
+XSAVEC64 mem [m: o64 np 0f c7 /4] LONG,FUTURE
+XSAVEOPT mem [m: np 0f ae /6] FUTURE
+XSAVEOPT64 mem [m: o64 np 0f ae /6] LONG,FUTURE
+XSAVES mem [m: np 0f c7 /5] FUTURE
+XSAVES64 mem [m: o64 np 0f c7 /5] LONG,FUTURE
+XRSTOR mem [m: np 0f ae /5] NEHALEM
+XRSTOR64 mem [m: o64 np 0f ae /5] LONG,NEHALEM
+XRSTORS mem [m: np 0f c7 /3] FUTURE
+XRSTORS64 mem [m: o64 np 0f c7 /3] LONG,FUTURE
+
+; These instructions are not SSE-specific; they are
+;# Generic memory operations
+; and work even if CR4.OSFXFR == 0
+PREFETCHNTA mem8 [m: 0f 18 /0] KATMAI
+PREFETCHT0 mem8 [m: 0f 18 /1] KATMAI
+PREFETCHT1 mem8 [m: 0f 18 /2] KATMAI
+PREFETCHT2 mem8 [m: 0f 18 /3] KATMAI
+SFENCE void [ np 0f ae f8] KATMAI
+
+;# New MMX instructions introduced in Katmai
+MASKMOVQ mmxreg,mmxreg [rm: np 0f f7 /r] KATMAI,MMX
+MOVNTQ mem,mmxreg [mr: np 0f e7 /r] KATMAI,MMX,SQ
+PAVGB mmxreg,mmxrm [rm: np o64nw 0f e0 /r] KATMAI,MMX,SQ
+PAVGW mmxreg,mmxrm [rm: np o64nw 0f e3 /r] KATMAI,MMX,SQ
+PEXTRW reg32,mmxreg,imm [rmi: np 0f c5 /r ib,u] KATMAI,MMX,SB,AR2
+; PINSRW is documented as using a reg32, but it's really using only 16 bit
+; -- accept either, but be truthful in disassembly
+PINSRW mmxreg,mem,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
+PINSRW mmxreg,rm16,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
+PINSRW mmxreg,reg32,imm [rmi: np 0f c4 /r ib,u] KATMAI,MMX,SB,AR2
+PMAXSW mmxreg,mmxrm [rm: np o64nw 0f ee /r] KATMAI,MMX,SQ
+PMAXUB mmxreg,mmxrm [rm: np o64nw 0f de /r] KATMAI,MMX,SQ
+PMINSW mmxreg,mmxrm [rm: np o64nw 0f ea /r] KATMAI,MMX,SQ
+PMINUB mmxreg,mmxrm [rm: np o64nw 0f da /r] KATMAI,MMX,SQ
+PMOVMSKB reg32,mmxreg [rm: np 0f d7 /r] KATMAI,MMX
+PMULHUW mmxreg,mmxrm [rm: np o64nw 0f e4 /r] KATMAI,MMX,SQ
+PSADBW mmxreg,mmxrm [rm: np o64nw 0f f6 /r] KATMAI,MMX,SQ
+PSHUFW mmxreg,mmxrm,imm [rmi: np o64nw 0f 70 /r ib] KATMAI,MMX,SM2,SB,AR2
+
+;# AMD Enhanced 3DNow! (Athlon) instructions
+PF2IW mmxreg,mmxrm [rm: o64nw 0f 0f /r 1c] PENT,3DNOW,SQ
+PFNACC mmxreg,mmxrm [rm: o64nw 0f 0f /r 8a] PENT,3DNOW,SQ
+PFPNACC mmxreg,mmxrm [rm: o64nw 0f 0f /r 8e] PENT,3DNOW,SQ
+PI2FW mmxreg,mmxrm [rm: o64nw 0f 0f /r 0c] PENT,3DNOW,SQ
+PSWAPD mmxreg,mmxrm [rm: o64nw 0f 0f /r bb] PENT,3DNOW,SQ
+
+;# Willamette SSE2 Cacheability Instructions
+MASKMOVDQU xmmreg,xmmreg [rm: 66 0f f7 /r] WILLAMETTE,SSE2
+; CLFLUSH needs its own feature flag implemented one day
+CLFLUSH mem [m: np 0f ae /7] WILLAMETTE,SSE2
+MOVNTDQ mem,xmmreg [mr: 66 0f e7 /r] WILLAMETTE,SSE2,SO
+MOVNTI mem,reg32 [mr: np 0f c3 /r] WILLAMETTE,SD
+MOVNTI mem,reg64 [mr: o64 np 0f c3 /r] X64,SQ
+MOVNTPD mem,xmmreg [mr: 66 0f 2b /r] WILLAMETTE,SSE2,SO
+LFENCE void [ np 0f ae e8] WILLAMETTE,SSE2
+MFENCE void [ np 0f ae f0] WILLAMETTE,SSE2
+
+;# Willamette MMX instructions (SSE2 SIMD Integer Instructions)
+MOVD mem,xmmreg [mr: 66 norexw 0f 7e /r] WILLAMETTE,SSE2,SD
+MOVD xmmreg,mem [rm: 66 norexw 0f 6e /r] WILLAMETTE,SSE2,SD
+MOVD xmmreg,rm32 [rm: 66 norexw 0f 6e /r] WILLAMETTE,SSE2
+MOVD rm32,xmmreg [mr: 66 norexw 0f 7e /r] WILLAMETTE,SSE2
+MOVDQA xmmreg,xmmreg [rm: 66 0f 6f /r] WILLAMETTE,SSE2
+MOVDQA mem,xmmreg [mr: 66 0f 7f /r] WILLAMETTE,SSE2,SO
+MOVDQA xmmreg,mem [rm: 66 0f 6f /r] WILLAMETTE,SSE2,SO
+MOVDQA xmmreg,xmmreg [mr: 66 0f 7f /r] WILLAMETTE,SSE2
+MOVDQU xmmreg,xmmreg [rm: f3 0f 6f /r] WILLAMETTE,SSE2
+MOVDQU mem,xmmreg [mr: f3 0f 7f /r] WILLAMETTE,SSE2,SO
+MOVDQU xmmreg,mem [rm: f3 0f 6f /r] WILLAMETTE,SSE2,SO
+MOVDQU xmmreg,xmmreg [mr: f3 0f 7f /r] WILLAMETTE,SSE2
+MOVDQ2Q mmxreg,xmmreg [rm: f2 0f d6 /r] WILLAMETTE,SSE2
+MOVQ xmmreg,xmmreg [rm: f3 0f 7e /r] WILLAMETTE,SSE2
+MOVQ xmmreg,xmmreg [mr: 66 0f d6 /r] WILLAMETTE,SSE2
+MOVQ mem,xmmreg [mr: 66 0f d6 /r] WILLAMETTE,SSE2,SQ
+MOVQ xmmreg,mem [rm: f3 0f 7e /r] WILLAMETTE,SSE2,SQ
+MOVQ xmmreg,rm64 [rm: 66 o64 0f 6e /r] X64,SSE2
+MOVQ rm64,xmmreg [mr: 66 o64 0f 7e /r] X64,SSE2
+MOVQ2DQ xmmreg,mmxreg [rm: f3 0f d6 /r] WILLAMETTE,SSE2
+PACKSSWB xmmreg,xmmrm [rm: 66 0f 63 /r] WILLAMETTE,SSE2,SO
+PACKSSDW xmmreg,xmmrm [rm: 66 0f 6b /r] WILLAMETTE,SSE2,SO
+PACKUSWB xmmreg,xmmrm [rm: 66 0f 67 /r] WILLAMETTE,SSE2,SO
+PADDB xmmreg,xmmrm [rm: 66 0f fc /r] WILLAMETTE,SSE2,SO
+PADDW xmmreg,xmmrm [rm: 66 0f fd /r] WILLAMETTE,SSE2,SO
+PADDD xmmreg,xmmrm [rm: 66 0f fe /r] WILLAMETTE,SSE2,SO
+PADDQ mmxreg,mmxrm [rm: np 0f d4 /r] WILLAMETTE,MMX,SQ
+PADDQ xmmreg,xmmrm [rm: 66 0f d4 /r] WILLAMETTE,SSE2,SO
+PADDSB xmmreg,xmmrm [rm: 66 0f ec /r] WILLAMETTE,SSE2,SO
+PADDSW xmmreg,xmmrm [rm: 66 0f ed /r] WILLAMETTE,SSE2,SO
+PADDUSB xmmreg,xmmrm [rm: 66 0f dc /r] WILLAMETTE,SSE2,SO
+PADDUSW xmmreg,xmmrm [rm: 66 0f dd /r] WILLAMETTE,SSE2,SO
+PAND xmmreg,xmmrm [rm: 66 0f db /r] WILLAMETTE,SSE2,SO
+PANDN xmmreg,xmmrm [rm: 66 0f df /r] WILLAMETTE,SSE2,SO
+PAVGB xmmreg,xmmrm [rm: 66 0f e0 /r] WILLAMETTE,SSE2,SO
+PAVGW xmmreg,xmmrm [rm: 66 0f e3 /r] WILLAMETTE,SSE2,SO
+PCMPEQB xmmreg,xmmrm [rm: 66 0f 74 /r] WILLAMETTE,SSE2,SO
+PCMPEQW xmmreg,xmmrm [rm: 66 0f 75 /r] WILLAMETTE,SSE2,SO
+PCMPEQD xmmreg,xmmrm [rm: 66 0f 76 /r] WILLAMETTE,SSE2,SO
+PCMPGTB xmmreg,xmmrm [rm: 66 0f 64 /r] WILLAMETTE,SSE2,SO
+PCMPGTW xmmreg,xmmrm [rm: 66 0f 65 /r] WILLAMETTE,SSE2,SO
+PCMPGTD xmmreg,xmmrm [rm: 66 0f 66 /r] WILLAMETTE,SSE2,SO
+PEXTRW reg32,xmmreg,imm [rmi: 66 0f c5 /r ib,u] WILLAMETTE,SSE2,SB,AR2
+PINSRW xmmreg,reg16,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
+PINSRW xmmreg,reg32,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2,ND
+PINSRW xmmreg,mem,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
+PINSRW xmmreg,mem16,imm [rmi: 66 0f c4 /r ib,u] WILLAMETTE,SSE2,SB,AR2
+PMADDWD xmmreg,xmmrm [rm: 66 0f f5 /r] WILLAMETTE,SSE2,SO
+PMAXSW xmmreg,xmmrm [rm: 66 0f ee /r] WILLAMETTE,SSE2,SO
+PMAXUB xmmreg,xmmrm [rm: 66 0f de /r] WILLAMETTE,SSE2,SO
+PMINSW xmmreg,xmmrm [rm: 66 0f ea /r] WILLAMETTE,SSE2,SO
+PMINUB xmmreg,xmmrm [rm: 66 0f da /r] WILLAMETTE,SSE2,SO
+PMOVMSKB reg32,xmmreg [rm: 66 0f d7 /r] WILLAMETTE,SSE2
+PMULHUW xmmreg,xmmrm [rm: 66 0f e4 /r] WILLAMETTE,SSE2,SO
+PMULHW xmmreg,xmmrm [rm: 66 0f e5 /r] WILLAMETTE,SSE2,SO
+PMULLW xmmreg,xmmrm [rm: 66 0f d5 /r] WILLAMETTE,SSE2,SO
+PMULUDQ mmxreg,mmxrm [rm: np o64nw 0f f4 /r] WILLAMETTE,SSE2,SO
+PMULUDQ xmmreg,xmmrm [rm: 66 0f f4 /r] WILLAMETTE,SSE2,SO
+POR xmmreg,xmmrm [rm: 66 0f eb /r] WILLAMETTE,SSE2,SO
+PSADBW xmmreg,xmmrm [rm: 66 0f f6 /r] WILLAMETTE,SSE2,SO
+PSHUFD xmmreg,xmmreg,imm [rmi: 66 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
+PSHUFD xmmreg,mem,imm [rmi: 66 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
+PSHUFHW xmmreg,xmmreg,imm [rmi: f3 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
+PSHUFHW xmmreg,mem,imm [rmi: f3 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
+PSHUFLW xmmreg,xmmreg,imm [rmi: f2 0f 70 /r ib] WILLAMETTE,SSE2,SB,AR2
+PSHUFLW xmmreg,mem,imm [rmi: f2 0f 70 /r ib] WILLAMETTE,SSE2,SM2,SB,AR2
+PSLLDQ xmmreg,imm [mi: 66 0f 73 /7 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSLLW xmmreg,xmmrm [rm: 66 0f f1 /r] WILLAMETTE,SSE2,SO
+PSLLW xmmreg,imm [mi: 66 0f 71 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSLLD xmmreg,xmmrm [rm: 66 0f f2 /r] WILLAMETTE,SSE2,SO
+PSLLD xmmreg,imm [mi: 66 0f 72 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSLLQ xmmreg,xmmrm [rm: 66 0f f3 /r] WILLAMETTE,SSE2,SO
+PSLLQ xmmreg,imm [mi: 66 0f 73 /6 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRAW xmmreg,xmmrm [rm: 66 0f e1 /r] WILLAMETTE,SSE2,SO
+PSRAW xmmreg,imm [mi: 66 0f 71 /4 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRAD xmmreg,xmmrm [rm: 66 0f e2 /r] WILLAMETTE,SSE2,SO
+PSRAD xmmreg,imm [mi: 66 0f 72 /4 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRLDQ xmmreg,imm [mi: 66 0f 73 /3 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRLW xmmreg,xmmrm [rm: 66 0f d1 /r] WILLAMETTE,SSE2,SO
+PSRLW xmmreg,imm [mi: 66 0f 71 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRLD xmmreg,xmmrm [rm: 66 0f d2 /r] WILLAMETTE,SSE2,SO
+PSRLD xmmreg,imm [mi: 66 0f 72 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSRLQ xmmreg,xmmrm [rm: 66 0f d3 /r] WILLAMETTE,SSE2,SO
+PSRLQ xmmreg,imm [mi: 66 0f 73 /2 ib,u] WILLAMETTE,SSE2,SB,AR1
+PSUBB xmmreg,xmmrm [rm: 66 0f f8 /r] WILLAMETTE,SSE2,SO
+PSUBW xmmreg,xmmrm [rm: 66 0f f9 /r] WILLAMETTE,SSE2,SO
+PSUBD xmmreg,xmmrm [rm: 66 0f fa /r] WILLAMETTE,SSE2,SO
+PSUBQ mmxreg,mmxrm [rm: np o64nw 0f fb /r] WILLAMETTE,SSE2,SO
+PSUBQ xmmreg,xmmrm [rm: 66 0f fb /r] WILLAMETTE,SSE2,SO
+PSUBSB xmmreg,xmmrm [rm: 66 0f e8 /r] WILLAMETTE,SSE2,SO
+PSUBSW xmmreg,xmmrm [rm: 66 0f e9 /r] WILLAMETTE,SSE2,SO
+PSUBUSB xmmreg,xmmrm [rm: 66 0f d8 /r] WILLAMETTE,SSE2,SO
+PSUBUSW xmmreg,xmmrm [rm: 66 0f d9 /r] WILLAMETTE,SSE2,SO
+PUNPCKHBW xmmreg,xmmrm [rm: 66 0f 68 /r] WILLAMETTE,SSE2,SO
+PUNPCKHWD xmmreg,xmmrm [rm: 66 0f 69 /r] WILLAMETTE,SSE2,SO
+PUNPCKHDQ xmmreg,xmmrm [rm: 66 0f 6a /r] WILLAMETTE,SSE2,SO
+PUNPCKHQDQ xmmreg,xmmrm [rm: 66 0f 6d /r] WILLAMETTE,SSE2,SO
+PUNPCKLBW xmmreg,xmmrm [rm: 66 0f 60 /r] WILLAMETTE,SSE2,SO
+PUNPCKLWD xmmreg,xmmrm [rm: 66 0f 61 /r] WILLAMETTE,SSE2,SO
+PUNPCKLDQ xmmreg,xmmrm [rm: 66 0f 62 /r] WILLAMETTE,SSE2,SO
+PUNPCKLQDQ xmmreg,xmmrm [rm: 66 0f 6c /r] WILLAMETTE,SSE2,SO
+PXOR xmmreg,xmmrm [rm: 66 0f ef /r] WILLAMETTE,SSE2,SO
+
+;# Willamette Streaming SIMD instructions (SSE2)
+ADDPD xmmreg,xmmrm [rm: 66 0f 58 /r] WILLAMETTE,SSE2,SO
+ADDSD xmmreg,xmmrm [rm: f2 0f 58 /r] WILLAMETTE,SSE2,SQ
+ANDNPD xmmreg,xmmrm [rm: 66 0f 55 /r] WILLAMETTE,SSE2,SO
+ANDPD xmmreg,xmmrm [rm: 66 0f 54 /r] WILLAMETTE,SSE2,SO
+CMPEQPD xmmreg,xmmrm [rm: 66 0f c2 /r 00] WILLAMETTE,SSE2,SO
+CMPEQSD xmmreg,xmmrm [rm: f2 0f c2 /r 00] WILLAMETTE,SSE2
+CMPLEPD xmmreg,xmmrm [rm: 66 0f c2 /r 02] WILLAMETTE,SSE2,SO
+CMPLESD xmmreg,xmmrm [rm: f2 0f c2 /r 02] WILLAMETTE,SSE2
+CMPLTPD xmmreg,xmmrm [rm: 66 0f c2 /r 01] WILLAMETTE,SSE2,SO
+CMPLTSD xmmreg,xmmrm [rm: f2 0f c2 /r 01] WILLAMETTE,SSE2
+CMPNEQPD xmmreg,xmmrm [rm: 66 0f c2 /r 04] WILLAMETTE,SSE2,SO
+CMPNEQSD xmmreg,xmmrm [rm: f2 0f c2 /r 04] WILLAMETTE,SSE2
+CMPNLEPD xmmreg,xmmrm [rm: 66 0f c2 /r 06] WILLAMETTE,SSE2,SO
+CMPNLESD xmmreg,xmmrm [rm: f2 0f c2 /r 06] WILLAMETTE,SSE2
+CMPNLTPD xmmreg,xmmrm [rm: 66 0f c2 /r 05] WILLAMETTE,SSE2,SO
+CMPNLTSD xmmreg,xmmrm [rm: f2 0f c2 /r 05] WILLAMETTE,SSE2
+CMPORDPD xmmreg,xmmrm [rm: 66 0f c2 /r 07] WILLAMETTE,SSE2,SO
+CMPORDSD xmmreg,xmmrm [rm: f2 0f c2 /r 07] WILLAMETTE,SSE2
+CMPUNORDPD xmmreg,xmmrm [rm: 66 0f c2 /r 03] WILLAMETTE,SSE2,SO
+CMPUNORDSD xmmreg,xmmrm [rm: f2 0f c2 /r 03] WILLAMETTE,SSE2
+; CMPPD/CMPSD must come after the specific ops; that way the disassembler will find the
+; specific ops first and only disassemble illegal ones as cmppd/cmpsd.
+CMPPD xmmreg,xmmrm128,imm8 [rmi: 66 0f c2 /r ib,u] WILLAMETTE,SSE2
+CMPSD xmmreg,xmmrm128,imm8 [rmi: f2 0f c2 /r ib,u] WILLAMETTE,SSE2
+COMISD xmmreg,xmmrm [rm: 66 0f 2f /r] WILLAMETTE,SSE2
+CVTDQ2PD xmmreg,xmmrm [rm: f3 0f e6 /r] WILLAMETTE,SSE2,SQ
+CVTDQ2PS xmmreg,xmmrm [rm: np 0f 5b /r] WILLAMETTE,SSE2,SO
+CVTPD2DQ xmmreg,xmmrm [rm: f2 0f e6 /r] WILLAMETTE,SSE2,SO
+CVTPD2PI mmxreg,xmmrm [rm: 66 0f 2d /r] WILLAMETTE,SSE2,SO
+CVTPD2PS xmmreg,xmmrm [rm: 66 0f 5a /r] WILLAMETTE,SSE2,SO
+CVTPI2PD xmmreg,mmxrm [rm: 66 0f 2a /r] WILLAMETTE,SSE2,SQ
+CVTPS2DQ xmmreg,xmmrm [rm: 66 0f 5b /r] WILLAMETTE,SSE2,SO
+CVTPS2PD xmmreg,xmmrm [rm: np 0f 5a /r] WILLAMETTE,SSE2,SQ
+CVTSD2SI reg32,xmmreg [rm: norexw f2 0f 2d /r] WILLAMETTE,SSE2,SQ,AR1
+CVTSD2SI reg32,mem [rm: norexw f2 0f 2d /r] WILLAMETTE,SSE2,SQ,AR1
+CVTSD2SI reg64,xmmreg [rm: o64 f2 0f 2d /r] X64,SSE2,SQ,AR1
+CVTSD2SI reg64,mem [rm: o64 f2 0f 2d /r] X64,SSE2,SQ,AR1
+CVTSD2SS xmmreg,xmmrm [rm: f2 0f 5a /r] WILLAMETTE,SSE2,SQ
+CVTSI2SD xmmreg,mem [rm: f2 0f 2a /r] WILLAMETTE,SSE2,SD,AR1,ND
+CVTSI2SD xmmreg,rm32 [rm: norexw f2 0f 2a /r] WILLAMETTE,SSE2,SD,AR1
+CVTSI2SD xmmreg,rm64 [rm: o64 f2 0f 2a /r] X64,SSE2,SQ,AR1
+CVTSS2SD xmmreg,xmmrm [rm: f3 0f 5a /r] WILLAMETTE,SSE2,SD
+CVTTPD2PI mmxreg,xmmrm [rm: 66 0f 2c /r] WILLAMETTE,SSE2,SO
+CVTTPD2DQ xmmreg,xmmrm [rm: 66 0f e6 /r] WILLAMETTE,SSE2,SO
+CVTTPS2DQ xmmreg,xmmrm [rm: f3 0f 5b /r] WILLAMETTE,SSE2,SO
+CVTTSD2SI reg32,xmmreg [rm: norexw f2 0f 2c /r] WILLAMETTE,SSE2,SQ,AR1
+CVTTSD2SI reg32,mem [rm: norexw f2 0f 2c /r] WILLAMETTE,SSE2,SQ,AR1
+CVTTSD2SI reg64,xmmreg [rm: o64 f2 0f 2c /r] X64,SSE2,SQ,AR1
+CVTTSD2SI reg64,mem [rm: o64 f2 0f 2c /r] X64,SSE2,SQ,AR1
+DIVPD xmmreg,xmmrm [rm: 66 0f 5e /r] WILLAMETTE,SSE2,SO
+DIVSD xmmreg,xmmrm [rm: f2 0f 5e /r] WILLAMETTE,SSE2
+MAXPD xmmreg,xmmrm [rm: 66 0f 5f /r] WILLAMETTE,SSE2,SO
+MAXSD xmmreg,xmmrm [rm: f2 0f 5f /r] WILLAMETTE,SSE2
+MINPD xmmreg,xmmrm [rm: 66 0f 5d /r] WILLAMETTE,SSE2,SO
+MINSD xmmreg,xmmrm [rm: f2 0f 5d /r] WILLAMETTE,SSE2
+MOVAPD xmmreg,xmmreg [rm: 66 0f 28 /r] WILLAMETTE,SSE2
+MOVAPD xmmreg,xmmreg [mr: 66 0f 29 /r] WILLAMETTE,SSE2
+MOVAPD mem,xmmreg [mr: 66 0f 29 /r] WILLAMETTE,SSE2,SO
+MOVAPD xmmreg,mem [rm: 66 0f 28 /r] WILLAMETTE,SSE2,SO
+MOVHPD mem,xmmreg [mr: 66 0f 17 /r] WILLAMETTE,SSE2
+MOVHPD xmmreg,mem [rm: 66 0f 16 /r] WILLAMETTE,SSE2
+MOVLPD mem64,xmmreg [mr: 66 0f 13 /r] WILLAMETTE,SSE2
+MOVLPD xmmreg,mem64 [rm: 66 0f 12 /r] WILLAMETTE,SSE2
+MOVMSKPD reg32,xmmreg [rm: 66 0f 50 /r] WILLAMETTE,SSE2
+MOVMSKPD reg64,xmmreg [rm: 66 o64 0f 50 /r] X64,SSE2
+MOVSD xmmreg,xmmreg [rm: f2 0f 10 /r] WILLAMETTE,SSE2
+MOVSD xmmreg,xmmreg [mr: f2 0f 11 /r] WILLAMETTE,SSE2
+MOVSD mem64,xmmreg [mr: f2 0f 11 /r] WILLAMETTE,SSE2
+MOVSD xmmreg,mem64 [rm: f2 0f 10 /r] WILLAMETTE,SSE2
+MOVUPD xmmreg,xmmreg [rm: 66 0f 10 /r] WILLAMETTE,SSE2
+MOVUPD xmmreg,xmmreg [mr: 66 0f 11 /r] WILLAMETTE,SSE2
+MOVUPD mem,xmmreg [mr: 66 0f 11 /r] WILLAMETTE,SSE2,SO
+MOVUPD xmmreg,mem [rm: 66 0f 10 /r] WILLAMETTE,SSE2,SO
+MULPD xmmreg,xmmrm [rm: 66 0f 59 /r] WILLAMETTE,SSE2,SO
+MULSD xmmreg,xmmrm [rm: f2 0f 59 /r] WILLAMETTE,SSE2
+ORPD xmmreg,xmmrm [rm: 66 0f 56 /r] WILLAMETTE,SSE2,SO
+SHUFPD xmmreg,xmmreg,imm [rmi: 66 0f c6 /r ib,u] WILLAMETTE,SSE2,SB,AR2
+SHUFPD xmmreg,mem,imm [rmi: 66 0f c6 /r ib,u] WILLAMETTE,SSE2,SM,SB,AR2
+SQRTPD xmmreg,xmmrm [rm: 66 0f 51 /r] WILLAMETTE,SSE2,SO
+SQRTSD xmmreg,xmmrm [rm: f2 0f 51 /r] WILLAMETTE,SSE2
+SUBPD xmmreg,xmmrm [rm: 66 0f 5c /r] WILLAMETTE,SSE2,SO
+SUBSD xmmreg,xmmrm [rm: f2 0f 5c /r] WILLAMETTE,SSE2
+UCOMISD xmmreg,xmmrm [rm: 66 0f 2e /r] WILLAMETTE,SSE2
+UNPCKHPD xmmreg,xmmrm128 [rm: 66 0f 15 /r] WILLAMETTE,SSE2
+UNPCKLPD xmmreg,xmmrm128 [rm: 66 0f 14 /r] WILLAMETTE,SSE2
+XORPD xmmreg,xmmrm128 [rm: 66 0f 57 /r] WILLAMETTE,SSE2
+
+;# Prescott New Instructions (SSE3)
+ADDSUBPD xmmreg,xmmrm [rm: 66 0f d0 /r] PRESCOTT,SSE3,SO
+ADDSUBPS xmmreg,xmmrm [rm: f2 0f d0 /r] PRESCOTT,SSE3,SO
+HADDPD xmmreg,xmmrm [rm: 66 0f 7c /r] PRESCOTT,SSE3,SO
+HADDPS xmmreg,xmmrm [rm: f2 0f 7c /r] PRESCOTT,SSE3,SO
+HSUBPD xmmreg,xmmrm [rm: 66 0f 7d /r] PRESCOTT,SSE3,SO
+HSUBPS xmmreg,xmmrm [rm: f2 0f 7d /r] PRESCOTT,SSE3,SO
+LDDQU xmmreg,mem [rm: f2 0f f0 /r] PRESCOTT,SSE3,SO
+MOVDDUP xmmreg,xmmrm [rm: f2 0f 12 /r] PRESCOTT,SSE3
+MOVSHDUP xmmreg,xmmrm [rm: f3 0f 16 /r] PRESCOTT,SSE3
+MOVSLDUP xmmreg,xmmrm [rm: f3 0f 12 /r] PRESCOTT,SSE3
+
+;# VMX/SVM Instructions
+CLGI void [ 0f 01 dd] VMX,AMD
+STGI void [ 0f 01 dc] VMX,AMD
+VMCALL void [ 0f 01 c1] VMX
+VMCLEAR mem [m: 66 0f c7 /6] VMX
+VMFUNC void [ 0f 01 d4] VMX
+VMLAUNCH void [ 0f 01 c2] VMX
+VMLOAD void [ 0f 01 da] VMX,AMD
+VMMCALL void [ 0f 01 d9] VMX,AMD
+VMPTRLD mem [m: np 0f c7 /6] VMX
+VMPTRST mem [m: np 0f c7 /7] VMX
+VMREAD rm32,reg32 [mr: np 0f 78 /r] VMX,NOLONG,SD
+VMREAD rm64,reg64 [mr: o64nw np 0f 78 /r] X64,VMX,SQ
+VMRESUME void [ 0f 01 c3] VMX
+VMRUN void [ 0f 01 d8] VMX,AMD
+VMSAVE void [ 0f 01 db] VMX,AMD
+VMWRITE reg32,rm32 [rm: np 0f 79 /r] VMX,NOLONG,SD
+VMWRITE reg64,rm64 [rm: o64nw np 0f 79 /r] X64,VMX,SQ
+VMXOFF void [ 0f 01 c4] VMX
+VMXON mem [m: f3 0f c7 /6] VMX
+;# Extended Page Tables VMX instructions
+INVEPT reg32,mem [rm: 66 0f 38 80 /r] VMX,SO,NOLONG
+INVEPT reg64,mem [rm: o64nw 66 0f 38 80 /r] VMX,SO,LONG
+INVVPID reg32,mem [rm: 66 0f 38 81 /r] VMX,SO,NOLONG
+INVVPID reg64,mem [rm: o64nw 66 0f 38 81 /r] VMX,SO,LONG
+
+;# Tejas New Instructions (SSSE3)
+PABSB mmxreg,mmxrm [rm: np 0f 38 1c /r] SSSE3,MMX,SQ
+PABSB xmmreg,xmmrm [rm: 66 0f 38 1c /r] SSSE3
+PABSW mmxreg,mmxrm [rm: np 0f 38 1d /r] SSSE3,MMX,SQ
+PABSW xmmreg,xmmrm [rm: 66 0f 38 1d /r] SSSE3
+PABSD mmxreg,mmxrm [rm: np 0f 38 1e /r] SSSE3,MMX,SQ
+PABSD xmmreg,xmmrm [rm: 66 0f 38 1e /r] SSSE3
+PALIGNR mmxreg,mmxrm,imm [rmi: np 0f 3a 0f /r ib,u] SSSE3,MMX,SQ
+PALIGNR xmmreg,xmmrm,imm [rmi: 66 0f 3a 0f /r ib,u] SSSE3
+PHADDW mmxreg,mmxrm [rm: np 0f 38 01 /r] SSSE3,MMX,SQ
+PHADDW xmmreg,xmmrm [rm: 66 0f 38 01 /r] SSSE3
+PHADDD mmxreg,mmxrm [rm: np 0f 38 02 /r] SSSE3,MMX,SQ
+PHADDD xmmreg,xmmrm [rm: 66 0f 38 02 /r] SSSE3
+PHADDSW mmxreg,mmxrm [rm: np 0f 38 03 /r] SSSE3,MMX,SQ
+PHADDSW xmmreg,xmmrm [rm: 66 0f 38 03 /r] SSSE3
+PHSUBW mmxreg,mmxrm [rm: np 0f 38 05 /r] SSSE3,MMX,SQ
+PHSUBW xmmreg,xmmrm [rm: 66 0f 38 05 /r] SSSE3
+PHSUBD mmxreg,mmxrm [rm: np 0f 38 06 /r] SSSE3,MMX,SQ
+PHSUBD xmmreg,xmmrm [rm: 66 0f 38 06 /r] SSSE3
+PHSUBSW mmxreg,mmxrm [rm: np 0f 38 07 /r] SSSE3,MMX,SQ
+PHSUBSW xmmreg,xmmrm [rm: 66 0f 38 07 /r] SSSE3
+PMADDUBSW mmxreg,mmxrm [rm: np 0f 38 04 /r] SSSE3,MMX,SQ
+PMADDUBSW xmmreg,xmmrm [rm: 66 0f 38 04 /r] SSSE3
+PMULHRSW mmxreg,mmxrm [rm: np 0f 38 0b /r] SSSE3,MMX,SQ
+PMULHRSW xmmreg,xmmrm [rm: 66 0f 38 0b /r] SSSE3
+PSHUFB mmxreg,mmxrm [rm: np 0f 38 00 /r] SSSE3,MMX,SQ
+PSHUFB xmmreg,xmmrm [rm: 66 0f 38 00 /r] SSSE3
+PSIGNB mmxreg,mmxrm [rm: np 0f 38 08 /r] SSSE3,MMX,SQ
+PSIGNB xmmreg,xmmrm [rm: 66 0f 38 08 /r] SSSE3
+PSIGNW mmxreg,mmxrm [rm: np 0f 38 09 /r] SSSE3,MMX,SQ
+PSIGNW xmmreg,xmmrm [rm: 66 0f 38 09 /r] SSSE3
+PSIGND mmxreg,mmxrm [rm: np 0f 38 0a /r] SSSE3,MMX,SQ
+PSIGND xmmreg,xmmrm [rm: 66 0f 38 0a /r] SSSE3
+
+;# AMD SSE4A
+EXTRQ xmmreg,imm,imm [mij: 66 0f 78 /0 ib,u ib,u] SSE4A,AMD
+EXTRQ xmmreg,xmmreg [rm: 66 0f 79 /r] SSE4A,AMD
+INSERTQ xmmreg,xmmreg,imm,imm [rmij: f2 0f 78 /r ib,u ib,u] SSE4A,AMD
+INSERTQ xmmreg,xmmreg [rm: f2 0f 79 /r] SSE4A,AMD
+MOVNTSD mem,xmmreg [mr: f2 0f 2b /r] SSE4A,AMD,SQ
+MOVNTSS mem,xmmreg [mr: f3 0f 2b /r] SSE4A,AMD,SD
+
+;# New instructions in Barcelona
+LZCNT reg16,rm16 [rm: o16 f3i 0f bd /r] P6,AMD
+LZCNT reg32,rm32 [rm: o32 f3i 0f bd /r] P6,AMD
+LZCNT reg64,rm64 [rm: o64 f3i 0f bd /r] X64,AMD
+
+;# Penryn New Instructions (SSE4.1)
+BLENDPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 0d /r ib,u] SSE41
+BLENDPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 0c /r ib,u] SSE41
+BLENDVPD xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 15 /r] SSE41
+BLENDVPD xmmreg,xmmrm [rm: 66 0f 38 15 /r] SSE41
+BLENDVPS xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 14 /r] SSE41
+BLENDVPS xmmreg,xmmrm [rm: 66 0f 38 14 /r] SSE41
+DPPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 41 /r ib,u] SSE41
+DPPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 40 /r ib,u] SSE41
+EXTRACTPS rm32,xmmreg,imm [mri: 66 0f 3a 17 /r ib,u] SSE41
+EXTRACTPS reg64,xmmreg,imm [mri: o64 66 0f 3a 17 /r ib,u] SSE41,X64
+INSERTPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 21 /r ib,u] SSE41,SD
+MOVNTDQA xmmreg,mem128 [rm: 66 0f 38 2a /r] SSE41
+MPSADBW xmmreg,xmmrm,imm [rmi: 66 0f 3a 42 /r ib,u] SSE41
+PACKUSDW xmmreg,xmmrm [rm: 66 0f 38 2b /r] SSE41
+PBLENDVB xmmreg,xmmrm,xmm0 [rm-: 66 0f 38 10 /r] SSE41
+PBLENDVB xmmreg,xmmrm [rm: 66 0f 38 10 /r] SSE41
+PBLENDW xmmreg,xmmrm,imm [rmi: 66 0f 3a 0e /r ib,u] SSE41
+PCMPEQQ xmmreg,xmmrm [rm: 66 0f 38 29 /r] SSE41
+PEXTRB reg32,xmmreg,imm [mri: 66 0f 3a 14 /r ib,u] SSE41
+PEXTRB mem8,xmmreg,imm [mri: 66 0f 3a 14 /r ib,u] SSE41
+PEXTRB reg64,xmmreg,imm [mri: o64 66 0f 3a 14 /r ib,u] SSE41,X64
+PEXTRD rm32,xmmreg,imm [mri: norexw 66 0f 3a 16 /r ib,u] SSE41
+PEXTRQ rm64,xmmreg,imm [mri: o64 66 0f 3a 16 /r ib,u] SSE41,X64
+PEXTRW reg32,xmmreg,imm [mri: 66 0f 3a 15 /r ib,u] SSE41
+PEXTRW mem16,xmmreg,imm [mri: 66 0f 3a 15 /r ib,u] SSE41
+PEXTRW reg64,xmmreg,imm [mri: o64 66 0f 3a 15 /r ib,u] SSE41,X64
+PHMINPOSUW xmmreg,xmmrm [rm: 66 0f 38 41 /r] SSE41
+PINSRB xmmreg,mem,imm [rmi: 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
+PINSRB xmmreg,rm8,imm [rmi: nohi 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
+PINSRB xmmreg,reg32,imm [rmi: 66 0f 3a 20 /r ib,u] SSE41,SB,AR2
+PINSRD xmmreg,mem,imm [rmi: norexw 66 0f 3a 22 /r ib,u] SSE41,SB,AR2
+PINSRD xmmreg,rm32,imm [rmi: norexw 66 0f 3a 22 /r ib,u] SSE41,SB,AR2
+PINSRQ xmmreg,mem,imm [rmi: o64 66 0f 3a 22 /r ib,u] SSE41,X64,SB,AR2
+PINSRQ xmmreg,rm64,imm [rmi: o64 66 0f 3a 22 /r ib,u] SSE41,X64,SB,AR2
+PMAXSB xmmreg,xmmrm [rm: 66 0f 38 3c /r] SSE41
+PMAXSD xmmreg,xmmrm [rm: 66 0f 38 3d /r] SSE41
+PMAXUD xmmreg,xmmrm [rm: 66 0f 38 3f /r] SSE41
+PMAXUW xmmreg,xmmrm [rm: 66 0f 38 3e /r] SSE41
+PMINSB xmmreg,xmmrm [rm: 66 0f 38 38 /r] SSE41
+PMINSD xmmreg,xmmrm [rm: 66 0f 38 39 /r] SSE41
+PMINUD xmmreg,xmmrm [rm: 66 0f 38 3b /r] SSE41
+PMINUW xmmreg,xmmrm [rm: 66 0f 38 3a /r] SSE41
+PMOVSXBW xmmreg,xmmrm [rm: 66 0f 38 20 /r] SSE41,SQ
+PMOVSXBD xmmreg,xmmrm [rm: 66 0f 38 21 /r] SSE41,SD
+PMOVSXBQ xmmreg,xmmrm [rm: 66 0f 38 22 /r] SSE41,SW
+PMOVSXWD xmmreg,xmmrm [rm: 66 0f 38 23 /r] SSE41,SQ
+PMOVSXWQ xmmreg,xmmrm [rm: 66 0f 38 24 /r] SSE41,SD
+PMOVSXDQ xmmreg,xmmrm [rm: 66 0f 38 25 /r] SSE41,SQ
+PMOVZXBW xmmreg,xmmrm [rm: 66 0f 38 30 /r] SSE41,SQ
+PMOVZXBD xmmreg,xmmrm [rm: 66 0f 38 31 /r] SSE41,SD
+PMOVZXBQ xmmreg,xmmrm [rm: 66 0f 38 32 /r] SSE41,SW
+PMOVZXWD xmmreg,xmmrm [rm: 66 0f 38 33 /r] SSE41,SQ
+PMOVZXWQ xmmreg,xmmrm [rm: 66 0f 38 34 /r] SSE41,SD
+PMOVZXDQ xmmreg,xmmrm [rm: 66 0f 38 35 /r] SSE41,SQ
+PMULDQ xmmreg,xmmrm [rm: 66 0f 38 28 /r] SSE41
+PMULLD xmmreg,xmmrm [rm: 66 0f 38 40 /r] SSE41
+PTEST xmmreg,xmmrm [rm: 66 0f 38 17 /r] SSE41
+ROUNDPD xmmreg,xmmrm,imm [rmi: 66 0f 3a 09 /r ib,u] SSE41
+ROUNDPS xmmreg,xmmrm,imm [rmi: 66 0f 3a 08 /r ib,u] SSE41
+ROUNDSD xmmreg,xmmrm,imm [rmi: 66 0f 3a 0b /r ib,u] SSE41
+ROUNDSS xmmreg,xmmrm,imm [rmi: 66 0f 3a 0a /r ib,u] SSE41
+
+;# Nehalem New Instructions (SSE4.2)
+CRC32 reg32,rm8 [rm: f2i 0f 38 f0 /r] SSE42
+CRC32 reg32,rm16 [rm: o16 f2i 0f 38 f1 /r] SSE42
+CRC32 reg32,rm32 [rm: o32 f2i 0f 38 f1 /r] SSE42
+CRC32 reg64,rm8 [rm: o64 f2i 0f 38 f0 /r] SSE42,X64
+CRC32 reg64,rm64 [rm: o64 f2i 0f 38 f1 /r] SSE42,X64
+PCMPESTRI xmmreg,xmmrm,imm [rmi: 66 0f 3a 61 /r ib,u] SSE42
+PCMPESTRM xmmreg,xmmrm,imm [rmi: 66 0f 3a 60 /r ib,u] SSE42
+PCMPISTRI xmmreg,xmmrm,imm [rmi: 66 0f 3a 63 /r ib,u] SSE42
+PCMPISTRM xmmreg,xmmrm,imm [rmi: 66 0f 3a 62 /r ib,u] SSE42
+PCMPGTQ xmmreg,xmmrm [rm: 66 0f 38 37 /r] SSE42
+POPCNT reg16,rm16 [rm: o16 f3i 0f b8 /r] NEHALEM,SW
+POPCNT reg32,rm32 [rm: o32 f3i 0f b8 /r] NEHALEM,SD
+POPCNT reg64,rm64 [rm: o64 f3i 0f b8 /r] NEHALEM,SQ,X64
+
+;# Intel SMX
+GETSEC void [ 0f 37] KATMAI
+
+;# Geode (Cyrix) 3DNow! additions
+PFRCPV mmxreg,mmxrm [rm: o64nw 0f 0f /r 86] PENT,3DNOW,SQ,CYRIX
+PFRSQRTV mmxreg,mmxrm [rm: o64nw 0f 0f /r 87] PENT,3DNOW,SQ,CYRIX
+
+;# Intel new instructions in ???
+; Is NEHALEM right here?
+MOVBE reg16,mem16 [rm: o16 norep 0f 38 f0 /r] NEHALEM,SM
+MOVBE reg32,mem32 [rm: o32 norep 0f 38 f0 /r] NEHALEM,SM
+MOVBE reg64,mem64 [rm: o64 norep 0f 38 f0 /r] NEHALEM,SM
+MOVBE mem16,reg16 [mr: o16 norep 0f 38 f1 /r] NEHALEM,SM
+MOVBE mem32,reg32 [mr: o32 norep 0f 38 f1 /r] NEHALEM,SM
+MOVBE mem64,reg64 [mr: o64 norep 0f 38 f1 /r] NEHALEM,SM
+
+;# Intel AES instructions
+AESENC xmmreg,xmmrm128 [rm: 66 0f 38 dc /r] SSE,WESTMERE
+AESENCLAST xmmreg,xmmrm128 [rm: 66 0f 38 dd /r] SSE,WESTMERE
+AESDEC xmmreg,xmmrm128 [rm: 66 0f 38 de /r] SSE,WESTMERE
+AESDECLAST xmmreg,xmmrm128 [rm: 66 0f 38 df /r] SSE,WESTMERE
+AESIMC xmmreg,xmmrm128 [rm: 66 0f 38 db /r] SSE,WESTMERE
+AESKEYGENASSIST xmmreg,xmmrm128,imm8 [rmi: 66 0f 3a df /r ib] SSE,WESTMERE
+
+;# Intel AVX AES instructions
+VAESENC xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 dc /r] AVX,SANDYBRIDGE
+VAESENCLAST xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 dd /r] AVX,SANDYBRIDGE
+VAESDEC xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 de /r] AVX,SANDYBRIDGE
+VAESDECLAST xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 df /r] AVX,SANDYBRIDGE
+VAESIMC xmmreg,xmmrm128 [rm: vex.128.66.0f38 db /r] AVX,SANDYBRIDGE
+VAESKEYGENASSIST xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a df /r ib] AVX,SANDYBRIDGE
+
+;# Intel AVX instructions
+VADDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 58 /r] AVX,SANDYBRIDGE
+VADDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 58 /r] AVX,SANDYBRIDGE
+VADDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 58 /r] AVX,SANDYBRIDGE
+VADDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 58 /r] AVX,SANDYBRIDGE
+VADDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 58 /r] AVX,SANDYBRIDGE
+VADDSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 58 /r] AVX,SANDYBRIDGE
+VADDSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d0 /r] AVX,SANDYBRIDGE
+VADDSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d0 /r] AVX,SANDYBRIDGE
+VADDSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f d0 /r] AVX,SANDYBRIDGE
+VADDSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f d0 /r] AVX,SANDYBRIDGE
+VANDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 54 /r] AVX,SANDYBRIDGE
+VANDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 54 /r] AVX,SANDYBRIDGE
+VANDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 54 /r] AVX,SANDYBRIDGE
+VANDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 54 /r] AVX,SANDYBRIDGE
+VANDNPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 55 /r] AVX,SANDYBRIDGE
+VANDNPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 55 /r] AVX,SANDYBRIDGE
+VANDNPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 55 /r] AVX,SANDYBRIDGE
+VANDNPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 55 /r] AVX,SANDYBRIDGE
+VBLENDPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0d /r ib] AVX,SANDYBRIDGE
+VBLENDPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0d /r ib] AVX,SANDYBRIDGE
+VBLENDPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0c /r ib] AVX,SANDYBRIDGE
+VBLENDPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0c /r ib] AVX,SANDYBRIDGE
+VBLENDVPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4b /r /is4] AVX,SANDYBRIDGE
+VBLENDVPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a.w0 4b /r /is4] AVX,SANDYBRIDGE
+VBLENDVPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4a /r /is4] AVX,SANDYBRIDGE
+VBLENDVPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a.w0 4a /r /is4] AVX,SANDYBRIDGE
+VBROADCASTSS xmmreg,mem32 [rm: vex.128.66.0f38.w0 18 /r] AVX,SANDYBRIDGE
+VBROADCASTSS ymmreg,mem32 [rm: vex.256.66.0f38.w0 18 /r] AVX,SANDYBRIDGE
+VBROADCASTSD ymmreg,mem64 [rm: vex.256.66.0f38.w0 19 /r] AVX,SANDYBRIDGE
+VBROADCASTF128 ymmreg,mem128 [rm: vex.256.66.0f38.w0 1a /r] AVX,SANDYBRIDGE
+; Specific aliases first, then the generic version, to keep the disassembler happy...
+VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPEQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPLT_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLT_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPUNORD_QPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORD_QPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPNEQ_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQ_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNLT_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLT_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPORD_QPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORD_QPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPEQ_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPEQ_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPNGE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGT_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGT_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPFALSE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPNEQ_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPNEQ_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPGE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGT_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGT_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPTRUE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUEPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUEPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPLT_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLT_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPLE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPUNORD_SPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPUNORD_SPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPNEQ_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNEQ_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNLT_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLT_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPNLE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPORD_SPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPORD_SPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPEQ_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPEQ_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPNGE_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGE_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGT_UQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPNGT_UQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPFALSE_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPFALSE_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPNEQ_OSPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPNEQ_OSPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPGE_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGE_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGT_OQPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPGT_OQPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPTRUE_USPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPTRUE_USPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f c2 /r ib] AVX,SANDYBRIDGE
+VCMPPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f c2 /r ib] AVX,SANDYBRIDGE
+; Specific aliases first, then the generic version, to keep the disassembler happy...
+VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPEQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPLT_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLT_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPUNORD_QPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORD_QPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPNEQ_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQ_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNLT_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLT_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPORD_QPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORD_QPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPEQ_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPEQ_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPNGE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGT_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGT_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPFALSE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPNEQ_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPNEQ_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPGE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGT_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGT_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPTRUE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUEPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUEPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPLT_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLT_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPLE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPUNORD_SPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPUNORD_SPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPNEQ_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNEQ_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNLT_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLT_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPNLE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPORD_SPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPORD_SPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPEQ_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPEQ_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPNGE_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGE_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGT_UQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPNGT_UQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPFALSE_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPFALSE_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPNEQ_OSPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPNEQ_OSPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPGE_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGE_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGT_OQPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPGT_OQPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPTRUE_USPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPTRUE_USPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.0f c2 /r ib] AVX,SANDYBRIDGE
+VCMPPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.0f c2 /r ib] AVX,SANDYBRIDGE
+; Specific aliases first, then the generic version, to keep the disassembler happy...
+VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPLT_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPUNORD_QSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPNEQ_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNLT_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPORD_QSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPEQ_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPNGE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGT_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPFALSE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPNEQ_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPGE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGT_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPTRUE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUESD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPLT_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPUNORD_SSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPNEQ_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNLT_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPORD_SSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPEQ_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPNGE_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGT_UQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPFALSE_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPNEQ_OSSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPGE_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGT_OQSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPTRUE_USSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPSD xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.lig.f2.0f c2 /r ib] AVX,SANDYBRIDGE
+; Specific aliases first, then the generic version, to keep the disassembler happy...
+VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPEQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 00] AVX,SANDYBRIDGE
+VCMPLT_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 01] AVX,SANDYBRIDGE
+VCMPLE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPLESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 02] AVX,SANDYBRIDGE
+VCMPUNORD_QSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPUNORDSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 03] AVX,SANDYBRIDGE
+VCMPNEQ_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNEQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 04] AVX,SANDYBRIDGE
+VCMPNLT_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 05] AVX,SANDYBRIDGE
+VCMPNLE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPNLESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 06] AVX,SANDYBRIDGE
+VCMPORD_QSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPORDSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 07] AVX,SANDYBRIDGE
+VCMPEQ_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 08] AVX,SANDYBRIDGE
+VCMPNGE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 09] AVX,SANDYBRIDGE
+VCMPNGT_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPNGTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0a] AVX,SANDYBRIDGE
+VCMPFALSE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPFALSESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0b] AVX,SANDYBRIDGE
+VCMPNEQ_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0c] AVX,SANDYBRIDGE
+VCMPGE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0d] AVX,SANDYBRIDGE
+VCMPGT_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPGTSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0e] AVX,SANDYBRIDGE
+VCMPTRUE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPTRUESS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 0f] AVX,SANDYBRIDGE
+VCMPEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 10] AVX,SANDYBRIDGE
+VCMPLT_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 11] AVX,SANDYBRIDGE
+VCMPLE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 12] AVX,SANDYBRIDGE
+VCMPUNORD_SSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 13] AVX,SANDYBRIDGE
+VCMPNEQ_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 14] AVX,SANDYBRIDGE
+VCMPNLT_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 15] AVX,SANDYBRIDGE
+VCMPNLE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 16] AVX,SANDYBRIDGE
+VCMPORD_SSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 17] AVX,SANDYBRIDGE
+VCMPEQ_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 18] AVX,SANDYBRIDGE
+VCMPNGE_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 19] AVX,SANDYBRIDGE
+VCMPNGT_UQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1a] AVX,SANDYBRIDGE
+VCMPFALSE_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1b] AVX,SANDYBRIDGE
+VCMPNEQ_OSSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1c] AVX,SANDYBRIDGE
+VCMPGE_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1d] AVX,SANDYBRIDGE
+VCMPGT_OQSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1e] AVX,SANDYBRIDGE
+VCMPTRUE_USSS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f3.0f c2 /r 1f] AVX,SANDYBRIDGE
+VCMPSS xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.lig.f3.0f c2 /r ib] AVX,SANDYBRIDGE
+VCOMISD xmmreg,xmmrm64 [rm: vex.lig.66.0f 2f /r] AVX,SANDYBRIDGE
+VCOMISS xmmreg,xmmrm32 [rm: vex.lig.0f 2f /r] AVX,SANDYBRIDGE
+VCVTDQ2PD xmmreg,xmmrm64 [rm: vex.128.f3.0f e6 /r] AVX,SANDYBRIDGE
+VCVTDQ2PD ymmreg,xmmrm128 [rm: vex.256.f3.0f e6 /r] AVX,SANDYBRIDGE
+VCVTDQ2PS xmmreg,xmmrm128 [rm: vex.128.0f 5b /r] AVX,SANDYBRIDGE
+VCVTDQ2PS ymmreg,ymmrm256 [rm: vex.256.0f 5b /r] AVX,SANDYBRIDGE
+VCVTPD2DQ xmmreg,xmmreg [rm: vex.128.f2.0f e6 /r] AVX,SANDYBRIDGE
+VCVTPD2DQ xmmreg,mem128 [rm: vex.128.f2.0f e6 /r] AVX,SANDYBRIDGE,SO
+VCVTPD2DQ xmmreg,ymmreg [rm: vex.256.f2.0f e6 /r] AVX,SANDYBRIDGE
+VCVTPD2DQ xmmreg,mem256 [rm: vex.256.f2.0f e6 /r] AVX,SANDYBRIDGE,SY
+VCVTPD2PS xmmreg,xmmreg [rm: vex.128.66.0f 5a /r] AVX,SANDYBRIDGE
+VCVTPD2PS xmmreg,mem128 [rm: vex.128.66.0f 5a /r] AVX,SANDYBRIDGE,SO
+VCVTPD2PS xmmreg,ymmreg [rm: vex.256.66.0f 5a /r] AVX,SANDYBRIDGE
+VCVTPD2PS xmmreg,mem256 [rm: vex.256.66.0f 5a /r] AVX,SANDYBRIDGE,SY
+VCVTPS2DQ xmmreg,xmmrm128 [rm: vex.128.66.0f 5b /r] AVX,SANDYBRIDGE
+VCVTPS2DQ ymmreg,ymmrm256 [rm: vex.256.66.0f 5b /r] AVX,SANDYBRIDGE
+VCVTPS2PD xmmreg,xmmrm64 [rm: vex.128.0f 5a /r] AVX,SANDYBRIDGE
+VCVTPS2PD ymmreg,xmmrm128 [rm: vex.256.0f 5a /r] AVX,SANDYBRIDGE
+VCVTSD2SI reg32,xmmrm64 [rm: vex.lig.f2.0f.w0 2d /r] AVX,SANDYBRIDGE
+VCVTSD2SI reg64,xmmrm64 [rm: vex.lig.f2.0f.w1 2d /r] AVX,SANDYBRIDGE,LONG
+VCVTSD2SS xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5a /r] AVX,SANDYBRIDGE
+VCVTSI2SD xmmreg,xmmreg*,rm32 [rvm: vex.nds.lig.f2.0f.w0 2a /r] AVX,SANDYBRIDGE,SD
+VCVTSI2SD xmmreg,xmmreg*,mem32 [rvm: vex.nds.lig.f2.0f.w0 2a /r] AVX,SANDYBRIDGE,ND,SD
+VCVTSI2SD xmmreg,xmmreg*,rm64 [rvm: vex.nds.lig.f2.0f.w1 2a /r] AVX,SANDYBRIDGE,LONG,SQ
+VCVTSI2SS xmmreg,xmmreg*,rm32 [rvm: vex.nds.lig.f3.0f.w0 2a /r] AVX,SANDYBRIDGE,SD
+VCVTSI2SS xmmreg,xmmreg*,mem32 [rvm: vex.nds.lig.f3.0f.w0 2a /r] AVX,SANDYBRIDGE,ND,SD
+VCVTSI2SS xmmreg,xmmreg*,rm64 [rvm: vex.nds.lig.f3.0f.w1 2a /r] AVX,SANDYBRIDGE,LONG,SQ
+VCVTSS2SD xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5a /r] AVX,SANDYBRIDGE
+VCVTSS2SI reg32,xmmrm32 [rm: vex.lig.f3.0f.w0 2d /r] AVX,SANDYBRIDGE
+VCVTSS2SI reg64,xmmrm32 [rm: vex.lig.f3.0f.w1 2d /r] AVX,SANDYBRIDGE,LONG
+VCVTTPD2DQ xmmreg,xmmreg [rm: vex.128.66.0f e6 /r] AVX,SANDYBRIDGE
+VCVTTPD2DQ xmmreg,mem128 [rm: vex.128.66.0f e6 /r] AVX,SANDYBRIDGE,SO
+VCVTTPD2DQ xmmreg,ymmreg [rm: vex.256.66.0f e6 /r] AVX,SANDYBRIDGE
+VCVTTPD2DQ xmmreg,mem256 [rm: vex.256.66.0f e6 /r] AVX,SANDYBRIDGE,SY
+VCVTTPS2DQ xmmreg,xmmrm128 [rm: vex.128.f3.0f 5b /r] AVX,SANDYBRIDGE
+VCVTTPS2DQ ymmreg,ymmrm256 [rm: vex.256.f3.0f 5b /r] AVX,SANDYBRIDGE
+VCVTTSD2SI reg32,xmmrm64 [rm: vex.lig.f2.0f.w0 2c /r] AVX,SANDYBRIDGE
+VCVTTSD2SI reg64,xmmrm64 [rm: vex.lig.f2.0f.w1 2c /r] AVX,SANDYBRIDGE,LONG
+VCVTTSS2SI reg32,xmmrm32 [rm: vex.lig.f3.0f.w0 2c /r] AVX,SANDYBRIDGE
+VCVTTSS2SI reg64,xmmrm32 [rm: vex.lig.f3.0f.w1 2c /r] AVX,SANDYBRIDGE,LONG
+VDIVPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5e /r] AVX,SANDYBRIDGE
+VDIVPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5e /r] AVX,SANDYBRIDGE
+VDIVPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5e /r] AVX,SANDYBRIDGE
+VDIVPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5e /r] AVX,SANDYBRIDGE
+VDIVSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5e /r] AVX,SANDYBRIDGE
+VDIVSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5e /r] AVX,SANDYBRIDGE
+VDPPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 41 /r ib] AVX,SANDYBRIDGE
+VDPPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 40 /r ib] AVX,SANDYBRIDGE
+VDPPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 40 /r ib] AVX,SANDYBRIDGE
+VEXTRACTF128 xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 19 /r ib] AVX,SANDYBRIDGE
+VEXTRACTPS rm32,xmmreg,imm8 [mri: vex.128.66.0f3a 17 /r ib] AVX,SANDYBRIDGE
+VHADDPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 7c /r] AVX,SANDYBRIDGE
+VHADDPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 7c /r] AVX,SANDYBRIDGE
+VHADDPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f 7c /r] AVX,SANDYBRIDGE
+VHADDPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f 7c /r] AVX,SANDYBRIDGE
+VHSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 7d /r] AVX,SANDYBRIDGE
+VHSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 7d /r] AVX,SANDYBRIDGE
+VHSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.f2.0f 7d /r] AVX,SANDYBRIDGE
+VHSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.f2.0f 7d /r] AVX,SANDYBRIDGE
+VINSERTF128 ymmreg,ymmreg*,xmmrm128,imm8 [rvmi: vex.nds.256.66.0f3a.w0 18 /r ib] AVX,SANDYBRIDGE
+VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi: vex.nds.128.66.0f3a 21 /r ib] AVX,SANDYBRIDGE
+VLDDQU xmmreg,mem128 [rm: vex.128.f2.0f f0 /r] AVX,SANDYBRIDGE
+VLDQQU ymmreg,mem256 [rm: vex.256.f2.0f f0 /r] AVX,SANDYBRIDGE
+VLDDQU ymmreg,mem256 [rm: vex.256.f2.0f f0 /r] AVX,SANDYBRIDGE
+VLDMXCSR mem32 [m: vex.lz.0f ae /2] AVX,SANDYBRIDGE
+VMASKMOVDQU xmmreg,xmmreg [rm: vex.128.66.0f f7 /r] AVX,SANDYBRIDGE
+VMASKMOVPS xmmreg,xmmreg,mem128 [rvm: vex.nds.128.66.0f38.w0 2c /r] AVX,SANDYBRIDGE
+VMASKMOVPS ymmreg,ymmreg,mem256 [rvm: vex.nds.256.66.0f38.w0 2c /r] AVX,SANDYBRIDGE
+VMASKMOVPS mem128,xmmreg,xmmreg [mvr: vex.nds.128.66.0f38.w0 2e /r] AVX,SANDYBRIDGE,SO
+VMASKMOVPS mem256,ymmreg,ymmreg [mvr: vex.nds.256.66.0f38.w0 2e /r] AVX,SANDYBRIDGE,SY
+VMASKMOVPD xmmreg,xmmreg,mem128 [rvm: vex.nds.128.66.0f38.w0 2d /r] AVX,SANDYBRIDGE
+VMASKMOVPD ymmreg,ymmreg,mem256 [rvm: vex.nds.256.66.0f38.w0 2d /r] AVX,SANDYBRIDGE
+VMASKMOVPD mem128,xmmreg,xmmreg [mvr: vex.nds.128.66.0f38.w0 2f /r] AVX,SANDYBRIDGE
+VMASKMOVPD mem256,ymmreg,ymmreg [mvr: vex.nds.256.66.0f38.w0 2f /r] AVX,SANDYBRIDGE
+VMAXPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5f /r] AVX,SANDYBRIDGE
+VMAXPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5f /r] AVX,SANDYBRIDGE
+VMAXPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5f /r] AVX,SANDYBRIDGE
+VMAXPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5f /r] AVX,SANDYBRIDGE
+VMAXSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5f /r] AVX,SANDYBRIDGE
+VMAXSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5f /r] AVX,SANDYBRIDGE
+VMINPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5d /r] AVX,SANDYBRIDGE
+VMINPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5d /r] AVX,SANDYBRIDGE
+VMINPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5d /r] AVX,SANDYBRIDGE
+VMINPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5d /r] AVX,SANDYBRIDGE
+VMINSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5d /r] AVX,SANDYBRIDGE
+VMINSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5d /r] AVX,SANDYBRIDGE
+VMOVAPD xmmreg,xmmrm128 [rm: vex.128.66.0f 28 /r] AVX,SANDYBRIDGE
+VMOVAPD xmmrm128,xmmreg [mr: vex.128.66.0f 29 /r] AVX,SANDYBRIDGE
+VMOVAPD ymmreg,ymmrm256 [rm: vex.256.66.0f 28 /r] AVX,SANDYBRIDGE
+VMOVAPD ymmrm256,ymmreg [mr: vex.256.66.0f 29 /r] AVX,SANDYBRIDGE
+VMOVAPS xmmreg,xmmrm128 [rm: vex.128.0f 28 /r] AVX,SANDYBRIDGE
+VMOVAPS xmmrm128,xmmreg [mr: vex.128.0f 29 /r] AVX,SANDYBRIDGE
+VMOVAPS ymmreg,ymmrm256 [rm: vex.256.0f 28 /r] AVX,SANDYBRIDGE
+VMOVAPS ymmrm256,ymmreg [mr: vex.256.0f 29 /r] AVX,SANDYBRIDGE
+VMOVD xmmreg,rm32 [rm: vex.128.66.0f.w0 6e /r] AVX,SANDYBRIDGE
+VMOVD rm32,xmmreg [mr: vex.128.66.0f.w0 7e /r] AVX,SANDYBRIDGE
+VMOVQ xmmreg,xmmrm64 [rm: vex.128.f3.0f 7e /r] AVX,SANDYBRIDGE,SQ
+VMOVQ xmmrm64,xmmreg [mr: vex.128.66.0f d6 /r] AVX,SANDYBRIDGE,SQ
+VMOVQ xmmreg,rm64 [rm: vex.128.66.0f.w1 6e /r] AVX,SANDYBRIDGE,LONG,SQ
+VMOVQ rm64,xmmreg [mr: vex.128.66.0f.w1 7e /r] AVX,SANDYBRIDGE,LONG,SQ
+VMOVDDUP xmmreg,xmmrm64 [rm: vex.128.f2.0f 12 /r] AVX,SANDYBRIDGE
+VMOVDDUP ymmreg,ymmrm256 [rm: vex.256.f2.0f 12 /r] AVX,SANDYBRIDGE
+VMOVDQA xmmreg,xmmrm128 [rm: vex.128.66.0f 6f /r] AVX,SANDYBRIDGE
+VMOVDQA xmmrm128,xmmreg [mr: vex.128.66.0f 7f /r] AVX,SANDYBRIDGE
+; These are officially documented as VMOVDQA, but VMOVQQA seems more logical to me...
+VMOVQQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE
+VMOVQQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE
+VMOVDQA ymmreg,ymmrm256 [rm: vex.256.66.0f 6f /r] AVX,SANDYBRIDGE
+VMOVDQA ymmrm256,ymmreg [mr: vex.256.66.0f 7f /r] AVX,SANDYBRIDGE
+VMOVDQU xmmreg,xmmrm128 [rm: vex.128.f3.0f 6f /r] AVX,SANDYBRIDGE
+VMOVDQU xmmrm128,xmmreg [mr: vex.128.f3.0f 7f /r] AVX,SANDYBRIDGE
+; These are officially documented as VMOVDQU, but VMOVQQU seems more logical to me...
+VMOVQQU ymmreg,ymmrm256 [rm: vex.256.f3.0f 6f /r] AVX,SANDYBRIDGE
+VMOVQQU ymmrm256,ymmreg [mr: vex.256.f3.0f 7f /r] AVX,SANDYBRIDGE
+VMOVDQU ymmreg,ymmrm256 [rm: vex.256.f3.0f 6f /r] AVX,SANDYBRIDGE
+VMOVDQU ymmrm256,ymmreg [mr: vex.256.f3.0f 7f /r] AVX,SANDYBRIDGE
+VMOVHLPS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.128.0f 12 /r] AVX,SANDYBRIDGE
+VMOVHPD xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.66.0f 16 /r] AVX,SANDYBRIDGE
+VMOVHPD mem64,xmmreg [mr: vex.128.66.0f 17 /r] AVX,SANDYBRIDGE
+VMOVHPS xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.0f 16 /r] AVX,SANDYBRIDGE
+VMOVHPS mem64,xmmreg [mr: vex.128.0f 17 /r] AVX,SANDYBRIDGE
+VMOVLHPS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.128.0f 16 /r] AVX,SANDYBRIDGE
+VMOVLPD xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.66.0f 12 /r] AVX,SANDYBRIDGE
+VMOVLPD mem64,xmmreg [mr: vex.128.66.0f 13 /r] AVX,SANDYBRIDGE
+VMOVLPS xmmreg,xmmreg*,mem64 [rvm: vex.nds.128.0f 12 /r] AVX,SANDYBRIDGE
+VMOVLPS mem64,xmmreg [mr: vex.128.0f 13 /r] AVX,SANDYBRIDGE
+VMOVMSKPD reg64,xmmreg [rm: vex.128.66.0f 50 /r] AVX,SANDYBRIDGE,LONG
+VMOVMSKPD reg32,xmmreg [rm: vex.128.66.0f 50 /r] AVX,SANDYBRIDGE
+VMOVMSKPD reg64,ymmreg [rm: vex.256.66.0f 50 /r] AVX,SANDYBRIDGE,LONG
+VMOVMSKPD reg32,ymmreg [rm: vex.256.66.0f 50 /r] AVX,SANDYBRIDGE
+VMOVMSKPS reg64,xmmreg [rm: vex.128.0f 50 /r] AVX,SANDYBRIDGE,LONG
+VMOVMSKPS reg32,xmmreg [rm: vex.128.0f 50 /r] AVX,SANDYBRIDGE
+VMOVMSKPS reg64,ymmreg [rm: vex.256.0f 50 /r] AVX,SANDYBRIDGE,LONG
+VMOVMSKPS reg32,ymmreg [rm: vex.256.0f 50 /r] AVX,SANDYBRIDGE
+VMOVNTDQ mem128,xmmreg [mr: vex.128.66.0f e7 /r] AVX,SANDYBRIDGE
+; Officially VMOVNTDQ, but VMOVNTQQ seems more logical to me...
+VMOVNTQQ mem256,ymmreg [mr: vex.256.66.0f e7 /r] AVX,SANDYBRIDGE
+VMOVNTDQ mem256,ymmreg [mr: vex.256.66.0f e7 /r] AVX,SANDYBRIDGE
+VMOVNTDQA xmmreg,mem128 [rm: vex.128.66.0f38 2a /r] AVX,SANDYBRIDGE
+VMOVNTPD mem128,xmmreg [mr: vex.128.66.0f 2b /r] AVX,SANDYBRIDGE
+VMOVNTPD mem256,ymmreg [mr: vex.256.66.0f 2b /r] AVX,SANDYBRIDGE
+VMOVNTPS mem128,xmmreg [mr: vex.128.0f 2b /r] AVX,SANDYBRIDGE
+VMOVNTPS mem256,ymmreg [mr: vex.256.0f 2b /r] AVX,SANDYBRIDGE
+VMOVSD xmmreg,xmmreg*,xmmreg [rvm: vex.nds.lig.f2.0f 10 /r] AVX,SANDYBRIDGE
+VMOVSD xmmreg,mem64 [rm: vex.lig.f2.0f 10 /r] AVX,SANDYBRIDGE
+VMOVSD xmmreg,xmmreg*,xmmreg [mvr: vex.nds.lig.f2.0f 11 /r] AVX,SANDYBRIDGE
+VMOVSD mem64,xmmreg [mr: vex.lig.f2.0f 11 /r] AVX,SANDYBRIDGE
+VMOVSHDUP xmmreg,xmmrm128 [rm: vex.128.f3.0f 16 /r] AVX,SANDYBRIDGE
+VMOVSHDUP ymmreg,ymmrm256 [rm: vex.256.f3.0f 16 /r] AVX,SANDYBRIDGE
+VMOVSLDUP xmmreg,xmmrm128 [rm: vex.128.f3.0f 12 /r] AVX,SANDYBRIDGE
+VMOVSLDUP ymmreg,ymmrm256 [rm: vex.256.f3.0f 12 /r] AVX,SANDYBRIDGE
+VMOVSS xmmreg,xmmreg*,xmmreg [rvm: vex.nds.lig.f3.0f 10 /r] AVX,SANDYBRIDGE
+VMOVSS xmmreg,mem32 [rm: vex.lig.f3.0f 10 /r] AVX,SANDYBRIDGE
+VMOVSS xmmreg,xmmreg*,xmmreg [mvr: vex.nds.lig.f3.0f 11 /r] AVX,SANDYBRIDGE
+VMOVSS mem32,xmmreg [mr: vex.lig.f3.0f 11 /r] AVX,SANDYBRIDGE
+VMOVUPD xmmreg,xmmrm128 [rm: vex.128.66.0f 10 /r] AVX,SANDYBRIDGE
+VMOVUPD xmmrm128,xmmreg [mr: vex.128.66.0f 11 /r] AVX,SANDYBRIDGE
+VMOVUPD ymmreg,ymmrm256 [rm: vex.256.66.0f 10 /r] AVX,SANDYBRIDGE
+VMOVUPD ymmrm256,ymmreg [mr: vex.256.66.0f 11 /r] AVX,SANDYBRIDGE
+VMOVUPS xmmreg,xmmrm128 [rm: vex.128.0f 10 /r] AVX,SANDYBRIDGE
+VMOVUPS xmmrm128,xmmreg [mr: vex.128.0f 11 /r] AVX,SANDYBRIDGE
+VMOVUPS ymmreg,ymmrm256 [rm: vex.256.0f 10 /r] AVX,SANDYBRIDGE
+VMOVUPS ymmrm256,ymmreg [mr: vex.256.0f 11 /r] AVX,SANDYBRIDGE
+VMPSADBW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 42 /r ib] AVX,SANDYBRIDGE
+VMULPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 59 /r] AVX,SANDYBRIDGE
+VMULPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 59 /r] AVX,SANDYBRIDGE
+VMULPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 59 /r] AVX,SANDYBRIDGE
+VMULPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 59 /r] AVX,SANDYBRIDGE
+VMULSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 59 /r] AVX,SANDYBRIDGE
+VMULSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 59 /r] AVX,SANDYBRIDGE
+VORPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 56 /r] AVX,SANDYBRIDGE
+VORPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 56 /r] AVX,SANDYBRIDGE
+VORPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 56 /r] AVX,SANDYBRIDGE
+VORPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 56 /r] AVX,SANDYBRIDGE
+VPABSB xmmreg,xmmrm128 [rm: vex.128.66.0f38 1c /r] AVX,SANDYBRIDGE
+VPABSW xmmreg,xmmrm128 [rm: vex.128.66.0f38 1d /r] AVX,SANDYBRIDGE
+VPABSD xmmreg,xmmrm128 [rm: vex.128.66.0f38 1e /r] AVX,SANDYBRIDGE
+VPACKSSWB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 63 /r] AVX,SANDYBRIDGE
+VPACKSSDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6b /r] AVX,SANDYBRIDGE
+VPACKUSWB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 67 /r] AVX,SANDYBRIDGE
+VPACKUSDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 2b /r] AVX,SANDYBRIDGE
+VPADDB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fc /r] AVX,SANDYBRIDGE
+VPADDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fd /r] AVX,SANDYBRIDGE
+VPADDD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fe /r] AVX,SANDYBRIDGE
+VPADDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d4 /r] AVX,SANDYBRIDGE
+VPADDSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ec /r] AVX,SANDYBRIDGE
+VPADDSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ed /r] AVX,SANDYBRIDGE
+VPADDUSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f dc /r] AVX,SANDYBRIDGE
+VPADDUSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f dd /r] AVX,SANDYBRIDGE
+VPALIGNR xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0f /r ib] AVX,SANDYBRIDGE
+VPAND xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f db /r] AVX,SANDYBRIDGE
+VPANDN xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f df /r] AVX,SANDYBRIDGE
+VPAVGB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e0 /r] AVX,SANDYBRIDGE
+VPAVGW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e3 /r] AVX,SANDYBRIDGE
+VPBLENDVB xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.nds.128.66.0f3a.w0 4c /r /is4] AVX,SANDYBRIDGE
+VPBLENDW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 0e /r ib] AVX,SANDYBRIDGE
+VPCMPESTRI xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 61 /r ib] AVX,SANDYBRIDGE
+VPCMPESTRM xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 60 /r ib] AVX,SANDYBRIDGE
+VPCMPISTRI xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 63 /r ib] AVX,SANDYBRIDGE
+VPCMPISTRM xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 62 /r ib] AVX,SANDYBRIDGE
+VPCMPEQB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 74 /r] AVX,SANDYBRIDGE
+VPCMPEQW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 75 /r] AVX,SANDYBRIDGE
+VPCMPEQD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 76 /r] AVX,SANDYBRIDGE
+VPCMPEQQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 29 /r] AVX,SANDYBRIDGE
+VPCMPGTB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 64 /r] AVX,SANDYBRIDGE
+VPCMPGTW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 65 /r] AVX,SANDYBRIDGE
+VPCMPGTD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 66 /r] AVX,SANDYBRIDGE
+VPCMPGTQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 37 /r] AVX,SANDYBRIDGE
+VPERMILPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 0d /r] AVX,SANDYBRIDGE
+VPERMILPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 0d /r] AVX,SANDYBRIDGE
+VPERMILPD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a.w0 05 /r ib] AVX,SANDYBRIDGE
+VPERMILPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w0 05 /r ib] AVX,SANDYBRIDGE
+VPERMILPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 0c /r] AVX,SANDYBRIDGE
+VPERMILPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 0c /r] AVX,SANDYBRIDGE
+VPERMILPS xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a.w0 04 /r ib] AVX,SANDYBRIDGE
+VPERMILPS ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w0 04 /r ib] AVX,SANDYBRIDGE
+VPERM2F128 ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 06 /r ib] AVX,SANDYBRIDGE
+VPEXTRB reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE,LONG
+VPEXTRB reg32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE
+VPEXTRB mem8,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 14 /r ib] AVX,SANDYBRIDGE
+VPEXTRW reg64,xmmreg,imm8 [rmi: vex.128.66.0f.w0 c5 /r ib] AVX,SANDYBRIDGE,LONG
+VPEXTRW reg32,xmmreg,imm8 [rmi: vex.128.66.0f.w0 c5 /r ib] AVX,SANDYBRIDGE
+VPEXTRW reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE,LONG
+VPEXTRW reg32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE
+VPEXTRW mem16,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 15 /r ib] AVX,SANDYBRIDGE
+VPEXTRD reg64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 16 /r ib] AVX,SANDYBRIDGE,LONG
+VPEXTRD rm32,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 16 /r ib] AVX,SANDYBRIDGE
+VPEXTRQ rm64,xmmreg,imm8 [mri: vex.128.66.0f3a.w1 16 /r ib] AVX,SANDYBRIDGE,LONG
+VPHADDW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 01 /r] AVX,SANDYBRIDGE
+VPHADDD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 02 /r] AVX,SANDYBRIDGE
+VPHADDSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 03 /r] AVX,SANDYBRIDGE
+VPHMINPOSUW xmmreg,xmmrm128 [rm: vex.128.66.0f38 41 /r] AVX,SANDYBRIDGE
+VPHSUBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 05 /r] AVX,SANDYBRIDGE
+VPHSUBD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 06 /r] AVX,SANDYBRIDGE
+VPHSUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 07 /r] AVX,SANDYBRIDGE
+VPINSRB xmmreg,xmmreg*,mem8,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
+VPINSRB xmmreg,xmmreg*,rm8,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
+VPINSRB xmmreg,xmmreg*,reg32,imm8 [rvmi: vex.nds.128.66.0f3a 20 /r ib] AVX,SANDYBRIDGE
+VPINSRW xmmreg,xmmreg*,mem16,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
+VPINSRW xmmreg,xmmreg*,rm16,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
+VPINSRW xmmreg,xmmreg*,reg32,imm8 [rvmi: vex.nds.128.66.0f c4 /r ib] AVX,SANDYBRIDGE
+VPINSRD xmmreg,xmmreg*,mem32,imm8 [rvmi: vex.nds.128.66.0f3a.w0 22 /r ib] AVX,SANDYBRIDGE
+VPINSRD xmmreg,xmmreg*,rm32,imm8 [rvmi: vex.nds.128.66.0f3a.w0 22 /r ib] AVX,SANDYBRIDGE
+VPINSRQ xmmreg,xmmreg*,mem64,imm8 [rvmi: vex.nds.128.66.0f3a.w1 22 /r ib] AVX,SANDYBRIDGE,LONG
+VPINSRQ xmmreg,xmmreg*,rm64,imm8 [rvmi: vex.nds.128.66.0f3a.w1 22 /r ib] AVX,SANDYBRIDGE,LONG
+VPMADDWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f5 /r] AVX,SANDYBRIDGE
+VPMADDUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 04 /r] AVX,SANDYBRIDGE
+VPMAXSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3c /r] AVX,SANDYBRIDGE
+VPMAXSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ee /r] AVX,SANDYBRIDGE
+VPMAXSD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3d /r] AVX,SANDYBRIDGE
+VPMAXUB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f de /r] AVX,SANDYBRIDGE
+VPMAXUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3e /r] AVX,SANDYBRIDGE
+VPMAXUD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3f /r] AVX,SANDYBRIDGE
+VPMINSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 38 /r] AVX,SANDYBRIDGE
+VPMINSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ea /r] AVX,SANDYBRIDGE
+VPMINSD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 39 /r] AVX,SANDYBRIDGE
+VPMINUB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f da /r] AVX,SANDYBRIDGE
+VPMINUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3a /r] AVX,SANDYBRIDGE
+VPMINUD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 3b /r] AVX,SANDYBRIDGE
+VPMOVMSKB reg64,xmmreg [rm: vex.128.66.0f d7 /r] AVX,SANDYBRIDGE,LONG
+VPMOVMSKB reg32,xmmreg [rm: vex.128.66.0f d7 /r] AVX,SANDYBRIDGE
+VPMOVSXBW xmmreg,xmmrm64 [rm: vex.128.66.0f38 20 /r] AVX,SANDYBRIDGE
+VPMOVSXBD xmmreg,xmmrm32 [rm: vex.128.66.0f38 21 /r] AVX,SANDYBRIDGE
+VPMOVSXBQ xmmreg,xmmrm16 [rm: vex.128.66.0f38 22 /r] AVX,SANDYBRIDGE
+VPMOVSXWD xmmreg,xmmrm64 [rm: vex.128.66.0f38 23 /r] AVX,SANDYBRIDGE
+VPMOVSXWQ xmmreg,xmmrm32 [rm: vex.128.66.0f38 24 /r] AVX,SANDYBRIDGE
+VPMOVSXDQ xmmreg,xmmrm64 [rm: vex.128.66.0f38 25 /r] AVX,SANDYBRIDGE
+VPMOVZXBW xmmreg,xmmrm64 [rm: vex.128.66.0f38 30 /r] AVX,SANDYBRIDGE
+VPMOVZXBD xmmreg,xmmrm32 [rm: vex.128.66.0f38 31 /r] AVX,SANDYBRIDGE
+VPMOVZXBQ xmmreg,xmmrm16 [rm: vex.128.66.0f38 32 /r] AVX,SANDYBRIDGE
+VPMOVZXWD xmmreg,xmmrm64 [rm: vex.128.66.0f38 33 /r] AVX,SANDYBRIDGE
+VPMOVZXWQ xmmreg,xmmrm32 [rm: vex.128.66.0f38 34 /r] AVX,SANDYBRIDGE
+VPMOVZXDQ xmmreg,xmmrm64 [rm: vex.128.66.0f38 35 /r] AVX,SANDYBRIDGE
+VPMULHUW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e4 /r] AVX,SANDYBRIDGE
+VPMULHRSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 0b /r] AVX,SANDYBRIDGE
+VPMULHW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e5 /r] AVX,SANDYBRIDGE
+VPMULLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d5 /r] AVX,SANDYBRIDGE
+VPMULLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 40 /r] AVX,SANDYBRIDGE
+VPMULUDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f4 /r] AVX,SANDYBRIDGE
+VPMULDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 28 /r] AVX,SANDYBRIDGE
+VPOR xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f eb /r] AVX,SANDYBRIDGE
+VPSADBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f6 /r] AVX,SANDYBRIDGE
+VPSHUFB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 00 /r] AVX,SANDYBRIDGE
+VPSHUFD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f 70 /r ib] AVX,SANDYBRIDGE
+VPSHUFHW xmmreg,xmmrm128,imm8 [rmi: vex.128.f3.0f 70 /r ib] AVX,SANDYBRIDGE
+VPSHUFLW xmmreg,xmmrm128,imm8 [rmi: vex.128.f2.0f 70 /r ib] AVX,SANDYBRIDGE
+VPSIGNB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 08 /r] AVX,SANDYBRIDGE
+VPSIGNW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 09 /r] AVX,SANDYBRIDGE
+VPSIGND xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38 0a /r] AVX,SANDYBRIDGE
+VPSLLDQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /7 ib] AVX,SANDYBRIDGE
+VPSRLDQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /3 ib] AVX,SANDYBRIDGE
+VPSLLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f1 /r] AVX,SANDYBRIDGE
+VPSLLW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /6 ib] AVX,SANDYBRIDGE
+VPSLLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f2 /r] AVX,SANDYBRIDGE
+VPSLLD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /6 ib] AVX,SANDYBRIDGE
+VPSLLQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f3 /r] AVX,SANDYBRIDGE
+VPSLLQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /6 ib] AVX,SANDYBRIDGE
+VPSRAW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e1 /r] AVX,SANDYBRIDGE
+VPSRAW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /4 ib] AVX,SANDYBRIDGE
+VPSRAD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e2 /r] AVX,SANDYBRIDGE
+VPSRAD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /4 ib] AVX,SANDYBRIDGE
+VPSRLW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d1 /r] AVX,SANDYBRIDGE
+VPSRLW xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 71 /2 ib] AVX,SANDYBRIDGE
+VPSRLD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d2 /r] AVX,SANDYBRIDGE
+VPSRLD xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 72 /2 ib] AVX,SANDYBRIDGE
+VPSRLQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d3 /r] AVX,SANDYBRIDGE
+VPSRLQ xmmreg,xmmreg*,imm8 [vmi: vex.ndd.128.66.0f 73 /2 ib] AVX,SANDYBRIDGE
+VPTEST xmmreg,xmmrm128 [rm: vex.128.66.0f38 17 /r] AVX,SANDYBRIDGE
+VPTEST ymmreg,ymmrm256 [rm: vex.256.66.0f38 17 /r] AVX,SANDYBRIDGE
+VPSUBB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f8 /r] AVX,SANDYBRIDGE
+VPSUBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f f9 /r] AVX,SANDYBRIDGE
+VPSUBD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fa /r] AVX,SANDYBRIDGE
+VPSUBQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f fb /r] AVX,SANDYBRIDGE
+VPSUBSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e8 /r] AVX,SANDYBRIDGE
+VPSUBSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f e9 /r] AVX,SANDYBRIDGE
+VPSUBUSB xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d8 /r] AVX,SANDYBRIDGE
+VPSUBUSW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f d9 /r] AVX,SANDYBRIDGE
+VPUNPCKHBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 68 /r] AVX,SANDYBRIDGE
+VPUNPCKHWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 69 /r] AVX,SANDYBRIDGE
+VPUNPCKHDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6a /r] AVX,SANDYBRIDGE
+VPUNPCKHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6d /r] AVX,SANDYBRIDGE
+VPUNPCKLBW xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 60 /r] AVX,SANDYBRIDGE
+VPUNPCKLWD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 61 /r] AVX,SANDYBRIDGE
+VPUNPCKLDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 62 /r] AVX,SANDYBRIDGE
+VPUNPCKLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 6c /r] AVX,SANDYBRIDGE
+VPXOR xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f ef /r] AVX,SANDYBRIDGE
+VRCPPS xmmreg,xmmrm128 [rm: vex.128.0f 53 /r] AVX,SANDYBRIDGE
+VRCPPS ymmreg,ymmrm256 [rm: vex.256.0f 53 /r] AVX,SANDYBRIDGE
+VRCPSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 53 /r] AVX,SANDYBRIDGE
+VRSQRTPS xmmreg,xmmrm128 [rm: vex.128.0f 52 /r] AVX,SANDYBRIDGE
+VRSQRTPS ymmreg,ymmrm256 [rm: vex.256.0f 52 /r] AVX,SANDYBRIDGE
+VRSQRTSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 52 /r] AVX,SANDYBRIDGE
+VROUNDPD xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 09 /r ib] AVX,SANDYBRIDGE
+VROUNDPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a 09 /r ib] AVX,SANDYBRIDGE
+VROUNDPS xmmreg,xmmrm128,imm8 [rmi: vex.128.66.0f3a 08 /r ib] AVX,SANDYBRIDGE
+VROUNDPS ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a 08 /r ib] AVX,SANDYBRIDGE
+VROUNDSD xmmreg,xmmreg*,xmmrm64,imm8 [rvmi: vex.nds.128.66.0f3a 0b /r ib] AVX,SANDYBRIDGE
+VROUNDSS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi: vex.nds.128.66.0f3a 0a /r ib] AVX,SANDYBRIDGE
+VSHUFPD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f c6 /r ib] AVX,SANDYBRIDGE
+VSHUFPD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f c6 /r ib] AVX,SANDYBRIDGE
+VSHUFPS xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.0f c6 /r ib] AVX,SANDYBRIDGE
+VSHUFPS ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.0f c6 /r ib] AVX,SANDYBRIDGE
+VSQRTPD xmmreg,xmmrm128 [rm: vex.128.66.0f 51 /r] AVX,SANDYBRIDGE
+VSQRTPD ymmreg,ymmrm256 [rm: vex.256.66.0f 51 /r] AVX,SANDYBRIDGE
+VSQRTPS xmmreg,xmmrm128 [rm: vex.128.0f 51 /r] AVX,SANDYBRIDGE
+VSQRTPS ymmreg,ymmrm256 [rm: vex.256.0f 51 /r] AVX,SANDYBRIDGE
+VSQRTSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 51 /r] AVX,SANDYBRIDGE
+VSQRTSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 51 /r] AVX,SANDYBRIDGE
+VSTMXCSR mem32 [m: vex.128.0f ae /3] AVX,SANDYBRIDGE
+VSUBPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 5c /r] AVX,SANDYBRIDGE
+VSUBPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 5c /r] AVX,SANDYBRIDGE
+VSUBPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 5c /r] AVX,SANDYBRIDGE
+VSUBPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 5c /r] AVX,SANDYBRIDGE
+VSUBSD xmmreg,xmmreg*,xmmrm64 [rvm: vex.nds.lig.f2.0f 5c /r] AVX,SANDYBRIDGE
+VSUBSS xmmreg,xmmreg*,xmmrm32 [rvm: vex.nds.lig.f3.0f 5c /r] AVX,SANDYBRIDGE
+VTESTPS xmmreg,xmmrm128 [rm: vex.128.66.0f38.w0 0e /r] AVX,SANDYBRIDGE
+VTESTPS ymmreg,ymmrm256 [rm: vex.256.66.0f38.w0 0e /r] AVX,SANDYBRIDGE
+VTESTPD xmmreg,xmmrm128 [rm: vex.128.66.0f38.w0 0f /r] AVX,SANDYBRIDGE
+VTESTPD ymmreg,ymmrm256 [rm: vex.256.66.0f38.w0 0f /r] AVX,SANDYBRIDGE
+VUCOMISD xmmreg,xmmrm64 [rm: vex.lig.66.0f 2e /r] AVX,SANDYBRIDGE
+VUCOMISS xmmreg,xmmrm32 [rm: vex.lig.0f 2e /r] AVX,SANDYBRIDGE
+VUNPCKHPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 15 /r] AVX,SANDYBRIDGE
+VUNPCKHPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 15 /r] AVX,SANDYBRIDGE
+VUNPCKHPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 15 /r] AVX,SANDYBRIDGE
+VUNPCKHPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 15 /r] AVX,SANDYBRIDGE
+VUNPCKLPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 14 /r] AVX,SANDYBRIDGE
+VUNPCKLPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 14 /r] AVX,SANDYBRIDGE
+VUNPCKLPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 14 /r] AVX,SANDYBRIDGE
+VUNPCKLPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 14 /r] AVX,SANDYBRIDGE
+VXORPD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f 57 /r] AVX,SANDYBRIDGE
+VXORPD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 57 /r] AVX,SANDYBRIDGE
+VXORPS xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.0f 57 /r] AVX,SANDYBRIDGE
+VXORPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.0f 57 /r] AVX,SANDYBRIDGE
+VZEROALL void [ vex.256.0f.w0 77] AVX,SANDYBRIDGE
+VZEROUPPER void [ vex.128.0f.w0 77] AVX,SANDYBRIDGE
+
+;# Intel Carry-Less Multiplication instructions (CLMUL)
+PCLMULLQLQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 00] SSE,WESTMERE
+PCLMULHQLQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 01] SSE,WESTMERE
+PCLMULLQHQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 10] SSE,WESTMERE
+PCLMULHQHQDQ xmmreg,xmmrm128 [rm: 66 0f 3a 44 /r 11] SSE,WESTMERE
+PCLMULQDQ xmmreg,xmmrm128,imm8 [rmi: 66 0f 3a 44 /r ib] SSE,WESTMERE
+
+;# Intel AVX Carry-Less Multiplication instructions (CLMUL)
+VPCLMULLQLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 00] AVX,SANDYBRIDGE
+VPCLMULHQLQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 01] AVX,SANDYBRIDGE
+VPCLMULLQHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 10] AVX,SANDYBRIDGE
+VPCLMULHQHQDQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f3a 44 /r 11] AVX,SANDYBRIDGE
+VPCLMULQDQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a 44 /r ib] AVX,SANDYBRIDGE
+
+;# Intel Fused Multiply-Add instructions (FMA)
+VFMADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 98 /r] FMA,FUTURE
+VFMADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 98 /r] FMA,FUTURE
+VFMADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 98 /r] FMA,FUTURE
+VFMADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 98 /r] FMA,FUTURE
+VFMADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 98 /r] FMA,FUTURE
+VFMADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 98 /r] FMA,FUTURE
+VFMADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 98 /r] FMA,FUTURE
+VFMADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 98 /r] FMA,FUTURE
+VFMADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a8 /r] FMA,FUTURE
+VFMADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a8 /r] FMA,FUTURE
+VFMADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a8 /r] FMA,FUTURE
+VFMADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a8 /r] FMA,FUTURE
+VFMADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a8 /r] FMA,FUTURE
+VFMADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a8 /r] FMA,FUTURE
+VFMADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a8 /r] FMA,FUTURE
+VFMADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a8 /r] FMA,FUTURE
+VFMADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b8 /r] FMA,FUTURE
+VFMADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b8 /r] FMA,FUTURE
+VFMADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b8 /r] FMA,FUTURE
+VFMADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b8 /r] FMA,FUTURE
+VFMADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b8 /r] FMA,FUTURE
+VFMADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b8 /r] FMA,FUTURE
+VFMADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b8 /r] FMA,FUTURE
+VFMADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b8 /r] FMA,FUTURE
+VFMADDSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 96 /r] FMA,FUTURE
+VFMADDSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 96 /r] FMA,FUTURE
+VFMADDSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 96 /r] FMA,FUTURE
+VFMADDSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 96 /r] FMA,FUTURE
+VFMADDSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 96 /r] FMA,FUTURE
+VFMADDSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 96 /r] FMA,FUTURE
+VFMADDSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 96 /r] FMA,FUTURE
+VFMADDSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 96 /r] FMA,FUTURE
+VFMADDSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a6 /r] FMA,FUTURE
+VFMADDSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a6 /r] FMA,FUTURE
+VFMADDSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a6 /r] FMA,FUTURE
+VFMADDSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a6 /r] FMA,FUTURE
+VFMADDSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a6 /r] FMA,FUTURE
+VFMADDSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a6 /r] FMA,FUTURE
+VFMADDSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a6 /r] FMA,FUTURE
+VFMADDSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a6 /r] FMA,FUTURE
+VFMADDSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b6 /r] FMA,FUTURE
+VFMADDSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b6 /r] FMA,FUTURE
+VFMADDSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b6 /r] FMA,FUTURE
+VFMADDSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b6 /r] FMA,FUTURE
+VFMADDSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b6 /r] FMA,FUTURE
+VFMADDSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b6 /r] FMA,FUTURE
+VFMADDSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b6 /r] FMA,FUTURE
+VFMADDSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b6 /r] FMA,FUTURE
+VFMSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9a /r] FMA,FUTURE
+VFMSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9a /r] FMA,FUTURE
+VFMSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9a /r] FMA,FUTURE
+VFMSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9a /r] FMA,FUTURE
+VFMSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9a /r] FMA,FUTURE
+VFMSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9a /r] FMA,FUTURE
+VFMSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9a /r] FMA,FUTURE
+VFMSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9a /r] FMA,FUTURE
+VFMSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 aa /r] FMA,FUTURE
+VFMSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 aa /r] FMA,FUTURE
+VFMSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 aa /r] FMA,FUTURE
+VFMSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 aa /r] FMA,FUTURE
+VFMSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 aa /r] FMA,FUTURE
+VFMSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 aa /r] FMA,FUTURE
+VFMSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 aa /r] FMA,FUTURE
+VFMSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 aa /r] FMA,FUTURE
+VFMSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ba /r] FMA,FUTURE
+VFMSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ba /r] FMA,FUTURE
+VFMSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ba /r] FMA,FUTURE
+VFMSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ba /r] FMA,FUTURE
+VFMSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ba /r] FMA,FUTURE
+VFMSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ba /r] FMA,FUTURE
+VFMSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ba /r] FMA,FUTURE
+VFMSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ba /r] FMA,FUTURE
+VFMSUBADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 97 /r] FMA,FUTURE
+VFMSUBADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 97 /r] FMA,FUTURE
+VFMSUBADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 97 /r] FMA,FUTURE
+VFMSUBADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 97 /r] FMA,FUTURE
+VFMSUBADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 97 /r] FMA,FUTURE
+VFMSUBADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 97 /r] FMA,FUTURE
+VFMSUBADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 97 /r] FMA,FUTURE
+VFMSUBADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 97 /r] FMA,FUTURE
+VFMSUBADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a7 /r] FMA,FUTURE
+VFMSUBADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a7 /r] FMA,FUTURE
+VFMSUBADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a7 /r] FMA,FUTURE
+VFMSUBADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a7 /r] FMA,FUTURE
+VFMSUBADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 a7 /r] FMA,FUTURE
+VFMSUBADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 a7 /r] FMA,FUTURE
+VFMSUBADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 a7 /r] FMA,FUTURE
+VFMSUBADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 a7 /r] FMA,FUTURE
+VFMSUBADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b7 /r] FMA,FUTURE
+VFMSUBADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b7 /r] FMA,FUTURE
+VFMSUBADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b7 /r] FMA,FUTURE
+VFMSUBADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b7 /r] FMA,FUTURE
+VFMSUBADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 b7 /r] FMA,FUTURE
+VFMSUBADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 b7 /r] FMA,FUTURE
+VFMSUBADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 b7 /r] FMA,FUTURE
+VFMSUBADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 b7 /r] FMA,FUTURE
+VFNMADD132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9c /r] FMA,FUTURE
+VFNMADD132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9c /r] FMA,FUTURE
+VFNMADD132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9c /r] FMA,FUTURE
+VFNMADD132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9c /r] FMA,FUTURE
+VFNMADD312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9c /r] FMA,FUTURE
+VFNMADD312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9c /r] FMA,FUTURE
+VFNMADD312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9c /r] FMA,FUTURE
+VFNMADD312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9c /r] FMA,FUTURE
+VFNMADD213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ac /r] FMA,FUTURE
+VFNMADD213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ac /r] FMA,FUTURE
+VFNMADD213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ac /r] FMA,FUTURE
+VFNMADD213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ac /r] FMA,FUTURE
+VFNMADD123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ac /r] FMA,FUTURE
+VFNMADD123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ac /r] FMA,FUTURE
+VFNMADD123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ac /r] FMA,FUTURE
+VFNMADD123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ac /r] FMA,FUTURE
+VFNMADD231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 bc /r] FMA,FUTURE
+VFNMADD231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 bc /r] FMA,FUTURE
+VFNMADD231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 bc /r] FMA,FUTURE
+VFNMADD231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 bc /r] FMA,FUTURE
+VFNMADD321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 bc /r] FMA,FUTURE
+VFNMADD321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 bc /r] FMA,FUTURE
+VFNMADD321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 bc /r] FMA,FUTURE
+VFNMADD321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 bc /r] FMA,FUTURE
+VFNMSUB132PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9e /r] FMA,FUTURE
+VFNMSUB132PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9e /r] FMA,FUTURE
+VFNMSUB132PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9e /r] FMA,FUTURE
+VFNMSUB132PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9e /r] FMA,FUTURE
+VFNMSUB312PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 9e /r] FMA,FUTURE
+VFNMSUB312PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 9e /r] FMA,FUTURE
+VFNMSUB312PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 9e /r] FMA,FUTURE
+VFNMSUB312PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 9e /r] FMA,FUTURE
+VFNMSUB213PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ae /r] FMA,FUTURE
+VFNMSUB213PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ae /r] FMA,FUTURE
+VFNMSUB213PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ae /r] FMA,FUTURE
+VFNMSUB213PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ae /r] FMA,FUTURE
+VFNMSUB123PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 ae /r] FMA,FUTURE
+VFNMSUB123PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 ae /r] FMA,FUTURE
+VFNMSUB123PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 ae /r] FMA,FUTURE
+VFNMSUB123PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 ae /r] FMA,FUTURE
+VFNMSUB231PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 be /r] FMA,FUTURE
+VFNMSUB231PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 be /r] FMA,FUTURE
+VFNMSUB231PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 be /r] FMA,FUTURE
+VFNMSUB231PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 be /r] FMA,FUTURE
+VFNMSUB321PS xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w0 be /r] FMA,FUTURE
+VFNMSUB321PS ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w0 be /r] FMA,FUTURE
+VFNMSUB321PD xmmreg,xmmreg,xmmrm128 [rvm: vex.dds.128.66.0f38.w1 be /r] FMA,FUTURE
+VFNMSUB321PD ymmreg,ymmreg,ymmrm256 [rvm: vex.dds.256.66.0f38.w1 be /r] FMA,FUTURE
+VFMADD132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 99 /r] FMA,FUTURE
+VFMADD132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 99 /r] FMA,FUTURE
+VFMADD312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 99 /r] FMA,FUTURE
+VFMADD312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 99 /r] FMA,FUTURE
+VFMADD213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 a9 /r] FMA,FUTURE
+VFMADD213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 a9 /r] FMA,FUTURE
+VFMADD123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 a9 /r] FMA,FUTURE
+VFMADD123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 a9 /r] FMA,FUTURE
+VFMADD231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 b9 /r] FMA,FUTURE
+VFMADD231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 b9 /r] FMA,FUTURE
+VFMADD321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 b9 /r] FMA,FUTURE
+VFMADD321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 b9 /r] FMA,FUTURE
+VFMSUB132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9b /r] FMA,FUTURE
+VFMSUB132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9b /r] FMA,FUTURE
+VFMSUB312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9b /r] FMA,FUTURE
+VFMSUB312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9b /r] FMA,FUTURE
+VFMSUB213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ab /r] FMA,FUTURE
+VFMSUB213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ab /r] FMA,FUTURE
+VFMSUB123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ab /r] FMA,FUTURE
+VFMSUB123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ab /r] FMA,FUTURE
+VFMSUB231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bb /r] FMA,FUTURE
+VFMSUB231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bb /r] FMA,FUTURE
+VFMSUB321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bb /r] FMA,FUTURE
+VFMSUB321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bb /r] FMA,FUTURE
+VFNMADD132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9d /r] FMA,FUTURE
+VFNMADD132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9d /r] FMA,FUTURE
+VFNMADD312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9d /r] FMA,FUTURE
+VFNMADD312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9d /r] FMA,FUTURE
+VFNMADD213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ad /r] FMA,FUTURE
+VFNMADD213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ad /r] FMA,FUTURE
+VFNMADD123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 ad /r] FMA,FUTURE
+VFNMADD123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 ad /r] FMA,FUTURE
+VFNMADD231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bd /r] FMA,FUTURE
+VFNMADD231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bd /r] FMA,FUTURE
+VFNMADD321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bd /r] FMA,FUTURE
+VFNMADD321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bd /r] FMA,FUTURE
+VFNMSUB132SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9f /r] FMA,FUTURE
+VFNMSUB132SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9f /r] FMA,FUTURE
+VFNMSUB312SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 9f /r] FMA,FUTURE
+VFNMSUB312SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 9f /r] FMA,FUTURE
+VFNMSUB213SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 af /r] FMA,FUTURE
+VFNMSUB213SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 af /r] FMA,FUTURE
+VFNMSUB123SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 af /r] FMA,FUTURE
+VFNMSUB123SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 af /r] FMA,FUTURE
+VFNMSUB231SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bf /r] FMA,FUTURE
+VFNMSUB231SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bf /r] FMA,FUTURE
+VFNMSUB321SS xmmreg,xmmreg,xmmrm32 [rvm: vex.dds.128.66.0f38.w0 bf /r] FMA,FUTURE
+VFNMSUB321SD xmmreg,xmmreg,xmmrm64 [rvm: vex.dds.128.66.0f38.w1 bf /r] FMA,FUTURE
+
+;# Intel post-32 nm processor instructions
+;
+; Per AVX spec revision 7, document 319433-007
+RDFSBASE reg32 [m: norexw f3 0f ae /0] LONG,FUTURE
+RDFSBASE reg64 [m: o64 f3 0f ae /0] LONG,FUTURE
+RDGSBASE reg32 [m: norexw f3 0f ae /1] LONG,FUTURE
+RDGSBASE reg64 [m: o64 f3 0f ae /1] LONG,FUTURE
+RDRAND reg16 [m: o16 0f c7 /6] FUTURE
+RDRAND reg32 [m: o32 0f c7 /6] FUTURE
+RDRAND reg64 [m: o64 0f c7 /6] LONG,FUTURE
+WRFSBASE reg32 [m: norexw f3 0f ae /2] LONG,FUTURE
+WRFSBASE reg64 [m: o64 f3 0f ae /2] LONG,FUTURE
+WRGSBASE reg32 [m: norexw f3 0f ae /3] LONG,FUTURE
+WRGSBASE reg64 [m: o64 f3 0f ae /3] LONG,FUTURE
+VCVTPH2PS ymmreg,xmmrm128 [rm: vex.256.66.0f38.w0 13 /r] AVX,FUTURE
+VCVTPH2PS xmmreg,xmmrm64 [rm: vex.128.66.0f38.w0 13 /r] AVX,FUTURE
+VCVTPS2PH xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 1d /r ib] AVX,FUTURE
+VCVTPS2PH xmmrm64,xmmreg,imm8 [mri: vex.128.66.0f3a.w0 1d /r ib] AVX,FUTURE
+
+; Per AVX spec revision 13, document 319433-013
+ADCX reg32,rm32 [rm: norexw 66 0f 38 f6 /r] FUTURE
+ADCX reg64,rm64 [rm: o64 66 0f 38 f6 /r] LONG,FUTURE
+ADOX reg32,rm32 [rm: norexw f3 0f 38 f6 /r] FUTURE
+ADOX reg64,rm64 [rm: o64 f3 0f 38 f6 /r] LONG,FUTURE
+RDSEED reg16 [m: o16 0f c7 /7] FUTURE
+RDSEED reg32 [m: o32 0f c7 /7] FUTURE
+RDSEED reg64 [m: o64 0f c7 /7] LONG,FUTURE
+
+; Per AVX spec revision 14, document 319433-014
+CLAC void [ 0f 01 ca] PRIV,FUTURE
+STAC void [ 0f 01 cb] PRIV,FUTURE
+
+;# VIA (Centaur) security instructions
+XSTORE void [ 0f a7 c0] PENT,CYRIX
+XCRYPTECB void [ mustrep 0f a7 c8] PENT,CYRIX
+XCRYPTCBC void [ mustrep 0f a7 d0] PENT,CYRIX
+XCRYPTCTR void [ mustrep 0f a7 d8] PENT,CYRIX
+XCRYPTCFB void [ mustrep 0f a7 e0] PENT,CYRIX
+XCRYPTOFB void [ mustrep 0f a7 e8] PENT,CYRIX
+MONTMUL void [ mustrep 0f a6 c0] PENT,CYRIX
+XSHA1 void [ mustrep 0f a6 c8] PENT,CYRIX
+XSHA256 void [ mustrep 0f a6 d0] PENT,CYRIX
+
+;# AMD Lightweight Profiling (LWP) instructions
+;
+; based on pub number 43724 revision 3.04 date August 2009
+;
+; updated to match draft from AMD developer (patch has been
+; sent to binutils
+; 2010-03-22 Quentin Neill <quentin.neill@amd.com>
+; Sebastian Pop <sebastian.pop@amd.com>
+;
+LLWPCB reg32 [m: xop.m9.w0.l0.p0 12 /0] AMD,386
+LLWPCB reg64 [m: xop.m9.w1.l0.p0 12 /0] AMD,X64
+
+SLWPCB reg32 [m: xop.m9.w0.l0.p0 12 /1] AMD,386
+SLWPCB reg64 [m: xop.m9.w1.l0.p0 12 /1] AMD,X64
+
+LWPVAL reg32,rm32,imm32 [vmi: xop.m10.w0.ndd.l0.p0 12 /1 id] AMD,386
+LWPVAL reg64,rm32,imm32 [vmi: xop.m10.w1.ndd.l0.p0 12 /1 id] AMD,X64
+
+LWPINS reg32,rm32,imm32 [vmi: xop.m10.w0.ndd.l0.p0 12 /0 id] AMD,386
+LWPINS reg64,rm32,imm32 [vmi: xop.m10.w1.ndd.l0.p0 12 /0 id] AMD,X64
+
+;# AMD XOP and FMA4 instructions (SSE5)
+;
+; based on pub number 43479 revision 3.04 dated November 2009
+;
+VFMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 69 /r /is4] AMD,SSE5
+VFMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 69 /r /is4] AMD,SSE5
+VFMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 69 /r /is4] AMD,SSE5
+VFMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 69 /r /is4] AMD,SSE5
+
+VFMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 68 /r /is4] AMD,SSE5
+VFMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 68 /r /is4] AMD,SSE5
+VFMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 68 /r /is4] AMD,SSE5
+VFMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 68 /r /is4] AMD,SSE5
+
+VFMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6b /r /is4] AMD,SSE5
+VFMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 6b /r /is4] AMD,SSE5
+
+VFMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6a /r /is4] AMD,SSE5
+VFMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 6a /r /is4] AMD,SSE5
+
+VFMADDSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5d /r /is4] AMD,SSE5
+VFMADDSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5d /r /is4] AMD,SSE5
+VFMADDSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5d /r /is4] AMD,SSE5
+VFMADDSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5d /r /is4] AMD,SSE5
+
+VFMADDSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5c /r /is4] AMD,SSE5
+VFMADDSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5c /r /is4] AMD,SSE5
+VFMADDSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5c /r /is4] AMD,SSE5
+VFMADDSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5c /r /is4] AMD,SSE5
+
+VFMSUBADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5f /r /is4] AMD,SSE5
+VFMSUBADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5f /r /is4] AMD,SSE5
+VFMSUBADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5f /r /is4] AMD,SSE5
+VFMSUBADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5f /r /is4] AMD,SSE5
+
+VFMSUBADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 5e /r /is4] AMD,SSE5
+VFMSUBADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 5e /r /is4] AMD,SSE5
+VFMSUBADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 5e /r /is4] AMD,SSE5
+VFMSUBADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 5e /r /is4] AMD,SSE5
+
+VFMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6d /r /is4] AMD,SSE5
+VFMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 6d /r /is4] AMD,SSE5
+VFMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 6d /r /is4] AMD,SSE5
+VFMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 6d /r /is4] AMD,SSE5
+
+VFMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6c /r /is4] AMD,SSE5
+VFMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 6c /r /is4] AMD,SSE5
+VFMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 6c /r /is4] AMD,SSE5
+VFMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 6c /r /is4] AMD,SSE5
+
+VFMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6f /r /is4] AMD,SSE5
+VFMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 6f /r /is4] AMD,SSE5
+
+VFMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 6e /r /is4] AMD,SSE5
+VFMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 6e /r /is4] AMD,SSE5
+
+VFNMADDPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 79 /r /is4] AMD,SSE5
+VFNMADDPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 79 /r /is4] AMD,SSE5
+VFNMADDPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 79 /r /is4] AMD,SSE5
+VFNMADDPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 79 /r /is4] AMD,SSE5
+
+VFNMADDPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 78 /r /is4] AMD,SSE5
+VFNMADDPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 78 /r /is4] AMD,SSE5
+VFNMADDPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 78 /r /is4] AMD,SSE5
+VFNMADDPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 78 /r /is4] AMD,SSE5
+
+VFNMADDSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7b /r /is4] AMD,SSE5
+VFNMADDSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 7b /r /is4] AMD,SSE5
+
+VFNMADDSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7a /r /is4] AMD,SSE5
+VFNMADDSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 7a /r /is4] AMD,SSE5
+
+VFNMSUBPD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7d /r /is4] AMD,SSE5
+VFNMSUBPD ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 7d /r /is4] AMD,SSE5
+VFNMSUBPD xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 7d /r /is4] AMD,SSE5
+VFNMSUBPD ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 7d /r /is4] AMD,SSE5
+
+VFNMSUBPS xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7c /r /is4] AMD,SSE5
+VFNMSUBPS ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.m3.w0.nds.l1.p1 7c /r /is4] AMD,SSE5
+VFNMSUBPS xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: vex.m3.w1.nds.l0.p1 7c /r /is4] AMD,SSE5
+VFNMSUBPS ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: vex.m3.w1.nds.l1.p1 7c /r /is4] AMD,SSE5
+
+VFNMSUBSD xmmreg,xmmreg*,xmmrm64,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7f /r /is4] AMD,SSE5
+VFNMSUBSD xmmreg,xmmreg*,xmmreg,xmmrm64 [rvsm: vex.m3.w1.nds.l0.p1 7f /r /is4] AMD,SSE5
+
+VFNMSUBSS xmmreg,xmmreg*,xmmrm32,xmmreg [rvms: vex.m3.w0.nds.l0.p1 7e /r /is4] AMD,SSE5
+VFNMSUBSS xmmreg,xmmreg*,xmmreg,xmmrm32 [rvsm: vex.m3.w1.nds.l0.p1 7e /r /is4] AMD,SSE5
+
+VFRCZPD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 81 /r] AMD,SSE5
+VFRCZPD ymmreg,ymmrm256* [rm: xop.m9.w0.l1.p0 81 /r] AMD,SSE5
+
+VFRCZPS xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 80 /r] AMD,SSE5
+VFRCZPS ymmreg,ymmrm256* [rm: xop.m9.w0.l1.p0 80 /r] AMD,SSE5
+
+VFRCZSD xmmreg,xmmrm64* [rm: xop.m9.w0.l0.p0 83 /r] AMD,SSE5
+
+VFRCZSS xmmreg,xmmrm32* [rm: xop.m9.w0.l0.p0 82 /r] AMD,SSE5
+;
+; fixed: spec mention imm[7:4] though it should be /is4 even in spec
+VPCMOV xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a2 /r /is4] AMD,SSE5
+VPCMOV ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: xop.m8.w0.nds.l1.p0 a2 /r /is4] AMD,SSE5
+VPCMOV xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: xop.m8.w1.nds.l0.p0 a2 /r /is4] AMD,SSE5
+VPCMOV ymmreg,ymmreg*,ymmreg,ymmrm256 [rvsm: xop.m8.w1.nds.l1.p0 a2 /r /is4] AMD,SSE5
+
+VPCOMB xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cc /r ib] AMD,SSE5
+VPCOMD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ce /r ib] AMD,SSE5
+VPCOMQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cf /r ib] AMD,SSE5
+;
+; fixed: spec mention only 3 operands in mnemonics
+VPCOMUB xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ec /r ib] AMD,SSE5
+VPCOMUD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ee /r ib] AMD,SSE5
+VPCOMUQ xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ef /r ib] AMD,SSE5
+;
+; fixed: spec point wrong VPCOMB in mnemonic
+VPCOMUW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 ed /r ib] AMD,SSE5
+VPCOMW xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: xop.m8.w0.nds.l0.p0 cd /r ib] AMD,SSE5
+
+VPHADDBD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c2 /r] AMD,SSE5
+VPHADDBQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c3 /r] AMD,SSE5
+VPHADDBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c1 /r] AMD,SSE5
+VPHADDDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 cb /r] AMD,SSE5
+;
+; fixed: spec has ymmreg for l0
+VPHADDUBD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d2 /r] AMD,SSE5
+VPHADDUBQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d3 /r] AMD,SSE5
+;
+; fixed: spec has VPHADDUBWD
+VPHADDUBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d1 /r] AMD,SSE5
+;
+; fixed: opcode db
+VPHADDUDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 db /r] AMD,SSE5
+VPHADDUWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d6 /r] AMD,SSE5
+VPHADDUWQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 d7 /r] AMD,SSE5
+;
+; fixed: spec has ymmreg for l0
+VPHADDWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c6 /r] AMD,SSE5
+;
+; fixed: spec has d7 opcode
+VPHADDWQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 c7 /r] AMD,SSE5
+
+VPHSUBBW xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e1 /r] AMD,SSE5
+VPHSUBDQ xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e3 /r] AMD,SSE5
+VPHSUBWD xmmreg,xmmrm128* [rm: xop.m9.w0.l0.p0 e2 /r] AMD,SSE5
+
+VPMACSDD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 9e /r /is4] AMD,SSE5
+;
+; fixed: spec has 97,9f opcodes here
+VPMACSDQH xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 9f /r /is4] AMD,SSE5
+VPMACSDQL xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 97 /r /is4] AMD,SSE5
+VPMACSSDD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 8e /r /is4] AMD,SSE5
+VPMACSSDQH xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 8f /r /is4] AMD,SSE5
+VPMACSSDQL xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 87 /r /is4] AMD,SSE5
+VPMACSSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 86 /r /is4] AMD,SSE5
+VPMACSSWW xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 85 /r /is4] AMD,SSE5
+VPMACSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 96 /r /is4] AMD,SSE5
+VPMACSWW xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 95 /r /is4] AMD,SSE5
+VPMADCSSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a6 /r /is4] AMD,SSE5
+VPMADCSWD xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 b6 /r /is4] AMD,SSE5
+
+VPPERM xmmreg,xmmreg*,xmmreg,xmmrm128 [rvsm: xop.m8.w1.nds.l0.p0 a3 /r /is4] AMD,SSE5
+VPPERM xmmreg,xmmreg*,xmmrm128,xmmreg [rvms: xop.m8.w0.nds.l0.p0 a3 /r /is4] AMD,SSE5
+
+VPROTB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 90 /r] AMD,SSE5
+VPROTB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 90 /r] AMD,SSE5
+;
+; fixed: spec point xmmreg instead of reg/mem
+VPROTB xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c0 /r ib] AMD,SSE5
+
+VPROTD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 92 /r] AMD,SSE5
+VPROTD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 92 /r] AMD,SSE5
+;
+; fixed: spec error /r is needed
+VPROTD xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c2 /r ib] AMD,SSE5
+VPROTQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 93 /r] AMD,SSE5
+VPROTQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 93 /r] AMD,SSE5
+;
+; fixed: spec error /r is needed
+VPROTQ xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c3 /r ib] AMD,SSE5
+VPROTW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 91 /r] AMD,SSE5
+VPROTW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 91 /r] AMD,SSE5
+VPROTW xmmreg,xmmrm128*,imm8 [rmi: xop.m8.w0.l0.p0 c1 /r ib] AMD,SSE5
+
+VPSHAB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 98 /r] AMD,SSE5
+VPSHAB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 98 /r] AMD,SSE5
+
+VPSHAD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 9a /r] AMD,SSE5
+VPSHAD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 9a /r] AMD,SSE5
+
+VPSHAQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 9b /r] AMD,SSE5
+VPSHAQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 9b /r] AMD,SSE5
+
+VPSHAW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 99 /r] AMD,SSE5
+VPSHAW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 99 /r] AMD,SSE5
+
+VPSHLB xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 94 /r] AMD,SSE5
+VPSHLB xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 94 /r] AMD,SSE5
+
+;
+; fixed: spec has ymmreg for l0
+VPSHLD xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 96 /r] AMD,SSE5
+VPSHLD xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 96 /r] AMD,SSE5
+
+VPSHLQ xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 97 /r] AMD,SSE5
+VPSHLQ xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 97 /r] AMD,SSE5
+
+VPSHLW xmmreg,xmmrm128*,xmmreg [rmv: xop.m9.w0.nds.l0.p0 95 /r] AMD,SSE5
+VPSHLW xmmreg,xmmreg*,xmmrm128 [rvm: xop.m9.w1.nds.l0.p0 95 /r] AMD,SSE5
+
+;# Intel AVX2 instructions
+;
+; based on pub number 319433-011 dated July 2011
+;
+VMPSADBW ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 42 /r ib] FUTURE,AVX2
+VPABSB ymmreg,ymmrm256 [rm: vex.256.66.0f38 1c /r] FUTURE,AVX2
+VPABSW ymmreg,ymmrm256 [rm: vex.256.66.0f38 1d /r] FUTURE,AVX2
+VPABSD ymmreg,ymmrm256 [rm: vex.256.66.0f38 1e /r] FUTURE,AVX2
+VPACKSSWB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 63 /r] FUTURE,AVX2
+VPACKSSDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6b /r] FUTURE,AVX2
+VPACKUSDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 2b /r] FUTURE,AVX2
+VPACKUSWB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 67 /r] FUTURE,AVX2
+VPADDB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fc /r] FUTURE,AVX2
+VPADDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fd /r] FUTURE,AVX2
+VPADDD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fe /r] FUTURE,AVX2
+VPADDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d4 /r] FUTURE,AVX2
+VPADDSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ec /r] FUTURE,AVX2
+VPADDSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ed /r] FUTURE,AVX2
+VPADDUSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f dc /r] FUTURE,AVX2
+VPADDUSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f dd /r] FUTURE,AVX2
+VPALIGNR ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0f /r ib] FUTURE,AVX2
+VPAND ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f db /r] FUTURE,AVX2
+VPANDN ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f df /r] FUTURE,AVX2
+VPAVGB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e0 /r] FUTURE,AVX2
+VPAVGW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e3 /r] FUTURE,AVX2
+VPBLENDVB ymmreg,ymmreg*,ymmrm256,ymmreg [rvms: vex.nds.256.66.0f3a 4c /r /is4] FUTURE,AVX2
+VPBLENDW ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a 0e /r ib] FUTURE,AVX2
+VPCMPEQB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 74 /r] FUTURE,AVX2
+VPCMPEQW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 75 /r] FUTURE,AVX2
+VPCMPEQD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 76 /r] FUTURE,AVX2
+VPCMPEQQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 29 /r] FUTURE,AVX2
+VPCMPGTB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 64 /r] FUTURE,AVX2
+VPCMPGTW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 65 /r] FUTURE,AVX2
+VPCMPGTD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 66 /r] FUTURE,AVX2
+VPCMPGTQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 37 /r] FUTURE,AVX2
+VPHADDW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 01 /r] FUTURE,AVX2
+VPHADDD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 02 /r] FUTURE,AVX2
+VPHADDSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 03 /r] FUTURE,AVX2
+VPHSUBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 05 /r] FUTURE,AVX2
+VPHSUBD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 06 /r] FUTURE,AVX2
+VPHSUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 07 /r] FUTURE,AVX2
+VPMADDUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 04 /r] FUTURE,AVX2
+VPMADDWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f5 /r] FUTURE,AVX2
+VPMAXSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3c /r] FUTURE,AVX2
+VPMAXSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ee /r] FUTURE,AVX2
+VPMAXSD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3d /r] FUTURE,AVX2
+VPMAXUB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f de /r] FUTURE,AVX2
+VPMAXUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3e /r] FUTURE,AVX2
+VPMAXUD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3f /r] FUTURE,AVX2
+VPMINSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 38 /r] FUTURE,AVX2
+VPMINSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ea /r] FUTURE,AVX2
+VPMINSD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 39 /r] FUTURE,AVX2
+VPMINUB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f da /r] FUTURE,AVX2
+VPMINUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3a /r] FUTURE,AVX2
+VPMINUD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 3b /r] FUTURE,AVX2
+VPMOVMSKB reg32,ymmreg [rm: vex.256.66.0f d7 /r] FUTURE,AVX2
+VPMOVMSKB reg64,ymmreg [rm: vex.256.66.0f d7 /r] FUTURE,AVX2
+VPMOVSXBW ymmreg,xmmrm128 [rm: vex.256.66.0f38 20 /r] FUTURE,AVX2
+VPMOVSXBD ymmreg,mem64 [rm: vex.256.66.0f38 21 /r] FUTURE,AVX2
+VPMOVSXBD ymmreg,xmmreg [rm: vex.256.66.0f38 21 /r] FUTURE,AVX2
+VPMOVSXBQ ymmreg,mem32 [rm: vex.256.66.0f38 22 /r] FUTURE,AVX2
+VPMOVSXBQ ymmreg,xmmreg [rm: vex.256.66.0f38 22 /r] FUTURE,AVX2
+VPMOVSXWD ymmreg,xmmrm128 [rm: vex.256.66.0f38 23 /r] FUTURE,AVX2
+VPMOVSXWQ ymmreg,mem64 [rm: vex.256.66.0f38 24 /r] FUTURE,AVX2
+VPMOVSXWQ ymmreg,xmmreg [rm: vex.256.66.0f38 24 /r] FUTURE,AVX2
+VPMOVSXDQ ymmreg,xmmrm128 [rm: vex.256.66.0f38 25 /r] FUTURE,AVX2
+VPMOVZXBW ymmreg,xmmrm128 [rm: vex.256.66.0f38 30 /r] FUTURE,AVX2
+VPMOVZXBD ymmreg,mem64 [rm: vex.256.66.0f38 31 /r] FUTURE,AVX2
+VPMOVZXBD ymmreg,xmmreg [rm: vex.256.66.0f38 31 /r] FUTURE,AVX2
+VPMOVZXBQ ymmreg,mem32 [rm: vex.256.66.0f38 32 /r] FUTURE,AVX2
+VPMOVZXBQ ymmreg,xmmreg [rm: vex.256.66.0f38 32 /r] FUTURE,AVX2
+VPMOVZXWD ymmreg,xmmrm128 [rm: vex.256.66.0f38 33 /r] FUTURE,AVX2
+VPMOVZXWQ ymmreg,mem64 [rm: vex.256.66.0f38 34 /r] FUTURE,AVX2
+VPMOVZXWQ ymmreg,xmmreg [rm: vex.256.66.0f38 34 /r] FUTURE,AVX2
+VPMOVZXDQ ymmreg,xmmrm128 [rm: vex.256.66.0f38 35 /r] FUTURE,AVX2
+VPMULDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 28 /r] FUTURE,AVX2
+VPMULHRSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 0b /r] FUTURE,AVX2
+VPMULHUW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e4 /r] FUTURE,AVX2
+VPMULHW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e5 /r] FUTURE,AVX2
+VPMULLW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d5 /r] FUTURE,AVX2
+VPMULLD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 40 /r] FUTURE,AVX2
+VPMULUDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f4 /r] FUTURE,AVX2
+VPOR ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f eb /r] FUTURE,AVX2
+VPSADBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f6 /r] FUTURE,AVX2
+VPSHUFB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 00 /r] FUTURE,AVX2
+VPSHUFD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f 70 /r ib] FUTURE,AVX2
+VPSHUFHW ymmreg,ymmrm256,imm8 [rmi: vex.256.f3.0f 70 /r ib] FUTURE,AVX2
+VPSHUFLW ymmreg,ymmrm256,imm8 [rmi: vex.256.f2.0f 70 /r ib] FUTURE,AVX2
+VPSIGNB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 08 /r] FUTURE,AVX2
+VPSIGNW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 09 /r] FUTURE,AVX2
+VPSIGND ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38 0a /r] FUTURE,AVX2
+VPSLLDQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /7 ib] FUTURE,AVX2
+VPSLLW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f1 /r] FUTURE,AVX2
+VPSLLW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /6 ib] FUTURE,AVX2
+VPSLLD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f2 /r] FUTURE,AVX2
+VPSLLD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /6 ib] FUTURE,AVX2
+VPSLLQ ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f f3 /r] FUTURE,AVX2
+VPSLLQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /6 ib] FUTURE,AVX2
+VPSRAW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f e1 /r] FUTURE,AVX2
+VPSRAW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /4 ib] FUTURE,AVX2
+VPSRAD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f e2 /r] FUTURE,AVX2
+VPSRAD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /4 ib] FUTURE,AVX2
+VPSRLDQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 73 /3 ib] FUTURE,AVX2
+VPSRLW ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d1 /r] FUTURE,AVX2
+VPSRLW ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 71 /2 ib] FUTURE,AVX2
+VPSRLD ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d2 /r] FUTURE,AVX2
+VPSRLD ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f 72 /2 ib] FUTURE,AVX2
+VPSRLQ ymmreg,ymmreg*,xmmrm128 [rvm: vex.nds.256.66.0f d3 /r] FUTURE,AVX2
+VPSRLQ ymmreg,ymmreg*,imm8 [vmi: vex.ndd.256.66.0f.wig 73 /2 ib] FUTURE,AVX2
+VPSUBB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f8 /r] FUTURE,AVX2
+VPSUBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f f9 /r] FUTURE,AVX2
+VPSUBD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fa /r] FUTURE,AVX2
+VPSUBQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f fb /r] FUTURE,AVX2
+VPSUBSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e8 /r] FUTURE,AVX2
+VPSUBSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f e9 /r] FUTURE,AVX2
+VPSUBUSB ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d8 /r] FUTURE,AVX2
+VPSUBUSW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f d9 /r] FUTURE,AVX2
+VPUNPCKHBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 68 /r] FUTURE,AVX2
+VPUNPCKHWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 69 /r] FUTURE,AVX2
+VPUNPCKHDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6a /r] FUTURE,AVX2
+VPUNPCKHQDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6d /r] FUTURE,AVX2
+VPUNPCKLBW ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 60 /r] FUTURE,AVX2
+VPUNPCKLWD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 61 /r] FUTURE,AVX2
+VPUNPCKLDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 62 /r] FUTURE,AVX2
+VPUNPCKLQDQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f 6c /r] FUTURE,AVX2
+VPXOR ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f ef /r] FUTURE,AVX2
+VMOVNTDQA ymmreg,mem256 [rm: vex.256.66.0f38 2a /r] FUTURE,AVX2
+VBROADCASTSS xmmreg,xmmreg [rm: vex.128.66.0f38.w0 18 /r] FUTURE,AVX2
+VBROADCASTSS ymmreg,xmmreg [rm: vex.256.66.0f38.w0 18 /r] FUTURE,AVX2
+VBROADCASTSD ymmreg,xmmreg [rm: vex.256.66.0f38.w0 19 /r] FUTURE,AVX2
+VBROADCASTI128 ymmreg,mem128 [rm: vex.256.66.0f38.w0 5a /r] FUTURE,AVX2
+VPBLENDD xmmreg,xmmreg*,xmmrm128,imm8 [rvmi: vex.nds.128.66.0f3a.w0 02 /r ib] FUTURE,AVX2
+VPBLENDD ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 02 /r ib] FUTURE,AVX2
+VPBROADCASTB xmmreg,mem8 [rm: vex.128.66.0f38.w0 78 /r] FUTURE,AVX2
+VPBROADCASTB xmmreg,xmmreg [rm: vex.128.66.0f38.w0 78 /r] FUTURE,AVX2
+VPBROADCASTB ymmreg,mem8 [rm: vex.256.66.0f38.w0 78 /r] FUTURE,AVX2
+VPBROADCASTB ymmreg,xmmreg [rm: vex.256.66.0f38.w0 78 /r] FUTURE,AVX2
+VPBROADCASTW xmmreg,mem16 [rm: vex.128.66.0f38.w0 79 /r] FUTURE,AVX2
+VPBROADCASTW xmmreg,xmmreg [rm: vex.128.66.0f38.w0 79 /r] FUTURE,AVX2
+VPBROADCASTW ymmreg,mem16 [rm: vex.256.66.0f38.w0 79 /r] FUTURE,AVX2
+VPBROADCASTW ymmreg,xmmreg [rm: vex.256.66.0f38.w0 79 /r] FUTURE,AVX2
+VPBROADCASTD xmmreg,mem32 [rm: vex.128.66.0f38.w0 58 /r] FUTURE,AVX2
+VPBROADCASTD xmmreg,xmmreg [rm: vex.128.66.0f38.w0 58 /r] FUTURE,AVX2
+VPBROADCASTD ymmreg,mem32 [rm: vex.256.66.0f38.w0 58 /r] FUTURE,AVX2
+VPBROADCASTD ymmreg,xmmreg [rm: vex.256.66.0f38.w0 58 /r] FUTURE,AVX2
+VPBROADCASTQ xmmreg,mem64 [rm: vex.128.66.0f38.w0 59 /r] FUTURE,AVX2
+VPBROADCASTQ xmmreg,xmmreg [rm: vex.128.66.0f38.w0 59 /r] FUTURE,AVX2
+VPBROADCASTQ ymmreg,mem64 [rm: vex.256.66.0f38.w0 59 /r] FUTURE,AVX2
+VPBROADCASTQ ymmreg,xmmreg [rm: vex.256.66.0f38.w0 59 /r] FUTURE,AVX2
+
+VPERMD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 36 /r] FUTURE,AVX2
+VPERMPD ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w1 01 /r ib] FUTURE,AVX2
+VPERMPS ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 16 /r] FUTURE,AVX2
+VPERMQ ymmreg,ymmrm256,imm8 [rmi: vex.256.66.0f3a.w1 00 /r ib] FUTURE,AVX2
+VPERM2I128 ymmreg,ymmreg*,ymmrm256,imm8 [rvmi: vex.nds.256.66.0f3a.w0 46 /r ib] FUTURE,AVX2
+VEXTRACTI128 xmmrm128,ymmreg,imm8 [mri: vex.256.66.0f3a.w0 39 /r ib] FUTURE,AVX2
+
+VINSERTI128 ymmreg,ymmreg*,xmmrm128,imm8 [rvmi: vex.nds.256.66.0f3a.w0 38 /r ib] FUTURE,AVX2
+VPMASKMOVD xmmreg,xmmreg*,mem128 [rvm: vex.nds.128.66.0f38.w0 8c /r] FUTURE,AVX2
+VPMASKMOVD ymmreg,ymmreg*,mem256 [rvm: vex.nds.256.66.0f38.w0 8c /r] FUTURE,AVX2
+VPMASKMOVQ xmmreg,xmmreg*,mem128 [rvm: vex.nds.128.66.0f38.w1 8c /r] FUTURE,AVX2
+VPMASKMOVQ ymmreg,ymmreg*,mem256 [rvm: vex.nds.256.66.0f38.w1 8c /r] FUTURE,AVX2
+
+VPMASKMOVD mem128,xmmreg*,xmmreg [mvr: vex.nds.128.66.0f38.w0 8e /r] FUTURE,AVX2
+VPMASKMOVD mem256,ymmreg*,ymmreg [mvr: vex.nds.256.66.0f38.w0 8e /r] FUTURE,AVX2
+VPMASKMOVQ mem128,xmmreg*,xmmreg [mvr: vex.nds.128.66.0f38.w1 8e /r] FUTURE,AVX2
+VPMASKMOVQ mem256,ymmreg*,ymmreg [mvr: vex.nds.256.66.0f38.w1 8e /r] FUTURE,AVX2
+
+VPSLLVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 47 /r] FUTURE,AVX2
+VPSLLVQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w1 47 /r] FUTURE,AVX2
+VPSLLVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 47 /r] FUTURE,AVX2
+VPSLLVQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w1 47 /r] FUTURE,AVX2
+
+VPSRAVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 46 /r] FUTURE,AVX2
+VPSRAVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 46 /r] FUTURE,AVX2
+
+VPSRLVD xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w0 45 /r] FUTURE,AVX2
+VPSRLVQ xmmreg,xmmreg*,xmmrm128 [rvm: vex.nds.128.66.0f38.w1 45 /r] FUTURE,AVX2
+VPSRLVD ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w0 45 /r] FUTURE,AVX2
+VPSRLVQ ymmreg,ymmreg*,ymmrm256 [rvm: vex.nds.256.66.0f38.w1 45 /r] FUTURE,AVX2
+
+VGATHERDPD xmmreg,xmem64,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w1 92 /r] FUTURE,AVX2
+VGATHERQPD xmmreg,xmem64,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w1 93 /r] FUTURE,AVX2
+VGATHERDPD ymmreg,xmem64,ymmreg [rmv: vm32x vex.dds.256.66.0f38.w1 92 /r] FUTURE,AVX2
+VGATHERQPD ymmreg,ymem64,ymmreg [rmv: vm64y vex.dds.256.66.0f38.w1 93 /r] FUTURE,AVX2
+
+VGATHERDPS xmmreg,xmem32,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w0 92 /r] FUTURE,AVX2
+VGATHERQPS xmmreg,xmem32,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w0 93 /r] FUTURE,AVX2
+VGATHERDPS ymmreg,ymem32,ymmreg [rmv: vm32y vex.dds.256.66.0f38.w0 92 /r] FUTURE,AVX2
+VGATHERQPS xmmreg,ymem32,xmmreg [rmv: vm64y vex.dds.256.66.0f38.w0 93 /r] FUTURE,AVX2
+
+VPGATHERDD xmmreg,xmem32,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w0 90 /r] FUTURE,AVX2
+VPGATHERQD xmmreg,xmem32,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w0 91 /r] FUTURE,AVX2
+VPGATHERDD ymmreg,ymem32,ymmreg [rmv: vm32y vex.dds.256.66.0f38.w0 90 /r] FUTURE,AVX2
+VPGATHERQD xmmreg,ymem32,xmmreg [rmv: vm64y vex.dds.256.66.0f38.w0 91 /r] FUTURE,AVX2
+
+VPGATHERDQ xmmreg,xmem64,xmmreg [rmv: vm32x vex.dds.128.66.0f38.w1 90 /r] FUTURE,AVX2
+VPGATHERQQ xmmreg,xmem64,xmmreg [rmv: vm64x vex.dds.128.66.0f38.w1 91 /r] FUTURE,AVX2
+VPGATHERDQ ymmreg,xmem64,ymmreg [rmv: vm32x vex.dds.256.66.0f38.w1 90 /r] FUTURE,AVX2
+VPGATHERQQ ymmreg,ymem64,ymmreg [rmv: vm64y vex.dds.256.66.0f38.w1 91 /r] FUTURE,AVX2
+
+;# Intel Transactional Synchronization Extensions (TSX)
+XABORT imm [i: c6 f8 ib] FUTURE,RTM
+XABORT imm8 [i: c6 f8 ib] FUTURE,RTM
+XBEGIN imm [i: odf c7 f8 rel] FUTURE,RTM
+XBEGIN imm|near [i: odf c7 f8 rel] FUTURE,RTM,ND
+XBEGIN imm16 [i: o16 c7 f8 rel] FUTURE,RTM,NOLONG
+XBEGIN imm16|near [i: o16 c7 f8 rel] FUTURE,RTM,NOLONG,ND
+XBEGIN imm32 [i: o32 c7 f8 rel] FUTURE,RTM,NOLONG
+XBEGIN imm32|near [i: o32 c7 f8 rel] FUTURE,RTM,NOLONG,ND
+XBEGIN imm64 [i: o64nw c7 f8 rel] FUTURE,RTM,LONG
+XBEGIN imm64|near [i: o64nw c7 f8 rel] FUTURE,RTM,LONG,ND
+XEND void [ 0f 01 d5] FUTURE,RTM
+XTEST void [ 0f 01 d6] FUTURE,HLE,RTM
+
+;# Intel BMI1 and BMI2 instructions, AMD TBM instructions
+;
+; based on pub number 319433-011 dated July 2011
+;
+ANDN reg32,reg32,rm32 [rvm: vex.nds.lz.0f38.w0 f2 /r] FUTURE,BMI1
+ANDN reg64,reg64,rm64 [rvm: vex.nds.lz.0f38.w1 f2 /r] LONG,FUTURE,BMI1
+BEXTR reg32,rm32,reg32 [rmv: vex.nds.lz.0f38.w0 f7 /r] FUTURE,BMI1
+BEXTR reg64,rm64,reg64 [rmv: vex.nds.lz.0f38.w1 f7 /r] LONG,FUTURE,BMI1
+BEXTR reg32,rm32,imm32 [rmi: xop.m10.lz.w0 10 /r id] FUTURE,TBM
+BEXTR reg64,rm64,imm32 [rmi: xop.m10.lz.w1 10 /r id] LONG,FUTURE,TBM
+BLCI reg32,rm32 [vm: xop.ndd.lz.m9.w0 02 /6] FUTURE,TBM
+BLCI reg64,rm64 [vm: xop.ndd.lz.m9.w1 02 /6] LONG,FUTURE,TBM
+BLCIC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /5] FUTURE,TBM
+BLCIC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /5] LONG,FUTURE,TBM
+BLSI reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /3] FUTURE,BMI1
+BLSI reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /3] LONG,FUTURE,BMI1
+BLSIC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /6] FUTURE,TBM
+BLSIC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /6] LONG,FUTURE,TBM
+BLCFILL reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /1] FUTURE,TBM
+BLCFILL reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /1] LONG,FUTURE,TBM
+BLSFILL reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /2] FUTURE,TBM
+BLSFILL reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /2] LONG,FUTURE,TBM
+BLCMSK reg32,rm32 [vm: xop.ndd.lz.m9.w0 02 /1] FUTURE,TBM
+BLCMSK reg64,rm64 [vm: xop.ndd.lz.m9.w1 02 /1] LONG,FUTURE,TBM
+BLSMSK reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /2] FUTURE,BMI1
+BLSMSK reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /2] LONG,FUTURE,BMI1
+BLSR reg32,rm32 [vm: vex.ndd.lz.0f38.w0 f3 /1] FUTURE,BMI1
+BLSR reg64,rm64 [vm: vex.ndd.lz.0f38.w1 f3 /1] LONG,FUTURE,BMI1
+BLCS reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /3] FUTURE,TBM
+BLCS reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /3] LONG,FUTURE,TBM
+BZHI reg32,rm32,reg32 [rmv: vex.nds.lz.0f38.w0 f5 /r] FUTURE,BMI2
+BZHI reg64,rm64,reg64 [rmv: vex.nds.lz.0f38.w1 f5 /r] LONG,FUTURE,BMI2
+MULX reg32,reg32,rm32 [rvm: vex.ndd.lz.f2.0f38.w0 f6 /r] FUTURE,BMI2
+MULX reg64,reg64,rm64 [rvm: vex.ndd.lz.f2.0f38.w1 f6 /r] LONG,FUTURE,BMI2
+PDEP reg32,reg32,rm32 [rvm: vex.nds.lz.f2.0f38.w0 f5 /r] FUTURE,BMI2
+PDEP reg64,reg64,rm64 [rvm: vex.nds.lz.f2.0f38.w1 f5 /r] LONG,FUTURE,BMI2
+PEXT reg32,reg32,rm32 [rvm: vex.nds.lz.f3.0f38.w0 f5 /r] FUTURE,BMI2
+PEXT reg64,reg64,rm64 [rvm: vex.nds.lz.f3.0f38.w1 f5 /r] LONG,FUTURE,BMI2
+RORX reg32,rm32,imm8 [rmi: vex.lz.f2.0f3a.w0 f0 /r ib] FUTURE,BMI2
+RORX reg64,rm64,imm8 [rmi: vex.lz.f2.0f3a.w1 f0 /r ib] LONG,FUTURE,BMI2
+SARX reg32,rm32,reg32 [rmv: vex.nds.lz.f3.0f38.w0 f7 /r] FUTURE,BMI2
+SARX reg64,rm64,reg64 [rmv: vex.nds.lz.f3.0f38.w1 f7 /r] LONG,FUTURE,BMI2
+SHLX reg32,rm32,reg32 [rmv: vex.nds.lz.66.0f38.w0 f7 /r] FUTURE,BMI2
+SHLX reg64,rm64,reg64 [rmv: vex.nds.lz.66.0f38.w1 f7 /r] LONG,FUTURE,BMI2
+SHRX reg32,rm32,reg32 [rmv: vex.nds.lz.f2.0f38.w0 f7 /r] FUTURE,BMI2
+SHRX reg64,rm64,reg64 [rmv: vex.nds.lz.f2.0f38.w1 f7 /r] LONG,FUTURE,BMI2
+TZCNT reg16,rm16 [rm: o16 f3i 0f bc /r] FUTURE,BMI1
+TZCNT reg32,rm32 [rm: o32 f3i 0f bc /r] FUTURE,BMI1
+TZCNT reg64,rm64 [rm: o64 f3i 0f bc /r] LONG,FUTURE,BMI1
+TZMSK reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /4] FUTURE,TBM
+TZMSK reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /4] LONG,FUTURE,TBM
+T1MSKC reg32,rm32 [vm: xop.ndd.lz.m9.w0 01 /7] FUTURE,TBM
+T1MSKC reg64,rm64 [vm: xop.ndd.lz.m9.w1 01 /7] LONG,FUTURE,TBM
+
+PREFETCHWT1 mem8 [m: 0f 0d /2 ] PREFETCHWT1,FUTURE
+
+;# Intel Memory Protection Extensions (MPX)
+BNDMK bndreg,mem [rm: f3 0f 1b /r ] MPX,MIB,FUTURE
+BNDCL bndreg,mem [rm: f3 0f 1a /r ] MPX,FUTURE
+BNDCL bndreg,reg32 [rm: f3 0f 1a /r ] MPX,NOLONG,FUTURE
+BNDCL bndreg,reg64 [rm: o64nw f3 0f 1a /r ] MPX,LONG,FUTURE
+BNDCU bndreg,mem [rm: f2 0f 1a /r ] MPX,FUTURE
+BNDCU bndreg,reg32 [rm: f2 0f 1a /r ] MPX,NOLONG,FUTURE
+BNDCU bndreg,reg64 [rm: o64nw f2 0f 1a /r ] MPX,LONG,FUTURE
+BNDCN bndreg,mem [rm: f2 0f 1b /r ] MPX,FUTURE
+BNDCN bndreg,reg32 [rm: f2 0f 1b /r ] MPX,NOLONG,FUTURE
+BNDCN bndreg,reg64 [rm: o64nw f2 0f 1b /r ] MPX,LONG,FUTURE
+BNDMOV bndreg,bndreg [rm: 66 0f 1a /r ] MPX,FUTURE
+BNDMOV bndreg,mem [rm: 66 0f 1a /r ] MPX,FUTURE
+BNDMOV bndreg,bndreg [mr: 66 0f 1b /r ] MPX,FUTURE
+BNDMOV mem,bndreg [mr: 66 0f 1b /r ] MPX,FUTURE
+BNDLDX bndreg,mem [rm: 0f 1a /r ] MPX,MIB,FUTURE
+BNDLDX bndreg,mem,reg32 [rmx: 0f 1a /r ] MPX,MIB,NOLONG,FUTURE
+BNDLDX bndreg,mem,reg64 [rmx: 0f 1a /r ] MPX,MIB,LONG,FUTURE
+BNDSTX mem,bndreg [mr: 0f 1b /r ] MPX,MIB,FUTURE
+BNDSTX mem,reg32,bndreg [mxr: 0f 1b /r ] MPX,MIB,NOLONG,FUTURE
+BNDSTX mem,reg64,bndreg [mxr: 0f 1b /r ] MPX,MIB,LONG,FUTURE
+BNDSTX mem,bndreg,reg32 [mrx: 0f 1b /r ] MPX,MIB,NOLONG,FUTURE
+BNDSTX mem,bndreg,reg64 [mrx: 0f 1b /r ] MPX,MIB,LONG,FUTURE
+
+;# Intel SHA acceleration instructions
+SHA1MSG1 xmmreg,xmmrm128 [rm: 0f 38 c9 /r ] SHA,FUTURE
+SHA1MSG2 xmmreg,xmmrm128 [rm: 0f 38 ca /r ] SHA,FUTURE
+SHA1NEXTE xmmreg,xmmrm128 [rm: 0f 38 c8 /r ] SHA,FUTURE
+SHA1RNDS4 xmmreg,xmmrm128,imm8 [rmi: 0f 3a cc /r ib ] SHA,FUTURE
+SHA256MSG1 xmmreg,xmmrm128 [rm: 0f 38 cc /r ] SHA,FUTURE
+SHA256MSG2 xmmreg,xmmrm128 [rm: 0f 38 cd /r ] SHA,FUTURE
+SHA256RNDS2 xmmreg,xmmrm128,xmm0 [rm-: 0f 38 cb /r ] SHA,FUTURE
+SHA256RNDS2 xmmreg,xmmrm128 [rm: 0f 38 cb /r ] SHA,FUTURE
+
+;# AVX-512 mask register instructions
+KADDB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 4a /r ] FUTURE
+KADDD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 4a /r ] FUTURE
+KADDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 4a /r ] FUTURE
+KADDW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 4a /r ] FUTURE
+KANDB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 41 /r ] FUTURE
+KANDD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 41 /r ] FUTURE
+KANDNB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 42 /r ] FUTURE
+KANDND kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 42 /r ] FUTURE
+KANDNQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 42 /r ] FUTURE
+KANDNW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 42 /r ] FUTURE
+KANDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 41 /r ] FUTURE
+KANDW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 41 /r ] FUTURE
+KMOVB kreg,krm8 [rm: vex.l0.66.0f.w0 90 /r ] FUTURE
+KMOVB mem8,kreg [mr: vex.l0.66.0f.w0 91 /r ] FUTURE
+KMOVB kreg,reg32 [rm: vex.l0.66.0f.w0 92 /r ] FUTURE
+KMOVB reg32,kreg [rm: vex.l0.66.0f.w0 93 /r ] FUTURE
+KMOVD kreg,krm32 [rm: vex.l0.66.0f.w1 90 /r ] FUTURE
+KMOVD mem32,kreg [mr: vex.l0.66.0f.w1 91 /r ] FUTURE
+KMOVD kreg,reg32 [rm: vex.l0.f2.0f.w0 92 /r ] FUTURE
+KMOVD reg32,kreg [rm: vex.l0.f2.0f.w0 93 /r ] FUTURE
+KMOVQ kreg,krm64 [rm: vex.l0.0f.w1 90 /r ] FUTURE
+KMOVQ mem64,kreg [mr: vex.l0.0f.w1 91 /r ] FUTURE
+KMOVQ kreg,reg64 [rm: vex.l0.f2.0f.w1 92 /r ] FUTURE
+KMOVQ reg64,kreg [rm: vex.l0.f2.0f.w1 93 /r ] FUTURE
+KMOVW kreg,krm16 [rm: vex.l0.0f.w0 90 /r ] FUTURE
+KMOVW mem16,kreg [mr: vex.l0.0f.w0 91 /r ] FUTURE
+KMOVW kreg,reg32 [rm: vex.l0.0f.w0 92 /r ] FUTURE
+KMOVW reg32,kreg [rm: vex.l0.0f.w0 93 /r ] FUTURE
+KNOTB kreg,kreg [rm: vex.l0.66.0f.w0 44 /r ] FUTURE
+KNOTD kreg,kreg [rm: vex.l0.66.0f.w1 44 /r ] FUTURE
+KNOTQ kreg,kreg [rm: vex.l0.0f.w1 44 /r ] FUTURE
+KNOTW kreg,kreg [rm: vex.l0.0f.w0 44 /r ] FUTURE
+KORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 45 /r ] FUTURE
+KORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 45 /r ] FUTURE
+KORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 45 /r ] FUTURE
+KORTESTB kreg,kreg [rm: vex.l0.66.0f.w0 98 /r ] FUTURE
+KORTESTD kreg,kreg [rm: vex.l0.66.0f.w1 98 /r ] FUTURE
+KORTESTQ kreg,kreg [rm: vex.l0.0f.w1 98 /r ] FUTURE
+KORTESTW kreg,kreg [rm: vex.l0.0f.w0 98 /r ] FUTURE
+KORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 45 /r ] FUTURE
+KSHIFTLB kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 32 /r ib ] FUTURE
+KSHIFTLD kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 33 /r ib ] FUTURE
+KSHIFTLQ kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 33 /r ib ] FUTURE
+KSHIFTLW kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 32 /r ib ] FUTURE
+KSHIFTRB kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 30 /r ib ] FUTURE
+KSHIFTRD kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w0 31 /r ib ] FUTURE
+KSHIFTRQ kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 31 /r ib ] FUTURE
+KSHIFTRW kreg,kreg,imm8 [rmi: vex.l0.66.0f3a.w1 30 /r ib ] FUTURE
+KTESTB kreg,kreg [rm: vex.l0.66.0f.w0 99 /r ] FUTURE
+KTESTD kreg,kreg [rm: vex.l0.66.0f.w1 99 /r ] FUTURE
+KTESTQ kreg,kreg [rm: vex.l0.0f.w1 99 /r ] FUTURE
+KTESTW kreg,kreg [rm: vex.l0.0f.w0 99 /r ] FUTURE
+KUNPCKBW kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 4b /r ] FUTURE
+KUNPCKDQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 4b /r ] FUTURE
+KUNPCKWD kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 4b /r ] FUTURE
+KXNORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 46 /r ] FUTURE
+KXNORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 46 /r ] FUTURE
+KXNORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 46 /r ] FUTURE
+KXNORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 46 /r ] FUTURE
+KXORB kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w0 47 /r ] FUTURE
+KXORD kreg,kreg,kreg [rvm: vex.nds.l1.66.0f.w1 47 /r ] FUTURE
+KXORQ kreg,kreg,kreg [rvm: vex.nds.l1.0f.w1 47 /r ] FUTURE
+KXORW kreg,kreg,kreg [rvm: vex.nds.l1.0f.w0 47 /r ] FUTURE
+
+;# AVX-512 instructions
+VADDPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE
+VADDPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 58 /r ] AVX512VL,AVX512,FUTURE
+VADDPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 58 /r ] AVX512,FUTURE
+VADDPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VADDPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VADDPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 58 /r ] AVX512,FUTURE
+VADDSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 58 /r ] AVX512,FUTURE
+VADDSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 58 /r ] AVX512,FUTURE
+VALIGND xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 03 /r ib ] AVX512VL,AVX512,FUTURE
+VALIGND ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 03 /r ib ] AVX512VL,AVX512,FUTURE
+VALIGND zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 03 /r ib ] AVX512,FUTURE
+VALIGNQ xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 03 /r ib ] AVX512VL,AVX512,FUTURE
+VALIGNQ ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 03 /r ib ] AVX512VL,AVX512,FUTURE
+VALIGNQ zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 03 /r ib ] AVX512,FUTURE
+VANDNPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 55 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDNPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 55 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDNPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 55 /r ] AVX512DQ,FUTURE
+VANDNPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 55 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDNPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 55 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDNPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 55 /r ] AVX512DQ,FUTURE
+VANDPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 54 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 54 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 54 /r ] AVX512DQ,FUTURE
+VANDPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 54 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 54 /r ] AVX512VL,AVX512DQ,FUTURE
+VANDPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 54 /r ] AVX512DQ,FUTURE
+VBLENDMPD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 65 /r ] AVX512VL,AVX512,FUTURE
+VBLENDMPD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 65 /r ] AVX512VL,AVX512,FUTURE
+VBLENDMPD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 65 /r ] AVX512,FUTURE
+VBLENDMPS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 65 /r ] AVX512VL,AVX512,FUTURE
+VBLENDMPS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 65 /r ] AVX512VL,AVX512,FUTURE
+VBLENDMPS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 65 /r ] AVX512,FUTURE
+VBROADCASTF32X2 ymmreg|mask|z,xmmrm64 [rm:t2: evex.256.66.0f38.w0 19 /r ] AVX512VL,AVX512DQ,FUTURE
+VBROADCASTF32X2 zmmreg|mask|z,xmmrm64 [rm:t2: evex.512.66.0f38.w0 19 /r ] AVX512DQ,FUTURE
+VBROADCASTF32X4 ymmreg|mask|z,mem128 [rm:t4: evex.256.66.0f38.w0 1a /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTF32X4 zmmreg|mask|z,mem128 [rm:t4: evex.512.66.0f38.w0 1a /r ] AVX512,FUTURE
+VBROADCASTF32X8 zmmreg|mask|z,mem256 [rm:t8: evex.512.66.0f38.w0 1b /r ] AVX512DQ,FUTURE
+VBROADCASTF64X2 ymmreg|mask|z,mem128 [rm:t2: evex.256.66.0f38.w1 1a /r ] AVX512VL,AVX512DQ,FUTURE
+VBROADCASTF64X2 zmmreg|mask|z,mem128 [rm:t2: evex.512.66.0f38.w1 1a /r ] AVX512DQ,FUTURE
+VBROADCASTF64X4 zmmreg|mask|z,mem256 [rm:t4: evex.512.66.0f38.w1 1b /r ] AVX512,FUTURE
+VBROADCASTI32X2 xmmreg|mask|z,xmmrm64 [rm:t2: evex.128.66.0f38.w0 59 /r ] AVX512VL,AVX512DQ,FUTURE
+VBROADCASTI32X2 ymmreg|mask|z,xmmrm64 [rm:t2: evex.256.66.0f38.w0 59 /r ] AVX512VL,AVX512DQ,FUTURE
+VBROADCASTI32X2 zmmreg|mask|z,xmmrm64 [rm:t2: evex.512.66.0f38.w0 59 /r ] AVX512DQ,FUTURE
+VBROADCASTI32X4 ymmreg|mask|z,mem128 [rm:t4: evex.256.66.0f38.w0 5a /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTI32X4 zmmreg|mask|z,mem128 [rm:t4: evex.512.66.0f38.w0 5a /r ] AVX512,FUTURE
+VBROADCASTI32X8 zmmreg|mask|z,mem256 [rm:t8: evex.512.66.0f38.w0 5b /r ] AVX512DQ,FUTURE
+VBROADCASTI64X2 ymmreg|mask|z,mem128 [rm:t2: evex.256.66.0f38.w1 5a /r ] AVX512VL,AVX512DQ,FUTURE
+VBROADCASTI64X2 zmmreg|mask|z,mem128 [rm:t2: evex.512.66.0f38.w1 5a /r ] AVX512DQ,FUTURE
+VBROADCASTI64X4 zmmreg|mask|z,mem256 [rm:t4: evex.512.66.0f38.w1 5b /r ] AVX512,FUTURE
+VBROADCASTSD ymmreg|mask|z,mem64 [rm:t1s: evex.256.66.0f38.w1 19 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSD zmmreg|mask|z,mem64 [rm:t1s: evex.512.66.0f38.w1 19 /r ] AVX512,FUTURE
+VBROADCASTSD ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w1 19 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSD zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w1 19 /r ] AVX512,FUTURE
+VBROADCASTSS xmmreg|mask|z,mem32 [rm:t1s: evex.128.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSS ymmreg|mask|z,mem32 [rm:t1s: evex.256.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSS zmmreg|mask|z,mem32 [rm:t1s: evex.512.66.0f38.w0 18 /r ] AVX512,FUTURE
+VBROADCASTSS xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSS ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w0 18 /r ] AVX512VL,AVX512,FUTURE
+VBROADCASTSS zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w0 18 /r ] AVX512,FUTURE
+VCMPPD kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f.w1 c2 /r ib ] AVX512VL,AVX512,FUTURE
+VCMPPD kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f.w1 c2 /r ib ] AVX512VL,AVX512,FUTURE
+VCMPPD kreg|mask,zmmreg,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f.w1 c2 /r ib ] AVX512,FUTURE
+VCMPPS kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.0f.w0 c2 /r ib ] AVX512VL,AVX512,FUTURE
+VCMPPS kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.0f.w0 c2 /r ib ] AVX512VL,AVX512,FUTURE
+VCMPPS kreg|mask,zmmreg,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.0f.w0 c2 /r ib ] AVX512,FUTURE
+VCMPSD kreg|mask,xmmreg,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.f2.0f.w1 c2 /r ib ] AVX512,FUTURE
+VCMPSS kreg|mask,xmmreg,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.f3.0f.w0 c2 /r ib ] AVX512,FUTURE
+VCOMISD xmmreg,xmmrm64|sae [rm:t1s: evex.128.66.0f.w1 2f /r ] AVX512,FUTURE
+VCOMISS xmmreg,xmmrm32|sae [rm:t1s: evex.128.0f.w0 2f /r ] AVX512,FUTURE
+VCOMPRESSPD mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPD mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPD mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w1 8a /r ] AVX512,FUTURE
+VCOMPRESSPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w1 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w1 8a /r ] AVX512,FUTURE
+VCOMPRESSPS mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPS mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPS mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w0 8a /r ] AVX512,FUTURE
+VCOMPRESSPS xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPS ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w0 8a /r ] AVX512VL,AVX512,FUTURE
+VCOMPRESSPS zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w0 8a /r ] AVX512,FUTURE
+VCVTDQ2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.f3.0f.w0 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTDQ2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.f3.0f.w0 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTDQ2PD zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.f3.0f.w0 e6 /r ] AVX512,FUTURE
+VCVTDQ2PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTDQ2PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTDQ2PS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 5b /r ] AVX512,FUTURE
+VCVTPD2DQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f2.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2DQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f2.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2DQ ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f2.0f.w1 e6 /r ] AVX512,FUTURE
+VCVTPD2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 5a /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 5a /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 5a /r ] AVX512,FUTURE
+VCVTPD2QQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 7b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPD2QQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 7b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPD2QQ zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 7b /r ] AVX512DQ,FUTURE
+VCVTPD2UDQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 79 /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2UDQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 79 /r ] AVX512VL,AVX512,FUTURE
+VCVTPD2UDQ ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.0f.w1 79 /r ] AVX512,FUTURE
+VCVTPD2UQQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 79 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPD2UQQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 79 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPD2UQQ zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 79 /r ] AVX512DQ,FUTURE
+VCVTPH2PS xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VCVTPH2PS ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VCVTPH2PS zmmreg|mask|z,ymmrm256|sae [rm:hvm: evex.512.66.0f38.w0 13 /r ] AVX512,FUTURE
+VCVTPS2DQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2DQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2DQ zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.66.0f.w0 5b /r ] AVX512,FUTURE
+VCVTPS2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.0f.w0 5a /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.0f.w0 5a /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2PD zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.0f.w0 5a /r ] AVX512,FUTURE
+VCVTPS2PH xmmreg|mask|z,xmmreg,imm8 [mri:hvm: evex.128.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
+VCVTPS2PH xmmreg|mask|z,ymmreg,imm8 [mri:hvm: evex.256.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
+VCVTPS2PH ymmreg|mask|z,zmmreg|sae,imm8 [mri:hvm: evex.512.66.0f3a.w0 1d /r ib ] AVX512,FUTURE
+VCVTPS2PH mem64|mask,xmmreg,imm8 [mri:hvm: evex.128.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
+VCVTPS2PH mem128|mask,ymmreg,imm8 [mri:hvm: evex.256.66.0f3a.w0 1d /r ib ] AVX512VL,AVX512,FUTURE
+VCVTPS2PH mem256|mask,zmmreg|sae,imm8 [mri:hvm: evex.512.66.0f3a.w0 1d /r ib ] AVX512,FUTURE
+VCVTPS2QQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 7b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPS2QQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 7b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPS2QQ zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.66.0f.w0 7b /r ] AVX512DQ,FUTURE
+VCVTPS2UDQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 79 /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2UDQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 79 /r ] AVX512VL,AVX512,FUTURE
+VCVTPS2UDQ zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 79 /r ] AVX512,FUTURE
+VCVTPS2UQQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 79 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPS2UQQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 79 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTPS2UQQ zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.66.0f.w0 79 /r ] AVX512DQ,FUTURE
+VCVTQQ2PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f3.0f.w1 e6 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTQQ2PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f3.0f.w1 e6 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTQQ2PD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f3.0f.w1 e6 /r ] AVX512DQ,FUTURE
+VCVTQQ2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 5b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTQQ2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 5b /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTQQ2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.0f.w1 5b /r ] AVX512DQ,FUTURE
+VCVTSD2SI reg32,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w0 2d /r ] AVX512,FUTURE
+VCVTSD2SI reg64,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w1 2d /r ] AVX512,FUTURE
+VCVTSD2SS xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5a /r ] AVX512,FUTURE
+VCVTSD2USI reg32,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w0 79 /r ] AVX512,FUTURE
+VCVTSD2USI reg64,xmmrm64|er [rm:t1f64: evex.128.f2.0f.w1 79 /r ] AVX512,FUTURE
+VCVTSI2SD xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f2.0f.w0 2a /r ] AVX512,FUTURE
+VCVTSI2SD xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f2.0f.w1 2a /r ] AVX512,FUTURE
+VCVTSI2SS xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f3.0f.w0 2a /r ] AVX512,FUTURE
+VCVTSI2SS xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f3.0f.w1 2a /r ] AVX512,FUTURE
+VCVTSS2SD xmmreg|mask|z,xmmreg,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5a /r ] AVX512,FUTURE
+VCVTSS2SI reg32,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w0 2d /r ] AVX512,FUTURE
+VCVTSS2SI reg64,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w1 2d /r ] AVX512,FUTURE
+VCVTSS2USI reg32,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w0 79 /r ] AVX512,FUTURE
+VCVTSS2USI reg64,xmmrm32|er [rm:t1f32: evex.128.f3.0f.w1 79 /r ] AVX512,FUTURE
+VCVTTPD2DQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPD2DQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 e6 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPD2DQ ymmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 e6 /r ] AVX512,FUTURE
+VCVTTPD2QQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPD2QQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPD2QQ zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 7a /r ] AVX512DQ,FUTURE
+VCVTTPD2UDQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.0f.w1 78 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPD2UDQ xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.0f.w1 78 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPD2UDQ ymmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.0f.w1 78 /r ] AVX512,FUTURE
+VCVTTPD2UQQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 78 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPD2UQQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 78 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPD2UQQ zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f.w1 78 /r ] AVX512DQ,FUTURE
+VCVTTPS2DQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.f3.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTTPS2DQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.f3.0f.w0 5b /r ] AVX512VL,AVX512,FUTURE
+VCVTTPS2DQ zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.f3.0f.w0 5b /r ] AVX512,FUTURE
+VCVTTPS2QQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPS2QQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPS2QQ zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.66.0f.w0 7a /r ] AVX512DQ,FUTURE
+VCVTTPS2UDQ xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 78 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPS2UDQ ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 78 /r ] AVX512VL,AVX512,FUTURE
+VCVTTPS2UDQ zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.0f.w0 78 /r ] AVX512,FUTURE
+VCVTTPS2UQQ xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.66.0f.w0 78 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPS2UQQ ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.66.0f.w0 78 /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTTPS2UQQ zmmreg|mask|z,ymmrm256|b32|sae [rm:hv: evex.512.66.0f.w0 78 /r ] AVX512DQ,FUTURE
+VCVTTSD2SI reg32,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w0 2c /r ] AVX512,FUTURE
+VCVTTSD2SI reg64,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w1 2c /r ] AVX512,FUTURE
+VCVTTSD2USI reg32,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w0 78 /r ] AVX512,FUTURE
+VCVTTSD2USI reg64,xmmrm64|sae [rm:t1f64: evex.128.f2.0f.w1 78 /r ] AVX512,FUTURE
+VCVTTSS2SI reg32,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w0 2c /r ] AVX512,FUTURE
+VCVTTSS2SI reg64,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w1 2c /r ] AVX512,FUTURE
+VCVTTSS2USI reg32,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w0 78 /r ] AVX512,FUTURE
+VCVTTSS2USI reg64,xmmrm32|sae [rm:t1f32: evex.128.f3.0f.w1 78 /r ] AVX512,FUTURE
+VCVTUDQ2PD xmmreg|mask|z,xmmrm64|b32 [rm:hv: evex.128.f3.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
+VCVTUDQ2PD ymmreg|mask|z,xmmrm128|b32 [rm:hv: evex.256.f3.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
+VCVTUDQ2PD zmmreg|mask|z,ymmrm256|b32|er [rm:hv: evex.512.f3.0f.w0 7a /r ] AVX512,FUTURE
+VCVTUDQ2PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.f2.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
+VCVTUDQ2PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.f2.0f.w0 7a /r ] AVX512VL,AVX512,FUTURE
+VCVTUDQ2PS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.f2.0f.w0 7a /r ] AVX512,FUTURE
+VCVTUQQ2PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f3.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTUQQ2PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f3.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTUQQ2PD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f3.0f.w1 7a /r ] AVX512DQ,FUTURE
+VCVTUQQ2PS xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.f2.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTUQQ2PS xmmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.f2.0f.w1 7a /r ] AVX512VL,AVX512DQ,FUTURE
+VCVTUQQ2PS ymmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.f2.0f.w1 7a /r ] AVX512DQ,FUTURE
+VCVTUSI2SD xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f2.0f.w0 7b /r ] AVX512,FUTURE
+VCVTUSI2SD xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f2.0f.w1 7b /r ] AVX512,FUTURE
+VCVTUSI2SS xmmreg,xmmreg|er,rm32 [rvm:t1s: evex.nds.128.f3.0f.w0 7b /r ] AVX512,FUTURE
+VCVTUSI2SS xmmreg,xmmreg|er,rm64 [rvm:t1s: evex.nds.128.f3.0f.w1 7b /r ] AVX512,FUTURE
+VDBPSADBW xmmreg|mask|z,xmmreg*,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 42 /r ib ] AVX512VL,AVX512BW,FUTURE
+VDBPSADBW ymmreg|mask|z,ymmreg*,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 42 /r ib ] AVX512VL,AVX512BW,FUTURE
+VDBPSADBW zmmreg|mask|z,zmmreg*,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 42 /r ib ] AVX512BW,FUTURE
+VDIVPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5e /r ] AVX512VL,AVX512,FUTURE
+VDIVPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5e /r ] AVX512VL,AVX512,FUTURE
+VDIVPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 5e /r ] AVX512,FUTURE
+VDIVPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5e /r ] AVX512VL,AVX512,FUTURE
+VDIVPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5e /r ] AVX512VL,AVX512,FUTURE
+VDIVPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 5e /r ] AVX512,FUTURE
+VDIVSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5e /r ] AVX512,FUTURE
+VDIVSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 5e /r ] AVX512,FUTURE
+VEXP2PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 c8 /r ] AVX512ER,FUTURE
+VEXP2PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 c8 /r ] AVX512ER,FUTURE
+VEXPANDPD xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPD ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPD zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w1 88 /r ] AVX512,FUTURE
+VEXPANDPD xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPD ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w1 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPD zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w1 88 /r ] AVX512,FUTURE
+VEXPANDPS xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPS ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPS zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w0 88 /r ] AVX512,FUTURE
+VEXPANDPS xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPS ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w0 88 /r ] AVX512VL,AVX512,FUTURE
+VEXPANDPS zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w0 88 /r ] AVX512,FUTURE
+VEXTRACTF32X4 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w0 19 /r ib ] AVX512VL,AVX512,FUTURE
+VEXTRACTF32X4 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 19 /r ib ] AVX512,FUTURE
+VEXTRACTF32X4 mem128|mask,ymmreg,imm8 [mri:t4: evex.256.66.0f3a.w0 19 /r ib ] AVX512VL,AVX512,FUTURE
+VEXTRACTF32X4 mem128|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w0 19 /r ib ] AVX512,FUTURE
+VEXTRACTF32X8 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 1b /r ib ] AVX512DQ,FUTURE
+VEXTRACTF32X8 mem256|mask,zmmreg,imm8 [mri:t8: evex.512.66.0f3a.w0 1b /r ib ] AVX512DQ,FUTURE
+VEXTRACTF64X2 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w1 19 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VEXTRACTF64X2 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 19 /r ib ] AVX512DQ,FUTURE
+VEXTRACTF64X2 mem128|mask,ymmreg,imm8 [mri:t2: evex.256.66.0f3a.w1 19 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VEXTRACTF64X2 mem128|mask,zmmreg,imm8 [mri:t2: evex.512.66.0f3a.w1 19 /r ib ] AVX512DQ,FUTURE
+VEXTRACTF64X4 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 1b /r ib ] AVX512,FUTURE
+VEXTRACTF64X4 mem256|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w1 1b /r ib ] AVX512,FUTURE
+VEXTRACTI32X4 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w0 39 /r ib ] AVX512VL,AVX512,FUTURE
+VEXTRACTI32X4 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 39 /r ib ] AVX512,FUTURE
+VEXTRACTI32X4 mem128|mask,ymmreg,imm8 [mri:t4: evex.256.66.0f3a.w0 39 /r ib ] AVX512VL,AVX512,FUTURE
+VEXTRACTI32X4 mem128|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w0 39 /r ib ] AVX512,FUTURE
+VEXTRACTI32X8 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w0 3b /r ib ] AVX512DQ,FUTURE
+VEXTRACTI32X8 mem256|mask,zmmreg,imm8 [mri:t8: evex.512.66.0f3a.w0 3b /r ib ] AVX512DQ,FUTURE
+VEXTRACTI64X2 xmmreg|mask|z,ymmreg,imm8 [mri: evex.256.66.0f3a.w1 39 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VEXTRACTI64X2 xmmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 39 /r ib ] AVX512DQ,FUTURE
+VEXTRACTI64X2 mem128|mask,ymmreg,imm8 [mri:t2: evex.256.66.0f3a.w1 39 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VEXTRACTI64X2 mem128|mask,zmmreg,imm8 [mri:t2: evex.512.66.0f3a.w1 39 /r ib ] AVX512DQ,FUTURE
+VEXTRACTI64X4 ymmreg|mask|z,zmmreg,imm8 [mri: evex.512.66.0f3a.w1 3b /r ib ] AVX512,FUTURE
+VEXTRACTI64X4 mem256|mask,zmmreg,imm8 [mri:t4: evex.512.66.0f3a.w1 3b /r ib ] AVX512,FUTURE
+VEXTRACTPS reg32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
+VEXTRACTPS reg64,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
+VEXTRACTPS mem32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.wig 17 /r ib ] AVX512,FUTURE
+VFIXUPIMMPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 54 /r ib ] AVX512VL,AVX512,FUTURE
+VFIXUPIMMPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 54 /r ib ] AVX512VL,AVX512,FUTURE
+VFIXUPIMMPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 54 /r ib ] AVX512,FUTURE
+VFIXUPIMMPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 54 /r ib ] AVX512VL,AVX512,FUTURE
+VFIXUPIMMPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 54 /r ib ] AVX512VL,AVX512,FUTURE
+VFIXUPIMMPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 54 /r ib ] AVX512,FUTURE
+VFIXUPIMMSD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 55 /r ib ] AVX512,FUTURE
+VFIXUPIMMSS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 55 /r ib ] AVX512,FUTURE
+VFMADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 98 /r ] AVX512VL,AVX512,FUTURE
+VFMADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 98 /r ] AVX512VL,AVX512,FUTURE
+VFMADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 98 /r ] AVX512,FUTURE
+VFMADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 98 /r ] AVX512VL,AVX512,FUTURE
+VFMADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 98 /r ] AVX512VL,AVX512,FUTURE
+VFMADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 98 /r ] AVX512,FUTURE
+VFMADD132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 99 /r ] AVX512,FUTURE
+VFMADD132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 99 /r ] AVX512,FUTURE
+VFMADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a8 /r ] AVX512,FUTURE
+VFMADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a8 /r ] AVX512,FUTURE
+VFMADD213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 a9 /r ] AVX512,FUTURE
+VFMADD213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 a9 /r ] AVX512,FUTURE
+VFMADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b8 /r ] AVX512,FUTURE
+VFMADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b8 /r ] AVX512VL,AVX512,FUTURE
+VFMADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b8 /r ] AVX512,FUTURE
+VFMADD231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 b9 /r ] AVX512,FUTURE
+VFMADD231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 b9 /r ] AVX512,FUTURE
+VFMADDSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 96 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 96 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 96 /r ] AVX512,FUTURE
+VFMADDSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 96 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 96 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 96 /r ] AVX512,FUTURE
+VFMADDSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a6 /r ] AVX512,FUTURE
+VFMADDSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a6 /r ] AVX512,FUTURE
+VFMADDSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b6 /r ] AVX512,FUTURE
+VFMADDSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b6 /r ] AVX512VL,AVX512,FUTURE
+VFMADDSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b6 /r ] AVX512,FUTURE
+VFMSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9a /r ] AVX512VL,AVX512,FUTURE
+VFMSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9a /r ] AVX512VL,AVX512,FUTURE
+VFMSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9a /r ] AVX512,FUTURE
+VFMSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9a /r ] AVX512VL,AVX512,FUTURE
+VFMSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9a /r ] AVX512VL,AVX512,FUTURE
+VFMSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9a /r ] AVX512,FUTURE
+VFMSUB132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9b /r ] AVX512,FUTURE
+VFMSUB132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9b /r ] AVX512,FUTURE
+VFMSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 aa /r ] AVX512VL,AVX512,FUTURE
+VFMSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 aa /r ] AVX512VL,AVX512,FUTURE
+VFMSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 aa /r ] AVX512,FUTURE
+VFMSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 aa /r ] AVX512VL,AVX512,FUTURE
+VFMSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 aa /r ] AVX512VL,AVX512,FUTURE
+VFMSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 aa /r ] AVX512,FUTURE
+VFMSUB213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 ab /r ] AVX512,FUTURE
+VFMSUB213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 ab /r ] AVX512,FUTURE
+VFMSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ba /r ] AVX512VL,AVX512,FUTURE
+VFMSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ba /r ] AVX512VL,AVX512,FUTURE
+VFMSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ba /r ] AVX512,FUTURE
+VFMSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ba /r ] AVX512VL,AVX512,FUTURE
+VFMSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ba /r ] AVX512VL,AVX512,FUTURE
+VFMSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ba /r ] AVX512,FUTURE
+VFMSUB231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bb /r ] AVX512,FUTURE
+VFMSUB231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bb /r ] AVX512,FUTURE
+VFMSUBADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 97 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 97 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 97 /r ] AVX512,FUTURE
+VFMSUBADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 97 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 97 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 97 /r ] AVX512,FUTURE
+VFMSUBADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 a7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 a7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 a7 /r ] AVX512,FUTURE
+VFMSUBADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 a7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 a7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 a7 /r ] AVX512,FUTURE
+VFMSUBADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 b7 /r ] AVX512,FUTURE
+VFMSUBADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 b7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 b7 /r ] AVX512VL,AVX512,FUTURE
+VFMSUBADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 b7 /r ] AVX512,FUTURE
+VFNMADD132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9c /r ] AVX512VL,AVX512,FUTURE
+VFNMADD132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9c /r ] AVX512VL,AVX512,FUTURE
+VFNMADD132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9c /r ] AVX512,FUTURE
+VFNMADD132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9c /r ] AVX512VL,AVX512,FUTURE
+VFNMADD132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9c /r ] AVX512VL,AVX512,FUTURE
+VFNMADD132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9c /r ] AVX512,FUTURE
+VFNMADD132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9d /r ] AVX512,FUTURE
+VFNMADD132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9d /r ] AVX512,FUTURE
+VFNMADD213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ac /r ] AVX512VL,AVX512,FUTURE
+VFNMADD213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ac /r ] AVX512VL,AVX512,FUTURE
+VFNMADD213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ac /r ] AVX512,FUTURE
+VFNMADD213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ac /r ] AVX512VL,AVX512,FUTURE
+VFNMADD213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ac /r ] AVX512VL,AVX512,FUTURE
+VFNMADD213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ac /r ] AVX512,FUTURE
+VFNMADD213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 ad /r ] AVX512,FUTURE
+VFNMADD213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 ad /r ] AVX512,FUTURE
+VFNMADD231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 bc /r ] AVX512VL,AVX512,FUTURE
+VFNMADD231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 bc /r ] AVX512VL,AVX512,FUTURE
+VFNMADD231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 bc /r ] AVX512,FUTURE
+VFNMADD231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 bc /r ] AVX512VL,AVX512,FUTURE
+VFNMADD231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 bc /r ] AVX512VL,AVX512,FUTURE
+VFNMADD231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 bc /r ] AVX512,FUTURE
+VFNMADD231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bd /r ] AVX512,FUTURE
+VFNMADD231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bd /r ] AVX512,FUTURE
+VFNMSUB132PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 9e /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB132PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 9e /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB132PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 9e /r ] AVX512,FUTURE
+VFNMSUB132PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 9e /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB132PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 9e /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB132PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 9e /r ] AVX512,FUTURE
+VFNMSUB132SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 9f /r ] AVX512,FUTURE
+VFNMSUB132SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 9f /r ] AVX512,FUTURE
+VFNMSUB213PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 ae /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB213PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 ae /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB213PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 ae /r ] AVX512,FUTURE
+VFNMSUB213PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 ae /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB213PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 ae /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB213PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 ae /r ] AVX512,FUTURE
+VFNMSUB213SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 af /r ] AVX512,FUTURE
+VFNMSUB213SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 af /r ] AVX512,FUTURE
+VFNMSUB231PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 be /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB231PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 be /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB231PD zmmreg|mask|z,zmmreg,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 be /r ] AVX512,FUTURE
+VFNMSUB231PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 be /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB231PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 be /r ] AVX512VL,AVX512,FUTURE
+VFNMSUB231PS zmmreg|mask|z,zmmreg,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 be /r ] AVX512,FUTURE
+VFNMSUB231SD xmmreg|mask|z,xmmreg,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 bf /r ] AVX512,FUTURE
+VFNMSUB231SS xmmreg|mask|z,xmmreg,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 bf /r ] AVX512,FUTURE
+VFPCLASSPD kreg|mask,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VFPCLASSPD kreg|mask,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VFPCLASSPD kreg|mask,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 66 /r ib ] AVX512DQ,FUTURE
+VFPCLASSPS kreg|mask,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VFPCLASSPS kreg|mask,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 66 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VFPCLASSPS kreg|mask,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f3a.w0 66 /r ib ] AVX512DQ,FUTURE
+VFPCLASSSD kreg|mask,xmmrm64,imm8 [rmi:t1s: evex.128.66.0f3a.w1 67 /r ib ] AVX512DQ,FUTURE
+VFPCLASSSS kreg|mask,xmmrm32,imm8 [rmi:t1s: evex.128.66.0f3a.w0 67 /r ib ] AVX512DQ,FUTURE
+VGATHERDPD xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 92 /r ] AVX512VL,AVX512,FUTURE
+VGATHERDPD ymmreg|mask,xmem64 [rm:t1s: vsibx evex.256.66.0f38.w1 92 /r ] AVX512VL,AVX512,FUTURE
+VGATHERDPD zmmreg|mask,ymem64 [rm:t1s: vsiby evex.512.66.0f38.w1 92 /r ] AVX512,FUTURE
+VGATHERDPS xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 92 /r ] AVX512VL,AVX512,FUTURE
+VGATHERDPS ymmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 92 /r ] AVX512VL,AVX512,FUTURE
+VGATHERDPS zmmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 92 /r ] AVX512,FUTURE
+VGATHERPF0DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /1 ] AVX512PF,FUTURE
+VGATHERPF0DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /1 ] AVX512PF,FUTURE
+VGATHERPF0QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /1 ] AVX512PF,FUTURE
+VGATHERPF0QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /1 ] AVX512PF,FUTURE
+VGATHERPF1DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /2 ] AVX512PF,FUTURE
+VGATHERPF1DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /2 ] AVX512PF,FUTURE
+VGATHERPF1QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /2 ] AVX512PF,FUTURE
+VGATHERPF1QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /2 ] AVX512PF,FUTURE
+VGATHERQPD xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 93 /r ] AVX512VL,AVX512,FUTURE
+VGATHERQPD ymmreg|mask,ymem64 [rm:t1s: vsiby evex.256.66.0f38.w1 93 /r ] AVX512VL,AVX512,FUTURE
+VGATHERQPD zmmreg|mask,zmem64 [rm:t1s: vsibz evex.512.66.0f38.w1 93 /r ] AVX512,FUTURE
+VGATHERQPS xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 93 /r ] AVX512VL,AVX512,FUTURE
+VGATHERQPS xmmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 93 /r ] AVX512VL,AVX512,FUTURE
+VGATHERQPS ymmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 93 /r ] AVX512,FUTURE
+VGETEXPPD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 42 /r ] AVX512VL,AVX512,FUTURE
+VGETEXPPD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 42 /r ] AVX512VL,AVX512,FUTURE
+VGETEXPPD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 42 /r ] AVX512,FUTURE
+VGETEXPPS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 42 /r ] AVX512VL,AVX512,FUTURE
+VGETEXPPS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 42 /r ] AVX512VL,AVX512,FUTURE
+VGETEXPPS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 42 /r ] AVX512,FUTURE
+VGETEXPSD xmmreg|mask|z,xmmreg,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 43 /r ] AVX512,FUTURE
+VGETEXPSS xmmreg|mask|z,xmmreg,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 43 /r ] AVX512,FUTURE
+VGETMANTPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 26 /r ib ] AVX512VL,AVX512,FUTURE
+VGETMANTPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 26 /r ib ] AVX512VL,AVX512,FUTURE
+VGETMANTPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 26 /r ib ] AVX512,FUTURE
+VGETMANTPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 26 /r ib ] AVX512VL,AVX512,FUTURE
+VGETMANTPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 26 /r ib ] AVX512VL,AVX512,FUTURE
+VGETMANTPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 26 /r ib ] AVX512,FUTURE
+VGETMANTSD xmmreg|mask|z,xmmreg,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 27 /r ib ] AVX512,FUTURE
+VGETMANTSS xmmreg|mask|z,xmmreg,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 27 /r ib ] AVX512,FUTURE
+VINSERTF32X4 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.256.66.0f3a.w0 18 /r ib ] AVX512VL,AVX512,FUTURE
+VINSERTF32X4 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w0 18 /r ib ] AVX512,FUTURE
+VINSERTF32X8 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t8: evex.nds.512.66.0f3a.w0 1a /r ib ] AVX512DQ,FUTURE
+VINSERTF64X2 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.256.66.0f3a.w1 18 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VINSERTF64X2 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.512.66.0f3a.w1 18 /r ib ] AVX512DQ,FUTURE
+VINSERTF64X4 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w1 1a /r ib ] AVX512,FUTURE
+VINSERTI32X4 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.256.66.0f3a.w0 38 /r ib ] AVX512VL,AVX512,FUTURE
+VINSERTI32X4 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w0 38 /r ib ] AVX512,FUTURE
+VINSERTI32X8 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t8: evex.nds.512.66.0f3a.w0 3a /r ib ] AVX512DQ,FUTURE
+VINSERTI64X2 ymmreg|mask|z,ymmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.256.66.0f3a.w1 38 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VINSERTI64X2 zmmreg|mask|z,zmmreg*,xmmrm128,imm8 [rvmi:t2: evex.nds.512.66.0f3a.w1 38 /r ib ] AVX512DQ,FUTURE
+VINSERTI64X4 zmmreg|mask|z,zmmreg*,ymmrm256,imm8 [rvmi:t4: evex.nds.512.66.0f3a.w1 3a /r ib ] AVX512,FUTURE
+VINSERTPS xmmreg,xmmreg*,xmmrm32,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 21 /r ib ] AVX512,FUTURE
+VMAXPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5f /r ] AVX512VL,AVX512,FUTURE
+VMAXPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5f /r ] AVX512VL,AVX512,FUTURE
+VMAXPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae [rvm:fv: evex.nds.512.66.0f.w1 5f /r ] AVX512,FUTURE
+VMAXPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5f /r ] AVX512VL,AVX512,FUTURE
+VMAXPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5f /r ] AVX512VL,AVX512,FUTURE
+VMAXPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae [rvm:fv: evex.nds.512.0f.w0 5f /r ] AVX512,FUTURE
+VMAXSD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.f2.0f.w1 5f /r ] AVX512,FUTURE
+VMAXSS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5f /r ] AVX512,FUTURE
+VMINPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5d /r ] AVX512VL,AVX512,FUTURE
+VMINPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5d /r ] AVX512VL,AVX512,FUTURE
+VMINPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae [rvm:fv: evex.nds.512.66.0f.w1 5d /r ] AVX512,FUTURE
+VMINPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5d /r ] AVX512VL,AVX512,FUTURE
+VMINPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5d /r ] AVX512VL,AVX512,FUTURE
+VMINPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae [rvm:fv: evex.nds.512.0f.w0 5d /r ] AVX512,FUTURE
+VMINSD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.f2.0f.w1 5d /r ] AVX512,FUTURE
+VMINSS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.f3.0f.w0 5d /r ] AVX512,FUTURE
+VMOVAPD xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 28 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 28 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 28 /r ] AVX512,FUTURE
+VMOVAPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f.w1 29 /r ] AVX512,FUTURE
+VMOVAPD mem128|mask,xmmreg [mr:fvm: evex.128.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD mem256|mask,ymmreg [mr:fvm: evex.256.66.0f.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPD mem512|mask,zmmreg [mr:fvm: evex.512.66.0f.w1 29 /r ] AVX512,FUTURE
+VMOVAPS xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.0f.w0 28 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.0f.w0 28 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.0f.w0 28 /r ] AVX512,FUTURE
+VMOVAPS xmmreg|mask|z,xmmreg [mr: evex.128.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS ymmreg|mask|z,ymmreg [mr: evex.256.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS zmmreg|mask|z,zmmreg [mr: evex.512.0f.w0 29 /r ] AVX512,FUTURE
+VMOVAPS mem128|mask,xmmreg [mr:fvm: evex.128.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS mem256|mask,ymmreg [mr:fvm: evex.256.0f.w0 29 /r ] AVX512VL,AVX512,FUTURE
+VMOVAPS mem512|mask,zmmreg [mr:fvm: evex.512.0f.w0 29 /r ] AVX512,FUTURE
+VMOVD xmmreg,rm32 [rm:t1s: evex.128.66.0f.w0 6e /r ] AVX512,FUTURE
+VMOVD rm32,xmmreg [mr:t1s: evex.128.66.0f.w0 7e /r ] AVX512,FUTURE
+VMOVDDUP xmmreg|mask|z,xmmrm64 [rm:dup: evex.128.f2.0f.w1 12 /r ] AVX512VL,AVX512,FUTURE
+VMOVDDUP ymmreg|mask|z,ymmrm256 [rm:dup: evex.256.f2.0f.w1 12 /r ] AVX512VL,AVX512,FUTURE
+VMOVDDUP zmmreg|mask|z,zmmrm512 [rm:dup: evex.512.f2.0f.w1 12 /r ] AVX512,FUTURE
+VMOVDQA32 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA32 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA32 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w0 6f /r ] AVX512,FUTURE
+VMOVDQA32 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.66.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA32 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.66.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA32 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.66.0f.w0 7f /r ] AVX512,FUTURE
+VMOVDQA64 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA64 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA64 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 6f /r ] AVX512,FUTURE
+VMOVDQA64 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.66.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA64 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.66.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQA64 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.66.0f.w1 7f /r ] AVX512,FUTURE
+VMOVDQU16 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f2.0f.w1 6f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU16 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f2.0f.w1 6f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU16 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f2.0f.w1 6f /r ] AVX512BW,FUTURE
+VMOVDQU16 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f2.0f.w1 7f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU16 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f2.0f.w1 7f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU16 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f2.0f.w1 7f /r ] AVX512BW,FUTURE
+VMOVDQU32 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU32 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU32 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 6f /r ] AVX512,FUTURE
+VMOVDQU32 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f3.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU32 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f3.0f.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU32 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f3.0f.w0 7f /r ] AVX512,FUTURE
+VMOVDQU64 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU64 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w1 6f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU64 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w1 6f /r ] AVX512,FUTURE
+VMOVDQU64 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f3.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU64 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f3.0f.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VMOVDQU64 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f3.0f.w1 7f /r ] AVX512,FUTURE
+VMOVDQU8 xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f2.0f.w0 6f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU8 ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f2.0f.w0 6f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU8 zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f2.0f.w0 6f /r ] AVX512BW,FUTURE
+VMOVDQU8 xmmrm128|mask|z,xmmreg [mr:fvm: evex.128.f2.0f.w0 7f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU8 ymmrm256|mask|z,ymmreg [mr:fvm: evex.256.f2.0f.w0 7f /r ] AVX512VL,AVX512BW,FUTURE
+VMOVDQU8 zmmrm512|mask|z,zmmreg [mr:fvm: evex.512.f2.0f.w0 7f /r ] AVX512BW,FUTURE
+VMOVHLPS xmmreg,xmmreg*,xmmreg [rvm: evex.nds.128.0f.w0 12 /r ] AVX512,FUTURE
+VMOVHPD xmmreg,xmmreg*,mem64 [rvm:t1s: evex.nds.128.66.0f.w1 16 /r ] AVX512,FUTURE
+VMOVHPD mem64,xmmreg [mr:t1s: evex.128.66.0f.w1 17 /r ] AVX512,FUTURE
+VMOVHPS xmmreg,xmmreg*,mem64 [rvm:t2: evex.nds.128.0f.w0 16 /r ] AVX512,FUTURE
+VMOVHPS mem64,xmmreg [mr:t2: evex.128.0f.w0 17 /r ] AVX512,FUTURE
+VMOVLHPS xmmreg,xmmreg*,xmmreg [rvm: evex.nds.128.0f.w0 16 /r ] AVX512,FUTURE
+VMOVLPD xmmreg,xmmreg*,mem64 [rvm:t1s: evex.nds.128.66.0f.w1 12 /r ] AVX512,FUTURE
+VMOVLPD mem64,xmmreg [mr:t1s: evex.128.66.0f.w1 13 /r ] AVX512,FUTURE
+VMOVLPS xmmreg,xmmreg*,mem64 [rvm:t2: evex.nds.128.0f.w0 12 /r ] AVX512,FUTURE
+VMOVLPS mem64,xmmreg [mr:t2: evex.128.0f.w0 13 /r ] AVX512,FUTURE
+VMOVNTDQ mem128,xmmreg [mr:fvm: evex.128.66.0f.w0 e7 /r ] AVX512VL,AVX512,FUTURE
+VMOVNTDQ mem256,ymmreg [mr:fvm: evex.256.66.0f.w0 e7 /r ] AVX512VL,AVX512,FUTURE
+VMOVNTDQ mem512,zmmreg [mr:fvm: evex.512.66.0f.w0 e7 /r ] AVX512,FUTURE
+VMOVNTDQA xmmreg,mem128 [rm:fvm: evex.128.66.0f38.w0 2a /r ] AVX512VL,AVX512,FUTURE
+VMOVNTDQA ymmreg,mem256 [rm:fvm: evex.256.66.0f38.w0 2a /r ] AVX512VL,AVX512,FUTURE
+VMOVNTDQA zmmreg,mem512 [rm:fvm: evex.512.66.0f38.w0 2a /r ] AVX512,FUTURE
+VMOVNTPD mem128,xmmreg [mr:fvm: evex.128.66.0f.w1 2b /r ] AVX512VL,AVX512,FUTURE
+VMOVNTPD mem256,ymmreg [mr:fvm: evex.256.66.0f.w1 2b /r ] AVX512VL,AVX512,FUTURE
+VMOVNTPD mem512,zmmreg [mr:fvm: evex.512.66.0f.w1 2b /r ] AVX512,FUTURE
+VMOVNTPS mem128,xmmreg [mr:fvm: evex.128.0f.w0 2b /r ] AVX512VL,AVX512,FUTURE
+VMOVNTPS mem256,ymmreg [mr:fvm: evex.256.0f.w0 2b /r ] AVX512VL,AVX512,FUTURE
+VMOVNTPS mem512,zmmreg [mr:fvm: evex.512.0f.w0 2b /r ] AVX512,FUTURE
+VMOVQ xmmreg,rm64 [rm:t1s: evex.128.66.0f.w1 6e /r ] AVX512,FUTURE
+VMOVQ rm64,xmmreg [mr:t1s: evex.128.66.0f.w1 7e /r ] AVX512,FUTURE
+VMOVQ xmmreg,xmmrm64 [rm:t1s: evex.128.f3.0f.w1 7e /r ] AVX512,FUTURE
+VMOVQ xmmrm64,xmmreg [mr:t1s: evex.128.66.0f.w1 d6 /r ] AVX512,FUTURE
+VMOVSD xmmreg|mask|z,mem64 [rm:t1s: evex.128.f2.0f.w1 10 /r ] AVX512,FUTURE
+VMOVSD mem64|mask,xmmreg [mr:t1s: evex.128.f2.0f.w1 11 /r ] AVX512,FUTURE
+VMOVSD xmmreg|mask|z,xmmreg*,xmmreg [rvm: evex.nds.128.f2.0f.w1 10 /r ] AVX512,FUTURE
+VMOVSD xmmreg|mask|z,xmmreg*,xmmreg [mvr: evex.nds.128.f2.0f.w1 11 /r ] AVX512,FUTURE
+VMOVSHDUP xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 16 /r ] AVX512VL,AVX512,FUTURE
+VMOVSHDUP ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 16 /r ] AVX512VL,AVX512,FUTURE
+VMOVSHDUP zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 16 /r ] AVX512,FUTURE
+VMOVSLDUP xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.f3.0f.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VMOVSLDUP ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.f3.0f.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VMOVSLDUP zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.f3.0f.w0 12 /r ] AVX512,FUTURE
+VMOVSS xmmreg|mask|z,mem32 [rm:t1s: evex.128.f3.0f.w0 10 /r ] AVX512,FUTURE
+VMOVSS mem32|mask,xmmreg [mr:t1s: evex.128.f3.0f.w0 11 /r ] AVX512,FUTURE
+VMOVSS xmmreg|mask|z,xmmreg*,xmmreg [rvm: evex.nds.128.f3.0f.w0 10 /r ] AVX512,FUTURE
+VMOVSS xmmreg|mask|z,xmmreg*,xmmreg [mvr: evex.nds.128.f3.0f.w0 11 /r ] AVX512,FUTURE
+VMOVUPD xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f.w1 10 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f.w1 10 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f.w1 10 /r ] AVX512,FUTURE
+VMOVUPD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f.w1 11 /r ] AVX512,FUTURE
+VMOVUPD mem128|mask,xmmreg [mr:fvm: evex.128.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD mem256|mask,ymmreg [mr:fvm: evex.256.66.0f.w1 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPD mem512|mask,zmmreg [mr:fvm: evex.512.66.0f.w1 11 /r ] AVX512,FUTURE
+VMOVUPS xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.0f.w0 10 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.0f.w0 10 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.0f.w0 10 /r ] AVX512,FUTURE
+VMOVUPS xmmreg|mask|z,xmmreg [mr: evex.128.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS ymmreg|mask|z,ymmreg [mr: evex.256.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS zmmreg|mask|z,zmmreg [mr: evex.512.0f.w0 11 /r ] AVX512,FUTURE
+VMOVUPS mem128|mask,xmmreg [mr:fvm: evex.128.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS mem256|mask,ymmreg [mr:fvm: evex.256.0f.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VMOVUPS mem512|mask,zmmreg [mr:fvm: evex.512.0f.w0 11 /r ] AVX512,FUTURE
+VMULPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VMULPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VMULPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 59 /r ] AVX512,FUTURE
+VMULPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 59 /r ] AVX512VL,AVX512,FUTURE
+VMULPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 59 /r ] AVX512VL,AVX512,FUTURE
+VMULPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 59 /r ] AVX512,FUTURE
+VMULSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 59 /r ] AVX512,FUTURE
+VMULSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 59 /r ] AVX512,FUTURE
+VORPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 56 /r ] AVX512VL,AVX512DQ,FUTURE
+VORPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 56 /r ] AVX512VL,AVX512DQ,FUTURE
+VORPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 56 /r ] AVX512DQ,FUTURE
+VORPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 56 /r ] AVX512VL,AVX512DQ,FUTURE
+VORPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 56 /r ] AVX512VL,AVX512DQ,FUTURE
+VORPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 56 /r ] AVX512DQ,FUTURE
+VPABSB xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f38.wig 1c /r ] AVX512VL,AVX512BW,FUTURE
+VPABSB ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f38.wig 1c /r ] AVX512VL,AVX512BW,FUTURE
+VPABSB zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f38.wig 1c /r ] AVX512BW,FUTURE
+VPABSD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 1e /r ] AVX512VL,AVX512,FUTURE
+VPABSD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 1e /r ] AVX512VL,AVX512,FUTURE
+VPABSD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 1e /r ] AVX512,FUTURE
+VPABSQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 1f /r ] AVX512VL,AVX512,FUTURE
+VPABSQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 1f /r ] AVX512VL,AVX512,FUTURE
+VPABSQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 1f /r ] AVX512,FUTURE
+VPABSW xmmreg|mask|z,xmmrm128 [rm:fvm: evex.128.66.0f38.wig 1d /r ] AVX512VL,AVX512BW,FUTURE
+VPABSW ymmreg|mask|z,ymmrm256 [rm:fvm: evex.256.66.0f38.wig 1d /r ] AVX512VL,AVX512BW,FUTURE
+VPABSW zmmreg|mask|z,zmmrm512 [rm:fvm: evex.512.66.0f38.wig 1d /r ] AVX512BW,FUTURE
+VPACKSSDW xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 6b /r ] AVX512VL,AVX512BW,FUTURE
+VPACKSSDW ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 6b /r ] AVX512VL,AVX512BW,FUTURE
+VPACKSSDW zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 6b /r ] AVX512BW,FUTURE
+VPACKSSWB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 63 /r ] AVX512VL,AVX512BW,FUTURE
+VPACKSSWB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 63 /r ] AVX512VL,AVX512BW,FUTURE
+VPACKSSWB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 63 /r ] AVX512BW,FUTURE
+VPACKUSDW xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 2b /r ] AVX512VL,AVX512BW,FUTURE
+VPACKUSDW ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 2b /r ] AVX512VL,AVX512BW,FUTURE
+VPACKUSDW zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 2b /r ] AVX512BW,FUTURE
+VPACKUSWB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 67 /r ] AVX512VL,AVX512BW,FUTURE
+VPACKUSWB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 67 /r ] AVX512VL,AVX512BW,FUTURE
+VPACKUSWB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 67 /r ] AVX512BW,FUTURE
+VPADDB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig fc /r ] AVX512VL,AVX512BW,FUTURE
+VPADDB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig fc /r ] AVX512VL,AVX512BW,FUTURE
+VPADDB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig fc /r ] AVX512BW,FUTURE
+VPADDD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 fe /r ] AVX512VL,AVX512,FUTURE
+VPADDD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 fe /r ] AVX512VL,AVX512,FUTURE
+VPADDD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 fe /r ] AVX512,FUTURE
+VPADDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 d4 /r ] AVX512VL,AVX512,FUTURE
+VPADDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 d4 /r ] AVX512VL,AVX512,FUTURE
+VPADDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 d4 /r ] AVX512,FUTURE
+VPADDSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ec /r ] AVX512VL,AVX512BW,FUTURE
+VPADDSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ec /r ] AVX512VL,AVX512BW,FUTURE
+VPADDSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ec /r ] AVX512BW,FUTURE
+VPADDSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ed /r ] AVX512VL,AVX512BW,FUTURE
+VPADDSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ed /r ] AVX512VL,AVX512BW,FUTURE
+VPADDSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ed /r ] AVX512BW,FUTURE
+VPADDUSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig dc /r ] AVX512VL,AVX512BW,FUTURE
+VPADDUSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig dc /r ] AVX512VL,AVX512BW,FUTURE
+VPADDUSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig dc /r ] AVX512BW,FUTURE
+VPADDUSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig dd /r ] AVX512VL,AVX512BW,FUTURE
+VPADDUSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig dd /r ] AVX512VL,AVX512BW,FUTURE
+VPADDUSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig dd /r ] AVX512BW,FUTURE
+VPADDW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig fd /r ] AVX512VL,AVX512BW,FUTURE
+VPADDW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig fd /r ] AVX512VL,AVX512BW,FUTURE
+VPADDW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig fd /r ] AVX512BW,FUTURE
+VPALIGNR xmmreg|mask|z,xmmreg*,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.wig 0f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPALIGNR ymmreg|mask|z,ymmreg*,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.wig 0f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPALIGNR zmmreg|mask|z,zmmreg*,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.wig 0f /r ib ] AVX512BW,FUTURE
+VPANDD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 db /r ] AVX512VL,AVX512,FUTURE
+VPANDD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 db /r ] AVX512VL,AVX512,FUTURE
+VPANDD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 db /r ] AVX512,FUTURE
+VPANDND xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 df /r ] AVX512VL,AVX512,FUTURE
+VPANDND ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 df /r ] AVX512VL,AVX512,FUTURE
+VPANDND zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 df /r ] AVX512,FUTURE
+VPANDNQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 df /r ] AVX512VL,AVX512,FUTURE
+VPANDNQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 df /r ] AVX512VL,AVX512,FUTURE
+VPANDNQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 df /r ] AVX512,FUTURE
+VPANDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 db /r ] AVX512VL,AVX512,FUTURE
+VPANDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 db /r ] AVX512VL,AVX512,FUTURE
+VPANDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 db /r ] AVX512,FUTURE
+VPAVGB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e0 /r ] AVX512VL,AVX512BW,FUTURE
+VPAVGB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e0 /r ] AVX512VL,AVX512BW,FUTURE
+VPAVGB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e0 /r ] AVX512BW,FUTURE
+VPAVGW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e3 /r ] AVX512VL,AVX512BW,FUTURE
+VPAVGW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e3 /r ] AVX512VL,AVX512BW,FUTURE
+VPAVGW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e3 /r ] AVX512BW,FUTURE
+VPBLENDMB xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 66 /r ] AVX512VL,AVX512BW,FUTURE
+VPBLENDMB ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 66 /r ] AVX512VL,AVX512BW,FUTURE
+VPBLENDMB zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 66 /r ] AVX512BW,FUTURE
+VPBLENDMD xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 64 /r ] AVX512VL,AVX512,FUTURE
+VPBLENDMD ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 64 /r ] AVX512VL,AVX512,FUTURE
+VPBLENDMD zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 64 /r ] AVX512,FUTURE
+VPBLENDMQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 64 /r ] AVX512VL,AVX512,FUTURE
+VPBLENDMQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 64 /r ] AVX512VL,AVX512,FUTURE
+VPBLENDMQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 64 /r ] AVX512,FUTURE
+VPBLENDMW xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 66 /r ] AVX512VL,AVX512BW,FUTURE
+VPBLENDMW ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 66 /r ] AVX512VL,AVX512BW,FUTURE
+VPBLENDMW zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 66 /r ] AVX512BW,FUTURE
+VPBROADCASTB xmmreg|mask|z,xmmrm8 [rm:t1s8: evex.128.66.0f38.w0 78 /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB ymmreg|mask|z,xmmrm8 [rm:t1s8: evex.256.66.0f38.w0 78 /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB zmmreg|mask|z,xmmrm8 [rm:t1s8: evex.512.66.0f38.w0 78 /r ] AVX512BW,FUTURE
+VPBROADCASTB xmmreg|mask|z,reg8 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB xmmreg|mask|z,reg16 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB ymmreg|mask|z,reg8 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB ymmreg|mask|z,reg16 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w0 7a /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTB zmmreg|mask|z,reg8 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
+VPBROADCASTB zmmreg|mask|z,reg16 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
+VPBROADCASTB zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
+VPBROADCASTB zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w0 7a /r ] AVX512BW,FUTURE
+VPBROADCASTD xmmreg|mask|z,mem32 [rm:t1s: evex.128.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD ymmreg|mask|z,mem32 [rm:t1s: evex.256.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD zmmreg|mask|z,mem32 [rm:t1s: evex.512.66.0f38.w0 58 /r ] AVX512,FUTURE
+VPBROADCASTD xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w0 58 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w0 58 /r ] AVX512,FUTURE
+VPBROADCASTD xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7c /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7c /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTD zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7c /r ] AVX512,FUTURE
+VPBROADCASTMB2Q xmmreg,kreg [rm: evex.128.f3.0f38.w1 2a /r ] AVX512VL,AVX512CD,FUTURE
+VPBROADCASTMB2Q ymmreg,kreg [rm: evex.256.f3.0f38.w1 2a /r ] AVX512VL,AVX512CD,FUTURE
+VPBROADCASTMB2Q zmmreg,kreg [rm: evex.512.f3.0f38.w1 2a /r ] AVX512CD,FUTURE
+VPBROADCASTMW2D xmmreg,kreg [rm: evex.128.f3.0f38.w0 3a /r ] AVX512VL,AVX512CD,FUTURE
+VPBROADCASTMW2D ymmreg,kreg [rm: evex.256.f3.0f38.w0 3a /r ] AVX512VL,AVX512CD,FUTURE
+VPBROADCASTMW2D zmmreg,kreg [rm: evex.512.f3.0f38.w0 3a /r ] AVX512CD,FUTURE
+VPBROADCASTQ xmmreg|mask|z,mem64 [rm:t1s: evex.128.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ ymmreg|mask|z,mem64 [rm:t1s: evex.256.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ zmmreg|mask|z,mem64 [rm:t1s: evex.512.66.0f38.w1 59 /r ] AVX512,FUTURE
+VPBROADCASTQ xmmreg|mask|z,xmmreg [rm: evex.128.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ ymmreg|mask|z,xmmreg [rm: evex.256.66.0f38.w1 59 /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ zmmreg|mask|z,xmmreg [rm: evex.512.66.0f38.w1 59 /r ] AVX512,FUTURE
+VPBROADCASTQ xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w1 7c /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w1 7c /r ] AVX512VL,AVX512,FUTURE
+VPBROADCASTQ zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w1 7c /r ] AVX512,FUTURE
+VPBROADCASTW xmmreg|mask|z,xmmrm16 [rm:t1s16: evex.128.66.0f38.w0 79 /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW ymmreg|mask|z,xmmrm16 [rm:t1s16: evex.256.66.0f38.w0 79 /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW zmmreg|mask|z,xmmrm16 [rm:t1s16: evex.512.66.0f38.w0 79 /r ] AVX512BW,FUTURE
+VPBROADCASTW xmmreg|mask|z,reg16 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW xmmreg|mask|z,reg32 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW xmmreg|mask|z,reg64 [rm: evex.128.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW ymmreg|mask|z,reg16 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW ymmreg|mask|z,reg32 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW ymmreg|mask|z,reg64 [rm: evex.256.66.0f38.w0 7b /r ] AVX512VL,AVX512BW,FUTURE
+VPBROADCASTW zmmreg|mask|z,reg16 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
+VPBROADCASTW zmmreg|mask|z,reg32 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
+VPBROADCASTW zmmreg|mask|z,reg64 [rm: evex.512.66.0f38.w0 7b /r ] AVX512BW,FUTURE
+VPCMPB kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 3f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPB kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 3f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPB kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 3f /r ib ] AVX512BW,FUTURE
+VPCMPD kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 1f /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPD kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 1f /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPD kreg|mask,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 1f /r ib ] AVX512,FUTURE
+VPCMPEQB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 74 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPEQB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 74 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPEQB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 74 /r ] AVX512BW,FUTURE
+VPCMPEQD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 76 /r ] AVX512VL,AVX512,FUTURE
+VPCMPEQD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 76 /r ] AVX512VL,AVX512,FUTURE
+VPCMPEQD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 76 /r ] AVX512,FUTURE
+VPCMPEQQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VPCMPEQQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 29 /r ] AVX512VL,AVX512,FUTURE
+VPCMPEQQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 29 /r ] AVX512,FUTURE
+VPCMPEQW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 75 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPEQW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 75 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPEQW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 75 /r ] AVX512BW,FUTURE
+VPCMPGTB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 64 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPGTB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 64 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPGTB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 64 /r ] AVX512BW,FUTURE
+VPCMPGTD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 66 /r ] AVX512VL,AVX512,FUTURE
+VPCMPGTD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 66 /r ] AVX512VL,AVX512,FUTURE
+VPCMPGTD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 66 /r ] AVX512,FUTURE
+VPCMPGTQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 37 /r ] AVX512VL,AVX512,FUTURE
+VPCMPGTQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 37 /r ] AVX512VL,AVX512,FUTURE
+VPCMPGTQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 37 /r ] AVX512,FUTURE
+VPCMPGTW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 65 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPGTW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 65 /r ] AVX512VL,AVX512BW,FUTURE
+VPCMPGTW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 65 /r ] AVX512BW,FUTURE
+VPCMPQ kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 1f /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPQ kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 1f /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPQ kreg|mask,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 1f /r ib ] AVX512,FUTURE
+VPCMPUB kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w0 3e /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPUB kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w0 3e /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPUB kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w0 3e /r ib ] AVX512BW,FUTURE
+VPCMPUD kreg|mask,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 1e /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPUD kreg|mask,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 1e /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPUD kreg|mask,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 1e /r ib ] AVX512,FUTURE
+VPCMPUQ kreg|mask,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 1e /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPUQ kreg|mask,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 1e /r ib ] AVX512VL,AVX512,FUTURE
+VPCMPUQ kreg|mask,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 1e /r ib ] AVX512,FUTURE
+VPCMPUW kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w1 3e /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPUW kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w1 3e /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPUW kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w1 3e /r ib ] AVX512BW,FUTURE
+VPCMPW kreg|mask,xmmreg,xmmrm128,imm8 [rvmi:fvm: evex.nds.128.66.0f3a.w1 3f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPW kreg|mask,ymmreg,ymmrm256,imm8 [rvmi:fvm: evex.nds.256.66.0f3a.w1 3f /r ib ] AVX512VL,AVX512BW,FUTURE
+VPCMPW kreg|mask,zmmreg,zmmrm512,imm8 [rvmi:fvm: evex.nds.512.66.0f3a.w1 3f /r ib ] AVX512BW,FUTURE
+VPCOMPRESSD mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSD mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSD mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w0 8b /r ] AVX512,FUTURE
+VPCOMPRESSD xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSD ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w0 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSD zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w0 8b /r ] AVX512,FUTURE
+VPCOMPRESSQ mem128|mask,xmmreg [mr:t1s: evex.128.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSQ mem256|mask,ymmreg [mr:t1s: evex.256.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSQ mem512|mask,zmmreg [mr:t1s: evex.512.66.0f38.w1 8b /r ] AVX512,FUTURE
+VPCOMPRESSQ xmmreg|mask|z,xmmreg [mr: evex.128.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSQ ymmreg|mask|z,ymmreg [mr: evex.256.66.0f38.w1 8b /r ] AVX512VL,AVX512,FUTURE
+VPCOMPRESSQ zmmreg|mask|z,zmmreg [mr: evex.512.66.0f38.w1 8b /r ] AVX512,FUTURE
+VPCONFLICTD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 c4 /r ] AVX512VL,AVX512CD,FUTURE
+VPCONFLICTD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 c4 /r ] AVX512VL,AVX512CD,FUTURE
+VPCONFLICTD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 c4 /r ] AVX512CD,FUTURE
+VPCONFLICTQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 c4 /r ] AVX512VL,AVX512CD,FUTURE
+VPCONFLICTQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 c4 /r ] AVX512VL,AVX512CD,FUTURE
+VPCONFLICTQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 c4 /r ] AVX512CD,FUTURE
+VPERMB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 8d /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 8d /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 8d /r ] AVX512VBMI,FUTURE
+VPERMD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 36 /r ] AVX512VL,AVX512,FUTURE
+VPERMD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 36 /r ] AVX512,FUTURE
+VPERMI2B xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 75 /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMI2B ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 75 /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMI2B zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 75 /r ] AVX512VBMI,FUTURE
+VPERMI2D xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 76 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2D ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 76 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2D zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 76 /r ] AVX512,FUTURE
+VPERMI2PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 77 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 77 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2PD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 77 /r ] AVX512,FUTURE
+VPERMI2PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 77 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 77 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2PS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 77 /r ] AVX512,FUTURE
+VPERMI2Q xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 76 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2Q ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 76 /r ] AVX512VL,AVX512,FUTURE
+VPERMI2Q zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 76 /r ] AVX512,FUTURE
+VPERMI2W xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 75 /r ] AVX512VL,AVX512BW,FUTURE
+VPERMI2W ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 75 /r ] AVX512VL,AVX512BW,FUTURE
+VPERMI2W zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 75 /r ] AVX512BW,FUTURE
+VPERMILPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 05 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMILPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 05 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMILPD zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 05 /r ib ] AVX512,FUTURE
+VPERMILPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 0d /r ] AVX512VL,AVX512,FUTURE
+VPERMILPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 0d /r ] AVX512VL,AVX512,FUTURE
+VPERMILPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 0d /r ] AVX512,FUTURE
+VPERMILPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 04 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMILPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 04 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMILPS zmmreg|mask|z,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f3a.w0 04 /r ib ] AVX512,FUTURE
+VPERMILPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 0c /r ] AVX512VL,AVX512,FUTURE
+VPERMILPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 0c /r ] AVX512VL,AVX512,FUTURE
+VPERMILPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 0c /r ] AVX512,FUTURE
+VPERMPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 01 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMPD zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 01 /r ib ] AVX512,FUTURE
+VPERMPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 16 /r ] AVX512VL,AVX512,FUTURE
+VPERMPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 16 /r ] AVX512,FUTURE
+VPERMPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 16 /r ] AVX512VL,AVX512,FUTURE
+VPERMPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 16 /r ] AVX512,FUTURE
+VPERMQ ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 00 /r ib ] AVX512VL,AVX512,FUTURE
+VPERMQ zmmreg|mask|z,zmmrm512|b64,imm8 [rmi:fv: evex.512.66.0f3a.w1 00 /r ib ] AVX512,FUTURE
+VPERMQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 36 /r ] AVX512VL,AVX512,FUTURE
+VPERMQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 36 /r ] AVX512,FUTURE
+VPERMT2B xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 7d /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMT2B ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 7d /r ] AVX512VL,AVX512VBMI,FUTURE
+VPERMT2B zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 7d /r ] AVX512VBMI,FUTURE
+VPERMT2D xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 7e /r ] AVX512VL,AVX512,FUTURE
+VPERMT2D ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 7e /r ] AVX512VL,AVX512,FUTURE
+VPERMT2D zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 7e /r ] AVX512,FUTURE
+VPERMT2PD xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VPERMT2PD ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 7f /r ] AVX512VL,AVX512,FUTURE
+VPERMT2PD zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 7f /r ] AVX512,FUTURE
+VPERMT2PS xmmreg|mask|z,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VPERMT2PS ymmreg|mask|z,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 7f /r ] AVX512VL,AVX512,FUTURE
+VPERMT2PS zmmreg|mask|z,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 7f /r ] AVX512,FUTURE
+VPERMT2Q xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 7e /r ] AVX512VL,AVX512,FUTURE
+VPERMT2Q ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 7e /r ] AVX512VL,AVX512,FUTURE
+VPERMT2Q zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 7e /r ] AVX512,FUTURE
+VPERMT2W xmmreg|mask|z,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 7d /r ] AVX512VL,AVX512BW,FUTURE
+VPERMT2W ymmreg|mask|z,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 7d /r ] AVX512VL,AVX512BW,FUTURE
+VPERMT2W zmmreg|mask|z,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 7d /r ] AVX512BW,FUTURE
+VPERMW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 8d /r ] AVX512VL,AVX512BW,FUTURE
+VPERMW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 8d /r ] AVX512VL,AVX512BW,FUTURE
+VPERMW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 8d /r ] AVX512BW,FUTURE
+VPEXPANDD xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDD ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDD zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w0 89 /r ] AVX512,FUTURE
+VPEXPANDD xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDD ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w0 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDD zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w0 89 /r ] AVX512,FUTURE
+VPEXPANDQ xmmreg|mask|z,mem128 [rm:t1s: evex.128.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDQ ymmreg|mask|z,mem256 [rm:t1s: evex.256.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDQ zmmreg|mask|z,mem512 [rm:t1s: evex.512.66.0f38.w1 89 /r ] AVX512,FUTURE
+VPEXPANDQ xmmreg|mask|z,xmmreg [rm:t1s: evex.128.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDQ ymmreg|mask|z,ymmreg [rm:t1s: evex.256.66.0f38.w1 89 /r ] AVX512VL,AVX512,FUTURE
+VPEXPANDQ zmmreg|mask|z,zmmreg [rm:t1s: evex.512.66.0f38.w1 89 /r ] AVX512,FUTURE
+VPEXTRB reg8,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
+VPEXTRB reg16,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
+VPEXTRB reg32,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
+VPEXTRB reg64,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
+VPEXTRB mem8,xmmreg,imm8 [mri:t1s8: evex.128.66.0f3a.wig 14 /r ib ] AVX512BW,FUTURE
+VPEXTRD rm32,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.w0 16 /r ib ] AVX512DQ,FUTURE
+VPEXTRQ rm64,xmmreg,imm8 [mri:t1s: evex.128.66.0f3a.w1 16 /r ib ] AVX512DQ,FUTURE
+VPEXTRW reg16,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
+VPEXTRW reg32,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
+VPEXTRW reg64,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
+VPEXTRW mem16,xmmreg,imm8 [mri:t1s16: evex.128.66.0f3a.wig 15 /r ib ] AVX512BW,FUTURE
+VPEXTRW reg16,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
+VPEXTRW reg32,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
+VPEXTRW reg64,xmmreg,imm8 [rmi: evex.128.66.0f.wig c5 /r ib ] AVX512BW,FUTURE
+VPGATHERDD xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 90 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERDD ymmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 90 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERDD zmmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 90 /r ] AVX512,FUTURE
+VPGATHERDQ xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 90 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERDQ ymmreg|mask,xmem64 [rm:t1s: vsibx evex.256.66.0f38.w1 90 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERDQ zmmreg|mask,ymem64 [rm:t1s: vsiby evex.512.66.0f38.w1 90 /r ] AVX512,FUTURE
+VPGATHERQD xmmreg|mask,xmem32 [rm:t1s: vsibx evex.128.66.0f38.w0 91 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERQD xmmreg|mask,ymem32 [rm:t1s: vsiby evex.256.66.0f38.w0 91 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERQD ymmreg|mask,zmem32 [rm:t1s: vsibz evex.512.66.0f38.w0 91 /r ] AVX512,FUTURE
+VPGATHERQQ xmmreg|mask,xmem64 [rm:t1s: vsibx evex.128.66.0f38.w1 91 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERQQ ymmreg|mask,ymem64 [rm:t1s: vsiby evex.256.66.0f38.w1 91 /r ] AVX512VL,AVX512,FUTURE
+VPGATHERQQ zmmreg|mask,zmem64 [rm:t1s: vsibz evex.512.66.0f38.w1 91 /r ] AVX512,FUTURE
+VPINSRB xmmreg,xmmreg*,reg32,imm8 [rvmi:t1s8: evex.nds.128.66.0f3a.wig 20 /r ib ] AVX512BW,FUTURE
+VPINSRB xmmreg,xmmreg*,mem8,imm8 [rvmi:t1s8: evex.nds.128.66.0f3a.wig 20 /r ib ] AVX512BW,FUTURE
+VPINSRD xmmreg,xmmreg*,rm32,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 22 /r ib ] AVX512DQ,FUTURE
+VPINSRQ xmmreg,xmmreg*,rm64,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 22 /r ib ] AVX512DQ,FUTURE
+VPINSRW xmmreg,xmmreg*,reg32,imm8 [rvmi:t1s16: evex.nds.128.66.0f.wig c4 /r ib ] AVX512BW,FUTURE
+VPINSRW xmmreg,xmmreg*,mem16,imm8 [rvmi:t1s16: evex.nds.128.66.0f.wig c4 /r ib ] AVX512BW,FUTURE
+VPLZCNTD xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 44 /r ] AVX512VL,AVX512CD,FUTURE
+VPLZCNTD ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 44 /r ] AVX512VL,AVX512CD,FUTURE
+VPLZCNTD zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 44 /r ] AVX512CD,FUTURE
+VPLZCNTQ xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 44 /r ] AVX512VL,AVX512CD,FUTURE
+VPLZCNTQ ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 44 /r ] AVX512VL,AVX512CD,FUTURE
+VPLZCNTQ zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 44 /r ] AVX512CD,FUTURE
+VPMADD52HUQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b5 /r ] AVX512VL,AVX512IFMA,FUTURE
+VPMADD52HUQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b5 /r ] AVX512VL,AVX512IFMA,FUTURE
+VPMADD52HUQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 b5 /r ] AVX512IFMA,FUTURE
+VPMADD52LUQ xmmreg|mask|z,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 b4 /r ] AVX512VL,AVX512IFMA,FUTURE
+VPMADD52LUQ ymmreg|mask|z,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 b4 /r ] AVX512VL,AVX512IFMA,FUTURE
+VPMADD52LUQ zmmreg|mask|z,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 b4 /r ] AVX512IFMA,FUTURE
+VPMADDUBSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 04 /r ] AVX512VL,AVX512BW,FUTURE
+VPMADDUBSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 04 /r ] AVX512VL,AVX512BW,FUTURE
+VPMADDUBSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 04 /r ] AVX512BW,FUTURE
+VPMADDWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMADDWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMADDWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f5 /r ] AVX512BW,FUTURE
+VPMAXSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3c /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3c /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3c /r ] AVX512BW,FUTURE
+VPMAXSD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3d /r ] AVX512VL,AVX512,FUTURE
+VPMAXSD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3d /r ] AVX512VL,AVX512,FUTURE
+VPMAXSD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3d /r ] AVX512,FUTURE
+VPMAXSQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3d /r ] AVX512VL,AVX512,FUTURE
+VPMAXSQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3d /r ] AVX512VL,AVX512,FUTURE
+VPMAXSQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3d /r ] AVX512,FUTURE
+VPMAXSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ee /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ee /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ee /r ] AVX512BW,FUTURE
+VPMAXUB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig de /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXUB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig de /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXUB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig de /r ] AVX512BW,FUTURE
+VPMAXUD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3f /r ] AVX512VL,AVX512,FUTURE
+VPMAXUD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3f /r ] AVX512VL,AVX512,FUTURE
+VPMAXUD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3f /r ] AVX512,FUTURE
+VPMAXUQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3f /r ] AVX512VL,AVX512,FUTURE
+VPMAXUQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3f /r ] AVX512VL,AVX512,FUTURE
+VPMAXUQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3f /r ] AVX512,FUTURE
+VPMAXUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3e /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3e /r ] AVX512VL,AVX512BW,FUTURE
+VPMAXUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3e /r ] AVX512BW,FUTURE
+VPMINSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 38 /r ] AVX512VL,AVX512BW,FUTURE
+VPMINSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 38 /r ] AVX512VL,AVX512BW,FUTURE
+VPMINSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 38 /r ] AVX512BW,FUTURE
+VPMINSD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 39 /r ] AVX512VL,AVX512,FUTURE
+VPMINSD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 39 /r ] AVX512VL,AVX512,FUTURE
+VPMINSD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 39 /r ] AVX512,FUTURE
+VPMINSQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 39 /r ] AVX512VL,AVX512,FUTURE
+VPMINSQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 39 /r ] AVX512VL,AVX512,FUTURE
+VPMINSQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 39 /r ] AVX512,FUTURE
+VPMINSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig ea /r ] AVX512VL,AVX512BW,FUTURE
+VPMINSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig ea /r ] AVX512VL,AVX512BW,FUTURE
+VPMINSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig ea /r ] AVX512BW,FUTURE
+VPMINUB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig da /r ] AVX512VL,AVX512BW,FUTURE
+VPMINUB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig da /r ] AVX512VL,AVX512BW,FUTURE
+VPMINUB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig da /r ] AVX512BW,FUTURE
+VPMINUD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 3b /r ] AVX512VL,AVX512,FUTURE
+VPMINUD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 3b /r ] AVX512VL,AVX512,FUTURE
+VPMINUD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 3b /r ] AVX512,FUTURE
+VPMINUQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 3b /r ] AVX512VL,AVX512,FUTURE
+VPMINUQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 3b /r ] AVX512VL,AVX512,FUTURE
+VPMINUQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 3b /r ] AVX512,FUTURE
+VPMINUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 3a /r ] AVX512VL,AVX512BW,FUTURE
+VPMINUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 3a /r ] AVX512VL,AVX512BW,FUTURE
+VPMINUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 3a /r ] AVX512BW,FUTURE
+VPMOVB2M kreg,xmmreg [rm: evex.128.f3.0f38.w0 29 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVB2M kreg,ymmreg [rm: evex.256.f3.0f38.w0 29 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVB2M kreg,zmmreg [rm: evex.512.f3.0f38.w0 29 /r ] AVX512BW,FUTURE
+VPMOVD2M kreg,xmmreg [rm: evex.128.f3.0f38.w0 39 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVD2M kreg,ymmreg [rm: evex.256.f3.0f38.w0 39 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVD2M kreg,zmmreg [rm: evex.512.f3.0f38.w0 39 /r ] AVX512DQ,FUTURE
+VPMOVDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 31 /r ] AVX512,FUTURE
+VPMOVDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 31 /r ] AVX512,FUTURE
+VPMOVDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 33 /r ] AVX512,FUTURE
+VPMOVDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 33 /r ] AVX512,FUTURE
+VPMOVM2B xmmreg,kreg [rm: evex.128.f3.0f38.w0 28 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVM2B ymmreg,kreg [rm: evex.256.f3.0f38.w0 28 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVM2B zmmreg,kreg [rm: evex.512.f3.0f38.w0 28 /r ] AVX512BW,FUTURE
+VPMOVM2D xmmreg,kreg [rm: evex.128.f3.0f38.w0 38 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVM2D ymmreg,kreg [rm: evex.256.f3.0f38.w0 38 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVM2D zmmreg,kreg [rm: evex.512.f3.0f38.w0 38 /r ] AVX512DQ,FUTURE
+VPMOVM2Q xmmreg,kreg [rm: evex.128.f3.0f38.w1 38 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVM2Q ymmreg,kreg [rm: evex.256.f3.0f38.w1 38 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVM2Q zmmreg,kreg [rm: evex.512.f3.0f38.w1 38 /r ] AVX512DQ,FUTURE
+VPMOVM2W xmmreg,kreg [rm: evex.128.f3.0f38.w1 28 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVM2W ymmreg,kreg [rm: evex.256.f3.0f38.w1 28 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVM2W zmmreg,kreg [rm: evex.512.f3.0f38.w1 28 /r ] AVX512BW,FUTURE
+VPMOVQ2M kreg,xmmreg [rm: evex.128.f3.0f38.w1 39 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVQ2M kreg,ymmreg [rm: evex.256.f3.0f38.w1 39 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMOVQ2M kreg,zmmreg [rm: evex.512.f3.0f38.w1 39 /r ] AVX512DQ,FUTURE
+VPMOVQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 32 /r ] AVX512,FUTURE
+VPMOVQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 32 /r ] AVX512,FUTURE
+VPMOVQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 35 /r ] AVX512,FUTURE
+VPMOVQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 35 /r ] AVX512,FUTURE
+VPMOVQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 34 /r ] AVX512,FUTURE
+VPMOVQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 34 /r ] AVX512,FUTURE
+VPMOVSDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 21 /r ] AVX512,FUTURE
+VPMOVSDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 21 /r ] AVX512,FUTURE
+VPMOVSDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 23 /r ] AVX512,FUTURE
+VPMOVSDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 23 /r ] AVX512,FUTURE
+VPMOVSQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 22 /r ] AVX512,FUTURE
+VPMOVSQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 22 /r ] AVX512,FUTURE
+VPMOVSQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 25 /r ] AVX512,FUTURE
+VPMOVSQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 25 /r ] AVX512,FUTURE
+VPMOVSQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 24 /r ] AVX512,FUTURE
+VPMOVSQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 24 /r ] AVX512,FUTURE
+VPMOVSWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 20 /r ] AVX512BW,FUTURE
+VPMOVSWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 20 /r ] AVX512BW,FUTURE
+VPMOVSXBD xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXBD ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 21 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXBD zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 21 /r ] AVX512,FUTURE
+VPMOVSXBQ xmmreg|mask|z,xmmrm16 [rm:ovm: evex.128.66.0f38.wig 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXBQ ymmreg|mask|z,xmmrm32 [rm:ovm: evex.256.66.0f38.wig 22 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXBQ zmmreg|mask|z,xmmrm64 [rm:ovm: evex.512.66.0f38.wig 22 /r ] AVX512,FUTURE
+VPMOVSXBW xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSXBW ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 20 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVSXBW zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 20 /r ] AVX512BW,FUTURE
+VPMOVSXDQ xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXDQ ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 25 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXDQ zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.w0 25 /r ] AVX512,FUTURE
+VPMOVSXWD xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXWD ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 23 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXWD zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 23 /r ] AVX512,FUTURE
+VPMOVSXWQ xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXWQ ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 24 /r ] AVX512VL,AVX512,FUTURE
+VPMOVSXWQ zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 24 /r ] AVX512,FUTURE
+VPMOVUSDB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 11 /r ] AVX512,FUTURE
+VPMOVUSDB mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDB mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 11 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDB mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 11 /r ] AVX512,FUTURE
+VPMOVUSDW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDW ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 13 /r ] AVX512,FUTURE
+VPMOVUSDW mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDW mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 13 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSDW mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 13 /r ] AVX512,FUTURE
+VPMOVUSQB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQB xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 12 /r ] AVX512,FUTURE
+VPMOVUSQB mem16|mask,xmmreg [mr:ovm: evex.128.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQB mem32|mask,ymmreg [mr:ovm: evex.256.f3.0f38.w0 12 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQB mem64|mask,zmmreg [mr:ovm: evex.512.f3.0f38.w0 12 /r ] AVX512,FUTURE
+VPMOVUSQD xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQD xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQD ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 15 /r ] AVX512,FUTURE
+VPMOVUSQD mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQD mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQD mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 15 /r ] AVX512,FUTURE
+VPMOVUSQW xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQW xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQW xmmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 14 /r ] AVX512,FUTURE
+VPMOVUSQW mem32|mask,xmmreg [mr:qvm: evex.128.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQW mem64|mask,ymmreg [mr:qvm: evex.256.f3.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPMOVUSQW mem128|mask,zmmreg [mr:qvm: evex.512.f3.0f38.w0 14 /r ] AVX512,FUTURE
+VPMOVUSWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVUSWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVUSWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 10 /r ] AVX512BW,FUTURE
+VPMOVUSWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVUSWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVUSWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 10 /r ] AVX512BW,FUTURE
+VPMOVW2M kreg,xmmreg [rm: evex.128.f3.0f38.w1 29 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVW2M kreg,ymmreg [rm: evex.256.f3.0f38.w1 29 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVW2M kreg,zmmreg [rm: evex.512.f3.0f38.w1 29 /r ] AVX512BW,FUTURE
+VPMOVWB xmmreg|mask|z,xmmreg [mr: evex.128.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVWB xmmreg|mask|z,ymmreg [mr: evex.256.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVWB ymmreg|mask|z,zmmreg [mr: evex.512.f3.0f38.w0 30 /r ] AVX512BW,FUTURE
+VPMOVWB mem64|mask,xmmreg [mr:hvm: evex.128.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVWB mem128|mask,ymmreg [mr:hvm: evex.256.f3.0f38.w0 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVWB mem256|mask,zmmreg [mr:hvm: evex.512.f3.0f38.w0 30 /r ] AVX512BW,FUTURE
+VPMOVZXBD xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXBD ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 31 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXBD zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 31 /r ] AVX512,FUTURE
+VPMOVZXBQ xmmreg|mask|z,xmmrm16 [rm:ovm: evex.128.66.0f38.wig 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXBQ ymmreg|mask|z,xmmrm32 [rm:ovm: evex.256.66.0f38.wig 32 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXBQ zmmreg|mask|z,xmmrm64 [rm:ovm: evex.512.66.0f38.wig 32 /r ] AVX512,FUTURE
+VPMOVZXBW xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVZXBW ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 30 /r ] AVX512VL,AVX512BW,FUTURE
+VPMOVZXBW zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 30 /r ] AVX512BW,FUTURE
+VPMOVZXDQ xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXDQ ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.w0 35 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXDQ zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.w0 35 /r ] AVX512,FUTURE
+VPMOVZXWD xmmreg|mask|z,xmmrm64 [rm:hvm: evex.128.66.0f38.wig 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXWD ymmreg|mask|z,xmmrm128 [rm:hvm: evex.256.66.0f38.wig 33 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXWD zmmreg|mask|z,ymmrm256 [rm:hvm: evex.512.66.0f38.wig 33 /r ] AVX512,FUTURE
+VPMOVZXWQ xmmreg|mask|z,xmmrm32 [rm:qvm: evex.128.66.0f38.wig 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXWQ ymmreg|mask|z,xmmrm64 [rm:qvm: evex.256.66.0f38.wig 34 /r ] AVX512VL,AVX512,FUTURE
+VPMOVZXWQ zmmreg|mask|z,xmmrm128 [rm:qvm: evex.512.66.0f38.wig 34 /r ] AVX512,FUTURE
+VPMULDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 28 /r ] AVX512VL,AVX512,FUTURE
+VPMULDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 28 /r ] AVX512VL,AVX512,FUTURE
+VPMULDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 28 /r ] AVX512,FUTURE
+VPMULHRSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 0b /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHRSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 0b /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHRSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 0b /r ] AVX512BW,FUTURE
+VPMULHUW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e4 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHUW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e4 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHUW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e4 /r ] AVX512BW,FUTURE
+VPMULHW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULHW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e5 /r ] AVX512BW,FUTURE
+VPMULLD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 40 /r ] AVX512VL,AVX512,FUTURE
+VPMULLD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 40 /r ] AVX512VL,AVX512,FUTURE
+VPMULLD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 40 /r ] AVX512,FUTURE
+VPMULLQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 40 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMULLQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 40 /r ] AVX512VL,AVX512DQ,FUTURE
+VPMULLQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 40 /r ] AVX512DQ,FUTURE
+VPMULLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULLW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d5 /r ] AVX512VL,AVX512BW,FUTURE
+VPMULLW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d5 /r ] AVX512BW,FUTURE
+VPMULTISHIFTQB xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 83 /r ] AVX512VL,AVX512VBMI,FUTURE
+VPMULTISHIFTQB ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 83 /r ] AVX512VL,AVX512VBMI,FUTURE
+VPMULTISHIFTQB zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 83 /r ] AVX512VBMI,FUTURE
+VPMULUDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 f4 /r ] AVX512VL,AVX512,FUTURE
+VPMULUDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 f4 /r ] AVX512VL,AVX512,FUTURE
+VPMULUDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 f4 /r ] AVX512,FUTURE
+VPORD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 eb /r ] AVX512VL,AVX512,FUTURE
+VPORD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 eb /r ] AVX512VL,AVX512,FUTURE
+VPORD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 eb /r ] AVX512,FUTURE
+VPORQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 eb /r ] AVX512VL,AVX512,FUTURE
+VPORQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 eb /r ] AVX512VL,AVX512,FUTURE
+VPORQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 eb /r ] AVX512,FUTURE
+VPROLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /1 ib ] AVX512VL,AVX512,FUTURE
+VPROLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /1 ib ] AVX512VL,AVX512,FUTURE
+VPROLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /1 ib ] AVX512,FUTURE
+VPROLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /1 ib ] AVX512VL,AVX512,FUTURE
+VPROLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /1 ib ] AVX512VL,AVX512,FUTURE
+VPROLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /1 ib ] AVX512,FUTURE
+VPROLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPROLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VPROLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 15 /r ] AVX512,FUTURE
+VPROLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 15 /r ] AVX512VL,AVX512,FUTURE
+VPROLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 15 /r ] AVX512VL,AVX512,FUTURE
+VPROLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 15 /r ] AVX512,FUTURE
+VPRORD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /0 ib ] AVX512VL,AVX512,FUTURE
+VPRORD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /0 ib ] AVX512VL,AVX512,FUTURE
+VPRORD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /0 ib ] AVX512,FUTURE
+VPRORQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /0 ib ] AVX512VL,AVX512,FUTURE
+VPRORQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /0 ib ] AVX512VL,AVX512,FUTURE
+VPRORQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /0 ib ] AVX512,FUTURE
+VPRORVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPRORVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VPRORVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 14 /r ] AVX512,FUTURE
+VPRORVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 14 /r ] AVX512VL,AVX512,FUTURE
+VPRORVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 14 /r ] AVX512VL,AVX512,FUTURE
+VPRORVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 14 /r ] AVX512,FUTURE
+VPSADBW xmmreg,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f6 /r ] AVX512VL,AVX512BW,FUTURE
+VPSADBW ymmreg,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f6 /r ] AVX512VL,AVX512BW,FUTURE
+VPSADBW zmmreg,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f6 /r ] AVX512BW,FUTURE
+VPSCATTERDD xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a0 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERDD ymem32|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a0 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERDD zmem32|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a0 /r ] AVX512,FUTURE
+VPSCATTERDQ xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a0 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERDQ xmem64|mask,ymmreg [mr:t1s: vsibx evex.256.66.0f38.w1 a0 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERDQ ymem64|mask,zmmreg [mr:t1s: vsiby evex.512.66.0f38.w1 a0 /r ] AVX512,FUTURE
+VPSCATTERQD xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a1 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERQD ymem32|mask,xmmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a1 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERQD zmem32|mask,ymmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a1 /r ] AVX512,FUTURE
+VPSCATTERQQ xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a1 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERQQ ymem64|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w1 a1 /r ] AVX512VL,AVX512,FUTURE
+VPSCATTERQQ zmem64|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w1 a1 /r ] AVX512,FUTURE
+VPSHUFB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.wig 00 /r ] AVX512VL,AVX512BW,FUTURE
+VPSHUFB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.wig 00 /r ] AVX512VL,AVX512BW,FUTURE
+VPSHUFB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.wig 00 /r ] AVX512BW,FUTURE
+VPSHUFD xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f.w0 70 /r ib ] AVX512VL,AVX512,FUTURE
+VPSHUFD ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f.w0 70 /r ib ] AVX512VL,AVX512,FUTURE
+VPSHUFD zmmreg|mask|z,zmmrm512|b32,imm8 [rmi:fv: evex.512.66.0f.w0 70 /r ib ] AVX512,FUTURE
+VPSHUFHW xmmreg|mask|z,xmmrm128,imm8 [rmi:fvm: evex.128.f3.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
+VPSHUFHW ymmreg|mask|z,ymmrm256,imm8 [rmi:fvm: evex.256.f3.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
+VPSHUFHW zmmreg|mask|z,zmmrm512,imm8 [rmi:fvm: evex.512.f3.0f.wig 70 /r ib ] AVX512BW,FUTURE
+VPSHUFLW xmmreg|mask|z,xmmrm128,imm8 [rmi:fvm: evex.128.f2.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
+VPSHUFLW ymmreg|mask|z,ymmrm256,imm8 [rmi:fvm: evex.256.f2.0f.wig 70 /r ib ] AVX512VL,AVX512BW,FUTURE
+VPSHUFLW zmmreg|mask|z,zmmrm512,imm8 [rmi:fvm: evex.512.f2.0f.wig 70 /r ib ] AVX512BW,FUTURE
+VPSLLD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 f2 /r ] AVX512VL,AVX512,FUTURE
+VPSLLD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 f2 /r ] AVX512VL,AVX512,FUTURE
+VPSLLD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 f2 /r ] AVX512,FUTURE
+VPSLLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /6 ib ] AVX512VL,AVX512,FUTURE
+VPSLLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /6 ib ] AVX512VL,AVX512,FUTURE
+VPSLLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /6 ib ] AVX512,FUTURE
+VPSLLDQ xmmreg,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 73 /7 ib ] AVX512VL,AVX512BW,FUTURE
+VPSLLDQ ymmreg,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 73 /7 ib ] AVX512VL,AVX512BW,FUTURE
+VPSLLDQ zmmreg,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 73 /7 ib ] AVX512BW,FUTURE
+VPSLLQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 f3 /r ] AVX512VL,AVX512,FUTURE
+VPSLLQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 f3 /r ] AVX512VL,AVX512,FUTURE
+VPSLLQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 f3 /r ] AVX512,FUTURE
+VPSLLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 73 /6 ib ] AVX512VL,AVX512,FUTURE
+VPSLLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 73 /6 ib ] AVX512VL,AVX512,FUTURE
+VPSLLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 73 /6 ib ] AVX512,FUTURE
+VPSLLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 47 /r ] AVX512VL,AVX512,FUTURE
+VPSLLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 47 /r ] AVX512VL,AVX512,FUTURE
+VPSLLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 47 /r ] AVX512,FUTURE
+VPSLLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 47 /r ] AVX512VL,AVX512,FUTURE
+VPSLLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 47 /r ] AVX512VL,AVX512,FUTURE
+VPSLLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 47 /r ] AVX512,FUTURE
+VPSLLVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 12 /r ] AVX512VL,AVX512BW,FUTURE
+VPSLLVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 12 /r ] AVX512VL,AVX512BW,FUTURE
+VPSLLVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 12 /r ] AVX512BW,FUTURE
+VPSLLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig f1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSLLW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig f1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSLLW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig f1 /r ] AVX512BW,FUTURE
+VPSLLW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /6 ib ] AVX512VL,AVX512BW,FUTURE
+VPSLLW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /6 ib ] AVX512VL,AVX512BW,FUTURE
+VPSLLW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /6 ib ] AVX512BW,FUTURE
+VPSRAD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 e2 /r ] AVX512VL,AVX512,FUTURE
+VPSRAD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 e2 /r ] AVX512VL,AVX512,FUTURE
+VPSRAD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 e2 /r ] AVX512,FUTURE
+VPSRAD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /4 ib ] AVX512VL,AVX512,FUTURE
+VPSRAD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /4 ib ] AVX512VL,AVX512,FUTURE
+VPSRAD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /4 ib ] AVX512,FUTURE
+VPSRAQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 e2 /r ] AVX512VL,AVX512,FUTURE
+VPSRAQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 e2 /r ] AVX512VL,AVX512,FUTURE
+VPSRAQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 e2 /r ] AVX512,FUTURE
+VPSRAQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 72 /4 ib ] AVX512VL,AVX512,FUTURE
+VPSRAQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 72 /4 ib ] AVX512VL,AVX512,FUTURE
+VPSRAQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 72 /4 ib ] AVX512,FUTURE
+VPSRAVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 46 /r ] AVX512VL,AVX512,FUTURE
+VPSRAVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 46 /r ] AVX512VL,AVX512,FUTURE
+VPSRAVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 46 /r ] AVX512,FUTURE
+VPSRAVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 46 /r ] AVX512VL,AVX512,FUTURE
+VPSRAVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 46 /r ] AVX512VL,AVX512,FUTURE
+VPSRAVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 46 /r ] AVX512,FUTURE
+VPSRAVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 11 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRAVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 11 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRAVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 11 /r ] AVX512BW,FUTURE
+VPSRAW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig e1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRAW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig e1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRAW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig e1 /r ] AVX512BW,FUTURE
+VPSRAW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /4 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRAW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /4 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRAW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /4 ib ] AVX512BW,FUTURE
+VPSRLD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w0 d2 /r ] AVX512VL,AVX512,FUTURE
+VPSRLD ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w0 d2 /r ] AVX512VL,AVX512,FUTURE
+VPSRLD zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w0 d2 /r ] AVX512,FUTURE
+VPSRLD xmmreg|mask|z,xmmrm128|b32*,imm8 [vmi:fv: evex.nds.128.66.0f.w0 72 /2 ib ] AVX512VL,AVX512,FUTURE
+VPSRLD ymmreg|mask|z,ymmrm256|b32*,imm8 [vmi:fv: evex.nds.256.66.0f.w0 72 /2 ib ] AVX512VL,AVX512,FUTURE
+VPSRLD zmmreg|mask|z,zmmrm512|b32*,imm8 [vmi:fv: evex.nds.512.66.0f.w0 72 /2 ib ] AVX512,FUTURE
+VPSRLDQ xmmreg,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 73 /3 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRLDQ ymmreg,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 73 /3 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRLDQ zmmreg,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 73 /3 ib ] AVX512BW,FUTURE
+VPSRLQ xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.w1 d3 /r ] AVX512VL,AVX512,FUTURE
+VPSRLQ ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.w1 d3 /r ] AVX512VL,AVX512,FUTURE
+VPSRLQ zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.w1 d3 /r ] AVX512,FUTURE
+VPSRLQ xmmreg|mask|z,xmmrm128|b64*,imm8 [vmi:fv: evex.nds.128.66.0f.w1 73 /2 ib ] AVX512VL,AVX512,FUTURE
+VPSRLQ ymmreg|mask|z,ymmrm256|b64*,imm8 [vmi:fv: evex.nds.256.66.0f.w1 73 /2 ib ] AVX512VL,AVX512,FUTURE
+VPSRLQ zmmreg|mask|z,zmmrm512|b64*,imm8 [vmi:fv: evex.nds.512.66.0f.w1 73 /2 ib ] AVX512,FUTURE
+VPSRLVD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 45 /r ] AVX512VL,AVX512,FUTURE
+VPSRLVD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 45 /r ] AVX512VL,AVX512,FUTURE
+VPSRLVD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 45 /r ] AVX512,FUTURE
+VPSRLVQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 45 /r ] AVX512VL,AVX512,FUTURE
+VPSRLVQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 45 /r ] AVX512VL,AVX512,FUTURE
+VPSRLVQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 45 /r ] AVX512,FUTURE
+VPSRLVW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRLVW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 10 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRLVW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 10 /r ] AVX512BW,FUTURE
+VPSRLW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:m128: evex.nds.128.66.0f.wig d1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRLW ymmreg|mask|z,ymmreg*,xmmrm128 [rvm:m128: evex.nds.256.66.0f.wig d1 /r ] AVX512VL,AVX512BW,FUTURE
+VPSRLW zmmreg|mask|z,zmmreg*,xmmrm128 [rvm:m128: evex.nds.512.66.0f.wig d1 /r ] AVX512BW,FUTURE
+VPSRLW xmmreg|mask|z,xmmrm128*,imm8 [vmi:fvm: evex.nds.128.66.0f.wig 71 /2 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRLW ymmreg|mask|z,ymmrm256*,imm8 [vmi:fvm: evex.nds.256.66.0f.wig 71 /2 ib ] AVX512VL,AVX512BW,FUTURE
+VPSRLW zmmreg|mask|z,zmmrm512*,imm8 [vmi:fvm: evex.nds.512.66.0f.wig 71 /2 ib ] AVX512BW,FUTURE
+VPSUBB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f8 /r ] AVX512BW,FUTURE
+VPSUBD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 fa /r ] AVX512VL,AVX512,FUTURE
+VPSUBD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 fa /r ] AVX512VL,AVX512,FUTURE
+VPSUBD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 fa /r ] AVX512,FUTURE
+VPSUBQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 fb /r ] AVX512VL,AVX512,FUTURE
+VPSUBQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 fb /r ] AVX512VL,AVX512,FUTURE
+VPSUBQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 fb /r ] AVX512,FUTURE
+VPSUBSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e8 /r ] AVX512BW,FUTURE
+VPSUBSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig e9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig e9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig e9 /r ] AVX512BW,FUTURE
+VPSUBUSB xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBUSB ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d8 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBUSB zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d8 /r ] AVX512BW,FUTURE
+VPSUBUSW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig d9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBUSW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig d9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBUSW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig d9 /r ] AVX512BW,FUTURE
+VPSUBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig f9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig f9 /r ] AVX512VL,AVX512BW,FUTURE
+VPSUBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig f9 /r ] AVX512BW,FUTURE
+VPTERNLOGD xmmreg|mask|z,xmmreg,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 25 /r ib ] AVX512VL,AVX512,FUTURE
+VPTERNLOGD ymmreg|mask|z,ymmreg,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 25 /r ib ] AVX512VL,AVX512,FUTURE
+VPTERNLOGD zmmreg|mask|z,zmmreg,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 25 /r ib ] AVX512,FUTURE
+VPTERNLOGQ xmmreg|mask|z,xmmreg,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 25 /r ib ] AVX512VL,AVX512,FUTURE
+VPTERNLOGQ ymmreg|mask|z,ymmreg,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 25 /r ib ] AVX512VL,AVX512,FUTURE
+VPTERNLOGQ zmmreg|mask|z,zmmreg,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 25 /r ib ] AVX512,FUTURE
+VPTESTMB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTMB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTMB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w0 26 /r ] AVX512BW,FUTURE
+VPTESTMD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTMD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTMD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f38.w0 27 /r ] AVX512,FUTURE
+VPTESTMQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTMQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTMQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f38.w1 27 /r ] AVX512,FUTURE
+VPTESTMW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.66.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTMW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.66.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTMW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.66.0f38.w1 26 /r ] AVX512BW,FUTURE
+VPTESTNMB kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.f3.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTNMB kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.f3.0f38.w0 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTNMB kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.f3.0f38.w0 26 /r ] AVX512BW,FUTURE
+VPTESTNMD kreg|mask,xmmreg,xmmrm128|b32 [rvm:fv: evex.nds.128.f3.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTNMD kreg|mask,ymmreg,ymmrm256|b32 [rvm:fv: evex.nds.256.f3.0f38.w0 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTNMD kreg|mask,zmmreg,zmmrm512|b32 [rvm:fv: evex.nds.512.f3.0f38.w0 27 /r ] AVX512,FUTURE
+VPTESTNMQ kreg|mask,xmmreg,xmmrm128|b64 [rvm:fv: evex.nds.128.f3.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTNMQ kreg|mask,ymmreg,ymmrm256|b64 [rvm:fv: evex.nds.256.f3.0f38.w1 27 /r ] AVX512VL,AVX512,FUTURE
+VPTESTNMQ kreg|mask,zmmreg,zmmrm512|b64 [rvm:fv: evex.nds.512.f3.0f38.w1 27 /r ] AVX512,FUTURE
+VPTESTNMW kreg|mask,xmmreg,xmmrm128 [rvm:fvm: evex.nds.128.f3.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTNMW kreg|mask,ymmreg,ymmrm256 [rvm:fvm: evex.nds.256.f3.0f38.w1 26 /r ] AVX512VL,AVX512BW,FUTURE
+VPTESTNMW kreg|mask,zmmreg,zmmrm512 [rvm:fvm: evex.nds.512.f3.0f38.w1 26 /r ] AVX512BW,FUTURE
+VPUNPCKHBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 68 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKHBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 68 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKHBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 68 /r ] AVX512BW,FUTURE
+VPUNPCKHDQ xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 6a /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKHDQ ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 6a /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKHDQ zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 6a /r ] AVX512,FUTURE
+VPUNPCKHQDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 6d /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKHQDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 6d /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKHQDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 6d /r ] AVX512,FUTURE
+VPUNPCKHWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 69 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKHWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 69 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKHWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 69 /r ] AVX512BW,FUTURE
+VPUNPCKLBW xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 60 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKLBW ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 60 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKLBW zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 60 /r ] AVX512BW,FUTURE
+VPUNPCKLDQ xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 62 /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKLDQ ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 62 /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKLDQ zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 62 /r ] AVX512,FUTURE
+VPUNPCKLQDQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 6c /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKLQDQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 6c /r ] AVX512VL,AVX512,FUTURE
+VPUNPCKLQDQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 6c /r ] AVX512,FUTURE
+VPUNPCKLWD xmmreg|mask|z,xmmreg*,xmmrm128 [rvm:fvm: evex.nds.128.66.0f.wig 61 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKLWD ymmreg|mask|z,ymmreg*,ymmrm256 [rvm:fvm: evex.nds.256.66.0f.wig 61 /r ] AVX512VL,AVX512BW,FUTURE
+VPUNPCKLWD zmmreg|mask|z,zmmreg*,zmmrm512 [rvm:fvm: evex.nds.512.66.0f.wig 61 /r ] AVX512BW,FUTURE
+VPXORD xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f.w0 ef /r ] AVX512VL,AVX512,FUTURE
+VPXORD ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f.w0 ef /r ] AVX512VL,AVX512,FUTURE
+VPXORD zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.66.0f.w0 ef /r ] AVX512,FUTURE
+VPXORQ xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 ef /r ] AVX512VL,AVX512,FUTURE
+VPXORQ ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 ef /r ] AVX512VL,AVX512,FUTURE
+VPXORQ zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 ef /r ] AVX512,FUTURE
+VRANGEPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w1 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VRANGEPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VRANGEPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 50 /r ib ] AVX512DQ,FUTURE
+VRANGEPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.66.0f3a.w0 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VRANGEPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 50 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VRANGEPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|sae,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 50 /r ib ] AVX512DQ,FUTURE
+VRANGESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 51 /r ib ] AVX512DQ,FUTURE
+VRANGESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 51 /r ib ] AVX512DQ,FUTURE
+VRCP14PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 4c /r ] AVX512VL,AVX512,FUTURE
+VRCP14PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 4c /r ] AVX512VL,AVX512,FUTURE
+VRCP14PD zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 4c /r ] AVX512,FUTURE
+VRCP14PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 4c /r ] AVX512VL,AVX512,FUTURE
+VRCP14PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 4c /r ] AVX512VL,AVX512,FUTURE
+VRCP14PS zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 4c /r ] AVX512,FUTURE
+VRCP14SD xmmreg|mask|z,xmmreg*,xmmrm64 [rvm:t1s: evex.nds.128.66.0f38.w1 4d /r ] AVX512,FUTURE
+VRCP14SS xmmreg|mask|z,xmmreg*,xmmrm32 [rvm:t1s: evex.nds.128.66.0f38.w0 4d /r ] AVX512,FUTURE
+VRCP28PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 ca /r ] AVX512ER,FUTURE
+VRCP28PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 ca /r ] AVX512ER,FUTURE
+VRCP28SD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 cb /r ] AVX512ER,FUTURE
+VRCP28SS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 cb /r ] AVX512ER,FUTURE
+VREDUCEPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VREDUCEPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VREDUCEPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 56 /r ib ] AVX512DQ,FUTURE
+VREDUCEPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VREDUCEPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 56 /r ib ] AVX512VL,AVX512DQ,FUTURE
+VREDUCEPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 56 /r ib ] AVX512DQ,FUTURE
+VREDUCESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 57 /r ib ] AVX512DQ,FUTURE
+VREDUCESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 57 /r ib ] AVX512DQ,FUTURE
+VRNDSCALEPD xmmreg|mask|z,xmmrm128|b64,imm8 [rmi:fv: evex.128.66.0f3a.w1 09 /r ib ] AVX512VL,AVX512,FUTURE
+VRNDSCALEPD ymmreg|mask|z,ymmrm256|b64,imm8 [rmi:fv: evex.256.66.0f3a.w1 09 /r ib ] AVX512VL,AVX512,FUTURE
+VRNDSCALEPD zmmreg|mask|z,zmmrm512|b64|sae,imm8 [rmi:fv: evex.512.66.0f3a.w1 09 /r ib ] AVX512,FUTURE
+VRNDSCALEPS xmmreg|mask|z,xmmrm128|b32,imm8 [rmi:fv: evex.128.66.0f3a.w0 08 /r ib ] AVX512VL,AVX512,FUTURE
+VRNDSCALEPS ymmreg|mask|z,ymmrm256|b32,imm8 [rmi:fv: evex.256.66.0f3a.w0 08 /r ib ] AVX512VL,AVX512,FUTURE
+VRNDSCALEPS zmmreg|mask|z,zmmrm512|b32|sae,imm8 [rmi:fv: evex.512.66.0f3a.w0 08 /r ib ] AVX512,FUTURE
+VRNDSCALESD xmmreg|mask|z,xmmreg*,xmmrm64|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w1 0b /r ib ] AVX512,FUTURE
+VRNDSCALESS xmmreg|mask|z,xmmreg*,xmmrm32|sae,imm8 [rvmi:t1s: evex.nds.128.66.0f3a.w0 0a /r ib ] AVX512,FUTURE
+VRSQRT14PD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f38.w1 4e /r ] AVX512VL,AVX512,FUTURE
+VRSQRT14PD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f38.w1 4e /r ] AVX512VL,AVX512,FUTURE
+VRSQRT14PD zmmreg|mask|z,zmmrm512|b64 [rm:fv: evex.512.66.0f38.w1 4e /r ] AVX512,FUTURE
+VRSQRT14PS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.66.0f38.w0 4e /r ] AVX512VL,AVX512,FUTURE
+VRSQRT14PS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.66.0f38.w0 4e /r ] AVX512VL,AVX512,FUTURE
+VRSQRT14PS zmmreg|mask|z,zmmrm512|b32 [rm:fv: evex.512.66.0f38.w0 4e /r ] AVX512,FUTURE
+VRSQRT14SD xmmreg|mask|z,xmmreg*,xmmrm64 [rvm:t1s: evex.nds.128.66.0f38.w1 4f /r ] AVX512,FUTURE
+VRSQRT14SS xmmreg|mask|z,xmmreg*,xmmrm32 [rvm:t1s: evex.nds.128.66.0f38.w0 4f /r ] AVX512,FUTURE
+VRSQRT28PD zmmreg|mask|z,zmmrm512|b64|sae [rm:fv: evex.512.66.0f38.w1 cc /r ] AVX512ER,FUTURE
+VRSQRT28PS zmmreg|mask|z,zmmrm512|b32|sae [rm:fv: evex.512.66.0f38.w0 cc /r ] AVX512ER,FUTURE
+VRSQRT28SD xmmreg|mask|z,xmmreg*,xmmrm64|sae [rvm:t1s: evex.nds.128.66.0f38.w1 cd /r ] AVX512ER,FUTURE
+VRSQRT28SS xmmreg|mask|z,xmmreg*,xmmrm32|sae [rvm:t1s: evex.nds.128.66.0f38.w0 cd /r ] AVX512ER,FUTURE
+VSCALEFPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f38.w1 2c /r ] AVX512VL,AVX512,FUTURE
+VSCALEFPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f38.w1 2c /r ] AVX512VL,AVX512,FUTURE
+VSCALEFPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f38.w1 2c /r ] AVX512,FUTURE
+VSCALEFPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.66.0f38.w0 2c /r ] AVX512VL,AVX512,FUTURE
+VSCALEFPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.66.0f38.w0 2c /r ] AVX512VL,AVX512,FUTURE
+VSCALEFPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.66.0f38.w0 2c /r ] AVX512,FUTURE
+VSCALEFSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.66.0f38.w1 2d /r ] AVX512,FUTURE
+VSCALEFSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.66.0f38.w0 2d /r ] AVX512,FUTURE
+VSCATTERDPD xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a2 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERDPD xmem64|mask,ymmreg [mr:t1s: vsibx evex.256.66.0f38.w1 a2 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERDPD ymem64|mask,zmmreg [mr:t1s: vsiby evex.512.66.0f38.w1 a2 /r ] AVX512,FUTURE
+VSCATTERDPS xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a2 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERDPS ymem32|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a2 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERDPS zmem32|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a2 /r ] AVX512,FUTURE
+VSCATTERPF0DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /5 ] AVX512PF,FUTURE
+VSCATTERPF0DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /5 ] AVX512PF,FUTURE
+VSCATTERPF0QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /5 ] AVX512PF,FUTURE
+VSCATTERPF0QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /5 ] AVX512PF,FUTURE
+VSCATTERPF1DPD ymem64|mask [m:t1s: vsiby evex.512.66.0f38.w1 c6 /6 ] AVX512PF,FUTURE
+VSCATTERPF1DPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c6 /6 ] AVX512PF,FUTURE
+VSCATTERPF1QPD zmem64|mask [m:t1s: vsibz evex.512.66.0f38.w1 c7 /6 ] AVX512PF,FUTURE
+VSCATTERPF1QPS zmem32|mask [m:t1s: vsibz evex.512.66.0f38.w0 c7 /6 ] AVX512PF,FUTURE
+VSCATTERQPD xmem64|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w1 a3 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERQPD ymem64|mask,ymmreg [mr:t1s: vsiby evex.256.66.0f38.w1 a3 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERQPD zmem64|mask,zmmreg [mr:t1s: vsibz evex.512.66.0f38.w1 a3 /r ] AVX512,FUTURE
+VSCATTERQPS xmem32|mask,xmmreg [mr:t1s: vsibx evex.128.66.0f38.w0 a3 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERQPS ymem32|mask,xmmreg [mr:t1s: vsiby evex.256.66.0f38.w0 a3 /r ] AVX512VL,AVX512,FUTURE
+VSCATTERQPS zmem32|mask,ymmreg [mr:t1s: vsibz evex.512.66.0f38.w0 a3 /r ] AVX512,FUTURE
+VSHUFF32X4 ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 23 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFF32X4 zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 23 /r ib ] AVX512,FUTURE
+VSHUFF64X2 ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 23 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFF64X2 zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 23 /r ib ] AVX512,FUTURE
+VSHUFI32X4 ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w0 43 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFI32X4 zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w0 43 /r ib ] AVX512,FUTURE
+VSHUFI64X2 ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f3a.w1 43 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFI64X2 zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f3a.w1 43 /r ib ] AVX512,FUTURE
+VSHUFPD xmmreg|mask|z,xmmreg*,xmmrm128|b64,imm8 [rvmi:fv: evex.nds.128.66.0f.w1 c6 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFPD ymmreg|mask|z,ymmreg*,ymmrm256|b64,imm8 [rvmi:fv: evex.nds.256.66.0f.w1 c6 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFPD zmmreg|mask|z,zmmreg*,zmmrm512|b64,imm8 [rvmi:fv: evex.nds.512.66.0f.w1 c6 /r ib ] AVX512,FUTURE
+VSHUFPS xmmreg|mask|z,xmmreg*,xmmrm128|b32,imm8 [rvmi:fv: evex.nds.128.0f.w0 c6 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFPS ymmreg|mask|z,ymmreg*,ymmrm256|b32,imm8 [rvmi:fv: evex.nds.256.0f.w0 c6 /r ib ] AVX512VL,AVX512,FUTURE
+VSHUFPS zmmreg|mask|z,zmmreg*,zmmrm512|b32,imm8 [rvmi:fv: evex.nds.512.0f.w0 c6 /r ib ] AVX512,FUTURE
+VSQRTPD xmmreg|mask|z,xmmrm128|b64 [rm:fv: evex.128.66.0f.w1 51 /r ] AVX512VL,AVX512,FUTURE
+VSQRTPD ymmreg|mask|z,ymmrm256|b64 [rm:fv: evex.256.66.0f.w1 51 /r ] AVX512VL,AVX512,FUTURE
+VSQRTPD zmmreg|mask|z,zmmrm512|b64|er [rm:fv: evex.512.66.0f.w1 51 /r ] AVX512,FUTURE
+VSQRTPS xmmreg|mask|z,xmmrm128|b32 [rm:fv: evex.128.0f.w0 51 /r ] AVX512VL,AVX512,FUTURE
+VSQRTPS ymmreg|mask|z,ymmrm256|b32 [rm:fv: evex.256.0f.w0 51 /r ] AVX512VL,AVX512,FUTURE
+VSQRTPS zmmreg|mask|z,zmmrm512|b32|er [rm:fv: evex.512.0f.w0 51 /r ] AVX512,FUTURE
+VSQRTSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 51 /r ] AVX512,FUTURE
+VSQRTSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 51 /r ] AVX512,FUTURE
+VSUBPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 5c /r ] AVX512VL,AVX512,FUTURE
+VSUBPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 5c /r ] AVX512VL,AVX512,FUTURE
+VSUBPD zmmreg|mask|z,zmmreg*,zmmrm512|b64|er [rvm:fv: evex.nds.512.66.0f.w1 5c /r ] AVX512,FUTURE
+VSUBPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 5c /r ] AVX512VL,AVX512,FUTURE
+VSUBPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 5c /r ] AVX512VL,AVX512,FUTURE
+VSUBPS zmmreg|mask|z,zmmreg*,zmmrm512|b32|er [rvm:fv: evex.nds.512.0f.w0 5c /r ] AVX512,FUTURE
+VSUBSD xmmreg|mask|z,xmmreg*,xmmrm64|er [rvm:t1s: evex.nds.128.f2.0f.w1 5c /r ] AVX512,FUTURE
+VSUBSS xmmreg|mask|z,xmmreg*,xmmrm32|er [rvm:t1s: evex.nds.128.f3.0f.w0 5c /r ] AVX512,FUTURE
+VUCOMISD xmmreg,xmmrm64|sae [rm:t1s: evex.128.66.0f.w1 2e /r ] AVX512,FUTURE
+VUCOMISS xmmreg,xmmrm32|sae [rm:t1s: evex.128.0f.w0 2e /r ] AVX512,FUTURE
+VUNPCKHPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 15 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKHPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 15 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKHPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 15 /r ] AVX512,FUTURE
+VUNPCKHPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKHPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 15 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKHPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 15 /r ] AVX512,FUTURE
+VUNPCKLPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 14 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKLPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 14 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKLPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 14 /r ] AVX512,FUTURE
+VUNPCKLPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKLPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 14 /r ] AVX512VL,AVX512,FUTURE
+VUNPCKLPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 14 /r ] AVX512,FUTURE
+VXORPD xmmreg|mask|z,xmmreg*,xmmrm128|b64 [rvm:fv: evex.nds.128.66.0f.w1 57 /r ] AVX512VL,AVX512DQ,FUTURE
+VXORPD ymmreg|mask|z,ymmreg*,ymmrm256|b64 [rvm:fv: evex.nds.256.66.0f.w1 57 /r ] AVX512VL,AVX512DQ,FUTURE
+VXORPD zmmreg|mask|z,zmmreg*,zmmrm512|b64 [rvm:fv: evex.nds.512.66.0f.w1 57 /r ] AVX512DQ,FUTURE
+VXORPS xmmreg|mask|z,xmmreg*,xmmrm128|b32 [rvm:fv: evex.nds.128.0f.w0 57 /r ] AVX512VL,AVX512DQ,FUTURE
+VXORPS ymmreg|mask|z,ymmreg*,ymmrm256|b32 [rvm:fv: evex.nds.256.0f.w0 57 /r ] AVX512VL,AVX512DQ,FUTURE
+VXORPS zmmreg|mask|z,zmmreg*,zmmrm512|b32 [rvm:fv: evex.nds.512.0f.w0 57 /r ] AVX512DQ,FUTURE
+; MJC PUBLIC END
+
+;# Intel memory protection keys for userspace (PKU aka PKEYs)
+RDPKRU void [ 0f 01 ee] X64,FUTURE
+WRPKRU void [ 0f 01 ef] X64,FUTURE
+
+;# Read Processor ID
+RDPID reg32 [m: f3 0f c7 /7] NOLONG,FUTURE
+RDPID reg64 [m: o64nw f3 0f c7 /7] X64,FUTURE
+RDPID reg32 [m: f3 0f c7 /7] X64,UNDOC,FUTURE
+
+;# New memory instructions
+CLFLUSHOPT mem [m: 66 0f ae /7] FUTURE
+CLWB mem [m: 66 0f ae /6] FUTURE
+; This one was killed before it saw the light of day
+PCOMMIT void [ 66 0f ae f8] FUTURE,UNDOC,OBSOLETE
+
+; AMD Zen v1
+CLZERO void [ 0f 01 fc] FUTURE,AMD
+
+;# Systematic names for the hinting nop instructions
+; These should be last in the file
+HINT_NOP0 rm16 [m: o16 0f 18 /0] P6,UNDOC
+HINT_NOP0 rm32 [m: o32 0f 18 /0] P6,UNDOC
+HINT_NOP0 rm64 [m: o64 0f 18 /0] X64,UNDOC
+HINT_NOP1 rm16 [m: o16 0f 18 /1] P6,UNDOC
+HINT_NOP1 rm32 [m: o32 0f 18 /1] P6,UNDOC
+HINT_NOP1 rm64 [m: o64 0f 18 /1] X64,UNDOC
+HINT_NOP2 rm16 [m: o16 0f 18 /2] P6,UNDOC
+HINT_NOP2 rm32 [m: o32 0f 18 /2] P6,UNDOC
+HINT_NOP2 rm64 [m: o64 0f 18 /2] X64,UNDOC
+HINT_NOP3 rm16 [m: o16 0f 18 /3] P6,UNDOC
+HINT_NOP3 rm32 [m: o32 0f 18 /3] P6,UNDOC
+HINT_NOP3 rm64 [m: o64 0f 18 /3] X64,UNDOC
+HINT_NOP4 rm16 [m: o16 0f 18 /4] P6,UNDOC
+HINT_NOP4 rm32 [m: o32 0f 18 /4] P6,UNDOC
+HINT_NOP4 rm64 [m: o64 0f 18 /4] X64,UNDOC
+HINT_NOP5 rm16 [m: o16 0f 18 /5] P6,UNDOC
+HINT_NOP5 rm32 [m: o32 0f 18 /5] P6,UNDOC
+HINT_NOP5 rm64 [m: o64 0f 18 /5] X64,UNDOC
+HINT_NOP6 rm16 [m: o16 0f 18 /6] P6,UNDOC
+HINT_NOP6 rm32 [m: o32 0f 18 /6] P6,UNDOC
+HINT_NOP6 rm64 [m: o64 0f 18 /6] X64,UNDOC
+HINT_NOP7 rm16 [m: o16 0f 18 /7] P6,UNDOC
+HINT_NOP7 rm32 [m: o32 0f 18 /7] P6,UNDOC
+HINT_NOP7 rm64 [m: o64 0f 18 /7] X64,UNDOC
+HINT_NOP8 rm16 [m: o16 0f 19 /0] P6,UNDOC
+HINT_NOP8 rm32 [m: o32 0f 19 /0] P6,UNDOC
+HINT_NOP8 rm64 [m: o64 0f 19 /0] X64,UNDOC
+HINT_NOP9 rm16 [m: o16 0f 19 /1] P6,UNDOC
+HINT_NOP9 rm32 [m: o32 0f 19 /1] P6,UNDOC
+HINT_NOP9 rm64 [m: o64 0f 19 /1] X64,UNDOC
+HINT_NOP10 rm16 [m: o16 0f 19 /2] P6,UNDOC
+HINT_NOP10 rm32 [m: o32 0f 19 /2] P6,UNDOC
+HINT_NOP10 rm64 [m: o64 0f 19 /2] X64,UNDOC
+HINT_NOP11 rm16 [m: o16 0f 19 /3] P6,UNDOC
+HINT_NOP11 rm32 [m: o32 0f 19 /3] P6,UNDOC
+HINT_NOP11 rm64 [m: o64 0f 19 /3] X64,UNDOC
+HINT_NOP12 rm16 [m: o16 0f 19 /4] P6,UNDOC
+HINT_NOP12 rm32 [m: o32 0f 19 /4] P6,UNDOC
+HINT_NOP12 rm64 [m: o64 0f 19 /4] X64,UNDOC
+HINT_NOP13 rm16 [m: o16 0f 19 /5] P6,UNDOC
+HINT_NOP13 rm32 [m: o32 0f 19 /5] P6,UNDOC
+HINT_NOP13 rm64 [m: o64 0f 19 /5] X64,UNDOC
+HINT_NOP14 rm16 [m: o16 0f 19 /6] P6,UNDOC
+HINT_NOP14 rm32 [m: o32 0f 19 /6] P6,UNDOC
+HINT_NOP14 rm64 [m: o64 0f 19 /6] X64,UNDOC
+HINT_NOP15 rm16 [m: o16 0f 19 /7] P6,UNDOC
+HINT_NOP15 rm32 [m: o32 0f 19 /7] P6,UNDOC
+HINT_NOP15 rm64 [m: o64 0f 19 /7] X64,UNDOC
+HINT_NOP16 rm16 [m: o16 0f 1a /0] P6,UNDOC
+HINT_NOP16 rm32 [m: o32 0f 1a /0] P6,UNDOC
+HINT_NOP16 rm64 [m: o64 0f 1a /0] X64,UNDOC
+HINT_NOP17 rm16 [m: o16 0f 1a /1] P6,UNDOC
+HINT_NOP17 rm32 [m: o32 0f 1a /1] P6,UNDOC
+HINT_NOP17 rm64 [m: o64 0f 1a /1] X64,UNDOC
+HINT_NOP18 rm16 [m: o16 0f 1a /2] P6,UNDOC
+HINT_NOP18 rm32 [m: o32 0f 1a /2] P6,UNDOC
+HINT_NOP18 rm64 [m: o64 0f 1a /2] X64,UNDOC
+HINT_NOP19 rm16 [m: o16 0f 1a /3] P6,UNDOC
+HINT_NOP19 rm32 [m: o32 0f 1a /3] P6,UNDOC
+HINT_NOP19 rm64 [m: o64 0f 1a /3] X64,UNDOC
+HINT_NOP20 rm16 [m: o16 0f 1a /4] P6,UNDOC
+HINT_NOP20 rm32 [m: o32 0f 1a /4] P6,UNDOC
+HINT_NOP20 rm64 [m: o64 0f 1a /4] X64,UNDOC
+HINT_NOP21 rm16 [m: o16 0f 1a /5] P6,UNDOC
+HINT_NOP21 rm32 [m: o32 0f 1a /5] P6,UNDOC
+HINT_NOP21 rm64 [m: o64 0f 1a /5] X64,UNDOC
+HINT_NOP22 rm16 [m: o16 0f 1a /6] P6,UNDOC
+HINT_NOP22 rm32 [m: o32 0f 1a /6] P6,UNDOC
+HINT_NOP22 rm64 [m: o64 0f 1a /6] X64,UNDOC
+HINT_NOP23 rm16 [m: o16 0f 1a /7] P6,UNDOC
+HINT_NOP23 rm32 [m: o32 0f 1a /7] P6,UNDOC
+HINT_NOP23 rm64 [m: o64 0f 1a /7] X64,UNDOC
+HINT_NOP24 rm16 [m: o16 0f 1b /0] P6,UNDOC
+HINT_NOP24 rm32 [m: o32 0f 1b /0] P6,UNDOC
+HINT_NOP24 rm64 [m: o64 0f 1b /0] X64,UNDOC
+HINT_NOP25 rm16 [m: o16 0f 1b /1] P6,UNDOC
+HINT_NOP25 rm32 [m: o32 0f 1b /1] P6,UNDOC
+HINT_NOP25 rm64 [m: o64 0f 1b /1] X64,UNDOC
+HINT_NOP26 rm16 [m: o16 0f 1b /2] P6,UNDOC
+HINT_NOP26 rm32 [m: o32 0f 1b /2] P6,UNDOC
+HINT_NOP26 rm64 [m: o64 0f 1b /2] X64,UNDOC
+HINT_NOP27 rm16 [m: o16 0f 1b /3] P6,UNDOC
+HINT_NOP27 rm32 [m: o32 0f 1b /3] P6,UNDOC
+HINT_NOP27 rm64 [m: o64 0f 1b /3] X64,UNDOC
+HINT_NOP28 rm16 [m: o16 0f 1b /4] P6,UNDOC
+HINT_NOP28 rm32 [m: o32 0f 1b /4] P6,UNDOC
+HINT_NOP28 rm64 [m: o64 0f 1b /4] X64,UNDOC
+HINT_NOP29 rm16 [m: o16 0f 1b /5] P6,UNDOC
+HINT_NOP29 rm32 [m: o32 0f 1b /5] P6,UNDOC
+HINT_NOP29 rm64 [m: o64 0f 1b /5] X64,UNDOC
+HINT_NOP30 rm16 [m: o16 0f 1b /6] P6,UNDOC
+HINT_NOP30 rm32 [m: o32 0f 1b /6] P6,UNDOC
+HINT_NOP30 rm64 [m: o64 0f 1b /6] X64,UNDOC
+HINT_NOP31 rm16 [m: o16 0f 1b /7] P6,UNDOC
+HINT_NOP31 rm32 [m: o32 0f 1b /7] P6,UNDOC
+HINT_NOP31 rm64 [m: o64 0f 1b /7] X64,UNDOC
+HINT_NOP32 rm16 [m: o16 0f 1c /0] P6,UNDOC
+HINT_NOP32 rm32 [m: o32 0f 1c /0] P6,UNDOC
+HINT_NOP32 rm64 [m: o64 0f 1c /0] X64,UNDOC
+HINT_NOP33 rm16 [m: o16 0f 1c /1] P6,UNDOC
+HINT_NOP33 rm32 [m: o32 0f 1c /1] P6,UNDOC
+HINT_NOP33 rm64 [m: o64 0f 1c /1] X64,UNDOC
+HINT_NOP34 rm16 [m: o16 0f 1c /2] P6,UNDOC
+HINT_NOP34 rm32 [m: o32 0f 1c /2] P6,UNDOC
+HINT_NOP34 rm64 [m: o64 0f 1c /2] X64,UNDOC
+HINT_NOP35 rm16 [m: o16 0f 1c /3] P6,UNDOC
+HINT_NOP35 rm32 [m: o32 0f 1c /3] P6,UNDOC
+HINT_NOP35 rm64 [m: o64 0f 1c /3] X64,UNDOC
+HINT_NOP36 rm16 [m: o16 0f 1c /4] P6,UNDOC
+HINT_NOP36 rm32 [m: o32 0f 1c /4] P6,UNDOC
+HINT_NOP36 rm64 [m: o64 0f 1c /4] X64,UNDOC
+HINT_NOP37 rm16 [m: o16 0f 1c /5] P6,UNDOC
+HINT_NOP37 rm32 [m: o32 0f 1c /5] P6,UNDOC
+HINT_NOP37 rm64 [m: o64 0f 1c /5] X64,UNDOC
+HINT_NOP38 rm16 [m: o16 0f 1c /6] P6,UNDOC
+HINT_NOP38 rm32 [m: o32 0f 1c /6] P6,UNDOC
+HINT_NOP38 rm64 [m: o64 0f 1c /6] X64,UNDOC
+HINT_NOP39 rm16 [m: o16 0f 1c /7] P6,UNDOC
+HINT_NOP39 rm32 [m: o32 0f 1c /7] P6,UNDOC
+HINT_NOP39 rm64 [m: o64 0f 1c /7] X64,UNDOC
+HINT_NOP40 rm16 [m: o16 0f 1d /0] P6,UNDOC
+HINT_NOP40 rm32 [m: o32 0f 1d /0] P6,UNDOC
+HINT_NOP40 rm64 [m: o64 0f 1d /0] X64,UNDOC
+HINT_NOP41 rm16 [m: o16 0f 1d /1] P6,UNDOC
+HINT_NOP41 rm32 [m: o32 0f 1d /1] P6,UNDOC
+HINT_NOP41 rm64 [m: o64 0f 1d /1] X64,UNDOC
+HINT_NOP42 rm16 [m: o16 0f 1d /2] P6,UNDOC
+HINT_NOP42 rm32 [m: o32 0f 1d /2] P6,UNDOC
+HINT_NOP42 rm64 [m: o64 0f 1d /2] X64,UNDOC
+HINT_NOP43 rm16 [m: o16 0f 1d /3] P6,UNDOC
+HINT_NOP43 rm32 [m: o32 0f 1d /3] P6,UNDOC
+HINT_NOP43 rm64 [m: o64 0f 1d /3] X64,UNDOC
+HINT_NOP44 rm16 [m: o16 0f 1d /4] P6,UNDOC
+HINT_NOP44 rm32 [m: o32 0f 1d /4] P6,UNDOC
+HINT_NOP44 rm64 [m: o64 0f 1d /4] X64,UNDOC
+HINT_NOP45 rm16 [m: o16 0f 1d /5] P6,UNDOC
+HINT_NOP45 rm32 [m: o32 0f 1d /5] P6,UNDOC
+HINT_NOP45 rm64 [m: o64 0f 1d /5] X64,UNDOC
+HINT_NOP46 rm16 [m: o16 0f 1d /6] P6,UNDOC
+HINT_NOP46 rm32 [m: o32 0f 1d /6] P6,UNDOC
+HINT_NOP46 rm64 [m: o64 0f 1d /6] X64,UNDOC
+HINT_NOP47 rm16 [m: o16 0f 1d /7] P6,UNDOC
+HINT_NOP47 rm32 [m: o32 0f 1d /7] P6,UNDOC
+HINT_NOP47 rm64 [m: o64 0f 1d /7] X64,UNDOC
+HINT_NOP48 rm16 [m: o16 0f 1e /0] P6,UNDOC
+HINT_NOP48 rm32 [m: o32 0f 1e /0] P6,UNDOC
+HINT_NOP48 rm64 [m: o64 0f 1e /0] X64,UNDOC
+HINT_NOP49 rm16 [m: o16 0f 1e /1] P6,UNDOC
+HINT_NOP49 rm32 [m: o32 0f 1e /1] P6,UNDOC
+HINT_NOP49 rm64 [m: o64 0f 1e /1] X64,UNDOC
+HINT_NOP50 rm16 [m: o16 0f 1e /2] P6,UNDOC
+HINT_NOP50 rm32 [m: o32 0f 1e /2] P6,UNDOC
+HINT_NOP50 rm64 [m: o64 0f 1e /2] X64,UNDOC
+HINT_NOP51 rm16 [m: o16 0f 1e /3] P6,UNDOC
+HINT_NOP51 rm32 [m: o32 0f 1e /3] P6,UNDOC
+HINT_NOP51 rm64 [m: o64 0f 1e /3] X64,UNDOC
+HINT_NOP52 rm16 [m: o16 0f 1e /4] P6,UNDOC
+HINT_NOP52 rm32 [m: o32 0f 1e /4] P6,UNDOC
+HINT_NOP52 rm64 [m: o64 0f 1e /4] X64,UNDOC
+HINT_NOP53 rm16 [m: o16 0f 1e /5] P6,UNDOC
+HINT_NOP53 rm32 [m: o32 0f 1e /5] P6,UNDOC
+HINT_NOP53 rm64 [m: o64 0f 1e /5] X64,UNDOC
+HINT_NOP54 rm16 [m: o16 0f 1e /6] P6,UNDOC
+HINT_NOP54 rm32 [m: o32 0f 1e /6] P6,UNDOC
+HINT_NOP54 rm64 [m: o64 0f 1e /6] X64,UNDOC
+HINT_NOP55 rm16 [m: o16 0f 1e /7] P6,UNDOC
+HINT_NOP55 rm32 [m: o32 0f 1e /7] P6,UNDOC
+HINT_NOP55 rm64 [m: o64 0f 1e /7] X64,UNDOC
+HINT_NOP56 rm16 [m: o16 0f 1f /0] P6,UNDOC
+HINT_NOP56 rm32 [m: o32 0f 1f /0] P6,UNDOC
+HINT_NOP56 rm64 [m: o64 0f 1f /0] X64,UNDOC
+HINT_NOP57 rm16 [m: o16 0f 1f /1] P6,UNDOC
+HINT_NOP57 rm32 [m: o32 0f 1f /1] P6,UNDOC
+HINT_NOP57 rm64 [m: o64 0f 1f /1] X64,UNDOC
+HINT_NOP58 rm16 [m: o16 0f 1f /2] P6,UNDOC
+HINT_NOP58 rm32 [m: o32 0f 1f /2] P6,UNDOC
+HINT_NOP58 rm64 [m: o64 0f 1f /2] X64,UNDOC
+HINT_NOP59 rm16 [m: o16 0f 1f /3] P6,UNDOC
+HINT_NOP59 rm32 [m: o32 0f 1f /3] P6,UNDOC
+HINT_NOP59 rm64 [m: o64 0f 1f /3] X64,UNDOC
+HINT_NOP60 rm16 [m: o16 0f 1f /4] P6,UNDOC
+HINT_NOP60 rm32 [m: o32 0f 1f /4] P6,UNDOC
+HINT_NOP60 rm64 [m: o64 0f 1f /4] X64,UNDOC
+HINT_NOP61 rm16 [m: o16 0f 1f /5] P6,UNDOC
+HINT_NOP61 rm32 [m: o32 0f 1f /5] P6,UNDOC
+HINT_NOP61 rm64 [m: o64 0f 1f /5] X64,UNDOC
+HINT_NOP62 rm16 [m: o16 0f 1f /6] P6,UNDOC
+HINT_NOP62 rm32 [m: o32 0f 1f /6] P6,UNDOC
+HINT_NOP62 rm64 [m: o64 0f 1f /6] X64,UNDOC
+HINT_NOP63 rm16 [m: o16 0f 1f /7] P6,UNDOC
+HINT_NOP63 rm32 [m: o32 0f 1f /7] P6,UNDOC
+HINT_NOP63 rm64 [m: o64 0f 1f /7] X64,UNDOC
--- /dev/null
+++ b/src/as/target/x86/proc.h
@@ -1,0 +1,156 @@
+enum args {
+ AREG_CS = AMAX,
+ AREG_DS,
+ AREG_SS,
+ AREG_ES,
+ AREG_FS,
+ AREG_GS,
+
+ AREG_EFLAGS,
+ AREG_CF,
+ AREG_PF,
+ AREG_AF,
+ AREG_ZF,
+ AREG_SF,
+ AREG_TF,
+ AREG_IF,
+ AREG_DF,
+ AREG_OF,
+ AREG_IOPL,
+ AREG_NT,
+ AREG_RF,
+ AREG_VM,
+ AREG_AC,
+ AREG_VIF,
+ AREG_VIP,
+ AREG_ID,
+
+ AREG_AX,
+ AREG_AL,
+ AREG_AH,
+ AREG_EAX,
+ AREG_RAX,
+
+ AREG_BX,
+ AREG_BL,
+ AREG_BH,
+ AREG_EBX,
+ AREG_RBX,
+
+ AREG_CX,
+ AREG_CL,
+ AREG_CH,
+ AREG_ECX,
+ AREG_RCX,
+
+ AREG_DX,
+ AREG_DL,
+ AREG_DH,
+ AREG_EDX,
+ AREG_RDX,
+
+ AREG_SI,
+ AREG_SIL,
+ AREG_ESI,
+ AREG_RSI,
+ AREG_DI,
+ AREG_DIL,
+ AREG_EDI,
+ AREG_RDI,
+
+ AREG_SP,
+ AREG_SPL,
+ AREG_ESP,
+ AREG_RSP,
+
+ AREG_BP,
+ AREG_BPL,
+ AREG_EBP,
+ AREG_RBP,
+
+ AREG_R0,
+ AREG_MM0,
+ AREG_R1,
+ AREG_MM1,
+ AREG_R2,
+ AREG_MM2,
+ AREG_R3,
+ AREG_MM3,
+ AREG_R4,
+ AREG_MM4,
+ AREG_R5,
+ AREG_MM5,
+ AREG_R6,
+ AREG_MM6,
+ AREG_R7,
+ AREG_MM7,
+
+ AREG_R8,
+ AREG_R8L,
+ AREG_R8W,
+ AREG_R9,
+ AREG_R9L,
+ AREG_R9W,
+ AREG_R10,
+ AREG_R10L,
+ AREG_R10W,
+ AREG_R11,
+ AREG_R11L,
+ AREG_R11W,
+ AREG_R12,
+ AREG_R12L,
+ AREG_R12W,
+ AREG_R13,
+ AREG_R13L,
+ AREG_R13W,
+ AREG_R14,
+ AREG_R14L,
+ AREG_R14W,
+ AREG_R15,
+ AREG_R15L,
+ AREG_R15W,
+
+ AREG_XMM0,
+ AREG_XMM1,
+ AREG_XMM2,
+ AREG_XMM3,
+ AREG_XMM4,
+ AREG_XMM5,
+ AREG_XMM6,
+ AREG_XMM7,
+ AREG_XMM8,
+ AREG_XMM9,
+ AREG_XMM10,
+ AREG_XMM11,
+ AREG_XMM12,
+ AREG_XMM13,
+ AREG_XMM14,
+ AREG_XMM15,
+
+ AREG_YMM0,
+ AREG_YMM1,
+ AREG_YMM2,
+ AREG_YMM3,
+ AREG_YMM4,
+ AREG_YMM5,
+ AREG_YMM6,
+ AREG_YMM7,
+ AREG_YMM8,
+ AREG_YMM9,
+ AREG_YMM10,
+ AREG_YMM11,
+ AREG_YMM12,
+ AREG_YMM13,
+ AREG_YMM14,
+ AREG_YMM15,
+
+ AREG_MXCSR,
+
+ AREG_R8CLASS, /* register class for 8 bit registers in i286 */
+ AREG_R16CLASS, /* register class for 16 bit registers in i286 */
+};
+
+enum class {
+ R8CLASS = 1 << 0,
+ R16CLASS = 1 << 1,
+};
--- /dev/null
+++ b/src/as/target/x86/rules.dat
@@ -1,0 +1,9 @@
+reg8 AREG_R8CLASS
+reg16 AREG_R16CLASS
+imm8 AIMM8
+imm16 AIMM16
+imm32 AIMM32
+imm64 AIMM64
+\(n\) ADIRECT
+sym ASYM
+string ASTR
--- /dev/null
+++ b/src/as/target/x86/x86.dat
@@ -1,0 +1,28 @@
+# Tab 16, tabs 16, :set ts=16
+# op args size bytes format cpu
+.DB imm8+ 0 none defb I286,I386,AMD64
+.DEFB imm8+ 0 none defb I286,I386,AMD64
+.BYTE imm8+ 0 none defb I286,I386,AMD64
+.DW imm16+ 0 none defw I286,I386,AMD64
+.DEFW imm16+ 0 none defw I286,I386,AMD64
+.SHORT imm16+ 0 none defw I286,I386,AMD64
+.WORD imm16+ 0 none defw I286
+.WORD imm32+ 0 none defd I386,AMD64
+.DD imm32+ 0 none defd I286,I386,AMD64
+.DEFD imm32+ 0 none defd I286,I386,AMD64
+.LONG imm32+ 0 none defd I286,I386
+.LONG imm64+ 0 none defq AMD64
+.INT imm32+ 0 none defd I386,AMD64
+.INT imm16+ 0 none defd I286
+.DQ imm64+ 0 none defq I286,I386,AMD64
+.DEFQ imm64+ 0 none defq I286,I386,AMD64
+.EQU imm16 0 none equ I286
+.EQU imm32 0 none equ I386
+.EQU imm64 0 none equ AMD64
+NOP none 1 0x90 noargs I286,I386,AMD64
+RET none 1 0xc3 noargs I286,I386,AMD64
+
+
+# 8 bit arithmetic operations
+ADDB reg8,reg8 2 0x00 reg8_reg8 I286,I386,AMD64
+ADDW reg16,reg16 2 0x01 reg16_reg16 I286,I386,AMD64
--- /dev/null
+++ b/src/as/target/z80.mk
@@ -1,0 +1,10 @@
+Z80_OBJ = $(OBJS) \
+ target/x80/z80tbl.o \
+ target/x80/z80.o \
+ target/x80/ins.o \
+
+target/x80/z80tbl.c: target/x80/x80.dat target/x80/rules.dat
+ ./mktbl -f x80 -c z80
+
+$(LIBEXEC)/as-z80: $(OBJ) $(Z80_OBJ)
+ $(CC) $(SCC_LDFLAGS) $(Z80_OBJ) -lscc -o $@
--- /dev/null
+++ b/src/cc1/Makefile
@@ -1,0 +1,38 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = types.o \
+ decl.o \
+ lex.o \
+ error.o \
+ symbol.o \
+ main.o \
+ expr.o \
+ code.o \
+ stmt.o \
+ cpp.o \
+ fold.o \
+ init.o \
+ builtin.o \
+
+TARGET = $(LIBEXEC)/cc1-amd64-sysv \
+ $(LIBEXEC)/cc1-arm64-sysv \
+ $(LIBEXEC)/cc1-i386-sysv \
+ $(LIBEXEC)/cc1-z80-scc \
+
+all: $(TARGET)
+
+$(TARGET): $(LIBDIR)/libscc.a
+
+dep: inc-dep
+
+clean:
+ rm -f target/*/*.o
+
+include target/amd64-sysv/arch.mk
+include target/arm64-sysv/arch.mk
+include target/i386-sysv/arch.mk
+include target/z80-scc/arch.mk
+include deps.mk
--- /dev/null
+++ b/src/cc1/TODO
@@ -1,0 +1,14 @@
+* Implement bitfields
+* Rewrite error recovery code, and ensure correct state after recovery
+* Parse correctly all integer and float constants
+* Add C99 features (almost all the new features of C99 are missed)
+* Add correct emit for any kind of constant
+* Add warning when some ANSI limit is violated.
+* Free memory in emit after some error happened.
+* Rewrite initializers to deal with the idea of "current object"
+* Add some test about pointer airthmetic.
+* Merge all the definitions of the same string
+* Do not assign identifierss until symbols are emitted. This change will
+ avoid identifiers that are not emitted.
+* Fix assignation abbreviations. They fail whe lhs type is smaller than
+ the type in rhs
--- /dev/null
+++ b/src/cc1/builtin.c
@@ -1,0 +1,121 @@
+static char sccsid[] = "@(#) ./cc1/builtin.c";
+
+#include <stdio.h>
+
+#include <scc/scc.h>
+#include "cc1.h"
+
+static Node *
+builtin_va_arg(Symbol *sym)
+{
+ Node *np, *ap;
+ Type *tp;
+
+ ap = assign();
+ expect(',');
+ tp = typename();
+
+ if (!valid_va_list(ap->type)) {
+ errorp("incorrect parameters for va_arg");
+ goto error;
+ }
+ if (tp == booltype ||
+ tp == chartype || tp == uchartype || tp == schartype ||
+ tp == shortype || tp == ushortype) {
+ warn("bool, char and short are promoted to int when passed through '...'");
+ tp = (tp->prop & TSIGNED) ? inttype : uinttype;
+ }
+
+ np = node(OBUILTIN, tp, ap, NULL);
+ np->sym = sym;
+ return np;
+
+error:
+ return constnode(zero);
+}
+
+static Node *
+builtin_va_copy(Symbol *sym)
+{
+ Node *np, *src, *dst;
+
+ dst = assign();
+ expect(',');
+ src = assign();
+
+ if (!valid_va_list(dst->type) || !valid_va_list(src->type)) {
+ errorp("incorrect parameters for va_copy");
+ return constnode(zero);
+ }
+
+ np = node(OBUILTIN, voidtype, dst, src);
+ np->sym = sym;
+ return np;
+}
+
+static Node *
+builtin_va_start(Symbol *sym)
+{
+ Node *np, *ap, *last;
+ Symbol **p;
+ Type *tp;
+
+ ap = assign();
+ expect(',');
+ last = assign();
+ if (last->op != OSYM)
+ goto error;
+
+ if (!valid_va_list(ap->type) || !(last->sym->flags&SDECLARED))
+ goto error;
+
+ for (p = curfun->u.pars; p && *p != last->sym; ++p)
+ ;
+ if (!p || *p == NULL || p[1] == NULL || p[1]->type != ellipsistype)
+ warn("second parameter of 'va_start' not last named argument");
+
+ tp = last->type;
+ if (tp == booltype ||
+ tp == chartype || tp == uchartype || tp == schartype ||
+ tp == shortype || tp == ushortype) {
+ warn("last parameter before '...' must not be bool, char or short");
+ }
+
+ np = node(OBUILTIN, voidtype, ap, last);
+ np->sym = sym;
+ return np;
+
+error:
+ errorp("incorrect parameters for va_start");
+ return constnode(zero);
+}
+
+static Node *
+builtin_va_end(Symbol *sym)
+{
+ Node *ap, *np;
+
+ ap = assign();
+
+ if (!valid_va_list(ap->type)) {
+ errorp("incorrect parameters for va_end");
+ return constnode(zero);
+ }
+
+ np = node(OBUILTIN, voidtype, ap, NULL);
+ np->sym = sym;
+ return np;
+}
+
+void
+ibuilts(void)
+{
+ struct builtin built[] = {
+ {"__builtin_va_arg", builtin_va_arg},
+ {"__builtin_va_copy", builtin_va_copy},
+ {"__builtin_va_start", builtin_va_start},
+ {"__builtin_va_end", builtin_va_end},
+ {NULL}
+ };
+ builtins(built);
+}
--- /dev/null
+++ b/src/cc1/cc1.h
@@ -1,0 +1,496 @@
+#define INPUTSIZ LINESIZ
+
+#define GLOBALCTX 0
+#define PARAMCTX 1
+
+#define NR_USWITCHES 20
+
+/*
+ * Definition of enumerations
+ */
+enum {
+ NOALLOC,
+ ALLOC
+};
+
+enum typeprops {
+ TDEFINED = 1 << 0, /* type defined */
+ TSIGNED = 1 << 1, /* signedness of the type */
+ TINTEGER = 1 << 2, /* the type is INT of enum */
+ TARITH = 1 << 3, /* the type is INT, ENUM or FLOAT */
+ TAGGREG = 1 << 4, /* the type is struct or union */
+ TK_R = 1 << 5, /* this is a K&R-function */
+ TELLIPSIS= 1 << 6, /* this function has an ellipsis par */
+ TFUNDEF = 1 << 7, /* function definition */
+};
+
+enum inputtype {
+ IMACRO = 1 << 0, /* macro expansion type */
+ IFILE = 1 << 1, /* input file type */
+ ISTDIN = 1 << 2, /* stdin type */
+ IEOF = 1 << 3, /* EOF mark */
+ ITYPE = IMACRO | IFILE | ISTDIN,
+};
+
+/* data type letters */
+enum ns {
+ L_INT8 = 'C',
+ L_INT16 = 'I',
+ L_INT32 = 'W',
+ L_INT64 = 'Q',
+ L_UINT8 = 'K',
+ L_UINT16 = 'N',
+ L_UINT32 = 'Z',
+ L_UINT64 = 'O',
+ L_BOOL = 'B',
+
+ L_FLOAT = 'J',
+ L_DOUBLE = 'D',
+ L_LDOUBLE = 'H',
+
+ L_ELLIPSIS = 'E',
+ L_VOID = '0',
+ L_POINTER = 'P',
+ L_FUNCTION = 'F',
+ L_ARRAY = 'V',
+ L_UNION = 'U',
+ L_STRUCT = 'S',
+ L_VA_ARG = '1',
+};
+
+/* recovery points */
+enum {
+ END_DECL,
+ END_LDECL,
+ END_COMP,
+ END_COND
+};
+
+/* type constructors */
+enum typeop {
+ FTN = 1,
+ PTR,
+ ARY,
+ KRFTN
+};
+
+/* namespaces */
+enum namespaces {
+ NS_DUMMY,
+ NS_IDEN,
+ NS_TAG,
+ NS_LABEL,
+ NS_CPP,
+ NS_KEYWORD,
+ NS_CPPCLAUSES,
+ NS_STRUCTS
+};
+
+/* symbol flags */
+enum {
+ SAUTO = 1 << 0,
+ SREGISTER = 1 << 1,
+ SDECLARED = 1 << 2,
+ SFIELD = 1 << 3,
+ SEXTERN = 1 << 4,
+ SUSED = 1 << 5,
+ SCONSTANT = 1 << 6,
+ SGLOBAL = 1 << 7,
+ SPRIVATE = 1 << 8,
+ SLOCAL = 1 << 9,
+ SEMITTED = 1 << 10,
+ SDEFINED = 1 << 11,
+ SSTRING = 1 << 12,
+ STYPEDEF = 1 << 13,
+ SINITLST = 1 << 14,
+ SHASINIT = 1 << 15
+};
+
+/* node flags */
+enum {
+ NLVAL = 1 << 0,
+ NCONST = 1 << 1,
+ NEFFECT = 1 << 2
+};
+
+/* lexer mode, compiler or preprocessor directive */
+enum {
+ CCMODE,
+ CPPMODE
+};
+
+/* input tokens */
+enum tokens {
+ CONST = 1 << 0, /* type qualifier tokens are used as flags */
+ RESTRICT = 1 << 1,
+ VOLATILE = 1 << 2,
+ INLINE = 1 << 3,
+ TQUALIFIER = 1 << 7, /* this value is picked outside of ASCII range */
+ TYPE,
+ IDEN,
+ SCLASS,
+ CONSTANT,
+ STRING,
+ SIZEOF,
+ INDIR,
+ INC,
+ DEC,
+ SHL,
+ SHR,
+ LE,
+ GE,
+ EQ,
+ NE,
+ AND,
+ OR,
+ MUL_EQ,
+ DIV_EQ,
+ MOD_EQ,
+ ADD_EQ,
+ SUB_EQ,
+ AND_EQ,
+ XOR_EQ,
+ OR_EQ,
+ SHL_EQ,
+ SHR_EQ,
+ ELLIPSIS,
+ CASE,
+ DEFAULT,
+ IF,
+ ELSE,
+ SWITCH,
+ WHILE,
+ DO,
+ FOR,
+ GOTO,
+ VOID,
+ FLOAT,
+ INT,
+ BOOL,
+ VA_LIST,
+ STRUCT,
+ UNION,
+ CHAR,
+ DOUBLE,
+ SHORT,
+ LONG,
+ LLONG,
+ COMPLEX,
+ TYPEDEF,
+ EXTERN,
+ STATIC,
+ AUTO,
+ REGISTER,
+ ENUM,
+ TYPEIDEN,
+ UNSIGNED,
+ SIGNED,
+ CONTINUE,
+ BREAK,
+ RETURN,
+ DEFINE,
+ INCLUDE,
+ LINE,
+ PRAGMA,
+ ERROR,
+ IFDEF,
+ ELIF,
+ IFNDEF,
+ UNDEF,
+ ENDIF,
+ BUILTIN,
+ EOFTOK
+};
+
+/* operations */
+enum op {
+ OADD,
+ OMUL,
+ OSUB,
+ OINC,
+ ODEC,
+ ODIV,
+ OMOD,
+ OSHL,
+ OSHR,
+ OBAND,
+ OBXOR,
+ OBOR,
+ OSNEG,
+ ONEG,
+ OCPL,
+ OAND,
+ OOR,
+ OEQ,
+ ONE,
+ OLT,
+ OGE,
+ OLE,
+ OGT,
+ OASSIGN,
+ OA_MUL,
+ OA_DIV,
+ OA_MOD,
+ OA_ADD,
+ OA_SUB,
+ OA_SHL,
+ OA_SHR,
+ OA_AND,
+ OA_XOR,
+ OA_OR,
+ OADDR,
+ OCOMMA,
+ OCAST,
+ OPTR,
+ OSYM,
+ OASK,
+ OCOLON,
+ OFIELD,
+ OLABEL,
+ ODEFAULT,
+ OCASE,
+ OJUMP,
+ OBRANCH,
+ OEXPR,
+ OEFUN,
+ OELOOP,
+ OBLOOP,
+ OFUN,
+ OPAR,
+ OCALL,
+ OCALLE,
+ ORET,
+ ODECL,
+ OBSWITCH,
+ OESWITCH,
+ OINIT,
+ OBUILTIN,
+ OTYP,
+};
+
+/*
+ * Definition of structures
+ */
+typedef struct type Type;
+typedef struct symbol Symbol;
+typedef struct swtch Switch;
+typedef struct node Node;
+typedef struct input Input;
+
+struct limits {
+ union {
+ TUINT i;
+ TFLOAT f;
+ } max;
+ union {
+ TUINT i;
+ TFLOAT f;
+ } min;
+};
+
+struct builtin {
+ char *str;
+ Node *(*fun)(Symbol *);
+};
+
+struct keyword {
+ char *str;
+ unsigned char token, value;
+};
+
+struct type {
+ unsigned char op; /* type builder operator */
+ unsigned char ns; /* namespace for struct members */
+ short id; /* type id, used in dcls */
+ char letter; /* letter of the type */
+ unsigned char prop; /* type properties */
+ unsigned char align; /* align of the type */
+ unsigned long size; /* sizeof the type */
+ Type *type; /* base type */
+ Symbol *tag; /* symbol of the strug tag */
+ union {
+ Type **pars; /* Function type parameters */
+ Symbol **fields; /* fields of aggregate type */
+ } p;
+ union {
+ unsigned char rank; /* convertion rank */
+ TINT elem; /* number of type parameters */
+ } n;
+ Type *next; /* local list pointer */
+ Type *h_next; /* hash collision list */
+};
+
+struct symbol {
+ unsigned char ctx;
+ unsigned char hide;
+ char ns;
+ unsigned short id;
+ unsigned short flags;
+ char *name;
+ Type *type;
+ unsigned char token;
+ union {
+ TINT i;
+ TUINT u;
+ TFLOAT f;
+ char *s;
+ unsigned char token;
+ Node **init;
+ Symbol **pars;
+ Node *(*fun)(Symbol *);
+ } u;
+ struct symbol *next;
+ struct symbol *hash;
+};
+
+struct node {
+ unsigned char op;
+ unsigned char flags;
+ Type *type;
+ Symbol *sym;
+ struct node *left, *right;
+};
+
+struct swtch {
+ short nr;
+ char hasdef;
+};
+
+struct yystype {
+ Symbol *sym;
+ unsigned char token;
+};
+
+#ifdef stdin
+struct input {
+ char flags;
+ unsigned lineno;
+ char *filenam;
+ FILE *fp;
+ Symbol *hide;
+ char *line, *begin, *p;
+ struct input *next;
+};
+#endif
+
+/* error.c */
+extern void error(char *fmt, ...);
+extern void warn(char *fmt, ...);
+extern void unexpected(void);
+extern void errorp(char *fmt, ...);
+extern void cpperror(char *fmt, ...);
+extern Type *deftype(Type *tp);
+
+/* types.c */
+extern int eqtype(Type *tp1, Type *tp2, int eqflag);
+extern Type *ctype(int type, int sign, int size);
+extern Type *mktype(Type *tp, int op, TINT nelem, Type *data[]);
+extern Type *duptype(Type *base);
+extern struct limits *getlimits(Type *tp);
+extern void typesize(Type *tp);
+extern void flushtypes(void);
+
+/* symbol.c */
+extern void dumpstab(Symbol **tbl, char *msg);
+extern Symbol *lookup(int ns, char *name, int alloc);
+extern Symbol *nextsym(Symbol *sym, int ns);
+extern Symbol *install(int ns, Symbol *sym);
+extern Symbol *newsym(int ns, char *name);
+extern void pushctx(void), popctx(void);
+extern void killsym(Symbol *sym);
+extern Symbol *newlabel(void);
+extern void keywords(struct keyword *key, int ns);
+extern void builtins(struct builtin *builts);
+extern Symbol *newstring(char *s, size_t len);
+extern unsigned newid(void);
+
+/* stmt.c */
+extern void compound(Symbol *lbreak, Symbol *lcont, Switch *sw);
+
+/* decl.c */
+extern Type *typename(void);
+extern void decl(void);
+
+/* lex.c */
+extern int ahead(void);
+extern int next(void);
+extern void expect(int tok);
+extern void discard(void);
+extern void addinput(char *fname, Symbol *hide, char *buffer);
+extern void delinput(void);
+extern void setsafe(int type);
+extern void ilex(void);
+extern void setloc(char *fname, unsigned line);
+#define accept(t) ((yytoken == (t)) ? next() : 0)
+
+/* code.c */
+extern void prtree(Node *np);
+extern void emit(int, void *);
+extern Node *node(int op, Type *tp, Node *left, Node *rigth);
+extern Node *varnode(Symbol *sym);
+extern Node *constnode(Symbol *sym);
+extern Node *sizeofnode(Type *tp);
+extern void freetree(Node *np);
+extern void icode(void);
+#define BTYPE(np) ((np)->type->op)
+
+/* fold.c */
+extern Node *simplify(Node *np);
+extern TUINT ones(int nbytes);
+
+/* expr.c */
+extern Node *decay(Node *), *negate(Node *np), *assign(void);
+extern Node *convert(Node *np, Type *tp1, int iscast);
+extern Node *constexpr(void), *condexpr(int neg), *expr(void);
+extern int isnodecmp(int op);
+extern int negop(int op);
+extern int cmpnode(Node *np, TUINT val);
+
+/* init.c */
+extern void initializer(Symbol *sym, Type *tp);
+extern Node *initlist(Type *tp);
+
+/* cpp.c */
+extern void icpp(void);
+extern int cpp(void);
+extern int expand(char *begin, Symbol *sym);
+extern void incdir(char *dir);
+extern void outcpp(void);
+extern void defdefine(char *macro, char *val, char *source);
+extern void undefmacro(char *s);
+extern void ppragmaln(void);
+
+/* builtin.c */
+extern void ibuilts(void);
+
+/* arch.c */
+extern void iarch(void);
+extern int valid_va_list(Type *tp);
+
+/*
+ * Definition of global variables
+ */
+extern struct yystype yylval;
+extern char yytext[];
+extern int yytoken;
+extern unsigned short yylen;
+extern int disexpand;
+extern unsigned cppctx;
+extern Input *input;
+extern int lexmode, namespace;
+extern int onlycpp, onlyheader;
+extern unsigned curctx;
+extern Symbol *curfun, *zero, *one;
+extern char *infile;
+extern unsigned lineno;
+extern char filenam[];
+
+extern Type *voidtype, *pvoidtype, *booltype,
+ *uchartype, *chartype, *schartype,
+ *uinttype, *inttype,
+ *sizettype, *pdifftype,
+ *ushortype, *shortype,
+ *longtype, *ulongtype,
+ *ullongtype, *llongtype,
+ *floattype, *doubletype, *ldoubletype,
+ *ellipsistype, *va_list_type, *va_type;
--- /dev/null
+++ b/src/cc1/code.c
@@ -1,0 +1,550 @@
+static char sccsid[] = "@(#) ./cc1/code.c";
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include <scc/scc.h>
+#include "cc1.h"
+
+static void emitbin(int, void *),
+ emitcast(int, void *),
+ emitsym(int, void *),
+ emitexp(int, void *),
+ emitsymid(int, void *),
+ emittext(int, void *),
+ emitfun(int, void *),
+ emitdcl(int, void *),
+ emitinit(int, void *),
+ emittype(int, void *),
+ emitbuilt(int, void *);
+
+char *optxt[] = {
+ [OADD] = "+",
+ [OSUB] = "-",
+ [OMUL] = "*",
+ [OINC] = ":i",
+ [ODEC] = ":d",
+ [OPTR] = "@",
+ [OMOD] = "%",
+ [ODIV] = "/",
+ [OSHL] = "l",
+ [OSHR] = "r",
+ [OLT] = "<",
+ [OGT] = ">",
+ [OGE] = "]",
+ [OLE] = "[",
+ [OEQ] = "=",
+ [ONE] = "!",
+ [OBAND] = "&",
+ [OBXOR] = "^",
+ [OBOR] = "|",
+ [OASSIGN] = ":",
+ [OA_MUL] = ":*",
+ [OA_DIV] = ":/",
+ [OA_MOD] = ":%",
+ [OA_ADD] = ":+",
+ [OA_SUB] = ":-",
+ [OA_SHL] = ":l",
+ [OA_SHR] = ":r",
+ [OA_AND] = ":&",
+ [OA_XOR] = ":^",
+ [OA_OR] = ":|",
+ [OADDR] = "'",
+ [OSNEG] = "_",
+ [ONEG] = "n",
+ [OCPL] = "~",
+ [OAND] = "a",
+ [OOR] = "o",
+ [OASK] = "?",
+ [OCOMMA] = ",",
+ [OLABEL] = "L%d\n",
+ [ODEFAULT] = "\tf\tL%d\n",
+ [OBSWITCH] = "\ts",
+ [OESWITCH] = "\tt\tL%d\n",
+ [OCASE] = "\tv\tL%d",
+ [OJUMP] = "\tj\tL%d\n",
+ [OBRANCH] = "\ty\tL%d",
+ [OEFUN] = "}\n",
+ [OELOOP] = "\tb\n",
+ [OBLOOP] = "\te\n",
+ [ORET] = "\th",
+ [OPAR] = "p",
+ [OCALL] = "c",
+ [OCALLE] = "z",
+ [OFIELD] = "."
+};
+
+void (*opcode[])(int, void *) = {
+ [OADD] = emitbin,
+ [OSUB] = emitbin,
+ [OMUL] = emitbin,
+ [OINC] = emitbin,
+ [ODEC] = emitbin,
+ [OPTR] = emitbin,
+ [OMOD] = emitbin,
+ [ODIV] = emitbin,
+ [OSHL] = emitbin,
+ [OSHR] = emitbin,
+ [OLT] = emitbin,
+ [OGT] = emitbin,
+ [OGE] = emitbin,
+ [OLE] = emitbin,
+ [OEQ] = emitbin,
+ [ONE] = emitbin,
+ [OBAND] = emitbin,
+ [OBXOR] = emitbin,
+ [OBOR] = emitbin,
+ [OASSIGN] = emitbin,
+ [OA_MUL] = emitbin,
+ [OA_DIV] = emitbin,
+ [OA_MOD] = emitbin,
+ [OA_ADD] = emitbin,
+ [OA_SUB] = emitbin,
+ [OA_SHL] = emitbin,
+ [OA_SHR] = emitbin,
+ [OA_AND] = emitbin,
+ [OA_XOR] = emitbin,
+ [OA_OR] = emitbin,
+ [OADDR] = emitbin,
+ [OSNEG] = emitbin,
+ [ONEG] = emitbin,
+ [OCPL] = emitbin,
+ [OAND] = emitbin,
+ [OOR] = emitbin,
+ [OCOMMA] = emitbin,
+ [OCAST] = emitcast,
+ [OSYM] = emitsym,
+ [OASK] = emitbin,
+ [OCOLON] = emitbin,
+ [OFIELD]= emitbin,
+ [OEXPR] = emitexp,
+ [OLABEL] = emitsymid,
+ [ODEFAULT] = emitsymid,
+ [OCASE] = emitsymid,
+ [OJUMP] = emitsymid,
+ [OBRANCH] = emitsymid,
+ [OEFUN] = emittext,
+ [OELOOP] = emittext,
+ [OBLOOP] = emittext,
+ [OFUN] = emitfun,
+ [ORET] = emittext,
+ [ODECL] = emitdcl,
+ [OBSWITCH] = emittext,
+ [OESWITCH] = emitsymid,
+ [OPAR] = emitbin,
+ [OCALL] = emitbin,
+ [OCALLE] = emitbin,
+ [OINIT] = emitinit,
+ [OBUILTIN] = emitbuilt,
+ [OTYP] = emittype,
+};
+
+static FILE *outfp;
+
+void
+icode(void)
+{
+ outfp = stdout;
+}
+
+void
+freetree(Node *np)
+{
+ if (!np)
+ return;
+ freetree(np->left);
+ freetree(np->right);
+ free(np);
+}
+
+static void
+emitnode(Node *np)
+{
+ if (np)
+ (*opcode[np->op])(np->op, np);
+}
+
+void
+prtree(Node *np)
+{
+ outfp = stderr;
+ fputs("DBG prtree", outfp);
+ emitnode(np);
+ putc('\n', outfp);
+ outfp = stdout;
+}
+
+void
+emit(int op, void *arg)
+{
+ extern int failure;
+
+ if (failure || onlycpp || onlyheader)
+ return;
+ (*opcode[op])(op, arg);
+}
+
+static void
+emitvar(Symbol *sym)
+{
+ int c;
+ short flags = sym->flags;
+
+ if (flags & SLOCAL)
+ c = 'T';
+ else if (flags & SPRIVATE)
+ c = 'Y';
+ else if (flags & SGLOBAL)
+ c = 'G';
+ else if (flags & SREGISTER)
+ c = 'R';
+ else if (flags & SFIELD)
+ c = 'M';
+ else if (flags & SEXTERN)
+ c = 'X';
+ else
+ c = 'A';
+ fprintf(outfp, "%c%u", c, sym->id);
+}
+
+static void
+emitconst(Node *np)
+{
+ Symbol *sym = np->sym;
+ Type *tp = np->type;
+ TUINT u;
+
+ switch (tp->op) {
+ case PTR:
+ case INT:
+ case ENUM:
+ u = (tp->prop & TSIGNED) ? (TUINT) sym->u.i : sym->u.u;
+ fprintf(outfp,
+ "#%c%llX",
+ np->type->letter,
+ (long long) u & ones(tp->size));
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+emitsym(int op, void *arg)
+{
+ Node *np = arg;
+
+ if ((np->sym->flags & SINITLST) == 0) {
+ /*
+ * When we have a compound literal we are going
+ * to call to emitnode for every element of it,
+ * and it means that we will have two '\t'
+ * for the first element
+ */
+ putc('\t', outfp);
+ }
+ (np->flags & NCONST) ? emitconst(np) : emitvar(np->sym);
+}
+
+static void
+emitletter(Type *tp)
+{
+ int letter;
+
+ letter = (tp->prop&TELLIPSIS) ? 'E' : tp->letter;
+ putc(letter, outfp);
+ switch (tp->op) {
+ case ARY:
+ case STRUCT:
+ case UNION:
+ fprintf(outfp, "%u", tp->id);
+ }
+}
+
+static void
+emittype(int op, void *arg)
+{
+ TINT n;
+ Symbol **sp;
+ char *tag;
+ Type *tp = arg;
+
+ if (!(tp->prop & TDEFINED))
+ return;
+
+ switch (tp->op) {
+ case ARY:
+ emitletter(tp);
+ putc('\t', outfp);
+ emitletter(tp->type);
+ fprintf(outfp,
+ "\t#%c%llX\n",
+ sizettype->letter, (long long) tp->n.elem);
+ return;
+ case UNION:
+ case STRUCT:
+ emitletter(tp);
+ tag = tp->tag->name;
+ fprintf(outfp,
+ "\t\"%s\t#%c%lX\t#%c%X\n",
+ (tag) ? tag : "",
+ sizettype->letter,
+ tp->size,
+ sizettype->letter,
+ tp->align);
+ n = tp->n.elem;
+ for (sp = tp->p.fields; n-- > 0; ++sp)
+ emit(ODECL, *sp);
+ break;
+ case PTR:
+ case FTN:
+ case ENUM:
+ return;
+ default:
+ abort();
+ }
+}
+
+static void
+emitstring(Symbol *sym, Type *tp)
+{
+ char *bp, *s, *lim;
+ int n;
+
+ bp = sym->u.s;
+ lim = &sym->u.s[tp->n.elem];
+ while (bp < lim) {
+ s = bp;
+ while (bp < lim && isprint(*bp))
+ ++bp;
+ if ((n = bp - s) > 1)
+ fprintf(outfp, "\t#\"%.*s\n", n, s);
+ else
+ bp = s;
+ if (bp == lim)
+ break;
+ do {
+ fprintf(outfp,
+ "\t#%c%02X\n",
+ chartype->letter, (*bp++) & 0xFF);
+ } while (bp < lim && !isprint(*bp));
+ }
+}
+
+static void
+emitdesig(Node *np, Type *tp)
+{
+ Symbol *sym;
+ size_t n; /* TODO: This should be SIZET */
+ Node *aux;
+ Type *p;
+
+ if (!np) {
+ sym = NULL;
+ } else {
+ if (!np->sym)
+ goto emit_expression;
+ sym = np->sym;
+ if (sym->flags & SSTRING) {
+ emitstring(sym, tp);
+ return;
+ }
+ if ((sym->flags & SINITLST) == 0)
+ goto emit_expression;
+ }
+
+ switch (tp->op) {
+ case PTR:
+ case INT:
+ case ENUM:
+ aux = (sym) ? *sym->u.init : convert(constnode(zero), tp, 0);
+ emitexp(OEXPR, aux);
+ break;
+ case UNION:
+ n = tp->n.elem-1;
+ aux = (sym) ? sym->u.init[0] : NULL;
+ emitdesig(aux, aux->type);
+ break;
+ case STRUCT:
+ case ARY:
+ for (n = 0; n < tp->n.elem; ++n) {
+ aux = (sym) ? sym->u.init[n] : NULL;
+ p = (tp->op == ARY) ? tp->type : tp->p.fields[n]->type;
+ emitdesig(aux, p);
+ }
+ break;
+ default:
+ abort();
+ }
+
+ if (sym) {
+ free(sym->u.init);
+ sym->u.init = NULL;
+ }
+ freetree(np);
+ return;
+
+emit_expression:
+ emitexp(OEXPR, np);
+}
+
+static void
+emitinit(int op, void *arg)
+{
+ Node *np = arg;
+
+ fputs("\t(\n", outfp);
+ emitdesig(np, np->type);
+ fputs(")\n", outfp);
+}
+
+static void
+emitdcl(int op, void *arg)
+{
+ Symbol *sym = arg;
+
+ if (sym->flags & SEMITTED)
+ return;
+ emitvar(sym);
+ putc('\t', outfp);
+ if (sym->type->op == FTN) {
+ emitletter(sym->type->type);
+ putc('\t', outfp);
+ }
+ emitletter(sym->type);
+ fprintf(outfp, "\t\"%s", (sym->name) ? sym->name : "");
+ if (sym->flags & SFIELD)
+ fprintf(outfp, "\t#%c%llX", sizettype->letter, sym->u.i);
+ sym->flags |= SEMITTED;
+ if ((sym->flags & SHASINIT) == 0)
+ putc('\n', outfp);
+}
+
+static void
+emitcast(int op, void *arg)
+{
+ Node *np = arg, *lp = np->left;
+
+ emitnode(lp);
+ if (np->type != voidtype)
+ fprintf(outfp, "\tg%c", np->type->letter);
+}
+
+static void
+emitbin(int op, void *arg)
+{
+ Node *np = arg;
+ char *s;
+
+ emitnode(np->left);
+ emitnode(np->right);
+ if ((s = optxt[op]) != NULL) { /* do not print in OCOLON case */
+ fprintf(outfp, "\t%s", s);
+ emitletter(np->type);
+ }
+}
+
+static void
+emitbuilt(int op, void *arg)
+{
+ Node *np = arg;
+
+ emitnode(np->left);
+ emitnode(np->right);
+ fprintf(outfp, "\t\"%s\tm", np->sym->name);
+ emitletter(np->type);
+}
+
+
+static void
+emitexp(int op, void *arg)
+{
+ Node *np = arg;
+
+ emitnode(np);
+ putc('\n', outfp);
+ freetree(np);
+}
+
+static void
+emitfun(int op, void *arg)
+{
+ Symbol *sym = arg, **sp;
+
+ emitdcl(op, arg);
+ fputs("{\n", outfp);
+
+ for (sp = sym->u.pars; sp && *sp; ++sp)
+ emit(ODECL, *sp);
+ fputs("\\\n", outfp);
+}
+
+static void
+emittext(int op, void *arg)
+{
+ fputs(optxt[op], outfp);
+}
+
+static void
+emitsymid(int op, void *arg)
+{
+ Symbol *sym = arg;
+ fprintf(outfp, optxt[op], sym->id);
+}
+
+Node *
+node(int op, Type *tp, Node *lp, Node *rp)
+{
+ Node *np;
+
+ np = xmalloc(sizeof(*np));
+ np->op = op;
+ np->type = tp;
+ np->sym = NULL;
+ np->flags = 0;
+ np->left = lp;
+ np->right = rp;
+
+ if (lp)
+ np->flags |= lp->flags & NEFFECT;
+ if (rp)
+ np->flags |= rp->flags & NEFFECT;
+ return np;
+}
+
+Node *
+varnode(Symbol *sym)
+{
+ Node *np;
+ Type *tp = sym->type;
+
+ np = node(OSYM, sym->type, NULL, NULL);
+ np->type = sym->type;
+ np->flags = (tp->op != FTN && tp->op != ARY) ? NLVAL : 0;
+ np->sym = sym;
+ return np;
+}
+
+Node *
+constnode(Symbol *sym)
+{
+ Node *np;
+
+ np = node(OSYM, sym->type, NULL, NULL);
+ np->type = sym->type;
+ np->flags = NCONST;
+ np->sym = sym;
+ return np;
+}
+
+Node *
+sizeofnode(Type *tp)
+{
+ Symbol *sym;
+
+ sym = newsym(NS_IDEN, NULL);
+ sym->type = sizettype;
+ sym->u.i = tp->size;
+ return constnode(sym);
+}
--- /dev/null
+++ b/src/cc1/cpp.c
@@ -1,0 +1,839 @@
+static char sccsid[] = "@(#) ./cc1/cpp.c";
+#include <ctype.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+static char *argp, *macroname;
+static unsigned arglen;
+static unsigned ncmdlines;
+static Symbol *symline, *symfile;
+static unsigned char ifstatus[NR_COND];
+static int cppoff;
+static struct items dirinclude;
+
+unsigned cppctx;
+int disexpand;
+
+void
+defdefine(char *macro, char *val, char *source)
+{
+ char *def, *fmt = "#define %s %s\n";
+ Symbol dummy = {.flags = SDECLARED};
+
+ if (!val)
+ val = "";
+ def = xmalloc(strlen(fmt) + strlen(macro) + strlen(val));
+
+ sprintf(def, fmt, macro, val);
+ lineno = ++ncmdlines;
+ addinput(source, &dummy, def);
+ cpp();
+ delinput();
+}
+
+void
+undefmacro(char *s)
+{
+ killsym(lookup(NS_CPP, s, NOALLOC));
+}
+
+void
+icpp(void)
+{
+ static char sdate[14], stime[11];
+ struct tm *tm;
+ time_t t;
+ static char **bp, *list[] = {
+ "__STDC__",
+ "__STDC_HOSTED__",
+ "__SCC__",
+ NULL
+ };
+ static struct keyword keys[] = {
+ {"define", DEFINE, DEFINE},
+ {"include", INCLUDE, INCLUDE},
+ {"line", LINE, LINE},
+ {"ifdef", IFDEF, IFDEF},
+ {"if", IF, IF},
+ {"elif", ELIF, ELIF},
+ {"else", ELSE, ELSE},
+ {"ifndef", IFNDEF, IFNDEF},
+ {"endif", ENDIF, ENDIF},
+ {"undef", UNDEF, UNDEF},
+ {"pragma", PRAGMA, PRAGMA},
+ {"error", ERROR, ERROR},
+ {NULL, 0, 0}
+ };
+
+ keywords(keys, NS_CPPCLAUSES);
+
+ t = time(NULL);
+ tm = localtime(&t);
+ strftime(sdate, sizeof(sdate), "\"%b %d %Y\"", tm);
+ strftime(stime, sizeof(stime), "\"%H:%M:%S\"", tm);
+ defdefine("__DATE__", sdate, "built-in");
+ defdefine("__TIME__", stime, "built-in");
+ defdefine("__STDC_VERSION__", STDC_VERSION, "built-in");
+ defdefine("__LINE__", NULL, "built-in");
+ defdefine("__FILE__", NULL, "built-in");
+
+ symline = lookup(NS_CPP, "__LINE__", ALLOC);
+ symfile = lookup(NS_CPP, "__FILE__", ALLOC);
+
+ for (bp = list; *bp; ++bp)
+ defdefine(*bp, "1", "built-in");
+
+ ncmdlines = 0;
+}
+
+static void
+nextcpp(void)
+{
+ next();
+ if (yytoken == EOFTOK)
+ error("unterminated argument list invoking macro \"%s\"",
+ macroname);
+ if (yylen + 1 > arglen)
+ error("argument overflow invoking macro \"%s\"",
+ macroname);
+ if (yytoken == IDEN)
+ yylval.sym->flags |= SUSED;
+ memcpy(argp, yytext, yylen);
+ argp += yylen;
+ *argp++ = ' ';
+ arglen -= yylen + 1;
+}
+
+static void
+paren(void)
+{
+ for (;;) {
+ nextcpp();
+ switch (yytoken) {
+ case ')':
+ return;
+ case '(':
+ paren();
+ break;
+ }
+ }
+}
+
+static void
+parameter(void)
+{
+ for (;;) {
+ nextcpp();
+ switch (yytoken) {
+ case ')':
+ case ',':
+ argp -= 3; /* remove " , " or " ) "*/
+ *argp++ = '\0';
+ return;
+ case '(':
+ paren();
+ break;
+ }
+ }
+}
+
+static int
+parsepars(char *buffer, char **listp, int nargs)
+{
+ int n;
+
+ if (nargs == -1)
+ return -1;
+ if (ahead() != '(' && nargs > 0)
+ return 0;
+
+ disexpand = 1;
+ next();
+ n = 0;
+ argp = buffer;
+ arglen = INPUTSIZ;
+ if (ahead() == ')') {
+ next();
+ } else {
+ do {
+ *listp++ = argp;
+ parameter();
+ } while (++n < NR_MACROARG && yytoken == ',');
+ }
+ if (yytoken != ')')
+ error("incorrect macro function-alike invocation");
+ disexpand = 0;
+
+ if (n == NR_MACROARG)
+ error("too many parameters in macro \"%s\"", macroname);
+ if (n != nargs) {
+ error("macro \"%s\" received %d arguments, but it takes %d",
+ macroname, n, nargs);
+ }
+
+ return 1;
+}
+
+static size_t
+copymacro(char *buffer, char *s, size_t bufsiz, char *arglist[])
+{
+ int delim, prevc, c;
+ char *p, *arg, *bp = buffer;
+ size_t size;
+
+ for (prevc = '\0'; c = *s; prevc = c, ++s) {
+ switch (c) {
+ case '$':
+ while (bp[-1] == ' ')
+ --bp, ++bufsiz;
+ while (s[1] == ' ')
+ ++s;
+ case '#':
+ break;
+ case '\'':
+ delim = '\'';
+ goto search_delim;
+ case '\"':
+ delim = '"';
+ search_delim:
+ for (p = s; *++s != delim; )
+ ;
+ size = s - p + 1;
+ if (size > bufsiz)
+ goto expansion_too_long;
+ memcpy(bp, p, size);
+ bufsiz -= size;
+ bp += size;
+ break;
+ case '@':
+ if (prevc == '#')
+ bufsiz -= 2;
+ arg = arglist[atoi(++s)];
+ size = strlen(arg);
+ if (size > bufsiz)
+ goto expansion_too_long;
+ if (prevc == '#')
+ *bp++ = '"';
+ memcpy(bp, arg, size);
+ bp += size;
+ if (prevc == '#')
+ *bp++ = '"';
+ bufsiz -= size;
+ s += 2;
+ break;
+ default:
+ if (bufsiz-- == 0)
+ goto expansion_too_long;
+ *bp++ = c;
+ break;
+ }
+ }
+ *bp = '\0';
+
+ return bp - buffer;
+
+expansion_too_long:
+ error("macro expansion of \"%s\" too long", macroname);
+}
+
+int
+expand(char *begin, Symbol *sym)
+{
+ size_t elen;
+ int n, i;
+ char *s = sym->u.s;
+ char *arglist[NR_MACROARG], arguments[INPUTSIZ], buffer[INPUTSIZ];
+
+ macroname = sym->name;
+ if (sym == symfile) {
+ elen = sprintf(buffer, "\"%s\" ", filenam);
+ goto substitute;
+ }
+ if (sym == symline) {
+ elen = sprintf(buffer, "%d ", lineno);
+ goto substitute;
+ }
+ if (!s)
+ return 1;
+
+ n = atoi(s);
+ if (!parsepars(arguments, arglist, atoi(s)))
+ return 0;
+ for (i = 0; i < n; ++i)
+ DBG("MACRO par%d:%s", i, arglist[i]);
+
+ elen = copymacro(buffer, s+3, INPUTSIZ-1, arglist);
+
+substitute:
+ DBG("MACRO '%s' expanded to :'%s'", macroname, buffer);
+ buffer[elen] = '\0';
+ addinput(filenam, sym, xstrdup(buffer));
+
+ return 1;
+}
+
+static int
+getpars(Symbol *args[NR_MACROARG])
+{
+ int n, c;
+ Symbol *sym;
+
+ c = *input->p;
+ next();
+ if (c != '(')
+ return -1;
+ next(); /* skip the '(' */
+ if (accept(')'))
+ return 0;
+
+ n = 0;
+ do {
+ if (n == NR_MACROARG) {
+ cpperror("too many parameters in macro");
+ return NR_MACROARG;
+ }
+ if (accept(ELLIPSIS)) {
+ args[n++] = NULL;
+ break;
+ }
+ if (yytoken != IDEN) {
+ cpperror("macro arguments must be identifiers");
+ return NR_MACROARG;
+ }
+ sym = install(NS_IDEN, yylval.sym);
+ sym->flags |= SUSED;
+ args[n++] = sym;
+ next();
+ } while (accept(','));
+ expect(')');
+
+ return n;
+}
+
+static int
+getdefs(Symbol *args[NR_MACROARG], int nargs, char *bp, size_t bufsiz)
+{
+ Symbol **argp;
+ size_t len;
+ int prevc = 0, ispar;
+
+ if (yytoken == '$') {
+ cpperror("'##' cannot appear at either ends of a macro expansion");
+ return 0;
+ }
+
+ for (;;) {
+ ispar = 0;
+ if (yytoken == IDEN && nargs >= 0) {
+ for (argp = args; argp < &args[nargs]; ++argp) {
+ if (*argp == yylval.sym)
+ break;
+ }
+ if (argp != &args[nargs]) {
+ sprintf(yytext, "@%02d@", (int) (argp - args));
+ ispar = 1;
+ }
+ }
+ if (prevc == '#' && !ispar) {
+ cpperror("'#' is not followed by a macro parameter");
+ return 0;
+ }
+ if (yytoken == '\n')
+ break;
+
+ if ((len = strlen(yytext)) >= bufsiz) {
+ cpperror("macro too long");
+ return 0;
+ }
+ if (yytoken == '$') {
+ *bp++ = '$';
+ --bufsiz;
+ } else {
+ memcpy(bp, yytext, len);
+ bp += len;
+ bufsiz -= len;
+ }
+ if ((prevc = yytoken) != '#') {
+ *bp++ = ' ';
+ --bufsiz;
+ }
+ next();
+ }
+ *bp = '\0';
+ return 1;
+}
+
+static void
+define(void)
+{
+ Symbol *sym,*args[NR_MACROARG];
+ char buff[LINESIZ+1];
+ int n;
+
+ if (cppoff)
+ return;
+
+ namespace = NS_CPP;
+ next();
+
+ if (yytoken != IDEN) {
+ cpperror("macro names must be identifiers");
+ return;
+ }
+ sym = yylval.sym;
+ if (sym->flags & SDECLARED) {
+ warn("'%s' redefined", yytext);
+ free(sym->u.s);
+ } else {
+ sym = install(NS_CPP, sym);
+ sym->flags |= SDECLARED|SSTRING;
+ }
+
+ namespace = NS_IDEN; /* Avoid polution in NS_CPP */
+ if ((n = getpars(args)) == NR_MACROARG)
+ goto delete;
+ if (n > 0 && !args[n-1]) /* it is a variadic function */
+ --n;
+ sprintf(buff, "%02d#", n);
+ if (!getdefs(args, n, buff+3, LINESIZ-3))
+ goto delete;
+ sym->u.s = xstrdup(buff);
+ DBG("MACRO '%s' defined as '%s'", sym->name, buff);
+ return;
+
+delete:
+ killsym(sym);
+}
+
+void
+incdir(char *dir)
+{
+ if (!dir || *dir == '\0')
+ die("cc1: incorrect -I flag");
+ newitem(&dirinclude, dir);
+}
+
+static int
+includefile(char *dir, char *file, size_t filelen)
+{
+ size_t dirlen;
+ char path[FILENAME_MAX];
+
+ if (!dir) {
+ dirlen = 0;
+ if (filelen > FILENAME_MAX-1)
+ return 0;
+ } else {
+ dirlen = strlen(dir);
+ if (dirlen + filelen > FILENAME_MAX-2)
+ return 0;
+ memcpy(path, dir, dirlen);
+ if (dir[dirlen-1] != '/')
+ path[dirlen++] = '/';
+ }
+ memcpy(path+dirlen, file, filelen);
+ path[dirlen + filelen] = '\0';
+
+ addinput(path, NULL, NULL);
+ return 1;
+}
+
+static char *
+cwd(char *buf)
+{
+ char *p, *s = filenam;
+ size_t len;
+
+ if ((p = strrchr(s, '/')) == NULL)
+ return NULL;
+ if ((len = p - s) >= FILENAME_MAX)
+ die("cc1: current work directory too long");
+ memcpy(buf, s, len);
+ buf[len] = '\0';
+ return buf;
+}
+
+static void
+include(void)
+{
+ char dir[FILENAME_MAX], file[FILENAME_MAX], *p, **bp;
+ size_t filelen;
+ int n;
+
+ if (cppoff)
+ return;
+
+ namespace = NS_IDEN;
+ next();
+
+ switch (*yytext) {
+ case '<':
+ if ((p = strchr(input->begin, '>')) == NULL || p[-1] == '<')
+ goto bad_include;
+ filelen = p - input->begin;
+ if (filelen >= FILENAME_MAX)
+ goto too_long;
+ memcpy(file, input->begin, filelen);
+ file[filelen] = '\0';
+
+ input->begin = input->p = p+1;
+ if (next() != '\n')
+ goto trailing_characters;
+
+ break;
+ case '"':
+ if (yylen < 3)
+ goto bad_include;
+ filelen = yylen-2;
+ if (filelen >= FILENAME_MAX)
+ goto too_long;
+ memcpy(file, yytext+1, filelen);
+ file[filelen] = '\0';
+
+ if (next() != '\n')
+ goto trailing_characters;
+
+ if (includefile(cwd(dir), file, filelen))
+ goto its_done;
+ break;
+ default:
+ goto bad_include;
+ }
+
+ n = dirinclude.n;
+ for (bp = dirinclude.s; n--; ++bp) {
+ if (includefile(*bp, file, filelen))
+ goto its_done;
+ }
+ cpperror("included file '%s' not found", file);
+
+its_done:
+ return;
+
+trailing_characters:
+ cpperror("trailing characters after preprocessor directive");
+ return;
+
+too_long:
+ cpperror("too long file name in #include");
+ return;
+
+bad_include:
+ cpperror("#include expects \"FILENAME\" or <FILENAME>");
+ return;
+}
+
+static void
+line(void)
+{
+ long n;
+ char *endp, *fname;
+
+ if (cppoff)
+ return;
+
+ disexpand = 0;
+ next();
+ n = strtol(yytext, &endp, 10);
+ if (n <= 0 || n > USHRT_MAX || *endp != '\0') {
+ cpperror("first parameter of #line is not a positive integer");
+ return;
+ }
+
+ next();
+ if (yytoken == '\n') {
+ fname = NULL;
+ } else {
+ if (*yytext != '\"' || yylen == 1) {
+ cpperror("second parameter of #line is not a valid filename");
+ return;
+ }
+ fname = yylval.sym->u.s;
+ }
+ setloc(fname, n - 1);
+ if (yytoken != '\n')
+ next();
+}
+
+static void
+pragma(void)
+{
+ if (cppoff)
+ return;
+ next();
+ warn("ignoring pragma '%s'", yytext);
+ *input->p = '\0';
+ next();
+}
+
+static void
+usererr(void)
+{
+ if (cppoff)
+ return;
+ cpperror("#error %s", input->p);
+ *input->p = '\0';
+ next();
+}
+
+static void
+ifclause(int negate, int isifdef)
+{
+ Symbol *sym;
+ unsigned n;
+ int status;
+ Node *expr;
+
+ if (cppctx == NR_COND-1)
+ error("too many nesting levels of conditional inclusion");
+
+ n = cppctx++;
+ namespace = NS_CPP;
+ next();
+
+ if (isifdef) {
+ if (yytoken != IDEN) {
+ cpperror("no macro name given in #%s directive",
+ (negate) ? "ifndef" : "ifdef");
+ return;
+ }
+ sym = yylval.sym;
+ next();
+ status = (sym->flags & SDECLARED) != 0;
+ if (!status)
+ killsym(sym);
+ } else {
+ /* TODO: catch recovery here */
+ if ((expr = constexpr()) == NULL) {
+ cpperror("parameter of #if is not an integer constant expression");
+ return;
+ }
+ status = expr->sym->u.i != 0;
+ freetree(expr);
+ }
+
+ if (negate)
+ status = !status;
+ if ((ifstatus[n] = status) == 0)
+ ++cppoff;
+}
+
+static void
+cppif(void)
+{
+ disexpand = 0;
+ ifclause(0, 0);
+}
+
+static void
+ifdef(void)
+{
+ ifclause(0, 1);
+}
+
+static void
+ifndef(void)
+{
+ ifclause(1, 1);
+}
+
+static void
+elseclause(void)
+{
+ int status;
+
+ if (cppctx == 0) {
+ cpperror("#else without #ifdef/ifndef");
+ return;
+ }
+
+ status = ifstatus[cppctx-1];
+ ifstatus[cppctx-1] = !status;
+ cppoff += (status) ? 1 : -1;
+}
+
+static void
+cppelse(void)
+{
+ elseclause();
+ next();
+}
+
+static void
+elif(void)
+{
+ elseclause();
+ if (ifstatus[cppctx-1]) {
+ --cppctx;
+ cppif();
+ }
+}
+
+static void
+endif(void)
+{
+ if (cppctx == 0)
+ error("#endif without #if");
+ if (!ifstatus[--cppctx])
+ --cppoff;
+ next();
+}
+
+static void
+undef(void)
+{
+ if (cppoff)
+ return;
+
+ namespace = NS_CPP;
+ next();
+ if (yytoken != IDEN) {
+ error("no macro name given in #undef directive");
+ return;
+ }
+ killsym(yylval.sym);
+ next();
+}
+
+int
+cpp(void)
+{
+ static struct {
+ unsigned char token;
+ void (*fun)(void);
+ } *bp, clauses [] = {
+ {DEFINE, define},
+ {INCLUDE, include},
+ {LINE, line},
+ {IFDEF, ifdef},
+ {IF, cppif},
+ {ELIF, elif},
+ {IFNDEF, ifndef},
+ {ELSE, cppelse},
+ {ENDIF, endif},
+ {UNDEF, undef},
+ {PRAGMA, pragma},
+ {ERROR, usererr},
+ {0, NULL}
+ };
+ int ns;
+ char *p;
+
+ for (p = input->p; isspace(*p); ++p)
+ ;
+
+ if (*p != '#')
+ return cppoff;
+ input->p = p+1;
+
+ disexpand = 1;
+ lexmode = CPPMODE;
+ ns = namespace;
+ namespace = NS_CPPCLAUSES;
+ next();
+ namespace = NS_IDEN;
+
+ for (bp = clauses; bp->token && bp->token != yytoken; ++bp)
+ ;
+ if (!bp->token) {
+ errorp("incorrect preprocessor directive '%s'", yytext);
+ goto error;
+ }
+
+ DBG("CPP %s", yytext);
+
+ pushctx(); /* create a new context to avoid polish */
+ (*bp->fun)(); /* the current context, and to get all */
+ popctx(); /* the symbols freed at the end */
+
+ /*
+ * #include changes the content of input->line, so the correctness
+ * of the line must be checked in the own include(), and we have
+ * to skip this tests. For the same reason include() is the only
+ * function which does not prepare the next token
+ */
+ if (yytoken != '\n' && !cppoff && bp->token != INCLUDE)
+ errorp("trailing characters after preprocessor directive");
+
+error:
+ disexpand = 0;
+ lexmode = CCMODE;
+ namespace = ns;
+
+ return 1;
+}
+
+void
+ppragmaln(void)
+{
+ static char file[FILENAME_MAX];
+ static unsigned nline;
+ char *s;
+
+ putchar('\n');
+ if (strcmp(file, filenam)) {
+ strcpy(file, filenam);
+ s = "#line %u \"%s\"\n";
+ } else if (nline+1 != lineno) {
+ s = "#line %u\n";
+ } else {
+ s = "";
+ }
+ nline = lineno;
+ printf(s, nline, file);
+}
+
+void
+outcpp(void)
+{
+ int c;
+ char *s, *t;
+
+ for (next(); yytoken != EOFTOK; next()) {
+ if (onlyheader)
+ continue;
+ if (yytoken != STRING) {
+ printf("%s ", yytext);
+ continue;
+ }
+ for (s = yytext; c = *s; ++s) {
+ switch (c) {
+ case '\n':
+ t = "\\n";
+ goto print_str;
+ case '\v':
+ t = "\\v";
+ goto print_str;
+ case '\b':
+ t = "\\b";
+ goto print_str;
+ case '\t':
+ t = "\\t";
+ goto print_str;
+ case '\a':
+ t = "\\a";
+ print_str:
+ fputs(t, stdout);
+ break;
+ case '\\':
+ putchar('\\');
+ default:
+ if (!isprint(c))
+ printf("\\x%x", c);
+ else
+ putchar(c);
+ break;
+ }
+ }
+ putchar(' ');
+ }
+ putchar('\n');
+}
+
--- /dev/null
+++ b/src/cc1/decl.c
@@ -1,0 +1,967 @@
+static char sccsid[] = "@(#) ./cc1/decl.c";
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define NOSCLASS 0
+
+#define NOREP 0
+#define REP 1
+#define QUIET 1
+#define NOQUIET 0
+
+#define NR_DCL_TYP (NR_DECLARATORS+NR_FUNPARAM)
+#define NR_DCL_SYM (NR_DECLARATORS+NR_FUNPARAM+1)
+
+struct declarators {
+ unsigned nr;
+ unsigned ns;
+ struct decl *dcl;
+ unsigned nr_types;
+ Type **tpars;
+ Symbol **pars;
+ struct declarator {
+ unsigned char op;
+ TINT nelem;
+ Symbol *sym;
+ Type **tpars;
+ Symbol **pars;
+ } d [NR_DECLARATORS];
+};
+
+struct decl {
+ unsigned ns;
+ int sclass;
+ int qualifier;
+ Symbol *sym;
+ Type *type;
+ Type *parent;
+ Symbol **pars;
+ Symbol *bufpars[NR_DCL_SYM];
+ Type *buftpars[NR_DCL_TYP];
+};
+
+
+static void
+endfundcl(Type *tp, Symbol **pars)
+{
+ if (tp->prop&TK_R && *pars)
+ warn("parameter names (without types) in function declaration");
+ /*
+ * avoid non used warnings in prototypes
+ */
+ while (*pars)
+ (*pars++)->flags |= SUSED;
+ popctx();
+}
+
+static void
+push(struct declarators *dp, int op, ...)
+{
+ va_list va;
+ unsigned n;
+ struct declarator *p;
+
+ va_start(va, op);
+ if ((n = dp->nr++) == NR_DECLARATORS)
+ error("too many declarators");
+
+ p = &dp->d[n];
+ p->op = op;
+ p->tpars = NULL;
+
+ switch (op) {
+ case ARY:
+ p->nelem = va_arg(va, TINT);
+ break;
+ case KRFTN:
+ case FTN:
+ p->nelem = va_arg(va, unsigned);
+ p->tpars = va_arg(va, Type **);
+ p->pars = va_arg(va, Symbol **);
+ break;
+ case IDEN:
+ p->sym = va_arg(va, Symbol *);
+ break;
+ }
+ va_end(va);
+}
+
+static int
+pop(struct declarators *dp, struct decl *dcl)
+{
+ struct declarator *p;
+
+ if (dp->nr == 0)
+ return 0;
+
+ p = &dp->d[--dp->nr];
+ if (p->op == IDEN) {
+ dcl->sym = p->sym;
+ return 1;
+ }
+
+ if (dcl->type->op == FTN)
+ endfundcl(dcl->type, dcl->pars);
+ dcl->pars = p->pars;
+
+ dcl->type = mktype(dcl->type, p->op, p->nelem, p->tpars);
+ return 1;
+}
+
+static void
+arydcl(struct declarators *dp)
+{
+ Node *np = NULL;
+ TINT n = 0;
+
+ expect('[');
+ if (yytoken != ']') {
+ if ((np = constexpr()) == NULL) {
+ errorp("invalid storage size");
+ } else {
+ if ((n = np->sym->u.i) <= 0) {
+ errorp("array size is not a positive number");
+ n = 1;
+ }
+ freetree(np);
+ }
+ }
+ expect(']');
+
+ push(dp, ARY, n);
+}
+
+static int
+empty(Symbol *sym, Type *tp, int param)
+{
+ if (!sym->name) {
+ sym->type = tp;
+ switch (tp->op) {
+ default:
+ /* warn if it is not a parameter */
+ if (!param)
+ warn("empty declaration");
+ case STRUCT:
+ case UNION:
+ case ENUM:
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static void
+bad_storage(Type *tp, char *name)
+{
+ if (tp->op != FTN)
+ errorp("incorrect storage class for file-scope declaration");
+ else
+ errorp("invalid storage class for function '%s'", name);
+}
+
+static Symbol *
+redcl(Symbol *sym, Type *tp, int sclass)
+{
+ int flags;
+ char *name = sym->name;
+
+ if (!eqtype(sym->type, tp, 1)) {
+ errorp("conflicting types for '%s'", name);
+ return sym;
+ }
+
+ if (sym->token == TYPEIDEN && sclass != TYPEDEF ||
+ sym->token != TYPEIDEN && sclass == TYPEDEF) {
+ goto redeclaration;
+ }
+ if (curctx != GLOBALCTX && tp->op != FTN) {
+ /* is it the redeclaration of a local variable? */
+ if ((sym->flags & SEXTERN) && sclass == EXTERN)
+ return sym;
+ goto redeclaration;
+ }
+
+ flags = sym->flags;
+ switch (sclass) {
+ case REGISTER:
+ case AUTO:
+ bad_storage(tp, name);
+ break;
+ case NOSCLASS:
+ if ((flags & SPRIVATE) == 0) {
+ if (flags & SEXTERN)
+ flags &= ~(SEXTERN|SEMITTED);
+ flags |= SGLOBAL;
+ break;
+ }
+ errorp("non-static declaration of '%s' follows static declaration",
+ name);
+ break;
+ case TYPEDEF:
+ /* Only C11 allows multiple definitions of a typedef. */
+ goto redeclaration;
+ case EXTERN:
+ break;
+ case STATIC:
+ if ((flags & (SGLOBAL|SEXTERN)) == 0) {
+ flags |= SPRIVATE;
+ break;
+ }
+ errorp("static declaration of '%s' follows non-static declaration",
+ name);
+ break;
+ }
+ sym->flags = flags;
+
+ return sym;
+
+redeclaration:
+ errorp("redeclaration of '%s'", name);
+ return sym;
+}
+
+static Symbol *
+identifier(struct decl *dcl)
+{
+ Symbol *sym = dcl->sym;
+ Type *tp = dcl->type;
+ int sclass = dcl->sclass;
+ char *name = sym->name;
+
+ if (empty(sym, tp, 0))
+ return sym;
+
+ /* TODO: Add warning about ANSI limits */
+ if (!(tp->prop & TDEFINED) &&
+ sclass != EXTERN && sclass != TYPEDEF &&
+ !(tp->op == ARY && yytoken == '=')) {
+ errorp("declared variable '%s' of incomplete type", name);
+ }
+
+ if (tp->op == FTN) {
+ if (sclass == NOSCLASS)
+ sclass = EXTERN;
+ if (!strcmp(name, "main") && tp->type != inttype) {
+ errorp("main shall be defined with a return type of int");
+ errorp("please contact __20h__ on irc.freenode.net (#bitreich-en) via IRC");
+ }
+ }
+
+ if (sym->flags & SDECLARED) {
+ sym = redcl(dcl->sym, tp, sclass);
+ } else {
+ int flags = sym->flags | SDECLARED;
+
+ sym->type = tp;
+
+ switch (sclass) {
+ case REGISTER:
+ case AUTO:
+ if (curctx != GLOBALCTX && tp->op != FTN) {
+ flags |= (sclass == REGISTER) ? SREGISTER : SAUTO;
+ break;
+ }
+ bad_storage(tp, name);
+ case NOSCLASS:
+ if (tp->op == FTN)
+ flags |= SEXTERN;
+ else
+ flags |= (curctx == GLOBALCTX) ? SGLOBAL : SAUTO;
+ break;
+ case EXTERN:
+ flags |= SEXTERN;
+ break;
+ case STATIC:
+ flags |= (curctx == GLOBALCTX) ? SPRIVATE : SLOCAL;
+ break;
+ case TYPEDEF:
+ flags |= STYPEDEF;
+ sym->u.token = sym->token = TYPEIDEN;
+ break;
+ }
+ sym->flags = flags;
+ }
+
+ if (accept('='))
+ initializer(sym, sym->type);
+ if (!(sym->flags & (SGLOBAL|SEXTERN)) && tp->op != FTN)
+ sym->flags |= SDEFINED;
+ if (sym->token == IDEN && tp->op != FTN)
+ emit(ODECL, sym);
+ return sym;
+}
+
+static Symbol *
+parameter(struct decl *dcl)
+{
+ Symbol *sym = dcl->sym;
+ Type *funtp = dcl->parent, *tp = dcl->type;
+ char *name = sym->name;
+ int flags;
+
+ flags = 0;
+ switch (dcl->sclass) {
+ case STATIC:
+ case EXTERN:
+ case AUTO:
+ errorp("bad storage class in function parameter");
+ break;
+ case REGISTER:
+ flags |= SREGISTER;
+ break;
+ case NOSCLASS:
+ flags |= SAUTO;
+ break;
+ }
+
+ switch (tp->op) {
+ case VOID:
+ funtp->n.elem = 1;
+ if (dcl->sclass)
+ errorp("void as unique parameter may not be qualified");
+ return NULL;
+ case ARY:
+ tp = mktype(tp->type, PTR, 0, NULL);
+ break;
+ case FTN:
+ errorp("incorrect function type for a function parameter");
+ return NULL;
+ }
+ if (!empty(sym, tp, 1)) {
+ int isdcl = sym->flags&SDECLARED, isk_r = funtp->prop & TK_R;
+ if (isdcl && !isk_r) {
+ errorp("redefinition of parameter '%s'", name);
+ return NULL;
+ }
+ if (!isdcl && isk_r) {
+ errorp("declaration for parameter '%s' but no such parameter",
+ sym->name);
+ return NULL;
+ }
+ sym->flags |= SDECLARED;
+ }
+
+ sym->type = tp;
+ sym->flags &= ~(SAUTO|SREGISTER);
+ sym->flags |= flags;
+ return sym;
+}
+
+static Symbol *dodcl(int rep,
+ Symbol *(*fun)(struct decl *),
+ unsigned ns,
+ Type *type);
+
+static int
+krpars(struct declarators *dp)
+{
+ Symbol *sym;
+ int toomany = 0;
+ unsigned npars = 0;
+
+ do {
+ sym = yylval.sym;
+ expect(IDEN);
+ sym->flags |= SAUTO;
+ if ((sym = install(NS_IDEN, sym)) == NULL) {
+ errorp("redefinition of parameter '%s'",
+ yylval.sym->name);
+ continue;
+ }
+ if (npars < NR_FUNPARAM) {
+ ++npars;
+ *dp->pars++ = sym;
+ continue;
+ }
+ if (!toomany)
+ toomany = 1;
+ } while (accept(','));
+
+ return toomany;
+}
+
+static unsigned
+krfun(struct declarators *dp)
+{
+ int toomany = 0;
+
+
+ if (yytoken != ')')
+ toomany = krpars(dp);
+
+ if (dp->nr_types == NR_DCL_TYP) {
+ toomany = 1;
+ } else {
+ ++dp->nr_types;
+ *dp->tpars++ = ellipsistype;
+ }
+
+ if (toomany)
+ errorp("too many parameters in function definition");
+ return 1;
+}
+
+static unsigned
+ansifun(struct declarators *dp)
+{
+ Symbol *sym;
+ unsigned npars, ntype, toomany, distoomany, voidpar;
+ Type type, *tp;
+
+ type.n.elem = 0;
+ type.prop = 0;
+ npars = ntype = toomany = distoomany = voidpar = 0;
+
+ do {
+ if (accept(ELLIPSIS)) {
+ if (ntype < 1)
+ errorp("a named argument is requiered before '...'");
+ if (yytoken != ')')
+ errorp("... must be the last parameter");
+ sym = NULL;
+ tp = ellipsistype;
+ } else if ((sym = dodcl(NOREP, parameter, NS_IDEN, &type)) == NULL) {
+ if (type.n.elem == 1 && ntype > 1)
+ voidpar = 1;
+ sym = NULL;
+ tp = NULL;
+ } else {
+ tp = sym->type;
+ }
+
+ if (sym) {
+ if (npars == NR_FUNPARAM) {
+ toomany = 1;
+ } else {
+ npars++;
+ *dp->pars++ = sym;
+ }
+ }
+
+ if (tp) {
+ if (dp->nr_types == NR_DCL_TYP) {
+ toomany = 1;
+ } else {
+ ntype++;
+ dp->nr_types++;
+ *dp->tpars++ = tp;
+ }
+ }
+
+ } while (accept(','));
+
+ if (toomany == 1)
+ errorp("too many parameters in function definition");
+ if (voidpar && ntype > 1)
+ errorp("'void' must be the only parameter");
+ return ntype;
+}
+
+static int
+funbody(Symbol *sym, Symbol *pars[])
+{
+ Type *tp;
+ Symbol **bp, *p;
+
+ if (!sym)
+ return 0;
+ tp = sym->type;
+ if (tp->op != FTN)
+ return 0;
+
+ switch (yytoken) {
+ case '{':
+ case TYPE:
+ case TYPEIDEN:
+ if (curctx != PARAMCTX)
+ errorp("nested function declaration");
+ if (sym && sym->ns == NS_IDEN)
+ break;
+ default:
+ emit(ODECL, sym);
+ endfundcl(tp, pars);
+ return 0;
+ }
+
+ tp->prop |= TFUNDEF;
+ curfun = sym;
+ if (sym->type->prop & TK_R) {
+ while (yytoken != '{') {
+ dodcl(REP, parameter, NS_IDEN, sym->type);
+ expect(';');
+ }
+ for (bp = pars; p = *bp; ++bp) {
+ if (p->type == NULL) {
+ warn("type of '%s' defaults to int", p->name);
+ p->type = inttype;
+ }
+ }
+ }
+ if (sym->flags & STYPEDEF)
+ errorp("function definition declared 'typedef'");
+ if (sym->flags & SDEFINED)
+ errorp("redefinition of '%s'", sym->name);
+ if (sym->flags & SEXTERN) {
+ sym->flags &= ~SEXTERN;
+ sym->flags |= SGLOBAL;
+ }
+ sym->flags |= SDEFINED;
+ sym->flags &= ~SEMITTED;
+ sym->u.pars = pars;
+ emit(OFUN, sym);
+ compound(NULL, NULL, NULL);
+ emit(OEFUN, NULL);
+ popctx();
+ flushtypes();
+ curfun = NULL;
+ return 1;
+}
+
+static void
+fundcl(struct declarators *dp)
+{
+ Type **types = dp->tpars;
+ unsigned ntypes, typefun;
+ Symbol **pars = dp->pars;
+ unsigned (*fun)(struct declarators *);
+
+ pushctx();
+ expect('(');
+ if (yytoken == ')' || yytoken == IDEN) {
+ typefun = KRFTN;
+ fun = krfun;
+ } else {
+ typefun = FTN;
+ fun = ansifun;
+ }
+ ntypes = (*fun)(dp);
+ *dp->pars++= NULL;
+ expect(')');
+
+ push(dp, typefun, ntypes, types, pars);
+}
+
+static void declarator(struct declarators *dp);
+
+static void
+directdcl(struct declarators *dp)
+{
+ Symbol *p, *sym;
+ static int nested;
+
+ if (accept('(')) {
+ if (nested == NR_SUBTYPE)
+ error("too many declarators nested by parentheses");
+ ++nested;
+ declarator(dp);
+ --nested;
+ expect(')');
+ } else {
+ if (yytoken == IDEN || yytoken == TYPEIDEN) {
+ sym = yylval.sym;
+ if (p = install(dp->ns, sym)) {
+ sym = p;
+ sym->flags &= ~SDECLARED;
+ }
+ next();
+ } else {
+ sym = newsym(dp->ns, NULL);
+ }
+ push(dp, IDEN, sym);
+ }
+
+ for (;;) {
+ switch (yytoken) {
+ case '(': fundcl(dp); break;
+ case '[': arydcl(dp); break;
+ default: return;
+ }
+ }
+}
+
+static void
+declarator(struct declarators *dp)
+{
+ unsigned n;
+
+ for (n = 0; accept('*'); ++n) {
+ while (accept(TQUALIFIER))
+ ;
+ }
+
+ directdcl(dp);
+
+ while (n--)
+ push(dp, PTR);
+}
+
+static Type *structdcl(void), *enumdcl(void);
+
+static Type *
+specifier(int *sclass, int *qualifier)
+{
+ Type *tp = NULL;
+ unsigned spec, qlf, sign, type, cls, size;
+
+ spec = qlf = sign = type = cls = size = 0;
+
+ for (;;) {
+ unsigned *p = NULL;
+ Type *(*dcl)(void) = NULL;
+
+ switch (yytoken) {
+ case SCLASS:
+ p = &cls;
+ break;
+ case TQUALIFIER:
+ qlf |= yylval.token;
+ next();
+ continue;
+ case TYPEIDEN:
+ if (type)
+ goto return_type;
+ tp = yylval.sym->type;
+ p = &type;
+ break;
+ case TYPE:
+ switch (yylval.token) {
+ case ENUM:
+ dcl = enumdcl;
+ p = &type;
+ break;
+ case STRUCT:
+ case UNION:
+ dcl = structdcl;
+ p = &type;
+ break;
+ case VA_LIST:
+ case VOID:
+ case BOOL:
+ case CHAR:
+ case INT:
+ case FLOAT:
+ case DOUBLE:
+ p = &type;
+ break;
+ case SIGNED:
+ case UNSIGNED:
+ p = &sign;
+ break;
+ case LONG:
+ if (size == LONG) {
+ yylval.token = LLONG;
+ size = 0;
+ }
+ case SHORT:
+ p = &size;
+ break;
+ }
+ break;
+ default:
+ goto return_type;
+ }
+ if (*p)
+ errorp("invalid type specification");
+ *p = yylval.token;
+ if (dcl) {
+ if (size || sign)
+ errorp("invalid type specification");
+ tp = (*dcl)();
+ goto return_type;
+ } else {
+ next();
+ }
+ spec = 1;
+ }
+
+return_type:
+ *sclass = cls;
+ *qualifier = qlf;
+ if (!tp) {
+ if (spec) {
+ tp = ctype(type, sign, size);
+ } else {
+ if (curctx != GLOBALCTX)
+ unexpected();
+ warn("type defaults to 'int' in declaration");
+ tp = inttype;
+ }
+ }
+ return tp;
+}
+
+static Symbol *
+newtag(void)
+{
+ Symbol *sym;
+ int ns, op, tag = yylval.token;
+ static unsigned tpns = NS_STRUCTS;
+
+ ns = namespace;
+ namespace = NS_TAG;
+ next();
+ namespace = ns;
+
+ switch (yytoken) {
+ case IDEN:
+ case TYPEIDEN:
+ sym = yylval.sym;
+ if ((sym->flags & SDECLARED) == 0)
+ install(NS_TAG, yylval.sym);
+ next();
+ break;
+ default:
+ sym = newsym(NS_TAG, NULL);
+ break;
+ }
+ if (!sym->type) {
+ Type *tp;
+
+ if (tpns == NS_STRUCTS + NR_MAXSTRUCTS)
+ error("too many tags declared");
+ tp = mktype(NULL, tag, 0, NULL);
+ tp->ns = tpns++;
+ sym->type = tp;
+ tp->tag = sym;
+ DBG("declared tag '%s' with ns = %d\n",
+ (sym->name) ? sym->name : "anonymous", tp->ns);
+ }
+
+ if ((op = sym->type->op) != tag && op != INT)
+ error("'%s' defined as wrong kind of tag", sym->name);
+ return sym;
+}
+
+static void fieldlist(Type *tp);
+
+static Type *
+structdcl(void)
+{
+ Symbol *sym;
+ Type *tp;
+ static int nested;
+ int ns;
+
+ sym = newtag();
+ tp = sym->type;
+
+ if (!accept('{'))
+ return tp;
+
+ ns = namespace;
+ namespace = tp->ns;
+
+ if (tp->prop & TDEFINED && sym->ctx == curctx)
+ error("redefinition of struct/union '%s'", sym->name);
+
+ if (nested == NR_STRUCT_LEVEL)
+ error("too many levels of nested structure or union definitions");
+
+ ++nested;
+ while (yytoken != '}') {
+ fieldlist(tp);
+ }
+ --nested;
+
+ deftype(tp);
+ namespace = ns;
+ expect('}');
+ return tp;
+}
+
+static Type *
+enumdcl(void)
+{
+ Type *tp;
+ Symbol *sym, *tagsym;
+ int ns, val, toomany;
+ unsigned nctes;
+
+ ns = namespace;
+ tagsym = newtag();
+ tp = tagsym->type;
+
+ if (!accept('{'))
+ goto restore_name;
+ if (tp->prop & TDEFINED)
+ errorp("redefinition of enumeration '%s'", tagsym->name);
+ deftype(tp);
+ namespace = NS_IDEN;
+
+ /* TODO: check incorrect values in val */
+ for (nctes = val = 0; yytoken != '}'; ++nctes, ++val) {
+ if (yytoken != IDEN)
+ unexpected();
+ sym = yylval.sym;
+ next();
+ if (nctes == NR_ENUM_CTES && !toomany) {
+ errorp("too many enum constants in a single enum");
+ toomany = 1;
+ }
+ if (accept('=')) {
+ Node *np = constexpr();
+
+ if (np == NULL)
+ errorp("invalid enumeration value");
+ else
+ val = np->sym->u.i;
+ freetree(np);
+ }
+ if ((sym = install(NS_IDEN, sym)) == NULL) {
+ errorp("'%s' redeclared as different kind of symbol",
+ yytext);
+ } else {
+ sym->u.i = val;
+ sym->flags |= SCONSTANT;
+ sym->type = inttype;
+ }
+ if (!accept(','))
+ break;
+ }
+ expect('}');
+
+restore_name:
+ namespace = ns;
+ return tp;
+}
+
+static Symbol *
+type(struct decl *dcl)
+{
+ Symbol *sym = dcl->sym;
+
+ if (dcl->sclass)
+ error("class storage in type name");
+ if (sym->name)
+ error("unexpected identifier in type name");
+ sym->type = dcl->type;
+
+ return sym;
+}
+
+static Symbol *
+field(struct decl *dcl)
+{
+ static char *anon = "<anonymous>";
+ Symbol *sym = dcl->sym;
+ char *name = (sym->name) ? sym->name : anon;
+ Type *structp = dcl->parent, *tp = dcl->type;
+ TINT n = structp->n.elem;
+ int err = 0;
+
+ if (accept(':')) {
+ Node *np;
+ TINT n;
+
+ if ((np = constexpr()) == NULL) {
+ unexpected();
+ n = 0;
+ } else {
+ n = np->sym->u.i;
+ freetree(np);
+ }
+ if (n == 0 && name != anon)
+ errorp("zero width for bit-field '%s'", name);
+ if (tp != booltype && tp != inttype && tp != uinttype)
+ errorp("bit-field '%s' has invalid type", name);
+ if (n < 0)
+ errorp("negative width in bit-field '%s'", name);
+ else if (n > tp->size*8)
+ errorp("width of '%s' exceeds its type", name);
+ } else if (empty(sym, tp, 0)) {
+ return sym;
+ }
+
+ if (tp->op == FTN) {
+ errorp("invalid type '%s' in struct/union", name);
+ err = 1;
+ }
+ if (dcl->sclass) {
+ errorp("storage class in struct/union field '%s'", name);
+ err = 1;
+ }
+ if (!(tp->prop & TDEFINED)) {
+ error("field '%s' has incomplete type", name);
+ err = 1;
+ }
+ if (err)
+ return sym;
+
+ if (sym->flags & SDECLARED)
+ error("duplicated member '%s'", name);
+ sym->flags |= SFIELD|SDECLARED;
+ sym->type = tp;
+
+ if (n == NR_FIELDS)
+ error("too many fields in struct/union");
+ DBG("New field '%s' in namespace %d\n", name, structp->ns);
+ structp->p.fields = xrealloc(structp->p.fields, ++n * sizeof(*sym));
+ structp->p.fields[n-1] = sym;
+ structp->n.elem = n;
+
+ return sym;
+}
+
+static Symbol *
+dodcl(int rep, Symbol *(*fun)(struct decl *), unsigned ns, Type *parent)
+{
+ Symbol *sym;
+ Type *base;
+ struct decl dcl;
+ struct declarators stack;
+
+ dcl.ns = ns;
+ dcl.parent = parent;
+ base = specifier(&dcl.sclass, &dcl.qualifier);
+
+ do {
+ dcl.type = base;
+ stack.nr_types = stack.nr = 0;
+ stack.tpars = dcl.buftpars;
+ stack.pars = dcl.bufpars;
+ stack.dcl = &dcl;
+ stack.ns = ns;
+
+ declarator(&stack);
+
+ while (pop(&stack, &dcl))
+ ;
+ sym = (*fun)(&dcl);
+ if (funbody(sym, dcl.pars))
+ return sym;
+ } while (rep && accept(','));
+
+ return sym;
+}
+
+void
+decl(void)
+{
+ Symbol *sym;
+
+ if (accept(';'))
+ return;
+ sym = dodcl(REP, identifier, NS_IDEN, NULL);
+ if (sym->type->prop & TFUNDEF)
+ return;
+ expect(';');
+}
+
+static void
+fieldlist(Type *tp)
+{
+ if (yytoken != ';')
+ dodcl(REP, field, tp->ns, tp);
+ expect(';');
+}
+
+Type *
+typename(void)
+{
+ return dodcl(NOREP, type, NS_DUMMY, NULL)->type;
+}
--- /dev/null
+++ b/src/cc1/deps.mk
@@ -1,0 +1,44 @@
+#deps
+builtin.o: $(INCDIR)/scc/scc/scc.h
+builtin.o: cc1.h
+code.o: $(INCDIR)/scc/scc/scc.h
+code.o: cc1.h
+cpp.o: $(INCDIR)/scc/scc/cstd.h
+cpp.o: $(INCDIR)/scc/scc/scc.h
+cpp.o: cc1.h
+decl.o: $(INCDIR)/scc/scc/cstd.h
+decl.o: $(INCDIR)/scc/scc/scc.h
+decl.o: cc1.h
+error.o: $(INCDIR)/scc/scc/scc.h
+error.o: cc1.h
+expr.o: $(INCDIR)/scc/scc/cstd.h
+expr.o: $(INCDIR)/scc/scc/scc.h
+expr.o: cc1.h
+fold.o: $(INCDIR)/scc/scc/scc.h
+fold.o: cc1.h
+init.o: $(INCDIR)/scc/scc/cstd.h
+init.o: $(INCDIR)/scc/scc/scc.h
+init.o: cc1.h
+lex.o: $(INCDIR)/scc/scc/cstd.h
+lex.o: $(INCDIR)/scc/scc/scc.h
+lex.o: cc1.h
+main.o: $(INCDIR)/scc/scc/arg.h
+main.o: $(INCDIR)/scc/scc/scc.h
+main.o: cc1.h
+stmt.o: $(INCDIR)/scc/scc/cstd.h
+stmt.o: $(INCDIR)/scc/scc/scc.h
+stmt.o: cc1.h
+symbol.o: $(INCDIR)/scc/scc/cstd.h
+symbol.o: $(INCDIR)/scc/scc/scc.h
+symbol.o: cc1.h
+target/amd64-sysv/arch.o: $(INCDIR)/scc/scc/scc.h
+target/amd64-sysv/arch.o: target/amd64-sysv/../../cc1.h
+target/arm64-sysv/arch.o: $(INCDIR)/scc/scc/scc.h
+target/arm64-sysv/arch.o: target/arm64-sysv/../../cc1.h
+target/i386-sysv/arch.o: $(INCDIR)/scc/scc/scc.h
+target/i386-sysv/arch.o: target/i386-sysv/../../cc1.h
+target/z80-scc/arch.o: $(INCDIR)/scc/scc/scc.h
+target/z80-scc/arch.o: target/z80-scc/../../cc1.h
+types.o: $(INCDIR)/scc/scc/cstd.h
+types.o: $(INCDIR)/scc/scc/scc.h
+types.o: cc1.h
--- /dev/null
+++ b/src/cc1/error.c
@@ -1,0 +1,85 @@
+static char sccsid[] = "@(#) ./cc1/error.c";
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define MAXERRNUM 10
+
+extern int failure;
+static unsigned nerrors;
+
+static void
+warn_error(int flag, char *fmt, va_list va)
+{
+ if (flag == 0)
+ return;
+ fprintf(stderr, "%s:%u: %s: ",
+ filenam, lineno,
+ (flag < 0) ? "error" : "warning");
+ vfprintf(stderr, fmt, va);
+ putc('\n', stderr);
+
+ if (flag < 0) {
+ if (!failure)
+ fclose(stdout);
+ failure = 1;
+ if (++nerrors == MAXERRNUM) {
+ fputs("too many errors\n", stderr);
+ exit(1);
+ }
+ }
+}
+
+void
+warn(char *fmt, ...)
+{
+ extern int warnings;
+
+ va_list va;
+ va_start(va, fmt);
+ warn_error(warnings, fmt, va);
+ va_end(va);
+}
+
+void
+error(char *fmt, ...)
+{
+ va_list va;
+
+ va_start(va, fmt);
+ warn_error(-1, fmt, va);
+ va_end(va);
+ exit(1);
+ discard();
+}
+
+void
+errorp(char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ warn_error(-1, fmt, va);
+ va_end(va);
+}
+
+void
+cpperror(char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ warn_error(-1, fmt, va);
+ va_end(va);
+
+ /* discard input until the end of the line */
+ *input->p = '\0';
+ next();
+}
+
+void
+unexpected(void)
+{
+ error("unexpected '%s'", yytext);
+}
--- /dev/null
+++ b/src/cc1/expr.c
@@ -1,0 +1,1185 @@
+static char sccsid[] = "@(#) ./cc1/expr.c";
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define XCHG(lp, rp, np) (np = lp, lp = rp, rp = np)
+
+static Node *xexpr(void), *xassign(void);
+
+int
+cmpnode(Node *np, TUINT val)
+{
+ Symbol *sym;
+ Type *tp;
+ TUINT mask, nodeval;
+
+ if (!np || !(np->flags & NCONST) || !np->sym)
+ return 0;
+ sym = np->sym;
+ tp = sym->type;
+
+ switch (tp->op) {
+ case PTR:
+ case INT:
+ mask = (val > 1) ? ones(np->type->size) : -1;
+ nodeval = (tp->prop & TSIGNED) ? sym->u.i : sym->u.u;
+ return (nodeval & mask) == (val & mask);
+ case FLOAT:
+ return sym->u.f == val;
+ }
+ return 0;
+}
+
+static Node *
+promote(Node *np)
+{
+ Type *tp;
+ Node *new;
+ struct limits *lim, *ilim;
+
+ tp = np->type;
+
+ switch (tp->op) {
+ case ENUM:
+ case INT:
+ if (tp->n.rank >= inttype->n.rank)
+ return np;
+ lim = getlimits(tp);
+ ilim = getlimits(inttype);
+ tp = (lim->max.i <= ilim->max.i) ? inttype : uinttype;
+ break;
+ case FLOAT:
+ /* TODO: Add support for C99 float math */
+ tp = doubletype;
+ break;
+ default:
+ abort();
+ }
+ if ((new = convert(np, tp, 1)) != NULL)
+ return new;
+ return np;
+}
+
+static void
+arithconv(Node **p1, Node **p2)
+{
+ int to = 0, s1, s2;
+ unsigned r1, r2;
+ Type *tp1, *tp2;
+ Node *np1, *np2;
+ struct limits *lp1, *lp2;
+
+ np1 = promote(*p1);
+ np2 = promote(*p2);
+
+ tp1 = np1->type;
+ tp2 = np2->type;
+
+ if (tp1 == tp2)
+ goto set_p1_p2;
+
+ s1 = (tp1->prop & TSIGNED) != 0;
+ r1 = tp1->n.rank;
+ lp1 = getlimits(tp1);
+
+ s2 = (tp2->prop & TSIGNED) != 0;
+ r2 = tp2->n.rank;
+ lp2 = getlimits(tp2);
+
+ if (s1 == s2 || tp1->op == FLOAT || tp2->op == FLOAT) {
+ to = r1 - r2;
+ } else if (!s1) {
+ if (r1 >= r2 || lp1->max.i >= lp2->max.i)
+ to = 1;
+ else
+ to = -1;
+ } else {
+ if (r2 >= r1 || lp2->max.i >= lp1->max.i)
+ to = -1;
+ else
+ to = 1;
+ }
+
+ if (to > 0)
+ np2 = convert(np2, tp1, 1);
+ else if (to < 0)
+ np1 = convert(np1, tp2, 1);
+
+set_p1_p2:
+ *p1 = np1;
+ *p2 = np2;
+}
+
+static int
+null(Node *np)
+{
+ if (np->type != pvoidtype || np->op != OCAST)
+ return 0;
+
+ np = np->left;
+ if (np->type != inttype)
+ return 0;
+
+ return cmpnode(np, 0);
+}
+
+static Node *
+chkternary(Node *yes, Node *no)
+{
+ /*
+ * FIXME:
+ * We are ignoring type qualifiers here,
+ * but the standard has strong rules about this.
+ * take a look to 6.5.15
+ */
+
+ if (!eqtype(yes->type, no->type, 1)) {
+ if ((yes->type->prop & TARITH) && (no->type->prop & TARITH)) {
+ arithconv(&yes, &no);
+ } else if (yes->type->op != PTR && no->type->op != PTR) {
+ goto wrong_type;
+ } else {
+ /* convert integer 0 to NULL */
+ if ((yes->type->prop & TINTEGER) && cmpnode(yes, 0))
+ yes = convert(yes, pvoidtype, 0);
+ if ((no->type->prop & TINTEGER) && cmpnode(no, 0))
+ no = convert(no, pvoidtype, 0);
+ /*
+ * At this point the type of both should be
+ * a pointer to something, or we have don't
+ * compatible types
+ */
+ if (yes->type->op != PTR || no->type->op != PTR)
+ goto wrong_type;
+ /*
+ * If we have a null pointer constant then
+ * convert to the another type
+ */
+ if (null(yes))
+ yes = convert(yes, no->type, 0);
+ if (null(no))
+ no = convert(no, yes->type, 0);
+
+ if (!eqtype(yes->type, no->type, 1))
+ goto wrong_type;
+ }
+ }
+ return node(OCOLON, yes->type, yes, no);
+
+wrong_type:
+ errorp("type mismatch in conditional expression");
+ freetree(yes);
+ freetree(no);
+ return constnode(zero);
+}
+
+static void
+chklvalue(Node *np)
+{
+ if (!(np->flags & NLVAL))
+ errorp("lvalue required in operation");
+ if (np->type == voidtype)
+ errorp("invalid use of void expression");
+}
+
+Node *
+decay(Node *np)
+{
+ Node *new;
+ Type *tp = np->type;
+
+ switch (tp->op) {
+ case ARY:
+ tp = tp->type;
+ if (np->op == OPTR) {
+ new = np->left;
+ free(np);
+ new->type = mktype(tp, PTR, 0, NULL);
+ return new;
+ }
+ case FTN:
+ new = node(OADDR, mktype(tp, PTR, 0, NULL), np, NULL);
+ if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new->flags |= NCONST;
+ return new;
+ default:
+ return np;
+ }
+}
+
+static Node *
+integerop(int op, Node *lp, Node *rp)
+{
+ if (!(lp->type->prop & TINTEGER) || !(rp->type->prop & TINTEGER))
+ error("operator requires integer operands");
+ arithconv(&lp, &rp);
+ return node(op, lp->type, lp, rp);
+}
+
+static Node *
+integeruop(int op, Node *np)
+{
+ if (!(np->type->prop & TINTEGER))
+ error("unary operator requires integer operand");
+ np = promote(np);
+ return node(op, np->type, np, NULL);
+}
+
+static Node *
+numericaluop(int op, Node *np)
+{
+ if (!(np->type->prop & TARITH))
+ error("unary operator requires numerical operand");
+ np = promote(np);
+ return node(op, np->type, np, NULL);
+}
+
+Node *
+convert(Node *np, Type *newtp, int iscast)
+{
+ Type *oldtp = np->type;
+
+ if (eqtype(newtp, oldtp, 0))
+ return np;
+
+ switch (oldtp->op) {
+ case ENUM:
+ case INT:
+ case FLOAT:
+ switch (newtp->op) {
+ case PTR:
+ if (oldtp->op == FLOAT || !cmpnode(np, 0) && !iscast)
+ return NULL;
+ case INT:
+ case FLOAT:
+ case ENUM:
+ break;
+ default:
+ return NULL;
+ }
+ break;
+ case PTR:
+ switch (newtp->op) {
+ case ENUM:
+ case INT:
+ case VOID:
+ if (!iscast)
+ return NULL;
+ break;
+ case PTR:
+ if (eqtype(newtp, oldtp, 1) ||
+ iscast ||
+ newtp == pvoidtype || oldtp == pvoidtype) {
+ np->type = newtp;
+ return np;
+ }
+ default:
+ return NULL;
+ }
+ break;
+ default:
+ return NULL;
+ }
+ return node(OCAST, newtp, np, NULL);
+}
+
+static Node *
+parithmetic(int op, Node *lp, Node *rp)
+{
+ Type *tp;
+ Node *size, *np;
+
+ if (lp->type->op != PTR)
+ XCHG(lp, rp, np);
+
+ tp = rp->type;
+ if (tp->op == PTR && !(tp->type->prop & TDEFINED))
+ goto incomplete;
+ tp = lp->type;
+ if (!(tp->type->prop & TDEFINED))
+ goto incomplete;
+ size = sizeofnode(tp->type);
+
+ if (op == OSUB && BTYPE(rp) == PTR) {
+ if ((rp = convert(rp, lp->type, 0)) == NULL)
+ goto incorrect;
+ lp = node(OSUB, pdifftype, lp, rp);
+ return node(ODIV, inttype, lp, size);
+ }
+ if (!(rp->type->prop & TINTEGER))
+ goto incorrect;
+
+ rp = convert(promote(rp), sizettype, 0);
+ rp = node(OMUL, sizettype, rp, size);
+ rp = convert(rp, tp, 1);
+
+ return node(op, tp, lp, rp);
+
+incomplete:
+ errorp("invalid use of undefined type");
+ return lp;
+incorrect:
+ errorp("incorrect arithmetic operands");
+ return lp;
+
+}
+
+static Node *
+arithmetic(int op, Node *lp, Node *rp)
+{
+ Type *ltp = lp->type, *rtp = rp->type;
+
+ if ((ltp->prop & TARITH) && (rtp->prop & TARITH)) {
+ arithconv(&lp, &rp);
+ return node(op, lp->type, lp, rp);
+ } else if ((ltp->op == PTR || rtp->op == PTR)) {
+ switch (op) {
+ case OADD:
+ case OSUB:
+ case OA_ADD:
+ case OA_SUB:
+ case OINC:
+ case ODEC:
+ return parithmetic(op, lp, rp);
+ }
+ }
+ errorp("incorrect arithmetic operands");
+}
+
+static Node *
+pcompare(int op, Node *lp, Node *rp)
+{
+ Node *np;
+
+ if (lp->type->prop & TINTEGER)
+ XCHG(lp, rp, np);
+ else if (eqtype(lp->type, pvoidtype, 1))
+ XCHG(lp, rp, np);
+
+ if ((np = convert(rp, lp->type, 0)) != NULL)
+ rp = np;
+ else
+ errorp("incompatible types in comparison");
+ return convert(node(op, pvoidtype, lp, rp), inttype, 1);
+}
+
+static Node *
+compare(int op, Node *lp, Node *rp)
+{
+ Type *ltp, *rtp;
+
+ ltp = lp->type;
+ rtp = rp->type;
+
+ if (ltp->op == PTR || rtp->op == PTR) {
+ return pcompare(op, rp, lp);
+ } else if ((ltp->prop & TARITH) && (rtp->prop & TARITH)) {
+ arithconv(&lp, &rp);
+ return convert(node(op, lp->type, lp, rp), inttype, 1);;
+ } else {
+ errorp("incompatible types in comparison");
+ freetree(lp);
+ freetree(rp);
+ return constnode(zero);
+ }
+}
+
+int
+negop(int op)
+{
+ switch (op) {
+ case OEQ: return ONE;
+ case ONE: return OEQ;
+ case OLT: return OGE;
+ case OGE: return OLT;
+ case OLE: return OGT;
+ case OGT: return OLE;
+ default: abort();
+ }
+ return op;
+}
+
+static Node *
+exp2cond(Node *np, int neg)
+{
+ if (np->type->prop & TAGGREG) {
+ errorp("used struct/union type value where scalar is required");
+ return constnode(zero);
+ }
+ switch (np->op) {
+ case ONEG:
+ case OOR:
+ case OAND:
+ return (neg) ? node(ONEG, inttype, np, NULL) : np;
+ case OEQ:
+ case ONE:
+ case OLT:
+ case OGE:
+ case OLE:
+ case OGT:
+ if (neg)
+ np->op = negop(np->op);
+ return np;
+ default:
+ return compare((neg) ? OEQ : ONE, np, constnode(zero));
+ }
+}
+
+static Node *
+logic(int op, Node *lp, Node *rp)
+{
+ lp = exp2cond(lp, 0);
+ rp = exp2cond(rp, 0);
+ return node(op, inttype, lp, rp);
+}
+
+static Node *
+field(Node *np)
+{
+ Symbol *sym;
+
+ namespace = np->type->ns;
+ next();
+ namespace = NS_IDEN;
+
+ sym = yylval.sym;
+ if (yytoken != IDEN)
+ unexpected();
+ next();
+
+ if (!(np->type->prop & TAGGREG)) {
+ errorp("request for member '%s' in something not a structure or union",
+ yylval.sym->name);
+ goto free_np;
+ }
+ if ((sym->flags & SDECLARED) == 0) {
+ errorp("incorrect field in struct/union");
+ goto free_np;
+ }
+ np = node(OFIELD, sym->type, np, varnode(sym));
+ np->flags |= NLVAL;
+ return np;
+
+free_np:
+ freetree(np);
+ return constnode(zero);
+}
+
+static Node *
+content(int op, Node *np)
+{
+ if (BTYPE(np) != PTR) {
+ errorp("invalid argument of memory indirection");
+ } else {
+ if (np->op == OADDR) {
+ Node *new = np->left;
+ new->type = np->type->type;
+ free(np);
+ np = new;
+ } else {
+ np = node(op, np->type->type, np, NULL);
+ }
+ np->flags |= NLVAL;
+ }
+ return np;
+}
+
+static Node *
+array(Node *lp, Node *rp)
+{
+ Type *tp;
+ Node *np;
+
+ if (!(lp->type->prop & TINTEGER) && !(rp->type->prop & TINTEGER))
+ error("array subscript is not an integer");
+ np = arithmetic(OADD, lp, rp);
+ tp = np->type;
+ if (tp->op != PTR)
+ errorp("subscripted value is neither array nor pointer");
+ return content(OPTR, np);
+}
+
+static Node *
+assignop(int op, Node *lp, Node *rp)
+{
+ if ((rp = convert(rp, lp->type, 0)) == NULL) {
+ errorp("incompatible types when assigning");
+ return lp;
+ }
+
+ return node(op, lp->type, lp, rp);
+}
+
+static Node *
+incdec(Node *np, int op)
+{
+ Type *tp = np->type;
+ Node *inc;
+
+ chklvalue(np);
+ np->flags |= NEFFECT;
+
+ if (!(tp->prop & TDEFINED)) {
+ errorp("invalid use of undefined type");
+ return np;
+ } else if (tp->op == PTR && !(tp->type->prop & TDEFINED)) {
+ errorp("%s of pointer to an incomplete type",
+ (op == OINC || op == OA_ADD) ? "increment" : "decrement");
+ return np;
+ } else if (tp->op == PTR || (tp->prop & TARITH)) {
+ inc = constnode(one);
+ } else {
+ errorp("wrong type argument to increment or decrement");
+ return np;
+ }
+ return arithmetic(op, np, inc);
+}
+
+static Node *
+address(int op, Node *np)
+{
+ Node *new;
+
+ /*
+ * ansi c accepts & applied to a function name, and it generates
+ * a function pointer
+ */
+ if (np->op == OSYM) {
+ if (np->type->op == FTN)
+ return decay(np);
+ if (np->type->op == ARY)
+ goto dont_check_lvalue;
+ }
+ chklvalue(np);
+
+dont_check_lvalue:
+ if (np->sym && (np->sym->flags & SREGISTER))
+ errorp("address of register variable '%s' requested", yytext);
+ new = node(op, mktype(np->type, PTR, 0, NULL), np, NULL);
+ if (np->sym && np->sym->flags & (SGLOBAL|SLOCAL|SPRIVATE))
+ new->flags |= NCONST;
+ return new;
+}
+
+static Node *
+negation(int op, Node *np)
+{
+ if (!(np->type->prop & TARITH) && np->type->op != PTR) {
+ errorp("invalid argument of unary '!'");
+ return constnode(zero);
+ }
+ return exp2cond(np, 1);
+}
+
+static Symbol *
+notdefined(Symbol *sym)
+{
+ int isdef;
+
+ if (namespace == NS_CPP && !strcmp(sym->name, "defined")) {
+ disexpand = 1;
+ next();
+ expect('(');
+ sym = yylval.sym;
+ expect(IDEN);
+ expect(')');
+
+ isdef = (sym->flags & SDECLARED) != 0;
+ sym = newsym(NS_IDEN, NULL);
+ sym->type = inttype;
+ sym->flags |= SCONSTANT;
+ sym->u.i = isdef;
+ disexpand = 0;
+ return sym;
+ }
+ errorp("'%s' undeclared", yytext);
+ sym->type = inttype;
+ return install(sym->ns, yylval.sym);
+}
+
+static Symbol *
+adjstrings(Symbol *sym)
+{
+ char *s, *t;
+ size_t len, n;
+ Type *tp;
+
+ tp = sym->type;
+ s = sym->u.s;
+ for (len = strlen(s);; len += n) {
+ next();
+ if (yytoken != STRING)
+ break;
+ t = yylval.sym->u.s;
+ n = strlen(t);
+ s = xrealloc(s, len + n + 1);
+ memcpy(s+len, t, n);
+ s[len + n] = '\0';
+ killsym(yylval.sym);
+ }
+ ++len;
+ if (tp->n.elem != len) {
+ sym->type = mktype(chartype, ARY, len, NULL);
+ sym->u.s = s;
+ }
+ return sym;
+}
+
+/*************************************************************
+ * grammar functions *
+ *************************************************************/
+static Node *
+primary(void)
+{
+ Node *np;
+ Symbol *sym;
+ Node *(*fun)(Symbol *);
+
+ sym = yylval.sym;
+ switch (yytoken) {
+ case STRING:
+ np = constnode(adjstrings(sym));
+ sym->flags |= SHASINIT;
+ emit(ODECL, sym);
+ emit(OINIT, np);
+ return varnode(sym);
+ case BUILTIN:
+ fun = sym->u.fun;
+ next();
+ expect('(');
+ np = (*fun)(sym);
+ expect(')');
+
+ /* do not call to next */
+ return np;
+ case CONSTANT:
+ np = constnode(sym);
+ break;
+ case IDEN:
+ assert((sym->flags & SCONSTANT) == 0);
+ if ((sym->flags & SDECLARED) == 0) {
+ if (namespace == NS_CPP) {
+ np = constnode(zero);
+ break;
+ }
+ sym = notdefined(sym);
+ }
+ sym->flags |= SUSED;
+ np = varnode(sym);
+ break;
+ default:
+ unexpected();
+ }
+ next();
+
+ return np;
+}
+
+static Node *
+arguments(Node *np)
+{
+ int toomany, n, op;
+ Node *par = NULL, *arg;
+ Type *argtype, **targs, *tp = np->type, *rettype;
+
+ if (tp->op == PTR && tp->type->op == FTN) {
+ np = content(OPTR, np);
+ tp = np->type;
+ }
+ if (tp->op != FTN) {
+ targs = (Type *[]) {ellipsistype};
+ n = 1;
+ rettype = inttype;
+ errorp("function or function pointer expected");
+ } else {
+ targs = tp->p.pars;
+ n = tp->n.elem;
+ rettype = tp->type;
+ }
+
+ expect('(');
+ if (yytoken == ')')
+ goto no_pars;
+ toomany = 0;
+
+ do {
+ arg = xassign();
+ argtype = *targs;
+ if (argtype == ellipsistype) {
+ n = 0;
+ switch (arg->type->op) {
+ case INT:
+ arg = promote(arg);
+ break;
+ case FLOAT:
+ if (arg->type == floattype)
+ arg = convert(arg, doubletype, 1);
+ break;
+ }
+ par = node(OPAR, arg->type, par, arg);
+ continue;
+ }
+ if (--n < 0) {
+ if (!toomany)
+ errorp("too many arguments in function call");
+ toomany = 1;
+ continue;
+ }
+ ++targs;
+ if ((arg = convert(arg, argtype, 0)) != NULL) {
+ par = node(OPAR, arg->type, par, arg);
+ continue;
+ }
+ errorp("incompatible type for argument %d in function call",
+ tp->n.elem - n + 1);
+ } while (accept(','));
+
+no_pars:
+ expect(')');
+ if (n > 0 && *targs != ellipsistype)
+ errorp("too few arguments in function call");
+
+ op = (tp->prop&TELLIPSIS) ? OCALLE : OCALL;
+ return node(op, rettype, np, par);
+}
+
+static Node *unary(int);
+
+static Type *
+typeof(Node *np)
+{
+ Type *tp;
+
+ if (np == NULL)
+ unexpected();
+ tp = np->type;
+ freetree(np);
+ return tp;
+}
+
+static Type *
+sizeexp(void)
+{
+ Type *tp;
+
+ expect('(');
+ switch (yytoken) {
+ case TYPE:
+ case TYPEIDEN:
+ tp = typename();
+ break;
+ default:
+ tp = typeof(unary(0));
+ break;
+ }
+ expect(')');
+ return tp;
+}
+
+static Node *
+postfix(Node *lp)
+{
+ Node *rp;
+
+ for (;;) {
+ switch (yytoken) {
+ case '[':
+ case DEC:
+ case INC:
+ case INDIR:
+ case '.':
+ case '(':
+ lp = decay(lp);
+ switch (yytoken) {
+ case '[':
+ next();
+ rp = xexpr();
+ expect(']');
+ lp = array(lp, rp);
+ break;
+ case DEC:
+ case INC:
+ lp = incdec(lp, (yytoken == INC) ? OINC : ODEC);
+ next();
+ break;
+ case INDIR:
+ lp = content(OPTR, lp);
+ case '.':
+ lp = field(lp);
+ break;
+ case '(':
+ lp = arguments(lp);
+ lp->flags |= NEFFECT;
+ break;
+ }
+ break;
+ default:
+ return lp;
+ }
+ }
+}
+
+static Node *
+defined(void)
+{
+ Symbol *sym;
+ int paren;
+
+ disexpand = 1;
+ next();
+ paren = accept('(');
+ if (yytoken != IDEN && yytoken != TYPEIDEN)
+ cpperror("operator 'defined' requires an identifier");
+ if (yytoken == TYPEIDEN || !(yylval.sym->flags & SDECLARED))
+ sym = zero;
+ else
+ sym = one;
+ disexpand = 0;
+ next();
+ if (paren)
+ expect(')');
+ return constnode(sym);
+}
+
+static Node *cast(int);
+
+static Node *
+unary(int needdecay)
+{
+ Node *(*fun)(int, Node *), *np;
+ int op;
+ Type *tp;
+
+ switch (yytoken) {
+ case '!': op = 0; fun = negation; break;
+ case '+': op = OADD; fun = numericaluop; break;
+ case '-': op = OSNEG; fun = numericaluop; break;
+ case '~': op = OCPL; fun = integeruop; break;
+ case '&': op = OADDR; fun = address; break;
+ case '*': op = OPTR; fun = content; break;
+ case SIZEOF:
+ next();
+ tp = (yytoken == '(') ? sizeexp() : typeof(unary(0));
+ if (!(tp->prop & TDEFINED))
+ errorp("sizeof applied to an incomplete type");
+ return sizeofnode(tp);
+ case INC:
+ case DEC:
+ op = (yytoken == INC) ? OA_ADD : OA_SUB;
+ next();
+ np = incdec(unary(1), op);
+ goto chk_decay;
+ case IDEN:
+ case TYPEIDEN:
+ if (lexmode == CPPMODE && !strcmp(yylval.sym->name, "defined"))
+ return defined();
+ default:
+ np = postfix(primary());
+ goto chk_decay;
+ }
+
+ next();
+ np = (*fun)(op, cast(op != OADDR));
+
+chk_decay:
+ if (needdecay)
+ np = decay(np);
+ return np;
+}
+
+static Node *
+cast(int needdecay)
+{
+ Node *lp, *rp;
+ Type *tp;
+ static int nested;
+
+ if (!accept('('))
+ return unary(needdecay);
+
+ switch (yytoken) {
+ case TQUALIFIER:
+ case TYPE:
+ case TYPEIDEN:
+ tp = typename();
+ expect(')');
+
+ if (yytoken == '{')
+ return initlist(tp);
+
+ switch (tp->op) {
+ case ARY:
+ error("cast specifies an array type");
+ default:
+ lp = cast(needdecay);
+ if ((rp = convert(lp, tp, 1)) == NULL)
+ error("bad type conversion requested");
+ rp->flags &= ~NLVAL;
+ rp->flags |= lp->flags & NLVAL;
+ }
+ break;
+ default:
+ if (nested == NR_SUBEXPR)
+ error("too many expressions nested by parentheses");
+ ++nested;
+ rp = xexpr();
+ --nested;
+ expect(')');
+ rp = postfix(rp);
+ break;
+ }
+
+ return rp;
+}
+
+static Node *
+mul(void)
+{
+ Node *np, *(*fun)(int, Node *, Node *);
+ int op;
+
+ np = cast(1);
+ for (;;) {
+ switch (yytoken) {
+ case '*': op = OMUL; fun = arithmetic; break;
+ case '/': op = ODIV; fun = arithmetic; break;
+ case '%': op = OMOD; fun = integerop; break;
+ default: return np;
+ }
+ next();
+ np = (*fun)(op, np, cast(1));
+ }
+}
+
+static Node *
+add(void)
+{
+ int op;
+ Node *np;
+
+ np = mul();
+ for (;;) {
+ switch (yytoken) {
+ case '+': op = OADD; break;
+ case '-': op = OSUB; break;
+ default: return np;
+ }
+ next();
+ np = arithmetic(op, np, mul());
+ }
+}
+
+static Node *
+shift(void)
+{
+ int op;
+ Node *np;
+
+ np = add();
+ for (;;) {
+ switch (yytoken) {
+ case SHL: op = OSHL; break;
+ case SHR: op = OSHR; break;
+ default: return np;
+ }
+ next();
+ np = integerop(op, np, add());
+ }
+}
+
+static Node *
+relational(void)
+{
+ int op;
+ Node *np;
+
+ np = shift();
+ for (;;) {
+ switch (yytoken) {
+ case '<': op = OLT; break;
+ case '>': op = OGT; break;
+ case GE: op = OGE; break;
+ case LE: op = OLE; break;
+ default: return np;
+ }
+ next();
+ np = compare(op, np, shift());
+ }
+}
+
+static Node *
+eq(void)
+{
+ int op;
+ Node *np;
+
+ np = relational();
+ for (;;) {
+ switch (yytoken) {
+ case EQ: op = OEQ; break;
+ case NE: op = ONE; break;
+ default: return np;
+ }
+ next();
+ np = compare(op, np, relational());
+ }
+}
+
+static Node *
+bit_and(void)
+{
+ Node *np;
+
+ np = eq();
+ while (accept('&'))
+ np = integerop(OBAND, np, eq());
+ return np;
+}
+
+static Node *
+bit_xor(void)
+{
+ Node *np;
+
+ np = bit_and();
+ while (accept('^'))
+ np = integerop(OBXOR, np, bit_and());
+ return np;
+}
+
+static Node *
+bit_or(void)
+{
+ Node *np;
+
+ np = bit_xor();
+ while (accept('|'))
+ np = integerop(OBOR, np, bit_xor());
+ return np;
+}
+
+static Node *
+and(void)
+{
+ Node *np;
+
+ np = bit_or();
+ while (accept(AND))
+ np = logic(OAND, np, bit_or());
+ return np;
+}
+
+static Node *
+or(void)
+{
+ Node *np;
+
+ np = and();
+ while (accept(OR))
+ np = logic(OOR, np, and());
+ return np;
+}
+
+static Node *
+ternary(void)
+{
+ Node *cond;
+
+ cond = or();
+ while (accept('?')) {
+ Node *ifyes, *ifno, *np;
+
+ cond = exp2cond(cond, 0);
+ ifyes = xexpr();
+ expect(':');
+ ifno = ternary();
+ np = chkternary(ifyes, ifno);
+ cond = node(OASK, np->type, cond, np);
+ }
+ return cond;
+}
+
+static Node *
+xassign(void)
+{
+ Node *np, *(*fun)(int , Node *, Node *);
+ int op;
+
+ np = ternary();
+ for (;;) {
+ switch (yytoken) {
+ case '=': op = OASSIGN; fun = assignop; break;
+ case MUL_EQ: op = OA_MUL; fun = arithmetic; break;
+ case DIV_EQ: op = OA_DIV; fun = arithmetic; break;
+ case MOD_EQ: op = OA_MOD; fun = integerop; break;
+ case ADD_EQ: op = OA_ADD; fun = arithmetic; break;
+ case SUB_EQ: op = OA_SUB; fun = arithmetic; break;
+ case SHL_EQ: op = OA_SHL; fun = integerop; break;
+ case SHR_EQ: op = OA_SHR; fun = integerop; break;
+ case AND_EQ: op = OA_AND; fun = integerop; break;
+ case XOR_EQ: op = OA_XOR; fun = integerop; break;
+ case OR_EQ: op = OA_OR; fun = integerop; break;
+ default: return np;
+ }
+ chklvalue(np);
+ np->flags |= NEFFECT;
+ next();
+ np = (fun)(op, np, assign());
+ }
+}
+
+static Node *
+xexpr(void)
+{
+ Node *lp, *rp;
+
+ lp = xassign();
+ while (accept(',')) {
+ rp = xassign();
+ lp = node(OCOMMA, rp->type, lp, rp);
+ }
+ return lp;
+}
+
+Node *
+assign(void)
+{
+ return simplify(xassign());
+}
+
+Node *
+constexpr(void)
+{
+ Node *np;
+
+ np = ternary();
+ if (np && np->type->op == INT) {
+ np = simplify(convert(np, inttype, 0));
+ if (np->flags & NCONST)
+ return np;
+ }
+ freetree(np);
+ return NULL;
+}
+
+Node *
+expr(void)
+{
+ return simplify(xexpr());
+}
+
+Node *
+condexpr(int neg)
+{
+ Node *np;
+
+ np = exp2cond(xexpr(), neg);
+ if (np->flags & NCONST)
+ warn("conditional expression is constant");
+ return simplify(np);
+}
--- /dev/null
+++ b/src/cc1/fold.c
@@ -1,0 +1,685 @@
+static char sccsid[] = "@(#) ./cc1/fold.c";
+#include <assert.h>
+#include <stdlib.h>
+
+#include <scc/scc.h>
+#include "cc1.h"
+
+
+TUINT
+ones(int nbytes)
+{
+ return (nbytes == 8) ? -1 : ~(-1ull << nbytes * 8);
+}
+
+static int
+addi(TINT l, TINT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+ TINT max = lim->max.i, min = -lim->min.i;
+
+ if (l < 0 && r < 0 && l >= min - r ||
+ l == 0 ||
+ r == 0 ||
+ l < 0 && r > 0 ||
+ l > 0 && r < 0 ||
+ l > 0 && r > 0 && l <= max - r) {
+ return 1;
+ }
+ warn("overflow in constant expression");
+ return 0;
+}
+
+static int
+addf(TFLOAT l, TFLOAT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+ TFLOAT max = lim->max.f, min = lim->min.f;
+
+ if (l < 0 && r < 0 && l >= min - r ||
+ l == 0 ||
+ r == 0 ||
+ l < 0 && r > 0 ||
+ l > 0 && r < 0 ||
+ l > 0 && r > 0 && l <= max - r) {
+ return 1;
+ }
+ warn("overflow in constant expression");
+ return 0;
+}
+
+static int
+subi(TINT l, TINT r, Type *tp)
+{
+ return addi(l, -r, tp);
+}
+
+static int
+subf(TFLOAT l, TFLOAT r, Type *tp)
+{
+ return addf(l, -r, tp);
+}
+
+static int
+muli(TINT l, TINT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+ TINT max = lim->max.i, min = -lim->min.i;
+
+ if (l > -1 && l <= 1 ||
+ r > -1 && r <= 1 ||
+ l < 0 && r < 0 && -l <= max/-r ||
+ l < 0 && r > 0 && l >= min/r ||
+ l > 0 && r < 0 && r >= min/l ||
+ l > 0 && r > 0 && l <= max/r) {
+ return 1;
+ }
+ warn("overflow in constant expression");
+ return 0;
+}
+
+static int
+mulf(TFLOAT l, TFLOAT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+ TFLOAT max = lim->max.f, min = lim->min.f;
+
+ if (l > -1 && l <= 1 ||
+ r > -1 && r <= 1 ||
+ l < 0 && r < 0 && -l <= max/-r ||
+ l < 0 && r > 0 && l >= min/r ||
+ l > 0 && r < 0 && r >= min/l ||
+ l > 0 && r > 0 && l <= max/r) {
+ return 1;
+ }
+ warn("overflow in constant expression");
+ return 0;
+}
+
+static int
+divi(TINT l, TINT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+
+ if (r == 0 || l == -lim->min.i && r == -1) {
+ warn("overflow in constant expression");
+ return 0;
+ }
+ return 1;
+}
+
+static int
+divf(TFLOAT l, TFLOAT r, Type *tp)
+{
+ struct limits *lim = getlimits(tp);
+
+ if (l < 0) l = -l;
+ if (r < 0) r = -r;
+
+ if (r == 0.0 || r < 1.0 && l > lim->max.f * r) {
+ warn("overflow in constant expression");
+ return 0;
+ }
+ return 1;
+}
+
+static int
+lshi(TINT l, TINT r, Type *tp)
+{
+ if (r < 0 || r >= tp->size * 8) {
+ warn("shifting %d bits is undefined", r);
+ return 0;
+ }
+ return muli(l, 1 << r, tp);
+}
+
+static int
+rshi(TINT l, TINT r, Type *tp)
+{
+ if (r < 0 || r >= tp->size * 8) {
+ warn("shifting %d bits is undefined", r);
+ return 0;
+ }
+ return 1;
+}
+
+static int
+foldint(int op, Symbol *res, TINT l, TINT r)
+{
+ TINT i;
+ Type *tp = res->type;
+ int (*validate)(TINT, TINT, Type *tp);
+
+ switch (op) {
+ case OADD: validate = addi; break;
+ case OSUB: validate = subi; break;
+ case OMUL: validate = muli; break;
+ case ODIV: validate = divi; break;
+ case OSHL: validate = lshi; break;
+ case OSHR: validate = rshi; break;
+ case OMOD: validate = divi; break;
+ default: validate = NULL; break;
+ }
+
+ if (validate && !(*validate)(l, r, tp))
+ return 0;
+
+ switch (op) {
+ case OADD: i = l + r; break;
+ case OSUB: i = l - r; break;
+ case OMUL: i = l * r; break;
+ case ODIV: i = l / r; break;
+ case OMOD: i = l % r; break;
+ case OSHL: i = l << r; break;
+ case OSHR: i = l >> r; break;
+ case OBAND: i = l & r; break;
+ case OBXOR: i = l ^ r; break;
+ case OBOR: i = l | r; break;
+ case OAND: i = l && r; break;
+ case OOR: i = l || r; break;
+ case OLT: i = l < r; break;
+ case OGT: i = l > r; break;
+ case OGE: i = l >= r; break;
+ case OLE: i = l <= r; break;
+ case OEQ: i = l == r; break;
+ case ONE: i = l != r; break;
+ case ONEG: i = !l; break;
+ case OSNEG: i = -l; break;
+ case OCPL: i = ~l; break;
+ default: return 0;
+ }
+ res->u.i = i;
+
+ DBG("FOLD i l=%lld %d r=%lld = %lld", l, op, r, i);
+ return 1;
+}
+
+static int
+folduint(int op, Symbol *res, TUINT l, TUINT r)
+{
+ TINT i;
+ TUINT u;
+
+ switch (op) {
+ case OADD: u = l + r; break;
+ case OSUB: u = l - r; break;
+ case OMUL: u = l * r; break;
+ case ODIV: u = l / r; break;
+ case OMOD: u = l % r; break;
+ case OSHL: u = l << r; break;
+ case OSHR: u = l >> r; break;
+ case OBAND: u = l & r; break;
+ case OBXOR: u = l ^ r; break;
+ case OBOR: u = l | r; break;
+ case ONEG: u = !l; break;
+ case OSNEG: u = -l; break;
+ case OCPL: u = ~l; break;
+ case OAND: i = l && r; goto sign;
+ case OOR: i = l || r; goto sign;
+ case OLT: i = l < r; goto sign;
+ case OGT: i = l > r; goto sign;
+ case OGE: i = l >= r; goto sign;
+ case OLE: i = l <= r; goto sign;
+ case OEQ: i = l == r; goto sign;
+ case ONE: i = l != r; goto sign;
+ default: return 0;
+ }
+ res->u.u = u & ones(res->type->size);
+
+ DBG("FOLD ui l=%llu %d r=%llu = %llu", l, op, r, u);
+ return 1;
+
+sign:
+ res->u.i = i;
+
+ DBG("FOLD sui %llu %d %llu = %llu", l, op, r, i);
+ return 1;
+}
+
+static int
+foldfloat(int op, Symbol *res, TFLOAT l, TFLOAT r)
+{
+ TFLOAT f;
+ TINT i;
+ int (*validate)(TFLOAT, TFLOAT, Type *tp);
+
+ switch (op) {
+ case OADD: validate = addf; break;
+ case OSUB: validate = subf; break;
+ case OMUL: validate = mulf; break;
+ case ODIV: validate = divf; break;
+ default: validate = NULL; break;
+ }
+
+ if (validate && !(*validate)(l, r, res->type))
+ return 0;
+
+ switch (op) {
+ case OADD: f = l + r; break;
+ case OSUB: f = l - r; break;
+ case OMUL: f = l * r; break;
+ case ODIV: f = l / r; break;
+ case OLT: i = l < r; goto comparison;
+ case OGT: i = l > r; goto comparison;
+ case OGE: i = l >= r; goto comparison;
+ case OLE: i = l <= r; goto comparison;
+ case OEQ: i = l == r; goto comparison;
+ case ONE: i = l != r; goto comparison;
+ default: return 0;
+ }
+ res->u.f = f;
+
+ DBG("FOLD f l=%lf %d r=%lf = %lf", l, op, r, f);
+ return 1;
+
+comparison:
+ res->u.i = i;
+
+ DBG("FOLD if l=%lf %d r=%lf = %lld", l, op, r, i);
+ return 1;
+}
+
+static Node *
+foldconst(int type, int op, Type *tp, Symbol *ls, Symbol *rs)
+{
+ Symbol *sym, aux;
+ TINT i;
+ TUINT u;
+ TFLOAT f;
+
+ aux.type = tp;
+ switch (type) {
+ case INT:
+ i = (rs) ? rs->u.i : 0;
+ if (!foldint(op, &aux, ls->u.i, i))
+ return NULL;
+ break;
+ case UNSIGNED:
+ u = (rs) ? rs->u.u : 0u;
+ if (!folduint(op, &aux, ls->u.u, u))
+ return NULL;
+ break;
+ case FLOAT:
+ f = (rs) ? rs->u.f : 0.0;
+ if (!foldfloat(op, &aux, ls->u.f, f))
+ return NULL;
+ break;
+ }
+ sym = newsym(NS_IDEN, NULL);
+ sym->flags |= SCONSTANT;
+ sym->type = tp;
+ sym->u = aux.u;
+ return constnode(sym);
+}
+
+static Node *
+foldcast(Node *np, Node *l)
+{
+ TUINT negmask, mask, u;
+ Type *newtp = np->type, *oldtp = l->type;
+ Symbol aux, *sym, *osym = l->sym;
+
+ if (!(l->flags & NCONST))
+ return np;
+
+ switch (newtp->op) {
+ case PTR:
+ case INT:
+ case ENUM:
+ switch (oldtp->op) {
+ case PTR:
+ case INT:
+ case ENUM:
+ u = (oldtp->prop & TSIGNED) ? osym->u.i : osym->u.u;
+ break;
+ case FLOAT:
+ oldtp = newtp;
+ u = osym->u.f;
+ break;
+ default:
+ return np;
+ }
+ mask = ones(newtp->size);
+ if (newtp->prop & TSIGNED) {
+ negmask = ~mask;
+ if (u & (negmask >> 1) & mask)
+ u |= negmask;
+ aux.u.i = u;
+ } else {
+ aux.u.u = u & mask;
+ }
+ break;
+ case FLOAT:
+ /* FIXME: The cast can be from another float type */
+ aux.u.f = (oldtp->prop & TSIGNED) ? osym->u.i : osym->u.u;
+ break;
+ default:
+ return np;
+ }
+ DBG("FOLD cast %c->%c", oldtp->letter, newtp->letter);
+ freetree(np);
+ sym = newsym(NS_IDEN, NULL);
+ sym->flags |= SCONSTANT;
+ sym->type = newtp;
+ sym->u = aux.u;
+ return constnode(sym);
+}
+
+static Node *
+foldunary(Node *np, Node *l)
+{
+ int op = l->op;
+ Node *aux;
+
+ switch (np->op) {
+ case ONEG:
+ if (l->op == ONEG)
+ break;
+ return NULL;
+ case OADD:
+ DBG("FOLD unary delete %d", np->op);
+ np->left = NULL;
+ freetree(np);
+ return l;
+ case OCAST:
+ if (op != OCAST)
+ return foldcast(np, l);
+ /* TODO: This is wrong: (float)(int) 7.2 */
+ DBG("FOLD unary collapse %d", np->op);
+ np->left = l->left;
+ l->left = NULL;
+ freetree(l);
+ return np;
+ case OSNEG:
+ case OCPL:
+ if (op != np->op)
+ return NULL;
+ break;
+ case OPTR:
+ if (op != OADDR || np->type != l->left->type)
+ return NULL;
+ break;
+ case OADDR:
+ if (op != OPTR)
+ return NULL;
+ break;
+ default:
+ return NULL;
+ }
+ DBG("FOLD unary cancel %d", np->op);
+ aux = l->left;
+ l->left = NULL;
+ freetree(np);
+ return aux;
+}
+
+static Node *
+fold(Node *np)
+{
+ Symbol *rs, *ls;
+ Type *optype;
+ int type;
+ int op = np->op;
+ Node *p, *lp = np->left, *rp = np->right;
+ Type *tp = np->type;
+
+ assert(lp && rp);
+ if ((op == ODIV || op == OMOD) && cmpnode(rp, 0)) {
+ warn("division by 0");
+ return NULL;
+ }
+ /*
+ * Return if any of the children is no constant,
+ * or it is a constant generated when
+ * the address of a static variable is taken
+ * (when we don't know the physical address so
+ * we cannot fold it)
+ */
+ if (!rp) {
+ rs = NULL;
+ } else {
+ if (!(rp->flags & NCONST) || !rp->sym)
+ return NULL;
+ rs = rp->sym;
+ }
+
+ if (!(lp->flags & NCONST) || !lp->sym)
+ return NULL;
+ optype = lp->type;
+ ls = lp->sym;
+
+ switch (type = optype->op) {
+ case ENUM:
+ case INT:
+ if (!(optype->prop & TSIGNED))
+ type = UNSIGNED;
+ case PTR:
+ case FLOAT:
+ if ((p = foldconst(type, op, tp, ls, rs)) == NULL)
+ return NULL;
+ freetree(np);
+ return p;
+ default:
+ return NULL;
+ }
+}
+
+static void
+commutative(Node *np, Node *l, Node *r)
+{
+ int op = np->op;
+
+ if (r == NULL || r->flags&NCONST || !(l->flags&NCONST))
+ return;
+
+ switch (op) {
+ case OLT:
+ case OGT:
+ case OGE:
+ case OLE:
+ DBG("FOLD neg commutative %d", np->op);
+ np->op = negop(op);
+ case OEQ:
+ case ONE:
+ case OADD:
+ case OMUL:
+ case OBAND:
+ case OBXOR:
+ case OBOR:
+ DBG("FOLD commutative %d", np->op);
+ np->left = r;
+ np->right = l;
+ break;
+ }
+}
+
+static Node *
+identity(Node *np)
+{
+ int iszeror, isoner;
+ int iszerol, isonel;
+ Node *lp = np->left, *rp = np->right;
+
+ if (!rp)
+ return NULL;
+
+ iszeror = cmpnode(rp, 0);
+ isoner = cmpnode(rp, 1),
+ iszerol = cmpnode(lp, 0);
+ isonel = cmpnode(lp, 1);
+
+ switch (np->op) {
+ case OOR:
+ /*
+ * 1 || i => 1 (free right)
+ * i || 0 => i (free right)
+ * 0 || i => i (free left)
+ * i || 1 => i,1 (comma)
+ */
+ if (isonel | iszeror)
+ goto free_right;
+ if (iszerol)
+ goto free_left;
+ if (isoner)
+ goto change_to_comma;
+ return NULL;
+ case OAND:
+ /*
+ * 0 && i => 0 (free right)
+ * i && 1 => i (free right)
+ * 1 && i => i (free left)
+ * i && 0 => i,0 (comma)
+ */
+ if (iszerol | isoner)
+ goto free_right;
+ if (isonel)
+ goto free_left;
+ if (iszeror)
+ goto change_to_comma;
+ return NULL;
+ case OSHL:
+ case OSHR:
+ /*
+ * i >> 0 => i (free right)
+ * i << 0 => i (free right)
+ * 0 >> i => 0 (free right)
+ * 0 << i => 0 (free right)
+ */
+ if (iszeror | iszerol)
+ goto free_right;
+ return NULL;
+ case OBXOR:
+ case OADD:
+ case OBOR:
+ case OSUB:
+ /*
+ * i + 0 => i
+ * i - 0 => i
+ * i | 0 => i
+ * i ^ 0 => i
+ */
+ if (iszeror)
+ goto free_right;
+ return NULL;
+ case OMUL:
+ /*
+ * i * 0 => i,0
+ * i * 1 => i
+ */
+ if (iszeror)
+ goto change_to_comma;
+ if (isoner)
+ goto free_right;
+ return NULL;
+ case ODIV:
+ /* i / 1 => i */
+ if (isoner)
+ goto free_right;
+ return NULL;
+ case OBAND:
+ /* i & ~0 => i */
+ if (cmpnode(rp, -1))
+ goto free_right;
+ return NULL;
+ case OMOD:
+ /* i % 1 => i,1 */
+ /* TODO: i % 2^n => i & n-1 */
+ if (isoner)
+ goto change_to_comma;
+ default:
+ return NULL;
+ }
+
+free_right:
+ DBG("FOLD identity %d", np->op);
+ np->left = NULL;
+ freetree(np);
+ return lp;
+
+free_left:
+ DBG("FOLD identity %d", np->op);
+ np->right = NULL;
+ freetree(np);
+ return rp;
+
+change_to_comma:
+ DBG("FOLD identity %d", np->op);
+ np->op = OCOMMA;
+ return np;
+}
+
+static Node *
+foldternary(Node *np, Node *cond, Node *body)
+{
+ if (!(cond->flags & NCONST))
+ return np;
+ if (cmpnode(cond, 0)) {
+ np = body->right;
+ freetree(body->left);
+ } else {
+ np = body->left;
+ freetree(body->right);
+ }
+
+ DBG("FOLD ternary");
+ body->left = NULL;
+ body->right = NULL;
+ freetree(cond);
+ free(body);
+ return np;
+}
+
+/* TODO: fold OCOMMA */
+
+Node *
+simplify(Node *np)
+{
+ Node *p, *l, *r;
+
+ if (!np)
+ return NULL;
+ if (debug)
+ prtree(np);
+
+ l = np->left = simplify(np->left);
+ r = np->right = simplify(np->right);
+
+ switch (np->op) {
+ case OASK:
+ return foldternary(np, l, r);
+ case OCALL:
+ case OPAR:
+ case OSYM:
+ case OASSIGN:
+ case OA_MUL:
+ case OA_DIV:
+ case OA_MOD:
+ case OA_ADD:
+ case OA_SUB:
+ case OA_SHL:
+ case OA_SHR:
+ case OA_AND:
+ case OA_XOR:
+ case OA_OR:
+ return np;
+ case OSNEG:
+ case OCPL:
+ case OADDR:
+ case OPTR:
+ case INC:
+ case DEC:
+ case OCAST:
+ case ONEG:
+ assert(!r);
+ if ((p = foldunary(np, l)) != NULL)
+ return p;
+ return np;
+ default:
+ commutative(np, l, r);
+ if ((p = fold(np)) != NULL)
+ return p;
+ if ((p = identity(np)) != NULL)
+ return p;
+ return np;
+ }
+}
--- /dev/null
+++ b/src/cc1/init.c
@@ -1,0 +1,378 @@
+static char sccsid[] = "@(#) ./cc1/init.c";
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+
+typedef struct init Init;
+
+struct designator {
+ TINT pos;
+ Node *expr;
+ struct designator *next;
+};
+
+struct init {
+ TUINT pos;
+ TUINT max;
+ struct designator *tail;
+ struct designator *head;
+};
+
+static TINT
+arydesig(Type *tp, Init *ip)
+{
+ TINT npos;
+ Node *np;
+
+ if (tp->op != ARY)
+ errorp("array index in non-array initializer");
+ next();
+ np = constexpr();
+ npos = np->sym->u.i;
+ if (npos < 0 || (tp->prop & TDEFINED) && npos >= tp->n.elem) {
+ errorp("array index in initializer exceeds array bounds");
+ npos = 0;
+ }
+ freetree(np);
+ expect(']');
+ return npos;
+}
+
+static TINT
+fielddesig(Type *tp, Init *ip)
+{
+ int ons;
+ Symbol *sym, **p;
+
+ if (!(tp->prop & TAGGREG))
+ errorp("field name not in record or union initializer");
+ ons = namespace;
+ namespace = tp->ns;
+ next();
+ namespace = ons;
+ if (yytoken != IDEN)
+ unexpected();
+ sym = yylval.sym;
+ next();
+ if ((sym->flags & SDECLARED) == 0) {
+ errorp("unknown field '%s' specified in initializer",
+ sym->name);
+ return 0;
+ }
+ for (p = tp->p.fields; *p != sym; ++p)
+ ;
+ return p - tp->p.fields;
+}
+
+static Init *
+init(Init *ip)
+{
+ ip->tail = ip->head = NULL;
+ ip->pos = ip->max = 0;
+ return ip;
+}
+
+static Node *
+str2ary(Type *tp)
+{
+ Node *np;
+ Type *btp = tp->type;;
+ Symbol *sym;
+ size_t len;
+ char *s;
+
+ np = assign();
+ sym = np->left->sym;
+ if (btp != chartype && btp != uchartype && btp != schartype) {
+ errorp("array of inappropriate type initialized from string constant");
+ return constnode(zero);
+ }
+
+ len = sym->type->n.elem-1;
+ if (!(tp->prop & TDEFINED)) {
+ tp->n.elem = len+1;
+ deftype(tp);
+ } else if (tp->n.elem < len) {
+ warn("initializer-string for array of chars is too long");
+ }
+
+ len = tp->n.elem;
+ s = sym->u.s;
+ sym = newstring(NULL, len);
+ strncpy(sym->u.s, s, len);
+ np->sym = sym;
+ np->type = sym->type;
+
+ return np;
+}
+
+static Node *
+initialize(Type *tp)
+{
+ Node *np;
+ Symbol *sym;
+
+ if (tp->op == ARY && yytoken == STRING)
+ return str2ary(tp);
+
+ if (yytoken == '{' || tp->op == STRUCT || tp->op == ARY)
+ return initlist(tp);
+
+ np = assign();
+ if (eqtype(tp, np->type, 1))
+ return np;
+
+ np = convert(decay(np), tp, 0);
+ if (!np) {
+ errorp("incorrect initializer");
+ return constnode(zero);
+ }
+
+ return simplify(np);
+}
+
+static Node *
+mkcompound(Init *ip, Type *tp)
+{
+ Node **v, **p;
+ size_t n;
+ struct designator *dp, *next;
+ Symbol *sym;
+
+ if (tp->op == UNION) {
+ Node *np = NULL;
+
+ v = xmalloc(sizeof(*v));
+ for (dp = ip->head; dp; dp = next) {
+ freetree(np);
+ np = dp->expr;
+ next = dp->next;
+ free(dp);
+ }
+ *v = np;
+ } else {
+ n = (tp->prop&TDEFINED) ? tp->n.elem : ip->max;
+ if (n == 0) {
+ v = NULL;
+ } else if (n > SIZE_MAX / sizeof(*v)) {
+ errorp("compound literal too big");
+ return constnode(zero);
+ } else {
+ n *= sizeof(*v);
+ v = memset(xmalloc(n), 0, n);
+
+ for (dp = ip->head; dp; dp = next) {
+ p = &v[dp->pos];
+ freetree(*p);
+ *p = dp->expr;
+ next = dp->next;
+ free(dp);
+ }
+ }
+ }
+
+ sym = newsym(NS_IDEN, NULL);
+ sym->u.init = v;
+ sym->type = tp;
+ sym->flags |= SINITLST;
+
+ return constnode(sym);
+}
+
+static void
+newdesig(Init *ip, Node *np)
+{
+ struct designator *dp;
+
+ dp = xmalloc(sizeof(*dp));
+ dp->pos = ip->pos;
+ dp->expr = np;
+ dp->next = NULL;
+
+ if (ip->head == NULL) {
+ ip->head = ip->tail = dp;
+ } else {
+ ip->tail->next = dp;
+ ip->tail = dp;
+ }
+
+ if (ip->pos+1 > ip->max)
+ ip->max = ip->pos+1;
+}
+
+Node *
+initlist(Type *tp)
+{
+ Init in;
+ Node *np;
+ Type *curtp;
+ int braces, scalar, toomany, outbound;
+ TINT nelem = tp->n.elem;
+ static int depth;
+
+ if (depth == NR_SUBTYPE)
+ error("too many nested initializers");
+ ++depth;
+ init(&in);
+ braces = scalar = toomany = 0;
+
+ if (accept('{'))
+ braces = 1;
+
+ do {
+ curtp = inttype;
+ switch (yytoken) {
+ case '[':
+ in.pos = arydesig(tp, &in);
+ curtp = tp->type;
+ goto desig_list;
+ case '.':
+ in.pos = fielddesig(tp, &in);
+ if (in.pos < nelem)
+ curtp = tp->p.fields[in.pos]->type;
+ desig_list:
+ if (yytoken == '[' || yytoken == '.') {
+ np = initlist(curtp);
+ goto new_desig;
+ }
+ expect('=');
+ default:
+ outbound = 0;
+
+ switch (tp->op) {
+ case ARY:
+ curtp = tp->type;
+ if (!(tp->prop & TDEFINED) || in.pos < tp->n.elem)
+ break;
+ if (!toomany)
+ warn("excess elements in array initializer");
+ toomany = 1;
+ outbound = 1;
+ break;
+ case UNION:
+ case STRUCT:
+ if (in.pos < nelem) {
+ curtp = tp->p.fields[in.pos]->type;
+ break;
+ }
+ if (!toomany)
+ warn("excess elements in struct initializer");
+ toomany = 1;
+ outbound = 1;
+ break;
+ default:
+ curtp = tp;
+ if (!scalar)
+ warn("braces around scalar initializer");
+ scalar = 1;
+ if (in.pos == 0)
+ break;
+ if (!toomany)
+ warn("excess elements in scalar initializer");
+ toomany = 1;
+ outbound = 1;
+ break;
+ }
+ np = initialize(curtp);
+ if (outbound) {
+ freetree(np);
+ np = NULL;
+ }
+ }
+
+new_desig:
+ if (np)
+ newdesig(&in, np);
+ if (++in.pos == 0)
+ errorp("compound literal too big");
+ if (nelem == in.pos && !braces)
+ break;
+ } while (accept(','));
+
+ if (braces)
+ expect('}');
+
+
+ if (tp->op == ARY && !(tp->prop & TDEFINED)) {
+ tp->n.elem = in.max;
+ deftype(tp);
+ }
+ if (in.max == 0) {
+ errorp("empty braced initializer");
+ return constnode(zero);
+ }
+
+ return mkcompound(&in, tp);
+}
+
+static void
+autoinit(Symbol *sym, Node *np)
+{
+ Symbol *hidden;
+ Type *tp = sym->type;
+ size_t n; /* FIXME: It should be SIZET */
+
+repeat:
+ switch (tp->op) {
+ case UNION:
+ np = np->sym->u.init[0];
+ tp = np->type;
+ goto repeat;
+ case ARY:
+ case STRUCT:
+ if (!(np->flags & NCONST))
+ abort(); /* TODO */
+ hidden = newsym(NS_IDEN, NULL);
+ hidden->type = sym->type;
+ hidden->flags |= SLOCAL | SHASINIT;
+ emit(ODECL, hidden);
+ emit(OINIT, np);
+ emit(ODECL, sym);
+ emit(OEXPR,
+ node(OASSIGN, tp, varnode(sym), varnode(hidden)));
+ break;
+ default:
+ emit(ODECL, sym);
+ np = node(OASSIGN, tp, varnode(sym), np);
+ emit(OEXPR, np);
+ break;
+ }
+}
+
+void
+initializer(Symbol *sym, Type *tp)
+{
+ Node *np;
+ int flags = sym->flags;
+
+ if (tp->op == FTN) {
+ errorp("function '%s' initialized like a variable",
+ sym->name);
+ tp = inttype;
+ }
+ np = initialize(tp);
+
+ if (flags & SDEFINED) {
+ errorp("redeclaration of '%s'", sym->name);
+ } else if ((flags & (SGLOBAL|SLOCAL|SPRIVATE)) != 0) {
+ if (!(np->flags & NCONST)) {
+ errorp("initializer element is not constant");
+ return;
+ }
+ sym->flags |= SHASINIT;
+ sym->flags &= ~SEMITTED;
+ emit(ODECL, sym);
+ emit(OINIT, np);
+ sym->flags |= SDEFINED;
+ } else if ((flags & (SEXTERN|STYPEDEF)) != 0) {
+ errorp("'%s' has both '%s' and initializer",
+ sym->name, (flags&SEXTERN) ? "extern" : "typedef");
+ } else {
+ autoinit(sym, np);
+ }
+}
--- /dev/null
+++ b/src/cc1/ir.md
@@ -1,0 +1,443 @@
+# scc intermediate representation #
+
+The scc IR tries to be be a simple and easily parseable intermediate
+representation, and it makes it a bit terse and cryptic. The main
+characteristic of the IR is that all the types and operations are
+represented with only one letter, so parsing tables can be used
+to parse it.
+
+The language is composed of lines, representing statements.
+Each statement is composed of tab-separated fields.
+Declaration statements begin in column 0, expressions and
+control flow begin with a tabulator.
+When the frontend detects an error, it closes the output stream.
+
+## Types ##
+
+Types are represented with uppercase letters:
+
+* C -- signed 8-Bit integer
+* I -- signed 16-Bit integer
+* W -- signed 32-Bit integer
+* Q -- signed 64-Bit integer
+* K -- unsigned 8-Bit integer
+* N -- unsigned 16-Bit integer
+* Z -- unsigned 32-Bit integer
+* O -- unsigned 64-Bit integer
+* 0 -- void
+* P -- pointer
+* F -- function
+* V -- vector
+* U -- union
+* S -- struct
+* B -- bool
+* J -- float
+* D -- double
+* H -- long double
+
+This list has been built for the original Z80 backend, where 'int'
+has the same size as 'short'. Several types (S, F, V, U and others) need
+an identifier after the type letter for better differentiation
+between multiple structs, functions, vectors and unions (S1, V12 ...)
+naturally occuring in a C-program.
+
+## Storage classes ##
+
+The storage classes are represented using uppercase letters:
+
+* A -- automatic
+* R -- register
+* G -- public (global variable declared in the module)
+* X -- extern (global variable declared in another module)
+* Y -- private (variable in file-scope)
+* T -- local (static variable in function-scope)
+* M -- member (struct/union member)
+* L -- label
+
+## Declarations/definitions ##
+
+Variable names are composed of a storage class and an identifier
+(e.g. A1, R2, T3).
+Declarations and definitions are composed of a variable
+name, a type and the name of the variable:
+
+ A1 I maxweight
+ R2 C flag
+ A3 S4 statstruct
+
+### Type declarations ###
+
+Some declarations (e.g. structs) involve the declaration of member
+variables.
+Struct members are declared normally after the type declaration in
+parentheses.
+
+For example the struct declaration
+
+ struct foo {
+ int i;
+ long c;
+ } var1;
+
+generates
+
+ S2 foo (
+ M3 I i
+ M4 W c
+ )
+ G5 S2 var1
+
+## Functions ##
+
+A function prototype
+
+ int printf(char *cmd, int flag, void *data);
+
+will generate a type declaration and a variable declaration
+
+ F5 P I P
+ X1 F5 printf
+
+The first line gives the function-type specification 'F' with
+an identifier '5' and subsequently lists the types of the
+function parameters.
+The second line declares the 'printf' function as a publicly
+scoped variable.
+
+Analogously, a statically declared function in file scope
+
+ static int printf(char *cmd, int flag, void *data);
+
+generates
+
+ F5 P I P
+ T1 F5 printf
+
+Thus, the 'printf' variable went into local scope ('T').
+
+A '{' in the first column starts the body of the previously
+declared function:
+
+ int printf(char *cmd, int flag, void *data) {}
+
+generates
+
+ F5 P I P
+ G1 F5 printf
+ {
+ A2 P cmd
+ A3 I flag
+ A4 P data
+ -
+ }
+
+Again, the frontend must ensure that '{' appears only after the
+declaration of a function. The character '-' marks the separation
+between parameters and local variables:
+
+ int printf(register char *cmd, int flag, void *data) {int i;};
+
+generates
+
+ F5 P I P
+ G1 F5 printf
+ {
+ R2 P cmd
+ A3 I flag
+ A4 P data
+ -
+ A6 I i
+ }
+
+### Expressions ###
+
+Expressions are emitted in reverse polish notation, simplifying
+parsing and converting into a tree representation.
+
+#### Operators ####
+
+Operators allowed in expressions are:
+
+* \+ -- addition
+* \- -- substraction
+* \* -- multiplication
+* % -- modulo
+* / -- division
+* l -- left shift
+* r -- right shift
+* < -- less than
+* > -- greather than
+* ] -- greather or equal than
+* [ -- less or equal than
+* = -- equal than
+* ! -- different than
+* & -- bitwise and
+* | -- bitwise or
+* ^ -- bitwise xor
+* ~ -- bitwise complement
+* : -- asignation
+* _ -- unary negation
+* c -- function call
+* p -- parameter
+* . -- field
+* , -- comma operator
+* ? -- ternary operator
+* ' -- take address
+* a -- logical shortcut and
+* o -- logical shortcut or
+* @ -- content of pointer
+
+Assignation has some suboperators:
+
+* :/ -- divide and assign
+* :% -- modulo and assign
+* :+ -- addition and assign
+* :- -- substraction and assign
+* :l -- left shift and assign
+* :r -- right shift and assign
+* :& -- bitwise and and assign
+* :^ -- bitwise xor and assign
+* :| -- bitwise or and assign
+* :i -- post increment
+* :d -- post decrement
+
+Every operator in an expression has a type descriptor.
+
+#### Constants ####
+
+Constants are introduced with the character '#'. For instance, 10 is
+translated to #IA (all constants are emitted in hexadecimal),
+where I indicates that it is an integer constant.
+Strings are a special case because they are represented with
+the " character.
+The constant "hello" is emitted as "68656C6C6F. For example
+
+ int
+ main(void)
+ {
+ int i, j;
+
+ i = j+2*3;
+ }
+
+generates
+
+ F1
+ G1 F1 main
+ {
+ -
+ A2 I i
+ A3 I j
+ A2 A3 #I6 +I :I
+ }
+
+Type casts are expressed with a tuple denoting the
+type conversion
+
+ int
+ main(void)
+ {
+ int i;
+ long j;
+
+ j = (long)i;
+ }
+
+generates
+
+ F1
+ G1 F1 main
+ {
+ -
+ A2 I i
+ A3 W j
+ A2 A3 WI :I
+ }
+
+### Statements ###
+#### Jumps #####
+
+Jumps have the following form:
+
+ j L# [expression]
+
+the optional expression field indicates some condition which
+must be satisfied to jump. Example:
+
+ int
+ main(void)
+ {
+ int i;
+
+ goto label;
+ label:
+ i -= i;
+ }
+
+generates
+
+ F1
+ G1 F1 main
+ {
+ -
+ A2 I i
+ j L3
+ L3
+ A2 A2 :-I
+ }
+
+Another form of jump is the return statement, which uses the
+letter 'y' followed by a type identifier.
+Depending on the type, an optional expression follows.
+
+ int
+ main(void)
+ {
+ return 16;
+ }
+
+generates
+
+ F1
+ G1 F1 main
+ {
+ -
+ yI #I10
+ }
+
+
+#### Loops ####
+
+There are two special characters that are used to indicate
+to the backend that the following statements are part of
+a loop body.
+
+* b -- beginning of loop
+* e -- end of loop
+
+#### Switch statement ####
+
+Switches are represented using a table, in which the labels
+where to jump for each case are indicated. Common cases are
+represented with 'v' and default with 'f'.
+The switch statement itself is represented with 's' followed
+by the label where the jump table is located, and the
+expression of the switch:
+
+ int
+ func(int n)
+ {
+ switch (n+1) {
+ case 1:
+ case 2:
+ case 3:
+ default:
+ ++n;
+ }
+ }
+
+generates
+
+ F2 I
+ G1 F2 func
+ {
+ A1 I n
+ -
+ s L4 A1 #I1 +I
+ L5
+ L6
+ L7
+ L8
+ A1 #I1 :+I
+ j L3
+ L4
+ t #4
+ v L7 #I3
+ v L6 #I2
+ v L5 #I1
+ f L8
+ L3
+ }
+
+The beginning of the jump table is indicated by the the letter 't',
+followed by the number of cases (including default case) of the
+switch.
+
+## Resumen ##
+
+* C -- signed 8-Bit integer
+* I -- signed 16-Bit integer
+* W -- signed 32-Bit integer
+* O -- signed 64-Bit integer
+* M -- unsigned 8-Bit integer
+* N -- unsigned 16-Bit integer
+* Z -- unsigned 32-Bit integer
+* Q -- unsigned 64-Bit integer
+* 0 -- void
+* P -- pointer
+* F -- function
+* V -- vector
+* U -- union
+* S -- struct
+* B -- bool
+* J -- float
+* D -- double
+* H -- long double
+* A -- automatic
+* R -- register
+* G -- public (global variable declared in the module)
+* X -- extern (global variable declared in another module)
+* Y -- private (variable in file-scope)
+* T -- local (static variable in function-scope)
+* M -- member (struct/union member)
+* L -- label
+* { -- beginning of function body
+* } -- end of function body
+* \\ -- end of function parameters
+* \+ -- addition
+* \- -- substraction
+* \* -- multiplication
+* % -- modulo
+* / -- division
+* l -- left shift
+* r -- right shift
+* < -- less than
+* > -- greather than
+* ] -- greather or equal than
+* [ -- less or equal than
+* = -- equal than
+* ! -- different than
+* & -- bitwise and
+* | -- bitwise or
+* ^ -- bitwise xor
+* ~ -- bitwise complement
+* : -- asignation
+* _ -- unary negation
+* c -- function call
+* p -- parameter
+* . -- field
+* , -- comma operator
+* ? -- ternary operator
+* ' -- take address
+* a -- logical shortcut and
+* o -- logical shortcut or
+* @ -- content of pointer
+* :/ -- divide and assign
+* :% -- modulo and assign
+* :+ -- addition and assign
+* :- -- substraction and assign
+* :l -- left shift and assign
+* :r -- right shift and assign
+* :& -- bitwise and and assign
+* :^ -- bitwise xor and assign
+* :| -- bitwise or and assign
+* ;+ -- post increment
+* ;- -- post decrement
+* j -- jump
+* y -- return
+* b -- begin of loop
+* d -- end of loop
+* s -- switch statement
+* t -- switch table
+* v -- case entry in switch table
+* f -- default entry in switch table
--- /dev/null
+++ b/src/cc1/lex.c
@@ -1,0 +1,801 @@
+static char sccsid[] = "@(#) ./cc1/lex.c";
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+int yytoken;
+struct yystype yylval;
+char yytext[STRINGSIZ+3];
+unsigned short yylen;
+int lexmode = CCMODE;
+unsigned lineno;
+char filenam[FILENAME_MAX];
+
+int namespace = NS_IDEN;
+static int safe;
+Input *input;
+
+void
+ilex(void)
+{
+ static struct keyword keys[] = {
+ {"auto", SCLASS, AUTO},
+ {"break", BREAK, BREAK},
+ {"_Bool", TYPE, BOOL},
+ {"__builtin_va_list", TYPE, VA_LIST},
+ {"case", CASE, CASE},
+ {"char", TYPE, CHAR},
+ {"const", TQUALIFIER, CONST},
+ {"continue", CONTINUE, CONTINUE},
+ {"default", DEFAULT, DEFAULT},
+ {"do", DO, DO},
+ {"double", TYPE, DOUBLE},
+ {"else", ELSE, ELSE},
+ {"enum", TYPE, ENUM},
+ {"extern", SCLASS, EXTERN},
+ {"float", TYPE, FLOAT},
+ {"for", FOR, FOR},
+ {"goto", GOTO, GOTO},
+ {"if", IF, IF},
+ {"inline", TQUALIFIER, INLINE},
+ {"int", TYPE, INT},
+ {"long", TYPE, LONG},
+ {"register", SCLASS, REGISTER},
+ {"restrict", TQUALIFIER, RESTRICT},
+ {"return", RETURN, RETURN},
+ {"short", TYPE, SHORT},
+ {"signed", TYPE, SIGNED},
+ {"sizeof", SIZEOF, SIZEOF},
+ {"static", SCLASS, STATIC},
+ {"struct", TYPE, STRUCT},
+ {"switch", SWITCH, SWITCH},
+ {"typedef", SCLASS, TYPEDEF},
+ {"union", TYPE, UNION},
+ {"unsigned", TYPE, UNSIGNED},
+ {"void", TYPE, VOID},
+ {"volatile", TQUALIFIER, VOLATILE},
+ {"while", WHILE, WHILE},
+ {NULL, 0, 0},
+ };
+ keywords(keys, NS_KEYWORD);
+}
+
+void
+setloc(char *fname, unsigned line)
+{
+ size_t len;
+
+ if ((len = strlen(fname)) >= FILENAME_MAX)
+ die("cc1: %s: file name too long", fname);
+ memmove(filenam, fname, len);
+ filenam[len] = '\0';
+
+ free(input->filenam);
+ input->filenam = xstrdup(fname);
+ lineno = input->lineno = line;
+}
+
+void
+addinput(char *fname, Symbol *hide, char *buffer)
+{
+ FILE *fp;
+ char *extp;
+ unsigned flags;
+ int infileln;
+ Input *newip, *curip = input;
+
+ if (hide) {
+ /* this is a macro expansion */
+ fp = NULL;
+ if (hide->hide == UCHAR_MAX)
+ die("cc1: too many macro expansions");
+ ++hide->hide;
+ flags = IMACRO;
+ } else if (fname) {
+ /* a new file */
+ if ((fp = fopen(fname, "r")) == NULL)
+ die("cc1: %s: %s", fname, strerror(errno));
+ flags = IFILE;
+ if (curip && onlyheader) {
+ infileln = strlen(infile);
+ if (extp = strrchr(infile, '.'))
+ infileln -= strlen(extp);
+ printf("%.*s.o: %s %s\n",
+ infileln, infile, infile, fname);
+ }
+ } else {
+ /* reading from stdin */
+ fp = stdin;
+ fname = "<stdin>";
+ flags = ISTDIN;
+ }
+
+ newip = xmalloc(sizeof(*newip));
+
+ if (!buffer) {
+ buffer = xmalloc(INPUTSIZ);
+ buffer[0] = '\0';
+ }
+
+ if (curip)
+ curip->lineno = lineno;
+
+ newip->p = newip->begin = newip->line = buffer;
+ newip->filenam = NULL;
+ newip->lineno = 0;
+ newip->next = curip;
+ newip->fp = fp;
+ newip->hide = hide;
+ newip->flags = flags;
+ input = newip;
+
+ setloc(fname, (curip) ? curip->lineno : newip->lineno);
+}
+
+void
+delinput(void)
+{
+ Input *ip = input;
+ Symbol *hide = ip->hide;
+
+ switch (ip->flags & ITYPE) {
+ case IFILE:
+ if (fclose(ip->fp))
+ die("cc1: %s: %s", ip->filenam, strerror(errno));
+ break;
+ case IMACRO:
+ assert(hide->hide == 1);
+ --hide->hide;
+ break;
+ }
+ input = ip->next;
+ free(ip->filenam);
+ free(ip->line);
+ if (input) {
+ lineno = input->lineno;
+ strcpy(filenam, input->filenam);
+ }
+}
+
+static void
+newline(void)
+{
+ if (++lineno == 0)
+ die("cc1: %s: file too long", filenam);
+}
+
+/*
+ * Read the next character from the input file, counting number of lines
+ * and joining lines escaped with \
+ */
+static int
+readchar(void)
+{
+ FILE *fp = input->fp;
+ int c;
+
+repeat:
+ switch (c = getc(fp)) {
+ case '\\':
+ if ((c = getc(fp)) == '\n') {
+ newline();
+ goto repeat;
+ }
+ ungetc(c, fp);
+ c = '\\';
+ break;
+ case '\n':
+ newline();
+ break;
+ default:
+ if (!isprint(c) && !ispunct(c) && !isspace(c))
+ warn("invalid input character. The shame of UB is yours");
+ break;
+ }
+
+ return c;
+}
+
+/*
+ * discard a C comment. This function is only called from readline
+ * because it is impossible to have a comment in a macro, because
+ * comments are always discarded before processing any cpp directive
+ */
+static void
+comment(int type)
+{
+ int c;
+
+repeat:
+ while ((c = readchar()) != EOF && c != type)
+ ;
+
+ if (c == EOF) {
+ errorp("unterminated comment");
+ return;
+ }
+
+ if (type == '*' && (c = readchar()) != '/')
+ goto repeat;
+}
+
+/*
+ * readline is used to read a full logic line from a file.
+ * It discards comments and check that the line fits in
+ * the input buffer
+ */
+static int
+readline(void)
+{
+ char *bp, *lim;
+ int c, peekc = 0;
+
+ if (feof(input->fp)) {
+ input->flags |= IEOF;
+ return 0;
+ }
+
+ *input->line = '\0';
+ lim = &input->line[INPUTSIZ-1];
+ for (bp = input->line; bp < lim-1; *bp++ = c) {
+ c = (peekc) ? peekc : readchar();
+ peekc = 0;
+ if (c == '\n' || c == EOF)
+ break;
+ if (c != '/')
+ continue;
+
+ /* check for /* or // */
+ peekc = readchar();
+ if (peekc != '*' && peekc != '/')
+ continue;
+ comment((peekc == '/') ? '\n' : '*');
+ peekc = 0;
+ c = ' ';
+ }
+
+ input->begin = input->p = input->line;
+ if (bp == lim-1) {
+ errorp("line too long");
+ --bp;
+ }
+ *bp++ = '\n';
+ *bp = '\0';
+
+ return 1;
+}
+
+/*
+ * moreinput gets more bytes to be passed to the lexer.
+ * It can take more bytes from macro expansions or
+ * directly reading from files. When a cpp directive
+ * is processed the line is discarded because it must not
+ * be passed to the lexer
+ */
+static int
+moreinput(void)
+{
+ int wasexpand = 0;
+
+repeat:
+ if (!input)
+ return 0;
+
+ if (*input->p == '\0') {
+ if ((input->flags&ITYPE) == IMACRO) {
+ wasexpand = 1;
+ input->flags |= IEOF;
+ }
+ if (input->flags & IEOF) {
+ delinput();
+ goto repeat;
+ }
+ if (!readline() || cpp()) {
+ *input->p = '\0';
+ goto repeat;
+ }
+ }
+
+ if (onlycpp && !wasexpand)
+ ppragmaln();
+ return 1;
+}
+
+static void
+tok2str(void)
+{
+ if ((yylen = input->p - input->begin) > INTIDENTSIZ)
+ error("token too big");
+ memcpy(yytext, input->begin, yylen);
+ yytext[yylen] = '\0';
+ input->begin = input->p;
+}
+
+static Symbol *
+readint(char *s, int base, int sign, Symbol *sym)
+{
+ Type *tp = sym->type;
+ struct limits *lim;
+ TUINT u, val, max;
+ int c;
+
+ lim = getlimits(tp);
+ max = lim->max.i;
+ if (*s == '0')
+ ++s;
+ if (toupper(*s) == 'X')
+ ++s;
+
+ for (u = 0; isxdigit(c = *s++); u = u*base + val) {
+ static char letters[] = "0123456789ABCDEF";
+ val = strchr(letters, toupper(c)) - letters;
+ repeat:
+ if (u <= max/base && u*base <= max - val)
+ continue;
+ if (tp->prop & TSIGNED) {
+ if (tp == inttype)
+ tp = (base==10) ? longtype : uinttype;
+ else if (tp == longtype)
+ tp = (base==10) ? llongtype : ulongtype;
+ else
+ goto overflow;
+ } else {
+ if (tp == uinttype)
+ tp = (sign==UNSIGNED) ? ulongtype : longtype;
+ else if (tp == ulongtype)
+ tp = (sign==UNSIGNED) ? ullongtype : llongtype;
+ else
+ goto overflow;
+ }
+ sym->type = tp;
+ lim = getlimits(tp);
+ max = lim->max.i;
+ goto repeat;
+ }
+
+ if (tp->prop & TSIGNED)
+ sym->u.i = u;
+ else
+ sym->u.u = u;
+
+ return sym;
+
+overflow:
+ errorp("overflow in integer constant");
+ return sym;
+}
+
+static int
+integer(char *s, int base)
+{
+ Type *tp;
+ Symbol *sym;
+ unsigned size, sign;
+
+ for (size = sign = 0; ; ++input->p) {
+ switch (toupper(*input->p)) {
+ case 'L':
+ if (size == LLONG)
+ goto wrong_type;
+ size = (size == LONG) ? LLONG : LONG;
+ continue;
+ case 'U':
+ if (sign == UNSIGNED)
+ goto wrong_type;
+ sign = UNSIGNED;
+ continue;
+ default:
+ goto convert;
+ wrong_type:
+ error("invalid suffix in integer constant");
+ }
+ }
+
+convert:
+ tp = ctype(INT, sign, size);
+ sym = newsym(NS_IDEN, NULL);
+ sym->type = tp;
+ sym->flags |= SCONSTANT;
+ yylval.sym = readint(s, base, sign, sym);
+ return CONSTANT;
+}
+
+static char *
+digits(int base)
+{
+ char *p;
+ int c;
+
+ for (p = input->p; c = *p; ++p) {
+ switch (base) {
+ case 8:
+ if (!strchr("01234567", c))
+ goto end;
+ break;
+ case 10:
+ if (!isdigit(c))
+ goto end;
+ break;
+ case 16:
+ if (!isxdigit(c))
+ goto end;
+ break;
+ }
+ }
+end:
+ input->p = p;
+ tok2str();
+ return yytext;
+}
+
+static int
+number(void)
+{
+ int base;
+
+ if (*input->p != '0') {
+ base = 10;
+ } else {
+ if (toupper(*++input->p) == 'X') {
+ ++input->p;
+ base = 16;
+ } else {
+ base = 8;
+ }
+ }
+
+ return integer(digits(base), base);
+}
+
+static int
+escape(void)
+{
+ int c, base;
+
+ switch (*++input->p) {
+ case 'a': return '\a';
+ case 'f': return '\f';
+ case 'n': return '\n';
+ case 'r': return '\r';
+ case 't': return '\t';
+ case 'v': return '\v';
+ case '"': return '"';
+ case '\'': return '\'';
+ case '\\': return '\\';
+ case '\?': return '\?';
+ case 'u':
+ /*
+ * FIXME: universal constants are not correctly handled
+ */
+ if (!isdigit(*++input->p))
+ warn("incorrect digit for numerical character constant");
+ base = 10;
+ break;
+ case 'x':
+ if (!isxdigit(*++input->p))
+ warn("\\x used with no following hex digits");
+ base = 16;
+ break;
+ case '0':
+ if (!strchr("01234567", *++input->p))
+ warn("\\0 used with no following octal digits");
+ base = 8;
+ break;
+ default:
+ warn("unknown escape sequence");
+ return ' ';
+ }
+ errno = 0;
+ c = strtoul(input->p, &input->p, base);
+ if (errno || c > 255)
+ warn("character constant out of range");
+ --input->p;
+ return c;
+}
+
+static int
+character(void)
+{
+ int c;
+ Symbol *sym;
+
+ if ((c = *++input->p) == '\\')
+ c = escape();
+ else
+ c = *input->p;
+ ++input->p;
+ if (*input->p != '\'')
+ errorp("invalid character constant");
+ else
+ ++input->p;
+
+ sym = newsym(NS_IDEN, NULL);
+ sym->u.i = c;
+ sym->type = inttype;
+ yylval.sym = sym;
+ tok2str();
+ return CONSTANT;
+}
+
+static int
+string(void)
+{
+ char *bp = yytext;
+ int c;
+
+ *bp++ = '"';
+ for (++input->p; (c = *input->p) != '"'; ++input->p) {
+ if (c == '\0') {
+ errorp("missing terminating '\"' character");
+ break;
+ }
+ if (c == '\\')
+ c = escape();
+ if (bp == &yytext[STRINGSIZ+1]) {
+ /* TODO: proper error handling here */
+ error("string too long");
+ }
+ *bp++ = c;
+ }
+
+ input->begin = ++input->p;
+ *bp = '\0';
+
+ yylen = bp - yytext + 1;
+ yylval.sym = newstring(yytext+1, yylen-1);
+ *bp++ = '"';
+ *bp = '\0';
+ return STRING;
+}
+
+static int
+iden(void)
+{
+ Symbol *sym;
+ char *p, *begin;
+
+ begin = input->p;
+ for (p = begin; isalnum(*p) || *p == '_'; ++p)
+ ;
+ input->p = p;
+ tok2str();
+ if ((sym = lookup(NS_CPP, yytext, NOALLOC)) != NULL) {
+ if (!disexpand && !sym->hide && expand(begin, sym))
+ return next();
+ }
+ sym = lookup(namespace, yytext, ALLOC);
+ yylval.sym = sym;
+ if (sym->flags & SCONSTANT)
+ return CONSTANT;
+ if (sym->token != IDEN)
+ yylval.token = sym->u.token;
+ return sym->token;
+}
+
+static int
+follow(int expect, int ifyes, int ifno)
+{
+ if (*input->p++ == expect)
+ return ifyes;
+ --input->p;
+ return ifno;
+}
+
+static int
+minus(void)
+{
+ switch (*input->p++) {
+ case '-': return DEC;
+ case '>': return INDIR;
+ case '=': return SUB_EQ;
+ default: --input->p; return '-';
+ }
+}
+
+static int
+plus(void)
+{
+ switch (*input->p++) {
+ case '+': return INC;
+ case '=': return ADD_EQ;
+ default: --input->p; return '+';
+ }
+}
+
+static int
+relational(int op, int equal, int shift, int assig)
+{
+ int c;
+
+ if ((c = *input->p++) == '=')
+ return equal;
+ if (c == op)
+ return follow('=', assig, shift);
+ --input->p;
+ return op;
+}
+
+static int
+logic(int op, int equal, int logic)
+{
+ int c;
+
+ if ((c = *input->p++) == '=')
+ return equal;
+ if (c == op)
+ return logic;
+ --input->p;
+ return op;
+}
+
+static int
+dot(void)
+{
+ int c;
+
+ if ((c = *input->p) != '.')
+ return '.';
+ if ((c = *++input->p) != '.')
+ error("incorrect token '..'");
+ ++input->p;
+ return ELLIPSIS;
+}
+
+static int
+operator(void)
+{
+ int t;
+
+ switch (t = *input->p++) {
+ case '<': t = relational('<', LE, SHL, SHL_EQ); break;
+ case '>': t = relational('>', GE, SHR, SHR_EQ); break;
+ case '&': t = logic('&', AND_EQ, AND); break;
+ case '|': t = logic('|', OR_EQ, OR); break;
+ case '=': t = follow('=', EQ, '='); break;
+ case '^': t = follow('=', XOR_EQ, '^'); break;
+ case '*': t = follow('=', MUL_EQ, '*'); break;
+ case '/': t = follow('=', DIV_EQ, '/'); break;
+ case '!': t = follow('=', NE, '!'); break;
+ case '#': t = follow('#', '$', '#'); break;
+ case '-': t = minus(); break;
+ case '+': t = plus(); break;
+ case '.': t = dot(); break;
+ }
+ tok2str();
+ return t;
+}
+
+/* TODO: Ensure that namespace is NS_IDEN after a recovery */
+
+/*
+ * skip all the spaces until the next token. When we are in
+ * CPPMODE \n is not considered a whitespace
+ */
+static int
+skipspaces(void)
+{
+ int c;
+
+ for (;;) {
+ switch (c = *input->p) {
+ case '\n':
+ if (lexmode == CPPMODE)
+ goto return_byte;
+ ++input->p;
+ case '\0':
+ if (!moreinput())
+ return EOF;
+ break;
+ case ' ':
+ case '\t':
+ case '\v':
+ case '\r':
+ case '\f':
+ ++input->p;
+ break;
+ default:
+ goto return_byte;
+ }
+ }
+
+return_byte:
+ input->begin = input->p;
+ return c;
+}
+
+int
+next(void)
+{
+ int c;
+
+ if ((c = skipspaces()) == EOF)
+ yytoken = EOFTOK;
+ else if (isalpha(c) || c == '_')
+ yytoken = iden();
+ else if (isdigit(c))
+ yytoken = number();
+ else if (c == '"')
+ yytoken = string();
+ else if (c == '\'')
+ yytoken = character();
+ else
+ yytoken = operator();
+
+ if (yytoken == EOF) {
+ strcpy(yytext, "<EOF>");
+ if (cppctx)
+ errorp("#endif expected");
+ }
+
+ DBG("TOKEN %s", yytext);
+ return yytoken;
+}
+
+void
+expect(int tok)
+{
+ if (yytoken != tok) {
+ if (isgraph(tok))
+ errorp("expected '%c' before '%s'", tok, yytext);
+ else
+ errorp("unexpected '%s'", yytext);
+ } else {
+ next();
+ }
+}
+
+int
+ahead(void)
+{
+ skipspaces();
+ return *input->begin;
+}
+
+void
+setsafe(int type)
+{
+ safe = type;
+}
+
+void
+discard(void)
+{
+ extern jmp_buf recover;
+ int c;
+
+ input->begin = input->p;
+ for (c = yytoken; ; c = *input->begin++) {
+ switch (safe) {
+ case END_COMP:
+ if (c == '}')
+ goto jump;
+ goto semicolon;
+ case END_COND:
+ if (c == ')')
+ goto jump;
+ break;
+ case END_LDECL:
+ if (c == ',')
+ goto jump;
+ case END_DECL:
+ semicolon:
+ if (c == ';')
+ goto jump;
+ break;
+ }
+ if (c == '\0' && !moreinput())
+ exit(1);
+ }
+jump:
+ yytoken = c;
+ longjmp(recover, 1);
+}
--- /dev/null
+++ b/src/cc1/main.c
@@ -1,0 +1,102 @@
+static char sccsid[] = "@(#) ./cc1/main.c";
+#include <setjmp.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+#include <scc/arg.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+char *argv0, *infile;
+
+int warnings;
+jmp_buf recover;
+
+static struct items uflags;
+int onlycpp, onlyheader;
+
+
+extern int failure;
+
+static void
+defmacro(char *macro)
+{
+ char *p = strchr(macro, '=');
+
+ if (p)
+ *p++ = '\0';
+ else
+ p = "1";
+
+ defdefine(macro, p, "command-line");
+}
+
+static void
+usage(void)
+{
+ fputs("usage: cc1 [-Ewd] [-D def[=val]]... [-U def]... "
+ "[-I dir]... [-o output] [input]\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+
+ ilex();
+ icpp();
+ icode();
+ ibuilts();
+
+ ARGBEGIN {
+ case 'D':
+ defmacro(EARGF(usage()));
+ break;
+ case 'M':
+ onlyheader = 1;
+ break;
+ case 'E':
+ onlycpp = 1;
+ break;
+ case 'I':
+ incdir(EARGF(usage()));
+ break;
+ case 'U':
+ newitem(&uflags, EARGF(usage()));
+ break;
+ case 'd':
+ DBGON();
+ break;
+ case 'w':
+ warnings = 1;
+ break;
+ default:
+ usage();
+ } ARGEND
+
+ if (argc > 1)
+ usage();
+
+ for (i = 0; i < uflags.n; ++i)
+ undefmacro(uflags.s[i]);
+
+ infile = (*argv) ? *argv : "<stdin>";
+ addinput(*argv, NULL, NULL);
+
+ /*
+ * we cannot initialize arch until we have an
+ * output stream, because we maybe want to emit new types
+ */
+ iarch();
+ if (onlycpp || onlyheader) {
+ outcpp();
+ } else {
+ for (next(); yytoken != EOFTOK; decl())
+ ;
+ }
+
+ return failure;
+}
--- /dev/null
+++ b/src/cc1/stmt.c
@@ -1,0 +1,386 @@
+static char sccsid[] = "@(#) ./cc1/stmt.c";
+#include <stddef.h>
+#include <setjmp.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define NEGATE 1
+#define NONEGATE 0
+
+Symbol *curfun;
+
+static void stmt(Symbol *lbreak, Symbol *lcont, Switch *lswitch);
+
+static void
+label(void)
+{
+ Symbol *sym;
+
+ switch (yytoken) {
+ case IDEN:
+ case TYPEIDEN:
+ sym = lookup(NS_LABEL, yytext, ALLOC);
+ if (sym->flags & SDEFINED)
+ error("label '%s' already defined", yytext);
+ if ((sym->flags & SDECLARED) == 0)
+ sym = install(NS_LABEL, sym);
+ sym->flags |= SDEFINED;
+ emit(OLABEL, sym);
+ next();
+ expect(':');
+ break;
+ default:
+ unexpected();
+ }
+}
+
+static void
+stmtexp(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Node *np;
+
+ if (accept(';'))
+ return;
+ if (yytoken == IDEN && ahead() == ':') {
+ label();
+ stmt(lbreak, lcont, lswitch);
+ return;
+ }
+ np = expr();
+ if ((np->flags & NEFFECT) == 0)
+ warn("expression without side effects");
+ emit(OEXPR, np);
+ expect(';');
+}
+
+static Node *
+condition(int neg)
+{
+ Node *np;
+
+ expect('(');
+ np = condexpr(neg);
+ expect(')');
+
+ return np;
+}
+
+static void
+While(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Symbol *begin;
+ Node *np;
+
+ begin = newlabel();
+ lcont = newlabel();
+ lbreak = newlabel();
+
+ expect(WHILE);
+ np = condition(NONEGATE);
+
+ emit(OJUMP, lcont);
+
+ emit(OBLOOP, NULL);
+ emit(OLABEL, begin);
+ stmt(lbreak, lcont, lswitch);
+ emit(OLABEL, lcont);
+ emit(OBRANCH, begin);
+ emit(OEXPR, np);
+ emit(OELOOP, NULL);
+
+ emit(OLABEL, lbreak);
+}
+
+static void
+For(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Symbol *begin, *cond;
+ Node *econd, *einc;
+
+ begin = newlabel();
+ lcont = newlabel();
+ cond = newlabel();
+ lbreak = newlabel();
+
+ pushctx();
+
+ expect(FOR);
+ expect('(');
+ switch (yytoken) {
+ case TYPE:
+ case TYPEIDEN:
+ case TQUALIFIER:
+ case SCLASS:
+ decl();
+ break;
+ default:
+ emit(OEXPR, expr());
+ case ';':
+ expect(';');
+ break;
+ }
+ econd = (yytoken != ';') ? condexpr(NONEGATE) : NULL;
+ expect(';');
+ einc = (yytoken != ')') ? expr() : NULL;
+ expect(')');
+
+ emit(OJUMP, cond);
+
+ emit(OBLOOP, NULL);
+ emit(OLABEL, begin);
+ stmt(lbreak, lcont, lswitch);
+ emit(OLABEL, lcont);
+ emit(OEXPR, einc);
+ emit(OLABEL, cond);
+ emit((econd) ? OBRANCH : OJUMP, begin);
+ emit(OEXPR, econd);
+ emit(OELOOP, NULL);
+
+ emit(OLABEL, lbreak);
+
+ popctx();
+}
+
+static void
+Dowhile(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Symbol *begin;
+ Node *np;
+
+ begin = newlabel();
+ lcont = newlabel();
+ lbreak = newlabel();
+
+ expect(DO);
+
+ emit(OBLOOP, NULL);
+ emit(OLABEL, begin);
+ stmt(lbreak, lcont, lswitch);
+ expect(WHILE);
+ np = condition(NONEGATE);
+ emit(OLABEL, lcont);
+ emit(OBRANCH, begin);
+ emit(OEXPR, np);
+ emit(OELOOP, NULL);
+
+ emit(OLABEL, lbreak);
+}
+
+static void
+Return(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Node *np;
+ Type *tp = curfun->type->type;
+
+ expect(RETURN);
+ np = (yytoken != ';') ? decay(expr()) : NULL;
+ expect(';');
+ if (!np) {
+ if (tp != voidtype)
+ warn("function returning non void returns no value");
+ tp = voidtype;
+ } else if (np->type != tp) {
+ if (tp == voidtype)
+ warn("function returning void returns a value");
+ else if ((np = convert(np, tp, 0)) == NULL)
+ errorp("incorrect type in return");
+ }
+ emit(ORET, NULL);
+ emit(OEXPR, np);
+}
+
+static void
+Break(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ expect(BREAK);
+ if (!lbreak) {
+ errorp("break statement not within loop or switch");
+ } else {
+ emit(OJUMP, lbreak);
+ expect(';');
+ }
+}
+
+static void
+Continue(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ expect(CONTINUE);
+ if (!lcont) {
+ errorp("continue statement not within loop");
+ } else {
+ emit(OJUMP, lcont);
+ expect(';');
+ }
+}
+
+static void
+Goto(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Symbol *sym;
+
+ namespace = NS_LABEL;
+ next();
+ namespace = NS_IDEN;
+
+ if (yytoken != IDEN)
+ unexpected();
+ sym = yylval.sym;
+ if ((sym->flags & SDECLARED) == 0)
+ sym = install(NS_LABEL, sym);
+ sym->flags |= SUSED;
+ emit(OJUMP, sym);
+ next();
+ expect(';');
+}
+
+static void
+Swtch(Symbol *obr, Symbol *lcont, Switch *osw)
+{
+ Switch sw = {0};
+ Node *cond;
+ Symbol *lbreak;
+
+ expect(SWITCH);
+
+ expect ('(');
+ if ((cond = convert(expr(), inttype, 0)) == NULL) {
+ errorp("incorrect type in switch statement");
+ cond = constnode(zero);
+ }
+ expect (')');
+
+ lbreak = newlabel();
+ emit(OBSWITCH, NULL);
+ emit(OEXPR, cond);
+ stmt(lbreak, lcont, &sw);
+ emit(OESWITCH, lbreak);
+ emit(OLABEL, lbreak);
+}
+
+static void
+Case(Symbol *lbreak, Symbol *lcont, Switch *sw)
+{
+ Node *np;
+ Symbol *label;
+
+ expect(CASE);
+ if ((np = constexpr()) == NULL)
+ errorp("case label does not reduce to an integer constant");
+ if (!sw) {
+ errorp("case label not within a switch statement");
+ } else if (sw->nr >= 0 && ++sw->nr == NR_SWITCH) {
+ errorp("too many case labels for a switch statement");
+ sw->nr = -1;
+ }
+ expect(':');
+
+ label = newlabel();
+ emit(OCASE, label);
+ emit(OEXPR, np);
+ emit(OLABEL, label);
+ stmt(lbreak, lcont, sw);
+}
+
+static void
+Default(Symbol *lbreak, Symbol *lcont, Switch *sw)
+{
+ Symbol *label = newlabel();
+
+ if (sw->hasdef)
+ errorp("multiple default labels in one switch");
+ sw->hasdef = 1;
+ expect(DEFAULT);
+ expect(':');
+ emit(ODEFAULT, label);
+ emit(OLABEL, label);
+ stmt(lbreak, lcont, sw);
+}
+
+static void
+If(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ Symbol *end, *lelse;
+ Node *np;
+
+ lelse = newlabel();
+ expect(IF);
+ np = condition(NEGATE);
+ emit(OBRANCH, lelse);
+ emit(OEXPR, np);
+ stmt(lbreak, lcont, lswitch);
+ if (accept(ELSE)) {
+ end = newlabel();
+ emit(OJUMP, end);
+ emit(OLABEL, lelse);
+ stmt(lbreak, lcont, lswitch);
+ emit(OLABEL, end);
+ } else {
+ emit(OLABEL, lelse);
+ }
+}
+
+static void
+blockit(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ switch (yytoken) {
+ case TYPEIDEN:
+ if (ahead() == ':')
+ goto parse_stmt;
+ case TYPE:
+ case TQUALIFIER:
+ case SCLASS:
+ decl();
+ return;
+ default:
+ parse_stmt:
+ stmt(lbreak, lcont, lswitch);
+ }
+}
+
+void
+compound(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ static int nested;
+
+ pushctx();
+ expect('{');
+
+ if (nested == NR_BLOCK)
+ error("too many nesting levels of compound statements");
+
+ ++nested;
+ for (;;) {
+ if (yytoken == '}')
+ break;
+ blockit(lbreak, lcont, lswitch);
+ }
+ --nested;
+
+ popctx();
+ expect('}');
+}
+
+static void
+stmt(Symbol *lbreak, Symbol *lcont, Switch *lswitch)
+{
+ void (*fun)(Symbol *, Symbol *, Switch *);
+
+ switch (yytoken) {
+ case '{': fun = compound; break;
+ case RETURN: fun = Return; break;
+ case WHILE: fun = While; break;
+ case FOR: fun = For; break;
+ case DO: fun = Dowhile; break;
+ case IF: fun = If; break;
+ case BREAK: fun = Break; break;
+ case CONTINUE: fun = Continue; break;
+ case GOTO: fun = Goto; break;
+ case SWITCH: fun = Swtch; break;
+ case CASE: fun = Case; break;
+ case DEFAULT: fun = Default; break;
+ default: fun = stmtexp; break;
+ }
+ (*fun)(lbreak, lcont, lswitch);
+}
--- /dev/null
+++ b/src/cc1/symbol.c
@@ -1,0 +1,353 @@
+static char sccsid[] = "@(#) ./cc1/symbol.c";
+#include <assert.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define NR_SYM_HASH 64
+#define NR_CPP_HASH 32
+#define NR_LBL_HASH 16
+
+unsigned curctx;
+static unsigned short counterid;
+
+static Symbol *head, *labels;
+static Symbol *htab[NR_SYM_HASH];
+static Symbol *htabcpp[NR_CPP_HASH];
+static Symbol *htablbl[NR_LBL_HASH];
+
+#ifndef NDEBUG
+void
+dumpstab(Symbol **tbl, char *msg)
+{
+ Symbol **bp, *sym;
+ unsigned size;
+
+ fprintf(stderr, "Symbol Table dump at ctx=%u\n%s\n", curctx, msg);
+ if (tbl == htab)
+ size = NR_SYM_HASH;
+ else if (tbl == htabcpp)
+ size = NR_CPP_HASH;
+ else if (tbl == htablbl)
+ size = NR_LBL_HASH;
+ else
+ abort();
+
+ for (bp = tbl; bp < &tbl[size]; ++bp) {
+ if (*bp == NULL)
+ continue;
+ fprintf(stderr, "%d", (int) (bp - htab));
+ for (sym = *bp; sym; sym = sym->hash)
+ fprintf(stderr, "->[%d,%d:'%s'=%p]",
+ sym->ns, sym->ctx, sym->name, (void *) sym);
+ putc('\n', stderr);
+ }
+ fputs("head:", stderr);
+ for (sym = head; sym; sym = sym->next) {
+ fprintf(stderr, "->[%d,%d:'%s'=%p]",
+ sym->ns, sym->ctx,
+ (sym->name) ? sym->name : "", (void *) sym);
+ }
+ fputs("\nlabels:", stderr);
+ for (sym = labels; sym; sym = sym->next) {
+ fprintf(stderr, "->[%d,%d:'%s'=%p]",
+ sym->ns, sym->ctx,
+ (sym->name) ? sym->name : "", (void *) sym);
+ }
+ putc('\n', stderr);
+}
+#endif
+
+static Symbol **
+hash(char *s, int ns)
+{
+ unsigned c, h, size;
+ Symbol **tab;
+
+ for (h = 0; c = *s; ++s)
+ h = h*33 ^ c;
+
+ switch (ns) {
+ case NS_CPP:
+ tab = htabcpp;
+ size = NR_CPP_HASH-1;
+ break;
+ case NS_LABEL:
+ tab = htablbl;
+ size = NR_LBL_HASH-1;
+ break;
+ default:
+ tab = htab;
+ size = NR_SYM_HASH-1;
+ break;
+ }
+ return &tab[h & size];
+}
+
+static void
+unlinkhash(Symbol *sym)
+{
+ Symbol **h;
+
+ if ((sym->flags & SDECLARED) == 0)
+ return;
+ h = hash(sym->name, sym->ns);
+ assert(sym->ns == NS_CPP || *h == sym);
+ while (*h != sym)
+ h = &(*h)->hash;
+ *h = sym->hash;
+}
+
+void
+pushctx(void)
+{
+ DBG("SYM: pushed context %d", curctx+1);
+ if (++curctx == NR_BLOCK+1)
+ error("too many nested blocks");
+}
+
+void
+killsym(Symbol *sym)
+{
+ short f;
+ char *name;
+
+ if (!sym)
+ return;
+ f = sym->flags;
+ if (f & SSTRING)
+ free(sym->u.s);
+ if (sym->ns == NS_TAG)
+ sym->type->prop &= ~TDEFINED;
+ unlinkhash(sym);
+ if ((name = sym->name) != NULL) {
+ switch (sym->ns) {
+ case NS_LABEL:
+ if ((f & SDEFINED) == 0)
+ errorp("label '%s' is not defined", name);
+ case NS_IDEN:
+ if ((f & (SUSED|SGLOBAL|SDECLARED)) == SDECLARED)
+ warn("'%s' defined but not used", name);
+ break;
+ }
+ }
+ free(name);
+ free(sym);
+}
+
+void
+popctx(void)
+{
+ Symbol *next, *sym;
+ int ns, dangling = 0;
+
+ DBG("SYM: poped context %d", curctx);
+ /*
+ * we have to be careful before popping the current
+ * context, because since the parser is one token
+ * ahead it may already have read an identifier at
+ * this point, and yylval.sym is a pointer to
+ * the symbol associated to such token. If that
+ * symbol is from the context that we are popping
+ * then we are going to generate a dangling pointer.
+ * We can detect this situation and call again to
+ * lookup.
+ */
+ if ((yytoken == IDEN || yytoken == TYPEIDEN) &&
+ yylval.sym->ctx == curctx) {
+ ns = yylval.sym->ns;
+ dangling = 1;
+ }
+
+ for (sym = head; sym && sym->ctx == curctx; sym = next) {
+ /*
+ * Since we are unlinking them in the inverse order
+ * we do know that sym is always the head of the
+ * collision list
+ */
+ next = sym->next;
+ killsym(sym);
+ }
+ head = sym;
+
+ if (--curctx == GLOBALCTX) {
+ for (sym = labels; sym; sym = next) {
+ next = sym->next;
+ killsym(sym);
+ }
+ labels = NULL;
+ }
+
+ if (dangling) {
+ yylval.sym = lookup(ns, yytext, ALLOC);
+ yytoken = yylval.sym->token;
+ }
+}
+
+unsigned
+newid(void)
+{
+ unsigned short id;
+
+ if (lexmode == CPPMODE)
+ return 0;
+ id = ++counterid;
+ if (id == 0) {
+ die("cc1: overflow in %s identifiers",
+ (curctx) ? "internal" : "external");
+ }
+ return id;
+}
+
+Symbol *
+newsym(int ns, char *name)
+{
+ Symbol *sym;
+
+ sym = xmalloc(sizeof(*sym));
+ if (name)
+ name = xstrdup(name);
+ sym->name = name;
+ sym->id = 0;
+ sym->hide = 0;
+ sym->ns = ns;
+ sym->ctx = curctx;
+ sym->token = IDEN;
+ sym->flags = 0;
+ sym->u.s = NULL;
+ sym->type = NULL;
+ sym->hash = NULL;
+
+ if (ns == NS_LABEL) {
+ sym->next = labels;
+ labels = sym;
+ } else if (ns != NS_CPP) {
+ sym->next = head;
+ head = sym;
+ }
+ return sym;
+}
+
+static Symbol *
+linkhash(Symbol *sym)
+{
+ Symbol **h;
+
+ h = hash(sym->name, sym->ns);
+ sym->hash = *h;
+ *h = sym;
+
+ if (sym->ns != NS_CPP)
+ sym->id = newid();
+ sym->flags |= SDECLARED;
+ return sym;
+}
+
+Symbol *
+newstring(char *s, size_t len)
+{
+ Symbol *sym = newsym(NS_IDEN, NULL);
+
+ if (lexmode != CPPMODE)
+ sym->type = mktype(chartype, ARY, len, NULL);
+ sym->id = newid();
+ sym->flags |= SSTRING | SCONSTANT | SPRIVATE;
+ sym->u.s = xmalloc(len);
+ if (s)
+ memcpy(sym->u.s, s, len);
+
+ return sym;
+}
+
+Symbol *
+newlabel(void)
+{
+ Symbol *sym = newsym(NS_LABEL, NULL);
+ sym->id = newid();
+ return sym;
+}
+
+Symbol *
+lookup(int ns, char *name, int alloc)
+{
+ Symbol *sym;
+ int sns, c;
+ char *t;
+
+ c = *name;
+ for (sym = *hash(name, ns); sym; sym = sym->hash) {
+ t = sym->name;
+ if (*t != c || strcmp(t, name))
+ continue;
+ sns = sym->ns;
+ if (sns == ns)
+ return sym;
+ /*
+ * When a lookup is done in a namespace associated
+ * to a struct we also want symbols of NS_IDEN which
+ * are typedef, because in other case we cannot declare
+ * fields of such types.
+ * TODO: Remove this trick
+ */
+ if (sns == NS_KEYWORD ||
+ (sym->flags & STYPEDEF) && ns >= NS_STRUCTS) {
+ return sym;
+ }
+ }
+ return (alloc == ALLOC) ? newsym(ns, name) : NULL;
+}
+
+Symbol *
+install(int ns, Symbol *sym)
+{
+ if (sym->flags & SDECLARED || sym->ctx != curctx) {
+ if (sym->ctx == curctx && ns == sym->ns)
+ return NULL;
+ sym = newsym(ns, sym->name);
+ }
+ return linkhash(sym);
+}
+
+void
+keywords(struct keyword *key, int ns)
+{
+ Symbol *sym;
+
+ for ( ; key->str; ++key) {
+ sym = linkhash(newsym(ns, key->str));
+ sym->token = key->token;
+ sym->u.token = key->value;
+ }
+ /*
+ * Remove all the predefined symbols from * the symbol list. It
+ * will make faster some operations. There is no problem of memory
+ * leakeage because this memory is not ever freed
+ */
+ counterid = 0;
+ head = NULL;
+}
+
+void
+builtins(struct builtin *built)
+{
+ Symbol *sym;
+ struct builtin *bp;
+
+ for (bp = built; bp->str; ++bp) {
+ sym = linkhash(newsym(NS_KEYWORD, bp->str));
+ sym->token = BUILTIN;
+ sym->u.fun = bp->fun;
+ }
+ /*
+ * Remove all the predefined symbols from * the symbol list. It
+ * will make faster some operations. There is no problem of memory
+ * leakeage because this memory is not ever freed
+ */
+ counterid = 0;
+ head = NULL;
+}
--- /dev/null
+++ b/src/cc1/target/amd64-sysv/arch.c
@@ -1,0 +1,220 @@
+static char sccsid[] = "@(#) ./cc1/arch/amd64-sysv/arch.c";
+
+#include <scc/scc.h>
+#include "../../cc1.h"
+
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 1
+#define RANK_CHAR 1
+#define RANK_SHORT 2
+#define RANK_USHORT 2
+#define RANK_INT 3
+#define RANK_UINT 3
+#define RANK_LONG 4
+#define RANK_ULONG 4
+#define RANK_LLONG 5
+#define RANK_ULLONG 5
+#define RANK_FLOAT 6
+#define RANK_DOUBLE 7
+#define RANK_LDOUBLE 8
+
+/*
+ * Initializaion of type pointers were done with
+ * a C99 initilizator '... = &(Type) {...', but
+ * c compiler in Plan9 gives error with this
+ * syntax, so I have switched it to this ugly form
+ * I hope I will change it again in the future
+ */
+
+static Type types[] = {
+ { /* 0 = voidtype */
+ .op = VOID,
+ .letter = L_VOID,
+ },
+ { /* 1 = pvoidtype */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .type = &types[5], /* chartype */
+ .size = 8,
+ .align = 8,
+ },
+ { /* 2 = booltype */
+ .op = INT,
+ .letter = L_BOOL,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_BOOL,
+ },
+ { /* 3 = schartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_SCHAR,
+ },
+ { /* 4 = uchartype */
+ .op = INT,
+ .letter = L_UINT8,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_UCHAR,
+ },
+ { /* 5 = chartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_CHAR,
+ },
+ { /* 6 = ushortype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_USHORT,
+ },
+ { /* 7 = shortype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_SHORT,
+ },
+ { /* 8 = uinttype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_UINT,
+ },
+ { /* 9 = inttype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_INT,
+ },
+ { /* 10 = longtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LONG,
+ },
+ { /* 11 = ulongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_ULONG,
+ },
+ { /* 12 = ullongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_ULLONG,
+ },
+ { /* 13 = llongtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LLONG,
+ },
+ { /* 14 = floattype */
+ .op = FLOAT,
+ .letter = L_FLOAT,
+ .prop = TDEFINED | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_FLOAT,
+ },
+ { /* 15 = doubletype */
+ .op = FLOAT,
+ .letter = L_DOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_DOUBLE,
+ },
+ { /* 16 = ldoubletype */
+ .op = FLOAT,
+ .letter = L_LDOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 16,
+ .align = 16,
+ .n.rank = RANK_LDOUBLE,
+ },
+ { /* 17 = sizettype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_UINT,
+ },
+ { /* 18 = ellipsis */
+ .op = ELLIPSIS,
+ .letter = L_ELLIPSIS,
+ .prop = TDEFINED,
+ },
+ { /* 19 = pdifftype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LONG,
+ },
+ { /* 20 = va_type */
+ .op = STRUCT,
+ .letter = L_VA_ARG,
+ .prop = TDEFINED,
+ .size = 24,
+ .align = 8,
+ },
+};
+
+Type *voidtype = &types[0], *pvoidtype = &types[1],
+ *booltype = &types[2], *schartype = &types[3],
+ *uchartype = &types[4], *chartype = &types[5],
+ *ushortype = &types[6], *shortype = &types[7],
+ *uinttype = &types[8], *inttype = &types[9],
+ *longtype = &types[10], *ulongtype = &types[11],
+ *ullongtype = &types[12], *llongtype = &types[13],
+ *floattype = &types[14], *doubletype = &types[15],
+ *ldoubletype = &types[16],
+ *sizettype = &types[17], *pdifftype = &types[19],
+ *ellipsistype = &types[18], *va_type = &types[20],
+ *va_list_type;
+
+static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
+ dummy1 = {.u.i = 1, .type = &types[9]};
+Symbol *zero = &dummy0, *one = &dummy1;
+
+void
+iarch(void)
+{
+ va_list_type = mktype(va_type, ARY, 1, NULL);
+}
+
+int
+valid_va_list(Type *tp)
+{
+ return tp->op == PTR && eqtype(tp->type, va_type, 1);
+}
--- /dev/null
+++ b/src/cc1/target/amd64-sysv/arch.mk
@@ -1,0 +1,4 @@
+OBJ-amd64-sysv= $(OBJS) target/amd64-sysv/arch.o
+
+$(LIBEXEC)/cc1-amd64-sysv: $(OBJ-amd64-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-amd64-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc1/target/arm64-sysv/arch.c
@@ -1,0 +1,220 @@
+static char sccsid[] = "@(#) ./cc1/arch/arm64-sysv/arch.c";
+
+#include <scc/scc.h>
+#include "../../cc1.h"
+
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 1
+#define RANK_CHAR 1
+#define RANK_SHORT 2
+#define RANK_USHORT 2
+#define RANK_INT 3
+#define RANK_UINT 3
+#define RANK_LONG 4
+#define RANK_ULONG 4
+#define RANK_LLONG 5
+#define RANK_ULLONG 5
+#define RANK_FLOAT 6
+#define RANK_DOUBLE 7
+#define RANK_LDOUBLE 8
+
+/*
+ * Initializaion of type pointers were done with
+ * a C99 initilizator '... = &(Type) {...', but
+ * c compiler in Plan9 gives error with this
+ * syntax, so I have switched it to this ugly form
+ * I hope I will change it again in the future
+ */
+
+static Type types[] = {
+ { /* 0 = voidtype */
+ .op = VOID,
+ .letter = L_VOID,
+ },
+ { /* 1 = pvoidtype */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .type = &types[5], /* chartype */
+ .size = 8,
+ .align = 8,
+ },
+ { /* 2 = booltype */
+ .op = INT,
+ .letter = L_BOOL,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_BOOL,
+ },
+ { /* 3 = schartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_SCHAR,
+ },
+ { /* 4 = uchartype */
+ .op = INT,
+ .letter = L_UINT8,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_UCHAR,
+ },
+ { /* 5 = chartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_CHAR,
+ },
+ { /* 6 = ushortype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_USHORT,
+ },
+ { /* 7 = shortype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_SHORT,
+ },
+ { /* 8 = uinttype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_UINT,
+ },
+ { /* 9 = inttype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_INT,
+ },
+ { /* 10 = longtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LONG,
+ },
+ { /* 11 = ulongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_ULONG,
+ },
+ { /* 12 = ullongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_ULLONG,
+ },
+ { /* 13 = llongtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LLONG,
+ },
+ { /* 14 = floattype */
+ .op = FLOAT,
+ .letter = L_FLOAT,
+ .prop = TDEFINED | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_FLOAT,
+ },
+ { /* 15 = doubletype */
+ .op = FLOAT,
+ .letter = L_DOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_DOUBLE,
+ },
+ { /* 16 = ldoubletype */
+ .op = FLOAT,
+ .letter = L_LDOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 16,
+ .align = 16,
+ .n.rank = RANK_LDOUBLE,
+ },
+ { /* 17 = sizettype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_UINT,
+ },
+ { /* 18 = ellipsis */
+ .op = ELLIPSIS,
+ .letter = L_ELLIPSIS,
+ .prop = TDEFINED,
+ },
+ { /* 19 = pdifftype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 8,
+ .n.rank = RANK_LONG,
+ },
+ { /* 20 = va_type */
+ .op = STRUCT,
+ .letter = L_VA_ARG,
+ .prop = TDEFINED,
+ .size = 24,
+ .align = 8,
+ },
+};
+
+Type *voidtype = &types[0], *pvoidtype = &types[1],
+ *booltype = &types[2], *schartype = &types[3],
+ *uchartype = &types[4], *chartype = &types[5],
+ *ushortype = &types[6], *shortype = &types[7],
+ *uinttype = &types[8], *inttype = &types[9],
+ *longtype = &types[10], *ulongtype = &types[11],
+ *ullongtype = &types[12], *llongtype = &types[13],
+ *floattype = &types[14], *doubletype = &types[15],
+ *ldoubletype = &types[16],
+ *sizettype = &types[17], *pdifftype = &types[19],
+ *ellipsistype = &types[18], *va_type = &types[20],
+ *va_list_type;
+
+static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
+ dummy1 = {.u.i = 1, .type = &types[9]};
+Symbol *zero = &dummy0, *one = &dummy1;
+
+void
+iarch(void)
+{
+ va_list_type = mktype(va_type, ARY, 1, NULL);
+}
+
+int
+valid_va_list(Type *tp)
+{
+ return tp->op == PTR && eqtype(tp->type, va_type, 1);
+}
--- /dev/null
+++ b/src/cc1/target/arm64-sysv/arch.mk
@@ -1,0 +1,4 @@
+OBJ-arm64-sysv= $(OBJS) target/arm64-sysv/arch.o
+
+$(LIBEXEC)/cc1-arm64-sysv: $(OBJ-arm64-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-arm64-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc1/target/i386-sysv/arch.c
@@ -1,0 +1,221 @@
+static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c";
+
+#include <scc/scc.h>
+#include "../../cc1.h"
+
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 1
+#define RANK_CHAR 1
+#define RANK_SHORT 2
+#define RANK_USHORT 2
+#define RANK_INT 3
+#define RANK_UINT 3
+#define RANK_LONG 4
+#define RANK_ULONG 4
+#define RANK_LLONG 5
+#define RANK_ULLONG 5
+#define RANK_FLOAT 6
+#define RANK_DOUBLE 7
+#define RANK_LDOUBLE 8
+
+/*
+ * Initializaion of type pointers were done with
+ * a C99 initilizator '... = &(Type) {...', but
+ * c compiler in Plan9 gives error with this
+ * syntax, so I have switched it to this ugly form
+ * I hope I will change it again in the future
+ */
+
+static Type types[] = {
+ { /* 0 = voidtype */
+ .op = VOID,
+ .letter = L_VOID,
+ },
+ { /* 1 = pvoidtype */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .type = &types[5], /* chartype */
+ .size = 4,
+ .align = 4,
+ },
+ { /* 2 = booltype */
+ .op = INT,
+ .letter = L_BOOL,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_BOOL,
+ },
+ { /* 3 = schartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_SCHAR,
+ },
+ { /* 4 = uchartype */
+ .op = INT,
+ .letter = L_UINT8,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_UCHAR,
+ },
+ { /* 5 = chartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_CHAR,
+ },
+ { /* 6 = ushortype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_USHORT,
+ },
+ { /* 7 = shortype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 2,
+ .n.rank = RANK_SHORT,
+ },
+ { /* 8 = uinttype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_UINT,
+ },
+ { /* 9 = inttype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_INT,
+ },
+ { /* 10 = longtype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_LONG,
+ },
+ { /* 11 = ulongtype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_ULONG,
+ },
+ { /* 12 = ullongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 4,
+ .n.rank = RANK_ULLONG,
+ },
+ { /* 13 = llongtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 4,
+ .n.rank = RANK_LLONG,
+ },
+ { /* 14 = floattype */
+ .op = FLOAT,
+ .letter = L_FLOAT,
+ .prop = TDEFINED | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_FLOAT,
+ },
+ { /* 15 = doubletype */
+ .op = FLOAT,
+ .letter = L_DOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 8,
+ .align = 4,
+ .n.rank = RANK_DOUBLE,
+ },
+ { /* 16 = ldoubletype */
+ .op = FLOAT,
+ .letter = L_LDOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 12,
+ .align = 4,
+ .n.rank = RANK_LDOUBLE,
+ },
+ { /* 17 = sizettype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_UINT,
+ },
+ { /* 18 = ellipsis */
+ .op = ELLIPSIS,
+ .letter = L_ELLIPSIS,
+ .prop = TDEFINED,
+ },
+ { /* 19 = pdifftype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 4,
+ .n.rank = RANK_INT,
+ },
+ { /* 20 = va_list_type */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .size = 4,
+ .align = 4,
+ },
+};
+
+
+Type *voidtype = &types[0], *pvoidtype = &types[1],
+ *booltype = &types[2], *schartype = &types[3],
+ *uchartype = &types[4], *chartype = &types[5],
+ *ushortype = &types[6], *shortype = &types[7],
+ *uinttype = &types[8], *inttype = &types[9],
+ *longtype = &types[10], *ulongtype = &types[11],
+ *ullongtype = &types[12], *llongtype = &types[13],
+ *floattype = &types[14], *doubletype = &types[15],
+ *ldoubletype = &types[16],
+ *sizettype = &types[17], *pdifftype = &types[19],
+ *ellipsistype = &types[18], *va_list_type = &types[20];
+
+
+
+static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
+ dummy1 = {.u.i = 1, .type = &types[9]};
+Symbol *zero = &dummy0, *one = &dummy1;
+
+void
+iarch(void)
+{
+}
+
+int
+valid_va_list(Type *tp)
+{
+ return eqtype(tp, va_list_type, 1);
+}
--- /dev/null
+++ b/src/cc1/target/i386-sysv/arch.mk
@@ -1,0 +1,4 @@
+OBJ-i386-sysv= $(OBJS) target/i386-sysv/arch.o
+
+$(LIBEXEC)/cc1-i386-sysv: $(OBJ-i386-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-i386-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc1/target/z80-scc/arch.c
@@ -1,0 +1,219 @@
+static char sccsid[] = "@(#) ./cc1/arch/z80/arch.c";
+
+#include <scc/scc.h>
+#include "../../cc1.h"
+
+#define RANK_BOOL 0
+#define RANK_SCHAR 1
+#define RANK_UCHAR 1
+#define RANK_CHAR 1
+#define RANK_SHORT 2
+#define RANK_USHORT 2
+#define RANK_INT 3
+#define RANK_UINT 3
+#define RANK_LONG 4
+#define RANK_ULONG 4
+#define RANK_LLONG 5
+#define RANK_ULLONG 5
+#define RANK_FLOAT 6
+#define RANK_DOUBLE 7
+#define RANK_LDOUBLE 8
+
+/*
+ * Initializaion of type pointers were done with
+ * a C99 initilizator '... = &(Type) {...', but
+ * c compiler in Plan9 gives error with this
+ * syntax, so I have switched it to this ugly form
+ * I hope I will change it again in the future
+ */
+
+static Type types[] = {
+ { /* 0 = voidtype */
+ .op = VOID,
+ .letter = L_VOID,
+ },
+ { /* 1 = pvoidtype */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .type = &types[5], /* char type */
+ .size = 2,
+ .align = 2,
+ },
+ { /* 2 = booltype */
+ .op = INT,
+ .letter = L_BOOL,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_BOOL,
+ },
+ { /* 3 = schartype */
+ .op = INT,
+ .letter = L_INT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_SCHAR,
+ },
+ { /* 4 = uchartype */
+ .op = INT,
+ .letter = L_UINT8,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_UCHAR,
+ },
+ { /* 5 = chartype */
+ .op = INT,
+ .letter = L_UINT8,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 1,
+ .align = 1,
+ .n.rank = RANK_CHAR,
+ },
+ { /* 6 = ushortype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_USHORT,
+ },
+ { /* 7 = shortype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_SHORT,
+ },
+ { /* 8 = uinttype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_UINT,
+ },
+ { /* 9 = inttype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_INT,
+ },
+ { /* 10 = longtype */
+ .op = INT,
+ .letter = L_INT32,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 4,
+ .align = 1,
+ .n.rank = RANK_LONG,
+ },
+ { /* 11 = ulongtype */
+ .op = INT,
+ .letter = L_UINT32,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 4,
+ .align = 1,
+ .n.rank = RANK_ULONG,
+ },
+ { /* 12 = ullongtype */
+ .op = INT,
+ .letter = L_UINT64,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 8,
+ .align = 1,
+ .n.rank = RANK_ULLONG,
+ },
+ { /* 13 = llongtype */
+ .op = INT,
+ .letter = L_INT64,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 8,
+ .align = 1,
+ .n.rank = RANK_LLONG,
+ },
+ { /* 14 = floattype */
+ .op = FLOAT,
+ .letter = L_FLOAT,
+ .prop = TDEFINED | TARITH,
+ .size = 4,
+ .align = 1,
+ .n.rank = RANK_FLOAT,
+ },
+ { /* 15 = doubletype */
+ .op = FLOAT,
+ .letter = L_DOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 8,
+ .align = 1,
+ .n.rank = RANK_DOUBLE,
+ },
+ { /* 16 = ldoubletype */
+ .op = FLOAT,
+ .letter = L_LDOUBLE,
+ .prop = TDEFINED | TARITH,
+ .size = 16,
+ .align = 1,
+ .n.rank = RANK_LDOUBLE,
+ },
+ { /* 17 = sizettype */
+ .op = INT,
+ .letter = L_UINT16,
+ .prop = TDEFINED | TINTEGER | TARITH,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_UINT,
+ },
+ { /* 18 = ellipsis */
+ .op = ELLIPSIS,
+ .letter = L_ELLIPSIS,
+ .prop = TDEFINED,
+ },
+ { /* 7 = pdifftype */
+ .op = INT,
+ .letter = L_INT16,
+ .prop = TDEFINED | TINTEGER | TARITH | TSIGNED,
+ .size = 2,
+ .align = 1,
+ .n.rank = RANK_SHORT,
+ },
+ { /* 20 = va_list_type */
+ .op = PTR,
+ .letter = L_POINTER,
+ .prop = TDEFINED,
+ .size = 2,
+ .align = 1,
+ }
+};
+
+Type *voidtype = &types[0], *pvoidtype = &types[1],
+ *booltype = &types[2], *schartype = &types[3],
+ *uchartype = &types[4], *chartype = &types[5],
+ *ushortype = &types[6], *shortype = &types[7],
+ *uinttype = &types[8], *inttype = &types[9],
+ *longtype = &types[10], *ulongtype = &types[11],
+ *ullongtype = &types[12], *llongtype = &types[13],
+ *floattype = &types[14], *doubletype = &types[15],
+ *ldoubletype = &types[16],
+ *sizettype = &types[17], *pdifftype = &types[19],
+ *ellipsistype = &types[18], *va_list_type = &types[20];
+
+
+static Symbol dummy0 = {.u.i = 0, .type = &types[9]},
+ dummy1 = {.u.i = 1, .type = &types[9]};
+Symbol *zero = &dummy0, *one = &dummy1;
+
+void
+iarch(void)
+{
+}
+
+int
+valid_va_list(Type *tp)
+{
+ return eqtype(tp, va_list_type, 1);
+}
--- /dev/null
+++ b/src/cc1/target/z80-scc/arch.mk
@@ -1,0 +1,4 @@
+OBJ-z80-scc= $(OBJS) target/z80-scc/arch.o
+
+$(LIBEXEC)/cc1-z80-scc: $(OBJ-z80-scc)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-z80-scc) -lscc -o $@
--- /dev/null
+++ b/src/cc1/types.c
@@ -1,0 +1,438 @@
+static char sccsid[] = "@(#) ./cc1/types.c";
+#include <assert.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+#include "cc1.h"
+
+#define NR_TYPE_HASH 16
+#define HASH(t) (((t)->op ^ (uintptr_t) (t)->type>>3) & NR_TYPE_HASH-1)
+
+static Type *typetab[NR_TYPE_HASH], *localtypes;
+
+/* FIXME:
+ * Compiler can generate warnings here if the ranges of TINT,
+ * TUINT and TFLOAT are smaller than any of the constants in this
+ * array. Ignore them if you know that the target types are correct
+ */
+static struct limits limits[][4] = {
+ {
+ { /* 0 = unsigned 1 byte */
+ .min.i = 0,
+ .max.i = 0xff
+ },
+ { /* 1 = unsigned 2 bytes */
+ .min.i = 0,
+ .max.i = 0xffff
+ },
+ { /* 2 = unsigned 4 bytes */
+ .min.i = 0,
+ .max.i = 0xffffffff
+ },
+ { /* 3 = unsigned 8 bytes */
+ .min.i = 0,
+ .max.i = 0xffffffffffffffff
+ }
+ },
+ {
+ { /* 0 = signed 1 byte */
+ .min.i = -0x7f-1,
+ .max.i = 0x7f
+ },
+ { /* 1 = signed 2 byte */
+ .min.i = -0x7fff-1,
+ .max.i = 0x7fff
+ },
+ { /* 2 = signed 4 byte */
+ .min.i = -0x7fffffff-1,
+ .max.i = 0x7fffffff
+ },
+ { /* 3 = signed 8 byte */
+ .min.i = -0x7fffffffffffffff-1,
+ .max.i = 0x7fffffffffffffff,
+ }
+ },
+ {
+ {
+ /* 0 = float 4 bytes */
+ .min.f = -1,
+ .max.f = 2
+ },
+ {
+ /* 1 = float 8 bytes */
+ .min.f = -1,
+ .max.f = 2,
+ },
+ {
+ /* 2 = float 16 bytes */
+ .min.f = -1,
+ .max.f = 2,
+ }
+ }
+};
+
+struct limits *
+getlimits(Type *tp)
+{
+ int ntable, ntype;
+
+ switch (tp->op) {
+ case ENUM:
+ case INT:
+ ntable = ((tp->prop & TSIGNED) != 0);
+ switch (tp->size) {
+ case 1: ntype = 0; break;
+ case 2: ntype = 1; break;
+ case 4: ntype = 2; break;
+ case 8: ntype = 3; break;
+ }
+ break;
+ case FLOAT:
+ ntable = 2;
+ switch (tp->size) {
+ case 4: ntype = 0; break;
+ case 8: ntype = 1; break;
+ case 16: ntype = 2; break;
+ }
+ break;
+ default:
+ abort();
+ }
+
+ return &limits[ntable][ntype];
+}
+
+Type *
+ctype(int type, int sign, int size)
+{
+ switch (type) {
+ case CHAR:
+ if (size)
+ goto invalid_type;
+ switch (sign) {
+ case 0:
+ return chartype;
+ case SIGNED:
+ return schartype;
+ case UNSIGNED:
+ return uchartype;
+ }
+ break;
+ case VA_LIST:
+ if (size || sign)
+ goto invalid_type;
+ return va_list_type;
+ case VOID:
+ if (size || sign)
+ goto invalid_type;
+ return voidtype;
+ case BOOL:
+ if (size || sign)
+ goto invalid_type;
+ return booltype;
+ case 0:
+ case INT:
+ switch (size) {
+ case 0:
+ return (sign == UNSIGNED) ? uinttype : inttype;
+ case SHORT:
+ return (sign == UNSIGNED) ? ushortype : shortype;
+ case LONG:
+ return (sign == UNSIGNED) ? ulongtype : longtype;
+ case LLONG:
+ return (sign == UNSIGNED) ? ullongtype : llongtype;
+ }
+ break;
+ case DOUBLE:
+ if (size == LLONG)
+ goto invalid_type;
+ if (size == LONG)
+ size = LLONG;
+ else
+ size = LONG;
+ goto floating;
+ case FLOAT:
+ if (size == LLONG)
+ goto invalid_type;
+ floating:
+ if (sign)
+ goto invalid_type;
+ switch (size) {
+ case 0:
+ return floattype;
+ case LONG:
+ return doubletype;
+ case LLONG:
+ return ldoubletype;
+ }
+ break;
+ }
+
+invalid_type:
+ error("invalid type specification");
+}
+
+void
+typesize(Type *tp)
+{
+ Symbol **sp;
+ Type *type;
+ unsigned long size, offset;
+ int align, a;
+ TINT n;
+
+ switch (tp->op) {
+ case ARY:
+ /* FIXME: Control overflow */
+ tp->size = tp->n.elem * tp->type->size;
+ tp->align = tp->type->align;
+ return;
+ case PTR:
+ tp->size = pvoidtype->size;
+ tp->align = pvoidtype->align;
+ return;
+ case STRUCT:
+ case UNION:
+ /* FIXME: Control overflow */
+ /*
+ * The alignment of the struct/union is
+ * he alignment of the largest included type.
+ * The size of an union is the size of the largest
+ * field, and the size of a struct is the sum
+ * of the size of every field plus padding bits.
+ */
+ offset = align = size = 0;
+ n = tp->n.elem;
+ for (sp = tp->p.fields; n--; ++sp) {
+ (*sp)->u.i = offset;
+ type = (*sp)->type;
+ a = type->align;
+ if (a > align)
+ align = a;
+ if (tp->op == STRUCT) {
+ if (--a != 0)
+ size = (size + a) & ~a;
+ size += type->size;
+ offset = size;
+ } else {
+ if (type->size > size)
+ size = type->size;
+ }
+ }
+
+ tp->align = align;
+ /*
+ * We have to add the padding bits to
+ * ensure next struct in an array is well
+ * alignment.
+ */
+ if (tp->op == STRUCT && align-- > 1)
+ size += size+align & ~align;
+ tp->size = size;
+ return;
+ case ENUM:
+ tp->size = inttype->size;
+ tp->align = inttype->align;
+ return;
+ case FTN:
+ return;
+ default:
+ abort();
+ }
+}
+
+Type *
+deftype(Type *tp)
+{
+ tp->prop |= TDEFINED;
+ typesize(tp);
+ emit(OTYP, tp);
+ return tp;
+}
+
+static Type *
+newtype(Type *base)
+{
+ Type *tp;
+ size_t siz;
+
+ tp = xmalloc(sizeof(*tp));
+ *tp = *base;
+ tp->id = newid();
+
+ if (tp->op == FTN) {
+ siz = tp->n.elem * sizeof(Type *);
+ tp->p.pars = memcpy(xmalloc(siz), tp->p.pars, siz);
+ }
+
+ if (curfun) {
+ /* it is a type defined in the body of a function */
+ tp->next = localtypes;
+ localtypes = tp;
+ }
+ if (tp->prop & TDEFINED)
+ deftype(tp);
+ return tp;
+}
+
+Type *
+mktype(Type *tp, int op, TINT nelem, Type *pars[])
+{
+ Type **tbl, type;
+ Type *bp;
+
+ if (op == PTR && tp == voidtype)
+ return pvoidtype;
+
+ memset(&type, 0, sizeof(type));
+ type.type = tp;
+ type.op = op;
+ type.p.pars = pars;
+ type.n.elem = nelem;
+
+ switch (op) {
+ case ARY:
+ if (tp == voidtype) {
+ errorp("declaration of array of voids type");
+ tp = inttype;
+ }
+ type.letter = L_ARRAY;
+ if (nelem != 0)
+ type.prop |= TDEFINED;
+ break;
+ case KRFTN:
+ type.prop |= TDEFINED | TK_R;
+ type.op = FTN;
+ type.letter = L_FUNCTION;
+ break;
+ case FTN:
+ if (nelem > 0 && pars[nelem-1] == ellipsistype)
+ type.prop |= TELLIPSIS;
+ type.letter = L_FUNCTION;
+ type.prop |= TDEFINED;
+ break;
+ case PTR:
+ type.letter = L_POINTER;
+ type.prop |= TDEFINED;
+ break;
+ case ENUM:
+ type.letter = inttype->letter;
+ type.prop |= TINTEGER | TARITH;
+ type.n.rank = inttype->n.rank;
+ goto create_type;
+ case STRUCT:
+ type.letter = L_STRUCT;
+ type.prop |= TAGGREG;
+ goto create_type;
+ case UNION:
+ type.letter = L_UNION;
+ type.prop |= TAGGREG;
+ create_type:
+ return newtype(&type);
+ default:
+ abort();
+ }
+
+ tbl = &typetab[HASH(&type)];
+ for (bp = *tbl; bp; bp = bp->h_next) {
+ if (eqtype(bp, &type, 0))
+ return bp;
+ }
+
+ bp = newtype(&type);
+ bp->h_next = *tbl;
+ *tbl = bp;
+
+ return bp;
+}
+
+int
+eqtype(Type *tp1, Type *tp2, int equiv)
+{
+ TINT n;
+ Type **p1, **p2;
+ Symbol **s1, **s2;
+
+ if (tp1 == tp2)
+ return 1;
+ if (!tp1 || !tp2)
+ return 0;
+ if (tp1->op != tp2->op)
+ return 0;
+
+ switch (tp1->op) {
+ case UNION:
+ case STRUCT:
+ if (tp1->letter != tp2->letter)
+ return 0;
+ if (tp1->tag->name || tp2->tag->name)
+ return tp1->tag == tp2->tag;
+ if (tp1->n.elem != tp2->n.elem)
+ return 0;
+ s1 = tp1->p.fields, s2 = tp2->p.fields;
+ for (n = tp1->n.elem; n > 0; --n, ++s1, ++s2) {
+ if (strcmp((*s1)->name, (*s2)->name))
+ return 0;
+ if (!eqtype((*s1)->type, (*s2)->type, equiv))
+ return 0;
+ }
+ return 1;
+ case FTN:
+ if (tp1->n.elem != tp2->n.elem)
+ return 0;
+ p1 = tp1->p.pars, p2 = tp2->p.pars;
+ for (n = tp1->n.elem; n > 0; --n) {
+ if (!eqtype(*p1++, *p2++, equiv))
+ return 0;
+ }
+ goto check_base;
+ case ARY:
+ if (equiv && (tp1->n.elem == 0 || tp2->n.elem == 0))
+ goto check_base;
+ if (tp1->n.elem != tp2->n.elem)
+ return 0;
+ case PTR:
+ check_base:
+ return eqtype(tp1->type, tp2->type, equiv);
+ case VOID:
+ case ENUM:
+ return 0;
+ case INT:
+ case FLOAT:
+ return tp1->letter == tp2->letter;
+ default:
+ abort();
+ }
+}
+
+void
+flushtypes(void)
+{
+ Type *tp, *next, **h;
+
+ for (tp = localtypes; tp; tp = next) {
+ next = tp->next;
+ switch (tp->op) {
+ default:
+ /*
+ * All the local types are linked after
+ * global types, and since we are
+ * unlinking them in the inverse order
+ * we do know that tp is always the head
+ * of the collision list
+ */
+ h = &typetab[HASH(tp)];
+ assert(*h == tp);
+ *h = tp->h_next;
+ case STRUCT:
+ case UNION:
+ case ENUM:
+ free(tp);
+ break;
+ }
+ }
+ localtypes = NULL;
+}
--- /dev/null
+++ b/src/cc2/.gitignore
@@ -1,0 +1,1 @@
+error.h
--- /dev/null
+++ b/src/cc2/Makefile
@@ -1,0 +1,40 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -I$(INCDIR)/$(STD)
+
+OBJS = main.o \
+ parser.o \
+ peep.o \
+ symbol.o \
+ node.o \
+ code.o \
+ optm.o \
+
+TARGET = $(LIBEXEC)/cc2-amd64-sysv \
+ $(LIBEXEC)/cc2-i386-sysv \
+ $(LIBEXEC)/cc2-qbe_amd64-sysv \
+ $(LIBEXEC)/cc2-z80-scc \
+
+all: $(TARGET)
+
+$(TARGET): error.h
+
+error.h: cc2.h
+ rm -f $@;\
+ trap 'r=$?;rm -f $$$$.h;exit $r' EXIT INT QUIT ;\
+ awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@
+
+dep: inc-dep
+
+clean:
+ rm -f target/*/*.o error.h
+
+include target/amd64-sysv/target.mk
+include target/i386-sysv/target.mk
+include target/qbe_amd64-sysv/target.mk
+include target/qbe_arm64-sysv/target.mk
+include target/z80-scc/target.mk
+include deps.mk
--- /dev/null
+++ b/src/cc2/cc2.h
@@ -1,0 +1,256 @@
+enum iflags {
+ BBENTRY = 1, /* basic block entry */
+};
+
+enum tflags {
+ SIGNF = 1 << 0, /* Signed type */
+ INTF = 1 << 1, /* integer type */
+ FLOATF = 1 << 2, /* float type */
+ STRF = 1 << 3, /* string */
+ AGGRF = 1 << 4, /* aggregate */
+ FUNF = 1 << 5, /* function */
+ PARF = 1 << 6, /* parameter */
+ INITF = 1 << 7, /* initializer flag */
+ ELLIPS = 1 << 8, /* vararg function */
+};
+
+enum sclass {
+ SAUTO = 'A',
+ SREG = 'R',
+ SLABEL = 'L',
+ SINDEX = 'I',
+ STMP = 'N',
+ SGLOB = 'G',
+ SEXTRN = 'X',
+ SPRIV = 'Y',
+ SLOCAL = 'T',
+ SMEMB = 'M',
+ SCONST = '#',
+ STRING = '"',
+ SNONE = 0 /* cc2 relies on SNONE being 0 in nextpc() */
+};
+
+enum types {
+ ELLIPSIS = 'E',
+ INT8 = 'C',
+ INT16 = 'I',
+ INT32 = 'W',
+ INT64 = 'Q',
+ UINT8 = 'K',
+ UINT16 = 'N',
+ UINT32 = 'Z',
+ UINT64 = 'O',
+ POINTER = 'P',
+ FUNCTION = 'F',
+ VECTOR = 'V',
+ UNION = 'U',
+ STRUCT = 'S',
+ BOOL = 'B',
+ FLOAT = 'J',
+ DOUBLE = 'D',
+ LDOUBLE = 'H',
+ VOID = '0'
+};
+
+enum op {
+ /* kind of operand */
+ /* operands */
+ OMEM = 'M',
+ OTMP = 'N',
+ OAUTO = 'A',
+ OREG = 'R',
+ OCONST = '#',
+ OSTRING = '"',
+ OLOAD = 'D',
+ OLABEL = 'L',
+ OADD = '+',
+ OSUB = '-',
+ OMUL = '*',
+ OMOD = '%',
+ ODIV = '/',
+ OSHL = 'l',
+ OSHR = 'r',
+ OLT = '<',
+ OGT = '>',
+ OLE = '[',
+ OGE = ']',
+ OEQ = '=',
+ ONE = '!',
+ OBAND = '&',
+ OBOR = '|',
+ OBXOR = '^',
+ OCPL = '~',
+ OASSIG = ':',
+ OSNEG = '_',
+ OCALL = 'c',
+ OCALLE = 'z',
+ OPAR = 'p',
+ OFIELD = '.',
+ OCOMMA = ',',
+ OASK = '?',
+ OCOLON = ' ',
+ OADDR = '\'',
+ OAND = 'a',
+ OOR = 'o',
+ ONEG = 'n',
+ OPTR = '@',
+ OCAST = 'g',
+ OINC = 'i',
+ ODEC = 'd',
+ OBUILTIN = 'm',
+ /*statements */
+ ONOP = 'q',
+ OJMP = 'j',
+ OBRANCH = 'y',
+ ORET = 'h',
+ OBLOOP = 'b',
+ OELOOP = 'e',
+ OCASE = 'v',
+ ODEFAULT = 'f',
+ OBSWITCH = 's',
+ OESWITCH = 't',
+ OBFUN = 'x',
+ OEFUN = 'k',
+};
+
+enum builtins {
+ BVA_START = 's',
+ BVA_END = 'e',
+ BVA_ARG = 'a',
+ BVA_COPY = 'c',
+};
+
+enum nerrors {
+ EEOFFUN, /* EOF while parsing function */
+ ENLABEL, /* label without statement */
+ EIDOVER, /* identifier overflow */
+ EOUTPAR, /* out pf params */
+ ESYNTAX, /* syntax error */
+ ESTACKA, /* stack unaligned */
+ ESTACKO, /* stack overflow */
+ ESTACKU, /* stack underflow */
+ ELNLINE, /* line too long */
+ ELNBLNE, /* line without new line */
+ EFERROR, /* error reading from file:%s */
+ EBADID, /* incorrect symbol id */
+ EWTACKO, /* switch stack overflow */
+ EWTACKU, /* switch stack underflow */
+ ENOSWTC, /* Out of switch statement */
+ EBBUILT, /* Unknown builtin */
+ ENUMERR
+};
+
+typedef struct node Node;
+typedef struct type Type;
+typedef struct symbol Symbol;
+typedef struct addr Addr;
+typedef struct inst Inst;
+
+struct type {
+ unsigned long size;
+ unsigned long align;
+ short flags;
+};
+
+struct symbol {
+ Type type;
+ Type rtype;
+ unsigned short id;
+ unsigned short numid;
+ char *name;
+ char kind;
+ union {
+ unsigned long off;
+ Node *stmt;
+ Inst *inst;
+ } u;
+ Symbol *next;
+ Symbol *h_next;
+};
+
+struct node {
+ char op;
+ Type type;
+ char complex;
+ char address;
+ unsigned char flags;
+ union {
+ TUINT i;
+ TFLOAT f;
+ char reg;
+ char *s;
+ Symbol *sym;
+ char subop;
+ } u;
+ Symbol *label;
+ Node *left, *right;
+ Node *next, *prev;
+};
+
+struct addr {
+ char kind;
+ union {
+ char reg;
+ TUINT i;
+ Symbol *sym;
+ } u;
+};
+
+struct inst {
+ unsigned char op;
+ unsigned char flags;
+ Symbol *label;
+ Inst *next, *prev;
+ Addr from1, from2, to;
+};
+
+/* main.c */
+extern void error(unsigned nerror, ...);
+
+/* parse.c */
+extern void parse(void);
+
+/* optm.c */
+extern Node *optm_dep(Node *np), *optm_ind(Node *np);
+
+/* cgen.c */
+extern Node *sethi(Node *np);
+extern Node *cgen(Node *np);
+
+/* peep.c */
+extern void peephole(void);
+
+/* code.c */
+extern void data(Node *np);
+extern void writeout(void), endinit(void), newfun(void);
+extern void code(int op, Node *to, Node *from1, Node *from2);
+extern void defvar(Symbol *), defpar(Symbol *), defglobal(Symbol *);
+extern void setlabel(Symbol *sym), getbblocks(void);
+extern Node *label2node(Node *np, Symbol *sym);
+extern Node *constnode(Node *np, TUINT n, Type *tp);
+extern Symbol *newlabel(void);
+
+/* node.c */
+#define SETCUR 1
+#define KEEPCUR 0
+extern void apply(Node *(*fun)(Node *));
+extern void cleannodes(void);
+extern void delnode(Node *np);
+extern void deltree(Node *np);
+extern void prtree(Node *np), prforest(char *msg);
+extern Node *node(int op);
+extern Node *addstmt(Node *np, int flags);
+extern Node *delstmt(void);
+extern Node *nextstmt(void);
+
+/* symbol.c */
+#define TMPSYM 0
+extern Symbol *getsym(unsigned id);
+extern void popctx(void);
+extern void pushctx(void);
+extern void freesym(Symbol *sym);
+
+/* globals */
+extern Symbol *curfun;
+extern Symbol *locals;
+extern Inst *pc, *prog;
--- /dev/null
+++ b/src/cc2/code.c
@@ -1,0 +1,133 @@
+static char sccsid[] = "@(#) ./cc2/code.c";
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include "cc2.h"
+
+Inst *pc, *prog;
+
+static void
+nextpc(void)
+{
+ Inst *new;
+
+ new = xcalloc(1, sizeof(*new)); /* TODO: create an arena */
+
+ if (!pc) {
+ prog = new;
+ } else {
+ new->next = pc->next;
+ pc->next = new;
+ }
+
+ /* SNONE being 0, calloc initialized {from1,from2,to}.kind for us */
+ new->prev = pc;
+ pc = new;
+}
+
+static void
+addr(Node *np, Addr *addr)
+{
+ Symbol *sym;
+
+ switch (np->op) {
+ case OREG:
+ /* TODO:
+ * At this moment this op is used also for register variables
+ */
+ addr->kind = SREG;
+ addr->u.reg = np->u.reg;
+ break;
+ case OCONST:
+ addr->kind = SCONST;
+ /* TODO: Add support for more type of constants */
+ addr->u.i = np->u.i;
+ break;
+ case OTMP:
+ case OLABEL:
+ case OAUTO:
+ case OMEM:
+ sym = np->u.sym;
+ addr->kind = sym->kind;
+ addr->u.sym = sym;
+ break;
+ default:
+ abort();
+ }
+}
+
+Symbol *
+newlabel(void)
+{
+ Symbol *sym = getsym(TMPSYM);
+
+ sym->kind = SLABEL;
+ return sym;
+}
+
+Node *
+label2node(Node *np, Symbol *sym)
+{
+ if(!sym)
+ sym = newlabel();
+ if (!np)
+ np = node(OLABEL);
+ np->op = OLABEL;
+ np->u.sym = sym;
+
+ return np;
+}
+
+Node *
+constnode(Node *np, TUINT n, Type *tp)
+{
+ if (!np)
+ np = node(OCONST);
+ np->op = OCONST;
+ np->left = NULL;
+ np->right = NULL;
+ np->type = *tp;
+ np->u.i = n;
+ return np;
+}
+
+void
+setlabel(Symbol *sym)
+{
+ if (!sym)
+ return;
+ code(0, NULL, NULL, NULL);
+ pc->label = sym;
+ sym->u.inst = pc;
+}
+
+void
+code(int op, Node *to, Node *from1, Node *from2)
+{
+ nextpc();
+ if (from1)
+ addr(from1, &pc->from1);
+ if (from2)
+ addr(from2, &pc->from2);
+ if (to)
+ addr(to, &pc->to);
+ pc->op = op;
+}
+
+void
+delcode(void)
+{
+ Inst *prev = pc->prev, *next = pc->next;
+
+ free(pc);
+ if (!prev) {
+ pc = next;
+ prog = NULL;
+ } else {
+ pc = prev;
+ prev->next = next;
+ if (next)
+ next->prev = prev;
+ }
+}
--- /dev/null
+++ b/src/cc2/deps.mk
@@ -1,0 +1,61 @@
+#deps
+code.o: $(INCDIR)/scc/scc/scc.h
+code.o: cc2.h
+main.o: $(INCDIR)/scc/scc/arg.h
+main.o: $(INCDIR)/scc/scc/scc.h
+main.o: cc2.h
+main.o: error.h
+node.o: $(INCDIR)/scc/scc/scc.h
+node.o: cc2.h
+optm.o: $(INCDIR)/scc/scc/scc.h
+optm.o: cc2.h
+parser.o: $(INCDIR)/scc/scc/cstd.h
+parser.o: $(INCDIR)/scc/scc/scc.h
+parser.o: cc2.h
+peep.o: $(INCDIR)/scc/scc/scc.h
+peep.o: cc2.h
+symbol.o: $(INCDIR)/scc/scc/scc.h
+symbol.o: cc2.h
+target/amd64-sysv/cgen.o: $(INCDIR)/scc/scc/scc.h
+target/amd64-sysv/cgen.o: target/amd64-sysv/../../cc2.h
+target/amd64-sysv/cgen.o: target/amd64-sysv/arch.h
+target/amd64-sysv/code.o: $(INCDIR)/scc/scc/cstd.h
+target/amd64-sysv/code.o: $(INCDIR)/scc/scc/scc.h
+target/amd64-sysv/code.o: target/amd64-sysv/../../cc2.h
+target/amd64-sysv/code.o: target/amd64-sysv/arch.h
+target/amd64-sysv/optm.o: $(INCDIR)/scc/scc/scc.h
+target/amd64-sysv/optm.o: target/amd64-sysv/../../cc2.h
+target/amd64-sysv/types.o: $(INCDIR)/scc/scc/scc.h
+target/amd64-sysv/types.o: target/amd64-sysv/../../cc2.h
+target/i386-sysv/cgen.o: $(INCDIR)/scc/scc/scc.h
+target/i386-sysv/cgen.o: target/i386-sysv/../../cc2.h
+target/i386-sysv/cgen.o: target/i386-sysv/arch.h
+target/i386-sysv/code.o: $(INCDIR)/scc/scc/cstd.h
+target/i386-sysv/code.o: $(INCDIR)/scc/scc/scc.h
+target/i386-sysv/code.o: target/i386-sysv/../../cc2.h
+target/i386-sysv/code.o: target/i386-sysv/arch.h
+target/i386-sysv/optm.o: $(INCDIR)/scc/scc/scc.h
+target/i386-sysv/optm.o: target/i386-sysv/../../cc2.h
+target/i386-sysv/types.o: $(INCDIR)/scc/scc/scc.h
+target/i386-sysv/types.o: target/i386-sysv/../../cc2.h
+target/qbe/cgen.o: $(INCDIR)/scc/scc/cstd.h
+target/qbe/cgen.o: $(INCDIR)/scc/scc/scc.h
+target/qbe/cgen.o: target/qbe/../../cc2.h
+target/qbe/cgen.o: target/qbe/arch.h
+target/qbe/code.o: $(INCDIR)/scc/scc/cstd.h
+target/qbe/code.o: $(INCDIR)/scc/scc/scc.h
+target/qbe/code.o: target/qbe/../../cc2.h
+target/qbe/code.o: target/qbe/arch.h
+target/qbe/optm.o: $(INCDIR)/scc/scc/scc.h
+target/qbe/optm.o: target/qbe/../../cc2.h
+target/z80-scc/cgen.o: $(INCDIR)/scc/scc/scc.h
+target/z80-scc/cgen.o: target/z80-scc/../../cc2.h
+target/z80-scc/cgen.o: target/z80-scc/arch.h
+target/z80-scc/code.o: $(INCDIR)/scc/scc/cstd.h
+target/z80-scc/code.o: $(INCDIR)/scc/scc/scc.h
+target/z80-scc/code.o: target/z80-scc/../../cc2.h
+target/z80-scc/code.o: target/z80-scc/arch.h
+target/z80-scc/optm.o: $(INCDIR)/scc/scc/scc.h
+target/z80-scc/optm.o: target/z80-scc/../../cc2.h
+target/z80-scc/types.o: $(INCDIR)/scc/scc/scc.h
+target/z80-scc/types.o: target/z80-scc/../../cc2.h
--- /dev/null
+++ b/src/cc2/generror.awk
@@ -1,0 +1,9 @@
+/^enum nerrors \{/ {print "char *errlist[] = {"; inhome = 1}
+
+inhome && /E[A-Z]*, / {sub(/,/, "", $1)
+ printf("\t[%s] = \"", $1)
+ for (i = 3; i <= NF-1; ++i)
+ printf("%s%s", $i, (i == NF-1) ? "\"" : " ")
+ print ","}
+
+inhome && /^}/ {print "};" ; inhome = 0}
--- /dev/null
+++ b/src/cc2/main.c
@@ -1,0 +1,70 @@
+static char sccsid[] = "@(#) ./cc2/main.c";
+
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/arg.h>
+#include <scc/scc.h>
+#include "cc2.h"
+#include "error.h"
+
+char *argv0;
+
+void
+error(unsigned nerror, ...)
+{
+ va_list va;
+ va_start(va, nerror);
+ vfprintf(stderr, errlist[nerror], va);
+ va_end(va);
+ putc('\n', stderr);
+ exit(1);
+}
+
+static int
+moreinput(void)
+{
+ int c;
+
+repeat:
+ if (feof(stdin))
+ return 0;
+ if ((c = getchar()) == '\n' || c == EOF)
+ goto repeat;
+ ungetc(c, stdin);
+ return 1;
+}
+
+static void
+usage(void)
+{
+ fputs("usage: cc2 [irfile]\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND
+
+ if (argv[0] && !freopen(argv[0], "r", stdin))
+ die("cc2: %s: %s", argv[0], strerror(errno));
+
+ while (moreinput()) {
+ parse();
+ apply(optm_ind);
+ apply(optm_dep);
+ apply(sethi);
+ apply(cgen);
+ getbblocks(); /* TODO: run apply over asm ins too */
+ peephole();
+ writeout();
+ }
+ return 0;
+}
--- /dev/null
+++ b/src/cc2/node.c
@@ -1,0 +1,142 @@
+static char sccsid[] = "@(#) ./cc2/node.c";
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+
+#include "cc2.h"
+
+#define NNODES 32
+
+Node *curstmt;
+Symbol *curfun;
+
+static Alloc *arena;
+
+
+Node *
+node(int op)
+{
+ struct arena *ap;
+ Node *np;
+
+ if (!arena)
+ arena = alloc(sizeof(Node), NNODES);
+ np = memset(new(arena), 0, sizeof(*np));
+ np->op = op;
+
+ return np;
+}
+
+#ifndef NDEBUG
+#include <stdio.h>
+
+static void
+prnode(Node *np)
+{
+ if (np->left)
+ prnode(np->left);
+ if (np->right)
+ prnode(np->right);
+ fprintf(stderr, "\t%c%lu", np->op, np->type.size);
+}
+
+void
+prtree(Node *np)
+{
+ prnode(np);
+ putc('\n', stderr);
+}
+
+void
+prforest(char *msg)
+{
+ Node *np;
+
+ if (!curfun)
+ return;
+
+ fprintf(stderr, "%s {\n", msg);
+ for (np = curfun->u.stmt; np; np = np->next)
+ prtree(np);
+ fputs("}\n", stderr);
+}
+#endif
+
+Node *
+addstmt(Node *np, int flag)
+{
+ if (curstmt)
+ np->next = curstmt->next;
+ np->prev = curstmt;
+
+ if (!curfun->u.stmt)
+ curfun->u.stmt = np;
+ else
+ curstmt->next = np;
+
+ if (flag == SETCUR)
+ curstmt = np;
+
+ return np;
+}
+
+Node *
+delstmt(void)
+{
+ Node *next, *prev;
+
+ next = curstmt->next;
+ prev = curstmt->prev;
+ if (next)
+ next->prev = prev;
+ if (prev)
+ prev->next = next;
+ else
+ curfun->u.stmt = next;
+ deltree(curstmt);
+
+ return curstmt = next;
+}
+
+Node *
+nextstmt(void)
+{
+ return curstmt = curstmt->next;
+}
+
+void
+delnode(Node *np)
+{
+ delete(arena, np);
+}
+
+void
+deltree(Node *np)
+{
+ if (!np)
+ return;
+ deltree(np->left);
+ deltree(np->right);
+ delnode(np);
+}
+
+void
+cleannodes(void)
+{
+ if (arena) {
+ dealloc(arena);
+ arena = NULL;
+ }
+ curstmt = NULL;
+}
+
+void
+apply(Node *(*fun)(Node *))
+{
+ if (!curfun)
+ return;
+ curstmt = curfun->u.stmt;
+ while (curstmt)
+ (*fun)(curstmt) ? nextstmt() : delstmt();
+}
--- /dev/null
+++ b/src/cc2/optm.c
@@ -1,0 +1,9 @@
+#include <scc/scc.h>
+#include "cc2.h"
+
+Node *
+optm_ind(Node *np)
+{
+ return np;
+}
+
--- /dev/null
+++ b/src/cc2/parser.c
@@ -1,0 +1,722 @@
+static char sccsid[] = "@(#) ./cc2/parser.c";
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "cc2.h"
+
+#define STACKSIZ 50
+
+extern Type int8type, int16type, int32type, int64type,
+ uint8type, uint16type, uint32type, uint64type,
+ float32type, float64type, float80type,
+ booltype,
+ ptrtype,
+ voidtype,
+ arg_type;
+
+Type funetype = {
+ .flags = FUNF | ELLIPS
+};
+
+Type funtype = {
+ .flags = FUNF
+};
+
+union tokenop {
+ void *arg;
+ unsigned op;
+};
+
+struct swtch {
+ int nr;
+ Node *first;
+ Node *last;
+};
+
+static struct swtch swtbl[NR_BLOCK], *swp = swtbl;
+static Symbol *lastfun;
+
+typedef void parsefun(char *, union tokenop);
+static parsefun type, symbol, getname, unary, binary, ternary, call,
+ constant, composed, binit, einit,
+ jump, oreturn, loop, assign,
+ ocase, bswitch, eswitch, builtin;
+
+typedef void evalfun(void);
+static evalfun vardecl, beginfun, endfun, endpars, stmt,
+ array, aggregate, flddecl, labeldcl;
+
+static struct decoc {
+ void (*eval)(void);
+ void (*parse)(char *token, union tokenop);
+ union tokenop u;
+} optbl[] = { /* eval parse args */
+ ['A'] = { vardecl, symbol, .u.op = SAUTO<<8 | OAUTO},
+ ['R'] = { vardecl, symbol, .u.op = SREG<<8 | OREG},
+ ['G'] = { vardecl, symbol, .u.op = SGLOB<<8 | OMEM},
+ ['X'] = { vardecl, symbol, .u.op = SEXTRN<<8 | OMEM},
+ ['Y'] = { vardecl, symbol, .u.op = SPRIV<<8 | OMEM},
+ ['T'] = { vardecl, symbol, .u.op = SLOCAL<<8 | OMEM},
+ ['M'] = { flddecl, symbol, .u.op = SMEMB<<8 | OMEM},
+ ['L'] = { labeldcl, symbol, .u.op = SLABEL<<8 | OLABEL},
+
+ ['C'] = { NULL, type, .u.arg = &int8type},
+ ['I'] = { NULL, type, .u.arg = &int16type},
+ ['W'] = { NULL, type, .u.arg = &int32type},
+ ['Q'] = { NULL, type, .u.arg = &int64type},
+ ['K'] = { NULL, type, .u.arg = &uint8type},
+ ['N'] = { NULL, type, .u.arg = &uint16type},
+ ['Z'] = { NULL, type, .u.arg = &uint32type},
+ ['O'] = { NULL, type, .u.arg = &uint64type},
+ ['J'] = { NULL, type, .u.arg = &float32type},
+ ['D'] = { NULL, type, .u.arg = &float64type},
+ ['H'] = { NULL, type, .u.arg = &float80type},
+ ['0'] = { NULL, type, .u.arg = &voidtype},
+ ['B'] = { NULL, type, .u.arg = &booltype},
+ ['P'] = { NULL, type, .u.arg = &ptrtype},
+ ['E'] = { NULL, type, .u.arg = &funetype},
+ ['1'] = { NULL, type, .u.arg = &arg_type},
+
+ ['F'] = { NULL, type, .u.arg = &funtype},
+ ['V'] = { array,composed, 0},
+ ['U'] = {aggregate,composed, 0},
+ ['S'] = {aggregate,composed, 0},
+
+ ['"'] = { NULL, getname, 0},
+ ['{'] = { beginfun, NULL, 0},
+ ['}'] = { endfun, NULL, 0},
+ ['('] = { NULL, binit, 0},
+ [')'] = { NULL, einit, 0},
+ ['\\'] = { endpars, NULL, 0},
+ ['\t'] = { stmt, NULL, 0},
+
+ ['~'] = { NULL, unary, .u.op = OCPL},
+ ['_'] = { NULL, unary, .u.op = OSNEG},
+ ['\''] = { NULL, unary, .u.op = OADDR},
+ ['@'] = { NULL, unary, .u.op = OPTR},
+ ['g'] = { NULL, unary, .u.op = OCAST},
+ ['p'] = { NULL, unary, .u.op = OPAR},
+ ['n'] = { NULL, unary, .u.op = ONEG},
+
+ ['a'] = { NULL, binary, .u.op = OAND},
+ ['o'] = { NULL, binary, .u.op = OOR},
+ ['.'] = { NULL, binary, .u.op = OFIELD},
+ ['+'] = { NULL, binary, .u.op = OADD},
+ ['-'] = { NULL, binary, .u.op = OSUB},
+ ['*'] = { NULL, binary, .u.op = OMUL},
+ ['%'] = { NULL, binary, .u.op = OMOD},
+ ['/'] = { NULL, binary, .u.op = ODIV},
+ ['l'] = { NULL, binary, .u.op = OSHL},
+ ['r'] = { NULL, binary, .u.op = OSHR},
+ ['<'] = { NULL, binary, .u.op = OLT},
+ ['>'] = { NULL, binary, .u.op = OGT},
+ ['['] = { NULL, binary, .u.op = OLE},
+ [']'] = { NULL, binary, .u.op = OGE},
+ ['='] = { NULL, binary, .u.op = OEQ},
+ ['!'] = { NULL, binary, .u.op = ONE},
+ ['&'] = { NULL, binary, .u.op = OBAND},
+ ['|'] = { NULL, binary, .u.op = OBOR},
+ ['^'] = { NULL, binary, .u.op = OBXOR},
+ [','] = { NULL, binary, .u.op = OCOMMA},
+ ['m'] = { NULL, builtin,.u.op = OBUILTIN},
+
+ [':'] = { NULL, assign, .u.op = OASSIG},
+ ['?'] = { NULL, ternary, .u.op = OASK},
+ ['c'] = { NULL, call, .u.op = OCALL},
+ ['z'] = { NULL, call, .u.op = OCALLE},
+
+ ['#'] = { NULL,constant, .u.op = OCONST},
+
+ ['j'] = { NULL, jump, .u.op = OJMP},
+ ['y'] = { NULL, jump, .u.op = OBRANCH},
+ ['h'] = { NULL, oreturn, .u.op = ORET},
+ ['i'] = { NULL, NULL, .u.op = OINC},
+ ['d'] = { NULL, NULL, .u.op = ODEC},
+
+ ['b'] = { NULL, loop, .u.op = OBLOOP},
+ ['e'] = { NULL, loop, .u.op = OELOOP},
+
+ ['v'] = { NULL, ocase, .u.op = OCASE},
+ ['f'] = { NULL, ocase, .u.op = ODEFAULT},
+ ['t'] = { NULL, eswitch, .u.op = OESWITCH},
+ ['s'] = { NULL, bswitch, .u.op = OBSWITCH},
+};
+
+static int sclass, inpars, ininit, endf, lineno;
+static void *stack[STACKSIZ], **sp = stack;
+
+static Node *
+push(void *elem)
+{
+ if (sp == &stack[STACKSIZ])
+ error(ESTACKO);
+ return *sp++ = elem;
+}
+
+static void *
+pop(void)
+{
+ if (sp == stack)
+ error(ESTACKU);
+ return *--sp;
+}
+
+static int
+empty(void)
+{
+ return sp == stack;
+}
+
+static void
+type(char *token, union tokenop u)
+{
+ push(u.arg);
+}
+
+static void
+composed(char *token, union tokenop u)
+{
+ Symbol *sym;
+
+ sym = getsym(atoi(token+1));
+ push(&sym->type);
+}
+
+static void
+getname(char *t, union tokenop u)
+{
+ push((*++t) ? xstrdup(t) : NULL);
+}
+
+static void
+symbol(char *token, union tokenop u)
+{
+ Node *np = node(u.op & 0xFF);
+ Symbol *sym = getsym(atoi(token+1));
+
+ sclass = u.op >> 8;
+ np->u.sym = sym;
+ np->type = sym->type;
+ push(np);
+}
+
+static Type *
+gettype(char *token)
+{
+ struct decoc *dp;
+
+ dp = &optbl[*token];
+ if (!dp->parse)
+ error(ESYNTAX);
+ (*dp->parse)(token, dp->u);
+ return pop();
+}
+
+static void
+constant(char *token, union tokenop u)
+{
+ static char letters[] = "0123456789ABCDEF";
+ Node *np;
+ TUINT v;
+ unsigned c;
+
+ ++token;
+ if (*token == '"') {
+ ++token;
+ np = node(OSTRING);
+ np->type.flags = STRF;
+ np->type.size = strlen(token);
+ np->type.align = int8type.align;
+ np->u.s = xstrdup(token);
+ } else {
+ np = node(OCONST);
+ np->type = *gettype(token++);
+ for (v = 0; c = *token++; v += c) {
+ v <<= 4;
+ c = strchr(letters, c) - letters;
+ }
+ np->u.i = v;
+ }
+ push(np);
+}
+
+static void
+assign(char *token, union tokenop u)
+{
+ int subop;
+ Node *np = node(u.op);
+
+ switch (subop = *++token) {
+ case '+':
+ case '-':
+ case '*':
+ case '%':
+ case '/':
+ case 'l':
+ case 'r':
+ case '&':
+ case '|':
+ case '^':
+ case 'i':
+ case 'd':
+ ++token;
+ subop = optbl[subop].u.op;
+ break;
+ default:
+ subop = 0;
+ break;
+ }
+
+ np->u.subop = subop;
+ np->type = *gettype(token);
+ np->right = pop();
+ np->left = pop();
+ push(np);
+}
+
+static void
+ternary(char *token, union tokenop u)
+{
+ Node *ask = node(OASK), *colon = node(OCOLON);
+ Type *tp = gettype(token+1);
+
+ colon->right = pop();
+ colon->left = pop();
+
+ ask->type = *tp;
+ ask->left = pop();
+ ask->right = colon;
+ push(ask);
+}
+
+static void
+eval(char *tok)
+{
+ struct decoc *dp;
+
+ do {
+ dp = &optbl[*tok];
+ if (!dp->parse)
+ break;
+ (*dp->parse)(tok, dp->u);
+ } while (tok = strtok(NULL, "\t\n"));
+}
+
+static int
+nextline(void)
+{
+ static char line[LINESIZ];
+ size_t len;
+ int c;
+ void (*fun)(void);
+
+repeat:
+ ++lineno;
+ if (!fgets(line, sizeof(line), stdin))
+ return 0;
+ if ((len = strlen(line)) == 0 || line[0] == '\n')
+ goto repeat;
+ if (line[len-1] != '\n')
+ error(len < sizeof(line)-1 ? ELNBLNE : ELNLINE);
+ line[len-1] = '\0';
+
+ c = *line;
+ eval(strtok(line, "\t\n"));
+ if ((fun = *optbl[c].eval) != NULL)
+ (*fun)();
+ if (sp != stack)
+ error(ESTACKA);
+ return 1;
+}
+
+static void
+oreturn(char *token, union tokenop u)
+{
+ Node *np = node(u.op);
+
+ if (token = strtok(NULL, "\t\n"))
+ eval(token);
+ if (!empty())
+ np->left = pop();
+ push(np);
+}
+
+/*
+ * Move np (which is a OCASE/ODEFAULT/OESWITCH) to be contigous with
+ * the last switch table. It is a bit ugly to touch directly curstmt
+ * here, but moving this function to node.c is worse, because we are
+ * putting knowledge of how the text is parsed into the node
+ * represtation module.
+ */
+static void
+waft(Node *np)
+{
+ Node *lastcase, *next;;
+ struct swtch *cur;
+ extern Node *curstmt;
+
+ if (swp == swtbl)
+ error(EWTACKU);
+
+ cur = swp - 1;
+ lastcase = cur->last;
+ next = lastcase->next;
+
+ np->next = next;
+ np->prev = lastcase;
+
+ if (next)
+ next->prev = np;
+ lastcase->next = np;
+
+ if (curstmt == cur->last)
+ curstmt = np;
+ cur->last = np;
+ cur->nr++;
+}
+
+static void
+bswitch(char *token, union tokenop u)
+{
+ struct swtch *cur;
+ Node *np = node(u.op);
+
+ if (swp == &swtbl[NR_BLOCK])
+ error(EWTACKO);
+ cur = swp++;
+ cur->nr = 0;
+
+ eval(strtok(NULL, "\t\n"));
+ np->left = pop();
+
+ push(cur->first = cur->last = np);
+}
+
+static void
+eswitch(char *token, union tokenop u)
+{
+ struct swtch *cur;
+
+ if (swp == swtbl)
+ error(EWTACKU);
+ jump(token, u);
+ waft(pop());
+ cur = --swp;
+ cur->first->u.i = cur->nr;
+}
+
+static void
+ocase(char *token, union tokenop u)
+{
+ jump(token, u);
+ waft(pop());
+}
+
+static void
+jump(char *token, union tokenop u)
+{
+ Node *aux, *np = node(u.op);
+
+ eval(strtok(NULL, "\t\n"));
+
+ if (u.op == OBRANCH || u.op == OCASE)
+ np->left = pop();
+ aux = pop();
+ np->u.sym = aux->u.sym;
+ delnode(aux);
+ push(np);
+}
+
+static void
+loop(char *token, union tokenop u)
+{
+ push(node(u.op));
+}
+
+static void
+unary(char *token, union tokenop u)
+{
+ Node *np = node(u.op);
+
+ np->type = *gettype(token+1);
+ np->left = pop();
+ np->right = NULL;
+ push(np);
+}
+
+static void
+call(char *token, union tokenop u)
+{
+ Node *np, *par, *fun = node(u.op);
+
+ for (par = NULL;; par = np) {
+ np = pop();
+ if (np->op != OPAR)
+ break;
+ np->right = par;
+ }
+
+ fun->type = *gettype(token+1);
+ fun->left = np;
+ fun->right = par;
+ push(fun);
+}
+
+static void
+builtin(char *token, union tokenop u)
+{
+ Node *np = node(u.op);
+ char *name;
+ unsigned subop, nchilds;
+
+ np->type = *gettype(token+1);
+ name = pop();
+
+ if (!strcmp("__builtin_va_arg", name)) {
+ nchilds = 1;
+ subop = BVA_ARG;
+ } else if (!strcmp("__builtin_va_start", name)) {
+ nchilds = 2;
+ subop = BVA_START;
+ } else if (!strcmp("__builtin_va_end", name)) {
+ nchilds = 1;
+ subop = BVA_END;
+ } else if (!strcmp("__builtin_va_copy", name)) {
+ nchilds = 2;
+ subop = BVA_COPY;
+ } else {
+ error(EBBUILT);;
+ }
+
+ np->u.subop = subop;
+ np->right = (nchilds == 2) ? pop() : NULL;
+ np->left = (nchilds != 0) ? pop() : NULL;
+
+ free(name);
+ push(np);
+}
+
+static void
+binary(char *token, union tokenop u)
+{
+ Node *np = node(u.op);
+
+ np->type = *gettype(token+1);
+ np->right = pop();
+ np->left = pop();
+ push(np);
+}
+
+static void
+binit(char *token, union tokenop u)
+{
+ ininit = 1;
+}
+
+static void
+einit(char *token, union tokenop u)
+{
+ ininit = 0;
+ endinit();
+}
+
+static void
+endpars(void)
+{
+ if (!curfun || !inpars)
+ error(ESYNTAX);
+ inpars = 0;
+}
+
+static void
+aggregate(void)
+{
+ Node *align, *size;
+ char *name;
+ Type *tp;
+ Symbol *sym;
+
+ align = pop();
+ size = pop();
+ name = pop();
+ tp = pop();
+
+ tp->size = size->u.i;
+ tp->align = align->u.i;
+ tp->flags = AGGRF;
+ /*
+ * type is the first field of Symbol so we can obtain the
+ * address of the symbol from the address of the type.
+ * We have to do this because composed returns the pointer
+ * to the type, but in this function we also need the
+ * symbol to store the name.
+ */
+ sym = (Symbol *) tp;
+ sym->name = name;
+
+ delnode(align);
+ delnode(size);
+}
+
+static void
+array(void)
+{
+ Type *tp, *base;
+ Node *size;
+
+ size = pop();
+ base = pop();
+ tp = pop();
+ tp->size = size->u.i * base->size; /* FIXME check for overflow */
+ tp->align = base->align;
+
+ delnode(size);
+}
+
+static void
+decl(Symbol *sym)
+{
+ Type *tp = &sym->type;
+
+ if (tp->flags & FUNF) {
+ lastfun = sym;
+ } else {
+ switch (sym->kind) {
+ case SEXTRN:
+ case SGLOB:
+ case SPRIV:
+ case SLOCAL:
+ defglobal(sym);
+ break;
+ case SAUTO:
+ case SREG:
+ if (!curfun)
+ error(ESYNTAX);
+ ((inpars) ? defpar : defvar)(sym);
+ break;
+ default:
+ abort();
+ }
+ }
+}
+
+static void
+vardecl(void)
+{
+ Type *tp, *rp;
+ Node *np;
+ Symbol *sym;
+ char *name;
+
+ name = pop();
+ tp = pop();
+ if (tp->flags & FUNF)
+ rp = pop();
+ np = pop();
+
+ sym = np->u.sym;
+ /*
+ * We have to free sym->name because in tentative declarations
+ * we can have multiple declarations of the same symbol, and in
+ * this case our parser will allocate twice the memory
+ */
+ free(sym->name);
+ sym->name = name;
+ sym->type = *tp;
+ if (tp->flags & FUNF)
+ sym->rtype = *rp;
+ sym->kind = sclass;
+
+ if (ininit)
+ sym->type.flags |= INITF;
+ decl(sym);
+ delnode(np);
+}
+
+static void
+flddecl(void)
+{
+ Node *off, *np;
+ char *name;
+ Type *tp;
+ Symbol *sym;
+
+ off = pop();
+ name = pop();
+ tp = pop();
+ np = pop();
+
+ sym = np->u.sym;
+ sym->u.off = off->u.i;
+ sym->name = name;
+ sym->type = *tp;
+
+ delnode(np);
+ delnode(off);
+}
+
+static void
+labeldcl(void)
+{
+ Node *np;
+ Symbol *sym;
+
+ np = pop();
+ np->op = ONOP;
+ sym = np->u.sym;
+ sym->kind = SLABEL;
+ sym->u.stmt = np;
+ np->label = sym;
+ addstmt(np, SETCUR);
+}
+
+static void
+stmt(void)
+{
+ Node *np;
+
+ if (empty())
+ return;
+ np = pop();
+ if (ininit) {
+ data(np);
+ deltree(np);
+ return;
+ }
+ addstmt(np, SETCUR);
+}
+
+static void
+beginfun(void)
+{
+ curfun = lastfun;
+ inpars = 1;
+ pushctx();
+ addstmt(node(OBFUN), SETCUR);
+}
+
+static void
+endfun(void)
+{
+ endf = 1;
+ addstmt(node(OEFUN), SETCUR);
+}
+
+void
+parse(void)
+{
+ cleannodes(); /* remove code of previous function */
+ popctx(); /* remove context of previous function */
+ curfun = NULL;
+ endf = 0;
+
+ while (!endf && nextline())
+ ;
+ if (ferror(stdin))
+ error(EFERROR, strerror(errno));
+}
--- /dev/null
+++ b/src/cc2/peep.c
@@ -1,0 +1,8 @@
+static char sccsid[] = "@(#) ./cc2/peep.c";
+#include <scc/scc.h>
+#include "cc2.h"
+
+void
+peephole(void)
+{
+}
--- /dev/null
+++ b/src/cc2/symbol.c
@@ -1,0 +1,92 @@
+static char sccsid[] = "@(#) ./cc2/symbol.c";
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+
+#include "cc2.h"
+
+#define NR_SYMHASH 64
+
+Symbol *locals;
+
+static Symbol *symtab[NR_SYMHASH], *curlocal;
+static int infunction;
+
+
+void
+freesym(Symbol *sym)
+{
+ free(sym->name);
+ free(sym);
+}
+
+void
+pushctx(void)
+{
+ infunction = 1;
+}
+
+void
+popctx(void)
+{
+ Symbol *sym, *next;
+
+ infunction = 0;
+ for (sym = locals; sym; sym = next) {
+ next = sym->next;
+ /*
+ * Symbols are inserted in the hash in the inverted
+ * order they are found in locals and it is impossible
+ * to have a global over a local, because a local is
+ * any symbol defined in the body of a function,
+ * even if it has extern linkage.
+ * For this reason when we reach a symbol in the
+ * locals list we know that it is the head of it
+ * collision list and we can remove it assigning
+ * it h_next to the hash table position
+ */
+ if (sym->id != TMPSYM)
+ symtab[sym->id & NR_SYMHASH-1] = sym->h_next;
+ freesym(sym);
+ }
+ curlocal = locals = NULL;
+}
+
+Symbol *
+getsym(unsigned id)
+{
+ Symbol **htab, *sym;
+ static unsigned short num;
+
+ if (id >= USHRT_MAX)
+ error(EBADID);
+
+ if (id != TMPSYM) {
+ htab = &symtab[id & NR_SYMHASH-1];
+ for (sym = *htab; sym; sym = sym->h_next) {
+ if (sym->id == id)
+ return sym;
+ }
+ }
+
+ sym = xcalloc(1, sizeof(*sym));
+ sym->id = id;
+ if (infunction) {
+ if (!locals)
+ locals = sym;
+ if (curlocal)
+ curlocal->next = sym;
+ curlocal = sym;
+ }
+ if (id != TMPSYM) {
+ sym->h_next = *htab;
+ *htab = sym;
+ }
+ if ((sym->numid = ++num) == 0)
+ error(EIDOVER);
+
+ return sym;
+}
--- /dev/null
+++ b/src/cc2/target/amd64-sysv/cgen.c
@@ -1,0 +1,15 @@
+static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/cgen.c";
+
+#include "arch.h"
+#include <scc/scc.h>
+#include "../../cc2.h"
+
+Node *
+cgen(Node *np)
+{
+}
+
+Node *
+sethi(Node *np)
+{
+}
--- /dev/null
+++ b/src/cc2/target/amd64-sysv/code.c
@@ -1,0 +1,211 @@
+static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/code.c";
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+enum segment {
+ CODESEG,
+ DATASEG,
+ BSSSEG,
+ NOSEG
+};
+
+static int curseg = NOSEG;
+
+static void
+segment(int seg)
+{
+ static char *txt[] = {
+ [CODESEG] = "\t.text\n",
+ [DATASEG] = "\t.data\n",
+ [BSSSEG] = "\t.bss\n",
+ };
+
+ if (seg == curseg)
+ return;
+ fputs(txt[seg], stdout);
+ curseg = seg;
+}
+
+static char *
+symname(Symbol *sym)
+{
+ static char name[INTIDENTSIZ+1];
+
+ if (sym->name) {
+ switch (sym->kind) {
+ case SEXTRN:
+ case SGLOB:
+ case SPRIV:
+ return sym->name;
+ }
+ }
+
+ sprintf(name, ".L%d", sym->numid);
+
+ return name;
+}
+
+static void
+emitconst(Node *np)
+{
+ switch (np->type.size) {
+ case 1:
+ printf("%d", (int) np->u.i & 0xFF);
+ break;
+ case 2:
+ printf("%d", (int) np->u.i & 0xFFFF);
+ break;
+ case 4:
+ printf("%ld", (long) np->u.i & 0xFFFFFFFF);
+ break;
+ case 8:
+ printf("%lld", (long long) np->u.i & 0xFFFFFFFF);
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+emittree(Node *np)
+{
+ if (!np)
+ return;
+
+ switch (np->op) {
+ case OSTRING:
+ printf("\"%s\"", np->u.s);
+ free(np->u.s);
+ np->u.s = NULL;
+ break;
+ case OCONST:
+ emitconst(np);
+ break;
+ case OADDR:
+ emittree(np->left);
+ break;
+ case OMEM:
+ fputs(symname(np->u.sym), stdout);
+ break;
+ default:
+ emittree(np->left);
+ printf(" %c ", np->op);
+ emittree(np->right);
+ break;
+ }
+}
+static void
+size2asm(Type *tp)
+{
+ char *s;
+
+ if (tp->flags & STRF) {
+ s = "\t.ascii\t";
+ } else {
+ switch (tp->size) {
+ case 1:
+ s = "\t.byte\t";
+ break;
+ case 2:
+ s = "\t.short\t";
+ break;
+ case 4:
+ s = "\t.long\t";
+ break;
+ case 8:
+ s = "\t.quad\t";
+ break;
+ default:
+ s = "\t.space\t%lu,";
+ break;
+ }
+ }
+ printf(s, tp->size);
+}
+
+
+void
+data(Node *np)
+{
+ size2asm(&np->type);
+ emittree(np);
+ putchar('\n');
+}
+
+static void
+label(Symbol *sym)
+{
+ int seg;
+ char *name = symname(sym);
+ Type *tp = &sym->type;
+
+ if (sym->type.flags & FUNF)
+ seg = CODESEG;
+ else if (sym->type.flags & INITF)
+ seg = DATASEG;
+ else
+ seg = BSSSEG;
+ segment(seg);
+
+ switch (sym->kind) {
+ case SEXTRN:
+ printf("\t.extern\t%s\n", name);
+ case SLOCAL:
+ return;
+ case SGLOB:
+ printf("\t.global\t%s\n", name);
+ if (seg == BSSSEG)
+ printf("\t.comm\t%s,%lu\n", name, tp->size);
+ break;
+ }
+ if (sym->type.align != 1)
+ printf("\t.align\t%lu\n", sym->type.align );
+ printf("%s:\n", name);
+}
+
+void
+defglobal(Symbol *sym)
+{
+ label(sym);
+ if (sym->kind == SEXTRN || (sym->type.flags & INITF))
+ return;
+ size2asm(&sym->type);
+ puts("0");
+}
+
+void
+defvar(Symbol *sym)
+{
+}
+
+void
+defpar(Symbol *sym)
+{
+}
+
+void
+newfun(void)
+{
+}
+
+void
+writeout(void)
+{
+}
+
+void
+endinit(void)
+{
+}
+
+void
+getbblocks(void)
+{
+}
--- /dev/null
+++ b/src/cc2/target/amd64-sysv/optm.c
@@ -1,0 +1,11 @@
+static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/optm.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+Node *
+optm_dep(Node *np)
+{
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/amd64-sysv/target.mk
@@ -1,0 +1,8 @@
+OBJ-amd64-sysv = $(OBJS) \
+ target/amd64-sysv/cgen.o \
+ target/amd64-sysv/optm.o \
+ target/amd64-sysv/code.o \
+ target/amd64-sysv/types.o
+
+$(LIBEXEC)/cc2-amd64-sysv: $(OBJ-amd64-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-amd64-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc2/target/amd64-sysv/types.c
@@ -1,0 +1,94 @@
+static char sccsid[] = "@(#) ./cc2/arch/amd64-sysv/types.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+
+Type int8type = {
+ .flags = SIGNF | INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type int16type = {
+ .flags = SIGNF | INTF,
+ .size = 2,
+ .align = 2
+};
+
+Type int32type = {
+ .flags = SIGNF | INTF,
+ .size = 4,
+ .align = 4
+};
+
+Type int64type = {
+ .flags = SIGNF | INTF,
+ .size = 8,
+ .align = 8
+};
+
+Type uint8type = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type uint16type = {
+ .flags = INTF,
+ .size = 2,
+ .align = 2
+};
+
+Type uint32type = {
+ .flags = INTF,
+ .size = 4,
+ .align = 4
+};
+
+Type uint64type = {
+ .flags = INTF,
+ .size = 8,
+ .align = 2
+};
+
+Type ptrtype = {
+ .flags = INTF,
+ .size = 8,
+ .align = 8
+};
+
+Type booltype = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type float32type = {
+ .flags = FLOATF,
+ .size = 4,
+ .align = 4
+};
+
+Type float64type = {
+ .flags = FLOATF,
+ .size = 8,
+ .align = 8
+};
+
+Type float80type = {
+ .flags = FLOATF,
+ .size = 16,
+ .align = 16
+};
+
+Type voidtype = {
+ .size = 0,
+ .align = 0
+};
+
+Type arg_type = {
+ .size = 24,
+ .align = 8
+};
--- /dev/null
+++ b/src/cc2/target/i386-sysv/cgen.c
@@ -1,0 +1,16 @@
+static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/cgen.c";
+
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+Node *
+cgen(Node *np)
+{
+}
+
+Node *
+sethi(Node *np)
+{
+}
--- /dev/null
+++ b/src/cc2/target/i386-sysv/code.c
@@ -1,0 +1,209 @@
+static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/code.c";
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+enum segment {
+ CODESEG,
+ DATASEG,
+ BSSSEG,
+ NOSEG
+};
+
+static int curseg = NOSEG;
+
+static void
+segment(int seg)
+{
+ static char *txt[] = {
+ [CODESEG] = "\t.text\n",
+ [DATASEG] = "\t.data\n",
+ [BSSSEG] = "\t.bss\n",
+ };
+
+ if (seg == curseg)
+ return;
+ fputs(txt[seg], stdout);
+ curseg = seg;
+}
+
+static char *
+symname(Symbol *sym)
+{
+ static char name[INTIDENTSIZ+1];
+
+ if (sym->name) {
+ switch (sym->kind) {
+ case SEXTRN:
+ case SGLOB:
+ case SPRIV:
+ return sym->name;
+ }
+ }
+
+ sprintf(name, ".L%d", sym->numid);
+
+ return name;
+}
+
+static void
+emitconst(Node *np)
+{
+ switch (np->type.size) {
+ case 1:
+ printf("%d", (int) np->u.i & 0xFF);
+ break;
+ case 2:
+ printf("%d", (int) np->u.i & 0xFFFF);
+ break;
+ case 4:
+ printf("%ld", (long) np->u.i & 0xFFFFFFFF);
+ break;
+ case 8:
+ printf("%lld", (long long) np->u.i & 0xFFFFFFFF);
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+emittree(Node *np)
+{
+ if (!np)
+ return;
+
+ switch (np->op) {
+ case OSTRING:
+ printf("\"%s\"", np->u.s);
+ free(np->u.s);
+ np->u.s = NULL;
+ break;
+ case OCONST:
+ emitconst(np);
+ break;
+ case OADDR:
+ emittree(np->left);
+ break;
+ case OMEM:
+ fputs(symname(np->u.sym), stdout);
+ break;
+ default:
+ emittree(np->left);
+ printf(" %c ", np->op);
+ emittree(np->right);
+ break;
+ }
+}
+static void
+size2asm(Type *tp)
+{
+ char *s;
+
+ if (tp->flags & STRF) {
+ s = "\t.ascii\t";
+ } else {
+ switch (tp->size) {
+ case 1:
+ s = "\t.byte\t";
+ break;
+ case 2:
+ s = "\t.short\t";
+ break;
+ case 4:
+ s = "\t.long\t";
+ break;
+ case 8:
+ s = "\t.quad\t";
+ break;
+ default:
+ s = "\t.space\t%lu,";
+ break;
+ }
+ }
+ printf(s, tp->size);
+}
+
+void
+data(Node *np)
+{
+ size2asm(&np->type);
+ emittree(np);
+ putchar('\n');
+}
+
+static void
+label(Symbol *sym)
+{
+ int seg;
+ char *name = symname(sym);
+ Type *tp = &sym->type;
+
+ if (sym->type.flags & FUNF)
+ seg = CODESEG;
+ else if (sym->type.flags & INITF)
+ seg = DATASEG;
+ else
+ seg = BSSSEG;
+ segment(seg);
+
+ switch (sym->kind) {
+ case SEXTRN:
+ printf("\t.extern\t%s\n", name);
+ case SLOCAL:
+ return;
+ case SGLOB:
+ printf("\t.global\t%s\n", name);
+ if (seg == BSSSEG)
+ printf("\t.comm\t%s,%lu\n", name, tp->size);
+ break;
+ }
+ if (sym->type.align != 1)
+ printf("\t.align\t%lu\n", sym->type.align );
+ printf("%s:\n", name);
+}
+
+void
+defglobal(Symbol *sym)
+{
+ label(sym);
+ if (sym->kind == SEXTRN || (sym->type.flags & INITF))
+ return;
+ size2asm(&sym->type);
+ puts("0");
+}
+
+void
+defpar(Symbol *sym)
+{
+}
+
+void
+defvar(Symbol *sym)
+{
+}
+
+void
+newfun(void)
+{
+}
+
+void
+writeout(void)
+{
+}
+
+void
+endinit(void)
+{
+}
+
+void
+getbblocks(void)
+{
+}
--- /dev/null
+++ b/src/cc2/target/i386-sysv/optm.c
@@ -1,0 +1,11 @@
+static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/optm.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+Node *
+optm_dep(Node *np)
+{
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/i386-sysv/target.mk
@@ -1,0 +1,8 @@
+OBJ-i386-sysv = $(OBJS) \
+ target/i386-sysv/cgen.o \
+ target/i386-sysv/optm.o \
+ target/i386-sysv/code.o \
+ target/i386-sysv/types.o
+
+$(LIBEXEC)/cc2-i386-sysv: $(OBJ-i386-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-i386-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc2/target/i386-sysv/types.c
@@ -1,0 +1,95 @@
+static char sccsid[] = "@(#) ./cc2/arch/i386-sysv/types.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+
+Type int8type = {
+ .flags = SIGNF | INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type int16type = {
+ .flags = SIGNF | INTF,
+ .size = 2,
+ .align = 2
+};
+
+Type int32type = {
+ .flags = SIGNF | INTF,
+ .size = 4,
+ .align = 4
+};
+
+Type int64type = {
+ .flags = SIGNF | INTF,
+ .size = 8,
+ .align = 4
+};
+
+Type uint8type = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type uint16type = {
+ .flags = INTF,
+ .size = 2,
+ .align = 2
+};
+
+Type uint32type = {
+ .flags = INTF,
+ .size = 4,
+ .align = 2
+};
+
+Type uint64type = {
+ .flags = INTF,
+ .size = 8,
+ .align = 4
+};
+
+Type ptrtype = {
+ .flags = INTF,
+ .size = 4,
+ .align = 4
+};
+
+Type booltype = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type float32type = {
+ .flags = FLOATF,
+ .size = 4,
+ .align = 4
+};
+
+Type float64type = {
+ .flags = FLOATF,
+ .size = 8,
+ .align = 4
+};
+
+Type float80type = {
+ .flags = FLOATF,
+ .size = 12,
+ .align = 4
+};
+
+Type voidtype = {
+ .size = 0,
+ .align = 0
+};
+
+/* this type is not used in this architecture */
+Type arg_type = {
+ .size = 0,
+ .align = 0
+};
--- /dev/null
+++ b/src/cc2/target/qbe/arch.h
@@ -1,0 +1,135 @@
+enum asmop {
+ ASNOP = 0,
+ ASSTB,
+ ASSTH,
+ ASSTW,
+ ASSTL,
+ ASSTM,
+ ASSTS,
+ ASSTD,
+
+ ASLDSB,
+ ASLDUB,
+ ASLDSH,
+ ASLDUH,
+ ASLDSW,
+ ASLDUW,
+ ASLDL,
+ ASLDS,
+ ASLDD,
+
+ ASADDW,
+ ASSUBW,
+ ASMULW,
+ ASMODW,
+ ASUMODW,
+ ASDIVW,
+ ASUDIVW,
+ ASSHLW,
+ ASSHRW,
+ ASUSHRW,
+ ASLTW,
+ ASULTW,
+ ASGTW,
+ ASUGTW,
+ ASLEW,
+ ASULEW,
+ ASGEW,
+ ASUGEW,
+ ASEQW,
+ ASNEW,
+ ASBANDW,
+ ASBORW,
+ ASBXORW,
+
+ ASADDL,
+ ASSUBL,
+ ASMULL,
+ ASMODL,
+ ASUMODL,
+ ASDIVL,
+ ASUDIVL,
+ ASSHLL,
+ ASSHRL,
+ ASUSHRL,
+ ASLTL,
+ ASULTL,
+ ASGTL,
+ ASUGTL,
+ ASLEL,
+ ASULEL,
+ ASGEL,
+ ASUGEL,
+ ASEQL,
+ ASNEL,
+ ASBANDL,
+ ASBORL,
+ ASBXORL,
+
+ ASADDS,
+ ASSUBS,
+ ASMULS,
+ ASDIVS,
+ ASLTS,
+ ASGTS,
+ ASLES,
+ ASGES,
+ ASEQS,
+ ASNES,
+
+ ASADDD,
+ ASSUBD,
+ ASMULD,
+ ASDIVD,
+ ASLTD,
+ ASGTD,
+ ASLED,
+ ASGED,
+ ASEQD,
+ ASNED,
+
+ ASEXTBW,
+ ASUEXTBW,
+ ASEXTBL,
+ ASUEXTBL,
+ ASEXTHW,
+ ASUEXTHW,
+ ASEXTHL,
+ ASUEXTHL,
+ ASEXTWL,
+ ASUEXTWL,
+
+ ASSTOL,
+ ASSTOW,
+ ASDTOL,
+ ASDTOW,
+
+ ASSWTOD,
+ ASSWTOS,
+ ASSLTOD,
+ ASSLTOS,
+
+ ASEXTS,
+ ASTRUNCD,
+
+ ASJMP,
+ ASBRANCH,
+ ASRET,
+ ASCALL,
+ ASCALLE,
+ ASCALLEX,
+ ASPAR,
+ ASPARE,
+ ASALLOC,
+ ASFORM,
+
+ ASCOPYB,
+ ASCOPYH,
+ ASCOPYW,
+ ASCOPYL,
+ ASCOPYS,
+ ASCOPYD,
+
+ ASVSTAR,
+ ASVARG,
+};
--- /dev/null
+++ b/src/cc2/target/qbe/cgen.c
@@ -1,0 +1,729 @@
+static char sccsid[] = "@(#) ./cc2/arch/qbe/cgen.c";
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+enum sflags {
+ ISTMP = 1,
+ ISCONS = 2
+};
+
+static char opasmw[] = {
+ [OADD] = ASADDW,
+ [OSUB] = ASSUBW,
+ [OMUL] = ASMULW,
+ [OMOD] = ASMODW,
+ [ODIV] = ASDIVW,
+ [OSHL] = ASSHLW,
+ [OSHR] = ASSHRW,
+ [OLT] = ASLTW,
+ [OGT] = ASGTW,
+ [OLE] = ASLEW,
+ [OGE] = ASGEW,
+ [OEQ] = ASEQW,
+ [ONE] = ASNEW,
+ [OBAND] = ASBANDW,
+ [OBOR] = ASBORW,
+ [OBXOR] = ASBXORW,
+};
+
+static char opasml[] = {
+ [OADD] = ASADDL,
+ [OSUB] = ASSUBL,
+ [OMUL] = ASMULL,
+ [OMOD] = ASMODL,
+ [ODIV] = ASDIVL,
+ [OSHL] = ASSHLL,
+ [OSHR] = ASSHRL,
+ [OLT] = ASLTL,
+ [OGT] = ASGTL,
+ [OLE] = ASLEL,
+ [OGE] = ASGEL,
+ [OEQ] = ASEQL,
+ [ONE] = ASNEL,
+ [OBAND] = ASBANDL,
+ [OBOR] = ASBORL,
+ [OBXOR] = ASBXORL,
+};
+
+static char opasms[] = {
+ [OADD] = ASADDS,
+ [OSUB] = ASSUBS,
+ [OMUL] = ASMULS,
+ [ODIV] = ASDIVS,
+ [OLT] = ASLTS,
+ [OGT] = ASGTS,
+ [OLE] = ASLES,
+ [OGE] = ASGES,
+ [OEQ] = ASEQS,
+ [ONE] = ASNES,
+};
+static char opasmd[] = {
+ [OADD] = ASADDD,
+ [OSUB] = ASSUBD,
+ [OMUL] = ASMULD,
+ [ODIV] = ASDIVD,
+ [OLT] = ASLTD,
+ [OGT] = ASGTD,
+ [OLE] = ASLED,
+ [OGE] = ASGED,
+ [OEQ] = ASEQD,
+ [ONE] = ASNED,
+};
+
+extern Type int32type, uint32type, ptrtype;
+
+static Node *
+tmpnode(Node *np, Type *tp)
+{
+ char flags;
+ Symbol *sym;
+
+ if (!np)
+ np = node(OTMP);
+ sym = getsym(TMPSYM);
+ sym->type = np->type = *tp;
+ flags = tp->flags & ~(PARF|INITF);
+ sym->type.flags = np->type.flags = flags;
+ sym->kind = STMP;
+ np->left = np->right = NULL;
+ np->u.sym = sym;
+ np->op = OTMP;
+ np->flags |= ISTMP;
+ return np;
+}
+
+static Node *
+load(Type *tp, Node *np, Node *new)
+{
+ int op;
+ int flags = tp->flags;
+
+ if (flags & (AGGRF|FUNF)) {
+ *new = *np;
+ return new;
+ }
+ switch (tp->size) {
+ case 1:
+ op = ASLDSB;
+ break;
+ case 2:
+ op = ASLDSH;
+ break;
+ case 4:
+ op = (flags & FLOATF) ? ASLDS : ASLDSW;
+ break;
+ case 8:
+ op = (flags & FLOATF) ? ASLDD : ASLDL;
+ break;
+ default:
+ abort();
+ }
+ /*
+ * unsigned version of operations are always +1 the
+ * signed version
+ */
+ if ((flags & (INTF|SIGNF)) == INTF && tp->size < 8)
+ ++op;
+
+ code(op, tmpnode(new, tp), np, NULL);
+
+ return new;
+}
+
+static Node *rhs(Node *np, Node *new);
+
+static Node *
+cast(Type *td, Node *ns, Node *nd)
+{
+ Type *ts;
+ Node aux1, aux2;
+ int op, d_isint, s_isint;
+
+ ts = &ns->type;
+ d_isint = (td->flags & INTF) != 0;
+ s_isint = (ts->flags & INTF) != 0;
+
+ if (d_isint && s_isint) {
+ if (td->size <= ts->size) {
+ *nd = *ns;
+ return nd;
+ }
+ assert(td->size == 4 || td->size == 8);
+ switch (ts->size) {
+ case 1:
+ op = (td->size == 4) ? ASEXTBW : ASEXTBL;
+ break;
+ case 2:
+ op = (td->size == 4) ? ASEXTHW : ASEXTHL;
+ break;
+ case 4:
+ op = ASEXTWL;
+ break;
+ default:
+ abort();
+ }
+ /*
+ * unsigned version of operations are always +1 the
+ * signed version
+ */
+ op += (ts->flags & SIGNF) == 0;
+ } else if (d_isint) {
+ /* conversion from float to int */
+ switch (ts->size) {
+ case 4:
+ op = (td->size == 8) ? ASSTOL : ASSTOW;
+ break;
+ case 8:
+ op = (td->size == 8) ? ASDTOL : ASDTOW;
+ break;
+ default:
+ abort();
+ }
+ /* TODO: Add signess */
+ } else if (s_isint) {
+ /* conversion from int to float */
+ switch (ts->size) {
+ case 1:
+ case 2:
+ ts = (ts->flags&SIGNF) ? &int32type : &uint32type;
+ ns = cast(ts, ns, tmpnode(&aux2, ts));
+ case 4:
+ op = (td->size == 8) ? ASSWTOD : ASSWTOS;
+ break;
+ case 8:
+ op = (td->size == 8) ? ASSLTOD : ASSLTOS;
+ break;
+ default:
+ abort();
+ }
+ /* TODO: Add signess */
+ } else {
+ /* conversion from float to float */
+ op = (td->size == 4) ? ASEXTS : ASTRUNCD;
+ }
+
+ code(op, tmpnode(nd, td), ns, NULL);
+ return nd;
+}
+
+static Node *
+call(Node *np, Node *fun, Node *ret)
+{
+ int n, op;
+ Type *tp;
+ Node aux, **q, *p, *pars[NR_FUNPARAM];
+
+ for (n = 0, p = np->right; p; p = p->right)
+ pars[n++] = rhs(p->left, node(OTMP));
+
+ tp = &np->type;
+ code(ASCALL, tmpnode(ret, tp), fun, NULL);
+
+ for (q = pars; q < &pars[n]; ++q) {
+ op = (q == &pars[n-1]) ? ASPARE : ASPAR;
+ tmpnode(&aux, &(*q)->type);
+ code(op, NULL, *q, &aux);
+ }
+ code((np->op == OCALL) ? ASCALLE : ASCALLEX, NULL, NULL, NULL);
+
+ return ret;
+}
+
+static Node *
+assign(Type *tp, Node *to, Node *from)
+{
+ int op;
+
+ switch (tp->size) {
+ case 1:
+ op = ASSTB;
+ break;
+ case 2:
+ op = ASSTH;
+ break;
+ case 4:
+ op = (tp->flags & FLOATF) ? ASSTS : ASSTW;
+ break;
+ case 8:
+ op = (tp->flags & FLOATF) ? ASSTD : ASSTL;
+ break;
+ default:
+ op = ASSTM;
+ break;
+ }
+ code(op, to, from, NULL);
+ return from;
+}
+
+static Node *
+copy(Type *tp, Node *to, Node *from)
+{
+ int op;
+
+ switch (tp->size) {
+ case 1:
+ op = ASCOPYB;
+ break;
+ case 2:
+ op = ASCOPYH;
+ break;
+ case 4:
+ op = (tp->flags & FLOATF) ? ASCOPYS : ASCOPYW;
+ break;
+ case 8:
+ op = (tp->flags & FLOATF) ? ASCOPYD : ASCOPYL;
+ break;
+ default:
+ /* TODO: Need to handle the general case */
+ abort();
+ }
+ code(op, to, from, NULL);
+ return from;
+}
+
+/* TODO: Do field() transformation in sethi */
+
+static Node *
+field(Node *np, Node *ret, int islhs)
+{
+ Node base, node, off, add, *addr;
+ TUINT offset = np->right->u.sym->u.off;
+
+ addr = rhs(np->left, &base);
+
+ if (offset != 0) {
+ node.op = OADD;
+ node.type = ptrtype;
+ node.left = addr;
+ node.right = constnode(&off, offset, &ptrtype);
+ addr = rhs(&node, &add);
+ }
+
+ if (islhs)
+ *ret = *addr;
+ else
+ load(&np->type, addr, ret);
+
+ return ret;
+}
+
+static Node *
+lhs(Node *np, Node *new)
+{
+ switch (np->op) {
+ case OMEM:
+ case OAUTO:
+ *new = *np;
+ return new;
+ case OPTR:
+ return rhs(np->left, new);
+ case OFIELD:
+ return field(np, new, 1);
+ default:
+ abort();
+ }
+}
+
+static void
+bool(Node *np, Symbol *true, Symbol *false)
+{
+ Node *l = np->left, *r = np->right;
+ Node ret, ifyes, ifno;
+ Symbol *label;
+
+ switch (np->op) {
+ case ONEG:
+ bool(l, false, true);
+ break;
+ case OAND:
+ label = newlabel();
+ bool(l, label, false);
+ setlabel(label);
+ bool(r, true, false);
+ break;
+ case OOR:
+ label = newlabel();
+ bool(l, true, label);
+ setlabel(label);
+ bool(r, true, false);
+ break;
+ default:
+ label2node(&ifyes, true);
+ label2node(&ifno, false);
+ code(ASBRANCH, rhs(np, &ret), &ifyes, &ifno);
+ break;
+ }
+}
+
+static Node *
+ternary(Node *np, Node *ret)
+{
+ Node ifyes, ifno, phi, *colon, aux1, aux2, aux3;
+
+ tmpnode(ret, &np->type);
+ label2node(&ifyes, NULL);
+ label2node(&ifno, NULL);
+ label2node(&phi, NULL);
+
+ colon = np->right;
+ code(ASBRANCH, rhs(np->left, &aux1), &ifyes, &ifno);
+
+ setlabel(ifyes.u.sym);
+ copy(&ret->type, ret, rhs(colon->left, &aux2));
+ code(ASJMP, NULL, &phi, NULL);
+
+ setlabel(ifno.u.sym);
+ copy(&ret->type, ret, rhs(colon->right, &aux3));
+ setlabel(phi.u.sym);
+
+ return ret;
+}
+
+static Node *
+function(void)
+{
+ Node aux;
+ Symbol *p;
+
+ /* allocate stack space for parameters */
+ for (p = locals; p && (p->type.flags & PARF) != 0; p = p->next)
+ code(ASALLOC, label2node(&aux, p), NULL, NULL);
+
+ /* allocate stack space for local variables) */
+ for ( ; p && p->id != TMPSYM; p = p->next) {
+ if (p->kind != SAUTO)
+ continue;
+ code(ASALLOC, label2node(&aux, p), NULL, NULL);
+ }
+ /* store formal parameters in parameters */
+ for (p = locals; p; p = p->next) {
+ if ((p->type.flags & PARF) == 0)
+ break;
+ code(ASFORM, label2node(&aux, p), NULL, NULL);
+ }
+ return NULL;
+}
+
+static void
+swtch_if(Node *idx)
+{
+ Node aux1, aux2, *np;
+ Symbol *deflabel = NULL;
+
+ for (;;) {
+ np = delstmt();
+ setlabel(np->label);
+
+ switch (np->op) {
+ case OESWITCH:
+ if (!deflabel)
+ deflabel = np->u.sym;
+ aux1.op = OJMP;
+ aux1.label = NULL;
+ aux1.u.sym = deflabel;
+ cgen(&aux1);
+ return;
+ case OCASE:
+ aux1 = *np;
+ aux1.op = OBRANCH;
+ aux1.label = NULL;
+ aux1.left = &aux2;
+
+ aux2.op = OEQ;
+ aux2.type = idx->type;
+ aux2.left = np->left;
+ aux2.right = idx;
+
+ cgen(&aux1);
+ break;
+ case ODEFAULT:
+ deflabel = np->u.sym;
+ break;
+ default:
+ abort();
+ }
+ }
+}
+
+static Node *
+rhs(Node *np, Node *ret)
+{
+ Node aux1, aux2, *phi, *l = np->left, *r = np->right;
+ Type *tp;
+ int off, op;
+ char *tbl;
+ Symbol *true, *false;
+
+ tp = &np->type;
+
+ switch (np->op) {
+ case OBFUN:
+ return function();
+ case ONOP:
+ case OBLOOP:
+ case OELOOP:
+ case OEFUN:
+ return NULL;
+ case OTMP:
+ case OCONST:
+ *ret = *np;
+ return np;
+ case OMEM:
+ case OAUTO:
+ return load(tp, np, ret);
+ case ONEG:
+ case OAND:
+ case OOR:
+ true = newlabel();
+ false = newlabel();
+ phi = label2node(&aux1, NULL);
+ tmpnode(ret, &int32type);
+
+ bool(np, true, false);
+
+ setlabel(true);
+ code(ASCOPYW, ret, constnode(&aux2, 1, &int32type), NULL);
+ code(ASJMP, NULL, phi, NULL);
+
+ setlabel(false);
+ code(ASCOPYW, ret, constnode(&aux2, 0, &int32type), NULL);
+
+ setlabel(phi->u.sym);
+ return ret;
+ case OMOD:
+ case OSHR:
+ assert(tp->flags & INTF);
+ case ODIV:
+ case OLT:
+ case OGT:
+ case OLE:
+ case OGE:
+ /*
+ * unsigned version of operations are always +1 the
+ * signed version
+ */
+ off = (tp->flags & SIGNF) == 0;
+ goto binary;
+ case OSHL:
+ case OBAND:
+ case OBOR:
+ case OBXOR:
+ assert(tp->flags & INTF);
+ case OADD:
+ case OSUB:
+ case OMUL:
+ case OEQ:
+ case ONE:
+ off = 0;
+ binary:
+ if (l->complex >= r->complex) {
+ rhs(l, &aux1);
+ rhs(r, &aux2);
+ } else {
+ rhs(r, &aux2);
+ rhs(l, &aux1);
+ }
+ switch (tp->size) {
+ case 4:
+ tbl = (tp->flags & FLOATF) ? opasms : opasmw;
+ break;
+ case 8:
+ tbl = (tp->flags & FLOATF) ? opasmd : opasml;
+ break;
+ default:
+ abort();
+ }
+ op = tbl[np->op] + off;
+ tmpnode(ret, tp);
+ code(op, ret, &aux1, &aux2);
+ return ret;
+ case OCALL:
+ case OCALLE:
+ if (l->op == OPTR)
+ l = rhs(l, &aux1);
+ return call(np, l, ret);
+ case OCAST:
+ return cast(tp, rhs(l, &aux1), ret);
+ case OASSIG:
+ /* TODO: Do this transformations in sethi */
+ switch (np->u.subop) {
+ case OINC:
+ op = OADD;
+ goto post_oper;
+ case ODEC:
+ op = OSUB;
+ post_oper:
+ aux1.op = op;
+ aux1.left = rhs(l, ret);
+ aux1.right = r;
+ aux1.type = np->type;
+ rhs(&aux1, &aux2);
+ lhs(l, &aux1);
+ assign(tp, &aux1, &aux2);
+ break;
+ default:
+ aux2.type = np->type;
+ aux2.op = np->u.subop;
+ aux2.right = np->right;
+ aux2.left = np->left;
+ r = rhs(&aux2, &aux1);
+ Node aux3;
+ if (l->op == OCAST) {
+ aux3.type = l->left->type;
+ aux3.op = OCAST;
+ aux3.left = r;
+ aux3.right = NULL;
+ r = &aux3;
+ l = l->left;
+ }
+ case 0:
+ /* TODO: see what is the most difficult */
+ lhs(l, &aux2);
+ rhs(r, ret);
+ return assign(tp, &aux2, ret);
+ }
+ return ret;
+ case OASK:
+ return ternary(np, ret);
+ case OCOMMA:
+ rhs(l, &aux1);
+ return rhs(r, ret);
+ case OPTR:
+ return load(tp, rhs(l, &aux1), ret);
+ case OADDR:
+ lhs(l, ret);
+ ret->type = *tp;
+ return ret;
+ case OFIELD:
+ return field(np, ret, 0);
+ case OBUILTIN:
+ switch (np->u.subop) {
+ case BVA_START:
+ l = rhs(l, &aux1);
+ code(ASVSTAR, NULL, l, NULL);
+ return NULL;
+ case BVA_END:
+ return NULL;
+ case BVA_ARG:
+ l = rhs(l, &aux1);
+ code(ASVARG, tmpnode(ret, tp), l, NULL);
+ return ret;
+ case BVA_COPY:
+ /* TODO */
+ default:
+ abort();
+ }
+ default:
+ abort();
+ }
+ abort();
+}
+
+Node *
+cgen(Node *np)
+{
+ Node aux, *p, *next;
+
+ setlabel(np->label);
+ switch (np->op) {
+ case OJMP:
+ label2node(&aux, np->u.sym);
+ code(ASJMP, NULL, &aux, NULL);
+ break;
+ case OBRANCH:
+ next = np->next;
+ if (!next->label)
+ next->label = newlabel();
+ bool(np->left, np->u.sym, next->label);
+ break;
+ case ORET:
+ p = (np->left) ? rhs(np->left, &aux) : NULL;
+ code(ASRET, NULL, p, NULL);
+ break;
+ case OBSWITCH:
+ p = rhs(np->left, &aux);
+ swtch_if(p);
+ break;
+ default:
+ rhs(np, &aux);
+ break;
+ }
+ return NULL;
+}
+
+/*
+ * This is strongly influenced by
+ * http://plan9.bell-labs.com/sys/doc/compiler.ps (/sys/doc/compiler.ps)
+ * calculate addresability as follows
+ * AUTO => 11 value+fp
+ * REG => 11 reg
+ * STATIC => 11 (value)
+ * CONST => 11 $value
+ * These values of addressability are not used in the code generation.
+ * They are only used to calculate the Sethi-Ullman numbers. Since
+ * QBE is AMD64 targered we could do a better job there, and try to
+ * detect some of the complex addressing modes of these processors.
+ */
+Node *
+sethi(Node *np)
+{
+ Node *lp, *rp;
+
+ if (!np)
+ return np;
+
+ np->complex = 0;
+ np->address = 0;
+ lp = np->left;
+ rp = np->right;
+
+ switch (np->op) {
+ case OAUTO:
+ case OREG:
+ case OMEM:
+ case OCONST:
+ np->address = 11;
+ break;
+ case OCPL:
+ assert(np->type.flags & INTF);
+ np->op = OBXOR;
+ rp = constnode(NULL, ~(TUINT) 0, &np->type);
+ goto binary;
+ case OSNEG:
+ np->op = OSUB;
+ rp = lp;
+ lp = constnode(NULL, 0, &np->type);
+ if ((np->type.flags & INTF) == 0)
+ lp->u.f = 0.0;
+ default:
+ binary:
+ lp = sethi(lp);
+ rp = sethi(rp);
+ break;
+ }
+ np->left = lp;
+ np->right = rp;
+
+ if (np->address > 10)
+ return np;
+ if (lp)
+ np->complex = lp->complex;
+ if (rp) {
+ int d = np->complex - rp->complex;
+
+ if (d == 0)
+ ++np->complex;
+ else if (d < 0)
+ np->complex = rp->complex;
+ }
+ if (np->complex == 0)
+ ++np->complex;
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/qbe/code.c
@@ -1,0 +1,569 @@
+static char sccsid[] = "@(#) ./cc2/arch/qbe/code.c";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+#define ADDR_LEN (INTIDENTSIZ+64)
+
+static void binary(void), unary(void), store(void), jmp(void), ret(void),
+ branch(void), call(void), ecall(void), param(void),
+ asalloc(void), form2local(void), ldir(void), vastart(void),
+ vaarg(void);
+
+static struct opdata {
+ void (*fun)(void);
+ char *txt;
+ char letter;
+} optbl [] = {
+ [ASLDSB] = {.fun = unary, .txt = "loadsb", .letter = 'w'},
+ [ASLDUB] = {.fun = unary, .txt = "loadub", .letter = 'w'},
+ [ASLDSH] = {.fun = unary, .txt = "loadsh", .letter = 'w'},
+ [ASLDUH] = {.fun = unary, .txt = "loaduh", .letter = 'w'},
+ [ASLDSW] = {.fun = unary, .txt = "loadsw", .letter = 'w'},
+ [ASLDUW] = {.fun = unary, .txt = "loaduw", .letter = 'w'},
+ [ASLDL] = {.fun = unary, .txt = "loadl", .letter = 'l'},
+ [ASLDS] = {.fun = unary, .txt = "loads", .letter = 's'},
+ [ASLDD] = {.fun = unary, .txt = "loadd", .letter = 'd'},
+
+ [ASCOPYB] = {.fun = unary, .txt = "copy", .letter = 'b'},
+ [ASCOPYH] = {.fun = unary, .txt = "copy", .letter = 'h'},
+ [ASCOPYW] = {.fun = unary, .txt = "copy", .letter = 'w'},
+ [ASCOPYL] = {.fun = unary, .txt = "copy", .letter = 'l'},
+ [ASCOPYS] = {.fun = unary, .txt = "copy", .letter = 's'},
+ [ASCOPYD] = {.fun = unary, .txt = "copy", .letter = 'd'},
+
+ [ASSTB] = {.fun = store, .txt = "store", .letter = 'b'},
+ [ASSTH] = {.fun = store, .txt = "store", .letter = 'h'},
+ [ASSTW] = {.fun = store, .txt = "store", .letter = 'w'},
+ [ASSTL] = {.fun = store, .txt = "store", .letter = 'l'},
+ [ASSTM] = {.fun = ldir},
+ [ASSTS] = {.fun = store, .txt = "store", .letter = 's'},
+ [ASSTD] = {.fun = store, .txt = "store", .letter = 'd'},
+
+ [ASADDW] = {.fun = binary, .txt = "add", .letter = 'w'},
+ [ASSUBW] = {.fun = binary, .txt = "sub", .letter = 'w'},
+ [ASMULW] = {.fun = binary, .txt = "mul", .letter = 'w'},
+ [ASMODW] = {.fun = binary, .txt = "rem", .letter = 'w'},
+ [ASUMODW] = {.fun = binary, .txt = "urem", .letter = 'w'},
+ [ASDIVW] = {.fun = binary, .txt = "div", .letter = 'w'},
+ [ASUDIVW] = {.fun = binary, .txt = "udiv", .letter = 'w'},
+ [ASSHLW] = {.fun = binary, .txt = "shl", .letter = 'w'},
+ [ASSHRW] = {.fun = binary, .txt = "sar", .letter = 'w'},
+ [ASUSHRW] = {.fun = binary, .txt = "shr", .letter = 'w'},
+ [ASLTW] = {.fun = binary, .txt = "csltw", .letter = 'w'},
+ [ASULTW] = {.fun = binary, .txt = "cultw", .letter = 'w'},
+ [ASGTW] = {.fun = binary, .txt = "csgtw", .letter = 'w'},
+ [ASUGTW] = {.fun = binary, .txt = "cugtw", .letter = 'w'},
+ [ASLEW] = {.fun = binary, .txt = "cslew", .letter = 'w'},
+ [ASULEW] = {.fun = binary, .txt = "culew", .letter = 'w'},
+ [ASGEW] = {.fun = binary, .txt = "csgew", .letter = 'w'},
+ [ASUGEW] = {.fun = binary, .txt = "cugew", .letter = 'w'},
+ [ASEQW] = {.fun = binary, .txt = "ceqw", .letter = 'w'},
+ [ASNEW] = {.fun = binary, .txt = "cnew", .letter = 'w'},
+ [ASBANDW] = {.fun = binary, .txt = "and", .letter = 'w'},
+ [ASBORW] = {.fun = binary, .txt = "or", .letter = 'w'},
+ [ASBXORW] = {.fun = binary, .txt = "xor", .letter = 'w'},
+
+ [ASADDL] = {.fun = binary, .txt = "add", .letter = 'l'},
+ [ASSUBL] = {.fun = binary, .txt = "sub", .letter = 'l'},
+ [ASMULL] = {.fun = binary, .txt = "mul", .letter = 'l'},
+ [ASMODL] = {.fun = binary, .txt = "rem", .letter = 'l'},
+ [ASUMODL] = {.fun = binary, .txt = "urem", .letter = 'l'},
+ [ASDIVL] = {.fun = binary, .txt = "div", .letter = 'l'},
+ [ASUDIVL] = {.fun = binary, .txt = "udiv", .letter = 'l'},
+ [ASSHLL] = {.fun = binary, .txt = "shl", .letter = 'l'},
+ [ASSHRL] = {.fun = binary, .txt = "sar", .letter = 'l'},
+ [ASUSHRL] = {.fun = binary, .txt = "shr", .letter = 'l'},
+ [ASLTL] = {.fun = binary, .txt = "csltl", .letter = 'w'},
+ [ASULTL] = {.fun = binary, .txt = "cultl", .letter = 'w'},
+ [ASGTL] = {.fun = binary, .txt = "csgtl", .letter = 'w'},
+ [ASUGTL] = {.fun = binary, .txt = "cugtl", .letter = 'w'},
+ [ASLEL] = {.fun = binary, .txt = "cslel", .letter = 'w'},
+ [ASULEL] = {.fun = binary, .txt = "culel", .letter = 'w'},
+ [ASGEL] = {.fun = binary, .txt = "csgel", .letter = 'w'},
+ [ASUGEL] = {.fun = binary, .txt = "cugel", .letter = 'w'},
+ [ASEQL] = {.fun = binary, .txt = "ceql", .letter = 'w'},
+ [ASNEL] = {.fun = binary, .txt = "cnel", .letter = 'w'},
+ [ASBANDL] = {.fun = binary, .txt = "and", .letter = 'l'},
+ [ASBORL] = {.fun = binary, .txt = "or", .letter = 'l'},
+ [ASBXORL] = {.fun = binary, .txt = "xor", .letter = 'l'},
+
+ [ASADDS] = {.fun = binary, .txt = "add", .letter = 's'},
+ [ASSUBS] = {.fun = binary, .txt = "sub", .letter = 's'},
+ [ASMULS] = {.fun = binary, .txt = "mul", .letter = 's'},
+ [ASDIVS] = {.fun = binary, .txt = "div", .letter = 's'},
+ [ASLTS] = {.fun = binary, .txt = "clts", .letter = 'w'},
+ [ASGTS] = {.fun = binary, .txt = "cgts", .letter = 'w'},
+ [ASLES] = {.fun = binary, .txt = "cles", .letter = 'w'},
+ [ASGES] = {.fun = binary, .txt = "cges", .letter = 'w'},
+ [ASEQS] = {.fun = binary, .txt = "ceqs", .letter = 'w'},
+ [ASNES] = {.fun = binary, .txt = "cnes", .letter = 'w'},
+
+ [ASADDD] = {.fun = binary, .txt = "add", .letter = 'd'},
+ [ASSUBD] = {.fun = binary, .txt = "sub", .letter = 'd'},
+ [ASMULD] = {.fun = binary, .txt = "mul", .letter = 'd'},
+ [ASDIVD] = {.fun = binary, .txt = "div", .letter = 'd'},
+ [ASLTD] = {.fun = binary, .txt = "cltd", .letter = 'w'},
+ [ASGTD] = {.fun = binary, .txt = "cgtd", .letter = 'w'},
+ [ASLED] = {.fun = binary, .txt = "cled", .letter = 'w'},
+ [ASGED] = {.fun = binary, .txt = "cged", .letter = 'w'},
+ [ASEQD] = {.fun = binary, .txt = "ceqd", .letter = 'w'},
+ [ASNED] = {.fun = binary, .txt = "cned", .letter = 'w'},
+
+ [ASEXTBW] = {.fun = unary, .txt = "extsb", .letter = 'w'},
+ [ASUEXTBW]= {.fun = unary, .txt = "extub", .letter = 'w'},
+ [ASEXTBL] = {.fun = unary, .txt = "extsb", .letter = 'l'},
+ [ASUEXTBL]= {.fun = unary, .txt = "extub", .letter = 'l'},
+ [ASEXTHW] = {.fun = unary, .txt = "extsh", .letter = 'w'},
+ [ASUEXTHW]= {.fun = unary, .txt = "extuh", .letter = 'w'},
+ [ASEXTWL] = {.fun = unary, .txt = "extsw", .letter = 'l'},
+ [ASUEXTWL]= {.fun = unary, .txt = "extuw", .letter = 'l'},
+
+ [ASSTOL] = {.fun = unary, .txt = "stosi", .letter = 'l'},
+ [ASSTOW] = {.fun = unary, .txt = "stosi", .letter = 'w'},
+ [ASDTOL] = {.fun = unary, .txt = "dtosi", .letter = 'l'},
+ [ASDTOW] = {.fun = unary, .txt = "dtosi", .letter = 'w'},
+
+ [ASSWTOD] = {.fun = unary, .txt = "swtof", .letter = 'd'},
+ [ASSWTOS] = {.fun = unary, .txt = "swtof", .letter = 's'},
+ [ASSLTOD] = {.fun = unary, .txt = "sltof", .letter = 'd'},
+ [ASSLTOS] = {.fun = unary, .txt = "sltof", .letter = 's'},
+
+ [ASEXTS] = {.fun = unary, .txt = "exts", .letter = 'd'},
+ [ASTRUNCD] = {.fun = unary, .txt = "truncd", .letter = 's'},
+
+ [ASBRANCH] = {.fun = branch},
+ [ASJMP] = {.fun = jmp},
+ [ASRET] = {.fun = ret},
+ [ASCALL] = {.fun = call},
+ [ASCALLE] = {.fun = ecall, .txt = ")"},
+ [ASCALLEX] = {.fun = ecall, .txt = ", ...)"},
+ [ASPAR] = {.fun = param, .txt = "%s %s, "},
+ [ASPARE] = {.fun = param, .txt = "%s %s"},
+ [ASALLOC] = {.fun = asalloc},
+ [ASFORM] = {.fun = form2local},
+
+ [ASVSTAR] = {.fun = vastart},
+ [ASVARG] = {.fun = vaarg},
+};
+
+static char buff[ADDR_LEN];
+/*
+ * : is for user-defined Aggregate Types
+ * $ is for globals (represented by a pointer)
+ * % is for function-scope temporaries
+ * @ is for block labels
+ */
+static char
+sigil(Symbol *sym)
+{
+ switch (sym->kind) {
+ case SEXTRN:
+ case SGLOB:
+ case SPRIV:
+ case SLOCAL:
+ return '$';
+ case SAUTO:
+ case STMP:
+ return '%';
+ case SLABEL:
+ return '@';
+ default:
+ abort();
+ }
+}
+
+static char *
+symname(Symbol *sym)
+{
+ char c = sigil(sym);
+
+ if (sym->name) {
+ switch (sym->kind) {
+ case SEXTRN:
+ case SGLOB:
+ sprintf(buff, "%c%s", c, sym->name);
+ return buff;
+ case SLOCAL:
+ case SPRIV:
+ case SAUTO:
+ sprintf(buff, "%c%s.%u", c, sym->name, sym->id);
+ return buff;
+ default:
+ abort();
+ }
+ }
+ sprintf(buff, "%c.%u", c, sym->numid);
+
+ return buff;
+}
+
+static void
+emitconst(Node *np)
+{
+ switch (np->type.size) {
+ case 1:
+ printf("%d", (int) np->u.i & 0xFF);
+ break;
+ case 2:
+ printf("%d", (int) np->u.i & 0xFFFF);
+ break;
+ case 4:
+ printf("%ld", (long) np->u.i & 0xFFFFFFFF);
+ break;
+ case 8:
+ printf("%lld", (long long) np->u.i);
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+emittree(Node *np)
+{
+ if (!np)
+ return;
+
+ switch (np->op) {
+ case OSTRING:
+ printf("\"%s\"", np->u.s);
+ free(np->u.s);
+ np->u.s = NULL;
+ break;
+ case OCONST:
+ emitconst(np);
+ break;
+ case OADDR:
+ emittree(np->left);
+ break;
+ case OMEM:
+ fputs(symname(np->u.sym), stdout);
+ break;
+ default:
+ emittree(np->left);
+ printf(" %c ", np->op);
+ emittree(np->right);
+ break;
+ }
+}
+
+static char *
+size2asm(Type *tp)
+{
+ if (tp->flags & STRF) {
+ return "b";
+ } else if (tp->flags & INTF) {
+ switch (tp->size) {
+ case 1:
+ return "b";
+ case 2:
+ return "h";
+ case 4:
+ return "w";
+ case 8:
+ return "l";
+ }
+ } else if (tp->flags & FLOATF) {
+ if (tp->size == 4)
+ return "s";
+ else if (tp->size == 8)
+ return "d";
+ }
+ abort();
+}
+
+void
+defglobal(Symbol *sym)
+{
+ if (sym->kind == SEXTRN)
+ return;
+ if (sym->kind == SGLOB)
+ fputs("export ", stdout);
+ printf("data %s = {\n", symname(sym));
+ if (sym->type.flags & INITF)
+ return;
+ printf("\tz\t%lu\n}\n", sym->type.size);
+}
+
+void
+defpar(Symbol *sym)
+{
+ sym->type.flags |= PARF;
+}
+
+void
+defvar(Symbol *sym)
+{
+ if (sym->kind == SREG)
+ sym->kind = SAUTO;
+}
+
+void
+data(Node *np)
+{
+ printf("\t%s\t", size2asm(&np->type));
+ emittree(np);
+ putchar(',');
+ putchar('\n');
+}
+
+static char *
+size2stack(Type *tp)
+{
+ if (tp->flags & INTF) {
+ switch (tp->size) {
+ case 1:
+ case 2:
+ case 4:
+ return "w";
+ case 8:
+ return "l";
+ }
+ } else if (tp->flags & FLOATF) {
+ if (tp->size == 4)
+ return "s";
+ else if (tp->size == 8)
+ return "d";
+ } else if (tp->size == 0) {
+ return "w";
+ }
+ abort();
+}
+
+void
+writeout(void)
+{
+ Symbol *p;
+ Type *tp;
+ char *sep, *name;
+ int haslabel = 0;
+
+ if (!curfun)
+ return;
+ if (curfun->kind == SGLOB)
+ fputs("export ", stdout);
+ printf("function %s %s(", size2stack(&curfun->rtype), symname(curfun));
+
+ /* declare formal parameters */
+ for (sep = "", p = locals; p; p = p->next, sep = ",") {
+ if ((p->type.flags & PARF) == 0)
+ break;
+ printf("%s%s %s.val", sep, size2stack(&p->type), symname(p));
+ }
+ printf("%s)\n{\n", (curfun->type.flags&ELLIPS) ? ", ..." : "");
+
+ /* emit assembler instructions */
+ for (pc = prog; pc; pc = pc->next) {
+ if (pc->label) {
+ haslabel = 1;
+ printf("%s\n", symname(pc->label));
+ }
+ if (!pc->op)
+ continue;
+ if (pc->flags&BBENTRY && !haslabel)
+ printf("%s\n", symname(newlabel()));
+ (*optbl[pc->op].fun)();
+ if (!pc->label)
+ haslabel = 0;
+ }
+
+ puts("}");
+}
+
+static char *
+addr2txt(Addr *a)
+{
+ switch (a->kind) {
+ case SCONST:
+ sprintf(buff, "%llu", (unsigned long long) a->u.i);
+ return buff;
+ case SAUTO:
+ case SLABEL:
+ case STMP:
+ case SGLOB:
+ case SEXTRN:
+ case SPRIV:
+ case SLOCAL:
+ return symname(a->u.sym);
+ default:
+ abort();
+ }
+}
+
+static void
+binary(void)
+{
+ struct opdata *p = &optbl[pc->op];
+ char to[ADDR_LEN], from1[ADDR_LEN], from2[ADDR_LEN];
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from1, addr2txt(&pc->from1));
+ strcpy(from2, addr2txt(&pc->from2));
+ printf("\t%s =%c\t%s\t%s,%s\n", to, p->letter, p->txt, from1, from2);
+}
+
+static void
+ldir(void)
+{
+ struct opdata *p = &optbl[pc->op];
+ char to[ADDR_LEN], from[ADDR_LEN];
+ /* TODO: what type do we use for the size? */
+
+ /* TODO: it is pending */
+}
+
+static void
+store(void)
+{
+ struct opdata *p = &optbl[pc->op];
+ char to[ADDR_LEN], from[ADDR_LEN];
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from, addr2txt(&pc->from1));
+ printf("\t\t%s%c\t%s,%s\n", p->txt, p->letter, from, to);
+}
+
+static void
+unary(void)
+{
+ struct opdata *p = &optbl[pc->op];
+ char to[ADDR_LEN], from[ADDR_LEN];
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from, addr2txt(&pc->from1));
+ printf("\t%s =%c\t%s\t%s\n", to, p->letter, p->txt, from);
+}
+
+static void
+call(void)
+{
+ struct opdata *p = &optbl[pc->op];
+ char to[ADDR_LEN], from[ADDR_LEN];
+ Symbol *sym = pc->to.u.sym;
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from, addr2txt(&pc->from1));
+ printf("\t%s =%s\tcall\t%s(",
+ to, size2stack(&sym->type), from);
+}
+
+static void
+param(void)
+{
+ Symbol *sym = pc->from2.u.sym;
+
+ printf(optbl[pc->op].txt,
+ size2stack(&sym->type), addr2txt(&pc->from1));
+}
+
+static void
+ecall(void)
+{
+ struct opdata *p = &optbl[pc->op];
+
+ puts(p->txt);
+}
+
+static void
+ret(void)
+{
+ if (pc->from1.kind == SNONE)
+ puts("\t\tret");
+ else
+ printf("\t\tret\t%s\n", addr2txt(&pc->from1));
+}
+
+static void
+jmp(void)
+{
+ printf("\t\tjmp\t%s\n", addr2txt(&pc->from1));
+}
+
+static void
+branch(void)
+{
+ char to[ADDR_LEN], from1[ADDR_LEN], from2[ADDR_LEN];
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from1, addr2txt(&pc->from1));
+ strcpy(from2, addr2txt(&pc->from2));
+ printf("\t\tjnz\t%s,%s,%s\n", to, from1, from2);
+}
+
+static void
+vastart(void)
+{
+ printf("\t\tvastart %s\n", addr2txt(&pc->from1));
+}
+
+static void
+vaarg(void)
+{
+ Symbol *sym = pc->to.u.sym;
+ Type *tp = &sym->type;
+ char to[ADDR_LEN], from[ADDR_LEN];
+
+ strcpy(to, addr2txt(&pc->to));
+ strcpy(from, addr2txt(&pc->from1));
+ printf("\t\t%s =%s vaarg %s\n", to, size2asm(tp), from);
+}
+
+static void
+asalloc(void)
+{
+ Symbol *sym = pc->to.u.sym;
+ Type *tp = &sym->type;
+ extern Type ptrtype;
+
+ printf("\t%s =%s\talloc%lu\t%lu\n",
+ symname(sym), size2asm(&ptrtype), tp->align+3 & ~3, tp->size);
+}
+
+static void
+form2local(void)
+{
+ Symbol *sym = pc->to.u.sym;
+ Type *tp = &sym->type;
+ char *name = symname(sym);
+
+ printf("\t\tstore%s\t%s.val,%s\n", size2asm(tp), name, name);
+}
+
+void
+endinit(void)
+{
+ puts("}");
+}
+
+void
+getbblocks(void)
+{
+ Inst *i;
+
+ if (!prog)
+ return;
+
+ prog->flags |= BBENTRY;
+ for (pc = prog; pc; pc = pc->next) {
+ switch (pc->op) {
+ case ASBRANCH:
+ i = pc->from2.u.sym->u.inst;
+ i->flags |= BBENTRY;
+ case ASJMP:
+ i = pc->from1.u.sym->u.inst;
+ i->flags |= BBENTRY;
+ case ASRET:
+ if (pc->next)
+ pc->next->flags |= BBENTRY;
+ break;
+ }
+ }
+}
--- /dev/null
+++ b/src/cc2/target/qbe/optm.c
@@ -1,0 +1,58 @@
+static char sccsid[] = "@(#) ./cc2/arch/qbe/optm.c";
+
+#include <stddef.h>
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+Node *
+optm_dep(Node *np)
+{
+ int op = np->op;
+ Node *p, *dst, *next = np->next;
+ Symbol *sym, *osym;
+
+ switch (op) {
+ case OEFUN:
+ /*
+ * In QBE we need at the end of a basic block
+ * a jump, so we have to ensure that the last
+ * statement of the function is a ret, a jmp
+ * or a branch. In the same way, QBE does
+ * not accept labels at the end of a function
+ * (ONOP is used for labels) so we have to add
+ * a ret there, and in the case of branches
+ * we need a label for the next statement
+ */
+ op = (np->prev) ? np->prev->op : 0;
+ if (!op || op == ONOP || op == OBRANCH || (op != ORET && op != OJMP))
+ addstmt(node(ORET), KEEPCUR);
+ break;
+ case OBRANCH:
+ if (!next->label) {
+ sym = getsym(TMPSYM);
+ sym->kind = SLABEL;
+ next->label = sym;
+ }
+ case OJMP:
+ for (;;) {
+ dst = np->u.sym->u.stmt;
+ if (dst->op != OJMP)
+ break;
+ np->u.sym = dst->u.sym;
+ }
+ for (p = np->next; p; p = p->next) {
+ if (p == dst)
+ return NULL;
+ if (p->op == ONOP ||
+ p->op == OBLOOP ||
+ p->op == OELOOP) {
+ continue;
+ }
+ break;
+ }
+ break;
+ }
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/qbe_amd64-sysv/target.mk
@@ -1,0 +1,8 @@
+OBJ-qbe_amd64-sysv = $(OBJS) \
+ target/qbe/cgen.o \
+ target/qbe/optm.o \
+ target/qbe/code.o \
+ target/amd64-sysv/types.o
+
+$(LIBEXEC)/cc2-qbe_amd64-sysv: $(OBJ-qbe_amd64-sysv)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-qbe_amd64-sysv) -lscc -o $@
--- /dev/null
+++ b/src/cc2/target/qbe_arm64-sysv/target.mk
@@ -1,0 +1,5 @@
+OBJ-qbe_arm64-sysv = $(OBJS) \
+ target/qbe/cgen.o \
+ target/qbe/optm.o \
+ target/qbe/code.o \
+ target/arm64-sysv/types.o \
--- /dev/null
+++ b/src/cc2/target/z80-scc/arch.h
@@ -1,0 +1,5 @@
+enum asmop {
+ ASJMP = 0,
+ ASRET,
+ ASBRANCH,
+};
--- /dev/null
+++ b/src/cc2/target/z80-scc/cgen.c
@@ -1,0 +1,161 @@
+static char sccsid[] = "@(#) ./cc2/arch/z80/cgen.c";
+
+#include <stdlib.h>
+
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+static void
+swtch(Node *idx)
+{
+}
+
+static Node *
+rhs(Node *np, Node *ret)
+{
+}
+
+static Node *
+field(Node *np, Node *ret, int islhs)
+{
+}
+
+static Node *
+lhs(Node *np, Node *new)
+{
+ switch (np->op) {
+ case OMEM:
+ case OAUTO:
+ *new = *np;
+ return new;
+ case OPTR:
+ return rhs(np->left, new);
+ case OFIELD:
+ return field(np, new, 1);
+ default:
+ abort();
+ }
+}
+
+static void
+bool(Node *np, Symbol *true, Symbol *false)
+{
+ Node *l = np->left, *r = np->right;
+ Node ret, ifyes, ifno;
+ Symbol *label;
+
+ switch (np->op) {
+ case ONEG:
+ bool(l, false, true);
+ break;
+ case OAND:
+ label = newlabel();
+ bool(l, label, false);
+ setlabel(label);
+ bool(r, true, false);
+ break;
+ case OOR:
+ label = newlabel();
+ bool(l, true, label);
+ setlabel(label);
+ bool(r, true, false);
+ break;
+ default:
+ label2node(&ifyes, true);
+ label2node(&ifno, false);
+ code(ASBRANCH, rhs(np, &ret), &ifyes, &ifno);
+ break;
+ }
+}
+
+Node *
+cgen(Node *np)
+{
+ Node aux, *p, *next;
+
+ setlabel(np->label);
+ switch (np->op) {
+ case OJMP:
+ label2node(&aux, np->u.sym);
+ code(ASJMP, NULL, &aux, NULL);
+ break;
+ case OBRANCH:
+ next = np->next;
+ if (!next->label)
+ next->label = newlabel();
+ bool(np->left, np->u.sym, next->label);
+ break;
+ case ORET:
+ p = np->left;
+ if (p)
+ p = rhs(np->left, &aux);
+ code(ASRET, NULL, p, NULL);
+ break;
+ case OBSWITCH:
+ swtch(rhs(np->left, &aux));
+ break;
+ default:
+ rhs(np, &aux);
+ break;
+ }
+ return NULL;
+}
+
+/*
+ * This is strongly influenced by
+ * http://plan9.bell-labs.com/sys/doc/compiler.ps (/sys/doc/compiler.ps)
+ * calculate addresability as follows
+ * AUTO => 11 value+fp
+ * REG => 13 reg
+ * STATIC => 12 (value)
+ * CONST => 20 $value
+ */
+Node *
+sethi(Node *np)
+{
+ Node *lp, *rp;
+
+ if (!np)
+ return np;
+
+ np->complex = 0;
+ np->address = 0;
+ lp = np->left;
+ rp = np->right;
+ switch (np->op) {
+ case OAUTO:
+ np->address = 11;
+ break;
+ case OREG:
+ np->address = 13;
+ break;
+ case OMEM:
+ np->address = 12;
+ break;
+ case OCONST:
+ np->address = 20;
+ break;
+ default:
+ sethi(lp);
+ sethi(rp);
+ break;
+ }
+
+ if (np->address > 10)
+ return np;
+ if (lp)
+ np->complex = lp->complex;
+ if (rp) {
+ int d = np->complex - rp->complex;
+
+ if (d == 0)
+ ++np->complex;
+ else if (d < 0)
+ np->complex = rp->complex;
+ }
+ if (np->complex == 0)
+ ++np->complex;
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/z80-scc/code.c
@@ -1,0 +1,229 @@
+static char sccsid[] = "@(#) ./cc2/arch/z80/code.c";
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <scc/cstd.h>
+#include <scc/scc.h>
+
+#include "arch.h"
+#include "../../cc2.h"
+
+enum segment {
+ CODESEG,
+ DATASEG,
+ BSSSEG,
+ NOSEG
+};
+
+static int curseg = NOSEG;
+static unsigned long offpar, offvar;
+
+static void
+segment(int seg)
+{
+ static char *txt[] = {
+ [CODESEG] = "\tCSEG\n",
+ [DATASEG] = "\tDSEG\n",
+ [BSSSEG] = "\tASEG\n",
+ };
+
+ if (seg == curseg)
+ return;
+ fputs(txt[seg], stdout);
+ curseg = seg;
+}
+
+static char *
+symname(Symbol *sym)
+{
+ static char name[INTIDENTSIZ+1];
+
+ if (sym->name) {
+ switch (sym->kind) {
+ case SGLOB:
+ case SEXTRN:
+ snprintf(name, sizeof(name), "_%s", sym->name);
+ return name;
+ case SPRIV:
+ return sym->name;
+ }
+ }
+
+ sprintf(name, ".%d", sym->numid);
+
+ return name;
+}
+
+static void
+label(Symbol *sym)
+{
+ int seg;
+ char *name = symname(sym);
+
+ if (sym->type.flags & FUNF)
+ seg = CODESEG;
+ else if (sym->type.flags & INITF)
+ seg = DATASEG;
+ else
+ seg = BSSSEG;
+ segment(seg);
+
+ switch (sym->kind) {
+ case SEXTRN:
+ printf("\tEXTRN\t%s\n", name);
+ return;
+ case SGLOB:
+ printf("\tPUBLIC\t%s\n", name);
+ break;
+ }
+
+ printf("%s:\n", name);
+}
+
+static void
+emitconst(Node *np)
+{
+ switch (np->type.size) {
+ case 1:
+ printf("%d", (int) np->u.i & 0xFF);
+ break;
+ case 2:
+ printf("%d", (int) np->u.i & 0xFFFF);
+ break;
+ case 4:
+ printf("%ld", (long) np->u.i & 0xFFFFFFFF);
+ break;
+ default:
+ abort();
+ }
+}
+
+static void
+emittree(Node *np)
+{
+ if (!np)
+ return;
+
+ switch (np->op) {
+ case OSTRING:
+ printf("\"%s\"", np->u.s);
+ free(np->u.s);
+ np->u.s = NULL;
+ break;
+ case OCONST:
+ emitconst(np);
+ break;
+ case OADDR:
+ emittree(np->left);
+ break;
+ case OMEM:
+ fputs(symname(np->u.sym), stdout);
+ break;
+ default:
+ emittree(np->left);
+ printf(" %c ", np->op);
+ emittree(np->right);
+ break;
+ }
+}
+
+static void
+size2asm(Type *tp)
+{
+ char *s;
+
+ /*
+ * In z80 we can ignore the alignment
+ */
+ if (tp->flags & STRF) {
+ s = "\tDB\t";
+ } else {
+ switch (tp->size) {
+ case 1:
+ s = "\tDB\t";
+ break;
+ case 2:
+ s = "\tDW\t";
+ break;
+ case 4:
+ s = "\tDD\t";
+ break;
+ default:
+ s = "\tDS\t%lu,";
+ break;
+ }
+ }
+ printf(s, tp->size);
+}
+
+void
+newfun()
+{
+ offpar = offvar = 0;
+}
+
+void
+defpar(Symbol *sym)
+{
+ unsigned long align, size;
+
+ if (sym->kind != SREG && sym->kind != SAUTO)
+ return;
+ align = sym->type.align;
+ size = sym->type.size;
+
+ offpar -= align-1 & ~align;
+ sym->u.off = offpar;
+ offpar -= size;
+ sym->kind = SAUTO;
+}
+
+void
+defvar(Symbol *sym)
+{
+ unsigned long align, size;
+
+ if (sym->kind != SREG && sym->kind != SAUTO)
+ return;
+ align = sym->type.align;
+ size = sym->type.size;
+
+ offvar += align-1 & ~align;
+ sym->u.off = offvar;
+ offvar += size;
+ sym->kind = SAUTO;
+}
+
+void
+defglobal(Symbol *sym)
+{
+ label(sym);
+ if (sym->kind == SEXTRN || (sym->type.flags & INITF))
+ return;
+ size2asm(&sym->type);
+ puts("0");
+}
+
+void
+data(Node *np)
+{
+ size2asm(&np->type);
+ emittree(np);
+ putchar('\n');
+}
+
+void
+writeout(void)
+{
+}
+
+void
+endinit(void)
+{
+}
+
+void
+getbblocks(void)
+{
+}
--- /dev/null
+++ b/src/cc2/target/z80-scc/optm.c
@@ -1,0 +1,11 @@
+static char sccsid[] = "@(#) ./cc2/arch/z80/optm.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+Node *
+optm_dep(Node *np)
+{
+ return np;
+}
--- /dev/null
+++ b/src/cc2/target/z80-scc/target.mk
@@ -1,0 +1,8 @@
+OBJ-z80-scc = $(OBJS) \
+ target/z80-scc/cgen.o \
+ target/z80-scc/optm.o \
+ target/z80-scc/code.o \
+ target/z80-scc/types.o \
+
+$(LIBEXEC)/cc2-z80-scc: $(OBJ-z80-scc)
+ $(CC) $(SCC_LDFLAGS) $(OBJ-z80-scc) -lscc -o $@
--- /dev/null
+++ b/src/cc2/target/z80-scc/types.c
@@ -1,0 +1,95 @@
+static char sccsid[] = "@(#) ./cc2/arch/z80/types.c";
+
+#include <scc/scc.h>
+
+#include "../../cc2.h"
+
+
+Type int8type = {
+ .flags = SIGNF | INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type int16type = {
+ .flags = SIGNF | INTF,
+ .size = 2,
+ .align = 1
+};
+
+Type int32type = {
+ .flags = SIGNF | INTF,
+ .size = 4,
+ .align = 1
+};
+
+Type int64type = {
+ .flags = SIGNF | INTF,
+ .size = 8,
+ .align = 1
+};
+
+Type uint8type = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type uint16type = {
+ .flags = INTF,
+ .size = 2,
+ .align = 1
+};
+
+Type uint32type = {
+ .flags = INTF,
+ .size = 4,
+ .align = 1
+};
+
+Type uint64type = {
+ .flags = INTF,
+ .size = 8,
+ .align = 1
+};
+
+Type ptrtype = {
+ .flags = INTF,
+ .size = 2,
+ .align = 1
+};
+
+Type booltype = {
+ .flags = INTF,
+ .size = 1,
+ .align = 1
+};
+
+Type float32type = {
+ .flags = FLOATF,
+ .size = 4,
+ .align = 1
+};
+
+Type float64type = {
+ .flags = FLOATF,
+ .size = 4,
+ .align = 1
+};
+
+Type float80type = {
+ .flags = FLOATF,
+ .size = 4,
+ .align = 1
+};
+
+Type voidtype = {
+ .size = 0,
+ .align = 0
+};
+
+/* this types is not going to be used in this arch */
+Type arg_type = {
+ .size = 0,
+ .align = 0
+};
--- /dev/null
+++ b/src/driver/Makefile
@@ -1,0 +1,8 @@
+.POSIX:
+
+DRIVER = posix
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+all dep clean:
+ +@cd $(DRIVER) && $(MAKE) $@
--- /dev/null
+++ b/src/driver/posix/Makefile
@@ -1,0 +1,40 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/rules.mk
+
+# SYSLST is a list of backend-arch-abi-sys. First
+# element of the list becomes the default target
+
+SYSLST = amd64-sysv-linux-elf z80-scc-none-none \
+ i386-sysv-linux-elf amd64-sysv-openbsd-elf
+
+STDCFLAGS =
+
+TARGETS = $(BINDIR)/scc $(BINDIR)/scpp
+
+all: $(TARGETS)
+
+$(BINDIR)/scc: scc.o
+ $(CC) $(SCC_LDFLAGS) scc.o -lscc -o $@
+
+$(BINDIR)/scpp: cpp.sh config.h
+ set -x ;\
+ trap "rm -f $$$$.sh" 0 2 3;\
+ rm -f $@ ;\
+ sed "s%@PREFIX@%$(PREFIX)%" < cpp.sh > $$$$.sh && \
+ chmod +x $$$$.sh && \
+ mv $$$$.sh $@
+
+config.h:
+ PREFIX=$(PREFIX) ./config.sh $(SYSLST)
+
+dep:
+ $(PROJECTDIR)/mkdep.sh
+
+clean:
+ rm -f scc scpp *.o
+ rm -f $(TARGETS)
+ rm -f config.h
+
+include deps.mk
--- /dev/null
+++ b/src/driver/posix/config.h
@@ -1,0 +1,5 @@
+#define PREFIX "/home/robvar01/src/tools/scc/driver/posix/../../root"
+#define ARCH "amd64"
+#define SYS "linux"
+#define ABI "sysv"
+#define FORMAT "elf"
--- /dev/null
+++ b/src/driver/posix/config.sh
@@ -1,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+rm -f config.h
+trap "rm -f $$.h" 0 2 3
+
+PREFIX=${PREFIX-$HOME}
+
+echo $@ |
+(IFS='- ' read arch abi sys format r
+echo \#define PREFIX \"$PREFIX\"
+echo \#define ARCH \"$arch\"
+echo \#define SYS \"$sys\"
+echo \#define ABI \"$abi\"
+echo \#define FORMAT \"$format\") > $$.h && mv $$.h config.h
--- /dev/null
+++ b/src/driver/posix/cpp.sh
@@ -1,0 +1,4 @@
+#!/bin/sh
+
+SCCPREFIX=${SCCPREFIX:-@PREFIX@}
+${SCCPREFIX}/bin/scc -E $@
--- /dev/null
+++ b/src/driver/posix/deps.mk
@@ -1,0 +1,8 @@
+#deps
+scc.o: ../../inc/arg.h
+scc.o: ../../inc/ldflags.h
+scc.o: ../../inc/scc.h
+scc.o: ../../inc/syscrts.h
+scc.o: ../../inc/sysincludes.h
+scc.o: ../../inc/syslibs.h
+scc.o: config.h
--- /dev/null
+++ b/src/driver/posix/scc.c
@@ -1,0 +1,617 @@
+static char sccsid[] = "@(#) ./driver/posix/scc.c";
+#define _POSIX_SOURCE
+#define _XOPEN_SOURCE 500
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "config.h"
+#include "../../inc/arg.h"
+#include "../../inc/scc.h"
+#include "../../inc/syscrts.h"
+#include "../../inc/sysincludes.h"
+#include "../../inc/syslibs.h"
+#include "../../inc/ldflags.h"
+
+enum {
+ CC1,
+ TEEIR,
+ CC2,
+ TEEQBE,
+ QBE,
+ TEEAS,
+ AS,
+ LD,
+ STRIP,
+ LAST_TOOL,
+};
+
+static struct tool {
+ char cmd[PATH_MAX];
+ char bin[32];
+ char *outfile;
+ struct items args;
+ unsigned nparams;
+ int in, out, init;
+ pid_t pid;
+} tools[] = {
+ [CC1] = { .cmd = "cc1" },
+ [TEEIR] = { .bin = "tee", .cmd = "tee", },
+ [CC2] = { .cmd = "cc2" },
+ [TEEQBE] = { .bin = "tee", .cmd = "tee", },
+ [QBE] = { .bin = "qbe", .cmd = "qbe", },
+ [TEEAS] = { .bin = "tee", .cmd = "tee", },
+ [AS] = { .bin = "as", .cmd = "as", },
+ [LD] = { .bin = "ld", .cmd = "ld", },
+ [STRIP] = { .bin = "strip", .cmd = "strip", },
+};
+
+char *argv0;
+static char *arch, *sys, *abi, *format;
+static char *prefix, *objfile, *outfile;
+static char *tmpdir;
+static size_t tmpdirln;
+static struct items objtmp, objout;
+static int Mflag, Eflag, Sflag, cflag, dflag, kflag, sflag, Qflag = 1; /* TODO: Remove Qflag */
+static int devnullfd = -1;
+
+extern int failure;
+
+static void
+terminate(void)
+{
+ unsigned i;
+
+ if (!kflag) {
+ for (i = 0; i < objtmp.n; ++i)
+ unlink(objtmp.s[i]);
+ }
+}
+
+static void
+addarg(int tool, char *arg)
+{
+ struct tool *t = &tools[tool];
+
+ if (t->args.n < 1)
+ t->args.n = 1;
+
+ newitem(&t->args, arg);
+}
+
+static void
+setargv0(int tool, char *arg)
+{
+ struct tool *t = &tools[tool];
+
+ if (t->args.n > 0)
+ t->args.s[0] = arg;
+ else
+ newitem(&t->args, arg);
+}
+
+static int
+qbe(int tool)
+{
+ if (tool != CC2 || !Qflag)
+ return 0;
+ if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv"))
+ return 1;
+ return 0;
+}
+
+static int
+inittool(int tool)
+{
+ struct tool *t = &tools[tool];
+ char *crt, *fmt;
+ int n;
+
+ if (t->init)
+ return tool;
+
+ switch (tool) {
+ case CC1:
+ for (n = 0; sysincludes[n]; ++n) {
+ addarg(tool, "-I");
+ addarg(tool, sysincludes[n]);
+ }
+ case CC2:
+ fmt = (qbe(tool)) ? "%s-qbe_%s-%s" : "%s-%s-%s";
+ n = snprintf(t->bin, sizeof(t->bin), fmt, t->cmd, arch, abi);
+ if (n < 0 || n >= sizeof(t->bin))
+ die("scc: target tool name too long");
+
+ n = snprintf(t->cmd, sizeof(t->cmd),
+ "%s/libexec/scc/%s", prefix, t->bin);
+ if (n < 0 || n >= sizeof(t->cmd))
+ die("scc: target tool path too long");
+ break;
+ case LD:
+ for (n = 0; ldflags[n]; ++n)
+ addarg(tool, ldflags[n]);
+ addarg(tool, "-o");
+ t->outfile = outfile ? outfile : xstrdup("a.out");
+ addarg(tool, t->outfile);
+ for (n = 0; syslibs[n]; ++n) {
+ addarg(tool, "-L");
+ addarg(tool, syslibs[n]);
+ }
+ if (syscrts[0]) {
+ for (n = 0; syscrts[n]; ++n)
+ addarg(tool, syscrts[n]);
+ break;
+ }
+ n = snprintf(NULL, 0,
+ "%s/lib/scc/%s-%s-%s/crt.o",
+ prefix, arch, abi, sys);
+ if (n < 0)
+ die("scc: wrong crt file name");
+ crt = xmalloc(++n);
+ sprintf(crt,
+ "%s/lib/scc/%s-%s-%s/crt.o",
+ prefix, arch, abi, sys);
+ addarg(tool, crt);
+ break;
+ case AS:
+ addarg(tool, "-o");
+ break;
+ default:
+ break;
+ }
+
+ setargv0(tool, t->bin);
+ t->nparams = t->args.n;
+ t->init = 1;
+
+ return tool;
+}
+
+static char *
+outfname(char *path, char *type)
+{
+ char *new, sep, *p;
+ size_t newsz, pathln;
+ int tmpfd, n;
+
+ if (path) {
+ sep = '.';
+ if (p = strrchr(path, '/'))
+ path = p + 1;
+ pathln = strlen(path);
+ if (p = strrchr(path, '.'))
+ pathln -= strlen(p);
+ } else {
+ sep = '/';
+ type = "scc-XXXXXX";
+ path = tmpdir;
+ pathln = tmpdirln;
+ }
+
+ newsz = pathln + 1 + strlen(type) + 1;
+ new = xmalloc(newsz);
+ n = snprintf(new, newsz, "%.*s%c%s", (int)pathln, path, sep, type);
+ if (n < 0 || n >= newsz)
+ die("scc: wrong output filename");
+ if (sep == '/') {
+ if ((tmpfd = mkstemp(new)) < 0)
+ die("scc: could not create output file '%s': %s",
+ new, strerror(errno));
+ close(tmpfd);
+ }
+
+ return new;
+}
+
+static int
+settool(int tool, char *infile, int nexttool)
+{
+ struct tool *t = &tools[tool];
+ unsigned i;
+ int fds[2];
+ static int fdin = -1;
+
+ switch (tool) {
+ case TEEIR:
+ t->outfile = outfname(infile, "ir");
+ addarg(tool, t->outfile);
+ break;
+ case TEEQBE:
+ t->outfile = outfname(infile, "qbe");
+ addarg(tool, t->outfile);
+ break;
+ case TEEAS:
+ t->outfile = outfname(infile, "s");
+ addarg(tool, t->outfile);
+ break;
+ case AS:
+ if (cflag && outfile) {
+ objfile = outfile;
+ } else {
+ objfile = (cflag || kflag) ? infile : NULL;
+ objfile = outfname(objfile, "o");
+ }
+ t->outfile = xstrdup(objfile);
+ addarg(tool, t->outfile);
+ break;
+ case STRIP:
+ if (cflag || kflag) {
+ for (i = 0; i < objout.n; ++i)
+ addarg(tool, xstrdup(objout.s[i]));
+ }
+ if (!cflag && tools[LD].outfile)
+ addarg(tool, tools[LD].outfile);
+ break;
+ default:
+ break;
+ }
+
+ if (fdin > -1) {
+ t->in = fdin;
+ fdin = -1;
+ } else {
+ t->in = -1;
+ if (infile)
+ addarg(tool, xstrdup(infile));
+ }
+
+ if (nexttool < LAST_TOOL) {
+ if (pipe(fds))
+ die("scc: pipe: %s", strerror(errno));
+ t->out = fds[1];
+ fdin = fds[0];
+ } else {
+ t->out = -1;
+ }
+
+ addarg(tool, NULL);
+
+ return tool;
+}
+
+static void
+spawn(int tool)
+{
+ struct tool *t = &tools[tool];
+
+ switch (t->pid = fork()) {
+ case -1:
+ die("scc: %s: %s", t->bin, strerror(errno));
+ case 0:
+ if (t->out > -1)
+ dup2(t->out, 1);
+ if (t->in > -1)
+ dup2(t->in, 0);
+ if (!dflag && tool != CC1 && tool != LD)
+ dup2(devnullfd, 2);
+ execvp(t->cmd, t->args.s);
+ if (dflag) {
+ fprintf(stderr,
+ "scc: execvp %s: %s\n",
+ t->cmd,
+ strerror(errno));
+ }
+ abort();
+ default:
+ if (t->in > -1)
+ close(t->in);
+ if (t->out > -1)
+ close(t->out);
+ break;
+ }
+}
+
+static int
+toolfor(char *file)
+{
+ char *dot = strrchr(file, '.');
+
+ if (dot) {
+ if (!strcmp(dot, ".c"))
+ return CC1;
+ if (!strcmp(dot, ".ir"))
+ return CC2;
+ if (!strcmp(dot, ".qbe"))
+ return QBE;
+ if (!strcmp(dot, ".s"))
+ return AS;
+ if (!strcmp(dot, ".o"))
+ return LD;
+ if (!strcmp(dot, ".a"))
+ return LD;
+ } else if (!strcmp(file, "-")) {
+ return CC1;
+ }
+
+ die("scc: do not recognize filetype of %s", file);
+}
+
+static int
+valid(int tool, struct tool *t)
+{
+ int st;
+
+ if (waitpid(t->pid, &st, 0) == -1 || WIFSIGNALED(st))
+ goto internal;
+ if (WIFEXITED(st) && WEXITSTATUS(st) == 0)
+ return 1;
+ if (!failure && (tool == CC1 || tool == LD))
+ goto fail;
+
+internal:
+ fprintf(stderr, "scc:%s: internal error\n", t->bin);
+fail:
+ failure = 1;
+ return 0;
+}
+
+static int
+validatetools(void)
+{
+ struct tool *t;
+ unsigned i;
+ int tool, st, failed = LAST_TOOL;
+
+ for (tool = 0; tool < LAST_TOOL; ++tool) {
+ t = &tools[tool];
+ if (!t->pid)
+ continue;
+ if (!valid(tool, t))
+ failed = tool;
+ if (tool >= failed && t->outfile)
+ unlink(t->outfile);
+ for (i = t->nparams; i < t->args.n; ++i)
+ free(t->args.s[i]);
+ t->args.n = t->nparams;
+ t->pid = 0;
+ }
+ if (failed < LAST_TOOL) {
+ unlink(objfile);
+ free(objfile);
+ objfile = NULL;
+ return 0;
+ }
+
+ return 1;
+}
+
+static int
+buildfile(char *file, int tool)
+{
+ int nexttool;
+
+ for (; tool < LAST_TOOL; tool = nexttool) {
+ switch (tool) {
+ case CC1:
+ if (Eflag || Mflag)
+ nexttool = LAST_TOOL;
+ else
+ nexttool = kflag ? TEEIR : CC2;
+ break;
+ case TEEIR:
+ nexttool = CC2;
+ break;
+ case CC2:
+ if (Qflag)
+ nexttool = kflag ? TEEQBE : QBE;
+ else
+ nexttool = (Sflag || kflag) ? TEEAS : AS;
+ break;
+ case TEEQBE:
+ nexttool = QBE;
+ break;
+ case QBE:
+ nexttool = (Sflag || kflag) ? TEEAS : AS;
+ break;
+ case TEEAS:
+ nexttool = Sflag ? LAST_TOOL : AS;
+ break;
+ case AS:
+ nexttool = LAST_TOOL;
+ break;
+ default:
+ nexttool = LAST_TOOL;
+ continue;
+ }
+
+ spawn(settool(inittool(tool), file, nexttool));
+ }
+
+ return validatetools();
+}
+
+static void
+build(struct items *chain, int link)
+{
+ int i, tool;
+
+ if (link)
+ inittool(LD);
+
+ for (i = 0; i < chain->n; ++i) {
+ if (!strcmp(chain->s[i], "-l")) {
+ if (link) {
+ addarg(LD, xstrdup(chain->s[i++]));
+ addarg(LD, xstrdup(chain->s[i]));
+ } else {
+ ++i;
+ }
+ continue;
+ }
+ tool = toolfor(chain->s[i]);
+ if (tool == LD) {
+ if (link)
+ addarg(LD, xstrdup(chain->s[i]));
+ continue;
+ }
+ if (buildfile(chain->s[i], tool)) {
+ if (link)
+ addarg(LD, xstrdup(objfile));
+ newitem((!link || kflag) ? &objout : &objtmp, objfile);
+ }
+ }
+}
+
+static void
+usage(void)
+{
+ fputs("usage: scc [-D def[=val]]... [-U def]... [-I dir]... "
+ "[-L dir]... [-l dir]...\n"
+ " [-dgksw] [-m arch] [-M|-E|-S] [-o outfile] file...\n"
+ " scc [-D def[=val]]... [-U def]... [-I dir]... "
+ "[-L dir]... [-l dir]...\n"
+ " [-dgksw] [-m arch] [-M|-E|-S] -c file...\n"
+ " scc [-D def[=val]]... [-U def]... [-I dir]... "
+ "[-L dir]... [-l dir]...\n"
+ " [-dgksw] [-m arch] -c -o outfile file\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct items linkchain = { .n = 0, };
+ int link;
+
+ atexit(terminate);
+
+ if (!(arch = getenv("ARCH")))
+ arch = ARCH;
+ if (!(sys = getenv("SYS")))
+ sys = SYS;
+ if (!(abi = getenv("ABI")))
+ abi = ABI;
+ if (!(format = getenv("FORMAT")))
+ format = FORMAT;
+ if (!(prefix = getenv("SCCPREFIX")))
+ prefix = PREFIX;
+
+ ARGBEGIN {
+ case 'D':
+ addarg(CC1, "-D");
+ addarg(CC1, EARGF(usage()));
+ break;
+ case 'M':
+ Mflag = 1;
+ addarg(CC1, "-M");
+ break;
+ case 'E':
+ Eflag = 1;
+ addarg(CC1, "-E");
+ break;
+ case 'I':
+ addarg(CC1, "-I");
+ addarg(CC1, EARGF(usage()));
+ break;
+ case 'L':
+ addarg(LD, "-L");
+ addarg(LD, EARGF(usage()));
+ break;
+ case 'O':
+ EARGF(usage());
+ break;
+ case 'S':
+ Sflag = 1;
+ break;
+ case 'U':
+ addarg(CC1, "-U");
+ addarg(CC1, EARGF(usage()));
+ break;
+ case 'c':
+ cflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'g':
+ addarg(AS, "-g");
+ addarg(LD, "-g");
+ break;
+ case 'k':
+ kflag = 1;
+ break;
+ case 'l':
+ newitem(&linkchain, "-l");
+ newitem(&linkchain, EARGF(usage()));
+ break;
+ case 'm':
+ arch = EARGF(usage());
+ break;
+ case 'o':
+ outfile = xstrdup(EARGF(usage()));
+ break;
+ case 's':
+ sflag = 1;
+ break;
+ case 't':
+ sys = EARGF(usage());
+ break;
+ case 'W':
+ EARGF(usage());
+ case 'w':
+ addarg(CC1, "-w");
+ break;
+ case 'q':
+ Qflag = 0;
+ break;
+ case 'Q':
+ Qflag = 1;
+ break;
+ case '-':
+ fprintf(stderr,
+ "scc: ignored parameter --%s\n", EARGF(usage()));
+ break;
+ default:
+ usage();
+ } ARGOPERAND {
+operand:
+ newitem(&linkchain, ARGOP());
+ } ARGEND
+
+ for (; *argv; --argc, ++argv)
+ goto operand;
+
+ if (Eflag && linkchain.n == 0)
+ newitem(&linkchain, "-");
+
+ if (Eflag && Mflag ||
+ (Eflag || Mflag) && (Sflag || kflag) ||
+ linkchain.n == 0 ||
+ linkchain.n > 1 && cflag && outfile)
+ usage();
+
+ if (!dflag) {
+ if ((devnullfd = open("/dev/null", O_WRONLY)) < 0)
+ fputs("scc: could not open /dev/null\n", stderr);
+ }
+
+ if (!(tmpdir = getenv("TMPDIR")) || !tmpdir[0])
+ tmpdir = ".";
+ tmpdirln = strlen(tmpdir);
+
+ build(&linkchain, (link = !(Mflag || Eflag || Sflag || cflag)));
+
+ if (!(link || cflag))
+ return failure;
+
+ if (link && !failure) {
+ addarg(LD, xstrdup("-lc"));
+ spawn(settool(LD, NULL, LAST_TOOL));
+ validatetools();
+ }
+
+ if (sflag) {
+ spawn(settool(inittool(STRIP), NULL, LAST_TOOL));
+ validatetools();
+ }
+
+ return failure;
+}
--- /dev/null
+++ b/src/ld/Makefile
@@ -1,0 +1,21 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = main.o \
+ coff32.o \
+ obj.o \
+
+TARGET = $(BINDIR)/ld
+
+all: $(TARGET)
+
+$(TARGET): $(LIBDIR)/libcoff32.a $(LIBDIR)/libscc.a
+
+$(TARGET): $(OBJS)
+ $(CC) $(SCC_LDFLAGS) $(OBJS) -lcoff32 -lscc -o $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/ld/coff32.c
@@ -1,0 +1,403 @@
+static char sccsid[] = "@(#) ./ld/coff32.c";
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/coff32/aouthdr.h>
+#include <scc/coff32/filehdr.h>
+#include <scc/coff32/scnhdr.h>
+#include <scc/coff32/syms.h>
+#include <scc/coff32/coff32.h>
+#include <scc/scc.h>
+#include "ld.h"
+
+#define NUMSCN_MAX 65536
+#define NUMENT_MAX 2147483648
+
+static long textpc = 0x1000;
+
+/*
+ * check overflow in: off + ptr + nitem*size
+ */
+static char *
+symname(Obj *obj, SYMENT *ent)
+{
+ long off;
+
+ if (ent->n_zeroes != 0)
+ return ent->n_name;
+
+ off = ent->n_offset;
+ if (off >= obj->strsiz) {
+ fprintf(stderr,
+ "ld: invalid offset in symbol table: %zd\n", off);
+ return "";
+ }
+
+ return &obj->strtbl[off];
+}
+
+static int
+readstr(Obj *obj, long off)
+{
+ unsigned char buff[4];
+ char *str;
+ size_t siz;
+
+ if (fseek(obj->fp, off, SEEK_SET) == EOF)
+ return -1;
+
+ if (fread(buff, 4, 1, obj->fp) != 1)
+ return -1;
+
+ (*obj->unpack)(buff, "l", &siz);
+
+ siz -= 4;
+ if (siz == 0) {
+ obj->strtbl = NULL;
+ obj->strsiz = 0;
+ return 0;
+ }
+
+ if (siz > SIZE_MAX || (str = malloc(siz)) == NULL)
+ outmem();
+
+ if (fread(str, siz, 1, obj->fp) != 1)
+ return -1;
+
+ obj->strtbl = str;
+ obj->strsiz = siz;
+
+ return 0;
+}
+
+static int
+readsects(Obj *obj, long off)
+{
+ unsigned a, nsec, i;
+ unsigned char buff[SCNHSZ];
+ SCNHDR *scns, *p;
+ FILHDR *hdr;
+ Symbol *sym;
+ Section *sp;
+
+ hdr = obj->filhdr;
+ nsec = hdr->f_nscns;
+
+ scns = NULL;
+ if (nsec <= SIZE_MAX / sizeof(*scns))
+ scns = malloc(nsec * sizeof(*scns));
+ if (!scns)
+ outmem();
+ obj->scnhdr = scns;
+
+ if (fseek(obj->fp, off, SEEK_SET) == EOF)
+ return -1;
+
+ a = obj->align - 1;
+ for (i = 0; i < nsec; ++i) {
+ p = &scns[i];
+ if (fread(buff, SCNHSZ, 1, obj->fp) != 1)
+ return -1;
+ coff32_unpack_scn(obj->unpack, buff, p);
+ sp = slookup(p->s_name);
+ p->s_vaddr = sp->base + sp->size;
+ sp->size += p->s_size;
+ }
+
+ return 0;
+}
+
+static int
+readents(Obj *obj, long off)
+{
+ SYMENT *ent, *ents;
+ SCNHDR *scn, *scns = obj->scnhdr;
+ FILHDR *hdr = obj->filhdr;;
+ long nsyms = hdr->f_nsyms;
+ unsigned nsect;
+ unsigned char buff[SYMESZ];
+ char *s;
+ int aux;
+ Symbol *sym;
+
+
+ if (fseek(obj->fp, off, SEEK_SET) == EOF)
+ return -1;
+
+ ents = NULL;
+ if (nsyms <= SIZE_MAX/sizeof(SYMENT))
+ ents = malloc((nsyms * sizeof(SYMENT)));
+ if (!ents)
+ outmem();
+ obj->enthdr = ents;
+
+ aux = 0;
+ for (ent = ents; ent < &ents[nsyms]; ++ent) {
+ if (fread(buff, SYMESZ, 1, obj->fp) != 1)
+ return -1;
+ coff32_unpack_ent(obj->unpack, buff, ent);
+ s = ent->n_name;
+ if (!s[0] && !s[1] && !s[2] && !s[3])
+ (*obj->unpack)(buff, "ll", &ent->n_zeroes, &ent->n_offset);
+
+ if (aux > 0) {
+ aux--;
+ continue;
+ }
+ aux = ent->n_numaux;
+
+ scn = NULL;
+ switch (ent->n_scnum) {
+ case N_DEBUG:
+ continue;
+ case N_ABS:
+ break;
+ case N_UNDEF:
+ /* TODO: deal wth common blocks */
+ break;
+ default:
+ nsect = ent->n_scnum-1;
+ if (nsect >= hdr->f_nscns)
+ corrupted(obj->fname, obj->member);
+ scn = &scns[nsect];
+ ent->n_value += scn->s_vaddr;
+ }
+
+ if (ent->n_sclass == C_EXT && ent->n_scnum != N_UNDEF) {
+ Symbol *sym = lookup(symname(obj, ent), INSTALL);
+
+ if (sym->flags & SDEFINED) {
+ redefined(obj, sym);
+ } else {
+ sym->flags |= SDEFINED;
+ sym->where = obj;
+ if (scn)
+ sym->section = slookup(scn->s_name);
+ }
+ }
+ }
+
+ return 0;
+}
+
+static long
+fileptr(long off, long ptr, long nitem, long size)
+{
+ if (off < 0 || ptr < 0 || nitem < 0 || size < 0)
+ return -1;
+
+ if (off > LONG_MAX - ptr)
+ return -1;
+ off += ptr;
+
+ if (size > 0) {
+ if (nitem > LONG_MAX / size)
+ return -1;
+ size *= nitem;
+ }
+
+ if (off > LONG_MAX - size)
+ return -1;
+ off += size;
+
+ return off;
+}
+
+Obj *
+load(Obj *obj)
+{
+ unsigned char buff[FILHSZ];
+ FILHDR *hdr;
+ char *strtbl;
+ long symoff, secoff, stroff, pos;
+
+ pos = ftell(obj->fp);
+ if (fread(buff, FILHSZ, 1, obj->fp) != 1)
+ goto bad_file;
+
+ if ((hdr = malloc(sizeof(*hdr))) == NULL)
+ outmem();
+ coff32_unpack_hdr(obj->unpack, buff, hdr);
+ obj->filhdr = hdr;
+
+ stroff = fileptr(pos, hdr->f_symptr, hdr->f_nsyms, SYMESZ);
+ symoff = fileptr(pos, hdr->f_symptr, 0, 0);
+ secoff = fileptr(pos, hdr->f_opthdr, 1, FILHSZ);
+
+ if (stroff < 0 || symoff < 0 || secoff < 0)
+ goto bad_file;
+
+ if (readstr(obj, stroff) < 0)
+ goto bad_file;
+ if (readsects(obj, secoff) < 0)
+ goto bad_file;
+ if (readents(obj, symoff) < 0)
+ goto bad_file;
+ return add(obj);
+
+bad_file:
+ fprintf(stderr,
+ "ld: %s: %s\n",
+ obj->fname,
+ (ferror(obj->fp)) ? strerror(errno) : "corrupted file");
+ exit(EXIT_FAILURE);
+}
+
+Obj *
+probe(char *fname, char *member, FILE *fp)
+{
+ int c;
+ int c1, c2;
+ long pos;
+ unsigned short magic;
+ unsigned align;
+ int (*unpack)(unsigned char *, char *, ...);
+ int (*pack)(unsigned char *, char *, ...);
+ Obj *obj;
+
+ pos = ftell(fp);
+ c1 = getc(fp);
+ c2 = getc(fp);
+ fseek(fp, pos, SEEK_SET);
+
+ if (ferror(fp))
+ die("ld: %s: %s", fname, strerror(errno));
+
+ if (c1 == EOF || c2 == EOF)
+ return 0;
+ magic = c1 | c2 << 8;
+
+ switch (magic) {
+ case COFF_I386MAGIC:
+ case COFF_Z80MAGIC:
+ unpack = lunpack;
+ pack = lpack;
+ align = 2;
+ break;
+ default:
+ return NULL;
+ }
+
+ obj = newobj(fname, member, fp);
+ obj->unpack = unpack;
+ obj->align = align;
+ obj->offset = pos;
+
+ return obj;
+}
+
+static void
+wrhdr(FILE *fp)
+{
+ FILHDR hdr;
+ Section *sp;
+ unsigned char buff[FILHSZ];
+
+ if (numsects > NUMSCN_MAX || numsymbols > NUMENT_MAX) {
+ fprintf(stderr, "ld: too many symbols or sections\n");
+ exit(EXIT_FAILURE);
+ }
+
+ /*
+ * we set the timestamp to 0 to make the output
+ * reproductible and to avoid a not standard use
+ * of time()
+ */
+ hdr.f_symptr = 0;
+ hdr.f_magic = COFF_Z80MAGIC;
+ hdr.f_nscns = numsects;
+ hdr.f_symptr = 0;
+ hdr.f_timdat = 0;
+ hdr.f_nsyms = 0;
+ hdr.f_opthdr = AOUTSZ;
+ hdr.f_flags = F_EXEC | F_AR32WR; /* TODO: set the correct endianess */
+
+ if (!sflag) {
+ hdr.f_symptr = 0; /* TODO: set correct value here */
+ hdr.f_flags |= F_SYMS;
+ hdr.f_nsyms = numsymbols;
+ }
+
+ coff32_pack_hdr(lpack, buff, &hdr);
+ fwrite(buff, FILHSZ, 1, fp);
+}
+
+static void
+wraout(FILE *fp)
+{
+ AOUTHDR aout;
+ unsigned char buff[AOUTSZ];
+ Symbol *sym;
+ long addr;
+
+ if ((sym = lookup(entry, NOINSTALL)) != NULL) {
+ addr = sym->value;
+ } else {
+ fprintf(stderr,
+ "ld: warning: cannot find entry symbol '%s'; defaulting to 0\n",
+ entry);
+ addr = 0;
+ }
+
+ aout.magic = ZMAGIC;
+ aout.vstamp = 0;
+ aout.entry = addr;
+ aout.tsize = tsize;
+ aout.dsize = dsize;
+ aout.bsize = bsize;
+ aout.text_start = textpc;
+ aout.data_start = textpc + dsize;
+
+ coff32_pack_aout(lpack, buff, &aout);
+ fwrite(buff, AOUTSZ, 1, fp);
+}
+
+static void
+wrscn(FILE *fp, Section *sp, long pc)
+{
+ SCNHDR scn;
+ unsigned char buff[SCNHSZ];
+
+ strcpy(scn.s_name, sp->name);
+ scn.s_paddr = pc;
+ scn.s_vaddr = pc;
+ scn.s_size = sp->size;
+ scn.s_scnptr = 0; /* TODO: file ptr */
+ scn.s_relptr = 0;
+ scn.s_lnnoptr = 0;
+ scn.s_nrelloc = 0;
+ scn.s_nlnno = 0;
+ scn.s_flags = 0; /* TODO: Add flags */
+
+ coff32_pack_scn(lpack, buff, &scn);
+ fwrite(buff, SCNHSZ, 1, fp);
+}
+
+void
+writeout(FILE *fp)
+{
+ Section *sp;
+ long pc = textpc;
+
+ wrhdr(fp);
+ wraout(fp);
+
+ for (sp = sectlst; sp; sp = sp->next) {
+ wrscn(fp, sp, pc);
+ pc += sp->size;
+ }
+
+ /* TODO: run over all the files */
+
+ if (fflush(fp) == EOF) {
+ perror("ld: error writing output file");
+ exit(EXIT_FAILURE);
+ }
+}
--- /dev/null
+++ b/src/ld/deps.mk
@@ -1,0 +1,15 @@
+
+#deps
+coff32.o: $(INCDIR)/scc/scc/coff32/aouthdr.h
+coff32.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32.o: $(INCDIR)/scc/scc/coff32/filehdr.h
+coff32.o: $(INCDIR)/scc/scc/coff32/scnhdr.h
+coff32.o: $(INCDIR)/scc/scc/coff32/syms.h
+coff32.o: $(INCDIR)/scc/scc/scc.h
+coff32.o: ld.h
+main.o: $(INCDIR)/scc/scc/ar.h
+main.o: $(INCDIR)/scc/scc/scc.h
+main.o: $(INCDIR)/scc/scc/syslibs.h
+main.o: ld.h
+obj.o: $(INCDIR)/scc/scc/scc.h
+obj.o: ld.h
--- /dev/null
+++ b/src/ld/ld.h
@@ -1,0 +1,84 @@
+#define INSTALL 1
+#define NOINSTALL 0
+
+typedef struct obj Obj;
+typedef struct symbol Symbol;
+typedef struct section Section;
+
+struct obj {
+ char *fname;
+ char *member;
+ FILE *fp;
+ long offset;
+
+ void *filhdr;
+ void *scnhdr;
+ void *enthdr;
+
+ char *strtbl;
+ size_t strsiz;
+
+ int (*unpack)(unsigned char *, char *, ...);
+ int align;
+
+ struct obj *next;
+};
+
+enum symflg {
+ SDEFINED = 1 << 1,
+};
+
+struct symbol {
+ char *name;
+ unsigned char flags;
+ long size;
+ TUINT base;
+ TUINT value;
+ Section *section;
+ Obj *where;
+ struct symbol *hash, *next;
+};
+
+struct section {
+ char *name;
+ TUINT base;
+ TUINT size;
+ struct section *next;
+};
+
+/* obj.c */
+extern Obj *newobj(char *fname, char *member, FILE *fp);
+extern Obj *add(Obj *obj);
+extern void delobj(Obj *obj);
+extern Section *slookup(char *name);
+extern Symbol *lookup(char *name, int install);
+
+/* main.c */
+extern void outmem(void);
+extern void corrupted(char *fname, char *member);
+extern void redefined(Obj *obj, Symbol *sym);
+
+/* object format */
+extern Obj *probe(char *fname, char *member, FILE *fp);
+extern Obj *load(Obj *obj);
+extern void writeout(FILE *fp);
+
+
+/*
+ * Definition of globals variables
+ */
+extern int pass;
+extern int sflag;
+extern int xflag;
+extern int Xflag;
+extern int rflag;
+extern int dflag;
+extern int gflag;
+extern Obj *objlst;
+extern Section *sectlst;
+extern long numsects;
+extern long numsymbols;
+extern TUINT tsize, dsize, bsize;
+extern char *output;
+extern char *entry;
+extern char *datasiz;
--- /dev/null
+++ b/src/ld/main.c
@@ -1,0 +1,288 @@
+static char sccsid[] = "@(#) ./ld/main.c";
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include <scc/ar.h>
+#include <scc/syslibs.h>
+#include "ld.h"
+
+char *output = "a.out", *entry = "start", *datasiz;
+int pass;
+int sflag; /* discard all the symbols */
+int xflag; /* discard local symbols */
+int Xflag; /* discard locals starting with 'L' */
+int rflag; /* preserve relocation bits */
+int dflag; /* define common even with rflag */
+int gflag; /* preserve debug symbols */
+
+static int done;
+
+void
+redefined(Obj *obj, Symbol *sym)
+{
+ /* TODO: add infotmation about where it is defined */
+ fprintf(stderr,
+ "ld: %s: redifinition of symbol '%s'\n",
+ obj->fname, sym->name);
+}
+
+void
+corrupted(char *fname, char *member)
+{
+ char *fmt;
+
+ fmt = (member) ?
+ "ld: %s(%s): corrupted file\n" : "ld: %s: corrupted file\n";
+ fprintf(stderr, fmt, fname, member);
+ exit(EXIT_FAILURE);
+}
+
+void
+outmem(void)
+{
+ fputs("ld: out of memory\n", stderr);
+ exit(EXIT_FAILURE);
+}
+
+static void
+cleanup(void)
+{
+ if (!done)
+ remove(output);
+}
+
+static int
+object(char *fname, char *member, FILE *fp)
+{
+ Obj *obj;
+
+ obj = probe(fname, member, fp);
+ if (!obj)
+ return 0;
+ load(obj);
+
+ return 1;
+}
+
+static char *
+getfname(struct ar_hdr *hdr, char *dst)
+{
+ char *p;
+ int i;
+
+ memcpy(dst, hdr->ar_name, SARNAM);
+ dst[SARNAM] = '\0';
+
+ for (i = SARNAM-1; i >= 0; i--) {
+ if (dst[i] != ' ' && dst[i] != '/')
+ break;
+ dst[i] = '\0';
+ }
+ return dst;
+}
+
+static void
+ar(char *fname, FILE *fp)
+{
+ struct ar_hdr hdr;
+ long pos, siz;
+ char member[SARNAM+1];
+
+ if (fseek(fp, SARMAG, SEEK_SET) == EOF)
+ goto file_error;
+
+ while (fread(&hdr, sizeof(hdr), 1, fp) == 1) {
+ if (strncmp(hdr.ar_fmag, ARFMAG, sizeof(hdr.ar_fmag)))
+ corrupted(fname, NULL);
+
+ siz = 0;
+ sscanf(hdr.ar_size, "%10ld", &siz);
+ if (siz & 1)
+ siz++;
+ if (siz == 0)
+ corrupted(fname, NULL);
+
+ pos = ftell(fp);
+ if (pos == -1 || pos > LONG_MAX - siz) {
+ fprintf(stderr,
+ "ld: %s(%s): overflow in size of archive",
+ fname, member);
+ exit(EXIT_FAILURE);
+ }
+ pos += siz;
+
+ getfname(&hdr, member);
+ object(fname, member, fp);
+ if (fseek(fp, pos, SEEK_SET) == EOF)
+ break;
+ }
+
+file_error:
+ if (ferror(fp)) {
+ fprintf(stderr, "ld: %s: %s\n", fname, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+}
+
+static int
+archive(char *fname, FILE *fp)
+{
+ char magic[SARMAG];
+ fpos_t pos;
+
+ fgetpos(fp, &pos);
+ fread(magic, SARMAG, 1, fp);
+ fsetpos(fp, &pos);
+
+ if (ferror(fp))
+ return 0;
+ if (strncmp(magic, ARMAG, SARMAG) != 0)
+ return 0;
+
+ ar(fname, fp);
+ return 1;
+}
+
+static void
+pass1(int argc, char *argv[])
+{
+ FILE *fp;
+ char *s;
+
+ while ((s = *argv++) != NULL) {
+ if ((fp = fopen(s, "rb")) == NULL) {
+ fprintf(stderr, "ld: %s: %s\n", s, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ if (!object(s, NULL, fp) && !archive(s, fp)) {
+ fprintf(stderr, "ld: %s: File format not recognized\n", s);
+ exit(EXIT_FAILURE);
+ }
+ fclose(fp);
+ }
+}
+
+static void
+pass2(int argc, char *argv[])
+{
+ FILE *fp;
+
+ if ((fp = fopen(output, "wb")) != NULL) {
+ writeout(fp);
+ if (fclose(fp) != EOF)
+ return;
+ }
+
+ fprintf(stderr, "ld: %s: %s\n", output, strerror(errno));
+ exit(EXIT_FAILURE);
+}
+
+static void
+usage(void)
+{
+ fputs("usage: ld [options] file ...\n", stderr);
+ exit(1);
+}
+
+static void
+Lpath(char *path)
+{
+ char **bp;
+
+ for (bp = syslibs; bp < &syslibs[MAX_LIB_PATHS] && *bp; ++bp)
+ ;
+ if (bp == &syslibs[MAX_LIB_PATHS]) {
+ fputs("ld: too many -L options\n", stderr);
+ exit(1);
+ }
+ *bp = path;
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *cp, **p;
+
+ for (--argc; *++argv; --argc) {
+ if (argv[0][0] != '-' || argv[0][1] == 'l')
+ break;
+ if (argv[0][1] == '-') {
+ --argc, ++argv;
+ break;
+ }
+ for (cp = &argv[0][1]; *cp; ++cp) {
+ switch (*cp) {
+ case 's':
+ sflag = 1;
+ break;
+ case 'x':
+ xflag = 1;
+ break;
+ case 'X':
+ Xflag = 1;
+ break;
+ case 'r':
+ rflag = 1;
+ break;
+ case 'd':
+ dflag = 1;
+ break;
+ case 'i':
+ case 'n':
+ /* TODO */
+ break;
+ case 'L':
+ if (argc == 0)
+ goto usage;
+ ++argv, --argc;
+ Lpath(*argv);
+ break;
+ case 'u':
+ if (argc == 0)
+ goto usage;
+ ++argv, --argc;
+ lookup(*argv, INSTALL);
+ break;
+ case 'o':
+ if (argc == 0)
+ goto usage;
+ ++argv, --argc;
+ output = *argv;
+ break;
+ case 'e':
+ if (argc == 0)
+ goto usage;
+ ++argv, --argc;
+ entry = *argv;
+ break;
+ case 'D':
+ if (argc == 0)
+ goto usage;
+ ++argv, --argc;
+ datasiz = *argv;
+ break;
+ default:
+ usage:
+ usage();
+ }
+ }
+ }
+
+ if (argc == 0)
+ usage();
+
+ atexit(cleanup);
+
+ pass1(argc, argv);
+ pass2(argc, argv);
+
+ done = 1;
+
+ return 0;
+}
--- /dev/null
+++ b/src/ld/obj.c
@@ -1,0 +1,153 @@
+static char sccsid[] = "@(#) ./ld/obj.c";
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include "ld.h"
+
+#define NR_SYM_HASH 64
+
+TUINT tsize, dsize, bsize;
+
+Obj *objlst;
+static Obj *objtail;
+
+long numsects, numsymbols;
+static Symbol *secttail;
+static Symbol *symtbl[NR_SYM_HASH];
+
+Section *sectlst;
+
+Obj *
+add(Obj *obj)
+{
+ obj->next = NULL;
+
+ if (!objlst) {
+ objtail = objlst = obj;
+ } else {
+ objtail->next = obj;
+ objtail = obj;
+ }
+}
+
+void
+delobj(Obj *obj)
+{
+ free(obj->strtbl);
+ free(obj->scnhdr);
+ free(obj->filhdr);
+ free(obj->fname);
+ free(obj->member);
+ free(obj);
+}
+
+Obj *
+newobj(char *fname, char *member, FILE *fp)
+{
+ Obj *obj;
+ char *s, *t;
+ size_t len;
+
+ len = strlen(fname);
+ obj = malloc(sizeof(*obj));
+ s = malloc(len) + 1;
+ if (!obj || !s)
+ outmem();
+ memset(obj, 0, sizeof(*obj));
+ obj->fname = memcpy(s, fname, len);
+
+ if (!member) {
+ obj->member = NULL;
+ } else {
+ len = strlen(member) + 1;
+ if ((s = malloc(len)) == NULL)
+ outmem();
+ obj->member = memcpy(s, member, len);
+ }
+
+ obj->fp = fp;
+ if ((obj->offset = ftell(fp)) == EOF) {
+ fprintf(stderr, "ld: %s: %s\n", fname, strerror(errno));
+ exit(1);
+ }
+
+ return obj;
+}
+
+Section *
+slookup(char *name)
+{
+ char *s;
+ Section *prev, *sp;
+ size_t len = strlen(name);
+
+ for (prev = sp = sectlst; sp; prev = sp, sp = sp->next) {
+ if (!memcmp(sp->name, name, len))
+ return sp;
+ }
+
+ sp = malloc(sizeof(*sp));
+ s = malloc(len);
+ if (!sp || !s)
+ outmem();
+ sp->name = s;
+ sp->base = 0;
+ sp->size = 0;
+ sp->next = NULL;
+
+ if (!prev)
+ sectlst = sp;
+ else
+ prev->next = sp;
+ numsects++;
+
+ return sp;
+}
+
+static unsigned
+hash(char *s)
+{
+ unsigned h, c;
+
+ for (h = 0; c = *s; ++s)
+ h = h*33 ^ c;
+ return h & NR_SYM_HASH-1;
+}
+
+Symbol *
+lookup(char *name, int install)
+{
+ unsigned h;
+ char *s;
+ size_t len;
+ Symbol *sym;
+
+ h = hash(name);
+ for (sym = symtbl[h]; sym; sym = sym->hash) {
+ s = sym->name;
+ if (*name == *s && !strcmp(name, s))
+ return sym;
+ }
+
+ if (!install)
+ return NULL;
+
+ len = strlen(name) + 1;
+ sym = malloc(sizeof(*sym));
+ s = malloc(len);
+ if (!sym || !s)
+ outmem();
+ memset(sym, 0, sizeof(*sym));
+ memcpy(s, name, len);
+
+ sym->hash = symtbl[h];
+ symtbl[h] = sym;
+ sym->name = s;
+ numsymbols++;
+
+ return sym;
+}
--- /dev/null
+++ b/src/libc/.gitignore
@@ -1,0 +1,1 @@
+objlst
--- /dev/null
+++ b/src/libc/Makefile
@@ -1,0 +1,30 @@
+.POSIX:
+PROJECTDIR =../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+TARGET = $(CRTDIR)/$(ARCH)-$(SYS)/libc.a
+DIRS = arch\
+ assert\
+ ctype\
+ locale\
+ stdio\
+ stdlib\
+ string\
+ time\
+
+all: $(DIRS)
+ +@$(MAKE) $(TARGET)
+
+$(DIRS): FORCE
+ +@cd $@ && $(MAKE)
+
+objlst: FORCE
+ ./mklst $(TARGET)
+
+$(TARGET): objlst
+ xargs $(AR) $(ARFLAGS) $@ < objlst
+
+clean:
+ $(FORALL)
+ rm -f objlst
--- /dev/null
+++ b/src/libc/arch/.gitignore
@@ -1,0 +1,1 @@
+syscall
--- /dev/null
+++ b/src/libc/arch/Makefile
@@ -1,0 +1,11 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+DIRS = amd64 arm32 arm64
+
+all:
+ +@cd $(ARCH) && $(MAKE)
+
+clean:
+ $(FORALL)
--- /dev/null
+++ b/src/libc/arch/amd64/Makefile
@@ -1,0 +1,14 @@
+.POSIX:
+PROJECTDIR =../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = longjmp.o setjmp.o
+DIRS = netbsd openbsd dragonfly linux
+
+all: $(OBJS) $(SYS)
+
+$(SYS): FORCE
+ +@cd $@ && $(MAKE)
+
+clean:
+ $(FORALL)
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/.gitignore
@@ -1,0 +1,10 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_kill.s
+_lseek.s
+_open.s
+_read.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/Makefile
@@ -1,0 +1,35 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _open.o \
+ _read.o \
+ _write.o \
+ _brk.o \
+ _getheap.o \
+ _sigaction.o\
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ movq $end,%rax
+ retq
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/_sigaction.c
@@ -1,0 +1,14 @@
+#include <stddef.h>
+#include <sys.h>
+
+extern int _sigaction2(int sig,
+ struct sigaction *new, struct sigaction *old,
+ int siginfo[], int num);
+
+int
+_sigaction(int sig, struct sigaction *new, struct sigaction *old)
+{
+ extern int _setcontext[];
+
+ return _sigaction2(sig, new, old, _setcontext, 2);
+}
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/gensys.sh
@@ -1,0 +1,26 @@
+#!/bin/sh
+
+#
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+$name:
+ movq \$$num,%rax
+ syscall
+ jb 1f
+ retq
+
+1: movl %eax,(errno)
+ movl \$-1,%eax
+ retq
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/syscall.lst
@@ -1,0 +1,10 @@
+#number name
+1 _Exit
+3 _read
+4 _write
+5 _open
+6 _close
+17 _brk
+20 _getpid
+37 _kill
+199 _lseek
--- /dev/null
+++ b/src/libc/arch/amd64/dragonfly/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/amd64/linux/.gitignore
@@ -1,0 +1,11 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_kill.s
+_lseek.s
+_open.s
+_read.s
+_sigaction.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/amd64/linux/Makefile
@@ -1,0 +1,37 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _open.o \
+ _sigaction.o \
+ _read.o \
+ _write.o \
+ _brk.o \
+ _getheap.o \
+ _cerrno.o \
+ _sigaction.o \
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/amd64/linux/_cerrno.s
@@ -1,0 +1,12 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+
+_cerrno:
+ cmpq $0,%rax
+ js 1f
+ retq
+
+1: neg %rax
+ mov %eax,(errno)
+ mov $-1,%eax
+ retq
--- /dev/null
+++ b/src/libc/arch/amd64/linux/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ movq $0,%rax
+ jmp _brk
--- /dev/null
+++ b/src/libc/arch/amd64/linux/_sigaction.c
@@ -1,0 +1,14 @@
+#include <stddef.h>
+#include <sys.h>
+
+extern int _sigaction2(int sig,
+ struct sigaction *new, struct sigaction *old,
+ int siginfo[], int num);
+
+int
+_sigaction(int sig, struct sigaction *new, struct sigaction *old)
+{
+ extern int _setcontext[];
+
+ return _sigaction2(sig, new, old, _setcontext, 2);
+}
--- /dev/null
+++ b/src/libc/arch/amd64/linux/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/amd64/linux/errno.lst
@@ -1,0 +1,131 @@
+EPERM 1 Operation not permitted
+ENOENT 2 No such file or directory
+ESRCH 3 No such process
+EINTR 4 Interrupted system call
+EIO 5 I/O error
+ENXIO 6 No such device or address
+E2BIG 7 Argument list too long
+ENOEXEC 8 Exec format error
+EBADF 9 Bad file number
+ECHILD 10 No child processes
+EAGAIN 11 Try again
+ENOMEM 12 Out of memory
+EACCES 13 Permission denied
+EFAULT 14 Bad address
+ENOTBLK 15 Block device required
+EBUSY 16 Device or resource busy
+EEXIST 17 File exists
+EXDEV 18 Cross-device link
+ENODEV 19 No such device
+ENOTDIR 20 Not a directory
+EISDIR 21 Is a directory
+EINVAL 22 Invalid argument
+ENFILE 23 File table overflow
+EMFILE 24 Too many open files
+ENOTTY 25 Not a typewriter
+ETXTBSY 26 Text file busy
+EFBIG 27 File too large
+ENOSPC 28 No space left on device
+ESPIPE 29 Illegal seek
+EROFS 30 Read-only file system
+EMLINK 31 Too many links
+EPIPE 32 Broken pipe
+EDOM 33 Math argument out of domain of func
+ERANGE 34 Math result not representable
+EDEADLK 35 Resource deadlock would occur
+ENAMETOOLONG 36 File name too long
+ENOLCK 37 No record locks available
+ENOSYS 38 Invalid system call number
+ENOTEMPTY 39 Directory not empty
+ELOOP 40 Too many symbolic links encountered
+ENOMSG 42 No message of desired type
+EIDRM 43 Identifier removed
+ECHRNG 44 Channel number out of range
+EL2NSYNC 45 Level 2 not synchronized
+EL3HLT 46 Level 3 halted
+EL3RST 47 Level 3 reset
+ELNRNG 48 Link number out of range
+EUNATCH 49 Protocol driver not attached
+ENOCSI 50 No CSI structure available
+EL2HLT 51 Level 2 halted
+EBADE 52 Invalid exchange
+EBADR 53 Invalid request descriptor
+EXFULL 54 Exchange full
+ENOANO 55 No anode
+EBADRQC 56 Invalid request code
+EBADSLT 57 Invalid slot
+EBFONT 59 Bad font file format
+ENOSTR 60 Device not a stream
+ENODATA 61 No data available
+ETIME 62 Timer expired
+ENOSR 63 Out of streams resources
+ENONET 64 Machine is not on the network
+ENOPKG 65 Package not installed
+EREMOTE 66 Object is remote
+ENOLINK 67 Link has been severed
+EADV 68 Advertise error
+ESRMNT 69 Srmount error
+ECOMM 70 Communication error on send
+EPROTO 71 Protocol error
+EMULTIHOP 72 Multihop attempted
+EDOTDOT 73 RFS specific error
+EBADMSG 74 Not a data message
+EOVERFLOW 75 Value too large for defined data type
+ENOTUNIQ 76 Name not unique on network
+EBADFD 77 File descriptor in bad state
+EREMCHG 78 Remote address changed
+ELIBACC 79 Can not access a needed shared library
+ELIBBAD 80 Accessing a corrupted shared library
+ELIBSCN 81 .lib section in a.out corrupted
+ELIBMAX 82 Attempting to link in too many shared libraries
+ELIBEXEC 83 Cannot exec a shared library directly
+EILSEQ 84 Illegal byte sequence
+ERESTART 85 Interrupted system call should be restarted
+ESTRPIPE 86 Streams pipe error
+EUSERS 87 Too many users
+ENOTSOCK 88 Socket operation on non-socket
+EDESTADDRREQ 89 Destination address required
+EMSGSIZE 90 Message too long
+EPROTOTYPE 91 Protocol wrong type for socket
+ENOPROTOOPT 92 Protocol not available
+EPROTONOSUPPORT 93 Protocol not supported
+ESOCKTNOSUPPORT 94 Socket type not supported
+EOPNOTSUPP 95 Operation not supported on transport endpoint
+EPFNOSUPPORT 96 Protocol family not supported
+EAFNOSUPPORT 97 Address family not supported by protocol
+EADDRINUSE 98 Address already in use
+EADDRNOTAVAIL 99 Cannot assign requested address
+ENETDOWN 100 Network is down
+ENETUNREACH 101 Network is unreachable
+ENETRESET 102 Network dropped connection because of reset
+ECONNABORTED 103 Software caused connection abort
+ECONNRESET 104 Connection reset by peer
+ENOBUFS 105 No buffer space available
+EISCONN 106 Transport endpoint is already connected
+ENOTCONN 107 Transport endpoint is not connected
+ESHUTDOWN 108 Cannot send after transport endpoint shutdown
+ETOOMANYREFS 109 Too many references: cannot splice
+ETIMEDOUT 110 Connection timed out
+ECONNREFUSED 111 Connection refused
+EHOSTDOWN 112 Host is down
+EHOSTUNREACH 113 No route to host
+EALREADY 114 Operation already in progress
+EINPROGRESS 115 Operation now in progress
+ESTALE 116 Stale file handle
+EUCLEAN 117 Structure needs cleaning
+ENOTNAM 118 Not a XENIX named type file
+ENAVAIL 119 No XENIX semaphores available
+EISNAM 120 Is a named type file
+EREMOTEIO 121 Remote I/O error
+EDQUOT 122 Quota exceeded
+ENOMEDIUM 123 No medium found
+EMEDIUMTYPE 124 Wrong medium type
+ECANCELED 125 Operation Canceled
+ENOKEY 126 Required key not available
+EKEYEXPIRED 127 Key has expired
+EKEYREVOKED 128 Key has been revoked
+EKEYREJECTED 129 Key was rejected by service
+EOWNERDEAD 130 Owner died
+ENOTRECOVERABLE 131 State not recoverable
+ERFKILL 132 Operation not possible due to RF-kill
+EHWPOISON 133 Memory page has hardware error
--- /dev/null
+++ b/src/libc/arch/amd64/linux/gensys.sh
@@ -1,0 +1,21 @@
+#!/bin/sh
+
+#
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+$name:
+ movq \$$num,%rax
+ syscall
+ jmp _cerrno
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/amd64/linux/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/amd64/linux/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/amd64/linux/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/amd64/linux/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+0 _read
+1 _write
+2 _open
+3 _close
+8 _lseek
+12 _brk
+13 _sigaction
+39 _getpid
+60 _Exit
+62 _kill
--- /dev/null
+++ b/src/libc/arch/amd64/linux/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/amd64/longjmp.s
@@ -1,0 +1,20 @@
+ .file "longjmp"
+
+ .text
+ .globl longjmp
+longjmp:
+ mov %rsi,%rax
+ test %rax,%rax
+ jnz 1f
+ inc %rax
+1:
+ mov (%rdi),%rbx
+ mov 8(%rdi),%rbp
+ mov 16(%rdi),%r12
+ mov 24(%rdi),%r13
+ mov 32(%rdi),%r14
+ mov 40(%rdi),%r15
+ mov 48(%rdi),%rdx
+ mov %rdx,%rsp
+ mov 56(%rdi),%rdx
+ jmp *%rdx
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/.gitignore
@@ -1,0 +1,11 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_gettimeofday.s
+_kill.s
+_lseek.s
+_open.s
+_read.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/Makefile
@@ -1,0 +1,38 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _open.o \
+ _read.o \
+ _write.o \
+ _brk.o \
+ _getheap.o \
+ _setcontext.o \
+ _sigaction.o \
+ _sigaction2.o \
+ _sigaction.o\
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ movq $end,%rax
+ retq
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/_setcontext.s
@@ -1,0 +1,14 @@
+
+ .text
+ .globl _Exit
+ .globl _setcontext
+
+_setcontext:
+ movq %r15,%rdi
+ movq $0x134,%rax
+ syscall
+
+ # Something was wrong, finish the program. We can't call
+ # abort here because it could generate a loop
+ movq $-1,%rdi
+ jmp _Exit
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/_sigaction.c
@@ -1,0 +1,14 @@
+#include <stddef.h>
+#include <sys.h>
+
+extern int _sigaction2(int sig,
+ struct sigaction *new, struct sigaction *old,
+ int siginfo[], int num);
+
+int
+_sigaction(int sig, struct sigaction *new, struct sigaction *old)
+{
+ extern int _setcontext[];
+
+ return _sigaction2(sig, new, old, _setcontext, 2);
+}
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/_sigaction2.s
@@ -1,0 +1,12 @@
+
+# This syscall cannot be autogenerated because it receives more than
+# 4 arguments
+
+ .text
+ .globl _sigaction2
+
+_sigaction2:
+ mov $0x154,%eax
+ mov %rcx,%r10
+ syscall
+ retq
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/errno.lst
@@ -1,0 +1,97 @@
+EPERM 1 Operation not permitted
+ENOENT 2 No such file or directory
+ESRCH 3 No such process
+EINTR 4 Interrupted system call
+EIO 5 Input/output error
+ENXIO 6 Device not configured
+E2BIG 7 Argument list too long
+ENOEXEC 8 Exec format error
+EBADF 9 Bad file descriptor
+ECHILD 10 No child processes
+EDEADLK 11 Resource deadlock avoided
+ENOMEM 12 Cannot allocate memory
+EACCES 13 Permission denied
+EFAULT 14 Bad address
+ENOTBLK 15 Block device required
+EBUSY 16 Device busy
+EEXIST 17 File exists
+EXDEV 18 Cross-device link
+ENODEV 19 Operation not supported by device
+ENOTDIR 20 Not a directory
+EISDIR 21 Is a directory
+EINVAL 22 Invalid argument
+ENFILE 23 Too many open files in system
+EMFILE 24 Too many open files
+ENOTTY 25 Inappropriate ioctl for device
+ETXTBSY 26 Text file busy
+EFBIG 27 File too large
+ENOSPC 28 No space left on device
+ESPIPE 29 Illegal seek
+EROFS 30 Read-only file system
+EMLINK 31 Too many links
+EPIPE 32 Broken pipe
+EDOM 33 Numerical argument out of domain
+ERANGE 34 Result too large or too small
+EAGAIN 35 Resource temporarily unavailable
+EINPROGRESS 36 Operation now in progress
+EALREADY 37 Operation already in progress
+ENOTSOCK 38 Socket operation on non-socket
+EDESTADDRREQ 39 Destination address required
+EMSGSIZE 40 Message too long
+EPROTOTYPE 41 Protocol wrong type for socket
+ENOPROTOOPT 42 Protocol option not available
+EPROTONOSUPPORT 43 Protocol not supported
+ESOCKTNOSUPPORT 44 Socket type not supported
+EOPNOTSUPP 45 Operation not supported
+EPFNOSUPPORT 46 Protocol family not supported
+EAFNOSUPPORT 47 Address family not supported by protocol family
+EADDRINUSE 48 Address already in use
+EADDRNOTAVAIL 49 Can't assign requested address
+ENETDOWN 50 Network is down
+ENETUNREACH 51 Network is unreachable
+ENETRESET 52 Network dropped connection on reset
+ECONNABORTED 53 Software caused connection abort
+ECONNRESET 54 Connection reset by peer
+ENOBUFS 55 No buffer space available
+EISCONN 56 Socket is already connected
+ENOTCONN 57 Socket is not connected
+ESHUTDOWN 58 Can't send after socket shutdown
+ETOOMANYREFS 59 Too many references: can't splice
+ETIMEDOUT 60 Operation timed out
+ECONNREFUSED 61 Connection refused
+ELOOP 62 Too many levels of symbolic links
+ENAMETOOLONG 63 File name too long
+EHOSTDOWN 64 Host is down
+EHOSTUNREACH 65 No route to host
+ENOTEMPTY 66 Directory not empty
+EPROCLIM 67 Too many processes
+EUSERS 68 Too many users
+EDQUOT 69 Disc quota exceeded
+ESTALE 70 Stale NFS file handle
+EREMOTE 71 Too many levels of remote in path
+EBADRPC 72 RPC struct is bad
+ERPCMISMATCH 73 RPC version wrong
+EPROGUNAVAIL 74 RPC prog. not avail
+EPROGMISMATCH 75 Program version wrong
+EPROCUNAVAIL 76 Bad procedure for program
+ENOLCK 77 No locks available
+ENOSYS 78 Function not implemented
+EFTYPE 79 Inappropriate file type or format
+EAUTH 80 Authentication error
+ENEEDAUTH 81 Need authenticator
+EIDRM 82 Identifier removed
+ENOMSG 83 No message of desired type
+EOVERFLOW 84 Value too large to be stored in data type
+EILSEQ 85 Illegal byte sequence
+ENOTSUP 86 Not supported
+ECANCELED 87 Operation canceled
+EBADMSG 88 Bad or Corrupt message
+ENODATA 89 No message available
+ENOSR 90 No STREAM resources
+ENOSTR 91 Not a STREAM
+ETIME 92 STREAM ioctl timeout
+ENOATTR 93 Attribute not found
+EMULTIHOP 94 Multihop attempted
+ENOLINK 95 Link has been severed
+EPROTO 96 Protocol error
+ELAST 96 Must equal largest errno
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/gensys.sh
@@ -1,0 +1,26 @@
+#!/bin/sh
+
+#
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+$name:
+ movq \$$num,%rax
+ syscall
+ jb 1f
+ retq
+
+1: movl %eax,(errno)
+ movl \$-1,%eax
+ retq
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+1 _Exit
+3 _read
+4 _write
+5 _open
+6 _close
+17 _brk
+20 _getpid
+37 _kill
+199 _lseek
+418 _gettimeofday
--- /dev/null
+++ b/src/libc/arch/amd64/netbsd/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/.gitignore
@@ -1,0 +1,11 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_kill.s
+_lseek.s
+_open.s
+_read.s
+_sigaction.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/Makefile
@@ -1,0 +1,35 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _open.o \
+ _read.o \
+ _write.o \
+ _brk.o \
+ _getheap.o \
+ _sigaction.o\
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ movq $end,%rax
+ retq
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/_sigaction.c
@@ -1,0 +1,14 @@
+#include <stddef.h>
+#include <sys.h>
+
+extern int _sigaction2(int sig,
+ struct sigaction *new, struct sigaction *old,
+ int siginfo[], int num);
+
+int
+_sigaction(int sig, struct sigaction *new, struct sigaction *old)
+{
+ extern int _setcontext[];
+
+ return _sigaction2(sig, new, old, _setcontext, 2);
+}
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/errno.lst
@@ -1,0 +1,96 @@
+EPERM 1 Operation not permitted
+ENOENT 2 No such file or directory
+ESRCH 3 No such process
+EINTR 4 Interrupted system call
+EIO 5 Input/output error
+ENXIO 6 Device not configured
+E2BIG 7 Argument list too long
+ENOEXEC 8 Exec format error
+EBADF 9 Bad file descriptor
+ECHILD 10 No child processes
+EDEADLK 11 Resource deadlock avoided
+ENOMEM 12 Cannot allocate memory
+EACCES 13 Permission denied
+EFAULT 14 Bad address
+ENOTBLK 15 Block device required
+EBUSY 16 Device busy
+EEXIST 17 File exists
+EXDEV 18 Cross-device link
+ENODEV 19 Operation not supported by device
+ENOTDIR 20 Not a directory
+EISDIR 21 Is a directory
+EINVAL 22 Invalid argument
+ENFILE 23 Too many open files in system
+EMFILE 24 Too many open files
+ENOTTY 25 Inappropriate ioctl for device
+ETXTBSY 26 Text file busy
+EFBIG 27 File too large
+ENOSPC 28 No space left on device
+ESPIPE 29 Illegal seek
+EROFS 30 Read-only file system
+EMLINK 31 Too many links
+EPIPE 32 Broken pipe
+EDOM 33 Numerical argument out of domain
+ERANGE 34 Result too large
+EAGAIN 35 Resource temporarily unavailable
+EINPROGRESS 36 Operation now in progress
+EALREADY 37 Operation already in progress
+ENOTSOCK 38 Socket operation on non-socket
+EDESTADDRREQ 39 Destination address required
+EMSGSIZE 40 Message too long
+EPROTOTYPE 41 Protocol wrong type for socket
+ENOPROTOOPT 42 Protocol not available
+EPROTONOSUPPORT 43 Protocol not supported
+ESOCKTNOSUPPORT 44 Socket type not supported
+EOPNOTSUPP 45 Operation not supported
+EPFNOSUPPORT 46 Protocol family not supported
+EAFNOSUPPORT 47 Address family not supported by protocol family
+EADDRINUSE 48 Address already in use
+EADDRNOTAVAIL 49 Can't assign requested address
+ENETDOWN 50 Network is down
+ENETUNREACH 51 Network is unreachable
+ENETRESET 52 Network dropped connection on reset
+ECONNABORTED 53 Software caused connection abort
+ECONNRESET 54 Connection reset by peer
+ENOBUFS 55 No buffer space available
+EISCONN 56 Socket is already connected
+ENOTCONN 57 Socket is not connected
+ESHUTDOWN 58 Can't send after socket shutdown
+ETOOMANYREFS 59 Too many references: can't splice
+ETIMEDOUT 60 Operation timed out
+ECONNREFUSED 61 Connection refused
+ELOOP 62 Too many levels of symbolic links
+ENAMETOOLONG 63 File name too long
+EHOSTDOWN 64 Host is down
+EHOSTUNREACH 65 No route to host
+ENOTEMPTY 66 Directory not empty
+EPROCLIM 67 Too many processes
+EUSERS 68 Too many users
+EDQUOT 69 Disk quota exceeded
+ESTALE 70 Stale NFS file handle
+EREMOTE 71 Too many levels of remote in path
+EBADRPC 72 RPC struct is bad
+ERPCMISMATCH 73 RPC version wrong
+EPROGUNAVAIL 74 RPC program not available
+EPROGMISMATCH 75 Program version wrong
+EPROCUNAVAIL 76 Bad procedure for program
+ENOLCK 77 No locks available
+ENOSYS 78 Function not implemented
+EFTYPE 79 Inappropriate file type or format
+EAUTH 80 Authentication error
+ENEEDAUTH 81 Need authenticator
+EIPSEC 82 IPsec processing failure
+ENOATTR 83 Attribute not found
+EILSEQ 84 Illegal byte sequence
+ENOMEDIUM 85 No medium found
+EMEDIUMTYPE 86 Wrong medium type
+EOVERFLOW 87 Value too large to be stored in data type
+ECANCELED 88 Operation canceled
+EIDRM 89 Identifier removed
+ENOMSG 90 No message of desired type
+ENOTSUP 91 Not supported
+EBADMSG 92 Bad message
+ENOTRECOVERABLE 93 State not recoverable
+EOWNERDEAD 94 Previous owner died
+EPROTO 95 Protocol error
+ELAST 95 Must be equal largest errno
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/gensys.sh
@@ -1,0 +1,26 @@
+#!/bin/sh
+
+#
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+$name:
+ movq \$$num,%rax
+ syscall
+ jb 1f
+ retq
+
+1: movl %eax,(errno)
+ movl \$-1,%eax
+ retq
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+1 _Exit
+3 _read
+4 _write
+5 _open
+6 _close
+17 _brk
+20 _getpid
+46 _sigaction
+122 _kill
+198 _lseek
--- /dev/null
+++ b/src/libc/arch/amd64/openbsd/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/amd64/setjmp.s
@@ -1,0 +1,17 @@
+ .file "setjmp.s"
+
+ .text
+ .globl setjmp
+setjmp:
+ mov %rbx,(%rdi)
+ mov %rbp,8(%rdi)
+ mov %r12,16(%rdi)
+ mov %r13,24(%rdi)
+ mov %r14,32(%rdi)
+ mov %r15,40(%rdi)
+ lea 8(%rsp),%rdx
+ mov %rdx,48(%rdi)
+ mov (%rsp),%rdx
+ mov %rdx,56(%rdi)
+ xor %rax,%rax
+ ret
--- /dev/null
+++ b/src/libc/arch/arm32/Makefile
@@ -1,0 +1,14 @@
+.POSIX:
+PROJECTDIR =../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = longjmp.o setjmp.o
+DIRS = linux
+
+all: $(OBJS) $(SYS)
+
+$(SYS): FORCE
+ +@cd $@ && $(MAKE)
+
+clean:
+ $(FORALL)
--- /dev/null
+++ b/src/libc/arch/arm32/linux/.gitignore
@@ -1,0 +1,10 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_kill.s
+_lseek.s
+_openat.s
+_read.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/arm32/linux/Makefile
@@ -1,0 +1,37 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _brk.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _openat.o \
+ _read.o \
+ _write.o \
+ _getheap.o \
+ _cerrno.o \
+ _open.o \
+ _sigaction.o \
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/arm32/linux/_cerrno.s
@@ -1,0 +1,14 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+
+_cerrno:
+ cmp r0,#0
+ blt 1f
+ bx lr
+
+1:
+ neg r0,r0
+ ldr r1,=errno
+ str r0,[r1]
+ mov r0,#-1
+ bx lr
--- /dev/null
+++ b/src/libc/arch/arm32/linux/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ mov r0,#0
+ b _brk
--- /dev/null
+++ b/src/libc/arch/arm32/linux/_open.c
@@ -1,0 +1,13 @@
+#include <stddef.h>
+
+#include "../../../syscall.h"
+
+#define AT_FDCWD -100
+
+extern int _openat(int fd, const char *fname, int flags);
+
+int
+_open(const char *fname, int flags)
+{
+ return _openat(AT_FDCWD, fname, flags);
+}
--- /dev/null
+++ b/src/libc/arch/arm32/linux/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/arm32/linux/gensys.sh
@@ -1,0 +1,19 @@
+#!/bin/sh
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+ .arm
+$name:
+ push {r7,lr}
+ ldr r7,=$num
+ swi 0
+ pop {r7,lr}
+ b _cerrno
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/arm32/linux/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/arm32/linux/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/arm32/linux/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/arm32/linux/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+322 _openat
+6 _close
+3 _read
+4 _write
+1 _Exit
+20 _getpid
+37 _kill
+19 _lseek
+45 _brk
+134 _sigaction
--- /dev/null
+++ b/src/libc/arch/arm32/linux/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/arm32/longjmp.s
@@ -1,0 +1,11 @@
+ .file "longjmp.s"
+
+ .text
+ .globl longjmp
+longjmp:
+ ldmia r0, {r4-r11, sp, lr}
+
+ // If r1 is 0 return 1 instead
+ movs r0, r1
+ moveq r0, #1
+ bx lr
--- /dev/null
+++ b/src/libc/arch/arm32/setjmp.s
@@ -1,0 +1,9 @@
+ .file "setjmp.s"
+
+ .text
+ .globl setjmp
+setjmp:
+ // IHI0042F_aapcs.pdf 5.1.1 callee saved registers
+ stmia r0, {r4-r11, sp, lr}
+ mov r0, #0
+ bx lr
--- /dev/null
+++ b/src/libc/arch/arm64/Makefile
@@ -1,0 +1,14 @@
+.POSIX:
+PROJECTDIR =../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = longjmp.o setjmp.o
+DIRS = linux
+
+all: $(OBJS) $(SYS)
+
+$(SYS): FORCE
+ +@cd $@ && $(MAKE)
+
+clean:
+ $(FORALL)
--- /dev/null
+++ b/src/libc/arch/arm64/linux/.gitignore
@@ -1,0 +1,10 @@
+_Exit.s
+_brk.s
+_close.s
+_getpid.s
+_kill.s
+_lseek.s
+_openat.s
+_read.s
+_sys_errlist.c
+_write.s
--- /dev/null
+++ b/src/libc/arch/arm64/linux/Makefile
@@ -1,0 +1,37 @@
+.POSIX:
+PROJECTDIR =../../../../..
+include $(PROJECTDIR)/scripts/rules.mk
+include ../../rules.mk
+
+OBJS = _Exit.o \
+ _close.o \
+ _brk.o \
+ _getpid.o \
+ _kill.o \
+ _lseek.o \
+ _openat.o \
+ _read.o \
+ _write.o \
+ _getheap.o \
+ _cerrno.o \
+ _open.o \
+ _sigaction.o \
+ _tzone.o \
+ getenv.o \
+ raise.o \
+ signal.o \
+ time.o \
+ _sys_errlist.o \
+
+all: syscall
+ $(MAKE) objs
+
+objs: $(OBJS)
+
+syscall: syscall.lst
+ ./gensys.sh syscall.lst
+ touch syscall
+
+clean:
+ rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f syscall _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/arm64/linux/_cerrno.s
@@ -1,0 +1,13 @@
+ .file "_cerrno.s"
+ .globl _cerrno
+
+_cerrno:
+ cmp x0,#0
+ b.lt 1f
+ ret
+
+1: neg x0,x0
+ adr x1,errno
+ str w0,[x1]
+ mov x0,#-1
+ ret
--- /dev/null
+++ b/src/libc/arch/arm64/linux/_getheap.s
@@ -1,0 +1,6 @@
+ .file "_getheap.s"
+
+ .globl _getheap
+_getheap:
+ mov x0,#0
+ b _brk
--- /dev/null
+++ b/src/libc/arch/arm64/linux/_open.c
@@ -1,0 +1,13 @@
+#include <stddef.h>
+
+#include "../../../syscall.h"
+
+#define AT_FDCWD -100
+
+extern int _openat(int fd, const char *fname, int flags);
+
+int
+_open(const char *fname, int flags)
+{
+ return _openat(AT_FDCWD, fname, flags);
+}
--- /dev/null
+++ b/src/libc/arch/arm64/linux/_sigaction.c
@@ -1,0 +1,14 @@
+#include <stddef.h>
+#include <sys.h>
+
+extern int _sigaction2(int sig,
+ struct sigaction *new, struct sigaction *old,
+ int siginfo[], int num);
+
+int
+_sigaction(int sig, struct sigaction *new, struct sigaction *old)
+{
+ extern int _setcontext[];
+
+ return _sigaction2(sig, new, old, _setcontext, 2);
+}
--- /dev/null
+++ b/src/libc/arch/arm64/linux/_tzone.c
@@ -1,0 +1,1 @@
+#include "../../posix/_tzone.c"
--- /dev/null
+++ b/src/libc/arch/arm64/linux/gensys.sh
@@ -1,0 +1,21 @@
+#!/bin/sh
+
+#
+# This job is very easy because app and kernel ABI are identical
+# until the 4th parameter, so we only have to set the syscall
+# number in rax
+
+sed 's/[ ]*#.*//
+ /^$/d' syscall.lst |
+while read num name
+do
+cat <<EOF > $name.s
+ .file "$name.s"
+
+ .globl $name
+$name:
+ mov x8,#$num
+ svc 0
+ b _cerrno
+EOF
+done
--- /dev/null
+++ b/src/libc/arch/arm64/linux/getenv.c
@@ -1,0 +1,1 @@
+#include "../../posix/getenv.c"
--- /dev/null
+++ b/src/libc/arch/arm64/linux/raise.c
@@ -1,0 +1,1 @@
+#include "../../posix/raise.c"
--- /dev/null
+++ b/src/libc/arch/arm64/linux/signal.c
@@ -1,0 +1,1 @@
+#include "../../posix/signal.c"
--- /dev/null
+++ b/src/libc/arch/arm64/linux/syscall.lst
@@ -1,0 +1,11 @@
+#number name
+56 _openat
+57 _close
+63 _read
+64 _write
+93 _Exit
+172 _getpid
+129 _kill
+62 _lseek
+134 _sigaction
+214 _brk
--- /dev/null
+++ b/src/libc/arch/arm64/linux/time.c
@@ -1,0 +1,1 @@
+#include "../../posix/time.c"
--- /dev/null
+++ b/src/libc/arch/arm64/longjmp.s
@@ -1,0 +1,22 @@
+ .file "longjmp.s"
+
+ .text
+ .globl longjmp
+longjmp:
+ ldp x19, x20, [x0,#0]
+ ldp x21, x22, [x0,#16]
+ ldp x23, x24, [x0,#32]
+ ldp x25, x26, [x0,#48]
+ ldp x27, x28, [x0,#64]
+ ldp x29, x30, [x0,#80]
+ ldr x2, [x0,#104]
+ mov sp, x2
+ ldp d8 , d9, [x0,#112]
+ ldp d10, d11, [x0,#128]
+ ldp d12, d13, [x0,#144]
+ ldp d14, d15, [x0,#160]
+
+ mov x0, x1
+ cbnz x1, 1f
+ mov x0, #1
+1: br x30
--- /dev/null
+++ b/src/libc/arch/arm64/setjmp.s
@@ -1,0 +1,20 @@
+ .file "setjmp.s"
+
+ .text
+ .globl setjmp
+setjmp:
+ // IHI0055B_aapcs64.pdf 5.1.1, 5.1.2 callee saved registers
+ stp x19, x20, [x0,#0]
+ stp x21, x22, [x0,#16]
+ stp x23, x24, [x0,#32]
+ stp x25, x26, [x0,#48]
+ stp x27, x28, [x0,#64]
+ stp x29, x30, [x0,#80]
+ mov x2, sp
+ str x2, [x0,#104]
+ stp d8, d9, [x0,#112]
+ stp d10, d11, [x0,#128]
+ stp d12, d13, [x0,#144]
+ stp d14, d15, [x0,#160]
+ mov x0, #0
+ ret
--- /dev/null
+++ b/src/libc/arch/generrno.sh
@@ -1,0 +1,35 @@
+#!/bin/sh
+
+trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP QUIT INT TERM
+
+for i
+do
+ case $i in
+ -o)
+ out=$2
+ shift 2
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ echo usage: generrno.sh [-o output] file ...
+ exit 1
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+awk '
+/^E/ && $2 > 0 {
+ errno[$1] = $2
+}
+
+END {
+ for (i in errno)
+ print "#define", i, errno[i] | "sort -n -k3"
+ close("sort -n -k3")
+}' $@ > $$.tmp && mv $$.tmp ${out:-errno.h}
--- /dev/null
+++ b/src/libc/arch/generrstr.sh
@@ -1,0 +1,23 @@
+#!/bin/sh
+
+trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM
+
+awk '
+/^E/ && $2 > 0 {
+ str = ""
+ for (i = 3; i <= NF; i++)
+ str = str " " $i
+ sub(/^ /, "", str)
+ errstr[$1] = str
+ if ($2 > max)
+ max = $2;
+}
+
+END {
+ print "#include <errno.h>\n"
+ print "char *_sys_errlist[] = {"
+ for (i in errstr)
+ printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]
+ print "};"
+ print "int _sys_nerr =", $2 + 1 ";"
+}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/mkerrstr
@@ -1,0 +1,24 @@
+#!/bin/sh
+
+trap 'r=$?; rm -f $$.tmp; exit $r' EXIT HUP INT QUIT TERM
+
+awk '
+/^#define[ \t]*E/{
+ str = ""
+ for (i = 5; i < NF; i++)
+ str = str " " $i
+ sub(/^ /, "", str)
+ errstr[$2] = str
+ if ($3 > max)
+ max = $3;
+}
+
+END {
+ print "#include <errno.h>\n"
+ print "char *const _sys_errlist[] = {"
+ for (i in errstr)
+ printf "\t%-20.20s = \"%s\",\n", "[" i "]", errstr[i]
+
+ print "};"
+ print "const int _sys_nerr =", max";"
+}' $@ > $$.tmp && mv $$.tmp _sys_errlist.c
--- /dev/null
+++ b/src/libc/arch/posix/_tzone.c
@@ -1,0 +1,27 @@
+#include <stdlib.h>
+#include <time.h>
+#include "../../libc.h"
+
+struct tzone *
+_tzone(struct tm *tm)
+{
+ static struct tzone tz;
+ static int first = 1;
+
+ if (!first)
+ return &tz;
+
+ tz.name = getenv("TZ");
+ if (!tz.name || *tz.name == '\0') {
+ tz.name = NULL;
+ tz.gmtoff = 0;
+ tz.isdst = 0;
+ } else {
+ /* TODO: parse TZ string */
+ tz.gmtoff = 0;
+ tz.isdst = 0;
+ }
+ first = 0;
+
+ return &tz;
+}
--- /dev/null
+++ b/src/libc/arch/posix/getenv.c
@@ -1,0 +1,18 @@
+#include <stdlib.h>
+#include <string.h>
+#undef getenv
+
+extern char **_environ;
+
+char *
+getenv(const char *name)
+{
+ char **p, *s;
+ size_t len = strlen(name);
+
+ for (p = _environ; s = *p; ++p) {
+ if (!strncmp(name, s, len) && s[len] == '=')
+ return s + len + 1;
+ }
+ return NULL;
+}
--- /dev/null
+++ b/src/libc/arch/posix/geterrno.sh
@@ -1,0 +1,8 @@
+#!/bin/sh
+
+awk '/define[ ]*E/ && $3 ~ /[0-9]+/ && $3 > 0 {
+ sub(/\#define[ ]*/, "")
+ sub(/\/\*/, "")
+ sub(/\*\//, "")
+}' /usr/include/sys/errno.h
--- /dev/null
+++ b/src/libc/arch/posix/raise.c
@@ -1,0 +1,11 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys.h>
+
+#undef raise
+
+int
+raise(int signum)
+{
+ return _kill(_getpid(), signum);
+}
--- /dev/null
+++ b/src/libc/arch/posix/signal.c
@@ -1,0 +1,17 @@
+#include <stddef.h>
+#include <signal.h>
+#include <sys.h>
+#undef signal
+
+void
+(*signal(int signum, void (*func)(int)))(int)
+{
+ struct sigaction sa = {
+ .sa_handler = func,
+ };
+
+ if (_sigaction(signum, &sa, &sa) < 0)
+ return SIG_ERR;
+
+ return sa.sa_handler;
+}
--- /dev/null
+++ b/src/libc/arch/posix/time.c
@@ -1,0 +1,21 @@
+#include <time.h>
+
+struct timeval {
+ time_t tv_sec;
+ int tv_usec; /* TODO use a arch type */
+};
+
+int
+_gettimeofday(struct timeval * restrict tp, void * restrict tzp);
+
+time_t
+time(time_t *t)
+{
+ struct timeval tv;
+
+ if (_gettimeofday(&tv, NULL) == -1)
+ return -1;
+ if (t)
+ *t =tv.tv_sec;
+ return tv.tv_sec;
+}
--- /dev/null
+++ b/src/libc/arch/rules.mk
@@ -1,0 +1,6 @@
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+SYSERRNO = $(INCDIR)/bits/$(SYS)/sys/errno.h
+
+_sys_errlist.c: $(SYSERRNO)
+ ../../mkerrstr $(SYSERRNO)
--- /dev/null
+++ b/src/libc/assert/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = __assert.o\
+ assert.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/assert/__assert.c
@@ -1,0 +1,9 @@
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+void __assert(char *exp, char *file, long line)
+{
+ fprintf(stderr, "%s:%ld: assertion failed '%s'\n", file, line, exp);
+ abort();
+}
--- /dev/null
+++ b/src/libc/assert/assert.c
@@ -1,0 +1,13 @@
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#undef assert
+
+void
+assert(int exp)
+{
+ if (exp)
+ return;
+ fputs("assert failed\n", stderr);
+ abort();
+}
--- /dev/null
+++ b/src/libc/ctype/Makefile
@@ -1,0 +1,24 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = ctype.o\
+ isalnum.o\
+ isalpha.o\
+ isascii.o\
+ isblank.o\
+ iscntrl.o\
+ isdigit.o\
+ isgraph.o\
+ islower.o\
+ isprint.o\
+ ispunct.o\
+ isspace.o\
+ isupper.o\
+ isxdigit.o\
+ tolower.o\
+ toupper.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/ctype/ctype.c
@@ -1,0 +1,22 @@
+#include <ctype.h>
+
+/* __ctype is shifted by one to match EOF */
+const unsigned char __ctype[257] = {
+ 0, /* EOF */
+ _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
+ _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */
+ _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */
+ _C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */
+ _S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */
+ _P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */
+ _D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */
+ _D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */
+ _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */
+ _U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */
+ _U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */
+ _U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */
+ _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */
+ _L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */
+ _L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */
+ _L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */
+};
--- /dev/null
+++ b/src/libc/ctype/isalnum.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isalnum
+
+int
+isalnum(int c)
+{
+ return (__ctype+1)[c] & (_U|_L|_D);
+}
--- /dev/null
+++ b/src/libc/ctype/isalpha.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isalpha
+
+int
+isalpha(int c)
+{
+ return (__ctype+1)[c] & (_U|_L);
+}
--- /dev/null
+++ b/src/libc/ctype/isascii.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isascii
+
+int
+isascii(int c)
+{
+ return c <= 0x7f;
+}
--- /dev/null
+++ b/src/libc/ctype/isblank.c
@@ -1,0 +1,7 @@
+#include <ctype.h>
+
+int
+isblank(int c)
+{
+ return (c == ' ') || (c == '\t');
+}
--- /dev/null
+++ b/src/libc/ctype/iscntrl.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef iscntrl
+
+int
+iscntrl(int c)
+{
+ return (__ctype+1)[c] & (_C);
+}
--- /dev/null
+++ b/src/libc/ctype/isdigit.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isdigit
+
+int
+isdigit(int c)
+{
+ return (__ctype+1)[c] & (_D);
+}
--- /dev/null
+++ b/src/libc/ctype/isgraph.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isgraph
+
+int
+isgraph(int c)
+{
+ return (__ctype+1)[c] & (_P|_U|_L|_D);
+}
--- /dev/null
+++ b/src/libc/ctype/islower.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef islower
+
+int
+islower(int c)
+{
+ return (__ctype+1)[c] & _L;
+}
--- /dev/null
+++ b/src/libc/ctype/isprint.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isprint
+
+int
+isprint(int c)
+{
+ return (__ctype+1)[c] & (_P|_U|_L|_D|_SP);
+}
--- /dev/null
+++ b/src/libc/ctype/ispunct.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef ispunct
+
+int
+ispunct(int c)
+{
+ return (__ctype+1)[c] & (_P);
+}
--- /dev/null
+++ b/src/libc/ctype/isspace.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isspace
+
+int
+isspace(int c)
+{
+ return (__ctype+1)[c] & _S;
+}
--- /dev/null
+++ b/src/libc/ctype/isupper.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isupper
+
+int
+isupper(int c)
+{
+ return (__ctype+1)[c] & _U;
+}
--- /dev/null
+++ b/src/libc/ctype/isxdigit.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef isxdigit
+
+int
+isxdigit(int c)
+{
+ return (__ctype+1)[c] & (_D|_X);
+}
--- /dev/null
+++ b/src/libc/ctype/tolower.c
@@ -1,0 +1,9 @@
+#define __USE_MACROS
+#include <ctype.h>
+#undef tolower
+
+int
+tolower(int c)
+{
+ return (isupper(c)) ? c | 0x20 : c;
+}
--- /dev/null
+++ b/src/libc/ctype/toupper.c
@@ -1,0 +1,8 @@
+#include <ctype.h>
+#undef toupper
+
+int
+toupper(int c)
+{
+ return (islower(c)) ? c & ~0x20 : c;
+}
--- /dev/null
+++ b/src/libc/libc.h
@@ -1,0 +1,42 @@
+#define SUN 0
+#define MON 1
+#define TUE 2
+#define WED 3
+#define THU 4
+#define FRI 5
+#define SAT 6
+
+#define JAN 0
+#define FEB 1
+#define DEC 11
+
+#define EPOCH 1970
+#define FEBDAYS(y) ((_daysyear(y) == 366) ? 29 : 28)
+#define SECMIN 60
+#define SECHOUR (60 * SECMIN) /* 3600 */
+#define SECDAY (24 * SECHOUR) /* 86400 */
+
+#ifdef stdin
+extern FILE *_fpopen(const char * restrict fname,
+ const char * restrict mode,
+ FILE * restrict fp);
+#endif
+
+struct tzone {
+ char *name;
+ int gmtoff;
+ int isdst;
+};
+
+struct tm;
+
+extern struct tzone *_tzone(struct tm *tm);
+extern int _daysyear(int year);
+extern int _newyear(int year);
+extern void *_getheap(void);
+#ifdef FILE
+extern int _flsbuf(FILE *fp);
+extern void _allocbuf(FILE *fp);
+#endif
+
+extern int _daysmon[12];
--- /dev/null
+++ b/src/libc/locale/Makefile
@@ -1,0 +1,10 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = localeconv.o\
+ setlocale.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/locale/localeconv.c
@@ -1,0 +1,29 @@
+#include <locale.h>
+#include <limits.h>
+#undef localeconv
+
+struct lconv *
+localeconv(void)
+{
+ static struct lconv lc = {
+ .decimal_point = ".",
+ .thousands_sep = "",
+ .grouping = "",
+ .mon_decimal_point = "",
+ .mon_thousands_sep = "",
+ .mon_grouping = "",
+ .positive_sign = "",
+ .negative_sign = "",
+ .currency_symbol = "",
+ .int_curr_symbol = "",
+ .frac_digits = CHAR_MAX,
+ .p_cs_precedes = CHAR_MAX,
+ .n_cs_precedes = CHAR_MAX,
+ .p_sep_by_space = CHAR_MAX,
+ .p_sign_posn = CHAR_MAX,
+ .n_sep_by_space = CHAR_MAX,
+ .n_sign_posn = CHAR_MAX,
+ .int_frac_digits = CHAR_MAX,
+ };
+ return &lc;
+}
--- /dev/null
+++ b/src/libc/locale/setlocale.c
@@ -1,0 +1,16 @@
+#include <locale.h>
+#include <stddef.h>
+#undef setlocale
+
+char *
+setlocale(int category, const char *locale)
+{
+ if (category > LC_TIME || category < LC_ALL)
+ return NULL;
+ if (!locale ||
+ locale[0] == '\0' ||
+ locale[0] == 'C' && locale[1] == '\0') {
+ return "C";
+ }
+ return NULL;
+}
--- /dev/null
+++ b/src/libc/mklst
@@ -1,0 +1,12 @@
+#!/bin/sh
+
+set -e
+trap 'r=$?;rm -f $$.tmp;exit $r' EXIT HUP QUIT INT TERM
+archive=${1?'First parameter must be the archive name'}
+
+if test -f $archive
+then
+ newer="-newer $archive"
+fi
+
+find . -name '*.o' $newer > $$.tmp && mv $$.tmp objlst
--- /dev/null
+++ b/src/libc/stdio/Makefile
@@ -1,0 +1,47 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = __getc.o\
+ __putc.o\
+ _flsbuf.o\
+ _fpopen.o\
+ clearerr.o\
+ fclose.o\
+ feof.o\
+ ferror.o\
+ fgetc.o\
+ fgets.o\
+ fopen.o\
+ fprintf.o\
+ fputc.o\
+ fputs.o\
+ fread.o\
+ freopen.o\
+ fseek.o\
+ ftell.o\
+ fwrite.o\
+ getc.o\
+ getchar.o\
+ gets.o\
+ perror.o\
+ printf.o\
+ putc.o\
+ putchar.o\
+ puts.o\
+ rewind.o\
+ setbuf.o\
+ setvbuf.o\
+ snprintf.o\
+ sprintf.o\
+ __iob.o\
+ tmpnam.o\
+ vfprintf.o\
+ vsnprintf.o\
+ vsprintf.o\
+ vprintf.o\
+ _allocbuf.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/stdio/__getc.c
@@ -1,0 +1,39 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "../libc.h"
+#include "../syscall.h"
+
+int
+__getc(FILE *fp)
+{
+ int cnt;
+
+ if (fp->flags & (_IOEOF | _IOERR))
+ return EOF;
+
+ if ((fp->flags & (_IOREAD | _IORW)) == 0) {
+ fp->flags |= _IOERR;
+ errno = EBADF;
+ return EOF;
+ }
+
+ if (fp->flags & _IOSTRG) {
+ fp->flags |= _IOEOF;
+ return EOF;
+ }
+
+ if (fp->buf == NULL && _allocbuf(fp))
+ return EOF;
+
+ if ((cnt = _read(fp->fd, fp->buf, fp->len)) <= 0) {
+ fp->flags |= (cnt == 0) ? _IOEOF : _IOERR;
+ return EOF;
+ }
+
+ fp->flags |= _IOREAD;
+ fp->rp = fp->buf;
+ fp->wp = fp->buf + cnt;
+
+ return *fp->rp++;
+}
--- /dev/null
+++ b/src/libc/stdio/__iob.c
@@ -1,0 +1,20 @@
+#include <stdio.h>
+
+FILE __iob[FOPEN_MAX] = {
+ {
+ .fd = 0,
+ .flags = _IOREAD,
+ },
+ {
+ .fd = 1,
+ .flags = _IOWRITE | _IOLBF,
+ },
+ {
+ .fd = 2,
+ .buf = stderr->unbuf,
+ .len = sizeof(stderr->unbuf),
+ .flags = _IOWRITE | _IONBF,
+ .rp = stderr->unbuf,
+ .wp = stderr->unbuf,
+ },
+};
--- /dev/null
+++ b/src/libc/stdio/__putc.c
@@ -1,0 +1,78 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "../libc.h"
+
+int
+fflush(FILE *fp)
+{
+ int err;
+
+ if (fp)
+ return _flsbuf(fp);
+
+ err = 0;
+ for (fp = __iob; fp < &__iob[FOPEN_MAX]; ++fp) {
+ if ((fp->flags & _IOWRITE) == 0 && _flsbuf(fp))
+ err = EOF;
+ }
+ return err;
+}
+
+static void
+cleanup(void)
+{
+ fflush(NULL);
+}
+
+int
+__putc(int ch, FILE *fp)
+{
+ static int first = 1;
+
+ if (fp->flags & _IOERR)
+ return EOF;
+
+ if (fp->flags & _IOREAD) {
+ fp->flags |= _IOERR;
+ errno = EBADF;
+ return EOF;
+ }
+
+ if (fp->flags & _IOSTRG) {
+ fp->flags |= _IOERR;
+ return EOF;
+ }
+
+ if (fp->buf == NULL && _allocbuf(fp))
+ return EOF;
+
+ if (first) {
+ if (atexit(cleanup)) {
+ fp->flags |= _IOERR;
+ errno = ENOMEM;
+ return EOF;
+ }
+ first = 0;
+ }
+
+ if (fp->flags & _IOLBF) {
+ if (fp->wp == fp->lp && _flsbuf(fp))
+ return EOF;
+ *fp->wp++ = ch;
+ if (ch == '\n' && _flsbuf(fp))
+ return EOF;
+ } else if (fp->flags & _IOFBF) {
+ if (_flsbuf(fp))
+ return EOF;
+ *fp->wp++ = ch;
+ fp->rp = fp->buf + fp->len;
+ } else {
+ *fp->wp++ = ch;
+ if (_flsbuf(fp))
+ return EOF;
+ }
+
+ fp->flags |= _IOWRITE;
+ return ch & 0xFF;
+}
--- /dev/null
+++ b/src/libc/stdio/_allocbuf.c
@@ -1,0 +1,21 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "../libc.h"
+
+int
+_allocbuf(FILE *fp)
+{
+ char *bp;
+
+ if ((bp = malloc(BUFSIZ)) == NULL) {
+ fp->flags |= _IOERR;
+ errno = ENOMEM;
+ return EOF;
+ }
+ fp->len = BUFSIZ;
+ fp->rp = fp->wp = fp->buf = bp;
+ fp->lp = bp + BUFSIZ;
+
+ return 0;
+}
--- /dev/null
+++ b/src/libc/stdio/_flsbuf.c
@@ -1,0 +1,23 @@
+#include <errno.h>
+#include <stdio.h>
+
+#include "../libc.h"
+#include "../syscall.h"
+
+int
+_flsbuf(FILE *fp)
+{
+ size_t cnt;
+
+ if (fp->flags&_IOREAD)
+ return 0;
+
+ cnt = fp->wp - fp->buf;
+ if (cnt > 0 && _write(fp->fd, fp->buf, cnt) != cnt) {
+ fp->flags |= _IOERR;
+ return EOF;
+ }
+ fp->wp = fp->buf;
+
+ return 0;
+}
--- /dev/null
+++ b/src/libc/stdio/_fpopen.c
@@ -1,0 +1,75 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys.h>
+#include "../syscall.h"
+#include "../libc.h"
+#undef fopen
+
+FILE *
+_fpopen(const char * restrict fname,
+ const char * restrict mode,
+ FILE * restrict fp)
+{
+ int i, flags, fd, rw, bin;
+
+ flags = rw = bin = 0;
+
+ if (mode[0] == '\0')
+ goto einval;
+
+ for (i = 1; mode[i]; ++i) {
+ switch (mode[i]) {
+ case '+':
+ if (rw)
+ goto einval;
+ rw = 1;
+ break;
+ case 'b':
+ if (bin)
+ goto einval;
+ bin = 1;
+ break;
+ default:
+ goto einval;
+ }
+ }
+
+ switch (mode[0]) {
+ case 'a':
+ flags |= O_APPEND | O_CREAT;
+ goto wrflags;
+ case 'w':
+ flags |= O_TRUNC | O_CREAT;
+ wrflags:
+ flags |= (rw) ? O_RDWR : O_WRONLY;
+ break;
+ case 'r':
+ flags = (rw) ? O_RDWR : O_RDONLY;
+ break;
+ default:
+ einval:
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if ((fd = _open(fname, flags)) < 0)
+ return NULL;
+
+ fp->buf = NULL;
+ fp->fd = fd;
+
+ if (!bin)
+ fp->flags |= _IOTXT;
+
+ if (flags & O_RDWR)
+ fp->flags |= _IORW;
+ else if (flags & O_RDONLY)
+ fp->flags |= _IOREAD;
+ else
+ fp->flags |= _IOWRITE;
+
+ fp->lp = fp->rp = fp->wp = NULL;
+
+ return fp;
+}
--- /dev/null
+++ b/src/libc/stdio/clearerr.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef clearerr
+
+void
+clearerr(FILE *fp)
+{
+ fp->flags &= ~(_IOERR | _IOEOF);
+}
--- /dev/null
+++ b/src/libc/stdio/fclose.c
@@ -1,0 +1,32 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include "../syscall.h"
+#undef fclose
+
+int
+fclose(FILE *fp)
+{
+ int r = EOF;
+
+ if ((fp->flags & _IOSTRG) == 0 &&
+ fp->flags & (_IOWRITE | _IOREAD | _IORW)) {
+ r = 0;
+ if (_flsbuf(fp) == EOF)
+ r = EOF;
+ if (_close(fp->fd) < 0)
+ r = EOF;
+ }
+
+ if (fp->flags & _IOALLOC) {
+ free(fp->buf);
+ fp->buf = NULL;
+ }
+
+ fp->flags &= ~(_IOWRITE | _IOREAD | _IORW |
+ _IOERR | _IOEOF |
+ _IOALLOC |
+ _IOTXT |
+ _IOSTRG);
+
+ return r;
+}
--- /dev/null
+++ b/src/libc/stdio/feof.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef feof
+
+int
+feof(FILE *fp)
+{
+ return fp->flags & _IOEOF;
+}
--- /dev/null
+++ b/src/libc/stdio/ferror.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef ferror
+
+int
+ferror(FILE *fp)
+{
+ return fp->flags & _IOERR;
+}
--- /dev/null
+++ b/src/libc/stdio/fgetc.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef fgetc
+
+int
+fgetc(FILE *fp)
+{
+ return getc(fp);
+}
--- /dev/null
+++ b/src/libc/stdio/fgets.c
@@ -1,0 +1,19 @@
+#include <stdio.h>
+#undef fgets
+
+char *
+fgets(char *s, int n, FILE *fp)
+{
+ int ch = 0;
+ char *t = s;
+
+ while (--n > 0 && (ch = getc(fp)) != EOF) {
+ if ((*t++ = ch) == '\n')
+ break;
+ }
+ if (ch == EOF && s == t)
+ return NULL;
+ *t = '\0';
+
+ return s;
+}
--- /dev/null
+++ b/src/libc/stdio/fopen.c
@@ -1,0 +1,23 @@
+#include <errno.h>
+#include <stdio.h>
+
+#include "../syscall.h"
+#include "../libc.h"
+#undef fopen
+
+
+FILE *
+fopen(const char * restrict name, const char * restrict mode)
+{
+ FILE *fp;
+
+ for (fp = __iob; fp < &__iob[FOPEN_MAX]; ++fp) {
+ if ((fp->flags & (_IOREAD | _IOWRITE | _IORW)) == 0)
+ break;
+ }
+ if (fp == &__iob[FOPEN_MAX]) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ return _fpopen(name, mode, fp);
+}
--- /dev/null
+++ b/src/libc/stdio/fprintf.c
@@ -1,0 +1,15 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef fprintf
+
+int
+fprintf(FILE * restrict fp, const char * restrict fmt, ...)
+{
+ va_list va;
+ int cnt;
+
+ va_start(va, fmt);
+ cnt = vfprintf(fp, fmt, va);
+ va_end(va);
+ return cnt;
+}
--- /dev/null
+++ b/src/libc/stdio/fputc.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef fputc
+
+int
+fputc(int c, FILE *fp)
+{
+ return putc(c, fp);
+}
--- /dev/null
+++ b/src/libc/stdio/fputs.c
@@ -1,0 +1,12 @@
+#include <stdio.h>
+#undef fputs
+
+int
+fputs(const char * restrict bp, FILE * restrict fp)
+{
+ int r, ch;
+
+ while (ch = *bp++)
+ r = putc(ch, fp);
+ return r;
+}
--- /dev/null
+++ b/src/libc/stdio/fread.c
@@ -1,0 +1,25 @@
+#include <stdio.h>
+#undef fread
+
+size_t
+fread(void * restrict ptr, size_t size, size_t nmemb,
+ FILE * restrict fp)
+{
+ unsigned char *bp = ptr;
+ size_t n, i;
+ int c;
+
+ if (size == 0)
+ return 0;
+
+ for (n = 0; n < nmemb; n++) {
+ i = size;
+ do {
+ if ((c = getc(fp)) == EOF)
+ return n;
+ *bp++ = c;
+ } while (--i);
+ }
+
+ return n;
+}
--- /dev/null
+++ b/src/libc/stdio/freopen.c
@@ -1,0 +1,14 @@
+#include <stdio.h>
+
+#include "../syscall.h"
+#include "../libc.h"
+#undef freopen
+
+FILE *
+freopen(const char * restrict name, const char * restrict mode,
+ FILE * restrict fp)
+{
+ if (fclose(fp) == EOF)
+ return NULL;
+ return _fpopen(name, mode, fp);
+}
--- /dev/null
+++ b/src/libc/stdio/fseek.c
@@ -1,0 +1,26 @@
+#include <stdio.h>
+#include "../syscall.h"
+#undef fseek
+
+int
+fseek(FILE *fp, long off, int whence)
+{
+ if (fp->flags & _IOERR)
+ return EOF;
+
+ if ((fp->flags & _IOWRITE) && _flsbuf(fp))
+ return -1;
+ else if (whence == SEEK_CUR && (fp->flags & _IOREAD))
+ off -= fp->wp - fp->rp;
+
+ if (_lseek(fp->fd, off, whence) < 0) {
+ fp->flags |= _IOERR;
+ return EOF;
+ }
+
+ if (fp->flags & _IORW)
+ fp->flags &= ~(_IOREAD | _IOWRITE);
+ fp->flags &= ~_IOEOF;
+
+ return 0;
+}
--- /dev/null
+++ b/src/libc/stdio/ftell.c
@@ -1,0 +1,27 @@
+#include <stdio.h>
+#include "../syscall.h"
+#undef ftell
+
+long
+ftell(FILE *fp)
+{
+ long off;
+ unsigned char *p;
+
+ if (fp->flags & _IOERR)
+ return EOF;
+
+ if ((off = _lseek(fp->fd, 0, SEEK_CUR)) < 0) {
+ fp->flags |= _IOERR;
+ return EOF;
+ }
+
+ if (fp->flags & _IOREAD)
+ return off - (fp->wp - fp->rp);
+
+ if (fp->flags & _IOWRITE) {
+ p = (fp->flags & _IOLBF) ? fp->lp : fp->wp;
+ return off + (p - fp->buf);
+ }
+ return off;
+}
--- /dev/null
+++ b/src/libc/stdio/fwrite.c
@@ -1,0 +1,24 @@
+#include <stdio.h>
+#undef fwrite
+
+size_t
+fwrite(const void * restrict ptr, size_t size, size_t nmemb,
+ FILE * restrict fp)
+{
+ const unsigned char *bp = ptr;
+ size_t n, i;
+
+ if (size == 0)
+ return 0;
+
+ for (n = 0; n < nmemb; n++) {
+ i = size;
+ do
+ putc(*bp++, fp);
+ while (--i);
+ if (ferror(fp))
+ break;
+ }
+
+ return n;
+}
--- /dev/null
+++ b/src/libc/stdio/getc.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef getc
+
+int
+getc(FILE *fp)
+{
+ return (fp->rp >= fp->wp) ? __getc(fp) : *fp->rp++;
+}
--- /dev/null
+++ b/src/libc/stdio/getchar.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef getchar
+
+int
+getchar(void)
+{
+ return getc(stdin);
+}
--- /dev/null
+++ b/src/libc/stdio/gets.c
@@ -1,0 +1,17 @@
+#include <stdio.h>
+#undef gets
+
+char *
+gets(char *s)
+{
+ int ch;
+ char *t = s;
+
+ while ((ch = getc(stdin)) != EOF && ch != '\n')
+ *t++ = ch;
+ if (ch == EOF && s == t)
+ return NULL;
+ *t = '\0';
+
+ return s;
+}
--- /dev/null
+++ b/src/libc/stdio/perror.c
@@ -1,0 +1,16 @@
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#undef perror
+
+void
+perror(const char *msg)
+{
+ if (msg && *msg) {
+ fputs(msg, stderr);
+ putc(':', stderr);
+ putc(' ', stderr);
+ }
+ fputs(strerror(errno), stderr);
+ putc('\n', stderr);
+}
--- /dev/null
+++ b/src/libc/stdio/printf.c
@@ -1,0 +1,15 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef printf
+
+int
+printf(const char * restrict fmt, ...)
+{
+ int cnt;
+ va_list va;
+
+ va_start(va, fmt);
+ cnt = vfprintf(stdout, fmt, va);
+ va_end(va);
+ return cnt;
+}
--- /dev/null
+++ b/src/libc/stdio/putc.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef putc
+
+int
+putc(int ch, FILE *fp)
+{
+ return (fp->wp >= fp->rp) ? __putc(ch,fp) : (*fp->wp++ = ch);
+}
--- /dev/null
+++ b/src/libc/stdio/putchar.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef putchar
+
+int
+putchar(int ch)
+{
+ return putc(ch, stdout);
+}
--- /dev/null
+++ b/src/libc/stdio/puts.c
@@ -1,0 +1,12 @@
+#include <stdio.h>
+#undef puts
+
+int
+puts(const char *str)
+{
+ int ch;
+
+ while (ch = *str++)
+ putchar(ch);
+ return putchar('\n');
+}
--- /dev/null
+++ b/src/libc/stdio/rewind.c
@@ -1,0 +1,10 @@
+#include <stdio.h>
+#undef rewind
+
+void
+rewind(FILE *fp)
+{
+ fp->flags &= ~_IOERR;
+ fseek(fp, 0, SEEK_SET);
+ clearerr(fp);
+}
--- /dev/null
+++ b/src/libc/stdio/setbuf.c
@@ -1,0 +1,8 @@
+#include <stdio.h>
+#undef setbuf
+
+void
+setbuf(FILE * restrict fp, char * restrict buf)
+{
+ setvbuf(fp, buf, (buf) ? _IOFBF : _IONBF, BUFSIZ);
+}
--- /dev/null
+++ b/src/libc/stdio/setvbuf.c
@@ -1,0 +1,48 @@
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#undef setvbuf
+
+int
+setvbuf(FILE * restrict fp, char * restrict buf, int mode, size_t size)
+{
+ int flags;
+ char *p;
+ size_t l;
+
+ if (_flsbuf(fp) == EOF)
+ return EOF;
+
+ if (buf)
+ p = buf, l = size;
+ else
+ p = fp->buf, l = fp->len;
+
+ switch (mode) {
+ case _IONBF:
+ l = sizeof(fp->unbuf);
+ p = fp->unbuf;
+ case _IOLBF:
+ case _IOFBF:
+ fp->rp = fp->wp = p;
+ fp->lp = p + l;
+ break;
+ default:
+ errno = EINVAL;
+ return EOF;
+ }
+
+ flags = fp->flags;
+ if (flags&_IOALLOC && (buf || mode == _IONBF)) {
+ free(fp->buf);
+ flags &= ~_IOALLOC;
+ }
+
+ fp->buf = p;
+ fp->len = l;
+ flags &= ~(_IONBF | _IOLBF | _IOFBF);
+ flags |= mode;
+ fp->flags = flags;
+
+ return 0;
+}
--- /dev/null
+++ b/src/libc/stdio/snprintf.c
@@ -1,0 +1,16 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef snprintf
+
+int
+snprintf(char * restrict s, size_t siz, const char * restrict fmt, ...)
+{
+ int r;
+ va_list va;
+
+ va_start(va, fmt);
+ r = vsnprintf(s, siz, fmt, va);
+ va_end(va);
+
+ return r;
+}
--- /dev/null
+++ b/src/libc/stdio/sprintf.c
@@ -1,0 +1,16 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef sprintf
+
+int
+sprintf(char * restrict s, const char * restrict fmt, ...)
+{
+ int r;
+
+ va_list va;
+ va_start(va, fmt);
+ r = vsprintf(s, fmt, va);
+ va_end(va);
+
+ return r;
+}
--- /dev/null
+++ b/src/libc/stdio/tmpnam.c
@@ -1,0 +1,31 @@
+#include <stdio.h>
+#include <string.h>
+#include "../syscall.h"
+#undef tmpnam
+
+char *
+tmpnam(char *s)
+{
+ static char *tmpl, buf[L_tmpnam];
+ char *p;
+
+ if (*buf == '\0') {
+ for (tmpl = buf, p = _TMPNAME; *tmpl++ = *p++; )
+ ;
+ for (p = tmpl; p < &buf[L_tmpnam-1]; ++p)
+ *p = '0';
+ *p = '\0';
+ }
+ for (;;) {
+ for (p = tmpl; *p && *p != '9'; ++p)
+ ;
+ if (*p == '\0')
+ return NULL;
+ ++*p;
+ if (_access(buf, 0) != 0)
+ break;
+ }
+ if (s)
+ strcpy(s, buf);
+ return buf;
+}
--- /dev/null
+++ b/src/libc/stdio/vfprintf.c
@@ -1,0 +1,362 @@
+#include <ctype.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+#undef vfprintf
+
+enum {
+ LONG = 1 << 0,
+ LLONG = 1 << 1,
+ SHORT = 1 << 2,
+ CHAR = 1 << 3,
+ SIZET = 1 << 4,
+ PTRDIFF = 1 << 5,
+ INTMAX = 1 << 6,
+ VOIDPTR = 1 << 7,
+ UNSIGNED = 1 << 8,
+ ALTFORM = 1 << 9,
+};
+
+#define MAXPREC 50
+
+struct conv {
+ int sign;
+ int prec;
+ char *digs;
+ int base;
+};
+
+static uintmax_t
+getnum(va_list *va, int flags, int *sign)
+{
+ uintmax_t uval;
+ intmax_t val;
+
+ if (flags & CHAR) {
+ val = va_arg(*va, int);
+ uval = (unsigned char) val;
+ } else if (flags & SHORT) {
+ val = va_arg(*va, int);
+ uval = (unsigned short) val;
+ } else if (flags & LONG) {
+ val = va_arg(*va, long);
+ uval = (unsigned long) val;
+ } else if (flags & LLONG) {
+ val = va_arg(*va, long long);
+ uval = (unsigned long long) val;
+ } else if (flags & SIZET) {
+ uval = va_arg(*va, size_t);
+ } else if (flags & INTMAX) {
+ val = va_arg(*va, intmax_t);
+ uval = (uintmax_t) val;
+ } else if (flags & VOIDPTR) {
+ uval = (uintmax_t) va_arg(*va, void *);
+ } else {
+ val = va_arg(*va, int);
+ uval = (unsigned) val;
+ }
+
+ if ((flags & UNSIGNED) == 0 && val < 0) {
+ *sign = '-';
+ uval = -uval;
+ }
+ return uval;
+}
+
+static char *
+numtostr(uintmax_t val, int flags, struct conv *conv, char *buf)
+{
+ char *buf0 = buf;
+ int base = conv->base, prec = conv->prec;
+ uintmax_t oval = val;
+
+ if (prec == -1)
+ prec = 1;
+
+ for (*buf = '\0'; val > 0; val /= base)
+ *--buf = conv->digs[val % base];
+ while (buf0 - buf < prec)
+ *--buf = '0';
+
+ if (flags & ALTFORM) {
+ if (base == 8 && *buf != '0') {
+ *--buf = '0';
+ } else if (base == 16 && oval != 0) {
+ *--buf = conv->digs[16];
+ *--buf = '0';
+ }
+ }
+ if (conv->sign)
+ *--buf = conv->sign;
+
+ return buf;
+}
+
+static void
+savecnt(va_list *va, int flags, int cnt)
+{
+ if (flags & CHAR)
+ *va_arg(*va, char*) = cnt;
+ else if (flags & SHORT)
+ *va_arg(*va, short*) = cnt;
+ else if (flags & LONG)
+ *va_arg(*va, long*) = cnt;
+ else if (flags & LLONG)
+ *va_arg(*va, long long*) = cnt;
+ else if (flags & SIZET)
+ *va_arg(*va, size_t*) = cnt;
+ else if (flags & INTMAX)
+ *va_arg(*va, intmax_t*) = cnt;
+ else
+ *va_arg(*va, int*) = cnt;
+}
+
+static size_t
+wstrout(wchar_t *ws, size_t len, int width, int fill, FILE * restrict fp)
+{
+ int left = 0, adjust;
+ size_t cnt = 0;
+ wchar_t wc;
+#if 0
+
+ if (width < 0) {
+ left = 1;
+ width = -width;
+ }
+
+ len *= sizeof(wchar_t);
+ adjust = (len < width) ? width - len : 0;
+ cnt = adjust + len;
+ if (left)
+ adjust = -adjust;
+
+ for ( ; adjust > 0; adjust++)
+ putc(fill, fp);
+
+ while (wc = *ws++)
+ putwc(wc, fp);
+
+ for ( ; adjust < 0; adjust--)
+ putc(' ', fp);
+#endif
+ return cnt;
+}
+
+static size_t
+strout(char *s, size_t len, int width, int fill, FILE * restrict fp)
+{
+ int left = 0, adjust, ch, prefix;
+ size_t cnt = 0;
+
+ if (width < 0) {
+ left = 1;
+ width = -width;
+ }
+
+ adjust = (len < width) ? width - len : 0;
+ cnt = adjust + len;
+ if (left)
+ adjust = -adjust;
+
+ if (fill == '0') {
+ if (*s == '-' || *s == '+')
+ prefix = 1;
+ else if (*s == '0' && toupper(s[1]) == 'X')
+ prefix = 2;
+ else
+ prefix = 0;
+ while (prefix--) {
+ putc(*s++, fp);
+ --len;
+ }
+ }
+
+ for ( ; adjust > 0; adjust--)
+ putc(fill, fp);
+
+ while (ch = *s++)
+ putc(ch, fp);
+
+ for ( ; adjust < 0; adjust++)
+ putc(' ', fp);
+
+ return cnt;
+}
+
+int
+vfprintf(FILE * restrict fp, const char *fmt, va_list va)
+{
+ int ch, n, flags, width, left, fill, cnt = 0;
+ size_t inc, len;
+ char *s;
+ wchar_t *ws;
+ struct conv conv;
+ char buf[MAXPREC+1];
+ wchar_t wbuf[2];
+ va_list va2;
+
+ va_copy(va2, va);
+ for (cnt = 0; ch = *fmt++; cnt += inc) {
+ if (ch != '%') {
+ putc(ch, fp);
+ inc = 1;
+ continue;
+ }
+
+ fill = ' ';
+ left = flags = width = 0;
+ conv.prec = -1;
+ conv.base = 10;
+ conv.sign = '\0';
+ conv.digs = "0123456789ABCDEFX";
+
+flags:
+ switch (*fmt++) {
+ case ' ':
+ if (conv.sign == '\0')
+ conv.sign = ' ';
+ goto flags;
+ case '+':
+ conv.sign = '+';
+ goto flags;
+ case '#':
+ flags |= ALTFORM;
+ goto flags;
+ case '.':
+ if (*fmt == '*') {
+ fmt++;
+ n = va_arg(va2, int);
+ } else {
+ for (n = 0; isdigit(ch = *fmt); fmt++)
+ n = n * 10 + ch - '0';
+ }
+ if (n > MAXPREC)
+ n = MAXPREC;
+ if (n > 0)
+ conv.prec = n;
+ goto flags;
+ case '*':
+ width = va_arg(va2, int);
+ goto flags;
+ case '-':
+ left = 1;
+ ++fmt;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ --fmt;
+ for (n = 0; isdigit(ch = *fmt); ++fmt)
+ n = n * 10 + ch - '0';
+ if (left)
+ n = -n;
+ width = n;
+ goto flags;
+ case '0':
+ fill = '0';
+ goto flags;
+ case 'l':
+ flags += LONG;
+ goto flags;
+ case 'h':
+ flags += SHORT;
+ goto flags;
+ case '%':
+ ch = '%';
+ goto cout;
+ case 'c':
+ if (flags & LONG) {
+ wbuf[0] = va_arg(va2, wint_t);
+ wbuf[1] = L'\0';
+ ws = wbuf;
+ len = 1;
+ goto wstrout;
+ }
+ ch = va_arg(va2, int);
+ cout:
+ buf[0] = ch;
+ buf[1] = '\0';
+ s = buf;
+ len = 1;
+ goto strout;
+ case 'j':
+ flags |= INTMAX;
+ goto flags;
+ case 't':
+ flags |= PTRDIFF;
+ goto flags;
+ case 'z':
+ flags |= SIZET;
+ goto flags;
+ case 'u':
+ flags |= UNSIGNED;
+ case 'i':
+ case 'd':
+ conv.base = 10;
+ goto numeric;
+ case 'p':
+ flags |= VOIDPTR | ALTFORM;
+ goto numeric16;
+ case 'x':
+ conv.digs = "0123456789abcdefx";
+ case 'X':
+ numeric16:
+ conv.base = 16;
+ flags |= UNSIGNED;
+ goto numeric;
+ case 'o':
+ conv.base = 8;
+ flags |= UNSIGNED;
+ numeric:
+ if (conv.prec != -1)
+ fill = ' ';
+ s = numtostr(getnum(&va2, flags, &conv.sign),
+ flags,
+ &conv,
+ &buf[MAXPREC]);
+ len = &buf[MAXPREC] - s;
+ goto strout;
+ case 'L':
+ case 'a':
+ case 'A':
+ case 'e':
+ case 'E':
+ case 'f':
+ case 'g':
+ case 'G':
+ /* TODO */
+ case 's':
+ if (flags & LONG) {
+ ws = va_arg(va2, wchar_t *);
+ /* len = wcsnlen(ws, conv.prec); */
+ goto wstrout;
+ } else {
+ s = va_arg(va2, char *);
+ len = strnlen(s, conv.prec);
+ goto strout;
+ }
+ wstrout:
+ inc = wstrout(ws, len, width, fill, fp);
+ break;
+ strout:
+ inc = strout(s, len, width, fill, fp);
+ break;
+ case 'n':
+ savecnt(&va2, flags, cnt);
+ break;
+ case '\0':
+ goto out_loop;
+ }
+ }
+
+out_loop:
+ return (ferror(fp)) ? EOF : cnt;
+}
--- /dev/null
+++ b/src/libc/stdio/vprintf.c
@@ -1,0 +1,12 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef vprintf
+
+int
+vprintf(const char *fmt, va_list ap)
+{
+ va_list ap2;
+
+ va_copy(ap2, ap);
+ return vfprintf(stdout, fmt, ap2);
+}
--- /dev/null
+++ b/src/libc/stdio/vsnprintf.c
@@ -1,0 +1,25 @@
+#include <stdarg.h>
+#include <stdio.h>
+#undef vsnprintf
+
+int
+vsnprintf(char * restrict s, size_t siz, const char * restrict fmt, va_list ap)
+{
+ FILE f;
+ int r;
+
+ f.flags = _IORW | _IOSTRG;
+ f.len = siz;
+ f.buf = s;
+ f.wp = s;
+ f.rp = s + siz;
+
+ r = vfprintf(&f, fmt, ap);
+ if (s) {
+ if (f.wp == f.rp)
+ --f.wp;
+ *f.wp = '\0';
+ }
+
+ return r;
+}
--- /dev/null
+++ b/src/libc/stdio/vsprintf.c
@@ -1,0 +1,12 @@
+#include <limits.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#undef vsprintf
+
+
+int
+vsprintf(char * restrict s, const char * restrict fmt, va_list va)
+{
+ return vsnprintf(s, SIZE_MAX, fmt, va);
+}
--- /dev/null
+++ b/src/libc/stdlib/Makefile
@@ -1,0 +1,25 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = abort.o\
+ abs.o\
+ atexit.o\
+ atoi.o\
+ atol.o\
+ atoll.o\
+ bsearch.o\
+ calloc.o\
+ errno.o\
+ exit.o\
+ labs.o\
+ llabs.o\
+ malloc.o\
+ qsort.o\
+ rand.o\
+ realloc.o\
+ strtoull.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/stdlib/abort.c
@@ -1,0 +1,10 @@
+#include <signal.h>
+#include <stdlib.h>
+#undef abort
+
+void
+abort(void)
+{
+ raise(SIGABRT);
+ _Exit(127);
+}
--- /dev/null
+++ b/src/libc/stdlib/abs.c
@@ -1,0 +1,8 @@
+#include <stdlib.h>
+#undef abs
+
+int
+abs(int n)
+{
+ return (n < 0) ? -n : n;
+}
--- /dev/null
+++ b/src/libc/stdlib/atexit.c
@@ -1,0 +1,17 @@
+#include <stdlib.h>
+#include <errno.h>
+#undef atexit
+
+extern void (*_exitf[_ATEXIT_MAX])(void);
+extern unsigned _exitn;
+
+int
+atexit(void (*fun)(void))
+{
+ if (_exitn == _ATEXIT_MAX) {
+ errno = ENOMEM;
+ return -1;
+ }
+ _exitf[_exitn++] = fun;
+ return 0;
+}
--- /dev/null
+++ b/src/libc/stdlib/atoi.c
@@ -1,0 +1,25 @@
+#include <ctype.h>
+#include <stdlib.h>
+#undef atoi
+
+int
+atoi(const char *s)
+{
+ int n, sign = -1;
+
+ while (isspace(*s))
+ ++s;
+
+ switch (*s) {
+ case '-':
+ sign = 1;
+ case '+':
+ ++s;
+ }
+
+ /* Compute n as a negative number to avoid overflow on INT_MIN */
+ for (n = 0; isdigit(*s); ++s)
+ n = 10*n - (*s - '0');
+
+ return sign * n;
+}
--- /dev/null
+++ b/src/libc/stdlib/atol.c
@@ -1,0 +1,26 @@
+#include <ctype.h>
+#include <stdlib.h>
+#undef atol
+
+long
+atol(const char *s)
+{
+ int sign = -1;
+ long n;
+
+ while (isspace(*s))
+ ++s;
+
+ switch (*s) {
+ case '-':
+ sign = 1;
+ case '+':
+ ++s;
+ }
+
+ /* Compute n as a negative number to avoid overflow on LONG_MIN */
+ for (n = 0; isdigit(*s); ++s)
+ n = 10*n - (*s - '0');
+
+ return sign * n;
+}
--- /dev/null
+++ b/src/libc/stdlib/atoll.c
@@ -1,0 +1,26 @@
+#include <ctype.h>
+#include <stdlib.h>
+#undef atoll
+
+long long
+atoll(const char *s)
+{
+ int sign = -1;
+ long long n;
+
+ while (isspace(*s))
+ ++s;
+
+ switch (*s) {
+ case '-':
+ sign = 1;
+ case '+':
+ ++s;
+ }
+
+ /* Compute n as a negative number to avoid overflow on LLONG_MIN */
+ for (n = 0; isdigit(*s); ++s)
+ n = 10*n - (*s - '0');
+
+ return sign * n;
+}
--- /dev/null
+++ b/src/libc/stdlib/bsearch.c
@@ -1,0 +1,26 @@
+#include <stdlib.h>
+
+void *
+bsearch(const void *key, const void *ary, size_t n, size_t size,
+ int (*cmp)(const void *, const void *))
+{
+ int t;
+ size_t mid, low, high;
+ char *cur, *base = ary;
+
+ low = 0;
+ high = n - 1;
+ while (low <= high) {
+ mid = low + (high - low) / 2;
+ cur = base + mid*size;
+
+ if ((t = (*cmp)(key, cur)) == 0)
+ return cur;
+ else if (t > 0)
+ low = mid + 1;
+ else
+ high = mid - 1;
+ }
+
+ return NULL;
+}
--- /dev/null
+++ b/src/libc/stdlib/calloc.c
@@ -1,0 +1,18 @@
+#include <stdlib.h>
+#include <string.h>
+#undef calloc
+
+void *
+calloc(size_t nmemb, size_t size)
+{
+ size_t nbytes;
+ void *mem;
+
+ if (!nmemb || !size || nmemb > (size_t)-1/size)
+ return NULL;
+
+ nbytes = nmemb * size;
+ if ((mem = malloc(nbytes)) == NULL)
+ return NULL;
+ return memset(mem, 0, nbytes);
+}
--- /dev/null
+++ b/src/libc/stdlib/errno.c
@@ -1,0 +1,1 @@
+int errno;
--- /dev/null
+++ b/src/libc/stdlib/exit.c
@@ -1,0 +1,13 @@
+#include <stdlib.h>
+#undef exit
+
+void (*_exitf[_ATEXIT_MAX])(void);
+unsigned _exitn;
+
+void
+exit(int status)
+{
+ while (_exitn > 0)
+ (*_exitf[--_exitn])();
+ _Exit(status);
+}
--- /dev/null
+++ b/src/libc/stdlib/labs.c
@@ -1,0 +1,8 @@
+#include <stdlib.h>
+#undef labs
+
+long
+labs(long n)
+{
+ return (n < 0) ? -n : n;
+}
--- /dev/null
+++ b/src/libc/stdlib/llabs.c
@@ -1,0 +1,8 @@
+#include <stdlib.h>
+#undef llabs
+
+long long
+llabs(long long n)
+{
+ return (n < 0) ? -n : n;
+}
--- /dev/null
+++ b/src/libc/stdlib/malloc.c
@@ -1,0 +1,158 @@
+#include <errno.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "malloc.h"
+#include "../syscall.h"
+
+#define MAXADDR ((char *)-1)
+#define ERRADDR ((char *)-1)
+
+static Header base = { .h.next = &base };
+static Header *freep = &base;
+
+/*
+ * Run over the free list looking for the nearest previous
+ * block. There are two possible results: end of the list
+ * or an intermediary block.
+ */
+void *
+_prevchunk(Header *hp)
+{
+ Header *p;
+
+ for (p = freep; ;p = p->h.next) {
+ /* hp between p and p->h.next? */
+ if (p < hp && hp < p->h.next)
+ break;
+ /* p before hp and hp at the end of list? */
+ if (p->h.next <= p && (hp < p->h.next || hp > p))
+ break;
+ }
+ return p;
+}
+
+/*
+ * Get the previous block and try to merge
+ * with next and previous blocks
+ */
+void
+free(void *mem)
+{
+ Header *hp, *prev;
+
+ if (!mem)
+ return;
+
+ hp = (Header *) mem - 1;
+ prev = _prevchunk(hp);
+
+ /* join to next */
+ if (hp + hp->h.size == prev->h.next) {
+ hp->h.size += prev->h.next->h.size;
+ hp->h.next = prev->h.next->h.next;
+ } else {
+ hp->h.next = prev->h.next;
+ }
+
+ /* join to previous */
+ if (prev + prev->h.size == hp) {
+ prev->h.size += hp->h.size;
+ prev->h.next = hp->h.next;
+ } else {
+ prev->h.next = hp;
+ }
+
+ freep = prev;
+}
+
+static void *
+sbrk(uintptr_t inc)
+{
+ char *new, *old;
+ void *p;
+ static void *heap;
+
+ if (!heap)
+ heap = _getheap();
+ old = heap;
+ if (old >= MAXADDR - inc)
+ return ERRADDR;
+ new = old + inc;
+ p = _brk(new);
+ if (p == old || p < 0)
+ return ERRADDR;
+ heap = new;
+
+ return old;
+}
+
+static Header *
+morecore(size_t nunits)
+{
+ char *rawmem;
+ Header *hp;
+
+ if (nunits < NALLOC)
+ nunits = NALLOC;
+
+ rawmem = sbrk(nunits * sizeof(Header));
+ if (rawmem == ERRADDR)
+ return NULL;
+
+ hp = (Header*)rawmem;
+ hp->h.size = nunits;
+
+ /* integrate new memory into the list */
+ free(hp + 1);
+
+ return freep;
+}
+
+/*
+ * Run over the list of free blocks trying to find a block
+ * big enough for nbytes. If the block fit perfectly with
+ * the required size then we only have to unlink
+ * the block. Otherwise we have to split the block and
+ * return the right part. If we run over the full list
+ * without a fit then we have to require more memory
+ *
+ * ______________________________________
+ * ___________./______________________________________\_____
+ * ...| in | | | in | |.....| in | | | |....
+ * ...| use | | | use | |.....| use | | | |....
+ * ___|______|___|.____|_____|._|_____|______|._|.___|.|____
+ * \__/ \_________/ \_____________/ \/ \__/
+ */
+void *
+malloc(size_t nbytes)
+{
+ Header *cur, *prev;
+ size_t nunits;
+
+ /* 1 unit for header plus enough units to fit nbytes */
+ nunits = (nbytes+sizeof(Header)-1) / sizeof(Header) + 1;
+
+ for (prev = freep; ; prev = cur) {
+ cur = prev->h.next;
+ if (cur->h.size >= nunits) {
+ if (cur->h.size == nunits) {
+ prev->h.next = cur->h.next;
+ } else {
+ cur->h.size -= nunits;
+ cur += cur->h.size;
+ cur->h.size = nunits;
+ }
+ freep = prev;
+ return cur + 1;
+ }
+
+ if (cur == freep) {
+ if ((cur = morecore(nunits)) == NULL) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ }
+ }
+}
--- /dev/null
+++ b/src/libc/stdlib/malloc.h
@@ -1,0 +1,16 @@
+#include <stdlib.h>
+
+/* minimum amount of required units */
+#define NALLOC 10000
+
+typedef union header Header;
+union header {
+ struct hdr {
+ Header *next;
+ size_t size;
+ } h;
+ /* most restrictive type fixes the union size for alignment */
+ _ALIGNTYPE most;
+};
+
+extern void *_prevchunk(Header *hp);
--- /dev/null
+++ b/src/libc/stdlib/qsort.c
@@ -1,0 +1,68 @@
+#include <stdlib.h>
+#include <string.h>
+#undef qsort
+
+/*
+ * This implementation of qsort is based in the paper
+ * "Engineering a Sort Function", by Jon L.Bentley and M. Douglas McIlroy.
+ * A lot of different optimizations were removed to make the code simpler.
+ */
+
+struct qsort {
+ size_t es;
+ int (*cmp)(const void *, const void *);
+};
+
+static void
+swap(char *i, char *j, size_t n)
+{
+ do {
+ char c = *i;
+ *i++ = *j;
+ *j++ = c;
+ } while (--n > 0);
+}
+
+static void
+xqsort(char *a, size_t n, struct qsort *qs)
+{
+ size_t j, es = qs->es;
+ char *pi, *pj, *pn;
+
+ if (n <= 1)
+ return;
+
+ pi = a;
+ pn = pj = a + n*es;
+
+ swap(a, a + n/2 * es, es);
+ for (;;) {
+ do {
+ pi += es;
+ } while (pi < pn && qs->cmp(pi, a) < 0);
+
+ do {
+ pj -= es;
+ } while (pj > a && qs->cmp(pj, a) > 0);
+
+ if (pj < pi)
+ break;
+ swap(pi, pj, es);
+ }
+ swap(a, pj, es);
+
+ j = (pj - a) / es;
+ xqsort(a, j, qs);
+ xqsort(a + (j+1)*es, n-j-1, qs);
+}
+
+void
+qsort(void *base, size_t nmemb, size_t size,
+ int (*f)(const void *, const void *))
+{
+ struct qsort qs;
+
+ qs.cmp = f;
+ qs.es = size;
+ xqsort(base, nmemb, &qs);
+}
--- /dev/null
+++ b/src/libc/stdlib/rand.c
@@ -1,0 +1,18 @@
+#include <stdlib.h>
+#undef rand
+#undef srand
+
+static unsigned long next;
+
+void
+srand(unsigned seed)
+{
+ next = seed;
+}
+
+int
+rand(void) /* RAND_MAX assumed to be 32767. */
+{
+ next = next * 1103515245 + 12345;
+ return (unsigned)(next/65536) % 32768;
+}
--- /dev/null
+++ b/src/libc/stdlib/realloc.c
@@ -1,0 +1,68 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "malloc.h"
+#undef realloc
+
+void *
+realloc(void *ptr, size_t nbytes)
+{
+ Header *oh, *prev, *next, *new;
+ size_t nunits, avail, onbytes, n;
+
+ if (!nbytes)
+ return NULL;
+
+ if (!ptr)
+ return malloc(nbytes);
+
+ nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1;
+ oh = (Header*)ptr - 1;
+
+ if (oh->h.size == nunits)
+ return ptr;
+
+ new = oh + nunits;
+
+ if (nunits < oh->h.size - 1) {
+ new->h.size = oh->h.size - nunits;
+ oh->h.size = nunits;
+ free(new + 1);
+ return oh;
+ }
+
+ prev = _prevchunk(oh);
+
+ if (oh + oh->h.size == prev->h.next) {
+ /*
+ * if there is free space adjacent
+ * to the current memory
+ */
+ next = prev->h.next;
+ avail = oh->h.size + next->h.size;
+
+ if (avail == nunits) {
+ oh->h.size = nunits;
+ prev->h.next = next->h.next;
+ return oh;
+ }
+
+ if (avail > nunits) {
+ oh->h.size = nunits;
+ prev->h.next = new;
+ new->h.next = next;
+ new->h.size = avail - nunits;
+ return oh;
+ }
+ }
+
+ onbytes = (oh->h.size - 1) * sizeof(Header);
+ if ((new = malloc(nbytes)) == NULL)
+ return NULL;
+
+ n = (onbytes > nbytes) ? nbytes : onbytes;
+ memcpy(new, ptr, n);
+ free(ptr);
+
+ return new;
+}
--- /dev/null
+++ b/src/libc/stdlib/strtoull.c
@@ -1,0 +1,64 @@
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#undef strtoull
+
+unsigned long long
+strtoull(const char *s, char **end, int base)
+{
+ int d, sign = 1;
+ unsigned long long n;
+ static const char digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ const char *t, *p;
+
+ while (isspace(*s))
+ ++s;
+
+ switch (*s) {
+ case '-':
+ sign = -1;
+ case '+':
+ ++s;
+ }
+
+ if (base == 0) {
+ if (*s == '0' && toupper(s[1]) == 'X')
+ base = 16;
+ else if (*s == '0')
+ base = 8;
+ else
+ base = 10;
+ }
+
+ if (base == 16 && *s == '0' && toupper(s[1]) == 'X')
+ s += 2;
+
+ n = 0;
+ for (t = s; p = strchr(digits, toupper(*t)); ++t) {
+ if ((d = p - digits) >= base)
+ break;
+ if (n > ULLONG_MAX/base)
+ goto overflow;
+ n *= base;
+ if (d > ULLONG_MAX - n)
+ goto overflow;
+ n += d;
+ }
+
+
+ if (end)
+ *end = t;
+ if (n == 0 && s == t)
+ errno = EINVAL;
+ return n*sign;
+
+overflow:
+ if (end)
+ *end = t;
+ errno = ERANGE;
+
+ return ULLONG_MAX;
+}
--- /dev/null
+++ b/src/libc/string/Makefile
@@ -1,0 +1,31 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = memchr.o\
+ memcmp.o\
+ memcpy.o\
+ memmove.o\
+ memset.o\
+ strcat.o\
+ strchr.o\
+ strcmp.o\
+ strcoll.o\
+ strcpy.o\
+ strcspn.o\
+ strerror.o\
+ strlen.o\
+ strncat.o\
+ strncmp.o\
+ strncpy.o\
+ strnlen.o\
+ strpbrk.o\
+ strrchr.o\
+ strspn.o\
+ strstr.o\
+ strtok.o\
+ strxfrm.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/string/memchr.c
@@ -1,0 +1,12 @@
+#include <string.h>
+#undef memchr
+
+void *
+memchr(const void *s, int c, size_t n)
+{
+ const unsigned char *bp = s;
+
+ while (n > 0 && *bp++ != c)
+ --n;
+ return (n == 0) ? NULL : bp-1;
+}
--- /dev/null
+++ b/src/libc/string/memcmp.c
@@ -1,0 +1,14 @@
+#include <string.h>
+#undef memcmp
+
+int
+memcmp(const void *s1, const void *s2, size_t n)
+{
+ const char *s = s1;
+ const char *t = s2;
+
+ for ( ; n > 0 && *s == *t; --n)
+ ++s, ++t;
+
+ return (n > 0) ? *(unsigned char *) s - *(unsigned char *) t : 0;
+}
--- /dev/null
+++ b/src/libc/string/memcpy.c
@@ -1,0 +1,13 @@
+#include <string.h>
+#undef memcpy
+
+void *
+memcpy(void * restrict dst, const void * restrict src, size_t n)
+{
+ char *s1 = dst;
+ const char *s2 = src;
+
+ while (n-- > 0)
+ *s1++ = *s2++;
+ return dst;
+}
--- /dev/null
+++ b/src/libc/string/memmove.c
@@ -1,0 +1,18 @@
+#include <string.h>
+#undef memmove
+
+void *
+memmove(void *dst, const void *src, size_t n)
+{
+ char *d = dst, *s = (char *) src;
+
+ if (d < s) {
+ while (n-- > 0)
+ *d++ = *s++;
+ } else {
+ s += n-1, d += n-1;
+ while (n-- > 0)
+ *d-- = *s--;
+ }
+ return dst;
+}
--- /dev/null
+++ b/src/libc/string/memset.c
@@ -1,0 +1,12 @@
+#include <string.h>
+#undef memset
+
+void *
+memset(void *s, int c, size_t n)
+{
+ char *m = s;
+
+ while (n-- > 0)
+ *m++ = c;
+ return s;
+}
--- /dev/null
+++ b/src/libc/string/strcat.c
@@ -1,0 +1,14 @@
+#include <string.h>
+#undef strcat
+
+char *
+strcat(char * restrict dst, const char * restrict src)
+{
+ char *ret = dst;
+
+ while (*dst)
+ ++dst;
+ while (*dst++ = *src++)
+ ;
+ return ret;
+}
--- /dev/null
+++ b/src/libc/string/strchr.c
@@ -1,0 +1,10 @@
+#include <string.h>
+#undef strchr
+
+char *
+strchr(const char *s, int c)
+{
+ while (*s && *s != c)
+ ++s;
+ return (*s == c) ? (char *)s : NULL;
+}
--- /dev/null
+++ b/src/libc/string/strcmp.c
@@ -1,0 +1,10 @@
+#include <string.h>
+#undef strcmp
+
+int
+strcmp(const char *s1, const char *s2)
+{
+ while (*s1 && *s2 && *s1 == *s2)
+ ++s1, ++s2;
+ return *(unsigned char *)s1 - *(unsigned char *)s2;
+}
--- /dev/null
+++ b/src/libc/string/strcoll.c
@@ -1,0 +1,10 @@
+#include <string.h>
+#undef strcoll
+
+int
+strcoll(const char *s1, const char *s2)
+{
+ while (*s1 && *s2 && *s1 == *s2)
+ ++s1, ++s2;
+ return *(unsigned char *) s1 - *(unsigned char *) s2;
+}
--- /dev/null
+++ b/src/libc/string/strcpy.c
@@ -1,0 +1,12 @@
+#include <string.h>
+#undef strcpy
+
+char *
+strcpy(char * restrict dst, const char * restrict src)
+{
+ char *ret = dst;
+
+ while (*dst++ = *src++)
+ ;
+ return ret;
+}
--- /dev/null
+++ b/src/libc/string/strcspn.c
@@ -1,0 +1,21 @@
+#include <string.h>
+#undef strcspn
+
+size_t
+strcspn(const char *s1, const char *s2)
+{
+ const unsigned char *s = s1;
+ const unsigned char *accept = s2;
+ unsigned ch;
+ size_t n;
+ char buf[__NUMCHARS];
+
+ memset(buf, 0, sizeof(buf));
+ while (ch = *accept++)
+ buf[ch] = 1;
+
+ for (n = 0; (ch = *s++) && !buf[ch]; ++n)
+ ;
+
+ return n;
+}
--- /dev/null
+++ b/src/libc/string/strerror.c
@@ -1,0 +1,11 @@
+#include <errno.h>
+#include <string.h>
+#undef strerror
+
+char *
+strerror(int errnum)
+{
+ if (errnum > _sys_nerr)
+ errnum = EUNKNOWN;
+ return _sys_errlist[errnum];
+}
--- /dev/null
+++ b/src/libc/string/strlen.c
@@ -1,0 +1,12 @@
+#include <string.h>
+#undef strlen
+
+size_t
+strlen(const char *s)
+{
+ const char *t;
+
+ for (t = s; *t; ++t)
+ ;
+ return t - s;
+}
--- /dev/null
+++ b/src/libc/string/strncat.c
@@ -1,0 +1,15 @@
+#include <string.h>
+#undef strncat
+
+char *
+strncat(char * restrict dst, const char * restrict src, size_t n)
+{
+ char *ret = dst;
+
+ while (*dst)
+ ++dst;
+ while (n-- > 0 && *src)
+ *dst++ = *src++;
+ *dst = '\0';
+ return ret;
+}
--- /dev/null
+++ b/src/libc/string/strncmp.c
@@ -1,0 +1,14 @@
+#include <string.h>
+#undef strncmp
+
+int
+strncmp(const char *s1, const char *s2, size_t n)
+{
+ int c;
+
+ for ( ; n > 0 && (c = *s1) && c == *s2; --n)
+ ++s1, ++s2;
+ if (n == 0)
+ return 0;
+ return *(unsigned char *) s1 - *(unsigned char *) s2;
+}
--- /dev/null
+++ b/src/libc/string/strncpy.c
@@ -1,0 +1,14 @@
+#include <string.h>
+#undef strncpy
+
+char *
+strncpy(char * restrict dst, const char * restrict src, size_t n)
+{
+ char *ret = dst;
+
+ for (; n > 0 && *src; --n)
+ *dst++ = *src++;
+ while (n-- > 0)
+ *dst++ = '\0';
+ return ret;
+}
--- /dev/null
+++ b/src/libc/string/strnlen.c
@@ -1,0 +1,13 @@
+#include <string.h>
+
+#undef strnlen
+
+size_t
+strnlen(const char *s, size_t maxlen)
+{
+ size_t n;
+
+ for (n = 0; n < maxlen && *s++; ++n)
+ ;
+ return n;
+}
--- /dev/null
+++ b/src/libc/string/strpbrk.c
@@ -1,0 +1,20 @@
+#include <string.h>
+#undef strpbrk
+
+char *
+strpbrk(const char *s1, const char *s2)
+{
+ const unsigned char *s = s1;
+ const unsigned char *accept = s2;
+ unsigned ch;
+ char buf[__NUMCHARS];
+
+ memset(buf, 0, sizeof(buf));
+ while (ch = *accept++)
+ buf[ch] = 1;
+
+ while ((ch = *s) && !buf[ch])
+ s++;
+
+ return (ch == '\0') ? NULL : (char *) s;
+}
--- /dev/null
+++ b/src/libc/string/strrchr.c
@@ -1,0 +1,14 @@
+#include <string.h>
+#undef strrchr
+
+char *
+strrchr(const char *s, int c)
+{
+ const char *t = s;
+
+ while (*t)
+ ++t;
+ while (t > s && *t != c)
+ --t;
+ return (*t == c) ? (char *)t : NULL;
+}
--- /dev/null
+++ b/src/libc/string/strspn.c
@@ -1,0 +1,21 @@
+#include <string.h>
+#undef strspn
+
+size_t
+strspn(const char *s1, const char *s2)
+{
+ const unsigned char *s = s1;
+ const unsigned char *accept = s2;
+ unsigned ch;
+ size_t n;
+ char buf[__NUMCHARS];
+
+ memset(buf, 0, sizeof(buf));
+ while (ch = *accept++)
+ buf[ch] = 1;
+
+ for (n = 0; (ch = *s++) && buf[ch]; ++n)
+ ;
+
+ return n;
+}
--- /dev/null
+++ b/src/libc/string/strstr.c
@@ -1,0 +1,18 @@
+#include <stddef.h>
+#include <string.h>
+#undef strstr
+
+char *
+strstr(const char *s1, const char *s2)
+{
+ const char *p;
+ int c = *s2;
+
+ if (c == '\0')
+ return NULL;
+ for (p = s1; p = strchr(p, c); ++p) {
+ if (!strcmp(p, s2))
+ return (char *) p;
+ }
+ return NULL;
+}
--- /dev/null
+++ b/src/libc/string/strtok.c
@@ -1,0 +1,25 @@
+#include <string.h>
+#undef strtok
+
+char *
+strtok(char * restrict s, const char * restrict delim)
+{
+ static char *line;
+
+ if (s)
+ line = s;
+ if (!s && !line)
+ return NULL;
+
+ s = line + strspn(line, delim);
+ if (*s == '\0')
+ return line = NULL;
+
+ line = s + strcspn(s, delim);
+ if (*line != '\0')
+ *line++ = '\0';
+ else
+ line = NULL;
+
+ return s;
+}
--- /dev/null
+++ b/src/libc/string/strxfrm.c
@@ -1,0 +1,12 @@
+#include <string.h>
+#undef strxfrm
+
+size_t
+strxfrm(char * restrict dst, const char * restrict src, size_t n)
+{
+ size_t len = strlen(src);
+
+ if (len < n)
+ strcpy(dst, src);
+ return len;
+}
--- /dev/null
+++ b/src/libc/syscall.h
@@ -1,0 +1,8 @@
+extern void *_brk(void *addr);
+extern int _open(const char *path, int flags);
+extern int _close(int fd);
+extern int _read(int fd, void *buf, size_t n);
+extern int _write(int fd, void *buf, size_t n);
+extern int _lseek(int fd, long off, int whence);
+extern void _Exit(int status);
+extern int _access(char *path, int mode);
--- /dev/null
+++ b/src/libc/time/Makefile
@@ -1,0 +1,16 @@
+.POSIX:
+PROJECTDIR =../../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+MORECFLAGS = -w -I$(INCDIR) -I$(INCDIR)/bits/$(SYS) -I$(INCDIR)/bits/$(ARCH)
+
+OBJS = _daysyear.o\
+ asctime.o\
+ ctime.o\
+ difftime.o\
+ gmtime.o\
+ localtime.o\
+ mktime.o\
+ strftime.o\
+
+all: $(OBJS)
--- /dev/null
+++ b/src/libc/time/_daysyear.c
@@ -1,0 +1,30 @@
+#include <time.h>
+#include "../libc.h"
+
+int _daysmon[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+
+int
+_daysyear(int year)
+{
+ if (year%4 != 0)
+ return 365;
+ if (year%100 == 0 && year%400 != 0)
+ return 365;
+ return 366;
+}
+
+/*
+ * Happy New Year!!!!
+ */
+int
+_newyear(int year)
+{
+ int day;
+
+ year += 1900 - 1;
+ day = 1 + year + year/4;
+ day -= year/100;
+ day += year/400;
+
+ return day % 7;
+}
--- /dev/null
+++ b/src/libc/time/asctime.c
@@ -1,0 +1,12 @@
+#include <time.h>
+#undef asctime
+
+#include <stdio.h> // TODO: remove me!
+char *
+asctime(const struct tm *tm)
+{
+ static char buf[30];
+
+ strftime(buf, sizeof(buf), "%c\n", tm);
+ return buf;
+}
--- /dev/null
+++ b/src/libc/time/ctime.c
@@ -1,0 +1,8 @@
+#include <time.h>
+#undef ctime
+
+char *
+ctime(const time_t *t)
+{
+ return asctime(localtime(t));
+}
--- /dev/null
+++ b/src/libc/time/difftime.c
@@ -1,0 +1,8 @@
+#include <time.h>
+#undef difftime
+
+double
+difftime(time_t t1, time_t t2)
+{
+ return (double) (t1 - t2);
+}
--- /dev/null
+++ b/src/libc/time/gmtime.c
@@ -1,0 +1,36 @@
+#include <time.h>
+
+#include "../libc.h"
+#undef gmtime
+
+struct tm *
+gmtime(const time_t *t)
+{
+ static struct tm tm;
+ time_t sec, min, hour, year, day;
+ int i;
+
+ tm.tm_sec = *t % SECDAY;
+ tm.tm_min = tm.tm_sec / 60;
+ tm.tm_sec %= 60;
+ tm.tm_hour = tm.tm_min / 60;
+ tm.tm_min %= 60;
+ day = *t / SECDAY;
+
+ tm.tm_wday = (day + THU) % 7; /* 1/1/1970 was Thursday */
+
+ for (i = EPOCH; day >= _daysyear(i); ++i)
+ day -= _daysyear(i);
+ tm.tm_year = i - 1900;
+ tm.tm_yday = day;
+
+ _daysmon[FEB] = FEBDAYS(tm.tm_year);
+ for (i = JAN; day > _daysmon[i]; i++)
+ day -= _daysmon[i];
+ tm.tm_mon = i;
+ tm.tm_mday = day + 1;
+
+ tm.tm_isdst = 0;
+
+ return &tm;
+}
--- /dev/null
+++ b/src/libc/time/localtime.c
@@ -1,0 +1,22 @@
+#include <time.h>
+
+#include "../libc.h"
+#undef localtime
+
+struct tm *
+localtime(const time_t *timep)
+{
+ struct tzone *tz;
+ struct tm *tm;
+ time_t t = *timep;
+
+ t += tz->gmtoff * 60;
+ t += tz->isdst * 60;
+ tm = gmtime(&t);
+ tz = _tzone(tm);
+ tm->tm_zone = tz->name;
+ tm->tm_isdst = tz->isdst;
+ tm->tm_gmtoff = tz->gmtoff;
+
+ return tm;
+}
--- /dev/null
+++ b/src/libc/time/mktime.c
@@ -1,0 +1,113 @@
+#include <limits.h>
+#include <time.h>
+
+#include "../libc.h"
+#undef mktime
+
+static int
+norm(int *val, int *next, int qty)
+{
+ int v = *val, n = *next, d;
+
+ if (v < 0) {
+ d = -v / qty + 1;
+ v += d * qty;
+ if (n > INT_MAX - d)
+ return 0;
+ n += d;
+ }
+ if (v >= qty) {
+ d = v / qty;
+ v -= d * qty;
+ if (n < INT_MIN + d)
+ return 0;
+ n -= d;
+ }
+
+ *val = v;
+ *next = n;
+ return 1;
+}
+
+static int
+normalize(struct tm *tm)
+{
+ int mon, day, year;
+ struct tm aux = *tm;
+
+ if (!norm(&tm->tm_sec, &tm->tm_min, 60) ||
+ !norm(&tm->tm_min, &tm->tm_hour, 60) ||
+ !norm(&tm->tm_hour, &tm->tm_mday, 24) ||
+ !norm(&tm->tm_mon, &tm->tm_year, 12)) {
+ return 0;
+ }
+
+ day = tm->tm_mday;
+ year = EPOCH + tm->tm_year;
+ _daysmon[FEB] = FEBDAYS(year);
+
+ for (mon = tm->tm_mon; day < 1; --mon) {
+ day += _daysmon[mon];
+ if (mon == JAN) {
+ if (year == EPOCH)
+ return -1;
+ year--;
+ _daysmon[FEB] = FEBDAYS(year);
+ mon = DEC+1;
+ }
+ }
+
+ for (; day > _daysmon[mon]; ++mon) {
+ day -= _daysmon[mon];
+ if (mon == DEC) {
+ if (year == _MAXYEAR)
+ return -1;
+ year++;
+ _daysmon[FEB] = FEBDAYS(year);
+ mon = JAN-1;
+ }
+ }
+
+ tm->tm_mon = mon;
+ tm->tm_year = year - EPOCH;
+ tm->tm_mday = day;
+ tm->tm_wday = (_newyear(tm->tm_year) + tm->tm_yday) % 7;
+
+ return 1;
+}
+
+time_t
+mktime(struct tm *tm)
+{
+ int i, year, dst;
+ time_t t;
+ struct tm *aux;
+
+ if (!normalize(tm))
+ return -1;
+
+ t = 0;
+ year = tm->tm_year + 1900;
+ for (i = EPOCH; i < year; i++)
+ t += _daysyear(i) * SECDAY;
+
+ for (i = 0; i < tm->tm_mon; i++)
+ t += _daysmon[i] * SECDAY;
+
+ t += tm->tm_sec;
+ t += tm->tm_min * SECMIN;
+ t += tm->tm_hour * SECHOUR;
+ t += (tm->tm_mday-1) * SECDAY;
+
+ aux = localtime(&t);
+
+ dst = 0;
+ if (tm->tm_isdst == 0 && aux->tm_isdst == 1)
+ dst = -SECHOUR;
+ else if (tm->tm_isdst == 1 && aux->tm_isdst == 0)
+ dst = +SECHOUR;
+
+ t += aux->tm_gmtoff + dst;
+
+ return t;
+}
--- /dev/null
+++ b/src/libc/time/strftime.c
@@ -1,0 +1,247 @@
+#include <time.h>
+#include <string.h>
+
+#include "../libc.h"
+#undef strftime
+
+static char *days[] = {
+ "Sunday", "Monday", "Tuesday", "Wednesday",
+ "Thursday", "Friday", "Saturday",
+};
+
+static char *months[] = {
+ "January", "February", "March", "April",
+ "May", "June", "July", "August",
+ "September", "October", "November", "December"
+};
+
+static char *am_pm[] = {"AM", "PM"};
+
+static size_t
+sval(char *s, size_t siz, char **strs, int abrev, int idx, int max)
+{
+ char *str;
+ size_t len;
+
+ if (idx < 0 && idx >= max)
+ goto wrong;
+
+ str = strs[idx];
+ len = (!abrev) ? strlen(str) : 3;
+ if (len > siz)
+ goto wrong;
+
+ memcpy(s, str, len);
+ return len;
+
+wrong:
+ *s = '?';
+ return 1;
+}
+
+static size_t
+dval(char *s, size_t siz, int prec, int fill, int val)
+{
+ char *t;
+ int n;
+ static char digits[] = "0123456789";
+
+ if (prec > siz || val < 0) {
+ *s = '?';
+ return 1;
+ }
+
+ n = prec;
+ do {
+ s[--n] = digits[val % 10];
+ val /= 10;
+ } while (n > 0 && val > 0);
+
+ while (n > 0)
+ s[--n] = fill;
+
+ return prec;
+}
+
+static size_t
+timezone(char *s, size_t prec, const struct tm * restrict tm)
+{
+ long off = tm->tm_gmtoff;
+
+ if (prec < 5) {
+ *s = '?';
+ return 1;
+ }
+
+ if (off >= 0) {
+ *s++ = '+';
+ } else {
+ *s++ = '-';
+ off = -off;
+ }
+
+ dval(s, 2, 2, '0', off / 3600);
+ dval(s, 2, 2, '0', (off % 3600) / 60);
+
+ return 5;
+}
+
+size_t
+strftime(char * restrict s, size_t siz,
+ const char * restrict fmt,
+ const struct tm * restrict tm)
+{
+ int ch, abrev, val, fill, width;
+ size_t n, inc;
+ char *tfmt;
+
+ for (n = siz-1; (ch = *fmt++) && n > 0; s += inc, n -= inc) {
+ if (ch != '%') {
+ *s = ch;
+ inc = 1;
+ continue;
+ }
+
+ abrev = 0;
+ fill = '0';
+ width = 2;
+
+ switch (*fmt++) {
+ case 'Z':
+ if (!tm->tm_zone)
+ break;
+ inc = sval(s, n, &tm->tm_zone, 0, 0, 1);
+ break;
+ case 'a':
+ abrev = 1;
+ case 'A':
+ inc = sval(s, n, days, abrev, tm->tm_wday, 7);
+ break;
+ case 'h':
+ case 'b':
+ abrev = 1;
+ case 'B':
+ inc = sval(s, n, months, abrev, tm->tm_mon, 12);
+ break;
+ case 'p':
+ inc = sval(s, n, am_pm, 0, tm->tm_hour > 12, 2);
+ break;
+ case 'c':
+ tfmt = "%a %b %e %T %Y";
+ goto recursive;
+ case 'D':
+ tfmt = "%m/%d/%y";
+ goto recursive;
+ case 'F':
+ tfmt = "%Y-%m-%d";
+ goto recursive;
+ case 'R':
+ tfmt = "%H:%M";
+ goto recursive;
+ case 'X':
+ case 'T':
+ tfmt = "%H:%M:%S";
+ goto recursive;
+ case 'r':
+ tfmt = "%I:%M:%S %p";
+ goto recursive;
+ case 'x':
+ tfmt = "%m/%d/%y";
+ goto recursive;
+ recursive:
+ inc = strftime(s, n+1, tfmt, tm) - 1;
+ break;
+ case 'n':
+ val = '\n';
+ goto character;
+ case 't':
+ val = '\t';
+ goto character;
+ case '%':
+ val = '%';
+ character:
+ *s = val;
+ inc = 1;
+ break;
+ case 'e':
+ fill = ' ';
+ val = tm->tm_mday;
+ goto number;
+ case 'd':
+ val = tm->tm_mday;
+ goto number;
+ case 'V':
+ case 'g':
+ case 'G':
+ /* TODO */
+ break;
+ case 'C':
+ val = tm->tm_year / 100;
+ goto number;
+ case 'H':
+ val = tm->tm_hour;
+ goto number;
+ case 'I':
+ val = tm->tm_hour;
+ if (val == 0)
+ val = 12;
+ if (val > 12)
+ val -= 12;
+ goto number;
+ case 'j':
+ width = 3;
+ val = tm->tm_yday+1;
+ goto number;
+ case 'm':
+ val = tm->tm_mon+1;
+ goto number;
+ case 'M':
+ val = tm->tm_min;
+ goto number;
+ case 'S':
+ val = tm->tm_sec;
+ goto number;
+ case 'u':
+ width = 1;
+ val = tm->tm_wday+1;
+ goto number;
+ case 'U':
+ val = tm->tm_yday / 7;
+ if (_newyear(tm->tm_year) == SAT)
+ val++;
+ goto number;
+ case 'W':
+ val = tm->tm_yday / 7;
+ if (_newyear(tm->tm_year) == MON)
+ val++;
+ goto number;
+ case 'w':
+ width = 1;
+ val = tm->tm_wday;
+ goto number;
+ case 'y':
+ val = tm->tm_year%100;
+ goto number;
+ case 'Y':
+ width = 4;
+ val = 1900 + tm->tm_year;
+ number:
+ inc = dval(s, n, width, fill, val);
+ break;
+ case 'z':
+ inc = timezone(s, n, tm);
+ break;
+ case 'E':
+ case 'O':
+ if (*fmt != '\0')
+ fmt += 2;;
+ case '\0':
+ inc = 0;
+ --fmt;
+ break;
+ }
+ }
+ *s = '\0';
+
+ return siz - n;
+}
--- /dev/null
+++ b/src/libcoff32/Makefile
@@ -1,0 +1,25 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = coff32_pack_hdr.o \
+ coff32_unpack_hdr.o \
+ coff32_pack_scn.o \
+ coff32_unpack_scn.o \
+ coff32_pack_aout.o \
+ coff32_unpack_aout.o \
+ coff32_pack_ent.o \
+ coff32_unpack_ent.o \
+
+TARGET = $(LIBDIR)/libcoff32.a
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(AR) $(ARFLAGS) $@ $?
+ ranlib $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/libcoff32/coff32_pack_aout.c
@@ -1,0 +1,9 @@
+#include <assert.h>
+
+#include <scc/coff32/aouthdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_pack_aout(packfun fun, unsigned char *buff, AOUTHDR *aout)
+{
+}
--- /dev/null
+++ b/src/libcoff32/coff32_pack_ent.c
@@ -1,0 +1,20 @@
+#include <assert.h>
+
+#include <scc/coff32/syms.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_pack_ent(packfun fun, unsigned char *buff, SYMENT *ent)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "'8lsscc",
+ &ent->n_name,
+ &ent->n_value,
+ &ent->n_scnum,
+ &ent->n_type,
+ &ent->n_sclass,
+ &ent->n_numaux);
+ assert(n == SYMESZ);
+}
--- /dev/null
+++ b/src/libcoff32/coff32_pack_hdr.c
@@ -1,0 +1,21 @@
+#include <assert.h>
+
+#include <scc/coff32/filehdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_pack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "sslllss",
+ hdr->f_magic,
+ hdr->f_nscns,
+ hdr->f_timdat,
+ hdr->f_symptr,
+ hdr->f_nsyms,
+ hdr->f_opthdr,
+ hdr->f_flags);
+ assert(n == FILHSZ);
+}
--- /dev/null
+++ b/src/libcoff32/coff32_pack_scn.c
@@ -1,0 +1,24 @@
+#include <assert.h>
+
+#include <scc/coff32/scnhdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_pack_scn(packfun fun, unsigned char *buff, SCNHDR *scn)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "'8llllllssl",
+ scn->s_name,
+ scn->s_paddr,
+ scn->s_vaddr,
+ scn->s_size,
+ scn->s_scnptr,
+ scn->s_relptr,
+ scn->s_lnnoptr,
+ scn->s_nrelloc,
+ scn->s_nlnno,
+ scn->s_flags);
+ assert(n == SCNHSZ);
+}
--- /dev/null
+++ b/src/libcoff32/coff32_unpack_aout.c
@@ -1,0 +1,9 @@
+#include <assert.h>
+
+#include <scc/coff32/aouthdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_unpack_aout(packfun fun, unsigned char *buff, AOUTHDR *ent)
+{
+}
--- /dev/null
+++ b/src/libcoff32/coff32_unpack_ent.c
@@ -1,0 +1,20 @@
+#include <assert.h>
+
+#include <scc/coff32/syms.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_unpack_ent(packfun fun, unsigned char *buff, SYMENT *ent)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "'8lsscc",
+ &ent->n_name,
+ &ent->n_value,
+ &ent->n_scnum,
+ &ent->n_type,
+ &ent->n_sclass,
+ &ent->n_numaux);
+ assert(n == SYMESZ);
+}
--- /dev/null
+++ b/src/libcoff32/coff32_unpack_hdr.c
@@ -1,0 +1,22 @@
+#include <assert.h>
+
+#include <scc/coff32/filehdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_unpack_hdr(packfun fun, unsigned char *buff, FILHDR *hdr)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "sslllss",
+ &hdr->f_magic,
+ &hdr->f_nscns,
+ &hdr->f_timdat,
+ &hdr->f_symptr,
+ &hdr->f_nsyms,
+ &hdr->f_opthdr,
+ &hdr->f_flags);
+ assert(n == FILHSZ);
+}
+
--- /dev/null
+++ b/src/libcoff32/coff32_unpack_scn.c
@@ -1,0 +1,24 @@
+#include <assert.h>
+
+#include <scc/coff32/scnhdr.h>
+#include <scc/coff32/coff32.h>
+
+void
+coff32_unpack_scn(packfun fun, unsigned char *buff, SCNHDR *scn)
+{
+ int n;
+
+ n = (*fun)(buff,
+ "'8llllllssl",
+ scn->s_name,
+ &scn->s_paddr,
+ &scn->s_vaddr,
+ &scn->s_size,
+ &scn->s_scnptr,
+ &scn->s_relptr,
+ &scn->s_lnnoptr,
+ &scn->s_nrelloc,
+ &scn->s_nlnno,
+ &scn->s_flags);
+ assert(n == SCNHSZ);
+}
--- /dev/null
+++ b/src/libcoff32/deps.mk
@@ -1,0 +1,17 @@
+#deps
+coff32_pack_aout.o: $(INCDIR)/scc/scc/coff32/aouthdr.h
+coff32_pack_aout.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_pack_ent.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_pack_ent.o: $(INCDIR)/scc/scc/coff32/syms.h
+coff32_pack_hdr.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_pack_hdr.o: $(INCDIR)/scc/scc/coff32/filehdr.h
+coff32_pack_scn.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_pack_scn.o: $(INCDIR)/scc/scc/coff32/scnhdr.h
+coff32_unpack_aout.o: $(INCDIR)/scc/scc/coff32/aouthdr.h
+coff32_unpack_aout.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_unpack_ent.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_unpack_ent.o: $(INCDIR)/scc/scc/coff32/syms.h
+coff32_unpack_hdr.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_unpack_hdr.o: $(INCDIR)/scc/scc/coff32/filehdr.h
+coff32_unpack_scn.o: $(INCDIR)/scc/scc/coff32/coff32.h
+coff32_unpack_scn.o: $(INCDIR)/scc/scc/coff32/scnhdr.h
--- /dev/null
+++ b/src/libcrt/Makefile
@@ -1,0 +1,11 @@
+.POSIX:
+PROJECTDIR=../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = crt-$(SYS).o crt-$(ABI).o
+TARGET = $(CRTDIR)/$(ARCH)-$(SYS)/crt.o
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(LD) -r -o $@ $(OBJS)
--- /dev/null
+++ b/src/libcrt/crt-amd64-posix.s
@@ -1,0 +1,19 @@
+ .bss
+ .globl _environ
+_environ:
+ .quad 0
+
+ .text
+ .global _start
+_start:
+ movq %rsp,%rbp
+
+ /* load argc, argv, envp from stack */
+ movq (%rbp),%rdi /* argc */
+ leaq 8(%rbp),%rsi /* argv */
+ leaq 16(%rbp,%rdi,8),%rdx /* envp = argv + 8*argc + 8 */
+ movq %rdx,_environ
+
+ call main
+ movl %eax,%edi
+ jmp exit
--- /dev/null
+++ b/src/libcrt/crt-arm32-posix.s
@@ -1,0 +1,16 @@
+ .bss
+ .globl _environ
+_environ:
+ .word 0
+
+ .text
+ .globl _start
+_start:
+ ldr r0,[sp] /* argc */
+ add r1,sp,#4 /* argv */
+ add r2,r1,r0,lsl #2 /* argv = argc + 4*argc + 4 */
+ add r2,r2,#4
+ ldr r3,=_environ
+ str r2,[r3]
+ bl main
+ b exit
--- /dev/null
+++ b/src/libcrt/crt-arm64-posix.s
@@ -1,0 +1,16 @@
+ .bss
+ .globl _environ
+_environ:
+ .quad 0
+
+ .text
+ .globl _start
+_start:
+ ldr x0,[sp] /* argc */
+ add x1,sp,#8 /* argv */
+ add x2,x1,x0,lsl #3 /* argv = argc + 8*argc + 8 */
+ add x2,x2,#8
+ adr x3,_environ
+ str x2,[x3]
+ bl main
+ b exit
--- /dev/null
+++ b/src/libcrt/crt-dragonfly.s
@@ -1,0 +1,1 @@
+ .file "crt-dragonfly.s"
--- /dev/null
+++ b/src/libcrt/crt-linux.s
@@ -1,0 +1,1 @@
+ .file "crt-linux.s"
--- /dev/null
+++ b/src/libcrt/crt-netbsd.s
@@ -1,0 +1,9 @@
+ .file "crt-netbsd.s"
+ .section ".note.netbsd.ident", "a"
+ .p2align 2
+
+ .long 7
+ .long 4
+ .long 1
+ .ascii "NetBSD\0\0"
+ .long 800000000
--- /dev/null
+++ b/src/libcrt/crt-openbsd.s
@@ -1,0 +1,9 @@
+ .file "crt-openbsd.s"
+ .section ".note.openbsd.ident", "a"
+ .p2align 2
+ .long 8
+ .long 4
+ .long 1
+ .ascii "OpenBSD\0"
+ .long 0
+ .p2align 2
--- /dev/null
+++ b/src/libscc/Makefile
@@ -1,0 +1,31 @@
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = debug.o \
+ die.o \
+ newitem.o \
+ xcalloc.o \
+ xmalloc.o \
+ xrealloc.o \
+ xstrdup.o \
+ alloc.o \
+ casecmp.o \
+ lunpack.o \
+ lpack.o \
+ bunpack.o \
+ bpack.o \
+ wmyro.o \
+ rmyro.o \
+
+TARGET = $(LIBDIR)/libscc.a
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+ $(AR) $(ARFLAGS) $@ $?
+ ranlib $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/libscc/alloc.c
@@ -1,0 +1,112 @@
+static char sccsid[] = "@(#) ./lib/scc/alloc.c";
+#include <stdlib.h>
+#include <scc/scc.h>
+
+/*
+ * This is the most pedantic piece of code that I have written
+ * in my life. The next union is used to enforce the aligmnet
+ * of the address returned by new(). A union has the aligment
+ * of the field with the biggest aligment. This union has all
+ * the types that we use in scc, and we round all the address
+ * to the aligment of this struct, so we can be sure that any
+ * pointer using that address will be safe. The field ap is
+ * in the union to be sure that struct pointers are included
+ * in the list, although they will have the same aligment or
+ * smaller than void *, but I wanted to be pedantic.
+ */
+union hdr {
+ union hdr *next;
+ struct arena *ap;
+ char c;
+ unsigned char uc;
+ int i;
+ short s;
+ long l;
+ long long ll;
+ float f;
+ double d;
+ long double ld;
+ void *vp;
+};
+
+struct arena {
+ struct arena *next;
+ union hdr *array;
+};
+
+struct alloc {
+ size_t size;
+ size_t nmemb;
+ size_t padding;
+ struct arena *arena;
+ union hdr *freep;
+};
+
+static void
+newarena(Alloc *allocp)
+{
+ struct arena *ap;
+ union hdr *bp, *lim;
+ size_t unit, n = allocp->nmemb;
+
+ unit = (allocp->size-1) / sizeof(union hdr) + 1;
+ ap = xmalloc(sizeof(struct arena));
+ ap->array = xmalloc(unit * sizeof(union hdr) * n);
+
+ bp = ap->array;
+ for (lim = &bp[unit * (n-1)]; bp < lim; bp += unit)
+ bp->next = bp + unit;
+ bp->next = NULL;
+
+ ap->next = allocp->arena;
+ allocp->arena = ap;
+ allocp->freep = ap->array;
+}
+
+Alloc *
+alloc(size_t size, size_t nmemb)
+{
+ Alloc *allocp = xmalloc(sizeof(*allocp));
+
+ allocp->size = size;
+ allocp->nmemb = nmemb;
+ allocp->arena = NULL;
+ allocp->freep = NULL;
+
+ return allocp;
+}
+
+void
+dealloc(Alloc *allocp)
+{
+ struct arena *ap, *next;
+
+ for (ap = allocp->arena; ap; ap = next) {
+ next = ap->next;
+ free(ap->array);
+ free(ap);
+ }
+ free(allocp);
+}
+
+void *
+new(Alloc *allocp)
+{
+ union hdr *bp;
+
+ if (!allocp->freep)
+ newarena(allocp);
+ bp = allocp->freep;
+ allocp->freep = bp->next;
+
+ return bp;
+}
+
+void
+delete(Alloc *allocp, void *p)
+{
+ union hdr *bp = p;
+
+ bp->next = allocp->freep;
+ allocp->freep = bp;
+}
--- /dev/null
+++ b/src/libscc/bpack.c
@@ -1,0 +1,64 @@
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <scc/scc.h>
+
+int
+bpack(unsigned char *dst, char *fmt, ...)
+{
+ unsigned char *bp, *cp;
+ unsigned s;
+ unsigned long l;
+ unsigned long long q;
+ size_t n;
+ int d;
+ va_list va;
+
+ bp = dst;
+ va_start(va, fmt);
+ while (*fmt) {
+ switch (*fmt++) {
+ case '\'':
+ for (n = 0; isdigit(*fmt); n += d) {
+ n *= 10;
+ d = *fmt++ - '0';
+ }
+ cp = va_arg(va, unsigned char *);
+ while (n--)
+ *bp++ = *cp++;
+ break;
+ case 'c':
+ *bp++ = va_arg(va, unsigned);
+ break;
+ case 's':
+ s = va_arg(va, unsigned);
+ *bp++ = s >> 8;
+ *bp++ = s;
+ break;
+ case 'l':
+ l = va_arg(va, unsigned long);
+ *bp++ = l >> 24;
+ *bp++ = l >> 16;
+ *bp++ = l >> 8;
+ *bp++ = l;
+ break;
+ case 'q':
+ q = va_arg(va, unsigned long long);
+ *bp++ = q >> 56;
+ *bp++ = q >> 48;
+ *bp++ = q >> 40;
+ *bp++ = q >> 32;
+ *bp++ = q >> 24;
+ *bp++ = q >> 16;
+ *bp++ = q >> 8;
+ *bp++ = q;
+ break;
+ default:
+ va_end(va);
+ return -1;
+ }
+ }
+ va_end(va);
+
+ return bp - dst;
+}
--- /dev/null
+++ b/src/libscc/bunpack.c
@@ -1,0 +1,71 @@
+static char sccsid[] = "@(#) ./lib/scc/lunpack.c";
+
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <scc/scc.h>
+
+int
+lunpack(unsigned char *src, char *fmt, ...)
+{
+ unsigned char *bp, *cp;
+ unsigned short *sp;
+ unsigned s;
+ unsigned long *lp, l;
+ unsigned long long *qp, q;
+ va_list va;
+ size_t n;
+ int d;
+
+ bp = src;
+ va_start(va, fmt);
+ while (*fmt) {
+ switch (*fmt++) {
+ case '\'':
+ for (n = 0; isdigit(*fmt); n += d) {
+ n *= 10;
+ d = *fmt++ - '0';
+ }
+ cp = va_arg(va, unsigned char *);
+ while (n--)
+ *cp++ = *bp++;
+ break;
+ case 'c':
+ cp = va_arg(va, unsigned char *);
+ *cp = *bp++;
+ break;
+ case 's':
+ sp = va_arg(va, unsigned short *);
+ s = (unsigned) *bp++ << 8;
+ s |= (unsigned) *bp++;
+ *sp = s;
+ break;
+ case 'l':
+ lp = va_arg(va, unsigned long *);
+ l = (unsigned long) *bp++ << 24;
+ l |= (unsigned long) *bp++ << 16;
+ l |= (unsigned long) *bp++ << 8;
+ l |= (unsigned long) *bp++;
+ *lp = l;
+ break;
+ case 'q':
+ qp = va_arg(va, unsigned long long *);
+ q = (unsigned long long) *bp++ << 56;
+ q |= (unsigned long long) *bp++ << 48;
+ q |= (unsigned long long) *bp++ << 40;
+ q |= (unsigned long long) *bp++ << 32;
+ q |= (unsigned long long) *bp++ << 24;
+ q |= (unsigned long long) *bp++ << 16;
+ q |= (unsigned long long) *bp++ << 8;
+ q |= (unsigned long long) *bp++;
+ *qp = q;
+ break;
+ default:
+ va_end(va);
+ return -1;
+ }
+ }
+ va_end(va);
+
+ return bp - src;
+}
--- /dev/null
+++ b/src/libscc/casecmp.c
@@ -1,0 +1,11 @@
+static char sccsid[] = "@(#) ./lib/scc/casecmp.c";
+#include <ctype.h>
+#include <scc/scc.h>
+
+int
+casecmp(const char *s1, const char *s2)
+{
+ while (*s1 && toupper(*s1) == toupper(*s2))
+ ++s1, ++s2;
+ return *s1 - *s2;
+}
--- /dev/null
+++ b/src/libscc/debug.c
@@ -1,0 +1,20 @@
+static char sccsid[] = "@(#) ./lib/scc/debug.c";
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <scc/scc.h>
+
+int debug;
+
+void
+dbg(const char *fmt, ...)
+{
+ if (!debug)
+ return;
+ va_list va;
+ va_start(va, fmt);
+ vfprintf(stderr, fmt, va);
+ putc('\n', stderr);
+ va_end(va);
+ return;
+}
--- /dev/null
+++ b/src/libscc/deps.mk
@@ -1,0 +1,18 @@
+#deps
+alloc.o: $(INCDIR)/scc/scc/scc.h
+bpack.o: $(INCDIR)/scc/scc/scc.h
+bunpack.o: $(INCDIR)/scc/scc/scc.h
+casecmp.o: $(INCDIR)/scc/scc/scc.h
+debug.o: $(INCDIR)/scc/scc/scc.h
+die.o: $(INCDIR)/scc/scc/scc.h
+lpack.o: $(INCDIR)/scc/scc/scc.h
+lunpack.o: $(INCDIR)/scc/scc/scc.h
+newitem.o: $(INCDIR)/scc/scc/scc.h
+rmyro.o: $(INCDIR)/scc/scc/myro.h
+rmyro.o: $(INCDIR)/scc/scc/scc.h
+wmyro.o: $(INCDIR)/scc/scc/myro.h
+wmyro.o: $(INCDIR)/scc/scc/scc.h
+xcalloc.o: $(INCDIR)/scc/scc/scc.h
+xmalloc.o: $(INCDIR)/scc/scc/scc.h
+xrealloc.o: $(INCDIR)/scc/scc/scc.h
+xstrdup.o: $(INCDIR)/scc/scc/scc.h
--- /dev/null
+++ b/src/libscc/die.c
@@ -1,0 +1,20 @@
+static char sccsid[] = "@(#) ./lib/scc/die.c";
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <scc/scc.h>
+
+int failure;
+
+void
+die(const char *fmt, ...)
+{
+ failure = 1;
+ va_list va;
+ va_start(va, fmt);
+ vfprintf(stderr, fmt, va);
+ putc('\n', stderr);
+ va_end(va);
+ exit(1);
+}
--- /dev/null
+++ b/src/libscc/lpack.c
@@ -1,0 +1,64 @@
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <scc/scc.h>
+
+int
+lpack(unsigned char *dst, char *fmt, ...)
+{
+ unsigned char *bp, *cp;
+ unsigned s;
+ unsigned long l;
+ unsigned long long q;
+ size_t n;
+ int d;
+ va_list va;
+
+ bp = dst;
+ va_start(va, fmt);
+ while (*fmt) {
+ switch (*fmt++) {
+ case '\'':
+ for (n = 0; isdigit(*fmt); n += d) {
+ n *= 10;
+ d = *fmt++ - '0';
+ }
+ cp = va_arg(va, unsigned char *);
+ while (n--)
+ *bp++ = *cp++;
+ break;
+ case 'c':
+ *bp++ = va_arg(va, unsigned);
+ break;
+ case 's':
+ s = va_arg(va, unsigned);
+ *bp++ = s;
+ *bp++ = s >> 8;
+ break;
+ case 'l':
+ l = va_arg(va, unsigned long);
+ *bp++ = l;
+ *bp++ = l >> 8;
+ *bp++ = l >> 16;
+ *bp++ = l >> 24;
+ break;
+ case 'q':
+ q = va_arg(va, unsigned long long);
+ *bp++ = q;
+ *bp++ = q >> 8;
+ *bp++ = q >> 16;
+ *bp++ = q >> 24;
+ *bp++ = q >> 32;
+ *bp++ = q >> 40;
+ *bp++ = q >> 48;
+ *bp++ = q >> 56;
+ break;
+ default:
+ va_end(va);
+ return -1;
+ }
+ }
+ va_end(va);
+
+ return bp - dst;
+}
--- /dev/null
+++ b/src/libscc/lunpack.c
@@ -1,0 +1,71 @@
+static char sccsid[] = "@(#) ./lib/scc/lunpack.c";
+
+#include <ctype.h>
+#include <stdarg.h>
+
+#include <scc/scc.h>
+
+int
+lunpack(unsigned char *src, char *fmt, ...)
+{
+ unsigned char *bp, *cp;
+ unsigned short *sp;
+ unsigned s;
+ unsigned long *lp, l;
+ unsigned long long *qp, q;
+ va_list va;
+ size_t n;
+ int d;
+
+ bp = src;
+ va_start(va, fmt);
+ while (*fmt) {
+ switch (*fmt++) {
+ case '\'':
+ for (n = 0; isdigit(*fmt); n += d) {
+ n *= 10;
+ d = *fmt++ - '0';
+ }
+ cp = va_arg(va, unsigned char *);
+ while (n--)
+ *cp++ = *bp++;
+ break;
+ case 'c':
+ cp = va_arg(va, unsigned char *);
+ *cp = *bp++;
+ break;
+ case 's':
+ sp = va_arg(va, unsigned short *);
+ s = (unsigned) *bp++;
+ s |= (unsigned) *bp++ << 8;
+ *sp = s;
+ break;
+ case 'l':
+ lp = va_arg(va, unsigned long *);
+ l = (unsigned long) *bp++;
+ l |= (unsigned long) *bp++ << 8;
+ l |= (unsigned long) *bp++ << 16;
+ l |= (unsigned long) *bp++ << 24;
+ *lp = l;
+ break;
+ case 'q':
+ qp = va_arg(va, unsigned long long *);
+ q = (unsigned long long) *bp++;
+ q |= (unsigned long long) *bp++ << 8;
+ q |= (unsigned long long) *bp++ << 16;
+ q |= (unsigned long long) *bp++ << 24;
+ q |= (unsigned long long) *bp++ << 32;
+ q |= (unsigned long long) *bp++ << 40;
+ q |= (unsigned long long) *bp++ << 48;
+ q |= (unsigned long long) *bp++ << 56;
+ *qp = q;
+ break;
+ default:
+ va_end(va);
+ return -1;
+ }
+ }
+ va_end(va);
+
+ return bp - src;
+}
--- /dev/null
+++ b/src/libscc/newitem.c
@@ -1,0 +1,12 @@
+#include <scc/scc.h>
+
+void
+newitem(struct items *items, char *item)
+{
+ if ((items->n + 1) < items->n)
+ die("overflow in newitem (%u + 1)", items->n);
+
+ items->s = xrealloc(items->s, (items->n + 1) * sizeof(char **));
+ items->s[items->n++] = item;
+}
+
--- /dev/null
+++ b/src/libscc/rmyro.c
@@ -1,0 +1,94 @@
+static char sccsid[] = "@(#) ./lib/scc/rmyro.c";
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include <scc/myro.h>
+
+int
+rdmyrohdr(FILE *fp, struct myrohdr *hdr)
+{
+ unsigned char buf[MYROHDR_SIZ];
+ int len;
+
+ fread(buf, sizeof(buf), 1, fp);
+ if (ferror(fp))
+ return EOF;
+ len = lunpack(buf, "cccclqqqqq",
+ hdr->magic+0, hdr->magic+1,
+ hdr->magic+2, hdr->magic+3,
+ &hdr->format,
+ &hdr->entry,
+ &hdr->strsize,
+ &hdr->secsize,
+ &hdr->symsize,
+ &hdr->relsize);
+ assert(len == MYROHDR_SIZ);
+
+ return len;
+}
+
+int
+rdmyrosec(FILE *fp, struct myrosect *sect)
+{
+ unsigned char buf[MYROSECT_SIZ];
+ int len;
+
+ fread(buf, sizeof(buf), 1, fp);
+ if (ferror(fp))
+ return EOF;
+ len = lunpack(buf, "lsccqq",
+ §->name,
+ §->flags,
+ §->fill,
+ §->aligment,
+ §->offset,
+ §->len);
+ assert(len == MYROSECT_SIZ);
+
+ return len;
+}
+
+int
+rdmyrosym(FILE *fp, struct myrosym *sym)
+{
+ unsigned char buf[MYROSYM_SIZ];
+ int len;
+
+ fread(buf, sizeof(buf), 1, fp);
+ if (ferror(fp))
+ return EOF;
+ len = lunpack(buf, "llccqq",
+ &sym->name,
+ &sym->type,
+ &sym->section,
+ &sym->flags,
+ &sym->offset,
+ &sym->len);
+ assert(len == MYROSYM_SIZ);
+
+ return len;
+}
+
+int
+rdmyrorel(FILE *fp, struct myrorel *rel)
+{
+ unsigned char buf[MYROREL_SIZ];
+ int len;
+
+ fread(buf, sizeof(buf), 1, fp);
+ if (ferror(fp))
+ return EOF;
+ len = lunpack(buf, "lccccq",
+ &rel->id,
+ &rel->flags,
+ &rel->size,
+ &rel->nbits,
+ &rel->shift,
+ &rel->offset);
+ assert(len == MYROREL_SIZ);
+
+ return len;
+}
--- /dev/null
+++ b/src/libscc/wmyro.c
@@ -1,0 +1,86 @@
+static char sccsid[] = "@(#) ./lib/scc/wmyro.c";
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <scc/scc.h>
+#include <scc/myro.h>
+
+int
+wrmyrohdr(FILE *fp, struct myrohdr *hdr)
+{
+ unsigned char buf[MYROHDR_SIZ];
+ int len;
+
+ len = lpack(buf, "cccclqqqqq",
+ hdr->magic[0], hdr->magic[1],
+ hdr->magic[2], hdr->magic[3],
+ hdr->format,
+ hdr->entry,
+ hdr->strsize,
+ hdr->secsize,
+ hdr->symsize,
+ hdr->relsize);
+ assert(MYROHDR_SIZ == len);
+ fwrite(buf, len, 1, fp);
+
+ return (ferror(fp)) ? EOF : len;
+}
+
+int
+wrmyrosec(FILE *fp, struct myrosect *sect)
+{
+ unsigned char buf[MYROSECT_SIZ];
+ int len;
+
+ len = lpack(buf, "lsccqq",
+ sect->name,
+ sect->flags,
+ sect->fill,
+ sect->aligment,
+ sect->offset,
+ sect->len);
+ assert(MYROSECT_SIZ == len);
+ fwrite(buf, len, 1, fp);
+
+ return (ferror(fp)) ? EOF : len;
+}
+
+int
+wrmyrosym(FILE *fp, struct myrosym *sym)
+{
+ unsigned char buf[MYROSYM_SIZ];
+ int len;
+
+ len = lpack(buf, "llccqq",
+ sym->name,
+ sym->type,
+ sym->section,
+ sym->flags,
+ sym->offset,
+ sym->len);
+ assert(MYROSYM_SIZ == len);
+ fwrite(buf, len, 1, fp);
+
+ return (ferror(fp)) ? EOF : len;
+}
+
+int
+wrmyrorel(FILE *fp, struct myrorel *rel)
+{
+ unsigned char buf[MYROREL_SIZ];
+ int len;
+
+ len = lpack(buf, "lccccq",
+ rel->id,
+ rel->flags,
+ rel->size,
+ rel->nbits,
+ rel->shift,
+ rel->offset);
+ assert(MYROREL_SIZ == len);
+ fwrite(buf, len, 1, fp);
+
+ return (ferror(fp)) ? EOF : len;
+}
--- /dev/null
+++ b/src/libscc/xcalloc.c
@@ -1,0 +1,13 @@
+static char sccsid[] = "@(#) ./lib/scc/xcalloc.c";
+#include <stdlib.h>
+#include <scc/scc.h>
+
+void *
+xcalloc(size_t n, size_t size)
+{
+ void *p = calloc(n, size);
+
+ if (!p)
+ die("out of memory");
+ return p;
+}
--- /dev/null
+++ b/src/libscc/xmalloc.c
@@ -1,0 +1,13 @@
+static char sccsid[] = "@(#) ./lib/scc/xmalloc.c";
+#include <stdlib.h>
+#include <scc/scc.h>
+
+void *
+xmalloc(size_t size)
+{
+ void *p = malloc(size);
+
+ if (!p)
+ die("out of memory");
+ return p;
+}
--- /dev/null
+++ b/src/libscc/xrealloc.c
@@ -1,0 +1,13 @@
+static char sccsid[] = "@(#) ./lib/scc/xrealloc.c";
+#include <stdlib.h>
+#include <scc/scc.h>
+
+void *
+xrealloc(void *buff, size_t size)
+{
+ void *p = realloc(buff, size);
+
+ if (!p)
+ die("out of memory");
+ return p;
+}
--- /dev/null
+++ b/src/libscc/xstrdup.c
@@ -1,0 +1,12 @@
+static char sccsid[] = "@(#) ./lib/scc/xstrdup.c";
+#include <string.h>
+#include <scc/scc.h>
+
+char *
+xstrdup(const char *s)
+{
+ size_t len = strlen(s) + 1;
+ char *p = xmalloc(len);
+
+ return memcpy(p, s, len);
+}
--- /dev/null
+++ b/src/nm/Makefile
@@ -1,0 +1,21 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = main.o \
+ coff32.o \
+ formats.o \
+
+TARGET = $(BINDIR)/nm
+
+all: $(TARGET)
+
+$(TARGET): $(LIBDIR)/libscc.a
+
+$(TARGET): $(OBJS)
+ $(CC) $(SCC_LDFLAGS) $(OBJS) -lscc -o $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/nm/coff32.c
@@ -1,0 +1,312 @@
+static char sccsid[] = "@(#) ./nm/coff.c";
+
+#include <assert.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/coff32/filehdr.h>
+#include <scc/coff32/scnhdr.h>
+#include <scc/coff32/syms.h>
+#include <scc/scc.h>
+#include "nm.h"
+
+static int (*unpack)(unsigned char *, char *, ...);
+static long strtbl, symtbl, sectbl;
+static SCNHDR *sections;
+static struct symbol *syms;
+static size_t nsect, nsyms;
+
+static char
+typeof(SYMENT *ent)
+{
+ SCNHDR *sec;
+ int c;
+ long flags;
+
+ switch (ent->n_scnum) {
+ case N_DEBUG:
+ c = 'n';
+ break;
+ case N_ABS:
+ c = 'a';
+ break;
+ case N_UNDEF:
+ c = (ent->n_value != 0) ? 'C' : 'U';
+ break;
+ default:
+ if (ent->n_scnum > nsect)
+ die("nm: incorrect section index");
+ sec = §ions[ent->n_scnum-1];
+ flags = sec->s_flags;
+ if (flags & STYP_TEXT)
+ c = 't';
+ else if (flags & STYP_DATA)
+ c = 'd';
+ else if (flags & STYP_BSS)
+ c = 'b';
+ else
+ c = '?';
+ break;
+ }
+
+ if (ent->n_sclass == C_EXT)
+ c = toupper(c);
+
+ return c;
+}
+
+static char *
+getsname(char *fname, FILE *fp, SYMENT *ent)
+{
+ int c;
+ size_t len;
+ char *s, *err;
+ fpos_t pos;
+
+ if (ent->n_zeroes != 0) {
+ for (len = 0; len < E_SYMNMLEN && ent->n_name[len]; ++len)
+ ;
+ s = xmalloc(len+1);
+ s[len] = '\0';
+ return memcpy(s, ent->n_name, len);
+ }
+
+ /* TODO: read the string table in memory before reading symbols */
+ fgetpos(fp, &pos);
+ fseek(fp, strtbl, SEEK_SET);
+ fseek(fp, ent->n_offset, SEEK_CUR);
+
+ if (ferror(fp))
+ goto error;
+
+ s = NULL;
+ for (len = 1; (c = getc(fp)) != EOF; len++) {
+ s = xrealloc(s, len);
+ if ((s[len-1] = c) == '\0')
+ break;
+ }
+ if (c == EOF)
+ goto error;
+ fsetpos(fp, &pos);
+ return s;
+
+error:
+ err = (!ferror(fp)) ?
+ "EOF before reading strings" : strerror(errno);
+ die("nm: %s: %s", fname, err);
+}
+
+static void
+getfsym(unsigned char *buff, SYMENT *ent)
+{
+ int n;
+
+ n = (*unpack)(buff,
+ "'8lsscc",
+ &ent->n_name,
+ &ent->n_value,
+ &ent->n_scnum,
+ &ent->n_type,
+ &ent->n_sclass,
+ &ent->n_numaux);
+ assert(n == SYMESZ);
+}
+
+static void
+getsymbol(char *fname, FILE *fp,
+ unsigned char *buff, SYMENT *ent, struct symbol *sym)
+{
+ char *nam;
+
+ getfsym(buff, ent);
+ nam = ent->n_name;
+ if (nam[0] == 0 && nam[1] == 0 && nam[2] == 0 && nam[3] == 0) {
+ long zero, offset;
+
+ (*unpack)(nam, "ll", &zero, &offset);
+ ent->n_zeroes = zero;
+ ent->n_offset = offset;
+ }
+ sym->name = getsname(fname, fp, ent);
+ sym->type = typeof(ent);
+ sym->value = ent->n_value;
+ sym->size = (sym->type == 'C') ? ent->n_value : 0;
+}
+
+static void
+getsyms(char *fname, char *member, FILE *fp, FILHDR *hdr)
+{
+ size_t n, i;
+ unsigned aux;
+ unsigned char buff[SYMESZ];
+ SYMENT ent;
+
+ if (hdr->f_nsyms > SIZE_MAX)
+ die("nm: %s:Too many symbols\n", member);
+
+ n = hdr->f_nsyms;
+ syms = xcalloc(sizeof(*syms), n);
+
+ if (fseek(fp, symtbl, SEEK_SET) == EOF)
+ die("nm: %s:%s", fname, strerror(errno));
+
+ aux = nsyms = 0;
+ for (i = 0; i < n; i++) {
+ if (fread(buff, SYMESZ, 1, fp) != 1)
+ break;
+ if (aux > 0) {
+ aux--;
+ continue;
+ }
+ getsymbol(member, fp, buff, &ent, &syms[nsyms++]);
+ aux = ent.n_numaux;
+ }
+ if (n != i) {
+ char *err;
+
+ err = (!ferror(fp)) ?
+ "EOF before reading symbols" : strerror(errno);
+ die("nm: %s: %s", fname, err);
+ }
+}
+
+static void
+getfsec(unsigned char *buff, SCNHDR *sec)
+{
+ int n;
+
+ n = (*unpack)(buff,
+ "'8llllllssl",
+ sec->s_name,
+ &sec->s_paddr,
+ &sec->s_vaddr,
+ &sec->s_size,
+ &sec->s_scnptr,
+ &sec->s_relptr,
+ &sec->s_lnnoptr,
+ &sec->s_nrelloc,
+ &sec->s_nlnno,
+ &sec->s_flags);
+ assert(n == SCNHSZ);
+}
+
+static void
+getsects(char *fname, char *member, FILE *fp, FILHDR *hdr)
+{
+ size_t i;
+ char buff[SCNHSZ];
+
+ nsect = hdr->f_nscns;
+ if (nsect == 0)
+ return;
+
+ if (nsect > SIZE_MAX)
+ die("nm: %s:Too many sections\n", member);
+
+ if (fseek(fp, sectbl, SEEK_SET) == EOF)
+ die("nm: %s:%s", member, strerror(errno));
+
+ sections = xcalloc(sizeof(*sections), nsect);
+ for (i = 0; i < nsect; i++) {
+ if (fread(buff, SCNHSZ, 1, fp) != 1)
+ break;
+ getfsec(buff, §ions[i]);
+ }
+ if (i != nsect) {
+ char *err;
+
+ err = (!ferror(fp)) ?
+ "EOF before reading sections" : strerror(errno);
+ die("nm: %s: %s", fname, err);
+ }
+}
+
+static void
+getfhdr(unsigned char *buff, FILHDR *hdr)
+{
+ int n;
+
+ n = (*unpack)(buff,
+ "sslllss",
+ &hdr->f_magic,
+ &hdr->f_nscns,
+ &hdr->f_timdat,
+ &hdr->f_symptr,
+ &hdr->f_nsyms,
+ &hdr->f_opthdr,
+ &hdr->f_flags);
+ assert(n == FILHSZ);
+}
+
+static int
+nm(char *fname, char *member, FILE *fp)
+{
+ unsigned char buff[FILHSZ];
+ FILHDR hdr;
+ long pos = ftell(fp);
+
+ if (fread(buff, FILHSZ, 1, fp) != 1) {
+ if (!ferror(fp))
+ return 0;
+ die("nm: %s: %s", fname, strerror(errno));
+ }
+
+ getfhdr(buff, &hdr);
+ if ((hdr.f_flags & F_SYMS) != 0 || hdr.f_nsyms == 0) {
+ fprintf(stderr, "nm: %s: no symbols\n", member);
+ return 1;
+ }
+
+ /* TODO: Check overflow */
+ strtbl = pos + hdr.f_symptr + hdr.f_nsyms* SYMESZ;
+ symtbl = pos + hdr.f_symptr;
+ sectbl = pos + FILHSZ + hdr.f_opthdr;
+
+ getsects(fname, member, fp, &hdr);
+ getsyms(fname, member, fp, &hdr);
+ printsyms(fname, member, syms, nsyms);
+
+ free(sections);
+ free(syms);
+ return 1;
+}
+
+static int
+probe(char *fname, char *member, FILE *fp)
+{
+ int c;
+ int c1, c2;
+ fpos_t pos;
+ unsigned short magic;
+
+ fgetpos(fp, &pos);
+ c1 = getc(fp);
+ c2 = getc(fp);
+ fsetpos(fp, &pos);
+
+ if (ferror(fp))
+ die("nm: %s: %s", fname, strerror(errno));
+
+ if (c1 == EOF || c2 == EOF)
+ return 0;
+ magic = c1 | c2 << 8;
+
+ switch (magic) {
+ case COFF_I386MAGIC:
+ case COFF_Z80MAGIC:
+ unpack = lunpack;
+ return 1;
+ default:
+ unpack = NULL;
+ return 0;
+ }
+}
+
+struct objfile coff32 = {
+ .probe = probe,
+ .nm = nm,
+};
--- /dev/null
+++ b/src/nm/deps.mk
@@ -1,0 +1,11 @@
+#deps
+coff32.o: $(INCDIR)/scc/scc/coff32/filehdr.h
+coff32.o: $(INCDIR)/scc/scc/coff32/scnhdr.h
+coff32.o: $(INCDIR)/scc/scc/coff32/syms.h
+coff32.o: $(INCDIR)/scc/scc/scc.h
+coff32.o: nm.h
+formats.o: nm.h
+main.o: $(INCDIR)/scc/scc/ar.h
+main.o: $(INCDIR)/scc/scc/arg.h
+main.o: $(INCDIR)/scc/scc/scc.h
+main.o: nm.h
--- /dev/null
+++ b/src/nm/formats.c
@@ -1,0 +1,13 @@
+static char sccsid[] = "@(#) ./nm/probe.c";
+
+#include <stdio.h>
+
+#include "nm.h"
+
+/* TODO: Autogenerate this file */
+struct objfile coff32;
+
+struct objfile *formats[] = {
+ &coff32,
+ NULL,
+};
--- /dev/null
+++ b/src/nm/main.c
@@ -1,0 +1,272 @@
+static char sccsid[] = "@(#) ./nm/main.c";
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/arg.h>
+#include <scc/scc.h>
+#include <scc/ar.h>
+#include "nm.h"
+
+char *argv0;
+static int radix = 16;
+static int Pflag;
+static int Aflag;
+static int vflag;
+static int gflag;
+static int uflag;
+static int arflag;
+
+static int
+object(char *fname, char *member, FILE *fp)
+{
+ extern struct objfile *formats[];
+ struct objfile **p, *obj;
+ void *data;
+
+ for (p = formats; *p; ++p) {
+ obj = *p;
+ if ((*obj->probe)(fname, member, fp))
+ break;
+ }
+ if (*p == NULL)
+ return 0;
+ return (*obj->nm)(fname, member, fp);
+}
+
+static char *
+getfname(struct ar_hdr *hdr, char *dst)
+{
+ char *p;
+ int i;
+
+ memcpy(dst, hdr->ar_name, SARNAM);
+ dst[SARNAM] = '\0';
+
+ for (i = SARNAM-1; i >= 0; i--) {
+ if (dst[i] != ' ' && dst[i] != '/')
+ break;
+ dst[i] = '\0';
+ }
+ return dst;
+}
+
+static void
+ar(char *fname, FILE *fp)
+{
+ struct ar_hdr hdr;
+ long pos, siz;
+ char member[SARNAM+1];
+
+ arflag = 1;
+ if (fseek(fp, SARMAG, SEEK_SET) == EOF)
+ goto file_error;
+
+ while (fread(&hdr, sizeof(hdr), 1, fp) == 1) {
+ pos = ftell(fp);
+ if (strncmp(hdr.ar_fmag, ARFMAG, sizeof(hdr.ar_fmag)))
+ goto corrupted;
+
+ siz = 0;
+ sscanf(hdr.ar_size, "%10ld", &siz);
+ if (siz == 0)
+ goto corrupted;
+
+ if (siz & 1)
+ siz++;
+ if (pos == -1 || pos > LONG_MAX - siz)
+ die("nm: %s: overflow in size of archive", fname);
+ pos += siz;
+
+ getfname(&hdr, member);
+ if (!object(fname, member, fp)) {
+ fprintf(stderr,
+ "nm: skipping member %s in archive %s\n",
+ member, fname);
+ }
+ if (fseek(fp, pos, SEEK_SET) == EOF)
+ goto file_error;
+ }
+ if (ferror(fp))
+ goto file_error;
+ return;
+
+corrupted:
+ die("nm: %s: corrupted archive", fname);
+file_error:
+ die("nm: %s: %s", fname, strerror(errno));
+}
+
+static int
+archive(char *fname, FILE *fp)
+{
+ char magic[SARMAG];
+ fpos_t pos;
+
+ fgetpos(fp, &pos);
+ fread(magic, SARMAG, 1, fp);
+ fsetpos(fp, &pos);
+
+ if (ferror(fp))
+ die("nm: %s: %s", fname, strerror(errno));
+ if (strncmp(magic, ARMAG, SARMAG) != 0)
+ return 0;
+
+ ar(fname, fp);
+ return 1;
+}
+
+static void
+printsym(char *file, char *member, struct symbol *sym)
+{
+ char *fmt;
+ int type = sym->type;
+
+ if (type == '?')
+ return;
+
+ if (uflag && type != 'U')
+ return;
+
+ if (gflag && !isupper(type))
+ return;
+
+ if (Aflag)
+ printf((arflag) ? "%s[%s]: " : "%s: ", file, member);
+ if (Pflag) {
+ printf("%s %c", sym->name, sym->type);
+ if (type != 'U') {
+ if (radix == 8)
+ fmt = " %016.16llo %lo";
+ else if (radix == 10)
+ fmt = " %016.16llu %lu";
+ else
+ fmt = " %016.16llx %lx";
+ printf(fmt, sym->value, sym->size);
+ }
+ } else {
+ if (type == 'U')
+ fmt = " ";
+ else if (radix == 8)
+ fmt = "%016.16llo";
+ else if (radix == 10)
+ fmt = "%016.16lld";
+ else
+ fmt = "%016.16llx";
+ printf(fmt, sym->value);
+ printf(" %c %s", sym->type, sym->name);
+ }
+ putchar('\n');
+}
+
+static int
+cmp(const void *p1, const void *p2)
+{
+ const struct symbol *s1 = p1, *s2 = p2;
+
+ if (vflag) {
+ if (s1->value > s2->value)
+ return 1;
+ if (s1->value < s2->value)
+ return -1;
+ if (s1->type == 'U' && s2->type == 'U')
+ return 0;
+ if (s1->type == 'U')
+ return -1;
+ if (s2->type == 'U')
+ return 1;
+ return 0;
+ } else {
+ return strcmp(s1->name, s2->name);
+ }
+}
+
+void
+printsyms(char *file, char *member, struct symbol *syms, size_t nsyms)
+{
+ qsort(syms, nsyms, sizeof(*syms), cmp);
+
+ while (nsyms--)
+ printsym(file, member, syms++);
+}
+
+static void
+doit(char *fname)
+{
+ FILE *fp;
+
+ arflag = 0;
+
+ if ((fp = fopen(fname, "rb")) == NULL)
+ die("nm: %s: %s", fname, strerror(errno));
+
+ if (!object(fname, fname, fp) && !archive(fname, fp))
+ die("nm: %s: File format not recognized", fname);
+
+ if (ferror(fp))
+ die("nm: %s: %s", fname, strerror(errno));
+
+ fclose(fp);
+}
+
+static void
+usage(void)
+{
+ fputs("nm [-APv][ -g| -u][-t format] [file...]\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ char *t;
+
+ ARGBEGIN {
+ case 'P':
+ Pflag = 1;
+ break;
+ case 'A':
+ Aflag = 1;
+ break;
+ case 'g':
+ gflag = 1;
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+ case 'v':
+ vflag = 1;
+ break;
+ case 't':
+ t = EARGF(usage());
+ if (!strcmp(t, "o"))
+ radix = 8;
+ else if (!strcmp(t, "d"))
+ radix = 10;
+ else if (!strcmp(t, "x"))
+ radix = 16;
+ else
+ usage();
+ break;
+ default:
+ usage();
+ } ARGEND
+
+ if (argc == 0) {
+ doit("a.out");
+ } else {
+ for ( ; *argv; ++argv)
+ doit(*argv);
+ }
+
+ fflush(stdout);
+ if (ferror(stdout))
+ die("nm: error writing in output");
+
+ return 0;
+}
--- /dev/null
+++ b/src/nm/nm.h
@@ -1,0 +1,14 @@
+struct symbol {
+ char *name;
+ int type;
+ unsigned long long value;
+ unsigned long size;
+};
+
+struct objfile {
+ int (*probe)(char *fname, char *member, FILE *fp);
+ int (*nm)(char *fname, char *member, FILE *fp);
+};
+
+/* main.c */
+extern void printsyms(char *, char *, struct symbol *, size_t );
--- /dev/null
+++ b/src/objdump/Makefile
@@ -1,0 +1,16 @@
+.POSIX:
+
+PROJECTDIR = ../..
+include $(PROJECTDIR)/scripts/rules.mk
+
+OBJS = main.o
+TARGET = $(BINDIR)/objdump
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS) $(LIBDIR)/libscc.a
+ $(CC) $(SCC_LDFLAGS) $(OBJS) -lscc -o $@
+
+dep: inc-dep
+
+include deps.mk
--- /dev/null
+++ b/src/objdump/deps.mk
@@ -1,0 +1,4 @@
+#deps
+main.o: $(INCDIR)/scc/scc/arg.h
+main.o: $(INCDIR)/scc/scc/myro.h
+main.o: $(INCDIR)/scc/scc/scc.h
--- /dev/null
+++ b/src/objdump/main.c
@@ -1,0 +1,333 @@
+#include <errno.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <scc/arg.h>
+#include <scc/scc.h>
+#include <scc/myro.h>
+
+char *argv0;
+static char *strings;
+static size_t strsiz;
+
+struct obj_info {
+ char *fname;
+ FILE *fp;
+ struct myrohdr hdr;
+ fpos_t strpos;
+ fpos_t secpos;
+ fpos_t sympos;
+ fpos_t relpos;
+ fpos_t datapos;
+};
+
+static char *
+getstring(unsigned long off)
+{
+ size_t n;
+
+ if ((int32_t) off == -1)
+ return "";
+ if (off < SIZE_MAX) {
+ for (n = off; n < strsiz && strings[n]; ++n)
+ ;
+ if (n < strsiz)
+ return &strings[off];
+ }
+ fprintf(stderr, "objdump: wrong string offset %lu\n", off);
+ return "";
+}
+
+static int
+printhdr(struct obj_info *obj)
+{
+ struct myrohdr *hdr = &obj->hdr;
+
+ printf("header:\n"
+ " magic: %02x %02x %02x %02x \"%4.4s\"\n"
+ " format: %lu (\"%s\")\n"
+ " entry: %llu\n"
+ " string table size: %llu\n"
+ " section table size: %llu\n"
+ " symbol table size: %llu\n"
+ " relocation table size: %llu\n",
+ hdr->magic[0], hdr->magic[1],
+ hdr->magic[2], hdr->magic[3],
+ hdr->magic,
+ hdr->format, getstring(hdr->format),
+ hdr->entry,
+ hdr->strsize,
+ hdr->secsize,
+ hdr->symsize,
+ hdr->relsize);
+ return 0;
+}
+
+static int
+printstrings(struct obj_info *obj)
+{
+ size_t off, begin;;
+ char *s = NULL;
+
+ puts("strings:");
+ for (off = 0; off < strsiz; off++) {
+ if (s == NULL) {
+ s = &strings[off];
+ begin = off;
+ }
+ if (strings[off] == '\0') {
+ printf(" [%zd] \"%s\"\n", begin, s);
+ s = NULL;
+ }
+ }
+ return 0;
+}
+
+static char *
+sectflags(struct myrosect *sec)
+{
+ static char flags[10];
+ char *s = flags + sizeof(flags);
+
+ if (sec->flags & MYROSEC_LOAD)
+ *--s = 'L';
+ if (sec->flags & MYROSEC_FILE)
+ *--s = 'F';
+ if (sec->flags & MYROSEC_ABS)
+ *--s = 'A';
+ if (sec->flags & MYROSEC_EXEC)
+ *--s = 'X';
+ if (sec->flags & MYROSEC_WRITE)
+ *--s = 'W';
+ if (sec->flags & MYROSEC_READ)
+ *--s = 'R';
+ return s;
+}
+
+static int
+printsections(struct obj_info *obj)
+{
+ unsigned long long n, i;
+ struct myrosect sect;
+ struct myrohdr *hdr = &obj->hdr;
+
+ printf("sections:\n"
+ " [Nr]\t%s\t%-16s\t%-16s\t%s\t%s\t%s\n",
+ "Name",
+ "Offset",
+ "Size",
+ "Fill",
+ "Align",
+ "Flags");
+
+ n = hdr->secsize / MYROSECT_SIZ;
+ for (i = 0; i < n; ++i) {
+ if (rdmyrosec(obj->fp, §) < 0)
+ return -1;
+ printf(" [%2llu]\t%s\t%016llX\t%016llX\t%02X\t%u\t%s\n",
+ i,
+ getstring(sect.name),
+ sect.offset,
+ sect.len,
+ sect.fill,
+ sect.aligment,
+ sectflags(§));
+ }
+ return 0;
+}
+
+static char *
+symflags(struct myrosym *sym)
+{
+ static char flags[10];
+ char *s = flags + sizeof(flags);
+
+ if (sym->flags & MYROSYM_COMMON)
+ *--s = 'C';
+ if (sym->flags & MYROSYM_EXTERN)
+ *--s = 'G';
+ if (sym->flags & MYROSYM_UNDEF)
+ *s-- = 'U';
+ return s;
+}
+
+static int
+printsymbols(struct obj_info *obj)
+{
+ unsigned long long n, i;
+ struct myrosym sym;
+ struct myrohdr *hdr = &obj->hdr;
+
+ printf("symbols:\n"
+ " [Nr]\t%s\t%-16s\t%s\t%s\t%s\t%s\n",
+ "Name",
+ "Value",
+ "Section",
+ "Flags",
+ "Size",
+ "Type");
+ n = hdr->symsize / MYROSYM_SIZ;
+ for (i = 0; i < n; ++i) {
+ if (rdmyrosym(obj->fp, &sym) < 0)
+ return -1;
+ printf(" [%2llu]\t%s\t%016llX\t%u\t%s\t%llu\t%s\n",
+ i,
+ getstring(sym.name),
+ sym.offset,
+ sym.section,
+ symflags(&sym),
+ sym.len,
+ getstring(sym.type));
+ }
+ return 0;
+}
+
+static int
+printrelocs(struct obj_info *obj)
+{
+ unsigned long long n, i;
+ struct myrorel rel;
+ struct myrohdr *hdr = &obj->hdr;
+
+ printf("relocs:\n"
+ " [Nr]\t%-16s\tType\tId\tSize\tNbits\tShift\n",
+ "Offset");
+ n = hdr->relsize / MYROREL_SIZ;
+ for (i = 0; i < n; ++i) {
+ if (rdmyrorel(obj->fp, &rel) < 0)
+ return -1;
+ printf(" [%2llu]\t%016llX\t%s\t%lu\t%u\t%u\t%u\n",
+ i,
+ rel.offset,
+ (rel.id & 1<<31) ? "section" : "symbol",
+ rel.id & ~(1<<31),
+ rel.size,
+ rel.nbits,
+ rel.shift);
+ }
+ return 0;
+}
+
+static int
+printdata(struct obj_info *obj)
+{
+ unsigned long long off;
+ int c, i, j;
+
+ puts("data:");
+ for (off = 0; ; off += 32) {
+ printf(" %016llX:", off);
+ for (i = 0; i < 2; i++) {
+ for (j = 0; j < 8; j++) {
+ if ((c = getc(obj->fp)) == EOF)
+ goto exit_loop;
+ printf(" %02X", c);
+ }
+ putchar('\t');
+ }
+ putchar('\n');
+ }
+
+exit_loop:
+ putchar('\n');
+ return (ferror(obj->fp)) ? -1 : 0;
+}
+
+void
+dump(char *fname, FILE *fp)
+{
+ struct obj_info obj;
+ struct myrohdr *hdr;
+
+ obj.fname = fname;
+ obj.fp = fp;
+ hdr = &obj.hdr;
+
+ if (rdmyrohdr(obj.fp, hdr) < 0)
+ goto wrong_file;
+ if (strncmp(hdr->magic, MYROMAGIC, MYROMAGIC_SIZ)) {
+ fprintf(stderr,
+ "objdump: %s: File format not recognized\n",
+ fname);
+ return;
+ }
+ puts(fname);
+ if (hdr->strsize > SIZE_MAX) {
+ fprintf(stderr,
+ "objdump: %s: overflow in header\n",
+ fname);
+ return;
+ }
+ strsiz = hdr->strsize;
+
+ if (strsiz > 0) {
+ strings = xmalloc(strsiz);
+ fread(strings, strsiz, 1, fp);
+ if (feof(fp))
+ goto wrong_file;
+ }
+
+ if (printhdr(&obj) < 0)
+ goto wrong_file;
+ if (printstrings(&obj) < 0)
+ goto wrong_file;
+ if (printsections(&obj) < 0)
+ goto wrong_file;
+ if (printsymbols(&obj) < 0)
+ goto wrong_file;
+ if (printrelocs(&obj) < 0)
+ goto wrong_file;
+ if (printdata(&obj) < 0)
+ goto wrong_file;
+ return;
+
+wrong_file:
+ fprintf(stderr,
+ "objdump: %s: %s\n",
+ fname, strerror(errno));
+}
+
+void
+doit(char *fname)
+{
+ FILE *fp;
+
+ if ((fp = fopen(fname, "rb")) == NULL) {
+ fprintf(stderr, "objdump: %s: %s\n", fname, strerror(errno));
+ return;
+ }
+ dump(fname, fp);
+ fclose(fp);
+}
+
+void
+usage(void)
+{
+ fputs("usage: objdump file ...\n", stderr);
+ exit(1);
+}
+
+int
+main(int argc, char *argv[])
+{
+ ARGBEGIN {
+ default:
+ usage();
+ } ARGEND
+
+ if (argc == 0)
+ doit("a.out");
+ else while (*argv) {
+ free(strings);
+ strings = NULL;
+ doit(*argv++);
+ }
+
+ if (fclose(stdout) == EOF)
+ die("objdump: stdout: %s", strerror(errno));
+
+ return 0;
+}
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,7 +1,7 @@
.POSIX:
PROJECTDIR = ..
-include $(PROJECTDIR)/rules.mk
+include $(PROJECTDIR)/scripts/rules.mk
DIRS=ar/execute \
nm/execute \