Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
2e15b172
Commit
2e15b172
authored
Mar 13, 1994
by
Richard Kenner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add OVERFLOW operand to CHECK_FLOAT_VALUE.
From-SVN: r6770
parent
c05f751c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
47 deletions
+64
-47
gcc/config/convex/convex.c
+15
-6
gcc/config/convex/convex.h
+3
-3
gcc/config/fx80/fx80.h
+11
-11
gcc/config/tahoe/tahoe.h
+14
-16
gcc/config/vax/vax.c
+18
-9
gcc/config/vax/vax.h
+3
-2
No files found.
gcc/config/convex/convex.c
View file @
2e15b172
/* Subroutines for insn-output.c for Convex.
/* Subroutines for insn-output.c for Convex.
Copyright (C) 1988, 1993 Free Software Foundation, Inc.
Copyright (C) 1988, 1993
, 1994
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -413,31 +413,40 @@ expand_movstr_call (operands)
...
@@ -413,31 +413,40 @@ expand_movstr_call (operands)
#define MIN_FLOAT 2.9387358770557188e-39
#define MIN_FLOAT 2.9387358770557188e-39
#endif
#endif
void
int
check_float_value
(
mode
,
dp
)
check_float_value
(
mode
,
dp
,
overflow
)
enum
machine_mode
mode
;
enum
machine_mode
mode
;
REAL_VALUE_TYPE
*
dp
;
REAL_VALUE_TYPE
*
dp
;
int
overflow
;
{
{
REAL_VALUE_TYPE
d
=
*
dp
;
REAL_VALUE_TYPE
d
=
*
dp
;
if
(
overflow
)
{
*
dp
=
MAX_FLOAT
;
return
1
;
}
if
(
mode
==
SFmode
)
if
(
mode
==
SFmode
)
{
{
if
(
d
>
MAX_FLOAT
)
if
(
d
>
MAX_FLOAT
)
{
{
error
(
"magnitude of constant too large for `float'"
);
*
dp
=
MAX_FLOAT
;
*
dp
=
MAX_FLOAT
;
return
1
;
}
}
else
if
(
d
<
-
MAX_FLOAT
)
else
if
(
d
<
-
MAX_FLOAT
)
{
{
error
(
"magnitude of constant too large for `float'"
);
*
dp
=
-
MAX_FLOAT
;
*
dp
=
-
MAX_FLOAT
;
return
1
;
}
}
else
if
((
d
>
0
&&
d
<
MIN_FLOAT
)
||
(
d
<
0
&&
d
>
-
MIN_FLOAT
))
else
if
((
d
>
0
&&
d
<
MIN_FLOAT
)
||
(
d
<
0
&&
d
>
-
MIN_FLOAT
))
{
{
warning
(
"`float' constant truncated to zero"
);
*
dp
=
0
.
0
;
*
dp
=
0
.
0
;
return
1
;
}
}
}
}
return
0
;
}
}
/* Output the label at the start of a function.
/* Output the label at the start of a function.
...
...
gcc/config/convex/convex.h
View file @
2e15b172
/* Definitions of target machine for GNU compiler. Convex version.
/* Definitions of target machine for GNU compiler. Convex version.
Copyright (C) 1988, 1993 Free Software Foundation, Inc.
Copyright (C) 1988, 1993
, 1994
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -1180,8 +1180,8 @@ enum reg_class {
...
@@ -1180,8 +1180,8 @@ enum reg_class {
extern
double
atof
();
extern
double
atof
();
/* Check a `double' value for validity for a particular machine mode. */
/* Check a `double' value for validity for a particular machine mode. */
#define CHECK_FLOAT_VALUE(
mode, d
) \
#define CHECK_FLOAT_VALUE(
MODE, D, OVERFLOW
) \
check_float_value ((mode), &(d)
)
overflow = check_float_value (MODE, &D, OVERFLOW
)
/* Tell final.c how to eliminate redundant test instructions. */
/* Tell final.c how to eliminate redundant test instructions. */
...
...
gcc/config/fx80/fx80.h
View file @
2e15b172
/* Definitions of target machine for GNU compiler. Alliant FX version.
/* Definitions of target machine for GNU compiler. Alliant FX version.
Copyright (C) 1989, 1993 Free Software Foundation, Inc.
Copyright (C) 1989, 1993
, 1994
Free Software Foundation, Inc.
Adapted from m68k.h by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
Adapted from m68k.h by Paul Petersen (petersen@uicsrd.csrd.uiuc.edu)
and Joe Weening (weening@gang-of-four.stanford.edu).
and Joe Weening (weening@gang-of-four.stanford.edu).
...
@@ -887,19 +887,19 @@ extern enum reg_class regno_reg_class[];
...
@@ -887,19 +887,19 @@ extern enum reg_class regno_reg_class[];
/* Check a `double' value for validity for a particular machine mode.
/* Check a `double' value for validity for a particular machine mode.
This is defined to avoid crashes outputting certain constants. */
This is defined to avoid crashes outputting certain constants. */
#define CHECK_FLOAT_VALUE(mode, d) \
#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW) \
if ((mode) == SFmode) \
if (OVERFLOW) \
(D) = 3.4028234663852890e+38; \
else if ((MODE) == SFmode) \
{ \
{ \
if ((d) > 3.4028234663852890e+38) \
if ((d) > 3.4028234663852890e+38) \
{ warning ("magnitude of value too large for `float'"); \
(OVERFLOW) = 1, (D) = 3.4028234663852890e+38; \
(d) = 3.4028234663852890e+38; } \
else if ((D) < -3.4028234663852890e+38) \
else if ((d) < -3.4028234663852890e+38) \
(OVERFLOW) = 1, (D) = -3.4028234663852890e+38; \
{ warning ("magnitude of value too large for `float'"); \
else if (((D) > 0) && ((D) < 1.1754943508222873e-38)) \
(d) = -3.4028234663852890e+38; } \
(OVERFLOW) = 1, (D) = 0.0; \
else if (((d) > 0) && ((d) < 1.1754943508222873e-38)) \
(d) = 0.0; \
else if (((d) < 0) && ((d) > -1.1754943508222873e-38)) \
else if (((d) < 0) && ((d) > -1.1754943508222873e-38)) \
(
d) = 0.0;
\
(
OVEFLOW) = 1, (D) = 0.0;
\
}
}
/* Tell final.c how to eliminate redundant test instructions. */
/* Tell final.c how to eliminate redundant test instructions. */
...
...
gcc/config/tahoe/tahoe.h
View file @
2e15b172
/* Definitions of target machine for GNU compiler. Tahoe version.
/* Definitions of target machine for GNU compiler. Tahoe version.
Copyright (C) 1989, 1993 Free Software Foundation, Inc.
Copyright (C) 1989, 1993
, 1994
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -135,21 +135,19 @@ extern int target_flags;
...
@@ -135,21 +135,19 @@ extern int target_flags;
/* this section is borrowed from the vax version since the */
/* this section is borrowed from the vax version since the */
/* formats are the same in both of the architectures */
/* formats are the same in both of the architectures */
#define CHECK_FLOAT_VALUE(mode, d) \
#define CHECK_FLOAT_VALUE(MODE, D, OVEFLOW) \
if ((mode) == SFmode) \
if (OVERFLOW) \
{ \
(D) = 1.7014117331926443e+38; \
if ((d) > 1.7014117331926443e+38) \
else if ((MODE) == SFmode) \
{ error ("magnitude of constant too large for `float'"); \
{ \
(d) = 1.7014117331926443e+38; } \
if ((D) > 1.7014117331926443e+38) \
else if ((d) < -1.7014117331926443e+38) \
(OVERFLOW) = 1, (D) = 1.7014117331926443e+38; \
{ error ("magnitude of constant too large for `float'"); \
else if ((D) < -1.7014117331926443e+38) \
(d) = -1.7014117331926443e+38; } \
(OVERFLOW) = 1, (D) = -1.7014117331926443e+38; \
else if (((d) > 0) && ((d) < 2.9387358770557188e-39)) \
else if (((D) > 0) && ((D) < 2.9387358770557188e-39)) \
{ warning ("`float' constant truncated to zero"); \
(OVERFLOW) = 1, (D) = 0.0; \
(d) = 0.0; } \
else if (((D) < 0) && ((D) > -2.9387358770557188e-39)) \
else if (((d) < 0) && ((d) > -2.9387358770557188e-39)) \
(OVERFLOW) = 1, (D) = 0.0; \
{ warning ("`float' constant truncated to zero"); \
(d) = 0.0; } \
}
}
...
...
gcc/config/vax/vax.c
View file @
2e15b172
/* Subroutines for insn-output.c for Vax.
/* Subroutines for insn-output.c for Vax.
Copyright (C) 1987 Free Software Foundation, Inc.
Copyright (C) 1987
, 1994
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -593,12 +593,12 @@ static REAL_VALUE_TYPE float_values[4];
...
@@ -593,12 +593,12 @@ static REAL_VALUE_TYPE float_values[4];
static
int
inited_float_values
=
0
;
static
int
inited_float_values
=
0
;
void
int
check_float_value
(
mode
,
d
)
check_float_value
(
mode
,
d
,
overflow
)
enum
machine_mode
mode
;
enum
machine_mode
mode
;
REAL_VALUE_TYPE
*
d
;
REAL_VALUE_TYPE
*
d
;
int
overflow
;
{
{
if
(
inited_float_values
==
0
)
if
(
inited_float_values
==
0
)
{
{
int
i
;
int
i
;
...
@@ -606,7 +606,14 @@ check_float_value (mode, d)
...
@@ -606,7 +606,14 @@ check_float_value (mode, d)
{
{
float_values
[
i
]
=
REAL_VALUE_ATOF
(
float_strings
[
i
],
DFmode
);
float_values
[
i
]
=
REAL_VALUE_ATOF
(
float_strings
[
i
],
DFmode
);
}
}
inited_float_values
=
1
;
inited_float_values
=
1
;
}
if
(
overflow
)
{
bcopy
(
&
float_values
[
0
],
d
,
sizeof
(
REAL_VALUE_TYPE
));
return
1
;
}
}
if
((
mode
)
==
SFmode
)
if
((
mode
)
==
SFmode
)
...
@@ -615,27 +622,29 @@ check_float_value (mode, d)
...
@@ -615,27 +622,29 @@ check_float_value (mode, d)
bcopy
(
d
,
&
r
,
sizeof
(
REAL_VALUE_TYPE
));
bcopy
(
d
,
&
r
,
sizeof
(
REAL_VALUE_TYPE
));
if
(
REAL_VALUES_LESS
(
float_values
[
0
],
r
))
if
(
REAL_VALUES_LESS
(
float_values
[
0
],
r
))
{
{
error
(
"magnitude of constant too large for `float'"
);
bcopy
(
&
float_values
[
0
],
d
,
sizeof
(
REAL_VALUE_TYPE
));
bcopy
(
&
float_values
[
0
],
d
,
sizeof
(
REAL_VALUE_TYPE
));
return
1
;
}
}
else
if
(
REAL_VALUES_LESS
(
r
,
float_values
[
1
]))
else
if
(
REAL_VALUES_LESS
(
r
,
float_values
[
1
]))
{
{
error
(
"magnitude of constant too large for `float'"
);
bcopy
(
&
float_values
[
1
],
d
,
sizeof
(
REAL_VALUE_TYPE
));
bcopy
(
&
float_values
[
1
],
d
,
sizeof
(
REAL_VALUE_TYPE
));
return
1
;
}
}
else
if
(
REAL_VALUES_LESS
(
dconst0
,
r
)
else
if
(
REAL_VALUES_LESS
(
dconst0
,
r
)
&&
REAL_VALUES_LESS
(
r
,
float_values
[
2
]))
&&
REAL_VALUES_LESS
(
r
,
float_values
[
2
]))
{
{
warning
(
"`float' constant truncated to zero"
);
bcopy
(
&
dconst0
,
d
,
sizeof
(
REAL_VALUE_TYPE
));
bcopy
(
&
dconst0
,
d
,
sizeof
(
REAL_VALUE_TYPE
));
return
1
;
}
}
else
if
(
REAL_VALUES_LESS
(
r
,
dconst0
)
else
if
(
REAL_VALUES_LESS
(
r
,
dconst0
)
&&
REAL_VALUES_LESS
(
float_values
[
3
],
r
))
&&
REAL_VALUES_LESS
(
float_values
[
3
],
r
))
{
{
warning
(
"`float' constant truncated to zero"
);
bcopy
(
&
dconst0
,
d
,
sizeof
(
REAL_VALUE_TYPE
));
bcopy
(
&
dconst0
,
d
,
sizeof
(
REAL_VALUE_TYPE
));
return
1
;
}
}
}
}
return
0
;
}
}
/* Linked list of all externals that are to be emitted when optimizing
/* Linked list of all externals that are to be emitted when optimizing
...
...
gcc/config/vax/vax.h
View file @
2e15b172
/* Definitions of target machine for GNU compiler. Vax version.
/* Definitions of target machine for GNU compiler. Vax version.
Copyright (C) 1987, 1988, 1991, 1993 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1991, 1993
, 1994
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
...
@@ -912,7 +912,8 @@ gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12))
...
@@ -912,7 +912,8 @@ gen_rtx (PLUS, Pmode, frame, gen_rtx (CONST_INT, VOIDmode, 12))
/* note that it is very hard to accidentally create a number that fits in a
/* note that it is very hard to accidentally create a number that fits in a
double but not in a float, since their ranges are almost the same */
double but not in a float, since their ranges are almost the same */
#define CHECK_FLOAT_VALUE(mode, d) (check_float_value (mode, &d))
#define CHECK_FLOAT_VALUE(MODE, D, OVERFLOW)
((
OVERFLOW
)
=
check_float_value
(
MODE
,
&
D
,
OVERFLOW
))
/* For future reference:
/* For future reference:
D Float: 9 bit, sign magnitude, excess 128 binary exponent
D Float: 9 bit, sign magnitude, excess 128 binary exponent
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment