diff options
author | Richard Henderson <rth@redhat.com> | 2002-09-16 16:36:39 +0000 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2002-09-16 16:36:39 +0000 |
commit | 19d8f5aa3ca0435f33fc00e36b3217aa3e88eb20 (patch) | |
tree | e6577420306f750f19abf6c590eb0d8987ca7485 /gcc/java | |
parent | 1ba2760c9b6a6c63859142003879677d6456bcfa (diff) |
gcc/
* real.c, real.h: Rewrite from scratch.
* Makefile.in (simplify-rtx.o): Depend on TREE_H.
(paranoia): New target.
* builtins.c (fold_builtin_inf): Use new real.h interface.
* c-common.c (builtin_define_with_hex_fp_value): Likewise.
* c-lex.c (interpret_float): Likewise.
* emit-rtl.c (gen_lowpart_common): Likewise.
* optabs.c (expand_float): Use real_2expN.
* config/ia64/ia64.md (divsi3, udivsi3): Likewise.
* defaults.h (INTEL_EXTENDED_IEEE_FORMAT): New.
(FLOAT_WORDS_BIG_ENDIAN): New.
* cse.c (find_comparison_args): Don't pass FLOAT_STORE_FLAG_VALUE
directly to REAL_VALUE_NEGATIVE.
* loop.c (canonicalize_condition): Likewise.
* simplify-rtx.c: Include tree.h.
(simplify_unary_operation): Don't handle FIX and UNSIGNED_FIX
with floating-point result modes.
* toplev.c (backend_init): Call init_real_once.
* fold-const.c (force_fit_type): Don't call CHECK_FLOAT_VALUE.
* tree.c (build_real): Likewise.
* config/alpha/alpha.c, config/vax/vax.c (float_strings,
float_values, inited_float_values, check_float_value): Remove.
* config/alpha/alpha.h, config/m68hc11/m68hc11.h,
config/m88k/m88k.h, config/vax/vax.h (CHECK_FLOAT_VALUE): Remove.
* doc/tm.texi (CHECK_FLOAT_VALUE): Remove.
gcc/f/
* target.c (ffetarget_real1): Don't pass FFETARGET_ATOF_
directly to ffetarget_make_real1.
(ffetarget_real2): Similarly.
* target.h (ffetarget_cvt_r1_to_rv_, ffetarget_cvt_rv_to_r2_,
ffetarget_cvt_r2_to_rv_): Use new real.h interface and simplify.
gcc/java/
* jcf-parse.c (get_constant): Runtime check for IEEE format;
use new real.h interface.
* jcf-write.c (find_constant_index): Use new real.h interface.
* lex.c (IS_ZERO): Use REAL_VALUES_EQUAL.
contrib/
* paranoia.cc: New file.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@57198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 75 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 23 | ||||
-rw-r--r-- | gcc/java/lex.c | 2 |
4 files changed, 54 insertions, 53 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index c8b4e8c521c..ac1b565950f 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2002-09-16 Richard Henderson <rth@redhat.com> + + * jcf-parse.c (get_constant): Runtime check for IEEE format; + use new real.h interface. + * jcf-write.c (find_constant_index): Use new real.h interface. + * lex.c (IS_ZERO): Use REAL_VALUES_EQUAL. + 2002-09-15 Kazu Hirata <kazu@cs.umass.edu> * lang.c: Follow spelling conventions. diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index fc755f0ce71..29ccf6328df 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -290,47 +290,44 @@ get_constant (jcf, index) force_fit_type (value, 0); break; } -#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT + case CONSTANT_Float: - { - jint num = JPOOL_INT(jcf, index); - REAL_VALUE_TYPE d; - d = REAL_VALUE_FROM_TARGET_SINGLE (num); - value = build_real (float_type_node, d); - break; - } + /* ??? Even more ideal would be to import the number using the + IEEE decode routines, then use whatever format the target + actually uses. This would enable Java on VAX to kind work. */ + if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT) + { + jint num = JPOOL_INT(jcf, index); + long buf = num; + REAL_VALUE_TYPE d; + real_from_target (&d, &buf, SFmode); + value = build_real (float_type_node, d); + break; + } + else + goto bad; + case CONSTANT_Double: - { - HOST_WIDE_INT num[2]; - REAL_VALUE_TYPE d; - HOST_WIDE_INT lo, hi; - num[0] = JPOOL_UINT (jcf, index); - lshift_double (num[0], 0, 32, 64, &lo, &hi, 0); - num[0] = JPOOL_UINT (jcf, index+1); - add_double (lo, hi, num[0], 0, &lo, &hi); - - /* Since ereal_from_double expects an array of HOST_WIDE_INT - in the target's format, we swap the elements for big endian - targets, unless HOST_WIDE_INT is sufficiently large to - contain a target double, in which case the 2nd element - is ignored. - - FIXME: Is this always right for cross targets? */ - if (FLOAT_WORDS_BIG_ENDIAN && sizeof(num[0]) < 8) - { - num[0] = hi; - num[1] = lo; - } - else - { - num[0] = lo; - num[1] = hi; - } - d = REAL_VALUE_FROM_TARGET_DOUBLE (num); - value = build_real (double_type_node, d); - break; - } -#endif /* TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT */ + if (TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT) + { + long buf[2], lo, hi; + REAL_VALUE_TYPE d; + + hi = JPOOL_UINT (jcf, index); + lo = JPOOL_UINT (jcf, index+1); + + if (FLOAT_WORDS_BIG_ENDIAN) + buf[0] = hi, buf[1] = lo; + else + buf[0] = lo, buf[1] = hi; + + real_from_target (&d, buf, DFmode); + value = build_real (double_type_node, d); + break; + } + else + goto bad; + case CONSTANT_String: { tree name = get_name_constant (jcf, JPOOL_USHORT1 (jcf, index)); diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 076912505e5..1a9f1075e23 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -826,21 +826,18 @@ find_constant_index (value, state) else if (TREE_CODE (value) == REAL_CST) { long words[2]; + + real_to_target (words, &TREE_REAL_CST (value), + TYPE_MODE (TREE_TYPE (value))); + words[0] &= 0xffffffff; + words[1] &= 0xffffffff; + if (TYPE_PRECISION (TREE_TYPE (value)) == 32) - { - words[0] = etarsingle (TREE_REAL_CST (value)) & 0xFFFFFFFF; - return find_constant1 (&state->cpool, CONSTANT_Float, - (jword)words[0]); - } + return find_constant1 (&state->cpool, CONSTANT_Float, (jword)words[0]); else - { - etardouble (TREE_REAL_CST (value), words); - return find_constant2 (&state->cpool, CONSTANT_Double, - (jword)(words[1-FLOAT_WORDS_BIG_ENDIAN] & - 0xFFFFFFFF), - (jword)(words[FLOAT_WORDS_BIG_ENDIAN] & - 0xFFFFFFFF)); - } + return find_constant2 (&state->cpool, CONSTANT_Double, + (jword)words[1-FLOAT_WORDS_BIG_ENDIAN], + (jword)words[FLOAT_WORDS_BIG_ENDIAN]); } else if (TREE_CODE (value) == STRING_CST) return find_string_constant (&state->cpool, value); diff --git a/gcc/java/lex.c b/gcc/java/lex.c index 5659ed2a1f5..026d3cacbd6 100644 --- a/gcc/java/lex.c +++ b/gcc/java/lex.c @@ -834,7 +834,7 @@ java_parse_escape_sequence () } #ifndef JC1_LITE -#define IS_ZERO(X) (ereal_cmp (X, dconst0) == 0) +#define IS_ZERO(X) REAL_VALUES_EQUAL (X, dconst0) /* Subroutine of java_lex: converts floating-point literals to tree nodes. LITERAL_TOKEN is the input literal, JAVA_LVAL is where to |