aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/FixedPoint.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2017-07-12 12:30:40 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commite222941f931b1d44bb29e5827b6df748e60cefc4 (patch)
tree1a54a60750caa998527e5c6b2a494047cb3ccc23 /tests/validation/FixedPoint.h
parentbbd3d6045ba6480be350c0b1610048ee6c9c050f (diff)
downloadComputeLibrary-e222941f931b1d44bb29e5827b6df748e60cefc4.tar.gz
COMPMID-401: Implement FixedPointPosition conversion for NEON.
Adds support of changing the fixed point position of a tensor in DepthConvert. Change-Id: Ic3b50a4628fac7497a0217d92941c9d6f64d21cb Reviewed-on: http://mpd-gerrit.cambridge.arm.com/80438 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/FixedPoint.h')
-rw-r--r--tests/validation/FixedPoint.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/validation/FixedPoint.h b/tests/validation/FixedPoint.h
index ab6f14a49b..12ffcdfc3d 100644
--- a/tests/validation/FixedPoint.h
+++ b/tests/validation/FixedPoint.h
@@ -244,15 +244,20 @@ public:
{
assert(p > 0 && p < std::numeric_limits<T>::digits);
+ using promoted_T = typename traits::promote<T>::type;
+ promoted_T val = _value;
if(p > _fixed_point_position)
{
- _value <<= (p - _fixed_point_position);
+ val <<= (p - _fixed_point_position);
}
else if(p < _fixed_point_position)
{
- _value >>= (_fixed_point_position - p);
+ uint8_t pbar = _fixed_point_position - p;
+ val += (pbar != 0) ? (1 << (pbar - 1)) : 0;
+ val >>= pbar;
}
+ _value = detail::constant_expr<T>::saturate_cast(val);
_fixed_point_position = p;
}