diff options
author | Giacomo Gabrielli <giacomo.gabrielli@arm.com> | 2018-10-16 16:04:08 +0100 |
---|---|---|
committer | Giacomo Gabrielli <giacomo.gabrielli@arm.com> | 2019-01-30 16:57:54 +0000 |
commit | 25474167e5b247d1b91fbf802c5b396a63ae705e (patch) | |
tree | b509597b23d792734f55c33b8125eebfbd9cd3a5 /src/cpu/o3/regfile.hh | |
parent | c6f5db8743f19b02a38146d9cf2a829883387008 (diff) | |
download | gem5-25474167e5b247d1b91fbf802c5b396a63ae705e.tar.xz |
arch,cpu: Add vector predicate registers
Latest-gen. vector/SIMD extensions, including the Arm Scalable Vector
Extension (SVE), introduce the notion of a predicate register file.
This changeset adds this feature across architectures and CPU models.
Change-Id: Iebcadbad89c0a582ff8b1b70de353305db603946
Signed-off-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/13715
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/cpu/o3/regfile.hh')
-rw-r--r-- | src/cpu/o3/regfile.hh | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/src/cpu/o3/regfile.hh b/src/cpu/o3/regfile.hh index 9d9113240..4077c99a4 100644 --- a/src/cpu/o3/regfile.hh +++ b/src/cpu/o3/regfile.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 ARM Limited + * Copyright (c) 2016-2017 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -70,6 +70,7 @@ class PhysRegFile using VecRegContainer = TheISA::VecRegContainer; using PhysIds = std::vector<PhysRegId>; using VecMode = Enums::VecRegRenameMode; + using VecPredRegContainer = TheISA::VecPredRegContainer; public: using IdRange = std::pair<PhysIds::const_iterator, PhysIds::const_iterator>; @@ -89,6 +90,10 @@ class PhysRegFile std::vector<PhysRegId> vecRegIds; std::vector<PhysRegId> vecElemIds; + /** Predicate register file. */ + std::vector<VecPredRegContainer> vecPredRegFile; + std::vector<PhysRegId> vecPredRegIds; + /** Condition-code register file. */ std::vector<CCReg> ccRegFile; std::vector<PhysRegId> ccRegIds; @@ -117,6 +122,11 @@ class PhysRegFile unsigned numPhysicalVecElemRegs; /** + * Number of physical predicate registers + */ + unsigned numPhysicalVecPredRegs; + + /** * Number of physical CC registers */ unsigned numPhysicalCCRegs; @@ -135,6 +145,7 @@ class PhysRegFile PhysRegFile(unsigned _numPhysicalIntRegs, unsigned _numPhysicalFloatRegs, unsigned _numPhysicalVecRegs, + unsigned _numPhysicalVecPredRegs, unsigned _numPhysicalCCRegs, VecMode vmode ); @@ -154,6 +165,8 @@ class PhysRegFile unsigned numFloatPhysRegs() const { return numPhysicalFloatRegs; } /** @return the number of vector physical registers. */ unsigned numVecPhysRegs() const { return numPhysicalVecRegs; } + /** @return the number of predicate physical registers. */ + unsigned numPredPhysRegs() const { return numPhysicalVecPredRegs; } /** @return the number of vector physical registers. */ unsigned numVecElemPhysRegs() const { return numPhysicalVecElemRegs; } @@ -201,7 +214,7 @@ class PhysRegFile DPRINTF(IEW, "RegFile: Access to vector register %i, has " "data %s\n", int(phys_reg->index()), - vectorRegFile[phys_reg->index()].as<VecElem>().print()); + vectorRegFile[phys_reg->index()].print()); return vectorRegFile[phys_reg->index()]; } @@ -258,6 +271,24 @@ class PhysRegFile return val; } + /** Reads a predicate register. */ + const VecPredRegContainer& readVecPredReg(PhysRegIdPtr phys_reg) const + { + assert(phys_reg->isVecPredPhysReg()); + + DPRINTF(IEW, "RegFile: Access to predicate register %i, has " + "data %s\n", int(phys_reg->index()), + vecPredRegFile[phys_reg->index()].print()); + + return vecPredRegFile[phys_reg->index()]; + } + + VecPredRegContainer& getWritableVecPredReg(PhysRegIdPtr phys_reg) + { + /* const_cast for not duplicating code above. */ + return const_cast<VecPredRegContainer&>(readVecPredReg(phys_reg)); + } + /** Reads a condition-code register. */ CCReg readCCReg(PhysRegIdPtr phys_reg) @@ -321,6 +352,17 @@ class PhysRegFile val; } + /** Sets a predicate register to the given value. */ + void setVecPredReg(PhysRegIdPtr phys_reg, const VecPredRegContainer& val) + { + assert(phys_reg->isVecPredPhysReg()); + + DPRINTF(IEW, "RegFile: Setting predicate register %i to %s\n", + int(phys_reg->index()), val.print()); + + vecPredRegFile[phys_reg->index()] = val; + } + /** Sets a condition-code register to the given value. */ void setCCReg(PhysRegIdPtr phys_reg, CCReg val) |