https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126291
--- Comment #7 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:182f0056f5c137213eef3ba70f5ad885ddc55f9a commit r17-2532-g182f0056f5c137213eef3ba70f5ad885ddc55f9a Author: Philipp Tomsich <[email protected]> Date: Sun Jul 19 18:26:41 2026 +0200 match.pd: Make the (trunc)copysign(extend x, extend y) vector-safe [PR126291] The (convert (copysigns (convert@2 @0) (convert @1))) rules evaluate TYPE_PRECISION on the outer and inner types after only types_match, so a vectorized copysign chain like vect_1 = (vector(2) float) vect_0; vect_2 = (vector(2) float) vect_3; vect_4 = .COPYSIGN (vect_1, vect_2); vect_5 = (vector(2) double) vect_4; trips the vector_type tree check while gimple_simplify evaluates the guard (the ICE does not require the precision test to hold: evaluating TYPE_PRECISION on a vector type is what triggers it). Use element_precision, mirroring the abs fix. No equivalent of the target_supports_op_p check is needed here, since the existing direct_internal_fn_supported_p guard already handles vector types correctly. The REAL_CST variant cannot match vectors (a vector constant is a VECTOR_CST), but is converted as well for consistency. Bootstrapped and regtested on x86_64-pc-linux-gnu. PR tree-optimization/126291 gcc/ChangeLog: * match.pd ((trunc)copysign ((extend)x, (extend)y) -> copysign (x, y), (trunc)copysign ((extend)x, CST) -> copysign (x, CST)): Use element_precision. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr126291-2.c: New test.
