summaryrefslogtreecommitdiff
path: root/core/cortex-m/include/fpu.h
blob: 74862d00ab71b509df543e3517ed2e6b800f0027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Copyright 2012 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Math utility functions for ARMv7 */

#ifndef __CROS_EC_FPU_H
#define __CROS_EC_FPU_H

#ifdef CONFIG_FPU
static inline float sqrtf(float v)
{
	float root;
	asm volatile("fsqrts %0, %1" : "=w"(root) : "w"(v));
	return root;
}

static inline float fabsf(float v)
{
	float root;
	asm volatile("fabss %0, %1" : "=w"(root) : "w"(v));
	return root;
}
#endif /* CONFIG_FPU */

#endif /* __CROS_EC_FPU_H */