diff options
author | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-08-09 11:51:35 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-08-09 11:51:35 -0400 |
commit | c973b112c76c9d8fd042991128f218a738cc8d0a (patch) | |
tree | e813b0da5d0a0e19e06de6462d145a29ad683026 /arch/arm/nwfpe/fpa11_cpdo.c | |
parent | c5fbc3966f48279dbebfde10248c977014aa9988 (diff) | |
parent | 00dd1e433967872f3997a45d5adf35056fdf2f56 (diff) |
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'arch/arm/nwfpe/fpa11_cpdo.c')
-rw-r--r-- | arch/arm/nwfpe/fpa11_cpdo.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/arm/nwfpe/fpa11_cpdo.c b/arch/arm/nwfpe/fpa11_cpdo.c index 1bea67437b6f..4a31dfd94068 100644 --- a/arch/arm/nwfpe/fpa11_cpdo.c +++ b/arch/arm/nwfpe/fpa11_cpdo.c | |||
@@ -24,15 +24,16 @@ | |||
24 | #include "fpa11.h" | 24 | #include "fpa11.h" |
25 | #include "fpopcode.h" | 25 | #include "fpopcode.h" |
26 | 26 | ||
27 | unsigned int SingleCPDO(const unsigned int opcode, FPREG * rFd); | 27 | unsigned int SingleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd); |
28 | unsigned int DoubleCPDO(const unsigned int opcode, FPREG * rFd); | 28 | unsigned int DoubleCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd); |
29 | unsigned int ExtendedCPDO(const unsigned int opcode, FPREG * rFd); | 29 | unsigned int ExtendedCPDO(struct roundingData *roundData, const unsigned int opcode, FPREG * rFd); |
30 | 30 | ||
31 | unsigned int EmulateCPDO(const unsigned int opcode) | 31 | unsigned int EmulateCPDO(const unsigned int opcode) |
32 | { | 32 | { |
33 | FPA11 *fpa11 = GET_FPA11(); | 33 | FPA11 *fpa11 = GET_FPA11(); |
34 | FPREG *rFd; | 34 | FPREG *rFd; |
35 | unsigned int nType, nDest, nRc; | 35 | unsigned int nType, nDest, nRc; |
36 | struct roundingData roundData; | ||
36 | 37 | ||
37 | /* Get the destination size. If not valid let Linux perform | 38 | /* Get the destination size. If not valid let Linux perform |
38 | an invalid instruction trap. */ | 39 | an invalid instruction trap. */ |
@@ -40,7 +41,9 @@ unsigned int EmulateCPDO(const unsigned int opcode) | |||
40 | if (typeNone == nDest) | 41 | if (typeNone == nDest) |
41 | return 0; | 42 | return 0; |
42 | 43 | ||
43 | SetRoundingMode(opcode); | 44 | roundData.mode = SetRoundingMode(opcode); |
45 | roundData.precision = SetRoundingPrecision(opcode); | ||
46 | roundData.exception = 0; | ||
44 | 47 | ||
45 | /* Compare the size of the operands in Fn and Fm. | 48 | /* Compare the size of the operands in Fn and Fm. |
46 | Choose the largest size and perform operations in that size, | 49 | Choose the largest size and perform operations in that size, |
@@ -63,14 +66,14 @@ unsigned int EmulateCPDO(const unsigned int opcode) | |||
63 | 66 | ||
64 | switch (nType) { | 67 | switch (nType) { |
65 | case typeSingle: | 68 | case typeSingle: |
66 | nRc = SingleCPDO(opcode, rFd); | 69 | nRc = SingleCPDO(&roundData, opcode, rFd); |
67 | break; | 70 | break; |
68 | case typeDouble: | 71 | case typeDouble: |
69 | nRc = DoubleCPDO(opcode, rFd); | 72 | nRc = DoubleCPDO(&roundData, opcode, rFd); |
70 | break; | 73 | break; |
71 | #ifdef CONFIG_FPE_NWFPE_XP | 74 | #ifdef CONFIG_FPE_NWFPE_XP |
72 | case typeExtended: | 75 | case typeExtended: |
73 | nRc = ExtendedCPDO(opcode, rFd); | 76 | nRc = ExtendedCPDO(&roundData, opcode, rFd); |
74 | break; | 77 | break; |
75 | #endif | 78 | #endif |
76 | default: | 79 | default: |
@@ -93,9 +96,9 @@ unsigned int EmulateCPDO(const unsigned int opcode) | |||
93 | case typeSingle: | 96 | case typeSingle: |
94 | { | 97 | { |
95 | if (typeDouble == nType) | 98 | if (typeDouble == nType) |
96 | rFd->fSingle = float64_to_float32(rFd->fDouble); | 99 | rFd->fSingle = float64_to_float32(&roundData, rFd->fDouble); |
97 | else | 100 | else |
98 | rFd->fSingle = floatx80_to_float32(rFd->fExtended); | 101 | rFd->fSingle = floatx80_to_float32(&roundData, rFd->fExtended); |
99 | } | 102 | } |
100 | break; | 103 | break; |
101 | 104 | ||
@@ -104,7 +107,7 @@ unsigned int EmulateCPDO(const unsigned int opcode) | |||
104 | if (typeSingle == nType) | 107 | if (typeSingle == nType) |
105 | rFd->fDouble = float32_to_float64(rFd->fSingle); | 108 | rFd->fDouble = float32_to_float64(rFd->fSingle); |
106 | else | 109 | else |
107 | rFd->fDouble = floatx80_to_float64(rFd->fExtended); | 110 | rFd->fDouble = floatx80_to_float64(&roundData, rFd->fExtended); |
108 | } | 111 | } |
109 | break; | 112 | break; |
110 | 113 | ||
@@ -121,12 +124,15 @@ unsigned int EmulateCPDO(const unsigned int opcode) | |||
121 | #else | 124 | #else |
122 | if (nDest != nType) { | 125 | if (nDest != nType) { |
123 | if (nDest == typeSingle) | 126 | if (nDest == typeSingle) |
124 | rFd->fSingle = float64_to_float32(rFd->fDouble); | 127 | rFd->fSingle = float64_to_float32(&roundData, rFd->fDouble); |
125 | else | 128 | else |
126 | rFd->fDouble = float32_to_float64(rFd->fSingle); | 129 | rFd->fDouble = float32_to_float64(rFd->fSingle); |
127 | } | 130 | } |
128 | #endif | 131 | #endif |
129 | } | 132 | } |
130 | 133 | ||
134 | if (roundData.exception) | ||
135 | float_raise(roundData.exception); | ||
136 | |||
131 | return nRc; | 137 | return nRc; |
132 | } | 138 | } |