1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <asm/asmmacro.h>
19 #include <asm/export.h>
20
21 #ifdef MODULO
22 # define OP mod
23 #else
24 # define OP div
25 #endif
26
27 #ifdef UNSIGNED
28 # define SGN u
29 # define INT_TO_FP(a,b) fcvt.xuf.s1 a=b
30 # define FP_TO_INT(a,b) fcvt.fxu.trunc.s1 a=b
31 #else
32 # define SGN
33 # define INT_TO_FP(a,b) fcvt.xf a=b
34 # define FP_TO_INT(a,b) fcvt.fx.trunc.s1 a=b
35 #endif
36
37 #define PASTE1(a,b) a##b
38 #define PASTE(a,b) PASTE1(a,b)
39 #define NAME PASTE(PASTE(__,SGN),PASTE(OP,di3))
40
41 GLOBAL_ENTRY(NAME)
42 .regstk 2,0,0,0
43
44 setf.sig f8 = in0
45 setf.sig f9 = in1
46 ;;
47
48 INT_TO_FP(f8, f8)
49 INT_TO_FP(f9, f9)
50 ;;
51 frcpa.s1 f11, p6 = f8, f9
52 ;;
53 (p6) fmpy.s1 f7 = f8, f11
54 (p6) fnma.s1 f6 = f9, f11, f1
55 ;;
56 (p6) fma.s1 f10 = f7, f6, f7
57 (p6) fmpy.s1 f7 = f6, f6
58 ;;
59 #ifdef MODULO
60 sub in1 = r0, in1
61 #endif
62 (p6) fma.s1 f10 = f10, f7, f10
63 (p6) fma.s1 f6 = f11, f6, f11
64 ;;
65 (p6) fma.s1 f6 = f6, f7, f6
66 (p6) fnma.s1 f7 = f9, f10, f8
67 ;;
68 #ifdef MODULO
69 setf.sig f8 = in0
70 setf.sig f9 = in1
71 #endif
72 (p6) fma.s1 f11 = f7, f6, f10
73 ;;
74 FP_TO_INT(f11, f11)
75 ;;
76 #ifdef MODULO
77 xma.l f11 = f11, f9, f8
78 ;;
79 #endif
80 getf.sig r8 = f11
81 br.ret.sptk.many rp
82 END(NAME)
83 EXPORT_SYMBOL(NAME)