This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Boolean Vector, patch 1/5] Introduce boolean vector to be used as a vector comparison type


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);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]