This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix result for conditional reductions matching at index 0
- From: Kilian Verhetsel <kilian dot verhetsel at uclouvain dot be>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, Alan Hayward <Alan dot Hayward at arm dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Mon, 11 Dec 2017 18:00:11 +0100
- Subject: Re: [PATCH] Fix result for conditional reductions matching at index 0
- Authentication-results: sourceware.org; auth=none
- Dkim-filter: OpenDKIM Filter v2.9.2 smtp6.sgsi.ucl.ac.be 76B8A67DBED
- References: <87d14brhj6.fsf@uclouvain.be> <CAFiYyc3VrW4bVB9WXQ4yMhPRn_FpV6T3vAA=6YLVi5CdZopHEg@mail.gmail.com> <87zi7fbn07.fsf@uclouvain.be> <CAFiYyc2GcuaKcD8XgfT0XkFd=gCRFiaM=eHMXFTK1P1Ct4rWzw@mail.gmail.com> <E4166ABC-97D0-4A48-B1C6-5EAB06CC1979@arm.com> <CAFiYyc2jzbC4x-h=+8ksNz4Oc90U4XMqrhqNHnwf+Tj=84Vckg@mail.gmail.com> <87wp2ib6aj.fsf@uclouvain.be> <20171208181501.GB2353@tucnak> <87po7lleh4.fsf@uclouvain.be> <20171211131134.GL2353@tucnak> <20171211135150.GM2353@tucnak>
Jakub Jelinek <jakub@redhat.com> 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.
> Thanks, it applies cleanly now
> > + else if ((STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) == COND_REDUCTION
> > + || (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
> > + == INTEGER_INDUC_COND_REDUCTION))
> > + && reduc_fn == IFN_LAST)»
>
> contains a character at the end of line that makes it not to compile.
My bad, I must have added this when I opened the patch file itself to
inspect it...
> 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?