diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/SConscript --- a/src/arch/x86/SConscript Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/SConscript Wed Feb 27 13:00:44 2013 -0600 @@ -271,9 +271,7 @@ 'x87/data_transfer_and_conversion/convert_and_load_or_store_bcd.py', 'x87/data_transfer_and_conversion/conditional_move.py', 'x87/data_transfer_and_conversion/extract.py', - 'x87/load_constants/__init__.py', - 'x87/load_constants/load_0_1_or_pi.py', - 'x87/load_constants/load_logarithm.py', + 'x87/load_constants.py', 'x87/arithmetic/__init__.py', 'x87/arithmetic/subtraction.py', 'x87/arithmetic/addition.py', diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/decoder/x87.isa --- a/src/arch/x86/isa/decoder/x87.isa Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/decoder/x87.isa Wed Feb 27 13:00:44 2013 -0600 @@ -39,6 +39,7 @@ 0x1B: decode OPCODE_OP_BOTTOM3 { //0x0: esc0(); 0x0: decode MODRM_REG { + // ST(0) = ST(0) + 32-bit Mem 0x0: fadd(); 0x1: fmul(); 0x2: fcom(); @@ -50,7 +51,11 @@ } //0x1: esc1(); 0x1: decode MODRM_REG { - 0x0: fld(); + 0x0: decode MODRM_MOD { + 0x3: Inst::FLD(Eq); + // 32-bit load + default: Inst::FLD(Md); + } 0x1: decode MODRM_MOD { 0x3: fxch(); default: Inst::UD2(); @@ -78,24 +83,24 @@ } 0x5: decode MODRM_MOD { 0x3: decode MODRM_RM { - 0x0: fld1(); - 0x1: fldl2t(); - 0x2: fldl2e(); - 0x3: fldpi(); - 0x4: fldlg2(); - 0x5: fldln2(); - 0x6: fldz(); + 0x0: Inst::FLD1(); + 0x1: Inst::FLDL2T(); + 0x2: Inst::FLDL2E(); + 0x3: Inst::FLDPI(); + 0x4: Inst::FLDLG2(); + 0x5: Inst::FLDLN2(); + 0x6: Inst::FLDZ(); } - default: fldcw_Mw(); + default: Inst::FLDCW(Mw); } 0x6: decode MODRM_MOD { 0x3: decode MODRM_RM { 0x0: f2xm1(); - 0x1: fyl2x(); - 0x2: fptan(); + 0x1: Inst::FYL2X(); + 0x2: Inst::FPTAN(); 0x3: fpatan(); 0x4: fxtract(); - 0x5: fprem1(); + 0x5: Inst::FPREM1(); 0x6: fdecstp(); 0x7: fincstp(); } @@ -103,7 +108,7 @@ } 0x7: decode MODRM_MOD { 0x3: decode MODRM_RM { - 0x0: fprem(); + 0x0: Inst::FPREM(); 0x1: fyl2xp1(); 0x2: fsqrt(); 0x3: Inst::FSINCOS(); @@ -181,6 +186,7 @@ } 0x5: decode MODRM_MOD { 0x3: fucomi(); + // 80-bit load default: fld(); } 0x6: decode MODRM_MOD { @@ -225,6 +231,7 @@ 0x5: decode MODRM_REG { 0x0: decode MODRM_MOD { 0x3: ffree(); + // 64-bit load default: Inst::FLD(Mq); } 0x1: decode MODRM_MOD { diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/arithmetic/partial_remainder.py --- a/src/arch/x86/isa/insts/x87/arithmetic/partial_remainder.py Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/insts/x87/arithmetic/partial_remainder.py Wed Feb 27 13:00:44 2013 -0600 @@ -36,6 +36,11 @@ # Authors: Gabe Black microcode = ''' -# FPREM -# FPREM1 +def macroop FPREM { + premfp st(0), st(1), st(0) +}; + +def macroop FPREM1 { + premfp st(0), st(1), st(0) +}; ''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py --- a/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/insts/x87/control/save_and_restore_x87_control_word.py Wed Feb 27 13:00:44 2013 -0600 @@ -36,7 +36,15 @@ # Authors: Gabe Black microcode = ''' -# FLDCW + +def macroop FLDCW_M { + ld fcw, seg, sib, disp, dataSize=2 +}; + +def macroop FLDCW_P { + ld fcw, seg, sib, disp, dataSize=2 +}; + # FSTCW def macroop FNSTCW_M { diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py --- a/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py Wed Feb 27 13:00:44 2013 -0600 @@ -47,6 +47,10 @@ movfp st(-1), ufp1, spm=-1 }; +def macroop FLD_R { + movfp st(-1), sti, spm=-1 +}; + def macroop FST_R { movfp sti, st(0) }; diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/load_constants.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/arch/x86/isa/insts/x87/load_constants.py Wed Feb 27 13:00:44 2013 -0600 @@ -0,0 +1,74 @@ +# Copyright (c) 2007 The Hewlett-Packard Development Company +# All rights reserved. +# +# The license below extends only to copyright in the software and shall +# not be construed as granting a license to any other intellectual +# property including but not limited to intellectual property relating +# to a hardware implementation of the functionality of the software +# licensed hereunder. You may use the software subject to the license +# terms below provided that you ensure that this notice is replicated +# unmodified and in its entirety in all distributions of the software, +# modified or unmodified, in source code or in binary form. +# +# 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; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# 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. +# +# Authors: Gabe Black + +microcode = ''' +def macroop FLDZ { + limm ufp1, "double(0)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLD1 { + limm ufp1, "double(1)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLDPI { + limm ufp1, "double(3.14159265359)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLDL2E { + limm ufp1, "double(1.44269504089)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLDL2T { + limm ufp1, "double(3.32192809489)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLDLG2 { + limm ufp1, "double(0.30102999566)" + movfp st(-1), ufp1, spm=-1 +}; + +def macroop FLDLN2 { + limm ufp1, "double(0.69314718056)" + movfp st(-1), ufp1, spm=-1 +}; + +''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/load_constants/__init__.py --- a/src/arch/x86/isa/insts/x87/load_constants/__init__.py Wed Feb 27 12:58:18 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -# Copyright (c) 2007 The Hewlett-Packard Development Company -# All rights reserved. -# -# The license below extends only to copyright in the software and shall -# not be construed as granting a license to any other intellectual -# property including but not limited to intellectual property relating -# to a hardware implementation of the functionality of the software -# licensed hereunder. You may use the software subject to the license -# terms below provided that you ensure that this notice is replicated -# unmodified and in its entirety in all distributions of the software, -# modified or unmodified, in source code or in binary form. -# -# 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; -# neither the name of the copyright holders nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# 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. -# -# Authors: Gabe Black - -categories = ["load_0_1_or_pi", - "load_logarithm"] - -microcode = ''' -# X86 microcode -''' -for category in categories: - exec "import %s as cat" % category - microcode += cat.microcode diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/load_constants/load_0_1_or_pi.py --- a/src/arch/x86/isa/insts/x87/load_constants/load_0_1_or_pi.py Wed Feb 27 12:58:18 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -# Copyright (c) 2007 The Hewlett-Packard Development Company -# All rights reserved. -# -# The license below extends only to copyright in the software and shall -# not be construed as granting a license to any other intellectual -# property including but not limited to intellectual property relating -# to a hardware implementation of the functionality of the software -# licensed hereunder. You may use the software subject to the license -# terms below provided that you ensure that this notice is replicated -# unmodified and in its entirety in all distributions of the software, -# modified or unmodified, in source code or in binary form. -# -# 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; -# neither the name of the copyright holders nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# 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. -# -# Authors: Gabe Black - -microcode = ''' -# FLDZ -# FLD1 -# FLDPI -''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/load_constants/load_logarithm.py --- a/src/arch/x86/isa/insts/x87/load_constants/load_logarithm.py Wed Feb 27 12:58:18 2013 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -# Copyright (c) 2007 The Hewlett-Packard Development Company -# All rights reserved. -# -# The license below extends only to copyright in the software and shall -# not be construed as granting a license to any other intellectual -# property including but not limited to intellectual property relating -# to a hardware implementation of the functionality of the software -# licensed hereunder. You may use the software subject to the license -# terms below provided that you ensure that this notice is replicated -# unmodified and in its entirety in all distributions of the software, -# modified or unmodified, in source code or in binary form. -# -# 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; -# neither the name of the copyright holders nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# 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. -# -# Authors: Gabe Black - -microcode = ''' -# FLDL2E -# FLDL2T -# FLDLG2 -# FLDLN2 -''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/transcendental_functions/logarithmic_functions.py --- a/src/arch/x86/isa/insts/x87/transcendental_functions/logarithmic_functions.py Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/insts/x87/transcendental_functions/logarithmic_functions.py Wed Feb 27 13:00:44 2013 -0600 @@ -38,6 +38,10 @@ microcode = ''' # F2XM1 # FSCALE -# FYL2X + +def macroop FYL2X { + yl2xfp st(1), st(0), st(1), spm=1 +}; + # FYL2XP1 ''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/insts/x87/transcendental_functions/trigonometric_functions.py --- a/src/arch/x86/isa/insts/x87/transcendental_functions/trigonometric_functions.py Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/insts/x87/transcendental_functions/trigonometric_functions.py Wed Feb 27 13:00:44 2013 -0600 @@ -51,6 +51,11 @@ movfp st(-1), ufp2, spm=-1 }; -# FPTAN +def macroop FPTAN { + tanfp st(0), st(0) + limm ufp1, "double(1)" + movfp st(-1), ufp1, spm=-1 +}; + # FPATAN ''' diff -r 1f1f4105a4ed -r 2b77aed15602 src/arch/x86/isa/microops/fpop.isa --- a/src/arch/x86/isa/microops/fpop.isa Wed Feb 27 12:58:18 2013 -0600 +++ b/src/arch/x86/isa/microops/fpop.isa Wed Feb 27 13:00:44 2013 -0600 @@ -258,6 +258,9 @@ class Sinfp(FpUnaryOp): code = 'FpDestReg = sin(FpSrcReg1);' + class Tanfp(FpUnaryOp): + code = 'FpDestReg = tan(FpSrcReg1);' + # Conversion microops class ConvOp(FpBinaryOp): @@ -305,6 +308,17 @@ class subfp(FpBinaryOp): code = 'FpDestReg = FpSrcReg1 - FpSrcReg2;' + class Yl2xFp(FpBinaryOp): + code = ''' + FpDestReg = FpSrcReg2 * (log(FpSrcReg1) / log(2)); + ''' + + class PremFp(FpBinaryOp): + code = ''' + FpDestReg = fmod(FpSrcReg1, FpSrcReg2); + DPRINTF(X86, "src1: %lf, src2: %lf, dest: %lf\\n", FpSrcReg1, FpSrcReg2, FpDestReg); + ''' + class Compfp(FpBinaryOp): def __init__(self, src1, src2, spm=0, setStatus=False, \ dataSize="env.dataSize"):