From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78207 invoked by alias); 27 Feb 2015 15:35:19 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 78164 invoked by uid 48); 27 Feb 2015 15:35:16 -0000 From: "ktkachov at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [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 Date: Fri, 27 Feb 2015 16:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ktkachov at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ktkachov at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg03090.txt.bz2 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...