diff mbox

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

Message ID 20151022162105.GB23452@msticlxl57.ims.intel.com
State New
Headers show

Commit Message

Ilya Enkovich Oct. 22, 2015, 4:21 p.m. UTC
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.

Comments

Jeff Law Oct. 22, 2015, 4:42 p.m. UTC | #1
On 10/22/2015 10:21 AM, Ilya Enkovich 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.
OK.
jeff
Richard Biener Oct. 23, 2015, 9:40 a.m. UTC | #2
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?

> +    vsize = vector_size * BITS_PER_UNIT;
> +
> +  unsigned HOST_WIDE_INT esize = vsize / nunits;
> +  gcc_assert (esize * nunits == vsize);
>
>    tree bool_type = build_nonstandard_boolean_type (esize);
>
diff mbox

Patch

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)
+    vsize = vector_size * BITS_PER_UNIT;
+
+  unsigned HOST_WIDE_INT esize = vsize / nunits;
+  gcc_assert (esize * nunits == vsize);
 
   tree bool_type = build_nonstandard_boolean_type (esize);