Commit Graph

937 Commits

Author SHA1 Message Date
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