This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Boolean Vector, patch 1/5] Introduce boolean vector to be used as a vector comparison type
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Andreas Schwab <schwab at suse dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Jeff Law <law at redhat dot com>
- Date: Fri, 23 Oct 2015 14:12:40 +0300
- Subject: Re: [Boolean Vector, patch 1/5] Introduce boolean vector to be used as a vector comparison type
- Authentication-results: sourceware.org; auth=none
- References: <20151002135921 dot GE26618 at msticlxl57 dot ims dot intel dot com> <mvmbnbrmcrw dot fsf at hawking dot suse dot de> <CAMbmDYb9MhPrrs+L50XAQA8N_aYvd+TACEQ-BFbRtduPjH7V+g at mail dot gmail dot com> <mvm7fmfmbnv dot fsf at hawking dot suse dot de> <20151022162105 dot GB23452 at msticlxl57 dot ims dot intel dot com> <CAFiYyc3aRo-=kW-qD3xCaCkTVkJ=Zbaq-pZhvAd7XJo=QSpsxg at mail dot gmail dot com>
On 23 Oct 11:40, Richard Biener wrote:
> On Thu, Oct 22, 2015 at 6:21 PM, Ilya Enkovich <enkovich.gnu@gmail.com> wrote:
> > On 22 Oct 12:37, Andreas Schwab wrote:
> >> Ilya Enkovich <enkovich.gnu@gmail.com> writes:
> >>
> >> > 2015-10-22 13:13 GMT+03:00 Andreas Schwab <schwab@suse.de>:
> >> >> FAIL: gcc.c-torture/compile/pr54713-1.c -O0 (internal compiler error)
> >> >
> >> > Can't reproduce it on i386. What's config used?
> >>
> >> http://gcc.gnu.org/ml/gcc-testresults/2015-10/msg02350.html
> >> http://gcc.gnu.org/ml/gcc-testresults/2015-10/msg02361.html
> >> http://gcc.gnu.org/ml/gcc-testresults/2015-10/msg02396.html
> >>
> >> Andreas.
> >>
> >> --
> >> Andreas Schwab, SUSE Labs, schwab@suse.de
> >> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
> >> "And now for something completely different."
> >
> > Thanks!
> > The problem is in wrong mboolean vector size in case target cannot provide a mode for it. I tested it on i386 with vector extension switched off, but with extensions off vector modes still exist, thus I missed this case. Here is a patch to fix it. Bootstrapped and regtested on powerpc64le-unknown-linux-gnu. I see disappeared fails:
> >
> > gcc.c-torture/compile/pr54713-2.c -O0 (test for excess errors)
> > gcc.c-torture/compile/pr54713-3.c -O0 (test for excess errors)
> >
> > I believe other targets should be fixed as well.
> >
> > Thanks,
> > Ilya
> > --
> > gcc/
> >
> > 2015-10-22 Ilya Enkovich <enkovich.gnu@gmail.com>
> >
> > * tree.c (build_truth_vector_type): Support BLK mode
> > returned for boolean vector.
> >
> >
> > diff --git a/gcc/tree.c b/gcc/tree.c
> > index 7d10dd6..836b69a 100644
> > --- a/gcc/tree.c
> > +++ b/gcc/tree.c
> > @@ -10654,8 +10654,12 @@ build_truth_vector_type (unsigned nunits, unsigned vector_size)
> >
> > gcc_assert (mask_mode != VOIDmode);
> >
> > - unsigned HOST_WIDE_INT esize = GET_MODE_BITSIZE (mask_mode) / nunits;
> > - gcc_assert (esize * nunits == GET_MODE_BITSIZE (mask_mode));
> > + unsigned HOST_WIDE_INT vsize = GET_MODE_BITSIZE (mask_mode);
> > + if (!vsize)
>
> This should better check for mask_mode == BLKmode instead?
Here is a version with BLKmode check. I bootstrapped it on powerpc64le-unknown-linux-gnu (c,c++,fotran only) and checked pr54713-2.c, pr54713-3.c are fixed by this patch. Is it OK for trunk?
Thanks,
Ilya
--
gcc/
2015-10-23 Ilya Enkovich <enkovich.gnu@gmail.com>
PR middle-end/68066
* tree.c (build_truth_vector_type): Support BLK mode
returned for boolean vector.
diff --git a/gcc/tree.c b/gcc/tree.c
index 09df67e..79bbd07 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -10671,8 +10671,14 @@ build_truth_vector_type (unsigned nunits, unsigned vector_size)
gcc_assert (mask_mode != VOIDmode);
- unsigned HOST_WIDE_INT esize = GET_MODE_BITSIZE (mask_mode) / nunits;
- gcc_assert (esize * nunits == GET_MODE_BITSIZE (mask_mode));
+ unsigned HOST_WIDE_INT vsize;
+ if (mask_mode == BLKmode)
+ vsize = vector_size * BITS_PER_UNIT;
+ else
+ vsize = GET_MODE_BITSIZE (mask_mode);
+
+ unsigned HOST_WIDE_INT esize = vsize / nunits;
+ gcc_assert (esize * nunits == vsize);
tree bool_type = build_nonstandard_boolean_type (esize);