float.hh revision 7087
12623SN/A/*
22623SN/A * Copyright (c) 2007 The Hewlett-Packard Development Company
32623SN/A * All rights reserved.
42623SN/A *
52623SN/A * The license below extends only to copyright in the software and shall
62623SN/A * not be construed as granting a license to any other intellectual
72623SN/A * property including but not limited to intellectual property relating
82623SN/A * to a hardware implementation of the functionality of the software
92623SN/A * licensed hereunder.  You may use the software subject to the license
102623SN/A * terms below provided that you ensure that this notice is replicated
112623SN/A * unmodified and in its entirety in all distributions of the software,
122623SN/A * modified or unmodified, in source code or in binary form.
132623SN/A *
142623SN/A * Redistribution and use in source and binary forms, with or without
152623SN/A * modification, are permitted provided that the following conditions are
162623SN/A * met: redistributions of source code must retain the above copyright
172623SN/A * notice, this list of conditions and the following disclaimer;
182623SN/A * redistributions in binary form must reproduce the above copyright
192623SN/A * notice, this list of conditions and the following disclaimer in the
202623SN/A * documentation and/or other materials provided with the distribution;
212623SN/A * neither the name of the copyright holders nor the names of its
222623SN/A * contributors may be used to endorse or promote products derived from
232623SN/A * this software without specific prior written permission.
242623SN/A *
252623SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
262623SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
272623SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
282623SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
292623SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
302623SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
312623SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
322623SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
332623SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
342623SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
352623SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
362623SN/A *
372623SN/A * Authors: Gabe Black
382623SN/A */
392623SN/A
402623SN/A#ifndef __ARCH_X86_FLOATREGS_HH__
412623SN/A#define __ARCH_X86_FLOATREGS_HH__
422623SN/A
432623SN/A#include "arch/x86/x86_traits.hh"
442623SN/A#include "base/bitunion.hh"
452623SN/A
462623SN/Anamespace X86ISA
472623SN/A{
482623SN/A    enum FloatRegIndex
492623SN/A    {
502623SN/A        // MMX/X87 registers
512623SN/A        FLOATREG_MMX_BASE,
522623SN/A        FLOATREG_FPR_BASE = FLOATREG_MMX_BASE,
532623SN/A        FLOATREG_MMX0 = FLOATREG_MMX_BASE,
542623SN/A        FLOATREG_MMX1,
552623SN/A        FLOATREG_MMX2,
562623SN/A        FLOATREG_MMX3,
572623SN/A        FLOATREG_MMX4,
582623SN/A        FLOATREG_MMX5,
592623SN/A        FLOATREG_MMX6,
602623SN/A        FLOATREG_MMX7,
612623SN/A
622623SN/A        FLOATREG_FPR0 = FLOATREG_FPR_BASE,
632630SN/A        FLOATREG_FPR1,
642623SN/A        FLOATREG_FPR2,
652623SN/A        FLOATREG_FPR3,
662623SN/A        FLOATREG_FPR4,
672623SN/A        FLOATREG_FPR5,
682623SN/A        FLOATREG_FPR6,
692623SN/A        FLOATREG_FPR7,
702630SN/A
712623SN/A        FLOATREG_XMM_BASE = FLOATREG_MMX_BASE + NumMMXRegs,
722623SN/A        FLOATREG_XMM0_LOW = FLOATREG_XMM_BASE,
732623SN/A        FLOATREG_XMM0_HIGH,
742623SN/A        FLOATREG_XMM1_LOW,
752623SN/A        FLOATREG_XMM1_HIGH,
762623SN/A        FLOATREG_XMM2_LOW,
772623SN/A        FLOATREG_XMM2_HIGH,
782631SN/A        FLOATREG_XMM3_LOW,
792631SN/A        FLOATREG_XMM3_HIGH,
802631SN/A        FLOATREG_XMM4_LOW,
812623SN/A        FLOATREG_XMM4_HIGH,
822623SN/A        FLOATREG_XMM5_LOW,
832623SN/A        FLOATREG_XMM5_HIGH,
842623SN/A        FLOATREG_XMM6_LOW,
852623SN/A        FLOATREG_XMM6_HIGH,
862623SN/A        FLOATREG_XMM7_LOW,
872623SN/A        FLOATREG_XMM7_HIGH,
882623SN/A        FLOATREG_XMM8_LOW,
892623SN/A        FLOATREG_XMM8_HIGH,
902623SN/A        FLOATREG_XMM9_LOW,
912623SN/A        FLOATREG_XMM9_HIGH,
922623SN/A        FLOATREG_XMM10_LOW,
932623SN/A        FLOATREG_XMM10_HIGH,
942623SN/A        FLOATREG_XMM11_LOW,
952623SN/A        FLOATREG_XMM11_HIGH,
962623SN/A        FLOATREG_XMM12_LOW,
972623SN/A        FLOATREG_XMM12_HIGH,
982623SN/A        FLOATREG_XMM13_LOW,
992623SN/A        FLOATREG_XMM13_HIGH,
1002623SN/A        FLOATREG_XMM14_LOW,
1012623SN/A        FLOATREG_XMM14_HIGH,
1022623SN/A        FLOATREG_XMM15_LOW,
1032623SN/A        FLOATREG_XMM15_HIGH,
1042623SN/A
1052623SN/A        FLOATREG_MICROFP_BASE = FLOATREG_XMM_BASE + 2 * NumXMMRegs,
1062623SN/A        FLOATREG_MICROFP0 = FLOATREG_MICROFP_BASE,
1072623SN/A        FLOATREG_MICROFP1,
1082623SN/A        FLOATREG_MICROFP2,
1092623SN/A        FLOATREG_MICROFP3,
1102623SN/A        FLOATREG_MICROFP4,
1112623SN/A        FLOATREG_MICROFP5,
1122623SN/A        FLOATREG_MICROFP6,
1132623SN/A        FLOATREG_MICROFP7,
1142623SN/A
1152623SN/A        NUM_FLOATREGS = FLOATREG_MICROFP_BASE + NumMicroFpRegs
1162623SN/A    };
1172623SN/A
1182623SN/A    static inline FloatRegIndex
1192623SN/A    FLOATREG_MMX(int index)
1202623SN/A    {
1212623SN/A        return (FloatRegIndex)(FLOATREG_MMX_BASE + index);
1222623SN/A    }
1232623SN/A
1242623SN/A    static inline FloatRegIndex
1252623SN/A    FLOATREG_FPR(int index)
1262623SN/A    {
1272623SN/A        return (FloatRegIndex)(FLOATREG_FPR_BASE + index);
1282623SN/A    }
1292623SN/A
1302623SN/A    static inline FloatRegIndex
1312623SN/A    FLOATREG_XMM_LOW(int index)
1322623SN/A    {
1332623SN/A        return (FloatRegIndex)(FLOATREG_XMM_BASE + 2 * index);
1342623SN/A    }
1352623SN/A
1362623SN/A    static inline FloatRegIndex
1372623SN/A    FLOATREG_XMM_HIGH(int index)
1382623SN/A    {
1392623SN/A        return (FloatRegIndex)(FLOATREG_XMM_BASE + 2 * index + 1);
1402623SN/A    }
1412623SN/A
1422623SN/A    static inline FloatRegIndex
1432623SN/A    FLOATREG_MICROFP(int index)
1442623SN/A    {
1452623SN/A        return (FloatRegIndex)(FLOATREG_MICROFP_BASE + index);
1462623SN/A    }
1472623SN/A
1482623SN/A    static inline FloatRegIndex
1492623SN/A    FLOATREG_STACK(int index, int top)
1502623SN/A    {
1512623SN/A        return FLOATREG_FPR((top + index + 8) % 8);
1522623SN/A    }
1532623SN/A};
1542623SN/A
1552623SN/A#endif // __ARCH_X86_FLOATREGS_HH__
1562623SN/A