diff options
Diffstat (limited to 'arch/m68k/math-emu/fp_move.S')
-rw-r--r-- | arch/m68k/math-emu/fp_move.S | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/arch/m68k/math-emu/fp_move.S b/arch/m68k/math-emu/fp_move.S new file mode 100644 index 000000000000..71bdf83ba61a --- /dev/null +++ b/arch/m68k/math-emu/fp_move.S | |||
@@ -0,0 +1,244 @@ | |||
1 | /* | ||
2 | * fp_move.S | ||
3 | * | ||
4 | * Copyright Roman Zippel, 1997. All rights reserved. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions | ||
8 | * are met: | ||
9 | * 1. Redistributions of source code must retain the above copyright | ||
10 | * notice, and the entire permission notice in its entirety, | ||
11 | * including the disclaimer of warranties. | ||
12 | * 2. Redistributions in binary form must reproduce the above copyright | ||
13 | * notice, this list of conditions and the following disclaimer in the | ||
14 | * documentation and/or other materials provided with the distribution. | ||
15 | * 3. The name of the author may not be used to endorse or promote | ||
16 | * products derived from this software without specific prior | ||
17 | * written permission. | ||
18 | * | ||
19 | * ALTERNATIVELY, this product may be distributed under the terms of | ||
20 | * the GNU General Public License, in which case the provisions of the GPL are | ||
21 | * required INSTEAD OF the above restrictions. (This clause is | ||
22 | * necessary due to a potential bad interaction between the GPL and | ||
23 | * the restrictions contained in a BSD-style copyright.) | ||
24 | * | ||
25 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
26 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
28 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | ||
29 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
30 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
33 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
35 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
36 | */ | ||
37 | |||
38 | #include "fp_emu.h" | ||
39 | #include "fp_decode.h" | ||
40 | |||
41 | do_no_pc_mode=1 | ||
42 | |||
43 | .globl fp_fmove_fp2mem | ||
44 | |||
45 | fp_fmove_fp2mem: | ||
46 | clr.b (2+FPD_FPSR,FPDATA) | ||
47 | fp_decode_dest_format | ||
48 | move.w %d0,%d1 | store data size twice in %d1 | ||
49 | swap %d1 | one can be trashed below | ||
50 | move.w %d0,%d1 | ||
51 | #ifdef FPU_EMU_DEBUG | ||
52 | lea 0f,%a0 | ||
53 | clr.l %d0 | ||
54 | move.b (%a0,%d1.w),%d0 | ||
55 | printf PDECODE,"fmove.%c ",1,%d0 | ||
56 | fp_decode_src_reg | ||
57 | printf PDECODE,"fp%d,",1,%d0 | ||
58 | |||
59 | .data | ||
60 | 0: .byte 'l','s','x','p','w','d','b','p' | ||
61 | .previous | ||
62 | #endif | ||
63 | |||
64 | | encode addressing mode for dest | ||
65 | fp_decode_addr_mode | ||
66 | |||
67 | .long fp_data, fp_ill | ||
68 | .long fp_indirect, fp_postinc | ||
69 | .long fp_predecr, fp_disp16 | ||
70 | .long fp_extmode0, fp_extmode1 | ||
71 | |||
72 | | addressing mode: data register direct | ||
73 | fp_data: | ||
74 | fp_mode_data_direct | ||
75 | move.w %d0,%d1 | ||
76 | fp_decode_src_reg | ||
77 | fp_get_fp_reg | ||
78 | lea (FPD_TEMPFP1,FPDATA),%a1 | ||
79 | move.l (%a0)+,(%a1)+ | ||
80 | move.l (%a0)+,(%a1)+ | ||
81 | move.l (%a0),(%a1) | ||
82 | lea (-8,%a1),%a0 | ||
83 | swap %d1 | ||
84 | move.l %d1,%d2 | ||
85 | printf PDECODE,"\n" | ||
86 | jmp ([0f:w,%pc,%d1.w*4]) | ||
87 | |||
88 | .align 4 | ||
89 | 0: | ||
90 | .long fp_data_long, fp_data_single | ||
91 | .long fp_ill, fp_ill | ||
92 | .long fp_data_word, fp_ill | ||
93 | .long fp_data_byte, fp_ill | ||
94 | |||
95 | fp_data_byte: | ||
96 | jsr fp_normalize_ext | ||
97 | jsr fp_conv_ext2byte | ||
98 | move.l %d0,%d1 | ||
99 | swap %d2 | ||
100 | move.w %d2,%d0 | ||
101 | jsr fp_get_data_reg | ||
102 | move.b %d1,%d0 | ||
103 | move.w %d2,%d1 | ||
104 | jsr fp_put_data_reg | ||
105 | jra fp_final | ||
106 | |||
107 | fp_data_word: | ||
108 | jsr fp_normalize_ext | ||
109 | jsr fp_conv_ext2short | ||
110 | move.l %d0,%d1 | ||
111 | swap %d2 | ||
112 | move.w %d2,%d0 | ||
113 | jsr fp_get_data_reg | ||
114 | move.w %d1,%d0 | ||
115 | move.l %d2,%d1 | ||
116 | jsr fp_put_data_reg | ||
117 | jra fp_final | ||
118 | |||
119 | fp_data_long: | ||
120 | jsr fp_normalize_ext | ||
121 | jsr fp_conv_ext2long | ||
122 | swap %d2 | ||
123 | move.w %d2,%d1 | ||
124 | jsr fp_put_data_reg | ||
125 | jra fp_final | ||
126 | |||
127 | fp_data_single: | ||
128 | jsr fp_normalize_ext | ||
129 | jsr fp_conv_ext2single | ||
130 | swap %d2 | ||
131 | move.w %d2,%d1 | ||
132 | jsr fp_put_data_reg | ||
133 | jra fp_final | ||
134 | |||
135 | | addressing mode: address register indirect | ||
136 | fp_indirect: | ||
137 | fp_mode_addr_indirect | ||
138 | jra fp_putdest | ||
139 | |||
140 | | addressing mode: address register indirect with postincrement | ||
141 | fp_postinc: | ||
142 | fp_mode_addr_indirect_postinc | ||
143 | jra fp_putdest | ||
144 | |||
145 | | addressing mode: address register indirect with predecrement | ||
146 | fp_predecr: | ||
147 | fp_mode_addr_indirect_predec | ||
148 | jra fp_putdest | ||
149 | |||
150 | | addressing mode: address register indirect with 16bit displacement | ||
151 | fp_disp16: | ||
152 | fp_mode_addr_indirect_disp16 | ||
153 | jra fp_putdest | ||
154 | |||
155 | fp_extmode0: | ||
156 | fp_mode_addr_indirect_extmode0 | ||
157 | jra fp_putdest | ||
158 | |||
159 | fp_extmode1: | ||
160 | fp_decode_addr_reg | ||
161 | jmp ([0f:w,%pc,%d0*4]) | ||
162 | |||
163 | .align 4 | ||
164 | 0: | ||
165 | .long fp_abs_short, fp_abs_long | ||
166 | .long fp_ill, fp_ill | ||
167 | .long fp_ill, fp_ill | ||
168 | .long fp_ill, fp_ill | ||
169 | |||
170 | fp_abs_short: | ||
171 | fp_mode_abs_short | ||
172 | jra fp_putdest | ||
173 | |||
174 | fp_abs_long: | ||
175 | fp_mode_abs_long | ||
176 | jra fp_putdest | ||
177 | |||
178 | fp_putdest: | ||
179 | move.l %a0,%a1 | ||
180 | fp_decode_src_reg | ||
181 | move.l %d1,%d2 | save size | ||
182 | fp_get_fp_reg | ||
183 | printf PDECODE,"\n" | ||
184 | addq.l #8,%a0 | ||
185 | move.l (%a0),-(%sp) | ||
186 | move.l -(%a0),-(%sp) | ||
187 | move.l -(%a0),-(%sp) | ||
188 | move.l %sp,%a0 | ||
189 | jsr fp_normalize_ext | ||
190 | |||
191 | swap %d2 | ||
192 | jmp ([0f:w,%pc,%d2.w*4]) | ||
193 | |||
194 | .align 4 | ||
195 | 0: | ||
196 | .long fp_format_long, fp_format_single | ||
197 | .long fp_format_extended, fp_format_packed | ||
198 | .long fp_format_word, fp_format_double | ||
199 | .long fp_format_byte, fp_format_packed | ||
200 | |||
201 | fp_format_long: | ||
202 | jsr fp_conv_ext2long | ||
203 | putuser.l %d0,(%a1),fp_err_ua1,%a1 | ||
204 | jra fp_finish_move | ||
205 | |||
206 | fp_format_single: | ||
207 | jsr fp_conv_ext2single | ||
208 | putuser.l %d0,(%a1),fp_err_ua1,%a1 | ||
209 | jra fp_finish_move | ||
210 | |||
211 | fp_format_extended: | ||
212 | move.l (%a0)+,%d0 | ||
213 | lsl.w #1,%d0 | ||
214 | lsl.l #7,%d0 | ||
215 | lsl.l #8,%d0 | ||
216 | putuser.l %d0,(%a1)+,fp_err_ua1,%a1 | ||
217 | move.l (%a0)+,%d0 | ||
218 | putuser.l %d0,(%a1)+,fp_err_ua1,%a1 | ||
219 | move.l (%a0),%d0 | ||
220 | putuser.l %d0,(%a1),fp_err_ua1,%a1 | ||
221 | jra fp_finish_move | ||
222 | |||
223 | fp_format_packed: | ||
224 | /* not supported yet */ | ||
225 | lea (12,%sp),%sp | ||
226 | jra fp_ill | ||
227 | |||
228 | fp_format_word: | ||
229 | jsr fp_conv_ext2short | ||
230 | putuser.w %d0,(%a1),fp_err_ua1,%a1 | ||
231 | jra fp_finish_move | ||
232 | |||
233 | fp_format_double: | ||
234 | jsr fp_conv_ext2double | ||
235 | jra fp_finish_move | ||
236 | |||
237 | fp_format_byte: | ||
238 | jsr fp_conv_ext2byte | ||
239 | putuser.b %d0,(%a1),fp_err_ua1,%a1 | ||
240 | | jra fp_finish_move | ||
241 | |||
242 | fp_finish_move: | ||
243 | lea (12,%sp),%sp | ||
244 | jra fp_final | ||