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 EXTEND zxt4
30 # define INT_TO_FP(a,b) fcvt.xuf.s1 a=b
31 # define FP_TO_INT(a,b) fcvt.fxu.trunc.s1 a=b
32 #else
33 # define SGN
34 # define EXTEND sxt4
35 # define INT_TO_FP(a,b) fcvt.xf a=b
36 # define FP_TO_INT(a,b) fcvt.fx.trunc.s1 a=b
37 #endif
38
39 #define PASTE1(a,b) a##b
40 #define PASTE(a,b) PASTE1(a,b)
41 #define NAME PASTE(PASTE(__,SGN),PASTE(OP,si3))
42
43 GLOBAL_ENTRY(NAME)
44 .regstk 2,0,0,0
45
46 mov r2 = 0xffdd
47 EXTEND in0 = in0
48 EXTEND in1 = in1
49 ;;
50 setf.sig f8 = in0
51 setf.sig f9 = in1
52 #ifdef MODULO
53 sub in1 = r0, in1
54 #endif
55 ;;
56
57 INT_TO_FP(f8, f8)
58 INT_TO_FP(f9, f9)
59 ;;
60 setf.exp f7 = r2
61 frcpa.s1 f6, p6 = f8, f9
62 ;;
63 (p6) fmpy.s1 f8 = f8, f6
64 (p6) fnma.s1 f6 = f9, f6, f1
65 ;;
66 #ifdef MODULO
67 setf.sig f9 = in1
68 #endif
69 (p6) fma.s1 f8 = f6, f8, f8
70 (p6) fma.s1 f6 = f6, f6, f7
71 ;;
72 #ifdef MODULO
73 setf.sig f7 = in0
74 #endif
75 (p6) fma.s1 f6 = f6, f8, f8
76 ;;
77 FP_TO_INT(f6, f6)
78 ;;
79 #ifdef MODULO
80 xma.l f6 = f6, f9, f7
81 ;;
82 #endif
83 getf.sig r8 = f6
84 br.ret.sptk.many rp
85 END(NAME)
86 EXPORT_SYMBOL(NAME)