Xenomai
3.0.5
arith.h
1
/*
2
* Copyright (C) 2008 Philippe Gerum <rpm@xenomai.org>.
3
*
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
8
*
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
13
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17
*/
18
#ifndef _COBALT_POWERPC_ASM_UAPI_ARITH_H
19
#define _COBALT_POWERPC_ASM_UAPI_ARITH_H
20
21
#include <asm/xenomai/uapi/features.h>
22
23
#ifdef __powerpc64__
24
25
#define xnarch_nodiv_ullimd(op, frac, integ) \
26
mach_powerpc_nodiv_ullimd((op), (frac), (integ))
27
28
static
inline
__attribute__((__const__))
unsigned
long
long
29
mach_powerpc_nodiv_ullimd(
const
unsigned
long
long
op,
30
const
unsigned
long
long
frac,
31
const
unsigned
rhs_integ)
32
{
33
unsigned
long
h, l, m;
34
35
__asm__(
"mulhdu %0, %3, %4\n\t"
\
36
"mulld %1, %3, %4\n\t"
\
37
"rlwinm %2, %1, 0, 0, 0\n\t"
\
38
"sldi %2, %2, 1\n\t"
\
39
"addc %1, %1, %2\n\t"
\
40
"addze %0, %0\n\t"
\
41
"mr %2, %5\n\t"
\
42
"clrldi %2, %2, 32\n\t"
\
43
"mulld %2, %3, %2\n\t"
\
44
"adde %0, %0, %2\n\t"
\
45
:
"=&r"
(h),
"=&r"
(l),
"=&r"
(m) \
46
:
"r"
(op),
"r"
(frac),
"r"
(rhs_integ) :
"cc"
); \
47
48
return h;
49
}
50
51
#else
/* !__powerpc64__ */
52
53
#define xnarch_add96and64(l0, l1, l2, s0, s1) \
54
do { \
55
__asm__ ("addc %2, %2, %4\n\t" \
56
"adde %1, %1, %3\n\t" \
57
"addze %0, %0\n\t" \
58
: "+r"(l0), "+r"(l1), "+r"(l2) \
59
: "r"(s0), "r"(s1) : "cc"); \
60
} while (0)
61
62
#endif
/* !__powerpc64__ */
63
64
#include <cobalt/uapi/asm-generic/arith.h>
65
66
#endif
/* _COBALT_POWERPC_ASM_UAPI_ARITH_H */
kernel
cobalt
arch
powerpc
include
asm
xenomai
uapi
arith.h
Generated by
1.8.13