X86: Implement the instructions that move sign bits.
authorGabe Black <gblack@eecs.umich.edu>
Tue, 18 Aug 2009 03:22:56 +0000 (20:22 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Tue, 18 Aug 2009 03:22:56 +0000 (20:22 -0700)
src/arch/x86/isa/decoder/two_byte_opcodes.isa
src/arch/x86/isa/insts/simd128/floating_point/data_transfer/move_mask.py
src/arch/x86/isa/insts/simd128/integer/data_transfer/move_mask.py
src/arch/x86/isa/insts/simd64/integer/data_transfer/move_mask.py

index adc14b2bddbf9fe6812156fa793bd7ce5004f0c0..7e0f19fb145846f47dd04535480f518be28db390 100644 (file)
                 0x0A: decode LEGACY_DECODEVAL {
                     // no prefix
                     0x0: decode OPCODE_OP_BOTTOM3 {
-                        0x0: WarnUnimpl::movmskps_Gd_VRo();
+                        0x0: MOVMSKPS(Gd,VRo);
                         0x1: SQRTPS(Vo,Wo);
                         0x2: WarnUnimpl::rqsrtps_Vo_Wo();
                         0x3: WarnUnimpl::rcpps_Vo_Wo();
                     }
                     // operand size (0x66)
                     0x1: decode OPCODE_OP_BOTTOM3 {
-                        0x0: WarnUnimpl::movmskpd_Gd_VRo();
+                        0x0: MOVMSKPD(Gd,VRo);
                         0x1: SQRTPD(Vo,Wo);
                         0x4: ANDPD(Vo,Wo);
                         0x5: ANDNPD(Vo,Wo);
                 }
                 0x7: Inst::IMUL(Gv,Ev);
             }
-            0x16: decode OPCODE_OP_BOTTOM3 {
-                0x0: Inst::CMPXCHG(Eb,Gb);
-                0x1: Inst::CMPXCHG(Ev,Gv);
-                0x2: lss_Gz_Mp();
-                0x3: Inst::BTR(Ev,Gv);
-                0x4: lfs_Gz_Mp();
-                0x5: lgs_Gz_Mp();
-                //The size of the second operand in these instructions should
-                //really be "b" or "w", but it's set to v in order to have a
-                //consistent register size. This shouldn't affect behavior.
-                0x6: Inst::MOVZX_B(Gv,Ev);
-                0x7: Inst::MOVZX_W(Gv,Ev);
-            }
-            0x17: decode OPCODE_OP_BOTTOM3 {
-                0x0: jmpe_Jz(); // IA-64?
-                format Inst {
+            format Inst {
+                0x16: decode OPCODE_OP_BOTTOM3 {
+                    0x0: CMPXCHG(Eb,Gb);
+                    0x1: CMPXCHG(Ev,Gv);
+                    0x2: WarnUnimpl::lss_Gz_Mp();
+                    0x3: BTR(Ev,Gv);
+                    0x4: WarnUnimpl::lfs_Gz_Mp();
+                    0x5: WarnUnimpl::lgs_Gz_Mp();
+                    //The size of the second operand in these instructions
+                    //should really be "b" or "w", but it's set to v in order
+                    //to have a consistent register size. This shouldn't
+                    //affect behavior.
+                    0x6: MOVZX_B(Gv,Ev);
+                    0x7: MOVZX_W(Gv,Ev);
+                }
+                0x17: decode OPCODE_OP_BOTTOM3 {
+                    0x0: WarnUnimpl::jmpe_Jz(); // IA-64?
                     //0x1: group11_UD2();
                     0x1: UD2();
                     //0x2: group8_Ev_Ib();
                         default: UD2();
                     }
                     0x3: BTC(Ev,Gv);
+                    0x4: BSF(Gv,Ev);
+                    0x5: BSR(Gv,Ev);
+                    //The size of the second operand in these instructions
+                    //should really be "b" or "w", but it's set to v in order
+                    //to have a consistent register size. This shouldn't
+                    //affect behavior.
+                    0x6: MOVSX_B(Gv,Ev);
+                    0x7: MOVSX_W(Gv,Ev);
                 }
-                0x4: Inst::BSF(Gv,Ev);
-                0x5: Inst::BSR(Gv,Ev);
-                //The size of the second operand in these instructions should
-                //really be "b" or "w", but it's set to v in order to have a
-                //consistent register size. This shouldn't affect behavior.
-                0x6: Inst::MOVSX_B(Gv,Ev);
-                0x7: Inst::MOVSX_W(Gv,Ev);
-            }
-            format Inst {
                 0x18: decode OPCODE_OP_BOTTOM3 {
                     0x0: XADD(Eb,Gb);
                     0x1: XADD(Ev,Gv);
                     8: BSWAP_Q(Bq);
                     default: UD2();
                 }
-            }
-            0x1A: decode LEGACY_DECODEVAL {
-                // no prefix
-                0x0: decode OPCODE_OP_BOTTOM3 {
-                    0x1: Inst::PSRLW(Pq,Qq);
-                    0x2: Inst::PSRLD(Pq,Qq);
-                    0x3: Inst::PSRLQ(Pq,Qq);
-                    0x4: Inst::PADDQ(Pq,Qq);
-                    0x5: Inst::PMULLW(Pq,Qq);
-                    0x7: pmovmskb_Gd_PRq();
-                    default: Inst::UD2();
-                }
-                // repe (0xF3)
-                0x4: decode OPCODE_OP_BOTTOM3 {
-                    0x6: movq2dq_Vo_PRq();
-                    default: Inst::UD2();
-                }
-                // operand size (0x66)
-                0x1: decode OPCODE_OP_BOTTOM3 {
-                    0x0: addsubpd_Vo_Wo();
-                    0x1: Inst::PSRLW(Vo,Wo);
-                    0x2: Inst::PSRLD(Vo,Wo);
-                    0x3: Inst::PSRLQ(Vo,Wo);
-                    0x4: Inst::PADDQ(Vo,Wo);
-                    0x5: Inst::PMULLW(Vo,Wo);
-                    0x6: Inst::MOVQ(Wq,Vq);
-                    0x7: pmovmskb_Gd_VRo();
-                }
-                // repne (0xF2)
-                0x8: decode OPCODE_OP_BOTTOM3 {
-                    0x0: addsubps_Vo_Wo();
-                    0x6: movdq2q_Pq_VRq();
-                    default: Inst::UD2();
+                0x1A: decode LEGACY_DECODEVAL {
+                    // no prefix
+                    0x0: decode OPCODE_OP_BOTTOM3 {
+                        0x1: PSRLW(Pq,Qq);
+                        0x2: PSRLD(Pq,Qq);
+                        0x3: PSRLQ(Pq,Qq);
+                        0x4: PADDQ(Pq,Qq);
+                        0x5: PMULLW(Pq,Qq);
+                        0x7: PMOVMSKB(Gd,PRq);
+                        default: UD2();
+                    }
+                    // repe (0xF3)
+                    0x4: decode OPCODE_OP_BOTTOM3 {
+                        0x6: WarnUnimpl::movq2dq_Vo_PRq();
+                        default: UD2();
+                    }
+                    // operand size (0x66)
+                    0x1: decode OPCODE_OP_BOTTOM3 {
+                        0x0: WarnUnimpl::addsubpd_Vo_Wo();
+                        0x1: PSRLW(Vo,Wo);
+                        0x2: PSRLD(Vo,Wo);
+                        0x3: PSRLQ(Vo,Wo);
+                        0x4: PADDQ(Vo,Wo);
+                        0x5: PMULLW(Vo,Wo);
+                        0x6: MOVQ(Wq,Vq);
+                        0x7: PMOVMSKB(Gd,VRo);
+                    }
+                    // repne (0xF2)
+                    0x8: decode OPCODE_OP_BOTTOM3 {
+                        0x0: WarnUnimpl::addsubps_Vo_Wo();
+                        0x6: WarnUnimpl::movdq2q_Pq_VRq();
+                        default: UD2();
+                    }
+                    default: UD2();
                 }
-                default: Inst::UD2();
-            }
-            format Inst {
                 0x1B: decode LEGACY_DECODEVAL {
                     // no prefix
                     0x0: decode OPCODE_OP_BOTTOM3 {
index abd1c7327267a33e3af9091a6238e973ba949e9a..5c5fb81d2ae90ae0166ff74c123da1195f0ee6fb 100644 (file)
 # Authors: Gabe Black
 
 microcode = '''
-# MOVMSKPS
-# MOVMSKPD
+def macroop MOVMSKPS_R_XMM {
+    limm reg, 0
+    movsign reg, xmmlm, size=4, ext=0
+    movsign reg, xmmhm, size=4, ext=1
+};
+
+def macroop MOVMSKPD_R_XMM {
+    limm reg, 0
+    movsign reg, xmmlm, size=8, ext=0
+    movsign reg, xmmhm, size=8, ext=1
+};
 '''
index 558391c6a880280502c0162256479b07aa70dd65..0be1229b45b45bcb14b53709ee761f2483a5cee8 100644 (file)
@@ -54,5 +54,9 @@
 # Authors: Gabe Black
 
 microcode = '''
-# PMOVMSKB
+def macroop PMOVMSKB_R_XMM {
+    limm reg, 0
+    movsign reg, xmmlm, size=1, ext=0
+    movsign reg, xmmhm, size=1, ext=1
+};
 '''
index 558391c6a880280502c0162256479b07aa70dd65..11e670b40144feeea0f906f23eb857baa3eb880d 100644 (file)
@@ -54,5 +54,8 @@
 # Authors: Gabe Black
 
 microcode = '''
-# PMOVMSKB
+def macroop PMOVMSKB_R_MMX {
+    limm reg, 0
+    movsign reg, mmxm, size=1, ext=0
+};
 '''