Commit Graph

937 Commits

Author SHA1 Message Date
Jeffrey A Law
7d12cee1f1 * fold-const.c (make_range): Do not widen the type of the expression.
From-SVN: r20545
1998-06-17 11:54:27 -06:00
Jeffrey A Law
dbecbbe48a expr.c (check_max_integer_computation_mode): New function.
* expr.c (check_max_integer_computation_mode): New function.
        (expand_expr): Avoid integer computations in modes wider than
        MAX_INTEGER_COMPUTATION_MODE.
        * fold-const.c (fold): Likewise.
        * tree.h (check_max_integer_computation_mode): Declare.
        * tm.texi (MAX_INTEGER_COMPUTATION_MODE): Document it.

From-SVN: r20538
1998-06-17 05:44:02 -06:00
Richard Henderson
77a45a2ea4 fold-const.c (fold): Revert last change.
* fold-const.c (fold): Revert last change.  It breaks constant
        expressions somehow.

From-SVN: r20441
1998-06-12 02:34:00 -07:00
Richard Henderson
ac1fdb22b8 fold-const.c (fold): Even with otherwise constant trees...
* fold-const.c (fold): Even with otherwise constant trees, look for
        opportunities to combine integer constants.

From-SVN: r20392
1998-06-09 15:05:49 -07:00
Kaveh R. Ghazi
83e0821b60 Some fixes for KNR compilers:
* gencheck.c: Remove redundant stdio.h include.  Add a definition
        of xmalloc for when we are forced to link with alloca.o.
        * reload1.c (reload_reg_free_for_value_p): Use `(unsigned)1'
        instead of `1U'.
        * fold-const.c (constant_boolean_node): Make definition static to
        match the prototype.

From-SVN: r20261
1998-06-06 09:25:16 +00:00
Andreas Schwab
df0e526f2d fold-const.c (fold, [...]): When folding VAR++ == CONST or VAR-- == CONST construct a proper mask if...
* fold-const.c (fold, case EQ_EXPR): When folding VAR++ == CONST
        or VAR-- == CONST construct a proper mask if VAR is a bitfield.
        Cope with CONST being out of range for the bitfield.

From-SVN: r20198
1998-06-02 15:53:37 -06:00
Jason Merrill
697073d938 fold-const.c (ssize_binop): New fn.
* fold-const.c (ssize_binop): New fn.
	* tree.h: Declare it.

From-SVN: r19963
1998-05-22 16:58:14 -04:00
Mark Mitchell
f628873f1f fold-const.c (constant_boolean_node): New function.
* fold-const.c (constant_boolean_node): New function.
	(fold): Use it.

From-SVN: r19775
1998-05-15 07:19:38 +00:00
Jeff Law
38e012594e typo typo fixes fixes
From-SVN: r19601
1998-05-06 15:09:07 -06:00
Robert Lipe
10f0ad3d49 toplev.h: New file.
Wed May  6 06:35:38 1998  Robert Lipe  <robertl@dgii.com>
        * toplev.h: New file.   Protypes for functions in toplev.c.
        * tree.h, rtl.h: Deleted protos for functions in toplev.c.
        * c-common.c, c-convert.c, c-decl.c, c-iterate.c, c-lex.c,
        c-parse.in, c-parse.y, c-pragma.c, c-typeck.c, calls.c,
        convert.c, dwarf2out.c, except.c, expr.c, final.c, fold-const.c,
        function.c, hash.c, profile.c, real.c, reg-stack.c, regclass.c,
        reload.c, reload1.c, stmt.c, stor-layout.c, tlink.c, tree.c,
        varasm.c: include it.

From-SVN: r19564
1998-05-06 04:54:01 +00:00
Jeff Law
f5963e6170 * Check in merge from gcc2. See ChangeLog.12 for details.
From-SVN: r19553
1998-05-05 17:18:02 -06:00
Jeffrey A Law
4f242db399 * fold-const.c (fold_convert): Fix typo.
From-SVN: r19409
1998-04-25 10:17:08 -06:00
Richard Henderson
896cced482 tree.h (sizetype_tab[2], [...]): Merge all of these into a single struct, with additional [us]sizetype entries.
* tree.h (sizetype_tab[2], sbitsizetype, ubitsizetype): Merge all
of these into a single struct, with additional [us]sizetype entries.
* stor-layout.c (set_sizetype): Initialize [us]sizetype.
* fold-const.c (size_int_wide): Don't rely on sizetype_tab being
an array.

From-SVN: r18994
1998-04-04 09:46:06 -08:00
Jeff Law
e5e809f419 * Check in merge from gcc2. See ChangeLog.11 and ChangeLog.12
for details.

        * haifa-sched.c: Mirror recent changes from gcc2.

From-SVN: r18984
1998-04-04 06:32:39 -07:00
Jeffrey A Law
4e86caed7d fold-const.c (optimze_bit_field_compare): Initialize rnbitpos, rnbitsize, rnmode and rinner.
* fold-const.c optimze_bit_field_compare): Initialize rnbitpos,
        rnbitsize, rnmode and rinner.
        (make_range): Initialize type.
        (fold): Initialize arg0, arg1 and varop.
        * function.c (instantiate_virtual_regs_1): Initialize offset, regnoi
        and regnor.
        (expand_function_start): Initialize last_ptr.
        * stor-layout.c (layout_record): Initialize desired_align.
        (get_best_mode): Initialize unit.
        * tree.c (copy_node): Initialize length.

From-SVN: r18943
1998-04-01 16:35:51 -07:00
Mark Mitchell
c651e1e085 varasm.c (make_decl_rtl): Update the DECL_ASSEMBLER_NAME for a entity in a local scope.
* varasm.c (make_decl_rtl): Update the DECL_ASSEMBLER_NAME for a
	entity in a local scope.
	* fold-const.c (fold): Call truthvalue_conversion for values which
	are folded to boolean type.

From-SVN: r18929
1998-04-01 13:45:40 +00:00
Philippe De Muyter
ba3ad5e002 fold-const.c (fold): Replace sign-extension of a zero extended value by a single zero extension.
* fold-const.c (fold): Replace sign-extension of a zero extended
        value by a single zero extension.

From-SVN: r18713
1998-03-19 12:27:18 -07:00
Richard Kenner
52de9b6cff fold-const.c (operand_equal_for_comparison_p): See if equal when nop conversions are removed.
Wed Mar 18 13:46:07 1998  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
        * fold-const.c (operand_equal_for_comparison_p): See if equal
        when nop conversions are removed.

From-SVN: r18672
1998-03-18 05:45:28 -08:00
Jeffrey A Law
de153e8290 * fold-const.c (fold_range_test): Always return a value.
From-SVN: r18343
1998-03-01 10:04:14 -07:00
Kaveh R. Ghazi
2fde567ece fold-const.c: Include "system.h" to get stdlib.h and stdio.h.
* fold-const.c: Include "system.h" to get stdlib.h and stdio.h.
        (lshift_double): Add parentheses around + or - inside shift.
        (rshift_double): Likewise.
        (size_int_wide): Explicitly set type of `bit_p' to `int'.
        * Makefile.in (fold-const.o): Depend on system.h.

From-SVN: r18057
1998-02-17 15:43:25 -07:00
Jason Merrill
b7f6588dd2 tree.c (first_rtl_op): New fn.
* tree.c (first_rtl_op): New fn.
	(unsave_expr_now): Use it.
	* print-tree.c (print_node): Likewise.
	* tree.c (has_cleanups): New fn.
	* fold-const.c (fold, case CLEANUP_POINT_EXPR): Use it.  Be more
	conservative about pushing the cleanup point down.
	* tree.h: Declare them.

From-SVN: r18023
1998-02-15 23:52:31 -05:00
Jeffrey A Law
29a820586a varasm.c (output_constant_pool): Bring back 'done' label inside an appropriate #ifdef.
* varasm.c (output_constant_pool): Bring back 'done' label inside
        an appropriate #ifdef.
        * bitmap.c (bitmap_element_allocate): Wrap variable 'i' in an
        appropriate #ifdef.
        (bitmap_copy, bitmap_operation): Likewise.
        * combine.c (combinable_i3pat): Similarly for 'src'.
        * function.c (fixup_var_refs_1): Similarly for 'outerdest'.
        (locate_and_pad_parm): Similarly for 'reg_parm_stack_space'.
        * regclass.c (copy_cost): Similarly for 'secondary_class'.
        * reload.c (make_memloc): Simliarly for 'i'.
        (find_reloads_address_1): Similarly for 'link'.
        * reload1.c (reload): Similarly for 'previous_frame_pointer_needed'.
        (emit_reload_insns): Similarly for 'second_reloadreg'.
        * unroll.c (iteration_info): Similarly for 'v'.
        * caller-save.c (insert_save_restore): Remove unused variable 'i'.
        * calls.c (expand_call): Similarly for 'i'.
        (emit_library_call, emit_library_call_value): Similarly for 'mode'.
        * fold-const.c (strip_compund_expr): Similarly for 'type'.
        * function.c (fixup_var_refs_1): Similarly  for 'width'.
        (fixup_memory_subreg): Similarly for 'saved'.
        (locate_and_pad_parm): Similarly for 'boundary_in_bytes.'
        (setjmp_protect): Similarly for 'sub'.
        (thread_prologue_and_epilogue_insns): Similarly for 'insn'.
        * loop.c (record_giv): Similarly for 'p'.
        (combine_givs): Similarly for 'temp_iv'.
        (indirect_jump_in_function_p): Similarly for 'is_indirect_jump'.
        * recog.c (validate_replace_rtx_1): Similarly for 'width'.
        * tree.c (get_set_constructor_bytes): Similarly for 'vals'.
        * unroll.c (unroll_loop): Similarly for 'copy'.
        (iteration_info): Similarly for 'b'.
        * varasm.c (assemble_string): Similarly for 'i'.
        * i386.h (LEGITIMIZE_ADDRESS): Similarly for 'orig_x'.

From-SVN: r17973
1998-02-13 18:13:58 -07:00
J"orn Rennecke
f8dac6eb3f expr.c (get_inner_reference): Use sbitsizetype for type sizes.
* expr.c (get_inner_reference): Use sbitsizetype for type sizes.
        * fold-const.c (size_int): Replace with
        (size_int_wide).
        (make_bit_field_ref): Use bitsize_int for bit position.
        * stor-layout.c (sizetype): Delete.
        (sizetype_tab, sbitsizetype, ubitsizetype): Declare.
        (layout_record, layout_union, layout_type):
        Use bitsize_int for bit size.
        (set_sizetype): New function.
        (make_signed_type, make_unsigned_type): Use it.
        * c-decl.c (init_decl_processing): Likewise.
        * tree.h (size_int): Don't delcare, #define.
        (size_int_wide, sizetype_tab, sbitsize, ubitsize): Declare.
        (set_sizetype): Declare.
        (bitsize_int, size_int_2, BITS_PER_UNIT_LOG, sizetype, bitsizetype):
        Define.
        * c-typeck.c (c_sizeof, c_sizeof_nowarn, c_size_in_bytes):
        Convert result to sizetype.
        (really_start_incremental_init, push_init_level):
        Set type of constructor_bit_index to sbitsizetype.
        (push_init_level): Use unsigned arithmetic to determine padding.
        (output_init_element): Likewise.

From-SVN: r17577
1998-02-01 04:47:59 -07:00
Kaveh R. Ghazi
1d300e19b6 bitmap.c (bitmap_clear): Ensure `inline' is at the beginning of the declaration.
* bitmap.c (bitmap_clear): Ensure `inline' is at the beginning
        of the declaration.
        * c-decl.c (finish_decl): Use parentheses around && within ||.
        * rtl.c: Include stdlib.h.
        (read_skip_spaces): Add parentheses around assignments used as
        truth values.
        (read_rtx): Initialize list_rtx.
        * cppexp.c (parse_number): Use || when operands are truth values.
        * alias.c (find_base_value): Add default case.
        (memrefs_conflict): Likewise.
        * combine.c (sets_function_arg_p): Likewise.
        * genemit.c (gen_exp): Likewise.
        * local-alloc.c (contains_replace_regs): Likewise.
        * rtlanal.c (jmp_uses_reg_or_mem): Likewise.
        * fold-const.c (fold_convert): Use "&&" for truth values.
        (fold): Add default case.
        * sdbout.c (sdbout_field_types): Fix typo in declaration.
        (sdbout_one_type): Add default case.
        * alpha.c (alpha_sa_mask): Prototype only if OPEN_VMS.
        (some_operand): Add default case.
        (input_operand): Likewise.
        (signed_comparison_operator): Likewise.
        (divmod_operator): Likewise.
        (alpha_set_memflags_1): Likewise.
        * reload1.c (reload_cse_simplify_operands): Ensure function
        always returns a value.
        * scan-decls.c (scan_decls): Likewise.
        * c-lex.c (skip_white_space): Fix typo in declaraion.
        * c-typeck.c (comp_target_types): Add parentheses around assignment
        used as truth value.
        (print_spelling): Likewise.
        (constructor_implicit, constructor_result): Remove unused variables.
        * collect2.c (scan_library): Protect prototype with
        #ifdef SCAN_LIBRARIES.
        * emit-rtl.c (find_line_note): Fix typo in declaration.
        * final.c (asm_insn_count): Protect prototype with
        #ifdef HAVE_ATTR_length.
        * flow.c (find_auto_inc): Protect prototype with #ifdef AUTO_INC_DEC.
        (try_pre_increment_1, try_pre_increment): Likewise.
        * regclass.c (auto_inc_dec_reg_p): Protect prototype with
        #ifdef FORBIDDEN_INC_DEC_CLASSES.  Make return type explicit.
        * gcov-io.h (__store_long, __write_long, __read_long): Fix
        unsigned/signed comparisons.
        * gcov.c (read_files): Remove unused "first_type" variable.
        (scan _for_source_files): Initialize s_ptr.
        (function_summary): Eliminate "%lf" formatting, use %ld for
        longs.
        (output_data): Initialize branch_probs and last_line_num.
        Eliminate "%lf" formatting, use "%ld" for longs.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>

From-SVN: r17158
1997-12-20 04:31:54 -07:00
Richard Henderson
e1ee5cdcbf tree.c (build_range_type): Allow creation of ranges with no maximum.
* tree.c (build_range_type): Allow creation of ranges with no maximum.
	* dbxout.c (dbxout_range_type): Handle missing TYPE_MAX_VALUE.
	* dwarf2out.c (add_subscript_info): Likewise.
	* dwarfout.c (subscript_data_attribute, byte_size_attribute): Likewise.
	* sdbout.c (plain_type_1): Likewise.
	* stmt.c (pushcase_range, all_cases_count, node_has_high_bound):
	Likewise.
	* fold-const.c (int_const_binop, fold_convert, make_range, fold):
	Likewise.

From-SVN: r17142
1997-12-18 16:20:19 -07:00
Jeff Law
b472527b0f Another handful of gcc-2.8 changes (will it ever go out the door?).
See ChangeLog.11 for details.

From-SVN: r17040
1997-12-11 09:26:05 -07:00
Jeff Law
956d69504d Merge from gcc-2.8
From-SVN: r16987
1997-12-06 17:31:01 -07:00
J"orn Rennecke
9f29ca789b * fold-const.c (fold_truthop): Fix bug in last change.
From-SVN: r16473
1997-11-14 00:38:08 +00:00
Paul Eggert
41c9120baf patch from paul eggert to fix -0.0/0.0 confusion that breaks glibc
* real.h (REAL_VALUES_IDENTICAL): New macro.
	* expr.c (is_zeros_p): Don't consider -0.0 to be all zeros.
	* fold-const.c (operand_equal_p): Don't consider -0.0 to be
	identical to 0.0.
	* tree.c (simple_cst_equal): Don't consider -0.0 to have the
	same tree structure as 0.0.
	* varasm.c (immed_real_const_1): Use new REAL_VALUES_IDENTICAL
	macro instead of doing it by hand.

From-SVN: r16472
1997-11-13 16:07:27 -08:00
J"orn Rennecke
5a6b336594 fold-const.c (fold_truthop): When changing a one-bit comparison against zero into a comparison against mask...
* fold-const.c (fold_truthop): When changing a one-bit comparison
	against zero into a comparison against mask, do a proper sign
	extension.

From-SVN: r16448
1997-11-13 00:09:37 +00:00
Jeff Law
e9a25f70a0 Update mainline egcs to gcc2 snapshot 971021.
From-SVN: r16278
1997-11-02 14:19:36 -07:00
Toon Moene
750e83485a fold-const.c (fold): For ((a * C1) / C3) or (((a * C1) + C2) / C3) optimizations...
* fold-const.c (fold): For ((a * C1) / C3) or (((a * C1) + C2) / C3)
        optimizations, look inside dividend to determine if the expression
        can be simplified by using EXACT_DIV_EXPR.

From-SVN: r16216
1997-10-28 12:02:23 -07:00
Toon Moene
91585c63e4 fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR if...
* fold-const (fold): Also simplify FLOOR_DIV_EXPR to EXACT_DIV_EXPR
        if the dividend is a multiple of the divisor.

From-SVN: r16181
1997-10-26 10:05:24 -07:00
Jeff Law
ce2157a1a9 fold-const.c (make_range): Correctly handle cases of converting from unsigned to signed type.
* fold-const.c (make_range): Correctly handle cases of converting
        from unsigned to signed type.

        * fold-const.c (merge_ranges): Make sure that if one range is subset
        of another, it will always be the second range.  Correct (+,-) case to
        account for this.

Brought over from gcc2; fixes sparc bug.

From-SVN: r15678
1997-09-23 12:35:51 -06:00
Jeffrey A Law
63e7fe9ba4 pa.md (reload_peepholes): Make sure operand is a REG before examining REGNO.
* pa.md (reload_peepholes): Make sure operand is a REG before
        examining REGNO.  Allow general registers too.
Fixes sporatic c-torture failure.

Remove last change to fold-const.c and c-decl.c

From-SVN: r15000
1997-08-29 16:14:07 -06:00
Doug Evans
3dedc65a1f c-decl.c (grokdeclarator): If array index or size calculations overflow, issue an error.
* c-decl.c (grokdeclarator): If array index or size calculations
        overflow, issue an error.
        * fold-const.c (int_const_binop): New static function.
        (const_binop, size_binop): Call it.
Brought over from the fsf.

From-SVN: r14967
1997-08-27 10:58:02 -06:00
Jeff Law
39dfb55a01 version.c: Bump for new snapshot.
* version.c: Bump for new snapshot.

        * local-alloc.c (update_equiv_regs): All the target to reject
        promotion of some REG_EQUAL to REG_EQUIV notes.
        * pa.h (DONT_RECORD_EQUIVALENCE): Define.
Fixes some c-torture failures, also improves generated code.

        * pa.c (secondary_reload_class): (mem (mem ... )) does not need
        secondary reloads.
Fixes 094.fpppp/twldrv.f abort.

        * pa.c (hppa_builtin_saveregs): Emit a blockage insn after the
        store of the argument registers.
Fixes c-torture failure.

        * fold-const.c (multiple_of_p): New function.
        (fold): Turn some cases of *_DIV_EXPR into EXACT_DIV_EXPR.
One of the performance patches from the g77 folks.

From-SVN: r14915
1997-08-25 09:00:44 -06:00
Richard Kenner
f0eebf28c4 (fold_range_test, fold): Avoid making SAVE_EXPR if at top level.
From-SVN: r14541
1997-07-27 19:35:53 -04:00
Doug Evans
0da6f3db7d Document force_fit_type as an entry point in the file.
From-SVN: r14324
1997-06-26 17:07:38 +00:00
Jason Merrill
88a5cdb87f x
From-SVN: r14210
1997-06-09 23:41:21 +00:00
Richard Kenner
96f06cb6dd (fold, truth_andor): Disable optimization for side effects on RHS.
From-SVN: r14047
1997-05-08 13:20:18 -04:00
Richard Kenner
3c9b009121 (operand_equal_p): Constants are not equal if there has been an overflow.
From-SVN: r13949
1997-04-20 21:27:07 -04:00
Richard Kenner
e80c9ccb75 (fold): Don't assume a nonexplicit constant cannot equal an explicit one.
From-SVN: r13650
1997-02-15 18:49:22 -05:00
Richard Kenner
580ceef20e (const_binop): Don't call size_int if low < 0.
From-SVN: r13617
1997-02-07 13:10:26 -05:00
Richard Kenner
8e3df5dce2 (fold): Don't make COND_EXPR when both expr and one part are comparisons.
From-SVN: r13553
1997-01-27 09:05:06 -05:00
Richard Kenner
c7cfe938eb (operand_equal_p): Rework to consider two expressions that have embedded identical SAVE_EXPRs as equivalent...
(operand_equal_p): Rework to consider two expressions that have
embedded identical SAVE_EXPRs as equivalent; also handle some more
cases.

From-SVN: r13385
1997-01-06 08:00:51 -05:00
Richard Kenner
380ff34aab (const_binop): Rework to only make constants in one place; always use size_int if small enough and of sizetype.
(const_binop): Rework to only make constants in
one place; always use size_int if small enough and of sizetype.
(size_int): Call force_fit_type.
(fold): Avoid ever changing type of input tree.

From-SVN: r13377
1997-01-04 22:27:13 -05:00
Richard Kenner
d4fcc6365e (merge_ranges): In (+,-) case, if lower bounds are the same the result
is always false.

From-SVN: r13236
1996-12-07 17:54:59 -05:00
Richard Kenner
23bd99ae34 (optimize_bit_field_compare, decode_field_reference): Pass new arg to
get_inner_reference.

From-SVN: r13188
1996-11-16 06:19:25 -05:00
Jim Wilson
cf85c69b0e (unextend): Rewrite type conversions to avoid overflow.
From-SVN: r13165
1996-11-15 10:20:53 -08:00
Richard Kenner
80906567f4 (operand_equal_p): Do real comparison with REAL_VALUES_EQUAL.
(make_range): Properly decide when to get TREE_TYPE of arg0.
Handle EXP being an INTEGER_CST at end.
(fold_range_test): Handle return of 0 from make_range.
(fold, case TRUTH_AND_EXPR): Handle first arg of 0.
(fold, case TRUTH_OR_EXPR): Handle first arg of 1.

From-SVN: r13163
1996-11-15 12:48:28 -05:00
Richard Kenner
4e644c93e0 (range_binop): Set SNG1 to zero if ARG1 is a not a lower or upper
bound.

From-SVN: r13161
1996-11-15 06:37:48 -05:00
Jim Wilson
405862dd6c (merge_ranges): In (+,-) case, treat subset specially
if lower bounds are the same.

From-SVN: r13127
1996-11-12 10:19:42 -08:00
Richard Kenner
9898deac71 (const_binop, case *_DIV_EXPR): Don't do special sizetype case if a
constant overflows.

From-SVN: r13106
1996-11-07 07:40:26 -05:00
Richard Kenner
0e1c7fc777 (make_range): Don't merge unsigned case with range containing upper bound;
instead merge just with zero and convert a range with no upper bound to
opposite one with no lower bound.
(merge_ranges): In (+,-) case, don't treat subset specially if the upper
bounds are the same; fix typo in others case here.

From-SVN: r13090
1996-11-01 09:49:54 -05:00
Jeff Law
3c00684e55 fold-const.c (make_range, [...]): Correct normalization of an unsigned range that wraps around zero.
* fold-const.c (make_range, case PLUS_EXPR): Correct
        normalization of an unsigned range that wraps around zero.

From-SVN: r13089
1996-10-31 20:10:33 -07:00
Richard Kenner
27bae8e571 (range_binop): Strip NOPs from result and verify it's an INTEGER_CST.
(make_range, case BIT_NOT_EXPR): Fix typo in constant for PLUS_EXPR.

From-SVN: r13079
1996-10-30 16:16:41 -05:00
Jeff Law
5df8a1f298 * fold-const.c (merge_ranges): Fix thinko/typo.
From-SVN: r13042
1996-10-27 15:17:12 -07:00
Jim Wilson
5a9d82a6df (make_range, case PLUS_EXPR): Normalize an unsigned
range that wraps around 0.

From-SVN: r13030
1996-10-24 12:08:23 -07:00
Richard Kenner
7f423031c0 (make_range, comparison cases): When making range for unsigned to
merge in, use full range.

From-SVN: r13027
1996-10-24 09:10:37 -04:00
Richard Kenner
39647dcba5 (exact_real_inverse): Likewise, if no REAL_ARITHMETIC.
(fold, case RDIV_EXPR): Turn divide by constant into multiplication by the
reciprocal, if optimizing and result is exact.

From-SVN: r13004
1996-10-23 10:20:45 -04:00
Doug Evans
239c95d346 fold-const.c (make_range): Handle NULL operand 0 (like in BIND_EXPRs).
* fold-const.c (make_range): Handle NULL operand 0
	(like in BIND_EXPRs).

From-SVN: r12957
1996-10-12 04:06:11 +00:00
Richard Kenner
ebde8a2754 (range_test): Function deleted.
(range_binop, make_range, build_range_check): New functions.
(merge_ranges, fold_range_test): Likewise.
(fold_truthop): No longer call range_test.
(fold, case TRUTH_{AND,OR}{,IF}_EXPR): Call fold_range_test.

From-SVN: r12921
1996-10-09 05:48:36 -04:00
Richard Kenner
214d5b845f (const_binop): Add new arg, TYPE, to call to build_complex.
(fold, case CONJ_EXPR, COMPLEX_EXPR): Likewise.

From-SVN: r12865
1996-09-29 19:03:36 -04:00
Richard Kenner
903cb4d6f2 Fix error in comments.
From-SVN: r12773
1996-09-22 12:12:10 -04:00
Mike Stump
0f41302f47 formatting tweaks
From-SVN: r12390
1996-07-03 22:07:53 +00:00
Richard Kenner
5fd7f37d2e (fold): Don't do anything with evaluated SAVE_EXPR.
From-SVN: r12185
1996-06-06 18:21:16 -04:00
Richard Kenner
30eca39133 (fold, case EQ_EXPR): When folding VAR++ = CONST, mask the new const
if VAR is a bitfield reference; also for VAR--.

From-SVN: r11976
1996-05-16 18:53:14 -04:00
Jason Merrill
3ffcb234e7 (fold): Don't call convert to recreate tree nodes
we already have.

From-SVN: r11908
1996-04-30 21:27:32 +00:00
Richard Kenner
700ad580a6 (range_test): Don't convert hi_cst or lo_cst to unsigned when folding
signed range tests.

From-SVN: r11768
1996-04-14 18:49:18 -04:00
Richard Kenner
7cb6a121f2 (fold_convert): Add new arg to REAL_VALUE_FROM_INT.
From-SVN: r11766
1996-04-14 08:55:37 -04:00
Richard Kenner
65d8b1ce9f (fold, case BIT_IOR_EXPR): Recognize rotates with variable count.
From-SVN: r11614
1996-03-25 18:48:05 -05:00
Richard Kenner
d011fbf978 (fold, case *_DIV_EXPR): Ignore SAVE_EXPR if has RTL.
From-SVN: r11400
1996-03-02 08:04:30 -05:00
Richard Kenner
15c577a80f (left_shift_overflows): Remove; unused.
From-SVN: r11021
1996-01-16 08:56:11 -05:00
Richard Kenner
36102b210e (const_binop): Strip NOPS from both args.
From-SVN: r11019
1996-01-16 08:42:19 -05:00
Richard Kenner
a377ff85d0 (fold_convert): When converting a NaN to another type, change the type
of the node before returning it.

From-SVN: r10863
1995-12-26 21:52:06 -05:00
Richard Kenner
0c9cabe7d4 (fold): Don't record overflow when negating unsigned constants.
From-SVN: r10779
1995-12-16 08:30:58 -05:00
Richard Kenner
10fa1ee296 (div_and_round_double): Change carry', quo_est', and `scale' from
plain int to `unsigned HOST_WIDE_INT'.

From-SVN: r10367
1995-09-15 18:26:36 -04:00
Richard Kenner
023c7f6348 (size_binop): Don't pass 1 to NOTRUNC.
From-SVN: r10306
1995-09-03 09:03:38 -04:00
Richard Kenner
410d3f5de9 (fold, case CONVERT_EXPR): Don't merge conversions if outer is to
handle a type with differing precision.

From-SVN: r10145
1995-07-18 19:02:49 -04:00
Richard Kenner
d4453ee5ef (decode_field_reference): New parm PAND_MASK.
(unextend): New parm MASK.
(fold_truthop): Pass new parms to decode_field_reference and unextend.

From-SVN: r10098
1995-07-01 10:12:02 -04:00
Richard Kenner
2dfd595d54 (fold_truthop): Commute unextend and convert on l_const and r_const.
From-SVN: r10065
1995-06-27 19:09:37 -04:00
Richard Kenner
a35311b035 Update FSF address.
From-SVN: r9961
1995-06-15 07:52:21 -04:00
Richard Kenner
21403f14b2 (fold): When converting a COND_EXPR to an ABS_EXPR, get the types
right for ABS_EXPR to work.

From-SVN: r9939
1995-06-13 18:32:39 -04:00
Richard Kenner
3d1877b127 (lshift_double): Replace &' with %' to fix typo.
(lshift_double, rshift_double): Truncate shift count only if
SHIFT_COUNT_TRUNCATED.  Remove unnecessary `count >= prec' test.

From-SVN: r9917
1995-06-09 19:29:17 -04:00
Richard Kenner
25216284b0 (fold): When folding `<' type nodes, make true_value and false_value
have correct types.

From-SVN: r9899
1995-06-07 17:17:08 -04:00
Jason Merrill
1180eb1042 *** empty log message ***
From-SVN: r9801
1995-05-24 19:41:29 +00:00
Richard Kenner
a25ee33216 (invert_truthvalue, case CLEANUP_POINT_EXPR): New case.
From-SVN: r9735
1995-05-17 17:44:45 -04:00
Richard Kenner
9faa82d8c0 Fix typos in comments.
From-SVN: r9712
1995-05-16 08:39:54 -04:00
Richard Kenner
7cd5f0b28f (const_binop): Don't pass OVERFLOW to force_fit_type if type is
unsigned.

From-SVN: r9694
1995-05-15 19:01:31 -04:00
Jason Merrill
0982a4b872 *** empty log message ***
From-SVN: r9623
1995-05-11 19:25:36 +00:00
Mike Stump
a69e1f6afc small tweak
From-SVN: r9566
1995-05-02 21:54:39 +00:00
Mike Stump
122977b9df fold-const.c (fold): Ensure that we don't alter the expression's type when folding CLEANUP_POINT_EXPRs.
* fold-const.c (fold): Ensure that we don't alter the expression's
        type when folding CLEANUP_POINT_EXPRs.

From-SVN: r9563
1995-05-02 19:39:17 +00:00
Richard Kenner
4d39710e8e ([lr]rotate_double): Replace; old versions were bogus.
(fold, shift and rotate): Don't call tree_int_cst_sgn on non-integer.
(fold, case LROTATE_EXPR): If constant count, convert to RROTATE_EXPR.
(fold, case RROTATE_EXPR): Sometimes commute logical op with rotate.
Delete pair of counteracting shifts.

From-SVN: r9425
1995-04-21 08:03:23 -04:00
Richard Kenner
a07a2d17c5 (size_int): Arg is unsigned HOST_WIDE_INT.
From-SVN: r9406
1995-04-18 06:19:35 -04:00
Richard Kenner
a7a0564039 (force_fit_type): Always propagate OVERFLOW.
From-SVN: r9138
1995-03-08 17:49:48 -05:00
Richard Kenner
021035770a (decode_field_reference): Don't check TREE_CODE of EXP; let get_inner_reference decide if have reference.
(decode_field_reference): Don't check TREE_CODE of EXP; let
get_inner_reference decide if have reference.
Allow no bit reference if have AND_MASK.
(all_ones_mask_p): Use tree_int_cst_equal, not operand_equal_p.
(unextend): New function.
(fold_truthop): For constant cases, use new function, rework
conversion, and warn if comparison can never be true.

From-SVN: r9099
1995-03-01 06:48:17 -05:00
Jason Merrill
56c98e5b32 Support CLEANUP_POINT_EXPRs.
From-SVN: r9034
1995-02-22 17:35:09 +00:00
Richard Kenner
cd7ece6611 (fold): Don't modify tree with newly-allocated nodes; instead make new
tree in those cases.

From-SVN: r8901
1995-02-10 14:54:54 -05:00
Jason Merrill
e9866da310 (pedantic_non_lvalue): Check pedantic_lvalues instead of pedantic.
From-SVN: r8765
1995-01-17 21:43:40 +00:00
Richard Kenner
3a96b5ebb4 (fold, case COND_EXPR): Properly swap args 1 and 2.
Strip nops from ARG2, just like ARG1.
Make {MIN,MAX}_EXPR properly when type of result different than args.

From-SVN: r8745
1995-01-13 19:16:09 -05:00
Richard Kenner
7f0b305c5a (fold): Avoid infinite recursion caused by last change.
From-SVN: r8730
1995-01-10 05:49:13 -05:00
Richard Kenner
7e13907585 (fold, case CONVERT_EXPR): Don't remove an integer conversion when outer is FP unless it doesn't change signedness...
(fold, case CONVERT_EXPR): Don't remove an integer conversion when
outer is FP unless it doesn't change signedness; rework code in this
area to be clearer.

From-SVN: r8724
1995-01-07 08:51:14 -05:00
Richard Kenner
4ab3cb6597 (pedantic_omit_one_operand): New function.
(fold, case COND_EXPR): Use it instead of calling pedantic_non_lvalue on the
result of omit_one_operand.

From-SVN: r8641
1994-12-10 16:05:49 -05:00
Doug Evans
68c6b3a925 (fold): Call real_zerop for real constants.
From-SVN: r8634
1994-12-09 21:06:03 +00:00
Richard Kenner
db40b434fa (fold_truthop): Delete BIT_AND_EXPR of constants with masks.
From-SVN: r8592
1994-11-30 19:02:39 -05:00
Richard Kenner
e33745253e (fold_convert): Don't fold conversion if it would produce constant
larger than we can support.

From-SVN: r8551
1994-11-22 17:40:46 -05:00
Ian Lance Taylor
f76b9db287 Check target endianness at run time, not compile time
From-SVN: r8470
1994-11-16 21:10:09 +00:00
Richard Kenner
e1f56f62a0 (fold): If moved conversion into COND_EXPR, leave it there if it is an integral conversion to word or narrower.
(fold): If moved conversion into COND_EXPR, leave it there if it is an
integral conversion to word or narrower.
(fold, case NOP_EXPR): Ignore conversion to same type as operand.
(fold, case COND_EXPR): Make third operand the simplest.

From-SVN: r8467
1994-11-16 07:55:26 -05:00
Jason Merrill
3ac4f0e6d0 (fold, COMPONENT_REF): Don't die if the CONSTRUCTOR
doesn't initialize the field we want.

From-SVN: r8223
1994-10-05 23:08:12 +00:00
Jason Merrill
e082358bff (fold): Handle COMPONENT_REFs involving CONSTRUCTORs.
From-SVN: r8095
1994-09-20 00:32:29 +00:00
Richard Kenner
7106180777 Fix typo.
From-SVN: r7840
1994-07-30 19:01:48 -04:00
Richard Kenner
474636f3e8 (fold_truthop): Apply masks to constants.
From-SVN: r7839
1994-07-30 18:18:55 -04:00
Jim Wilson
59d9021293 (fold): Don't fold X-X to 0 if X is floating point
and !flag_fast_math.

From-SVN: r7786
1994-07-21 14:46:32 -07:00
Richard Kenner
6d9f1f5f63 (decode_field_reference): Merge operand of a BIT_AND_EXPR with the
mask made from the description of the field.

From-SVN: r7766
1994-07-13 14:44:38 -04:00
Richard Kenner
8f03b1af61 Remove last change.
From-SVN: r7764
1994-07-13 08:40:00 -04:00
Richard Kenner
78221d63e7 (fold, case MULT_EXPR): If arg is an unsigned CEIL_DIV_EXPR, convert
to TRUNC_DIV_EXPR of a PLUS_EXPR in some cases.

From-SVN: r7744
1994-07-12 12:39:17 -04:00
Torbjorn Granlund
dbb5b3cec9 (div_and_round_double): Make it globally accessible.
From-SVN: r7594
1994-06-29 00:20:58 +00:00
Torbjorn Granlund
e627f0b601 Revert last patch: (fold, case *_DIV_EXPR): Optimize (x / C << y)...
From-SVN: r7475
1994-06-15 02:29:07 +00:00
Torbjorn Granlund
37bdb7e314 (encode, decode): Use 4 HOST_WIDE_INTs for encoded value with HOST_BITS_PER_WIDE_INT/2 bits in each.
(encode, decode): Use 4 HOST_WIDE_INTs for encoded
value with HOST_BITS_PER_WIDE_INT/2 bits in each.
(LOWPART, HIGHPART): New macros.
(BASE): Move definition outside of div_and_round_double.
(add_double, mul_double, lshift_double, rshift_double): Rewrite.
(lrotate_double): Use LOWPART, HIGHPART, and BASE.
(rrotate_double): Likewise.
(div_and_round_double): Major changes to code for general case.
Now it actually produces non-garbage results for large operands.
(div_and_round_double): Simplify condition for special code used when
divisor < BASE.
(const_binop): Delete special cases for multiplying by 0, 1, 2, 4, 8.
(fold, case *_DIV_EXPR): Don't try to optimize for overflow.

From-SVN: r7473
1994-06-15 02:23:14 +00:00
Richard Kenner
4c9a05bc55 Cast pointer operands to bzero, bcopy, and bcmp to (char *).
From-SVN: r7472
1994-06-14 18:19:28 -04:00
Richard Kenner
4b8a006289 (fold-convert): Use assignment, instead of initializing, aggregate
local variable REAL_VALUE_TYPE.

From-SVN: r7146
1994-04-25 06:33:38 -04:00
Richard Kenner
5f61007448 (const_binop): If arg is NaN, just return it
(const_binop): If arg is NaN, just return it
(fold_convert): Handle NaN in real->int and real->real cases.

From-SVN: r7072
1994-04-18 15:41:06 -04:00
Richard Kenner
4c64b88406 (fold): Avoid exponential work when simplifying conditional
expressions; don't recurse twice if ARG1 is constant.

From-SVN: r7010
1994-04-09 16:05:15 -04:00
Richard Kenner
34b1b41f3b Fix typo in comment of last change.
From-SVN: r7000
1994-04-08 18:35:23 -04:00
Richard Kenner
e92d30482e (fold, case GT_EXPR): Simplify X < (1 << Y) into X >> Y == 0.
From-SVN: r6999
1994-04-08 18:18:08 -04:00
Richard Kenner
b5f3b6b60b (strip_compound_expr): New function.
(fold): Call it; avoid exponential work when simplifying binary op over
a COND_EXPR.

From-SVN: r6921
1994-03-30 16:59:47 -05:00
Richard Kenner
3122945e76 (fold, case *_DIV_EXPR): Correct result when product of constants
overflows.

From-SVN: r6900
1994-03-25 16:12:56 -05:00
Richard Kenner
79c844cdca (const_binop): Avoid initialized aggregate local variables, for
antique compilers.

From-SVN: r6821
1994-03-19 06:25:26 -05:00
Richard Kenner
e9aaa5a553 (fold, associate): If -ffast-math, associate FP mults.
(fold, case RDIV_EXPR): Split case; ignore division by 1.
If -ffast-math, convert to multply by reciprocal.
(fold, case *_DIV_EXPR): Simplify A/C1/C2.

From-SVN: r6780
1994-03-14 06:18:52 -05:00
Richard Kenner
d0cb4c6591 (fold): Call tree_int_cst_sgn.
(fold, case *_DIV_EXPR): Add missing conversion.

From-SVN: r6779
1994-03-14 05:11:28 -05:00
Richard Kenner
649ff3b44f (force_fit_value): Operate on REAL_CST as well.
(real_value_truncate): Don't use its own handler.
(const_binop): Set overflow on FP error and call force_fit_type.
(fold_convert): Likewise.

From-SVN: r6768
1994-03-13 08:30:50 -05:00
Richard Kenner
b9b5c1b376 (fold, case MULT_EXPR): Simplify MULT_EXPR of an EXACT_DIV_EXPR with
the same divisor as our multiplicand.

From-SVN: r6734
1994-03-09 16:50:25 -05:00
Richard Kenner
58633be8f3 (const_binop, COMPLEX_TYPE, case RDIV_EXPR): If complex integer, use
TRUNC_DIV_EXPR for inner division.

From-SVN: r6468
1994-02-02 15:14:18 -05:00
Richard Kenner
7a75868d8e (operand_equal_for_comparison_p): Declare correct_width as unsigned.
From-SVN: r6447
1994-01-31 18:40:54 -05:00
Richard Kenner
e9b5e15f60 (fold, truth_andor): Don't apply distributive law when it would change evaluation order.
(fold, truth_andor): Don't apply distributive law when it would change
evaluation order.
Clean up code a bit to improve flow.

From-SVN: r6381
1994-01-11 19:14:18 -05:00
Richard Kenner
61f275ffe7 (truth_value_p): New function.
(fold): Use it to see when we should make a TRUTH_{AND,OR}_EXPR.
(fold, case TRUTH_{AND,OR,ANDIF,ORIF}_EXPR): Use distributive law on
expressions such as (A && B) || (A && C).

From-SVN: r6352
1994-01-03 07:59:59 -05:00
Richard Kenner
996c63d336 (fold, case PLUS_EXPR): Add a missing test of flag_fast_math.
From-SVN: r6341
1993-12-29 18:04:48 -05:00
Richard Kenner
fab446b8c3 (fold): Simplify more FP ops if -ffast-math.
From-SVN: r6335
1993-12-27 08:48:58 -05:00
Richard Kenner
95aa28ae18 (fold...
(fold, case EQ_EXPR, NE_EXPR): If COMPLEX_TYPE and at least one arg is
a COMPLEX_EXPR, split into a logical operation on the real and
imaginary parts.

From-SVN: r6313
1993-12-25 08:52:25 -05:00
Richard Kenner
aae678414b (fold, case *_{DIV,MOD}_EXPR): When using distributive law, take care
when C2 is negative.

From-SVN: r6194
1993-12-08 05:46:16 -05:00
Richard Stallman
2315a5db38 (twoval_comparison_p): Do nothing for SAVE_EXPR, at least for now.
From-SVN: r6090
1993-11-15 00:25:53 +00:00
Richard Stallman
dfa90b4271 (invert_truthvalue): Handle SAVE_EXPR.
From-SVN: r5797
1993-10-19 02:50:50 +00:00
Richard Kenner
9f5e873c8f (optimize_bit_field_compare, decode_field_reference): Don't do
anything if get_inner_reference returned its argument.

From-SVN: r5773
1993-10-13 15:14:21 -04:00
Richard Kenner
cc5edac673 (fold, case PLUS_EXPR, MINUS_EXPR): Properly handle case when ARG1
splits and VARSIGN is -1.

From-SVN: r5537
1993-09-30 05:53:43 -04:00
Per Bothner
efc1a4d9b4 (invert_truthvalue): Allow arbitrary BOOLEAN_TYPE arguments.
From-SVN: r5351
1993-09-17 21:43:29 -07:00
Richard Kenner
ac27d58987 (fold): Don't try to process an RTL_EXPR.
From-SVN: r5274
1993-09-07 14:32:05 -04:00
Richard Kenner
35e66bd1d9 (twoval_comparison_p): Add new arg, SAVE_P; all callers changed.
(fold, case EQ_EXPR): If SAVE_P is true after call to twoval_comparison_p
call save_expr on the expression we make.

From-SVN: r5194
1993-08-23 18:33:11 -04:00
Richard Kenner
2df46b06a2 (fold): Handle EQ_EXPR and NE_EXPR where both args are comparisons or
BIT_AND_EXPR with constant 1.

From-SVN: r5186
1993-08-19 08:28:38 -04:00
Richard Kenner
79bf94d3ea (fold...
(fold, case EQ_EXPR): Re-enable converting signed MOD operations to
unsigned when inside comparisons against zero, but only when the
second operand of the MOD is an integral power of two.

From-SVN: r5166
1993-08-16 18:47:39 -04:00
Richard Kenner
33558beb6a (fold...
(fold, case NOP_EXPR): Delete a pair of conversions back to the
original type when intermediate type is at least as wide.

From-SVN: r5046
1993-07-30 19:07:52 -04:00
Richard Kenner
9db73acb48 (optimize_bit_field_compare): Preserve volatility of bitfield.
From-SVN: r5005
1993-07-27 16:42:34 -04:00
Richard Kenner
e507581872 (fold, case EQ_EXPR): Remove code that converts mod to unsigned mod;
it isn't correct for negative operands.

From-SVN: r4995
1993-07-26 20:26:20 -04:00
Richard Stallman
551064b16e (fold): Handle CONJ_EXPR.
From-SVN: r4938
1993-07-18 20:24:45 +00:00
Jim Wilson
a5e9b1248c (fold, COND_EXPR case): All simplified results must go through pedantic_non_lvalue.
(fold, COND_EXPR case):  All simplified results
must go through pedantic_non_lvalue.
(pedantic_non_lvalue): New function.

From-SVN: r4867
1993-07-06 14:01:14 -07:00
Jim Wilson
8ac1abdf6a (invert_truthvalue): Check for ERROR_MARK input.
From-SVN: r4864
1993-07-06 13:48:51 -07:00
Richard Kenner
05a0d5eabb (fold, case EQ_EXPR, LE_EXPR): If comparing results of signed MOD with
zero, use an unsigned MOD.

From-SVN: r4852
1993-07-05 17:55:06 -04:00
Paul Eggert
dc3907c5c1 (const_binop, fold_convert, fold):
Set TREE_OVERFLOW in addition to TREE_CONSTANT_OVERFLOW.

From-SVN: r4828
1993-07-02 01:26:01 +00:00
Richard Kenner
56f8e5e67c (fold, case GE_EXPR, LT_EXPR): Don't assume result of comparison is
integer_type_node.

From-SVN: r4813
1993-07-01 09:48:11 -04:00
Richard Kenner
62d8b51eb2 (fold, case TRUTH_XOR_EXPR): End with return', not break'.
From-SVN: r4770
1993-06-27 18:48:22 -04:00
Richard Kenner
6a96fcb495 (fold, case PLUS_EXPR, MINUS_EXPR): Apply distributive law to multiplication.
(fold, case *_DIV_EXPR): Replace code to handle (A*C1)/C2 with more general
code to handle addition as well.
(fold, case *_MOD_EXPR): Add simplified version of above code.

From-SVN: r4757
1993-06-26 11:55:06 -04:00
Richard Kenner
6dc7571d06 Add prototypes for static functions.
({l,r}{shift,rotate}_double): COUNT arg is HOST_WIDE_INT, PREC is int.
(all_ones_mask): Remove __inline__.
(range_test): Make static; not used elsewhere.

From-SVN: r4750
1993-06-26 11:12:58 -04:00
Richard Kenner
96d4cf0ace (fold_truthop): Treat a BIT_AND_EXPR with a constant of one as if it were surrounded with an NE_EXPR.
(fold_truthop): Treat a BIT_AND_EXPR with a constant of one as if it were
surrounded with an NE_EXPR.
(fold): Don't move operation into conditional if it is BIT_{AND,OR}_EXPR with
the constant 1; change it to TRUTH_*_EXPR instead.
When moving things inside conditions, move comparisons as well as binary
operations.
Don't make a SAVE_EXPR when moving things inside conditionals unless the value
would really have been used twice.

From-SVN: r4746
1993-06-26 11:05:12 -04:00
Richard Kenner
772ae9f018 (decode_field_reference): Don't do anything for non-integral fields.
From-SVN: r4353
1993-05-06 05:45:47 -04:00
Richard Kenner
194c082fed (optimize_bit_field_compare): Add missing arg to const_binop.
From-SVN: r4344
1993-05-05 18:16:52 -04:00
Richard Kenner
b8a914304d (fold): Signedness matters for comparisons and right shifts.
From-SVN: r4243
1993-04-26 19:12:11 -04:00
Richard Kenner
7178e3af78 Use INTEGRAL_TYPE_P and FLOAT_TYPE_P.
From-SVN: r4241
1993-04-26 19:02:43 -04:00
Richard Kenner
a32793551e (fold...
(fold, case REALPART_EXPR, IMAGPART_EXPR): Avoid using
build_{unary,binary}_op since the calling sequences depend on the
front-end.

From-SVN: r4194
1993-04-23 06:55:07 -04:00
Richard Kenner
aa830baff1 (size_int): NUMBER is unsigned so don't test for negative.
(optimize_bit_field_compare, all_ones_mask_p): Add missing last arg to
force_fit_type call.

From-SVN: r4138
1993-04-13 17:16:37 -04:00
Richard Stallman
b1aa345d4f Comment change.
From-SVN: r4130
1993-04-13 20:33:27 +00:00
Richard Kenner
88ee26514d (div_and_round_double): Don't mix HOST_WIDE_INT * and unsigned
HOST_WIDE_INT * parameters; some compilers complain.

From-SVN: r4114
1993-04-13 06:07:59 -04:00
Jim Wilson
b76478952b (fold...
(fold, COMPOUND_EXPR case): When pedantic, don't
simplify a COMPOUND_EXPR, so that it won't be mistaken for an
lvalue or an integer constant expression.

From-SVN: r4103
1993-04-12 12:45:58 -07:00
Richard Stallman
5008b8ae95 (real_value_truncate): If REAL_ARITHMETIC, replace by routine of same name in real.c.
(real_value_truncate): If REAL_ARITHMETIC, replace
by routine of same name in real.c.
target_isinf, target_isnan, target_negative): Likewise.
(const_binop): Delete `register' from decls using REAL_VALUE_TYPE.
(fold_convert): Use REAL_VALUE_TO_INT.

From-SVN: r3939
1993-03-31 05:50:11 +00:00
Richard Kenner
ca86a57ae7 (fold, case PLUS_EXPR): Don't associate apart a constant operand.
From-SVN: r3807
1993-03-20 20:49:22 -05:00
Richard Stallman
88ece8db61 (const_binop): When evaluating a shift, ignore
overflows generated by force_fit_type.

From-SVN: r3700
1993-03-11 08:18:16 +00:00
Richard Stallman
a333b79fc5 (fold): Fix error in handling REALPART_EXPR and IMAGPART_EXPR.
From-SVN: r3644
1993-03-04 20:34:20 +00:00
Richard Stallman
1cc1b11a2e (fold): Handle complex constants as "winning".
Handle REALPART_EXPR and IMAGPART_EXPR.

From-SVN: r3637
1993-03-04 19:35:40 +00:00
Jim Wilson
ab314f6a6b (decode_field_reference): Fix force_fit_type call.
From-SVN: r3530
1993-02-25 11:31:18 -08:00
Richard Stallman
13af526d4f (all_ones_mask_p): Really use tmask.
(all_ones_mask_p): Declare tmask to be `tree'.
(optimize_bit_field_compare) Add missing semicolon.

(decode_field_reference): Use force_fit_type
instead of convert to avoid truncated integer warning.
(all_ones_mask_p): Likewise.

From-SVN: r3519
1993-02-24 06:43:37 +00:00
Doug Evans
5709eb48d8 (decode_field_reference): Use force_fit_type instead of convert to avoid truncated integer warning.
* (decode_field_reference): Use force_fit_type instead of convert to avoid
truncated integer warning.

From-SVN: r3501
1993-02-20 22:24:44 +00:00
Richard Stallman
ef2bf0c061 (fold): Call force_fit_type with two parameters.
(force_fit_type): Don't examine the tree until
it is known to an INTEGER_CST.  If it isn't, just return.

From-SVN: r3434
1993-02-07 17:24:37 +00:00
Richard Stallman
a4d8855c2a Comment fixes.
From-SVN: r3416
1993-02-02 23:38:03 +00:00
Richard Stallman
e0f776fbcb (same_sign): Removed.
(lshift_double): Don't report arithmetic overflow, since the
C standard doesn't seem to require it here.
(force_fit_type): Accept new parameter specifying whether a signed
overflow has already occurred.  Yield overflow indication.
All callers changed.
(neg_double): Don't report overflow when -0 yields 0.
(const_binop): Propagate operand overflow for warnings.
Don't report overflow when -1 + 1 yields 0.

From-SVN: r3401
1993-02-02 04:37:37 +00:00
Richard Stallman
42f769c15a (force_fit_type): Abort if T not INTEGER_CST.
From-SVN: r3387
1993-01-30 01:57:54 +00:00
Richard Stallman
d023bff9eb (non_lvalue): Result must not be null ptr constant.
(omit_one_operand): Use non_lvalue.
(fold, case COMPOUND_EXPR): Use non_lvalue if value is 0.

From-SVN: r3276
1993-01-19 15:09:12 +00:00
Brendan Kehoe
3d9a7827ed * fold-const.c (fold): Only call force_fit_type with one arg.
From-SVN: r3210
1993-01-12 18:30:21 -05:00
Richard Kenner
772447c5cf (invert_truthvalue, case TRUTH_XOR_EXPR): New case.
(fold, case TRUTH_XOR_EXPR): New case.
(fold, case TRUTH_OR_EXPR, TRUTH_AND_EXPR): Check for second operand
of appropriate value to determine result whether or not first operand
is a constant.

From-SVN: r2997
1992-12-30 06:13:24 -05:00
Richard Stallman
91d33e36a0 (const_binop): New arg NOTRUNC. All calls changed.
(size_binop): Pass 1 for NOTRUNC.
(force_fit_type): No longer static.

From-SVN: r2995
1992-12-30 11:09:07 +00:00
Richard Kenner
85d2e16cf7 (fold, case BIT_IOR_EXPR): Convert the IOR of a pair of shifts into a
rotate when it is equivalent.

From-SVN: r2970
1992-12-28 06:07:05 -05:00
Tom Wood
21431f802a (range_test): Convert the constants to the unsigned
type before expanding the range test.

From-SVN: r2785
1992-11-24 02:08:38 +00:00
Richard Stallman
d26d14f71a (real_value_truncate): Use push/pop_float_handler.
From-SVN: r2544
1992-10-21 21:21:25 +00:00
Richard Stallman
fced8ba341 (distribute_bit_expr): Test for BIT_{AND,IOR}_EXPR.
From-SVN: r2484
1992-10-16 02:49:07 +00:00
Richard Kenner
459a265325 (fold): Add missing test in case when we distribute a NOP_EXPR into a
COND_EXPR and try to pull it back out again.

From-SVN: r2476
1992-10-15 08:39:59 -04:00
Tom Wood
8227896cf6 (simple_operand_p): Don't regard global or static variables as simple.
(simple_operand_p): Don't regard global or static
	variables as simple.
	(fold_truthop): Only require the RHS to be simple.

From-SVN: r2473
1992-10-15 11:39:38 +00:00
Mike Stump
ca46db8715 Fix a simple typo.
From-SVN: r2368
1992-10-08 09:34:37 +00:00
Richard Stallman
3f78332988 (invert_truthvalue): Never alter ARG.
From-SVN: r2365
1992-10-08 08:30:25 +00:00
Richard Kenner
1f9dfb724b (fold_convert): Add missing cast to HOST_WIDE_INT.
From-SVN: r2218
1992-09-23 19:24:45 -04:00
Richard Stallman
b6b19f41c6 (fold_convert): Avoid using conversion of unsigned
to floating; offset value by hand to fit in signed type.

From-SVN: r2165
1992-09-19 19:00:40 +00:00
Richard Stallman
2a23183eba (convert_for_assignment): Warn about constant integer
overflow even if no conversion is involved.

From-SVN: r2075
1992-09-07 21:22:56 +00:00
Richard Stallman
2d7a4cf5cf (const_binop): Fix typo.
From-SVN: r2069
1992-09-07 06:06:12 +00:00
Richard Stallman
fe3e8e402b (left_shift_overflows, same_sign, overflow_sum_sign): New macros.
(add_double, div_and_round_double, lshift_double, mul_double):
(neg_double, const_binop, fold): Check for signed integer overflow.
Propagate overflow flags from operands to result.
(const_binop, fold_convert): Use pedwarn for overflow warnings.
Say `constant expression', not `constant folding', for user's sake.

From-SVN: r2053
1992-09-05 02:02:17 +00:00
Richard Stallman
812dd8a30d (const_binop): Delete special case for mult by 3.
From-SVN: r2002
1992-08-31 08:02:58 +00:00
Richard Stallman
53d2fb4f5f (fold): Do A op C1 ? A : C2 opt only for INTEGER_TYPEs.
From-SVN: r1965
1992-08-26 19:45:07 +00:00
Richard Stallman
1b81aa1493 (fold): Avoid the normal STRIP_NOPS on arg of NOP_EXPR.
From-SVN: r1959
1992-08-26 06:04:35 +00:00
Richard Kenner
b8eb43a245 (fold): Move conversion back outside of COND_EXPR if moving it inside
didn't help anything.

(div_and_round_double): Change some more ints to HOST_WIDE_INTs.

From-SVN: r1871
1992-08-17 07:36:10 -04:00
Torbjorn Granlund
858a47b165 Fix spelling errors in comments.
From-SVN: r1825
1992-08-14 11:33:04 +00:00
Richard Stallman
6a1746af42 (operand_equal_p): Make it clear that this function tests for indistinguishable values, not for equality as computed by `=='...
(operand_equal_p): Make it clear that this function
tests for indistinguishable values, not for equality as computed by
`=='; the distinction is important for IEEE NaNs and -0.0.

From-SVN: r1807
1992-08-12 07:43:50 +00:00
Richard Stallman
b5c525860d (fold): Don't fold (A op B ? A : C) if A is IEEE
floating point, because A might be -0.0 or NaN.

From-SVN: r1793
1992-08-11 08:33:24 +00:00
Richard Kenner
c0b9d4c816 (optimize_bit_field_compare): Correct bogus use of types in expressions...
(optimize_bit_field_compare): Correct bogus use of types in
expressions; always do computation in a type wide enough for the
result.

From-SVN: r1743
1992-08-02 21:31:25 -04:00
Richard Stallman
0924ddefb6 Renamed TREE_INLINE, TREE_NONLOCAL, TREE_REGDECL, TREE_EXTERNAL.
to DECL_INLINE, DECL_NONLOCAL, DECL_REGISTER, DECL_EXTERNAL.

From-SVN: r1570
1992-07-12 03:06:32 +00:00
Charles Hannum
9c0ae98b3a entered into RCS
From-SVN: r1522
1992-07-08 15:41:19 +00:00
Richard Kenner
906c4e36c6 *** empty log message ***
From-SVN: r1473
1992-07-06 16:04:13 -04:00
Richard Stallman
4b3d5ea0f5 *** empty log message ***
From-SVN: r1423
1992-07-04 16:44:05 +00:00
Richard Stallman
d35357ed3d *** empty log message ***
From-SVN: r1403
1992-07-03 20:11:05 +00:00
Tom Wood
b2215d835c *** empty log message ***
From-SVN: r1378
1992-07-01 20:55:32 +00:00
Richard Stallman
e6a28f2698 *** empty log message ***
From-SVN: r1359
1992-06-30 03:53:40 +00:00
Tom Wood
f59028696a *** empty log message ***
From-SVN: r1306
1992-06-27 10:21:04 +00:00
Tom Wood
ef659ec075 *** empty log message ***
From-SVN: r1301
1992-06-26 16:36:45 +00:00
Richard Kenner
42495ca044 *** empty log message ***
From-SVN: r1296
1992-06-26 07:06:07 -04:00
Richard Stallman
f72aed244a *** empty log message ***
From-SVN: r1263
1992-06-24 03:59:40 +00:00
Richard Stallman
5352b11a95 *** empty log message ***
From-SVN: r1232
1992-06-22 03:40:10 +00:00
Richard Stallman
68d884911e *** empty log message ***
From-SVN: r1153
1992-06-04 02:12:28 +00:00
Richard Kenner
3b998c11fb *** empty log message ***
From-SVN: r1079
1992-05-25 06:28:09 -04:00
Richard Stallman
7c7b029dab *** empty log message ***
From-SVN: r1070
1992-05-24 04:30:40 +00:00
Richard Stallman
a6acbe157b *** empty log message ***
From-SVN: r999
1992-05-17 07:07:44 +00:00
Richard Stallman
d8f6dbb911 *** empty log message ***
From-SVN: r968
1992-05-13 05:02:10 +00:00
Richard Stallman
f1e60ec6d5 *** empty log message ***
From-SVN: r951
1992-05-10 01:56:55 +00:00
Richard Stallman
6dc42e49d3 *** empty log message ***
From-SVN: r930
1992-05-07 06:41:23 +00:00
Richard Kenner
95ca4f9677 *** empty log message ***
From-SVN: r863
1992-04-30 23:15:40 -04:00
Tom Wood
13837058c1 *** empty log message ***
From-SVN: r815
1992-04-22 10:20:05 +00:00
Tom Wood
cdc54cc9f9 *** empty log message ***
From-SVN: r729
1992-04-12 14:34:57 +00:00
Richard Kenner
29ebe69a72 *** empty log message ***
From-SVN: r666
1992-04-02 06:03:52 -05:00
Richard Stallman
c05a9b68b8 *** empty log message ***
From-SVN: r664
1992-04-01 23:59:21 +00:00
Richard Stallman
7d4d4d22e4 *** empty log message ***
From-SVN: r563
1992-03-22 05:08:53 +00:00
Richard Kenner
ef9fe0da13 *** empty log message ***
From-SVN: r462
1992-03-13 08:58:47 -05:00
Richard Kenner
2002d72d90 *** empty log message ***
From-SVN: r371
1992-03-01 11:30:41 -05:00
Richard Stallman
6d716ca834 Initial revision
From-SVN: r330
1992-02-16 05:09:21 +00:00