From b99e54e05a4e9fed3bae1172c874af87e712526b Mon Sep 17 00:00:00 2001 From: SiCongLi Date: Wed, 5 Jan 2022 12:18:03 +0000 Subject: Add signbit support for f16 type Resolves COMPMID-5037 Change-Id: I648e8810dfd86e2ebcc16554f3f4cc58a5fd8c32 Signed-off-by: SiCongLi Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6899 Reviewed-by: Giorgio Arena Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- support/ToolchainSupport.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'support') diff --git a/support/ToolchainSupport.h b/support/ToolchainSupport.h index f19a8da627..cddcd542c8 100644 --- a/support/ToolchainSupport.h +++ b/support/ToolchainSupport.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021 Arm Limited. + * Copyright (c) 2017-2022 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -309,6 +309,23 @@ inline bool isfinite(bfloat16 value) { return std::isfinite(float(value)); } + +// std::signbit +template ::value>::type> +inline bool signbit(T value) +{ + return std::signbit(value); +} + +inline bool signbit(half_float::half value) +{ + return half_float::signbit(value); +} + +inline bool signbit(bfloat16 value) +{ + return std::signbit(float(value)); +} } // namespace cpp11 } // namespace support } // namespace arm_compute -- cgit v1.2.1