GCC with patches for OS216
Revision | 57a26c8c98d68fb6569e67850125ef65e1f359ba (tree) |
---|---|
Time | 2018-04-02 06:21:07 |
Author | Andrew Macleod <amacleod@gcc....> |
Commiter | Andrew Macleod |
Dont wind back thru divide yet
From-SVN: r258999
@@ -1061,7 +1061,7 @@ operator_divide::op1_irange (irange& r ATTRIBUTE_UNUSED, | ||
1061 | 1061 | // a_7 = a_6 / 4 |
1062 | 1062 | // if a_7 is [4,4], a_6 is actually [16,19] so ranges are trickier to |
1063 | 1063 | // calulate. |
1064 | - if (op2.singleton_p (offset) && op_rr (OPM_MUL, r, lhs, op2)) | |
1064 | + if (0 & op2.singleton_p (offset) && op_rr (OPM_MUL, r, lhs, op2)) | |
1065 | 1065 | { |
1066 | 1066 | wide_int ub, lb; |
1067 | 1067 | bool lb_ov = false, ub_ov = false; |
@@ -1075,10 +1075,26 @@ operator_divide::op1_irange (irange& r ATTRIBUTE_UNUSED, | ||
1075 | 1075 | offset = wi::sub (offset, 1, sign, &ub_ov); |
1076 | 1076 | lb = r.lower_bound (); |
1077 | 1077 | ub = r.upper_bound (); |
1078 | + | |
1078 | 1079 | if (wi::le_p (lb, 0, sign)) |
1079 | - lb = wi::sub (lb, offset, sign, &lb_ov); | |
1080 | + { | |
1081 | + lb = wi::sub (lb, offset, sign, &lb_ov); | |
1082 | + if (lb_ov) | |
1083 | + { | |
1084 | + lb = wi::min_value (TYPE_PRECISION (type), sign); | |
1085 | + lb_ov = false; | |
1086 | + } | |
1087 | + | |
1088 | + } | |
1080 | 1089 | if (wi::ge_p (ub, 0, sign)) |
1081 | - ub = wi::add (ub, offset, sign, &ub_ov); | |
1090 | + { | |
1091 | + ub = wi::add (ub, offset, sign, &ub_ov); | |
1092 | + if (ub_ov) | |
1093 | + { | |
1094 | + ub = wi::max_value (TYPE_PRECISION (type), sign); | |
1095 | + ub_ov = false; | |
1096 | + } | |
1097 | + } | |
1082 | 1098 | add_to_range (r, lb, lb_ov, ub, ub_ov); |
1083 | 1099 | if (!r.overflow_p ()) |
1084 | 1100 | return true; |