From 3633392ec4e7e3dade7501f31751aef54a471ee5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 Aug 2009 18:24:18 -0700 Subject: [PATCH] X86: Implement PAND, ANDPS, and ANDPD. --- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 8 ++-- .../simd128/floating_point/logical/andp.py | 47 +++++++++++++++++-- .../isa/insts/simd128/integer/logical/pand.py | 24 +++++++++- .../isa/insts/simd64/integer/logical/pand.py | 17 ++++++- 4 files changed, 85 insertions(+), 11 deletions(-) diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index 10b0bb0e3..4fd1fa4fc 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -468,7 +468,7 @@ 0x1: sqrtps_Vo_Wo(); 0x2: rqsrtps_Vo_Wo(); 0x3: rcpps_Vo_Wo(); - 0x4: andps_Vo_Wo(); + 0x4: Inst::ANDPS(Vo,Wo); 0x5: andnps_Vo_Wo(); 0x6: Inst::ORPS(Vo,Wo); 0x7: Inst::XORPS(Vo,Wo); @@ -484,7 +484,7 @@ 0x1: decode OPCODE_OP_BOTTOM3 { 0x0: movmskpd_Gd_VRo(); 0x1: sqrtpd_Vo_Wo(); - 0x4: andpd_Vo_Wo(); + 0x4: Inst::ANDPD(Vo,Wo); 0x5: andnpd_Vo_Wo(); 0x6: Inst::ORPD(Vo,Wo); //This really should be type o, but it works on q sized @@ -986,7 +986,7 @@ 0x0: psubusb_Pq_Qq(); 0x1: psubusw_Pq_Qq(); 0x2: pminub_Pq_Qq(); - 0x3: pand_Pq_Qq(); + 0x3: Inst::PAND(Pq,Qq); 0x4: paddusb_Pq_Qq(); 0x5: paddusw_Pq_Qq(); 0x6: pmaxub_Pq_Qq(); @@ -997,7 +997,7 @@ 0x0: psubusb_Vo_Wo(); 0x1: psubusw_Vo_Wo(); 0x2: pminub_Vo_Wo(); - 0x3: pand_Vo_Wo(); + 0x3: Inst::PAND(Vo,Wo); 0x4: paddusb_Vo_Wo(); 0x5: paddusw_Vo_Wo(); 0x6: pmaxub_Vo_Wo(); diff --git a/src/arch/x86/isa/insts/simd128/floating_point/logical/andp.py b/src/arch/x86/isa/insts/simd128/floating_point/logical/andp.py index 8d7d3ba25..104af8fa3 100644 --- a/src/arch/x86/isa/insts/simd128/floating_point/logical/andp.py +++ b/src/arch/x86/isa/insts/simd128/floating_point/logical/andp.py @@ -54,8 +54,49 @@ # Authors: Gabe Black microcode = ''' -# ANDPS -# ANDPD +def macroop ANDPS_XMM_XMM { + mand xmml, xmml, xmmlm + mand xmmh, xmmh, xmmhm +}; + +def macroop ANDPS_XMM_M { + lea t1, seg, sib, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; + +def macroop ANDPS_XMM_P { + rdip t7 + lea t1, seg, riprel, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; + +def macroop ANDPD_XMM_XMM { + mand xmml, xmml, xmmlm + mand xmmh, xmmh, xmmhm +}; + +def macroop ANDPD_XMM_M { + lea t1, seg, sib, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; + +def macroop ANDPD_XMM_P { + rdip t7 + lea t1, seg, riprel, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; +''' # ANDNPS # ANDNPD -''' diff --git a/src/arch/x86/isa/insts/simd128/integer/logical/pand.py b/src/arch/x86/isa/insts/simd128/integer/logical/pand.py index 055b7c5f6..aae80c8b5 100644 --- a/src/arch/x86/isa/insts/simd128/integer/logical/pand.py +++ b/src/arch/x86/isa/insts/simd128/integer/logical/pand.py @@ -54,6 +54,26 @@ # Authors: Gabe Black microcode = ''' -# PAND -# PANDN +def macroop PAND_XMM_XMM { + mand xmml, xmml, xmmlm + mand xmmh, xmmh, xmmhm +}; + +def macroop PAND_XMM_M { + lea t1, seg, sib, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; + +def macroop PAND_XMM_P { + rdip t7 + lea t1, seg, riprel, disp, dataSize=asz + ldfp ufp1, seg, [1, t0, t1], dataSize=8 + ldfp ufp2, seg, [1, t0, t1], 8, dataSize=8 + mand xmml, xmml, ufp1 + mand xmmh, xmmh, ufp2 +}; ''' +# PANDN diff --git a/src/arch/x86/isa/insts/simd64/integer/logical/pand.py b/src/arch/x86/isa/insts/simd64/integer/logical/pand.py index 055b7c5f6..15513ef98 100644 --- a/src/arch/x86/isa/insts/simd64/integer/logical/pand.py +++ b/src/arch/x86/isa/insts/simd64/integer/logical/pand.py @@ -54,6 +54,19 @@ # Authors: Gabe Black microcode = ''' -# PAND -# PANDN +def macroop PAND_MMX_MMX { + mand mmx, mmx, mmxm +}; + +def macroop PAND_MMX_M { + ldfp ufp1, seg, sib, disp, dataSize=8 + mand mmx, mmx, ufp1 +}; + +def macroop PAND_MMX_P { + rdip t7 + ldfp ufp1, seg, riprel, disp, dataSize=8 + mand mmx, mmx, ufp1 +}; ''' +# PANDN