[Bug rtl-optimization/65235] [4.8/4.9/5 Regression] Simplifying vec_select of vec_concat miscompiles when first element of vec_concat is const_int
ktkachov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 27 16:20:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65235
--- Comment #2 from ktkachov at gcc dot gnu.org ---
(In reply to Aldy Hernandez from comment #1)
> Hi. The known to work field is empty. Is this a regression?
>
> I can't reproduce on a cross build to --target=aarch64-linux by running cc1.
> What options causes this to fail? Could you post a preprocessed file for
> the test?
-O2 does it for me. I didn't try anything earlier than 4.8 (since they're not
maintained) but the offending code has been there since 2005:
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3551) rtx vec =
trueop0;
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3552) int offset =
INTVAL (XVECEXP (trueop1, 0, 0)) * GET_MODE_SIZE (mode);
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3553)
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3554) /* Try to
find the element in the VEC_CONCAT. */
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3555) while
(GET_MODE (vec) != mode
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3556) &&
GET_CODE (vec) == VEC_CONCAT)
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3557) {
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3558)
HOST_WIDE_INT vec_size = GET_MODE_SIZE (GET_MODE (XEXP (vec, 0)));
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3559) if
(offset < vec_size)
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3560) vec =
XEXP (vec, 0);
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3561) else
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3562) {
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3563)
offset -= vec_size;
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3564) vec =
XEXP (vec, 1);
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3565) }
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3566) vec =
avoid_constant_pool_reference (vec);
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3567) }
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3568)
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3569) if (GET_MODE
(vec) == mode)
6516cbaf (bonzini 2005-12-16 09:24:19 +0000 3570) return vec;
and aarch64 wasn't there before 4.8...
More information about the Gcc-bugs
mailing list