diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a92c3a5b5e0..4d113af985d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-04 Segher Boessenkool + + PR rtl-optimization/60818 + * simplify-rtx.c (simplify_binary_operation_1): Do not replace + a compare of comparisons with the thing compared if this results + in a different machine mode. + 2017-04-03 Jonathan Wakely * alias.c (base_alias_check): Fix typo in comment. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 640ccb7cb95..cff7e4d3e3f 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2306,10 +2306,10 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode, return xop00; if (REG_P (xop00) && REG_P (xop10) - && GET_MODE (xop00) == GET_MODE (xop10) && REGNO (xop00) == REGNO (xop10) - && GET_MODE_CLASS (GET_MODE (xop00)) == MODE_CC - && GET_MODE_CLASS (GET_MODE (xop10)) == MODE_CC) + && GET_MODE (xop00) == mode + && GET_MODE (xop10) == mode + && GET_MODE_CLASS (mode) == MODE_CC) return xop00; } break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4a05eba88b9..9ac0c0b8dc9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-04 Segher Boessenkool + + PR rtl-optimization/60818 + * gcc.c-torture/compile/pr60818.c: New testcase. + 2017-04-03 Jonathan Wakely * g++.old-deja/g++.benjamin/scope02.C: Fix typo in comment. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr60818.c b/gcc/testsuite/gcc.c-torture/compile/pr60818.c new file mode 100644 index 00000000000..b6171bbcdf0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr60818.c @@ -0,0 +1,5 @@ +int +lx (int oi, int mb) +{ + return (oi < mb) < (mb < oi); +}