/* $Id$ */
/* Copyright (c) 2011-2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. */



/* flags */
#define AOF_I686_MM	(AOF_I586_LAST << 1)


/* helpers */
/* mod r/m byte */
#define OP_R64		AO_REGISTER(0, 64, 0)
#define OP_R64_R	AO_REGISTER(AOF_I386_MODRM, 64, 8)
#define OP_RM64_D0_R	AO_DREGISTER(AOF_I386_MODRM, 0, W, 8)
#define OP_RM64_D8_R	AO_DREGISTER(AOF_I386_MODRM, 8, W, 8)
#define OP_RM64_DW_R	AO_DREGISTER(AOF_I386_MODRM, W, W, 8)
#define OP_RM64_R64_R	AO_REGISTER(AOF_I386_MODRM, 64, 8)


/* instructions */
/* EMMS		0x0f77		2					*/
{ "emms",	0x0f77,		OP2F, AO_0()				},
/* MOVD		0x0f6e /r	OP2F  mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "movd",	0x0f6e,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "movd",	0x0f6e,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "movd",	0x0f6e,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "movd",	0x0f6e,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* MOVD		0x0f7e /r	OP2F  mm/m64      mm			*/
{ "movd",	0x0f7e,		OP2F, AO_2(OP_RM64_D0_R, OP_R64_R)	},
{ "movd",	0x0f7e,		OP2F, AO_2(OP_RM64_D8_R, OP_R64_R)	},
{ "movd",	0x0f7e,		OP2F, AO_2(OP_RM64_DW_R, OP_R64_R)	},
#if 1 /* FIXME doesn't work properly */
{ "movq",	0x0f7f,		OP2F, AO_2(OP_RM64_R64_R,OP_R64_R)	},
#endif
/* MOVQ		0x0f6f /r	OP2F  mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "movq",	0x0f6f,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "movq",	0x0f6f,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "movq",	0x0f6f,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "movq",	0x0f6f,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* MOVQ		0x0f7f /r	OP2F  mm/m64      mm			*/
{ "movq",	0x0f7f,		OP2F, AO_2(OP_RM64_D0_R, OP_R64_R)	},
{ "movq",	0x0f7f,		OP2F, AO_2(OP_RM64_D8_R, OP_R64_R)	},
{ "movq",	0x0f7f,		OP2F, AO_2(OP_RM64_DW_R, OP_R64_R)	},
#if 1 /* FIXME doesn't work properly */
{ "movq",	0x0f7f,		OP2F, AO_2(OP_RM64_R64_R,OP_R64_R)	},
#endif
/* FIXME implement */
/* PADDB	0x0ffc /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "paddb",	0x0ffc,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "paddb",	0x0ffc,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "paddb",	0x0ffc,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "paddb",	0x0ffc,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PADDD	0x0ffd /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "paddd",	0x0ffe,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "paddd",	0x0ffe,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "paddd",	0x0ffe,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "paddd",	0x0ffe,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PADDW	0x0ffd /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "paddw",	0x0ffd,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "paddw",	0x0ffd,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "paddw",	0x0ffd,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "paddw",	0x0ffd,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PADDSB	0x0fec /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "paddsb",	0x0fec,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "paddsb",	0x0fec,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "paddsb",	0x0fec,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "paddsb",	0x0fec,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PADDSW	0x0fed /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "paddsw",	0x0fed,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "paddsw",	0x0fed,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "paddsw",	0x0fed,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "paddsw",	0x0fed,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PAND		0x0fdb /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "pand",	0x0fdb,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "pand",	0x0fdb,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "pand",	0x0fdb,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "pand",	0x0fdb,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PANDN	0x0fdf /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "pandn",	0x0fdf,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "pandn",	0x0fdf,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "pandn",	0x0fdf,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "pandn",	0x0fdf,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* POR		0x0feb /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "por",	0x0feb,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "por",	0x0feb,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "por",	0x0feb,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "por",	0x0feb,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
/* PUNPCKLBW	0x0f60 /r	2     mm          mm/m32		*/
/* FIXME implement */
/* PUNPCKLBD	0x0f61 /r	2     mm          mm/m32		*/
/* FIXME implement */
/* PUNPCKLBQ	0x0f62 /r	2     mm          mm/m32		*/
/* FIXME implement */
/* PXOR		0x0fef /r	2     mm          mm/m64		*/
#if 1 /* FIXME doesn't work properly */
{ "pxor",	0x0fef,		OP2F, AO_2(OP_R64_R, OP_RM64_D0_R)	},
{ "pxor",	0x0fef,		OP2F, AO_2(OP_R64_R, OP_RM64_D8_R)	},
{ "pxor",	0x0fef,		OP2F, AO_2(OP_R64_R, OP_RM64_DW_R)	},
{ "pxor",	0x0fef,		OP2F, AO_2(OP_R64_R, OP_RM64_R64_R)	},
#endif
{ "syscall",	0x0f05,		OP2F, AO_0()				},
