https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92908
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2019-12-11 CC| |jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Target Milestone|--- |10.0 Ever confirmed|0 |1 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- --- gcc/simplify-rtx.c.jj 2019-11-19 22:27:02.000058742 +0100 +++ gcc/simplify-rtx.c 2019-12-11 13:31:57.197809704 +0100 @@ -5037,6 +5037,23 @@ simplify_relational_operation (enum rtx_ return NULL_RTX; #endif } + if (VECTOR_MODE_P (cmp_mode) + && SCALAR_INT_MODE_P (mode) + && tem == const_true_rtx) + { + /* Vector comparisons that expect a scalar integral + bitmask. For const0_rtx the result is already correct, + for const_true_rtx we need all bits set. */ + int n_elts; + scalar_int_mode smode = as_a <scalar_int_mode> (mode); + gcc_assert (GET_MODE_NUNITS (cmp_mode).is_constant (&n_elts) + && GET_MODE_PRECISION (smode) <= n_elts); + if (GET_MODE_PRECISION (smode) == n_elts) + return constm1_rtx; + if (n_elts < HOST_BITS_PER_WIDE_INT) + return GEN_INT ((HOST_WIDE_INT_1U << n_elts) - 1); + return NULL_RTX; + } return tem; } @@ -5383,7 +5400,7 @@ comparison_result (enum rtx_code code, i } /* Check if the given comparison (done in the given MODE) is actually - a tautology or a contradiction. If the mode is VOID_mode, the + a tautology or a contradiction. If the mode is VOIDmode, the comparison is done in "infinite precision". If no simplification is possible, this function returns zero. Otherwise, it returns either const_true_rtx or const0_rtx. */ fixes this.