From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30772 invoked by alias); 4 Mar 2015 11:05:44 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 30753 invoked by uid 89); 4 Mar 2015 11:05:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Mar 2015 11:05:42 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by service87.mimecast.com; Wed, 04 Mar 2015 11:05:40 +0000 Received: from [10.2.207.50] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 4 Mar 2015 11:05:39 +0000 Message-ID: <54F6E702.5070709@arm.com> Date: Wed, 04 Mar 2015 11:05:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Eric Botcazou Subject: Re: [PATCH][simplify-rtx] PR 65235: Calculate element size correctly when simplifying (vec_select (vec_concat (const_int) (...)) [...]) References: <54F6D239.2010902@arm.com> In-Reply-To: X-MC-Unique: 115030411054017901 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00199.txt.bz2 On 04/03/15 10:41, Marc Glisse wrote: > On Wed, 4 Mar 2015, Kyrill Tkachov wrote: > >> Hi all, >> >> This patch fixes PR rtl-optimization 65235. >> As mentioned in bugzilla: >> Combine tries to combine: >> (insn 72 71 73 2 (set (reg:V2DI 117 [ D.18177 ]) >> (vec_concat:V2DI (reg:DI 176 [ D.18179 ]) >> (reg:DI 114 [ D.18168 ]))) >> (expr_list:REG_DEAD (reg:DI 176 [ D.18179 ]) >> (expr_list:REG_DEAD (reg:DI 114 [ D.18168 ]) >> >> and >> >> (insn 104 102 105 2 (set (reg:DI 193 [ D.18168 ]) >> (vec_select:DI (reg:V2DI 117 [ D.18177 ]) >> (parallel [ >> (const_int 0 [0]) >> ]))) >> (expr_list:REG_DEAD (reg:V2DI 117 [ D.18177 ]) >> (nil))) >> >> but ends up generating: >> (set (reg:DI 193 [ D.18168 ]) >> (reg:DI 114 [ D.18168 ])) >> >> >> that is, it gets the wrong element of the vec_concat. >> >> The problem is that in simplify-rtx it tries to get the size of the >> first element, compare the requested offset against it and pick the >> second element if the offset is greater than that size. If the first >> element is a const_int, the size is 0, so it will always pick the second >> part. > I am a bit surprised that the first element is a const_int and not reg > 176, maybe that's why it doesn't reproduce on other platforms? Not that it > really matters. Yeah, I guess combine tries various whacky combinations when it's trying to munge things together. > >> The patch fixes that by calculating the size of the first element by >> taking the size of the outer mode and subtracting the size of the second >> element. > I wonder if we should admit that vector sizes are always a power of 2 and > use half the size of the outer mode? Perhaps. I tried to be as defensive as possible since I'm not sure what=20 the restrictions are on vec_select+vec_concat combinations. Kyrill > >> I've added an assert to make sure that the second element is not also a >> const_int, as a vec_concat of const_ints doesn't make sense as far as I >> can see.