From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88088 invoked by alias); 11 Dec 2017 17:06:14 -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 88078 invoked by uid 89); 11 Dec 2017 17:06:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=BAYES_00,GIT_PATCH_1,KAM_NUMSUBJECT,KAM_SHORT,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1939, company X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Dec 2017 17:06:12 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5092D356EB; Mon, 11 Dec 2017 17:06:11 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C29744D748; Mon, 11 Dec 2017 17:06:10 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vBBH6697023552; Mon, 11 Dec 2017 18:06:07 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vBBH64je023551; Mon, 11 Dec 2017 18:06:04 +0100 Date: Mon, 11 Dec 2017 17:06:00 -0000 From: Jakub Jelinek To: Kilian Verhetsel Cc: Richard Biener , Alan Hayward , GCC Patches , nd Subject: Re: [PATCH] Fix result for conditional reductions matching at index 0 Message-ID: <20171211170603.GN2353@tucnak> Reply-To: Jakub Jelinek References: <87zi7fbn07.fsf@uclouvain.be> <87wp2ib6aj.fsf@uclouvain.be> <20171208181501.GB2353@tucnak> <87po7lleh4.fsf@uclouvain.be> <20171211131134.GL2353@tucnak> <20171211135150.GM2353@tucnak> <87o9n5kxno.fsf@uclouvain.be> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87o9n5kxno.fsf@uclouvain.be> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00631.txt.bz2 On Mon, Dec 11, 2017 at 06:00:11PM +0100, Kilian Verhetsel wrote: > Jakub Jelinek writes: > > Of course it can be done efficiently, what we care most is that the body of > > the vectorized loop is efficient. > > That's fair, I was looking at the x86 assembly being generated when a single > vectorized iteration was enough (because that is the context in which I > first encountered this bug): > > int f(unsigned int *x, unsigned int k) { > unsigned int result = 8; > for (unsigned int i = 0; i < 8; i++) { > if (x[i] == k) result = i; > } > return result; > } > > where the vpand instruction this generates would have to be replaced > with a variable blend if the default value weren't 0 — although I had > not realized even SSE4.1 on x86 includes such an instruction, making > this point less relevant. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80631#c6 where I've attached so far untested prototype. If it is added before your patch makes it in, your patch would start by introducing another kind (say SIMPLE_INTEGER_INDUC_COND_REDUCTION) and would use that for the spots that are handled by the PR80631 patch as INTEGER_INDUC_COND_REDUCTION right now and your code for the rest. E.g. the above testcase with my patch, because i is unsigned and base is the minimum of the type is emitted as COND_REDUCTION, which is what your patch would improve. > > Another thing is, as your patch is quite large, we need a copyright > > assignment for the changes before we can accept it, see > > https://gcc.gnu.org/contribute.html for details. > > > > If you are already covered by an assignment of some company, please tell > > us which one it is, otherwise contact us and we'll get you the needed > > forms. > > I am not covered by any copyright assignment yet. Do I need to send you > any additional information? I'll send it offlist. Jakub