https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126291

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Philipp Tomsich <[email protected]>:

https://gcc.gnu.org/g:6d5d980f76c3057cc90b1343a679e7eea3ad2a50

commit r17-2530-g6d5d980f76c3057cc90b1343a679e7eea3ad2a50
Author: Philipp Tomsich <[email protected]>
Date:   Thu Jul 16 06:45:03 2026 +0200

    match.pd: Make the (trunc)abs(extend x) guard vector-safe [PR126291]

    The (convert (abs (convert@1 @0))) -> (abs @0) rule added by
    r17-2276-ge2c4fc6b1cff evaluates TYPE_PRECISION on the outer and inner
types
    after only types_match, so a vectorized abs-of-narrowed chain like

      vect_1 = (vector(2) int) vect_0;
      vect_2 = ABS_EXPR <vect_1>;
      vect_3 = (vector(2) signed long) vect_2;

    trips the vector_type tree check when gimple_simplify visits the
    outer conversion (ICE during fre). Use element_precision
    so the guard is evaluable for vectors, and require target support
    for ABS on the narrow vector type before enabling the transform
    there.

    Bootstrapped and regtested on aarch64-unknown-linux-gnu,
x86_64-pc-linux-gnu
    and riscv64-unknown-linux-gnu.

            PR tree-optimization/126291

    gcc/ChangeLog:

            * match.pd ((trunc)abs (extend x) -> abs (x)): Use
            element_precision. Require target ABS support for the
            vector case.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/pr126291.c: New test.

Reply via email to