This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Testcase for nonzero_bits & __builtin_unreachable
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Oct 2013 15:54:31 +0100 (CET)
- Subject: Re: [PATCH] Testcase for nonzero_bits & __builtin_unreachable
- Authentication-results: sourceware.org; auth=none
- References: <20131025091925 dot GG30970 at tucnak dot zalov dot cz> <20131025173844 dot GK30970 at tucnak dot zalov dot cz> <20131025221933 dot GN30970 at tucnak dot zalov dot cz> <20131029072420 dot GU30970 at tucnak dot zalov dot cz>
On Tue, 29 Oct 2013, Jakub Jelinek wrote:
> On Sat, Oct 26, 2013 at 12:19:33AM +0200, Jakub Jelinek wrote:
> > And here is a patch that allows vectorization without peeling for alignment
> > and scalar loop for bound even for fn2, fn3 and fn4 in the following
> > testcase, though as with the range __builtin_unreachable () notes, it is
> > quite fragile, because it only works if there are no immediate uses of the
> > tested SSA_NAME before the assertion. Perhaps more reliable way would be to
> > convert those assertions info __builtin_assume_aligned, but that has the
> > disadvantage that it's first argument is a pointer and it returns a pointer,
> > so we'd need to cast integers to pointers and back, or add ASSUME_ALIGNED
> > internal function.
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux.
>
> And here is as a follow-up to the whole patchset of 4 patches a testcase:
Ok.
Thanks,
Richard.
> 2013-10-29 Jakub Jelinek <jakub@redhat.com>
>
> * gcc.dg/vect/vect-align-3.c: New test.
>
> --- gcc/testsuite/gcc.dg/vect/vect-align-3.c.jj 2013-10-29 08:18:08.636348586 +0100
> +++ gcc/testsuite/gcc.dg/vect/vect-align-3.c 2013-10-29 08:21:14.931384138 +0100
> @@ -0,0 +1,54 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target vect_int } */
> +
> +int a[2048];
> +
> +void
> +f1 (int x, int y)
> +{
> + int i;
> + x &= -256;
> + y &= -256;
> + for (i = x + 256; i < y; i++)
> + a[i]++;
> +}
> +
> +void
> +f2 (int x, int y)
> +{
> + int i;
> + if (x & 31)
> + __builtin_unreachable ();
> + if (y & 31)
> + __builtin_unreachable ();
> + for (i = x + 256; i < x + y; i++)
> + a[i]++;
> +}
> +
> +void
> +f3 (int x, int y)
> +{
> + int i;
> + if (x % 256)
> + __builtin_unreachable ();
> + if (y % 256)
> + __builtin_unreachable ();
> + for (i = x + 256; i < x + y; i++)
> + a[i]++;
> +}
> +
> +void
> +f4 (int x, int y)
> +{
> + int i;
> + if ((x % 256) != 0)
> + __builtin_unreachable ();
> + if ((y % 256) != 0)
> + __builtin_unreachable ();
> + for (i = x + 256; i < x + y; i++)
> + a[i]++;
> +}
> +
> +/* { dg-final { scan-tree-dump-not "vect_do_peeling_for_loop_bound" "vect" } } */
> +/* { dg-final { scan-tree-dump-not "loop peeled for vectorization" "vect" } } */
> +/* { dg-final { cleanup-tree-dump "vect" } } */
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend