• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/arm/nwfpe/
1/*
2    NetWinder Floating Point Emulator
3    (c) Rebel.COM, 1998,1999
4
5    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "softfloat.h"
24#include "fpopcode.h"
25#include "fpsr.h"
26#include "fpmodule.h"
27#include "fpmodule.inl"
28
29#ifdef CONFIG_FPE_NWFPE_XP
30const floatx80 floatx80Constant[] = {
31	{ .high = 0x0000, .low = 0x0000000000000000ULL},/* extended 0.0 */
32	{ .high = 0x3fff, .low = 0x8000000000000000ULL},/* extended 1.0 */
33	{ .high = 0x4000, .low = 0x8000000000000000ULL},/* extended 2.0 */
34	{ .high = 0x4000, .low = 0xc000000000000000ULL},/* extended 3.0 */
35	{ .high = 0x4001, .low = 0x8000000000000000ULL},/* extended 4.0 */
36	{ .high = 0x4001, .low = 0xa000000000000000ULL},/* extended 5.0 */
37	{ .high = 0x3ffe, .low = 0x8000000000000000ULL},/* extended 0.5 */
38	{ .high = 0x4002, .low = 0xa000000000000000ULL},/* extended 10.0 */
39};
40#endif
41
42const float64 float64Constant[] = {
43	0x0000000000000000ULL,	/* double 0.0 */
44	0x3ff0000000000000ULL,	/* double 1.0 */
45	0x4000000000000000ULL,	/* double 2.0 */
46	0x4008000000000000ULL,	/* double 3.0 */
47	0x4010000000000000ULL,	/* double 4.0 */
48	0x4014000000000000ULL,	/* double 5.0 */
49	0x3fe0000000000000ULL,	/* double 0.5 */
50	0x4024000000000000ULL	/* double 10.0 */
51};
52
53const float32 float32Constant[] = {
54	0x00000000,		/* single 0.0 */
55	0x3f800000,		/* single 1.0 */
56	0x40000000,		/* single 2.0 */
57	0x40400000,		/* single 3.0 */
58	0x40800000,		/* single 4.0 */
59	0x40a00000,		/* single 5.0 */
60	0x3f000000,		/* single 0.5 */
61	0x41200000		/* single 10.0 */
62};
63
64/* condition code lookup table
65 index into the table is test code: EQ, NE, ... LT, GT, AL, NV
66 bit position in short is condition code: NZCV */
67static const unsigned short aCC[16] = {
68	0xF0F0,			// EQ == Z set
69	0x0F0F,			// NE
70	0xCCCC,			// CS == C set
71	0x3333,			// CC
72	0xFF00,			// MI == N set
73	0x00FF,			// PL
74	0xAAAA,			// VS == V set
75	0x5555,			// VC
76	0x0C0C,			// HI == C set && Z clear
77	0xF3F3,			// LS == C clear || Z set
78	0xAA55,			// GE == (N==V)
79	0x55AA,			// LT == (N!=V)
80	0x0A05,			// GT == (!Z && (N==V))
81	0xF5FA,			// LE == (Z || (N!=V))
82	0xFFFF,			// AL always
83	0			// NV
84};
85
86unsigned int checkCondition(const unsigned int opcode, const unsigned int ccodes)
87{
88	return (aCC[opcode >> 28] >> (ccodes >> 28)) & 1;
89}
90