qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RISU PATCH v3 10/18] x86.risu: add MMX instructions


From: Jan Bobek
Subject: [Qemu-devel] [RISU PATCH v3 10/18] x86.risu: add MMX instructions
Date: Thu, 11 Jul 2019 18:32:52 -0400

Add an x86 configuration file with all MMX instructions.

Signed-off-by: Jan Bobek <address@hidden>
---
 x86.risu | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 321 insertions(+)
 create mode 100644 x86.risu

diff --git a/x86.risu b/x86.risu
new file mode 100644
index 0000000..208ac16
--- /dev/null
+++ b/x86.risu
@@ -0,0 +1,321 @@
+###############################################################################
+# Copyright (c) 2019 Jan Bobek
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#     Jan Bobek - initial implementation
+###############################################################################
+
+# Input file for risugen defining x86 instructions
+.mode x86
+
+#
+# Data Transfer Instructions
+# --------------------------
+#
+
+# NP 0F 6E /r: MOVD mm,r/m32
+# NP 0F 7E /r: MOVD r/m32,mm
+MOVD MMX 00001111 011 d 1110 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; !(defined 
$_->{modrm}{reg2} && $_->{modrm}{reg2} == REG_RSP) } \
+  !memory { $d ? store(size => 4) : load(size => 4); }
+
+# NP REX.W + 0F 6E /r: MOVQ mm,r/m64
+# NP REX.W + 0F 7E /r: MOVQ r/m64,mm
+MOVQ MMX 00001111 011 d 1110 \
+  !constraints { rex($_, w => 1); modrm($_); $_->{modrm}{reg} &= 0b111; 
!(defined $_->{modrm}{reg2} && $_->{modrm}{reg2} == REG_RSP) } \
+  !memory { $d ? store(size => 8) : load(size => 8); }
+
+# NP 0F 6F /r: MOVQ mm, mm/m64
+# NP 0F 7F /r: MOVQ mm/m64, mm
+MOVQ_mm MMX 00001111 011 d 1111 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { $d ? store(size => 8) : load(size => 8); }
+
+#
+# Arithmetic Instructions
+# -----------------------
+#
+
+# NP 0F FC /r: PADDB mm, mm/m64
+PADDB MMX 00001111 11111100 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F FD /r: PADDW mm, mm/m64
+PADDW MMX 00001111 11111101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F FE /r: PADDD mm, mm/m64
+PADDD MMX 00001111 11111110 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F EC /r: PADDSB mm, mm/m64
+PADDSB MMX 00001111 11101100 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F ED /r: PADDSW mm, mm/m64
+PADDSW MMX 00001111 11101101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F DC /r: PADDUSB mm,mm/m64
+PADDUSB MMX 00001111 11011100 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F DD /r: PADDUSW mm,mm/m64
+PADDUSW MMX 00001111 11011101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F F8 /r: PSUBB mm, mm/m64
+PSUBB MMX 00001111 11111000 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F F9 /r: PSUBW mm, mm/m64
+PSUBW MMX 00001111 11111001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F FA /r: PSUBD mm, mm/m64
+PSUBD MMX 00001111 11111010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F E8 /r: PSUBSB mm, mm/m64
+PSUBSB MMX 00001111 11101000 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F E9 /r: PSUBSW mm, mm/m64
+PSUBSW MMX 00001111 11101001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F D8 /r: PSUBUSB mm, mm/m64
+PSUBUSB MMX 00001111 11011000 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F D9 /r: PSUBUSW mm, mm/m64
+PSUBUSW MMX 00001111 11011001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F D5 /r: PMULLW mm, mm/m64
+PMULLW MMX 00001111 11010101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F E5 /r: PMULHW mm, mm/m64
+PMULHW MMX 00001111 11100101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F F5 /r: PMADDWD mm, mm/m64
+PMADDWD MMX 00001111 11110101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+#
+# Comparison Instructions
+# -----------------------
+#
+
+# NP 0F 74 /r: PCMPEQB mm,mm/m64
+PCMPEQB MMX 00001111 01110100 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 75 /r: PCMPEQW mm,mm/m64
+PCMPEQW MMX 00001111 01110101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 76 /r: PCMPEQD mm,mm/m64
+PCMPEQD MMX 00001111 01110110 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 64 /r: PCMPGTB mm,mm/m64
+PCMPGTB MMX 00001111 01100100 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 65 /r: PCMPGTW mm,mm/m64
+PCMPGTW MMX 00001111 01100101 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 66 /r: PCMPGTD mm,mm/m64
+PCMPGTD MMX 00001111 01100110 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+#
+# Logical Instructions
+# --------------------
+#
+
+# NP 0F DB /r: PAND mm, mm/m64
+PAND MMX 00001111 11011011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F DF /r: PANDN mm, mm/m64
+PANDN MMX 00001111 11011111 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F EB /r: POR mm, mm/m64
+POR MMX 00001111 11101011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F EF /r: PXOR mm, mm/m64
+PXOR MMX 00001111 11101111 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+#
+# Shift and Rotate Instructions
+# -----------------------------
+#
+
+# NP 0F F1 /r: PSLLW mm, mm/m64
+PSLLW MMX 00001111 11110001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F F2 /r: PSLLD mm, mm/m64
+PSLLD MMX 00001111 11110010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F F3 /r: PSLLQ mm, mm/m64
+PSLLQ MMX 00001111 11110011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 71 /6 ib: PSLLW mm1, imm8
+PSLLW_imm MMX 00001111 01110001 \
+  !constraints { modrm($_, reg => 6); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F 72 /6 ib: PSLLD mm, imm8
+PSLLD_imm MMX 00001111 01110010 \
+  !constraints { modrm($_, reg => 6); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F 73 /6 ib: PSLLQ mm, imm8
+PSLLQ_imm MMX 00001111 01110011 \
+  !constraints { modrm($_, reg => 6); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F D1 /r: PSRLW mm, mm/m64
+PSRLW MMX 00001111 11010001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F D2 /r: PSRLD mm, mm/m64
+PSRLD MMX 00001111 11010010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F D3 /r: PSRLQ mm, mm/m64
+PSRLQ MMX 00001111 11010011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 71 /2 ib: PSRLW mm, imm8
+PSRLW_imm MMX 00001111 01110001 \
+  !constraints { modrm($_, reg => 2); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F 72 /2 ib: PSRLD mm, imm8
+PSRLD_imm MMX 00001111 01110010 \
+  !constraints { modrm($_, reg => 2); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F 73 /2 ib: PSRLQ mm, imm8
+PSRLQ_imm MMX 00001111 01110011 \
+  !constraints { modrm($_, reg => 2); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F E1 /r: PSRAW mm,mm/m64
+PSRAW MMX 00001111 11100001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F E2 /r: PSRAD mm,mm/m64
+PSRAD MMX 00001111 11100010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 71 /4 ib: PSRAW mm,imm8
+PSRAW_imm MMX 00001111 01110001 \
+  !constraints { modrm($_, reg => 4); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+# NP 0F 72 /4 ib: PSRAD mm,imm8
+PSRAD_imm MMX 00001111 01110010 \
+  !constraints { modrm($_, reg => 4); imm($_, width => 8); $_->{modrm}{reg2} 
&= 0b111 if defined $_->{modrm}{reg2}; defined $_->{modrm}{reg2} }
+
+#
+# Shuffle, Unpack, Blend, Insert, Extract, Broadcast, Permute, Gather 
Instructions
+# 
--------------------------------------------------------------------------------
+#
+
+# NP 0F 63 /r: PACKSSWB mm1, mm2/m64
+PACKSSWB MMX 00001111 01100011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 6B /r: PACKSSDW mm1, mm2/m64
+PACKSSDW MMX 00001111 01101011 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 67 /r: PACKUSWB mm, mm/m64
+PACKUSWB MMX 00001111 01100111 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 68 /r: PUNPCKHBW mm, mm/m64
+PUNPCKHBW MMX 00001111 01101000 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8, align => 8); }
+
+# NP 0F 69 /r: PUNPCKHWD mm, mm/m64
+PUNPCKHWD MMX 00001111 01101001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 6A /r: PUNPCKHDQ mm, mm/m64
+PUNPCKHDQ MMX 00001111 01101010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 8); }
+
+# NP 0F 60 /r: PUNPCKLBW mm, mm/m32
+PUNPCKLBW MMX 00001111 01100000 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 4); }
+
+# NP 0F 61 /r: PUNPCKLWD mm, mm/m32
+PUNPCKLWD MMX 00001111 01100001 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 4); }
+
+# NP 0F 62 /r: PUNPCKLDQ mm, mm/m32
+PUNPCKLDQ MMX 00001111 01100010 \
+  !constraints { modrm($_); $_->{modrm}{reg} &= 0b111; $_->{modrm}{reg2} &= 
0b111 if defined $_->{modrm}{reg2}; 1 } \
+  !memory { load(size => 4); }
+
+#
+# State Management Instructions
+# -----------------------------
+#
+
+# NP 0F 77: EMMS
+EMMS MMX 00001111 01110111
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]