OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [s390/] [math-emu/] [sfp-util.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#include <linux/kernel.h>
2
#include <linux/sched.h>
3
#include <linux/types.h>
4
#include <asm/byteorder.h>
5
 
6
#define add_ssaaaa(sh, sl, ah, al, bh, bl) ({           \
7
        unsigned int __sh = (ah);                       \
8
        unsigned int __sl = (al);                       \
9
        __asm__ ("   alr  %1,%3\n"                      \
10
                 "   brc  12,0f\n"                      \
11
                 "   ahi  %0,1\n"                       \
12
                 "0: alr  %0,%2"                        \
13
                 : "+&d" (__sh), "+d" (__sl)            \
14
                 : "d" (bh), "d" (bl) : "cc" );         \
15
        (sh) = __sh;                                    \
16
        (sl) = __sl;                                    \
17
})
18
 
19
#define sub_ddmmss(sh, sl, ah, al, bh, bl) ({           \
20
       unsigned int __sh = (ah);                        \
21
       unsigned int __sl = (al);                        \
22
       __asm__ ("   slr  %1,%3\n"                       \
23
                "   brc  3,0f\n"                        \
24
                "   ahi  %0,-1\n"                       \
25
                "0: slr  %0,%2"                         \
26
                : "+&d" (__sh), "+d" (__sl)             \
27
                : "d" (bh), "d" (bl) : "cc" );          \
28
       (sh) = __sh;                                     \
29
       (sl) = __sl;                                     \
30
})
31
 
32
/* a umul b = a mul b + (a>=2<<31) ? b<<32:0 + (b>=2<<31) ? a<<32:0 */
33
#define umul_ppmm(wh, wl, u, v) ({                      \
34
        unsigned int __wh = u;                          \
35
        unsigned int __wl = v;                          \
36
        __asm__ ("   ltr  1,%0\n"                       \
37
                 "   mr   0,%1\n"                       \
38
                 "   jnm  0f\n"                         \
39
                 "   alr  0,%1\n"                       \
40
                 "0: ltr  %1,%1\n"                      \
41
                 "   jnm  1f\n"                         \
42
                 "   alr  0,%0\n"                       \
43
                 "1: lr   %0,0\n"                       \
44
                 "   lr   %1,1\n"                       \
45
                 : "+d" (__wh), "+d" (__wl)             \
46
                 : : "0", "1", "cc" );                   \
47
        wh = __wh;                                      \
48
        wl = __wl;                                      \
49
})
50
 
51
#define udiv_qrnnd(q, r, n1, n0, d)                     \
52
  do { unsigned long __r;                               \
53
    (q) = __udiv_qrnnd (&__r, (n1), (n0), (d));         \
54
    (r) = __r;                                          \
55
  } while (0)
56
extern unsigned long __udiv_qrnnd (unsigned long *, unsigned long,
57
                                   unsigned long , unsigned long);
58
 
59
#define UDIV_NEEDS_NORMALIZATION 0
60
 
61
#define abort() return 0
62
 
63
#define __BYTE_ORDER __BIG_ENDIAN

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.