+2007-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/34490
+ * simplify-rtx.c (simplify_const_relational_operation): If !sign,
+ don't reduce mmin/mmax using num_sign_bit_copies.
+
2007-12-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* doc/install.texi: Change recommended MPFR from 2.2.1 > 2.3.0.
else
{
rtx mmin_rtx, mmax_rtx;
- unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
get_mode_bounds (mode, sign, mode, &mmin_rtx, &mmax_rtx);
- /* Since unsigned mmin will never be interpreted as negative, use
- INTVAL (and an arithmetic right shift). */
- mmin = INTVAL (mmin_rtx) >> (sign_copies - 1);
- /* Since signed mmax will always be positive, use UINTVAL (and
- a logical right shift). */
- mmax = UINTVAL (mmax_rtx) >> (sign_copies - 1);
+ mmin = INTVAL (mmin_rtx);
+ mmax = INTVAL (mmax_rtx);
+ if (sign)
+ {
+ unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
+
+ mmin >>= (sign_copies - 1);
+ mmax >>= (sign_copies - 1);
+ }
}
switch (code)
+2007-12-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/34490
+ * gcc.c-torture/execute/20071216-1.c: New test.
+
2007-12-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-math-4.c: Remove XFAIL.
--- /dev/null
+/* PR rtl-optimization/34490 */
+
+extern void abort (void);
+
+static int x;
+
+int
+__attribute__((noinline))
+bar (void)
+{
+ return x;
+}
+
+int
+foo (void)
+{
+ long int b = bar ();
+ if ((unsigned long) b < -4095L)
+ return b;
+ if (-b != 38)
+ b = -2;
+ return b + 1;
+}
+
+int
+main (void)
+{
+ x = 26;
+ if (foo () != 26)
+ abort ();
+ x = -39;
+ if (foo () != -1)
+ abort ();
+ x = -38;
+ if (foo () != -37)
+ abort ();
+ return 0;
+}