Files
OpenCellular/core/minute-ia/include/math.h
Kyoung Kim 1765faf803 minute-ia: fix floating point inline assembly
change inline assembly for fsqrt and fabs

BUG=none
BRANCH=None
TEST=`make buildall -j`
1. Compare sqareroot(2) from calculator and from sqrtf(2.0f) by multiplying
   1.0 x 10E8 for both values to convert int32_t and check the difference.
2. read timestampt before and after 'sqrtf()' and calculate execution
   time.

Change-Id: I62694d8b084a3a74040dc298354b4fd685e77729
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/404927
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
2017-01-09 23:47:24 -08:00

40 lines
645 B
C

/* Copyright (c) 2016 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 minute-IA */
#ifndef __CROS_EC_MATH_H
#define __CROS_EC_MATH_H
#ifdef CONFIG_FPU
static inline float sqrtf(float v)
{
float root;
/* root = fsqart (v); */
asm volatile(
"fsqrt"
: "=t" (root)
: "0" (v)
);
return root;
}
static inline float fabsf(float v)
{
float root;
/* root = fabs (v); */
asm volatile(
"fabs"
: "=t" (root)
: "0" (v)
);
return root;
}
#endif /* CONFIG_FPU */
#endif /* __CROS_EC_MATH_H */