summaryrefslogtreecommitdiff
path: root/core/cortex-m0
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-06-15 15:07:35 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-06-19 15:33:09 -0700
commit90167c1764ab7c532b121bd08990b81631a3c896 (patch)
treecb2b1dadc7052437d071b872b6aff04df221d0d8 /core/cortex-m0
parent0696dd1e68692ca8dae17b737e0d895561f65cd4 (diff)
downloadchrome-ec-90167c1764ab7c532b121bd08990b81631a3c896.tar.gz
math_util: Use HW instruction for int_sqrtf when available
Cortex-M4 supports a floating point square root function that takes 14 cycles to execute, which is a speed improvement over the existing binary search, and saves flash space. BUG=chromium:687624 BRANCH=None TEST=On kevin, verify that both sqrtf methods (binary search vs HW instruction) have identical results for fractional input (eg. sqrt(15.999999) = 3), except when floating point representation of square root rounds up to an integer. Verify identical results for all integers [-100, 16793602). Note that 16793602 is the first integer for which the floating point representation of sqrt rounds up to an integer. Also verify basic motion sense functions on kevin. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I8521c9a28c958b340ca83c37342253e424df0c91 Reviewed-on: https://chromium-review.googlesource.com/537734 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'core/cortex-m0')
-rw-r--r--core/cortex-m0/include/math.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/cortex-m0/include/math.h b/core/cortex-m0/include/math.h
new file mode 100644
index 0000000000..4c8955e74d
--- /dev/null
+++ b/core/cortex-m0/include/math.h
@@ -0,0 +1,11 @@
+/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Math utility functions for ARMv6-M */
+
+#ifndef __CROS_EC_MATH_H
+#define __CROS_EC_MATH_H
+
+#endif /* __CROS_EC_MATH_H */