diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2017-06-28 18:29:47 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:15:39 +0100 |
commit | 9247c92bd8c53be4d0c4ae931f51ca8f88e4150b (patch) | |
tree | 3d457a263c0aa6ddcf3d05a4a2323640c486aa36 /arm_compute/core/FixedPoint.inl | |
parent | 097967568f9363d06df3ac21403edcab57de39d7 (diff) | |
download | ComputeLibrary-9247c92bd8c53be4d0c4ae931f51ca8f88e4150b.tar.gz |
COMPMID-428: Port NESoftmaxLayer to 16-bit fixed point.
Change-Id: I65122950bab9124b9758c27096c0f458b77aeabb
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79365
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Steven Niu <steven.niu@arm.com>
Diffstat (limited to 'arm_compute/core/FixedPoint.inl')
-rw-r--r-- | arm_compute/core/FixedPoint.inl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/arm_compute/core/FixedPoint.inl b/arm_compute/core/FixedPoint.inl index fdbc3f0c06..b921b32ed9 100644 --- a/arm_compute/core/FixedPoint.inl +++ b/arm_compute/core/FixedPoint.inl @@ -90,13 +90,22 @@ inline qint8_t sqadd_qs8(qint8_t a, qint8_t b) inline qint16_t sqadd_qs16(qint16_t a, qint16_t b) { - // We need to store the temporary result in qint16_t otherwise we cannot evaluate the overflow + // We need to store the temporary result in qint32_t otherwise we cannot evaluate the overflow qint32_t tmp = (static_cast<qint32_t>(a) + static_cast<qint32_t>(b)); // Saturate the result in case of overflow and cast to qint16_t return saturate_convert<qint32_t, qint16_t>(tmp); } +inline qint32_t sqadd_qs32(qint32_t a, qint32_t b) +{ + // We need to store the temporary result in qint64_t otherwise we cannot evaluate the overflow + qint64_t tmp = (static_cast<qint64_t>(a) + static_cast<qint64_t>(b)); + + // Saturate the result in case of overflow and cast to qint32_t + return saturate_convert<qint64_t, qint32_t>(tmp); +} + inline qint8_t ssub_qs8(qint8_t a, qint8_t b) { return a - b; @@ -388,4 +397,10 @@ inline qint8_t sqmovn_qs16(qint16_t a) // Saturate the result in case of overflow and cast to qint8_t return saturate_convert<qint16_t, qint8_t>(a); } + +inline qint16_t sqmovn_qs32(qint32_t a) +{ + // Saturate the result in case of overflow and cast to qint16_t + return saturate_convert<qint32_t, qint16_t>(a); +} } |