import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / m68k / fpsp040 / sto_res.S
1 |
2 |       sto_res.sa 3.1 12/10/90
3 |
4 |       Takes the result and puts it in where the user expects it.
5 |       Library functions return result in fp0. If fp0 is not the
6 |       users destination register then fp0 is moved to the
7 |       correct floating-point destination register.  fp0 and fp1
8 |       are then restored to the original contents. 
9 |
10 |       Input:  result in fp0,fp1 
11 |
12 |               d2 & a0 should be kept unmodified
13 |
14 |       Output: moves the result to the true destination reg or mem
15 |
16 |       Modifies: destination floating point register
17 |
18
19 |               Copyright (C) Motorola, Inc. 1990
20 |                       All Rights Reserved
21 |
22 |       THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA 
23 |       The copyright notice above does not evidence any  
24 |       actual or intended publication of such source code.
25
26 STO_RES:        |idnt   2,1 | Motorola 040 Floating Point Software Package
27
28
29         |section        8
30
31         .include "fpsp.h"
32
33         .global sto_cos
34 sto_cos:
35         bfextu          CMDREG1B(%a6){#13:#3},%d0       |extract cos destination
36         cmpib           #3,%d0          |check for fp0/fp1 cases
37         bles            c_fp0123
38         fmovemx %fp1-%fp1,-(%a7)
39         moveql          #7,%d1
40         subl            %d0,%d1         |d1 = 7- (dest. reg. no.)
41         clrl            %d0
42         bsetl           %d1,%d0         |d0 is dynamic register mask
43         fmovemx (%a7)+,%d0
44         rts
45 c_fp0123:
46         cmpib           #0,%d0
47         beqs            c_is_fp0
48         cmpib           #1,%d0
49         beqs            c_is_fp1
50         cmpib           #2,%d0
51         beqs            c_is_fp2
52 c_is_fp3:
53         fmovemx %fp1-%fp1,USER_FP3(%a6)
54         rts
55 c_is_fp2:
56         fmovemx %fp1-%fp1,USER_FP2(%a6)
57         rts
58 c_is_fp1:
59         fmovemx %fp1-%fp1,USER_FP1(%a6)
60         rts
61 c_is_fp0:
62         fmovemx %fp1-%fp1,USER_FP0(%a6)
63         rts
64
65
66         .global sto_res
67 sto_res:
68         bfextu          CMDREG1B(%a6){#6:#3},%d0        |extract destination register
69         cmpib           #3,%d0          |check for fp0/fp1 cases
70         bles            fp0123
71         fmovemx %fp0-%fp0,-(%a7)
72         moveql          #7,%d1
73         subl            %d0,%d1         |d1 = 7- (dest. reg. no.)
74         clrl            %d0
75         bsetl           %d1,%d0         |d0 is dynamic register mask
76         fmovemx (%a7)+,%d0
77         rts
78 fp0123:
79         cmpib           #0,%d0
80         beqs            is_fp0
81         cmpib           #1,%d0
82         beqs            is_fp1
83         cmpib           #2,%d0
84         beqs            is_fp2
85 is_fp3:
86         fmovemx %fp0-%fp0,USER_FP3(%a6)
87         rts
88 is_fp2:
89         fmovemx %fp0-%fp0,USER_FP2(%a6)
90         rts
91 is_fp1:
92         fmovemx %fp0-%fp0,USER_FP1(%a6)
93         rts
94 is_fp0:
95         fmovemx %fp0-%fp0,USER_FP0(%a6)
96         rts
97
98         |end